@keetanetwork/keetanet-client 0.10.3 → 0.10.5

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