@keetanetwork/keetanet-client 0.14.4 → 0.14.6

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 (190) hide show
  1. package/README.md +1 -1
  2. package/api/index.d.ts +7 -0
  3. package/api/node.d.ts +8 -0
  4. package/client/client_common_tests.d.ts +8 -0
  5. package/client/index-browser.d.ts +17 -3
  6. package/client/index-browser.js +1059 -181
  7. package/client/index.d.ts +17 -3
  8. package/client/index.js +2306 -187
  9. package/config/index.d.ts +4 -1
  10. package/docs/GETTING-STARTED.md +3 -3
  11. package/docs/assets/hierarchy.js +1 -1
  12. package/docs/assets/navigation.js +1 -1
  13. package/docs/assets/search.js +1 -1
  14. package/docs/classes/KeetaNetSDK.Client.html +10 -6
  15. package/docs/classes/KeetaNetSDK.Referenced.BaseSet.html +1 -1
  16. package/docs/classes/KeetaNetSDK.Referenced.BaseVoteBuilder.html +1 -1
  17. package/docs/classes/KeetaNetSDK.Referenced.Block.html +3 -2
  18. package/docs/classes/KeetaNetSDK.Referenced.BlockBuilder.html +2 -1
  19. package/docs/classes/KeetaNetSDK.Referenced.BlockHash.html +2 -2
  20. package/docs/classes/KeetaNetSDK.Referenced.BlockOperation.html +1 -1
  21. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationCREATE_IDENTIFIER.html +1 -1
  22. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMANAGE_CERTIFICATE.html +1 -1
  23. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMODIFY_PERMISSIONS.html +1 -1
  24. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationRECEIVE.html +1 -1
  25. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSEND.html +1 -1
  26. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_INFO.html +1 -1
  27. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_REP.html +1 -1
  28. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
  29. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_SUPPLY.html +1 -1
  30. package/docs/classes/KeetaNetSDK.Referenced.CertificateHash.html +1 -1
  31. package/docs/classes/KeetaNetSDK.Referenced.ECDSAKeyPair.html +1 -1
  32. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1KeyPair.html +1 -1
  33. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PrivateKey.html +1 -1
  34. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PublicKey.html +1 -1
  35. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1Signature.html +1 -1
  36. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1KeyPair.html +1 -1
  37. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PrivateKey.html +1 -1
  38. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PublicKey.html +1 -1
  39. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1Signature.html +1 -1
  40. package/docs/classes/KeetaNetSDK.Referenced.ED25519KeyPair.html +1 -1
  41. package/docs/classes/KeetaNetSDK.Referenced.ED25519PrivateKey.html +1 -1
  42. package/docs/classes/KeetaNetSDK.Referenced.ED25519PublicKey.html +1 -1
  43. package/docs/classes/KeetaNetSDK.Referenced.ED25519Signature.html +1 -1
  44. package/docs/classes/KeetaNetSDK.Referenced.ExternalKeyPair.html +1 -1
  45. package/docs/classes/KeetaNetSDK.Referenced.ExternalSet.html +1 -1
  46. package/docs/classes/KeetaNetSDK.Referenced.IdempotentKey.html +17 -0
  47. package/docs/classes/KeetaNetSDK.Referenced.IdentifierKey.html +1 -1
  48. package/docs/classes/KeetaNetSDK.Referenced.IdentifierKeyPair.html +1 -1
  49. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetError.html +2 -2
  50. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetErrorBase.html +1 -1
  51. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerError.html +2 -2
  52. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerVoteError.html +1 -1
  53. package/docs/classes/KeetaNetSDK.Referenced.KeyInterface.html +1 -1
  54. package/docs/classes/KeetaNetSDK.Referenced.KeyStorage.html +1 -1
  55. package/docs/classes/KeetaNetSDK.Referenced.Ledger.html +4 -2
  56. package/docs/classes/KeetaNetSDK.Referenced.LedgerAtomicInterface.html +3 -1
  57. package/docs/classes/KeetaNetSDK.Referenced.Log.html +40 -0
  58. package/docs/classes/KeetaNetSDK.Referenced.LogTargetConsole.html +5 -0
  59. package/docs/classes/KeetaNetSDK.Referenced.Node.html +1 -1
  60. package/docs/classes/KeetaNetSDK.Referenced.PermissionSetHolder.html +1 -1
  61. package/docs/classes/KeetaNetSDK.Referenced.PossiblyExpiredVote.html +1 -1
  62. package/docs/classes/KeetaNetSDK.Referenced.SignatureStorage.html +1 -1
  63. package/docs/classes/KeetaNetSDK.Referenced.Stats.html +1 -1
  64. package/docs/classes/KeetaNetSDK.Referenced.StatsPending.html +1 -1
  65. package/docs/classes/KeetaNetSDK.Referenced.Vote.html +1 -1
  66. package/docs/classes/KeetaNetSDK.Referenced.VoteBlockBundle.html +2 -2
  67. package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHash.html +1 -1
  68. package/docs/classes/KeetaNetSDK.Referenced.VoteBuilder.html +1 -1
  69. package/docs/classes/KeetaNetSDK.Referenced.VoteHash.html +1 -1
  70. package/docs/classes/KeetaNetSDK.Referenced.VoteLikeBase.html +1 -1
  71. package/docs/classes/KeetaNetSDK.Referenced.VoteQuote.html +1 -1
  72. package/docs/classes/KeetaNetSDK.Referenced.VoteQuoteBuilder.html +1 -1
  73. package/docs/classes/KeetaNetSDK.Referenced.VoteStaple.html +2 -2
  74. package/docs/classes/KeetaNetSDK.Referenced.VoteStapleHash.html +1 -1
  75. package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer.BufferStorage.html +1 -1
  76. package/docs/classes/KeetaNetSDK.UserClient.html +14 -10
  77. package/docs/documents/GETTING-STARTED.html +3 -3
  78. package/docs/functions/KeetaNetSDK.Referenced.src_config.getDefaultConfig.html +2 -2
  79. package/docs/functions/KeetaNetSDK.Referenced.src_config.getNetworkAlias.html +1 -1
  80. package/docs/functions/KeetaNetSDK.Referenced.src_config.getValidation.html +1 -1
  81. package/docs/functions/KeetaNetSDK.Referenced.src_config.isNetwork.html +1 -1
  82. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.validateBase64ToBuffer.html +1 -0
  83. package/docs/hierarchy.html +1 -1
  84. package/docs/index.html +1 -1
  85. package/docs/interfaces/KeetaNetSDK.Referenced.ACLEntry.html +1 -1
  86. package/docs/interfaces/KeetaNetSDK.Referenced.ACLUpdate.html +1 -1
  87. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ExplicitContextTag.html +1 -1
  88. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ImplicitContextTag.html +1 -1
  89. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1Object.html +1 -1
  90. package/docs/interfaces/KeetaNetSDK.Referenced.BaseExternalKeyPairFunctions.html +1 -1
  91. package/docs/interfaces/KeetaNetSDK.Referenced.BaseGenerationConfig.html +3 -2
  92. package/docs/interfaces/KeetaNetSDK.Referenced.BaseIdentifierCreateArguments.html +1 -1
  93. package/docs/interfaces/KeetaNetSDK.Referenced.BaseTokenInfo.html +3 -2
  94. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperation.html +1 -1
  95. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationCREATE_IDENTIFIER.html +1 -1
  96. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATE.html +1 -1
  97. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATESerializable.html +1 -1
  98. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMODIFY_PERMISSIONS.html +1 -1
  99. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationRECEIVE.html +1 -1
  100. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSEND.html +1 -1
  101. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_INFO.html +1 -1
  102. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_REP.html +1 -1
  103. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
  104. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_SUPPLY.html +1 -1
  105. package/docs/interfaces/KeetaNetSDK.Referenced.BlockV1Canonical.html +3 -2
  106. package/docs/interfaces/KeetaNetSDK.Referenced.BlockV1JSON.html +3 -2
  107. package/docs/interfaces/KeetaNetSDK.Referenced.BlockV1UnsignedCanonical.html +3 -2
  108. package/docs/interfaces/KeetaNetSDK.Referenced.BlockV2Canonical.html +3 -2
  109. package/docs/interfaces/KeetaNetSDK.Referenced.BlockV2JSON.html +3 -2
  110. package/docs/interfaces/KeetaNetSDK.Referenced.BlockV2UnsignedCanonical.html +3 -2
  111. package/docs/interfaces/KeetaNetSDK.Referenced.Constructor.html +1 -1
  112. package/docs/interfaces/KeetaNetSDK.Referenced.DisposableTimingHandle.html +1 -1
  113. package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsNoEncryption.html +1 -1
  114. package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsSupportsEncryption.html +1 -1
  115. package/docs/interfaces/KeetaNetSDK.Referenced.InitialConfigSupply.html +3 -2
  116. package/docs/interfaces/KeetaNetSDK.Referenced.InstanceSet.html +1 -1
  117. package/docs/interfaces/KeetaNetSDK.Referenced.KVGenericOptionsType.html +1 -1
  118. package/docs/interfaces/KeetaNetSDK.Referenced.KVSetOptionsType.html +1 -1
  119. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerConfig.html +6 -4
  120. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageAPI.html +4 -2
  121. package/docs/interfaces/KeetaNetSDK.Referenced.LogTarget.html +4 -0
  122. package/docs/interfaces/KeetaNetSDK.Referenced.Logger.html +6 -0
  123. package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +1 -1
  124. package/docs/interfaces/KeetaNetSDK.Referenced.MultiSigIdentifierCreateArguments.html +1 -1
  125. package/docs/interfaces/KeetaNetSDK.Referenced.MultisigConfig.html +1 -1
  126. package/docs/interfaces/KeetaNetSDK.Referenced.NodeConfig.html +5 -3
  127. package/docs/interfaces/KeetaNetSDK.Referenced.NumericValueEntry.html +1 -1
  128. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerBase.html +1 -1
  129. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerListener.html +1 -1
  130. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerRepBase.html +1 -1
  131. package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStorage.html +1 -1
  132. package/docs/interfaces/KeetaNetSDK.Referenced.RequestTokenReceiveEntry.html +1 -1
  133. package/docs/interfaces/KeetaNetSDK.Referenced.TokenNumericEntry.html +1 -1
  134. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientConfig.html +2 -2
  135. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientOptions.html +1 -1
  136. package/docs/interfaces/KeetaNetSDK.Referenced.VoteStapleJSON.html +2 -2
  137. package/docs/interfaces/KeetaNetSDK.Referenced.WithIsInstance.html +1 -1
  138. package/docs/interfaces/KeetaNetSDK.Referenced.src_config.ValidationConfig.html +3 -2
  139. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1BitString.html +1 -1
  140. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Date.html +1 -1
  141. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1OID.html +1 -1
  142. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Set.html +1 -1
  143. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1String.html +1 -1
  144. package/docs/modules/KeetaNetSDK.Referenced.html +1 -1
  145. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_helper.html +1 -1
  146. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_initial.html +1 -1
  147. package/docs/types/KeetaNetSDK.Referenced.AccountInfoResponse.html +3 -2
  148. package/docs/types/KeetaNetSDK.Referenced.IdempotentKeyString.html +1 -0
  149. package/docs/types/KeetaNetSDK.Referenced.LogCurrentRequest.html +2 -0
  150. package/docs/types/KeetaNetSDK.Referenced.LogEntry.html +6 -0
  151. package/docs/types/KeetaNetSDK.Referenced.LogLevel.html +1 -0
  152. package/docs/types/KeetaNetSDK.Referenced.LogOptions.html +4 -0
  153. package/docs/types/KeetaNetSDK.Referenced.LogTargetConsoleConfig.html +4 -0
  154. package/docs/types/KeetaNetSDK.Referenced.LogTargetID.html +1 -0
  155. package/docs/types/KeetaNetSDK.Referenced.LogTargetLevel.html +1 -0
  156. package/docs/types/KeetaNetSDK.Referenced.src_config.NetworkConfig.html +1 -1
  157. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_initial.BaseNetworkInfo.html +1 -0
  158. package/docs/variables/KeetaNetSDK.Referenced.FullLedgerBaseErrorCode.html +1 -1
  159. package/docs/variables/KeetaNetSDK.Referenced.allFullErrorCodes.html +1 -1
  160. package/docs/variables/KeetaNetSDK.Referenced.src_config.networksArray.html +1 -1
  161. package/docs/variables/KeetaNetSDK.lib.html +2 -2
  162. package/lib/block/index.d.ts +38 -24
  163. package/lib/error/block.d.ts +2 -2
  164. package/lib/error/client.d.ts +2 -2
  165. package/lib/error/index.d.ts +1 -1
  166. package/lib/error/ledger.d.ts +32 -4
  167. package/lib/index.d.ts +2 -0
  168. package/lib/kv/kv_redis.d.ts +3 -2
  169. package/lib/ledger/db_dynamodb.d.ts +2 -1
  170. package/lib/ledger/db_postgres.d.ts +2 -1
  171. package/lib/ledger/db_spanner.d.ts +2 -1
  172. package/lib/ledger/db_spanner_helper.d.ts +18 -2
  173. package/lib/ledger/db_sqlite.d.ts +3 -2
  174. package/lib/ledger/index.d.ts +34 -1
  175. package/lib/log/common.d.ts +39 -0
  176. package/lib/log/helper.generated.d.ts +9 -0
  177. package/lib/log/index.d.ts +102 -0
  178. package/lib/log/target_console.d.ts +14 -0
  179. package/lib/log/target_gcp.d.ts +20 -0
  180. package/lib/log/target_gcp.js +469 -0
  181. package/lib/node/index.d.ts +6 -4
  182. package/lib/node/utils.d.ts +1 -0
  183. package/lib/utils/helper.d.ts +1 -1
  184. package/lib/utils/initial.d.ts +5 -0
  185. package/lib/vote.d.ts +1 -0
  186. package/npm-shrinkwrap.json +1145 -29
  187. package/package.json +3 -2
  188. package/version.d.ts +1 -1
  189. package/benchmarking/test.d.ts +0 -4
  190. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.internalLogger.html +0 -1
@@ -92151,6 +92151,59 @@ module.exports = function typedarrayToBuffer (arr) {
92151
92151
  }
92152
92152
 
92153
92153
 
