@keetanetwork/keetanet-client 0.10.5 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/api/index.d.ts +23 -7
  2. package/api/node.d.ts +27 -2
  3. package/api/vote.d.ts +4 -6
  4. package/client/builder.d.ts +17 -0
  5. package/client/client_common_tests.d.ts +1 -1
  6. package/client/index-browser.d.ts +112 -3
  7. package/client/index-browser.js +25358 -37208
  8. package/client/index.d.ts +112 -3
  9. package/client/index.js +3775 -6527
  10. package/config/index.d.ts +6 -1
  11. package/docs/assets/hierarchy.js +1 -1
  12. package/docs/assets/search.js +1 -1
  13. package/docs/classes/KeetaNetSDK.Client.html +31 -11
  14. package/docs/classes/KeetaNetSDK.Referenced.Account.html +31 -21
  15. package/docs/classes/KeetaNetSDK.Referenced.BaseSet.html +2 -2
  16. package/docs/classes/KeetaNetSDK.Referenced.Block.html +2 -4
  17. package/docs/classes/KeetaNetSDK.Referenced.BlockBuilder.html +1 -1
  18. package/docs/classes/KeetaNetSDK.Referenced.BlockHash.html +4 -5
  19. package/docs/classes/KeetaNetSDK.Referenced.BlockOperation.html +1 -1
  20. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationCREATE_IDENTIFIER.html +2 -2
  21. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMANAGE_CERTIFICATE.html +12 -0
  22. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMODIFY_PERMISSIONS.html +2 -2
  23. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationRECEIVE.html +2 -2
  24. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSEND.html +2 -2
  25. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_INFO.html +2 -2
  26. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_REP.html +2 -2
  27. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE.html +2 -2
  28. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_SUPPLY.html +2 -2
  29. package/docs/classes/{KeetaNetSDK.Referenced.src_lib_utils_certificate.Certificate.html → KeetaNetSDK.Referenced.Certificate.html} +12 -9
  30. package/docs/classes/KeetaNetSDK.Referenced.CertificateBundle.html +8 -0
  31. package/docs/classes/KeetaNetSDK.Referenced.CertificateHash.html +16 -0
  32. package/docs/classes/KeetaNetSDK.Referenced.ECDSAKeyPair.html +1 -1
  33. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1KeyPair.html +1 -1
  34. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PrivateKey.html +1 -1
  35. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PublicKey.html +1 -1
  36. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1Signature.html +1 -1
  37. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1KeyPair.html +1 -1
  38. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PrivateKey.html +1 -1
  39. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PublicKey.html +1 -1
  40. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1Signature.html +1 -1
  41. package/docs/classes/KeetaNetSDK.Referenced.ED25519KeyPair.html +1 -1
  42. package/docs/classes/KeetaNetSDK.Referenced.ED25519PrivateKey.html +1 -1
  43. package/docs/classes/KeetaNetSDK.Referenced.ED25519PublicKey.html +1 -1
  44. package/docs/classes/KeetaNetSDK.Referenced.ED25519Signature.html +1 -1
  45. package/docs/classes/KeetaNetSDK.Referenced.ExternalKeyPair.html +1 -1
  46. package/docs/classes/KeetaNetSDK.Referenced.ExternalSet.html +1 -1
  47. package/docs/classes/KeetaNetSDK.Referenced.IdentifierKey.html +1 -1
  48. package/docs/classes/KeetaNetSDK.Referenced.IdentifierKeyPair.html +4 -4
  49. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetError.html +1 -1
  50. package/docs/classes/KeetaNetSDK.Referenced.KeyInterface.html +1 -1
  51. package/docs/classes/KeetaNetSDK.Referenced.KeyStorage.html +1 -1
  52. package/docs/classes/KeetaNetSDK.Referenced.Ledger.html +4 -2
  53. package/docs/classes/KeetaNetSDK.Referenced.LedgerAtomicInterface.html +3 -1
  54. package/docs/classes/KeetaNetSDK.Referenced.LedgerRequestCache.html +1 -1
  55. package/docs/classes/KeetaNetSDK.Referenced.Node.html +1 -1
  56. package/docs/classes/KeetaNetSDK.Referenced.P2PSwitch.html +3 -3
  57. package/docs/classes/KeetaNetSDK.Referenced.PendingAccount.html +3 -2
  58. package/docs/classes/KeetaNetSDK.Referenced.PermissionSetHolder.html +1 -1
  59. package/docs/classes/KeetaNetSDK.Referenced.Permissions.html +2 -3
  60. package/docs/classes/KeetaNetSDK.Referenced.PossiblyExpiredVote.html +4 -3
  61. package/docs/classes/KeetaNetSDK.Referenced.RequestTiming.html +16 -2
  62. package/docs/classes/KeetaNetSDK.Referenced.SignatureStorage.html +1 -1
  63. package/docs/classes/KeetaNetSDK.Referenced.Stats.html +3 -2
  64. package/docs/classes/KeetaNetSDK.Referenced.UserClientBuilder.html +3 -2
  65. package/docs/classes/KeetaNetSDK.Referenced.Vote.html +4 -5
  66. package/docs/classes/KeetaNetSDK.Referenced.VoteBlockBundle.html +35 -0
  67. package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHash.html +1 -1
  68. package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHashMap.html +9 -8
  69. package/docs/classes/KeetaNetSDK.Referenced.VoteHash.html +1 -1
  70. package/docs/classes/KeetaNetSDK.Referenced.VoteStaple.html +23 -29
  71. package/docs/classes/KeetaNetSDK.Referenced.VoteStapleHash.html +1 -1
  72. package/docs/classes/KeetaNetSDK.Referenced.default.html +1 -1
  73. package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_asn1.BufferStorageASN1.html +1 -1
  74. package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer.BufferStorage.html +1 -1
  75. package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_certificate.CertificateBuilder.html +1 -1
  76. package/docs/classes/KeetaNetSDK.UserClient.html +57 -15
  77. package/docs/documents/GETTING-STARTED.html +5 -2
  78. package/docs/enums/KeetaNetSDK.Referenced.AccountKeyAlgorithm.html +2 -1
  79. package/docs/enums/KeetaNetSDK.Referenced.AdjustMethod.html +4 -4
  80. package/docs/enums/KeetaNetSDK.Referenced.BaseFlag.html +2 -1
  81. package/docs/enums/KeetaNetSDK.Referenced.OperationType.html +2 -1
  82. package/docs/functions/KeetaNetSDK.Referenced.src_config.getDefaultConfig.html +2 -2
  83. package/docs/functions/KeetaNetSDK.Referenced.src_config.getNetworkAlias.html +1 -1
  84. package/docs/functions/KeetaNetSDK.Referenced.src_config.getValidation.html +1 -1
  85. package/docs/functions/KeetaNetSDK.Referenced.src_config.isNetwork.html +1 -1
  86. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.objectToBuffer.html +1 -1
  87. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.toJSONSerializable.html +1 -1
  88. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.booleanEnv.html +1 -0
  89. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.nonNullable.html +1 -0
  90. package/docs/hierarchy.html +1 -1
  91. package/docs/interfaces/KeetaNetSDK.Referenced.ACLEntry.html +1 -1
  92. package/docs/interfaces/KeetaNetSDK.Referenced.ACLUpdate.html +1 -1
  93. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ExplicitContextTag.html +1 -1
  94. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ImplicitContextTag.html +1 -1
  95. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1Object.html +1 -1
  96. package/docs/interfaces/KeetaNetSDK.Referenced.BaseExternalKeyPairFunctions.html +1 -1
  97. package/docs/interfaces/KeetaNetSDK.Referenced.BaseGenerationConfig.html +1 -1
  98. package/docs/interfaces/KeetaNetSDK.Referenced.BlockCanonical.html +2 -2
  99. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSON.html +2 -2
  100. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperation.html +1 -1
  101. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationCREATE_IDENTIFIER.html +1 -1
  102. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATE.html +6 -0
  103. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATESerializable.html +5 -0
  104. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMODIFY_PERMISSIONS.html +1 -1
  105. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationRECEIVE.html +1 -1
  106. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSEND.html +1 -1
  107. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_INFO.html +1 -1
  108. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_REP.html +1 -1
  109. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
  110. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_SUPPLY.html +2 -2
  111. package/docs/interfaces/KeetaNetSDK.Referenced.BlockUnsignedCanonical.html +2 -2
  112. package/docs/interfaces/KeetaNetSDK.Referenced.CertificateWithIntermediates.html +3 -0
  113. package/docs/interfaces/KeetaNetSDK.Referenced.CertificateWithIntermediatesResponse.html +3 -0
  114. package/docs/interfaces/KeetaNetSDK.Referenced.ComputedBlocksEffectFields.html +3 -2
  115. package/docs/interfaces/KeetaNetSDK.Referenced.Constructor.html +1 -1
  116. package/docs/interfaces/KeetaNetSDK.Referenced.DisposableTimingHandle.html +7 -0
  117. package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsNoEncryption.html +1 -1
  118. package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsSupportsEncryption.html +1 -1
  119. package/docs/interfaces/KeetaNetSDK.Referenced.IdentifierCreateRequest.html +2 -2
  120. package/docs/interfaces/KeetaNetSDK.Referenced.InitialConfigSupply.html +1 -1
  121. package/docs/interfaces/KeetaNetSDK.Referenced.InstanceSet.html +13 -0
  122. package/docs/interfaces/KeetaNetSDK.Referenced.KVGenericOptionsType.html +2 -0
  123. package/docs/interfaces/KeetaNetSDK.Referenced.KVSetOptionsType.html +3 -2
  124. package/docs/interfaces/KeetaNetSDK.Referenced.KVStorageProviderAPI.html +2 -2
  125. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerConfig.html +4 -2
  126. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStatistics.html +3 -2
  127. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageAPI.html +15 -7
  128. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageTransactionBase.html +6 -0
  129. package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +1 -1
  130. package/docs/interfaces/KeetaNetSDK.Referenced.NodeConfig.html +3 -3
  131. package/docs/interfaces/KeetaNetSDK.Referenced.NumericValidationRule.html +3 -0
  132. package/docs/interfaces/KeetaNetSDK.Referenced.NumericValueEntry.html +1 -1
  133. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerBase.html +1 -1
  134. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerListener.html +1 -1
  135. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerRepBase.html +3 -3
  136. package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperations.html +3 -2
  137. package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperationsJSON.html +3 -2
  138. package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStorage.html +1 -1
  139. package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStringMapping.html +3 -2
  140. package/docs/interfaces/KeetaNetSDK.Referenced.RequestTokenReceiveEntry.html +1 -1
  141. package/docs/interfaces/KeetaNetSDK.Referenced.TokenNumericEntry.html +1 -1
  142. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientConfig.html +2 -2
  143. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientListenerOptions.html +2 -0
  144. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientOptions.html +1 -1
  145. package/docs/interfaces/KeetaNetSDK.Referenced.VoteBundleConstructor.html +6 -0
  146. package/docs/interfaces/KeetaNetSDK.Referenced.VoteStapleJSON.html +2 -2
  147. package/docs/interfaces/KeetaNetSDK.Referenced.WithIsInstance.html +1 -1
  148. package/docs/interfaces/KeetaNetSDK.Referenced.src_config.ValidationConfig.html +2 -2
  149. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1BitString.html +1 -1
  150. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Date.html +1 -1
  151. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1OID.html +1 -1
  152. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Set.html +1 -1
  153. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1String.html +1 -1
  154. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializableOptions.html +3 -0
  155. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_helper.InstanceSetConstructor.html +2 -2
  156. package/docs/modules/KeetaNetSDK.Referenced.html +1 -1
  157. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_certificate.html +1 -1
  158. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_conversion.html +1 -1
  159. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_helper.html +1 -1
  160. package/docs/types/KeetaNetSDK.Referenced.AccountKeyAlgorithmHex.html +8 -0
  161. package/docs/types/KeetaNetSDK.Referenced.AccountKeyAlgorithmHexReverse.html +1 -0
  162. package/docs/types/KeetaNetSDK.Referenced.AccountKeyAlgorithmHexToType.html +1 -0
  163. package/docs/types/KeetaNetSDK.Referenced.AddBinaryIfIncluded.html +1 -0
  164. package/docs/types/KeetaNetSDK.Referenced.BlockHashString.html +1 -0
  165. package/docs/types/KeetaNetSDK.Referenced.CertificateErrorCode.html +1 -0
  166. package/docs/types/KeetaNetSDK.Referenced.CertificateHashString.html +1 -0
  167. package/docs/types/KeetaNetSDK.Referenced.CertificateOptions.html +4 -4
  168. package/docs/types/KeetaNetSDK.Referenced.CertificateUpdate.html +2 -0
  169. package/docs/types/KeetaNetSDK.Referenced.ComputedEffectOfBlocks.html +3 -2
  170. package/docs/types/KeetaNetSDK.Referenced.DbStats.html +2 -0
  171. package/docs/types/KeetaNetSDK.Referenced.ErrorCode.html +1 -1
  172. package/docs/types/KeetaNetSDK.Referenced.ExportedJSONOperation.html +1 -0
  173. package/docs/types/KeetaNetSDK.Referenced.MultisigPublicKeyString.html +1 -0
  174. package/docs/types/KeetaNetSDK.Referenced.NodeLike-1.html +1 -0
  175. package/docs/types/KeetaNetSDK.Referenced.NodeLike.html +1 -1
  176. package/docs/types/KeetaNetSDK.Referenced.PublicKeyAndTypeStringHex.html +3 -0
  177. package/docs/types/KeetaNetSDK.Referenced.TimingData.html +2 -0
  178. package/docs/types/KeetaNetSDK.Referenced.TimingSectionHandle.html +6 -0
  179. package/docs/types/KeetaNetSDK.Referenced.src_config.NetworkConfig.html +1 -1
  180. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.Schema.html +1 -1
  181. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.SchemaMap.html +1 -1
  182. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_certificate.CertificateJSONOutput.html +1 -0
  183. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializable.html +1 -1
  184. package/docs/variables/KeetaNetSDK.Referenced.BlockErrorCodes-1.html +1 -0
  185. package/docs/variables/KeetaNetSDK.Referenced.BlockErrorCodes.html +1 -1
  186. package/docs/{types/KeetaNetSDK.Referenced.JSONUnsupportedTypes.html → variables/KeetaNetSDK.Referenced.CertificateErrorType.html} +1 -1
  187. package/docs/variables/KeetaNetSDK.Referenced.ClientErrorCodes.html +1 -1
  188. package/docs/variables/KeetaNetSDK.Referenced.KVErrorCodes.html +1 -1
  189. package/docs/variables/KeetaNetSDK.Referenced.Operation.html +2 -2
  190. package/docs/variables/KeetaNetSDK.Referenced.identifierKeyTypes.html +1 -1
  191. package/docs/variables/KeetaNetSDK.Referenced.src_config.networksArray.html +1 -1
  192. package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_helper.AsyncDisposableStack.html +2 -0
  193. package/lib/account.d.ts +68 -29
  194. package/lib/block/index.d.ts +53 -23
  195. package/lib/block/operations.d.ts +78 -33
  196. package/lib/error/block.d.ts +1 -1
  197. package/lib/error/certificate.d.ts +9 -0
  198. package/lib/error/client.d.ts +1 -1
  199. package/lib/error/index.d.ts +2 -1
  200. package/lib/error/kv.d.ts +1 -1
  201. package/lib/kv/index.d.ts +15 -8
  202. package/lib/kv/kv_redis.d.ts +18 -8
  203. package/lib/ledger/common.d.ts +13 -5
  204. package/lib/ledger/db_dynamodb.d.ts +22 -16
  205. package/lib/ledger/db_postgres.d.ts +10 -10
  206. package/lib/ledger/db_spanner.d.ts +26 -14
  207. package/lib/ledger/db_spanner_helper.d.ts +94 -109
  208. package/lib/ledger/db_sqlite.d.ts +10 -10
  209. package/lib/ledger/effects.d.ts +19 -4
  210. package/lib/ledger/index.d.ts +57 -12
  211. package/lib/ledger/types.d.ts +7 -1
  212. package/lib/node/local.d.ts +10 -1
  213. package/lib/node/timing.d.ts +44 -5
  214. package/lib/p2p.d.ts +6 -3
  215. package/lib/permissions.d.ts +3 -3
  216. package/lib/pubsub/index.d.ts +1 -1
  217. package/lib/pubsub/providers.d.ts +2 -0
  218. package/lib/pubsub/ps_gcp.d.ts +14 -0
  219. package/lib/stats.d.ts +5 -0
  220. package/lib/utils/asn1.d.ts +3 -3
  221. package/lib/utils/certificate.d.ts +75 -4
  222. package/lib/utils/conversion.d.ts +13 -35
  223. package/lib/utils/helper.d.ts +19 -8
  224. package/lib/utils/helper_testing.d.ts +1 -1
  225. package/lib/vote.d.ts +73 -55
  226. package/package.json +2 -3
  227. package/version.d.ts +1 -1
  228. package/docs/classes/KeetaNetSDK.Referenced.HTTPAgentManager.html +0 -4
  229. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.RegisterSerializable.html +0 -2
  230. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOutput.html +0 -5
  231. package/docs/interfaces/KeetaNetSDK.Referenced.VoteJSONOutput.html +0 -4
  232. package/docs/interfaces/KeetaNetSDK.Referenced.WithConversionClass.html +0 -6
  233. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_helper.InstanceSet.html +0 -10
  234. package/docs/types/KeetaNetSDK.Referenced.JSONSupportedObject.html +0 -1
  235. package/docs/types/KeetaNetSDK.Referenced.JSONSupportedValue.html +0 -1
  236. package/docs/types/KeetaNetSDK.Referenced.Vote.html +0 -1
  237. package/docs/types/KeetaNetSDK.Referenced.VoteJSONOutput.html +0 -1
  238. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.JSONSupported.html +0 -1
  239. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializableOptions.html +0 -3
  240. package/docs/variables/KeetaNetSDK.Referenced.default.html +0 -3
