@aeternity/aepp-sdk 14.1.1 → 15.0.0

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 (82) hide show
  1. package/dist/aepp-sdk.browser-script.cjs +1 -1
  2. package/dist/aepp-sdk.browser-script.cjs.map +1 -1
  3. package/dist/aepp-sdk.browser.cjs +1 -1
  4. package/dist/aepp-sdk.browser.cjs.map +1 -1
  5. package/dist/aepp-sdk.cjs +3068 -502
  6. package/dist/aepp-sdk.cjs.map +1 -1
  7. package/es/account/Base.d.ts +6 -1
  8. package/es/account/Base.js.map +1 -1
  9. package/es/account/Generalized.d.ts +1 -1
  10. package/es/account/Generalized.js +7 -1
  11. package/es/account/Generalized.js.map +1 -1
  12. package/es/apis/node/models/index.d.ts +405 -79
  13. package/es/apis/node/models/index.js.map +1 -1
  14. package/es/apis/node/models/mappers.d.ts +54 -4
  15. package/es/apis/node/models/mappers.js +1910 -500
  16. package/es/apis/node/models/mappers.js.map +1 -1
  17. package/es/apis/node/node.d.ts +28 -6
  18. package/es/apis/node/node.js +276 -5
  19. package/es/apis/node/node.js.map +1 -1
  20. package/es/channel/Contract.d.ts +5 -0
  21. package/es/channel/Contract.js +8 -2
  22. package/es/channel/Contract.js.map +1 -1
  23. package/es/channel/handlers.js +3 -3
  24. package/es/channel/handlers.js.map +1 -1
  25. package/es/contract/ga.d.ts +5 -2
  26. package/es/contract/ga.js +53 -21
  27. package/es/contract/ga.js.map +1 -1
  28. package/es/index-browser.d.ts +3 -1
  29. package/es/index-browser.js +2 -1
  30. package/es/index-browser.js.map +1 -1
  31. package/es/tx/builder/constants.d.ts +12 -2
  32. package/es/tx/builder/constants.js +11 -1
  33. package/es/tx/builder/constants.js.map +1 -1
  34. package/es/tx/builder/entry/index.js +6 -0
  35. package/es/tx/builder/entry/index.js.map +1 -1
  36. package/es/tx/builder/entry/schema.d.ts +10 -10
  37. package/es/tx/builder/field-types/ct-version.d.ts +14 -0
  38. package/es/tx/builder/field-types/ct-version.js +14 -0
  39. package/es/tx/builder/field-types/ct-version.js.map +1 -1
  40. package/es/tx/builder/field-types/fee.d.ts +9 -7
  41. package/es/tx/builder/field-types/fee.js +75 -66
  42. package/es/tx/builder/field-types/fee.js.map +1 -1
  43. package/es/tx/builder/field-types/gas-limit.d.ts +5 -3
  44. package/es/tx/builder/field-types/gas-limit.js +25 -14
  45. package/es/tx/builder/field-types/gas-limit.js.map +1 -1
  46. package/es/tx/builder/field-types/gas-price.d.ts +6 -4
  47. package/es/tx/builder/field-types/gas-price.js +87 -21
  48. package/es/tx/builder/field-types/gas-price.js.map +1 -1
  49. package/es/tx/builder/field-types/interface.d.ts +20 -0
  50. package/es/tx/builder/field-types/interface.js +17 -1
  51. package/es/tx/builder/field-types/interface.js.map +1 -1
  52. package/es/tx/builder/field-types/name-fee.d.ts +3 -2
  53. package/es/tx/builder/field-types/name-fee.js +6 -0
  54. package/es/tx/builder/field-types/name-fee.js.map +1 -1
  55. package/es/tx/builder/field-types/pointers.d.ts +2 -1
  56. package/es/tx/builder/field-types/pointers.js +6 -2
  57. package/es/tx/builder/field-types/pointers.js.map +1 -1
  58. package/es/tx/builder/field-types/transaction.d.ts +4 -1
  59. package/es/tx/builder/field-types/transaction.js +18 -3
  60. package/es/tx/builder/field-types/transaction.js.map +1 -1
  61. package/es/tx/builder/field-types/with-formatting.d.ts +1 -1
  62. package/es/tx/builder/field-types/with-formatting.js +1 -1
  63. package/es/tx/builder/field-types/with-formatting.js.map +1 -1
  64. package/es/tx/builder/index.d.ts +13 -0
  65. package/es/tx/builder/index.js +92 -5
  66. package/es/tx/builder/index.js.map +1 -1
  67. package/es/tx/builder/protocol-parameters.d.ts +123 -0
  68. package/es/tx/builder/protocol-parameters.js +519 -0
  69. package/es/tx/builder/protocol-parameters.js.map +1 -0
  70. package/es/tx/builder/schema.d.ts +156 -155
  71. package/es/tx/builder/schema.js +5 -1
  72. package/es/tx/builder/schema.js.map +1 -1
  73. package/es/tx/execution-cost.js +5 -5
  74. package/es/tx/execution-cost.js.map +1 -1
  75. package/es/tx/transaction-signer.js +2 -2
  76. package/es/tx/transaction-signer.js.map +1 -1
  77. package/es/tx/validator.js +4 -4
  78. package/es/tx/validator.js.map +1 -1
  79. package/es/utils/wrap-proxy.d.ts +10 -0
  80. package/es/utils/wrap-proxy.js +18 -0
  81. package/es/utils/wrap-proxy.js.map +1 -1
  82. package/package.json +2 -2
package/dist/aepp-sdk.cjs CHANGED
@@ -7353,6 +7353,7 @@ __webpack_require__.d(__webpack_exports__, {
7353
7353
  connectionProxy: () => (/* reexport */ connection_proxy),
7354
7354
  createGeneralizedAccount: () => (/* reexport */ createGeneralizedAccount),
7355
7355
  decode: () => (/* reexport */ decode),
7356
+ defaultProtocolParameters: () => (/* reexport */ defaultProtocolParameters),
7356
7357
  encode: () => (/* reexport */ encode),
7357
7358
  encodeContractAddress: () => (/* reexport */ buildContractId),
7358
7359
  encodeUnsigned: () => (/* reexport */ encodeUnsigned),
@@ -7363,6 +7364,7 @@ __webpack_require__.d(__webpack_exports__, {
7363
7364
  genSalt: () => (/* reexport */ genSalt),
7364
7365
  getAccount: () => (/* reexport */ getAccount),
7365
7366
  getBalance: () => (/* reexport */ getBalance),
7367
+ getCachedProtocolParameters: () => (/* reexport */ getCachedProtocolParameters),
7366
7368
  getContract: () => (/* reexport */ getContract),
7367
7369
  getContractByteCode: () => (/* reexport */ getContractByteCode),
7368
7370
  getCurrentGeneration: () => (/* reexport */ getCurrentGeneration),
@@ -7399,6 +7401,7 @@ __webpack_require__.d(__webpack_exports__, {
7399
7401
  prefixedAmount: () => (/* reexport */ prefixedAmount),
7400
7402
  produceNameId: () => (/* reexport */ produceNameId),
7401
7403
  readInt: () => (/* reexport */ readInt),
7404
+ rebuildUnpackedTx: () => (/* reexport */ rebuildUnpackedTx),
7402
7405
  resolveName: () => (/* reexport */ resolveName),
7403
7406
  sendTransaction: () => (/* reexport */ sendTransaction),
7404
7407
  signJwt: () => (/* reexport */ signJwt),
@@ -7476,6 +7479,8 @@ __webpack_require__.d(mappers_namespaceObject, {
7476
7479
  ContractCallTx: () => (ContractCallTx),
7477
7480
  ContractCreateTx: () => (ContractCreateTx),
7478
7481
  ContractObject: () => (ContractObject),
7482
+ ContractTxBaseGas: () => (ContractTxBaseGas),
7483
+ ContractVersion: () => (ContractVersion),
7479
7484
  CountResponse: () => (CountResponse),
7480
7485
  CreateContractUnsignedTx: () => (CreateContractUnsignedTx),
7481
7486
  Currency: () => (Currency),
@@ -7502,16 +7507,61 @@ __webpack_require__.d(mappers_namespaceObject, {
7502
7507
  Image: () => (Image),
7503
7508
  KeyBlock: () => (KeyBlock),
7504
7509
  MicroBlockHeader: () => (MicroBlockHeader),
7510
+ NameAuctionTimeout: () => (NameAuctionTimeout),
7505
7511
  NameClaimTx: () => (NameClaimTx),
7506
7512
  NameEntry: () => (NameEntry),
7513
+ NameEntryPointersItem: () => (NameEntryPointersItem),
7507
7514
  NameHash: () => (NameHash),
7508
7515
  NamePointer: () => (NamePointer),
7509
- NamePointerComplete: () => (NamePointerComplete),
7510
7516
  NamePreclaimTx: () => (NamePreclaimTx),
7511
7517
  NameRevokeTx: () => (NameRevokeTx),
7512
7518
  NameTransferTx: () => (NameTransferTx),
7513
7519
  NameUpdateTx: () => (NameUpdateTx),
7514
7520
  NextNonceResponse: () => (NextNonceResponse),
7521
+ NodeGetAccountByPubkeyAndHashExceptionHeaders: () => (NodeGetAccountByPubkeyAndHashExceptionHeaders),
7522
+ NodeGetAccountByPubkeyAndHeightExceptionHeaders: () => (NodeGetAccountByPubkeyAndHeightExceptionHeaders),
7523
+ NodeGetAccountByPubkeyExceptionHeaders: () => (NodeGetAccountByPubkeyExceptionHeaders),
7524
+ NodeGetAccountNextNonceExceptionHeaders: () => (NodeGetAccountNextNonceExceptionHeaders),
7525
+ NodeGetAuctionEntryByNameExceptionHeaders: () => (NodeGetAuctionEntryByNameExceptionHeaders),
7526
+ NodeGetChainEndsExceptionHeaders: () => (NodeGetChainEndsExceptionHeaders),
7527
+ NodeGetChannelByPubkeyExceptionHeaders: () => (NodeGetChannelByPubkeyExceptionHeaders),
7528
+ NodeGetContractCodeExceptionHeaders: () => (NodeGetContractCodeExceptionHeaders),
7529
+ NodeGetContractExceptionHeaders: () => (NodeGetContractExceptionHeaders),
7530
+ NodeGetContractPoIExceptionHeaders: () => (NodeGetContractPoIExceptionHeaders),
7531
+ NodeGetCurrencyExceptionHeaders: () => (NodeGetCurrencyExceptionHeaders),
7532
+ NodeGetCurrentGenerationExceptionHeaders: () => (NodeGetCurrentGenerationExceptionHeaders),
7533
+ NodeGetCurrentKeyBlockExceptionHeaders: () => (NodeGetCurrentKeyBlockExceptionHeaders),
7534
+ NodeGetCurrentKeyBlockHashExceptionHeaders: () => (NodeGetCurrentKeyBlockHashExceptionHeaders),
7535
+ NodeGetCurrentKeyBlockHeightExceptionHeaders: () => (NodeGetCurrentKeyBlockHeightExceptionHeaders),
7536
+ NodeGetGenerationByHashExceptionHeaders: () => (NodeGetGenerationByHashExceptionHeaders),
7537
+ NodeGetGenerationByHeightExceptionHeaders: () => (NodeGetGenerationByHeightExceptionHeaders),
7538
+ NodeGetHyperchainContractPubkeysExceptionHeaders: () => (NodeGetHyperchainContractPubkeysExceptionHeaders),
7539
+ NodeGetKeyBlockByHashExceptionHeaders: () => (NodeGetKeyBlockByHashExceptionHeaders),
7540
+ NodeGetKeyBlockByHeightExceptionHeaders: () => (NodeGetKeyBlockByHeightExceptionHeaders),
7541
+ NodeGetMicroBlockHeaderByHashExceptionHeaders: () => (NodeGetMicroBlockHeaderByHashExceptionHeaders),
7542
+ NodeGetMicroBlockTransactionByHashAndIndexExceptionHeaders: () => (NodeGetMicroBlockTransactionByHashAndIndexExceptionHeaders),
7543
+ NodeGetMicroBlockTransactionsByHashExceptionHeaders: () => (NodeGetMicroBlockTransactionsByHashExceptionHeaders),
7544
+ NodeGetMicroBlockTransactionsCountByHashExceptionHeaders: () => (NodeGetMicroBlockTransactionsCountByHashExceptionHeaders),
7545
+ NodeGetNameEntryByNameExceptionHeaders: () => (NodeGetNameEntryByNameExceptionHeaders),
7546
+ NodeGetNameEntryByNameHashExceptionHeaders: () => (NodeGetNameEntryByNameHashExceptionHeaders),
7547
+ NodeGetNodeSettingsExceptionHeaders: () => (NodeGetNodeSettingsExceptionHeaders),
7548
+ NodeGetOracleByPubkeyExceptionHeaders: () => (NodeGetOracleByPubkeyExceptionHeaders),
7549
+ NodeGetOracleQueriesByPubkeyExceptionHeaders: () => (NodeGetOracleQueriesByPubkeyExceptionHeaders),
7550
+ NodeGetOracleQueryByPubkeyAndQueryIdExceptionHeaders: () => (NodeGetOracleQueryByPubkeyAndQueryIdExceptionHeaders),
7551
+ NodeGetPeerPubkeyExceptionHeaders: () => (NodeGetPeerPubkeyExceptionHeaders),
7552
+ NodeGetPendingAccountTransactionsByPubkeyExceptionHeaders: () => (NodeGetPendingAccountTransactionsByPubkeyExceptionHeaders),
7553
+ NodeGetPendingKeyBlockExceptionHeaders: () => (NodeGetPendingKeyBlockExceptionHeaders),
7554
+ NodeGetPinningTxExceptionHeaders: () => (NodeGetPinningTxExceptionHeaders),
7555
+ NodeGetProtocolParametersExceptionHeaders: () => (NodeGetProtocolParametersExceptionHeaders),
7556
+ NodeGetRecentGasPricesExceptionHeaders: () => (NodeGetRecentGasPricesExceptionHeaders),
7557
+ NodeGetStatusExceptionHeaders: () => (NodeGetStatusExceptionHeaders),
7558
+ NodeGetSyncStatusExceptionHeaders: () => (NodeGetSyncStatusExceptionHeaders),
7559
+ NodeGetTopHeaderExceptionHeaders: () => (NodeGetTopHeaderExceptionHeaders),
7560
+ NodeGetTransactionByHashExceptionHeaders: () => (NodeGetTransactionByHashExceptionHeaders),
7561
+ NodeGetTransactionInfoByHashExceptionHeaders: () => (NodeGetTransactionInfoByHashExceptionHeaders),
7562
+ NodePostTransactionExceptionHeaders: () => (NodePostTransactionExceptionHeaders),
7563
+ NodeProtectedDryRunTxsExceptionHeaders: () => (NodeProtectedDryRunTxsExceptionHeaders),
7564
+ NodeSettings: () => (NodeSettings),
7515
7565
  OffChainCallContract: () => (OffChainCallContract),
7516
7566
  OffChainDeposit: () => (OffChainDeposit),
7517
7567
  OffChainNewContract: () => (OffChainNewContract),
@@ -7536,19 +7586,22 @@ __webpack_require__.d(mappers_namespaceObject, {
7536
7586
  PoI: () => (PoI),
7537
7587
  PostTxResponse: () => (PostTxResponse),
7538
7588
  Protocol: () => (Protocol),
7589
+ ProtocolConsensusParameters: () => (ProtocolConsensusParameters),
7590
+ ProtocolParameters: () => (ProtocolParameters),
7539
7591
  PubKey: () => (PubKey),
7540
7592
  RegisteredOracle: () => (RegisteredOracle),
7541
7593
  RelativeTTL: () => (RelativeTTL),
7542
7594
  SignedTx: () => (SignedTx),
7543
7595
  SignedTxs: () => (SignedTxs),
7544
7596
  SpendTx: () => (SpendTx),
7597
+ SpendTxInput: () => (SpendTxInput),
7598
+ StateGasPerBlock: () => (StateGasPerBlock),
7545
7599
  Status: () => (Status),
7546
7600
  SyncStatus: () => (SyncStatus),
7547
7601
  TokenSupply: () => (TokenSupply),
7548
7602
  Ttl: () => (Ttl),
7549
7603
  Tx: () => (Tx),
7550
7604
  TxInfoObject: () => (TxInfoObject),
7551
- UnsignedTx: () => (UnsignedTx),
7552
7605
  discriminators: () => (discriminators)
7553
7606
  });
7554
7607
 
@@ -8796,10 +8849,28 @@ function wrapWithProxy(valueCb) {
8796
8849
  return typeof res === 'function' && name === 'get' ? res.bind(target) : res;
8797
8850
  }])));
8798
8851
  }
8852
+
8853
+ /**
8854
+ * Returns the value a proxy wraps. Anything keyed by a node must key by this: `onNode` is a proxy
8855
+ * created once per sdk instance and its identity doesn't change on `selectNode`, so a cache keyed
8856
+ * by the proxy would apply one network's values on another.
8857
+ */
8799
8858
  function unwrapProxy(value) {
8800
8859
  var _wrappedValue;
8801
8860
  return (_wrappedValue = value._wrappedValue) !== null && _wrappedValue !== void 0 ? _wrappedValue : value;
8802
8861
  }
8862
+
8863
+ /**
8864
+ * The same as {@link unwrapProxy}, but returns `undefined` instead of throwing when the proxy has
8865
+ * nothing to unwrap — an sdk instance with no node selected wraps a value that isn't there yet.
8866
+ */
8867
+ function unwrapProxyIfPossible(value) {
8868
+ try {
8869
+ return unwrapProxy(value);
8870
+ } catch {
8871
+ return undefined;
8872
+ }
8873
+ }
8803
8874
  // EXTERNAL MODULE: external "tweetnacl"
8804
8875
  var external_tweetnacl_ = __webpack_require__(1655);
8805
8876
  var external_tweetnacl_default = /*#__PURE__*/__webpack_require__.n(external_tweetnacl_);
@@ -9157,8 +9228,13 @@ const DRY_RUN_ACCOUNT = {
9157
9228
  };
9158
9229
 
9159
9230
  /**
9231
+ * The maximum gas of a generalized account authentication function as it was at the moment of the
9232
+ * SDK release. It is a node policy setting rather than a consensus parameter.
9160
9233
  * @category account generalized
9161
- * @deprecated transaction builder will ensure that gas doesn't exceed the maximum value by itself
9234
+ * @deprecated the transaction builder ensures that gas doesn't exceed the maximum by itself, and a
9235
+ * node may accept another maximum than this constant. Use
9236
+ * `(await getCachedProtocolParameters(node)).maxAuthFunGas` for the value the connected node
9237
+ * reports, or `defaultProtocolParameters.maxAuthFunGas` for this one.
9162
9238
  */
9163
9239
  const MAX_AUTH_FUN_GAS = 50000;
9164
9240
  /**
@@ -9170,7 +9246,11 @@ const MAX_AUTH_FUN_GAS = 50000;
9170
9246
  */
9171
9247
 
9172
9248
  /**
9249
+ * The consensus minimum gas price as it was at the moment of the SDK release.
9173
9250
  * @category transaction builder
9251
+ * @deprecated a node may run another minimum gas price, and this constant is wrong on it. Use
9252
+ * `(await getCachedProtocolParameters(node)).minGasPrice` for the value the connected node
9253
+ * reports, or `defaultProtocolParameters.minGasPrice` for this one.
9174
9254
  */
9175
9255
  const MIN_GAS_PRICE = 1e9; // TODO: don't use number for ae
9176
9256
  /**
@@ -9243,6 +9323,7 @@ const NAME_BID_RANGES = mapObject({
9243
9323
  */
9244
9324
  let ConsensusProtocolVersion = /*#__PURE__*/function (ConsensusProtocolVersion) {
9245
9325
  ConsensusProtocolVersion[ConsensusProtocolVersion["Ceres"] = 6] = "Ceres";
9326
+ ConsensusProtocolVersion[ConsensusProtocolVersion["Arcus"] = 7] = "Arcus";
9246
9327
  return ConsensusProtocolVersion;
9247
9328
  }({});
9248
9329
 
@@ -9996,6 +10077,20 @@ const ProtocolToVmAbi = {
9996
10077
  vmVersion: [],
9997
10078
  abiVersion: [AbiVersion.NoAbi, AbiVersion.Fate]
9998
10079
  }
10080
+ },
10081
+ [ConsensusProtocolVersion.Arcus]: {
10082
+ 'contract-create': {
10083
+ vmVersion: [VmVersion.Fate3],
10084
+ abiVersion: [AbiVersion.Fate]
10085
+ },
10086
+ 'contract-call': {
10087
+ vmVersion: [],
10088
+ abiVersion: [AbiVersion.Fate]
10089
+ },
10090
+ 'oracle-call': {
10091
+ vmVersion: [],
10092
+ abiVersion: [AbiVersion.NoAbi, AbiVersion.Fate]
10093
+ }
9999
10094
  }
10000
10095
  };
10001
10096
  function getProtocolDetails(protocolVersion, type) {
@@ -10032,6 +10127,24 @@ function getProtocolDetails(protocolVersion, type) {
10032
10127
  };
10033
10128
  }
10034
10129
  });
10130
+ ;// ./src/tx/builder/field-types/interface.ts
10131
+ // TODO: give `Field` an optional `validate` that `buildTx` runs before `serialize` and
10132
+ // `rebuildUnpackedTx` skips, so that a field can't check a value without being asked to. Needs
10133
+ // `packRecord` to stop passing params and options through the same channel first — a string key
10134
+ // in that channel would be forgeable from `JSON.parse`, which is why this is a symbol — and
10135
+ // `fee` to stop sharing its fixpoint between the default and the check [breaking change]
10136
+ /**
10137
+ * Set in the params of a transaction that is re-serialized rather than built — see
10138
+ * `rebuildUnpackedTx`. Fields that check their value against the protocol parameters serialize it
10139
+ * as it is instead: the transaction already exists, its values may belong to other parameters than
10140
+ * the ones this build runs against, and re-checking them would reject a valid transaction that is
10141
+ * serialized verbatim anyway.
10142
+ *
10143
+ * A symbol so that it can't come out of a `JSON.parse`. It is not a trust boundary either way —
10144
+ * `protocolParameters` decides what those same checks compare against and is a plain string key,
10145
+ * as are `fee`, `gasPrice`, and `gasLimit`.
10146
+ */
10147
+ const serializeAsIsParam = Symbol('serializeAsIs');
10035
10148
  ;// ./src/tx/builder/field-types/abi-version.ts
10036
10149
 
10037
10150
 
@@ -10220,32 +10333,611 @@ function genEnumerationField(enm) {
10220
10333
  }
10221
10334
  };
10222
10335
  }
