@keetanetwork/keetanet-client 0.10.3 → 0.10.4

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 (423) hide show
  1. package/README.md +7 -0
  2. package/client/builder.d.ts +42 -2
  3. package/client/client_common_tests.d.ts +1 -1
  4. package/client/index-browser.d.ts +885 -20
  5. package/client/index-browser.js +2706 -1507
  6. package/client/index.d.ts +885 -20
  7. package/client/index.js +85968 -83430
  8. package/config/index.d.ts +16 -0
  9. package/docs/assets/fonts/Surt-Expanded-Bold.woff2 +0 -0
  10. package/docs/assets/fonts/Surt-Expanded-Medium.woff2 +0 -0
  11. package/docs/assets/fonts/Surt-Expanded-Regular.woff2 +0 -0
  12. package/docs/assets/fonts/Surt-Expanded-Semibold.woff2 +0 -0
  13. package/docs/assets/fonts/Surt-Normal-Bold.woff2 +0 -0
  14. package/docs/assets/fonts/Surt-Normal-Medium.woff2 +0 -0
  15. package/docs/assets/fonts/Surt-Normal-Regular.woff2 +0 -0
  16. package/docs/assets/fonts/Surt-Normal-Semibold.woff2 +0 -0
  17. package/docs/assets/fonts/UbuntuMono-Regular.ttf +0 -0
  18. package/docs/assets/hierarchy.js +1 -0
  19. package/docs/assets/highlight.css +134 -0
  20. package/docs/assets/icons.js +18 -0
  21. package/docs/assets/icons.svg +1 -0
  22. package/docs/assets/logo-keeta-dark.svg +14 -0
  23. package/docs/assets/logo-keeta-light.svg +14 -0
  24. package/docs/assets/main.js +60 -0
  25. package/docs/assets/navigation.js +1 -0
  26. package/docs/assets/search.js +1 -0
  27. package/docs/assets/style.css +1640 -0
  28. package/docs/assets/typedoc-github-style.css +557 -0
  29. package/docs/classes/KeetaNetSDK.Client.html +288 -0
  30. package/docs/classes/KeetaNetSDK.Referenced.Account.html +107 -0
  31. package/docs/classes/KeetaNetSDK.Referenced.BaseSet.html +13 -0
  32. package/docs/classes/KeetaNetSDK.Referenced.Block.html +36 -0
  33. package/docs/classes/KeetaNetSDK.Referenced.BlockBuilder.html +26 -0
  34. package/docs/classes/KeetaNetSDK.Referenced.BlockHash.html +18 -0
  35. package/docs/classes/KeetaNetSDK.Referenced.BlockOperation.html +6 -0
  36. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationCREATE_IDENTIFIER.html +10 -0
  37. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMODIFY_PERMISSIONS.html +13 -0
  38. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationRECEIVE.html +13 -0
  39. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSEND.html +12 -0
  40. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_INFO.html +13 -0
  41. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_REP.html +10 -0
  42. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE.html +11 -0
  43. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_SUPPLY.html +11 -0
  44. package/docs/classes/KeetaNetSDK.Referenced.ECDSAKeyPair.html +30 -0
  45. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1KeyPair.html +33 -0
  46. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PrivateKey.html +12 -0
  47. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PublicKey.html +13 -0
  48. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1Signature.html +12 -0
  49. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1KeyPair.html +34 -0
  50. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PrivateKey.html +12 -0
  51. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PublicKey.html +13 -0
  52. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1Signature.html +12 -0
  53. package/docs/classes/KeetaNetSDK.Referenced.ED25519KeyPair.html +28 -0
  54. package/docs/classes/KeetaNetSDK.Referenced.ED25519PrivateKey.html +12 -0
  55. package/docs/classes/KeetaNetSDK.Referenced.ED25519PublicKey.html +13 -0
  56. package/docs/classes/KeetaNetSDK.Referenced.ED25519Signature.html +12 -0
  57. package/docs/classes/KeetaNetSDK.Referenced.ExternalKeyPair.html +28 -0
  58. package/docs/classes/KeetaNetSDK.Referenced.ExternalSet.html +16 -0
  59. package/docs/classes/KeetaNetSDK.Referenced.IdentifierKey.html +13 -0
  60. package/docs/classes/KeetaNetSDK.Referenced.IdentifierKeyPair.html +28 -0
  61. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetError.html +5 -0
  62. package/docs/classes/KeetaNetSDK.Referenced.KeyInterface.html +26 -0
  63. package/docs/classes/KeetaNetSDK.Referenced.KeyStorage.html +12 -0
  64. package/docs/classes/KeetaNetSDK.Referenced.Ledger.html +41 -0
  65. package/docs/classes/KeetaNetSDK.Referenced.LedgerAtomicInterface.html +27 -0
  66. package/docs/classes/KeetaNetSDK.Referenced.LedgerRequestCache.html +7 -0
  67. package/docs/classes/KeetaNetSDK.Referenced.Node.html +21 -0
  68. package/docs/classes/KeetaNetSDK.Referenced.P2PSwitch.html +40 -0
  69. package/docs/classes/KeetaNetSDK.Referenced.PendingAccount.html +5 -0
  70. package/docs/classes/KeetaNetSDK.Referenced.PermissionSetHolder.html +6 -0
  71. package/docs/classes/KeetaNetSDK.Referenced.Permissions.html +20 -0
  72. package/docs/classes/KeetaNetSDK.Referenced.PossiblyExpiredVote.html +26 -0
  73. package/docs/classes/KeetaNetSDK.Referenced.PublicKeyString.html +8 -0
  74. package/docs/classes/KeetaNetSDK.Referenced.RequestTiming.html +8 -0
  75. package/docs/classes/KeetaNetSDK.Referenced.SignatureStorage.html +12 -0
  76. package/docs/classes/KeetaNetSDK.Referenced.Stats.html +13 -0
  77. package/docs/classes/KeetaNetSDK.Referenced.UserClientBuilder.html +29 -0
  78. package/docs/classes/KeetaNetSDK.Referenced.Vote.html +31 -0
  79. package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHash.html +20 -0
  80. package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHashMap.html +26 -0
  81. package/docs/classes/KeetaNetSDK.Referenced.VoteBuilder.html +8 -0
  82. package/docs/classes/KeetaNetSDK.Referenced.VoteHash.html +11 -0
  83. package/docs/classes/KeetaNetSDK.Referenced.VoteStaple.html +40 -0
  84. package/docs/classes/KeetaNetSDK.Referenced.VoteStapleHash.html +14 -0
  85. package/docs/classes/KeetaNetSDK.Referenced.default.html +9 -0
  86. package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_asn1.BufferStorageASN1.html +9 -0
  87. package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.html +19 -0
  88. package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer.BufferStorage.html +11 -0
  89. package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_certificate.Certificate.html +79 -0
  90. package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_certificate.CertificateBuilder.html +9 -0
  91. package/docs/classes/KeetaNetSDK.UserClient.html +254 -0
  92. package/docs/documents/GETTING-STARTED.html +268 -0
  93. package/docs/enums/KeetaNetSDK.Referenced.AccountKeyAlgorithm.html +9 -0
  94. package/docs/enums/KeetaNetSDK.Referenced.AdjustMethod.html +4 -0
  95. package/docs/enums/KeetaNetSDK.Referenced.BaseFlag.html +15 -0
  96. package/docs/enums/KeetaNetSDK.Referenced.BasePermissionGroup.html +9 -0
  97. package/docs/enums/KeetaNetSDK.Referenced.LedgerKind.html +4 -0
  98. package/docs/enums/KeetaNetSDK.Referenced.NodeKind.html +5 -0
  99. package/docs/enums/KeetaNetSDK.Referenced.OperationType.html +10 -0
  100. package/docs/functions/KeetaNetSDK.Referenced.src_config.getDefaultConfig.html +2 -0
  101. package/docs/functions/KeetaNetSDK.Referenced.src_config.getNetworkAlias.html +1 -0
  102. package/docs/functions/KeetaNetSDK.Referenced.src_config.getValidation.html +1 -0
  103. package/docs/functions/KeetaNetSDK.Referenced.src_config.isNetwork.html +1 -0
  104. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_asn1.isValidSequenceSchema.html +2 -0
  105. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_bloom.deserializeBloomFilter.html +1 -0
  106. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_bloom.serializeBloomFilter.html +1 -0
  107. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.DecodeBase32.html +2 -0
  108. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.DecodeBase64.html +1 -0
  109. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.EncodeBase32.html +2 -0
  110. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.EncodeBase64.html +1 -0
  111. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.ZlibDeflate.html +1 -0
  112. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.ZlibInflate.html +1 -0
  113. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.RegisterSerializable.html +2 -0
  114. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.objectToBuffer.html +1 -0
  115. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.parseHexBigIntString.html +1 -0
  116. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.toJSONSerializable.html +1 -0
  117. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_hash.Hash.html +4 -0
  118. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.arrayRepeat.html +1 -0
  119. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.asleep.html +1 -0
  120. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.bufferToArrayBuffer.html +1 -0
  121. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.checkableGenerator.html +1 -0
  122. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.debugPrintableObject.html +1 -0
  123. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.env.html +3 -0
  124. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.internalLogger.html +1 -0
  125. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.isBuffer.html +6 -0
  126. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.isIntegerOrBigInt.html +2 -0
  127. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.objectToBuffer.html +1 -0
  128. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.promiseGenerator.html +1 -0
  129. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.randomInt.html +1 -0
  130. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.randomString.html +2 -0
  131. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.setGenerator.html +1 -0
  132. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.waitTicks.html +2 -0
  133. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_initial.generateInitialVoteStaple.html +1 -0
  134. package/docs/hierarchy.html +1 -0
  135. package/docs/index.html +4 -0
  136. package/docs/interfaces/KeetaNetSDK.Referenced.ACLEntry.html +10 -0
  137. package/docs/interfaces/KeetaNetSDK.Referenced.ACLRow.html +10 -0
  138. package/docs/interfaces/KeetaNetSDK.Referenced.ACLUpdate.html +12 -0
  139. package/docs/interfaces/KeetaNetSDK.Referenced.APIOptions.html +10 -0
  140. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ExplicitContextTag.html +5 -0
  141. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ImplicitContextTag.html +5 -0
  142. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1Object.html +2 -0
  143. package/docs/interfaces/KeetaNetSDK.Referenced.AccountInfo.html +12 -0
  144. package/docs/interfaces/KeetaNetSDK.Referenced.AccountSignerOptions.html +3 -0
  145. package/docs/interfaces/KeetaNetSDK.Referenced.AccountSignerOptionsJSON.html +3 -0
  146. package/docs/interfaces/KeetaNetSDK.Referenced.AllPendingJSON.html +5 -0
  147. package/docs/interfaces/KeetaNetSDK.Referenced.BaseExternalKeyPairFunctions.html +6 -0
  148. package/docs/interfaces/KeetaNetSDK.Referenced.BaseFlagRule.html +5 -0
  149. package/docs/interfaces/KeetaNetSDK.Referenced.BaseGenerationConfig.html +4 -0
  150. package/docs/interfaces/KeetaNetSDK.Referenced.BlockCanonical.html +10 -0
  151. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSON.html +11 -0
  152. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperation.html +2 -0
  153. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationCREATE_IDENTIFIER.html +4 -0
  154. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMODIFY_PERMISSIONS.html +7 -0
  155. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationRECEIVE.html +7 -0
  156. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSEND.html +6 -0
  157. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_INFO.html +7 -0
  158. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_REP.html +4 -0
  159. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE.html +5 -0
  160. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_SUPPLY.html +5 -0
  161. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOutput.html +5 -0
  162. package/docs/interfaces/KeetaNetSDK.Referenced.BlockOperationValidateContext.html +3 -0
  163. package/docs/interfaces/KeetaNetSDK.Referenced.BlockUnsignedCanonical.html +11 -0
  164. package/docs/interfaces/KeetaNetSDK.Referenced.ComputeBlocksResponse.html +3 -0
  165. package/docs/interfaces/KeetaNetSDK.Referenced.ComputedBlockEffect.html +4 -0
  166. package/docs/interfaces/KeetaNetSDK.Referenced.ComputedBlocksEffectFields.html +8 -0
  167. package/docs/interfaces/KeetaNetSDK.Referenced.ComputedBlocksEffectTokenChangesField.html +1 -0
  168. package/docs/interfaces/KeetaNetSDK.Referenced.Constructor.html +2 -0
  169. package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsNoEncryption.html +6 -0
  170. package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsSupportsEncryption.html +8 -0
  171. package/docs/interfaces/KeetaNetSDK.Referenced.GetPeersAPIResponse.html +9 -0
  172. package/docs/interfaces/KeetaNetSDK.Referenced.GetPeersOptions.html +11 -0
  173. package/docs/interfaces/KeetaNetSDK.Referenced.GetRepresentativeAPIResponse.html +5 -0
  174. package/docs/interfaces/KeetaNetSDK.Referenced.HTTPConfig.html +2 -0
  175. package/docs/interfaces/KeetaNetSDK.Referenced.IdentifierCreateRequest.html +3 -0
  176. package/docs/interfaces/KeetaNetSDK.Referenced.InitialConfigSupply.html +5 -0
  177. package/docs/interfaces/KeetaNetSDK.Referenced.KVSetOptionsType.html +3 -0
  178. package/docs/interfaces/KeetaNetSDK.Referenced.KVStorageProviderAPI.html +8 -0
  179. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerConfig.html +21 -0
  180. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStatistics.html +8 -0
  181. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageAPI.html +69 -0
  182. package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +6 -0
  183. package/docs/interfaces/KeetaNetSDK.Referenced.NodeConfig.html +32 -0
  184. package/docs/interfaces/KeetaNetSDK.Referenced.NumericValueEntry.html +2 -0
  185. package/docs/interfaces/KeetaNetSDK.Referenced.P2PConfig.html +24 -0
  186. package/docs/interfaces/KeetaNetSDK.Referenced.P2PConnection.html +27 -0
  187. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerBase.html +4 -0
  188. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerListener.html +5 -0
  189. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerRepBase.html +7 -0
  190. package/docs/interfaces/KeetaNetSDK.Referenced.P2PSwitchStatistics.html +7 -0
  191. package/docs/interfaces/KeetaNetSDK.Referenced.PeerInfo.html +10 -0
  192. package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperations.html +9 -0
  193. package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperationsJSON.html +9 -0
  194. package/docs/interfaces/KeetaNetSDK.Referenced.PrincipalACLWithInfoParsed.html +24 -0
  195. package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStorage.html +11 -0
  196. package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStringMapping.html +7 -0
  197. package/docs/interfaces/KeetaNetSDK.Referenced.RenderOptions.html +3 -0
  198. package/docs/interfaces/KeetaNetSDK.Referenced.RepresentativeInfo.html +5 -0
  199. package/docs/interfaces/KeetaNetSDK.Referenced.RequestTokenReceiveEntry.html +5 -0
  200. package/docs/interfaces/KeetaNetSDK.Referenced.StatsConfig.html +2 -0
  201. package/docs/interfaces/KeetaNetSDK.Referenced.TextValidationRule.html +4 -0
  202. package/docs/interfaces/KeetaNetSDK.Referenced.TokenNumericEntry.html +4 -0
  203. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientConfig.html +26 -0
  204. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientListenerTypes.html +2 -0
  205. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientOptions.html +16 -0
  206. package/docs/interfaces/KeetaNetSDK.Referenced.ValidationOptions.html +3 -0
  207. package/docs/interfaces/KeetaNetSDK.Referenced.VoteJSON.html +8 -0
  208. package/docs/interfaces/KeetaNetSDK.Referenced.VoteJSONOutput.html +4 -0
  209. package/docs/interfaces/KeetaNetSDK.Referenced.VoteStapleJSON.html +3 -0
  210. package/docs/interfaces/KeetaNetSDK.Referenced.WithConversionClass.html +6 -0
  211. package/docs/interfaces/KeetaNetSDK.Referenced.WithIsInstance.html +3 -0
  212. package/docs/interfaces/KeetaNetSDK.Referenced.signOptionsType.html +9 -0
  213. package/docs/interfaces/KeetaNetSDK.Referenced.src_config.ValidationConfig.html +4 -0
  214. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1BitString.html +4 -0
  215. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Date.html +4 -0
  216. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1OID.html +3 -0
  217. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Set.html +4 -0
  218. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1String.html +4 -0
  219. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_helper.InstanceSet.html +10 -0
  220. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_helper.InstanceSetConstructor.html +2 -0
  221. package/docs/media/index-1.js +517 -0
  222. package/docs/media/index.js +82 -0
  223. package/docs/modules/KeetaNetSDK.Referenced.html +1 -0
  224. package/docs/modules/KeetaNetSDK.Referenced.src_config.html +1 -0
  225. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.html +1 -0
  226. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_asn1.html +1 -0
  227. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_bloom.html +1 -0
  228. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_buffer.html +1 -0
  229. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_certificate.html +1 -0
  230. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_conversion.html +1 -0
  231. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_hash.html +1 -0
  232. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_helper.html +1 -0
  233. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_initial.html +1 -0
  234. package/docs/modules/KeetaNetSDK.html +8 -0
  235. package/docs/modules.html +1 -0
  236. package/docs/types/KeetaNetSDK.Referenced.ACLEntryUnparsed.html +5 -0
  237. package/docs/types/KeetaNetSDK.Referenced.ASN1AnyASN.html +1 -0
  238. package/docs/types/KeetaNetSDK.Referenced.AcceptedPermissionTypes.html +1 -0
  239. package/docs/types/KeetaNetSDK.Referenced.AccountBalancesUnparsed.html +1 -0
  240. package/docs/types/KeetaNetSDK.Referenced.AccountErrorCode.html +1 -0
  241. package/docs/types/KeetaNetSDK.Referenced.AccountInfoResponse.html +6 -0
  242. package/docs/types/KeetaNetSDK.Referenced.AccountOrPending.html +1 -0
  243. package/docs/types/KeetaNetSDK.Referenced.AccountPrefix.html +1 -0
  244. package/docs/types/KeetaNetSDK.Referenced.AccountPublicKeyString.html +1 -0
  245. package/docs/types/KeetaNetSDK.Referenced.AllPending.html +1 -0
  246. package/docs/types/KeetaNetSDK.Referenced.BaseFlagName.html +1 -0
  247. package/docs/types/KeetaNetSDK.Referenced.BaseFlagNames.html +1 -0
  248. package/docs/types/KeetaNetSDK.Referenced.BasePermissionOffsetSet.html +1 -0
  249. package/docs/types/KeetaNetSDK.Referenced.BasicSchemaMap.html +14 -0
  250. package/docs/types/KeetaNetSDK.Referenced.BlockErrorCode.html +1 -0
  251. package/docs/types/KeetaNetSDK.Referenced.BlockJSONIncomplete.html +1 -0
  252. package/docs/types/KeetaNetSDK.Referenced.BlockOperations.html +1 -0
  253. package/docs/types/KeetaNetSDK.Referenced.BlocksAlwaysReturn.html +4 -0
  254. package/docs/types/KeetaNetSDK.Referenced.BlocksWithAddSupply.html +1 -0
  255. package/docs/types/KeetaNetSDK.Referenced.BuilderOptions.html +2 -0
  256. package/docs/types/KeetaNetSDK.Referenced.CanBeArray.html +1 -0
  257. package/docs/types/KeetaNetSDK.Referenced.CertificateBuilderParams.html +23 -0
  258. package/docs/types/KeetaNetSDK.Referenced.CertificateExtensions.html +5 -0
  259. package/docs/types/KeetaNetSDK.Referenced.CertificateIssuerOrSubject.html +4 -0
  260. package/docs/types/KeetaNetSDK.Referenced.CertificateOID.html +3 -0
  261. package/docs/types/KeetaNetSDK.Referenced.CertificateOptions.html +15 -0
  262. package/docs/types/KeetaNetSDK.Referenced.CertificatePublicKeyInfo.html +1 -0
  263. package/docs/types/KeetaNetSDK.Referenced.CertificateSchema.html +1 -0
  264. package/docs/types/KeetaNetSDK.Referenced.CertificateValidity.html +1 -0
  265. package/docs/types/KeetaNetSDK.Referenced.CertificateVersionInfo.html +5 -0
  266. package/docs/types/KeetaNetSDK.Referenced.ClientErrorCode.html +1 -0
  267. package/docs/types/KeetaNetSDK.Referenced.ClientRepresentative.html +3 -0
  268. package/docs/types/KeetaNetSDK.Referenced.ComputedEffectOfBlocks.html +4 -0
  269. package/docs/types/KeetaNetSDK.Referenced.ComputedEffectOfBlocksByAccount.html +2 -0
  270. package/docs/types/KeetaNetSDK.Referenced.CreateIdentifierRequest.html +6 -0
  271. package/docs/types/KeetaNetSDK.Referenced.DecodeFunc.html +1 -0
  272. package/docs/types/KeetaNetSDK.Referenced.DelegationUpdate.html +2 -0
  273. package/docs/types/KeetaNetSDK.Referenced.DeserializerCallback.html +2 -0
  274. package/docs/types/KeetaNetSDK.Referenced.DurationBreakdowns.html +1 -0
  275. package/docs/types/KeetaNetSDK.Referenced.ED25519PublicKeyString.html +1 -0
  276. package/docs/types/KeetaNetSDK.Referenced.EncodeFunc.html +1 -0
  277. package/docs/types/KeetaNetSDK.Referenced.ErrorCode.html +1 -0
  278. package/docs/types/KeetaNetSDK.Referenced.ExternalFlagName.html +1 -0
  279. package/docs/types/KeetaNetSDK.Referenced.ExternalKeyPairFunctions.html +1 -0
  280. package/docs/types/KeetaNetSDK.Referenced.ExternalPermissionOffsetSet.html +1 -0
  281. package/docs/types/KeetaNetSDK.Referenced.FlagGroupType.html +1 -0
  282. package/docs/types/KeetaNetSDK.Referenced.FlagOrExternalName.html +1 -0
  283. package/docs/types/KeetaNetSDK.Referenced.FlagOrExternalNames.html +1 -0
  284. package/docs/types/KeetaNetSDK.Referenced.GenericAccount.html +1 -0
  285. package/docs/types/KeetaNetSDK.Referenced.GetAccountStateAPIResponse.html +1 -0
  286. package/docs/types/KeetaNetSDK.Referenced.GetAccountStateAPIResponseFailure.html +3 -0
  287. package/docs/types/KeetaNetSDK.Referenced.GetAccountStateAPIResponseFormatted.html +28 -0
  288. package/docs/types/KeetaNetSDK.Referenced.GetAccountStateAPIResponseSuccess.html +6 -0
  289. package/docs/types/KeetaNetSDK.Referenced.GetAllBalancesResponse.html +6 -0
  290. package/docs/types/KeetaNetSDK.Referenced.GetPrevFunction.html +1 -0
  291. package/docs/types/KeetaNetSDK.Referenced.GetVotesAfterOptions.html +8 -0
  292. package/docs/types/KeetaNetSDK.Referenced.IdentifierAddress.html +1 -0
  293. package/docs/types/KeetaNetSDK.Referenced.IdentifierKeyAlgorithm.html +1 -0
  294. package/docs/types/KeetaNetSDK.Referenced.IdentifierPublicKeyString.html +1 -0
  295. package/docs/types/KeetaNetSDK.Referenced.InitialGenResponse.html +3 -0
  296. package/docs/types/KeetaNetSDK.Referenced.JSONMessage.html +7 -0
  297. package/docs/types/KeetaNetSDK.Referenced.JSONSupportedObject.html +1 -0
  298. package/docs/types/KeetaNetSDK.Referenced.JSONSupportedValue.html +1 -0
  299. package/docs/types/KeetaNetSDK.Referenced.JSONUnsupportedTypes.html +1 -0
  300. package/docs/types/KeetaNetSDK.Referenced.KVErrorCode.html +1 -0
  301. package/docs/types/KeetaNetSDK.Referenced.KeyPairTypes.html +2 -0
  302. package/docs/types/KeetaNetSDK.Referenced.LedgerErrorCode.html +1 -0
  303. package/docs/types/KeetaNetSDK.Referenced.LedgerSelector.html +2 -0
  304. package/docs/types/KeetaNetSDK.Referenced.LedgerStorage.html +2 -0
  305. package/docs/types/KeetaNetSDK.Referenced.Mutable.html +4 -0
  306. package/docs/types/KeetaNetSDK.Referenced.NetworkAddress.html +1 -0
  307. package/docs/types/KeetaNetSDK.Referenced.NetworkPublicKeyString.html +1 -0
  308. package/docs/types/KeetaNetSDK.Referenced.NodeLike.html +2 -0
  309. package/docs/types/KeetaNetSDK.Referenced.P2PPeer.html +1 -0
  310. package/docs/types/KeetaNetSDK.Referenced.P2PPeerRep.html +4 -0
  311. package/docs/types/KeetaNetSDK.Referenced.PaginatedVotes.html +4 -0
  312. package/docs/types/KeetaNetSDK.Referenced.PerAccount.html +1 -0
  313. package/docs/types/KeetaNetSDK.Referenced.PermissionOffsetSet.html +1 -0
  314. package/docs/types/KeetaNetSDK.Referenced.PermissionsErrorCode.html +1 -0
  315. package/docs/types/KeetaNetSDK.Referenced.PublicKeyStringPrefixed.html +4 -0
  316. package/docs/types/KeetaNetSDK.Referenced.Secp256K1PublicKeyString.html +1 -0
  317. package/docs/types/KeetaNetSDK.Referenced.Secp256R1PublicKeyString.html +1 -0
  318. package/docs/types/KeetaNetSDK.Referenced.SerializedConnection.html +3 -0
  319. package/docs/types/KeetaNetSDK.Referenced.StoragePublicKeyString.html +1 -0
  320. package/docs/types/KeetaNetSDK.Referenced.TimeStat.html +3 -0
  321. package/docs/types/KeetaNetSDK.Referenced.TimeStats.html +1 -0
  322. package/docs/types/KeetaNetSDK.Referenced.TokenAddress.html +1 -0
  323. package/docs/types/KeetaNetSDK.Referenced.TokenEntry.html +1 -0
  324. package/docs/types/KeetaNetSDK.Referenced.TokenOrPending.html +1 -0
  325. package/docs/types/KeetaNetSDK.Referenced.TokenPublicKeyString.html +1 -0
  326. package/docs/types/KeetaNetSDK.Referenced.UserClientIntervals.html +1 -0
  327. package/docs/types/KeetaNetSDK.Referenced.UserClientListeners.html +1 -0
  328. package/docs/types/KeetaNetSDK.Referenced.UserClientOptionsReadOnly.html +2 -0
  329. package/docs/types/KeetaNetSDK.Referenced.UserClientOrClientAndNetwork.html +5 -0
  330. package/docs/types/KeetaNetSDK.Referenced.Vote.html +1 -0
  331. package/docs/types/KeetaNetSDK.Referenced.VoteErrorCode.html +1 -0
  332. package/docs/types/KeetaNetSDK.Referenced.VoteJSONOutput.html +1 -0
  333. package/docs/types/KeetaNetSDK.Referenced.VoteOptions.html +4 -0
  334. package/docs/types/KeetaNetSDK.Referenced.decryptFunctionType.html +2 -0
  335. package/docs/types/KeetaNetSDK.Referenced.encryptFunctionType.html +2 -0
  336. package/docs/types/KeetaNetSDK.Referenced.fromSeedFunctionType.html +2 -0
  337. package/docs/types/KeetaNetSDK.Referenced.publicKeyASN1.html +3 -0
  338. package/docs/types/KeetaNetSDK.Referenced.seedDerivationFunction.html +2 -0
  339. package/docs/types/KeetaNetSDK.Referenced.signFunctionType.html +2 -0
  340. package/docs/types/KeetaNetSDK.Referenced.src_config.Endpoints.html +6 -0
  341. package/docs/types/KeetaNetSDK.Referenced.src_config.NetworkConfig.html +11 -0
  342. package/docs/types/KeetaNetSDK.Referenced.src_config.NetworkOrID.html +1 -0
  343. package/docs/types/KeetaNetSDK.Referenced.src_config.Networks.html +1 -0
  344. package/docs/types/KeetaNetSDK.Referenced.src_config.Representative.html +9 -0
  345. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1AnyJS.html +1 -0
  346. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1ContextTag.html +1 -0
  347. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1SequenceValidation.html +2 -0
  348. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.Schema.html +1 -0
  349. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.SchemaMap.html +1 -0
  350. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.JSONSerializable.html +1 -0
  351. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.JSONSerializableObject.html +1 -0
  352. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.JSONSupported.html +1 -0
  353. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializable.html +1 -0
  354. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializableOptions.html +3 -0
  355. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_helper.DeepMutable.html +1 -0
  356. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_helper.DistributiveOmit.html +1 -0
  357. package/docs/types/KeetaNetSDK.Referenced.verifyFunctionType.html +2 -0
  358. package/docs/variables/KeetaNetSDK.Referenced.AccountErrorCodes.html +1 -0
  359. package/docs/variables/KeetaNetSDK.Referenced.AccountErrorType.html +1 -0
  360. package/docs/variables/KeetaNetSDK.Referenced.AccountPrefixes.html +2 -0
  361. package/docs/variables/KeetaNetSDK.Referenced.BlockErrorCodes.html +1 -0
  362. package/docs/variables/KeetaNetSDK.Referenced.BlockErrorType.html +1 -0
  363. package/docs/variables/KeetaNetSDK.Referenced.ClientErrorCodes.html +1 -0
  364. package/docs/variables/KeetaNetSDK.Referenced.ClientErrorType.html +1 -0
  365. package/docs/variables/KeetaNetSDK.Referenced.KVErrorCodes.html +1 -0
  366. package/docs/variables/KeetaNetSDK.Referenced.KVErrorType.html +1 -0
  367. package/docs/variables/KeetaNetSDK.Referenced.LedgerErrorCodes.html +1 -0
  368. package/docs/variables/KeetaNetSDK.Referenced.LedgerErrorType.html +1 -0
  369. package/docs/variables/KeetaNetSDK.Referenced.Operation.html +2 -0
  370. package/docs/variables/KeetaNetSDK.Referenced.PermissionsErrorCodes.html +1 -0
  371. package/docs/variables/KeetaNetSDK.Referenced.PermissionsErrorType.html +1 -0
  372. package/docs/variables/KeetaNetSDK.Referenced.VoteErrorCodes.html +1 -0
  373. package/docs/variables/KeetaNetSDK.Referenced.VoteErrorType.html +1 -0
  374. package/docs/variables/KeetaNetSDK.Referenced.default.html +3 -0
  375. package/docs/variables/KeetaNetSDK.Referenced.durationRanges.html +1 -0
  376. package/docs/variables/KeetaNetSDK.Referenced.externalFlagPrefix.html +1 -0
  377. package/docs/variables/KeetaNetSDK.Referenced.identifierKeyTypes.html +1 -0
  378. package/docs/variables/KeetaNetSDK.Referenced.src_config.NetworkIDs.html +1 -0
  379. package/docs/variables/KeetaNetSDK.Referenced.src_config.baseValidationConfig.html +1 -0
  380. package/docs/variables/KeetaNetSDK.Referenced.src_config.networksArray.html +2 -0
  381. package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1BigIntToBuffer.html +1 -0
  382. package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1IntegerToBigInt.html +1 -0
  383. package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1toJS.html +1 -0
  384. package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_asn1.JStoASN1.html +1 -0
  385. package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_asn1.asn1.html +1 -0
  386. package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_hash.HashFunctionLength.html +2 -0
  387. package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_hash.HashFunctionName.html +2 -0
  388. package/docs/variables/KeetaNetSDK.lib.html +4 -0
  389. package/examples/basic/index.js +82 -0
  390. package/examples/basic/package-lock.json +126 -0
  391. package/examples/basic/package.json +14 -0
  392. package/examples/rwa-nft/index.js +517 -0
  393. package/examples/rwa-nft/package-lock.json +126 -0
  394. package/examples/rwa-nft/package.json +14 -0
  395. package/lib/account.d.ts +2 -2
  396. package/lib/block/index.d.ts +1 -1
  397. package/lib/block/operations.d.ts +1 -1
  398. package/lib/error/account.d.ts +1 -1
  399. package/lib/error/block.d.ts +1 -1
  400. package/lib/error/client.d.ts +2 -2
  401. package/lib/error/index.d.ts +1 -1
  402. package/lib/error/kv.d.ts +1 -1
  403. package/lib/error/ledger.d.ts +1 -1
  404. package/lib/error/permissions.d.ts +1 -1
  405. package/lib/error/vote.d.ts +1 -1
  406. package/lib/index.d.ts +6 -2
  407. package/lib/kv/index.d.ts +2 -3
  408. package/lib/kv/kv_dynamodb.d.ts +1 -1
  409. package/lib/kv/kv_memory.d.ts +1 -1
  410. package/lib/kv/kv_redis.d.ts +1 -5
  411. package/lib/ledger/db_spanner_helper.d.ts +1 -1
  412. package/lib/ledger/types.d.ts +53 -1
  413. package/lib/p2p.d.ts +1 -1
  414. package/lib/permissions.d.ts +1 -1
  415. package/lib/stats.d.ts +1 -1
  416. package/lib/utils/asn1.d.ts +0 -14
  417. package/lib/utils/buffer.d.ts +0 -1
  418. package/lib/utils/certificate.d.ts +2 -2
  419. package/lib/utils/conversion.d.ts +1 -1
  420. package/lib/utils/hash.d.ts +0 -1
  421. package/lib/vote.d.ts +1 -1
  422. package/package.json +5 -2
  423. package/version.d.ts +1 -1