92154
+ /***/ }),
92155
+
92156
+ /***/ 8659:
92157
+ /***/ ((__unused_webpack_module, exports) => {
92158
+
92159
+ "use strict";
92160
+
92161
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
92162
+ exports.TypeGuardError = void 0;
92163
+ class TypeGuardError extends Error {
92164
+ constructor(props) {
92165
+ // MESSAGE CONSTRUCTION
92166
+ super(props.message ||
92167
+ `Error on ${props.method}(): invalid type${props.path ? ` on ${props.path}` : ""}, expect to be ${props.expected}`);
92168
+ // INHERITANCE POLYFILL
92169
+ const proto = new.target.prototype;
92170
+ if (Object.setPrototypeOf)
92171
+ Object.setPrototypeOf(this, proto);
92172
+ else
92173
+ this.__proto__ = proto;
92174
+ // ASSIGN MEMBERS
92175
+ this.method = props.method;
92176
+ this.path = props.path;
92177
+ this.expected = props.expected;
92178
+ this.value = props.value;
92179
+ }
92180
+ }
92181
+ exports.TypeGuardError = TypeGuardError;
92182
+ //# sourceMappingURL=TypeGuardError.js.map
92183
+
92184
+ /***/ }),
92185
+
92186
+ /***/ 7422:
92187
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
92188
+
92189
+ "use strict";
92190
+ var __webpack_unused_export__;
92191
+
92192
+ __webpack_unused_export__ = ({ value: true });
92193
+ exports.v = void 0;
92194
+ const TypeGuardError_1 = __webpack_require__(8659);
92195
+ const _assertGuard = (exceptionable, props, factory) => {
92196
+ if (exceptionable === true) {
92197
+ if (factory)
92198
+ throw factory(props);
92199
+ else
92200
+ throw new TypeGuardError_1.TypeGuardError(props);
92201
+ }
92202
+ return false;
92203
+ };
92204
+ exports.v = _assertGuard;
92205
+ //# sourceMappingURL=_assertGuard.js.map
92206
+
92154
92207
  /***/ }),
92155
92208
 
92156
92209
  /***/ 4643:
