@keetanetwork/keetanet-client 0.10.4 → 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 +28 -1
  6. package/client/index-browser.d.ts +129 -7
  7. package/client/index-browser.js +25383 -37128
  8. package/client/index.d.ts +129 -7
  9. package/client/index.js +3828 -6498
  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 +42 -13
  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 +60 -18
  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.ClientRepresentative.html +1 -1
  170. package/docs/types/KeetaNetSDK.Referenced.ComputedEffectOfBlocks.html +3 -2
  171. package/docs/types/KeetaNetSDK.Referenced.DbStats.html +2 -0
  172. package/docs/types/KeetaNetSDK.Referenced.ErrorCode.html +1 -1
  173. package/docs/types/KeetaNetSDK.Referenced.ExportedJSONOperation.html +1 -0
  174. package/docs/types/KeetaNetSDK.Referenced.MultisigPublicKeyString.html +1 -0
  175. package/docs/types/KeetaNetSDK.Referenced.NodeLike-1.html +1 -0
  176. package/docs/types/KeetaNetSDK.Referenced.NodeLike.html +1 -1
  177. package/docs/types/KeetaNetSDK.Referenced.PublicKeyAndTypeStringHex.html +3 -0
  178. package/docs/types/KeetaNetSDK.Referenced.TimingData.html +2 -0
  179. package/docs/types/KeetaNetSDK.Referenced.TimingSectionHandle.html +6 -0
  180. package/docs/types/KeetaNetSDK.Referenced.src_config.NetworkConfig.html +3 -3
  181. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.Schema.html +1 -1
  182. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.SchemaMap.html +1 -1
  183. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_certificate.CertificateJSONOutput.html +1 -0
  184. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializable.html +1 -1
  185. package/docs/variables/KeetaNetSDK.Referenced.BlockErrorCodes-1.html +1 -0
  186. package/docs/variables/KeetaNetSDK.Referenced.BlockErrorCodes.html +1 -1
  187. package/docs/{types/KeetaNetSDK.Referenced.JSONUnsupportedTypes.html → variables/KeetaNetSDK.Referenced.CertificateErrorType.html} +1 -1
  188. package/docs/variables/KeetaNetSDK.Referenced.ClientErrorCodes.html +1 -1
  189. package/docs/variables/KeetaNetSDK.Referenced.KVErrorCodes.html +1 -1
  190. package/docs/variables/KeetaNetSDK.Referenced.Operation.html +2 -2
  191. package/docs/variables/KeetaNetSDK.Referenced.identifierKeyTypes.html +1 -1
  192. package/docs/variables/KeetaNetSDK.Referenced.src_config.networksArray.html +1 -1
  193. package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_helper.AsyncDisposableStack.html +2 -0
  194. package/lib/account.d.ts +68 -29
  195. package/lib/block/index.d.ts +53 -23
  196. package/lib/block/operations.d.ts +78 -33
  197. package/lib/error/block.d.ts +1 -1
  198. package/lib/error/certificate.d.ts +9 -0
  199. package/lib/error/client.d.ts +1 -1
  200. package/lib/error/index.d.ts +2 -1
  201. package/lib/error/kv.d.ts +1 -1
  202. package/lib/kv/index.d.ts +15 -8
  203. package/lib/kv/kv_redis.d.ts +18 -8
  204. package/lib/ledger/common.d.ts +13 -5
  205. package/lib/ledger/db_dynamodb.d.ts +22 -16
  206. package/lib/ledger/db_postgres.d.ts +10 -10
  207. package/lib/ledger/db_spanner.d.ts +26 -14
  208. package/lib/ledger/db_spanner_helper.d.ts +94 -109
  209. package/lib/ledger/db_sqlite.d.ts +10 -10
  210. package/lib/ledger/effects.d.ts +19 -4
  211. package/lib/ledger/index.d.ts +57 -12
  212. package/lib/ledger/types.d.ts +7 -1
  213. package/lib/node/local.d.ts +10 -1
  214. package/lib/node/timing.d.ts +44 -5
  215. package/lib/p2p.d.ts +6 -3
  216. package/lib/permissions.d.ts +3 -3
  217. package/lib/pubsub/index.d.ts +1 -1
  218. package/lib/pubsub/providers.d.ts +2 -0
  219. package/lib/pubsub/ps_gcp.d.ts +14 -0
  220. package/lib/stats.d.ts +5 -0
  221. package/lib/utils/asn1.d.ts +3 -3
  222. package/lib/utils/certificate.d.ts +75 -4
  223. package/lib/utils/conversion.d.ts +13 -35
  224. package/lib/utils/helper.d.ts +19 -8
  225. package/lib/utils/helper_testing.d.ts +1 -1
  226. package/lib/vote.d.ts +73 -55
  227. package/package.json +2 -3
  228. package/version.d.ts +1 -1
  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/lib/account.d.ts CHANGED
@@ -16,7 +16,8 @@ export declare enum AccountKeyAlgorithm {
16
16
  NETWORK = 2,
17
17
  TOKEN = 3,
18
18
  STORAGE = 4,
19
- ECDSA_SECP256R1 = 6
19
+ ECDSA_SECP256R1 = 6,// NIST P-256
20
+ MULTISIG = 7
20
21
  }