package/client/index.d.ts CHANGED
@@ -1,3 +1,13 @@
1
+ /**
2
+ * JavaScript and TypeScript SDK for the KeetaNet network.
3
+ *
4
+ * This SDK provides a low- and high-level interfaces to the KeetaNet network.
5
+ *
6
+ * See the [Getting Started](../../docs/GETTING-STARTED.md) guide for an overview of how to
7
+ * get started with the SDK.
8
+ *
9
+ * @module KeetaNetSDK
10
+ */
1
11
  import KeetaNet from '../lib';
2
12
  import type { GenericAccount, IdentifierKeyAlgorithm, NetworkAddress, TokenAddress } from '../lib/account';
3
13
  import Account, { AccountKeyAlgorithm } from '../lib/account';
@@ -7,7 +17,7 @@ import type { P2PSwitchStatistics } from '../lib/p2p';
7
17
  import * as Config from '../config';
8
18
  import type { BuilderOptions } from './builder';
9
19
  import { UserClientBuilder } from './builder';
10
- import KeetaNetError from '../lib/error';
20
+ import { KeetaNetError } from '../lib/error';
11
21
  import type { AccountInfo, GetAllBalancesResponse, ACLRow, LedgerStatistics } from '../lib/ledger/types';
12
22
  import type { LedgerSelector, LedgerStorage } from '../lib/ledger';