@@ -101182,7 +101235,6 @@ __webpack_require__.d(client_helper_namespaceObject, {
101182
101235
  crypto: () => (client_helper_crypto),
101183
101236
  debugPrintableObject: () => (client_debugPrintableObject),
101184
101237
  env: () => (client_env),
101185
- internalLogger: () => (client_internalLogger),
101186
101238
  isBuffer: () => (client_isBuffer),
101187
101239
  isIntegerOrBigInt: () => (client_isIntegerOrBigInt),
101188
101240
  nonNullable: () => (client_nonNullable),
@@ -101191,6 +101243,7 @@ __webpack_require__.d(client_helper_namespaceObject, {
101191
101243
  randomInt: () => (client_randomInt),
101192
101244
  randomString: () => (client_randomString),
101193
101245
  setGenerator: () => (client_setGenerator),
101246
+ validateBase64ToBuffer: () => (client_validateBase64ToBuffer),
101194
101247
  waitTicks: () => (client_waitTicks)
101195
101248
  });
101196
101249
 
@@ -105388,9 +105441,9 @@ function client_v4(options, buf, offset) {
105388
105441
  /* harmony default export */ const client_esm_browser_v4 = (client_v4);
105389
105442
 
105390
105443
  ;// ./src/lib/utils/helper.ts
105391
- /* provided dependency */ var client_process = __webpack_require__(5606);
105392
105444
  /* provided dependency */ var src_client_Buffer = __webpack_require__(8287)["Buffer"];
105393
- var client_process$env$KEETANET, client_process$env$KEETANET2, client_ref, client_global$AsyncDisposab;
105445
+ /* provided dependency */ var client_process = __webpack_require__(5606);
105446
+ var client_ref, client_global$AsyncDisposab;
105394
105447
  function src_client_classPrivateFieldSet(s, a, r) { return s.set(src_client_assertClassBrand(s, a), r), r; }
105395
105448
  function src_client_classPrivateMethodInitSpec(e, a) { src_client_checkPrivateRedeclaration(e, a), a.add(e); }
105396
105449
  function src_client_defineProperty_0(e, r, t) { return (r = src_client_toPropertyKey_0(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -105404,13 +105457,17 @@ function src_client_assertClassBrand(e, t, n) { if ("function" == typeof e ? e =
105404
105457
 
105405
105458
 
105406
105459
 
105407
- const client_loggingLevels = ['debug', 'error'];
105408
- const client_configuredLoggingLevel = (client_process$env$KEETANET = client_process.env['KEETANET_DEBUG']) === null || client_process$env$KEETANET === void 0 ? void 0 : client_process$env$KEETANET.toLowerCase();
105409
- const client_configuredLoggingFilter = new RegExp((client_process$env$KEETANET2 = client_process.env['KEETANET_DEBUG_FILTER']) !== null && client_process$env$KEETANET2 !== void 0 ? client_process$env$KEETANET2 : '', 'i');
105410
105460
  const client_helper_randomBytes = client_crypto_default().randomBytes.bind((client_crypto_default()));
105411
105461
  const client_helper_randomUUID = (client_crypto_default()).randomUUID ? client_crypto_default().randomUUID.bind((client_crypto_default())) : function () {
105412
105462
  return client_esm_browser_v4();
105413
105463
  };
105464
+ function client_validateBase64ToBuffer(input) {
105465
+ const buffer = src_client_Buffer.from(input, 'base64');
105466
+ if (input !== buffer.toString('base64')) {
105467
+ throw new Error('Could Not Decode base64 String');
105468
+ }
105469
+ return buffer;
105470
+ }
105414
105471
  function client_bufferToArrayBuffer(input) {
105415
105472
  const out = new ArrayBuffer(input.length);
105416
105473
  const view = new Uint8Array(out);
@@ -105634,48 +105691,6 @@ function client_convertToJSON(_ignore_key, item) {
105634
105691
  }
105635
105692
  return item;
105636
105693
  }
105637
- function client_internalLogger(nodeAlias, level, from) {
105638
- /**
105639
- * Disable logging unless specified
105640
- */
105641
- if (client_configuredLoggingLevel === undefined) {
105642
- return;
105643
- }
105644
-
105645
- /**
105646
- * Only log matching sources
105647
- */
105648
- if (!client_configuredLoggingFilter.test(from)) {
105649
- return;
105650
- }
105651
- const configuredLoggingLevelValue = client_loggingLevels.indexOf(client_configuredLoggingLevel);
105652
- const levelValue = client_loggingLevels.indexOf(level);
105653
- /**
105654
- * Do not log anything if desired log level is higher than logged message
105655
- */
105656
- if (configuredLoggingLevelValue > levelValue) {
105657
- return;
105658
- }
105659
- if (nodeAlias === undefined) {
105660
- nodeAlias = '<unnamed node>';
105661
- }
105662
- let logger;
105663
- switch (level) {
105664
- case 'debug':
105665
- logger = console.debug;
105666
- break;
105667
- case 'error':
105668
- logger = console.error;
105669
- break;
105670
- }
105671
- if (logger === undefined) {
105672
- return;
105673
- }
105674
- for (var _len = arguments.length, message = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
105675
- message[_key - 3] = arguments[_key];
105676
- }
105677
- logger(`[${nodeAlias}/${from.toUpperCase()}]`, ...message);
105678
- }
105679
105694
  function client_objectToBuffer(input) {
105680
105695
  const stringified = JSON.stringify(input, client_convertToJSON);
105681
105696
  return src_client_Buffer.from(stringified);
@@ -114301,13 +114316,11 @@ const client_Testing = {
114301
114316
  /**
114302
114317
  * Known Networks that exist in the configuration database
114303
114318
  */
114304
- const client_networksArray = ['production', 'staging', 'beta', 'test', 'test2', 'dev'];
114319
+ const client_networksArray = ['main', 'staging', 'test', 'dev'];
114305
114320
  const client_NetworkIDs = {
114306
- 'production': BigInt('0x19294EEAD74C'),
114307
- 'staging': BigInt('0x42455441D74C'),
114308
- 'beta': BigInt('0x42455441'),
114321
+ 'main': BigInt('0x5382'),
114322
+ 'staging': BigInt('0x538201'),
114309
114323
  'test': BigInt('0x54455354'),
114310
- 'test2': BigInt('0x54455355'),
114311
114324
  'dev': BigInt('0x444556')
114312
114325
  };
114313
114326
 
@@ -114361,6 +114374,9 @@ const client_baseValidationConfig = {
114361
114374
  regex: /^[-_A-Za-z0-9+/= ]+$/,
114362
114375
  canBeEmpty: true
114363
114376
  }
114377
+ },
114378
+ idempotentKey: {
114379
+ maxByteLength: 32
114364
114380
  }
114365
114381
  };
114366
114382
  function client_getNetworkAlias(networkOrID) {
@@ -114382,11 +114398,9 @@ function client_getValidation(networkOrID) {
114382
114398
  }
114383
114399
  const networkAlias = client_getNetworkAlias(networkOrID);
114384
114400
  switch (networkAlias) {
114385
- case 'production':
114401
+ case 'main':
114386
114402
  case 'staging':
114387
- case 'beta':
114388
114403
  case 'test':
114389
- case 'test2':
114390
114404
  case 'dev':
114391
114405
  return client_baseValidationConfig;
114392
114406
  default:
@@ -114404,60 +114418,45 @@ function client_getDefaultConfig(network) {
114404
114418
  const representatives = [];
114405
114419
  let publishAidURL = `https://publish-aid.${network}.api.keeta.com/api/publish`;
114406
114420
  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'
114421
+ case 'main':
114422
+ {
114423
+ initialTrustedAccount = 'keeta_aabk62tezl4whordlviamlx3zrdgux6lk63cghay45vkzdatyemzvqqjuj5resa';
114424
+ const reps = ['keeta_aabwip6zeo2fnzfxp5hssrrqtascs2277w2zk7vqd6d3k3m4dkt2flcbca2mqki', 'keeta_aabvmwxttv4q56gbfveighwfwp3yvitlrdfsacic3ckqc7lqelsspvmhc7oldmq', 'keeta_aabwqf5fnta4t2v2atieis545b3rqoq6z7x5w3geugiilqlz5jdsb5og2rmxvdq', 'keeta_aablpogflko72eusdhuuqgsto2rwcvy2m5mo5snmvrmbacz3qczwjtwpmzf5ufq'];
114425
+ for (let index = 0; index < reps.length; index++) {
114426
+ const repID = index + 1;
114427
+ const repKey = reps[index];
114428
+ representatives.push({
114429
+ key: client_lib_account.fromPublicKeyString(repKey).assertAccount(),
114430
+ endpoints: {
114431
+ api: `https://rep${repID}.main.network.api.keeta.com/api`,
114432
+ p2p: `wss://rep${repID}.main.network.api.keeta.com/p2p`
114433
+ }
114434
+ });
114414
114435
  }
114415
- });
114436
+ }
114416
114437
  break;
114417
114438
  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
114439
  {
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'];
114440
+ initialTrustedAccount = 'keeta_aabhtbqmg7whgpvbgii6twdjlyq5vlrtwaa47nb5b2gj6an5kvjbwvvw2mdwjjy';
114441
+ const reps = ['keeta_aabaagdrwrwnkzox4u3qh6uukre6lckax6kb5fwyxd4vtpua6vrjc6nuhb75fji', 'keeta_aabgizanf4agmioyrswbg4wsl7nmjlrakwd4piuks7cqagfccnxc2fscm25hw7i', 'keeta_aab2gw2zmtazqgtromyfmhjn5h67ep23676zq62obgtqaw65x5l5krn252w57ma', 'keeta_aabue4mdj22i5o6774tlszcxy2sxyvpninbm54nfhxn6dkmsvtryd7oha4bzh2i'];
114442
114442
  for (let index = 0; index < reps.length; index++) {
114443
114443
  const repID = index + 1;
114444
114444
  const repKey = reps[index];
114445
114445
  representatives.push({
114446
114446
  key: client_lib_account.fromPublicKeyString(repKey).assertAccount(),
114447
114447
  endpoints: {
114448
- api: `https://rep${repID}.${network}.network.api.keeta.com/api`,
114449
- p2p: `wss://rep${repID}.${network}.network.api.keeta.com/p2p`
114448
+ api: `https://rep${repID}.staging.network.api.keeta.com/api`,
114449
+ p2p: `wss://rep${repID}.staging.network.api.keeta.com/p2p`
114450
114450
  }
114451
114451
  });
114452
114452
  }
114453
114453
  }
114454
114454
  break;
114455
- case 'test2':
114455
+ case 'test':
114456
114456
  {
114457
- // 17C75845AC5D1D5C82BB554D80A32EF678EE7C0C8FD508E60004435C899F411C
114458
- initialTrustedAccount = 'keeta_aabhf4ythez6zaytjuea3552sc7ydjwqqzhkigejfbiyx2qwmty2v63hxibl32i';
114457
+ initialTrustedAccount = 'keeta_aabmvemiol5wrs67e4rfiyibopwav4e77sleiqaqvbdprbuxrifn7fgg4cchhia';
114459
114458
  publishAidURL = `https://publish-aid.${network}.network.api.keeta.com/api/publish`;
114460
- const reps = ['keeta_aabczuvy3x3mpaspn57ooinuz2yh2hnz65rcrvpnbmkeqj4qu7exfiha4dauosi', 'keeta_aabavwgipwruhomnvhsdiuzs5gfkffl75iml6hce42jbygin2wnjm7mqds7v7aa', 'keeta_aabw2oh264q76rwaz6nd6hrkongwh6hauxiwtvijapctdunotkmdmm34kmcwypi', 'keeta_aab2k5gz2dxqmz3mm3jaxgjthkl3uqffnoovjrzjbzsicpeejhmp3rxe4st3uca'];
114459
+ const reps = ['keeta_aabi4bd3f7jrt67mxcq44ozj65bh4bp2mygmrkedxggu2rxwn2ztuw3b6exivbq', 'keeta_aabf7dz5asq2n2lrldct33x2ww65cophxp7egfiixbb7tbyat5r3kcbcez7ftpi', 'keeta_aab3cxegizwhtim3zlyuwjhiqd5ikkhxg42smhwc3wx6yn7ep2t6lwo6emvw4wa', 'keeta_aabznoicrzvte6ql5rxbgugmfrjqubbnjuo5l6ivopowy4rpkqgs5fco3oaezcq'];
114461
114460
  for (let index = 0; index < reps.length; index++) {
114462
114461
  const repID = index + 1;
114463
114462
  const repKey = reps[index];
@@ -115224,7 +115223,7 @@ function client_block_toPrimitive(t, r) { if ("object" != typeof t || !t) return
115224
115223
 
115225
115224
 
115226
115225
  const client_BlockErrorType = 'BLOCK';
115227
- 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'];
115226
+ 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', 'INVALID_IDEMPOTENT_FORMAT', 'INVALID_IDEMPOTENT_LENGTH'];
115228
115227
  const client_FullBlockErrorCodes = client_BlockErrorCodes.map(code => `${client_BlockErrorType}_${code}`);
115229
115228
  class src_client_KeetaNetBlockError extends src_client_KeetaNetErrorBase {
115230
115229
  constructor(code, message) {
@@ -116738,24 +116737,28 @@ client_utils_certificate_defineProperty(src_client_Certificate, "Hash", src_clie
116738
116737
  */
116739
116738
  client_utils_certificate_defineProperty(src_client_Certificate, "certificateObjectTypeID", '8d05dca5-5f42-4dc9-8bf9-f534c6570994:CERTIFICATE');
116740
116739
  ;// ./src/lib/error/ledger.ts
116741
- var client_KeetaNetLedgerError, client_KeetaNetLedgerVoteError;
116740
+ /* provided dependency */ var client_ledger_Buffer = __webpack_require__(8287)["Buffer"];
116741
+ var client_KeetaNetLedgerError, client_KeetaNetLedgerVoteError, client_KeetaNetLedgerIdempotentKeyError;
116742
116742
  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; }
116743
116743
  function client_ledger_toPropertyKey(t) { var i = client_ledger_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
116744
116744
  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); }
116745
116745
 
116746
116746
 
116747
116747
  const client_LedgerErrorType = 'LEDGER';
116748
- const client_LedgerBaseErrorCodes = ['BLOCK_ALREADY_EXISTS', 'TRANSACTION_ABORTED', 'INVALID_CHAIN', 'INVALID_NETWORK', 'INVALID_SUBNET', 'INVALID_PERMISSIONS', 'INVALID_OWNER_COUNT', 'INVALID_BALANCE', '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',
116748
+ 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',
116749
116749
  // Fee Errors
116750
116750
  'FEE_AMOUNT_MISMATCH', 'FEE_TOKEN_MISMATCH', 'FEE_MISSING', 'MISSING_REQUIRED_FEE_BLOCK', 'PERM_VOTE_WITH_QUOTE', 'QUOTE_MISMATCH', 'REQUIRED_FEE_MISMATCH'];
116751
116751
 
116752
116752
  // Errors that can trigger rep sync
116753
116753
  const client_LedgerVoteErrorCodes = ['NOT_SUCCESSOR', 'NOT_OPENING'];
116754
- const client_FullLedgerErrorCodes = [...client_LedgerBaseErrorCodes, ...client_LedgerVoteErrorCodes].map(code => `${client_LedgerErrorType}_${code}`);
116754
+ const client_LedgerIdempotentKeyErrorCodes = ['IDEMPOTENT_KEY_EXISTS'];
116755
+ const client_FullLedgerErrorCodes = [...client_LedgerBaseErrorCodes, ...client_LedgerVoteErrorCodes, ...client_LedgerIdempotentKeyErrorCodes].map(code => `${client_LedgerErrorType}_${code}`);
116755
116756
  const client_FullLedgerBaseErrorCode = client_LedgerBaseErrorCodes.map(code => `${client_LedgerErrorType}_${code}`);
116756
116757
  const client_FullLedgerVoteErrorCodes = client_LedgerVoteErrorCodes.map(code => `${client_LedgerErrorType}_${code}`);
116758
+ const client_FullLedgerIdempotentKeyErrorCodes = client_LedgerIdempotentKeyErrorCodes.map(code => `${client_LedgerErrorType}_${code}`);
116757
116759
  const client_ledgerBaseErrorCodeSet = new Set(client_FullLedgerBaseErrorCode);
116758
116760
  const client_ledgerVoteErrorCodeSet = new Set(client_FullLedgerVoteErrorCodes);
116761
+ const client_ledgerIdempotentKeyErrorCodeSet = new Set(client_FullLedgerIdempotentKeyErrorCodes);
116759
116762
  class client_ledger_KeetaNetLedgerError extends src_client_KeetaNetErrorBase {
116760
116763
  static assertValidLedgerErrorCode(code) {
116761
116764
  return client_ledgerBaseErrorCodeSet.has(code);
@@ -116800,6 +116803,58 @@ class src_client_KeetaNetLedgerVoteError extends src_client_KeetaNetErrorBase {
116800
116803
  }
116801
116804
  client_KeetaNetLedgerVoteError = src_client_KeetaNetLedgerVoteError;
116802
116805
  client_ledger_defineProperty(src_client_KeetaNetLedgerVoteError, "isInstance", client_checkableGenerator(client_KeetaNetLedgerVoteError));
116806
+ class src_client_KeetaNetLedgerIdempotentKeyError extends src_client_KeetaNetErrorBase {
116807
+ static assertValidLedgerErrorCode(code) {
116808
+ return client_ledgerIdempotentKeyErrorCodeSet.has(code);
116809
+ }
116810
+ constructor(code, blockhash, existingBlockhash, account, idempotentKey) {
116811
+ let messageIdempotentKey = '<unknown>';
116812
+ if (idempotentKey) {
116813
+ messageIdempotentKey = client_ledger_Buffer.from(idempotentKey).toString('base64');
116814
+ }
116815
+ let messageAccount = '<unknown>';
116816
+ if (account) {
116817
+ messageAccount = account.publicKeyString.get();
116818
+ }
116819
+ const message = `Idempotent key (${messageIdempotentKey}) for account (${messageAccount}) already exists for blockhash ${existingBlockhash.toString()}`;
116820
+ super(code, message, {
116821
+ type: client_LedgerErrorType,
116822
+ codes: client_LedgerIdempotentKeyErrorCodes
116823
+ });
116824
+ client_ledger_defineProperty(this, "type", client_LedgerErrorType);
116825
+ client_ledger_defineProperty(this, "shouldRetry", false);
116826
+ this.blockhash = blockhash;
116827
+ this.existingBlockhash = existingBlockhash;
116828
+ if (account) {
116829
+ this.account = account;
116830
+ }
116831
+ if (idempotentKey) {
116832
+ if (client_ledger_Buffer.isBuffer(idempotentKey)) {
116833
+ this.idempotentKey = client_bufferToArrayBuffer(idempotentKey);
116834
+ } else {
116835
+ this.idempotentKey = idempotentKey;
116836
+ }
116837
+ }
116838
+ }
116839
+ toJSON() {
116840
+ const jsonOptional = {};
116841
+ if (this.account) {
116842
+ jsonOptional.account = this.account.publicKeyString.get();
116843
+ }
116844
+ if (this.idempotentKey) {
116845
+ jsonOptional.idempotentKey = client_ledger_Buffer.from(this.idempotentKey).toString('base64');
116846
+ }
116847
+ const json = {
116848
+ ...super.toJSON(),
116849
+ ...jsonOptional,
116850
+ blockhash: this.blockhash.toString(),
116851
+ existingBlockhash: this.existingBlockhash.toString()
116852
+ };
116853
+ return json;
116854
+ }
116855
+ }
116856
+ client_KeetaNetLedgerIdempotentKeyError = src_client_KeetaNetLedgerIdempotentKeyError;
116857
+ client_ledger_defineProperty(src_client_KeetaNetLedgerIdempotentKeyError, "isInstance", client_checkableGenerator(client_KeetaNetLedgerIdempotentKeyError));
116803
116858
  ;// ./src/lib/ledger/common.ts
116804
116859
  function client_common_classPrivateMethodInitSpec(e, a) { client_common_checkPrivateRedeclaration(e, a), a.add(e); }
116805
116860
  function client_common_checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
@@ -117518,11 +117573,11 @@ class client_LedgerStorageBase {
117518
117573
  }
117519
117574
  }
117520
117575
  function client_log() {
117521
- if (this.config !== null) {
117522
- if (this.config.log !== undefined) {
117523
- this.config.log(...arguments);
117524
- }
117576
+ var _this$config;
117577
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
117578
+ args[_key] = arguments[_key];
117525
117579
  }
117580
+ (_this$config = this.config) === null || _this$config === void 0 || (_this$config = _this$config.log) === null || _this$config === void 0 || _this$config.debug('ledger', ...args);
117526
117581
  }
117527
117582
  function client_assertLedgerStorage(value) {
117528
117583
  if (value === 'main' || value === 'side') {
@@ -118923,6 +118978,7 @@ function client_lib_block_toPrimitive(t, r) { if ("object" != typeof t || !t) re
118923
118978
 
118924
118979
 
118925
118980
 
118981
+
118926
118982
  const client_NO_PREVIOUS = '9bd05fa2-8e59-42a2-8153-26d8e8c10143:NO_PREVIOUS';
118927
118983
  let client_BlockPurpose = /*#__PURE__*/function (BlockPurpose) {
118928
118984
  BlockPurpose[BlockPurpose["GENERIC"] = 0] = "GENERIC";
@@ -119009,6 +119065,9 @@ client_lib_block_defineProperty(client_block_BlockHash, "Set", client_setGenerat
119009
119065
  /**
119010
119066
  * Subnet ID
119011
119067
  */
119068
+ /**
119069
+ * Idempotent Key
119070
+ */
119012
119071
  /**
119013
119072
  * Block signature
119014
119073
  */
@@ -119027,6 +119086,8 @@ client_lib_block_defineProperty(client_block_BlockHash, "Set", client_setGenerat
119027
119086
  /** @internal */
119028
119087
  const client_BlockV1ASN1Schema = [0n, client_BufferStorageASN1.Validate.IsInteger, {
119029
119088
  choice: [client_BufferStorageASN1.Validate.IsInteger, client_BufferStorageASN1.Validate.IsNull]
119089
+ }, {
119090
+ optional: client_BufferStorageASN1.Validate.IsOctetString
119030
119091
  }, {
119031
119092
  type: 'date',
119032
119093
  kind: 'general'
@@ -119113,6 +119174,8 @@ const client_BlockV2ASN1Schema = {
119113
119174
  value: 1,
119114
119175
  contains: [client_BufferStorageASN1.Validate.IsInteger, {
119115
119176
  optional: client_BufferStorageASN1.Validate.IsInteger
119177
+ }, {
119178
+ optional: client_BufferStorageASN1.Validate.IsOctetString
119116
119179
  }, {
119117
119180
  type: 'date',
119118
119181
  kind: 'general'
@@ -119181,6 +119244,28 @@ function client_ignore_static_checks() {
119181
119244
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
119182
119245
  const _ignore_check_blockasn1v2_reverse_2 = _ignore_check_blockasn1v2_reverse_1;
119183
119246
  }
119247
+ function client_parseBlockIdempotent(input, network) {
119248
+ let output;
119249
+ if (client_block_Buffer.isBuffer(input)) {
119250
+ output = input;
119251
+ } else {
119252
+ try {
119253
+ output = client_validateBase64ToBuffer(input);
119254
+ } catch (base64Error) {
119255
+ throw new src_client_KeetaNetBlockError('BLOCK_INVALID_IDEMPOTENT_FORMAT', 'Could not parse base64 Block idempotent');
119256
+ }
119257
+ }
119258
+ if (output === undefined) {
119259
+ throw new src_client_KeetaNetBlockError('BLOCK_INVALID_IDEMPOTENT_FORMAT', 'Could not parse Block idempotent');
119260
+ }
119261
+ if (network !== undefined) {
119262
+ const idempotentValidationConfig = client_getValidation(network).idempotentKey;
119263
+ if (output.length > idempotentValidationConfig.maxByteLength) {
119264
+ throw new src_client_KeetaNetBlockError('BLOCK_INVALID_IDEMPOTENT_LENGTH', `Block idempotent key is length ${output.length}, but maxByteLength is ${idempotentValidationConfig.maxByteLength}`);
119265
+ }
119266
+ }
119267
+ return output;
119268
+ }
119184
119269
  function client_MapV1InputValues(input) {
119185
119270
  var _Account$toAccount, _output$account;
119186
119271
  const output = {};
@@ -119188,6 +119273,28 @@ function client_MapV1InputValues(input) {
119188
119273
  throw new Error('MapInputValues should not be called with version != 1');
119189
119274
  }
119190
119275
  output.version = input.version;
119276
+
119277
+ /*
119278
+ * Import network
119279
+ */
119280
+ if (input.network !== undefined) {
119281
+ if (typeof input.network === 'bigint') {
119282
+ output.network = input.network;
119283
+ } else {
119284
+ output.network = BigInt(input.network);
119285
+ }
119286
+ }
119287
+
119288
+ /*
119289
+ * Import idempotent key
119290
+ */
119291
+ if (input.idempotent !== undefined) {
119292
+ output.idempotent = client_parseBlockIdempotent(input.idempotent, output.network);
119293
+ }
119294
+
119295
+ /*
119296
+ * Import date
119297
+ */
119191
119298
  if (input.date !== undefined) {
119192
119299
  output.date = new Date(input.date);
119193
119300
  }
@@ -119219,17 +119326,6 @@ function client_MapV1InputValues(input) {
119219
119326
  }
119220
119327
  }
119221
119328
 
119222
- /*
119223
- * Import network
119224
- */
119225
- if (input.network !== undefined) {
119226
- if (typeof input.network === 'bigint') {
119227
- output.network = input.network;
119228
- } else {
119229
- output.network = BigInt(input.network);
119230
- }
119231
- }
119232
-
119233
119329
  /*
119234
119330
  * Import Subnet
119235
119331
  */
@@ -119260,6 +119356,24 @@ function client_MapV2InputValues(input) {
119260
119356
  }
119261
119357
  output.version = input.version;
119262
119358
  output.purpose = input.purpose;
119359
+
119360
+ /*
119361
+ * Import network
119362
+ */
119363
+ if (input.network !== undefined) {
119364
+ output.network = BigInt(input.network);
119365
+ }
119366
+
119367
+ /*
119368
+ * Import idempotent key
119369
+ */
119370
+ if (input.idempotent !== undefined) {
119371
+ output.idempotent = client_parseBlockIdempotent(input.idempotent, output.network);
119372
+ }
119373
+
119374
+ /*
119375
+ * Import date
119376
+ */
119263
119377
  if (input.date !== undefined) {
119264
119378
  output.date = new Date(input.date);
119265
119379
  }
@@ -119284,13 +119398,6 @@ function client_MapV2InputValues(input) {
119284
119398
  }
119285
119399
  }
119286
119400
 
119287
- /*
119288
- * Import network
119289
- */
119290
- if (input.network !== undefined) {
119291
- output.network = BigInt(input.network);
119292
- }
119293
-
119294
119401
  /*
119295
119402
  * Import Subnet
119296
119403
  */
@@ -119408,7 +119515,7 @@ class src_client_Block {
119408
119515
  if (client_util.types.isArrayBuffer(input)) {
119409
119516
  const data = new client_BufferStorageASN1(input, client_BlockASN1Schema).getASN1();
119410
119517
  if (Array.isArray(data)) {
119411
- var _data$;
119518
+ var _data$, _data$2;
119412
119519
  if (data[0] !== 0n) {
119413
119520
  throw new Error('Invalid block version without context tag');
119414
119521
  }
@@ -119416,10 +119523,11 @@ class src_client_Block {
119416
119523
  this.purpose = client_BlockPurpose.GENERIC;
119417
119524
  this.network = data[1];
119418
119525
  this.subnet = (_data$ = data[2]) !== null && _data$ !== void 0 ? _data$ : undefined;
119419
- this.date = data[3].date;
119420
- const signerContainer = data[4];
119526
+ this.idempotent = (_data$2 = data[3]) !== null && _data$2 !== void 0 ? _data$2 : undefined;
119527
+ this.date = data[4].date;
119528
+ const signerContainer = data[5];
119421
119529
  this.signer = client_lib_account.fromPublicKeyAndType(signerContainer).assertAccount();
119422
- const acctItem = data[5];
119530
+ const acctItem = data[6];
119423
119531
  if (acctItem === null) {
119424
119532
  this.account = this.signer;
119425
119533
  } else {
@@ -119428,20 +119536,21 @@ class src_client_Block {
119428
119536
  throw new Error('Account should not be in block when it is same as signer, we cannot use this block');
119429
119537
  }
119430
119538
  }
119431
- const prevHashBuf = data[6];
119539
+ const prevHashBuf = data[7];
119432
119540
  this.previous = new client_block_BlockHash(prevHashBuf);
119433
- this.operations = client_ImportOperationsASN1(data[7], this.network);
119434
- this.signatures = [data[8]];
119541
+ this.operations = client_ImportOperationsASN1(data[8], this.network);
119542
+ this.signatures = [data[9]];
119435
119543
  } else if (data.value === 1) {
119436
- var _container$;
119544
+ var _container$, _container$2;
119437
119545
  this.version = 2;
119438
119546
  const container = data.contains;
119439
119547
  this.network = container[0];
119440
119548
  this.subnet = (_container$ = container[1]) !== null && _container$ !== void 0 ? _container$ : undefined;
119441
- this.date = container[2].date;
119442
- this.purpose = client_toBlockPurpose(container[3]);
119443
- this.account = client_lib_account.fromPublicKeyAndType(container[4]);
119444
- const signersContainer = container[5];
119549
+ this.idempotent = (_container$2 = container[2]) !== null && _container$2 !== void 0 ? _container$2 : undefined;
119550
+ this.date = container[3].date;
119551
+ this.purpose = client_toBlockPurpose(container[4]);
119552
+ this.account = client_lib_account.fromPublicKeyAndType(container[5]);
119553
+ const signersContainer = container[6];
119445
119554
  if (signersContainer === null) {
119446
119555
  this.signer = this.account.assertAccount();
119447
119556
  } else if (client_block_Buffer.isBuffer(signersContainer)) {
@@ -119452,9 +119561,9 @@ class src_client_Block {
119452
119561
  } else {
119453
119562
  this.signer = client_parseBlockSignerFieldContainer(signersContainer).parsed;
119454
119563
  }
119455
- this.previous = new client_block_BlockHash(container[6]);
119456
- this.operations = client_ImportOperationsASN1(container[7], this.network);
119457
- const signatureContainer = container[8];
119564
+ this.previous = new client_block_BlockHash(container[7]);
119565
+ this.operations = client_ImportOperationsASN1(container[8], this.network);
119566
+ const signatureContainer = container[9];
119458
119567
  if (client_block_Buffer.isBuffer(signatureContainer)) {
119459
119568
  this.signatures = [signatureContainer];
119460
119569
  } else {
@@ -119472,6 +119581,7 @@ class src_client_Block {
119472
119581
  if (src_client_Block.isInstance(input)) {
119473
119582
  this.version = input.version;
119474
119583
  this.purpose = input.purpose;
119584
+ this.idempotent = input.idempotent;
119475
119585
  this.date = input.date;
119476
119586
  this.previous = input.previous;
119477
119587
  this.network = input.network;
@@ -119486,6 +119596,7 @@ class src_client_Block {
119486
119596
  */
119487
119597
  const {
119488
119598
  version,
119599
+ idempotent,
119489
119600
  date,
119490
119601
  previous,
119491
119602
  network,
@@ -119496,6 +119607,7 @@ class src_client_Block {
119496
119607
  } = client_MapV1InputValues(input);
119497
119608
  this.version = version;
119498
119609
  this.purpose = client_BlockPurpose.GENERIC;
119610
+ this.idempotent = idempotent;
119499
119611
  this.date = date;
119500
119612
  this.previous = previous;
119501
119613
  this.network = network;
@@ -119525,6 +119637,7 @@ class src_client_Block {
119525
119637
  */
119526
119638
  const {
119527
119639
  version,
119640
+ idempotent,
119528
119641
  date,
119529
119642
  previous,
119530
119643
  network,
@@ -119536,6 +119649,7 @@ class src_client_Block {
119536
119649
  } = client_MapV2InputValues(input);
119537
119650
  this.version = version;
119538
119651
  this.purpose = purpose;
119652
+ this.idempotent = idempotent;
119539
119653
  this.date = date;
119540
119654
  this.previous = previous;
119541
119655
  this.network = network;
@@ -119607,7 +119721,8 @@ class src_client_Block {
119607
119721
  account: this.account,
119608
119722
  network: this.network,
119609
119723
  subnet: this.subnet,
119610
- date: this.date
119724
+ date: this.date,
119725
+ idempotent: this.idempotent
119611
119726
  };
119612
119727
  let container;
119613
119728
  if (this.version === 1) {
@@ -119679,7 +119794,7 @@ class src_client_Block {
119679
119794
  if (input.version !== 1) {
119680
119795
  throw new Error('Cannot call getASN1ContainerWithoutSignature when version != 1');
119681
119796
  }
119682
- return [0n, input.network, (_input$subnet = input.subnet) !== null && _input$subnet !== void 0 ? _input$subnet : null, {
119797
+ return [0n, input.network, (_input$subnet = input.subnet) !== null && _input$subnet !== void 0 ? _input$subnet : null, input.idempotent, {
119683
119798
  type: 'date',
119684
119799
  kind: 'general',
119685
119800
  date: input.date
@@ -119697,7 +119812,7 @@ class src_client_Block {
119697
119812
  } else {
119698
119813
  signerContainer = input.signer.publicKeyAndType;
119699
119814
  }
119700
- return [input.network, input.subnet, {
119815
+ return [input.network, input.subnet, input.idempotent, {
119701
119816
  type: 'date',
119702
119817
  kind: 'general',
119703
119818
  date: input.date
@@ -119718,6 +119833,7 @@ class src_client_Block {
119718
119833
  }
119719
119834
  }
119720
119835
  toJSON(options) {
119836
+ var _this$idempotent;
119721
119837
  const additionalFields = {};
119722
119838
  if (options !== null && options !== void 0 && options.addBinary) {
119723
119839
  additionalFields['$binary'] = client_block_Buffer.from(this.toBytes()).toString('base64');
@@ -119732,6 +119848,7 @@ class src_client_Block {
119732
119848
  }
119733
119849
  return {
119734
119850
  version: this.version,
119851
+ idempotent: (_this$idempotent = this.idempotent) === null || _this$idempotent === void 0 ? void 0 : _this$idempotent.toString('base64'),
119735
119852
  date: this.date,
119736
119853
  previous: this.previous,
119737
119854
  account: this.account,
@@ -119934,6 +120051,7 @@ class src_client_BlockBuilder {
119934
120051
  }
119935
120052
  return {
119936
120053
  version: this.version,
120054
+ idempotent: this.idempotent,
119937
120055
  date: this.date,
119938
120056
  previous: this.previous,
119939
120057
  account: this.account,
@@ -119967,6 +120085,7 @@ class src_client_BlockBuilder {
119967
120085
  if (src_client_Block.isInstance(client_block_classPrivateFieldGet(client_block, this))) {
119968
120086
  client_block_classPrivateFieldSet(client_block, this, {
119969
120087
  version: client_block_classPrivateFieldGet(client_block, this).version,
120088
+ idempotent: client_block_classPrivateFieldGet(client_block, this).idempotent,
119970
120089
  date: client_block_classPrivateFieldGet(client_block, this).date,
119971
120090
  previous: client_block_classPrivateFieldGet(client_block, this).previous,
119972
120091
  account: client_block_classPrivateFieldGet(client_block, this).account,
@@ -120059,7 +120178,7 @@ class src_client_BlockBuilder {
120059
120178
  get previous() {
120060
120179
  const block = this.currentBlock;
120061
120180
  if (block === undefined) {
120062
- return;
120181
+ return undefined;
120063
120182
  }
120064
120183
  const previous = block.previous;
120065
120184
  if (previous === undefined) {
@@ -120095,6 +120214,26 @@ class src_client_BlockBuilder {
120095
120214
  const sentinel = src_client_Block.getAccountOpeningHash(account);
120096
120215
  return sentinel.compareHexString(previous);
120097
120216
  }
120217
+ set idempotent(idempotent) {
120218
+ if (typeof idempotent === 'string') {
120219
+ try {
120220
+ this.currentWIP.idempotent = client_validateBase64ToBuffer(idempotent);
120221
+ } catch (decodeError) {
120222
+ throw new src_client_KeetaNetBlockError('BLOCK_INVALID_IDEMPOTENT_FORMAT', 'Could not parse Block idempotent');
120223
+ }
120224
+ } else {
120225
+ this.currentWIP.idempotent = client_block_Buffer.from(idempotent);
120226
+ }
120227
+ }
120228
+ get idempotent() {
120229
+ if (this.currentBlock.idempotent === undefined) {
120230
+ return undefined;
120231
+ }
120232
+ if (client_block_Buffer.isBuffer(this.currentBlock.idempotent)) {
120233
+ return this.currentBlock.idempotent.toString('base64');
120234
+ }
120235
+ return this.currentBlock.idempotent;
120236
+ }
120098
120237
  set date(date) {
120099
120238
  if (date === undefined) {
120100
120239
  this.currentWIP.date = undefined;
@@ -120106,7 +120245,7 @@ class src_client_BlockBuilder {
120106
120245
  }
120107
120246
  get date() {
120108
120247
  if (this.currentBlock.date === undefined) {
120109
- return;
120248
+ return undefined;
120110
120249
  }
120111
120250
  return new Date(this.currentBlock.date);
120112
120251
  }
@@ -124420,6 +124559,7 @@ function client_computeEffectOfOperationCREATE_IDENTIFIER(state, block, operatio
124420
124559
  multisigQuorum: operation.createArguments.quorum
124421
124560
  });
124422
124561
  for (const multisigSigner of operation.createArguments.signers) {
124562
+ state.possibleNewAccounts.add(multisigSigner);
124423
124563
  client_addPermission(state, {
124424
124564
  principal: multisigSigner,
124425
124565
  entity: operation.identifier,
@@ -125532,17 +125672,20 @@ function client_getDurationRange(duration) {
125532
125672
  }
125533
125673
  /* harmony default export */ const client_stats = (client_Stats);
125534
125674
  ;// ./src/lib/ledger/index.ts
125535
- var client_Ledger;
125675
+ /* provided dependency */ var client_lib_ledger_Buffer = __webpack_require__(8287)["Buffer"];
125676
+ var client_IdempotentKey, client_Ledger;
125536
125677
  function client_usingCtx2() { var r = "function" == typeof SuppressedError ? SuppressedError : function (r, e) { var n = Error(); return n.name = "SuppressedError", n.error = r, n.suppressed = e, n; }, e = {}, n = []; function using(r, e) { if (null != e) { if (Object(e) !== e) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined."); if (r) var o = e[Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose")]; if (void 0 === o && (o = e[Symbol.dispose || Symbol.for("Symbol.dispose")], r)) var t = o; if ("function" != typeof o) throw new TypeError("Object is not disposable."); t && (o = function () { try { t.call(e); } catch (r) { return Promise.reject(r); } }), n.push({ v: e, d: o, a: r }); } else r && n.push({ d: e, a: r }); return e; } return { e: e, u: using.bind(null, !1), a: using.bind(null, !0), d: function () { var o, t = this.e, s = 0; function next() { for (; o = n.pop();) try { if (!o.a && 1 === s) return s = 0, n.push(o), Promise.resolve().then(next); if (o.d) { var r = o.d.call(o.v); if (o.a) return s |= 2, Promise.resolve(r).then(next, err); } else s |= 1; } catch (r) { return err(r); } if (1 === s) return t !== e ? Promise.reject(t) : Promise.resolve(); if (t !== e) throw t; } function err(n) { return t = t !== e ? new r(n, t) : n, next(); } return next(); } }; }
125537
- function client_lib_ledger_defineProperty(e, r, t) { return (r = client_lib_ledger_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
125538
- function client_lib_ledger_toPropertyKey(t) { var i = client_lib_ledger_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
125539
- function client_lib_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); }
125540
125678
  function client_ledger_classPrivateMethodInitSpec(e, a) { client_ledger_checkPrivateRedeclaration(e, a), a.add(e); }
125541
125679
  function client_ledger_classPrivateFieldInitSpec(e, t, a) { client_ledger_checkPrivateRedeclaration(e, t), t.set(e, a); }
125542
125680
  function client_ledger_checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
125543
125681
  function client_ledger_classPrivateFieldGet(s, a) { return s.get(client_ledger_assertClassBrand(s, a)); }
125544
125682
  function client_ledger_classPrivateFieldSet(s, a, r) { return s.set(client_ledger_assertClassBrand(s, a), r), r; }
125545
125683
  function client_ledger_assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
125684
+ function client_lib_ledger_defineProperty(e, r, t) { return (r = client_lib_ledger_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
125685
+ function client_lib_ledger_toPropertyKey(t) { var i = client_lib_ledger_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
125686
+ function client_lib_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); }
125687
+
125688
+
125546
125689
 
125547
125690
 
125548
125691
 
@@ -125587,9 +125730,43 @@ let client_LedgerKind = /*#__PURE__*/function (LedgerKind) {
125587
125730
  */
125588
125731
 
125589
125732
  /**
125590
- * Each transaction can contain the node object making the request to access things like timing information
125733
+ * Idempotent Key
125591
125734
  */
125735
+ class src_client_IdempotentKey extends src_client_BufferStorage {
125736
+ static fromAccountAndIdempotent(account, idempotent) {
125737
+ let idempotentBuffer;
125738
+ if (typeof idempotent === 'string') {
125739
+ idempotentBuffer = client_lib_ledger_Buffer.from(idempotent, 'base64');
125740
+ } else {
125741
+ idempotentBuffer = idempotent;
125742
+ }
125743
+ const data = client_lib_ledger_Buffer.concat([account.publicKeyAndType, idempotentBuffer]);
125744
+ return new src_client_IdempotentKey(client_hash_Hash(data), account, idempotentBuffer);
125745
+ }
125746
+ constructor(idempotentKey, account, idempotent) {
125747
+ super(idempotentKey, 32);
125748
+ this.account = account;
125749
+ this.userIdempotent = idempotent;
125750
+ }
125751
+ toJSON() {
125752
+ return this.toString();
125753
+ }
125754
+ toString() {
125755
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
125756
+ return super.toString('hex');
125757
+ }
125758
+ }
125592
125759
 
125760
+ /**
125761
+ * Each transaction can contain the node object making the request to access things like timing information
125762
+ */
125763
+ client_IdempotentKey = src_client_IdempotentKey;
125764
+ client_lib_ledger_defineProperty(src_client_IdempotentKey, "isInstance", client_checkableGenerator(client_IdempotentKey));
125765
+ client_lib_ledger_defineProperty(src_client_IdempotentKey, "Set", client_setGenerator(client_IdempotentKey, function (value) {
125766
+ return value.toString();
125767
+ }, function (value) {
125768
+ return new client_IdempotentKey(client_lib_ledger_Buffer.from(value, 'hex'));
125769
+ }));
125593
125770
  class client_LedgerStorageTransactionBase {
125594
125771
  constructor(options) {
125595
125772
  var _options$moment, _options$readOnly;
@@ -125612,6 +125789,7 @@ var client_computeFeeFromBlocks = /*#__PURE__*/new WeakMap();
125612
125789
  var client_ledger_storage = /*#__PURE__*/new WeakMap();
125613
125790
  var client_ledger = /*#__PURE__*/new WeakMap();
125614
125791
  var src_client_cache = /*#__PURE__*/new WeakMap();
125792
+ var client_operations = /*#__PURE__*/new WeakMap();
125615
125793
  var client_transaction = /*#__PURE__*/new WeakMap();
125616
125794
  var client_LedgerAtomicInterface_brand = /*#__PURE__*/new WeakSet();
125617
125795
  /**
@@ -125619,6 +125797,7 @@ var client_LedgerAtomicInterface_brand = /*#__PURE__*/new WeakSet();
125619
125797
  */
125620
125798
  class client_LedgerAtomicInterface {
125621
125799
  constructor(_transaction2, storage, config, ledger) {
125800
+ var _config$operations;
125622
125801
  client_ledger_classPrivateMethodInitSpec(this, client_LedgerAtomicInterface_brand);
125623
125802
  client_ledger_classPrivateFieldInitSpec(this, client_network, void 0);
125624
125803
  client_ledger_classPrivateFieldInitSpec(this, client_subnet, void 0);
@@ -125628,12 +125807,16 @@ class client_LedgerAtomicInterface {
125628
125807
  client_ledger_classPrivateFieldInitSpec(this, client_ledger_storage, void 0);
125629
125808
  client_ledger_classPrivateFieldInitSpec(this, client_ledger, void 0);
125630
125809
  client_ledger_classPrivateFieldInitSpec(this, src_client_cache, void 0);
125810
+ client_ledger_classPrivateFieldInitSpec(this, client_operations, void 0);
125631
125811
  client_ledger_classPrivateFieldInitSpec(this, client_transaction, void 0);
125632
125812
  client_ledger_classPrivateFieldSet(client_network, this, config.network);
125633
125813
  client_ledger_classPrivateFieldSet(client_subnet, this, config.subnet);
125634
125814
  client_ledger_classPrivateFieldSet(client_kind, this, config.kind);
125635
125815
  client_ledger_classPrivateFieldSet(client_ledger_privateKey, this, config.privateKey);
125636
125816
  client_ledger_classPrivateFieldSet(client_computeFeeFromBlocks, this, config.computeFeeFromBlocks);
125817
+ client_ledger_classPrivateFieldSet(client_operations, this, (_config$operations = config.operations) !== null && _config$operations !== void 0 ? _config$operations : {
125818
+ enableTokenAdminModifyBalance: false
125819
+ });
125637
125820
  client_ledger_classPrivateFieldSet(client_ledger, this, ledger);
125638
125821
  client_ledger_classPrivateFieldSet(client_ledger_storage, this, storage);
125639
125822
  client_ledger_classPrivateFieldSet(client_transaction, this, _transaction2);
@@ -125773,7 +125956,16 @@ class client_LedgerAtomicInterface {
125773
125956
  throw new client_ledger_KeetaNetLedgerError('LEDGER_NO_PERM_WITHOUT_SELF_TEMP', 'Asked to give a permanent vote without a temporary vote from us');
125774
125957
  }
125775
125958
  }
125776
- const allLedgerHeads = await client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_validateBlocksForVote).call(this, blocks);
125959
+ const {
125960
+ allLedgerHeads,
125961
+ allLedgerIdempotentKeys
125962
+ } = await client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_validateBlocksForVote).call(this, blocks);
125963
+ for (const [blockHash, key] of allLedgerIdempotentKeys) {
125964
+ const foundBlockHash = await client_ledger_classPrivateFieldGet(client_ledger_storage, this).getIdempotentBlockHash(transaction, key, 'both', blockHash);
125965
+ if (foundBlockHash !== null) {
125966
+ throw new src_client_KeetaNetLedgerIdempotentKeyError('LEDGER_IDEMPOTENT_KEY_EXISTS', blockHash, foundBlockHash, key.account, key.userIdempotent);
125967
+ }
125968
+ }
125777
125969
  const needToGetHeadFor = new client_lib_account.Set(allLedgerHeads.keys());
125778
125970
  const allHeads = await client_ledger_classPrivateFieldGet(client_ledger_storage, this).getHeadBlockHashes(transaction, needToGetHeadFor);
125779
125971
  for (const [account, expectedBlock] of allLedgerHeads.entries()) {
@@ -126228,6 +126420,24 @@ class client_LedgerAtomicInterface {
126228
126420
  const effects = effectsInput !== null && effectsInput !== void 0 ? effectsInput : client_computeEffectOfBlocks(blocks, client_ledger_classPrivateFieldGet(client_ledger, this));
126229
126421
  return client_ledger_classPrivateFieldGet(client_computeFeeFromBlocks, this).call(this, client_ledger_classPrivateFieldGet(client_ledger, this), blocks, effects);
126230
126422
  }
126423
+ async getIdempotentBlockHash(account, idempotent) {
126424
+ let from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'both';
126425
+ let excludeBlockHash = arguments.length > 3 ? arguments[3] : undefined;
126426
+ const transaction = client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_assertTransaction).call(this);
126427
+ const idempotentKey = src_client_IdempotentKey.fromAccountAndIdempotent(account, idempotent);
126428
+ const blockHash = await client_ledger_classPrivateFieldGet(client_ledger_storage, this).getIdempotentBlockHash(transaction, idempotentKey, from, excludeBlockHash);
126429
+ return blockHash;
126430
+ }
126431
+ async getBlockFromIdempotent(account, idempotent) {
126432
+ let from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'both';
126433
+ let excludeBlockHash = arguments.length > 3 ? arguments[3] : undefined;
126434
+ const blockHash = await this.getIdempotentBlockHash(account, idempotent, from, excludeBlockHash);
126435
+ if (blockHash === null) {
126436
+ return null;
126437
+ }
126438
+ const block = await this.getBlock(blockHash, from);
126439
+ return block;
126440
+ }
126231
126441
  async _testingRunStorageFunction(code) {
126232
126442
  const transaction = client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_assertTransaction).call(this);
126233
126443
  const retval = await code(client_ledger_classPrivateFieldGet(client_ledger_storage, this), transaction);
@@ -126380,6 +126590,32 @@ async function client_checkPermissionRequirements(effects) {
126380
126590
  newOwners
126381
126591
  };
126382
126592
  }
126593
+ async function client_validateBlockOperations(blocks) {
126594
+ if (client_ledger_classPrivateFieldGet(client_operations, this) === undefined) {
126595
+ return;
126596
+ }
126597
+ for (const block of blocks) {
126598
+ for (const operation of block.operations) {
126599
+ switch (operation.type) {
126600
+ case src_client_Block.OperationType.SET_REP:
126601
+ if (client_ledger_classPrivateFieldGet(client_operations, this).setRep !== undefined) {
126602
+ const validRep = await client_ledger_classPrivateFieldGet(client_operations, this).setRep(block.account, operation.to);
126603
+ if (!validRep) {
126604
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_INVALID_SET_REP', `${operation.to.publicKeyString.get()} is not a valid representative`);
126605
+ }
126606
+ }
126607
+ break;
126608
+ case src_client_Block.OperationType.TOKEN_ADMIN_MODIFY_BALANCE:
126609
+ if (!client_ledger_classPrivateFieldGet(client_operations, this).enableTokenAdminModifyBalance) {
126610
+ throw new client_ledger_KeetaNetLedgerError('LEDGER_OPERATION_NOT_SUPPORTED', 'TOKEN_ADMIN_MODIFY_BALANCE operation not supported');
126611
+ }
126612
+ break;
126613
+ default:
126614
+ break;
126615
+ }
126616
+ }
126617
+ }
126618
+ }
126383
126619
  /**
126384
126620
  * Ensure all parts of a transaction do not have a negative outcome
126385
126621
  * Balance/Supply cannot fall negative at any point in transaction
@@ -126388,6 +126624,7 @@ async function client_checkPermissionRequirements(effects) {
126388
126624
  */
126389
126625
  async function client_validateLedgerOutcome(blocks) {
126390
126626
  const transaction = client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_assertTransaction).call(this);
126627
+ await client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_validateBlockOperations).call(this, blocks);
126391
126628
  const ownersByIdentifier = {};
126392
126629
 
126393
126630
  // 'ADD' or 'REMOVE' an owner from ownersByIdentifier
@@ -126524,6 +126761,8 @@ async function client_validateBlocksForVote(blocks) {
126524
126761
  const seenBlockHashes = new client_block_BlockHash.Set();
126525
126762
  const usedPreviousBlockHashes = new client_block_BlockHash.Set();
126526
126763
  const allLedgerHeads = new Map();
126764
+ const allLedgerIdempotentKeys = new Map();
126765
+ const allLedgerIdempotentKeysReverse = new Map();
126527
126766
  for (const block of blocks) {
126528
126767
  const prevBlockHash = block.previous;
126529
126768
  seenBlockHashes.add(block.hash);
@@ -126533,6 +126772,20 @@ async function client_validateBlocksForVote(blocks) {
126533
126772
  if (block.subnet !== client_ledger_classPrivateFieldGet(client_subnet, this)) {
126534
126773
  throw new client_ledger_KeetaNetLedgerError('LEDGER_INVALID_SUBNET', 'Cannot vote on block for a different subnet');
126535
126774
  }
126775
+
126776
+ /*
126777
+ * Verify that no other blocks in this set of blocks have the same idempotent key
126778
+ */
126779
+ if (block.idempotent !== undefined) {
126780
+ const idempotentKey = src_client_IdempotentKey.fromAccountAndIdempotent(block.account, block.idempotent);
126781
+ const idempotentKeyString = idempotentKey.toString();
126782
+ const existingBlockHash = allLedgerIdempotentKeysReverse.get(idempotentKeyString);
126783
+ if (existingBlockHash !== undefined) {
126784
+ throw new src_client_KeetaNetLedgerIdempotentKeyError('LEDGER_IDEMPOTENT_KEY_EXISTS', block.hash, existingBlockHash, block.account, block.idempotent);
126785
+ }
126786
+ allLedgerIdempotentKeys.set(block.hash, idempotentKey);
126787
+ allLedgerIdempotentKeysReverse.set(idempotentKeyString, block.hash);
126788
+ }
126536
126789
  if (usedPreviousBlockHashes.has(prevBlockHash)) {
126537
126790
  throw new client_ledger_KeetaNetLedgerError('LEDGER_PREVIOUS_ALREADY_USED', `Invalid reference to block, previous: ${prevBlockHash} has already been used`);
126538
126791
  }
@@ -126561,7 +126814,10 @@ async function client_validateBlocksForVote(blocks) {
126561
126814
  allLedgerHeads.set(block.account, block);
126562
126815
  }
126563
126816
  }
126564
- return allLedgerHeads;
126817
+ return {
126818
+ allLedgerHeads,
126819
+ allLedgerIdempotentKeys
126820
+ };
126565
126821
  }
126566
126822
  async function client_voteOrQuoteWithFees(blocks, type, quote) {
126567
126823
  var _quote$fee;
@@ -126993,6 +127249,22 @@ class src_client_Ledger {
126993
127249
  return await transaction.getFee(...args);
126994
127250
  });
126995
127251
  }
127252
+ async getIdempotentBlockHash() {
127253
+ for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {
127254
+ args[_key27] = arguments[_key27];
127255
+ }
127256
+ return await this.runReadOnly('db-getIdempotentBlockHash', async function (transaction) {
127257
+ return await transaction.getIdempotentBlockHash(...args);
127258
+ });
127259
+ }
127260
+ async getBlockFromIdempotent() {
127261
+ for (var _len28 = arguments.length, args = new Array(_len28), _key28 = 0; _key28 < _len28; _key28++) {
127262
+ args[_key28] = arguments[_key28];
127263
+ }
127264
+ return await this.runReadOnly('db-getBlockFromIdempotent', async function (transaction) {
127265
+ return await transaction.getBlockFromIdempotent(...args);
127266
+ });
127267
+ }
126996
127268
  async stats() {
126997
127269
  try {
126998
127270
  var _this$node5;
@@ -127019,7 +127291,7 @@ client_lib_ledger_defineProperty(src_client_Ledger, "isInstance", client_checkab
127019
127291
  // EXTERNAL MODULE: ws (ignored)
127020
127292
  var client_ws_ignored_ = __webpack_require__(4708);
127021
127293
  ;// ./src/version.ts
127022
- const client_version = '0.14.4+g6020a42a3e7fdf7cae2d3783e939f895ae1be911';
127294
+ const client_version = '0.14.6+g5aa6231eec357d1f519f0844be54694bedc01505';
127023
127295
  /* harmony default export */ const client_src_version = ((/* unused pure expression or super */ null && (client_version)));
127024
127296
  ;// ./src/lib/p2p.ts
127025
127297
  /* provided dependency */ var client_p2p_Buffer = __webpack_require__(8287)["Buffer"];
@@ -129005,6 +129277,545 @@ const client_p2p_Testing = {
129005
129277
  generateP2PPeerSigned: client_generateP2PPeerSigned,
129006
129278
  P2PPeerToJSO: client_P2PPeerToJSO
129007
129279
  };
129280
+ // EXTERNAL MODULE: ./node_modules/typia/lib/internal/_assertGuard.js
129281
+ var client_assertGuard = __webpack_require__(7422);
129282
+ ;// ./src/lib/log/helper.generated.ts
129283
+
129284
+ const client_assertLogOptionsParam = (() => {
129285
+ const _io0 = input => (undefined === input.userVisible || "boolean" === typeof input.userVisible) && (undefined === input.currentRequestInfo || "object" === typeof input.currentRequestInfo && null !== input.currentRequestInfo && _io1(input.currentRequestInfo));
129286
+ const _io1 = input => "string" === typeof input.id;
129287
+ const _ao0 = function (input, _path) {
129288
+ let _exceptionable = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
129289
+ return (undefined === input.userVisible || "boolean" === typeof input.userVisible || client_assertGuard/* _assertGuard */.v(_exceptionable, {
129290
+ method: "createAssert",
129291
+ path: _path + ".userVisible",
129292
+ expected: "(boolean | undefined)",
129293
+ value: input.userVisible
129294
+ }, _errorFactory)) && (undefined === input.currentRequestInfo || ("object" === typeof input.currentRequestInfo && null !== input.currentRequestInfo || client_assertGuard/* _assertGuard */.v(_exceptionable, {
129295
+ method: "createAssert",
129296
+ path: _path + ".currentRequestInfo",
129297
+ expected: "(LogCurrentRequest | undefined)",
129298
+ value: input.currentRequestInfo
129299
+ }, _errorFactory)) && _ao1(input.currentRequestInfo, _path + ".currentRequestInfo", true && _exceptionable) || client_assertGuard/* _assertGuard */.v(_exceptionable, {
129300
+ method: "createAssert",
129301
+ path: _path + ".currentRequestInfo",
129302
+ expected: "(LogCurrentRequest | undefined)",
129303
+ value: input.currentRequestInfo
129304
+ }, _errorFactory));
129305
+ };
129306
+ const _ao1 = function (input, _path) {
129307
+ let _exceptionable = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
129308
+ return "string" === typeof input.id || client_assertGuard/* _assertGuard */.v(_exceptionable, {
129309
+ method: "createAssert",
129310
+ path: _path + ".id",
129311
+ expected: "string",
129312
+ value: input.id
129313
+ }, _errorFactory);
129314
+ };
129315
+ const __is = input => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0(input);
129316
+ let _errorFactory;
129317
+ return (input, errorFactory) => {
129318
+ if (false === __is(input)) {
129319
+ _errorFactory = errorFactory;
129320
+ (function (input, _path) {
129321
+ let _exceptionable = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
129322
+ return ("object" === typeof input && null !== input && false === Array.isArray(input) || client_assertGuard/* _assertGuard */.v(true, {
129323
+ method: "createAssert",
129324
+ path: _path + "",
129325
+ expected: "__type",
129326
+ value: input
129327
+ }, _errorFactory)) && _ao0(input, _path + "", true) || client_assertGuard/* _assertGuard */.v(true, {
129328
+ method: "createAssert",
129329
+ path: _path + "",
129330
+ expected: "__type",
129331
+ value: input
129332
+ }, _errorFactory);
129333
+ })(input, "$input", true);
129334
+ }
129335
+ return input;
129336
+ };
129337
+ })();
129338
+ const client_assertLogTargetLevel = (() => {
129339
+ const __is = input => "ALL" === input || "DEBUG" === input || "INFO" === input || "WARN" === input || "ERROR" === input || "NONE" === input;
129340
+ let _errorFactory;
129341
+ return (input, errorFactory) => {
129342
+ if (false === __is(input)) {
129343
+ _errorFactory = errorFactory;
129344
+ (function (input, _path) {
129345
+ let _exceptionable = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
129346
+ return "ALL" === input || "DEBUG" === input || "INFO" === input || "WARN" === input || "ERROR" === input || "NONE" === input || client_assertGuard/* _assertGuard */.v(true, {
129347
+ method: "createAssert",
129348
+ path: _path + "",
129349
+ expected: "(\"ALL\" | \"DEBUG\" | \"ERROR\" | \"INFO\" | \"NONE\" | \"WARN\")",
129350
+ value: input
129351
+ }, _errorFactory);
129352
+ })(input, "$input", true);
129353
+ }
129354
+ return input;
129355
+ };
129356
+ })();
129357
+ ;// ./src/lib/log/common.ts
129358
+ const client_numericLogLevels = {
129359
+ DEBUG: 0,
129360
+ INFO: 1,
129361
+ WARN: 2,
129362
+ ERROR: 3
129363
+ };
129364
+
129365
+ /* XXX:TODO -- Do something with this */
129366
+
129367
+ function client_canLogForLevel(level, currentLevel) {
129368
+ return client_numericLogLevels[level] >= client_numericLogLevels[currentLevel];
129369
+ }
129370
+ function client_canLogForTargetLevel(level, targetLevel) {
129371
+ if (targetLevel === 'ALL') {
129372
+ return true;
129373
+ }
129374
+ if (targetLevel === 'NONE') {
129375
+ return false;
129376
+ }
129377
+ return client_canLogForLevel(level, targetLevel);
129378
+ }
129379
+ function client_filterLog(target, message) {
129380
+ var _message$options$user, _message$options$curr, _message$options$curr2;
129381
+ if (!client_canLogForTargetLevel(message.level, target.logLevel)) {
129382
+ return null;
129383
+ }
129384
+ if (target.filter && !target.filter.test(message.from)) {
129385
+ return null;
129386
+ }
129387
+ return {
129388
+ ...message,
129389
+ options: {
129390
+ userVisible: (_message$options$user = message.options.userVisible) !== null && _message$options$user !== void 0 ? _message$options$user : true,
129391
+ currentRequestInfo: {
129392
+ id: (_message$options$curr = (_message$options$curr2 = message.options.currentRequestInfo) === null || _message$options$curr2 === void 0 ? void 0 : _message$options$curr2.id) !== null && _message$options$curr !== void 0 ? _message$options$curr : '<NO_REQUEST_ID>',
129393
+ ...message.options.currentRequestInfo
129394
+ },
129395
+ ...message.options
129396
+ }
129397
+ };
129398
+ }
129399
+ ;// ./src/lib/log/target_console.ts
129400
+ function client_target_console_classPrivateFieldInitSpec(e, t, a) { client_target_console_checkPrivateRedeclaration(e, t), t.set(e, a); }
129401
+ function client_target_console_checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
129402
+ function client_target_console_classPrivateFieldGet(s, a) { return s.get(client_target_console_assertClassBrand(s, a)); }
129403
+ function client_target_console_classPrivateFieldSet(s, a, r) { return s.set(client_target_console_assertClassBrand(s, a), r), r; }
129404
+ function client_target_console_assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
129405
+
129406
+
129407
+ var client_console = /*#__PURE__*/new WeakMap();
129408
+ class client_LogTargetConsole {
129409
+ constructor(config) {
129410
+ var _config$logLevel, _config$console, _config$filter;
129411
+ client_target_console_classPrivateFieldInitSpec(this, client_console, void 0);
129412
+ this.logLevel = (_config$logLevel = config === null || config === void 0 ? void 0 : config.logLevel) !== null && _config$logLevel !== void 0 ? _config$logLevel : 'ALL';
129413
+ client_target_console_classPrivateFieldSet(client_console, this, (_config$console = config === null || config === void 0 ? void 0 : config.console) !== null && _config$console !== void 0 ? _config$console : console);
129414
+ this.filter = (_config$filter = config === null || config === void 0 ? void 0 : config.filter) !== null && _config$filter !== void 0 ? _config$filter : null;
129415
+ }
129416
+ async emitLogs(logs) {
129417
+ for (const rawLog of logs) {
129418
+ const log = client_filterLog(this, rawLog);
129419
+ if (log === null) {
129420
+ continue;
129421
+ }
129422
+ let method;
129423
+ switch (log.level) {
129424
+ case 'ERROR':
129425
+ method = 'error';
129426
+ break;
129427
+ case 'WARN':
129428
+ method = 'warn';
129429
+ break;
129430
+ case 'INFO':
129431
+ method = 'info';
129432
+ break;
129433
+ case 'DEBUG':
129434
+ method = 'debug';
129435
+ break;
129436
+ default:
129437
+ client_assertNever(log.level);
129438
+ }
129439
+ const requestID = log.options.currentRequestInfo.id;
129440
+ client_target_console_classPrivateFieldGet(client_console, this)[method](`[${requestID}] ${log.level} ${log.from}:`, ...log.args);
129441
+ if (log.trace !== undefined) {
129442
+ client_target_console_classPrivateFieldGet(client_console, this)[method](`[${requestID}] ${log.level} ${log.from} TRACE:`, log.trace);
129443
+ }
129444
+ }
129445
+ }
129446
+ }
129447
+ /* harmony default export */ const client_target_console = (client_LogTargetConsole);
129448
+ ;// ./src/lib/log/index.ts
129449
+ /* provided dependency */ var client_log_process = __webpack_require__(5606);
129450
+ function client_log_classPrivateMethodInitSpec(e, a) { client_log_checkPrivateRedeclaration(e, a), a.add(e); }
129451
+ function client_log_classPrivateFieldInitSpec(e, t, a) { client_log_checkPrivateRedeclaration(e, t), t.set(e, a); }
129452
+ function client_log_checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
129453
+ function client_log_defineProperty(e, r, t) { return (r = client_log_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
129454
+ function client_log_toPropertyKey(t) { var i = client_log_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
129455
+ function client_log_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); }
129456
+ function client_log_classPrivateFieldSet(s, a, r) { return s.set(client_log_assertClassBrand(s, a), r), r; }
129457
+ function client_log_classPrivateFieldGet(s, a) { return s.get(client_log_assertClassBrand(s, a)); }
129458
+ function client_log_assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
129459
+
129460
+
129461
+ /**
129462
+ * Maximum number of logs to enqueue when there are no targets assigned to a
129463
+ * Log instance
129464
+ */
129465
+ const client_MAX_LOGS_TO_ENQUEUE_WITH_NO_TARGETS = 131072;
129466
+
129467
+ /**
129468
+ * Options for a Log instance
129469
+ */
129470
+
129471
+ const client_NullLogger = {
129472
+ log: () => {},
129473
+ info: () => {},
129474
+ debug: () => {},
129475
+ warn: () => {},
129476
+ error: () => {}
129477
+ };
129478
+ var client_logs = /*#__PURE__*/new WeakMap();
129479
+ var client_autoSyncInterval = /*#__PURE__*/new WeakMap();
129480
+ var client_isSyncing = /*#__PURE__*/new WeakMap();
129481
+ var client_shouldSyncAgain = /*#__PURE__*/new WeakMap();
129482
+ var client_destroyed = /*#__PURE__*/new WeakMap();
129483
+ var client_emitOnLog = /*#__PURE__*/new WeakMap();
129484
+ var client_logDebugTracing = /*#__PURE__*/new WeakMap();
129485
+ var client_targets = /*#__PURE__*/new WeakMap();
129486
+ var client_Log_brand = /*#__PURE__*/new WeakSet();
129487
+ class client_Log {
129488
+ /**
129489
+ * The Null logger, to disable logging entirely
129490
+ */
129491
+ static Null() {
129492
+ return client_NullLogger;
129493
+ }
129494
+
129495
+ /**
129496
+ * The legacy logger
129497
+ *
129498
+ * This is a singleton instance of the logger that registers a console
129499
+ * target that emits logs immediately to the console.
129500
+ *
129501
+ * This also sets the log level based on the `<name>_DEBUG`
129502
+ * environment variable, if available and adds filtering based on
129503
+ * the `<name>_DEBUG_FILTER` environment variable, if available.
129504
+ *
129505
+ * The default value for `<name>` is `KEETANET`.
129506
+ */
129507
+ static Legacy(name) {
129508
+ if (name === undefined) {
129509
+ name = 'KEETANET';
129510
+ }
129511
+ const extraConfig = {};
129512
+ if (client_log_process !== undefined) {
129513
+ var _process$env$toUpperC, _process$env, _process$env2;
129514
+ let environmentLogLevel = (_process$env$toUpperC = (_process$env = client_log_process.env[`${name}_DEBUG`]) === null || _process$env === void 0 ? void 0 : _process$env.toUpperCase()) !== null && _process$env$toUpperC !== void 0 ? _process$env$toUpperC : 'NONE';
129515
+ if (environmentLogLevel === 'TRUE') {
129516
+ environmentLogLevel = 'DEBUG';
129517
+ } else if (environmentLogLevel === 'FALSE') {
129518
+ environmentLogLevel = 'NONE';
129519
+ }
129520
+ extraConfig.logLevel = client_assertLogTargetLevel(environmentLogLevel);
129521
+ extraConfig.filter = new RegExp((_process$env2 = client_log_process.env[`${name}_DEBUG_FILTER`]) !== null && _process$env2 !== void 0 ? _process$env2 : '', 'i');
129522
+ }
129523
+ if (client_Log.legacyLoggerInstance) {
129524
+ if (client_log_classPrivateFieldGet(client_destroyed, client_Log.legacyLoggerInstance)) {
129525
+ client_Log.legacyLoggerInstance = undefined;
129526
+ }
129527
+ }
129528
+ if (client_Log.legacyLoggerInstance) {
129529
+ return client_Log.legacyLoggerInstance;
129530
+ }
129531
+ const logger = new client_Log();
129532
+ logger.registerConsoleTarget({
129533
+ logLevel: client_Log.defaultLevel,
129534
+ ...extraConfig
129535
+ });
129536
+ client_log_classPrivateFieldSet(client_emitOnLog, logger, true);
129537
+ client_Log.legacyLoggerInstance = logger;
129538
+ return client_Log.legacyLoggerInstance;
129539
+ }
129540
+
129541
+ /**
129542
+ * Queued logs to be sent
129543
+ */
129544
+
129545
+ constructor(_options) {
129546
+ client_log_classPrivateMethodInitSpec(this, client_Log_brand);
129547
+ client_log_classPrivateFieldInitSpec(this, client_logs, []);
129548
+ /**
129549
+ * Interval holding the current autoSync process
129550
+ */
129551
+ client_log_classPrivateFieldInitSpec(this, client_autoSyncInterval, undefined);
129552
+ /**
129553
+ * Keep track of whether or not we are currently syncing
129554
+ */
129555
+ client_log_classPrivateFieldInitSpec(this, client_isSyncing, false);
129556
+ /**
129557
+ * If `sync()` is called while we are syncing, we should sync again
129558
+ * to ensure all logs are sent
129559
+ */
129560
+ client_log_classPrivateFieldInitSpec(this, client_shouldSyncAgain, false);
129561
+ /**
129562
+ * Whether or not the logger has been destroyed
129563
+ */
129564
+ client_log_classPrivateFieldInitSpec(this, client_destroyed, false);
129565
+ /**
129566
+ * Always attempt to emit logs when a new log event is added
129567
+ *
129568
+ * This is only available for the legacy logger instance
129569
+ */
129570
+ client_log_classPrivateFieldInitSpec(this, client_emitOnLog, false);
129571
+ /**
129572
+ * Whether or not to generate debug tracing information for each log entry
129573
+ */
129574
+ client_log_classPrivateFieldInitSpec(this, client_logDebugTracing, false);
129575
+ client_log_classPrivateFieldInitSpec(this, client_targets, new Map());
129576
+ /**
129577
+ * The maximum number of log entries to send to each target at a time
129578
+ */
129579
+ client_log_defineProperty(this, "batchSize", 10);
129580
+ if ((_options === null || _options === void 0 ? void 0 : _options.logDebugTracing) !== undefined) {
129581
+ client_log_classPrivateFieldSet(client_logDebugTracing, this, _options.logDebugTracing);
129582
+ }
129583
+ }
129584
+ log() {
129585
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
129586
+ args[_key] = arguments[_key];
129587
+ }
129588
+ const {
129589
+ options,
129590
+ from
129591
+ } = client_log_assertClassBrand(client_Log_brand, this, client_extractArguments).call(this, args);
129592
+ client_log_assertClassBrand(client_Log_brand, this, client_log_log).call(this, 'INFO', options, from, ...args);
129593
+ }
129594
+ info() {
129595
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
129596
+ args[_key2] = arguments[_key2];
129597
+ }
129598
+ const {
129599
+ options,
129600
+ from
129601
+ } = client_log_assertClassBrand(client_Log_brand, this, client_extractArguments).call(this, args);
129602
+ client_log_assertClassBrand(client_Log_brand, this, client_log_log).call(this, 'INFO', options, from, ...args);
129603
+ }
129604
+ debug() {
129605
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
129606
+ args[_key3] = arguments[_key3];
129607
+ }
129608
+ const {
129609
+ options,
129610
+ from
129611
+ } = client_log_assertClassBrand(client_Log_brand, this, client_extractArguments).call(this, args);
129612
+ client_log_assertClassBrand(client_Log_brand, this, client_log_log).call(this, 'DEBUG', options, from, ...args);
129613
+ }
129614
+ warn() {
129615
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
129616
+ args[_key4] = arguments[_key4];
129617
+ }
129618
+ const {
129619
+ options,
129620
+ from
129621
+ } = client_log_assertClassBrand(client_Log_brand, this, client_extractArguments).call(this, args);
129622
+ client_log_assertClassBrand(client_Log_brand, this, client_log_log).call(this, 'WARN', options, from, ...args);
129623
+ }
129624
+ error() {
129625
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
129626
+ args[_key5] = arguments[_key5];
129627
+ }
129628
+ const {
129629
+ options,
129630
+ from
129631
+ } = client_log_assertClassBrand(client_Log_brand, this, client_extractArguments).call(this, args);
129632
+
129633
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
129634
+ client_log_assertClassBrand(client_Log_brand, this, client_log_log).call(this, 'ERROR', options, from, ...args);
129635
+ }
129636
+
129637
+ /**
129638
+ * Register a new logging target (sink) to send logs to
129639
+ */
129640
+ registerTarget(target) {
129641
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
129642
+ const id = Symbol('LogTargetID');
129643
+ client_log_classPrivateFieldGet(client_targets, this).set(id, target);
129644
+ return id;
129645
+ }
129646
+
129647
+ /**
129648
+ * Register a new logging target (sink) to send logs to, using the Console target
129649
+ *
129650
+ */
129651
+ registerConsoleTarget(config) {
129652
+ const target = new client_target_console({
129653
+ ...config
129654
+ });
129655
+ return this.registerTarget(target);
129656
+ }
129657
+
129658
+ /**
129659
+ * Unregister a logging target (sink) to stop sending logs to
129660
+ */
129661
+ unregisterTarget(id) {
129662
+ client_log_classPrivateFieldGet(client_targets, this).delete(id);
129663
+ }
129664
+
129665
+ /**
129666
+ * Emit a set of logs to all registered targets
129667
+ */
129668
+ async emitLogs(logs, targets) {
129669
+ await Promise.allSettled(targets.map(async function (target) {
129670
+ await target.emitLogs(logs);
129671
+ }));
129672
+ }
129673
+
129674
+ /**
129675
+ * Start a timer to periodically sync logs to all targets
129676
+ */
129677
+ startAutoSync() {
129678
+ let rate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
129679
+ this.stopAutoSync();
129680
+ client_log_classPrivateFieldSet(client_autoSyncInterval, this, setInterval(async () => {
129681
+ try {
129682
+ await this.sync();
129683
+ } catch {
129684
+ /* Ignored */
129685
+ }
129686
+ }, rate));
129687
+ }
129688
+
129689
+ /**
129690
+ * If a timer was started with `startAutoSync()`, stop it
129691
+ */
129692
+ stopAutoSync() {
129693
+ if (!client_log_classPrivateFieldGet(client_autoSyncInterval, this)) {
129694
+ return;
129695
+ }
129696
+ clearInterval(client_log_classPrivateFieldGet(client_autoSyncInterval, this));
129697
+ client_log_classPrivateFieldSet(client_autoSyncInterval, this, undefined);
129698
+ }
129699
+
129700
+ /**
129701
+ * Sync all currently enqueued logs to all targets
129702
+ */
129703
+ async sync() {
129704
+ /*
129705
+ * If there are currently no targets, do not dequeue logs
129706
+ * in case a target is added later; However, if there are
129707
+ * too many logs, drop the oldest ones
129708
+ */
129709
+ if (client_log_classPrivateFieldGet(client_targets, this).size === 0) {
129710
+ if (client_log_classPrivateFieldGet(client_logs, this).length > client_MAX_LOGS_TO_ENQUEUE_WITH_NO_TARGETS) {
129711
+ client_log_classPrivateFieldGet(client_logs, this).splice(0, client_log_classPrivateFieldGet(client_logs, this).length - client_MAX_LOGS_TO_ENQUEUE_WITH_NO_TARGETS);
129712
+ }
129713
+ return;
129714
+ }
129715
+
129716
+ /*
129717
+ * If we are already syncing, set a flag to sync again after the current sync is done
129718
+ */
129719
+ if (client_log_classPrivateFieldGet(client_isSyncing, this)) {
129720
+ client_log_classPrivateFieldSet(client_shouldSyncAgain, this, true);
129721
+ return;
129722
+ }
129723
+ client_log_classPrivateFieldSet(client_isSyncing, this, true);
129724
+
129725
+ /*
129726
+ * Create a copy of the currently registered targets in case
129727
+ * they are modified while a sync is on-going, we use the
129728
+ * same targets until the sync is complete
129729
+ *
129730
+ * This ensures no messages are lost if all targets are removed
129731
+ * while a sync is in progress -- they will continue to be sent
129732
+ * to the registered targets at the time of the sync
129733
+ */
129734
+ const targets = Array.from(client_log_classPrivateFieldGet(client_targets, this).values());
129735
+ do {
129736
+ try {
129737
+ client_log_classPrivateFieldSet(client_shouldSyncAgain, this, false);
129738
+ while (client_log_classPrivateFieldGet(client_logs, this).length > 0) {
129739
+ const logs = client_log_classPrivateFieldGet(client_logs, this).splice(0, this.batchSize);
129740
+ await this.emitLogs(logs, targets);
129741
+ }
129742
+ } catch {
129743
+ /* Ignore errors */
129744
+ }
129745
+ } while (client_log_classPrivateFieldGet(client_shouldSyncAgain, this));
129746
+ client_log_classPrivateFieldSet(client_isSyncing, this, false);
129747
+ }
129748
+
129749
+ /**
129750
+ * Dispose of the logger instance, clearing all logs and targets
129751
+ */
129752
+ [Symbol.dispose]() {
129753
+ this.destroy();
129754
+ }
129755
+
129756
+ /**
129757
+ * Terminate the logger instance, clearing all logs and targets
129758
+ */
129759
+ destroy() {
129760
+ this.stopAutoSync();
129761
+ client_log_classPrivateFieldSet(client_logs, this, []);
129762
+ client_log_classPrivateFieldGet(client_targets, this).clear();
129763
+ client_log_classPrivateFieldSet(client_isSyncing, this, false);
129764
+ client_log_classPrivateFieldSet(client_shouldSyncAgain, this, false);
129765
+ client_log_classPrivateFieldSet(client_emitOnLog, this, false);
129766
+ client_log_classPrivateFieldSet(client_destroyed, this, true);
129767
+ }
129768
+ }
129769
+ function client_log_log(level, options, from) {
129770
+ for (var _len6 = arguments.length, args = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
129771
+ args[_key6 - 3] = arguments[_key6];
129772
+ }
129773
+ const log = {
129774
+ options,
129775
+ level,
129776
+ from,
129777
+ args
129778
+ };
129779
+ if (client_log_classPrivateFieldGet(client_logDebugTracing, this)) {
129780
+ var _Error$stack$split$sl, _Error$stack;
129781
+ log.trace = (_Error$stack$split$sl = (_Error$stack = new Error().stack) === null || _Error$stack === void 0 ? void 0 : _Error$stack.split('\n').slice(2).join('\n')) !== null && _Error$stack$split$sl !== void 0 ? _Error$stack$split$sl : '[No stack trace available]';
129782
+ }
129783
+ client_log_classPrivateFieldGet(client_logs, this).push(log);
129784
+ if (client_log_classPrivateFieldGet(client_emitOnLog, this)) {
129785
+ void this.sync().catch(function () {
129786
+ /* Ignore errors */
129787
+ });
129788
+ }
129789
+ }
129790
+ function client_extractArguments(args) {
129791
+ let firstArgIsOptions = false;
129792
+ if (typeof args[0] === 'object' && args[0] !== null && !Array.isArray(args[0])) {
129793
+ firstArgIsOptions = true;
129794
+ }
129795
+ const options = client_assertLogOptionsParam(firstArgIsOptions ? args.shift() : {});
129796
+ const from = args.shift();
129797
+ if (typeof from !== 'string') {
129798
+ throw new Error(`Expected string for 'from', got ${typeof from}`);
129799
+ }
129800
+ return {
129801
+ options,
129802
+ from
129803
+ };
129804
+ }
129805
+ /**
129806
+ * The default log level, used for new instances of the logger
129807
+ */
129808
+ client_log_defineProperty(client_Log, "defaultLevel", 'DEBUG');
129809
+ /**
129810
+ * The Console target, which is a basic logging target that outputs
129811
+ * logs to the console
129812
+ */
129813
+ client_log_defineProperty(client_Log, "ConsoleTarget", client_target_console);
129814
+ /**
129815
+ * The existing legacy logger instance, if it exists
129816
+ */
129817
+ client_log_defineProperty(client_Log, "legacyLoggerInstance", undefined);
129818
+ /* harmony default export */ const src_client_log = (client_Log);
129008
129819
  ;// ./src/lib/node/index.ts
129009
129820
  /* provided dependency */ var client_node_process = __webpack_require__(5606);
129010
129821
  /* provided dependency */ var client_node_Buffer = __webpack_require__(8287)["Buffer"];
@@ -129046,23 +129857,6 @@ class src_client_Node {
129046
129857
  });
129047
129858
  }
129048
129859
  constructor(configOrNode) {
129049
- var _this = this;
129050
- client_node_defineProperty(this, "log", {
129051
- debug: function (from) {
129052
- var _this$config;
129053
- for (var _len = arguments.length, message = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
129054
- message[_key - 1] = arguments[_key];
129055
- }
129056
- return client_internalLogger((_this$config = _this.config) === null || _this$config === void 0 ? void 0 : _this$config.nodeAlias, 'debug', from, ...message);
129057
- },
129058
- error: function (from) {
129059
- var _this$config2;
129060
- for (var _len2 = arguments.length, message = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
129061
- message[_key2 - 1] = arguments[_key2];
129062
- }
129063
- return client_internalLogger((_this$config2 = _this.config) === null || _this$config2 === void 0 ? void 0 : _this$config2.nodeAlias, 'error', from, ...message);
129064
- }
129065
- });
129066
129860
  this.timing = new src_client_timing();
129067
129861
  if (src_client_Node.isInstance(configOrNode, false)) {
129068
129862
  const node = configOrNode;
@@ -129072,9 +129866,15 @@ class src_client_Node {
129072
129866
  this.ledger = node.ledger.copy(this);
129073
129867
  this.switch = node.switch;
129074
129868
  this.stats = node.stats;
129869
+ this.log = node.log;
129075
129870
  return;
129076
129871
  }
129077
129872
  const config = configOrNode;
129873
+ if (config.log) {
129874
+ this.log = config.log;
129875
+ } else {
129876
+ this.log = src_client_log.Legacy();
129877
+ }
129078
129878
  this.log.debug('node', 'Starting up');
129079
129879
  const {
129080
129880
  networkAddress,
@@ -129096,12 +129896,7 @@ class src_client_Node {
129096
129896
  subnet: config.subnet,
129097
129897
  initialTrustedAccount: config.initialTrustedAccount,
129098
129898
  kind: ledgerKind,
129099
- log: function () {
129100
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
129101
- args[_key3] = arguments[_key3];
129102
- }
129103
- _this.log.debug('ledger', ...args);
129104
- },
129899
+ log: this.log,
129105
129900
  ...config.ledger
129106
129901
  }, this);
129107
129902
  this.switch = new src_client_P2PSwitch(this);
@@ -129132,7 +129927,7 @@ class src_client_Node {
129132
129927
  await this.switch.stop();
129133
129928
  }
129134
129929
  async sync() {
129135
- await Promise.all([this.stats.sync(), this.switch.wait()]);
129930
+ await Promise.all([this.stats.sync(), this.switch.wait(), this.log.sync()]);
129136
129931
  }
129137
129932
  async addToLedger(votesAndBlocks) {
129138
129933
  let broadcast = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
@@ -129270,7 +130065,7 @@ function client_client_toPrimitive(t, r) { if ("object" != typeof t || !t) retur
129270
130065
 
129271
130066
 
129272
130067
  const client_ClientErrorType = 'CLIENT';
129273
- 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'];
130068
+ 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'];
129274
130069
  const client_FullClientErrorCodes = client_ClientErrorCodes.map(code => `${client_ClientErrorType}_${code}`);
129275
130070
  class src_client_KeetaNetClientError extends src_client_KeetaNetErrorBase {
129276
130071
  constructor(code, message) {
@@ -129314,6 +130109,8 @@ client_error_kv_defineProperty(src_client_KeetaNetKVError, "isInstance", client_
129314
130109
 
129315
130110
 
129316
130111
 
130112
+
130113
+
129317
130114
  const client_allErrorCodesWithoutPrefix = [...client_AccountErrorCodes, ...client_APIErrorCodes, ...client_BlockErrorCodes, ...client_CertificateErrorCodes, ...client_ClientErrorCodes, ...client_KVErrorCodes, ...client_LedgerBaseErrorCodes, ...client_LedgerVoteErrorCodes, ...client_PermissionsErrorCodes, ...client_VoteErrorCodes];
129318
130115
  const client_allFullErrorCodes = [...client_FullAccountErrorCodes, ...client_FullAPIErrorCodes, ...client_FullBlockErrorCodes, ...client_FullCertificateErrorCodes, ...client_FullClientErrorCodes, ...client_FullKVErrorCodes, ...client_FullLedgerErrorCodes, ...client_FullPermissionsErrorCodes, ...client_FullVoteErrorCodes];
129319
130116
  const client_errorCodeSet = new Set(client_allFullErrorCodes);
@@ -129351,7 +130148,35 @@ class client_KeetaNetError extends src_client_KeetaNetErrorBase {
129351
130148
  }
129352
130149
  retryDelay = json.retryDelay;
129353
130150
  }
129354
- if (src_client_KeetaNetLedgerVoteError.assertValidLedgerErrorCode(code)) {
130151
+ if (src_client_KeetaNetLedgerIdempotentKeyError.assertValidLedgerErrorCode(code)) {
130152
+ let account;
130153
+ let idempotentKey;
130154
+ if ('account' in json) {
130155
+ if (typeof json.account !== 'string') {
130156
+ return new Error('Invalid JSON for KeetaNetLedgerIdempotentKeyError (bad account)');
130157
+ }
130158
+ account = client_lib_account.fromPublicKeyString(json.account);
130159
+ }
130160
+ if ('idempotentKey' in json) {
130161
+ if (typeof json.idempotentKey !== 'string') {
130162
+ return new Error('Invalid JSON for KeetaNetLedgerIdempotentKeyError (bad idempotentKey)');
130163
+ }
130164
+ try {
130165
+ idempotentKey = client_bufferToArrayBuffer(client_validateBase64ToBuffer(json.idempotentKey));
130166
+ } catch {
130167
+ return new Error('Invalid JSON for KeetaNetLedgerIdempotentKeyError (bad idempotentKey)');
130168
+ }
130169
+ }
130170
+ if (!('blockhash' in json) || typeof json.blockhash !== 'string') {
130171
+ return new Error('Invalid JSON for KeetaNetLedgerIdempotentKeyError (bad blockhash)');
130172
+ }
130173
+ if (!('existingBlockhash' in json) || typeof json.existingBlockhash !== 'string') {
130174
+ return new Error('Invalid JSON for KeetaNetLedgerIdempotentKeyError (bad existingBlockhash)');
130175
+ }
130176
+ const blockhash = new client_block_BlockHash(json.blockhash);
130177
+ const existingBlockhash = new client_block_BlockHash(json.existingBlockhash);
130178
+ return new src_client_KeetaNetLedgerIdempotentKeyError(code, blockhash, existingBlockhash, account, idempotentKey);
130179
+ } else if (src_client_KeetaNetLedgerVoteError.assertValidLedgerErrorCode(code)) {
129355
130180
  if (!('accounts' in json) || !Array.isArray(json.accounts)) {
129356
130181
  return new Error('Invalid JSON for KeetaNetLedgerVoteError (bad accounts)');
129357
130182
  }
@@ -129453,7 +130278,7 @@ function client_deserializeBloomFilter(input) {
129453
130278
  // Blocks that will return from generateInitialVoteStaple if you are adding supply
129454
130279
 
129455
130280
  async function client_generateInitialVoteStaple(options) {
129456
- var _options$baseTokenInf, _options$baseTokenInf2, _options$baseTokenInf3, _options$baseTokenInf4;
130281
+ var _options$baseNetworkI, _options$baseNetworkI2, _options$baseNetworkI3, _options$baseNetworkI4, _options$baseNetworkI5, _options$baseNetworkI6, _options$baseNetworkI7, _options$baseNetworkI8, _options$baseTokenInf, _options$baseTokenInf2, _options$baseTokenInf3, _options$baseTokenInf4, _options$baseTokenInf5, _options$baseTokenInf6;
129457
130282
  const {
129458
130283
  network,
129459
130284
  initialTrustedAccount,
@@ -129486,10 +130311,10 @@ async function client_generateInitialVoteStaple(options) {
129486
130311
  permissions: new client_permissions_Permissions(['OWNER'])
129487
130312
  }, {
129488
130313
  type: client_lib_block.OperationType.SET_INFO,
129489
- name: 'KEETANET',
129490
- description: 'Network Address For KeetaNet',
129491
- metadata: '',
129492
- defaultPermission: new client_permissions_Permissions(['STORAGE_CREATE'])
130314
+ name: (_options$baseNetworkI = (_options$baseNetworkI2 = options.baseNetworkInfo) === null || _options$baseNetworkI2 === void 0 ? void 0 : _options$baseNetworkI2.name) !== null && _options$baseNetworkI !== void 0 ? _options$baseNetworkI : 'KEETANET',
130315
+ description: (_options$baseNetworkI3 = (_options$baseNetworkI4 = options.baseNetworkInfo) === null || _options$baseNetworkI4 === void 0 ? void 0 : _options$baseNetworkI4.description) !== null && _options$baseNetworkI3 !== void 0 ? _options$baseNetworkI3 : 'Network Address For KeetaNet',
130316
+ metadata: (_options$baseNetworkI5 = (_options$baseNetworkI6 = options.baseNetworkInfo) === null || _options$baseNetworkI6 === void 0 ? void 0 : _options$baseNetworkI6.metadata) !== null && _options$baseNetworkI5 !== void 0 ? _options$baseNetworkI5 : '',
130317
+ defaultPermission: (_options$baseNetworkI7 = (_options$baseNetworkI8 = options.baseNetworkInfo) === null || _options$baseNetworkI8 === void 0 ? void 0 : _options$baseNetworkI8.defaultPermission) !== null && _options$baseNetworkI7 !== void 0 ? _options$baseNetworkI7 : new client_permissions_Permissions(['STORAGE_CREATE'])
129493
130318
  }]
129494
130319
  }).seal();
129495
130320
  setPrevious(networkAddress, blocks.networkAddress);
@@ -129519,7 +130344,7 @@ async function client_generateInitialVoteStaple(options) {
129519
130344
  metadata: options.baseTokenInfo ? btoa(JSON.stringify({
129520
130345
  decimalPlaces: options.baseTokenInfo.decimalPlaces
129521
130346
  })) : '',
129522
- defaultPermission: new client_permissions_Permissions(['ACCESS'])
130347
+ defaultPermission: (_options$baseTokenInf5 = (_options$baseTokenInf6 = options.baseTokenInfo) === null || _options$baseTokenInf6 === void 0 ? void 0 : _options$baseTokenInf6.defaultPermission) !== null && _options$baseTokenInf5 !== void 0 ? _options$baseTokenInf5 : new client_permissions_Permissions(['ACCESS'])
129523
130348
  }, ...additionalBaseTokenOperations]
129524
130349
  }).seal();
129525
130350
  setPrevious(baseToken, blocks.baseToken);
@@ -129591,6 +130416,7 @@ async function client_generateInitialVoteStaple(options) {
129591
130416
 
129592
130417
 
129593
130418
 
130419
+
129594
130420
  /* harmony default export */ const client_src_lib = ({
129595
130421
  /**
129596
130422
  * The `Account` module provides functionality for managing key pairs
@@ -129600,6 +130426,7 @@ async function client_generateInitialVoteStaple(options) {
129600
130426
  Block: client_lib_block,
129601
130427
  Error: client_KeetaNetError,
129602
130428
  Ledger: src_client_ledger,
130429
+ Log: src_client_log,
129603
130430
  Node: client_node,
129604
130431
  P2P: client_p2p,
129605
130432
  Permissions: client_permissions_Permissions,
@@ -131924,8 +132751,44 @@ class src_client_Client {
131924
132751
  if (publish === true) {
131925
132752
  await this.transmitStaple(successorStaple, [accountInfoSorted[0].rep]);
131926
132753
  }
132754
+ const updatedAccountInfo = await this.getAccountInfo(account, accountInfoSorted[0].rep);
132755
+ if (updatedAccountInfo.currentHeadBlockHeight === accountInfoSorted[0].info.currentHeadBlockHeight) {
132756
+ 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()}`);
132757
+ }
131927
132758
  return successorStaple;
131928
132759
  }
132760
+
132761
+ /**
132762
+ * Fetch a block from a given idempotent key
132763
+ * @param account The account associated with the idempotent key
132764
+ * @param idempotent The idempotent key to check
132765
+ */
132766
+ async getBlockFromIdempotent(account, idempotent) {
132767
+ let side = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'main';
132768
+ let rep = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'ANY';
132769
+ account = client_lib_account.toAccount(account);
132770
+ const accountPubKey = account.publicKeyString.get();
132771
+ const query = {
132772
+ side: client_assertLedgerStorage(side)
132773
+ };
132774
+ let idempotentBase64;
132775
+ if (typeof idempotent === 'string') {
132776
+ idempotentBase64 = idempotent;
132777
+ } else {
132778
+ idempotentBase64 = client_client_Buffer.from(idempotent).toString('base64');
132779
+ }
132780
+ const result = await client_client_assertClassBrand(client_Client_brand, this, src_client_api).call(this, rep, 'GET /node/ledger/account/:account/idempotent/:idempotent', {
132781
+ queryParams: query,
132782
+ args: {
132783
+ account: accountPubKey,
132784
+ idempotent: idempotentBase64
132785
+ }
132786
+ });
132787
+ if (result.block === null) {
132788
+ return null;
132789
+ }
132790
+ return new client_lib_block(result.block);
132791
+ }
131929
132792
  async getVoteQuotes(blocks) {
131930
132793
  return await client_client_assertClassBrand(client_Client_brand, this, client_requestQuotes).call(this, blocks);
131931
132794
  }
@@ -132328,6 +133191,9 @@ function client_formatAccountInfo(raw) {
132328
133191
  if (raw.defaultPermission !== undefined) {
132329
133192
  info.defaultPermission = client_client_assertClassBrand(client_Client_brand, this, client_parseResponsePermissions).call(this, raw.defaultPermission);
132330
133193
  }
133194
+ if (raw.multisigQuorum !== undefined) {
133195
+ info.multisigQuorum = BigInt(raw.multisigQuorum);
133196
+ }
132331
133197
  return info;
132332
133198
  }
132333
133199
  function client_parseAccountInfo(account, accountInfo) {
@@ -132671,7 +133537,8 @@ class src_client_UserClient {
132671
133537
  delegateTo = this.client.representatives[0].key,
132672
133538
  addSupplyAmount,
132673
133539
  voteSerial = 0n,
132674
- baseTokenInfo
133540
+ baseTokenInfo,
133541
+ baseNetworkInfo
132675
133542
  } = initOpts;
132676
133543
  if (this.signer === null) {
132677
133544
  throw new Error('May not initialize chain with a read-only UserClient (signer is null)');
@@ -132688,7 +133555,8 @@ class src_client_UserClient {
132688
133555
  recipient: client_client_assertClassBrand(client_UserClient_brand, this, client_getAccount).call(this, options).assertAccount(),
132689
133556
  amount: addSupplyAmount
132690
133557
  },
132691
- baseTokenInfo
133558
+ baseTokenInfo,
133559
+ baseNetworkInfo
132692
133560
  });
132693
133561
  return await this.client.transmitStaple(voteStaple);
132694
133562
  }
@@ -133166,6 +134034,16 @@ class src_client_UserClient {
133166
134034
  return await client_client_classPrivateFieldGet(client_client, this).recoverAccount(client_client_assertClassBrand(client_UserClient_brand, this, client_getAccount).call(this, options), publish);
133167
134035
  }
133168
134036
 
134037
+ /**
134038
+ * Fetch a block from a given idempotent key
134039
+ * @param idempotent The idempotent key to check
134040
+ * @param options User client options (common options)
134041
+ */
134042
+ async getBlockFromIdempotent(idempotent) {
134043
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
134044
+ return await client_client_classPrivateFieldGet(client_client, this).getBlockFromIdempotent(client_client_assertClassBrand(client_UserClient_brand, this, client_getAccount).call(this, options), idempotent);
134045
+ }
134046
+
133169
134047
  /**
133170
134048
  * Sync any partially-published account artifacts
133171
134049
  *