@keetanetwork/keetanet-client 0.14.3 → 0.14.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 (171) hide show
  1. package/benchmarking/test.d.ts +4 -0
  2. package/client/index-browser.d.ts +18 -1
  3. package/client/index-browser.js +449 -178
  4. package/client/index.d.ts +18 -1
  5. package/client/index.js +479 -165
  6. package/config/index.d.ts +1 -1
  7. package/docs/assets/hierarchy.js +1 -1
  8. package/docs/assets/navigation.js +1 -1
  9. package/docs/assets/search.js +1 -1
  10. package/docs/classes/KeetaNetSDK.Client.html +10 -6
  11. package/docs/classes/KeetaNetSDK.Referenced.BaseSet.html +1 -1
  12. package/docs/classes/KeetaNetSDK.Referenced.BaseVoteBuilder.html +1 -1
  13. package/docs/classes/KeetaNetSDK.Referenced.BlockHash.html +1 -1
  14. package/docs/classes/KeetaNetSDK.Referenced.BlockOperation.html +1 -1
  15. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationCREATE_IDENTIFIER.html +1 -1
  16. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMANAGE_CERTIFICATE.html +1 -1
  17. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMODIFY_PERMISSIONS.html +1 -1
  18. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationRECEIVE.html +1 -1
  19. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSEND.html +1 -1
  20. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_INFO.html +1 -1
  21. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_REP.html +1 -1
  22. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
  23. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_SUPPLY.html +1 -1
  24. package/docs/classes/KeetaNetSDK.Referenced.CertificateHash.html +1 -1
  25. package/docs/classes/KeetaNetSDK.Referenced.ECDSAKeyPair.html +1 -1
  26. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1KeyPair.html +1 -1
  27. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PrivateKey.html +1 -1
  28. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PublicKey.html +1 -1
  29. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1Signature.html +1 -1
  30. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1KeyPair.html +1 -1
  31. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PrivateKey.html +1 -1
  32. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PublicKey.html +1 -1
  33. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1Signature.html +1 -1
  34. package/docs/classes/KeetaNetSDK.Referenced.ED25519KeyPair.html +1 -1
  35. package/docs/classes/KeetaNetSDK.Referenced.ED25519PrivateKey.html +1 -1
  36. package/docs/classes/KeetaNetSDK.Referenced.ED25519PublicKey.html +1 -1
  37. package/docs/classes/KeetaNetSDK.Referenced.ED25519Signature.html +1 -1
  38. package/docs/classes/KeetaNetSDK.Referenced.ExternalKeyPair.html +1 -1
  39. package/docs/classes/KeetaNetSDK.Referenced.ExternalSet.html +1 -1
  40. package/docs/classes/KeetaNetSDK.Referenced.IdentifierKey.html +1 -1
  41. package/docs/classes/KeetaNetSDK.Referenced.IdentifierKeyPair.html +1 -1
  42. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetError.html +8 -5
  43. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetErrorBase.html +6 -0
  44. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerError.html +9 -0
  45. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerVoteError.html +9 -0
  46. package/docs/classes/KeetaNetSDK.Referenced.KeyInterface.html +1 -1
  47. package/docs/classes/KeetaNetSDK.Referenced.KeyStorage.html +1 -1
  48. package/docs/classes/KeetaNetSDK.Referenced.Node.html +1 -1
  49. package/docs/classes/KeetaNetSDK.Referenced.PermissionSetHolder.html +1 -1
  50. package/docs/classes/KeetaNetSDK.Referenced.PossiblyExpiredVote.html +1 -1
  51. package/docs/classes/KeetaNetSDK.Referenced.SignatureStorage.html +1 -1
  52. package/docs/classes/KeetaNetSDK.Referenced.Stats.html +1 -1
  53. package/docs/classes/KeetaNetSDK.Referenced.StatsPending.html +1 -1
  54. package/docs/classes/KeetaNetSDK.Referenced.Vote.html +1 -1
  55. package/docs/classes/KeetaNetSDK.Referenced.VoteBlockBundle.html +1 -1
  56. package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHash.html +1 -1
  57. package/docs/classes/KeetaNetSDK.Referenced.VoteBuilder.html +1 -1
  58. package/docs/classes/KeetaNetSDK.Referenced.VoteHash.html +1 -1
  59. package/docs/classes/KeetaNetSDK.Referenced.VoteLikeBase.html +1 -1
  60. package/docs/classes/KeetaNetSDK.Referenced.VoteQuote.html +1 -1
  61. package/docs/classes/KeetaNetSDK.Referenced.VoteQuoteBuilder.html +1 -1
  62. package/docs/classes/KeetaNetSDK.Referenced.VoteStaple.html +1 -1
  63. package/docs/classes/KeetaNetSDK.Referenced.VoteStapleHash.html +1 -1
  64. package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer.BufferStorage.html +1 -1
  65. package/docs/classes/KeetaNetSDK.UserClient.html +16 -11
  66. package/docs/functions/KeetaNetSDK.Referenced.src_config.getDefaultConfig.html +2 -2
  67. package/docs/functions/KeetaNetSDK.Referenced.src_config.getNetworkAlias.html +1 -1
  68. package/docs/functions/KeetaNetSDK.Referenced.src_config.getValidation.html +1 -1
  69. package/docs/functions/KeetaNetSDK.Referenced.src_config.isNetwork.html +1 -1
  70. package/docs/hierarchy.html +1 -1
  71. package/docs/interfaces/KeetaNetSDK.Referenced.ACLEntry.html +1 -1
  72. package/docs/interfaces/KeetaNetSDK.Referenced.ACLUpdate.html +1 -1
  73. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ExplicitContextTag.html +1 -1
  74. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ImplicitContextTag.html +1 -1
  75. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1Object.html +1 -1
  76. package/docs/interfaces/KeetaNetSDK.Referenced.BaseExternalKeyPairFunctions.html +1 -1
  77. package/docs/interfaces/KeetaNetSDK.Referenced.BaseGenerationConfig.html +3 -2
  78. package/docs/interfaces/KeetaNetSDK.Referenced.BaseIdentifierCreateArguments.html +1 -1
  79. package/docs/interfaces/KeetaNetSDK.Referenced.BaseTokenInfo.html +4 -0
  80. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperation.html +1 -1
  81. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationCREATE_IDENTIFIER.html +1 -1
  82. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATE.html +1 -1
  83. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATESerializable.html +1 -1
  84. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMODIFY_PERMISSIONS.html +1 -1
  85. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationRECEIVE.html +1 -1
  86. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSEND.html +1 -1
  87. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_INFO.html +1 -1
  88. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_REP.html +1 -1
  89. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
  90. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_SUPPLY.html +1 -1
  91. package/docs/interfaces/KeetaNetSDK.Referenced.BlockV1Canonical.html +1 -1
  92. package/docs/interfaces/KeetaNetSDK.Referenced.BlockV2Canonical.html +1 -1
  93. package/docs/interfaces/KeetaNetSDK.Referenced.Constructor.html +1 -1
  94. package/docs/interfaces/KeetaNetSDK.Referenced.DisposableTimingHandle.html +1 -1
  95. package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsNoEncryption.html +1 -1
  96. package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsSupportsEncryption.html +1 -1
  97. package/docs/interfaces/KeetaNetSDK.Referenced.InitialConfigSupply.html +3 -2
  98. package/docs/interfaces/KeetaNetSDK.Referenced.InstanceSet.html +1 -1
  99. package/docs/interfaces/KeetaNetSDK.Referenced.KVGenericOptionsType.html +1 -1
  100. package/docs/interfaces/KeetaNetSDK.Referenced.KVSetOptionsType.html +1 -1
  101. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerConfig.html +5 -3
  102. package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +1 -1
  103. package/docs/interfaces/KeetaNetSDK.Referenced.MultiSigIdentifierCreateArguments.html +1 -1
  104. package/docs/interfaces/KeetaNetSDK.Referenced.MultisigConfig.html +1 -1
  105. package/docs/interfaces/KeetaNetSDK.Referenced.NodeConfig.html +2 -2
  106. package/docs/interfaces/KeetaNetSDK.Referenced.NumericValueEntry.html +1 -1
  107. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerBase.html +1 -1
  108. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerListener.html +1 -1
  109. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerRepBase.html +1 -1
  110. package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStorage.html +1 -1
  111. package/docs/interfaces/KeetaNetSDK.Referenced.RequestTokenReceiveEntry.html +1 -1
  112. package/docs/interfaces/KeetaNetSDK.Referenced.TokenNumericEntry.html +1 -1
  113. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientConfig.html +2 -2
  114. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientOptions.html +1 -1
  115. package/docs/interfaces/KeetaNetSDK.Referenced.WithIsInstance.html +1 -1
  116. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1BitString.html +1 -1
  117. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Date.html +1 -1
  118. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1OID.html +1 -1
  119. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Set.html +1 -1
  120. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1String.html +1 -1
  121. package/docs/modules/KeetaNetSDK.Referenced.html +1 -1
  122. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_initial.html +1 -1
  123. package/docs/types/KeetaNetSDK.Referenced.ErrorCode.html +1 -1
  124. package/docs/types/KeetaNetSDK.Referenced.LedgerBaseErrorCode.html +1 -0
  125. package/docs/types/KeetaNetSDK.Referenced.LedgerVoteErrorCode.html +1 -0
  126. package/docs/variables/KeetaNetSDK.Referenced.FullLedgerBaseErrorCode.html +1 -0
  127. package/docs/variables/KeetaNetSDK.Referenced.FullLedgerVoteErrorCodes.html +1 -0
  128. package/docs/variables/KeetaNetSDK.Referenced.allFullErrorCodes.html +1 -0
  129. package/docs/variables/KeetaNetSDK.Referenced.src_config.networksArray.html +1 -1
  130. package/lib/error/account.d.ts +6 -7
  131. package/lib/error/api.d.ts +8 -0
  132. package/lib/error/base.d.ts +16 -0
  133. package/lib/error/block.d.ts +6 -7
  134. package/lib/error/certificate.d.ts +6 -7
  135. package/lib/error/client.d.ts +6 -7
  136. package/lib/error/index.d.ts +7 -18
  137. package/lib/error/kv.d.ts +6 -7
  138. package/lib/error/ledger.d.ts +28 -8
  139. package/lib/error/permissions.d.ts +6 -7
  140. package/lib/error/vote.d.ts +6 -7
  141. package/lib/ledger/index.d.ts +7 -0
  142. package/lib/node/local.d.ts +1 -2
  143. package/lib/node/utils.d.ts +1 -0
  144. package/lib/utils/initial.d.ts +6 -0
  145. package/npm-shrinkwrap.json +598 -0
  146. package/package.json +3 -2
  147. package/version.d.ts +1 -1
  148. package/docs/types/KeetaNetSDK.Referenced.AccountErrorCode.html +0 -1
  149. package/docs/types/KeetaNetSDK.Referenced.BlockErrorCode.html +0 -1
  150. package/docs/types/KeetaNetSDK.Referenced.CertificateErrorCode.html +0 -1
  151. package/docs/types/KeetaNetSDK.Referenced.ClientErrorCode.html +0 -1
  152. package/docs/types/KeetaNetSDK.Referenced.KVErrorCode.html +0 -1
  153. package/docs/types/KeetaNetSDK.Referenced.LedgerErrorCode.html +0 -1
  154. package/docs/types/KeetaNetSDK.Referenced.PermissionsErrorCode.html +0 -1
  155. package/docs/types/KeetaNetSDK.Referenced.VoteErrorCode.html +0 -1
  156. package/docs/variables/KeetaNetSDK.Referenced.AccountErrorCodes.html +0 -1
  157. package/docs/variables/KeetaNetSDK.Referenced.AccountErrorType.html +0 -1
  158. package/docs/variables/KeetaNetSDK.Referenced.BlockErrorCodes-1.html +0 -1
  159. package/docs/variables/KeetaNetSDK.Referenced.BlockErrorCodes.html +0 -1
  160. package/docs/variables/KeetaNetSDK.Referenced.BlockErrorType.html +0 -1
  161. package/docs/variables/KeetaNetSDK.Referenced.CertificateErrorType.html +0 -1
  162. package/docs/variables/KeetaNetSDK.Referenced.ClientErrorCodes.html +0 -1
  163. package/docs/variables/KeetaNetSDK.Referenced.ClientErrorType.html +0 -1
  164. package/docs/variables/KeetaNetSDK.Referenced.KVErrorCodes.html +0 -1
  165. package/docs/variables/KeetaNetSDK.Referenced.KVErrorType.html +0 -1
  166. package/docs/variables/KeetaNetSDK.Referenced.LedgerErrorCodes.html +0 -1
  167. package/docs/variables/KeetaNetSDK.Referenced.LedgerErrorType.html +0 -1
  168. package/docs/variables/KeetaNetSDK.Referenced.PermissionsErrorCodes.html +0 -1
  169. package/docs/variables/KeetaNetSDK.Referenced.PermissionsErrorType.html +0 -1
  170. package/docs/variables/KeetaNetSDK.Referenced.VoteErrorCodes.html +0 -1
  171. package/docs/variables/KeetaNetSDK.Referenced.VoteErrorType.html +0 -1