13
23
  import type { AcceptedPermissionTypes } from '../lib/permissions';
@@ -15,98 +25,549 @@ import { type BlockOperations } from '../lib/block/operations';
15
25
  type Vote = InstanceType<typeof KeetaNet['Vote']>;
16
26
  type VoteStaple = InstanceType<typeof KeetaNet['Vote']['Staple']>;
17
27
  type VoteBlocksHash = Vote['blocksHash'];
28
+ /**
29
+ * Account information
30
+ * @expandType AccountInfo
31
+ * @expandType GetAllBalancesResponse
32
+ */
18
33
  type GetAccountStateAPIResponseFormatted = {
34
+ /**
35
+ * The account for which this information is for
36
+ */
19
37
  account: GenericAccount;
38
+ /**
39
+ * The current head block for the account, if there is one
40
+ * this will be null if the account is not open
41
+ */
20
42
  currentHeadBlock: string | null;
43
+ /**
44
+ * The current representative for the account, if there is one
45
+ * this will be null if the account is not open or if the
46
+ * account has not yet set a representative
47
+ */
21
48
  representative: Account | null;
49
+ /**
50
+ * Metadata for the account which can be set with the
51
+ * {@link UserClient['setInfo']}() method
52
+ */
22
53
  info: AccountInfo;
54
+ /**
55
+ * The balances for the account
56
+ * Each token will have a balance, even if it is 0
57
+ * This will be an empty array if the account is not open
58
+ */
23
59
  balances: GetAllBalancesResponse;
24
60
  };