10336
+ ;// ./src/tx/builder/protocol-parameters.ts
10337
+
10338
+
10339
+
10340
+
10341
+
10342
+ /**
10343
+ * Consensus parameters and node policy settings the transaction builder needs to produce a
10344
+ * transaction the node would accept — see {@link getCachedProtocolParameters}.
10345
+ * @category transaction builder
10346
+ */
10347
+
10348
+ /**
10349
+ * Transaction option to build a transaction against specific consensus parameters. `buildTxAsync`
10350
+ * sets it to the parameters it requests from node, provide it to build a transaction offline for a
10351
+ * node that doesn't run the protocol version the current SDK release was made for.
10352
+ * @category transaction builder
10353
+ */
10354
+
10355
+ const BASE_GAS = 15000;
10356
+ const defaultStateGasPerBlock = {
10357
+ part: 32000,
10358
+ whole: Math.floor(60 * 24 * 365 / 3)
10359
+ };
10360
+
10361
+ /**
10362
+ * Protocol parameters are shared between every transaction built against them, and
10363
+ * {@link defaultProtocolParameters} is shared process-wide. `readonly` guards them at compile time
10364
+ * only, so freeze them to make sure a transaction can't be mispriced by an unrelated component
10365
+ * mutating parameters it doesn't own.
10366
+ */
10367
+ function freezeParameters(parameters) {
10368
+ Object.values(parameters.contractTxBaseGas).forEach(Object.freeze);
10369
+ Object.values(parameters.stateGasPerBlock).forEach(Object.freeze);
10370
+ Object.freeze(parameters.txBaseGas);
10371
+ Object.freeze(parameters.contractTxBaseGas);
10372
+ Object.freeze(parameters.stateGasPerBlock);
10373
+ return Object.freeze(parameters);
10374
+ }
10375
+
10376
+ /**
10377
+ * Protocol parameters of Ceres as they were at the moment of the SDK release. Used to build
10378
+ * transactions without a node connection, and on nodes that don't provide the protocol parameters
10379
+ * endpoint yet.
10380
+ * @category transaction builder
10381
+ * @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}
10382
+ */
10383
+ const defaultProtocolParameters = freezeParameters({
10384
+ minGasPrice: BigInt(MIN_GAS_PRICE),
10385
+ minMinerGasPrice: BigInt(MIN_GAS_PRICE),
10386
+ gasPerByte: 20,
10387
+ blockGasLimit: 6e6,
10388
+ maxAuthFunGas: MAX_AUTH_FUN_GAS,
10389
+ txBaseGas: {
10390
+ ...Object.fromEntries(Object.values(Tag).filter(tag => typeof tag === 'number')
10391
+ // node reports the base gas of contract-executing types in `contract_tx_base_gas`,
10392
+ // `SignedTx` is not a chargeable transaction type
10393
+ .filter(tag => ![Tag.SignedTx, Tag.ContractCreateTx, Tag.ContractCallTx, Tag.GaAttachTx, Tag.GaMetaTx].includes(tag)).map(tag => [tag, BASE_GAS])),
10394
+ [Tag.ChannelForceProgressTx]: 30 * BASE_GAS,
10395
+ [Tag.ChannelOffChainTx]: 0,
10396
+ [Tag.PayingForTx]: BASE_GAS / 5
10397
+ },
10398
+ contractTxBaseGas: {
10399
+ [Tag.ContractCreateTx]: {
10400
+ [AbiVersion.Sophia]: 5 * BASE_GAS,
10401
+ [AbiVersion.Fate]: 5 * BASE_GAS
10402
+ },
10403
+ [Tag.ContractCallTx]: {
10404
+ [AbiVersion.Sophia]: 12 * BASE_GAS,
10405
+ [AbiVersion.Fate]: 12 * BASE_GAS
10406
+ },
10407
+ [Tag.GaAttachTx]: {
10408
+ [AbiVersion.Sophia]: 5 * BASE_GAS,
10409
+ [AbiVersion.Fate]: 5 * BASE_GAS
10410
+ },
10411
+ [Tag.GaMetaTx]: {
10412
+ [AbiVersion.Sophia]: 5 * BASE_GAS,
10413
+ [AbiVersion.Fate]: 5 * BASE_GAS
10414
+ }
10415
+ },
10416
+ stateGasPerBlock: Object.fromEntries([Tag.OracleRegisterTx, Tag.OracleExtendTx, Tag.OracleQueryTx, Tag.OracleRespondTx].map(tag => [tag, {
10417
+ ...defaultStateGasPerBlock
10418
+ }]))
10419
+ });
10420
+
10421
+ // node names transaction types after `aetx:type_to_swagger_name/1`, it matches `Tag` except of these
10422
+ const txTypeToTag = {
10423
+ GAAttachTx: Tag.GaAttachTx,
10424
+ GAMetaTx: Tag.GaMetaTx
10425
+ };
10426
+ function getTag(txType) {
10427
+ // node controls these keys, `isKeyOfObject` also accepts anything inherited from
10428
+ // `Object.prototype` (`constructor`, `toString`) — a name of a transaction type is neither
10429
+ const isOwnKeyOf = object => Object.prototype.hasOwnProperty.call(object, txType);
10430
+ if (isOwnKeyOf(txTypeToTag) && isKeyOfObject(txType, txTypeToTag)) return txTypeToTag[txType];
10431
+ if (!isOwnKeyOf(Tag) || !isKeyOfObject(txType, Tag)) return undefined;
10432
+ // `Tag` is a numeric enum, so it is also indexable by a member value (`Tag['12'] === 'SpendTx'`)
10433
+ const tag = Tag[txType];
10434
+ return typeof tag === 'number' ? tag : undefined;
10435
+ }
10436
+
10437
+ // Node decides these values and they multiply into the fee the user pays, so a node that is
10438
+ // compromised, misconfigured, or impersonated could make the SDK build a transaction with an
10439
+ // extreme fee. A hard fork may legitimately raise them, but not by orders of magnitude — refuse to
10440
+ // build against a value far above the one the SDK was released with rather than silently overpay.
10441
+ const maxRaiseFactor = 1000;
10442
+ function excessiveError(name, value, limit) {
10443
+ return new NodeError(`Node reports ${name} as ${String(value)}, which is outside of the range the SDK considers` + ` plausible (0..${limit}). Provide \`protocolParameters\` in options to build a transaction` + ' against these parameters anyway.');
10444
+ }
10445
+
10446
+ /**
10447
+ * A value that doesn't match the schema node declares for it — the api client passes `null`,
10448
+ * booleans, strings, and fractions through unchanged. Not a {@link NodeError}: the parameters are
10449
+ * unreadable rather than implausible, so {@link getCachedProtocolParameters} falls back to
10450
+ * {@link defaultProtocolParameters}, as for a node without the endpoint (which a node can force
10451
+ * with a 404 anyway).
10452
+ */
10453
+ function malformedError(name, value) {
10454
+ return new InternalError(`Node reports ${name} as ${String(value)}, which doesn't match the schema it declares for it`);
10455
+ }
10456
+
10457
+ /**
10458
+ * Checks a value node reports against the one the SDK was released with, returns the factor it is
10459
+ * raised by.
10460
+ */
10461
+ function checkNotExcessive(name, value, sdkValue) {
10462
+ // a parameter the SDK release has at 0 can only stay at 0, it raises the fee by nothing
10463
+ const raise = number => sdkValue === 0 ? 1 : number / sdkValue;
10464
+ const limit = sdkValue * maxRaiseFactor;
10465
+ // a bigint matches the schema whatever its magnitude, so one out of range is an implausible
10466
+ // value rather than an unreadable one. Compared as a bigint: a value far enough above the limit
10467
+ // can't be counted in a number, and that is what makes it implausible in the first place
10468
+ if (typeof value === 'bigint') {
10469
+ if (value < 0n || value > BigInt(limit)) throw excessiveError(name, value, limit);
10470
+ return raise(Number(value));
10471
+ }
10472
+ if (!Number.isSafeInteger(value)) throw malformedError(name, value);
10473
+ if (value < 0 || value > limit) throw excessiveError(name, value, limit);
10474
+ return raise(value);
10475
+ }
10476
+
10477
+ /**
10478
+ * `Math.max(...array)` passes every element as an argument and overflows the stack on an array
10479
+ * node can make arbitrarily long — it reports one entry per transaction type and abi version.
10480
+ */
10481
+ function maxOf(numbers) {
10482
+ return numbers.reduce((max, number) => number > max ? number : max, -Infinity);
10483
+ }
10484
+
10485
+ // TODO: express the bound in aettos instead — a defaulted value may not commit the user to more
10486
+ // than a fixed coin amount — rather than as a ratio against the parameters of the SDK release.
10487
+ // That states the actual requirement directly and holds on any network, but it defaults a higher
10488
+ // gas limit on a network that raised the block gas limit, so it is a behavior change, not a
10489
+ // refactor [behavior change on networks running other parameters]
10490
+ /**
10491
+ * How much node's parameters raise each product a transaction costs, against the SDK release.
10492
+ * Kept out of {@link ProtocolParameters} because they are not consensus parameters but a property
10493
+ * of where the parameters came from — the ones a caller provides in options don't go through here.
10494
+ *
10495
+ * One per gas amount the SDK picks itself, and not one per parameter: each is charged to the value
10496
+ * it bounds, so that a raise of one doesn't shrink a value it has nothing to do with.
10497
+ */
10498
+
10499
+ const parameterRaises = new WeakMap();
10500
+
10501
+ // parameters this process built itself are checked where they are built — the ones of the SDK
10502
+ // release by construction, the ones node reports by `checkParametersNotExcessive`. This remembers
10503
+ // the caller-provided ones already walked, a build reads them once per field and per rebuild pass
10504
+ const usableParameters = new WeakSet();
10505
+ function checkUsableGas(name, value) {
10506
+ if (!Number.isSafeInteger(value) || value < 0) {
10507
+ throw new ArgumentError(`protocolParameters.${name}`, 'a non-negative safe integer', value);
10508
+ }
10509
+ }
10510
+
10511
+ /**
10512
+ * Checks that parameters a caller provided in options can price a transaction at all — only values
10513
+ * that would produce `NaN`, `Infinity`, or a division by zero, not their magnitude: options are the
10514
+ * way out of the bounds {@link convertProtocolParameters} applies, bounding them here would leave
10515
+ * no way to build against a network the SDK release doesn't know. They are as trusted as `fee` and
10516
+ * `gasLimit`: must not come from untrusted input, this only turns an unusable value into an error
10517
+ * naming the field. See `serializeAsIsParam`.
10518
+ * @param parameters - Parameters provided in options
10519
+ */
10520
+ function checkParametersUsable(parameters) {
10521
+ // built by this process, or already walked
10522
+ if (parameterRaises.has(parameters) || usableParameters.has(parameters)) return;
10523
+ if (typeof parameters.minGasPrice !== 'bigint' || parameters.minGasPrice < 1n) {
10524
+ throw new ArgumentError('protocolParameters.minGasPrice', 'a positive bigint (a transaction can’t be priced against 0)', parameters.minGasPrice);
10525
+ }
10526
+ if (typeof parameters.minMinerGasPrice !== 'bigint' || parameters.minMinerGasPrice < 0n) {
10527
+ throw new ArgumentError('protocolParameters.minMinerGasPrice', 'a non-negative bigint', parameters.minMinerGasPrice);
10528
+ }
10529
+ checkUsableGas('gasPerByte', parameters.gasPerByte);
10530
+ checkUsableGas('blockGasLimit', parameters.blockGasLimit);
10531
+ checkUsableGas('maxAuthFunGas', parameters.maxAuthFunGas);
10532
+ Object.entries(parameters.txBaseGas).forEach(([tag, gas]) => {
10533
+ var _Tag$tag;
10534
+ return checkUsableGas(`txBaseGas.${(_Tag$tag = Tag[+tag]) !== null && _Tag$tag !== void 0 ? _Tag$tag : tag}`, gas);
10535
+ });
10536
+ Object.entries(parameters.contractTxBaseGas).forEach(([tag, byAbiVersion]) => Object.entries(byAbiVersion !== null && byAbiVersion !== void 0 ? byAbiVersion : {}).forEach(([abiVersion, gas]) => {
10537
+ var _Tag$tag2;
10538
+ return checkUsableGas(`contractTxBaseGas.${(_Tag$tag2 = Tag[+tag]) !== null && _Tag$tag2 !== void 0 ? _Tag$tag2 : tag}.${abiVersion}`, gas);
10539
+ }));
10540
+ Object.entries(parameters.stateGasPerBlock).forEach(([tag, fraction]) => {
10541
+ var _Tag$tag3, _fraction$whole;
10542
+ const name = `stateGasPerBlock.${(_Tag$tag3 = Tag[+tag]) !== null && _Tag$tag3 !== void 0 ? _Tag$tag3 : tag}`;
10543
+ checkUsableGas(`${name}.part`, fraction?.part);
10544
+ // a `whole` of 0 makes the state gas — and so the fee — infinite
10545
+ if (!Number.isSafeInteger(fraction?.whole) || ((_fraction$whole = fraction?.whole) !== null && _fraction$whole !== void 0 ? _fraction$whole : 0) < 1) {
10546
+ throw new ArgumentError(`${name}.whole`, 'a positive safe integer', fraction?.whole);
10547
+ }
10548
+ });
10549
+ usableParameters.add(parameters);
10550
+ }
10551
+ function checkRatioNotExcessive(name, {
10552
+ part,
10553
+ whole
10554
+ }, sdkRatio) {
10555
+ if (!Number.isSafeInteger(part) || !Number.isSafeInteger(whole)) {
10556
+ throw malformedError(name, `${String(part)}/${String(whole)}`);
10557
+ }
10558
+ const limit = sdkRatio * maxRaiseFactor;
10559
+ // a `whole` of 0 would make the fee infinite, `0 / 0` is NaN — both fail the check below
10560
+ const ratio = part >= 0 && whole > 0 ? part / whole : NaN;
10561
+ if (!(ratio >= 0) || ratio > limit) throw excessiveError(name, `${part}/${whole}`, limit);
10562
+ return ratio / sdkRatio;
10563
+ }
10564
+
10565
+ /**
10566
+ * The base gas the SDK release charges for a transaction type, whichever of the two tables it is
10567
+ * in. `getTxBaseGas` reads `contractTxBaseGas` before `txBaseGas`, so an entry node adds to
10568
+ * `contractTxBaseGas` overrides the `txBaseGas` of that very type — checking it against a
10569
+ * type-independent constant would let node raise, say, a `PayingForTx` (3000) to 15000000 and
10570
+ * still be counted as a raise of 1000.
10571
+ */
10572
+ function defaultBaseGasOf(tag) {
10573
+ var _d$contractTxBaseGas$;
10574
+ const d = defaultProtocolParameters;
10575
+ const values = [d.txBaseGas[tag], ...Object.values((_d$contractTxBaseGas$ = d.contractTxBaseGas[tag]) !== null && _d$contractTxBaseGas$ !== void 0 ? _d$contractTxBaseGas$ : {})].filter(value => value != null);
10576
+ const max = values.length !== 0 ? maxOf(values) : BASE_GAS;
10577
+ // a type charged 0 (`ChannelOffChainTx`) would get a budget of 0, and node reporting any gas for
10578
+ // it would refuse the whole response. Give it an ordinary type's budget instead — a node charging
10579
+ // more than `maxRaiseFactor` base gas units for it is still refused
10580
+ return max !== 0 ? max : BASE_GAS;
10581
+ }
10582
+ function checkRaiseNotExcessive(what, raise) {
10583
+ if (raise <= maxRaiseFactor) return;
10584
+ throw new NodeError(`Node reports parameters raising ${what} ${Math.round(raise)} times above the one of the SDK` + ` release, more than the ${maxRaiseFactor} times the SDK considers plausible. Provide` + ' `protocolParameters` in options to build a transaction against these parameters anyway.');
10585
+ }
10586
+
10587
+ /**
10588
+ * Refuses the parameters if node reports values far above the ones of the SDK release, and returns
10589
+ * the factors the two products a transaction costs may be raised by — see {@link ParameterRaises}.
10590
+ */
10591
+ function checkParametersNotExcessive(parameters) {
10592
+ const d = defaultProtocolParameters;
10593
+ const defaultMinGasPrice = Number(d.minGasPrice);
10594
+ // a gas price of 0 makes every fee 0 — the network would reject the transaction, and the
10595
+ // `minFee / minGasPrice` of the demand-based fee is a division by zero
10596
+ if (parameters.minGasPrice < 1n) {
10597
+ throw new NodeError(`Node reports the minimum gas price as ${parameters.minGasPrice}, a transaction can't be` + ' priced against it. Provide `protocolParameters` in options to build a transaction' + ' against these parameters anyway.');
10598
+ }
10599
+ // both raise the gas price the fee is counted from: the consensus minimum directly, the miner
10600
+ // minimum as the floor `getCachedIncreasedGasPrice` lifts the gas price to. Bounding the miner
10601
+ // minimum on its own — as this used to — leaves node the product of the two to raise the fee by.
10602
+ const gasPriceRaise = maxOf([checkNotExcessive('the minimum gas price', parameters.minGasPrice, defaultMinGasPrice), checkNotExcessive('the miner minimum gas price', parameters.minMinerGasPrice, defaultMinGasPrice)]);
10603
+
10604
+ // every one of these is a gas amount the fee is counted from, the biggest raise among them is
10605
+ // the most a transaction's gas can grow by
10606
+ const gasRaises = [checkNotExcessive('the gas per byte', parameters.gasPerByte, d.gasPerByte)];
10607
+ Object.entries(parameters.txBaseGas).forEach(([tag, gas]) => {
10608
+ // against the default of this very type and not against the biggest default of all types: a
10609
+ // `ChannelForceProgressTx` costs 30 times a `SpendTx`, that is not a budget for a `SpendTx`
10610
+ gasRaises.push(checkNotExcessive(`the base gas of ${Tag[+tag]}`, gas, defaultBaseGasOf(+tag)));
10611
+ });
10612
+ Object.entries(parameters.contractTxBaseGas).forEach(([tag, byAbiVersion]) => {
10613
+ const sdkValue = defaultBaseGasOf(+tag);
10614
+ Object.entries(byAbiVersion).forEach(([abiVersion, gas]) => {
10615
+ const name = `the base gas of ${Tag[+tag]} at abi version ${abiVersion}`;
10616
+ gasRaises.push(checkNotExcessive(name, gas, sdkValue));
10617
+ });
10618
+ });
10619
+ const defaultStateGasRatio = defaultStateGasPerBlock.part / defaultStateGasPerBlock.whole;
10620
+ Object.entries(parameters.stateGasPerBlock).forEach(([tag, fraction]) => {
10621
+ const name = `the state gas per block of ${Tag[+tag]}`;
10622
+ gasRaises.push(checkRatioNotExcessive(name, fraction, defaultStateGasRatio));
10623
+ });
10624
+
10625
+ // the minimum fee is `gasPrice * (baseGas + size * gasPerByte + stateGas)`, so each product is
10626
+ // bounded rather than each parameter — otherwise node could combine them into a fee
10627
+ // `maxRaiseFactor` squared above the one of the SDK release
10628
+ const feeGasRaise = maxOf(gasRaises);
10629
+ checkRaiseNotExcessive('the minimum transaction fee', gasPriceRaise * feeGasRaise);
10630
+
10631
+ // the two bound different transaction types, but both are a gas limit multiplied by the same
10632
+ // gas price — the bigger of them is what the worst case costs
10633
+ const blockGasLimitRaise = checkNotExcessive('the block gas limit', parameters.blockGasLimit, d.blockGasLimit);
10634
+ const maxAuthFunGasRaise = checkNotExcessive('the max auth fun gas', parameters.maxAuthFunGas, d.maxAuthFunGas);
10635
+ const gasLimitRaise = maxOf([blockGasLimitRaise, maxAuthFunGasRaise]);
10636
+ checkRaiseNotExcessive('the cost of a contract transaction', gasPriceRaise * gasLimitRaise);
10637
+
10638
+ // the gas above is multiplied by a gas price that doesn't come from these parameters, and that
10639
+ // is bounded on its own — so the raises are reported to lower those bounds by the same factors,
10640
+ // see `getGasPriceDivisor` and `getGasLimitDivisor`
10641
+ return {
10642
+ fee: maxOf([1, feeGasRaise]),
10643
+ blockGasLimit: maxOf([1, blockGasLimitRaise]),
10644
+ maxAuthFunGas: maxOf([1, maxAuthFunGasRaise])
10645
+ };
10646
+ }
10647
+
10648
+ /**
10649
+ * Factor the gas price ceiling of `gas-price.ts` is lowered by, so that the worst case fee doesn't
10650
+ * become the product of that ceiling and the fee gas bound of {@link convertProtocolParameters}.
10651
+ * The gas limit raise is charged to the gas limit default instead ({@link getGasLimitDivisor}).
10652
+ * It is 1 unless the parameters came from node.
10653
+ *
10654
+ * The biggest raise among all transaction types, not the one of the type being built — so a node
10655
+ * repricing one type lowers the ceiling for every type. The ceiling is 100000 times the minimum
10656
+ * gas price, far above the demand-based price this bounds in practice.
10657
+ * @param parameters - Parameters a transaction is built against
10658
+ */
10659
+ function getGasPriceDivisor(parameters) {
10660
+ var _parameterRaises$get$;
10661
+ return (_parameterRaises$get$ = parameterRaises.get(parameters)?.fee) !== null && _parameterRaises$get$ !== void 0 ? _parameterRaises$get$ : 1;
10662
+ }
10663
+
10664
+ /**
10665
+ * The cost of a contract transaction is `gasPrice * gasLimit`, and the gas limit the SDK defaults
10666
+ * to comes from `blockGasLimit` — from `maxAuthFunGas` on a `GaMetaTx`. This is the factor node
10667
+ * raises the one `tag` reads by, so that lowering the default by it keeps the product within the
10668
+ * one of the SDK release. It is 1 unless the parameters came from node.
10669
+ *
10670
+ * Only the limit `tag` reads: charging the other one would shrink a gas limit because node raised
10671
+ * something that transaction never reads. The fee gas raise is charged to the gas price ceiling
10672
+ * ({@link getGasPriceDivisor}) instead.
10673
+ * @param parameters - Parameters a transaction is built against
10674
+ * @param tag - Type of the transaction the gas limit is defaulted for
10675
+ */
10676
+ function getGasLimitDivisor(parameters, tag) {
10677
+ const raises = parameterRaises.get(parameters);
10678
+ if (raises == null) return 1;
10679
+ return tag === Tag.GaMetaTx ? raises.maxAuthFunGas : raises.blockGasLimit;
10680
+ }
10681
+ function mapByTxType(entries, map) {
10682
+ return Object.fromEntries(entries.map(([txType, value]) => [getTag(txType), map(value)])
10683
+ // a transaction type the SDK doesn't implement, or won't ever build (`ChannelClientReconnectTx`)
10684
+ .filter(entry => entry[0] != null));
10685
+ }
10686
+
10687
+ /**
10688
+ * Converts the node responses to the shape the transaction builder uses, rejecting values far
10689
+ * above the ones the SDK was released with. Not a part of the public api, it is exported for
10690
+ * tests — use {@link getCachedProtocolParameters}.
10691
+ * @param response - Response of the `/v3/protocol-parameters` endpoint
10692
+ * @param nodeSettings - Response of the `/v3/node-settings` endpoint
10693
+ */
10694
+ function convertProtocolParameters(response, nodeSettings) {
10695
+ const {
10696
+ currentProtocolVersion,
10697
+ protocols
10698
+ } = response;
10699
+ const protocol = protocols.find(({
10700
+ version
10701
+ }) => version === currentProtocolVersion);
10702
+ if (protocol == null) {
10703
+ throw new InternalError(`Node doesn't provide parameters of the current protocol ${currentProtocolVersion}`);
10704
+ }
10705
+
10706
+ // starts from the values of the SDK release so that a type or an abi version node doesn't report
10707
+ // keeps building against them, as the SDK did before this endpoint existed, instead of failing
10708
+ const contractTxBaseGas = Object.fromEntries(Object.entries(defaultProtocolParameters.contractTxBaseGas).map(([tag, byAbiVersion]) => [tag, {
10709
+ ...byAbiVersion
10710
+ }]));
10711
+ protocol.contractTxBaseGas.forEach(({
10712
+ txType,
10713
+ abiVersion,
10714
+ txBaseGas
10715
+ }) => {
10716
+ var _contractTxBaseGas$ta;
10717
+ const tag = getTag(txType);
10718
+ // node controls `abiVersion` and the api client passes a value that doesn't match the schema
10719
+ // node declares for it through unchanged. A `__proto__` key would be written into the
10720
+ // prototype: invisible to the `Object.values` of the check below, and still returned by the
10721
+ // `byAbiVersion[abiVersion]` lookup the fee is calculated from
10722
+ if (tag == null || !Number.isInteger(abiVersion)) return;
10723
+ const byAbiVersion = (_contractTxBaseGas$ta = contractTxBaseGas[tag]) !== null && _contractTxBaseGas$ta !== void 0 ? _contractTxBaseGas$ta : contractTxBaseGas[tag] = {};
10724
+ byAbiVersion[abiVersion] = txBaseGas;
10725
+ });
10726
+ const reportedTxBaseGas = mapByTxType(Object.entries(protocol.txBaseGas), gas => gas);
10727
+ const parameters = freezeParameters({
10728
+ minGasPrice: protocol.minimumGasPrice,
10729
+ minMinerGasPrice: nodeSettings.minMinerGasPrice,
10730
+ gasPerByte: protocol.gasPerByte,
10731
+ blockGasLimit: nodeSettings.blockGasLimit,
10732
+ maxAuthFunGas: nodeSettings.maxAuthFunGas,
10733
+ txBaseGas: {
10734
+ // see the note on `contractTxBaseGas` above
10735
+ ...defaultProtocolParameters.txBaseGas,
10736
+ ...reportedTxBaseGas
10737
+ },
10738
+ contractTxBaseGas,
10739
+ stateGasPerBlock: {
10740
+ // see the note on `contractTxBaseGas` above
10741
+ ...defaultProtocolParameters.stateGasPerBlock,
10742
+ ...mapByTxType(Object.entries(protocol.stateGasPerBlock), fraction => ({
10743
+ part: fraction.part,
10744
+ whole: fraction.whole
10745
+ }))
10746
+ }
10747
+ });
10748
+ parameterRaises.set(parameters, checkParametersNotExcessive(parameters));
10749
+ return parameters;
10750
+ }
10751
+ const cache = new WeakMap();
10752
+ // protocol parameters change on a hard fork, or when the node operator edits the node config,
10753
+ // neither happens often enough to justify a request per transaction built
10754
+ const cacheTtl = 10 * 60 * 1000;
10755
+ // a node that can't be reached, or that reports parameters the SDK refuses to build against, may
10756
+ // be reachable or reconfigured in a moment — don't keep the whole `cacheTtl` worth of transactions
10757
+ // building against the parameters of the SDK release, or failing, because of one bad response.
10758
+ // Still cached rather than retried per transaction: both outcomes cost a round trip to reproduce.
10759
+ const transientCacheTtl = 30 * 1000;
10760
+
10761
+ /**
10762
+ * Requests protocol parameters from node, the result is cached per node instance.
10763
+ *
10764
+ * Falls back to {@link defaultProtocolParameters} for a node that doesn't provide the endpoints,
10765
+ * can't be reached, or answers something this SDK release can't read. Rejects only when node
10766
+ * reports parameters that would price a transaction far above the SDK release — see
10767
+ * {@link ProtocolParametersOption} for the way out of that.
10768
+ *
10769
+ * The cache is keyed by the `Node` object, so code that constructs a `Node` per request (a
10770
+ * serverless handler, an edge worker) requests the parameters again for each one. Keep one `Node`
10771
+ * instance per endpoint to get the benefit of the cache.
10772
+ * @category transaction builder
10773
+ * @param nodeOrProxy - Node to request the parameters from
10774
+ */
10775
+ async function getCachedProtocolParameters(nodeOrProxy) {
10776
+ const node = unwrapProxy(nodeOrProxy);
10777
+ const entry = cache.get(node);
10778
+ if (entry != null && entry.expiresAt > Date.now()) return entry.parameters;
10779
+
10780
+ // node is expected to respond with 404 until it gets the endpoints, and a node whose operator
10781
+ // disabled the `node_info`/`node_settings` endpoint groups with 403 — neither changes within
10782
+ // `cacheTtl`, while anything else is worth asking again about sooner
10783
+ let ttl = cacheTtl;
10784
+ // the request and the conversion both run in here so that only a deliberate refusal — a
10785
+ // `NodeError` on implausible parameters — comes out as a rejection; anything unreadable falls
10786
+ // back to the parameters of the SDK release instead of making every transaction unbuildable
10787
+ const parameters = (async () => {
10788
+ const fallBack = reason => {
10789
+ ttl = transientCacheTtl;
10790
+ console.warn("Can't get protocol parameters from node, using the ones of the SDK release instead." + ' A transaction may be rejected if this node runs other parameters.' + ` Reason: ${reason instanceof Error ? reason.message : String(reason)}`);
10791
+ return defaultProtocolParameters;
10792
+ };
10793
+
10794
+ // a node object without the methods (a test double, another SDK copy's `Node`) won't grow
10795
+ // them within `transientCacheTtl` — treat like the 404 of an old node: full-interval cache,
10796
+ // and no warning per 30 seconds for the life of the process
10797
+ if (typeof node.getProtocolParameters !== 'function' || typeof node.getNodeSettings !== 'function') {
10798
+ return defaultProtocolParameters;
10799
+ }
10800
+
10801
+ // retrying the 404 on every transaction built would only add latency
10802
+ const noRetry = {
10803
+ requestOptions: {
10804
+ customHeaders: {
10805
+ '__no-retry': 'true'
10806
+ }
10807
+ }
10808
+ };
10809
+ let response;
10810
+ let nodeSettings;
10811
+ try {
10812
+ // consensus parameters and this node's own policy are two endpoints, and a transaction is
10813
+ // priced by both — requested together so that a build waits for one round trip and not two,
10814
+ // and taken as a set: parameters half from node and half from the SDK release would be
10815
+ // neither ones node accepts nor ones the SDK was tested against
10816
+ [response, nodeSettings] = await Promise.all([node.getProtocolParameters(noRetry), node.getNodeSettings(noRetry)]);
10817
+ } catch (error) {
10818
+ // the 404/403 of the note above — neither is worth a warning, or an earlier retry.
10819
+ // Read off the error rather than through `instanceof RestError`: that would import
10820
+ // `@azure/core-rest-pipeline` as a value into the transaction builder, which is otherwise
10821
+ // free of it, and pull the http stack into the bundle of an application that only packs
10822
+ // transactions. The api client is the only thing that rejects here, and it sets this
10823
+ const {
10824
+ statusCode
10825
+ } = error;
10826
+ if (statusCode === 404 || statusCode === 403) return defaultProtocolParameters;
10827
+ // node is syncing (503), a proxy in between is down, the request timed out
10828
+ return fallBack(error);
10829
+ }
10830
+ try {
10831
+ return convertProtocolParameters(response, nodeSettings);
10832
+ } catch (error) {
10833
+ // node reports parameters that would price a transaction far above the SDK release — falling
10834
+ // back would build a transaction this node rejects, so the caller is told to decide instead
10835
+ if (error instanceof NodeError) throw error;
10836
+ return fallBack(error);
10837
+ }
10838
+ })();
10839
+
10840
+ // until it settles the entry keeps concurrent builds on this one request
10841
+ const cacheEntry = {
10842
+ expiresAt: Date.now() + cacheTtl,
10843
+ parameters
10844
+ };
10845
+ parameters.then(() => {
10846
+ cacheEntry.expiresAt = Date.now() + ttl;
10847
+ },
10848
+ // see `transientCacheTtl`
10849
+ () => {
10850
+ cacheEntry.expiresAt = Date.now() + transientCacheTtl;
10851
+ });
10852
+ cache.set(node, cacheEntry);
10853
+ return parameters;
10854
+ }
10223
10855
  ;// ./src/tx/builder/field-types/gas-price.ts
