@keetanetwork/keetanet-client 0.10.5 → 0.12.2

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 (255) 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 +18234 -29816
  8. package/client/index.d.ts +112 -3
  9. package/client/index.js +4070 -6581
  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} +31 -14
  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 +5 -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 +5 -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.VoteBuilder.html +2 -1
  70. package/docs/classes/KeetaNetSDK.Referenced.VoteHash.html +1 -1
  71. package/docs/classes/KeetaNetSDK.Referenced.VoteStaple.html +23 -29
  72. package/docs/classes/KeetaNetSDK.Referenced.VoteStapleHash.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_asn1.isASN1Object.html +1 -0
  87. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.ZlibDeflateAsync.html +1 -0
  88. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.ZlibInflateAsync.html +1 -0
  89. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.objectToBuffer.html +1 -1
  90. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.toJSONSerializable.html +1 -1
  91. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.booleanEnv.html +1 -0
  92. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.nonNullable.html +1 -0
  93. package/docs/hierarchy.html +1 -1
  94. package/docs/interfaces/KeetaNetSDK.Referenced.ACLEntry.html +1 -1
  95. package/docs/interfaces/KeetaNetSDK.Referenced.ACLUpdate.html +1 -1
  96. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ExplicitContextTag.html +1 -1
  97. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ImplicitContextTag.html +1 -1
  98. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1Object.html +1 -1
  99. package/docs/interfaces/KeetaNetSDK.Referenced.BaseExternalKeyPairFunctions.html +1 -1
  100. package/docs/interfaces/KeetaNetSDK.Referenced.BaseGenerationConfig.html +1 -1
  101. package/docs/interfaces/KeetaNetSDK.Referenced.BlockCanonical.html +2 -2
  102. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSON.html +2 -2
  103. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperation.html +1 -1
  104. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationCREATE_IDENTIFIER.html +1 -1
  105. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATE.html +6 -0
  106. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATESerializable.html +5 -0
  107. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMODIFY_PERMISSIONS.html +1 -1
  108. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationRECEIVE.html +1 -1
  109. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSEND.html +1 -1
  110. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_INFO.html +1 -1
  111. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_REP.html +1 -1
  112. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
  113. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_SUPPLY.html +2 -2
  114. package/docs/interfaces/KeetaNetSDK.Referenced.BlockUnsignedCanonical.html +2 -2
  115. package/docs/interfaces/KeetaNetSDK.Referenced.CertificateWithIntermediates.html +3 -0
  116. package/docs/interfaces/KeetaNetSDK.Referenced.CertificateWithIntermediatesResponse.html +3 -0
  117. package/docs/interfaces/KeetaNetSDK.Referenced.ComputedBlocksEffectFields.html +3 -2
  118. package/docs/interfaces/KeetaNetSDK.Referenced.Constructor.html +1 -1
  119. package/docs/interfaces/KeetaNetSDK.Referenced.DisposableTimingHandle.html +7 -0
  120. package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsNoEncryption.html +1 -1
  121. package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsSupportsEncryption.html +1 -1
  122. package/docs/interfaces/KeetaNetSDK.Referenced.FeeAmountAndToken.html +5 -0
  123. package/docs/interfaces/KeetaNetSDK.Referenced.FeeAmountAndTokenJSON.html +4 -0
  124. package/docs/interfaces/KeetaNetSDK.Referenced.IdentifierCreateRequest.html +2 -2
  125. package/docs/interfaces/KeetaNetSDK.Referenced.InitialConfigSupply.html +1 -1
  126. package/docs/interfaces/KeetaNetSDK.Referenced.InstanceSet.html +13 -0
  127. package/docs/interfaces/KeetaNetSDK.Referenced.KVGenericOptionsType.html +2 -0
  128. package/docs/interfaces/KeetaNetSDK.Referenced.KVSetOptionsType.html +3 -2
  129. package/docs/interfaces/KeetaNetSDK.Referenced.KVStorageProviderAPI.html +2 -2
  130. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerConfig.html +4 -2
  131. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStatistics.html +3 -2
  132. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageAPI.html +15 -7
  133. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageTransactionBase.html +6 -0
  134. package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +1 -1
  135. package/docs/interfaces/KeetaNetSDK.Referenced.NodeConfig.html +3 -3
  136. package/docs/interfaces/KeetaNetSDK.Referenced.NumericValidationRule.html +3 -0
  137. package/docs/interfaces/KeetaNetSDK.Referenced.NumericValueEntry.html +1 -1
  138. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerBase.html +1 -1
  139. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerListener.html +1 -1
  140. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerRepBase.html +3 -3
  141. package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperations.html +3 -2
  142. package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperationsJSON.html +3 -2
  143. package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStorage.html +1 -1
  144. package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStringMapping.html +3 -2
  145. package/docs/interfaces/KeetaNetSDK.Referenced.RequestTokenReceiveEntry.html +1 -1
  146. package/docs/interfaces/KeetaNetSDK.Referenced.TokenNumericEntry.html +1 -1
  147. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientConfig.html +2 -2
  148. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientListenerOptions.html +2 -0
  149. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientOptions.html +1 -1
  150. package/docs/interfaces/KeetaNetSDK.Referenced.VoteBundleConstructor.html +6 -0
  151. package/docs/interfaces/KeetaNetSDK.Referenced.VoteJSON.html +3 -2
  152. package/docs/interfaces/KeetaNetSDK.Referenced.VoteStapleJSON.html +2 -2
  153. package/docs/interfaces/KeetaNetSDK.Referenced.WithIsInstance.html +1 -1
  154. package/docs/interfaces/KeetaNetSDK.Referenced.src_config.ValidationConfig.html +2 -2
  155. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1BitString.html +1 -1
  156. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Date.html +1 -1
  157. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1OID.html +1 -1
  158. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Set.html +1 -1
  159. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1String.html +1 -1
  160. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializableOptions.html +3 -0
  161. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_helper.InstanceSetConstructor.html +2 -2
  162. package/docs/modules/KeetaNetSDK.Referenced.html +1 -1
  163. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_asn1.html +1 -1
  164. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_buffer.html +1 -1
  165. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_certificate.html +1 -1
  166. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_conversion.html +1 -1
  167. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_helper.html +1 -1
  168. package/docs/types/KeetaNetSDK.Referenced.AccountKeyAlgorithmHex.html +8 -0
  169. package/docs/types/KeetaNetSDK.Referenced.AccountKeyAlgorithmHexReverse.html +1 -0
  170. package/docs/types/KeetaNetSDK.Referenced.AccountKeyAlgorithmHexToType.html +1 -0
  171. package/docs/types/KeetaNetSDK.Referenced.AddBinaryIfIncluded.html +1 -0
  172. package/docs/types/KeetaNetSDK.Referenced.BlockHashString.html +1 -0
  173. package/docs/types/KeetaNetSDK.Referenced.CertificateErrorCode.html +1 -0
  174. package/docs/types/KeetaNetSDK.Referenced.CertificateExtensionData.html +1 -0
  175. package/docs/types/KeetaNetSDK.Referenced.CertificateExtensions.html +2 -2
  176. package/docs/types/KeetaNetSDK.Referenced.CertificateHashString.html +1 -0
  177. package/docs/types/KeetaNetSDK.Referenced.CertificateOptions.html +4 -4
  178. package/docs/types/KeetaNetSDK.Referenced.CertificateUpdate.html +2 -0
  179. package/docs/types/KeetaNetSDK.Referenced.ComputedEffectOfBlocks.html +3 -2
  180. package/docs/types/KeetaNetSDK.Referenced.DbStats.html +2 -0
  181. package/docs/types/KeetaNetSDK.Referenced.ErrorCode.html +1 -1
  182. package/docs/types/KeetaNetSDK.Referenced.ExportedJSONOperation.html +1 -0
  183. package/docs/types/KeetaNetSDK.Referenced.MultisigPublicKeyString.html +1 -0
  184. package/docs/types/KeetaNetSDK.Referenced.NodeLike-1.html +1 -0
  185. package/docs/types/KeetaNetSDK.Referenced.NodeLike.html +1 -1
  186. package/docs/types/KeetaNetSDK.Referenced.PublicKeyAndTypeStringHex.html +3 -0
  187. package/docs/types/{KeetaNetSDK.Referenced.VoteJSONOutput.html → KeetaNetSDK.Referenced.StorageAddress.html} +1 -1
  188. package/docs/types/KeetaNetSDK.Referenced.TimingData.html +2 -0
  189. package/docs/types/KeetaNetSDK.Referenced.TimingSectionHandle.html +6 -0
  190. package/docs/types/KeetaNetSDK.Referenced.VoteBuilderOptions.html +4 -0
  191. package/docs/types/KeetaNetSDK.Referenced.src_config.NetworkConfig.html +1 -1
  192. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.Schema.html +1 -1
  193. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.SchemaMap.html +1 -1
  194. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_certificate.CertificateJSONOutput.html +1 -0
  195. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializable.html +1 -1
  196. package/docs/variables/KeetaNetSDK.Referenced.BlockErrorCodes-1.html +1 -0
  197. package/docs/variables/KeetaNetSDK.Referenced.BlockErrorCodes.html +1 -1
  198. package/docs/{types/KeetaNetSDK.Referenced.JSONUnsupportedTypes.html → variables/KeetaNetSDK.Referenced.CertificateErrorType.html} +1 -1
  199. package/docs/variables/KeetaNetSDK.Referenced.ClientErrorCodes.html +1 -1
  200. package/docs/variables/KeetaNetSDK.Referenced.KVErrorCodes.html +1 -1
  201. package/docs/variables/KeetaNetSDK.Referenced.Operation.html +2 -2
  202. package/docs/variables/KeetaNetSDK.Referenced.VoteErrorCodes.html +1 -1
  203. package/docs/variables/KeetaNetSDK.Referenced.identifierKeyTypes.html +1 -1
  204. package/docs/variables/KeetaNetSDK.Referenced.src_config.networksArray.html +1 -1
  205. package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_helper.AsyncDisposableStack.html +2 -0
  206. package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_helper.crypto.html +1 -0
  207. package/lib/account.d.ts +68 -29
  208. package/lib/block/index.d.ts +53 -23
  209. package/lib/block/operations.d.ts +78 -33
  210. package/lib/error/block.d.ts +1 -1
  211. package/lib/error/certificate.d.ts +9 -0
  212. package/lib/error/client.d.ts +1 -1
  213. package/lib/error/index.d.ts +2 -1
  214. package/lib/error/kv.d.ts +1 -1
  215. package/lib/error/vote.d.ts +1 -1
  216. package/lib/kv/index.d.ts +15 -8
  217. package/lib/kv/kv_redis.d.ts +18 -8
  218. package/lib/ledger/common.d.ts +13 -5
  219. package/lib/ledger/db_dynamodb.d.ts +22 -16
  220. package/lib/ledger/db_postgres.d.ts +10 -10
  221. package/lib/ledger/db_spanner.d.ts +26 -14
  222. package/lib/ledger/db_spanner_helper.d.ts +94 -109
  223. package/lib/ledger/db_sqlite.d.ts +10 -10
  224. package/lib/ledger/effects.d.ts +19 -4
  225. package/lib/ledger/index.d.ts +57 -12
  226. package/lib/ledger/types.d.ts +7 -1
  227. package/lib/node/local.d.ts +10 -1
  228. package/lib/node/timing.d.ts +44 -5
  229. package/lib/p2p.d.ts +6 -3
  230. package/lib/permissions.d.ts +3 -3
  231. package/lib/pubsub/index.d.ts +1 -1
  232. package/lib/pubsub/providers.d.ts +2 -0
  233. package/lib/pubsub/ps_gcp.d.ts +14 -0
  234. package/lib/stats.d.ts +5 -0
  235. package/lib/utils/asn1.d.ts +4 -3
  236. package/lib/utils/buffer.d.ts +4 -0
  237. package/lib/utils/certificate.d.ts +107 -6
  238. package/lib/utils/conversion.d.ts +13 -35
  239. package/lib/utils/helper.d.ts +26 -8
  240. package/lib/utils/helper_testing.d.ts +1 -1
  241. package/lib/vote.d.ts +122 -63
  242. package/package.json +2 -3
  243. package/version.d.ts +1 -1
  244. package/docs/classes/KeetaNetSDK.Referenced.HTTPAgentManager.html +0 -4
  245. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.RegisterSerializable.html +0 -2
  246. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOutput.html +0 -5
  247. package/docs/interfaces/KeetaNetSDK.Referenced.VoteJSONOutput.html +0 -4
  248. package/docs/interfaces/KeetaNetSDK.Referenced.WithConversionClass.html +0 -6
  249. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_helper.InstanceSet.html +0 -10
  250. package/docs/types/KeetaNetSDK.Referenced.JSONSupportedObject.html +0 -1
  251. package/docs/types/KeetaNetSDK.Referenced.JSONSupportedValue.html +0 -1
  252. package/docs/types/KeetaNetSDK.Referenced.Vote.html +0 -1
  253. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.JSONSupported.html +0 -1
  254. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializableOptions.html +0 -3
  255. package/docs/variables/KeetaNetSDK.Referenced.default.html +0 -3