25
61
  interface PeerInfo {
62
+ /**
63
+ * The kind of peer that is connected, which is an index into the
64
+ * {@link NodeKind} enum
65
+ */
26
66
  kind: number;
67
+ /**
68
+ * IF the peer is a representative and the peer has been greeted
69
+ * this will be the representative's public key
70
+ */
27
71
  key?: string;
72
+ /**
73
+ * If the peer is a representative and the peer has been greeted
74
+ * this will be the P2P endpoint for the representative
75
+ */
28
76
  endpoint?: string;
29
77
  }
78
+ /** @expandType PeerInfo */
30
79
  interface GetPeersAPIResponse {
80
+ /**
81
+ * The peers for the node
82
+ */
31
83
  peers: PeerInfo[];
32
84
  }
33
85
  interface RepresentativeInfo {
86
+ /**
87
+ * The representative account address
88
+ */
34
89
  representative: string;
90
+ /**
91
+ * The weight of the representative
92
+ */
35
93
  weight: bigint;
36
94
  }
95
+ /**
96
+ * The response from the API when requesting the ACLs for a given account
97
+ * @expandType ACLRow
98
+ * @expandType AccountInfo
99
+ * @expandType GetAllBalancesResponse
100
+ */
37
101
  interface PrincipalACLWithInfoParsed {
102
+ /**
103
+ * The account for which this ACL is set
104
+ */
38
105
  entity: GenericAccount;
39
106
  principals: ACLRow[];
107
+ /**
108
+ * Metadata for the `entity`
109
+ */
40
110
  info: AccountInfo;
111
+ /**
112
+ * The balances for the `entity`
113
+ */
41
114
  balances: GetAllBalancesResponse;
42
115
  }
116
+ /**
117
+ */
43
118
  interface UserClientOptions {
119
+ /**
120
+ * Use the "publish aid" service to publish blocks.
121
+ *
122
+ * This service handles requesting short votes and permanent votes
123
+ * and publishing to the network. This can reduce latency for clients
124
+ * far away from representatives because they only need to wait for
125
+ * a single response instead of multiple round-trips.
126
+ *
127
+ * The default is false.
128
+ */
44
129
  usePublishAid?: boolean;
130
+ /**
131
+ * If using the publish aid (see {@link UserClientOptions['usePublishAid']})
132
+ * the URL to use.
133
+ *
134
+ * The default depends on the network configuration.
135
+ */
45
136
  publishAidURL?: string;
137
+ /**
138
+ * The account to use for the user client, if this is not supplied then
139
+ * the `signer` will be used (if available) otherwise this there will
140
+ * be no account and some operations may not be available.
141
+ */
46
142
  account?: GenericAccount;
47
143
  }
144
+ /**
145
+ * The set of options that are applicable to read-only operations
146
+ */
147
+ type UserClientOptionsReadOnly = Pick<UserClientOptions, 'account'>;
48
148
  interface UserClientConfig extends UserClientOptions {
149
+ /**
150
+ * Account to use to sign blocks for this instance of the {@link UserClient}
151
+ * If this is `null` then no account will be used and some operations may not
152
+ * be available.
153
+ */
49
154
  signer: Account | null;
155
+ /**
156
+ * The {@link Client} to use for interacting with the KeetaNet network
157
+ */
50
158
  client: Client;
159
+ /**
160
+ * The network to use for this instance of the {@link UserClient}
161
+ */
51
162
  network: bigint;
163
+ /**
164
+ * The network alias to use for this instance of the {@link UserClient}
165
+ * @expand
166
+ */
52
167
  networkAlias: Config.Networks;
53
168
  }
169
+ /**
170
+ * A representative for the client
171
+ */
54
172
  type ClientRepresentative = Config.Representative & {
173
+ /**
174
+ * The weight of the representative, in terms of voting power
175
+ */
55
176
  weight?: bigint;
56
177
  };