@@ -114301,13 +114301,11 @@ const client_Testing = {
114301
114301
  /**
114302
114302
  * Known Networks that exist in the configuration database
114303
114303
  */
114304
- const client_networksArray = ['production', 'staging', 'beta', 'test', 'test2', 'dev'];
114304
+ const client_networksArray = ['main', 'staging', 'test', 'dev'];
114305
114305
  const client_NetworkIDs = {
114306
- 'production': BigInt('0x19294EEAD74C'),
114307
- 'staging': BigInt('0x42455441D74C'),
114308
- 'beta': BigInt('0x42455441'),
114306
+ 'main': BigInt('0x5382'),
114307
+ 'staging': BigInt('0x538201'),
114309
114308
  'test': BigInt('0x54455354'),
114310
- 'test2': BigInt('0x54455355'),
114311
114309
  'dev': BigInt('0x444556')
114312
114310
  };
114313
114311
 
@@ -114382,11 +114380,9 @@ function client_getValidation(networkOrID) {
114382
114380
  }
114383
114381
  const networkAlias = client_getNetworkAlias(networkOrID);
114384
114382
  switch (networkAlias) {
114385
- case 'production':
114383
+ case 'main':
114386
114384
  case 'staging':
114387
- case 'beta':
114388
114385
  case 'test':
114389
- case 'test2':
114390
114386
  case 'dev':
114391
114387
  return client_baseValidationConfig;
114392
114388
  default:
@@ -114404,60 +114400,45 @@ function client_getDefaultConfig(network) {
114404
114400
  const representatives = [];
114405
114401
  let publishAidURL = `https://publish-aid.${network}.api.keeta.com/api/publish`;
114406
114402
  switch (network) {
114407
- case 'production':
114408
- initialTrustedAccount = 'keeta_aabnshntrnip6r5g5m7rwlltj7hbkjaj7zx2tl7fdf2ycac32dxfhttjsshebni';
114409
- representatives.push({
114410
- key: client_lib_account.fromPublicKeyString('keeta_aabanlfwxv3yddwkl4t3fwkmzuqh2czprkwoy63vwtmy5soll6ocknaajjwz5ra'),
114411
- endpoints: {
114412
- api: 'https://rep1.production.network.api.keeta.com/api',
114413
- p2p: 'wss://rep1.production.network.api.keeta.com/p2p'
114403
+ case 'main':
114404
+ {
114405
+ initialTrustedAccount = 'keeta_aabk62tezl4whordlviamlx3zrdgux6lk63cghay45vkzdatyemzvqqjuj5resa';
114406
+ const reps = ['keeta_aabwip6zeo2fnzfxp5hssrrqtascs2277w2zk7vqd6d3k3m4dkt2flcbca2mqki', 'keeta_aabvmwxttv4q56gbfveighwfwp3yvitlrdfsacic3ckqc7lqelsspvmhc7oldmq', 'keeta_aabwqf5fnta4t2v2atieis545b3rqoq6z7x5w3geugiilqlz5jdsb5og2rmxvdq', 'keeta_aablpogflko72eusdhuuqgsto2rwcvy2m5mo5snmvrmbacz3qczwjtwpmzf5ufq'];
114407
+ for (let index = 0; index < reps.length; index++) {
114408
+ const repID = index + 1;
114409
+ const repKey = reps[index];
114410
+ representatives.push({
114411
+ key: client_lib_account.fromPublicKeyString(repKey).assertAccount(),
114412
+ endpoints: {
114413
+ api: `https://rep${repID}.main.network.api.keeta.com/api`,
114414
+ p2p: `wss://rep${repID}.main.network.api.keeta.com/p2p`
114415
+ }
114416
+ });
114414
114417
  }
114415
- });
114418
+ }
114416
114419
  break;
114417
114420
  case 'staging':
114418
- initialTrustedAccount = 'keeta_aabivlxod37q5uno7dkaze4c2ch3m7nkoy4sqzkvrpjh35jiznlmuaj7kqdfo2y';
114419
- representatives.push({
114420
- key: client_lib_account.fromPublicKeyString('keeta_aabdpxhsnphfbewgcwkqitrwx5rhxo3fvr2t66hpdvv5tvtqeuqclqwezl5phza'),
114421
- endpoints: {
114422
- api: 'https://rep1.staging.network.api.keeta.com/api',
114423
- p2p: 'wss://rep1.staging.network.api.keeta.com/p2p'
114424
- }
114425
- });
114426
- break;
114427
- case 'beta':
114428
- initialTrustedAccount = 'keeta_aab4dfditzmfyj33a6hkergc24zntjr44w4364yd3azl5munzlkbxekrkwztpwy';
114429
- representatives.push({
114430
- key: client_lib_account.fromPublicKeyString('keeta_aab6eers2xhzonls6icxszm4dsx3olc7sleuiwaovoualadecaplfv5qdmrivua'),
114431
- endpoints: {
114432
- api: 'https://rep1.beta.api.keeta.com/api',
114433
- p2p: 'wss://rep1.beta.api.keeta.com/p2p'
114434
- }
114435
- });
114436
- break;
114437
- case 'test':
114438
114421
  {
114439
- initialTrustedAccount = 'keeta_aabmvemiol5wrs67e4rfiyibopwav4e77sleiqaqvbdprbuxrifn7fgg4cchhia';
114440
- publishAidURL = `https://publish-aid.${network}.network.api.keeta.com/api/publish`;
114441
- const reps = ['keeta_aabi4bd3f7jrt67mxcq44ozj65bh4bp2mygmrkedxggu2rxwn2ztuw3b6exivbq', 'keeta_aabf7dz5asq2n2lrldct33x2ww65cophxp7egfiixbb7tbyat5r3kcbcez7ftpi', 'keeta_aab3cxegizwhtim3zlyuwjhiqd5ikkhxg42smhwc3wx6yn7ep2t6lwo6emvw4wa', 'keeta_aabznoicrzvte6ql5rxbgugmfrjqubbnjuo5l6ivopowy4rpkqgs5fco3oaezcq'];
114422
+ initialTrustedAccount = 'keeta_aabhtbqmg7whgpvbgii6twdjlyq5vlrtwaa47nb5b2gj6an5kvjbwvvw2mdwjjy';
114423
+ const reps = ['keeta_aabaagdrwrwnkzox4u3qh6uukre6lckax6kb5fwyxd4vtpua6vrjc6nuhb75fji', 'keeta_aabgizanf4agmioyrswbg4wsl7nmjlrakwd4piuks7cqagfccnxc2fscm25hw7i', 'keeta_aab2gw2zmtazqgtromyfmhjn5h67ep23676zq62obgtqaw65x5l5krn252w57ma', 'keeta_aabue4mdj22i5o6774tlszcxy2sxyvpninbm54nfhxn6dkmsvtryd7oha4bzh2i'];
114442
114424
  for (let index = 0; index < reps.length; index++) {
114443
114425
  const repID = index + 1;
114444
114426
  const repKey = reps[index];
114445
114427
  representatives.push({
114446
114428
  key: client_lib_account.fromPublicKeyString(repKey).assertAccount(),
114447
114429
  endpoints: {
114448
- api: `https://rep${repID}.${network}.network.api.keeta.com/api`,
114449
- p2p: `wss://rep${repID}.${network}.network.api.keeta.com/p2p`
114430
+ api: `https://rep${repID}.staging.network.api.keeta.com/api`,
114431
+ p2p: `wss://rep${repID}.staging.network.api.keeta.com/p2p`
114450
114432
  }
114451
114433
  });
114452
114434
  }
114453
114435
  }
114454
114436
  break;
114455
- case 'test2':
114437
+ case 'test':
114456
114438
  {
114457
- // 17C75845AC5D1D5C82BB554D80A32EF678EE7C0C8FD508E60004435C899F411C
114458
- initialTrustedAccount = 'keeta_aabhf4ythez6zaytjuea3552sc7ydjwqqzhkigejfbiyx2qwmty2v63hxibl32i';
114439
+ initialTrustedAccount = 'keeta_aabmvemiol5wrs67e4rfiyibopwav4e77sleiqaqvbdprbuxrifn7fgg4cchhia';
114459
114440
  publishAidURL = `https://publish-aid.${network}.network.api.keeta.com/api/publish`;
114460
- const reps = ['keeta_aabczuvy3x3mpaspn57ooinuz2yh2hnz65rcrvpnbmkeqj4qu7exfiha4dauosi', 'keeta_aabavwgipwruhomnvhsdiuzs5gfkffl75iml6hce42jbygin2wnjm7mqds7v7aa', 'keeta_aabw2oh264q76rwaz6nd6hrkongwh6hauxiwtvijapctdunotkmdmm34kmcwypi', 'keeta_aab2k5gz2dxqmz3mm3jaxgjthkl3uqffnoovjrzjbzsicpeejhmp3rxe4st3uca'];
114441
+ const reps = ['keeta_aabi4bd3f7jrt67mxcq44ozj65bh4bp2mygmrkedxggu2rxwn2ztuw3b6exivbq', 'keeta_aabf7dz5asq2n2lrldct33x2ww65cophxp7egfiixbb7tbyat5r3kcbcez7ftpi', 'keeta_aab3cxegizwhtim3zlyuwjhiqd5ikkhxg42smhwc3wx6yn7ep2t6lwo6emvw4wa', 'keeta_aabznoicrzvte6ql5rxbgugmfrjqubbnjuo5l6ivopowy4rpkqgs5fco3oaezcq'];
114461
114442
  for (let index = 0; index < reps.length; index++) {
114462
114443
  const repID = index + 1;
114463
114444
  const repKey = reps[index];
@@ -114577,24 +114558,16 @@ function client_fromOffsetArray(setOffsets) {
114577
114558
  return val;
114578
114559
  }
114579
114560
  client_bitfield_defineProperty(src_client_BitField, "isInstance", client_checkableGenerator(client_BitField));
114580
- ;// ./src/lib/error/index.ts
114581
- var client_KeetaNetError;
114582
- function client_error_defineProperty(e, r, t) { return (r = client_error_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
114583
- function client_error_toPropertyKey(t) { var i = client_error_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
114584
- function client_error_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
114561
+ ;// ./src/lib/error/base.ts
114562
+ var client_KeetaNetErrorBase;
114563
+ function client_base_defineProperty(e, r, t) { return (r = client_base_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
114564
+ function client_base_toPropertyKey(t) { var i = client_base_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
114565
+ function client_base_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
114585
114566
 
114586
- async function client_ExpectErrorCode(code, test) {
114587
- await expect(test).rejects.toThrow(expect.objectContaining({
114588
- code: code
114589
- }));
114590
- }
114591
- class src_client_KeetaNetError extends Error {
114567
+ class src_client_KeetaNetErrorBase extends Error {
114592
114568
  constructor(code, message, validation) {
114593
114569
  super(message);
114594
- let type = validation === null || validation === void 0 ? void 0 : validation.type;
114595
- if (!type) {
114596
- type = 'GENERIC';
114597
- }
114570
+ const type = (validation === null || validation === void 0 ? void 0 : validation.type) || 'GENERIC';
114598
114571
  if (validation !== undefined) {
114599
114572
  const prefix = `${validation.type}_`;
114600
114573
  const validPrefix = code.startsWith(prefix);
@@ -114607,9 +114580,16 @@ class src_client_KeetaNetError extends Error {
114607
114580
  this.code = code;
114608
114581
  this.type = type;
114609
114582
  }
114583
+ toJSON() {
114584
+ return {
114585
+ type: this.type,
114586
+ code: this.code,
114587
+ message: this.message
114588
+ };
114589
+ }
114610
114590
  }
114611
- client_KeetaNetError = src_client_KeetaNetError;
114612
- client_error_defineProperty(src_client_KeetaNetError, "isInstance", client_checkableGenerator(client_KeetaNetError, false));
114591
+ client_KeetaNetErrorBase = src_client_KeetaNetErrorBase;
114592
+ client_base_defineProperty(src_client_KeetaNetErrorBase, "isInstance", client_checkableGenerator(client_KeetaNetErrorBase, false));
114613
114593
  ;// ./src/lib/error/permissions.ts
114614
114594
  var client_KeetaNetPermissionsError;
114615
114595
  function client_permissions_defineProperty(e, r, t) { return (r = client_permissions_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -114619,7 +114599,8 @@ function client_permissions_toPrimitive(t, r) { if ("object" != typeof t || !t)
114619
114599
 
114620
114600
  const client_PermissionsErrorType = 'PERMISSIONS';
114621
114601
  const client_PermissionsErrorCodes = ['CANNOT_MIX_FLAGS_AND_TYPES', 'EXTERNAL_OFFSET_TOO_LARGE', 'INVALID_EXTERNAL_FLAG', 'INVALID_FLAG', 'INVALID_FLAG_ASSERTION'];
114622
- class src_client_KeetaNetPermissionsError extends src_client_KeetaNetError {
114602
+ const client_FullPermissionsErrorCodes = client_PermissionsErrorCodes.map(code => `${client_PermissionsErrorType}_${code}`);
114603
+ class src_client_KeetaNetPermissionsError extends src_client_KeetaNetErrorBase {
114623
114604
  constructor(code, message) {
114624
114605
  super(code, message, {
114625
114606
  type: client_PermissionsErrorType,
@@ -115225,7 +115206,8 @@ function client_block_toPrimitive(t, r) { if ("object" != typeof t || !t) return
115225
115206
 
115226
115207
  const client_BlockErrorType = 'BLOCK';
115227
115208
  const client_BlockErrorCodes = ['INVALID_TYPE', 'INVALID_VERSION', 'NO_MULTIPLE_SET_REP', 'IDENTIFIER_NEED_DEFAULT_PERMISSIONS', 'CANNOT_SEND_NON_TOKEN', 'TOKEN_RECEIVE_DIFFERS', 'ONLY_TOKEN_OP', 'ONLY_IDENTIFIER_OP', 'NO_TOKEN_OP', 'NO_IDENTIFIER_OP', 'INVALID_SIGNER', 'INVALID_PURPOSE_VALIDATION', 'INVALID_MULTISIG_QUORUM', 'INVALID_MULTISIG_SIGNER_DEPTH', 'INVALID_MULTISIG_SIGNER_COUNT', 'INVALID_MULTISIG_SIGNER_DUPLICATE', 'INVALID_CREATE_IDENTIFIER_ARGS', 'NO_MULTISIG_OP', 'IDENTIFIER_INVALID', 'GENERAL_FIELD_INVALID', 'PERMISSIONS_INVALID_DEFAULT', 'PERMISSIONS_INVALID_ENTITY', 'PERMISSIONS_INVALID_PRINCIPAL', 'PERMISSIONS_INVALID_TARGET', 'INVALID_ACCOUNT_TYPE', 'NO_ADMIN_ON_TARGET', 'PREVIOUS_SELF', 'NO_DELEGATE_ADMIN', 'NO_MODIFY_PERMISSION_DUPE', 'CANNOT_FORWARD_TO_SELF', 'EXACT_TRUE_WHEN_FORWARDING', 'CERTIFICATE_SUBJECT_MISMATCH', 'NO_DUPLICATE_CERTIFICATE_OPERATION', 'INTERMEDIATE_CERTIFICATES_ONLY_ADD', 'INVALID_CERTIFICATE_VALUE', 'EXTERNAL_TOO_LONG', 'EXTERNAL_INVALID', 'EXTERNAL_MISSING', 'SUPPLY_INVALID'];
115228
- class src_client_KeetaNetBlockError extends src_client_KeetaNetError {
115209
+ const client_FullBlockErrorCodes = client_BlockErrorCodes.map(code => `${client_BlockErrorType}_${code}`);
115210
+ class src_client_KeetaNetBlockError extends src_client_KeetaNetErrorBase {
115229
115211
  constructor(code, message) {
115230
115212
  super(code, message, {
115231
115213
  type: client_BlockErrorType,
@@ -115325,12 +115307,13 @@ function client_certificate_toPrimitive(t, r) { if ("object" != typeof t || !t)
115325
115307
 
115326
115308
 
115327
115309
  const client_CertificateErrorType = 'CERTIFICATE';
115328
- const client_certificate_BlockErrorCodes = ['DUPLICATE_INCLUDED', 'ORPHAN_FOUND', 'CYCLE_FOUND', 'SECONDARY_GRAPH', 'MISSING_FIELD', 'SIGNATURE_ALGORITHM_MISMATCH', 'SELF_SIGNED_VALIDATION_FAILED', 'CHAIN_VERIFICATION_FAILED', 'DUPLICATE_EXTENSION', 'EXTENSION_NOT_PROCESSED', 'INVALID_SIGNATURE_ALGORITHM', 'INVALID_GRAPH_COUNT', 'MOMENT_INVALID', 'INVALID_VERSION'];
115329
- class src_client_KeetaNetCertificateError extends src_client_KeetaNetError {
115310
+ const client_CertificateErrorCodes = ['DUPLICATE_INCLUDED', 'ORPHAN_FOUND', 'CYCLE_FOUND', 'SECONDARY_GRAPH', 'MISSING_FIELD', 'SIGNATURE_ALGORITHM_MISMATCH', 'SELF_SIGNED_VALIDATION_FAILED', 'CHAIN_VERIFICATION_FAILED', 'DUPLICATE_EXTENSION', 'EXTENSION_NOT_PROCESSED', 'INVALID_SIGNATURE_ALGORITHM', 'INVALID_GRAPH_COUNT', 'MOMENT_INVALID', 'INVALID_VERSION'];
115311
+ const client_FullCertificateErrorCodes = client_CertificateErrorCodes.map(code => `${client_CertificateErrorType}_${code}`);
115312
+ class src_client_KeetaNetCertificateError extends src_client_KeetaNetErrorBase {
115330
115313
  constructor(code, message) {
115331
115314
  super(code, message, {
115332
115315
  type: client_CertificateErrorType,
115333
- codes: client_certificate_BlockErrorCodes
115316
+ codes: client_CertificateErrorCodes
115334
115317
  });
115335
115318
  }
115336
115319
  }
@@ -116736,23 +116719,34 @@ client_utils_certificate_defineProperty(src_client_Certificate, "Hash", src_clie
116736
116719
  */
116737
116720
  client_utils_certificate_defineProperty(src_client_Certificate, "certificateObjectTypeID", '8d05dca5-5f42-4dc9-8bf9-f534c6570994:CERTIFICATE');
116738
116721
  ;// ./src/lib/error/ledger.ts
116739
- var client_KeetaNetLedgerError;
116722
+ var client_KeetaNetLedgerError, client_KeetaNetLedgerVoteError;
116740
116723
  function client_ledger_defineProperty(e, r, t) { return (r = client_ledger_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
116741
116724
  function client_ledger_toPropertyKey(t) { var i = client_ledger_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
116742
116725
  function client_ledger_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
116743
116726
 
116744
116727
 
116745
116728
  const client_LedgerErrorType = 'LEDGER';
116746
- const client_LedgerErrorCodes = ['BLOCK_ALREADY_EXISTS', 'TRANSACTION_ABORTED', 'INVALID_CHAIN', 'INVALID_NETWORK', 'INVALID_SUBNET', 'NOT_EMPTY', 'NOT_OPENING', 'NOT_SUCCESSOR', 'INVALID_PERMISSIONS', 'INVALID_OWNER_COUNT', 'INVALID_BALANCE', 'PREVIOUS_ALREADY_USED', 'PREVIOUS_NOT_SEEN', 'SUCCESSOR_VOTE_EXISTS', 'INSUFFICIENT_VOTING_WEIGHT', 'INVALID_ACCOUNT_INFO_KEY', 'RECEIVE_NOT_MET', 'DUPLICATE_VOTE_FOUND', 'CANNOT_EXCHANGE_PERM_VOTE', 'BLOCKS_DIFFER_FROM_VOTED_ON', 'NO_PERM_WITHOUT_SELF_TEMP', 'DUPLICATE_VOTE_ISSUER_FOUND', 'OTHER', 'MISSING_BLOCKS',
116729
+ const client_LedgerBaseErrorCodes = ['BLOCK_ALREADY_EXISTS', 'TRANSACTION_ABORTED', 'INVALID_CHAIN', 'INVALID_NETWORK', 'INVALID_SUBNET', 'INVALID_PERMISSIONS', 'INVALID_OWNER_COUNT', 'INVALID_BALANCE', 'INVALID_SET_REP', 'OPERATION_NOT_SUPPORTED', 'NOT_EMPTY', 'PREVIOUS_ALREADY_USED', 'PREVIOUS_NOT_SEEN', 'SUCCESSOR_VOTE_EXISTS', 'INSUFFICIENT_VOTING_WEIGHT', 'INVALID_ACCOUNT_INFO_KEY', 'RECEIVE_NOT_MET', 'DUPLICATE_VOTE_FOUND', 'CANNOT_EXCHANGE_PERM_VOTE', 'BLOCKS_DIFFER_FROM_VOTED_ON', 'NO_PERM_WITHOUT_SELF_TEMP', 'DUPLICATE_VOTE_ISSUER_FOUND', 'OTHER', 'MISSING_BLOCKS',
116747
116730
  // Fee Errors
116748
116731
  'FEE_AMOUNT_MISMATCH', 'FEE_TOKEN_MISMATCH', 'FEE_MISSING', 'MISSING_REQUIRED_FEE_BLOCK', 'PERM_VOTE_WITH_QUOTE', 'QUOTE_MISMATCH', 'REQUIRED_FEE_MISMATCH'];
116749
- class client_ledger_KeetaNetLedgerError extends src_client_KeetaNetError {
116732
+
116733
+ // Errors that can trigger rep sync
116734
+ const client_LedgerVoteErrorCodes = ['NOT_SUCCESSOR', 'NOT_OPENING'];
116735
+ const client_FullLedgerErrorCodes = [...client_LedgerBaseErrorCodes, ...client_LedgerVoteErrorCodes].map(code => `${client_LedgerErrorType}_${code}`);
116736
+ const client_FullLedgerBaseErrorCode = client_LedgerBaseErrorCodes.map(code => `${client_LedgerErrorType}_${code}`);
116737
+ const client_FullLedgerVoteErrorCodes = client_LedgerVoteErrorCodes.map(code => `${client_LedgerErrorType}_${code}`);
116738
+ const client_ledgerBaseErrorCodeSet = new Set(client_FullLedgerBaseErrorCode);
116739
+ const client_ledgerVoteErrorCodeSet = new Set(client_FullLedgerVoteErrorCodes);
116740
+ class client_ledger_KeetaNetLedgerError extends src_client_KeetaNetErrorBase {
116741
+ static assertValidLedgerErrorCode(code) {
116742
+ return client_ledgerBaseErrorCodeSet.has(code);
116743
+ }
116750
116744
  constructor(code, message) {
116751
116745
  let shouldRetry = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
116752
116746
  let retryDelay = arguments.length > 3 ? arguments[3] : undefined;
116753
116747
  super(code, message, {
116754
116748
  type: client_LedgerErrorType,
116755
- codes: client_LedgerErrorCodes
116749
+ codes: client_LedgerBaseErrorCodes
116756
116750
  });
116757
116751
  client_ledger_defineProperty(this, "type", client_LedgerErrorType);
116758
116752
  this.shouldRetry = shouldRetry;
@@ -116763,7 +116757,30 @@ class client_ledger_KeetaNetLedgerError extends src_client_KeetaNetError {
116763
116757
  }
116764
116758
  client_KeetaNetLedgerError = client_ledger_KeetaNetLedgerError;
116765
116759
  client_ledger_defineProperty(client_ledger_KeetaNetLedgerError, "isInstance", client_checkableGenerator(client_KeetaNetLedgerError));
116766
- /* harmony default export */ const client_ledger = (client_ledger_KeetaNetLedgerError);
116760
+ class src_client_KeetaNetLedgerVoteError extends src_client_KeetaNetErrorBase {
116761
+ static assertValidLedgerErrorCode(code) {
116762
+ return client_ledgerVoteErrorCodeSet.has(code);
116763
+ }
116764
+ constructor(code, message, accounts) {
116765
+ super(code, message, {
116766
+ type: client_LedgerErrorType,
116767
+ codes: client_LedgerVoteErrorCodes
116768
+ });
116769
+ client_ledger_defineProperty(this, "type", client_LedgerErrorType);
116770
+ client_ledger_defineProperty(this, "shouldRetry", false);
116771
+ this.accounts = accounts;
116772
+ }
116773
+ toJSON() {
116774
+ return {
116775
+ ...super.toJSON(),
116776
+ accounts: [...this.accounts.values()].map(function (account) {
116777
+ return account.publicKeyString.get();
116778
+ })
116779
+ };
116780
+ }
116781
+ }
116782
+ client_KeetaNetLedgerVoteError = src_client_KeetaNetLedgerVoteError;
116783
+ client_ledger_defineProperty(src_client_KeetaNetLedgerVoteError, "isInstance", client_checkableGenerator(client_KeetaNetLedgerVoteError));
116767
116784
  ;// ./src/lib/ledger/common.ts
116768
116785
  function client_common_classPrivateMethodInitSpec(e, a) { client_common_checkPrivateRedeclaration(e, a), a.add(e); }
116769
116786
  function client_common_checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
@@ -120151,7 +120168,8 @@ function client_account_toPrimitive(t, r) { if ("object" != typeof t || !t) retu
120151
120168
 
120152
120169
  const client_AccountErrorType = 'ACCOUNT';
120153
120170
  const client_AccountErrorCodes = ['INVALID_PREFIX', 'INVALID_KEYTYPE', 'INVALID_KEYTYPE_EXTERNAL', 'PASSPHRASE_WEAK', 'INVALID_CONSTRUCTION', 'NO_IDENTIFIER_SIGN', 'NO_IDENTIFIER_VERIFY', 'INVALID_IDENTIFIER_CONSTRUCTION', 'SEED_INDEX_UNDEFINED', 'SEED_INDEX_NEGATIVE', 'SEED_INDEX_NOT_INT', 'SEED_INDEX_TOO_LARGE', 'ENCRYPTION_NOT_SUPPORTED'];
120154
- class src_client_KeetaNetAccountError extends src_client_KeetaNetError {
120171
+ const client_FullAccountErrorCodes = client_AccountErrorCodes.map(code => `${client_AccountErrorType}_${code}`);
120172
+ class src_client_KeetaNetAccountError extends src_client_KeetaNetErrorBase {
120155
120173
  constructor(code, message) {
120156
120174
  super(code, message, {
120157
120175
  type: client_AccountErrorType,
@@ -122282,7 +122300,8 @@ const client_VoteErrorCodes = [
122282
122300
  'MALFORMED_FEES_AMOUNT', 'MALFORMED_FEES_FROM_VOTE_INVALID_INPUT', 'MALFORMED_FEES_IN_PERMANENT_VOTE', 'MALFORMED_FEES_PAY_TO_INVALID', 'MALFORMED_FEES_TOKEN_NOT_TOKEN',
122283
122301
  // Fee Quote Errors
122284
122302
  'FEE_IS_QUOTE', 'FEE_QUOTE_MISSING_FEES', 'FEE_NOT_QUOTE', 'MALFORMED_FEES_KIND_MISSING', 'MALFORMED_FEES_QUOTE_INVALID'];
122285
- class src_client_KeetaNetVoteError extends src_client_KeetaNetError {
122303
+ const client_FullVoteErrorCodes = client_VoteErrorCodes.map(code => `${client_VoteErrorType}_${code}`);
122304
+ class src_client_KeetaNetVoteError extends src_client_KeetaNetErrorBase {
122286
122305
  constructor(code, message) {
122287
122306
  super(code, message, {
122288
122307
  type: client_VoteErrorType,
@@ -124382,6 +124401,7 @@ function client_computeEffectOfOperationCREATE_IDENTIFIER(state, block, operatio
124382
124401
  multisigQuorum: operation.createArguments.quorum
124383
124402
  });
124384
124403
  for (const multisigSigner of operation.createArguments.signers) {
124404
+ state.possibleNewAccounts.add(multisigSigner);
124385
124405
  client_addPermission(state, {
124386
124406
  principal: multisigSigner,
124387
124407
  entity: operation.identifier,
@@ -125572,8 +125592,9 @@ var client_kind = /*#__PURE__*/new WeakMap();
125572
125592
  var client_ledger_privateKey = /*#__PURE__*/new WeakMap();
125573
125593
  var client_computeFeeFromBlocks = /*#__PURE__*/new WeakMap();
125574
125594
  var client_ledger_storage = /*#__PURE__*/new WeakMap();
125575
- var src_client_ledger = /*#__PURE__*/new WeakMap();
125595
+ var client_ledger = /*#__PURE__*/new WeakMap();
125576
125596
  var src_client_cache = /*#__PURE__*/new WeakMap();
125597
+ var client_operations = /*#__PURE__*/new WeakMap();
125577
125598
  var client_transaction = /*#__PURE__*/new WeakMap();
125578
125599
  var client_LedgerAtomicInterface_brand = /*#__PURE__*/new WeakSet();
125579
125600
  /**
@@ -125581,6 +125602,7 @@ var client_LedgerAtomicInterface_brand = /*#__PURE__*/new WeakSet();
125581
125602
  */
125582
125603
  class client_LedgerAtomicInterface {
125583
125604
  constructor(_transaction2, storage, config, ledger) {
125605
+ var _config$operations;
125584
125606
  client_ledger_classPrivateMethodInitSpec(this, client_LedgerAtomicInterface_brand);
125585
125607
  client_ledger_classPrivateFieldInitSpec(this, client_network, void 0);
125586
125608
  client_ledger_classPrivateFieldInitSpec(this, client_subnet, void 0);
@@ -125588,15 +125610,19 @@ class client_LedgerAtomicInterface {
125588
125610
  client_ledger_classPrivateFieldInitSpec(this, client_ledger_privateKey, void 0);
125589
125611
  client_ledger_classPrivateFieldInitSpec(this, client_computeFeeFromBlocks, void 0);
125590
125612
  client_ledger_classPrivateFieldInitSpec(this, client_ledger_storage, void 0);
125591
- client_ledger_classPrivateFieldInitSpec(this, src_client_ledger, void 0);
125613
+ client_ledger_classPrivateFieldInitSpec(this, client_ledger, void 0);
125592
125614
  client_ledger_classPrivateFieldInitSpec(this, src_client_cache, void 0);
125615
+ client_ledger_classPrivateFieldInitSpec(this, client_operations, void 0);
125593
125616
  client_ledger_classPrivateFieldInitSpec(this, client_transaction, void 0);
125594
125617
  client_ledger_classPrivateFieldSet(client_network, this, config.network);
125595
125618
  client_ledger_classPrivateFieldSet(client_subnet, this, config.subnet);
125596
125619
  client_ledger_classPrivateFieldSet(client_kind, this, config.kind);
125597
125620
  client_ledger_classPrivateFieldSet(client_ledger_privateKey, this, config.privateKey);
125598
125621
  client_ledger_classPrivateFieldSet(client_computeFeeFromBlocks, this, config.computeFeeFromBlocks);
125599
- client_ledger_classPrivateFieldSet(src_client_ledger, this, ledger);
125622
+ client_ledger_classPrivateFieldSet(client_operations, this, (_config$operations = config.operations) !== null && _config$operations !== void 0 ? _config$operations : {
125623
+ enableTokenAdminModifyBalance: false
125624
+ });
125625
+ client_ledger_classPrivateFieldSet(client_ledger, this, ledger);
125600
125626
  client_ledger_classPrivateFieldSet(client_ledger_storage, this, storage);
125601
125627
  client_ledger_classPrivateFieldSet(client_transaction, this, _transaction2);
125602
125628
 
@@ -125618,7 +125644,7 @@ class client_LedgerAtomicInterface {
125618
125644
  const transaction = client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_assertTransaction).call(this);
125619
125645
  client_ledger_classPrivateFieldSet(client_transaction, this, null);
125620
125646
  await client_ledger_classPrivateFieldGet(client_ledger_storage, this).commitTransaction(transaction);
125621
- (_classPrivateFieldGet2 = client_ledger_classPrivateFieldGet(src_client_ledger, this).node) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.stats.merge(transaction.statsPending);
125647
+ (_classPrivateFieldGet2 = client_ledger_classPrivateFieldGet(client_ledger, this).node) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.stats.merge(transaction.statsPending);
125622
125648
  }
125623
125649
  async abort() {
125624
125650
  const transaction = client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_assertTransaction).call(this);
@@ -125627,22 +125653,22 @@ class client_LedgerAtomicInterface {
125627
125653
  }
125628
125654
  async vote(blocks, otherVotes, quote) {
125629
125655
  if (blocks.length === 0) {
125630
- throw new client_ledger('LEDGER_MISSING_BLOCKS', 'At least one block is required to issue a vote');
125656
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_MISSING_BLOCKS', 'At least one block is required to issue a vote');
125631
125657
  }
125632
125658
  if (!client_ledger_classPrivateFieldGet(client_ledger_privateKey, this)) {
125633
125659
  throw new Error('Cannot vote on block, no private key loaded');
125634
125660
  }
125635
- if (client_ledger_classPrivateFieldGet(src_client_ledger, this).ledgerWriteMode !== 'read-write') {
125636
- throw new Error(`May not issue votes in read-only mode, in ${client_ledger_classPrivateFieldGet(src_client_ledger, this).ledgerWriteMode} mode`);
125661
+ if (client_ledger_classPrivateFieldGet(client_ledger, this).ledgerWriteMode !== 'read-write') {
125662
+ throw new Error(`May not issue votes in read-only mode, in ${client_ledger_classPrivateFieldGet(client_ledger, this).ledgerWriteMode} mode`);
125637
125663
  }
125638
125664
  const privateKey = client_ledger_classPrivateFieldGet(client_ledger_privateKey, this);
125639
125665
  const ledgerPubKey = privateKey.publicKeyString.get();
125640
125666
  if (quote !== undefined) {
125641
125667
  if (otherVotes !== undefined) {
125642
- throw new client_ledger('LEDGER_PERM_VOTE_WITH_QUOTE', 'Quote should not be included when requesting permanent votes');
125668
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_PERM_VOTE_WITH_QUOTE', 'Quote should not be included when requesting permanent votes');
125643
125669
  }
125644
125670
  if (!quote.issuer.comparePublicKey(ledgerPubKey)) {
125645
- throw new client_ledger('LEDGER_QUOTE_MISMATCH', 'Provided quote does not match issuer public key');
125671
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_QUOTE_MISMATCH', 'Provided quote does not match issuer public key');
125646
125672
  }
125647
125673
  }
125648
125674
  const transaction = client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_assertTransaction).call(this);
@@ -125652,13 +125678,13 @@ class client_LedgerAtomicInterface {
125652
125678
  * us and the blocks are in the same order as the set of
125653
125679
  * blocks we are voting on now
125654
125680
  */
125681
+ let hasFeeBlock = false;
125655
125682
  if (otherVotes !== undefined) {
125656
125683
  let foundOurVote = false;
125657
125684
  const seenVoteUIDs = new Set();
125658
125685
  const seenVoteIssuers = new client_lib_account.Set();
125659
- const possibleFeeBlock = blocks.at(-1);
125660
- let hasFeeBlock = false;
125661
125686
  let blockCount = blocks.length;
125687
+ const possibleFeeBlock = blocks.at(-1);
125662
125688
  if ((possibleFeeBlock === null || possibleFeeBlock === void 0 ? void 0 : possibleFeeBlock.purpose) === client_BlockPurpose.FEE) {
125663
125689
  hasFeeBlock = true;
125664
125690
  blockCount--;
@@ -125666,13 +125692,13 @@ class client_LedgerAtomicInterface {
125666
125692
  const requiredFees = new Map();
125667
125693
  for (const checkVote of otherVotes) {
125668
125694
  if (checkVote.quote === true) {
125669
- throw new client_ledger('LEDGER_PERM_VOTE_WITH_QUOTE', 'Cannot request permanent votes with quotes');
125695
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_PERM_VOTE_WITH_QUOTE', 'Cannot request permanent votes with quotes');
125670
125696
  }
125671
125697
  if (seenVoteUIDs.has(checkVote.$id)) {
125672
- throw new client_ledger('LEDGER_DUPLICATE_VOTE_FOUND', 'Duplicate vote UID found');
125698
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_DUPLICATE_VOTE_FOUND', 'Duplicate vote UID found');
125673
125699
  }
125674
125700
  if (seenVoteIssuers.has(checkVote.issuer)) {
125675
- throw new client_ledger('LEDGER_DUPLICATE_VOTE_ISSUER_FOUND', 'Multiple votes found from same issuer');
125701
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_DUPLICATE_VOTE_ISSUER_FOUND', 'Multiple votes found from same issuer');
125676
125702
  }
125677
125703
  seenVoteIssuers.add(checkVote.issuer);
125678
125704
  seenVoteUIDs.add(checkVote.$id);
@@ -125680,7 +125706,7 @@ class client_LedgerAtomicInterface {
125680
125706
  requiredFees.set(checkVote.issuer, checkVote.fee);
125681
125707
  }
125682
125708
  if (checkVote.$permanent) {
125683
- throw new client_ledger('LEDGER_CANNOT_EXCHANGE_PERM_VOTE', 'Asked to exchange a permanent vote for a permanent vote');
125709
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_CANNOT_EXCHANGE_PERM_VOTE', 'Asked to exchange a permanent vote for a permanent vote');
125684
125710
  }
125685
125711
  let blocksDifferFromVoteBlocks = checkVote.blocks.length !== blockCount;
125686
125712
 
@@ -125694,7 +125720,7 @@ class client_LedgerAtomicInterface {
125694
125720
  }
125695
125721
  }
125696
125722
  if (blocksDifferFromVoteBlocks) {
125697
- throw new client_ledger('LEDGER_BLOCKS_DIFFER_FROM_VOTED_ON', 'Asked to exchange different number of blocks for a permanent vote');
125723
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_BLOCKS_DIFFER_FROM_VOTED_ON', 'Asked to exchange different number of blocks for a permanent vote');
125698
125724
  }
125699
125725
  if (checkVote.issuer.comparePublicKey(ledgerPubKey)) {
125700
125726
  foundOurVote = true;
@@ -125702,10 +125728,10 @@ class client_LedgerAtomicInterface {
125702
125728
  }
125703
125729
  if (requiredFees.size > 0) {
125704
125730
  if (!hasFeeBlock) {
125705
- throw new client_ledger('LEDGER_MISSING_REQUIRED_FEE_BLOCK', 'Missing fee block but votes require it');
125731
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_MISSING_REQUIRED_FEE_BLOCK', 'Missing fee block but votes require it');
125706
125732
  }
125707
125733
  if (requiredFees.size !== (possibleFeeBlock === null || possibleFeeBlock === void 0 ? void 0 : possibleFeeBlock.operations.length)) {
125708
- throw new client_ledger('LEDGER_REQUIRED_FEE_MISMATCH', 'Fee Block Operations do not match required fees');
125734
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_REQUIRED_FEE_MISMATCH', 'Fee Block Operations do not match required fees');
125709
125735
  }
125710
125736
  }
125711
125737
 
@@ -125714,13 +125740,13 @@ class client_LedgerAtomicInterface {
125714
125740
  const foundFee = possibleFeeBlock === null || possibleFeeBlock === void 0 ? void 0 : possibleFeeBlock.operations.find(operation => {
125715
125741
  var _fee$payTo, _fee$token;
125716
125742
  const expectedPayTo = (_fee$payTo = fee.payTo) !== null && _fee$payTo !== void 0 ? _fee$payTo : issuer;
125717
- const expectedToken = (_fee$token = fee.token) !== null && _fee$token !== void 0 ? _fee$token : client_ledger_classPrivateFieldGet(src_client_ledger, this).baseToken;
125743
+ const expectedToken = (_fee$token = fee.token) !== null && _fee$token !== void 0 ? _fee$token : client_ledger_classPrivateFieldGet(client_ledger, this).baseToken;
125718
125744
  if (operation.type === client_OperationType.SEND && operation.to.comparePublicKey(expectedPayTo)) {
125719
125745
  if (operation.amount !== fee.amount) {
125720
- throw new client_ledger('LEDGER_FEE_AMOUNT_MISMATCH', `Fee Amount Mismatch, found: ${operation.amount} expected: ${fee.amount}`);
125746
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_FEE_AMOUNT_MISMATCH', `Fee Amount Mismatch, found: ${operation.amount} expected: ${fee.amount}`);
125721
125747
  }
125722
125748
  if (!operation.token.comparePublicKey(expectedToken)) {
125723
- throw new client_ledger('LEDGER_FEE_TOKEN_MISMATCH', `Fee Token Mismatch, found: ${operation.token.publicKeyString.get()} expected: ${expectedToken.publicKeyString.get()}`);
125749
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_FEE_TOKEN_MISMATCH', `Fee Token Mismatch, found: ${operation.token.publicKeyString.get()} expected: ${expectedToken.publicKeyString.get()}`);
125724
125750
  }
125725
125751
  return true;
125726
125752
  }
@@ -125728,11 +125754,11 @@ class client_LedgerAtomicInterface {
125728
125754
  });
125729
125755
  if (foundFee === undefined) {
125730
125756
  var _fee$payTo$publicKeyS, _fee$payTo2;
125731
- throw new client_ledger('LEDGER_FEE_MISSING', `Missing Required Fee for ${(_fee$payTo$publicKeyS = (_fee$payTo2 = fee.payTo) === null || _fee$payTo2 === void 0 ? void 0 : _fee$payTo2.publicKeyString.get()) !== null && _fee$payTo$publicKeyS !== void 0 ? _fee$payTo$publicKeyS : issuer.publicKeyString.get()}`);
125757
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_FEE_MISSING', `Missing Required Fee for ${(_fee$payTo$publicKeyS = (_fee$payTo2 = fee.payTo) === null || _fee$payTo2 === void 0 ? void 0 : _fee$payTo2.publicKeyString.get()) !== null && _fee$payTo$publicKeyS !== void 0 ? _fee$payTo$publicKeyS : issuer.publicKeyString.get()}`);
125732
125758
  }
125733
125759
  }
125734
125760
  if (!foundOurVote) {
125735
- throw new client_ledger('LEDGER_NO_PERM_WITHOUT_SELF_TEMP', 'Asked to give a permanent vote without a temporary vote from us');
125761
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_NO_PERM_WITHOUT_SELF_TEMP', 'Asked to give a permanent vote without a temporary vote from us');
125736
125762
  }
125737
125763
  }
125738
125764
  const allLedgerHeads = await client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_validateBlocksForVote).call(this, blocks);
@@ -125742,15 +125768,15 @@ class client_LedgerAtomicInterface {
125742
125768
  const accountHead = allHeads[account.publicKeyString.get()];
125743
125769
  if (accountHead === null) {
125744
125770
  if (!expectedBlock.$opening) {
125745
- throw new client_ledger('LEDGER_NOT_OPENING', 'Cannot vote on non-opening block for an empty account');
125771
+ throw new src_client_KeetaNetLedgerVoteError('LEDGER_NOT_OPENING', 'Cannot vote on non-opening block for an empty account', needToGetHeadFor);
125746
125772
  }
125747
125773
  continue;
125748
125774
  }
125749
125775
  if (expectedBlock.$opening) {
125750
- throw new client_ledger('LEDGER_NOT_EMPTY', 'Cannot vote on opening block for a non-empty account');
125776
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_NOT_EMPTY', 'Cannot vote on opening block for a non-empty account');
125751
125777
  }
125752
125778
  if (expectedBlock.previous.toString() !== accountHead.toString()) {
125753
- throw new client_ledger('LEDGER_NOT_SUCCESSOR', 'The block is not the successor to the account head block');
125779
+ throw new src_client_KeetaNetLedgerVoteError('LEDGER_NOT_SUCCESSOR', 'The block is not the successor to the account head block', needToGetHeadFor);
125754
125780
  }
125755
125781
  }
125756
125782
 
@@ -125776,7 +125802,7 @@ class client_LedgerAtomicInterface {
125776
125802
  mayReplace = !ourVote.$permanent && ourVote.issuer.comparePublicKey(ledgerPubKey);
125777
125803
  }
125778
125804
  if (!mayReplace) {
125779
- throw new client_ledger('LEDGER_SUCCESSOR_VOTE_EXISTS', `We cannot vote for this block (hash=${block.hash.toString()}), we have an existing vote for a successor (previous votes = ${JSON.stringify(client_toJSONSerializable(previousVotes))})`);
125805
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_SUCCESSOR_VOTE_EXISTS', `We cannot vote for this block (hash=${block.hash.toString()}), we have an existing vote for a successor (previous votes = ${JSON.stringify(client_toJSONSerializable(previousVotes))})`);
125780
125806
  }
125781
125807
  }
125782
125808
  }
@@ -125791,13 +125817,20 @@ class client_LedgerAtomicInterface {
125791
125817
  return vote;
125792
125818
  }
125793
125819
 
125820
+ /**
125821
+ * Validate ledger outcome again before permanent votes if blocks includes a fee block
125822
+ */
125823
+ if (hasFeeBlock) {
125824
+ await client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_validateLedgerOutcome).call(this, blocks);
125825
+ }
125826
+
125794
125827
  /**
125795
125828
  * Validate the votes are sufficient weight and grant
125796
125829
  * our permanent vote
125797
125830
  */
125798
125831
  const votesSufficient = await client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_validateVotingWeight).call(this, otherVotes);
125799
125832
  if (votesSufficient !== true) {
125800
- throw new client_ledger('LEDGER_INSUFFICIENT_VOTING_WEIGHT', 'Unable to create a vote from these votes, they do not represent enough voting power');
125833
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_INSUFFICIENT_VOTING_WEIGHT', 'Unable to create a vote from these votes, they do not represent enough voting power');
125801
125834
  }
125802
125835
 
125803
125836
  /**
@@ -125826,7 +125859,7 @@ class client_LedgerAtomicInterface {
125826
125859
  async add(votesAndBlocks, from) {
125827
125860
  var _classPrivateFieldGet3, _classPrivateFieldGet4, _classPrivateFieldGet5, _classPrivateFieldGet6;
125828
125861
  const transaction = client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_assertTransaction).call(this);
125829
- switch (client_ledger_classPrivateFieldGet(src_client_ledger, this).ledgerWriteMode) {
125862
+ switch (client_ledger_classPrivateFieldGet(client_ledger, this).ledgerWriteMode) {
125830
125863
  case 'read-only':
125831
125864
  throw new Error('Cannot add blocks to a read-only ledger');
125832
125865
  case 'bootstrap-only':
@@ -125838,7 +125871,7 @@ class client_LedgerAtomicInterface {
125838
125871
  case 'no-voting':
125839
125872
  break;
125840
125873
  default:
125841
- throw new Error(`internal error: invalid ledger write mode: ${client_ledger_classPrivateFieldGet(src_client_ledger, this).ledgerWriteMode}`);
125874
+ throw new Error(`internal error: invalid ledger write mode: ${client_ledger_classPrivateFieldGet(client_ledger, this).ledgerWriteMode}`);
125842
125875
  }
125843
125876
  const {
125844
125877
  votes,
@@ -125860,19 +125893,19 @@ class client_LedgerAtomicInterface {
125860
125893
  throw new Error('Can only insert permanent votes');
125861
125894
  }
125862
125895
  }
125863
- const weightTiming = (_classPrivateFieldGet3 = client_ledger_classPrivateFieldGet(src_client_ledger, this).node) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.timing.startTime('db-add/getWeight');
125896
+ const weightTiming = (_classPrivateFieldGet3 = client_ledger_classPrivateFieldGet(client_ledger, this).node) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.timing.startTime('db-add/getWeight');
125864
125897
  const votesSufficient = await client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_validateVotingWeight).call(this, votesAndBlocks.votes);
125865
125898
  if (votesSufficient !== true) {
125866
- throw new client_ledger('LEDGER_INSUFFICIENT_VOTING_WEIGHT', 'Votes attached do not represent enough voting power');
125899
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_INSUFFICIENT_VOTING_WEIGHT', 'Votes attached do not represent enough voting power');
125867
125900
  }
125868
125901
  weightTiming === null || weightTiming === void 0 || weightTiming.end();
125869
- const changesTiming = (_classPrivateFieldGet4 = client_ledger_classPrivateFieldGet(src_client_ledger, this).node) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.timing.startTime('db-add/computeEffectOfBlocks');
125870
- const changes = client_computeEffectOfBlocks(votesAndBlocks.blocks, client_ledger_classPrivateFieldGet(src_client_ledger, this));
125902
+ const changesTiming = (_classPrivateFieldGet4 = client_ledger_classPrivateFieldGet(client_ledger, this).node) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.timing.startTime('db-add/computeEffectOfBlocks');
125903
+ const changes = client_computeEffectOfBlocks(votesAndBlocks.blocks, client_ledger_classPrivateFieldGet(client_ledger, this));
125871
125904
  changesTiming === null || changesTiming === void 0 || changesTiming.end();
125872
- const adjustTiming = (_classPrivateFieldGet5 = client_ledger_classPrivateFieldGet(src_client_ledger, this).node) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.timing.startTime('db-add/adjust');
125905
+ const adjustTiming = (_classPrivateFieldGet5 = client_ledger_classPrivateFieldGet(client_ledger, this).node) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.timing.startTime('db-add/adjust');
125873
125906
  const voteStaples = await client_ledger_classPrivateFieldGet(client_ledger_storage, this).adjust(transaction, votesAndBlocks, changes);
125874
125907
  adjustTiming === null || adjustTiming === void 0 || adjustTiming.end();
125875
- const postambleTiming = (_classPrivateFieldGet6 = client_ledger_classPrivateFieldGet(src_client_ledger, this).node) === null || _classPrivateFieldGet6 === void 0 ? void 0 : _classPrivateFieldGet6.timing.startTime('db-add/postamble');
125908
+ const postambleTiming = (_classPrivateFieldGet6 = client_ledger_classPrivateFieldGet(client_ledger, this).node) === null || _classPrivateFieldGet6 === void 0 ? void 0 : _classPrivateFieldGet6.timing.startTime('db-add/postamble');
125876
125909
  /**
125877
125910
  * Add all the block hashes to the node checksum
125878
125911
  */
@@ -126180,8 +126213,8 @@ class client_LedgerAtomicInterface {
126180
126213
  return await client_ledger_classPrivateFieldGet(client_ledger_storage, this).gc(transaction, timeLimitMS);
126181
126214
  }
126182
126215
  async getFee(blocks, effectsInput) {
126183
- const effects = effectsInput !== null && effectsInput !== void 0 ? effectsInput : client_computeEffectOfBlocks(blocks, client_ledger_classPrivateFieldGet(src_client_ledger, this));
126184
- return client_ledger_classPrivateFieldGet(client_computeFeeFromBlocks, this).call(this, client_ledger_classPrivateFieldGet(src_client_ledger, this), blocks, effects);
126216
+ const effects = effectsInput !== null && effectsInput !== void 0 ? effectsInput : client_computeEffectOfBlocks(blocks, client_ledger_classPrivateFieldGet(client_ledger, this));
126217
+ return client_ledger_classPrivateFieldGet(client_computeFeeFromBlocks, this).call(this, client_ledger_classPrivateFieldGet(client_ledger, this), blocks, effects);
126185
126218
  }
126186
126219
  async _testingRunStorageFunction(code) {
126187
126220
  const transaction = client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_assertTransaction).call(this);
@@ -126209,7 +126242,7 @@ async function client_validateVotingWeight(votes) {
126209
126242
  */
126210
126243
  if (totalVotingPower === 0n) {
126211
126244
  const foundTrustedVote = votes.find(vote => {
126212
- return vote.issuer.comparePublicKey(client_ledger_classPrivateFieldGet(src_client_ledger, this).initialTrustedAccount);
126245
+ return vote.issuer.comparePublicKey(client_ledger_classPrivateFieldGet(client_ledger, this).initialTrustedAccount);
126213
126246
  });
126214
126247
  return foundTrustedVote !== undefined;
126215
126248
  }
@@ -126262,7 +126295,7 @@ async function client_checkSingleAccountPermissions(account, requirements, accou
126262
126295
  const baseFlagsStr = requirement.permissions.base.flags.join(', ');
126263
126296
  const externalOffsetsStr = requirement.permissions.external.trueOffsets.join(', ');
126264
126297
  const reqTargetKey = (_requirement$target = requirement.target) === null || _requirement$target === void 0 ? void 0 : _requirement$target.publicKeyString.get();
126265
- throw new client_ledger('LEDGER_INVALID_PERMISSIONS', `${accountPubKey} does not have required permissions to perform action on ${reqEntityKey}/${reqTargetKey} -- needs [${baseFlagsStr}]/[${externalOffsetsStr}]`);
126298
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_INVALID_PERMISSIONS', `${accountPubKey} does not have required permissions to perform action on ${reqEntityKey}/${reqTargetKey} -- needs [${baseFlagsStr}]/[${externalOffsetsStr}]`);
126266
126299
  }
126267
126300
  }
126268
126301
  }
@@ -126321,7 +126354,7 @@ async function client_checkPermissionRequirements(effects) {
126321
126354
  throw new Error(`Multisig quorum not found for ${multisigPubKey}`);
126322
126355
  }
126323
126356
  if (foundInfo.multisigQuorum > foundSingerLength) {
126324
- throw new client_ledger('LEDGER_INVALID_PERMISSIONS', `Quorum of ${foundInfo.multisigQuorum} not reached for ${multisigPubKey} -- got ${foundSingerLength}`);
126357
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_INVALID_PERMISSIONS', `Quorum of ${foundInfo.multisigQuorum} not reached for ${multisigPubKey} -- got ${foundSingerLength}`);
126325
126358
  }
126326
126359
  }
126327
126360
  const checkPromises = [];
@@ -126335,6 +126368,32 @@ async function client_checkPermissionRequirements(effects) {
126335
126368
  newOwners
126336
126369
  };
126337
126370
  }
126371
+ async function client_validateBlockOperations(blocks) {
126372
+ if (client_ledger_classPrivateFieldGet(client_operations, this) === undefined) {
126373
+ return;
126374
+ }
126375
+ for (const block of blocks) {
126376
+ for (const operation of block.operations) {
126377
+ switch (operation.type) {
126378
+ case src_client_Block.OperationType.SET_REP:
126379
+ if (client_ledger_classPrivateFieldGet(client_operations, this).setRep !== undefined) {
126380
+ const validRep = await client_ledger_classPrivateFieldGet(client_operations, this).setRep(block.account, operation.to);
126381
+ if (!validRep) {
126382
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_INVALID_SET_REP', `${operation.to.publicKeyString.get()} is not a valid representative`);
126383
+ }
126384
+ }
126385
+ break;
126386
+ case src_client_Block.OperationType.TOKEN_ADMIN_MODIFY_BALANCE:
126387
+ if (!client_ledger_classPrivateFieldGet(client_operations, this).enableTokenAdminModifyBalance) {
126388
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_OPERATION_NOT_SUPPORTED', 'TOKEN_ADMIN_MODIFY_BALANCE operation not supported');
126389
+ }
126390
+ break;
126391
+ default:
126392
+ break;
126393
+ }
126394
+ }
126395
+ }
126396
+ }
126338
126397
  /**
126339
126398
  * Ensure all parts of a transaction do not have a negative outcome
126340
126399
  * Balance/Supply cannot fall negative at any point in transaction
@@ -126343,6 +126402,7 @@ async function client_checkPermissionRequirements(effects) {
126343
126402
  */
126344
126403
  async function client_validateLedgerOutcome(blocks) {
126345
126404
  const transaction = client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_assertTransaction).call(this);
126405
+ await client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_validateBlockOperations).call(this, blocks);
126346
126406
  const ownersByIdentifier = {};
126347
126407
 
126348
126408
  // 'ADD' or 'REMOVE' an owner from ownersByIdentifier
@@ -126370,7 +126430,7 @@ async function client_validateLedgerOutcome(blocks) {
126370
126430
  break;
126371
126431
  }
126372
126432
  };
126373
- const effects = client_computeEffectOfBlocks(blocks, client_ledger_classPrivateFieldGet(src_client_ledger, this));
126433
+ const effects = client_computeEffectOfBlocks(blocks, client_ledger_classPrivateFieldGet(client_ledger, this));
126374
126434
  const accountEffects = effects.accounts;
126375
126435
  const allAccountsChanges = Object.values(accountEffects);
126376
126436
 
@@ -126442,13 +126502,13 @@ async function client_validateLedgerOutcome(blocks) {
126442
126502
  if (ownerLength === 1) {
126443
126503
  continue;
126444
126504
  }
126445
- throw new client_ledger('LEDGER_INVALID_OWNER_COUNT', `Invalid number of owners for ${identifierPubKey} - Got ${ownerLength}/1`);
126505
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_INVALID_OWNER_COUNT', `Invalid number of owners for ${identifierPubKey} - Got ${ownerLength}/1`);
126446
126506
  }
126447
126507
  const {
126448
126508
  balances
126449
126509
  } = await client_computeLedgerEffect({
126450
126510
  checkRangeConstraints: true,
126451
- baseToken: client_ledger_classPrivateFieldGet(src_client_ledger, this).baseToken
126511
+ baseToken: client_ledger_classPrivateFieldGet(client_ledger, this).baseToken
126452
126512
  }, accountEffects, client_ledger_classPrivateFieldGet(client_ledger_storage, this), client_ledger_classPrivateFieldGet(client_network, this), client_ledger_classPrivateFieldGet(client_transaction, this));
126453
126513
  for (const accountPubKey in balances) {
126454
126514
  const acctBalanceChanges = balances[accountPubKey];
@@ -126459,10 +126519,10 @@ async function client_validateLedgerOutcome(blocks) {
126459
126519
  receiveValidated
126460
126520
  } = acctBalanceChanges[tokenPubKey];
126461
126521
  if (fellNegative) {
126462
- throw new client_ledger('LEDGER_INVALID_BALANCE', `Resulting balance becomes negative at one+ point(s) during this transaction for account/token ${accountPubKey}/${tokenPubKey}: change ${change}`);
126522
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_INVALID_BALANCE', `Resulting balance becomes negative at one+ point(s) during this transaction for account/token ${accountPubKey}/${tokenPubKey}: change ${change}`);
126463
126523
  }
126464
126524
  if (receiveValidated === false) {
126465
- throw new client_ledger('LEDGER_RECEIVE_NOT_MET', `${accountPubKey}/${tokenPubKey} did not receive enough of requested token. change: ${change}`);
126525
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_RECEIVE_NOT_MET', `${accountPubKey}/${tokenPubKey} did not receive enough of requested token. change: ${change}`);
126466
126526
  }
126467
126527
  }
126468
126528
  }
@@ -126483,13 +126543,13 @@ async function client_validateBlocksForVote(blocks) {
126483
126543
  const prevBlockHash = block.previous;
126484
126544
  seenBlockHashes.add(block.hash);
126485
126545
  if (block.network !== client_ledger_classPrivateFieldGet(client_network, this)) {
126486
- throw new client_ledger('LEDGER_INVALID_NETWORK', 'Cannot vote on block for a different network');
126546
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_INVALID_NETWORK', 'Cannot vote on block for a different network');
126487
126547
  }
126488
126548
  if (block.subnet !== client_ledger_classPrivateFieldGet(client_subnet, this)) {
126489
- throw new client_ledger('LEDGER_INVALID_SUBNET', 'Cannot vote on block for a different subnet');
126549
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_INVALID_SUBNET', 'Cannot vote on block for a different subnet');
126490
126550
  }
126491
126551
  if (usedPreviousBlockHashes.has(prevBlockHash)) {
126492
- throw new client_ledger('LEDGER_PREVIOUS_ALREADY_USED', `Invalid reference to block, previous: ${prevBlockHash} has already been used`);
126552
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_PREVIOUS_ALREADY_USED', `Invalid reference to block, previous: ${prevBlockHash} has already been used`);
126493
126553
  }
126494
126554
  usedPreviousBlockHashes.add(prevBlockHash);
126495
126555
 
@@ -126505,10 +126565,10 @@ async function client_validateBlocksForVote(blocks) {
126505
126565
  if (prevBlock !== undefined) {
126506
126566
  predecessorBeingVotedOn = true;
126507
126567
  if (!prevBlock.account.comparePublicKey(block.account)) {
126508
- throw new client_ledger('LEDGER_INVALID_CHAIN', 'Invalid chain, changes accounts');
126568
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_INVALID_CHAIN', 'Invalid chain, changes accounts');
126509
126569
  }
126510
126570
  if (!seenBlockHashes.has(prevBlockHash)) {
126511
- throw new client_ledger('LEDGER_PREVIOUS_NOT_SEEN', `Invalid reference to block, out-of-order: ${prevBlockHash} has not already been seen`);
126571
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_PREVIOUS_NOT_SEEN', `Invalid reference to block, out-of-order: ${prevBlockHash} has not already been seen`);
126512
126572
  }
126513
126573
  }
126514
126574
  }
@@ -126520,8 +126580,8 @@ async function client_validateBlocksForVote(blocks) {
126520
126580
  }
126521
126581
  async function client_voteOrQuoteWithFees(blocks, type, quote) {
126522
126582
  var _quote$fee;
126523
- if (client_ledger_classPrivateFieldGet(src_client_ledger, this).ledgerWriteMode !== 'read-write') {
126524
- throw new Error(`May not issue votes in read-only mode, in ${client_ledger_classPrivateFieldGet(src_client_ledger, this).ledgerWriteMode} mode`);
126583
+ if (client_ledger_classPrivateFieldGet(client_ledger, this).ledgerWriteMode !== 'read-write') {
126584
+ throw new Error(`May not issue votes in read-only mode, in ${client_ledger_classPrivateFieldGet(client_ledger, this).ledgerWriteMode} mode`);
126525
126585
  }
126526
126586
  if (!client_ledger_classPrivateFieldGet(client_ledger_privateKey, this)) {
126527
126587
  throw new Error('Cannot vote on block, no private key loaded');
@@ -126701,7 +126761,7 @@ class src_client_Ledger {
126701
126761
  shouldTryToRetry = now - startTime < retryConfig.timeout;
126702
126762
  }
126703
126763
  if (shouldTryToRetry) {
126704
- if (client_ledger.isInstance(txnError)) {
126764
+ if (client_ledger_KeetaNetLedgerError.isInstance(txnError)) {
126705
126765
  if (txnError.shouldRetry) {
126706
126766
  let retryDelay = 20;
126707
126767
  if (txnError.retryDelay) {
@@ -126970,11 +127030,11 @@ class src_client_Ledger {
126970
127030
  client_Ledger = src_client_Ledger;
126971
127031
  client_lib_ledger_defineProperty(src_client_Ledger, "Kind", client_LedgerKind);
126972
127032
  client_lib_ledger_defineProperty(src_client_Ledger, "isInstance", client_checkableGenerator(client_Ledger));
126973
- /* harmony default export */ const client_lib_ledger = (src_client_Ledger);
127033
+ /* harmony default export */ const src_client_ledger = (src_client_Ledger);
126974
127034
  // EXTERNAL MODULE: ws (ignored)
126975
127035
  var client_ws_ignored_ = __webpack_require__(4708);
126976
127036
  ;// ./src/version.ts
126977
- const client_version = '0.14.3+gc0f4c96265aa999e6f32e3b21443d294bbf33806';
127037
+ const client_version = '0.14.5+g7ab6fd7b04246202abe16df362295a3a022d514a';
126978
127038
  /* harmony default export */ const client_src_version = ((/* unused pure expression or super */ null && (client_version)));
126979
127039
  ;// ./src/lib/p2p.ts
126980
127040
  /* provided dependency */ var client_p2p_Buffer = __webpack_require__(8287)["Buffer"];
@@ -129039,13 +129099,13 @@ class src_client_Node {
129039
129099
  this.baseToken = baseToken;
129040
129100
 
129041
129101
  /* XXX:TODO: Compute ledger kind from node kind */
129042
- const ledgerKind = client_lib_ledger.Kind.REPRESENTATIVE;
129102
+ const ledgerKind = src_client_ledger.Kind.REPRESENTATIVE;
129043
129103
  this.config = config;
129044
129104
  const initialTrustedAccount = config.initialTrustedAccount;
129045
129105
  if (initialTrustedAccount.hasPrivateKey) {
129046
129106
  throw new Error('There is no reason for us to have the private key in setup of the initialTrustedAccount');
129047
129107
  }
129048
- this.ledger = new client_lib_ledger({
129108
+ this.ledger = new src_client_ledger({
129049
129109
  privateKey: config.ledgerPrivateKey,
129050
129110
  network: config.network,
129051
129111
  subnet: config.subnet,
@@ -129197,6 +129257,144 @@ client_Node = src_client_Node;
129197
129257
  client_node_defineProperty(src_client_Node, "Kind", client_node_NodeKind);
129198
129258
  client_node_defineProperty(src_client_Node, "isInstance", client_checkableGenerator(client_Node));
129199
129259
  /* harmony default export */ const client_node = (src_client_Node);
129260
+ ;// ./src/lib/error/api.ts
129261
+ var client_KeetaNetAPIError;
129262
+ function client_api_defineProperty(e, r, t) { return (r = client_api_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
129263
+ function client_api_toPropertyKey(t) { var i = client_api_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
129264
+ function client_api_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
129265
+
129266
+
129267
+ const client_APIErrorType = 'API';
129268
+ const client_APIErrorCodes = ['INVALID_LIMIT', 'INVALID_SIDE', 'INVALID_START', 'LIMIT_NOT_NUMBER', 'LIMIT_NOT_GREATER_THAN_ZERO', 'REP_MISSING', 'START_MISSING'];
129269
+ const client_FullAPIErrorCodes = client_APIErrorCodes.map(code => `${client_APIErrorType}_${code}`);
129270
+ class src_client_KeetaNetAPIError extends src_client_KeetaNetErrorBase {
129271
+ constructor(code, message) {
129272
+ super(code, message, {
129273
+ type: client_APIErrorType,
129274
+ codes: client_APIErrorCodes
129275
+ });
129276
+ }
129277
+ }
129278
+ client_KeetaNetAPIError = src_client_KeetaNetAPIError;
129279
+ client_api_defineProperty(src_client_KeetaNetAPIError, "isInstance", client_checkableGenerator(client_KeetaNetAPIError));
129280
+ ;// ./src/lib/error/client.ts
129281
+ var client_KeetaNetClientError;
129282
+ function client_client_defineProperty(e, r, t) { return (r = client_client_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
129283
+ function client_client_toPropertyKey(t) { var i = client_client_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
129284
+ function client_client_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
129285
+
129286
+
129287
+ const client_ClientErrorType = 'CLIENT';
129288
+ const client_ClientErrorCodes = ['BUILDER_AMOUNT_IS_ZERO', 'BUILDER_CANNOT_READ_BEFORE_RENDER', 'BUILDER_REQUIRES_PRIVATE_KEY', 'BUILDER_USER_CLIENT_REQUIRED', 'PUBLISH_AID_NOT_AVAILABLE', 'SIGNER_REQUIRES_PRIVATE_KEY', 'SYNC_PUBLISH_FAILED'];
129289
+ const client_FullClientErrorCodes = client_ClientErrorCodes.map(code => `${client_ClientErrorType}_${code}`);
129290
+ class src_client_KeetaNetClientError extends src_client_KeetaNetErrorBase {
129291
+ constructor(code, message) {
129292
+ super(code, message, {
129293
+ type: client_ClientErrorType,
129294
+ codes: client_ClientErrorCodes
129295
+ });
129296
+ }
129297
+ }
129298
+ client_KeetaNetClientError = src_client_KeetaNetClientError;
129299
+ client_client_defineProperty(src_client_KeetaNetClientError, "isInstance", client_checkableGenerator(client_KeetaNetClientError));
129300
+ ;// ./src/lib/error/kv.ts
129301
+ var client_KeetaNetKVError;
129302
+ function client_error_kv_defineProperty(e, r, t) { return (r = client_error_kv_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
129303
+ function client_error_kv_toPropertyKey(t) { var i = client_error_kv_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
129304
+ function client_error_kv_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
129305
+
129306
+
129307
+ const client_KVErrorType = 'KV';
129308
+ const client_KVErrorCodes = ['TTL_NOT_SUPPORTED', 'KEY_ALREADY_EXISTS'];
129309
+ const client_FullKVErrorCodes = client_KVErrorCodes.map(code => `${client_KVErrorType}_${code}`);
129310
+ class src_client_KeetaNetKVError extends src_client_KeetaNetErrorBase {
129311
+ constructor(code, message) {
129312
+ super(code, message, {
129313
+ type: client_KVErrorType,
129314
+ codes: client_KVErrorCodes
129315
+ });
129316
+ }
129317
+ }
129318
+ client_KeetaNetKVError = src_client_KeetaNetKVError;
129319
+ client_error_kv_defineProperty(src_client_KeetaNetKVError, "isInstance", client_checkableGenerator(client_KeetaNetKVError));
129320
+ ;// ./src/lib/error/index.ts
129321
+
129322
+
129323
+
129324
+
129325
+
129326
+
129327
+
129328
+
129329
+
129330
+
129331
+
129332
+ const client_allErrorCodesWithoutPrefix = [...client_AccountErrorCodes, ...client_APIErrorCodes, ...client_BlockErrorCodes, ...client_CertificateErrorCodes, ...client_ClientErrorCodes, ...client_KVErrorCodes, ...client_LedgerBaseErrorCodes, ...client_LedgerVoteErrorCodes, ...client_PermissionsErrorCodes, ...client_VoteErrorCodes];
129333
+ const client_allFullErrorCodes = [...client_FullAccountErrorCodes, ...client_FullAPIErrorCodes, ...client_FullBlockErrorCodes, ...client_FullCertificateErrorCodes, ...client_FullClientErrorCodes, ...client_FullKVErrorCodes, ...client_FullLedgerErrorCodes, ...client_FullPermissionsErrorCodes, ...client_FullVoteErrorCodes];
129334
+ const client_errorCodeSet = new Set(client_allFullErrorCodes);
129335
+ async function client_ExpectErrorCode(code, test) {
129336
+ await expect(test).rejects.toThrow(expect.objectContaining({
129337
+ code: code
129338
+ }));
129339
+ }
129340
+ class client_KeetaNetError extends src_client_KeetaNetErrorBase {
129341
+ static assertValidErrorCode(code) {
129342
+ return client_errorCodeSet.has(code);
129343
+ }
129344
+ static fromJSON(json) {
129345
+ if (typeof json === 'object' && json !== null && 'type' in json && 'code' in json && 'message' in json) {
129346
+ const {
129347
+ type,
129348
+ code,
129349
+ message
129350
+ } = json;
129351
+ if (typeof type !== 'string' || typeof code !== 'string' || typeof message !== 'string') {
129352
+ return new Error('Invalid JSON for KeetaNetError (bad type or code or message)');
129353
+ }
129354
+ if (type === 'LEDGER') {
129355
+ let shouldRetry;
129356
+ let retryDelay;
129357
+ if ('shouldRetry' in json) {
129358
+ if (typeof json.shouldRetry !== 'boolean') {
129359
+ return new Error('Invalid JSON for KeetaNetLedgerError (bad shouldRetry)');
129360
+ }
129361
+ shouldRetry = json.shouldRetry;
129362
+ }
129363
+ if ('retryDelay' in json) {
129364
+ if (typeof json.retryDelay !== 'number') {
129365
+ return new Error('Invalid JSON for KeetaNetLedgerError (bad retryDelay)');
129366
+ }
129367
+ retryDelay = json.retryDelay;
129368
+ }
129369
+ if (src_client_KeetaNetLedgerVoteError.assertValidLedgerErrorCode(code)) {
129370
+ if (!('accounts' in json) || !Array.isArray(json.accounts)) {
129371
+ return new Error('Invalid JSON for KeetaNetLedgerVoteError (bad accounts)');
129372
+ }
129373
+ const accountsArray = json.accounts.map(account => {
129374
+ return client_lib_account.fromPublicKeyString(account);
129375
+ });
129376
+ const accounts = new client_lib_account.Set(accountsArray);
129377
+ return new src_client_KeetaNetLedgerVoteError(code, message, accounts);
129378
+ } else if (client_ledger_KeetaNetLedgerError.assertValidLedgerErrorCode(code)) {
129379
+ return new client_ledger_KeetaNetLedgerError(code, message, shouldRetry, retryDelay);
129380
+ }
129381
+ }
129382
+ if (this.assertValidErrorCode(code)) {
129383
+ return new client_KeetaNetError(code, message, {
129384
+ type,
129385
+ codes: client_allErrorCodesWithoutPrefix
129386
+ });
129387
+ }
129388
+ }
129389
+ if (typeof json === 'object' && json !== null && 'message' in json) {
129390
+ if (typeof json.message !== 'string') {
129391
+ return new Error('Invalid JSON for KeetaNetError (bad message)');
129392
+ }
129393
+ return new Error(json.message);
129394
+ }
129395
+ return new Error('Unknown error');
129396
+ }
129397
+ }
129200
129398
  // EXTERNAL MODULE: ./node_modules/bloom-filters/dist/api.js
129201
129399
  var client_api = __webpack_require__(5652);
129202
129400
  ;// ./src/lib/utils/bloom.ts
@@ -129270,6 +129468,7 @@ function client_deserializeBloomFilter(input) {
129270
129468
  // Blocks that will return from generateInitialVoteStaple if you are adding supply
129271
129469
 
129272
129470
  async function client_generateInitialVoteStaple(options) {
129471
+ var _options$baseTokenInf, _options$baseTokenInf2, _options$baseTokenInf3, _options$baseTokenInf4;
129273
129472
  const {
129274
129473
  network,
129275
129474
  initialTrustedAccount,
@@ -129330,9 +129529,11 @@ async function client_generateInitialVoteStaple(options) {
129330
129529
  permissions: new client_permissions_Permissions(['OWNER'])
129331
129530
  }, {
129332
129531
  type: client_lib_block.Builder.OperationType.SET_INFO,
129333
- name: '',
129334
- description: '',
129335
- metadata: '',
129532
+ name: (_options$baseTokenInf = (_options$baseTokenInf2 = options.baseTokenInfo) === null || _options$baseTokenInf2 === void 0 ? void 0 : _options$baseTokenInf2.currencyCode) !== null && _options$baseTokenInf !== void 0 ? _options$baseTokenInf : '',
129533
+ description: (_options$baseTokenInf3 = (_options$baseTokenInf4 = options.baseTokenInfo) === null || _options$baseTokenInf4 === void 0 ? void 0 : _options$baseTokenInf4.name) !== null && _options$baseTokenInf3 !== void 0 ? _options$baseTokenInf3 : '',
129534
+ metadata: options.baseTokenInfo ? btoa(JSON.stringify({
129535
+ decimalPlaces: options.baseTokenInfo.decimalPlaces
129536
+ })) : '',
129336
129537
  defaultPermission: new client_permissions_Permissions(['ACCESS'])
129337
129538
  }, ...additionalBaseTokenOperations]
129338
129539
  }).seal();
@@ -129412,8 +129613,8 @@ async function client_generateInitialVoteStaple(options) {
129412
129613
  */
129413
129614
  Account: client_lib_account,
129414
129615
  Block: client_lib_block,
129415
- Error: src_client_KeetaNetError,
129416
- Ledger: client_lib_ledger,
129616
+ Error: client_KeetaNetError,
129617
+ Ledger: src_client_ledger,
129417
129618
  Node: client_node,
129418
129619
  P2P: client_p2p,
129419
129620
  Permissions: client_permissions_Permissions,
@@ -129430,25 +129631,6 @@ async function client_generateInitialVoteStaple(options) {
129430
129631
  Certificate: client_utils_certificate_namespaceObject
129431
129632
  }
129432
129633
  });
129433
- ;// ./src/lib/error/client.ts
129434
- var client_KeetaNetClientError;
129435
- function client_client_defineProperty(e, r, t) { return (r = client_client_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
129436
- function client_client_toPropertyKey(t) { var i = client_client_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
129437
- function client_client_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
129438
-
129439
-
129440
- const client_ClientErrorType = 'CLIENT';
129441
- const client_ClientErrorCodes = ['BUILDER_AMOUNT_IS_ZERO', 'BUILDER_CANNOT_READ_BEFORE_RENDER', 'BUILDER_REQUIRES_PRIVATE_KEY', 'BUILDER_USER_CLIENT_REQUIRED', 'PUBLISH_AID_NOT_AVAILABLE', 'SIGNER_REQUIRES_PRIVATE_KEY'];
129442
- class src_client_KeetaNetClientError extends src_client_KeetaNetError {
129443
- constructor(code, message) {
129444
- super(code, message, {
129445
- type: client_ClientErrorType,
129446
- codes: client_ClientErrorCodes
129447
- });
129448
- }
129449
- }
129450
- client_KeetaNetClientError = src_client_KeetaNetClientError;
129451
- client_client_defineProperty(src_client_KeetaNetClientError, "isInstance", client_checkableGenerator(client_KeetaNetClientError));
129452
129634
  ;// ./src/client/builder.ts
129453
129635
  /* provided dependency */ var client_builder_Buffer = __webpack_require__(8287)["Buffer"];
129454
129636
  var client_PendingAccount, client_UserClientBuilder;
@@ -130429,6 +130611,7 @@ function client_client_assertClassBrand(e, t, n) { if ("function" == typeof e ?
130429
130611
 
130430
130612
 
130431
130613
 
130614
+
130432
130615
 
130433
130616
 
130434
130617
  /*
@@ -130807,9 +130990,10 @@ class src_client_Client {
130807
130990
  * @return The account information
130808
130991
  */
130809
130992
  async getAccountInfo(account) {
130993
+ let rep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'ANY';
130810
130994
  account = client_lib_account.toAccount(account);
130811
130995
  const accountPubKey = account.publicKeyString.get();
130812
- const result = await client_client_assertClassBrand(client_Client_brand, this, src_client_api).call(this, 'ANY', 'GET /node/ledger/account/:account', {
130996
+ const result = await client_client_assertClassBrand(client_Client_brand, this, src_client_api).call(this, rep, 'GET /node/ledger/account/:account', {
130813
130997
  args: {
130814
130998
  account: accountPubKey
130815
130999
  }
@@ -131699,6 +131883,68 @@ class src_client_Client {
131699
131883
  }
131700
131884
  return voteStaple;
131701
131885
  }
131886
+
131887
+ /**
131888
+ * Sync any partially-published account artifacts
131889
+ *
131890
+ * @param account Account to sync
131891
+ * @param publish Publish the synced staple to the network (default is true)
131892
+ */
131893
+ async syncAccount(account) {
131894
+ let publish = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
131895
+ let reps = arguments.length > 2 ? arguments[2] : undefined;
131896
+ await client_client_classPrivateFieldGet(client_updateRepsPromise, this);
131897
+ if (reps === undefined) {
131898
+ reps = this.representatives;
131899
+ }
131900
+ const repAccountInfoPromises = [];
131901
+ for (const rep of reps) {
131902
+ repAccountInfoPromises.push((async () => {
131903
+ const info = await this.getAccountInfo(account, rep);
131904
+ return {
131905
+ rep,
131906
+ info
131907
+ };
131908
+ })());
131909
+ }
131910
+ const accountInfoSettled = await Promise.allSettled(repAccountInfoPromises);
131911
+ const accountInfo = [];
131912
+ for (const info of accountInfoSettled) {
131913
+ if (info.status === 'fulfilled') {
131914
+ accountInfo.push(info.value);
131915
+ }
131916
+ }
131917
+ const accountInfoSorted = accountInfo.sort(function (a, b) {
131918
+ var _a$info$currentHeadBl, _b$info$currentHeadBl;
131919
+ return Number(BigInt((_a$info$currentHeadBl = a.info.currentHeadBlockHeight) !== null && _a$info$currentHeadBl !== void 0 ? _a$info$currentHeadBl : -1) - BigInt((_b$info$currentHeadBl = b.info.currentHeadBlockHeight) !== null && _b$info$currentHeadBl !== void 0 ? _b$info$currentHeadBl : -1));
131920
+ });
131921
+ if (accountInfoSorted[0].info.currentHeadBlockHeight === accountInfoSorted[accountInfoSorted.length - 1].info.currentHeadBlockHeight) {
131922
+ // Block Heights match so return
131923
+ return null;
131924
+ }
131925
+ let lowestHead = accountInfoSorted[0].info.currentHeadBlock;
131926
+ if (lowestHead === null) {
131927
+ lowestHead = client_lib_block.getAccountOpeningHash(account).toString();
131928
+ }
131929
+
131930
+ // Get the missing successor block and vote staple from the rep with the highest block height
131931
+ const successorBlock = await this.getSuccessorBlock(lowestHead, accountInfoSorted[accountInfoSorted.length - 1].rep);
131932
+ if (successorBlock === null) {
131933
+ return null;
131934
+ }
131935
+ const successorStaple = await this.getVoteStaple(successorBlock.hash, 'main', accountInfoSorted[accountInfoSorted.length - 1].rep);
131936
+ if (successorStaple === null) {
131937
+ return null;
131938
+ }
131939
+ if (publish === true) {
131940
+ await this.transmitStaple(successorStaple, [accountInfoSorted[0].rep]);
131941
+ }
131942
+ const updatedAccountInfo = await this.getAccountInfo(account, accountInfoSorted[0].rep);
131943
+ if (updatedAccountInfo.currentHeadBlockHeight === accountInfoSorted[0].info.currentHeadBlockHeight) {
131944
+ throw new src_client_KeetaNetClientError('CLIENT_SYNC_PUBLISH_FAILED', `Client sync found a missing staple: ${successorStaple.blocksHash}, but it could not be published to rep: ${accountInfoSorted[0].rep.key.publicKeyString.get()}`);
131945
+ }
131946
+ return successorStaple;
131947
+ }
131702
131948
  async getVoteQuotes(blocks) {
131703
131949
  return await client_client_assertClassBrand(client_Client_brand, this, client_requestQuotes).call(this, blocks);
131704
131950
  }
@@ -131730,7 +131976,8 @@ async function client_apiRaw(rep, api, method) {
131730
131976
  ...options
131731
131977
  };
131732
131978
  let delay = 1;
131733
- let result, resultThrow;
131979
+ let result;
131980
+ let resultThrow;
131734
131981
  for (let retry = 0; retry < Number.MAX_SAFE_INTEGER; retry++) {
131735
131982
  if (rep === 'ANY') {
131736
131983
  var _classPrivateFieldGet4;
@@ -131787,7 +132034,18 @@ async function client_apiRaw(rep, api, method) {
131787
132034
  try {
131788
132035
  const errorInfo = await response.json();
131789
132036
  if (errorInfo.error === true) {
131790
- resultThrow = errorInfo;
132037
+ const keetaNetError = client_KeetaNetError.fromJSON(errorInfo);
132038
+ try {
132039
+ if (src_client_KeetaNetLedgerVoteError.isInstance(keetaNetError)) {
132040
+ for (const account of keetaNetError.accounts) {
132041
+ await this.syncAccount(account);
132042
+ }
132043
+ continue;
132044
+ }
132045
+ } catch {
132046
+ // ignored error parsing KeetaNet Error just return original
132047
+ }
132048
+ resultThrow = keetaNetError;
131791
132049
  break;
131792
132050
  }
131793
132051
  } catch (errorResponse) {
@@ -131849,13 +132107,8 @@ async function client_apiRaw(rep, api, method) {
131849
132107
  break;
131850
132108
  }
131851
132109
  if (resultThrow) {
131852
- if (resultThrow.code && resultThrow.type) {
131853
- const error = new src_client_KeetaNetError(resultThrow.code, resultThrow.message);
131854
- error.type = resultThrow.type;
131855
- throw error;
131856
- } else {
131857
- throw new Error(resultThrow.message);
131858
- }
132110
+ const toThrow = client_KeetaNetError.fromJSON(resultThrow);
132111
+ throw toThrow;
131859
132112
  }
131860
132113
  return result;
131861
132114
  }
@@ -132436,7 +132689,8 @@ class src_client_UserClient {
132436
132689
  const {
132437
132690
  delegateTo = this.client.representatives[0].key,
132438
132691
  addSupplyAmount,
132439
- voteSerial = 0n
132692
+ voteSerial = 0n,
132693
+ baseTokenInfo
132440
132694
  } = initOpts;
132441
132695
  if (this.signer === null) {
132442
132696
  throw new Error('May not initialize chain with a read-only UserClient (signer is null)');
@@ -132452,7 +132706,8 @@ class src_client_UserClient {
132452
132706
  delegateTo: delegateTo,
132453
132707
  recipient: client_client_assertClassBrand(client_UserClient_brand, this, client_getAccount).call(this, options).assertAccount(),
132454
132708
  amount: addSupplyAmount
132455
- }
132709
+ },
132710
+ baseTokenInfo
132456
132711
  });
132457
132712
  return await this.client.transmitStaple(voteStaple);
132458
132713
  }
@@ -132557,9 +132812,10 @@ class src_client_UserClient {
132557
132812
  * @return The vote staple that was generated and whether it was able to be published
132558
132813
  */
132559
132814
  async publishBuilder(builder) {
132560
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
132561
- generateFeeBlock: client_client_classPrivateFieldGet(client_client_config, this).generateFeeBlock
132562
- };
132815
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
132816
+ if (options.generateFeeBlock === undefined) {
132817
+ options.generateFeeBlock = client_client_classPrivateFieldGet(client_client_config, this).generateFeeBlock;
132818
+ }
132563
132819
  if (!client_client_classPrivateFieldGet(client_client_config, this).usePublishAid) {
132564
132820
  return await client_client_classPrivateFieldGet(client_client, this).transmitBuilder(builder, this.network, options);
132565
132821
  }
@@ -132678,15 +132934,18 @@ class src_client_UserClient {
132678
132934
  try {
132679
132935
  const builder = this.initBuilder(options);
132680
132936
  builder.send(client_lib_account.toAccount(to), BigInt(amount), client_lib_account.toAccount(token), external);
132681
- return await this.publishBuilder(builder);
132937
+ const publish = await this.publishBuilder(builder);
132938
+ return publish;
132682
132939
  } catch (transmitError) {
132683
132940
  let error = true;
132684
132941
  if (retries < 2) {
132685
- if (src_client_KeetaNetError.isInstance(transmitError) && transmitError.code === 'LEDGER_SUCCESSOR_VOTE_EXISTS') {
132686
- const staple = await this.recover(true, options);
132687
- if (staple) {
132688
- error = false;
132689
- return await this.send(to, amount, token, external, options, retries + 1);
132942
+ if (client_KeetaNetError.isInstance(transmitError)) {
132943
+ if (transmitError.code === 'LEDGER_SUCCESSOR_VOTE_EXISTS') {
132944
+ const staple = await this.recover(true, options);
132945
+ if (staple) {
132946
+ error = false;
132947
+ return await this.send(to, amount, token, external, options, retries + 1);
132948
+ }
132690
132949
  }
132691
132950
  }
132692
132951
  }
@@ -132926,6 +133185,18 @@ class src_client_UserClient {
132926
133185
  return await client_client_classPrivateFieldGet(client_client, this).recoverAccount(client_client_assertClassBrand(client_UserClient_brand, this, client_getAccount).call(this, options), publish);
132927
133186
  }
132928
133187
 
133188
+ /**
133189
+ * Sync any partially-published account artifacts
133190
+ *
133191
+ * @param publish Publish the recovered staple to the network
133192
+ * (default: true)
133193
+ * @param options User client options (common options)
133194
+ */
133195
+ async sync(publish) {
133196
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
133197
+ return await client_client_classPrivateFieldGet(client_client, this).syncAccount(client_client_assertClassBrand(client_UserClient_brand, this, client_getAccount).call(this, options), publish);
133198
+ }
133199
+
132929
133200
  /**
132930
133201
  * Register a callback for change messages and set up a websocket filtered to our account only.
132931
133202
  * Also set up long timeout polling for changes in case the websocket misses a change update
@@ -133147,7 +133418,7 @@ async function client_publishWithPublishAid(blocks) {
133147
133418
  publish: json.publish
133148
133419
  };
133149
133420
  } catch (publishError) {
133150
- if (src_client_KeetaNetError.isInstance(publishError)) {
133421
+ if (client_KeetaNetError.isInstance(publishError)) {
133151
133422
  throw publishError;
133152
133423
  } else if (publishError instanceof Error) {
133153
133424
  throw new src_client_KeetaNetClientError('CLIENT_PUBLISH_AID_NOT_AVAILABLE', `Publish Aid not available: ${publishError.message}`);