@@ -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;
@@ -1,6 +1,6 @@
1
1
  import { KeetaNetError } from '.';
2
2
  declare const VoteErrorType: "VOTE";
3
- declare const VoteErrorCodes: readonly ["SERIAL_MISMATCH", "INVALID_VERSION", "INVALID_CONSTRUCTION", "INVALID_CONSTRUCTION_JSON", "SIGNATURE_INVALID", "EXPIRED", "INVALID_VALIDITY", "MOMENT_BEFORE_VALIDITY_FROM", "STAPLE_INVALID_CONSTRUCTION", "STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_COUNT", "STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_MISSING", "STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_ORDER", "STAPLE_DUPLICATE_VOTE_ISSUER", "STAPLE_PERMANENCE_MISMATCH", "BUILDER_INVALID_CONSTRUCTION", "BUILDER_INVALID_BLOCK_TYPE", "BUILDER_INVALID_SERIAL", "BUILDER_INVALID_VALID_TO_FROM", "MALFORMED_WRAPPER", "MALFORMED_VOTE_WRAPPER", "MALFORMED_VOTE_CONTENT", "MALFORMED_VOTE_CONTENT_EXTRA_DATA", "MALFORMED_VOTE_VERSION", "MALFORMED_VOTE_SERIAL", "MALFORMED_VOTE_SIGNATURE_INFORMATION", "MALFORMED_VOTE_ISSUER_INFORMATION", "MALFORMED_VOTE_SUBJECT_INFORMATION", "MALFORMED_VOTE_VALIDITY_INFORMATION", "MALFORMED_VOTE_SERIAL", "MALFORMED_VOTE_EXTENSIONS", "MALFORMED_VOTE_EXTENSIONS_VALUE", "MALFORMED_VOTE_EXTENSIONS_VALUE_OID", "MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL", "MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL_TYPE", "MALFORMED_VOTE_EXTENSIONS_VALUE_HASH_DATA", "MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_ISSUER", "MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_WRAPPER", "MALFORMED_VOTE_SIGNATURE_SCHEME_ECDSA_INVALID_CURVE", "MALFORMED_VOTE_SIGNATURE_UNSUPPORTED_SCHEME", "MALFORMED_VOTE_SUBJECT_PUBLIC_KEY_INFORMATION", "MALFORMED_VOTE_SIGNATURE_VALUE", "MALFORMED_VOTE_NO_BLOCKS_FOUND", "MALFORMED_STAPLE", "MALFORMED_STAPLE_BLOCKS", "MALFORMED_STAPLE_BLOCKS_AT_LEAST_ONE", "MALFORMED_STAPLE_VOTES", "MALFORMED_STAPLE_VOTES_AT_LEAST_ONE", "MALFORMED_FIND_RDN_INVALID_TYPE", "MALFORMED_FIND_RDN_MUST_HAVE_ONE", "MALFORMED_FIND_RDN_PART_WELL_FORMED", "MALFORMED_FIND_RDN_MUST_BE_SET", "MALFORMED_FIND_RDN_TYPE_MUST_BE_OID", "MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT", "MALFORMED_HASHES_FROM_VOTE_INVALID_TYPE", "MALFORMED_HASHES_FROM_VOTE_INVALID_CONTEXT_SPECIFIC", "MALFORMED_HASHES_FROM_VOTE_DATA_NEEDS_OID", "MALFORMED_HASHES_FROM_VOTE_DATA_HASH_DATA_MUST_BE_SEQUENCE", "MALFORMED_HASHES_FROM_VOTE_DATA_NOT_TWO_ITEMS", "MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_FUNC", "MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_TYPE", "MALFORMED_HASHES_FROM_VOTE_DATA_SECOND_MUST_BE_SEQUENCE"];
3
+ declare const VoteErrorCodes: readonly ["SERIAL_MISMATCH", "INVALID_VERSION", "INVALID_CONSTRUCTION", "INVALID_CONSTRUCTION_JSON", "SIGNATURE_INVALID", "EXPIRED", "INVALID_VALIDITY", "MOMENT_BEFORE_VALIDITY_FROM", "STAPLE_INVALID_CONSTRUCTION", "STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_COUNT", "STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_MISSING", "STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_ORDER", "STAPLE_DUPLICATE_VOTE_ISSUER", "STAPLE_PERMANENCE_MISMATCH", "BUILDER_INVALID_CONSTRUCTION", "BUILDER_INVALID_BLOCK_TYPE", "BUILDER_INVALID_SERIAL", "BUILDER_INVALID_VALID_TO_FROM", "MALFORMED_WRAPPER", "MALFORMED_VOTE_WRAPPER", "MALFORMED_VOTE_CONTENT", "MALFORMED_VOTE_CONTENT_EXTRA_DATA", "MALFORMED_VOTE_VERSION", "MALFORMED_VOTE_SERIAL", "MALFORMED_VOTE_SIGNATURE_INFORMATION", "MALFORMED_VOTE_ISSUER_INFORMATION", "MALFORMED_VOTE_SUBJECT_INFORMATION", "MALFORMED_VOTE_VALIDITY_INFORMATION", "MALFORMED_VOTE_SERIAL", "MALFORMED_VOTE_EXTENSIONS", "MALFORMED_VOTE_EXTENSIONS_DATA", "MALFORMED_VOTE_EXTENSIONS_VALUE", "MALFORMED_VOTE_EXTENSIONS_VALUE_OID", "MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL", "MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL_TYPE", "MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_ISSUER", "MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_WRAPPER", "MALFORMED_VOTE_SIGNATURE_SCHEME_ECDSA_INVALID_CURVE", "MALFORMED_VOTE_SIGNATURE_UNSUPPORTED_SCHEME", "MALFORMED_VOTE_SUBJECT_PUBLIC_KEY_INFORMATION", "MALFORMED_VOTE_SIGNATURE_VALUE", "MALFORMED_VOTE_NO_BLOCKS_FOUND", "MALFORMED_STAPLE", "MALFORMED_STAPLE_BLOCKS", "MALFORMED_STAPLE_BLOCKS_AT_LEAST_ONE", "MALFORMED_STAPLE_VOTES", "MALFORMED_STAPLE_VOTES_AT_LEAST_ONE", "MALFORMED_FIND_RDN_INVALID_TYPE", "MALFORMED_FIND_RDN_MUST_HAVE_ONE", "MALFORMED_FIND_RDN_PART_WELL_FORMED", "MALFORMED_FIND_RDN_MUST_BE_SET", "MALFORMED_FIND_RDN_TYPE_MUST_BE_OID", "MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT", "MALFORMED_HASHES_FROM_VOTE_INVALID_TYPE", "MALFORMED_HASHES_FROM_VOTE_INVALID_CONTEXT_SPECIFIC", "MALFORMED_HASHES_FROM_VOTE_DATA_NEEDS_OID", "MALFORMED_HASHES_FROM_VOTE_DATA_HASH_DATA_MUST_BE_SEQUENCE", "MALFORMED_HASHES_FROM_VOTE_DATA_NOT_TWO_ITEMS", "MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_FUNC", "MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_TYPE", "MALFORMED_HASHES_FROM_VOTE_DATA_SECOND_MUST_BE_SEQUENCE", "MALFORMED_FEES_AMOUNT", "MALFORMED_FEES_FROM_VOTE_INVALID_INPUT", "MALFORMED_FEES_IN_PERMANENT_VOTE", "MALFORMED_FEES_PAY_TO_INVALID", "MALFORMED_FEES_TOKEN_NOT_TOKEN"];
4
4
  export type VoteErrorCode = `${typeof VoteErrorType}_${typeof VoteErrorCodes[number]}`;