package/api/index.d.ts CHANGED
@@ -7,17 +7,13 @@ declare const rootTree: {
7
7
  blocks: string[];
8
8
  votes?: string[];
9
9
  }) => Promise<{
10
- vote: import("../lib/vote").VoteJSONOutput & {
11
- $binary: string;
12
- };
10
+ vote: import("../lib/vote").Vote;
13
11
  }>;
14
12
  };
15
13
  ':blockhash': {
16
14
  GET: (request: APIRequest, blockhash: string) => Promise<{
17
- blockhash: string;
18
- votes: (import("../lib/vote").VoteJSONOutput & {
19
- $binary: string;
20
- })[] | null;
15
+ blockhash: import("../lib/block").BlockHash;
16
+ votes: import("../lib/vote").Vote[] | null;
21
17
  }>;
22
18
  };
23
19
  };
@@ -125,6 +121,26 @@ declare const rootTree: {
125
121
  }>;
126
122
  };
127
123
  };
124
+ certificates: {
125
+ GET: (request: APIRequest, account: string) => Promise<{
126
+ account: string;
127
+ certificates: {
128
+ certificate: string;
129
+ intermediates: string[] | null;
130
+ }[];
131
+ }>;
132
+ ':certificateHash': {
133
+ GET: (request: APIRequest, account: string, certificateHash: string) => Promise<{
134
+ certificate: string;
135
+ intermediates: string[] | null;
136
+ account: string;
137
+ } | {
138
+ certificate: null;
139
+ intermediates: null;
140
+ account: string;
141
+ }>;
142
+ };
143
+ };
128
144
  pending: {
129
145
  GET: (request: APIRequest, account: string) => Promise<{
130
146
  account: string;
package/api/node.d.ts CHANGED
@@ -10,7 +10,10 @@ import type { VoteStaple } from '../lib/vote';
10
10
  interface GetPeersAPIResponse {
11
11
  kind: NodeKind;
12
12
  key?: string;
13
- endpoint?: string;
13
+ endpoints?: {
14
+ p2p: string;
15
+ api: string;
16
+ };
14
17
  signature?: string;
15
18
  }
16
19
  interface GetAccountChainAPIResponse {
@@ -56,7 +59,7 @@ interface PrincipalACLWithInfoResponse {
56
59
  }
57
60
  interface GetAccountHistoryResponse {
58
61
  history: {
59
- voteStaple: ReturnType<typeof VoteStaple['toJSONSerializable']>;
62
+ voteStaple: VoteStaple;
60
63
  '$id': string;
61
64
  '$timestamp': string;
62
65
  }[];
@@ -97,6 +100,22 @@ declare function getAllBalances(request: APIRequest, account: string | GenericAc
97
100
  account: GenericAccount;
98
101
  balances: GetAllBalancesResponse;
99
102
  }>;
103
+ declare function getAccountCertificates(request: APIRequest, account: string): Promise<{
104
+ account: string;
105
+ certificates: {
106
+ certificate: string;
107
+ intermediates: string[] | null;
108
+ }[];
109
+ }>;
110
+ declare function getCertificateByHash(request: APIRequest, account: string, certificateHash: string): Promise<{
111
+ certificate: string;
112
+ intermediates: string[] | null;
113
+ account: string;
114
+ } | {
115
+ certificate: null;
116
+ intermediates: null;
117
+ account: string;
118
+ }>;
100
119
  declare function getAccountState(request: APIRequest, pubKey: string): Promise<AccountState | AccountStateError>;
101
120
  declare function getBlockByHash(request: APIRequest, blockhash: string): Promise<{
102
121
  blockhash: string;
@@ -192,6 +211,12 @@ declare const _default: {
192
211
  GET: typeof listACLsByPrincipal;
193
212
  };
194
213
  };
214
+ certificates: {
215
+ GET: typeof getAccountCertificates;
216
+ ':certificateHash': {
217
+ GET: typeof getCertificateByHash;
218
+ };
219
+ };
195
220
  pending: {
196
221
  GET: typeof getAccountPendingBlock;
197
222
  };
package/api/vote.d.ts CHANGED
@@ -1,18 +1,16 @@
1
1
  import type { APIRequest } from '.';
2
2
  import KeetaNet from '../lib';
3
3
  type Vote = InstanceType<typeof KeetaNet['Vote']>;
4
- type VoteJSONOutput = ReturnType<Vote['toJSON']> & {
5
- '$binary': string;
6
- };
4
+ type BlockHash = InstanceType<typeof KeetaNet['Block']['Hash']>;
7
5
  declare function createNewVote(request: APIRequest, payload: {
8
6
  blocks: string[];
9
7
  votes?: string[];
10
8
  }): Promise<{
11
- vote: VoteJSONOutput;
9
+ vote: Vote;
12
10
  }>;
13
11
  declare function getVotes(request: APIRequest, blockhash: string): Promise<{
14
- blockhash: string;
15
- votes: VoteJSONOutput[] | null;
12
+ blockhash: BlockHash;
13
+ votes: Vote[] | null;
16
14
  }>;
17
15
  declare const _default: {
18
16
  _root: {
@@ -2,10 +2,12 @@ import type { GenericAccount, IdentifierKeyAlgorithm } from '../lib/account';
2
2
  import { Account, AccountKeyAlgorithm } from '../lib/account';
3
3
  import type { AdjustMethod, BlockHash } from '../lib/block';
4
4
  import { Block } from '../lib/block';
5
+ import type { BlockJSONOperations } from '../lib/block/operations';
5
6
  import type { AccountInfo } from '../lib/ledger/types';
6
7
  import type { AcceptedPermissionTypes } from '../lib/permissions';
7
8
  import type { UserClient } from '.';
8
9
  import { Permissions } from '../lib/permissions';
10
+ import { Certificate, CertificateBundle } from '../lib/utils/certificate';
9
11
  type GetPrevFunction = (acct: GenericAccount | string) => Promise<BlockHash | string | null | undefined>;
10
12
  interface AccountSignerOptions {
11
13
  account: GenericAccount;
@@ -48,6 +50,9 @@ interface IdentifierCreateRequest {
48
50
  }
49
51
  type AccountOrPending<Type extends AccountKeyAlgorithm = AccountKeyAlgorithm> = Account<Type> | PendingAccount<Type>;
50
52
  type TokenOrPending = AccountOrPending<AccountKeyAlgorithm.TOKEN>;
53
+ export type ManageCertificateMethod = Extract<BlockJSONOperations, {
54
+ type: typeof Block['OperationType']['MANAGE_CERTIFICATE'];
55
+ }>['method'];
51
56
  export interface PendingOperations {
52
57
  receive?: {
53
58
  otherParty: AccountOrPending;
@@ -69,6 +74,11 @@ export interface PendingOperations {
69
74
  amount: bigint;
70
75
  token: TokenOrPending;
71
76
  }[];
77
+ modifyCertificates?: {
78
+ method: ManageCertificateMethod;
79
+ certificate: Certificate;
80
+ intermediateCertificates: CertificateBundle | null;
81
+ }[];
72
82
  permissionsChanges?: PerAccount<PerAccount<{
73
83
  method: AdjustMethod;
74
84
  permissions: Permissions;
@@ -99,6 +109,11 @@ export interface PendingOperationsJSON {
99
109
  amount: string;
100
110
  token: string;
101
111
  }[];
112
+ modifyCertificates?: {
113
+ method: ManageCertificateMethod;
114
+ certificate: string;
115
+ intermediateCertificates: string | null;
116
+ }[];
102
117
  permissionsChanges?: PerAccount<PerAccount<{
103
118
  method: AdjustMethod;
104
119
  permissions: [string, string];
@@ -138,6 +153,7 @@ export declare class PendingAccount<AccountType extends AccountKeyAlgorithm = Ac
138
153
  static GetValue<T extends AccountKeyAlgorithm>(data: AccountOrPending<T>): Account<T>;
139
154
  set account(account: Account<AccountType>);
140
155
  get account(): Account<AccountType>;
156
+ toJSON(): Account<AccountType>;
141
157
  }
142
158
  type AllPending = [AccountSignerOptions, PendingOperations][];
143
159
  export declare class UserClientBuilder {
@@ -158,6 +174,7 @@ export declare class UserClientBuilder {
158
174
  send(recipient: AccountOrPending, amount: bigint, token: TokenOrPending, external?: string, options?: BuilderBlockOptions): void;
159
175
  receive(from: AccountOrPending, amount: bigint, token: TokenOrPending, exact?: boolean, forward?: GenericAccount, options?: BuilderBlockOptions): void;
160
176
  updatePermissions(principal: GenericAccount, permissions: AcceptedPermissionTypes, target?: GenericAccount, method?: AdjustMethod, options?: BuilderBlockOptions): void;
177
+ modifyCertificate(method: ManageCertificateMethod, certificate: Certificate, intermediateCertificates?: CertificateBundle | null, options?: BuilderBlockOptions): void;
161
178
  modifyTokenSupply(amount: bigint, options?: BuilderBlockOptions): void;
162
179
  modifyTokenBalance(token: TokenOrPending, amount: bigint, isSet?: boolean, options?: BuilderBlockOptions): void;
163
180
  setInfo(info: AccountInfo, options?: BuilderBlockOptions): void;
@@ -39,7 +39,7 @@ export declare function setup(options?: NodeCreationOptions): Promise<{
39
39
  declare function runBasicTests(nodes: LocalNode[], userClient: UserClient, trustedClient: UserClient, params: ClientParams, expect: any, _ignoreExpectErrorCode: any): Promise<void>;
40
40
  declare function runBuilderStorageTests(_ignoreNodes: LocalNode[], userClient: UserClient, trustedClient: UserClient, params: ClientParams, expect: any, ExpectErrorCode: any): Promise<void>;
41
41
  declare function runRecoverAccountTest(nodes: LocalNode[], userClient: UserClient, trustedClient: UserClient, params: ClientParams, expect: any, ExpectErrorCode: any): Promise<void>;
42
- declare function runNonNodeTests(_ignore_nodes: LocalNode[], _ignore_userClient: UserClient, _ignore_trustedClient: UserClient, _ignore_params: ClientParams, expect: any, _ignore_ExpectErrorCode: any): Promise<void>;
42
+ declare function runNonNodeTests(_ignore_nodes: LocalNode[], _ignore_userClient: UserClient, _ignore_trustedClient: UserClient, _ignore_params: ClientParams, expect: any, ExpectErrorCode: any): Promise<void>;
43
43
  declare function runErrorTests(nodes: LocalNode[], userClientAccount1: UserClient, trustedClient: UserClient, params: ClientParams, expect: any, ExpectErrorCode: any): Promise<void>;
44
44
  export declare const clientTests: {
45
45
  'Basic Client Tests': {
@@ -15,13 +15,15 @@ import type { AdjustMethod } from '../lib/block';
15
15
  import Block, { BlockHash } from '../lib/block';
16
16
  import type { P2PSwitchStatistics } from '../lib/p2p';
17
17
  import * as Config from '../config';
18
- import type { BuilderOptions } from './builder';
18
+ import type { BuilderOptions, ManageCertificateMethod } from './builder';
19
19
  import { UserClientBuilder } from './builder';
20
20
  import { KeetaNetError } from '../lib/error';
21
21
  import type { AccountInfo, GetAllBalancesResponse, ACLRow, LedgerStatistics } from '../lib/ledger/types';
22
22
  import type { LedgerSelector, LedgerStorage } from '../lib/ledger';
23
23
  import type { AcceptedPermissionTypes } from '../lib/permissions';
24
24
  import { type BlockOperations } from '../lib/block/operations';
25
+ import { Certificate } from '../lib/utils/certificate';
26
+ import { CertificateBundle, type CertificateHash } from '../lib/utils/certificate';
25
27
  type Vote = InstanceType<typeof KeetaNet['Vote']>;
26
28
  type VoteStaple = InstanceType<typeof KeetaNet['Vote']['Staple']>;
27
29
  type VoteBlocksHash = Vote['blocksHash'];
@@ -113,6 +115,10 @@ interface PrincipalACLWithInfoParsed {
113
115
  */
114
116
  balances: GetAllBalancesResponse;
115
117
  }
118
+ interface CertificateWithIntermediatesResponse {
119
+ certificate: Certificate;
120
+ intermediates: CertificateBundle | null;
121
+ }
116
122
  /**
117
123
  */
118
124
  interface UserClientOptions {
@@ -217,6 +223,10 @@ export declare class Client {
217
223
  * by the application.
218
224
  */
219
225
  logger: Pick<Console, "error" | "log" | "warn">;
226
+ /**
227
+ * Indication of whether or not this client has been destroyed.
228
+ */
229
+ destroyed: boolean;
220
230
  private static updateRepsInterval;
221
231
  /**
222
232
  * Stats for this instance of the client
@@ -278,6 +288,14 @@ export declare class Client {
278
288
  * any resources used by the instance and stop any background tasks.
279
289
  */
280
290
  destroy(): Promise<void>;
291
+ /**
292
+ * This enables the use of `using` to automatically clean up the
293
+ * instance of the {@link Client} class when it is no longer needed.
294
+ *
295
+ * It calls the {@link destroy}() method to clean up the instance when
296
+ * it goes out of scope.
297
+ */
298
+ [Symbol.asyncDispose](): Promise<void>;
281
299
  /**
282
300
  * Create a new instance of the {@link UserClientBuilder} class. This
283
301
  * is a convenience method to create a new instance of the builder
@@ -425,6 +443,23 @@ export declare class Client {
425
443
  * for each token the user holds a balance for
426
444
  */
427
445
  getAllBalances(account: GenericAccount | string): Promise<GetAllBalancesResponse>;
446
+ /**
447
+ * List all certificates for a given account. This will return
448
+ * all certificates that have been added by and issued to the account, including
449
+ * any intermediate certificates that have been issued.
450
+ * @param account Account to lookup certificates for
451
+ * @returns An array of objects containing the certificate and any intermediates associated with the specified account
452
+ */
453
+ getAllCertificates(account: GenericAccount | string): Promise<CertificateWithIntermediatesResponse[]>;
454
+ /**
455
+ * Get a certificate by its hash for a given account. This will return
456
+ * the certificate and any intermediate certificates that have been issued.
457
+ *
458
+ * @param account The account to get the certificate for
459
+ * @param certificateHash The hash of the certificate to get
460
+ * @return The certificate and any intermediates or null if the certificate was not found
461
+ */
462
+ getCertificateByHash(account: GenericAccount | string, certificateHash: string | CertificateHash): Promise<CertificateWithIntermediatesResponse | null>;
428
463
  /**
429
464
  * Get the current head block for a given account. This will return the
430
465
  * entire block, or null if the account has not created any blocks.
@@ -504,11 +539,13 @@ export declare class Client {
504
539
  * @param account The account to get the chain for
505
540
  * @param options The options to use for the request
506
541
  * @param options.startBlock The block hash to start from -- this is used to paginate the request
542
+ * @param options.endBlock The block hash to stop on -- this is used to limit the chain to a specific range of blocks
507
543
  * @param options.depth The maximum number of blocks to return -- this is used to limit the number of blocks returned
508
544
  * @return The chain of blocks for the given account, in reverse order starting with the most recent block
509
545
  */
510
546
  getChain(account: GenericAccount | string, options?: {
511
547
  startBlock?: BlockHash | string;
548
+ endBlock?: BlockHash | string;
512
549
  depth?: number;
513
550
  }): Promise<Block[]>;
514
551
  /**
@@ -589,6 +626,7 @@ export declare class Client {
589
626
  blockCount: number;
590
627
  transactionCount: number;
591
628
  representativeCount: number;
629
+ db: import("../lib/stats").DbStats;
592
630
  settlementTimes: import("../lib/stats").TimeStats;
593
631
  };
594
632
  switch: {
@@ -682,6 +720,11 @@ interface UserClientListenerTypes {
682
720
  change: ((data: GetAccountStateAPIResponseFormatted) => void);
683
721
  }
684
722
  type UserClientEventName = keyof UserClientListenerTypes;
723
+ interface UserClientListenerOptions {
724
+ change: {
725
+ fallbackFrequency?: number;
726
+ };
727
+ }
685
728
  /**
686
729
  * The UserClient class provides a high-level interface, user-oriented
687
730
  * interface to the Keeta network. It is designed to be easy to use and
@@ -717,6 +760,10 @@ export declare class UserClient {
717
760
  * The network address for the network this client is connected to.
718
761
  */
719
762
  readonly networkAddress: NetworkAddress;
763
+ /**
764
+ * Indication of whether or not this client has been destroyed.
765
+ */
766
+ destroyed: boolean;
720
767
  /**
721
768
  * Create an instance of the UserClient class from a specific
722
769
  * representative. This will use the given representative to
@@ -892,6 +939,59 @@ export declare class UserClient {
892
939
  publish: boolean;
893
940
  from: "publish-aid";
894
941
  }>;
942
+ /**
943
+ * Add a certificate for a account
944
+ *
945
+ * @param method The method to use for modifying the certificate: `ADD` for this signature
946
+ * @param certificate The certificate to modify, this should be a {@link Certificate} instance.
947
+ * @param intermediates The certificate bundle containing the intermediate certificates, or null if there are no intermediates.
948
+ * @param options The options to use for the request
949
+ * @returns The vote staple that was generated and whether it was able to be published
950
+ */
951
+ modifyCertificate(method: AdjustMethod.ADD, certificate: Certificate, intermediates: CertificateBundle | null, options?: UserClientOptions): Promise<Awaited<ReturnType<typeof this.publishBuilder>>>;
952
+ /**
953
+ * Remove a certificate from a account
954
+ *
955
+ * @param method The method to use for modifying the certificate, either `ADD` or `REMOVE`
956
+ * @param certificate The certificate to remove, this should be a {@link Certificate} or a {@link CertificateHash} instance.
957
+ * @param intermediates Because the `SUBTRACT` method is used to remove a certificate, intermediates are not needed and should not be defined.
958
+ * @param options The options to use for the request
959
+ * @returns The vote staple that was generated and whether it was able to be published
960
+ */
961
+ modifyCertificate(method: AdjustMethod.SUBTRACT, certificate: Certificate | CertificateHash, intermediates?: undefined, options?: UserClientOptions): Promise<Awaited<ReturnType<typeof this.publishBuilder>>>;
962
+ /**
963
+ * Add or remove a certificate for a account
964
+ *
965
+ * @param method The method to use for modifying the certificate, either `ADD` or `REMOVE`
966
+ * @param certificate The certificate to modify, this should be a {@link Certificate} instance.
967
+ * @param intermediates The certificate bundle containing the intermediate certificates, or null if there are no intermediates.
968
+ * @param options The options to use for the request
969
+ * @returns The vote staple that was generated and whether it was able to be published
970
+ */
971
+ modifyCertificate(method: ManageCertificateMethod, certificate: Certificate | CertificateHash, intermediates?: CertificateBundle | null, options?: UserClientOptions): Promise<Awaited<ReturnType<typeof this.publishBuilder>>>;
972
+ /**
973
+ * Get a single certificate for the account, by the certificate hash.
974
+ * @param certificateHash The hash of the certificate to get, or a {@link CertificateHash} instance.
975
+ * @param options The options to use for the request
976
+ * @return The found certificate, or null if no certificate was found.
977
+ */
978
+ getCertificates(certificateHash: string | CertificateHash, options?: UserClientOptions): Promise<CertificateWithIntermediatesResponse | null>;
979
+ /**
980
+ * List certificates for a account.
981
+ * @param options The options to use for the request
982
+ * @return The found certificates for the account
983
+ */
984
+ getCertificates(certificateHash?: undefined, options?: UserClientOptions): Promise<CertificateWithIntermediatesResponse[]>;
985
+ /**
986
+ * Get the certificates for the account. If a certificate hash is provided,
987
+ * then only that certificate will be returned, otherwise all certificates
988
+ * for the account will be returned.
989
+ * @param certificateHash The hash of the certificate to get, or a {@link CertificateHash} instance.
990
+ * If not provided, all certificates for the account will be returned.
991
+ * @param options The options to use for the request
992
+ * @return The certificate or certificates for the account, depending on whether a hash was provided.
993
+ */
994
+ getCertificates(certificateHash?: string | CertificateHash | undefined, options?: UserClientOptions): Promise<CertificateWithIntermediatesResponse | (CertificateWithIntermediatesResponse[]) | null>;
895
995
  /**
896
996
  * Send some tokens from this account to another account.
897
997
  *
@@ -915,7 +1015,7 @@ export declare class UserClient {
915
1015
  * @param options The options to use for the request
916
1016
  * @return The identifier that was generated
917
1017
  */
918
- generateIdentifier(type: IdentifierKeyAlgorithm, options?: UserClientOptions): Promise<import("./builder").PendingAccount<AccountKeyAlgorithm.NETWORK | AccountKeyAlgorithm.TOKEN | AccountKeyAlgorithm.STORAGE>>;
1018
+ generateIdentifier(type: IdentifierKeyAlgorithm, options?: UserClientOptions): Promise<import("./builder").PendingAccount<AccountKeyAlgorithm.NETWORK | AccountKeyAlgorithm.TOKEN | AccountKeyAlgorithm.STORAGE | AccountKeyAlgorithm.MULTISIG>>;
919
1019
  /**
920
1020
  * Update the permissions for a given account. This will publish the
921
1021
  * changes to the network.
@@ -1064,7 +1164,7 @@ export declare class UserClient {
1064
1164
  * Also set up long timeout polling for changes in case the websocket misses a change update
1065
1165
  * Check that parameters of function complies with respective event function
1066
1166
  */
1067
- on<EventName extends UserClientEventName>(event: EventName, handler: UserClientListenerTypes[EventName]): symbol;
1167
+ on<EventName extends UserClientEventName>(event: EventName, handler: UserClientListenerTypes[EventName], listenerOptions?: UserClientListenerOptions[EventName]): symbol;
1068
1168
  /**
1069
1169
  * Cancel a previously registered callback from {@link on}
1070
1170
  */
@@ -1073,6 +1173,15 @@ export declare class UserClient {
1073
1173
  * Destroy this instance -- this is required to clean up all resources.
1074
1174
  */
1075
1175
  destroy(): Promise<void>;
1176
+ /**
1177
+ * This enables the use of `using` to automatically clean up the
1178
+ * instance of the {@link UserClient} class when it is no longer
1179
+ * needed.
1180
+ *
1181
+ * It calls the {@link destroy}() method to clean up the instance when
1182
+ * it goes out of scope.
1183
+ */
1184
+ [Symbol.asyncDispose](): Promise<void>;
1076
1185
  /**
1077
1186
  * Get the configuration for this UserClient instance.
1078
1187
  */