178
+ /**
179
+ * The Client class provides a low-level interface to the KeetaNet network.
180
+ * It handles sending messages to the KeetaNet representatives and parsing
181
+ * the responses.
182
+ *
183
+ * It does not handle any of the higher-level logic of the KeetaNet network,
184
+ * for that there is the {@link UserClient} class.
185
+ *
186
+ * @summary
187
+ * Low-level access to the KeetaNet network
188
+ *
189
+ * @example
190
+ * ```typescript
191
+ * import { Client } from '@keetanetwork/keetanet-client';
192
+ * const client = Client.fromNetwork('test');
193
+ * const blocks = await client.getChain('keeta_...');
194
+ * ```
195
+ */
57
196
  export declare class Client {
58
197
  #private;
198
+ /**
199
+ * A reference to the {@link UserClientBuilder} class, which is the high-level
200
+ * interface to building blocks.
201
+ */
59
202
  static readonly Builder: typeof UserClientBuilder;
203
+ /**
204
+ * A reference to the {@link Config} class, which provides access to
205
+ * the KeetaNet configuration utilities.
206
+ */
60
207
  static readonly Config: typeof Config;
208
+ /**
209
+ * The default logger to use for new instances of the {@link Client} class.
210
+ * This is set to the `console` object by default, but can be changed
211
+ * by the application.
212
+ */
61
213
  static DefaultLogger: Pick<typeof console, 'log' | 'error' | 'warn'>;
214
+ /**
215
+ * The logger to use for this instance of the {@link Client} class. This
216
+ * is defined by the `Client.DefaultLogger` property, but can be overridden
217
+ * by the application.
218
+ */
62
219
  logger: Pick<Console, "error" | "log" | "warn">;
220
+ /**
221
+ * Stats for this instance of the client
222
+ */
63
223
  readonly stats: {
224
+ /**
225
+ * Breakdown of the API calls made
226
+ */
64
227
  api: {
228
+ /**
229
+ * The total number of times the API was called
230
+ */
65
231
  called: number;
232
+ /**
233
+ * The number of times the API failed
234
+ */
66
235
  failures: number;
67
236
  };
68
237
  };
238
+ /**
239
+ * Construct a new instance of the {@link Client} class from the given
240
+ * network name. This will use the default representatives for the
241
+ * network based on the configuration.
242
+ *
243
+ * New instances should be cleaned up with the {@link destroy}() method
244
+ * when they are no longer needed.
245
+ *
246
+ * This is the recommended way to create a new instance of the {@link Client} class.
247
+ *
248
+ * @param network The network to use for this instance of the {@link Client} class
249
+ * @return A new instance of the {@link Client} class
250
+ * @expandType Config.Networks
251
+ */
69
252
  static fromNetwork(network: Config.Networks): Client;
253
+ /**
254
+ * Check if the given object is an instance of the {@link Client} class.
255
+ * This is preferred to using the `instanceof` operator because it will
256
+ * work across different contexts.
257
+ */
70
258
  static isInstance: (obj: any, strict?: boolean) => obj is Client;
259
+ /**
260
+ * Create a new instance of the {@link Client} class from the given set
261
+ * of representatives. This is used to create a new instance of the
262
+ * {@link Client} class with a custom set of representatives.
263
+ *
264
+ * New instances should be cleaned up with the {@link destroy}() method
265
+ * when they are no longer needed.
266
+ *
267
+ * In general this is not needed and the {@link Client.fromNetwork}()
268
+ * method should be used instead.
269
+ *
270
+ * @param reps The representatives to use for this instance of the {@link Client} class
271
+ * @return A new instance of the {@link Client} class
272
+ * @expandType ClientRepresentative
273
+ */
71
274
  constructor(reps: ClientRepresentative[]);
275
+ /**
276
+ * Destroy this instance of the {@link Client} class. This will clean up
277
+ * any resources used by the instance and stop any background tasks.
278
+ */
72
279
  destroy(): Promise<void>;
280
+ /**
281
+ * Create a new instance of the {@link UserClientBuilder} class. This
282
+ * is a convenience method to create a new instance of the builder
283
+ * class.
284
+ *
285
+ * The builder class is used to create blocks in a high-level way.
286
+ *
287
+ * @param options The options to use for the builder
288
+ * @expandType BuilderOptions
289
+ */
73
290
  makeBuilder(options: BuilderOptions): UserClientBuilder;
291
+ /**
292
+ * Compute the blocks for a given builder. This will take the
293
+ * pending operations and compute the blocks for them.
294
+ *
295
+ * This will additionally mutate the state of the builder to "seal" the
296
+ * blocks meaning new operations will be added to new blocks.
297
+ *
298
+ * @param network The network to use for the builder
299
+ * @param builder The builder to use for the computation
300
+ * @return The blocks that were computed
301
+ */
74
302
  computeBuilderBlocks(network: bigint, builder: UserClientBuilder): Promise<import("./builder").ComputeBlocksResponse>;
303
+ /**
304
+ * Transmit a set of blocks to the network. This will request short
305
+ * votes and permanent votes for the blocks and then publish them to
306
+ * the network.
307
+ *
308
+ * @param blocks The blocks or UserClientBuilder to transmit
309
+ * @return The result of the publish operation
310
+ */
75
311
  transmit(blocks: Block[]): ReturnType<Client['transmitStaple']>;
312
+ /**
313
+ * Transmit a set of blocks to the network. This will request short
314
+ * votes and permanent votes for the blocks and then publish them to
315
+ * the network.
316
+ *
317
+ * The `blocks` builder will be computed using {@link computeBuilderBlocks} and then transmitted.
318
+ *
319
+ * @param blocks The UserClientBuilder to compute and transmit transmit
320
+ * @param network The network to use for the builder (if using a builder)
321
+ * @return The result of the publish operation
322
+ */
76
323
  transmit(blocks: UserClientBuilder, network: bigint): ReturnType<Client['transmitStaple']>;
77
- transmitStaple(votesAndBlocks: VoteStaple, reps?: ClientRepresentative[]): Promise<any>;
324
+ /**
325
+ * Publish a Vote Staple to the network. This will publish the votes
326
+ * and blocks to the network.
327
+ *
328
+ * If `reps` is not defined then the highest weight representative
329
+ * will be used. If `reps` is defined then the votes and blocks
330
+ * will be published to all representatives in the list.
331
+ *
332
+ * @param votesAndBlocks The votes and blocks to publish
333
+ * @param reps The representatives to publish to
334
+ * @returns The result of the publish operation as well as the vote staple
335
+ * @expandType ClientRepresentative
336
+ */
337
+ transmitStaple(votesAndBlocks: VoteStaple, reps?: ClientRepresentative[]): Promise<{
338
+ voteStaple: VoteStaple;
339
+ publish: boolean;
340
+ from: 'direct';
341
+ }>;
342
+ /**
343
+ * Get statistics about the preferred representative
344
+ * @expandType LedgerStatistics
345
+ * @expandType P2PSwitchStatistics
346
+ */
78
347
  getNodeStats(): Promise<{
79
348
  ledger: LedgerStatistics;
80
349
  switch: P2PSwitchStatistics;
81
350
  }>;
351
+ /**
352
+ * Get the supply of a token. This will return the total supply of the
353
+ * specified token.
354
+ *
355
+ * @param token The token to get the supply for
356
+ * @return The total supply of the token
357
+ */
82
358
  getTokenSupply(token: TokenAddress | string): Promise<bigint>;
359
+ /**
360
+ * Fetch the account information for a given account. This will return
361
+ * the account information including the current head block, representative,
362
+ * balances, and metadata.
363
+ *
364
+ * @param account The account to fetch the information for
365
+ * @return The account information
366
+ */
83
367
  getAccountInfo(account: GenericAccount | string): Promise<GetAccountStateAPIResponseFormatted>;
368
+ /**
369
+ * Fetch the account information for multiple accounts. This will return
370
+ * the account information including the current head block, representative,
371
+ * balances, and metadata for each account.
372
+ *
373
+ * @param accounts The accounts to fetch the information for
374
+ * @return The account information for each account, as an object
375
+ * with the account as the key and the account information as the value
376
+ */
84
377
  getAccountsInfo(accounts: (GenericAccount | string)[]): Promise<{
85
378
  [account: string]: GetAccountStateAPIResponseFormatted;
86
379
  }>;
87
- listACLsByPrincipal(account: GenericAccount | string, targets?: (GenericAccount | string)[]): Promise<ACLRow[]>;
380
+ /**
381
+ * List the ACLs that have been set for a given account that are
382
+ * targeting a particular set of accounts. This will return the ACLs
383
+ * including the principal, entity, and permissions for each ACL entry.
384
+ *
385
+ * @param account The account to list the ACLs for
386
+ * @param entities The accounts to filter the ACLs by
387
+ * @return The ACLs for the account where the target is one of the
388
+ * specified accounts
389
+ */
390
+ listACLsByPrincipal(account: GenericAccount | string, entities?: (GenericAccount | string)[]): Promise<ACLRow[]>;
391
+ /**
392
+ * List the ACLs that have been set for a given account that are
393
+ * targeting a particular set of accounts. This will return the ACLs
394
+ * including the principal, entity, and permissions for each ACL entry.
395
+ *
396
+ * @param account The account to list the ACLs for
397
+ * @param targets The accounts to filter the ACLs by
398
+ * @return The ACLs for the account where the target is one of the
399
+ * specified accounts with additional information
400
+ */
88
401
  listACLsByPrincipalWithInfo(account: GenericAccount | string, targets?: (GenericAccount | string)[]): Promise<PrincipalACLWithInfoParsed[]>;
402
+ /**
403
+ * List the ACLs that have been set on a given account by any other
404
+ * account. This will return the ACLs including the principal.
405
+ *
406
+ * @param entity The account to list the ACLs for
407
+ * @return The ACLs for the account where the entity is the
408
+ * specified account
409
+ */
89
410
  listACLsByEntity(entity: GenericAccount | string): Promise<ACLRow[]>;
411
+ /**
412
+ * Get the balance of a given account for a given token.
413
+ *
414
+ * @param account The account to get the balance for
415
+ * @param token The token to get the balance of for the given account
416
+ * @return The balance of the account for the given token
417
+ */
90
418
  getBalance(account: GenericAccount | string, token: TokenAddress | string): Promise<bigint>;
419
+ /**
420
+ * Get the balance of a given account for all tokens.
421
+ *
422
+ * @param account The account to get the balance for
423
+ * @return An array of objects which specify the token and the balance
424
+ * for each token the user holds a balance for
425
+ */
91
426
  getAllBalances(account: GenericAccount | string): Promise<GetAllBalancesResponse>;
427
+ /**
428
+ * Get the current head block for a given account. This will return the
429
+ * entire block, or null if the account has not created any blocks.
430
+ *
431
+ * An account with no blocks may still have a balance because other users
432
+ * may have sent tokens to it.
433
+ *
434
+ * @param account The account to get the head block for
435
+ * @return The head block for the account or null if the account has
436
+ * not created any blocks
437
+ */
92
438
  getHeadBlock(account: GenericAccount | string): Promise<Block | null>;
439
+ /**
440
+ * Get a block from the specified representative by its block hash.
441
+ *
442
+ * The default mode of operation will request the block from the main
443
+ * ledger of the "best" representative.
444
+ *
445
+ * The "side" ledger is a special ledger that is used to hold
446
+ * unpublished blocks that the given representative has learned about
447
+ * but which have not been published to the network. This is used as
448
+ * part of the voting process.
449
+ *
450
+ * @param blockhash The block hash to get the block for
451
+ * @return The block for the given block hash or null if the block does not exist on the given ledger
452
+ */
93
453
  getBlock(blockhash: BlockHash | string): Promise<Block | null>;
454
+ /**
455
+ * @param blockhash The block hash to get the block for
456
+ * @param side The side of the ledger to get the block from -- this is generally "main", but it is possible to request "side" ledger blocks
457
+ * @param rep The representative to get the block from -- this is generally "ANY" in which case the best representative will be used, but it is possible to request a specific representative
458
+ * @return The block for the given block hash or null if the block does not exist on the given ledger
459
+ */
94
460
  getBlock(blockhash: BlockHash | string, side?: LedgerSelector, rep?: ClientRepresentative | 'ANY'): Promise<Block | null>;
461
+ /**
462
+ * Get the vote staple for a given block hash. This will return the entire
463
+ * vote staple including the blocks whose hash has not been requested.
464
+ *
465
+ * The default mode of operation will request the block from the main
466
+ * ledger of the "best" representative.
467
+ *
468
+ * The "side" ledger is a special ledger that is used to hold unpublished
469
+ * votes and blocks that the given representative has learned about but
470
+ * which have not been published to the network. This is used as part
471
+ * of the voting process.
472
+ *
473
+ * @param blockhash The block hash to get the vote staple for
474
+ * @return The vote staple for the given block hash or null if the vote staple does not exist on the given ledger
475
+ */
95
476
  getVoteStaple(blockhash: BlockHash | string): Promise<VoteStaple | null>;
477
+ /**
478
+ * @param blockhash The block hash to get the vote staple for
479
+ * @param side The side of the ledger to get the vote staple from -- this is generally "main", but it is possible to request "side" ledger blocks
480
+ * @return The vote staple for the given block hash or null if the vote staple does not exist on the given ledger
481
+ */
96
482
  getVoteStaple(blockhash: BlockHash | string, side?: LedgerStorage): Promise<VoteStaple | null>;
483
+ /**
484
+ * Get the chain for a given account. This is the set of blocks that
485
+ * the account has created. This will return the blocks in reverse
486
+ * order, with the most recent block first.
487
+ *
488
+ * This is a paginated request and may return only a partial set of
489
+ * blocks for a given request if there are more blocks to be fetched
490
+ * from the representative. The `startBlock` parameter can be used to
491
+ * fetch the next set of blocks. Once all blocks have been fetched
492
+ * an empty array will be returned.
493
+ *
494
+ * The `depth` parameter can be used to limit the number of blocks
495
+ * returned. The default is to leave it up to the representative to
496
+ * determine the number of blocks to return. The representative
497
+ * may return fewer than the requested number of blocks even if there
498
+ * are more blocks available, except that it will always return at
499
+ * least 1 block if there are any blocks available.
500
+ *
501
+ * @param account The account to get the chain for
502
+ * @param options The options to use for the request
503
+ * @param options.startBlock The block hash to start from -- this is used to paginate the request
504
+ * @param options.depth The maximum number of blocks to return -- this is used to limit the number of blocks returned
505
+ * @return The chain of blocks for the given account, in reverse order starting with the most recent block
506
+ */
97
507
  getChain(account: GenericAccount | string, options?: {
98
508
  startBlock?: BlockHash | string;
99
509
  depth?: number;
100
510
  }): Promise<Block[]>;
511
+ /**
512
+ * Get the history for a given account. This is the set of vote
513
+ * staples that have interacted with the account. This is different
514
+ * from the chain in that it includes vote staples that have affected
515
+ * this account but are not directly created by this account.
516
+ *
517
+ * This is a paginated request and may return only a partial set of
518
+ * vote staples for a given request if there are more vote staples
519
+ * to be fetched from the representative. The `startBlocksHash`
520
+ * parameter can be used to fetch the next set of vote staples.
521
+ * It can be computed from the last entry in the previous
522
+ * response's `blocksHash` field. Once all vote staples have been
523
+ * fetched an empty array will be returned.
524
+ *
525
+ * The `depth` parameter can be used to limit the number of vote
526
+ * staples returned. The default is to leave it up to the
527
+ * representative to determine the number of vote staples to return.
528
+ * The representative may return fewer than the requested number of
529
+ * vote staples even if there are more vote staples available, except
530
+ * that it will always return at least 1 vote staple if there are any
531
+ * vote staples available.
532
+ *
533
+ * @param account The account to get the history for
534
+ * @param options The options to use for the request
535
+ * @param options.startBlocksHash The block hash to start from -- this is used to paginate the request
536
+ * @param options.depth The maximum number of vote staples to return -- this is used to limit the number of vote staples returned
537
+ * @return The history of vote staples for the given account, in reverse order starting with the most recent vote staple
538
+ */
101
539
  getHistory(account: GenericAccount | string, options?: {
102
540
  startBlocksHash?: VoteBlocksHash | string;
103
541
  depth?: number;
104
542
  }): Promise<{
105
543
  voteStaple: VoteStaple;
106
544
  }[]>;
545
+ /**
546
+ * Get the representative information for a given representative account
547
+ *
548
+ * @param rep The representative account to get the information for
549
+ * @return The representative information
550
+ */
107
551
  getSingleRepresentativeInfo(rep?: Account | string): Promise<RepresentativeInfo>;
552
+ /**
553
+ * Get a list of peers that the node is connected to.
554
+ *
555
+ * @returns The list of peers that the node is connected to
556
+ */
108
557
  getPeers(): Promise<GetPeersAPIResponse>;
558
+ /**
559
+ * Get a list of all representatives that the node is aware of
560
+ * and their weights. This will fetch the information from all
561
+ * representatives
562
+ *
563
+ * @return The list of all representatives and their weights
564
+ */
109
565
  getAllRepresentativeInfo(): Promise<RepresentativeInfo[]>;
566
+ /**
567
+ * Get the list of representatives that the CLIENT is aware of
568
+ *
569
+ * @returns The list of representatives that the client is aware of
570
+ */
110
571
  get representatives(): ClientRepresentative[];
111
572
  /**
112
573
  * Get the network status of all representatives
@@ -135,8 +596,52 @@ export declare class Client {
135
596
  outgoingMessagesPeerFailureUngreeted: number;
136
597
  };
137
598
  })[]>;
599
+ /**
600
+ * Update this client's view of the network representatives.
601
+ * This will fetch the list of representatives from the
602
+ * network and update the list of representatives that this
603
+ * client will use.
604
+ *
605
+ * @param addNewReps If true, add any new representatives to the list of representatives
606
+ */
138
607
  updateReps(addNewReps?: boolean): Promise<void>;
608
+ /**
609
+ * Get a list of vote staples that have been added to the
610
+ * representative's ledger since a given moment in time.
611
+ *
612
+ * This method is used to bootstrap a new node with the
613
+ * vote staples that have been added to the ledger since
614
+ * the last time the node was updated.
615
+ *
616
+ * It is a paginated request and may return only a partial set of
617
+ * vote staples for a given request if there are more vote staples
618
+ * to be fetched from the representative. The `moment` parameter
619
+ * can be used to fetch the next set of vote staples, and the
620
+ * `bloomFilter` parameter can be used to tell the server not to
621
+ * include any duplicate vote staples that have already been sent
622
+ * as part of the last page in the case of a `moment` overlap.
623
+ * Once all vote staples have been fetched an empty array will be
624
+ * returned.
625
+ *
626
+ * The bloom filter is constructed from the bytes of the vote staples
627
+ * to exclude.
628
+ *
629
+ * @param moment The moment in time to get the vote staples after
630
+ * @param limit The maximum number of vote staples to return
631
+ * @param bloomFilter The bloom filter to use to filter the vote staples which have already been sent
632
+ * @return The list of vote staples that have been added to the representative's ledger since the given moment in time
633
+ */
139
634
  getVoteStaplesAfter(moment: Date, limit?: number, bloomFilter?: string): Promise<VoteStaple[]>;
635
+ /**
636
+ * Get the pending block for a given account. This will return the
637
+ * block on the representative's side ledger that is pending vote
638
+ * completion. This is used to recover the pending block for an
639
+ * account that has not been published yet.
640
+ *
641
+ * @param account The account to get the pending block for
642
+ * @return The pending block for the account or null if there is no
643
+ * pending block
644
+ */
140
645
  getPendingBlock(account: GenericAccount): Promise<Block | null>;
141
646
  /**
142
647
  * Recover any unpublished or half-publish account artifacts
@@ -145,11 +650,17 @@ export declare class Client {
145
650
  * @param publish Publish the recovered staple to the network (default is true)
146
651
  */
147
652
  recoverAccount(account: GenericAccount, publish?: boolean): Promise<VoteStaple | null>;
653
+ /** Work in progress */
148
654
  getLedgerChecksum(rep?: ClientRepresentative | 'ANY'): Promise<{
149
655
  moment: string;
150
656
  momentRange: number;
151
657
  checksum: string;
152
658
  }>;
659
+ /**
660
+ * Get the version of the node for a given representative, if no
661
+ * representative is specified then the version of the "best"
662
+ * representative will be returned.
663
+ */
153
664
  getVersion(rep?: ClientRepresentative | 'ANY'): Promise<{
154
665
  node: string;
155
666
  }>;
@@ -158,55 +669,375 @@ interface UserClientListenerTypes {
158
669
  change: ((data: GetAccountStateAPIResponseFormatted) => void);
159
670
  }
160
671
  type UserClientEventName = keyof UserClientListenerTypes;
672
+ /**
673
+ * The UserClient class provides a high-level interface, user-oriented
674
+ * interface to the Keeta network. It is designed to be easy to use and
675
+ * handle the most common cases for applications building on top of the
676
+ * Keeta network.
677
+ *
678
+ * @summary
679
+ * High-level, user-oriented interface to the KeetaNet network.
680
+ *
681
+ * @example
682
+ * ```typescript
683
+ * import { UserClient } from '@keetanetwork/keetanet-client';
684
+ * import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client`;
685
+ * const seed = '...'; // 64 character hex seed
686
+ * const account = KeetaNetLib.Account.fromSeed(seed, 0);
687
+ * const client = UserClient.fromNetwork('test');
688
+ * const blocks = await client.chain();
689
+ * ```
690
+ */
161
691
  export declare class UserClient {
162
692
  #private;
693
+ /**
694
+ * Reference to the {@link Config} class for the client. This is used to
695
+ * access the Configuration operations which may be needed for the
696
+ * UserClient.
697
+ */
163
698
  static readonly Config: typeof Config;
699
+ /**
700
+ * The base token for the network this client is connected to.
701
+ */
164
702
  readonly baseToken: TokenAddress;
703
+ /**
704
+ * The network address for the network this client is connected to.
705
+ */
165
706
  readonly networkAddress: NetworkAddress;
707
+ /**
708
+ * Create an instance of the UserClient class from a specific
709
+ * representative. This will use the given representative to
710
+ * initialize the connection to the network, however it will
711
+ * find other representatives to use for the network as well.
712
+ *
713
+ * This is useful for testing and development purposes, but in
714
+ * general it is recommended to use the {@link fromNetwork}
715
+ * method to create a new instance of the UserClient class.
716
+ */
166
717
  static fromSimpleSingleRep(hostname: string, ssl: boolean, repKey: string | Account, networkID: bigint, networkAlias: Config.Networks, signer: Account | null, options?: UserClientOptions): UserClient;
718
+ /**
719
+ * A helper method to get the configuration from the network alias
720
+ * and options. This will use the default representatives for the
721
+ * network based on the {@link Config | configuration}.
722
+ *
723
+ * @param network The {@link Config.Networks | network} to use to generate the configuration
724
+ * @param options The {@link UserClientOptions | options} to use to generate the configuration
725
+ * @return The configuration object for the {@link UserClient} class
726
+ */
167
727
  static getConfigFromNetwork(network: Config.Networks, options?: UserClientOptions): Omit<UserClientConfig, 'signer'>;
728
+ /**
729
+ * Construct a new instance of the {@link UserClient} class from the given
730
+ * network name. This will use the default representatives for the
731
+ * network based on the configuration.
732
+ *
733
+ * New instances should be cleaned up with the {@link destroy}() method
734
+ * when they are no longer needed.
735
+ *
736
+ * This is the recommended way to create a new instance of the {@link UserClient} class.
737
+ *
738
+ * @param network The network to use for this instance of the {@link UserClient} class
739
+ * @param signer The account to use for this instance of the {@link UserClient} class, or null if this is a read-only client
740
+ * @param options The options to use for this instance of the {@link UserClient} class
741
+ * @return A new instance of the {@link UserClient} class
742
+ * @expandType Config.Networks
743
+ * @expandType UserClientOptions
744
+ */
168
745
  static fromNetwork(network: Config.Networks, signer: Account | null, options?: UserClientOptions): UserClient;
746
+ /**
747
+ * Determine if a given object is an instance of the UserClient class.
748
+ * This is preferred over using `instanceof` because it works across
749
+ * different contexts.
750
+ */
169
751
  static isInstance: (obj: any, strict?: boolean) => obj is UserClient;
752
+ /**
753
+ * Helper method to filter a list of vote staples into
754
+ * a list of blocks and operations that are related to
755
+ * a given account.
756
+ *
757
+ * @param voteStaples The list of vote staples to filter
758
+ * @param account The account to search for operations related to
759
+ * @return An array of filtered operations for the given account, ordered by vote staple hash, then by block, and then containing each operation
760
+ */
170
761
  static filterStapleOperations(voteStaples: VoteStaple[], account: GenericAccount): {
171
762
  [stapleHash: string]: {
172
763
  block: Block;
173
764
  filteredOperations: BlockOperations[];
174
765
  }[];
175
766
  };
767
+ /**
768
+ * Construct a new instance of the {@link UserClient} class from the given
769
+ * configuration. This will use the default representatives for the
770
+ * network based on the configuration.
771
+ *
772
+ * New instances should be cleaned up with the {@link destroy} method
773
+ * when they are no longer needed.
774
+ *
775
+ * The recommended way to create a new instance of the {@link UserClient} class
776
+ * is to use the {@link fromNetwork} method.
777
+ */
176
778
  constructor(config: UserClientConfig);
177
- initializeChain(initOpts: {
779
+ /**
780
+ * Generate and publish the blocks needed to initialize a new network
781
+ * with the given parameters.
782
+ *
783
+ * This is generally only needed once per network and is used to
784
+ * initialize the network with a base token and a representative
785
+ * in order to start-up the network.
786
+ *
787
+ * @param initOpts The options to use for the initialization
788
+ * @param initOpts.addSupplyAmount The amount of supply to add to the network of the base token
789
+ * @param initOpts.delegateTo The representative account to delegate the supply to
790
+ * @param initOpts.voteSerial The serial number to use for the vote -- must never be reused by the representative
791
+ * @param options The options to use for the request
792
+ * @returns The vote staple that was generated and whether it was able to be published
793
+ */
794
+ initializeNetwork(initOpts: {
178
795
  addSupplyAmount: bigint;
179
796
  delegateTo?: Account;
180
797
  voteSerial?: bigint;
181
- }, options?: UserClientOptions): Promise<any>;
182
- modTokenSupplyAndBalance(amount: bigint, token: TokenAddress, options?: UserClientOptions): Promise<any>;
798
+ }, options?: UserClientOptions): Promise<{
799
+ voteStaple: VoteStaple;
800
+ publish: boolean;
801
+ from: "direct";
802
+ }>;
803
+ /**
804
+ * Modify both the token supply (mint/burn) and account balance
805
+ * for a given account of a given token.
806
+ *
807
+ * This will mint if a positive amount is given and burn if a negative
808
+ * amount is given, and the add or subtract the same amount from the
809
+ * account balance.
810
+ *
811
+ * @param amount The amount to add or subtract from the token supply and account balance
812
+ * @param token The token to modify the supply and balance for
813
+ * @param options The options to use for the request
814
+ * @return The vote staple that was generated and whether it was able to be published
815
+ */
816
+ modTokenSupplyAndBalance(amount: bigint, token: TokenAddress, options?: UserClientOptionsReadOnly): Promise<{
817
+ voteStaple: VoteStaple;
818
+ publish: boolean;
819
+ from: "direct";
820
+ } | {
821
+ blocks: Block[];
822
+ publish: boolean;
823
+ from: "publish-aid";
824
+ }>;
825
+ /**
826
+ * Create a new {@link UserClientBuilder} instance for this client. This
827
+ * is used to create a new builder for adding operations to which are then
828
+ * converted into the appropriate set of blocks.
829
+ *
830
+ * @param options The options to use for the builder
831
+ * @return A new {@link UserClientBuilder} instance
832
+ */
183
833
  initBuilder(options?: UserClientOptions): UserClientBuilder;
834
+ /**
835
+ * Compute the blocks needed to publish a given builder. This will
836
+ * update the state of the builder and any new operations added after
837
+ * this will generate new blocks.
838
+ *
839
+ * @param builder The builder to compute the blocks for
840
+ * @return The blocks that were computed
841
+ * @deprecated Use {@link UserClientBuilder.computeBlocks} instead
842
+ */
184
843
  computeBuilderBlocks(builder: UserClientBuilder): Promise<import("./builder").ComputeBlocksResponse>;
185
- publishBuilder(builder: UserClientBuilder): Promise<any>;
186
- setInfo(info: AccountInfo, options?: UserClientOptions): Promise<any>;
844
+ /**
845
+ * Compute the blocks needed to publish a given builder and then
846
+ * publish those blocks to the network. The builder should generally
847
+ * not be used after this method is called as the blocks will
848
+ * be published and the builder will be in an invalid state.
849
+ *
850
+ * In general, the {@link UserClientBuilder.publish} method should be used
851
+ * instead of this one.
852
+ *
853
+ * @param builder The builder to publish
854
+ * @return The vote staple that was generated and whether it was able to be published
855
+ */
856
+ publishBuilder(builder: UserClientBuilder): Promise<{
857
+ voteStaple: VoteStaple;
858
+ publish: boolean;
859
+ from: "direct";
860
+ } | {
861
+ blocks: Block[];
862
+ publish: boolean;
863
+ from: "publish-aid";
864
+ }>;
865
+ /**
866
+ * Set the metadata for an account and publish the blocks to the
867
+ * network.
868
+ *
869
+ * @param info The account info to set
870
+ * @param options The options to use for the request
871
+ * @return The vote staple that was generated and whether it was able to be published
872
+ */
873
+ setInfo(info: AccountInfo, options?: UserClientOptions): Promise<{
874
+ voteStaple: VoteStaple;
875
+ publish: boolean;
876
+ from: "direct";
877
+ } | {
878
+ blocks: Block[];
879
+ publish: boolean;
880
+ from: "publish-aid";
881
+ }>;
882
+ /**
883
+ * Send some tokens from this account to another account.
884
+ *
885
+ * If an `external` identifier is provided, it will be included in the
886
+ * Send operation and can be used by the recipient to identify the
887
+ * transaction.
888
+ *
889
+ * @param to The account to send the tokens to
890
+ * @param amount The amount of tokens to send (in base units)
891
+ * @param token The token to send
892
+ * @param external The external identifier to use for the transaction
893
+ * @param options The options to use for the request
894
+ * @param retries The number of times to retry the request if it fails
895
+ * @return The vote staple that was generated and whether it was able to be published
896
+ */
187
897
  send(to: GenericAccount | string, amount: bigint | number, token: TokenAddress | string, external?: string, options?: UserClientOptions, retries?: number): Promise<void>;
898
+ /**
899
+ * Generate a new identifier for the given type and publish the blocks
900
+ *
901
+ * @param type The type of identifier to generate
902
+ * @param options The options to use for the request
903
+ * @return The identifier that was generated
904
+ */
188
905
  generateIdentifier(type: IdentifierKeyAlgorithm, options?: UserClientOptions): Promise<import("./builder").PendingAccount<AccountKeyAlgorithm.NETWORK | AccountKeyAlgorithm.TOKEN | AccountKeyAlgorithm.STORAGE>>;
189
- updatePermissions(principal: GenericAccount | string, permissions: AcceptedPermissionTypes, target?: GenericAccount | string, method?: AdjustMethod, options?: UserClientOptions): Promise<any>;
906
+ /**
907
+ * Update the permissions for a given account. This will publish the
908
+ * changes to the network.
909
+ *
910
+ * @param principal The account to update the permissions regarding for this account
911
+ * @param permissions The permissions to set for the account
912
+ * @param target The account to set the permissions for, if applicable for this permission
913
+ * @param method The method to use for the permission, defaults to SET
914
+ * @param options The options to use for the request
915
+ * @return The vote staple that was generated and whether it was able to be published
916
+ */
917
+ updatePermissions(principal: GenericAccount | string, permissions: AcceptedPermissionTypes, target?: GenericAccount | string, method?: AdjustMethod, options?: UserClientOptions): Promise<{
918
+ voteStaple: VoteStaple;
919
+ publish: boolean;
920
+ from: "direct";
921
+ } | {
922
+ blocks: Block[];
923
+ publish: boolean;
924
+ from: "publish-aid";
925
+ }>;
926
+ /**
927
+ * Get all the balances for the given account. See {@link Client.getAllBalances}
928
+ * for more information.
929
+ *
930
+ * @param options The options to use for the request
931
+ * @return The balances for the account
932
+ */
190
933
  allBalances(options?: UserClientOptions): Promise<GetAllBalancesResponse>;
934
+ /**
935
+ * Get the balance for a given token for the given account. See
936
+ * {@link Client.getBalance} for more information.
937
+ *
938
+ * @param token The token to get the balance for
939
+ * @param options The options to use for the request
940
+ * @return The balance for the account of the given token
941
+ */
191
942
  balance(token: TokenAddress | string, options?: UserClientOptions): Promise<bigint>;
943
+ /**
944
+ * Get the current head block for the given account. This will return
945
+ * the hash of the current head block for the account or null if the
946
+ * account has no blocks.
947
+ *
948
+ * @param options The options to use for the request
949
+ * @return The hash of the current head block for the account or null
950
+ * if the account has no blocks
951
+ */
192
952
  head(options?: UserClientOptions): Promise<BlockHash | null>;
953
+ /**
954
+ * Get a specific block by its hash. This will return the block
955
+ * if it is known to the network or null if it is not.
956
+ *
957
+ * @param blockhash The hash of the block to get
958
+ * @return The block if it is known to the network or null if it is not
959
+ */
193
960
  block(blockhash: BlockHash | string): Promise<Block | null>;
194
- chain(query?: Parameters<Client['getChain']>[1], options?: UserClientOptions): Promise<Block[]>;
195
- history(query?: Parameters<Client['getHistory']>[1], options?: UserClientOptions): Promise<{
961
+ /**
962
+ * Get the chain for the given account. This will return the chain
963
+ * as {@link Client.getChain} does.
964
+ *
965
+ * @param query The query to use for the chain
966
+ * @param options The options to use for the request
967
+ * @return The chain for the account, paginated
968
+ */
969
+ chain(query?: Parameters<Client['getChain']>[1], options?: UserClientOptionsReadOnly): Promise<Block[]>;
970
+ /**
971
+ * Get the history for the given account. This will return the
972
+ * history as {@link Client.getHistory} does.
973
+ *
974
+ * @param query The query to use for the history
975
+ * @param options The options to use for the request
976
+ * @return The history for the account, paginated
977
+ */
978
+ history(query?: Parameters<Client['getHistory']>[1], options?: UserClientOptionsReadOnly): Promise<{
196
979
  voteStaple: import("../lib/vote").VoteStaple;
197
980
  effects: import("../lib/ledger/effects").ComputedEffectOfBlocks;
198
981
  }[]>;
199
- filterStapleOperations(voteStaples: VoteStaple[], options?: UserClientOptions): {
982
+ /**
983
+ * Filter the given vote staples for the user client account. See {@link UserClient.filterStapleOperations}
984
+ * for more information.
985
+ *
986
+ * @param voteStaples The vote staples to filter
987
+ * @param options The options to use for the request
988
+ * @return The filtered operations for the given account, ordered by vote staple hash, then by block, and then containing each operation
989
+ */
990
+ filterStapleOperations(voteStaples: VoteStaple[], options?: UserClientOptionsReadOnly): {
200
991
  [stapleHash: string]: {
201
992
  block: Block;
202
993
  filteredOperations: BlockOperations[];
203
994
  }[];
204
995
  };
205
- state(options?: UserClientOptions): ReturnType<Client['getAccountInfo']>;
206
- listACLsByPrincipal(entity?: (GenericAccount | string)[], options?: UserClientOptions): ReturnType<Client['listACLsByPrincipal']>;
207
- listACLsByEntity(options?: UserClientOptions): ReturnType<Client['listACLsByEntity']>;
208
- listACLsByPrincipalWithInfo(options?: UserClientOptions): ReturnType<Client['listACLsByPrincipalWithInfo']>;
209
- pendingBlock(options?: UserClientOptions): Promise<Block | null>;
996
+ /**
997
+ * Get the current live state of the account. This will return the
998
+ * current state of the account as {@link Client.getAccountInfo} does.
999
+ *
1000
+ * @param options The options to use for the request
1001
+ * @return The current state of the account
1002
+ */
1003
+ state(options?: UserClientOptionsReadOnly): ReturnType<Client['getAccountInfo']>;
1004
+ /**
1005
+ * List ACLs for the given account. This will return the ACLs
1006
+ * that relate to specified entities. See {@link Client.listACLsByPrincipal}
1007
+ * for more information.
1008
+ *
1009
+ * @param entities The list of entities to get the ACLs for
1010
+ * @param options The options to use for the request
1011
+ * @return The ACLs for the account
1012
+ */
1013
+ listACLsByPrincipal(entities?: (GenericAccount | string)[], options?: UserClientOptionsReadOnly): ReturnType<Client['listACLsByPrincipal']>;
1014
+ /**
1015
+ * List ACLs for the given account. This will return the ACLs
1016
+ * the account has set. See {@link Client.listACLsByEntity}
1017
+ * for more information.
1018
+ *
1019
+ * @param options The options to use for the request
1020
+ * @return The ACLs for the account
1021
+ */
1022
+ listACLsByEntity(options?: UserClientOptionsReadOnly): ReturnType<Client['listACLsByEntity']>;
1023
+ /**
1024
+ * List ACLs that others have set for the given account. See {@link Client.listACLsByEntity}
1025
+ * for more information.
1026
+ *
1027
+ * @param options The options to use for the request
1028
+ * @return The ACLs applied for the account
1029
+ */
1030
+ listACLsByPrincipalWithInfo(options?: UserClientOptionsReadOnly): ReturnType<Client['listACLsByPrincipalWithInfo']>;
1031
+ /**
1032
+ * Get the pending block for the given account. This will return
1033
+ * any side-ledger block for that account, or null if there is no
1034
+ * pending block.
1035
+ *
1036
+ * @param options The options to use for the request
1037
+ * @return The pending block for the account or null if there is no
1038
+ * pending block
1039
+ */
1040
+ pendingBlock(options?: UserClientOptionsReadOnly): Promise<Block | null>;
210
1041
  /**
211
1042
  * Recover any unpublished or half-publish account artifacts
212
1043
  *
@@ -222,19 +1053,53 @@ export declare class UserClient {
222
1053
  */
223
1054
  on<EventName extends UserClientEventName>(event: EventName, handler: UserClientListenerTypes[EventName]): symbol;
224
1055
  /**
225
- * Cancel a previously registered callback
1056
+ * Cancel a previously registered callback from {@link on}
226
1057
  */
227
1058
  off(id: symbol): void;
1059
+ /**
1060
+ * Destroy this instance -- this is required to clean up all resources.
1061
+ */
228
1062
  destroy(): Promise<void>;
1063
+ /**
1064
+ * Get the configuration for this UserClient instance.
1065
+ */
229
1066
  get config(): UserClientConfig;
1067
+ /**
1068
+ * Get the low-level {@link Client | client} for this instance.
1069
+ */
230
1070
  get client(): Client;
1071
+ /**
1072
+ * Get the signer for this instance, if it was set. This is the
1073
+ * account that will be used to sign blocks and transactions.
1074
+ * If this is null, then the client is readonly and will not be
1075
+ * able to publish blocks or transactions.
1076
+ */
231
1077
  get signer(): Account | null;
1078
+ /**
1079
+ * Get the account for this instance. This is the account that will
1080
+ * be affected by the blocks and transactions that are published.
1081
+ */
232
1082
  get account(): GenericAccount;
1083
+ /**
1084
+ * Get the network ID for this instance. This is the network that
1085
+ * this instance is connected to.
1086
+ */
233
1087
  get network(): bigint;
1088
+ /**
1089
+ * Whether or not this client is "readonly". This is true if the
1090
+ * signer is null.
1091
+ */
234
1092
  get readonly(): boolean;
235
1093
  }
1094
+ /** @hidden */
236
1095
  export declare function blockGenerator(seed: string, index: number, transactionCount: number, network?: bigint): Promise<import("../lib/vote").VoteStaple>;
1096
+ /** @hidden */
237
1097
  export declare function emitBlocks(client: Client, blocks: number, seed: string, index: number, transactionCount: number, network?: bigint): Promise<void>;
1098
+ /**
1099
+ * Utilities needed for working with KeetaNet
1100
+ * @summary
1101
+ * Utilities needed for working with KeetaNet
1102
+ */
238
1103
  export declare const lib: {
239
1104
  Account: typeof Account;
240
1105
  Block: typeof Block;
@@ -242,7 +1107,7 @@ export declare const lib: {
242
1107
  Ledger: typeof import("../lib/ledger").Ledger;
243
1108
  Node: typeof import("../lib/node").Node;
244
1109
  P2P: typeof import("../lib/p2p").P2PSwitch;
245
- Permissions: typeof import("../lib/permissions").default;
1110
+ Permissions: typeof import("../lib/permissions").Permissions;
246
1111
  Stats: typeof import("../lib/stats").Stats;
247
1112
  Vote: typeof import("../lib/vote").Vote;
248
1113
  Utils: {
@@ -256,4 +1121,4 @@ export declare const lib: {
256
1121
  Certificate: typeof import("../lib/utils/certificate");
257
1122
  };
258
1123
  };
259
- export default Client;
1124
+ export {};