21
22
  /**
22
23
  * Type for ASN.1 encoded public keys -- this is equivalent to {@link ValidateASN1.SchemaMap<typeof publicKeyASN1Schema>}
@@ -32,7 +33,55 @@ type publicKeyASN1 = [
32
33
  value: Buffer;
33
34
  }
34
35
  ];
35
- declare const identifierKeyTypes: readonly [AccountKeyAlgorithm.NETWORK, AccountKeyAlgorithm.TOKEN, AccountKeyAlgorithm.STORAGE];
36
+ /**
37
+ * Key pair types which we can process
38
+ */
39
+ type KeyPairTypes = ECDSAKeyPair | ECDSASECP256K1KeyPair | ECDSASECP256R1KeyPair | ED25519KeyPair | IdentifierKeyPair | ExternalKeyPair;
40
+ /**
41
+ * Generic interface to an account. An account may be backed by a private key
42
+ * (in which case it can sign data), a seed+index (which is used to generate
43
+ * a private key), or a public key (which can only verify blocks).
44
+ */
45
+ type PublicKeyStringPrefixed<X extends string> = `${AccountPrefix}${X}${string}`;
46
+ export type Secp256K1PublicKeyString = PublicKeyStringPrefixed<'aa' | 'ab' | 'ac' | 'ad'>;
47
+ export type Secp256R1PublicKeyString = PublicKeyStringPrefixed<'ay' | 'az' | 'a2' | 'a3'>;
48
+ export type ED25519PublicKeyString = PublicKeyStringPrefixed<'ae' | 'af' | 'ag' | 'ah'>;
49
+ export type NetworkPublicKeyString = PublicKeyStringPrefixed<'ai' | 'aj' | 'ak' | 'al'>;
50
+ export type TokenPublicKeyString = PublicKeyStringPrefixed<'am' | 'an' | 'ao' | 'ap'>;
51
+ export type StoragePublicKeyString = PublicKeyStringPrefixed<'aq' | 'ar' | 'as' | 'at'>;
52
+ export type MultisigPublicKeyString = PublicKeyStringPrefixed<'a4' | 'a5' | 'a6' | 'a7'>;
53
+ export interface PublicKeyStringMapping {
54
+ [AccountKeyAlgorithm.ECDSA_SECP256K1]: Secp256K1PublicKeyString;
55
+ [AccountKeyAlgorithm.ECDSA_SECP256R1]: Secp256R1PublicKeyString;
56
+ [AccountKeyAlgorithm.ED25519]: ED25519PublicKeyString;
57
+ [AccountKeyAlgorithm.TOKEN]: TokenPublicKeyString;
58
+ [AccountKeyAlgorithm.NETWORK]: NetworkPublicKeyString;
59
+ [AccountKeyAlgorithm.STORAGE]: StoragePublicKeyString;
60
+ [AccountKeyAlgorithm.MULTISIG]: MultisigPublicKeyString;
61
+ }
62
+ export type IdentifierPublicKeyString = PublicKeyStringMapping[IdentifierKeyAlgorithm];
63
+ export type AccountPublicKeyString = Secp256K1PublicKeyString | Secp256R1PublicKeyString | ED25519PublicKeyString;
64
+ type AccountKeyAlgorithmHex = {
65
+ [AccountKeyAlgorithm.ECDSA_SECP256K1]: '0x00';
66
+ [AccountKeyAlgorithm.ED25519]: '0x01';
67
+ [AccountKeyAlgorithm.TOKEN]: '0x02';
68
+ [AccountKeyAlgorithm.NETWORK]: '0x03';
69
+ [AccountKeyAlgorithm.STORAGE]: '0x04';
70
+ [AccountKeyAlgorithm.ECDSA_SECP256R1]: '0x06';
71
+ [AccountKeyAlgorithm.MULTISIG]: '0x07';
72
+ };
73
+ /**
74
+ * A hex-encoded public key and type, where the type is the first byte
75
+ * and the public key is the rest of the string.
76
+ */
77
+ export type PublicKeyAndTypeStringHex<Algo extends typeof AccountKeyAlgorithm[keyof typeof AccountKeyAlgorithm] = AccountKeyAlgorithm> = `${AccountKeyAlgorithmHex[Algo]}${string}`;
78
+ type AccountKeyAlgorithmHexReverse = {
79
+ [Hex in AccountKeyAlgorithmHex[keyof AccountKeyAlgorithmHex]]: Extract<keyof AccountKeyAlgorithmHex, {
80
+ [K in keyof AccountKeyAlgorithmHex]: AccountKeyAlgorithmHex[K] extends Hex ? K : never;
81
+ }[keyof AccountKeyAlgorithmHex]>;
82
+ };
83
+ type AccountKeyAlgorithmHexToType<T extends PublicKeyAndTypeStringHex> = T extends `0x${infer AlgorithmHex1}${infer AlgorithmHex2}${string}` ? `0x${AlgorithmHex1}${AlgorithmHex2}` extends keyof AccountKeyAlgorithmHexReverse ? AccountKeyAlgorithmHexReverse[`0x${AlgorithmHex1}${AlgorithmHex2}`] : never : never;
84
+ declare const identifierKeyTypes: readonly [AccountKeyAlgorithm.NETWORK, AccountKeyAlgorithm.TOKEN, AccountKeyAlgorithm.STORAGE, AccountKeyAlgorithm.MULTISIG];
36
85
  export type IdentifierKeyAlgorithm = typeof identifierKeyTypes[any];
37
86
  /**
38
87
  * Things we can use to construct a key from
@@ -324,31 +373,11 @@ declare class IdentifierKeyPair extends KeyInterface {
324
373
  decrypt(..._ignored_parameters: Parameters<decryptFunctionType>): ReturnType<decryptFunctionType>;
325
374
  }
326
375
  /**
327
- * Key pair types which we can process
328
- */
329
- type KeyPairTypes = ECDSAKeyPair | ECDSASECP256K1KeyPair | ECDSASECP256R1KeyPair | ED25519KeyPair | IdentifierKeyPair | ExternalKeyPair;
330
- /**
331
- * Generic interface to an account. An account may be backed by a private key
332
- * (in which case it can sign data), a seed+index (which is used to generate
333
- * a private key), or a public key (which can only verify blocks).
376
+ * Account class, which is used to represent a key pair or an identifier
377
+ * account (which have no private key) such as tokens.
378
+ *
379
+ * @template T - The type of the key algorithm used for this account.
334
380
  */