5
5
  export default class KeetaNetVoteError extends KeetaNetError {
6
6
  static isInstance: (obj: any, strict?: boolean) => obj is KeetaNetVoteError;
package/lib/kv/index.d.ts CHANGED
@@ -1,21 +1,28 @@
1
1
  import type { BufferStorage } from '../utils/buffer';
2
2
  import type { JSONSerializable } from '../utils/conversion';
3
- export interface KVSetOptionsType {
3
+ import type { Node } from '../node';
4
+ type NodeLike = Pick<Node, 'timing'>;
5
+ export interface KVGenericOptionsType {
6
+ node?: NodeLike;
7
+ }
8
+ export interface KVSetOptionsType extends KVGenericOptionsType {
4
9
  exclusiveCreate?: boolean;
5
10
  ttl?: number;
6
11
  }
7
12
  export interface KVStorageProviderAPI {
8
13
  set(arena: string, key: string, value: JSONSerializable | undefined, options?: KVSetOptionsType): Promise<void>;
9
- get(arena: string | null, key: string): Promise<JSONSerializable | undefined>;
10
- getAll(arena: string): Promise<{
14
+ get(arena: string | null, key: string, options?: KVGenericOptionsType): Promise<JSONSerializable | undefined>;
15
+ getAll(arena: string, options?: KVGenericOptionsType): Promise<{
11
16
  [key: string]: JSONSerializable;
12
17
  }>;
13
- list(arena: string): Promise<string[]>;
14
- incr(arena: string, key: string, change: number): Promise<bigint>;
15
- xor(arena: null, key: string, change: BufferStorage): Promise<void>;
16
- destroy?: () => Promise<void>;
18
+ list(arena: string, options?: KVGenericOptionsType): Promise<string[]>;
19
+ incr(arena: string, key: string, change: number, options?: KVGenericOptionsType): Promise<bigint>;
20
+ xor(arena: null, key: string, change: BufferStorage, options?: KVGenericOptionsType): Promise<void>;
21
+ destroy?: (options?: KVGenericOptionsType) => Promise<void>;
17
22
  }
18
23
  export type KVStorageProvider = KVStorageProviderAPI;
19
24
  export declare class KVStorageProviderBase {
20
- xor(_ignored_arena: null, key: string, _ignored_change: BufferStorage): Promise<void>;
25
+ readonly id: `${string}-${string}-${string}-${string}-${string}`;
26
+ xor(_ignored_arena: null, key: string, _ignored_change: BufferStorage, _ignored_options?: KVGenericOptionsType): Promise<void>;
21
27
  }
28
+ export {};
@@ -1,18 +1,28 @@
1
- import type { KVStorageProviderAPI, KVSetOptionsType } from './';
1
+ import type { KVStorageProviderAPI, KVSetOptionsType, KVGenericOptionsType } from './';
2
2
  import { KVStorageProviderBase } from './';
3
3
  import type { JSONSerializable } from '../utils/conversion';
4
4
  import type { BufferStorage } from '../utils/buffer';
5
+ export type KVStorageProviderRedisConfig = {
6
+ host: string;
7
+ password: string;
8
+ port?: number;
9
+ log?: typeof KVStorageProviderRedis['defaultLogger'];
10
+ node?: KVGenericOptionsType['node'];
11
+ };
5
12
  export declare class KVStorageProviderRedis extends KVStorageProviderBase implements KVStorageProviderAPI {
6
13
  #private;
7
- constructor(host: string, password: string, port?: number);
8
- destroy(): Promise<void>;
14
+ static defaultLogger: Pick<typeof console, 'debug' | 'error'>;
15
+ log: Pick<Console, "debug" | "error">;
16
+ constructor(config: KVStorageProviderRedisConfig);
17
+ private node;
18
+ destroy(options?: KVGenericOptionsType): Promise<void>;
9
19
  set(arena: string, key: string, value: JSONSerializable | undefined, opt?: KVSetOptionsType): Promise<void>;
10
- get(arena: string | null, key: string): Promise<JSONSerializable | undefined>;
11
- getAll(arena: string): Promise<{
20
+ get(arena: string | null, key: string, options?: KVGenericOptionsType): Promise<JSONSerializable | undefined>;
21
+ getAll(arena: string, options?: KVGenericOptionsType): Promise<{
12
22
  [key: string]: JSONSerializable;
13
23
  }>;
14
- list(arena: string): Promise<string[]>;
15
- incr(arena: string, key: string, change: number): Promise<bigint>;
16
- xor(arena: null, key: string, change: BufferStorage): Promise<void>;
24
+ list(arena: string, options?: KVGenericOptionsType): Promise<string[]>;
25
+ incr(arena: string, key: string, change: number, options?: KVGenericOptionsType): Promise<bigint>;
26
+ xor(arena: null, key: string, change: BufferStorage, options?: KVGenericOptionsType): Promise<void>;
17
27
  }
18
28
  export default KVStorageProviderRedis;
@@ -53,13 +53,14 @@ interface ComputeLedgerEffectOptions<T extends boolean, P extends boolean, W ext
53
53
  getFinalNumericValues?: T;
54
54
  computePermissions?: P;
55
55
  computeWeights?: W;
56
- checkNegative?: boolean;
56
+ checkRangeConstraints?: boolean;
57
57
  baseToken: TokenAddress;
58
58
  }
59
+ export declare function validateSupply(amount: bigint, network: bigint): void;
59
60
  /**
60
61
  * Compute effects on the ledger from block effects
61
62
  */
62
- export declare function computeLedgerEffect<T extends boolean, P extends boolean, W extends boolean>(options: ComputeLedgerEffectOptions<T, P, W>, effects: ComputedEffectOfBlocksByAccount, storageProvider: computeLedgerEffectStorageProvider, transaction?: any): Promise<BalanceSupplyChangeResp<T, P, W>>;
63
+ export declare function computeLedgerEffect<T extends boolean, P extends boolean, W extends boolean>(options: ComputeLedgerEffectOptions<T, P, W>, effects: ComputedEffectOfBlocksByAccount, storageProvider: computeLedgerEffectStorageProvider, network: bigint, transaction?: any): Promise<BalanceSupplyChangeResp<T, P, W>>;
63
64
  /**
64
65
  * A partial LedgerStorageAPI which just has the methods for "addTimeStatistics"
65
66
  */
@@ -94,12 +95,19 @@ export declare abstract class LedgerStorageBase {
94
95
  protected config: LedgerConfig | null;
95
96
  constructor();
96
97
  protected abstract adjustDefer(transaction: any, input: VoteStaple): Promise<void>;
97
- abstract getBlockHeight(transaction: any, blockHash: BlockHash, account: GenericAccount): Promise<{
98
- blockHeight: string | null;
99
- } | null>;
98
+ abstract getBlockHeight(transaction: any, blockHash: BlockHash, account: GenericAccount): Promise<bigint | null>;
99
+ getBlockHeights(transaction: any, toFetch: {
100
+ blockHash: BlockHash;
101
+ account: GenericAccount;
102
+ }[]): Promise<{
103
+ [blockHash: string]: bigint | null;
104
+ }>;
100
105
  abstract getHeadBlocks(transaction: any, accounts: GenericAccount[], from: LedgerSelector): Promise<{
101
106
  [account: string]: Block | null;
102
107
  }>;
108
+ getHeadBlockHashes(transaction: any, accounts: InstanceType<typeof Account.Set>): Promise<{
109
+ [account: string]: BlockHash | null;
110
+ }>;
103
111
  abstract getVotesFromMultiplePrevious(transaction: any, prevBlocks: BlockHash[], from: LedgerSelector, issuer?: Account): Promise<{
104
112
  [hash: string]: Vote[] | null;
105
113
  }>;
@@ -3,11 +3,13 @@ import { Block, BlockHash } from '../block';
3
3
  import type { VoteBlockHash, VoteBlockHashMap } from '../vote';
4
4
  import type { GenericAccount, IdentifierAddress, TokenAddress } from '../account';
5
5
  import Account from '../account';
6
- import type { Ledger, LedgerConfig, LedgerStorageAPI, LedgerSelector, PaginatedVotes, GetVotesAfterOptions } from '../ledger';
7
- import type { AccountInfo, ACLRow, GetAllBalancesResponse, LedgerStatistics } from './types';
6
+ import type { Ledger, LedgerConfig, LedgerStorageAPI, LedgerSelector, PaginatedVotes, GetVotesAfterOptions, LedgerStorageTransactionBase } from '../ledger';
7
+ import type { AccountInfo, ACLRow, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates } from './types';
8
8
  import { LedgerStorageBase } from './common';
9
9
  import type { ComputedEffectOfBlocks } from './effects';
10
- declare const dynamoDBTableNames: readonly ["votes", "voteUIDs", "permissions", "accountInfo", "accountOwners", "blocks", "balances", "weight", "heapBlocks", "heapStorage", "chain", "delegation", "serial", "kv"];
10
+ import type Node from '../node';
11
+ import type { CertificateHash } from '../utils/certificate';
12
+ declare const dynamoDBTableNames: readonly ["votes", "voteUIDs", "permissions", "accountInfo", "accountOwners", "accountCertificates", "blocks", "balances", "weight", "heapBlocks", "heapStorage", "chain", "delegation", "serial", "kv"];
11
13
  declare const optionalDynamoDbTables: readonly ["kv"];
12
14
  type TableName = typeof dynamoDBTableNames[number];
13
15
  type OptionalTableName = typeof optionalDynamoDbTables[number];
@@ -20,22 +22,23 @@ export interface DynamoDBConfig {
20
22
  transactionSize?: number;
21
23
  batchUpdateSize?: number;
22
24
  }
23
- declare class DynamoDBTransaction {
25
+ declare class DynamoDBTransaction implements LedgerStorageTransactionBase {
24
26
  #private;
27
+ readonly node: Node | undefined;
25
28
  readonly moment: Date;
26
- constructor(config: DynamoDBConfig, ledger: Ledger, log: LedgerConfig['log'], dbDynamoDB: DBDynamoDB);
29
+ readonly identifier: string;
30
+ readonly readOnly: boolean;
31
+ constructor(config: DynamoDBConfig, ledger: Ledger, log: LedgerConfig['log'], dbDynamoDB: DBDynamoDB, transactionBase: LedgerStorageTransactionBase);
27
32
  commit(): Promise<void>;
28
33
  abort(): Promise<void>;
29
- delegatedWeight(rep?: Account): Promise<bigint>;
34
+ delegatedWeight(rep?: Account | InstanceType<typeof Account.Set>): Promise<bigint>;
30
35
  getBalance(account: GenericAccount, token: TokenAddress): Promise<bigint>;
31
36
  getAllBalances(account: GenericAccount): Promise<GetAllBalancesResponse>;
32
37
  adjustDefer(input: VoteStaple): Promise<void>;
33
- adjust(input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean): Promise<BlockHash[]>;
38
+ adjust(input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean, completedStaples?: Set<string>): Promise<VoteStaple[]>;
34
39
  addPendingVote(blocksAndVotes: VoteStaple): Promise<void>;
35
40
  getBlock(block: BlockHash, from: LedgerSelector): Promise<Block | null>;
36
- getBlockHeight(blockHash: BlockHash, account: GenericAccount): Promise<{
37
- blockHeight: string | null;
38
- } | null>;
41
+ getBlockHeight(blockHash: BlockHash, account: GenericAccount): Promise<bigint | null>;
39
42
  getVotes(block: BlockHash, from: LedgerSelector, issuer?: Account, transactionAlreadyVerifiedActiveByCaller?: boolean): Promise<Vote[] | null>;
40
43
  getVoteStaple(stapleBlockHashes: VoteBlockHash[], from?: LedgerSelector): Promise<VoteBlockHashMap<VoteStaple | null>>;
41
44
  getHistory(account: GenericAccount, start: VoteBlockHash | null, limit: number): Promise<VoteBlockHash[]>;
@@ -57,29 +60,30 @@ declare class DynamoDBTransaction {
57
60
  listACLsByEntity(entity: GenericAccount): Promise<ACLRow[]>;
58
61
  listACLsByPrincipal(principal: GenericAccount, entityList?: GenericAccount[]): Promise<ACLRow[]>;
59
62
  getVotesAfter(moment: Date, startKey?: string, options?: GetVotesAfterOptions): Promise<PaginatedVotes>;
63
+ getAccountCertificates(account: GenericAccount): Promise<CertificateWithIntermediates[]>;
64
+ getAccountCertificateByHash(account: GenericAccount, hash: CertificateHash): Promise<CertificateWithIntermediates | null>;
60
65
  gcBatch(): Promise<boolean>;
61
66
  }
62
67
  export declare class DBDynamoDB extends LedgerStorageBase implements LedgerStorageAPI {
63
68
  #private;
69
+ ledgerConfig: LedgerConfig | null;
64
70
  static Testing: {
65
71
  deleteTables: (config: DynamoDBConfig) => Promise<void>;
66
72
  createTables: (config: DynamoDBConfig) => Promise<void>;
67
73
  };
68
74
  init(config: LedgerConfig, ledger: Ledger): void;
69
- beginTransaction(): Promise<DynamoDBTransaction>;
75
+ beginTransaction(transactionBase: LedgerStorageTransactionBase): Promise<DynamoDBTransaction>;
70
76
  commitTransaction(transaction: DynamoDBTransaction): Promise<void>;
71
77
  abortTransaction(transaction: DynamoDBTransaction): Promise<void>;
72
78
  evaluateError(error: any): Promise<any>;
73
- delegatedWeight(transaction: DynamoDBTransaction, rep?: Account): Promise<bigint>;
79
+ delegatedWeight(transaction: DynamoDBTransaction, rep?: Account | InstanceType<typeof Account.Set>): Promise<bigint>;
74
80
  getBalance(transaction: DynamoDBTransaction, account: GenericAccount, token: TokenAddress): Promise<bigint>;
75
81
  getAllBalances(transaction: DynamoDBTransaction, account: GenericAccount): Promise<GetAllBalancesResponse>;
76
82
  protected adjustDefer(transaction: DynamoDBTransaction, input: VoteStaple): Promise<void>;
77
- adjust(transaction: DynamoDBTransaction, input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean): Promise<BlockHash[]>;
83
+ adjust(transaction: DynamoDBTransaction, input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean): Promise<VoteStaple[]>;
78
84
  addPendingVote(transaction: DynamoDBTransaction, blocksAndVote: VoteStaple): Promise<void>;
79
85
  getBlock(transaction: DynamoDBTransaction, block: BlockHash, from: LedgerSelector): Promise<Block | null>;
80
- getBlockHeight(transaction: DynamoDBTransaction, blockHash: BlockHash, account: GenericAccount): Promise<{
81
- blockHeight: string | null;
82
- } | null>;
86
+ getBlockHeight(transaction: DynamoDBTransaction, blockHash: BlockHash, account: GenericAccount): Promise<bigint | null>;
83
87
  getVotes(transaction: DynamoDBTransaction, block: BlockHash, from: LedgerSelector): Promise<Vote[] | null>;
84
88
  getVoteStaples(transaction: DynamoDBTransaction, stapleBlockHashes: VoteBlockHash[], from?: LedgerSelector): Promise<VoteBlockHashMap<VoteStaple | null>>;
85
89
  getHistory(transaction: DynamoDBTransaction, account: GenericAccount, start: VoteBlockHash | null, limit?: number): Promise<VoteBlockHash[]>;
@@ -96,6 +100,8 @@ export declare class DBDynamoDB extends LedgerStorageBase implements LedgerStora
96
100
  listACLsByPrincipal(transaction: DynamoDBTransaction, principal: GenericAccount, entityList?: GenericAccount[]): Promise<ACLRow[]>;
97
101
  listACLsByEntity(transaction: DynamoDBTransaction, entity: GenericAccount): Promise<ACLRow[]>;
98
102
  getVotesAfter(transaction: DynamoDBTransaction, moment: Date, startKey?: string): Promise<PaginatedVotes>;
103
+ getAccountCertificates(transaction: DynamoDBTransaction, account: GenericAccount): Promise<CertificateWithIntermediates[]>;
104
+ getAccountCertificateByHash(transaction: DynamoDBTransaction, account: GenericAccount, hash: CertificateHash): Promise<CertificateWithIntermediates | null>;
99
105
  getNextSerialNumber(): Promise<bigint>;
100
106
  gcBatch(transaction: DynamoDBTransaction): Promise<boolean>;
101
107
  stats(): Promise<LedgerStatistics>;
@@ -3,16 +3,16 @@ import { Block, BlockHash } from '../block';
3
3
  import type { VoteBlockHash, VoteBlockHashMap } from '../vote';
4
4
  import type { GenericAccount, IdentifierAddress, TokenAddress } from '../account';
5
5
  import Account, { AccountKeyAlgorithm } from '../account';
6
- import type { Ledger, LedgerConfig, LedgerStorageAPI, LedgerSelector, PaginatedVotes, GetVotesAfterOptions } from '../ledger';
7
- import type { AccountInfo, ACLRow, GetAllBalancesResponse, LedgerStatistics } from './types';
6
+ import type { Ledger, LedgerConfig, LedgerStorageAPI, LedgerSelector, PaginatedVotes, GetVotesAfterOptions, LedgerStorageTransactionBase } from '../ledger';
7
+ import type { AccountInfo, ACLRow, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates } from './types';
8
8
  import { LedgerStorageBase } from './common';
9
9
  import type { PoolClient as PostgresPoolClient } from 'pg';
10
10
  import { Pool as PostgresPool } from 'pg';
11
11
  import type { ComputedEffectOfBlocks } from './effects';
12
12
  import LedgerRequestCache from './cache';
13
- interface PostgresTransaction {
13
+ import type { CertificateHash } from '../utils/certificate';
14
+ interface PostgresTransaction extends LedgerStorageTransactionBase {
14
15
  client: PostgresPoolClient;
15
- moment: Date;
16
16
  cache: LedgerRequestCache;
17
17
  }
18
18
  interface PostgresSelectOptions {
@@ -24,12 +24,12 @@ export declare class DBPostgres extends LedgerStorageBase implements LedgerStora
24
24
  constructor();
25
25
  init(config: LedgerConfig, ledger: Ledger): void;
26
26
  destroy(): Promise<void>;
27
- beginTransaction(): Promise<PostgresTransaction>;
27
+ beginTransaction(transactionBase: LedgerStorageTransactionBase): Promise<PostgresTransaction>;
28
28
  commitTransaction(transaction: PostgresTransaction): Promise<void>;
29
29
  abortTransaction(transaction: PostgresTransaction): Promise<void>;
30
30
  cache(transaction: PostgresTransaction): LedgerRequestCache;
31
31
  evaluateError(error: any): Promise<any>;
32
- delegatedWeight(transaction: PostgresTransaction, rep?: Account, options?: PostgresSelectOptions): Promise<bigint>;
32
+ delegatedWeight(transaction: PostgresTransaction, rep?: Account | InstanceType<typeof Account.Set>, options?: PostgresSelectOptions): Promise<bigint>;
33
33
  getBalance(transaction: PostgresTransaction, account: GenericAccount, token: TokenAddress, options?: PostgresSelectOptions): Promise<bigint>;
34
34
  getAllBalances(transaction: PostgresTransaction, account: GenericAccount): Promise<GetAllBalancesResponse>;
35
35
  addPendingVote(transaction: PostgresTransaction, votesAndBlocks: VoteStaple): Promise<void>;
@@ -42,11 +42,9 @@ export declare class DBPostgres extends LedgerStorageBase implements LedgerStora
42
42
  listACLsByEntity(transaction: PostgresTransaction, entity: GenericAccount): Promise<ACLRow[]>;
43
43
  listACLsByPrincipal(transaction: PostgresTransaction, principal: GenericAccount, entityList?: GenericAccount[]): Promise<ACLRow[]>;
44
44
  getAccountInfo(transaction: PostgresTransaction, account: GenericAccount | string): Promise<AccountInfo>;
45
- adjust(transaction: PostgresTransaction, input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean): Promise<BlockHash[]>;
45
+ adjust(transaction: PostgresTransaction, input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean, completedStaples?: Set<string>): Promise<VoteStaple[]>;
46
46
  getBlock(transaction: PostgresTransaction, block: BlockHash, from: LedgerSelector): Promise<Block | null>;
47
- getBlockHeight(transaction: PostgresTransaction, blockHash: BlockHash, account: GenericAccount): Promise<{
48
- blockHeight: string | null;
49
- } | null>;
47
+ getBlockHeight(transaction: PostgresTransaction, blockHash: BlockHash, account: GenericAccount): Promise<bigint | null>;
50
48
  getVotes(transaction: PostgresTransaction, block: BlockHash, from: LedgerSelector, issuer?: GenericAccount): Promise<Vote[] | null>;
51
49
  getVoteStaples(transaction: PostgresTransaction, stapleBlockHashes: VoteBlockHash[], from?: LedgerSelector): Promise<VoteBlockHashMap<VoteStaple | null>>;
52
50
  getHistory(transaction: PostgresTransaction, account: GenericAccount, start: VoteBlockHash | null, limit?: number): Promise<VoteBlockHash[]>;
@@ -59,6 +57,8 @@ export declare class DBPostgres extends LedgerStorageBase implements LedgerStora
59
57
  }>;
60
58
  getVoteStaplesFromBlockHash(transaction: PostgresTransaction, blocks: BlockHash[], onLedger: LedgerSelector): Promise<VoteStaple[]>;
61
59
  getVotesAfter(transaction: PostgresTransaction, moment: Date, startKey?: string, options?: GetVotesAfterOptions): Promise<PaginatedVotes>;
60
+ getAccountCertificates(transaction: PostgresTransaction, account: GenericAccount): Promise<CertificateWithIntermediates[]>;
61
+ getAccountCertificateByHash(transaction: PostgresTransaction, account: GenericAccount, hash: CertificateHash): Promise<CertificateWithIntermediates | null>;
62
62
  protected gcBatch(transaction: PostgresTransaction): Promise<boolean>;
63
63
  getNextSerialNumber(): Promise<bigint>;
64
64
  stats(): Promise<LedgerStatistics>;