10224
10856
 
10225
10857
 
10226
10858
 
10227
10859
 
10228
10860
 
10861
+
10862
+
10229
10863
  const gasPriceCache = new WeakMap();
10230
- async function getCachedIncreasedGasPrice(node) {
10231
- const cache = gasPriceCache.get(node);
10232
- if (cache != null && cache.time > Date.now() - 20 * 1000) {
10233
- return cache.gasPrice;
10864
+
10865
+ // the ceiling is based on the gas price of the SDK release and not on the one node reports, so
10866
+ // that node can't raise its own limit — a node asking for more than the ceiling gets an
10867
+ // underpriced transaction rather than the user an unbounded fee. Max microblock fee is 600ae or
10868
+ // 35usd, counted with the gas of the SDK release — see `getGasPriceDivisor`
10869
+ const maxSafeGasPrice = defaultProtocolParameters.minGasPrice * 100000n;
10870
+
10871
+ /**
10872
+ * Gas price the recent demand of the network suggests, cached per node. Depends on the network
10873
+ * only — the miner floor is applied by the caller, so that a caller providing its own
10874
+ * {@link ProtocolParameters} doesn't put a gas price based on them into a cache others share.
10875
+ *
10876
+ * The request is cached rather than its result, and this body has no `await` before registering
10877
+ * it: `buildTxAsync` prepares fields concurrently, so `fee.prepare` and `gasPrice.prepare` both
10878
+ * ask before either could write a result, and sharing the promise keeps that one round trip.
10879
+ */
10880
+ function getCachedDemandGasPrice(node) {
10881
+ const cached = gasPriceCache.get(node);
10882
+ if (cached != null && cached.time > Date.now() - 20 * 1000) {
10883
+ return cached;
10234
10884
  }
10235
- const {
10236
- minGasPrice,
10237
- utilization
10238
- } = (await node.getRecentGasPrices())[0];
10239
- let gasPrice = utilization < 70 ? 0n : BigInt(new (external_bignumber_js_default())(minGasPrice.toString()).times(1.01).integerValue().toFixed());
10240
- const maxSafeGasPrice = BigInt(MIN_GAS_PRICE) * 100000n; // max microblock fee is 600ae or 35usd
10241
- if (gasPrice > maxSafeGasPrice) {
10242
- console.warn(`Estimated gas price ${gasPrice} exceeds the maximum safe value for unknown reason.` + ` It will be limited to ${maxSafeGasPrice}.` + ' To overcome this restriction provide `gasPrice`/`fee` in options.');
10243
- gasPrice = maxSafeGasPrice;
10244
- }
10245
- gasPriceCache.set(node, {
10885
+ const gasPrice = (async () => {
10886
+ const {
10887
+ minGasPrice,
10888
+ utilization
10889
+ } = (await node.getRecentGasPrices())[0];
10890
+ const price = utilization < 70 ? 0n : BigInt(new (external_bignumber_js_default())(minGasPrice.toString()).times(1.01).integerValue().toFixed());
10891
+ if (price <= maxSafeGasPrice) return price;
10892
+ console.warn(`Estimated gas price ${price} exceeds the maximum safe value for unknown reason.` + ` It will be limited to ${maxSafeGasPrice}.` + ' To overcome this restriction provide `gasPrice`/`fee` in options.');
10893
+ return maxSafeGasPrice;
10894
+ })();
10895
+ const entry = {
10246
10896
  gasPrice,
10247
10897
  time: Date.now()
10898
+ };
10899
+ gasPriceCache.set(node, entry);
10900
+ gasPrice.then(() => {
10901
+ // the interval is about how long the value stays representative, and it starts when the
10902
+ // value is known — stamping the request instead would shorten it by the round trip, and on
10903
+ // a link slower than the interval every build would open a request of its own
10904
+ entry.time = Date.now();
10905
+ },
10906
+ // a request that failed may succeed on the next transaction built, and a gas price that can't
10907
+ // be requested fails the build — unlike `getCachedProtocolParameters`, which caches its
10908
+ // failures because it falls back to the parameters of the SDK release and the build goes on
10909
+ () => {
10910
+ if (gasPriceCache.get(node) === entry) gasPriceCache.delete(node);
10248
10911
  });
10912
+ return entry;
10913
+ }
10914
+ async function getCachedIncreasedGasPrice(nodeOrProxy, parameters) {
10915
+ const node = unwrapProxy(nodeOrProxy);
10916
+ const demandEntry = getCachedDemandGasPrice(node);
10917
+ // the caller may have been given the parameters to build against, requesting them from node
10918
+ // would both waste a request and ignore the `minMinerGasPrice` it was asked to use
10919
+ const [protocolParameters, demandGasPrice] = await Promise.all([parameters !== null && parameters !== void 0 ? parameters : getCachedProtocolParameters(node), demandEntry.gasPrice]);
10920
+ let gasPrice = demandGasPrice;
10921
+
10922
+ // 0n means "the consensus minimum", it is below what the miner of this node accepts
10923
+ const minerFloor = protocolParameters.minMinerGasPrice > protocolParameters.minGasPrice ? protocolParameters.minMinerGasPrice : 0n;
10924
+ if (gasPrice < minerFloor) gasPrice = minerFloor;
10925
+
10926
+ // the ceiling goes down by the factor the parameters raise the fee gas by — see
10927
+ // `getGasPriceDivisor`. Counted in thousandths so that a hard fork raising the gas a few percent
10928
+ // lowers the ceiling a few percent, rather than halving it by rounding the factor up
10929
+ const gasRaise = BigInt(Math.ceil(getGasPriceDivisor(protocolParameters) * 1000));
10930
+ // this can't cut the miner floor applied above: `checkParametersNotExcessive` bounds the miner
10931
+ // minimum times the fee gas raise by `maxRaiseFactor`, and the ceiling is 100 times
10932
+ // `maxRaiseFactor` above the minimum gas price, so it stays 100 times above the floor
10933
+ const ceiling = maxSafeGasPrice * 1000n / gasRaise;
10934
+ if (gasPrice > ceiling) {
10935
+ if (gasRaise > 1000n && demandEntry.ceilingWarned !== true) {
10936
+ demandEntry.ceilingWarned = true;
10937
+ console.warn(`Estimated gas price ${gasPrice} exceeds the maximum safe value ${ceiling} for the` + ' protocol parameters node reports. It will be limited to it, so the transaction may be' + ' not mined while the demand stays above it. To overcome this restriction provide' + ' `gasPrice`/`fee`, or `protocolParameters` in options.');
10938
+ }
10939
+ gasPrice = ceiling;
10940
+ }
10249
10941
  return gasPrice;
10250
10942
  }
10251
10943
 
@@ -10254,21 +10946,27 @@ async function getCachedIncreasedGasPrice(node) {
10254
10946
  ...coin_amount,
10255
10947
  async prepare(value, params, {
10256
10948
  onNode,
10257
- denomination
10949
+ denomination,
10950
+ protocolParameters
10258
10951
  }) {
10259
10952
  if (value != null) return value;
10260
10953
  if (onNode == null) {
10261
10954
  throw new ArgumentError('onNode', 'provided (or provide `gasPrice` instead)', onNode);
10262
10955
  }
10263
- const gasPrice = await getCachedIncreasedGasPrice(onNode);
10956
+ const gasPrice = await getCachedIncreasedGasPrice(onNode, protocolParameters);
10264
10957
  if (gasPrice === 0n) return undefined;
10265
10958
  return formatAmount(gasPrice, {
10266
10959
  targetDenomination: denomination
10267
10960
  });
10268
10961
  },
10269
- serializeAettos(value = MIN_GAS_PRICE.toString()) {
10270
- if (+value < MIN_GAS_PRICE) {
10271
- throw new IllegalArgumentError(`Gas price ${value.toString()} must be bigger than ${MIN_GAS_PRICE}`);
10962
+ serializeAettos(value, params, {
10963
+ protocolParameters = defaultProtocolParameters
10964
+ }) {
10965
+ const minGasPrice = protocolParameters.minGasPrice.toString();
10966
+ if (value == null) return minGasPrice;
10967
+ if (params[serializeAsIsParam] === true) return value;
10968
+ if (new (external_bignumber_js_default())(value).lt(minGasPrice)) {
10969
+ throw new IllegalArgumentError(`Gas price ${value} must be bigger than ${minGasPrice}`);
10272
10970
  }
10273
10971
  return value;
10274
10972
  }
@@ -10282,67 +10980,65 @@ async function getCachedIncreasedGasPrice(node) {
10282
10980
 
10283
10981
 
10284
10982
 
10285
- const BASE_GAS = 15000;
10286
- const GAS_PER_BYTE = 20;
10287
- const KEY_BLOCK_INTERVAL = 3;
10983
+
10288
10984
 
10289
10985
  /**
10290
- * Calculate the base gas
10986
+ * Get the base gas
10291
10987
  * @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}
10292
- * @param txType - The transaction type
10988
+ * @param txObject - The unpacked transaction
10989
+ * @param protocolParameters - The protocol parameters
10293
10990
  * @returns The base gas
10294
- * @example
10295
- * ```js
10296
- * TX_BASE_GAS(Tag.ChannelForceProgressTx) => 30 * 15000
10297
- * ```
10298
10991
  */
10299
- const TX_BASE_GAS = txType => {
10300
- var _feeFactors;
10301
- const feeFactors = {
10302
- [Tag.ChannelForceProgressTx]: 30,
10303
- [Tag.ChannelOffChainTx]: 0,
10304
- [Tag.ContractCreateTx]: 5,
10305
- [Tag.ContractCallTx]: 12,
10306
- [Tag.GaAttachTx]: 5,
10307
- [Tag.GaMetaTx]: 5,
10308
- [Tag.PayingForTx]: 1 / 5
10309
- };
10310
- const factor = (_feeFactors = feeFactors[txType]) !== null && _feeFactors !== void 0 ? _feeFactors : 1;
10311
- return factor * BASE_GAS;
10312
- };
10992
+ function getTxBaseGas(txObject, protocolParameters) {
10993
+ const {
10994
+ tag
10995
+ } = txObject;
10996
+ const byAbiVersion = protocolParameters.contractTxBaseGas[tag];
10997
+ if (byAbiVersion != null) {
10998
+ var _txObject$ctVersion$a;
10999
+ const abiVersion = (_txObject$ctVersion$a = txObject.ctVersion?.abiVersion) !== null && _txObject$ctVersion$a !== void 0 ? _txObject$ctVersion$a : txObject.abiVersion;
11000
+ // read only what the checks in `protocol-parameters.ts` iterate, so that the two can't
11001
+ // disagree about what the parameters hold — anything inherited is not a base gas
11002
+ const gas = Object.prototype.hasOwnProperty.call(byAbiVersion, abiVersion) ? byAbiVersion[abiVersion] : undefined;
11003
+ if (gas != null) return gas;
11004
+ // node charges the maximum base gas for an abi version it doesn't know
11005
+ const knownAbiVersions = Object.values(byAbiVersion);
11006
+ // the maximum of nothing is `-Infinity`, fall through to `txBaseGas` instead
11007
+ if (knownAbiVersions.length !== 0) return maxOf(knownAbiVersions);
11008
+ }
11009
+ const gas = protocolParameters.txBaseGas[tag];
11010
+ if (gas == null) throw new InternalError(`Base gas of ${Tag[tag]} is not known`);
11011
+ return gas;
11012
+ }
10313
11013
 
10314
11014
  /**
10315
11015
  * Calculate gas for other types of transactions
10316
11016
  * @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}
10317
11017
  * @param txType - The transaction type
10318
11018
  * @param txSize - The transaction size
10319
- * @returns parameters - The transaction parameters
10320
- * @returns parameters.relativeTtl - The relative ttl
10321
- * @returns parameters.innerTxSize - The size of the inner transaction
11019
+ * @param parameters - The transaction parameters
11020
+ * @param parameters.relativeTtl - The relative ttl
11021
+ * @param parameters.innerTxSize - The size of the inner transaction
11022
+ * @param protocolParameters - The protocol parameters
10322
11023
  * @returns The other gas
10323
- * @example
10324
- * ```js
10325
- * TX_OTHER_GAS(Tag.OracleRespondTx, 10, { relativeTtl: 12, innerTxSize: 0 })
10326
- * => 10 * 20 + Math.ceil(32000 * 12 / Math.floor(60 * 24 * 365 / 3))
10327
- * ```
10328
11024
  */
10329
- const TX_OTHER_GAS = (txType, txSize, {
11025
+ function getTxOtherGas(txType, txSize, {
10330
11026
  relativeTtl,
10331
11027
  innerTxSize
10332
- }) => {
10333
- switch (txType) {
10334
- case Tag.OracleRegisterTx:
10335
- case Tag.OracleExtendTx:
10336
- case Tag.OracleQueryTx:
10337
- case Tag.OracleRespondTx:
10338
- return txSize * GAS_PER_BYTE + Math.ceil(32000 * relativeTtl / Math.floor(60 * 24 * 365 / KEY_BLOCK_INTERVAL));
10339
- case Tag.GaMetaTx:
10340
- case Tag.PayingForTx:
10341
- return (txSize - innerTxSize) * GAS_PER_BYTE;
10342
- default:
10343
- return txSize * GAS_PER_BYTE;
10344
- }
10345
- };
11028
+ }, protocolParameters) {
11029
+ const {
11030
+ gasPerByte
11031
+ } = protocolParameters;
11032
+ // the inner transaction of a meta transaction pays for its own bytes in its own fee. The
11033
+ // deduction is separate from the state gas below: node reporting a state gas fraction for
11034
+ // `GaMetaTx`/`PayingForTx` must not cancel it — that would charge the inner transaction twice
11035
+ const isMeta = txType === Tag.GaMetaTx || txType === Tag.PayingForTx;
11036
+ const sizeGas = (isMeta ? txSize - innerTxSize : txSize) * gasPerByte;
11037
+ // oracle transactions pay a state rent for the time their entry occupies the state tree
11038
+ const stateGas = protocolParameters.stateGasPerBlock[txType];
11039
+ if (stateGas == null) return sizeGas;
11040
+ return sizeGas + Math.ceil(stateGas.part * relativeTtl / stateGas.whole);
11041
+ }
10346
11042
  function getOracleRelativeTtl(params) {
10347
11043
  const ttlKeys = {
10348
11044
  [Tag.OracleRegisterTx]: 'oracleTtlValue',
@@ -10360,19 +11056,25 @@ function getOracleRelativeTtl(params) {
10360
11056
  /**
10361
11057
  * Calculate gas based on tx type and params
10362
11058
  */
10363
- function buildGas(builtTx, unpackTx, buildTx) {
11059
+ function buildGas(builtTx, unpackTx, buildTx, protocolParameters) {
10364
11060
  const {
10365
11061
  length
10366
11062
  } = decode(builtTx);
10367
11063
  const txObject = unpackTx(builtTx);
10368
11064
  let innerTxSize = 0;
10369
11065
  if (txObject.tag === Tag.GaMetaTx || txObject.tag === Tag.PayingForTx) {
10370
- innerTxSize = decode(buildTx(txObject.tx.encodedTx)).length;
11066
+ // this rebuild only measures the size of an already signed inner transaction, its values are
11067
+ // serialized as they are — see `serializeAsIsParam`
11068
+ const innerTx = {
11069
+ ...txObject.tx.encodedTx,
11070
+ [serializeAsIsParam]: true
11071
+ };
11072
+ innerTxSize = decode(buildTx(innerTx)).length;
10371
11073
  }
10372
- return TX_BASE_GAS(txObject.tag) + TX_OTHER_GAS(txObject.tag, length, {
11074
+ return getTxBaseGas(txObject, protocolParameters) + getTxOtherGas(txObject.tag, length, {
10373
11075
  relativeTtl: getOracleRelativeTtl(txObject),
10374
11076
  innerTxSize
10375
- });
11077
+ }, protocolParameters);
10376
11078
  }
10377
11079
 
10378
11080
  /**
@@ -10380,12 +11082,13 @@ function buildGas(builtTx, unpackTx, buildTx) {
10380
11082
  * @category transaction builder
10381
11083
  * @param rebuildTx - Callback to get built transaction with specific fee
10382
11084
  */
10383
- function calculateMinFee(rebuildTx, unpackTx, buildTx) {
11085
+ function calculateMinFee(rebuildTx, unpackTx, buildTx, protocolParameters) {
11086
+ const minGasPrice = new (external_bignumber_js_default())(protocolParameters.minGasPrice.toString());
10384
11087
  let fee = new (external_bignumber_js_default())(0);
10385
11088
  let previousFee;
10386
11089
  do {
10387
11090
  previousFee = fee;
10388
- fee = new (external_bignumber_js_default())(MIN_GAS_PRICE).times(buildGas(rebuildTx(fee), unpackTx, buildTx));
11091
+ fee = minGasPrice.times(buildGas(rebuildTx(fee), unpackTx, buildTx, protocolParameters));
10389
11092
  } while (!fee.eq(previousFee));
10390
11093
  return fee;
10391
11094
  }
@@ -10397,29 +11100,33 @@ const gasPricePrefix = '_gas-price:';
10397
11100
  /* harmony default export */ const fee = ({
10398
11101
  ...coin_amount,
10399
11102
  async prepare(value, params, {
10400
- onNode
11103
+ onNode,
11104
+ protocolParameters
10401
11105
  }) {
10402
11106
  if (value != null) return value;
10403
11107
  if (onNode == null) {
10404
11108
  throw new ArgumentError('onNode', 'provided (or provide `fee` instead)', onNode);
10405
11109
  }
10406
- const gasPrice = await getCachedIncreasedGasPrice(onNode);
11110
+ const gasPrice = await getCachedIncreasedGasPrice(onNode, protocolParameters);
10407
11111
  if (gasPrice === 0n) return undefined;
10408
11112
  return gasPricePrefix + gasPrice;
10409
11113
  },
10410
- serializeAettos(_value, {
10411
- rebuildTx,
10412
- unpackTx,
10413
- buildTx,
10414
- _computingMinFee
10415
- }, {
10416
- _canIncreaseFee
11114
+ serializeAettos(_value, params, {
11115
+ _canIncreaseFee,
11116
+ protocolParameters = defaultProtocolParameters
10417
11117
  }) {
11118
+ const {
11119
+ rebuildTx,
11120
+ unpackTx,
11121
+ buildTx,
11122
+ _computingMinFee
11123
+ } = params;
10418
11124
  if (_computingMinFee != null) return _computingMinFee.toFixed();
11125
+ if (params[serializeAsIsParam] === true && _value != null) return new (external_bignumber_js_default())(_value).toFixed();
10419
11126
  const minFee = calculateMinFee(fee => rebuildTx({
10420
11127
  _computingMinFee: fee
10421
- }), unpackTx, buildTx);
10422
- const value = _value?.startsWith(gasPricePrefix) === true ? minFee.dividedBy(MIN_GAS_PRICE).times(_value.replace(gasPricePrefix, '')) : new (external_bignumber_js_default())(_value !== null && _value !== void 0 ? _value : minFee);
11128
+ }), unpackTx, buildTx, protocolParameters);
11129
+ const value = _value?.startsWith(gasPricePrefix) === true ? minFee.dividedBy(protocolParameters.minGasPrice.toString()).times(_value.replace(gasPricePrefix, '')) : new (external_bignumber_js_default())(_value !== null && _value !== void 0 ? _value : minFee);
10423
11130
  if (minFee.gt(value)) {
10424
11131
  if (_canIncreaseFee === true) return minFee.toFixed();
10425
11132
  throw new IllegalArgumentError(`Fee ${value.toString()} must be bigger than ${minFee}`);
@@ -10448,26 +11155,37 @@ const gasPricePrefix = '_gas-price:';
10448
11155
 
10449
11156
 
10450
11157
 
10451
- function calculateGasLimitMax(gasMax, rebuildTx, unpackTx, buildTx) {
10452
- return gasMax - +buildGas(rebuildTx(gasMax), unpackTx, buildTx);
11158
+
11159
+
11160
+ function calculateGasLimitMax(gasMax, rebuildTx, unpackTx, buildTx, protocolParameters) {
11161
+ return gasMax - +buildGas(rebuildTx(gasMax), unpackTx, buildTx, protocolParameters);
10453
11162
  }
10454
11163
  /* harmony default export */ const gas_limit = ({
10455
11164
  ...short_u_int,
10456
- serialize(_value, {
10457
- tag,
10458
- rebuildTx,
10459
- unpackTx,
10460
- buildTx,
10461
- _computingGasLimit
10462
- }, {
10463
- gasMax = 6e6
11165
+ serialize(_value, params, {
11166
+ gasMax,
11167
+ protocolParameters = defaultProtocolParameters
10464
11168
  }) {
11169
+ const {
11170
+ tag,
11171
+ rebuildTx,
11172
+ unpackTx,
11173
+ buildTx,
11174
+ _computingGasLimit
11175
+ } = params;
10465
11176
  if (_computingGasLimit != null) return short_u_int.serialize(_computingGasLimit);
10466
- const gasLimitMax = tag === Tag.GaMetaTx ? MAX_AUTH_FUN_GAS : calculateGasLimitMax(gasMax, gasLimit => rebuildTx({
11177
+ if (params[serializeAsIsParam] === true && _value != null) return short_u_int.serialize(_value);
11178
+ const gasLimitMax = tag === Tag.GaMetaTx ? protocolParameters.maxAuthFunGas : calculateGasLimitMax(gasMax !== null && gasMax !== void 0 ? gasMax : protocolParameters.blockGasLimit, gasLimit => rebuildTx({
10467
11179
  _computingGasLimit: gasLimit,
10468
11180
  _canIncreaseFee: true
10469
- }), unpackTx, buildTx);
10470
- const value = _value !== null && _value !== void 0 ? _value : gasLimitMax;
11181
+ }), unpackTx, buildTx, protocolParameters);
11182
+ // node raises the ceiling above through the parameter this tag reads, so the value defaulted
11183
+ // here is lowered by that raise — see `getGasLimitDivisor`. Only the default: a caller passing
11184
+ // `gasLimit`, or capping it with `gasMax`, chose it itself — except on `GaMetaTx`, whose
11185
+ // ceiling is `maxAuthFunGas` and never reads `gasMax`
11186
+ const capped = gasMax != null && tag !== Tag.GaMetaTx;
11187
+ const raise = capped ? 1 : getGasLimitDivisor(protocolParameters, tag);
11188
+ const value = _value !== null && _value !== void 0 ? _value : raise > 1 ? Math.floor(gasLimitMax / raise) : gasLimitMax;
10471
11189
  if (value > gasLimitMax) {
10472
11190
  throw new IllegalArgumentError(`Gas limit ${value} must be less or equal to ${gasLimitMax}`);
10473
11191
  }
@@ -10504,9 +11222,15 @@ function calculateGasLimitMax(gasMax, rebuildTx, unpackTx, buildTx) {
10504
11222
 
10505
11223
 
10506
11224
 
11225
+
10507
11226
  /* harmony default export */ const name_fee = ({
10508
11227
  ...coin_amount,
10509
11228
  serializeAettos(_value, txFields) {
11229
+ // SDK-release table, node reports it as `nameClaimFees` (all zeroes on a protocol that doesn't
11230
+ // enforce it) — skipped on re-serialization, see `serializeAsIsParam`
11231
+ if (txFields[serializeAsIsParam] === true && _value != null) {
11232
+ return new (external_bignumber_js_default())(_value).toFixed();
11233
+ }
10510
11234
  const minNameFee = getMinimumNameFee(txFields.name);
10511
11235
  const value = new (external_bignumber_js_default())(_value !== null && _value !== void 0 ? _value : minNameFee);
10512
11236
  if (minNameFee.gt(value)) throw new InsufficientNameFeeError(value, minNameFee);
@@ -10581,6 +11305,7 @@ function genNonceField(senderKey) {
10581
11305
 
10582
11306
 
10583
11307
 
11308
+
10584
11309
  const ID_TAG = Buffer.from([1]);
10585
11310
  const DATA_TAG = Buffer.from([2]);
10586
11311
  const DATA_LENGTH_MAX = 1024;
@@ -10593,10 +11318,13 @@ const addressAny = genAddressField(...idTagToEncoding);
10593
11318
  * Helper function to build pointers for name update TX
10594
11319
  * @param pointers - Array of pointers
10595
11320
  * `([ { key: 'account_pubkey', id: 'ak_32klj5j23k23j5423l434l2j3423'} ])`
11321
+ * @param params - Transaction params
10596
11322
  * @returns Serialized pointers array
10597
11323
  */
10598
- serialize(pointers) {
10599
- if (pointers.length > 32) {
11324
+ serialize(pointers, params) {
11325
+ // SDK-release limit, node reports it as `namePointersMaxCount` (omitted on a protocol that
11326
+ // imposes no limit) — skipped on re-serialization, see `serializeAsIsParam`
11327
+ if (params[serializeAsIsParam] !== true && pointers.length > 32) {
10600
11328
  throw new IllegalArgumentError(`Expected 32 pointers or less, got ${pointers.length} instead`);
10601
11329
  }
10602
11330
  return pointers.map(({
@@ -10705,11 +11433,15 @@ function genShortUIntConstField(constValue, optional) {
10705
11433
  });
10706
11434
  ;// ./src/tx/builder/field-types/transaction.ts
10707
11435
 
11436
+
10708
11437
  function genTransactionField(tag) {
10709
11438
  return {
10710
- serialize(txParams, {
10711
- buildTx
10712
- }) {
11439
+ nestedTransaction: true,
11440
+ serialize(txParams, options) {
11441
+ const {
11442
+ buildTx,
11443
+ protocolParameters
11444
+ } = options;
10713
11445
  if (ArrayBuffer.isView(txParams)) return Buffer.from(txParams);
10714
11446
  if (typeof txParams === 'string' && txParams.startsWith('tx_')) {
10715
11447
  return decode(txParams);
@@ -10718,6 +11450,17 @@ function genTransactionField(tag) {
10718
11450
  ...txParams,
10719
11451
  ...(tag != null && {
10720
11452
  tag
11453
+ }),
11454
+ // a nested transaction that is not built yet is built against the parameters of the
11455
+ // outer one, otherwise it would be priced by the parameters of the SDK release
11456
+ ...(protocolParameters != null && {
11457
+ protocolParameters
11458
+ }),
11459
+ // a transaction nested in one that is only re-serialized is re-serialized as well —
11460
+ // without this the innermost transaction of a `PayingForTx` wrapping a `GaMetaTx` gets
11461
+ // its already fixed values checked against the parameters of the outermost one
11462
+ ...(options[serializeAsIsParam] === true && {
11463
+ [serializeAsIsParam]: true
10721
11464
  })
10722
11465
  }));
10723
11466
  },
@@ -10777,7 +11520,7 @@ function withFormatting(format, field) {
10777
11520
  return {
10778
11521
  ...field,
10779
11522
  serialize(value, params, options) {
10780
- return field.serialize(format(value), params, options);
11523
+ return field.serialize(format(value, params), params, options);
10781
11524
  }
10782
11525
  };
10783
11526
  }
@@ -10861,6 +11604,7 @@ let EntryTag = /*#__PURE__*/function (EntryTag) {
10861
11604
 
10862
11605
 
10863
11606
 
11607
+
10864
11608
 
10865
11609
 
10866
11610
  /**
@@ -10882,9 +11626,12 @@ const clientTtl = withDefault(60 * 60, short_u_int);
10882
11626
  /**
10883
11627
  * Name ttl represented in number of blocks (Max value is 50000 blocks)
10884
11628
  */
10885
- const nameTtl = withFormatting(value => {
11629
+ const nameTtl = withFormatting((value, params) => {
10886
11630
  const NAME_TTL = 180000;
10887
11631
  value !== null && value !== void 0 ? value : value = NAME_TTL;
11632
+ // SDK-release limit, node reports it as `nameClaimMaxExpiration` — skipped on re-serialization,
11633
+ // see `serializeAsIsParam`
11634
+ if (params[serializeAsIsParam] === true) return value;
10888
11635
  if (value >= 1 && value <= NAME_TTL) return value;
10889
11636
  throw new ArgumentError('nameTtl', `a number between 1 and ${NAME_TTL} blocks`, value);
10890
11637
  }, short_u_int);
@@ -11723,6 +12470,7 @@ const schemas = [{
11723
12470
 
11724
12471
 
11725
12472
 
12473
+
11726
12474
  const encodingTag = [[EntryTag.CallsMtree, Encoding.CallStateTree], [EntryTag.StateTrees, Encoding.StateTrees], [EntryTag.TreesPoi, Encoding.Poi]];
11727
12475
 
11728
12476
  /**
@@ -11734,6 +12482,11 @@ const encodingTag = [[EntryTag.CallsMtree, Encoding.CallStateTree], [EntryTag.St
11734
12482
 
11735
12483
  function packEntry(params) {
11736
12484
  var _encodingTag$find$;
12485
+ // `GaMetaTxAuthData` holds a `gasPrice` priced by them, see the note in `buildTx`
12486
+ const {
12487
+ protocolParameters
12488
+ } = params;
12489
+ if (protocolParameters != null) checkParametersUsable(protocolParameters);
11737
12490
  const encoding = (_encodingTag$find$ = encodingTag.find(([tag]) => tag === params.tag)?.[1]) !== null && _encodingTag$find$ !== void 0 ? _encodingTag$find$ : Encoding.Bytearray;
11738
12491
  return packRecord(schemas, EntryTag, params, {
11739
12492
  packEntry
@@ -11764,6 +12517,8 @@ function unpackEntry(encoded, expectedTag) {
11764
12517
 
11765
12518
 
11766
12519
 
12520
+
12521
+
11767
12522
  /**
11768
12523
  * JavaScript-based Transaction builder
11769
12524
  */
@@ -11777,6 +12532,11 @@ function builder_getSchema(tag, version) {
11777
12532
  * @param params - Transaction params
11778
12533
  */
11779
12534
  function buildTx(params) {
12535
+ // as trusted as `fee` is, see `checkParametersUsable`
12536
+ const {
12537
+ protocolParameters
12538
+ } = params;
12539
+ if (protocolParameters != null) checkParametersUsable(protocolParameters);
11780
12540
  return packRecord(txSchema, Tag, params, {
11781
12541
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
11782
12542
  unpackTx,
@@ -11788,6 +12548,58 @@ function buildTx(params) {
11788
12548
  packEntry: packEntry
11789
12549
  }, Encoding.Transaction);
11790
12550
  }
12551
+
12552
+ /**
12553
+ * Serializes a transaction that already exists — the result of an `unpackTx` — back to its
12554
+ * `tx_`-encoded form.
12555
+ *
12556
+ * Use it instead of `buildTx` for a round trip. The values of such a transaction are fixed, and
12557
+ * belong to the protocol parameters of the node it was built for: a node running a lower minimum
12558
+ * gas price than the SDK release, a hyperchain or a devnet, produces a transaction that plain
12559
+ * `buildTx` would refuse to serialize again because its fee is below the minimum this process
12560
+ * computes. Nothing about it can be changed by re-serializing it, so nothing about it is checked.
12561
+ * @category transaction builder
12562
+ * @param params - Unpacked transaction, as returned by `unpackTx`
12563
+ */
12564
+ function rebuildUnpackedTx(params) {
12565
+ return buildTx({
12566
+ ...params,
12567
+ [serializeAsIsParam]: true
12568
+ });
12569
+ }
12570
+ // the fields the protocol parameters price
12571
+ const parametrizedFields = ['fee', 'gasPrice', 'gasLimit'];
12572
+
12573
+ /**
12574
+ * The parameters are needed to compute a priced value the caller didn't provide, and to check one
12575
+ * it did against what node accepts. A build that provides every priced field of its type, and
12576
+ * nests no transaction that still has to be built, serializes to the same bytes with or without
12577
+ * them — requesting them would turn a build that needs no node into one that waits for it, as it
12578
+ * would for a caller that passes `fee` exactly to avoid the round trip.
12579
+ */
12580
+ function needsProtocolParameters(schema, params) {
12581
+ return schema.some(([key, field]) => {
12582
+ const value = params[key];
12583
+ if (parametrizedFields.includes(key)) return value == null;
12584
+ // a nested transaction that is neither built (`tx_`) nor serialized (a buffer) yet is built
12585
+ // here, and priced by these parameters in turn
12586
+ if (field.nestedTransaction !== true) return false;
12587
+ if (value == null || typeof value === 'string' || ArrayBuffer.isView(value)) return false;
12588
+ // it is built here, but that doesn't mean anything in it is priced — the `SignedTx` wrapping
12589
+ // an already serialized transaction that `AccountGeneralized` nests in its `GaMetaTx` has no
12590
+ // priced field of its own
12591
+ const nested = value;
12592
+ let nestedSchema;
12593
+ try {
12594
+ nestedSchema = builder_getSchema(nested.tag, nested.version);
12595
+ } catch {
12596
+ // an unknown tag or version fails later in `buildTx` with a better message than here
12597
+ return true;
12598
+ }
12599
+ return needsProtocolParameters(nestedSchema, nested);
12600
+ });
12601
+ }
12602
+
11791
12603
  // TODO: require onNode because it is the only reason this builder is async [breaking change]
11792
12604
  /**
11793
12605
  * Build transaction async (may request node for additional data)
@@ -11796,14 +12608,42 @@ function buildTx(params) {
11796
12608
  * @returns tx_-encoded transaction
11797
12609
  */
11798
12610
  async function buildTxAsync(params) {
11799
- await Promise.all(builder_getSchema(params.tag, params.version).map(async ([key, field]) => {
12611
+ var _target$protocolParam;
12612
+ // the caller may build another transaction out of the same object, and `prepare` writing the
12613
+ // value it computed back would make the next build reuse them — the same nonce above all, and a
12614
+ // `fee` that makes it skip the request for the parameters that priced this one
12615
+ const paramsCopy = {
12616
+ ...params
12617
+ };
12618
+ const {
12619
+ onNode
12620
+ } = paramsCopy;
12621
+ const target = paramsCopy;
12622
+ const schema = builder_getSchema(paramsCopy.tag, paramsCopy.version);
12623
+ // `onNode` of an sdk instance is a proxy that is not `null` even when no node is selected, and
12624
+ // dereferencing it throws — a transaction that needs no node is still buildable in that case
12625
+ const node = onNode != null ? unwrapProxyIfPossible(onNode) : undefined;
12626
+ // started before the `prepare` calls below so that it runs in parallel with them: they read the
12627
+ // parameters, but get this very request from the cache it registers synchronously. Below the
12628
+ // `Promise.all` it would make `prepare` the originator and serialize the two requests
12629
+ const parametersPromise = node != null && target.protocolParameters == null && needsProtocolParameters(schema, paramsCopy) ? getCachedProtocolParameters(node) : undefined;
12630
+ // it is awaited after the `prepare` calls below, don't report it as an unhandled rejection if
12631
+ // one of them throws first
12632
+ parametersPromise?.catch(() => {});
12633
+ await Promise.all(schema.map(async ([key, field]) => {
11800
12634
  if (field.prepare == null) return;
11801
- // @ts-expect-error the type of `params[key]` can't be determined accurately
11802
- params[key] = await field.prepare(params[key], params, params);
12635
+ // @ts-expect-error the type of `paramsCopy[key]` can't be determined accurately
12636
+ paramsCopy[key] = await field.prepare(paramsCopy[key], paramsCopy, paramsCopy);
11803
12637
  }));
12638
+ const protocolParameters = (_target$protocolParam = target.protocolParameters) !== null && _target$protocolParam !== void 0 ? _target$protocolParam : await parametersPromise;
11804
12639
 
11805
12640
  // @ts-expect-error after preparation properties should be compatible with sync tx builder
11806
- return buildTx(params);
12641
+ return buildTx({
12642
+ ...paramsCopy,
12643
+ ...(protocolParameters != null && {
12644
+ protocolParameters
12645
+ })
12646
+ });
11807
12647
  }
11808
12648
 
11809
12649
  /**
@@ -12226,6 +13066,9 @@ const SignedTx = {
12226
13066
  }
12227
13067
  },
12228
13068
  hash: {
13069
+ constraints: {
13070
+ Pattern: new RegExp("^th_\\w+$")
13071
+ },
12229
13072
  serializedName: "hash",
12230
13073
  required: true,
12231
13074
  type: {
@@ -12233,6 +13076,9 @@ const SignedTx = {
12233
13076
  }
12234
13077
  },
12235
13078
  encodedTx: {
13079
+ constraints: {
13080
+ Pattern: new RegExp("^tx_[0-9A-Za-z+/=]+$")
13081
+ },
12236
13082
  serializedName: "encoded_tx",
12237
13083
  type: {
12238
13084
  name: "String"
@@ -12244,6 +13090,9 @@ const SignedTx = {
12244
13090
  type: {
12245
13091
  name: "Sequence",
12246
13092
  element: {
13093
+ constraints: {
13094
+ Pattern: new RegExp("^sg_\\w+$")
13095
+ },
12247
13096
  type: {
12248
13097
  name: "String"
12249
13098
  }
@@ -12418,6 +13267,9 @@ const Tx = {
12418
13267
  }
12419
13268
  },
12420
13269
  offchainTrees: {
13270
+ constraints: {
13271
+ Pattern: new RegExp("^ss_[0-9A-Za-z+/=]+$")
13272
+ },
12421
13273
  serializedName: "offchain_trees",
12422
13274
  type: {
12423
13275
  name: "String"
@@ -12444,6 +13296,9 @@ const Tx = {
12444
13296
  }
12445
13297
  },
12446
13298
  poi: {
13299
+ constraints: {
13300
+ Pattern: new RegExp("^pi_[0-9A-Za-z+/=]+$")
13301
+ },
12447
13302
  serializedName: "poi",
12448
13303
  type: {
12449
13304
  name: "String"
@@ -12543,6 +13398,9 @@ const Tx = {
12543
13398
  }
12544
13399
  },
12545
13400
  queryId: {
13401
+ constraints: {
13402
+ Pattern: new RegExp("^oq_\\w+$")
13403
+ },
12546
13404
  serializedName: "query_id",
12547
13405
  type: {
12548
13406
  name: "String"
@@ -12555,6 +13413,9 @@ const Tx = {
12555
13413
  }
12556
13414
  },
12557
13415
  commitmentId: {
13416
+ constraints: {
13417
+ Pattern: new RegExp("^cm_\\w+$")
13418
+ },
12558
13419
  serializedName: "commitment_id",
12559
13420
  type: {
12560
13421
  name: "String"
@@ -12586,6 +13447,9 @@ const Tx = {
12586
13447
  }
12587
13448
  },
12588
13449
  nameId: {
13450
+ constraints: {
13451
+ Pattern: new RegExp("^nm_\\w+$")
13452
+ },
12589
13453
  serializedName: "name_id",
12590
13454
  type: {
12591
13455
  name: "String"
@@ -12630,6 +13494,9 @@ const Tx = {
12630
13494
  }
12631
13495
  },
12632
13496
  code: {
13497
+ constraints: {
13498
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
13499
+ },
12633
13500
  serializedName: "code",
12634
13501
  type: {
12635
13502
  name: "String"
@@ -12676,6 +13543,9 @@ const Tx = {
12676
13543
  }
12677
13544
  },
12678
13545
  callData: {
13546
+ constraints: {
13547
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
13548
+ },
12679
13549
  serializedName: "call_data",
12680
13550
  type: {
12681
13551
  name: "String"
@@ -12709,6 +13579,9 @@ const Tx = {
12709
13579
  }
12710
13580
  },
12711
13581
  authData: {
13582
+ constraints: {
13583
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
13584
+ },
12712
13585
  serializedName: "auth_data",
12713
13586
  type: {
12714
13587
  name: "String"
@@ -12866,6 +13739,9 @@ const NamePointer = {
12866
13739
  }
12867
13740
  },
12868
13741
  encodedKey: {
13742
+ constraints: {
13743
+ Pattern: new RegExp("^ba_[0-9A-Za-z+/=]+$")
13744
+ },
12869
13745
  serializedName: "encoded_key",
12870
13746
  type: {
12871
13747
  name: "String"
@@ -12887,6 +13763,9 @@ const AuctionEntry = {
12887
13763
  className: "AuctionEntry",
12888
13764
  modelProperties: {
12889
13765
  id: {
13766
+ constraints: {
13767
+ Pattern: new RegExp("^nm_\\w+$")
13768
+ },
12890
13769
  serializedName: "id",
12891
13770
  required: true,
12892
13771
  type: {
@@ -13148,6 +14027,9 @@ const ByteCode = {
13148
14027
  className: "ByteCode",
13149
14028
  modelProperties: {
13150
14029
  bytecode: {
14030
+ constraints: {
14031
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
14032
+ },
13151
14033
  serializedName: "bytecode",
13152
14034
  required: true,
13153
14035
  type: {
@@ -13163,6 +14045,9 @@ const PoI = {
13163
14045
  className: "PoI",
13164
14046
  modelProperties: {
13165
14047
  poi: {
14048
+ constraints: {
14049
+ Pattern: new RegExp("^pi_[0-9A-Za-z+/=]+$")
14050
+ },
13166
14051
  serializedName: "poi",
13167
14052
  required: true,
13168
14053
  type: {
@@ -13351,12 +14236,18 @@ const DryRunInputItem = {
13351
14236
  className: "DryRunInputItem",
13352
14237
  modelProperties: {
13353
14238
  tx: {
14239
+ constraints: {
14240
+ Pattern: new RegExp("^tx_[0-9A-Za-z+/=]+$")
14241
+ },
13354
14242
  serializedName: "tx",
13355
14243
  type: {
13356
14244
  name: "String"
13357
14245
  }
13358
14246
  },
13359
14247
  txHash: {
14248
+ constraints: {
14249
+ Pattern: new RegExp("^th_\\w+$")
14250
+ },
13360
14251
  serializedName: "tx_hash",
13361
14252
  type: {
13362
14253
  name: "String"
@@ -13378,6 +14269,9 @@ const DryRunCallReq = {
13378
14269
  className: "DryRunCallReq",
13379
14270
  modelProperties: {
13380
14271
  calldata: {
14272
+ constraints: {
14273
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
14274
+ },
13381
14275
  serializedName: "calldata",
13382
14276
  required: true,
13383
14277
  type: {
@@ -13452,12 +14346,18 @@ const DryRunCallContext = {
13452
14346
  className: "DryRunCallContext",
13453
14347
  modelProperties: {
13454
14348
  tx: {
14349
+ constraints: {
14350
+ Pattern: new RegExp("^tx_[0-9A-Za-z+/=]+$")
14351
+ },
13455
14352
  serializedName: "tx",
13456
14353
  type: {
13457
14354
  name: "String"
13458
14355
  }
13459
14356
  },
13460
14357
  txHash: {
14358
+ constraints: {
14359
+ Pattern: new RegExp("^th_\\w+$")
14360
+ },
13461
14361
  serializedName: "tx_hash",
13462
14362
  type: {
13463
14363
  name: "String"
@@ -13621,6 +14521,9 @@ const ContractCallObject = {
13621
14521
  }
13622
14522
  },
13623
14523
  returnValue: {
14524
+ constraints: {
14525
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
14526
+ },
13624
14527
  serializedName: "return_value",
13625
14528
  required: true,
13626
14529
  type: {
@@ -13667,6 +14570,9 @@ const mappers_Event = {
13667
14570
  }
13668
14571
  },
13669
14572
  data: {
14573
+ constraints: {
14574
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
14575
+ },
13670
14576
  serializedName: "data",
13671
14577
  required: true,
13672
14578
  type: {
@@ -13762,8 +14668,10 @@ const KeyBlock = {
13762
14668
  }
13763
14669
  },
13764
14670
  flags: {
14671
+ constraints: {
14672
+ Pattern: new RegExp("^ba_[0-9A-Za-z+/=]+$")
14673
+ },
13765
14674
  serializedName: "flags",
13766
- required: true,
13767
14675
  type: {
13768
14676
  name: "String"
13769
14677
  }
@@ -13827,6 +14735,9 @@ const KeyBlock = {
13827
14735
  }
13828
14736
  },
13829
14737
  info: {
14738
+ constraints: {
14739
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
14740
+ },
13830
14741
  serializedName: "info",
13831
14742
  required: true,
13832
14743
  type: {
@@ -13893,6 +14804,9 @@ const Header = {
13893
14804
  }
13894
14805
  },
13895
14806
  flags: {
14807
+ constraints: {
14808
+ Pattern: new RegExp("^ba_[0-9A-Za-z+/=]+$")
14809
+ },
13896
14810
  serializedName: "flags",
13897
14811
  type: {
13898
14812
  name: "String"
@@ -13956,12 +14870,18 @@ const Header = {
13956
14870
  }
13957
14871
  },
13958
14872
  info: {
14873
+ constraints: {
14874
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
14875
+ },
13959
14876
  serializedName: "info",
13960
14877
  type: {
13961
14878
  name: "String"
13962
14879
  }
13963
14880
  },
13964
14881
  pofHash: {
14882
+ constraints: {
14883
+ Pattern: new RegExp("^(no_fraud|bf_\\w+)$")
14884
+ },
13965
14885
  serializedName: "pof_hash",
13966
14886
  type: {
13967
14887
  name: "String"
@@ -13974,6 +14894,9 @@ const Header = {
13974
14894
  }
13975
14895
  },
13976
14896
  signature: {
14897
+ constraints: {
14898
+ Pattern: new RegExp("^sg_\\w+$")
14899
+ },
13977
14900
  serializedName: "signature",
13978
14901
  type: {
13979
14902
  name: "String"
@@ -14124,6 +15047,9 @@ const MicroBlockHeader = {
14124
15047
  }
14125
15048
  },
14126
15049
  pofHash: {
15050
+ constraints: {
15051
+ Pattern: new RegExp("^(no_fraud|bf_\\w+)$")
15052
+ },
14127
15053
  serializedName: "pof_hash",
14128
15054
  required: true,
14129
15055
  type: {
@@ -14159,6 +15085,9 @@ const MicroBlockHeader = {
14159
15085
  }
14160
15086
  },
14161
15087
  signature: {
15088
+ constraints: {
15089
+ Pattern: new RegExp("^sg_\\w+$")
15090
+ },
14162
15091
  serializedName: "signature",
14163
15092
  required: true,
14164
15093
  type: {
@@ -14182,6 +15111,15 @@ const MicroBlockHeader = {
14182
15111
  type: {
14183
15112
  name: "Number"
14184
15113
  }
15114
+ },
15115
+ flags: {
15116
+ constraints: {
15117
+ Pattern: new RegExp("^ba_[0-9A-Za-z+/=]+$")
15118
+ },
15119
+ serializedName: "flags",
15120
+ type: {
15121
+ name: "String"
15122
+ }
14185
15123
  }
14186
15124
  }
14187
15125
  }
@@ -14211,6 +15149,9 @@ const NameEntry = {
14211
15149
  className: "NameEntry",
14212
15150
  modelProperties: {
14213
15151
  id: {
15152
+ constraints: {
15153
+ Pattern: new RegExp("^nm_\\w+$")
15154
+ },
14214
15155
  serializedName: "id",
14215
15156
  required: true,
14216
15157
  type: {
@@ -14242,7 +15183,7 @@ const NameEntry = {
14242
15183
  element: {
14243
15184
  type: {
14244
15185
  name: "Composite",
14245
- className: "NamePointerComplete"
15186
+ className: "NameEntryPointersItem"
14246
15187
  }
14247
15188
  }
14248
15189
  }
@@ -14250,35 +15191,6 @@ const NameEntry = {
14250
15191
  }
14251
15192
  }
14252
15193
  };
14253
- const NamePointerComplete = {
14254
- type: {
14255
- name: "Composite",
14256
- className: "NamePointerComplete",
14257
- modelProperties: {
14258
- key: {
14259
- serializedName: "key",
14260
- required: true,
14261
- type: {
14262
- name: "String"
14263
- }
14264
- },
14265
- encodedKey: {
14266
- serializedName: "encoded_key",
14267
- required: true,
14268
- type: {
14269
- name: "String"
14270
- }
14271
- },
14272
- id: {
14273
- serializedName: "id",
14274
- required: true,
14275
- type: {
14276
- name: "String"
14277
- }
14278
- }
14279
- }
14280
- }
14281
- };
14282
15194
  const RegisteredOracle = {
14283
15195
  type: {
14284
15196
  name: "Composite",
@@ -14368,6 +15280,9 @@ const OracleQuery = {
14368
15280
  className: "OracleQuery",
14369
15281
  modelProperties: {
14370
15282
  id: {
15283
+ constraints: {
15284
+ Pattern: new RegExp("^oq_\\w+$")
15285
+ },
14371
15286
  serializedName: "id",
14372
15287
  required: true,
14373
15288
  type: {
@@ -14501,83 +15416,142 @@ const GasPricesItem = {
14501
15416
  }
14502
15417
  }
14503
15418
  };
14504
- const Status = {
15419
+ const NodeSettings = {
14505
15420
  type: {
14506
15421
  name: "Composite",
14507
- className: "Status",
15422
+ className: "NodeSettings",
14508
15423
  modelProperties: {
14509
- genesisKeyBlockHash: {
14510
- serializedName: "genesis_key_block_hash",
15424
+ minMinerGasPrice: {
15425
+ serializedName: "min_miner_gas_price",
14511
15426
  required: true,
14512
15427
  type: {
14513
- name: "String"
15428
+ // @ts-expect-error we are extending autorest with BigInt support
15429
+ name: "BigInt"
14514
15430
  }
14515
15431
  },
14516
- solutions: {
15432
+ maxAuthFunGas: {
14517
15433
  constraints: {
14518
15434
  InclusiveMaximum: 18446744073709552000,
14519
15435
  InclusiveMinimum: 0
14520
15436
  },
14521
- serializedName: "solutions",
15437
+ serializedName: "max_auth_fun_gas",
14522
15438
  required: true,
14523
15439
  type: {
14524
15440
  name: "Number"
14525
15441
  }
14526
15442
  },
14527
- difficulty: {
15443
+ mempoolTxTtl: {
14528
15444
  constraints: {
14529
15445
  InclusiveMaximum: 18446744073709552000,
14530
15446
  InclusiveMinimum: 0
14531
15447
  },
14532
- serializedName: "difficulty",
15448
+ serializedName: "mempool_tx_ttl",
14533
15449
  required: true,
14534
15450
  type: {
14535
15451
  name: "Number"
14536
15452
  }
14537
15453
  },
14538
- hashrate: {
15454
+ mempoolNonceOffset: {
14539
15455
  constraints: {
14540
15456
  InclusiveMaximum: 18446744073709552000,
14541
15457
  InclusiveMinimum: 0
14542
15458
  },
14543
- serializedName: "hashrate",
15459
+ serializedName: "mempool_nonce_offset",
14544
15460
  required: true,
14545
15461
  type: {
14546
15462
  name: "Number"
14547
15463
  }
14548
15464
  },
14549
- syncing: {
14550
- serializedName: "syncing",
15465
+ dryRunGasLimit: {
15466
+ constraints: {
15467
+ InclusiveMaximum: 18446744073709552000,
15468
+ InclusiveMinimum: 0
15469
+ },
15470
+ serializedName: "dry_run_gas_limit",
14551
15471
  required: true,
14552
15472
  type: {
14553
- name: "Boolean"
15473
+ name: "Number"
14554
15474
  }
14555
15475
  },
14556
- syncProgress: {
15476
+ blockGasLimit: {
14557
15477
  constraints: {
14558
- InclusiveMaximum: 100,
15478
+ InclusiveMaximum: 18446744073709552000,
14559
15479
  InclusiveMinimum: 0
14560
15480
  },
14561
- serializedName: "sync_progress",
15481
+ serializedName: "block_gas_limit",
15482
+ required: true,
15483
+ type: {
15484
+ name: "Number"
15485
+ }
15486
+ }
15487
+ }
15488
+ }
15489
+ };
15490
+ const ProtocolParameters = {
15491
+ type: {
15492
+ name: "Composite",
15493
+ className: "ProtocolParameters",
15494
+ modelProperties: {
15495
+ networkId: {
15496
+ serializedName: "network_id",
15497
+ required: true,
15498
+ type: {
15499
+ name: "String"
15500
+ }
15501
+ },
15502
+ currentProtocolVersion: {
15503
+ constraints: {
15504
+ InclusiveMaximum: 4294967295,
15505
+ InclusiveMinimum: 0
15506
+ },
15507
+ serializedName: "current_protocol_version",
15508
+ required: true,
14562
15509
  type: {
14563
15510
  name: "Number"
14564
15511
  }
14565
15512
  },
14566
- uptime: {
14567
- serializedName: "uptime",
15513
+ lockedCoinsHolderAccount: {
15514
+ serializedName: "locked_coins_holder_account",
14568
15515
  required: true,
14569
15516
  type: {
14570
15517
  name: "String"
14571
15518
  }
14572
15519
  },
14573
- listening: {
14574
- serializedName: "listening",
15520
+ expectedBlockMineRate: {
15521
+ constraints: {
15522
+ InclusiveMaximum: 18446744073709552000,
15523
+ InclusiveMinimum: 0
15524
+ },
15525
+ serializedName: "expected_block_mine_rate",
15526
+ type: {
15527
+ name: "Number"
15528
+ }
15529
+ },
15530
+ childBlockTime: {
15531
+ constraints: {
15532
+ InclusiveMaximum: 18446744073709552000,
15533
+ InclusiveMinimum: 0
15534
+ },
15535
+ serializedName: "child_block_time",
15536
+ type: {
15537
+ name: "Number"
15538
+ }
15539
+ },
15540
+ microBlockCycle: {
15541
+ constraints: {
15542
+ InclusiveMaximum: 18446744073709552000,
15543
+ InclusiveMinimum: 0
15544
+ },
15545
+ serializedName: "micro_block_cycle",
14575
15546
  required: true,
14576
15547
  type: {
14577
- name: "Boolean"
15548
+ name: "Number"
14578
15549
  }
14579
15550
  },
14580
15551
  protocols: {
15552
+ constraints: {
15553
+ MinItems: 1
15554
+ },
14581
15555
  serializedName: "protocols",
14582
15556
  required: true,
14583
15557
  type: {
@@ -14585,81 +15559,144 @@ const Status = {
14585
15559
  element: {
14586
15560
  type: {
14587
15561
  name: "Composite",
14588
- className: "Protocol"
15562
+ className: "ProtocolConsensusParameters"
14589
15563
  }
14590
15564
  }
14591
15565
  }
14592
- },
14593
- nodeVersion: {
14594
- serializedName: "node_version",
15566
+ }
15567
+ }
15568
+ }
15569
+ };
15570
+ const ContractTxBaseGas = {
15571
+ type: {
15572
+ name: "Composite",
15573
+ className: "ContractTxBaseGas",
15574
+ modelProperties: {
15575
+ txType: {
15576
+ serializedName: "tx_type",
14595
15577
  required: true,
14596
15578
  type: {
14597
15579
  name: "String"
14598
15580
  }
14599
15581
  },
14600
- nodeRevision: {
14601
- serializedName: "node_revision",
15582
+ abiVersion: {
15583
+ constraints: {
15584
+ InclusiveMaximum: 65535,
15585
+ InclusiveMinimum: 0
15586
+ },
15587
+ serializedName: "abi_version",
14602
15588
  required: true,
14603
15589
  type: {
14604
- name: "String"
15590
+ name: "Number"
14605
15591
  }
14606
15592
  },
14607
- peerCount: {
15593
+ txBaseGas: {
14608
15594
  constraints: {
14609
- InclusiveMaximum: 4294967295,
15595
+ InclusiveMaximum: 18446744073709552000,
14610
15596
  InclusiveMinimum: 0
14611
15597
  },
14612
- serializedName: "peer_count",
15598
+ serializedName: "tx_base_gas",
14613
15599
  required: true,
14614
15600
  type: {
14615
15601
  name: "Number"
14616
15602
  }
14617
- },
14618
- peerConnections: {
14619
- serializedName: "peer_connections",
15603
+ }
15604
+ }
15605
+ }
15606
+ };
15607
+ const StateGasPerBlock = {
15608
+ type: {
15609
+ name: "Composite",
15610
+ className: "StateGasPerBlock",
15611
+ modelProperties: {
15612
+ part: {
15613
+ constraints: {
15614
+ InclusiveMaximum: 18446744073709552000,
15615
+ InclusiveMinimum: 0
15616
+ },
15617
+ serializedName: "part",
15618
+ required: true,
14620
15619
  type: {
14621
- name: "Composite",
14622
- className: "PeerConnections"
15620
+ name: "Number"
14623
15621
  }
14624
15622
  },
14625
- pendingTransactionsCount: {
15623
+ whole: {
14626
15624
  constraints: {
14627
- InclusiveMaximum: 4294967295,
15625
+ InclusiveMaximum: 18446744073709552000,
14628
15626
  InclusiveMinimum: 0
14629
15627
  },
14630
- serializedName: "pending_transactions_count",
15628
+ serializedName: "whole",
14631
15629
  required: true,
14632
15630
  type: {
14633
15631
  name: "Number"
14634
15632
  }
14635
- },
14636
- networkId: {
14637
- serializedName: "network_id",
15633
+ }
15634
+ }
15635
+ }
15636
+ };
15637
+ const NameAuctionTimeout = {
15638
+ type: {
15639
+ name: "Composite",
15640
+ className: "NameAuctionTimeout",
15641
+ modelProperties: {
15642
+ length: {
15643
+ constraints: {
15644
+ InclusiveMaximum: 18446744073709552000,
15645
+ InclusiveMinimum: 0
15646
+ },
15647
+ serializedName: "length",
14638
15648
  required: true,
14639
15649
  type: {
14640
- name: "String"
15650
+ name: "Number"
14641
15651
  }
14642
15652
  },
14643
- peerPubkey: {
14644
- serializedName: "peer_pubkey",
15653
+ bidTimeout: {
15654
+ constraints: {
15655
+ InclusiveMaximum: 18446744073709552000,
15656
+ InclusiveMinimum: 0
15657
+ },
15658
+ serializedName: "bid_timeout",
14645
15659
  required: true,
14646
15660
  type: {
14647
- name: "String"
15661
+ name: "Number"
14648
15662
  }
14649
15663
  },
14650
- topKeyBlockHash: {
14651
- serializedName: "top_key_block_hash",
15664
+ bidExtension: {
15665
+ constraints: {
15666
+ InclusiveMaximum: 18446744073709552000,
15667
+ InclusiveMinimum: 0
15668
+ },
15669
+ serializedName: "bid_extension",
14652
15670
  required: true,
14653
15671
  type: {
14654
- name: "String"
15672
+ name: "Number"
15673
+ }
15674
+ }
15675
+ }
15676
+ }
15677
+ };
15678
+ const ContractVersion = {
15679
+ type: {
15680
+ name: "Composite",
15681
+ className: "ContractVersion",
15682
+ modelProperties: {
15683
+ vmVersion: {
15684
+ constraints: {
15685
+ InclusiveMaximum: 65535,
15686
+ InclusiveMinimum: 0
15687
+ },
15688
+ serializedName: "vm_version",
15689
+ required: true,
15690
+ type: {
15691
+ name: "Number"
14655
15692
  }
14656
15693
  },
14657
- topBlockHeight: {
15694
+ abiVersion: {
14658
15695
  constraints: {
14659
- InclusiveMaximum: 18446744073709552000,
15696
+ InclusiveMaximum: 65535,
14660
15697
  InclusiveMinimum: 0
14661
15698
  },
14662
- serializedName: "top_block_height",
15699
+ serializedName: "abi_version",
14663
15700
  required: true,
14664
15701
  type: {
14665
15702
  name: "Number"
@@ -14698,6 +15735,173 @@ const Protocol = {
14698
15735
  }
14699
15736
  }
14700
15737
  };
15738
+ const Status = {
15739
+ type: {
15740
+ name: "Composite",
15741
+ className: "Status",
15742
+ modelProperties: {
15743
+ genesisKeyBlockHash: {
15744
+ serializedName: "genesis_key_block_hash",
15745
+ required: true,
15746
+ type: {
15747
+ name: "String"
15748
+ }
15749
+ },
15750
+ solutions: {
15751
+ constraints: {
15752
+ InclusiveMaximum: 18446744073709552000,
15753
+ InclusiveMinimum: 0
15754
+ },
15755
+ serializedName: "solutions",
15756
+ required: true,
15757
+ type: {
15758
+ name: "Number"
15759
+ }
15760
+ },
15761
+ difficulty: {
15762
+ constraints: {
15763
+ InclusiveMaximum: 18446744073709552000,
15764
+ InclusiveMinimum: 0
15765
+ },
15766
+ serializedName: "difficulty",
15767
+ required: true,
15768
+ type: {
15769
+ name: "Number"
15770
+ }
15771
+ },
15772
+ hashrate: {
15773
+ constraints: {
15774
+ InclusiveMaximum: 18446744073709552000,
15775
+ InclusiveMinimum: 0
15776
+ },
15777
+ serializedName: "hashrate",
15778
+ required: true,
15779
+ type: {
15780
+ name: "Number"
15781
+ }
15782
+ },
15783
+ syncing: {
15784
+ serializedName: "syncing",
15785
+ required: true,
15786
+ type: {
15787
+ name: "Boolean"
15788
+ }
15789
+ },
15790
+ syncProgress: {
15791
+ constraints: {
15792
+ InclusiveMaximum: 100,
15793
+ InclusiveMinimum: 0
15794
+ },
15795
+ serializedName: "sync_progress",
15796
+ type: {
15797
+ name: "Number"
15798
+ }
15799
+ },
15800
+ uptime: {
15801
+ serializedName: "uptime",
15802
+ required: true,
15803
+ type: {
15804
+ name: "String"
15805
+ }
15806
+ },
15807
+ listening: {
15808
+ serializedName: "listening",
15809
+ required: true,
15810
+ type: {
15811
+ name: "Boolean"
15812
+ }
15813
+ },
15814
+ protocols: {
15815
+ serializedName: "protocols",
15816
+ required: true,
15817
+ type: {
15818
+ name: "Sequence",
15819
+ element: {
15820
+ type: {
15821
+ name: "Composite",
15822
+ className: "Protocol"
15823
+ }
15824
+ }
15825
+ }
15826
+ },
15827
+ nodeVersion: {
15828
+ serializedName: "node_version",
15829
+ required: true,
15830
+ type: {
15831
+ name: "String"
15832
+ }
15833
+ },
15834
+ nodeRevision: {
15835
+ serializedName: "node_revision",
15836
+ required: true,
15837
+ type: {
15838
+ name: "String"
15839
+ }
15840
+ },
15841
+ peerCount: {
15842
+ constraints: {
15843
+ InclusiveMaximum: 4294967295,
15844
+ InclusiveMinimum: 0
15845
+ },
15846
+ serializedName: "peer_count",
15847
+ required: true,
15848
+ type: {
15849
+ name: "Number"
15850
+ }
15851
+ },
15852
+ peerConnections: {
15853
+ serializedName: "peer_connections",
15854
+ type: {
15855
+ name: "Composite",
15856
+ className: "PeerConnections"
15857
+ }
15858
+ },
15859
+ pendingTransactionsCount: {
15860
+ constraints: {
15861
+ InclusiveMaximum: 4294967295,
15862
+ InclusiveMinimum: 0
15863
+ },
15864
+ serializedName: "pending_transactions_count",
15865
+ required: true,
15866
+ type: {
15867
+ name: "Number"
15868
+ }
15869
+ },
15870
+ networkId: {
15871
+ serializedName: "network_id",
15872
+ required: true,
15873
+ type: {
15874
+ name: "String"
15875
+ }
15876
+ },
15877
+ peerPubkey: {
15878
+ serializedName: "peer_pubkey",
15879
+ required: true,
15880
+ type: {
15881
+ name: "String"
15882
+ }
15883
+ },
15884
+ topKeyBlockHash: {
15885
+ serializedName: "top_key_block_hash",
15886
+ required: true,
15887
+ type: {
15888
+ name: "String"
15889
+ }
15890
+ },
15891
+ topBlockHeight: {
15892
+ constraints: {
15893
+ InclusiveMaximum: 18446744073709552000,
15894
+ InclusiveMinimum: 0
15895
+ },
15896
+ serializedName: "top_block_height",
15897
+ required: true,
15898
+ type: {
15899
+ name: "Number"
15900
+ }
15901
+ }
15902
+ }
15903
+ }
15904
+ };
14701
15905
  const PeerConnections = {
14702
15906
  type: {
14703
15907
  name: "Composite",
@@ -14778,6 +15982,9 @@ const EncodedTx = {
14778
15982
  className: "EncodedTx",
14779
15983
  modelProperties: {
14780
15984
  tx: {
15985
+ constraints: {
15986
+ Pattern: new RegExp("^tx_[0-9A-Za-z+/=]+$")
15987
+ },
14781
15988
  serializedName: "tx",
14782
15989
  required: true,
14783
15990
  type: {
@@ -14793,6 +16000,9 @@ const PostTxResponse = {
14793
16000
  className: "PostTxResponse",
14794
16001
  modelProperties: {
14795
16002
  txHash: {
16003
+ constraints: {
16004
+ Pattern: new RegExp("^th_\\w+$")
16005
+ },
14796
16006
  serializedName: "tx_hash",
14797
16007
  required: true,
14798
16008
  type: {
@@ -14876,6 +16086,9 @@ const GAObject = {
14876
16086
  }
14877
16087
  },
14878
16088
  returnValue: {
16089
+ constraints: {
16090
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
16091
+ },
14879
16092
  serializedName: "return_value",
14880
16093
  required: true,
14881
16094
  type: {
@@ -15035,6 +16248,9 @@ const ChannelCloseSoloTx = {
15035
16248
  }
15036
16249
  },
15037
16250
  poi: {
16251
+ constraints: {
16252
+ Pattern: new RegExp("^pi_[0-9A-Za-z+/=]+$")
16253
+ },
15038
16254
  serializedName: "poi",
15039
16255
  required: true,
15040
16256
  type: {
@@ -15258,6 +16474,9 @@ const ChannelForceProgressTx = {
15258
16474
  }
15259
16475
  },
15260
16476
  payload: {
16477
+ constraints: {
16478
+ Pattern: new RegExp("^tx_[0-9A-Za-z+/=]+$")
16479
+ },
15261
16480
  serializedName: "payload",
15262
16481
  required: true,
15263
16482
  type: {
@@ -15321,6 +16540,9 @@ const ChannelForceProgressTx = {
15321
16540
  }
15322
16541
  },
15323
16542
  offchainTrees: {
16543
+ constraints: {
16544
+ Pattern: new RegExp("^ss_[0-9A-Za-z+/=]+$")
16545
+ },
15324
16546
  serializedName: "offchain_trees",
15325
16547
  type: {
15326
16548
  name: "String"
@@ -15565,6 +16787,9 @@ const ChannelSlashTx = {
15565
16787
  }
15566
16788
  },
15567
16789
  poi: {
16790
+ constraints: {
16791
+ Pattern: new RegExp("^pi_[0-9A-Za-z+/=]+$")
16792
+ },
15568
16793
  serializedName: "poi",
15569
16794
  required: true,
15570
16795
  type: {
@@ -15738,6 +16963,9 @@ const CommitmentId = {
15738
16963
  className: "CommitmentId",
15739
16964
  modelProperties: {
15740
16965
  commitmentId: {
16966
+ constraints: {
16967
+ Pattern: new RegExp("^cm_\\w+$")
16968
+ },
15741
16969
  serializedName: "commitment_id",
15742
16970
  required: true,
15743
16971
  type: {
@@ -15842,6 +17070,9 @@ const ContractCallTx = {
15842
17070
  }
15843
17071
  },
15844
17072
  callData: {
17073
+ constraints: {
17074
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
17075
+ },
15845
17076
  serializedName: "call_data",
15846
17077
  required: true,
15847
17078
  type: {
@@ -15874,6 +17105,9 @@ const ContractCreateTx = {
15874
17105
  }
15875
17106
  },
15876
17107
  code: {
17108
+ constraints: {
17109
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
17110
+ },
15877
17111
  serializedName: "code",
15878
17112
  required: true,
15879
17113
  type: {
@@ -15968,6 +17202,9 @@ const ContractCreateTx = {
15968
17202
  }
15969
17203
  },
15970
17204
  callData: {
17205
+ constraints: {
17206
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
17207
+ },
15971
17208
  serializedName: "call_data",
15972
17209
  required: true,
15973
17210
  type: {
@@ -15977,21 +17214,6 @@ const ContractCreateTx = {
15977
17214
  }
15978
17215
  }
15979
17216
  };
15980
- const UnsignedTx = {
15981
- type: {
15982
- name: "Composite",
15983
- className: "UnsignedTx",
15984
- modelProperties: {
15985
- tx: {
15986
- serializedName: "tx",
15987
- required: true,
15988
- type: {
15989
- name: "String"
15990
- }
15991
- }
15992
- }
15993
- }
15994
- };
15995
17217
  const GAAttachTx = {
15996
17218
  type: {
15997
17219
  name: "Composite",
@@ -16015,6 +17237,9 @@ const GAAttachTx = {
16015
17237
  }
16016
17238
  },
16017
17239
  code: {
17240
+ constraints: {
17241
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
17242
+ },
16018
17243
  serializedName: "code",
16019
17244
  required: true,
16020
17245
  type: {
@@ -16087,6 +17312,9 @@ const GAAttachTx = {
16087
17312
  }
16088
17313
  },
16089
17314
  callData: {
17315
+ constraints: {
17316
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
17317
+ },
16090
17318
  serializedName: "call_data",
16091
17319
  required: true,
16092
17320
  type: {
@@ -16173,6 +17401,9 @@ const GAMetaTx = {
16173
17401
  }
16174
17402
  },
16175
17403
  authData: {
17404
+ constraints: {
17405
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
17406
+ },
16176
17407
  serializedName: "auth_data",
16177
17408
  required: true,
16178
17409
  type: {
@@ -16268,6 +17499,9 @@ const NameHash = {
16268
17499
  className: "NameHash",
16269
17500
  modelProperties: {
16270
17501
  nameId: {
17502
+ constraints: {
17503
+ Pattern: new RegExp("^nm_\\w+$")
17504
+ },
16271
17505
  serializedName: "name_id",
16272
17506
  required: true,
16273
17507
  type: {
@@ -16283,60 +17517,66 @@ const NamePreclaimTx = {
16283
17517
  className: "NamePreclaimTx",
16284
17518
  modelProperties: {
16285
17519
  commitmentId: {
16286
- serializedName: "commitment_id",
16287
- required: true,
16288
- type: {
16289
- name: "String"
16290
- }
16291
- },
16292
- fee: {
16293
- constraints: {
16294
- InclusiveMinimum: 0
16295
- },
16296
- serializedName: "fee",
16297
- required: true,
16298
- type: {
16299
- // @ts-expect-error we are extending autorest with BigInt support
16300
- name: "BigInt"
16301
- }
16302
- },
16303
- ttl: {
16304
17520
  constraints: {
16305
- InclusiveMaximum: 18446744073709552000,
16306
- InclusiveMinimum: 0
17521
+ Pattern: new RegExp("^cm_\\w+$")
16307
17522
  },
16308
- serializedName: "ttl",
16309
- type: {
16310
- name: "Number"
16311
- }
16312
- },
16313
- accountId: {
16314
- serializedName: "account_id",
16315
- required: true,
16316
- type: {
16317
- name: "String"
16318
- }
16319
- },
16320
- nonce: {
16321
- constraints: {
16322
- InclusiveMaximum: 18446744073709552000,
16323
- InclusiveMinimum: 0
16324
- },
16325
- serializedName: "nonce",
16326
- type: {
16327
- name: "Number"
16328
- }
16329
- }
16330
- }
16331
- }
16332
- };
16333
- const NameRevokeTx = {
16334
- type: {
16335
- name: "Composite",
16336
- className: "NameRevokeTx",
16337
- modelProperties: {
16338
- nameId: {
16339
- serializedName: "name_id",
17523
+ serializedName: "commitment_id",
17524
+ required: true,
17525
+ type: {
17526
+ name: "String"
17527
+ }
17528
+ },
17529
+ fee: {
17530
+ constraints: {
17531
+ InclusiveMinimum: 0
17532
+ },
17533
+ serializedName: "fee",
17534
+ required: true,
17535
+ type: {
17536
+ // @ts-expect-error we are extending autorest with BigInt support
17537
+ name: "BigInt"
17538
+ }
17539
+ },
17540
+ ttl: {
17541
+ constraints: {
17542
+ InclusiveMaximum: 18446744073709552000,
17543
+ InclusiveMinimum: 0
17544
+ },
17545
+ serializedName: "ttl",
17546
+ type: {
17547
+ name: "Number"
17548
+ }
17549
+ },
17550
+ accountId: {
17551
+ serializedName: "account_id",
17552
+ required: true,
17553
+ type: {
17554
+ name: "String"
17555
+ }
17556
+ },
17557
+ nonce: {
17558
+ constraints: {
17559
+ InclusiveMaximum: 18446744073709552000,
17560
+ InclusiveMinimum: 0
17561
+ },
17562
+ serializedName: "nonce",
17563
+ type: {
17564
+ name: "Number"
17565
+ }
17566
+ }
17567
+ }
17568
+ }
17569
+ };
17570
+ const NameRevokeTx = {
17571
+ type: {
17572
+ name: "Composite",
17573
+ className: "NameRevokeTx",
17574
+ modelProperties: {
17575
+ nameId: {
17576
+ constraints: {
17577
+ Pattern: new RegExp("^nm_\\w+$")
17578
+ },
17579
+ serializedName: "name_id",
16340
17580
  required: true,
16341
17581
  type: {
16342
17582
  name: "String"
@@ -16389,6 +17629,9 @@ const NameTransferTx = {
16389
17629
  className: "NameTransferTx",
16390
17630
  modelProperties: {
16391
17631
  nameId: {
17632
+ constraints: {
17633
+ Pattern: new RegExp("^nm_\\w+$")
17634
+ },
16392
17635
  serializedName: "name_id",
16393
17636
  required: true,
16394
17637
  type: {
@@ -16449,6 +17692,9 @@ const NameUpdateTx = {
16449
17692
  className: "NameUpdateTx",
16450
17693
  modelProperties: {
16451
17694
  nameId: {
17695
+ constraints: {
17696
+ Pattern: new RegExp("^nm_\\w+$")
17697
+ },
16452
17698
  serializedName: "name_id",
16453
17699
  required: true,
16454
17700
  type: {
@@ -16866,6 +18112,9 @@ const OracleRespondTx = {
16866
18112
  className: "OracleRespondTx",
16867
18113
  modelProperties: {
16868
18114
  queryId: {
18115
+ constraints: {
18116
+ Pattern: new RegExp("^oq_\\w+$")
18117
+ },
16869
18118
  serializedName: "query_id",
16870
18119
  required: true,
16871
18120
  type: {
@@ -17106,10 +18355,10 @@ const PubKey = {
17106
18355
  }
17107
18356
  }
17108
18357
  };
17109
- const SpendTx = {
18358
+ const SpendTxInput = {
17110
18359
  type: {
17111
18360
  name: "Composite",
17112
- className: "SpendTx",
18361
+ className: "SpendTxInput",
17113
18362
  modelProperties: {
17114
18363
  recipientId: {
17115
18364
  serializedName: "recipient_id",
@@ -17142,114 +18391,1184 @@ const SpendTx = {
17142
18391
  },
17143
18392
  ttl: {
17144
18393
  constraints: {
17145
- InclusiveMaximum: 18446744073709552000,
18394
+ InclusiveMaximum: 18446744073709552000,
18395
+ InclusiveMinimum: 0
18396
+ },
18397
+ serializedName: "ttl",
18398
+ type: {
18399
+ name: "Number"
18400
+ }
18401
+ },
18402
+ senderId: {
18403
+ serializedName: "sender_id",
18404
+ required: true,
18405
+ type: {
18406
+ name: "String"
18407
+ }
18408
+ },
18409
+ nonce: {
18410
+ constraints: {
18411
+ InclusiveMaximum: 18446744073709552000,
18412
+ InclusiveMinimum: 0
18413
+ },
18414
+ serializedName: "nonce",
18415
+ type: {
18416
+ name: "Number"
18417
+ }
18418
+ },
18419
+ payload: {
18420
+ serializedName: "payload",
18421
+ required: true,
18422
+ type: {
18423
+ name: "any"
18424
+ }
18425
+ }
18426
+ }
18427
+ }
18428
+ };
18429
+ const TokenSupply = {
18430
+ type: {
18431
+ name: "Composite",
18432
+ className: "TokenSupply",
18433
+ modelProperties: {
18434
+ accounts: {
18435
+ constraints: {
18436
+ InclusiveMinimum: 0
18437
+ },
18438
+ serializedName: "accounts",
18439
+ type: {
18440
+ name: "Number"
18441
+ }
18442
+ },
18443
+ contracts: {
18444
+ constraints: {
18445
+ InclusiveMinimum: 0
18446
+ },
18447
+ serializedName: "contracts",
18448
+ type: {
18449
+ name: "Number"
18450
+ }
18451
+ },
18452
+ contractOracles: {
18453
+ constraints: {
18454
+ InclusiveMinimum: 0
18455
+ },
18456
+ serializedName: "contract_oracles",
18457
+ type: {
18458
+ name: "Number"
18459
+ }
18460
+ },
18461
+ locked: {
18462
+ constraints: {
18463
+ InclusiveMinimum: 0
18464
+ },
18465
+ serializedName: "locked",
18466
+ type: {
18467
+ name: "Number"
18468
+ }
18469
+ },
18470
+ oracles: {
18471
+ constraints: {
18472
+ InclusiveMinimum: 0
18473
+ },
18474
+ serializedName: "oracles",
18475
+ type: {
18476
+ name: "Number"
18477
+ }
18478
+ },
18479
+ oracleQueries: {
18480
+ constraints: {
18481
+ InclusiveMinimum: 0
18482
+ },
18483
+ serializedName: "oracle_queries",
18484
+ type: {
18485
+ name: "Number"
18486
+ }
18487
+ },
18488
+ pendingRewards: {
18489
+ constraints: {
18490
+ InclusiveMinimum: 0
18491
+ },
18492
+ serializedName: "pending_rewards",
18493
+ type: {
18494
+ name: "Number"
18495
+ }
18496
+ },
18497
+ total: {
18498
+ constraints: {
18499
+ InclusiveMinimum: 0
18500
+ },
18501
+ serializedName: "total",
18502
+ type: {
18503
+ name: "Number"
18504
+ }
18505
+ }
18506
+ }
18507
+ }
18508
+ };
18509
+ const OffChainCallContract = {
18510
+ serializedName: "OffChainCallContract",
18511
+ type: {
18512
+ name: "Composite",
18513
+ className: "OffChainCallContract",
18514
+ uberParent: "OffChainUpdate",
18515
+ polymorphicDiscriminator: OffChainUpdate.type.polymorphicDiscriminator,
18516
+ modelProperties: {
18517
+ ...OffChainUpdate.type.modelProperties,
18518
+ caller: {
18519
+ serializedName: "caller",
18520
+ required: true,
18521
+ type: {
18522
+ name: "String"
18523
+ }
18524
+ },
18525
+ contract: {
18526
+ serializedName: "contract",
18527
+ required: true,
18528
+ type: {
18529
+ name: "String"
18530
+ }
18531
+ },
18532
+ abiVersion: {
18533
+ constraints: {
18534
+ InclusiveMaximum: 65535,
18535
+ InclusiveMinimum: 0
18536
+ },
18537
+ serializedName: "abi_version",
18538
+ required: true,
18539
+ type: {
18540
+ name: "Number"
18541
+ }
18542
+ },
18543
+ amount: {
18544
+ constraints: {
18545
+ InclusiveMinimum: 0
18546
+ },
18547
+ serializedName: "amount",
18548
+ required: true,
18549
+ type: {
18550
+ // @ts-expect-error we are extending autorest with BigInt support
18551
+ name: "BigInt"
18552
+ }
18553
+ },
18554
+ gas: {
18555
+ constraints: {
18556
+ InclusiveMaximum: 18446744073709552000,
18557
+ InclusiveMinimum: 0
18558
+ },
18559
+ serializedName: "gas",
18560
+ required: true,
18561
+ type: {
18562
+ name: "Number"
18563
+ }
18564
+ },
18565
+ gasPrice: {
18566
+ constraints: {
18567
+ InclusiveMinimum: 0
18568
+ },
18569
+ serializedName: "gas_price",
18570
+ required: true,
18571
+ type: {
18572
+ // @ts-expect-error we are extending autorest with BigInt support
18573
+ name: "BigInt"
18574
+ }
18575
+ },
18576
+ callData: {
18577
+ constraints: {
18578
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
18579
+ },
18580
+ serializedName: "call_data",
18581
+ required: true,
18582
+ type: {
18583
+ name: "String"
18584
+ }
18585
+ }
18586
+ }
18587
+ }
18588
+ };
18589
+ const OffChainDeposit = {
18590
+ serializedName: "OffChainDeposit",
18591
+ type: {
18592
+ name: "Composite",
18593
+ className: "OffChainDeposit",
18594
+ uberParent: "OffChainUpdate",
18595
+ polymorphicDiscriminator: OffChainUpdate.type.polymorphicDiscriminator,
18596
+ modelProperties: {
18597
+ ...OffChainUpdate.type.modelProperties,
18598
+ from: {
18599
+ serializedName: "from",
18600
+ required: true,
18601
+ type: {
18602
+ name: "String"
18603
+ }
18604
+ },
18605
+ amount: {
18606
+ constraints: {
18607
+ InclusiveMinimum: 0
18608
+ },
18609
+ serializedName: "amount",
18610
+ required: true,
18611
+ type: {
18612
+ // @ts-expect-error we are extending autorest with BigInt support
18613
+ name: "BigInt"
18614
+ }
18615
+ }
18616
+ }
18617
+ }
18618
+ };
18619
+ const OffChainNewContract = {
18620
+ serializedName: "OffChainNewContract",
18621
+ type: {
18622
+ name: "Composite",
18623
+ className: "OffChainNewContract",
18624
+ uberParent: "OffChainUpdate",
18625
+ polymorphicDiscriminator: OffChainUpdate.type.polymorphicDiscriminator,
18626
+ modelProperties: {
18627
+ ...OffChainUpdate.type.modelProperties,
18628
+ owner: {
18629
+ serializedName: "owner",
18630
+ required: true,
18631
+ type: {
18632
+ name: "String"
18633
+ }
18634
+ },
18635
+ vmVersion: {
18636
+ constraints: {
18637
+ InclusiveMaximum: 65535,
18638
+ InclusiveMinimum: 0
18639
+ },
18640
+ serializedName: "vm_version",
18641
+ required: true,
18642
+ type: {
18643
+ name: "Number"
18644
+ }
18645
+ },
18646
+ abiVersion: {
18647
+ constraints: {
18648
+ InclusiveMaximum: 65535,
18649
+ InclusiveMinimum: 0
18650
+ },
18651
+ serializedName: "abi_version",
18652
+ required: true,
18653
+ type: {
18654
+ name: "Number"
18655
+ }
18656
+ },
18657
+ code: {
18658
+ serializedName: "code",
18659
+ type: {
18660
+ name: "Composite",
18661
+ className: "ByteCode"
18662
+ }
18663
+ },
18664
+ deposit: {
18665
+ constraints: {
18666
+ InclusiveMinimum: 0
18667
+ },
18668
+ serializedName: "deposit",
18669
+ required: true,
18670
+ type: {
18671
+ // @ts-expect-error we are extending autorest with BigInt support
18672
+ name: "BigInt"
18673
+ }
18674
+ },
18675
+ callData: {
18676
+ constraints: {
18677
+ Pattern: new RegExp("^cb_[0-9A-Za-z+/=]+$")
18678
+ },
18679
+ serializedName: "call_data",
18680
+ required: true,
18681
+ type: {
18682
+ name: "String"
18683
+ }
18684
+ }
18685
+ }
18686
+ }
18687
+ };
18688
+ const OffChainTransfer = {
18689
+ serializedName: "OffChainTransfer",
18690
+ type: {
18691
+ name: "Composite",
18692
+ className: "OffChainTransfer",
18693
+ uberParent: "OffChainUpdate",
18694
+ polymorphicDiscriminator: OffChainUpdate.type.polymorphicDiscriminator,
18695
+ modelProperties: {
18696
+ ...OffChainUpdate.type.modelProperties,
18697
+ from: {
18698
+ serializedName: "from",
18699
+ required: true,
18700
+ type: {
18701
+ name: "String"
18702
+ }
18703
+ },
18704
+ to: {
18705
+ serializedName: "to",
18706
+ required: true,
18707
+ type: {
18708
+ name: "String"
18709
+ }
18710
+ },
18711
+ amount: {
18712
+ constraints: {
18713
+ InclusiveMinimum: 0
18714
+ },
18715
+ serializedName: "amount",
18716
+ required: true,
18717
+ type: {
18718
+ // @ts-expect-error we are extending autorest with BigInt support
18719
+ name: "BigInt"
18720
+ }
18721
+ }
18722
+ }
18723
+ }
18724
+ };
18725
+ const OffChainWithdrawal = {
18726
+ serializedName: "OffChainWithdrawal",
18727
+ type: {
18728
+ name: "Composite",
18729
+ className: "OffChainWithdrawal",
18730
+ uberParent: "OffChainUpdate",
18731
+ polymorphicDiscriminator: OffChainUpdate.type.polymorphicDiscriminator,
18732
+ modelProperties: {
18733
+ ...OffChainUpdate.type.modelProperties,
18734
+ to: {
18735
+ serializedName: "to",
18736
+ required: true,
18737
+ type: {
18738
+ name: "String"
18739
+ }
18740
+ },
18741
+ amount: {
18742
+ constraints: {
18743
+ InclusiveMinimum: 0
18744
+ },
18745
+ serializedName: "amount",
18746
+ required: true,
18747
+ type: {
18748
+ // @ts-expect-error we are extending autorest with BigInt support
18749
+ name: "BigInt"
18750
+ }
18751
+ }
18752
+ }
18753
+ }
18754
+ };
18755
+ const NameEntryPointersItem = {
18756
+ type: {
18757
+ name: "Composite",
18758
+ className: "NameEntryPointersItem",
18759
+ modelProperties: {
18760
+ ...NamePointer.type.modelProperties
18761
+ }
18762
+ }
18763
+ };
18764
+ const ProtocolConsensusParameters = {
18765
+ type: {
18766
+ name: "Composite",
18767
+ className: "ProtocolConsensusParameters",
18768
+ modelProperties: {
18769
+ ...Protocol.type.modelProperties,
18770
+ minimumGasPrice: {
18771
+ serializedName: "minimum_gas_price",
18772
+ required: true,
18773
+ type: {
18774
+ // @ts-expect-error we are extending autorest with BigInt support
18775
+ name: "BigInt"
18776
+ }
18777
+ },
18778
+ gasPerByte: {
18779
+ constraints: {
18780
+ InclusiveMaximum: 18446744073709552000,
18781
+ InclusiveMinimum: 0
18782
+ },
18783
+ serializedName: "gas_per_byte",
18784
+ required: true,
18785
+ type: {
18786
+ name: "Number"
18787
+ }
18788
+ },
18789
+ storeByteGas: {
18790
+ constraints: {
18791
+ InclusiveMaximum: 18446744073709552000,
18792
+ InclusiveMinimum: 0
18793
+ },
18794
+ serializedName: "store_byte_gas",
18795
+ required: true,
18796
+ type: {
18797
+ name: "Number"
18798
+ }
18799
+ },
18800
+ txBaseGas: {
18801
+ serializedName: "tx_base_gas",
18802
+ required: true,
18803
+ type: {
18804
+ name: "Dictionary",
18805
+ value: {
18806
+ type: {
18807
+ name: "Number"
18808
+ },
18809
+ constraints: {
18810
+ InclusiveMaximum: 18446744073709552000,
18811
+ InclusiveMinimum: 0
18812
+ }
18813
+ }
18814
+ }
18815
+ },
18816
+ contractTxBaseGas: {
18817
+ serializedName: "contract_tx_base_gas",
18818
+ required: true,
18819
+ type: {
18820
+ name: "Sequence",
18821
+ element: {
18822
+ type: {
18823
+ name: "Composite",
18824
+ className: "ContractTxBaseGas"
18825
+ }
18826
+ }
18827
+ }
18828
+ },
18829
+ stateGasPerBlock: {
18830
+ serializedName: "state_gas_per_block",
18831
+ required: true,
18832
+ type: {
18833
+ name: "Dictionary",
18834
+ value: {
18835
+ type: {
18836
+ name: "Composite",
18837
+ className: "StateGasPerBlock"
18838
+ }
18839
+ }
18840
+ }
18841
+ },
18842
+ nameClaimFees: {
18843
+ constraints: {
18844
+ MinItems: 31,
18845
+ MaxItems: 31
18846
+ },
18847
+ serializedName: "name_claim_fees",
18848
+ required: true,
18849
+ type: {
18850
+ name: "Sequence",
18851
+ element: {
18852
+ type: {
18853
+ // @ts-expect-error we are extending autorest with BigInt support
18854
+ name: "BigInt"
18855
+ }
18856
+ }
18857
+ }
18858
+ },
18859
+ nameAuctionTimeouts: {
18860
+ serializedName: "name_auction_timeouts",
18861
+ required: true,
18862
+ type: {
18863
+ name: "Sequence",
18864
+ element: {
18865
+ type: {
18866
+ name: "Composite",
18867
+ className: "NameAuctionTimeout"
18868
+ }
18869
+ }
18870
+ }
18871
+ },
18872
+ nameClaimBidIncrement: {
18873
+ constraints: {
18874
+ InclusiveMaximum: 18446744073709552000,
18875
+ InclusiveMinimum: 0
18876
+ },
18877
+ serializedName: "name_claim_bid_increment",
18878
+ required: true,
18879
+ type: {
18880
+ name: "Number"
18881
+ }
18882
+ },
18883
+ nameMaxLengthStartingAuction: {
18884
+ constraints: {
18885
+ InclusiveMaximum: 18446744073709552000,
18886
+ InclusiveMinimum: 0
18887
+ },
18888
+ serializedName: "name_max_length_starting_auction",
18889
+ required: true,
18890
+ type: {
18891
+ name: "Number"
18892
+ }
18893
+ },
18894
+ nameClaimMaxExpiration: {
18895
+ constraints: {
18896
+ InclusiveMaximum: 18446744073709552000,
18897
+ InclusiveMinimum: 0
18898
+ },
18899
+ serializedName: "name_claim_max_expiration",
18900
+ required: true,
18901
+ type: {
18902
+ name: "Number"
18903
+ }
18904
+ },
18905
+ nameRegistrars: {
18906
+ serializedName: "name_registrars",
18907
+ required: true,
18908
+ type: {
18909
+ name: "Sequence",
18910
+ element: {
18911
+ type: {
18912
+ name: "String"
18913
+ }
18914
+ }
18915
+ }
18916
+ },
18917
+ namePointersMaxCount: {
18918
+ constraints: {
18919
+ InclusiveMaximum: 18446744073709552000,
18920
+ InclusiveMinimum: 0
18921
+ },
18922
+ serializedName: "name_pointers_max_count",
18923
+ type: {
18924
+ name: "Number"
18925
+ }
18926
+ },
18927
+ namePointerMaxKeySize: {
18928
+ constraints: {
18929
+ InclusiveMaximum: 18446744073709552000,
18930
+ InclusiveMinimum: 0
18931
+ },
18932
+ serializedName: "name_pointer_max_key_size",
18933
+ type: {
18934
+ name: "Number"
18935
+ }
18936
+ },
18937
+ namePreclaimExpiration: {
18938
+ constraints: {
18939
+ InclusiveMaximum: 18446744073709552000,
18940
+ InclusiveMinimum: 0
18941
+ },
18942
+ serializedName: "name_preclaim_expiration",
18943
+ required: true,
18944
+ type: {
18945
+ name: "Number"
18946
+ }
18947
+ },
18948
+ nameClaimPreclaimDelta: {
18949
+ constraints: {
18950
+ InclusiveMaximum: 18446744073709552000,
18951
+ InclusiveMinimum: 0
18952
+ },
18953
+ serializedName: "name_claim_preclaim_delta",
18954
+ required: true,
18955
+ type: {
18956
+ name: "Number"
18957
+ }
18958
+ },
18959
+ nameProtectionPeriod: {
18960
+ constraints: {
18961
+ InclusiveMaximum: 18446744073709552000,
18962
+ InclusiveMinimum: 0
18963
+ },
18964
+ serializedName: "name_protection_period",
18965
+ required: true,
18966
+ type: {
18967
+ name: "Number"
18968
+ }
18969
+ },
18970
+ nameClaimLockedFee: {
18971
+ serializedName: "name_claim_locked_fee",
18972
+ required: true,
18973
+ type: {
18974
+ // @ts-expect-error we are extending autorest with BigInt support
18975
+ name: "BigInt"
18976
+ }
18977
+ },
18978
+ allowedContractVersions: {
18979
+ serializedName: "allowed_contract_versions",
18980
+ required: true,
18981
+ type: {
18982
+ name: "Sequence",
18983
+ element: {
18984
+ type: {
18985
+ name: "Composite",
18986
+ className: "ContractVersion"
18987
+ }
18988
+ }
18989
+ }
18990
+ },
18991
+ allowedOracleAbiVersions: {
18992
+ serializedName: "allowed_oracle_abi_versions",
18993
+ required: true,
18994
+ type: {
18995
+ name: "Sequence",
18996
+ element: {
18997
+ constraints: {
18998
+ InclusiveMaximum: 65535,
18999
+ InclusiveMinimum: 0
19000
+ },
19001
+ type: {
19002
+ name: "Number"
19003
+ }
19004
+ }
19005
+ }
19006
+ }
19007
+ }
19008
+ }
19009
+ };
19010
+ const CreateContractUnsignedTx = {
19011
+ type: {
19012
+ name: "Composite",
19013
+ className: "CreateContractUnsignedTx",
19014
+ modelProperties: {
19015
+ ...EncodedTx.type.modelProperties,
19016
+ contractId: {
19017
+ serializedName: "contract_id",
19018
+ required: true,
19019
+ type: {
19020
+ name: "String"
19021
+ }
19022
+ }
19023
+ }
19024
+ }
19025
+ };
19026
+ const SpendTx = {
19027
+ type: {
19028
+ name: "Composite",
19029
+ className: "SpendTx",
19030
+ modelProperties: {
19031
+ ...SpendTxInput.type.modelProperties
19032
+ }
19033
+ }
19034
+ };
19035
+ const NodeGetAccountByPubkeyExceptionHeaders = {
19036
+ type: {
19037
+ name: "Composite",
19038
+ className: "NodeGetAccountByPubkeyExceptionHeaders",
19039
+ modelProperties: {
19040
+ retryAfter: {
19041
+ constraints: {
19042
+ InclusiveMinimum: 0
19043
+ },
19044
+ serializedName: "retry-after",
19045
+ type: {
19046
+ name: "Number"
19047
+ }
19048
+ }
19049
+ }
19050
+ }
19051
+ };
19052
+ const NodeGetAccountByPubkeyAndHashExceptionHeaders = {
19053
+ type: {
19054
+ name: "Composite",
19055
+ className: "NodeGetAccountByPubkeyAndHashExceptionHeaders",
19056
+ modelProperties: {
19057
+ retryAfter: {
19058
+ constraints: {
19059
+ InclusiveMinimum: 0
19060
+ },
19061
+ serializedName: "retry-after",
19062
+ type: {
19063
+ name: "Number"
19064
+ }
19065
+ }
19066
+ }
19067
+ }
19068
+ };
19069
+ const NodeGetAccountByPubkeyAndHeightExceptionHeaders = {
19070
+ type: {
19071
+ name: "Composite",
19072
+ className: "NodeGetAccountByPubkeyAndHeightExceptionHeaders",
19073
+ modelProperties: {
19074
+ retryAfter: {
19075
+ constraints: {
19076
+ InclusiveMinimum: 0
19077
+ },
19078
+ serializedName: "retry-after",
19079
+ type: {
19080
+ name: "Number"
19081
+ }
19082
+ }
19083
+ }
19084
+ }
19085
+ };
19086
+ const NodeGetAccountNextNonceExceptionHeaders = {
19087
+ type: {
19088
+ name: "Composite",
19089
+ className: "NodeGetAccountNextNonceExceptionHeaders",
19090
+ modelProperties: {
19091
+ retryAfter: {
19092
+ constraints: {
19093
+ InclusiveMinimum: 0
19094
+ },
19095
+ serializedName: "retry-after",
19096
+ type: {
19097
+ name: "Number"
19098
+ }
19099
+ }
19100
+ }
19101
+ }
19102
+ };
19103
+ const NodeGetPendingAccountTransactionsByPubkeyExceptionHeaders = {
19104
+ type: {
19105
+ name: "Composite",
19106
+ className: "NodeGetPendingAccountTransactionsByPubkeyExceptionHeaders",
19107
+ modelProperties: {
19108
+ retryAfter: {
19109
+ constraints: {
19110
+ InclusiveMinimum: 0
19111
+ },
19112
+ serializedName: "retry-after",
19113
+ type: {
19114
+ name: "Number"
19115
+ }
19116
+ }
19117
+ }
19118
+ }
19119
+ };
19120
+ const NodeGetAuctionEntryByNameExceptionHeaders = {
19121
+ type: {
19122
+ name: "Composite",
19123
+ className: "NodeGetAuctionEntryByNameExceptionHeaders",
19124
+ modelProperties: {
19125
+ retryAfter: {
19126
+ constraints: {
19127
+ InclusiveMinimum: 0
19128
+ },
19129
+ serializedName: "retry-after",
19130
+ type: {
19131
+ name: "Number"
19132
+ }
19133
+ }
19134
+ }
19135
+ }
19136
+ };
19137
+ const NodeGetChannelByPubkeyExceptionHeaders = {
19138
+ type: {
19139
+ name: "Composite",
19140
+ className: "NodeGetChannelByPubkeyExceptionHeaders",
19141
+ modelProperties: {
19142
+ retryAfter: {
19143
+ constraints: {
19144
+ InclusiveMinimum: 0
19145
+ },
19146
+ serializedName: "retry-after",
19147
+ type: {
19148
+ name: "Number"
19149
+ }
19150
+ }
19151
+ }
19152
+ }
19153
+ };
19154
+ const NodeGetContractExceptionHeaders = {
19155
+ type: {
19156
+ name: "Composite",
19157
+ className: "NodeGetContractExceptionHeaders",
19158
+ modelProperties: {
19159
+ retryAfter: {
19160
+ constraints: {
19161
+ InclusiveMinimum: 0
19162
+ },
19163
+ serializedName: "retry-after",
19164
+ type: {
19165
+ name: "Number"
19166
+ }
19167
+ }
19168
+ }
19169
+ }
19170
+ };
19171
+ const NodeGetContractCodeExceptionHeaders = {
19172
+ type: {
19173
+ name: "Composite",
19174
+ className: "NodeGetContractCodeExceptionHeaders",
19175
+ modelProperties: {
19176
+ retryAfter: {
19177
+ constraints: {
19178
+ InclusiveMinimum: 0
19179
+ },
19180
+ serializedName: "retry-after",
19181
+ type: {
19182
+ name: "Number"
19183
+ }
19184
+ }
19185
+ }
19186
+ }
19187
+ };
19188
+ const NodeGetContractPoIExceptionHeaders = {
19189
+ type: {
19190
+ name: "Composite",
19191
+ className: "NodeGetContractPoIExceptionHeaders",
19192
+ modelProperties: {
19193
+ retryAfter: {
19194
+ constraints: {
19195
+ InclusiveMinimum: 0
19196
+ },
19197
+ serializedName: "retry-after",
19198
+ type: {
19199
+ name: "Number"
19200
+ }
19201
+ }
19202
+ }
19203
+ }
19204
+ };
19205
+ const NodeGetCurrencyExceptionHeaders = {
19206
+ type: {
19207
+ name: "Composite",
19208
+ className: "NodeGetCurrencyExceptionHeaders",
19209
+ modelProperties: {
19210
+ retryAfter: {
19211
+ constraints: {
19212
+ InclusiveMinimum: 0
19213
+ },
19214
+ serializedName: "retry-after",
19215
+ type: {
19216
+ name: "Number"
19217
+ }
19218
+ }
19219
+ }
19220
+ }
19221
+ };
19222
+ const NodeProtectedDryRunTxsExceptionHeaders = {
19223
+ type: {
19224
+ name: "Composite",
19225
+ className: "NodeProtectedDryRunTxsExceptionHeaders",
19226
+ modelProperties: {
19227
+ retryAfter: {
19228
+ constraints: {
19229
+ InclusiveMinimum: 0
19230
+ },
19231
+ serializedName: "retry-after",
19232
+ type: {
19233
+ name: "Number"
19234
+ }
19235
+ }
19236
+ }
19237
+ }
19238
+ };
19239
+ const NodeGetCurrentGenerationExceptionHeaders = {
19240
+ type: {
19241
+ name: "Composite",
19242
+ className: "NodeGetCurrentGenerationExceptionHeaders",
19243
+ modelProperties: {
19244
+ retryAfter: {
19245
+ constraints: {
19246
+ InclusiveMinimum: 0
19247
+ },
19248
+ serializedName: "retry-after",
19249
+ type: {
19250
+ name: "Number"
19251
+ }
19252
+ }
19253
+ }
19254
+ }
19255
+ };
19256
+ const NodeGetGenerationByHashExceptionHeaders = {
19257
+ type: {
19258
+ name: "Composite",
19259
+ className: "NodeGetGenerationByHashExceptionHeaders",
19260
+ modelProperties: {
19261
+ retryAfter: {
19262
+ constraints: {
19263
+ InclusiveMinimum: 0
19264
+ },
19265
+ serializedName: "retry-after",
19266
+ type: {
19267
+ name: "Number"
19268
+ }
19269
+ }
19270
+ }
19271
+ }
19272
+ };
19273
+ const NodeGetGenerationByHeightExceptionHeaders = {
19274
+ type: {
19275
+ name: "Composite",
19276
+ className: "NodeGetGenerationByHeightExceptionHeaders",
19277
+ modelProperties: {
19278
+ retryAfter: {
19279
+ constraints: {
19280
+ InclusiveMinimum: 0
19281
+ },
19282
+ serializedName: "retry-after",
19283
+ type: {
19284
+ name: "Number"
19285
+ }
19286
+ }
19287
+ }
19288
+ }
19289
+ };
19290
+ const NodeGetTopHeaderExceptionHeaders = {
19291
+ type: {
19292
+ name: "Composite",
19293
+ className: "NodeGetTopHeaderExceptionHeaders",
19294
+ modelProperties: {
19295
+ retryAfter: {
19296
+ constraints: {
19297
+ InclusiveMinimum: 0
19298
+ },
19299
+ serializedName: "retry-after",
19300
+ type: {
19301
+ name: "Number"
19302
+ }
19303
+ }
19304
+ }
19305
+ }
19306
+ };
19307
+ const NodeGetPinningTxExceptionHeaders = {
19308
+ type: {
19309
+ name: "Composite",
19310
+ className: "NodeGetPinningTxExceptionHeaders",
19311
+ modelProperties: {
19312
+ retryAfter: {
19313
+ constraints: {
19314
+ InclusiveMinimum: 0
19315
+ },
19316
+ serializedName: "retry-after",
19317
+ type: {
19318
+ name: "Number"
19319
+ }
19320
+ }
19321
+ }
19322
+ }
19323
+ };
19324
+ const NodeGetHyperchainContractPubkeysExceptionHeaders = {
19325
+ type: {
19326
+ name: "Composite",
19327
+ className: "NodeGetHyperchainContractPubkeysExceptionHeaders",
19328
+ modelProperties: {
19329
+ retryAfter: {
19330
+ constraints: {
19331
+ InclusiveMinimum: 0
19332
+ },
19333
+ serializedName: "retry-after",
19334
+ type: {
19335
+ name: "Number"
19336
+ }
19337
+ }
19338
+ }
19339
+ }
19340
+ };
19341
+ const NodeGetCurrentKeyBlockExceptionHeaders = {
19342
+ type: {
19343
+ name: "Composite",
19344
+ className: "NodeGetCurrentKeyBlockExceptionHeaders",
19345
+ modelProperties: {
19346
+ retryAfter: {
19347
+ constraints: {
19348
+ InclusiveMinimum: 0
19349
+ },
19350
+ serializedName: "retry-after",
19351
+ type: {
19352
+ name: "Number"
19353
+ }
19354
+ }
19355
+ }
19356
+ }
19357
+ };
19358
+ const NodeGetCurrentKeyBlockHashExceptionHeaders = {
19359
+ type: {
19360
+ name: "Composite",
19361
+ className: "NodeGetCurrentKeyBlockHashExceptionHeaders",
19362
+ modelProperties: {
19363
+ retryAfter: {
19364
+ constraints: {
19365
+ InclusiveMinimum: 0
19366
+ },
19367
+ serializedName: "retry-after",
19368
+ type: {
19369
+ name: "Number"
19370
+ }
19371
+ }
19372
+ }
19373
+ }
19374
+ };
19375
+ const NodeGetCurrentKeyBlockHeightExceptionHeaders = {
19376
+ type: {
19377
+ name: "Composite",
19378
+ className: "NodeGetCurrentKeyBlockHeightExceptionHeaders",
19379
+ modelProperties: {
19380
+ retryAfter: {
19381
+ constraints: {
19382
+ InclusiveMinimum: 0
19383
+ },
19384
+ serializedName: "retry-after",
19385
+ type: {
19386
+ name: "Number"
19387
+ }
19388
+ }
19389
+ }
19390
+ }
19391
+ };
19392
+ const NodeGetKeyBlockByHashExceptionHeaders = {
19393
+ type: {
19394
+ name: "Composite",
19395
+ className: "NodeGetKeyBlockByHashExceptionHeaders",
19396
+ modelProperties: {
19397
+ retryAfter: {
19398
+ constraints: {
19399
+ InclusiveMinimum: 0
19400
+ },
19401
+ serializedName: "retry-after",
19402
+ type: {
19403
+ name: "Number"
19404
+ }
19405
+ }
19406
+ }
19407
+ }
19408
+ };
19409
+ const NodeGetKeyBlockByHeightExceptionHeaders = {
19410
+ type: {
19411
+ name: "Composite",
19412
+ className: "NodeGetKeyBlockByHeightExceptionHeaders",
19413
+ modelProperties: {
19414
+ retryAfter: {
19415
+ constraints: {
17146
19416
  InclusiveMinimum: 0
17147
19417
  },
17148
- serializedName: "ttl",
19418
+ serializedName: "retry-after",
17149
19419
  type: {
17150
19420
  name: "Number"
17151
19421
  }
17152
- },
17153
- senderId: {
17154
- serializedName: "sender_id",
17155
- required: true,
17156
- type: {
17157
- name: "String"
17158
- }
17159
- },
17160
- nonce: {
19422
+ }
19423
+ }
19424
+ }
19425
+ };
19426
+ const NodeGetPendingKeyBlockExceptionHeaders = {
19427
+ type: {
19428
+ name: "Composite",
19429
+ className: "NodeGetPendingKeyBlockExceptionHeaders",
19430
+ modelProperties: {
19431
+ retryAfter: {
17161
19432
  constraints: {
17162
- InclusiveMaximum: 18446744073709552000,
17163
19433
  InclusiveMinimum: 0
17164
19434
  },
17165
- serializedName: "nonce",
19435
+ serializedName: "retry-after",
17166
19436
  type: {
17167
19437
  name: "Number"
17168
19438
  }
17169
- },
17170
- payload: {
17171
- serializedName: "payload",
17172
- required: true,
17173
- type: {
17174
- name: "String"
17175
- }
17176
19439
  }
17177
19440
  }
17178
19441
  }
17179
19442
  };
17180
- const TokenSupply = {
19443
+ const NodeGetMicroBlockHeaderByHashExceptionHeaders = {
17181
19444
  type: {
17182
19445
  name: "Composite",
17183
- className: "TokenSupply",
19446
+ className: "NodeGetMicroBlockHeaderByHashExceptionHeaders",
17184
19447
  modelProperties: {
17185
- accounts: {
19448
+ retryAfter: {
17186
19449
  constraints: {
17187
19450
  InclusiveMinimum: 0
17188
19451
  },
17189
- serializedName: "accounts",
19452
+ serializedName: "retry-after",
17190
19453
  type: {
17191
19454
  name: "Number"
17192
19455
  }
17193
- },
17194
- contracts: {
19456
+ }
19457
+ }
19458
+ }
19459
+ };
19460
+ const NodeGetMicroBlockTransactionsByHashExceptionHeaders = {
19461
+ type: {
19462
+ name: "Composite",
19463
+ className: "NodeGetMicroBlockTransactionsByHashExceptionHeaders",
19464
+ modelProperties: {
19465
+ retryAfter: {
17195
19466
  constraints: {
17196
19467
  InclusiveMinimum: 0
17197
19468
  },
17198
- serializedName: "contracts",
19469
+ serializedName: "retry-after",
17199
19470
  type: {
17200
19471
  name: "Number"
17201
19472
  }
17202
- },
17203
- contractOracles: {
19473
+ }
19474
+ }
19475
+ }
19476
+ };
19477
+ const NodeGetMicroBlockTransactionsCountByHashExceptionHeaders = {
19478
+ type: {
19479
+ name: "Composite",
19480
+ className: "NodeGetMicroBlockTransactionsCountByHashExceptionHeaders",
19481
+ modelProperties: {
19482
+ retryAfter: {
17204
19483
  constraints: {
17205
19484
  InclusiveMinimum: 0
17206
19485
  },
17207
- serializedName: "contract_oracles",
19486
+ serializedName: "retry-after",
17208
19487
  type: {
17209
19488
  name: "Number"
17210
19489
  }
17211
- },
17212
- locked: {
19490
+ }
19491
+ }
19492
+ }
19493
+ };
19494
+ const NodeGetMicroBlockTransactionByHashAndIndexExceptionHeaders = {
19495
+ type: {
19496
+ name: "Composite",
19497
+ className: "NodeGetMicroBlockTransactionByHashAndIndexExceptionHeaders",
19498
+ modelProperties: {
19499
+ retryAfter: {
17213
19500
  constraints: {
17214
19501
  InclusiveMinimum: 0
17215
19502
  },
17216
- serializedName: "locked",
19503
+ serializedName: "retry-after",
17217
19504
  type: {
17218
19505
  name: "Number"
17219
19506
  }
17220
- },
17221
- oracles: {
19507
+ }
19508
+ }
19509
+ }
19510
+ };
19511
+ const NodeGetNameEntryByNameExceptionHeaders = {
19512
+ type: {
19513
+ name: "Composite",
19514
+ className: "NodeGetNameEntryByNameExceptionHeaders",
19515
+ modelProperties: {
19516
+ retryAfter: {
17222
19517
  constraints: {
17223
19518
  InclusiveMinimum: 0
17224
19519
  },
17225
- serializedName: "oracles",
19520
+ serializedName: "retry-after",
17226
19521
  type: {
17227
19522
  name: "Number"
17228
19523
  }
17229
- },
17230
- oracleQueries: {
19524
+ }
19525
+ }
19526
+ }
19527
+ };
19528
+ const NodeGetNameEntryByNameHashExceptionHeaders = {
19529
+ type: {
19530
+ name: "Composite",
19531
+ className: "NodeGetNameEntryByNameHashExceptionHeaders",
19532
+ modelProperties: {
19533
+ retryAfter: {
17231
19534
  constraints: {
17232
19535
  InclusiveMinimum: 0
17233
19536
  },
17234
- serializedName: "oracle_queries",
19537
+ serializedName: "retry-after",
17235
19538
  type: {
17236
19539
  name: "Number"
17237
19540
  }
17238
- },
17239
- pendingRewards: {
19541
+ }
19542
+ }
19543
+ }
19544
+ };
19545
+ const NodeGetOracleByPubkeyExceptionHeaders = {
19546
+ type: {
19547
+ name: "Composite",
19548
+ className: "NodeGetOracleByPubkeyExceptionHeaders",
19549
+ modelProperties: {
19550
+ retryAfter: {
17240
19551
  constraints: {
17241
19552
  InclusiveMinimum: 0
17242
19553
  },
17243
- serializedName: "pending_rewards",
19554
+ serializedName: "retry-after",
17244
19555
  type: {
17245
19556
  name: "Number"
17246
19557
  }
17247
- },
17248
- total: {
19558
+ }
19559
+ }
19560
+ }
19561
+ };
19562
+ const NodeGetOracleQueriesByPubkeyExceptionHeaders = {
19563
+ type: {
19564
+ name: "Composite",
19565
+ className: "NodeGetOracleQueriesByPubkeyExceptionHeaders",
19566
+ modelProperties: {
19567
+ retryAfter: {
17249
19568
  constraints: {
17250
19569
  InclusiveMinimum: 0
17251
19570
  },
17252
- serializedName: "total",
19571
+ serializedName: "retry-after",
17253
19572
  type: {
17254
19573
  name: "Number"
17255
19574
  }
@@ -17257,257 +19576,188 @@ const TokenSupply = {
17257
19576
  }
17258
19577
  }
17259
19578
  };
17260
- const OffChainCallContract = {
17261
- serializedName: "OffChainCallContract",
19579
+ const NodeGetOracleQueryByPubkeyAndQueryIdExceptionHeaders = {
17262
19580
  type: {
17263
19581
  name: "Composite",
17264
- className: "OffChainCallContract",
17265
- uberParent: "OffChainUpdate",
17266
- polymorphicDiscriminator: OffChainUpdate.type.polymorphicDiscriminator,
19582
+ className: "NodeGetOracleQueryByPubkeyAndQueryIdExceptionHeaders",
17267
19583
  modelProperties: {
17268
- ...OffChainUpdate.type.modelProperties,
17269
- caller: {
17270
- serializedName: "caller",
17271
- required: true,
17272
- type: {
17273
- name: "String"
17274
- }
17275
- },
17276
- contract: {
17277
- serializedName: "contract",
17278
- required: true,
17279
- type: {
17280
- name: "String"
17281
- }
17282
- },
17283
- abiVersion: {
19584
+ retryAfter: {
17284
19585
  constraints: {
17285
- InclusiveMaximum: 65535,
17286
19586
  InclusiveMinimum: 0
17287
19587
  },
17288
- serializedName: "abi_version",
17289
- required: true,
19588
+ serializedName: "retry-after",
17290
19589
  type: {
17291
19590
  name: "Number"
17292
19591
  }
17293
- },
17294
- amount: {
19592
+ }
19593
+ }
19594
+ }
19595
+ };
19596
+ const NodeGetPeerPubkeyExceptionHeaders = {
19597
+ type: {
19598
+ name: "Composite",
19599
+ className: "NodeGetPeerPubkeyExceptionHeaders",
19600
+ modelProperties: {
19601
+ retryAfter: {
17295
19602
  constraints: {
17296
19603
  InclusiveMinimum: 0
17297
19604
  },
17298
- serializedName: "amount",
17299
- required: true,
19605
+ serializedName: "retry-after",
17300
19606
  type: {
17301
- // @ts-expect-error we are extending autorest with BigInt support
17302
- name: "BigInt"
19607
+ name: "Number"
17303
19608
  }
17304
- },
17305
- gas: {
19609
+ }
19610
+ }
19611
+ }
19612
+ };
19613
+ const NodeGetRecentGasPricesExceptionHeaders = {
19614
+ type: {
19615
+ name: "Composite",
19616
+ className: "NodeGetRecentGasPricesExceptionHeaders",
19617
+ modelProperties: {
19618
+ retryAfter: {
17306
19619
  constraints: {
17307
- InclusiveMaximum: 18446744073709552000,
17308
19620
  InclusiveMinimum: 0
17309
19621
  },
17310
- serializedName: "gas",
17311
- required: true,
19622
+ serializedName: "retry-after",
17312
19623
  type: {
17313
19624
  name: "Number"
17314
19625
  }
17315
- },
17316
- gasPrice: {
19626
+ }
19627
+ }
19628
+ }
19629
+ };
19630
+ const NodeGetNodeSettingsExceptionHeaders = {
19631
+ type: {
19632
+ name: "Composite",
19633
+ className: "NodeGetNodeSettingsExceptionHeaders",
19634
+ modelProperties: {
19635
+ retryAfter: {
17317
19636
  constraints: {
17318
19637
  InclusiveMinimum: 0
17319
19638
  },
17320
- serializedName: "gas_price",
17321
- required: true,
17322
- type: {
17323
- // @ts-expect-error we are extending autorest with BigInt support
17324
- name: "BigInt"
17325
- }
17326
- },
17327
- callData: {
17328
- serializedName: "call_data",
17329
- required: true,
19639
+ serializedName: "retry-after",
17330
19640
  type: {
17331
- name: "String"
19641
+ name: "Number"
17332
19642
  }
17333
19643
  }
17334
19644
  }
17335
19645
  }
17336
19646
  };
17337
- const OffChainDeposit = {
17338
- serializedName: "OffChainDeposit",
19647
+ const NodeGetProtocolParametersExceptionHeaders = {
17339
19648
  type: {
17340
19649
  name: "Composite",
17341
- className: "OffChainDeposit",
17342
- uberParent: "OffChainUpdate",
17343
- polymorphicDiscriminator: OffChainUpdate.type.polymorphicDiscriminator,
19650
+ className: "NodeGetProtocolParametersExceptionHeaders",
17344
19651
  modelProperties: {
17345
- ...OffChainUpdate.type.modelProperties,
17346
- from: {
17347
- serializedName: "from",
17348
- required: true,
17349
- type: {
17350
- name: "String"
17351
- }
17352
- },
17353
- amount: {
19652
+ retryAfter: {
17354
19653
  constraints: {
17355
19654
  InclusiveMinimum: 0
17356
19655
  },
17357
- serializedName: "amount",
17358
- required: true,
19656
+ serializedName: "retry-after",
17359
19657
  type: {
17360
- // @ts-expect-error we are extending autorest with BigInt support
17361
- name: "BigInt"
19658
+ name: "Number"
17362
19659
  }
17363
19660
  }
17364
19661
  }
17365
19662
  }
17366
19663
  };
17367
- const OffChainNewContract = {
17368
- serializedName: "OffChainNewContract",
19664
+ const NodeGetStatusExceptionHeaders = {
17369
19665
  type: {
17370
19666
  name: "Composite",
17371
- className: "OffChainNewContract",
17372
- uberParent: "OffChainUpdate",
17373
- polymorphicDiscriminator: OffChainUpdate.type.polymorphicDiscriminator,
19667
+ className: "NodeGetStatusExceptionHeaders",
17374
19668
  modelProperties: {
17375
- ...OffChainUpdate.type.modelProperties,
17376
- owner: {
17377
- serializedName: "owner",
17378
- required: true,
17379
- type: {
17380
- name: "String"
17381
- }
17382
- },
17383
- vmVersion: {
19669
+ retryAfter: {
17384
19670
  constraints: {
17385
- InclusiveMaximum: 65535,
17386
19671
  InclusiveMinimum: 0
17387
19672
  },
17388
- serializedName: "vm_version",
17389
- required: true,
19673
+ serializedName: "retry-after",
17390
19674
  type: {
17391
19675
  name: "Number"
17392
19676
  }
17393
- },
17394
- abiVersion: {
19677
+ }
19678
+ }
19679
+ }
19680
+ };
19681
+ const NodeGetChainEndsExceptionHeaders = {
19682
+ type: {
19683
+ name: "Composite",
19684
+ className: "NodeGetChainEndsExceptionHeaders",
19685
+ modelProperties: {
19686
+ retryAfter: {
17395
19687
  constraints: {
17396
- InclusiveMaximum: 65535,
17397
19688
  InclusiveMinimum: 0
17398
19689
  },
17399
- serializedName: "abi_version",
17400
- required: true,
19690
+ serializedName: "retry-after",
17401
19691
  type: {
17402
19692
  name: "Number"
17403
19693
  }
17404
- },
17405
- code: {
17406
- serializedName: "code",
17407
- type: {
17408
- name: "Composite",
17409
- className: "ByteCode"
17410
- }
17411
- },
17412
- deposit: {
19694
+ }
19695
+ }
19696
+ }
19697
+ };
19698
+ const NodeGetSyncStatusExceptionHeaders = {
19699
+ type: {
19700
+ name: "Composite",
19701
+ className: "NodeGetSyncStatusExceptionHeaders",
19702
+ modelProperties: {
19703
+ retryAfter: {
17413
19704
  constraints: {
17414
19705
  InclusiveMinimum: 0
17415
19706
  },
17416
- serializedName: "deposit",
17417
- required: true,
17418
- type: {
17419
- // @ts-expect-error we are extending autorest with BigInt support
17420
- name: "BigInt"
17421
- }
17422
- },
17423
- callData: {
17424
- serializedName: "call_data",
17425
- required: true,
19707
+ serializedName: "retry-after",
17426
19708
  type: {
17427
- name: "String"
19709
+ name: "Number"
17428
19710
  }
17429
19711
  }
17430
19712
  }
17431
19713
  }
17432
19714
  };
17433
- const OffChainTransfer = {
17434
- serializedName: "OffChainTransfer",
19715
+ const NodePostTransactionExceptionHeaders = {
17435
19716
  type: {
17436
19717
  name: "Composite",
17437
- className: "OffChainTransfer",
17438
- uberParent: "OffChainUpdate",
17439
- polymorphicDiscriminator: OffChainUpdate.type.polymorphicDiscriminator,
19718
+ className: "NodePostTransactionExceptionHeaders",
17440
19719
  modelProperties: {
17441
- ...OffChainUpdate.type.modelProperties,
17442
- from: {
17443
- serializedName: "from",
17444
- required: true,
17445
- type: {
17446
- name: "String"
17447
- }
17448
- },
17449
- to: {
17450
- serializedName: "to",
17451
- required: true,
17452
- type: {
17453
- name: "String"
17454
- }
17455
- },
17456
- amount: {
19720
+ retryAfter: {
17457
19721
  constraints: {
17458
19722
  InclusiveMinimum: 0
17459
19723
  },
17460
- serializedName: "amount",
17461
- required: true,
19724
+ serializedName: "retry-after",
17462
19725
  type: {
17463
- // @ts-expect-error we are extending autorest with BigInt support
17464
- name: "BigInt"
19726
+ name: "Number"
17465
19727
  }
17466
19728
  }
17467
19729
  }
17468
19730
  }
17469
19731
  };
17470
- const OffChainWithdrawal = {
17471
- serializedName: "OffChainWithdrawal",
19732
+ const NodeGetTransactionByHashExceptionHeaders = {
17472
19733
  type: {
17473
19734
  name: "Composite",
17474
- className: "OffChainWithdrawal",
17475
- uberParent: "OffChainUpdate",
17476
- polymorphicDiscriminator: OffChainUpdate.type.polymorphicDiscriminator,
19735
+ className: "NodeGetTransactionByHashExceptionHeaders",
17477
19736
  modelProperties: {
17478
- ...OffChainUpdate.type.modelProperties,
17479
- to: {
17480
- serializedName: "to",
17481
- required: true,
17482
- type: {
17483
- name: "String"
17484
- }
17485
- },
17486
- amount: {
19737
+ retryAfter: {
17487
19738
  constraints: {
17488
19739
  InclusiveMinimum: 0
17489
19740
  },
17490
- serializedName: "amount",
17491
- required: true,
19741
+ serializedName: "retry-after",
17492
19742
  type: {
17493
- // @ts-expect-error we are extending autorest with BigInt support
17494
- name: "BigInt"
19743
+ name: "Number"
17495
19744
  }
17496
19745
  }
17497
19746
  }
17498
19747
  }
17499
19748
  };
17500
- const CreateContractUnsignedTx = {
19749
+ const NodeGetTransactionInfoByHashExceptionHeaders = {
17501
19750
  type: {
17502
19751
  name: "Composite",
17503
- className: "CreateContractUnsignedTx",
19752
+ className: "NodeGetTransactionInfoByHashExceptionHeaders",
17504
19753
  modelProperties: {
17505
- ...UnsignedTx.type.modelProperties,
17506
- contractId: {
17507
- serializedName: "contract_id",
17508
- required: true,
19754
+ retryAfter: {
19755
+ constraints: {
19756
+ InclusiveMinimum: 0
19757
+ },
19758
+ serializedName: "retry-after",
17509
19759
  type: {
17510
- name: "String"
19760
+ name: "Number"
17511
19761
  }
17512
19762
  }
17513
19763
  }
@@ -17863,9 +20113,11 @@ class node_Node extends core_client_.ServiceClient {
17863
20113
 
17864
20114
  /**
17865
20115
  * Dry-run unsigned transactions on top of a given block. Supports all TXs except GAMetaTx, PayingForTx
17866
- * and OffchainTx. The maximum gas limit of all calls is capped. The maximum gas limit per request is a
17867
- * global node setting. Since DryRunCallReq object do not have a mandatory gas field, if not set a
17868
- * default value of 1000000 is being used instead.
20116
+ * and OffchainTx. Gas defaults to 1000000 when not set on a call request; total gas per request is
20117
+ * capped by a node-configured limit. FATE contract-storage reads are metered at a size-proportional
20118
+ * gas cost, so reported gas is an estimate of the on-chain cost, not an exact figure. Reported gas is
20119
+ * never below what the same call costs on chain at the currently activated protocol, because each
20120
+ * repriced storage register read is floored at that charge.
17869
20121
  * @param body transactions
17870
20122
  * @param options The options parameters.
17871
20123
  */
@@ -17974,7 +20226,7 @@ class node_Node extends core_client_.ServiceClient {
17974
20226
 
17975
20227
  /**
17976
20228
  * Get a key block by hash
17977
- * @param hash The hash of the block - either a keyblock or a microblock
20229
+ * @param hash The hash of the key block
17978
20230
  * @param options The options parameters.
17979
20231
  */
17980
20232
  getKeyBlockByHash(hash, options) {
@@ -18008,7 +20260,7 @@ class node_Node extends core_client_.ServiceClient {
18008
20260
 
18009
20261
  /**
18010
20262
  * Get a micro block header by hash
18011
- * @param hash The hash of the block - either a keyblock or a microblock
20263
+ * @param hash The hash of the micro block
18012
20264
  * @param options The options parameters.
18013
20265
  */
18014
20266
  getMicroBlockHeaderByHash(hash, options) {
@@ -18138,6 +20390,36 @@ class node_Node extends core_client_.ServiceClient {
18138
20390
  }, getRecentGasPricesOperationSpec);
18139
20391
  }
18140
20392
 
20393
+ /**
20394
+ * Get this node's local policy settings. These are not consensus rules: they are operator
20395
+ * configuration, they may differ between nodes, and an operator can change them at runtime.
20396
+ * min_miner_gas_price is a decimal string; the other values are JSON numbers, or strings when
20397
+ * int-as-string=true.
20398
+ * @param options The options parameters.
20399
+ */
20400
+ getNodeSettings(options) {
20401
+ return this.sendOperationRequest({
20402
+ options
20403
+ }, getNodeSettingsOperationSpec);
20404
+ }
20405
+
20406
+ /**
20407
+ * Get the consensus protocol parameters needed to build valid transactions. Covers the protocol
20408
+ * effective at the current top block and any later protocol whose fork height has not been reached
20409
+ * yet; a community fork under signalling is reported only once it has activated, since until then it
20410
+ * may still fail to. See /node-settings for this node's local policy. Aettos amounts
20411
+ * (minimum_gas_price, name_claim_fees, name_claim_locked_fee) are always decimal strings, never JSON
20412
+ * numbers: the largest name fee is about 2^69 and would lose precision in an IEEE-754 client. Gas, key
20413
+ * block heights, counts and version numbers are JSON numbers; pass int-as-string=true to receive those
20414
+ * as strings too.
20415
+ * @param options The options parameters.
20416
+ */
20417
+ getProtocolParameters(options) {
20418
+ return this.sendOperationRequest({
20419
+ options
20420
+ }, getProtocolParametersOperationSpec);
20421
+ }
20422
+
18141
20423
  /**
18142
20424
  * Get the status of a node
18143
20425
  * @param options The options parameters.
@@ -18219,6 +20501,11 @@ const getAccountByPubkeyOperationSpec = {
18219
20501
  404: {
18220
20502
  bodyMapper: ErrorModel,
18221
20503
  isError: true
20504
+ },
20505
+ 503: {
20506
+ bodyMapper: ErrorModel,
20507
+ headersMapper: NodeGetAccountByPubkeyExceptionHeaders,
20508
+ isError: true
18222
20509
  }
18223
20510
  },
18224
20511
  urlParameters: [$host, pubkey],
@@ -18239,6 +20526,11 @@ const getAccountByPubkeyAndHashOperationSpec = {
18239
20526
  404: {
18240
20527
  bodyMapper: ErrorModel,
18241
20528
  isError: true
20529
+ },
20530
+ 503: {
20531
+ bodyMapper: ErrorModel,
20532
+ headersMapper: NodeGetAccountByPubkeyAndHashExceptionHeaders,
20533
+ isError: true
18242
20534
  }
18243
20535
  },
18244
20536
  urlParameters: [$host, pubkey, parameters_hash],
@@ -18263,6 +20555,11 @@ const getAccountByPubkeyAndHeightOperationSpec = {
18263
20555
  410: {
18264
20556
  bodyMapper: ErrorModel,
18265
20557
  isError: true
20558
+ },
20559
+ 503: {
20560
+ bodyMapper: ErrorModel,
20561
+ headersMapper: NodeGetAccountByPubkeyAndHeightExceptionHeaders,
20562
+ isError: true
18266
20563
  }
18267
20564
  },
18268
20565
  urlParameters: [$host, pubkey, height],
@@ -18283,6 +20580,11 @@ const getAccountNextNonceOperationSpec = {
18283
20580
  404: {
18284
20581
  bodyMapper: ErrorModel,
18285
20582
  isError: true
20583
+ },
20584
+ 503: {
20585
+ bodyMapper: ErrorModel,
20586
+ headersMapper: NodeGetAccountNextNonceExceptionHeaders,
20587
+ isError: true
18286
20588
  }
18287
20589
  },
18288
20590
  queryParameters: [strategy],
@@ -18304,6 +20606,11 @@ const getPendingAccountTransactionsByPubkeyOperationSpec = {
18304
20606
  404: {
18305
20607
  bodyMapper: ErrorModel,
18306
20608
  isError: true
20609
+ },
20610
+ 503: {
20611
+ bodyMapper: ErrorModel,
20612
+ headersMapper: NodeGetPendingAccountTransactionsByPubkeyExceptionHeaders,
20613
+ isError: true
18307
20614
  }
18308
20615
  },
18309
20616
  urlParameters: [$host, pubkey],
@@ -18324,6 +20631,11 @@ const getAuctionEntryByNameOperationSpec = {
18324
20631
  404: {
18325
20632
  bodyMapper: ErrorModel,
18326
20633
  isError: true
20634
+ },
20635
+ 503: {
20636
+ bodyMapper: ErrorModel,
20637
+ headersMapper: NodeGetAuctionEntryByNameExceptionHeaders,
20638
+ isError: true
18327
20639
  }
18328
20640
  },
18329
20641
  urlParameters: [$host, parameters_name],
@@ -18344,6 +20656,11 @@ const getChannelByPubkeyOperationSpec = {
18344
20656
  404: {
18345
20657
  bodyMapper: ErrorModel,
18346
20658
  isError: true
20659
+ },
20660
+ 503: {
20661
+ bodyMapper: ErrorModel,
20662
+ headersMapper: NodeGetChannelByPubkeyExceptionHeaders,
20663
+ isError: true
18347
20664
  }
18348
20665
  },
18349
20666
  urlParameters: [$host, pubkey],
@@ -18364,6 +20681,11 @@ const getContractOperationSpec = {
18364
20681
  404: {
18365
20682
  bodyMapper: ErrorModel,
18366
20683
  isError: true
20684
+ },
20685
+ 503: {
20686
+ bodyMapper: ErrorModel,
20687
+ headersMapper: NodeGetContractExceptionHeaders,
20688
+ isError: true
18367
20689
  }
18368
20690
  },
18369
20691
  urlParameters: [$host, pubkey],
@@ -18384,6 +20706,11 @@ const getContractCodeOperationSpec = {
18384
20706
  404: {
18385
20707
  bodyMapper: ErrorModel,
18386
20708
  isError: true
20709
+ },
20710
+ 503: {
20711
+ bodyMapper: ErrorModel,
20712
+ headersMapper: NodeGetContractCodeExceptionHeaders,
20713
+ isError: true
18387
20714
  }
18388
20715
  },
18389
20716
  urlParameters: [$host, pubkey],
@@ -18404,6 +20731,11 @@ const getContractPoIOperationSpec = {
18404
20731
  404: {
18405
20732
  bodyMapper: ErrorModel,
18406
20733
  isError: true
20734
+ },
20735
+ 503: {
20736
+ bodyMapper: ErrorModel,
20737
+ headersMapper: NodeGetContractPoIExceptionHeaders,
20738
+ isError: true
18407
20739
  }
18408
20740
  },
18409
20741
  urlParameters: [$host, pubkey],
@@ -18416,6 +20748,11 @@ const getCurrencyOperationSpec = {
18416
20748
  responses: {
18417
20749
  200: {
18418
20750
  bodyMapper: Currency
20751
+ },
20752
+ 503: {
20753
+ bodyMapper: ErrorModel,
20754
+ headersMapper: NodeGetCurrencyExceptionHeaders,
20755
+ isError: true
18419
20756
  }
18420
20757
  },
18421
20758
  urlParameters: [$host],
@@ -18436,6 +20773,11 @@ const protectedDryRunTxsOperationSpec = {
18436
20773
  403: {
18437
20774
  bodyMapper: ErrorModel,
18438
20775
  isError: true
20776
+ },
20777
+ 503: {
20778
+ bodyMapper: ErrorModel,
20779
+ headersMapper: NodeProtectedDryRunTxsExceptionHeaders,
20780
+ isError: true
18439
20781
  }
18440
20782
  },
18441
20783
  requestBody: body,
@@ -18454,6 +20796,11 @@ const getCurrentGenerationOperationSpec = {
18454
20796
  404: {
18455
20797
  bodyMapper: ErrorModel,
18456
20798
  isError: true
20799
+ },
20800
+ 503: {
20801
+ bodyMapper: ErrorModel,
20802
+ headersMapper: NodeGetCurrentGenerationExceptionHeaders,
20803
+ isError: true
18457
20804
  }
18458
20805
  },
18459
20806
  urlParameters: [$host],
@@ -18474,6 +20821,11 @@ const getGenerationByHashOperationSpec = {
18474
20821
  404: {
18475
20822
  bodyMapper: ErrorModel,
18476
20823
  isError: true
20824
+ },
20825
+ 503: {
20826
+ bodyMapper: ErrorModel,
20827
+ headersMapper: NodeGetGenerationByHashExceptionHeaders,
20828
+ isError: true
18477
20829
  }
18478
20830
  },
18479
20831
  urlParameters: [$host, parameters_hash],
@@ -18490,6 +20842,11 @@ const getGenerationByHeightOperationSpec = {
18490
20842
  404: {
18491
20843
  bodyMapper: ErrorModel,
18492
20844
  isError: true
20845
+ },
20846
+ 503: {
20847
+ bodyMapper: ErrorModel,
20848
+ headersMapper: NodeGetGenerationByHeightExceptionHeaders,
20849
+ isError: true
18493
20850
  }
18494
20851
  },
18495
20852
  urlParameters: [$host, height],
@@ -18506,6 +20863,11 @@ const getTopHeaderOperationSpec = {
18506
20863
  404: {
18507
20864
  bodyMapper: ErrorModel,
18508
20865
  isError: true
20866
+ },
20867
+ 503: {
20868
+ bodyMapper: ErrorModel,
20869
+ headersMapper: NodeGetTopHeaderExceptionHeaders,
20870
+ isError: true
18509
20871
  }
18510
20872
  },
18511
20873
  urlParameters: [$host],
@@ -18522,6 +20884,11 @@ const getPinningTxOperationSpec = {
18522
20884
  404: {
18523
20885
  bodyMapper: ErrorModel,
18524
20886
  isError: true
20887
+ },
20888
+ 503: {
20889
+ bodyMapper: ErrorModel,
20890
+ headersMapper: NodeGetPinningTxExceptionHeaders,
20891
+ isError: true
18525
20892
  }
18526
20893
  },
18527
20894
  urlParameters: [$host],
@@ -18538,6 +20905,11 @@ const getHyperchainContractPubkeysOperationSpec = {
18538
20905
  404: {
18539
20906
  bodyMapper: ErrorModel,
18540
20907
  isError: true
20908
+ },
20909
+ 503: {
20910
+ bodyMapper: ErrorModel,
20911
+ headersMapper: NodeGetHyperchainContractPubkeysExceptionHeaders,
20912
+ isError: true
18541
20913
  }
18542
20914
  },
18543
20915
  urlParameters: [$host],
@@ -18554,6 +20926,11 @@ const getCurrentKeyBlockOperationSpec = {
18554
20926
  404: {
18555
20927
  bodyMapper: ErrorModel,
18556
20928
  isError: true
20929
+ },
20930
+ 503: {
20931
+ bodyMapper: ErrorModel,
20932
+ headersMapper: NodeGetCurrentKeyBlockExceptionHeaders,
20933
+ isError: true
18557
20934
  }
18558
20935
  },
18559
20936
  urlParameters: [$host],
@@ -18570,6 +20947,11 @@ const getCurrentKeyBlockHashOperationSpec = {
18570
20947
  404: {
18571
20948
  bodyMapper: ErrorModel,
18572
20949
  isError: true
20950
+ },
20951
+ 503: {
20952
+ bodyMapper: ErrorModel,
20953
+ headersMapper: NodeGetCurrentKeyBlockHashExceptionHeaders,
20954
+ isError: true
18573
20955
  }
18574
20956
  },
18575
20957
  urlParameters: [$host],
@@ -18586,6 +20968,11 @@ const getCurrentKeyBlockHeightOperationSpec = {
18586
20968
  404: {
18587
20969
  bodyMapper: ErrorModel,
18588
20970
  isError: true
20971
+ },
20972
+ 503: {
20973
+ bodyMapper: ErrorModel,
20974
+ headersMapper: NodeGetCurrentKeyBlockHeightExceptionHeaders,
20975
+ isError: true
18589
20976
  }
18590
20977
  },
18591
20978
  urlParameters: [$host],
@@ -18606,6 +20993,11 @@ const getKeyBlockByHashOperationSpec = {
18606
20993
  404: {
18607
20994
  bodyMapper: ErrorModel,
18608
20995
  isError: true
20996
+ },
20997
+ 503: {
20998
+ bodyMapper: ErrorModel,
20999
+ headersMapper: NodeGetKeyBlockByHashExceptionHeaders,
21000
+ isError: true
18609
21001
  }
18610
21002
  },
18611
21003
  urlParameters: [$host, parameters_hash],
@@ -18622,6 +21014,11 @@ const getKeyBlockByHeightOperationSpec = {
18622
21014
  404: {
18623
21015
  bodyMapper: ErrorModel,
18624
21016
  isError: true
21017
+ },
21018
+ 503: {
21019
+ bodyMapper: ErrorModel,
21020
+ headersMapper: NodeGetKeyBlockByHeightExceptionHeaders,
21021
+ isError: true
18625
21022
  }
18626
21023
  },
18627
21024
  urlParameters: [$host, height],
@@ -18642,6 +21039,11 @@ const getPendingKeyBlockOperationSpec = {
18642
21039
  404: {
18643
21040
  bodyMapper: ErrorModel,
18644
21041
  isError: true
21042
+ },
21043
+ 503: {
21044
+ bodyMapper: ErrorModel,
21045
+ headersMapper: NodeGetPendingKeyBlockExceptionHeaders,
21046
+ isError: true
18645
21047
  }
18646
21048
  },
18647
21049
  urlParameters: [$host],
@@ -18662,6 +21064,11 @@ const getMicroBlockHeaderByHashOperationSpec = {
18662
21064
  404: {
18663
21065
  bodyMapper: ErrorModel,
18664
21066
  isError: true
21067
+ },
21068
+ 503: {
21069
+ bodyMapper: ErrorModel,
21070
+ headersMapper: NodeGetMicroBlockHeaderByHashExceptionHeaders,
21071
+ isError: true
18665
21072
  }
18666
21073
  },
18667
21074
  urlParameters: [$host, parameters_hash],
@@ -18682,6 +21089,11 @@ const getMicroBlockTransactionsByHashOperationSpec = {
18682
21089
  404: {
18683
21090
  bodyMapper: ErrorModel,
18684
21091
  isError: true
21092
+ },
21093
+ 503: {
21094
+ bodyMapper: ErrorModel,
21095
+ headersMapper: NodeGetMicroBlockTransactionsByHashExceptionHeaders,
21096
+ isError: true
18685
21097
  }
18686
21098
  },
18687
21099
  urlParameters: [$host, parameters_hash],
@@ -18702,6 +21114,11 @@ const getMicroBlockTransactionsCountByHashOperationSpec = {
18702
21114
  404: {
18703
21115
  bodyMapper: ErrorModel,
18704
21116
  isError: true
21117
+ },
21118
+ 503: {
21119
+ bodyMapper: ErrorModel,
21120
+ headersMapper: NodeGetMicroBlockTransactionsCountByHashExceptionHeaders,
21121
+ isError: true
18705
21122
  }
18706
21123
  },
18707
21124
  urlParameters: [$host, parameters_hash],
@@ -18722,6 +21139,11 @@ const getMicroBlockTransactionByHashAndIndexOperationSpec = {
18722
21139
  404: {
18723
21140
  bodyMapper: ErrorModel,
18724
21141
  isError: true
21142
+ },
21143
+ 503: {
21144
+ bodyMapper: ErrorModel,
21145
+ headersMapper: NodeGetMicroBlockTransactionByHashAndIndexExceptionHeaders,
21146
+ isError: true
18725
21147
  }
18726
21148
  },
18727
21149
  urlParameters: [$host, parameters_hash, index],
@@ -18742,6 +21164,11 @@ const getNameEntryByNameOperationSpec = {
18742
21164
  404: {
18743
21165
  bodyMapper: ErrorModel,
18744
21166
  isError: true
21167
+ },
21168
+ 503: {
21169
+ bodyMapper: ErrorModel,
21170
+ headersMapper: NodeGetNameEntryByNameExceptionHeaders,
21171
+ isError: true
18745
21172
  }
18746
21173
  },
18747
21174
  urlParameters: [$host, parameters_name],
@@ -18762,6 +21189,11 @@ const getNameEntryByNameHashOperationSpec = {
18762
21189
  404: {
18763
21190
  bodyMapper: ErrorModel,
18764
21191
  isError: true
21192
+ },
21193
+ 503: {
21194
+ bodyMapper: ErrorModel,
21195
+ headersMapper: NodeGetNameEntryByNameHashExceptionHeaders,
21196
+ isError: true
18765
21197
  }
18766
21198
  },
18767
21199
  urlParameters: [$host, nameHash],
@@ -18782,6 +21214,11 @@ const getOracleByPubkeyOperationSpec = {
18782
21214
  404: {
18783
21215
  bodyMapper: ErrorModel,
18784
21216
  isError: true
21217
+ },
21218
+ 503: {
21219
+ bodyMapper: ErrorModel,
21220
+ headersMapper: NodeGetOracleByPubkeyExceptionHeaders,
21221
+ isError: true
18785
21222
  }
18786
21223
  },
18787
21224
  urlParameters: [$host, pubkey],
@@ -18802,6 +21239,11 @@ const getOracleQueriesByPubkeyOperationSpec = {
18802
21239
  404: {
18803
21240
  bodyMapper: ErrorModel,
18804
21241
  isError: true
21242
+ },
21243
+ 503: {
21244
+ bodyMapper: ErrorModel,
21245
+ headersMapper: NodeGetOracleQueriesByPubkeyExceptionHeaders,
21246
+ isError: true
18805
21247
  }
18806
21248
  },
18807
21249
  queryParameters: [fromParam, limit, typeParam],
@@ -18823,6 +21265,11 @@ const getOracleQueryByPubkeyAndQueryIdOperationSpec = {
18823
21265
  404: {
18824
21266
  bodyMapper: ErrorModel,
18825
21267
  isError: true
21268
+ },
21269
+ 503: {
21270
+ bodyMapper: ErrorModel,
21271
+ headersMapper: NodeGetOracleQueryByPubkeyAndQueryIdExceptionHeaders,
21272
+ isError: true
18826
21273
  }
18827
21274
  },
18828
21275
  urlParameters: [$host, pubkey, queryId],
@@ -18835,6 +21282,11 @@ const getPeerPubkeyOperationSpec = {
18835
21282
  responses: {
18836
21283
  200: {
18837
21284
  bodyMapper: PeerPubKey
21285
+ },
21286
+ 503: {
21287
+ bodyMapper: ErrorModel,
21288
+ headersMapper: NodeGetPeerPubkeyExceptionHeaders,
21289
+ isError: true
18838
21290
  }
18839
21291
  },
18840
21292
  urlParameters: [$host],
@@ -18861,6 +21313,45 @@ const getRecentGasPricesOperationSpec = {
18861
21313
  400: {
18862
21314
  bodyMapper: ErrorModel,
18863
21315
  isError: true
21316
+ },
21317
+ 503: {
21318
+ bodyMapper: ErrorModel,
21319
+ headersMapper: NodeGetRecentGasPricesExceptionHeaders,
21320
+ isError: true
21321
+ }
21322
+ },
21323
+ urlParameters: [$host],
21324
+ headerParameters: [accept],
21325
+ serializer
21326
+ };
21327
+ const getNodeSettingsOperationSpec = {
21328
+ path: "/v3/node-settings",
21329
+ httpMethod: "GET",
21330
+ responses: {
21331
+ 200: {
21332
+ bodyMapper: NodeSettings
21333
+ },
21334
+ 503: {
21335
+ bodyMapper: ErrorModel,
21336
+ headersMapper: NodeGetNodeSettingsExceptionHeaders,
21337
+ isError: true
21338
+ }
21339
+ },
21340
+ urlParameters: [$host],
21341
+ headerParameters: [accept],
21342
+ serializer
21343
+ };
21344
+ const getProtocolParametersOperationSpec = {
21345
+ path: "/v3/protocol-parameters",
21346
+ httpMethod: "GET",
21347
+ responses: {
21348
+ 200: {
21349
+ bodyMapper: ProtocolParameters
21350
+ },
21351
+ 503: {
21352
+ bodyMapper: ErrorModel,
21353
+ headersMapper: NodeGetProtocolParametersExceptionHeaders,
21354
+ isError: true
18864
21355
  }
18865
21356
  },
18866
21357
  urlParameters: [$host],
@@ -18873,6 +21364,11 @@ const getStatusOperationSpec = {
18873
21364
  responses: {
18874
21365
  200: {
18875
21366
  bodyMapper: Status
21367
+ },
21368
+ 503: {
21369
+ bodyMapper: ErrorModel,
21370
+ headersMapper: NodeGetStatusExceptionHeaders,
21371
+ isError: true
18876
21372
  }
18877
21373
  },
18878
21374
  urlParameters: [$host],
@@ -18894,6 +21390,11 @@ const getChainEndsOperationSpec = {
18894
21390
  }
18895
21391
  }
18896
21392
  }
21393
+ },
21394
+ 503: {
21395
+ bodyMapper: ErrorModel,
21396
+ headersMapper: NodeGetChainEndsExceptionHeaders,
21397
+ isError: true
18897
21398
  }
18898
21399
  },
18899
21400
  urlParameters: [$host],
@@ -18910,6 +21411,11 @@ const getSyncStatusOperationSpec = {
18910
21411
  404: {
18911
21412
  bodyMapper: ErrorModel,
18912
21413
  isError: true
21414
+ },
21415
+ 503: {
21416
+ bodyMapper: ErrorModel,
21417
+ headersMapper: NodeGetSyncStatusExceptionHeaders,
21418
+ isError: true
18913
21419
  }
18914
21420
  },
18915
21421
  urlParameters: [$host],
@@ -18926,6 +21432,11 @@ const postTransactionOperationSpec = {
18926
21432
  400: {
18927
21433
  bodyMapper: ErrorModel,
18928
21434
  isError: true
21435
+ },
21436
+ 503: {
21437
+ bodyMapper: ErrorModel,
21438
+ headersMapper: NodePostTransactionExceptionHeaders,
21439
+ isError: true
18929
21440
  }
18930
21441
  },
18931
21442
  requestBody: body1,
@@ -18948,6 +21459,11 @@ const getTransactionByHashOperationSpec = {
18948
21459
  404: {
18949
21460
  bodyMapper: ErrorModel,
18950
21461
  isError: true
21462
+ },
21463
+ 503: {
21464
+ bodyMapper: ErrorModel,
21465
+ headersMapper: NodeGetTransactionByHashExceptionHeaders,
21466
+ isError: true
18951
21467
  }
18952
21468
  },
18953
21469
  urlParameters: [$host, parameters_hash],
@@ -18972,6 +21488,11 @@ const getTransactionInfoByHashOperationSpec = {
18972
21488
  410: {
18973
21489
  bodyMapper: ErrorModel,
18974
21490
  isError: true
21491
+ },
21492
+ 503: {
21493
+ bodyMapper: ErrorModel,
21494
+ headersMapper: NodeGetTransactionInfoByHashExceptionHeaders,
21495
+ isError: true
18975
21496
  }
18976
21497
  },
18977
21498
  urlParameters: [$host, parameters_hash],
@@ -19113,7 +21634,7 @@ function getTransactionSignerAddress(transaction) {
19113
21634
  const params = unpackTx(transaction);
19114
21635
  switch (params.tag) {
19115
21636
  case Tag.SignedTx:
19116
- return getTransactionSignerAddress(buildTx(params.encodedTx));
21637
+ return getTransactionSignerAddress(rebuildUnpackedTx(params.encodedTx));
19117
21638
  case Tag.GaMetaTx:
19118
21639
  return params.gaId;
19119
21640
  default:
@@ -19371,7 +21892,7 @@ function getExecutionCost(transaction, {
19371
21892
  res += BigInt(params.gasPrice) * BigInt(gasUsed !== null && gasUsed !== void 0 ? gasUsed : params.gasLimit);
19372
21893
  }
19373
21894
  if (params.tag === Tag.GaMetaTx || params.tag === Tag.PayingForTx) {
19374
- res += getExecutionCost(buildTx(params.tx.encodedTx), params.tag === Tag.PayingForTx ? {
21895
+ res += getExecutionCost(rebuildUnpackedTx(params.tx.encodedTx), params.tag === Tag.PayingForTx ? {
19375
21896
  innerTx: 'fee-payer'
19376
21897
  } : {});
19377
21898
  }
@@ -19388,13 +21909,13 @@ function getExecutionCost(transaction, {
19388
21909
  function getExecutionCostBySignedTx(transaction, networkId, options) {
19389
21910
  const params = unpackTx(transaction, Tag.SignedTx);
19390
21911
  if (params.encodedTx.tag === Tag.GaMetaTx) {
19391
- return getExecutionCost(buildTx(params.encodedTx), options);
21912
+ return getExecutionCost(rebuildUnpackedTx(params.encodedTx), options);
19392
21913
  }
19393
- const tx = buildTx(params.encodedTx);
21914
+ const tx = rebuildUnpackedTx(params.encodedTx);
19394
21915
  const address = getTransactionSignerAddress(tx);
19395
21916
  const [isInnerTx, isNotInnerTx] = [true, false].map(f => verifySignature(getBufferToSign(tx, networkId, f), params.signatures[0], address));
19396
21917
  if (!isInnerTx && !isNotInnerTx) throw new TransactionError("Can't verify signature");
19397
- return getExecutionCost(buildTx(params.encodedTx), {
21918
+ return getExecutionCost(rebuildUnpackedTx(params.encodedTx), {
19398
21919
  ...(isInnerTx && {
19399
21920
  innerTx: 'freeloader'
19400
21921
  }),
@@ -19457,7 +21978,7 @@ async function getExecutionCostUsingNode(transaction, node, {
19457
21978
 
19458
21979
  const validators = [];
19459
21980
  async function verifyTransactionInternal(tx, node, parentTxTypes) {
19460
- const address = getTransactionSignerAddress(buildTx(tx));
21981
+ const address = getTransactionSignerAddress(rebuildUnpackedTx(tx));
19461
21982
  const [account, {
19462
21983
  height
19463
21984
  }, {
@@ -19524,7 +22045,7 @@ validators.push((tx, {
19524
22045
  if ((encodedTx !== null && encodedTx !== void 0 ? encodedTx : signatures) == null) return [];
19525
22046
  if (signatures.length !== 1) return []; // TODO: Support multisignature like in state channels
19526
22047
  const prefix = Buffer.from([nodeNetworkId, ...(parentTxTypes.includes(Tag.PayingForTx) ? ['inner_tx'] : [])].join('-'));
19527
- const txBinary = decode(buildTx(encodedTx));
22048
+ const txBinary = decode(rebuildUnpackedTx(encodedTx));
19528
22049
  const txWithNetworkId = concatBuffers([prefix, txBinary]);
19529
22050
  const txHashWithNetworkId = concatBuffers([prefix, hash(txBinary)]);
19530
22051
  if (verifySignature(txWithNetworkId, signatures[0], account.id) || verifySignature(txHashWithNetworkId, signatures[0], account.id)) return [];
@@ -19558,7 +22079,7 @@ validators.push((tx, {
19558
22079
  node
19559
22080
  }) => {
19560
22081
  if (parentTxTypes.length !== 0) return [];
19561
- const cost = await getExecutionCostUsingNode(buildTx(tx), node).catch(() => 0n);
22082
+ const cost = await getExecutionCostUsingNode(rebuildUnpackedTx(tx), node).catch(() => 0n);
19562
22083
  if (cost <= account.balance) return [];
19563
22084
  return [{
19564
22085
  message: `Account balance ${account.balance} is not enough to execute the transaction that costs ${cost}`,
@@ -21283,6 +23804,8 @@ async function payForTransaction(transaction, options) {
21283
23804
 
21284
23805
 
21285
23806
 
23807
+
23808
+
21286
23809
  /**
21287
23810
  * Convert current account to GA
21288
23811
  * @category account generalized
@@ -21347,6 +23870,40 @@ async function createGeneralizedAccount(authFnName, args, {
21347
23870
  gaContractId: contractId
21348
23871
  });
21349
23872
  }
23873
+ // the symbol isn't exported, so only `buildAuthTxHashByGaMetaTx` can set it — kept off the public
23874
+ // `buildAuthTxHash` signature rather than advertising an option its callers can't provide
23875
+ async function buildAuthTxHashInternal(transaction, {
23876
+ fee,
23877
+ gasPrice,
23878
+ onNode,
23879
+ protocolParameters,
23880
+ ...options
23881
+ }) {
23882
+ const {
23883
+ nodeNetworkId
23884
+ } = await onNode.getNodeInfo();
23885
+ let payload = hash(concatBuffers([Buffer.from(nodeNetworkId), decode(transaction)]));
23886
+ if (fee == null) throw new ArgumentError('fee', 'provided (in Ceres)', fee);
23887
+ if (gasPrice == null) throw new ArgumentError('gasPrice', 'provided (in Ceres)', gasPrice);
23888
+ // the entry checks `gasPrice` against the consensus minimum the same way a transaction does,
23889
+ // so it needs the same parameters — without them a `gasPrice` correct for the network this
23890
+ // node runs is rejected whenever that network runs a lower minimum than the SDK release.
23891
+ // Not requested at all when there is nothing to check, so that re-deriving the hash of an
23892
+ // existing transaction needs no round trip and works on a transaction of another network
23893
+ payload = hash(decode(packEntry({
23894
+ tag: EntryTag.GaMetaTxAuthData,
23895
+ fee,
23896
+ gasPrice,
23897
+ txHash: encode(payload, Encoding.TxHash),
23898
+ ...(options[serializeAsIsParam] === true ? {
23899
+ [serializeAsIsParam]: true
23900
+ } : {
23901
+ protocolParameters: protocolParameters !== null && protocolParameters !== void 0 ? protocolParameters : await getCachedProtocolParameters(onNode)
23902
+ })
23903
+ })));
23904
+ return payload;
23905
+ }
23906
+
21350
23907
  /**
21351
23908
  * Build a transaction hash the same as `Auth.tx_hash` by GaMetaTx payload
21352
23909
  * @category account generalized
@@ -21355,29 +23912,22 @@ async function createGeneralizedAccount(authFnName, args, {
21355
23912
  * @param options.fee - GaMetaTx fee, required in Ceres
21356
23913
  * @param options.gasPrice - GaMetaTx gasPrice, required in Ceres
21357
23914
  * @param options.onNode - Node to use
23915
+ * @param options.protocolParameters - Consensus parameters the `gasPrice` belongs to, requested
23916
+ * from node if not provided
21358
23917
  * @returns Transaction hash
21359
23918
  */
21360
23919
  async function buildAuthTxHash(transaction, {
21361
23920
  fee,
21362
23921
  gasPrice,
21363
- onNode
23922
+ onNode,
23923
+ protocolParameters
21364
23924
  }) {
21365
- const {
21366
- nodeNetworkId,
21367
- consensusProtocolVersion
21368
- } = await onNode.getNodeInfo();
21369
- let payload = hash(concatBuffers([Buffer.from(nodeNetworkId), decode(transaction)]));
21370
- if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
21371
- if (fee == null) throw new ArgumentError('fee', 'provided (in Ceres)', fee);
21372
- if (gasPrice == null) throw new ArgumentError('gasPrice', 'provided (in Ceres)', gasPrice);
21373
- payload = hash(decode(packEntry({
21374
- tag: EntryTag.GaMetaTxAuthData,
21375
- fee,
21376
- gasPrice,
21377
- txHash: encode(payload, Encoding.TxHash)
21378
- })));
21379
- }
21380
- return payload;
23925
+ return buildAuthTxHashInternal(transaction, {
23926
+ fee,
23927
+ gasPrice,
23928
+ onNode,
23929
+ protocolParameters
23930
+ });
21381
23931
  }
21382
23932
 
21383
23933
  /**
@@ -21395,10 +23945,13 @@ async function buildAuthTxHashByGaMetaTx(transaction, {
21395
23945
  if (txParams.encodedTx.tag !== Tag.GaMetaTx) {
21396
23946
  throw new ArgumentError('transaction', 'to include GaMetaTx', Tag[txParams.encodedTx.tag]);
21397
23947
  }
21398
- return buildAuthTxHash(buildTx(txParams.encodedTx.tx.encodedTx), {
23948
+ return buildAuthTxHashInternal(rebuildUnpackedTx(txParams.encodedTx.tx.encodedTx), {
21399
23949
  fee: txParams.encodedTx.fee,
21400
23950
  gasPrice: txParams.encodedTx.gasPrice,
21401
- onNode
23951
+ onNode,
23952
+ // the `gasPrice` of a transaction that already exists, never checked and no parameters
23953
+ // requested for it — see `serializeAsIsParam`
23954
+ [serializeAsIsParam]: true
21402
23955
  });
21403
23956
  }
21404
23957
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/defineProperty.js
@@ -23139,7 +25692,8 @@ class AccountGeneralized extends AccountBase {
23139
25692
  async signTransaction(tx, {
23140
25693
  authData,
23141
25694
  onCompiler,
23142
- onNode
25695
+ onNode,
25696
+ protocolParameters
23143
25697
  }) {
23144
25698
  if (authData == null || onCompiler == null || onNode == null) {
23145
25699
  throw new ArgumentError('authData, onCompiler, onNode', 'provided', null);
@@ -23187,6 +25741,11 @@ class AccountGeneralized extends AccountBase {
23187
25741
  fee,
23188
25742
  gasLimit,
23189
25743
  gasPrice,
25744
+ // the wrapping transaction is priced by the same parameters the caller asked the inner one
25745
+ // to be built against, `buildTxAsync` requests them from node if not provided
25746
+ ...(protocolParameters != null && {
25747
+ protocolParameters
25748
+ }),
23190
25749
  onNode
23191
25750
  });
23192
25751
  return buildTx({
@@ -25173,7 +27732,7 @@ async function appendSignature(tx, signFn) {
25173
27732
  signatures,
25174
27733
  encodedTx
25175
27734
  } = unpackTx(tx, Tag.SignedTx);
25176
- const payloadTx = buildTx(encodedTx);
27735
+ const payloadTx = rebuildUnpackedTx(encodedTx);
25177
27736
  const result = await signFn(payloadTx);
25178
27737
  if (typeof result === 'string') {
25179
27738
  const {
@@ -25300,7 +27859,7 @@ async function awaitingReconnection(channel, message, state) {
25300
27859
  const {
25301
27860
  signedTx
25302
27861
  } = await channel.state();
25303
- changeState(channel, signedTx == null ? '' : buildTx(signedTx));
27862
+ changeState(channel, signedTx == null ? '' : rebuildUnpackedTx(signedTx));
25304
27863
  return {
25305
27864
  handler: channelOpen
25306
27865
  };
@@ -26168,6 +28727,7 @@ class ChannelSpend extends Base_Channel {
26168
28727
 
26169
28728
 
26170
28729
 
28730
+
26171
28731
  function Contract_snakeToPascalObjKeys(obj) {
26172
28732
  return Object.entries(obj).reduce((result, [key, val]) => ({
26173
28733
  ...result,
@@ -26347,6 +28907,11 @@ class ChannelContract extends ChannelSpend {
26347
28907
  * Trigger a force progress contract call
26348
28908
  * This call is going on-chain
26349
28909
  * @param options - Options
28910
+ * @param options.gasPrice - Gas price of the call, defaults to the consensus minimum gas price
28911
+ * of the SDK release (`defaultProtocolParameters.minGasPrice`). A channel talks to node over a
28912
+ * websocket and builds no transaction itself, so it can't request the parameters this node runs
28913
+ * — pass this option explicitly on a network running a higher minimum gas price, otherwise the
28914
+ * call is rejected as underpriced.
26350
28915
  * @param sign - Function which verifies and signs contract force progress transaction
26351
28916
  * @param callbacks - Callbacks
26352
28917
  * @example
@@ -26372,7 +28937,7 @@ class ChannelContract extends ChannelSpend {
26372
28937
  contract,
26373
28938
  abiVersion,
26374
28939
  gasLimit = 1000000,
26375
- gasPrice = MIN_GAS_PRICE
28940
+ gasPrice = Number(defaultProtocolParameters.minGasPrice)
26376
28941
  }, sign, {
26377
28942
  onOnChainTx
26378
28943
  } = {}) {
@@ -39791,6 +42356,7 @@ class BrowserRuntimeConnection extends BrowserConnection {
39791
42356
  */
39792
42357
 
39793
42358
 
42359
+
39794
42360
  // TODO: move to constants
39795
42361
 
39796
42362