335
- type PublicKeyStringPrefixed<X extends string> = `${AccountPrefix}${X}${string}`;
336
- export type Secp256K1PublicKeyString = PublicKeyStringPrefixed<'aa' | 'ab' | 'ac' | 'ad'>;
337
- export type Secp256R1PublicKeyString = PublicKeyStringPrefixed<'ay' | 'az' | 'a2' | 'a3'>;
338
- export type ED25519PublicKeyString = PublicKeyStringPrefixed<'ae' | 'af' | 'ag' | 'ah'>;
339
- export type NetworkPublicKeyString = PublicKeyStringPrefixed<'ai' | 'aj' | 'ak' | 'al'>;
340
- export type TokenPublicKeyString = PublicKeyStringPrefixed<'am' | 'an' | 'ao' | 'ap'>;
341
- export type StoragePublicKeyString = PublicKeyStringPrefixed<'aq' | 'ar' | 'as' | 'at'>;
342
- export interface PublicKeyStringMapping {
343
- [AccountKeyAlgorithm.ECDSA_SECP256K1]: Secp256K1PublicKeyString;
344
- [AccountKeyAlgorithm.ECDSA_SECP256R1]: Secp256R1PublicKeyString;
345
- [AccountKeyAlgorithm.ED25519]: ED25519PublicKeyString;
346
- [AccountKeyAlgorithm.TOKEN]: TokenPublicKeyString;
347
- [AccountKeyAlgorithm.NETWORK]: NetworkPublicKeyString;
348
- [AccountKeyAlgorithm.STORAGE]: StoragePublicKeyString;
349
- }
350
- export type IdentifierPublicKeyString = PublicKeyStringMapping[IdentifierKeyAlgorithm];
351
- export type AccountPublicKeyString = Secp256K1PublicKeyString | Secp256R1PublicKeyString | ED25519PublicKeyString;
352
381
  export declare class Account<T extends AccountKeyAlgorithm = Exclude<AccountKeyAlgorithm, IdentifierKeyAlgorithm>> {
353
382
  #private;
354
383
  static AccountKeyAlgorithm: typeof AccountKeyAlgorithm;
@@ -360,6 +389,7 @@ export declare class Account<T extends AccountKeyAlgorithm = Exclude<AccountKeyA
360
389
  static fromPublicKeyString(key: TokenPublicKeyString): Account<AccountKeyAlgorithm.TOKEN>;
361
390
  static fromPublicKeyString(key: NetworkPublicKeyString): Account<AccountKeyAlgorithm.NETWORK>;
362
391
  static fromPublicKeyString(key: StoragePublicKeyString): Account<AccountKeyAlgorithm.STORAGE>;
392
+ static fromPublicKeyString(key: MultisigPublicKeyString): Account<AccountKeyAlgorithm.MULTISIG>;
363
393
  static fromPublicKeyString(key: Secp256K1PublicKeyString): Account<AccountKeyAlgorithm.ECDSA_SECP256K1>;
364
394
  static fromPublicKeyString(key: Secp256R1PublicKeyString): Account<AccountKeyAlgorithm.ECDSA_SECP256R1>;
365
395
  static fromPublicKeyString(key: ED25519PublicKeyString): Account<AccountKeyAlgorithm.ED25519>;
@@ -402,6 +432,10 @@ export declare class Account<T extends AccountKeyAlgorithm = Exclude<AccountKeyA
402
432
  * Construct an account from a storage identifier public key
403
433
  */
404
434
  static fromStoragePublicKey(key: InputKeyTypes): Account<AccountKeyAlgorithm.STORAGE>;
435
+ /**
436
+ * Construct an account from a multisig identifier public key
437
+ */
438
+ static fromMultisigPublicKey(key: InputKeyTypes): Account<AccountKeyAlgorithm.MULTISIG>;
405
439
  /**
406
440
  * Construct an account from an ED25519 public key.
407
441
  */
@@ -410,6 +444,8 @@ export declare class Account<T extends AccountKeyAlgorithm = Exclude<AccountKeyA
410
444
  * Construct an Account from an KeyType and Public Key buffer
411
445
  */
412
446
  static fromPublicKeyAndType(keyData: Buffer): GenericAccount;
447
+ static fromPublicKeyAndType<T extends AccountKeyAlgorithm>(keyData: PublicKeyAndTypeStringHex<T>): Account<T>;
448
+ static fromPublicKeyAndType(keyData: string): GenericAccount;
413
449
  /**
414
450
  * Construct a new account from a public key encoded in DER-encoded ASN.1
415
451
  */
@@ -453,6 +489,7 @@ export declare class Account<T extends AccountKeyAlgorithm = Exclude<AccountKeyA
453
489
  static toAccount(): undefined;
454
490
  static toAccount(acct: null): null;
455
491
  static toAccount(acct: undefined): undefined;
492
+ static toAccount<X extends PublicKeyAndTypeStringHex>(acct: X): Account<AccountKeyAlgorithmHexToType<X>>;
456
493
  static toAccount<toAlgo extends AccountKeyAlgorithm>(acct: string | Account<toAlgo>): Account<toAlgo>;
457
494
  static toAccount<toAlgo extends AccountKeyAlgorithm>(acct: string | Account<toAlgo> | null): Account<toAlgo> | null;
458
495
  static toAccount<toAlgo extends AccountKeyAlgorithm>(acct: string | Account<toAlgo> | undefined): Account<toAlgo> | undefined;
@@ -468,7 +505,7 @@ export declare class Account<T extends AccountKeyAlgorithm = Exclude<AccountKeyA
468
505
  static toPublicKeyString(acct: string | Account<AccountKeyAlgorithm> | undefined | null): string | undefined | null;
469
506
  static comparePublicKeys(acct1: Account<AccountKeyAlgorithm> | string | undefined | null, acct2: Account<AccountKeyAlgorithm> | string | undefined | null): boolean;
470
507
  static isInstance: (obj: any, strict?: boolean) => obj is Account<AccountKeyAlgorithm>;
471
- static Set: import("./utils/helper").InstanceSetConstructor<Account<AccountKeyAlgorithm>, string>;
508
+ static Set: import("./utils/helper").InstanceSetConstructor<Account<AccountKeyAlgorithm>, `0x00${string}` | `0x01${string}` | `0x03${string}` | `0x02${string}` | `0x04${string}` | `0x06${string}` | `0x07${string}`>;
472
509
  constructor(key: KeyPairTypes | ECDSASECP256K1PrivateKey | ECDSASECP256R1PrivateKey | ED25519PrivateKey | ECDSASECP256K1PublicKey | ECDSASECP256R1PublicKey | ED25519PublicKey | IdentifierKeyPair | IdentifierKey | PublicKeyString | Account<T>, requiredKeyType?: T);
473
510
  /**
474
511
  * Sign some data and generate a detached signature in SEC format
@@ -507,6 +544,7 @@ export declare class Account<T extends AccountKeyAlgorithm = Exclude<AccountKeyA
507
544
  */
508
545
  get publicKey(): ECDSASECP256K1PublicKey | ECDSASECP256R1PublicKey | ED25519PublicKey;
509
546
  get publicKeyAndType(): Buffer;
547
+ get publicKeyAndTypeString(): PublicKeyAndTypeStringHex<T>;
510
548
  /**
511
549
  * Determine if this account has a private key associated with it
512
550
  */
@@ -529,15 +567,16 @@ export declare class Account<T extends AccountKeyAlgorithm = Exclude<AccountKeyA
529
567
  isStorage(): this is Account<AccountKeyAlgorithm.STORAGE>;
530
568
  isNetwork(): this is Account<AccountKeyAlgorithm.NETWORK>;
531
569
  isToken(): this is Account<AccountKeyAlgorithm.TOKEN>;
570
+ isMultisig(): this is Account<AccountKeyAlgorithm.MULTISIG>;
532
571
  assertKeyType<KeyType extends AccountKeyAlgorithm>(keyType: KeyType): Account<KeyType>;
533
572
  assertAccount(): Account;
534
573
  assertIdentifier(): IdentifierAddress;
535
- static toJSONSerializablePrefix: string;
536
- static toJSONSerializable(value: GenericAccount): Secp256K1PublicKeyString | ED25519PublicKeyString | NetworkPublicKeyString | TokenPublicKeyString | StoragePublicKeyString | Secp256R1PublicKeyString;
574
+ toJSON(): PublicKeyStringMapping[T];
537
575
  }
538
576
  export type TokenAddress = Account<AccountKeyAlgorithm.TOKEN>;
539
577
  export type StorageAddress = Account<AccountKeyAlgorithm.STORAGE>;
540
578
  export type NetworkAddress = Account<AccountKeyAlgorithm.NETWORK>;
579
+ export type MultisigAddress = Account<AccountKeyAlgorithm.MULTISIG>;
541
580
  export type IdentifierAddress = Account<IdentifierKeyAlgorithm>;
542
581
  export type NonIdentifierAccount = Account<Exclude<AccountKeyAlgorithm, IdentifierKeyAlgorithm>>;
543
582
  export type GenericAccount = Account<AccountKeyAlgorithm>;
@@ -2,7 +2,7 @@ import type { GenericAccount } from '../account';
2
2
  import Account from '../account';
3
3
  import { BufferStorage } from '../utils/buffer';
4
4
  import * as ASN1 from '../utils/asn1';
5
- import type { JSONSupported, ToJSONSerializableOptions } from '../utils/conversion';
5
+ import type { ToJSONSerializable, ToJSONSerializableOptions } from '../utils/conversion';
6
6
  import * as Operations from './operations';
7
7
  export declare enum AdjustMethod {
8
8
  ADD = 0,
@@ -10,18 +10,21 @@ export declare enum AdjustMethod {
10
10
  SET = 2
11
11
  }
12
12
  export declare function assertAdjustMethod(value: any, bigintOkay?: boolean): AdjustMethod;
13
+ type BlockHashString = string & {
14
+ readonly __blockhash: never;
15
+ };
13
16
  /**
14
17
  * Block hash
15
18
  */
16
19
  export declare class BlockHash extends BufferStorage {
17
20
  static isInstance: (obj: any, strict?: boolean) => obj is BlockHash;
18
- static Set: import("../utils/helper").InstanceSetConstructor<BlockHash, string>;
21
+ static Set: import("../utils/helper").InstanceSetConstructor<BlockHash, BlockHashString>;
19
22
  static getAccountOpeningHash(account: GenericAccount): BlockHash;
20
23
  fromData(data: Buffer): BlockHash;
21
24
  get hashFunctionName(): string;
22
25
  constructor(blockhash: ConstructorParameters<typeof BufferStorage>[0]);
23
- static toJSONSerializablePrefix: string;
24
- static toJSONSerializable(value: BlockHash, _ignore_opts: ToJSONSerializableOptions): string;
26
+ toJSON(): BlockHashString;
27
+ toString(): BlockHashString;
25
28
  }
26
29
  /**
27
30
  * Network ID
@@ -39,7 +42,7 @@ type BlockSignature = Buffer;
39
42
  * Representation of the block
40
43
  */
41
44
  export interface BlockJSON {
42
- version: number;
45
+ version: 1;
43
46
  date: string | Date;
44
47
  previous: string | BlockHash;
45
48
  network: string | NetworkID;
@@ -53,17 +56,13 @@ export type BlockJSONIncomplete = Partial<BlockJSON>;
53
56
  /**
54
57
  * Output of block suitable to JSON serialization
55
58
  */
56
- export interface BlockJSONOutput extends JSONSupported<Omit<BlockJSON, 'operations'>> {
57
- operations: JSONSupported<Operations.BlockJSONOperations>[];
58
- $hash: string;
59
- $opening: boolean;
60
- }
59
+ export type BlockJSONOutput = ToJSONSerializable<ReturnType<Block['toJSON']>>;
61
60
  export type BlockJSONOutputIncomplete = Partial<BlockJSONOutput>;
62
61
  /**
63
62
  * Map input to our values
64
63
  */
65
64
  interface BlockUnsignedCanonical {
66
- version: number;
65
+ version: 1;
67
66
  date: Date;
68
67
  previous: BlockHash;
69
68
  account: GenericAccount;
@@ -95,11 +94,12 @@ export declare class Block implements BlockCanonical {
95
94
  TOKEN_ADMIN_SUPPLY: typeof Operations.BlockOperationTOKEN_ADMIN_SUPPLY;
96
95
  TOKEN_ADMIN_MODIFY_BALANCE: typeof Operations.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE;
97
96
  RECEIVE: typeof Operations.BlockOperationRECEIVE;
97
+ MANAGE_CERTIFICATE: typeof Operations.BlockOperationMANAGE_CERTIFICATE;
98
98
  };
99
99
  static NO_PREVIOUS: string;
100
100
  static AdjustMethod: typeof AdjustMethod;
101
101
  static Builder: typeof BlockBuilder;
102
- readonly version: number;
102
+ readonly version: 1;
103
103
  readonly date: Date;
104
104
  readonly previous: BlockHash;
105
105
  readonly account: GenericAccount;
@@ -116,7 +116,20 @@ export declare class Block implements BlockCanonical {
116
116
  static getAccountOpeningHash(account: GenericAccount): BlockHash;
117
117
  toBytes(includeSignature?: boolean): ArrayBuffer;
118
118
  protected static getASN1ContainerWithoutSignature(input: BlockUnsignedCanonical | BlockCanonical): BlockASN1WithoutSignature;
119
- toJSON(): BlockJSONOutput;
119
+ toJSON(options?: ToJSONSerializableOptions): {
120
+ $binary?: string;
121
+ version: 1;
122
+ date: Date;
123
+ previous: BlockHash;
124
+ account: GenericAccount;
125
+ signer: Account<import("../account").AccountKeyAlgorithm.ECDSA_SECP256K1 | import("../account").AccountKeyAlgorithm.ED25519 | import("../account").AccountKeyAlgorithm.ECDSA_SECP256R1>;
126
+ signature: string;
127
+ network: bigint;
128
+ subnet: bigint | undefined;
129
+ operations: Operations.ExportedJSONOperation[];
130
+ $hash: BlockHash;
131
+ $opening: boolean;
132
+ };
120
133
  /**
121
134
  * Hash of the block minus the signature
122
135
  *
@@ -126,13 +139,6 @@ export declare class Block implements BlockCanonical {
126
139
  * signature (which isn't signed)
127
140
  */
128
141
  get hash(): BlockHash;
129
- static toJSONSerializablePrefix: string;
130
- static toJSONSerializable(value: Block, opts: ToJSONSerializableOptions): {
131
- [x: string]: any;
132
- operations: JSONSupported<Operations.BlockJSONOperations>[];
133
- $hash: string;
134
- $opening: boolean;
135
- };
136
142
  }
137
143
  export declare class BlockBuilder implements BlockJSONIncomplete {
138
144
  #private;
@@ -148,13 +154,37 @@ export declare class BlockBuilder implements BlockJSONIncomplete {
148
154
  TOKEN_ADMIN_SUPPLY: typeof Operations.BlockOperationTOKEN_ADMIN_SUPPLY;
149
155
  TOKEN_ADMIN_MODIFY_BALANCE: typeof Operations.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE;
150
156
  RECEIVE: typeof Operations.BlockOperationRECEIVE;
157
+ MANAGE_CERTIFICATE: typeof Operations.BlockOperationMANAGE_CERTIFICATE;
151
158
  };
152
159
  static NO_PREVIOUS: string;
153
160
  constructor(block?: BlockJSONIncomplete | BlockJSON | Block | ArrayBuffer | string);
154
161
  protected get currentBlock(): Block | BlockJSONIncomplete;
155
162
  protected get currentWIP(): BlockJSONIncomplete;
156
163
  protected get currentBlockSealed(): Block;
157
- toJSON(): BlockJSONOutput | BlockJSONOutputIncomplete;
164
+ toJSON(opts?: ToJSONSerializableOptions): {
165
+ $binary?: string;
166
+ version: 1;
167
+ date: Date;
168
+ previous: BlockHash;
169
+ account: GenericAccount;
170
+ signer: Account<import("../account").AccountKeyAlgorithm.ECDSA_SECP256K1 | import("../account").AccountKeyAlgorithm.ED25519 | import("../account").AccountKeyAlgorithm.ECDSA_SECP256R1>;
171
+ signature: string;
172
+ network: bigint;
173
+ subnet: bigint | undefined;
174
+ operations: Operations.ExportedJSONOperation[];
175
+ $hash: BlockHash;
176
+ $opening: boolean;
177
+ } | {
178
+ version: 1 | undefined;
179
+ date: Date | undefined;
180
+ previous: BlockHash | undefined;
181
+ account: GenericAccount | undefined;
182
+ signer: Account<import("../account").AccountKeyAlgorithm.ECDSA_SECP256K1 | import("../account").AccountKeyAlgorithm.ED25519 | import("../account").AccountKeyAlgorithm.ECDSA_SECP256R1> | undefined;
183
+ network: bigint | undefined;
184
+ subnet: bigint | undefined;
185
+ operations: Operations.BlockOperations[] | undefined;
186
+ $opening: boolean | undefined;
187
+ };
158
188
  seal(): Promise<Block>;
159
189
  unseal(): BlockJSONIncomplete;
160
190
  get sealed(): boolean;
@@ -169,8 +199,8 @@ export declare class BlockBuilder implements BlockJSONIncomplete {
169
199
  get $opening(): boolean | undefined;
170
200
  set date(date: Date | string | undefined);
171
201
  get date(): Date | undefined;
172
- set version(version: number | undefined);
173
- get version(): number | undefined;
202
+ set version(version: 1 | undefined);
203
+ get version(): 1 | undefined;
174
204
  set network(network: NetworkID | string | undefined);
175
205
  get network(): NetworkID | undefined;
176
206
  set subnet(subnet: SubnetID | string | undefined);
@@ -4,8 +4,9 @@ import type { GenericAccount, IdentifierAddress, TokenAddress, TokenPublicKeyStr
4
4
  import Account from '../account';
5
5
  import type { AcceptedPermissionTypes } from '../permissions';
6
6
  import { Permissions } from '../permissions';
7
- import type { JSONSupported } from '../utils/conversion';
7
+ import type { ToJSONSerializable } from '../utils/conversion';
8
8
  import Block, { AdjustMethod } from '.';
9
+ import { Certificate, CertificateBundle, CertificateHash } from '../utils/certificate';
9
10
  /**
10
11
  * All supported operations
11
12
  */
@@ -17,7 +18,8 @@ export declare enum OperationType {
17
18
  CREATE_IDENTIFIER = 4,
18
19
  TOKEN_ADMIN_SUPPLY = 5,
19
20
  TOKEN_ADMIN_MODIFY_BALANCE = 6,
20
- RECEIVE = 7
21
+ RECEIVE = 7,
22
+ MANAGE_CERTIFICATE = 8
21
23
  }
22
24
  export type BlockOperationTypes = keyof typeof OperationType;
23
25
  /**
@@ -126,6 +128,22 @@ declare const BlockOperationASN1SchemaBase: {
126
128
  readonly name: "method";
127
129
  readonly schema: typeof ValidateASN1.IsInteger;
128
130
  }];
131
+ readonly MANAGE_CERTIFICATE: [{
132
+ readonly name: "method";
133
+ readonly schema: typeof ValidateASN1.IsInteger;
134
+ }, {
135
+ readonly name: "certificateOrHash";
136
+ readonly schema: typeof ValidateASN1.IsOctetString;
137
+ }, {
138
+ readonly name: "intermediateCertificates";
139
+ readonly schema: {
140
+ readonly optional: {
141
+ readonly choice: [typeof ValidateASN1.IsNull, {
142
+ readonly sequenceOf: typeof ValidateASN1.IsOctetString;
143
+ }];
144
+ };
145
+ };
146
+ }];
129
147
  };
130
148
  type ExtractSchemaFromBase<T extends {
131
149
  name: string;
@@ -142,15 +160,8 @@ export declare const BlockOperationASN1Schema: { [T in BlockOperationTypes]: {
142
160
  value: (typeof OperationType)[T];
143
161
  contains: DeepMutable<ExtractSchemaFromBase<(typeof BlockOperationASN1SchemaBase)[T]>>;
144
162
  }; };
145
- /**
146
- * Keys of the operations which we will serialize/deserialize
147
- */
148
- export declare const BlockOperationKeys: BlockOperationKeysType;
149
163
  export type BlockOperationASN1SchemaType<T extends BlockOperationTypes = BlockOperationTypes> = typeof BlockOperationASN1Schema[T];
150
- type BlockOperationKeysType = {
151
- [Property in BlockOperationTypes as `${Property}`]: string[];
152
- };
153
- interface BlockJSONOperation {
164
+ export interface BlockJSONOperation {
154
165
  type: OperationType;
155
166
  }
156
167
  interface BlockOperationValidateContext {
@@ -165,7 +176,7 @@ declare class BlockOperation {
165
176
  protected computeTo(to: string | GenericAccount, isIdentifier?: undefined): GenericAccount;
166
177
  protected computeAmount(amount: string | bigint): bigint;
167
178
  }
168
- interface BlockJSONOperationSEND extends BlockJSONOperation {
179
+ export interface BlockJSONOperationSEND extends BlockJSONOperation {
169
180
  type: OperationType.SEND;
170
181
  to: string | GenericAccount;
171
182
  amount: string | bigint;
@@ -185,9 +196,9 @@ declare class BlockOperationSEND extends BlockOperation implements BlockJSONOper
185
196
  set amount(amount: string | bigint);
186
197
  get amount(): bigint;
187
198
  validate(context: BlockOperationValidateContext): void;
188
- toJSON(): JSONSupported<BlockJSONOperationSEND>;
199
+ toJSON(): BlockJSONOperationSEND;
189
200
  }
190
- interface BlockJSONOperationRECEIVE extends BlockJSONOperation {
201
+ export interface BlockJSONOperationRECEIVE extends BlockJSONOperation {
191
202
  type: OperationType.RECEIVE;
192
203
  amount: string | bigint;
193
204
  token: TokenPublicKeyString | TokenAddress;
@@ -211,9 +222,9 @@ declare class BlockOperationRECEIVE extends BlockOperation implements BlockJSONO
211
222
  set amount(amount: string | bigint);
212
223
  get amount(): bigint;
213
224
  validate(context: BlockOperationValidateContext): void;
214
- toJSON(): JSONSupported<BlockJSONOperationSEND>;
225
+ toJSON(): BlockJSONOperationRECEIVE;
215
226
  }
216
- interface BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE extends BlockJSONOperation {
227
+ export interface BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE extends BlockJSONOperation {
217
228
  type: OperationType.TOKEN_ADMIN_MODIFY_BALANCE;
218
229
  token: TokenPublicKeyString | TokenAddress;
219
230
  amount: string | bigint;
@@ -231,12 +242,12 @@ declare class BlockOperationTOKEN_ADMIN_MODIFY_BALANCE extends BlockOperation im
231
242
  set amount(amount: string | bigint);
232
243
  get amount(): bigint;
233
244
  validate(context: BlockOperationValidateContext): void;
234
- toJSON(): JSONSupported<BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE>;
245
+ toJSON(): BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE;
235
246
  }
236
247
  /**
237
248
  * SetRep operation
238
249
  */
239
- interface BlockJSONOperationSET_REP extends BlockJSONOperation {
250
+ export interface BlockJSONOperationSET_REP extends BlockJSONOperation {
240
251
  type: OperationType.SET_REP;
241
252
  to: string | GenericAccount;
242
253
  }
@@ -248,12 +259,12 @@ declare class BlockOperationSET_REP extends BlockOperation implements BlockJSONO
248
259
  set to(to: string | Account);
249
260
  get to(): Account;
250
261
  validate(context: BlockOperationValidateContext): void;
251
- toJSON(): JSONSupported<BlockJSONOperationSET_REP>;
262
+ toJSON(): BlockJSONOperationSET_REP;
252
263
  }
253
264
  /**
254
265
  * TokenCreate Operation
255
266
  */
256
- interface BlockJSONOperationCREATE_IDENTIFIER extends BlockJSONOperation {
267
+ export interface BlockJSONOperationCREATE_IDENTIFIER extends BlockJSONOperation {
257
268
  type: OperationType.CREATE_IDENTIFIER;
258
269
  identifier: IdentifierAddress | string;
259
270
  }
@@ -265,12 +276,12 @@ declare class BlockOperationCREATE_IDENTIFIER extends BlockOperation implements
265
276
  set identifier(identifier: string | IdentifierAddress);
266
277
  get identifier(): IdentifierAddress;
267
278
  validate(context: BlockOperationValidateContext): void;
268
- toJSON(): JSONSupported<BlockJSONOperationCREATE_IDENTIFIER>;
279
+ toJSON(): BlockJSONOperationCREATE_IDENTIFIER;
269
280
  }
270
281
  /**
271
282
  * SetInfo operation
272
283
  */
273
- interface BlockJSONOperationSET_INFO extends BlockJSONOperation {
284
+ export interface BlockJSONOperationSET_INFO extends BlockJSONOperation {
274
285
  type: OperationType.SET_INFO;
275
286
  name: string;
276
287
  description: string;
@@ -291,12 +302,12 @@ declare class BlockOperationSET_INFO extends BlockOperation implements BlockJSON
291
302
  set defaultPermission(newPerms: Permissions | undefined);
292
303
  get defaultPermission(): Permissions | undefined;
293
304
  validate(context: BlockOperationValidateContext): void;
294
- toJSON(): JSONSupported<BlockJSONOperationSET_INFO>;
305
+ toJSON(): BlockJSONOperationSET_INFO;
295
306
  }
296
307
  /**
297
308
  * Set Permissions Operation
298
309
  */
299
- interface BlockJSONOperationMODIFY_PERMISSIONS extends BlockJSONOperation {
310
+ export interface BlockJSONOperationMODIFY_PERMISSIONS extends BlockJSONOperation {
300
311
  type: OperationType.MODIFY_PERMISSIONS;
301
312
  principal: string | GenericAccount;
302
313
  method: AdjustMethod;
@@ -317,15 +328,15 @@ declare class BlockOperationMODIFY_PERMISSIONS extends BlockOperation implements
317
328
  set method(method: AdjustMethod);
318
329
  get method(): AdjustMethod;
319
330
  validate(context: BlockOperationValidateContext): void;
320
- toJSON(): JSONSupported<BlockOperationMODIFY_PERMISSIONS>;
331
+ toJSON(): BlockJSONOperationMODIFY_PERMISSIONS;
321
332
  }
322
333
  /**
323
334
  * Token Supply operation
324
335
  */
325
- interface BlockJSONOperationTOKEN_ADMIN_SUPPLY extends BlockJSONOperation {
336
+ export interface BlockJSONOperationTOKEN_ADMIN_SUPPLY extends BlockJSONOperation {
326
337
  type: OperationType.TOKEN_ADMIN_SUPPLY;
327
338
  amount: bigint | string;
328
- method: Omit<AdjustMethod, AdjustMethod.SET>;
339
+ method: AdjustMethod.ADD | AdjustMethod.SUBTRACT;
329
340
  }
330
341
  declare class BlockOperationTOKEN_ADMIN_SUPPLY extends BlockOperation implements BlockJSONOperationTOKEN_ADMIN_SUPPLY {
331
342
  #private;
@@ -334,10 +345,36 @@ declare class BlockOperationTOKEN_ADMIN_SUPPLY extends BlockOperation implements
334
345
  constructor(input: BlockJSONOperationTOKEN_ADMIN_SUPPLY);
335
346
  set amount(amount: string | bigint);
336
347
  get amount(): bigint;
337
- set method(shouldAdd: AdjustMethod);
338
- get method(): AdjustMethod;
348
+ set method(shouldAdd: BlockJSONOperationTOKEN_ADMIN_SUPPLY['method']);
349
+ get method(): BlockJSONOperationTOKEN_ADMIN_SUPPLY['method'];
339
350
  validate(context: BlockOperationValidateContext): void;
340
- toJSON(): JSONSupported<BlockJSONOperationTOKEN_ADMIN_SUPPLY>;
351
+ toJSON(): BlockJSONOperationTOKEN_ADMIN_SUPPLY;
352
+ }
353
+ /**
354
+ * X.509 Certificate operations
355
+ */
356
+ export interface BlockJSONOperationMANAGE_CERTIFICATE extends BlockJSONOperation {
357
+ type: OperationType.MANAGE_CERTIFICATE;
358
+ certificateOrHash: string | Certificate | Buffer | CertificateHash;
359
+ intermediateCertificates?: string | CertificateBundle | Buffer | null;
360
+ method: Exclude<AdjustMethod, AdjustMethod.SET>;
361
+ }
362
+ export interface BlockJSONOperationMANAGE_CERTIFICATESerializable extends Omit<BlockJSONOperationMANAGE_CERTIFICATE, 'certificateOrHash' | 'intermediateCertificates'> {
363
+ certificateOrHash: string | Buffer;
364
+ intermediateCertificates?: string | Buffer | null;
365
+ }
366
+ declare class BlockOperationMANAGE_CERTIFICATE extends BlockOperation implements BlockJSONOperationMANAGE_CERTIFICATE {
367
+ #private;
368
+ type: OperationType.MANAGE_CERTIFICATE;
369
+ constructor(input: BlockJSONOperationMANAGE_CERTIFICATE);
370
+ get intermediateCertificates(): CertificateBundle | null | undefined;
371
+ set intermediateCertificates(bundle: ConstructorParameters<typeof CertificateBundle>[0] | null | undefined);
372
+ get certificateOrHash(): Certificate | CertificateHash;
373
+ set certificateOrHash(certificate: string | Certificate | CertificateHash | Buffer);
374
+ set method(shouldAdd: Exclude<AdjustMethod, AdjustMethod.SET>);
375
+ get method(): Exclude<AdjustMethod, AdjustMethod.SET>;
376
+ validate(context: BlockOperationValidateContext): void;
377
+ toJSON(): BlockJSONOperationMANAGE_CERTIFICATESerializable;
341
378
  }
342
379
  /**
343
380
  * Aggregate set of operations
@@ -351,18 +388,22 @@ export declare const Operation: {
351
388
  TOKEN_ADMIN_SUPPLY: typeof BlockOperationTOKEN_ADMIN_SUPPLY;
352
389
  TOKEN_ADMIN_MODIFY_BALANCE: typeof BlockOperationTOKEN_ADMIN_MODIFY_BALANCE;
353
390
  RECEIVE: typeof BlockOperationRECEIVE;
391
+ MANAGE_CERTIFICATE: typeof BlockOperationMANAGE_CERTIFICATE;
354
392
  };
355
- export type { BlockOperationSEND, BlockOperationSET_REP, BlockOperationSET_INFO, BlockOperationMODIFY_PERMISSIONS, BlockOperationCREATE_IDENTIFIER, BlockOperationTOKEN_ADMIN_SUPPLY, BlockOperationTOKEN_ADMIN_MODIFY_BALANCE, BlockOperationRECEIVE };
393
+ export type { BlockOperationSEND, BlockOperationSET_REP, BlockOperationSET_INFO, BlockOperationMODIFY_PERMISSIONS, BlockOperationCREATE_IDENTIFIER, BlockOperationTOKEN_ADMIN_SUPPLY, BlockOperationTOKEN_ADMIN_MODIFY_BALANCE, BlockOperationRECEIVE, BlockOperationMANAGE_CERTIFICATE };
356
394
  export type BlockOperations = InstanceType<typeof Operation[keyof typeof OperationType]>;
357
395
  export type BlockJSONOperations = ConstructorParameters<typeof Operation[keyof typeof OperationType]>[0];
358
- export declare function createBlockOperation(input: BlockJSONOperations): BlockOperationSEND | BlockOperationRECEIVE | BlockOperationTOKEN_ADMIN_MODIFY_BALANCE | BlockOperationSET_REP | BlockOperationSET_INFO | BlockOperationMODIFY_PERMISSIONS | BlockOperationCREATE_IDENTIFIER | BlockOperationTOKEN_ADMIN_SUPPLY;
396
+ export declare function createBlockOperation(input: BlockJSONOperations | ToJSONSerializable<BlockJSONOperations>): BlockOperationSEND | BlockOperationSET_REP | BlockOperationSET_INFO | BlockOperationMODIFY_PERMISSIONS | BlockOperationCREATE_IDENTIFIER | BlockOperationTOKEN_ADMIN_SUPPLY | BlockOperationTOKEN_ADMIN_MODIFY_BALANCE | BlockOperationRECEIVE | BlockOperationMANAGE_CERTIFICATE;
359
397
  export declare function isBlockOperation(input: any): input is BlockOperations;
398
+ export type ExportedJSONOperation = {
399
+ [K in keyof typeof Operation]: ToJSONSerializable<ReturnType<InstanceType<typeof Operation[K]>['toJSON']>>;
400
+ }[keyof typeof Operation];
360
401
  /**
361
402
  * Export the "operations" mapping as something compatible with being
362
403
  * serialized to JSON
363
404
  */
364
- export declare function ExportOperationsJSON(operations: BlockOperations[]): JSONSupported<BlockJSONOperations>[];
365
- export declare function ImportOperationsJSON(operations: BlockOperations[] | BlockJSONOperations[]): BlockOperations[];
405
+ export declare function ExportOperationsJSON(operations: BlockOperations[]): ExportedJSONOperation[];
406
+ export declare function ImportOperationsJSON(operations: (BlockOperations | BlockJSONOperations)[]): BlockOperations[];
366
407
  export declare function ExportBlockOperations(operations: BlockOperations[]): ((Omit<import("../utils/asn1").ASN1ContextTag, "kind" | "value" | "contains"> & {
367
408
  contains: [bigint, bigint];
368
409
  value: OperationType.TOKEN_ADMIN_SUPPLY;
@@ -371,6 +412,10 @@ export declare function ExportBlockOperations(operations: BlockOperations[]): ((
371
412
  contains: [Buffer, bigint, bigint];
372
413
  value: OperationType.TOKEN_ADMIN_MODIFY_BALANCE;
373
414
  kind: "explicit";
415
+ }) | (Omit<import("../utils/asn1").ASN1ContextTag, "kind" | "value" | "contains"> & {
416
+ contains: [bigint, Buffer, Buffer[] | null | undefined];
417
+ value: OperationType.MANAGE_CERTIFICATE;
418
+ kind: "explicit";
374
419
  }) | (Omit<import("../utils/asn1").ASN1ContextTag, "kind" | "value" | "contains"> & {
375
420
  contains: [Buffer, bigint, Buffer, (Omit<import("../utils/asn1").ASN1String, "kind"> & {
376
421
  kind: "utf8";
@@ -1,6 +1,6 @@
1
1
  import { KeetaNetError } from '.';
2
2
  declare const BlockErrorType: "BLOCK";
3
- declare const BlockErrorCodes: readonly ["INVALID_TYPE", "NO_MULTIPLE_SET_REP", "IDENTIFIER_NEED_DEFAULT_PERMISSIONS", "CANNOT_SEND_NON_TOKEN", "TOKEN_RECEIVE_DIFFERS", "ONLY_TOKEN_OP", "ONLY_IDENTIFIER_OP", "NO_TOKEN_OP", "NO_IDENTIFIER_OP", "IDENTIFIER_INVALID", "GENERAL_FIELD_INVALID", "PERMISSIONS_INVALID_DEFAULT", "PERMISSIONS_INVALID_ENTITY", "PERMISSIONS_INVALID_PRINCIPAL", "PERMISSIONS_INVALID_TARGET", "INVALID_ACCOUNT_TYPE", "NO_ADMIN_ON_TARGET", "PREVIOUS_SELF", "NO_DELEGATE_ADMIN", "NO_MODIFY_PERMISSION_DUPE", "CANNOT_FORWARD_TO_SELF", "EXACT_TRUE_WHEN_FORWARDING", "EXTERNAL_TOO_LONG", "EXTERNAL_INVALID", "EXTERNAL_MISSING"];
3
+ declare const BlockErrorCodes: readonly ["INVALID_TYPE", "INVALID_VERSION", "NO_MULTIPLE_SET_REP", "IDENTIFIER_NEED_DEFAULT_PERMISSIONS", "CANNOT_SEND_NON_TOKEN", "TOKEN_RECEIVE_DIFFERS", "ONLY_TOKEN_OP", "ONLY_IDENTIFIER_OP", "NO_TOKEN_OP", "NO_IDENTIFIER_OP", "NO_MULTISIG_OP", "IDENTIFIER_INVALID", "GENERAL_FIELD_INVALID", "PERMISSIONS_INVALID_DEFAULT", "PERMISSIONS_INVALID_ENTITY", "PERMISSIONS_INVALID_PRINCIPAL", "PERMISSIONS_INVALID_TARGET", "INVALID_ACCOUNT_TYPE", "NO_ADMIN_ON_TARGET", "PREVIOUS_SELF", "NO_DELEGATE_ADMIN", "NO_MODIFY_PERMISSION_DUPE", "CANNOT_FORWARD_TO_SELF", "EXACT_TRUE_WHEN_FORWARDING", "CERTIFICATE_SUBJECT_MISMATCH", "NO_DUPLICATE_CERTIFICATE_OPERATION", "INTERMEDIATE_CERTIFICATES_ONLY_ADD", "INVALID_CERTIFICATE_VALUE", "EXTERNAL_TOO_LONG", "EXTERNAL_INVALID", "EXTERNAL_MISSING", "SUPPLY_INVALID"];
4
4
  export type BlockErrorCode = `${typeof BlockErrorType}_${typeof BlockErrorCodes[number]}`;
5
5
  export default class KeetaNetBlockError extends KeetaNetError {
6
6
  static isInstance: (obj: any, strict?: boolean) => obj is KeetaNetBlockError;
@@ -0,0 +1,9 @@
1
+ import { KeetaNetError } from '.';
2
+ declare const CertificateErrorType: "CERTIFICATE";
3
+ declare const BlockErrorCodes: readonly ["DUPLICATE_INCLUDED", "ORPHAN_FOUND", "CYCLE_FOUND", "SECONDARY_GRAPH"];
4
+ export type CertificateErrorCode = `${typeof CertificateErrorType}_${typeof BlockErrorCodes[number]}`;
5
+ export default class KeetaNetCertificateError extends KeetaNetError {
6
+ static isInstance: (obj: any, strict?: boolean) => obj is KeetaNetCertificateError;
7
+ constructor(code: CertificateErrorCode, message: string);
8
+ }
9
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { KeetaNetError } from '.';
2
2
  declare const ClientErrorType: "CLIENT";
3
- declare const ClientErrorCodes: readonly ["BUILDER_AMOUNT_IS_ZERO", "BUILDER_CANNOT_READ_BEFORE_RENDER", "BUILDER_REQUIRES_PRIVATE_KEY", "BUILDER_USER_CLIENT_REQUIRED", "PUBLISH_AID_NOT_AVAILABLE"];
3
+ declare const ClientErrorCodes: readonly ["BUILDER_AMOUNT_IS_ZERO", "BUILDER_CANNOT_READ_BEFORE_RENDER", "BUILDER_REQUIRES_PRIVATE_KEY", "BUILDER_USER_CLIENT_REQUIRED", "PUBLISH_AID_NOT_AVAILABLE", "SIGNER_REQUIRES_PRIVATE_KEY"];
4
4
  export type ClientErrorCode = `${typeof ClientErrorType}_${typeof ClientErrorCodes[number]}`;
5
5
  export default class KeetaNetClientError extends KeetaNetError {
6
6
  static isInstance: (obj: any, strict?: boolean) => obj is KeetaNetClientError;
@@ -5,7 +5,8 @@ import type { LedgerErrorCode } from './ledger';
5
5
  import type { VoteErrorCode } from './vote';
6
6
  import type { KVErrorCode } from './kv';
7
7
  import type { PermissionsErrorCode } from './permissions';
8
- export type ErrorCode = BlockErrorCode | LedgerErrorCode | AccountErrorCode | ClientErrorCode | VoteErrorCode | PermissionsErrorCode | KVErrorCode;
8
+ import type { CertificateErrorCode } from './certificate';
9
+ export type ErrorCode = BlockErrorCode | LedgerErrorCode | AccountErrorCode | ClientErrorCode | VoteErrorCode | PermissionsErrorCode | KVErrorCode | CertificateErrorCode;
9
10
  export declare function ExpectErrorCode(code: ErrorCode, test: () => any): Promise<void>;
10
11
  interface ValidationOptions {
11
12
  type: string;
package/lib/error/kv.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { KeetaNetError } from '.';
2
2
  declare const KVErrorType: "KV";
3
- declare const KVErrorCodes: readonly ["TTL_NOT_SUPPORTED"];
3
+ declare const KVErrorCodes: readonly ["TTL_NOT_SUPPORTED", "KEY_ALREADY_EXISTS"];
4
4
  export type KVErrorCode = `${typeof KVErrorType}_${typeof KVErrorCodes[number]}`;
5
5
  export default class KeetaNetKVError extends KeetaNetError {
6
6
  static isInstance: (obj: any, strict?: boolean) => obj is KeetaNetKVError;