@fuel-ts/account 0.0.0-rc-2238-20240514123009 → 0.0.0-rc-1356-20240514125020

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.

Potentially problematic release.


This version of @fuel-ts/account might be problematic. Click here for more details.

Files changed (42) hide show
  1. package/dist/account.d.ts.map +1 -1
  2. package/dist/index.global.js +1140 -408
  3. package/dist/index.global.js.map +1 -1
  4. package/dist/index.js +254 -234
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +145 -118
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/predicate/predicate.d.ts.map +1 -1
  9. package/dist/providers/coin.d.ts +1 -0
  10. package/dist/providers/coin.d.ts.map +1 -1
  11. package/dist/providers/message.d.ts +1 -0
  12. package/dist/providers/message.d.ts.map +1 -1
  13. package/dist/providers/transaction-request/input.d.ts +2 -0
  14. package/dist/providers/transaction-request/input.d.ts.map +1 -1
  15. package/dist/providers/transaction-request/transaction-request.d.ts +1 -0
  16. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  17. package/dist/providers/transaction-summary/call.d.ts +1 -1
  18. package/dist/providers/transaction-summary/call.d.ts.map +1 -1
  19. package/dist/providers/utils/auto-retry-fetch.d.ts.map +1 -1
  20. package/dist/providers/utils/index.d.ts +0 -1
  21. package/dist/providers/utils/index.d.ts.map +1 -1
  22. package/dist/test-utils/asset-id.d.ts +8 -0
  23. package/dist/test-utils/asset-id.d.ts.map +1 -0
  24. package/dist/test-utils/index.d.ts +4 -0
  25. package/dist/test-utils/index.d.ts.map +1 -1
  26. package/dist/test-utils/launchNode.d.ts +8 -1
  27. package/dist/test-utils/launchNode.d.ts.map +1 -1
  28. package/dist/test-utils/setup-test-provider-and-wallets.d.ts +33 -0
  29. package/dist/test-utils/setup-test-provider-and-wallets.d.ts.map +1 -0
  30. package/dist/test-utils/test-message.d.ts +28 -0
  31. package/dist/test-utils/test-message.d.ts.map +1 -0
  32. package/dist/test-utils/wallet-config.d.ts +49 -0
  33. package/dist/test-utils/wallet-config.d.ts.map +1 -0
  34. package/dist/test-utils.global.js +1465 -418
  35. package/dist/test-utils.global.js.map +1 -1
  36. package/dist/test-utils.js +523 -272
  37. package/dist/test-utils.js.map +1 -1
  38. package/dist/test-utils.mjs +413 -166
  39. package/dist/test-utils.mjs.map +1 -1
  40. package/package.json +16 -15
  41. package/dist/providers/utils/sleep.d.ts +0 -3
  42. package/dist/providers/utils/sleep.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -186,7 +186,6 @@ __export(src_exports, {
186
186
  resolveGasDependentCosts: () => resolveGasDependentCosts,
187
187
  resolveIconPaths: () => resolveIconPaths,
188
188
  returnZeroScript: () => returnZeroScript,
189
- sleep: () => sleep,
190
189
  transactionRequestify: () => transactionRequestify,
191
190
  urlJoin: () => urlJoin,
192
191
  withTimeout: () => withTimeout,
@@ -198,8 +197,8 @@ module.exports = __toCommonJS(src_exports);
198
197
  var import_address4 = require("@fuel-ts/address");
199
198
  var import_errors16 = require("@fuel-ts/errors");
200
199
  var import_interfaces = require("@fuel-ts/interfaces");
201
- var import_math20 = require("@fuel-ts/math");
202
- var import_utils28 = require("@fuel-ts/utils");
200
+ var import_math21 = require("@fuel-ts/math");
201
+ var import_utils29 = require("@fuel-ts/utils");
203
202
  var import_ramda4 = require("ramda");
204
203
 
205
204
  // src/providers/coin-quantity.ts
@@ -240,11 +239,11 @@ var addAmountToCoinQuantities = (params) => {
240
239
  // src/providers/provider.ts
241
240
  var import_address3 = require("@fuel-ts/address");
242
241
  var import_errors14 = require("@fuel-ts/errors");
243
- var import_math17 = require("@fuel-ts/math");
242
+ var import_math18 = require("@fuel-ts/math");
244
243
  var import_transactions20 = require("@fuel-ts/transactions");
245
- var import_utils22 = require("@fuel-ts/utils");
244
+ var import_utils23 = require("@fuel-ts/utils");
246
245
  var import_versions = require("@fuel-ts/versions");
247
- var import_utils23 = require("@noble/curves/abstract/utils");
246
+ var import_utils24 = require("@noble/curves/abstract/utils");
248
247
  var import_graphql_request = require("graphql-request");
249
248
  var import_ramda3 = require("ramda");
250
249
 
@@ -1863,15 +1862,6 @@ function normalizeJSON(root) {
1863
1862
  return normalize((0, import_ramda.clone)(root));
1864
1863
  }
1865
1864
 
1866
- // src/providers/utils/sleep.ts
1867
- function sleep(time) {
1868
- return new Promise((resolve) => {
1869
- setTimeout(() => {
1870
- resolve(true);
1871
- }, time);
1872
- });
1873
- }
1874
-
1875
1865
  // src/providers/utils/extract-tx-error.ts
1876
1866
  var import_errors7 = require("@fuel-ts/errors");
1877
1867
  var import_math6 = require("@fuel-ts/math");
@@ -2520,6 +2510,15 @@ var BaseTransactionRequest = class {
2520
2510
  }
2521
2511
  });
2522
2512
  }
2513
+ shiftPredicateData() {
2514
+ this.inputs.forEach((input) => {
2515
+ if ("predicateData" in input && "padPredicateData" in input && typeof input.padPredicateData === "function") {
2516
+ input.predicateData = input.padPredicateData(
2517
+ BaseTransactionRequest.getPolicyMeta(this).policies.length
2518
+ );
2519
+ }
2520
+ });
2521
+ }
2523
2522
  };
2524
2523
 
2525
2524
  // src/providers/transaction-request/create-transaction-request.ts
@@ -2942,12 +2941,12 @@ var transactionRequestify = (obj) => {
2942
2941
 
2943
2942
  // src/providers/transaction-response/transaction-response.ts
2944
2943
  var import_errors13 = require("@fuel-ts/errors");
2945
- var import_math16 = require("@fuel-ts/math");
2944
+ var import_math17 = require("@fuel-ts/math");
2946
2945
  var import_transactions19 = require("@fuel-ts/transactions");
2947
2946
  var import_utils20 = require("@fuel-ts/utils");
2948
2947
 
2949
2948
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2950
- var import_math15 = require("@fuel-ts/math");
2949
+ var import_math16 = require("@fuel-ts/math");
2951
2950
  var import_transactions17 = require("@fuel-ts/transactions");
2952
2951
  var import_utils18 = require("@fuel-ts/utils");
2953
2952
 
@@ -3024,32 +3023,43 @@ var calculateTXFeeForSummary = (params) => {
3024
3023
  // src/providers/transaction-summary/operations.ts
3025
3024
  var import_configs10 = require("@fuel-ts/address/configs");
3026
3025
  var import_errors11 = require("@fuel-ts/errors");
3027
- var import_math13 = require("@fuel-ts/math");
3026
+ var import_math14 = require("@fuel-ts/math");
3028
3027
  var import_transactions15 = require("@fuel-ts/transactions");
3029
3028
 
3030
3029
  // src/providers/transaction-summary/call.ts
3031
3030
  var import_abi_coder4 = require("@fuel-ts/abi-coder");
3032
- var getFunctionCall = ({ abi, receipt }) => {
3031
+ var import_math13 = require("@fuel-ts/math");
3032
+ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
3033
3033
  const abiInterface = new import_abi_coder4.Interface(abi);
3034
3034
  const callFunctionSelector = receipt.param1.toHex(8);
3035
3035
  const functionFragment = abiInterface.getFunction(callFunctionSelector);
3036
3036
  const inputs = functionFragment.jsonFn.inputs;
3037
- const encodedArgs = receipt.param2.toHex();
3037
+ let encodedArgs;
3038
+ if (functionFragment.isInputDataPointer) {
3039
+ if (rawPayload) {
3040
+ const argsOffset = (0, import_math13.bn)(receipt.param2).sub((0, import_abi_coder4.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
3041
+ encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
3042
+ }
3043
+ } else {
3044
+ encodedArgs = receipt.param2.toHex();
3045
+ }
3038
3046
  let argumentsProvided;
3039
- const data = functionFragment.decodeArguments(encodedArgs);
3040
- if (data) {
3041
- argumentsProvided = inputs.reduce((prev, input, index) => {
3042
- const value = data[index];
3043
- const name = input.name;
3044
- if (name) {
3045
- return {
3046
- ...prev,
3047
- // reparse to remove bn
3048
- [name]: JSON.parse(JSON.stringify(value))
3049
- };
3050
- }
3051
- return prev;
3052
- }, {});
3047
+ if (encodedArgs) {
3048
+ const data = functionFragment.decodeArguments(encodedArgs);
3049
+ if (data) {
3050
+ argumentsProvided = inputs.reduce((prev, input, index) => {
3051
+ const value = data[index];
3052
+ const name = input.name;
3053
+ if (name) {
3054
+ return {
3055
+ ...prev,
3056
+ // reparse to remove bn
3057
+ [name]: JSON.parse(JSON.stringify(value))
3058
+ };
3059
+ }
3060
+ return prev;
3061
+ }, {});
3062
+ }
3053
3063
  }
3054
3064
  const call = {
3055
3065
  functionSignature: functionFragment.signature,
@@ -3235,7 +3245,7 @@ var mergeAssets = (op1, op2) => {
3235
3245
  if (!matchingAsset) {
3236
3246
  return asset1;
3237
3247
  }
3238
- const mergedAmount = (0, import_math13.bn)(asset1.amount).add(matchingAsset.amount);
3248
+ const mergedAmount = (0, import_math14.bn)(asset1.amount).add(matchingAsset.amount);
3239
3249
  return { ...asset1, amount: mergedAmount };
3240
3250
  });
3241
3251
  return mergedAssets.concat(filteredAssets);
@@ -3561,7 +3571,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3561
3571
 
3562
3572
  // src/providers/transaction-summary/status.ts
3563
3573
  var import_errors12 = require("@fuel-ts/errors");
3564
- var import_math14 = require("@fuel-ts/math");
3574
+ var import_math15 = require("@fuel-ts/math");
3565
3575
  var getTransactionStatusName = (gqlStatus) => {
3566
3576
  switch (gqlStatus) {
3567
3577
  case "FailureStatus":
@@ -3595,15 +3605,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3595
3605
  time = gqlTransactionStatus.time;
3596
3606
  blockId = gqlTransactionStatus.block.id;
3597
3607
  isStatusSuccess = true;
3598
- totalFee = (0, import_math14.bn)(gqlTransactionStatus.totalFee);
3599
- totalGas = (0, import_math14.bn)(gqlTransactionStatus.totalGas);
3608
+ totalFee = (0, import_math15.bn)(gqlTransactionStatus.totalFee);
3609
+ totalGas = (0, import_math15.bn)(gqlTransactionStatus.totalGas);
3600
3610
  break;
3601
3611
  case "FailureStatus":
3602
3612
  time = gqlTransactionStatus.time;
3603
3613
  blockId = gqlTransactionStatus.block.id;
3604
3614
  isStatusFailure = true;
3605
- totalFee = (0, import_math14.bn)(gqlTransactionStatus.totalFee);
3606
- totalGas = (0, import_math14.bn)(gqlTransactionStatus.totalGas);
3615
+ totalFee = (0, import_math15.bn)(gqlTransactionStatus.totalFee);
3616
+ totalGas = (0, import_math15.bn)(gqlTransactionStatus.totalGas);
3607
3617
  break;
3608
3618
  case "SubmittedStatus":
3609
3619
  time = gqlTransactionStatus.time;
@@ -3653,7 +3663,7 @@ function assembleTransactionSummary(params) {
3653
3663
  maxInputs
3654
3664
  });
3655
3665
  const typeName = getTransactionTypeName(transaction.type);
3656
- const tip = (0, import_math15.bn)(transaction.policies?.find((policy) => policy.type === import_transactions17.PolicyType.Tip)?.data);
3666
+ const tip = (0, import_math16.bn)(transaction.policies?.find((policy) => policy.type === import_transactions17.PolicyType.Tip)?.data);
3657
3667
  const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3658
3668
  const fee = calculateTXFeeForSummary({
3659
3669
  totalFee,
@@ -3724,7 +3734,7 @@ var TransactionResponse = class {
3724
3734
  /** Current provider */
3725
3735
  provider;
3726
3736
  /** Gas used on the transaction */
3727
- gasUsed = (0, import_math16.bn)(0);
3737
+ gasUsed = (0, import_math17.bn)(0);
3728
3738
  /** The graphql Transaction with receipts object. */
3729
3739
  gqlTransaction;
3730
3740
  abis;
@@ -3892,6 +3902,7 @@ var TransactionResponse = class {
3892
3902
  };
3893
3903
 
3894
3904
  // src/providers/utils/auto-retry-fetch.ts
3905
+ var import_utils22 = require("@fuel-ts/utils");
3895
3906
  function getWaitDelay(options, retryAttemptNum) {
3896
3907
  const duration = options.baseDelay ?? 150;
3897
3908
  switch (options.backoff) {
@@ -3921,7 +3932,7 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
3921
3932
  throw error;
3922
3933
  }
3923
3934
  const delay = getWaitDelay(options, retryNum);
3924
- await sleep(delay);
3935
+ await (0, import_utils22.sleep)(delay);
3925
3936
  return autoRetryFetch(fetchFn, options, retryNum)(...args);
3926
3937
  }
3927
3938
  };
@@ -3958,47 +3969,47 @@ var processGqlChain = (chain) => {
3958
3969
  } = consensusParameters;
3959
3970
  return {
3960
3971
  name,
3961
- baseChainHeight: (0, import_math17.bn)(daHeight),
3972
+ baseChainHeight: (0, import_math18.bn)(daHeight),
3962
3973
  consensusParameters: {
3963
3974
  version,
3964
- chainId: (0, import_math17.bn)(chainId),
3975
+ chainId: (0, import_math18.bn)(chainId),
3965
3976
  baseAssetId,
3966
3977
  feeParameters: {
3967
3978
  version: feeParams.version,
3968
- gasPerByte: (0, import_math17.bn)(feeParams.gasPerByte),
3969
- gasPriceFactor: (0, import_math17.bn)(feeParams.gasPriceFactor)
3979
+ gasPerByte: (0, import_math18.bn)(feeParams.gasPerByte),
3980
+ gasPriceFactor: (0, import_math18.bn)(feeParams.gasPriceFactor)
3970
3981
  },
3971
3982
  contractParameters: {
3972
3983
  version: contractParams.version,
3973
- contractMaxSize: (0, import_math17.bn)(contractParams.contractMaxSize),
3974
- maxStorageSlots: (0, import_math17.bn)(contractParams.maxStorageSlots)
3984
+ contractMaxSize: (0, import_math18.bn)(contractParams.contractMaxSize),
3985
+ maxStorageSlots: (0, import_math18.bn)(contractParams.maxStorageSlots)
3975
3986
  },
3976
3987
  txParameters: {
3977
3988
  version: txParams.version,
3978
- maxInputs: (0, import_math17.bn)(txParams.maxInputs),
3979
- maxOutputs: (0, import_math17.bn)(txParams.maxOutputs),
3980
- maxWitnesses: (0, import_math17.bn)(txParams.maxWitnesses),
3981
- maxGasPerTx: (0, import_math17.bn)(txParams.maxGasPerTx),
3982
- maxSize: (0, import_math17.bn)(txParams.maxSize),
3983
- maxBytecodeSubsections: (0, import_math17.bn)(txParams.maxBytecodeSubsections)
3989
+ maxInputs: (0, import_math18.bn)(txParams.maxInputs),
3990
+ maxOutputs: (0, import_math18.bn)(txParams.maxOutputs),
3991
+ maxWitnesses: (0, import_math18.bn)(txParams.maxWitnesses),
3992
+ maxGasPerTx: (0, import_math18.bn)(txParams.maxGasPerTx),
3993
+ maxSize: (0, import_math18.bn)(txParams.maxSize),
3994
+ maxBytecodeSubsections: (0, import_math18.bn)(txParams.maxBytecodeSubsections)
3984
3995
  },
3985
3996
  predicateParameters: {
3986
3997
  version: predicateParams.version,
3987
- maxPredicateLength: (0, import_math17.bn)(predicateParams.maxPredicateLength),
3988
- maxPredicateDataLength: (0, import_math17.bn)(predicateParams.maxPredicateDataLength),
3989
- maxGasPerPredicate: (0, import_math17.bn)(predicateParams.maxGasPerPredicate),
3990
- maxMessageDataLength: (0, import_math17.bn)(predicateParams.maxMessageDataLength)
3998
+ maxPredicateLength: (0, import_math18.bn)(predicateParams.maxPredicateLength),
3999
+ maxPredicateDataLength: (0, import_math18.bn)(predicateParams.maxPredicateDataLength),
4000
+ maxGasPerPredicate: (0, import_math18.bn)(predicateParams.maxGasPerPredicate),
4001
+ maxMessageDataLength: (0, import_math18.bn)(predicateParams.maxMessageDataLength)
3991
4002
  },
3992
4003
  scriptParameters: {
3993
4004
  version: scriptParams.version,
3994
- maxScriptLength: (0, import_math17.bn)(scriptParams.maxScriptLength),
3995
- maxScriptDataLength: (0, import_math17.bn)(scriptParams.maxScriptDataLength)
4005
+ maxScriptLength: (0, import_math18.bn)(scriptParams.maxScriptLength),
4006
+ maxScriptDataLength: (0, import_math18.bn)(scriptParams.maxScriptDataLength)
3996
4007
  },
3997
4008
  gasCosts
3998
4009
  },
3999
4010
  latestBlock: {
4000
4011
  id: latestBlock.id,
4001
- height: (0, import_math17.bn)(latestBlock.height),
4012
+ height: (0, import_math18.bn)(latestBlock.height),
4002
4013
  time: latestBlock.header.time,
4003
4014
  transactions: latestBlock.transactions.map((i) => ({
4004
4015
  id: i.id
@@ -4194,7 +4205,7 @@ Supported fuel-core version: ${supportedVersion}.`
4194
4205
  */
4195
4206
  async getBlockNumber() {
4196
4207
  const { chain } = await this.operations.getChain();
4197
- return (0, import_math17.bn)(chain.latestBlock.height, 10);
4208
+ return (0, import_math18.bn)(chain.latestBlock.height, 10);
4198
4209
  }
4199
4210
  /**
4200
4211
  * Returns the chain information.
@@ -4204,8 +4215,8 @@ Supported fuel-core version: ${supportedVersion}.`
4204
4215
  async fetchNode() {
4205
4216
  const { nodeInfo } = await this.operations.getNodeInfo();
4206
4217
  const processedNodeInfo = {
4207
- maxDepth: (0, import_math17.bn)(nodeInfo.maxDepth),
4208
- maxTx: (0, import_math17.bn)(nodeInfo.maxTx),
4218
+ maxDepth: (0, import_math18.bn)(nodeInfo.maxDepth),
4219
+ maxTx: (0, import_math18.bn)(nodeInfo.maxTx),
4209
4220
  nodeVersion: nodeInfo.nodeVersion,
4210
4221
  utxoValidation: nodeInfo.utxoValidation,
4211
4222
  vmBacktrace: nodeInfo.vmBacktrace
@@ -4261,7 +4272,7 @@ Supported fuel-core version: ${supportedVersion}.`
4261
4272
  if (estimateTxDependencies) {
4262
4273
  await this.estimateTxDependencies(transactionRequest);
4263
4274
  }
4264
- const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
4275
+ const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
4265
4276
  let abis;
4266
4277
  if (transactionRequest.type === import_transactions20.TransactionType.Script) {
4267
4278
  abis = transactionRequest.abis;
@@ -4304,7 +4315,7 @@ Supported fuel-core version: ${supportedVersion}.`
4304
4315
  if (estimateTxDependencies) {
4305
4316
  return this.estimateTxDependencies(transactionRequest);
4306
4317
  }
4307
- const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
4318
+ const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
4308
4319
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4309
4320
  encodedTransactions: encodedTransaction,
4310
4321
  utxoValidation: utxoValidation || false
@@ -4322,13 +4333,13 @@ Supported fuel-core version: ${supportedVersion}.`
4322
4333
  async estimatePredicates(transactionRequest) {
4323
4334
  const shouldEstimatePredicates = Boolean(
4324
4335
  transactionRequest.inputs.find(
4325
- (input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new import_math17.BN(input.predicateGasUsed).isZero()
4336
+ (input) => "predicate" in input && input.predicate && !(0, import_utils24.equalBytes)((0, import_utils23.arrayify)(input.predicate), (0, import_utils23.arrayify)("0x")) && new import_math18.BN(input.predicateGasUsed).isZero()
4326
4337
  )
4327
4338
  );
4328
4339
  if (!shouldEstimatePredicates) {
4329
4340
  return transactionRequest;
4330
4341
  }
4331
- const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
4342
+ const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
4332
4343
  const response = await this.operations.estimatePredicates({
4333
4344
  encodedTransaction
4334
4345
  });
@@ -4337,7 +4348,7 @@ Supported fuel-core version: ${supportedVersion}.`
4337
4348
  } = response;
4338
4349
  if (inputs) {
4339
4350
  inputs.forEach((input, index) => {
4340
- if ("predicateGasUsed" in input && (0, import_math17.bn)(input.predicateGasUsed).gt(0)) {
4351
+ if ("predicateGasUsed" in input && (0, import_math18.bn)(input.predicateGasUsed).gt(0)) {
4341
4352
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
4342
4353
  }
4343
4354
  });
@@ -4370,7 +4381,7 @@ Supported fuel-core version: ${supportedVersion}.`
4370
4381
  const {
4371
4382
  dryRun: [{ receipts: rawReceipts, status }]
4372
4383
  } = await this.operations.dryRun({
4373
- encodedTransactions: [(0, import_utils22.hexlify)(transactionRequest.toTransactionBytes())],
4384
+ encodedTransactions: [(0, import_utils23.hexlify)(transactionRequest.toTransactionBytes())],
4374
4385
  utxoValidation: false
4375
4386
  });
4376
4387
  receipts = rawReceipts.map(processGqlReceipt);
@@ -4420,7 +4431,7 @@ Supported fuel-core version: ${supportedVersion}.`
4420
4431
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
4421
4432
  allRequests.forEach((req, index) => {
4422
4433
  if (req.type === import_transactions20.TransactionType.Script) {
4423
- serializedTransactionsMap.set(index, (0, import_utils22.hexlify)(req.toTransactionBytes()));
4434
+ serializedTransactionsMap.set(index, (0, import_utils23.hexlify)(req.toTransactionBytes()));
4424
4435
  }
4425
4436
  });
4426
4437
  let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
@@ -4456,7 +4467,7 @@ Supported fuel-core version: ${supportedVersion}.`
4456
4467
  transactionRequest: request
4457
4468
  });
4458
4469
  request.maxFee = maxFee;
4459
- serializedTransactionsMap.set(requestIdx, (0, import_utils22.hexlify)(request.toTransactionBytes()));
4470
+ serializedTransactionsMap.set(requestIdx, (0, import_utils23.hexlify)(request.toTransactionBytes()));
4460
4471
  nextRoundTransactions.push(requestIdx);
4461
4472
  }
4462
4473
  }
@@ -4469,7 +4480,7 @@ Supported fuel-core version: ${supportedVersion}.`
4469
4480
  if (estimateTxDependencies) {
4470
4481
  return this.estimateMultipleTxDependencies(transactionRequests);
4471
4482
  }
4472
- const encodedTransactions = transactionRequests.map((tx) => (0, import_utils22.hexlify)(tx.toTransactionBytes()));
4483
+ const encodedTransactions = transactionRequests.map((tx) => (0, import_utils23.hexlify)(tx.toTransactionBytes()));
4473
4484
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4474
4485
  encodedTransactions,
4475
4486
  utxoValidation: utxoValidation || false
@@ -4495,12 +4506,12 @@ Supported fuel-core version: ${supportedVersion}.`
4495
4506
  gasPrice = await this.estimateGasPrice(10);
4496
4507
  }
4497
4508
  const minFee = calculateGasFee({
4498
- gasPrice: (0, import_math17.bn)(gasPrice),
4509
+ gasPrice: (0, import_math18.bn)(gasPrice),
4499
4510
  gas: minGas,
4500
4511
  priceFactor: gasPriceFactor,
4501
4512
  tip: transactionRequest.tip
4502
4513
  }).add(1);
4503
- let gasLimit = (0, import_math17.bn)(0);
4514
+ let gasLimit = (0, import_math18.bn)(0);
4504
4515
  if (transactionRequest.type === import_transactions20.TransactionType.Script) {
4505
4516
  gasLimit = transactionRequest.gasLimit;
4506
4517
  if (transactionRequest.gasLimit.eq(0)) {
@@ -4513,7 +4524,7 @@ Supported fuel-core version: ${supportedVersion}.`
4513
4524
  }
4514
4525
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4515
4526
  const maxFee = calculateGasFee({
4516
- gasPrice: (0, import_math17.bn)(gasPrice),
4527
+ gasPrice: (0, import_math18.bn)(gasPrice),
4517
4528
  gas: maxGas,
4518
4529
  priceFactor: gasPriceFactor,
4519
4530
  tip: transactionRequest.tip
@@ -4542,7 +4553,7 @@ Supported fuel-core version: ${supportedVersion}.`
4542
4553
  if (estimateTxDependencies) {
4543
4554
  return this.estimateTxDependencies(transactionRequest);
4544
4555
  }
4545
- const encodedTransactions = [(0, import_utils22.hexlify)(transactionRequest.toTransactionBytes())];
4556
+ const encodedTransactions = [(0, import_utils23.hexlify)(transactionRequest.toTransactionBytes())];
4546
4557
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4547
4558
  encodedTransactions,
4548
4559
  utxoValidation: true
@@ -4578,7 +4589,7 @@ Supported fuel-core version: ${supportedVersion}.`
4578
4589
  const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
4579
4590
  txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
4580
4591
  if (isScriptTransaction) {
4581
- txRequestClone.gasLimit = (0, import_math17.bn)(0);
4592
+ txRequestClone.gasLimit = (0, import_math18.bn)(0);
4582
4593
  }
4583
4594
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4584
4595
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -4599,7 +4610,7 @@ Supported fuel-core version: ${supportedVersion}.`
4599
4610
  let dryRunStatus;
4600
4611
  let missingContractIds = [];
4601
4612
  let outputVariables = 0;
4602
- let gasUsed = (0, import_math17.bn)(0);
4613
+ let gasUsed = (0, import_math18.bn)(0);
4603
4614
  txRequestClone.maxFee = maxFee;
4604
4615
  if (isScriptTransaction) {
4605
4616
  txRequestClone.gasLimit = gasLimit;
@@ -4658,16 +4669,16 @@ Supported fuel-core version: ${supportedVersion}.`
4658
4669
  const result = await this.operations.getCoins({
4659
4670
  first: 10,
4660
4671
  ...paginationArgs,
4661
- filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils22.hexlify)(assetId) }
4672
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils23.hexlify)(assetId) }
4662
4673
  });
4663
4674
  const coins = result.coins.edges.map((edge) => edge.node);
4664
4675
  return coins.map((coin) => ({
4665
4676
  id: coin.utxoId,
4666
4677
  assetId: coin.assetId,
4667
- amount: (0, import_math17.bn)(coin.amount),
4678
+ amount: (0, import_math18.bn)(coin.amount),
4668
4679
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4669
- blockCreated: (0, import_math17.bn)(coin.blockCreated),
4670
- txCreatedIdx: (0, import_math17.bn)(coin.txCreatedIdx)
4680
+ blockCreated: (0, import_math18.bn)(coin.blockCreated),
4681
+ txCreatedIdx: (0, import_math18.bn)(coin.txCreatedIdx)
4671
4682
  }));
4672
4683
  }
4673
4684
  /**
@@ -4681,19 +4692,19 @@ Supported fuel-core version: ${supportedVersion}.`
4681
4692
  async getResourcesToSpend(owner, quantities, excludedIds) {
4682
4693
  const ownerAddress = import_address3.Address.fromAddressOrString(owner);
4683
4694
  const excludeInput = {
4684
- messages: excludedIds?.messages?.map((nonce) => (0, import_utils22.hexlify)(nonce)) || [],
4685
- utxos: excludedIds?.utxos?.map((id) => (0, import_utils22.hexlify)(id)) || []
4695
+ messages: excludedIds?.messages?.map((nonce) => (0, import_utils23.hexlify)(nonce)) || [],
4696
+ utxos: excludedIds?.utxos?.map((id) => (0, import_utils23.hexlify)(id)) || []
4686
4697
  };
4687
4698
  if (this.cache) {
4688
4699
  const uniqueUtxos = new Set(
4689
- excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils22.hexlify)(id)))
4700
+ excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils23.hexlify)(id)))
4690
4701
  );
4691
4702
  excludeInput.utxos = Array.from(uniqueUtxos);
4692
4703
  }
4693
4704
  const coinsQuery = {
4694
4705
  owner: ownerAddress.toB256(),
4695
4706
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
4696
- assetId: (0, import_utils22.hexlify)(assetId),
4707
+ assetId: (0, import_utils23.hexlify)(assetId),
4697
4708
  amount: amount.toString(10),
4698
4709
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
4699
4710
  })),
@@ -4704,9 +4715,9 @@ Supported fuel-core version: ${supportedVersion}.`
4704
4715
  switch (coin.type) {
4705
4716
  case "MessageCoin":
4706
4717
  return {
4707
- amount: (0, import_math17.bn)(coin.amount),
4718
+ amount: (0, import_math18.bn)(coin.amount),
4708
4719
  assetId: coin.assetId,
4709
- daHeight: (0, import_math17.bn)(coin.daHeight),
4720
+ daHeight: (0, import_math18.bn)(coin.daHeight),
4710
4721
  sender: import_address3.Address.fromAddressOrString(coin.sender),
4711
4722
  recipient: import_address3.Address.fromAddressOrString(coin.recipient),
4712
4723
  nonce: coin.nonce
@@ -4714,11 +4725,11 @@ Supported fuel-core version: ${supportedVersion}.`
4714
4725
  case "Coin":
4715
4726
  return {
4716
4727
  id: coin.utxoId,
4717
- amount: (0, import_math17.bn)(coin.amount),
4728
+ amount: (0, import_math18.bn)(coin.amount),
4718
4729
  assetId: coin.assetId,
4719
4730
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4720
- blockCreated: (0, import_math17.bn)(coin.blockCreated),
4721
- txCreatedIdx: (0, import_math17.bn)(coin.txCreatedIdx)
4731
+ blockCreated: (0, import_math18.bn)(coin.blockCreated),
4732
+ txCreatedIdx: (0, import_math18.bn)(coin.txCreatedIdx)
4722
4733
  };
4723
4734
  default:
4724
4735
  return null;
@@ -4735,13 +4746,13 @@ Supported fuel-core version: ${supportedVersion}.`
4735
4746
  async getBlock(idOrHeight) {
4736
4747
  let variables;
4737
4748
  if (typeof idOrHeight === "number") {
4738
- variables = { height: (0, import_math17.bn)(idOrHeight).toString(10) };
4749
+ variables = { height: (0, import_math18.bn)(idOrHeight).toString(10) };
4739
4750
  } else if (idOrHeight === "latest") {
4740
4751
  variables = { height: (await this.getBlockNumber()).toString(10) };
4741
4752
  } else if (idOrHeight.length === 66) {
4742
4753
  variables = { blockId: idOrHeight };
4743
4754
  } else {
4744
- variables = { blockId: (0, import_math17.bn)(idOrHeight).toString(10) };
4755
+ variables = { blockId: (0, import_math18.bn)(idOrHeight).toString(10) };
4745
4756
  }
4746
4757
  const { block } = await this.operations.getBlock(variables);
4747
4758
  if (!block) {
@@ -4749,7 +4760,7 @@ Supported fuel-core version: ${supportedVersion}.`
4749
4760
  }
4750
4761
  return {
4751
4762
  id: block.id,
4752
- height: (0, import_math17.bn)(block.height),
4763
+ height: (0, import_math18.bn)(block.height),
4753
4764
  time: block.header.time,
4754
4765
  transactionIds: block.transactions.map((tx) => tx.id)
4755
4766
  };
@@ -4764,7 +4775,7 @@ Supported fuel-core version: ${supportedVersion}.`
4764
4775
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4765
4776
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4766
4777
  id: block.id,
4767
- height: (0, import_math17.bn)(block.height),
4778
+ height: (0, import_math18.bn)(block.height),
4768
4779
  time: block.header.time,
4769
4780
  transactionIds: block.transactions.map((tx) => tx.id)
4770
4781
  }));
@@ -4779,7 +4790,7 @@ Supported fuel-core version: ${supportedVersion}.`
4779
4790
  async getBlockWithTransactions(idOrHeight) {
4780
4791
  let variables;
4781
4792
  if (typeof idOrHeight === "number") {
4782
- variables = { blockHeight: (0, import_math17.bn)(idOrHeight).toString(10) };
4793
+ variables = { blockHeight: (0, import_math18.bn)(idOrHeight).toString(10) };
4783
4794
  } else if (idOrHeight === "latest") {
4784
4795
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4785
4796
  } else {
@@ -4791,11 +4802,11 @@ Supported fuel-core version: ${supportedVersion}.`
4791
4802
  }
4792
4803
  return {
4793
4804
  id: block.id,
4794
- height: (0, import_math17.bn)(block.height, 10),
4805
+ height: (0, import_math18.bn)(block.height, 10),
4795
4806
  time: block.header.time,
4796
4807
  transactionIds: block.transactions.map((tx) => tx.id),
4797
4808
  transactions: block.transactions.map(
4798
- (tx) => new import_transactions20.TransactionCoder().decode((0, import_utils22.arrayify)(tx.rawPayload), 0)?.[0]
4809
+ (tx) => new import_transactions20.TransactionCoder().decode((0, import_utils23.arrayify)(tx.rawPayload), 0)?.[0]
4799
4810
  )
4800
4811
  };
4801
4812
  }
@@ -4811,7 +4822,7 @@ Supported fuel-core version: ${supportedVersion}.`
4811
4822
  return null;
4812
4823
  }
4813
4824
  return new import_transactions20.TransactionCoder().decode(
4814
- (0, import_utils22.arrayify)(transaction.rawPayload),
4825
+ (0, import_utils23.arrayify)(transaction.rawPayload),
4815
4826
  0
4816
4827
  )?.[0];
4817
4828
  }
@@ -4838,9 +4849,9 @@ Supported fuel-core version: ${supportedVersion}.`
4838
4849
  async getContractBalance(contractId, assetId) {
4839
4850
  const { contractBalance } = await this.operations.getContractBalance({
4840
4851
  contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
4841
- asset: (0, import_utils22.hexlify)(assetId)
4852
+ asset: (0, import_utils23.hexlify)(assetId)
4842
4853
  });
4843
- return (0, import_math17.bn)(contractBalance.amount, 10);
4854
+ return (0, import_math18.bn)(contractBalance.amount, 10);
4844
4855
  }
4845
4856
  /**
4846
4857
  * Returns the balance for the given owner for the given asset ID.
@@ -4852,9 +4863,9 @@ Supported fuel-core version: ${supportedVersion}.`
4852
4863
  async getBalance(owner, assetId) {
4853
4864
  const { balance } = await this.operations.getBalance({
4854
4865
  owner: import_address3.Address.fromAddressOrString(owner).toB256(),
4855
- assetId: (0, import_utils22.hexlify)(assetId)
4866
+ assetId: (0, import_utils23.hexlify)(assetId)
4856
4867
  });
4857
- return (0, import_math17.bn)(balance.amount, 10);
4868
+ return (0, import_math18.bn)(balance.amount, 10);
4858
4869
  }
4859
4870
  /**
4860
4871
  * Returns balances for the given owner.
@@ -4872,7 +4883,7 @@ Supported fuel-core version: ${supportedVersion}.`
4872
4883
  const balances = result.balances.edges.map((edge) => edge.node);
4873
4884
  return balances.map((balance) => ({
4874
4885
  assetId: balance.assetId,
4875
- amount: (0, import_math17.bn)(balance.amount)
4886
+ amount: (0, import_math18.bn)(balance.amount)
4876
4887
  }));
4877
4888
  }
4878
4889
  /**
@@ -4894,15 +4905,15 @@ Supported fuel-core version: ${supportedVersion}.`
4894
4905
  sender: message.sender,
4895
4906
  recipient: message.recipient,
4896
4907
  nonce: message.nonce,
4897
- amount: (0, import_math17.bn)(message.amount),
4908
+ amount: (0, import_math18.bn)(message.amount),
4898
4909
  data: message.data
4899
4910
  }),
4900
4911
  sender: import_address3.Address.fromAddressOrString(message.sender),
4901
4912
  recipient: import_address3.Address.fromAddressOrString(message.recipient),
4902
4913
  nonce: message.nonce,
4903
- amount: (0, import_math17.bn)(message.amount),
4914
+ amount: (0, import_math18.bn)(message.amount),
4904
4915
  data: import_transactions20.InputMessageCoder.decodeData(message.data),
4905
- daHeight: (0, import_math17.bn)(message.daHeight)
4916
+ daHeight: (0, import_math18.bn)(message.daHeight)
4906
4917
  }));
4907
4918
  }
4908
4919
  /**
@@ -4955,19 +4966,19 @@ Supported fuel-core version: ${supportedVersion}.`
4955
4966
  } = result.messageProof;
4956
4967
  return {
4957
4968
  messageProof: {
4958
- proofIndex: (0, import_math17.bn)(messageProof.proofIndex),
4969
+ proofIndex: (0, import_math18.bn)(messageProof.proofIndex),
4959
4970
  proofSet: messageProof.proofSet
4960
4971
  },
4961
4972
  blockProof: {
4962
- proofIndex: (0, import_math17.bn)(blockProof.proofIndex),
4973
+ proofIndex: (0, import_math18.bn)(blockProof.proofIndex),
4963
4974
  proofSet: blockProof.proofSet
4964
4975
  },
4965
4976
  messageBlockHeader: {
4966
4977
  id: messageBlockHeader.id,
4967
- daHeight: (0, import_math17.bn)(messageBlockHeader.daHeight),
4978
+ daHeight: (0, import_math18.bn)(messageBlockHeader.daHeight),
4968
4979
  transactionsCount: Number(messageBlockHeader.transactionsCount),
4969
4980
  transactionsRoot: messageBlockHeader.transactionsRoot,
4970
- height: (0, import_math17.bn)(messageBlockHeader.height),
4981
+ height: (0, import_math18.bn)(messageBlockHeader.height),
4971
4982
  prevRoot: messageBlockHeader.prevRoot,
4972
4983
  time: messageBlockHeader.time,
4973
4984
  applicationHash: messageBlockHeader.applicationHash,
@@ -4979,10 +4990,10 @@ Supported fuel-core version: ${supportedVersion}.`
4979
4990
  },
4980
4991
  commitBlockHeader: {
4981
4992
  id: commitBlockHeader.id,
4982
- daHeight: (0, import_math17.bn)(commitBlockHeader.daHeight),
4993
+ daHeight: (0, import_math18.bn)(commitBlockHeader.daHeight),
4983
4994
  transactionsCount: Number(commitBlockHeader.transactionsCount),
4984
4995
  transactionsRoot: commitBlockHeader.transactionsRoot,
4985
- height: (0, import_math17.bn)(commitBlockHeader.height),
4996
+ height: (0, import_math18.bn)(commitBlockHeader.height),
4986
4997
  prevRoot: commitBlockHeader.prevRoot,
4987
4998
  time: commitBlockHeader.time,
4988
4999
  applicationHash: commitBlockHeader.applicationHash,
@@ -4995,19 +5006,19 @@ Supported fuel-core version: ${supportedVersion}.`
4995
5006
  sender: import_address3.Address.fromAddressOrString(sender),
4996
5007
  recipient: import_address3.Address.fromAddressOrString(recipient),
4997
5008
  nonce,
4998
- amount: (0, import_math17.bn)(amount),
5009
+ amount: (0, import_math18.bn)(amount),
4999
5010
  data
5000
5011
  };
5001
5012
  }
5002
5013
  async getLatestGasPrice() {
5003
5014
  const { latestGasPrice } = await this.operations.getLatestGasPrice();
5004
- return (0, import_math17.bn)(latestGasPrice.gasPrice);
5015
+ return (0, import_math18.bn)(latestGasPrice.gasPrice);
5005
5016
  }
5006
5017
  async estimateGasPrice(blockHorizon) {
5007
5018
  const { estimateGasPrice } = await this.operations.estimateGasPrice({
5008
5019
  blockHorizon: String(blockHorizon)
5009
5020
  });
5010
- return (0, import_math17.bn)(estimateGasPrice.gasPrice);
5021
+ return (0, import_math18.bn)(estimateGasPrice.gasPrice);
5011
5022
  }
5012
5023
  /**
5013
5024
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
@@ -5028,10 +5039,10 @@ Supported fuel-core version: ${supportedVersion}.`
5028
5039
  */
5029
5040
  async produceBlocks(amount, startTime) {
5030
5041
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
5031
- blocksToProduce: (0, import_math17.bn)(amount).toString(10),
5032
- startTimestamp: startTime ? import_utils22.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
5042
+ blocksToProduce: (0, import_math18.bn)(amount).toString(10),
5043
+ startTimestamp: startTime ? import_utils23.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
5033
5044
  });
5034
- return (0, import_math17.bn)(latestBlockHeight);
5045
+ return (0, import_math18.bn)(latestBlockHeight);
5035
5046
  }
5036
5047
  // eslint-disable-next-line @typescript-eslint/require-await
5037
5048
  async getTransactionResponse(transactionId) {
@@ -5077,9 +5088,9 @@ __publicField(Provider, "nodeInfoCache", {});
5077
5088
 
5078
5089
  // src/providers/transaction-summary/get-transaction-summary.ts
5079
5090
  var import_errors15 = require("@fuel-ts/errors");
5080
- var import_math18 = require("@fuel-ts/math");
5091
+ var import_math19 = require("@fuel-ts/math");
5081
5092
  var import_transactions21 = require("@fuel-ts/transactions");
5082
- var import_utils25 = require("@fuel-ts/utils");
5093
+ var import_utils26 = require("@fuel-ts/utils");
5083
5094
  async function getTransactionSummary(params) {
5084
5095
  const { id, provider, abiMap } = params;
5085
5096
  const { transaction: gqlTransaction } = await provider.operations.getTransactionWithReceipts({
@@ -5092,7 +5103,7 @@ async function getTransactionSummary(params) {
5092
5103
  );
5093
5104
  }
5094
5105
  const [decodedTransaction] = new import_transactions21.TransactionCoder().decode(
5095
- (0, import_utils25.arrayify)(gqlTransaction.rawPayload),
5106
+ (0, import_utils26.arrayify)(gqlTransaction.rawPayload),
5096
5107
  0
5097
5108
  );
5098
5109
  let txReceipts = [];
@@ -5112,10 +5123,10 @@ async function getTransactionSummary(params) {
5112
5123
  id: gqlTransaction.id,
5113
5124
  receipts,
5114
5125
  transaction: decodedTransaction,
5115
- transactionBytes: (0, import_utils25.arrayify)(gqlTransaction.rawPayload),
5126
+ transactionBytes: (0, import_utils26.arrayify)(gqlTransaction.rawPayload),
5116
5127
  gqlTransactionStatus: gqlTransaction.status,
5117
- gasPerByte: (0, import_math18.bn)(gasPerByte),
5118
- gasPriceFactor: (0, import_math18.bn)(gasPriceFactor),
5128
+ gasPerByte: (0, import_math19.bn)(gasPerByte),
5129
+ gasPriceFactor: (0, import_math19.bn)(gasPriceFactor),
5119
5130
  abiMap,
5120
5131
  maxInputs,
5121
5132
  gasCosts,
@@ -5164,7 +5175,7 @@ async function getTransactionsSummaries(params) {
5164
5175
  const transactions = edges.map((edge) => {
5165
5176
  const { node: gqlTransaction } = edge;
5166
5177
  const { id, rawPayload, status } = gqlTransaction;
5167
- const [decodedTransaction] = new import_transactions21.TransactionCoder().decode((0, import_utils25.arrayify)(rawPayload), 0);
5178
+ const [decodedTransaction] = new import_transactions21.TransactionCoder().decode((0, import_utils26.arrayify)(rawPayload), 0);
5168
5179
  let txReceipts = [];
5169
5180
  if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
5170
5181
  txReceipts = gqlTransaction.status.receipts;
@@ -5174,7 +5185,7 @@ async function getTransactionsSummaries(params) {
5174
5185
  id,
5175
5186
  receipts,
5176
5187
  transaction: decodedTransaction,
5177
- transactionBytes: (0, import_utils25.arrayify)(rawPayload),
5188
+ transactionBytes: (0, import_utils26.arrayify)(rawPayload),
5178
5189
  gqlTransactionStatus: status,
5179
5190
  abiMap,
5180
5191
  gasPerByte,
@@ -5323,17 +5334,17 @@ var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
5323
5334
 
5324
5335
  // src/utils/formatTransferToContractScriptData.ts
5325
5336
  var import_abi_coder6 = require("@fuel-ts/abi-coder");
5326
- var import_math19 = require("@fuel-ts/math");
5327
- var import_utils27 = require("@fuel-ts/utils");
5337
+ var import_math20 = require("@fuel-ts/math");
5338
+ var import_utils28 = require("@fuel-ts/utils");
5328
5339
  var asm = __toESM(require("@fuels/vm-asm"));
5329
5340
  var formatTransferToContractScriptData = (params) => {
5330
5341
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
5331
5342
  const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
5332
- const encoded = numberCoder.encode(new import_math19.BN(amountToTransfer).toNumber());
5343
+ const encoded = numberCoder.encode(new import_math20.BN(amountToTransfer).toNumber());
5333
5344
  const scriptData = Uint8Array.from([
5334
- ...(0, import_utils27.arrayify)(hexlifiedContractId),
5345
+ ...(0, import_utils28.arrayify)(hexlifiedContractId),
5335
5346
  ...encoded,
5336
- ...(0, import_utils27.arrayify)(assetId)
5347
+ ...(0, import_utils28.arrayify)(assetId)
5337
5348
  ]);
5338
5349
  return scriptData;
5339
5350
  };
@@ -5524,9 +5535,9 @@ var Account = class extends import_interfaces.AbstractAccount {
5524
5535
  const { addedSignatures, estimatedPredicates, requiredQuantities, updateMaxFee } = params;
5525
5536
  const fee = request.maxFee;
5526
5537
  const baseAssetId = this.provider.getBaseAssetId();
5527
- const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || (0, import_math20.bn)(0);
5538
+ const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || (0, import_math21.bn)(0);
5528
5539
  const requiredQuantitiesWithFee = addAmountToCoinQuantities({
5529
- amount: (0, import_math20.bn)(fee),
5540
+ amount: (0, import_math21.bn)(fee),
5530
5541
  assetId: baseAssetId,
5531
5542
  coinQuantities: requiredQuantities
5532
5543
  });
@@ -5534,7 +5545,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5534
5545
  requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
5535
5546
  quantitiesDict[assetId] = {
5536
5547
  required: amount,
5537
- owned: (0, import_math20.bn)(0)
5548
+ owned: (0, import_math21.bn)(0)
5538
5549
  };
5539
5550
  });
5540
5551
  request.inputs.filter(isRequestInputResource).forEach((input) => {
@@ -5561,6 +5572,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5561
5572
  cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
5562
5573
  );
5563
5574
  request.addResources(resources);
5575
+ request.shiftPredicateData();
5564
5576
  request.updatePredicateGasUsed(estimatedPredicates);
5565
5577
  const requestToReestimate2 = (0, import_ramda4.clone)(request);
5566
5578
  if (addedSignatures) {
@@ -5592,6 +5604,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5592
5604
  }
5593
5605
  fundingAttempts += 1;
5594
5606
  }
5607
+ request.shiftPredicateData();
5595
5608
  request.updatePredicateGasUsed(estimatedPredicates);
5596
5609
  const requestToReestimate = (0, import_ramda4.clone)(request);
5597
5610
  if (addedSignatures) {
@@ -5642,7 +5655,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5642
5655
  * @returns A promise that resolves to the transaction response.
5643
5656
  */
5644
5657
  async transfer(destination, amount, assetId, txParams = {}) {
5645
- if ((0, import_math20.bn)(amount).lte(0)) {
5658
+ if ((0, import_math21.bn)(amount).lte(0)) {
5646
5659
  throw new import_errors16.FuelError(
5647
5660
  import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
5648
5661
  "Transfer amount must be a positive number."
@@ -5662,7 +5675,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5662
5675
  * @returns A promise that resolves to the transaction response.
5663
5676
  */
5664
5677
  async transferToContract(contractId, amount, assetId, txParams = {}) {
5665
- if ((0, import_math20.bn)(amount).lte(0)) {
5678
+ if ((0, import_math21.bn)(amount).lte(0)) {
5666
5679
  throw new import_errors16.FuelError(
5667
5680
  import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
5668
5681
  "Transfer amount must be a positive number."
@@ -5672,7 +5685,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5672
5685
  const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5673
5686
  const { script, scriptData } = await assembleTransferToContractScript({
5674
5687
  hexlifiedContractId: contractAddress.toB256(),
5675
- amountToTransfer: (0, import_math20.bn)(amount),
5688
+ amountToTransfer: (0, import_math21.bn)(amount),
5676
5689
  assetId: assetIdToTransfer
5677
5690
  });
5678
5691
  let request = new ScriptTransactionRequest({
@@ -5683,7 +5696,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5683
5696
  request.addContractInputAndOutput(contractAddress);
5684
5697
  const txCost = await this.provider.getTransactionCost(request, {
5685
5698
  resourcesOwner: this,
5686
- quantitiesToContract: [{ amount: (0, import_math20.bn)(amount), assetId: String(assetIdToTransfer) }]
5699
+ quantitiesToContract: [{ amount: (0, import_math21.bn)(amount), assetId: String(assetIdToTransfer) }]
5687
5700
  });
5688
5701
  request = this.validateGasLimitAndMaxFee({
5689
5702
  transactionRequest: request,
@@ -5704,21 +5717,21 @@ var Account = class extends import_interfaces.AbstractAccount {
5704
5717
  */
5705
5718
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
5706
5719
  const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
5707
- const recipientDataArray = (0, import_utils28.arrayify)(
5720
+ const recipientDataArray = (0, import_utils29.arrayify)(
5708
5721
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5709
5722
  );
5710
- const amountDataArray = (0, import_utils28.arrayify)(
5711
- "0x".concat((0, import_math20.bn)(amount).toHex().substring(2).padStart(16, "0"))
5723
+ const amountDataArray = (0, import_utils29.arrayify)(
5724
+ "0x".concat((0, import_math21.bn)(amount).toHex().substring(2).padStart(16, "0"))
5712
5725
  );
5713
5726
  const script = new Uint8Array([
5714
- ...(0, import_utils28.arrayify)(withdrawScript.bytes),
5727
+ ...(0, import_utils29.arrayify)(withdrawScript.bytes),
5715
5728
  ...recipientDataArray,
5716
5729
  ...amountDataArray
5717
5730
  ]);
5718
5731
  const params = { script, ...txParams };
5719
5732
  const baseAssetId = this.provider.getBaseAssetId();
5720
5733
  let request = new ScriptTransactionRequest(params);
5721
- const quantitiesToContract = [{ amount: (0, import_math20.bn)(amount), assetId: baseAssetId }];
5734
+ const quantitiesToContract = [{ amount: (0, import_math21.bn)(amount), assetId: baseAssetId }];
5722
5735
  const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
5723
5736
  request = this.validateGasLimitAndMaxFee({
5724
5737
  transactionRequest: request,
@@ -5791,7 +5804,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5791
5804
  txParams: { gasLimit: setGasLimit, maxFee: setMaxFee }
5792
5805
  }) {
5793
5806
  const request = transactionRequestify(transactionRequest);
5794
- if (!(0, import_utils28.isDefined)(setGasLimit)) {
5807
+ if (!(0, import_utils29.isDefined)(setGasLimit)) {
5795
5808
  request.gasLimit = gasUsed;
5796
5809
  } else if (gasUsed.gt(setGasLimit)) {
5797
5810
  throw new import_errors16.FuelError(
@@ -5799,7 +5812,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5799
5812
  `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
5800
5813
  );
5801
5814
  }
5802
- if (!(0, import_utils28.isDefined)(setMaxFee)) {
5815
+ if (!(0, import_utils29.isDefined)(setMaxFee)) {
5803
5816
  request.maxFee = maxFee;
5804
5817
  } else if (maxFee.gt(setMaxFee)) {
5805
5818
  throw new import_errors16.FuelError(
@@ -5813,14 +5826,14 @@ var Account = class extends import_interfaces.AbstractAccount {
5813
5826
 
5814
5827
  // src/wallet/base-wallet-unlocked.ts
5815
5828
  var import_hasher3 = require("@fuel-ts/hasher");
5816
- var import_utils31 = require("@fuel-ts/utils");
5829
+ var import_utils32 = require("@fuel-ts/utils");
5817
5830
 
5818
5831
  // src/signer/signer.ts
5819
5832
  var import_address5 = require("@fuel-ts/address");
5820
5833
  var import_crypto2 = require("@fuel-ts/crypto");
5821
5834
  var import_hasher2 = require("@fuel-ts/hasher");
5822
- var import_math21 = require("@fuel-ts/math");
5823
- var import_utils29 = require("@fuel-ts/utils");
5835
+ var import_math22 = require("@fuel-ts/math");
5836
+ var import_utils30 = require("@fuel-ts/utils");
5824
5837
  var import_secp256k1 = require("@noble/curves/secp256k1");
5825
5838
  var Signer = class {
5826
5839
  address;
@@ -5839,10 +5852,10 @@ var Signer = class {
5839
5852
  privateKey = `0x${privateKey}`;
5840
5853
  }
5841
5854
  }
5842
- const privateKeyBytes = (0, import_math21.toBytes)(privateKey, 32);
5843
- this.privateKey = (0, import_utils29.hexlify)(privateKeyBytes);
5844
- this.publicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
5845
- this.compressedPublicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
5855
+ const privateKeyBytes = (0, import_math22.toBytes)(privateKey, 32);
5856
+ this.privateKey = (0, import_utils30.hexlify)(privateKeyBytes);
5857
+ this.publicKey = (0, import_utils30.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
5858
+ this.compressedPublicKey = (0, import_utils30.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
5846
5859
  this.address = import_address5.Address.fromPublicKey(this.publicKey);
5847
5860
  }
5848
5861
  /**
@@ -5856,11 +5869,11 @@ var Signer = class {
5856
5869
  * @returns hashed signature
5857
5870
  */
5858
5871
  sign(data) {
5859
- const signature = import_secp256k1.secp256k1.sign((0, import_utils29.arrayify)(data), (0, import_utils29.arrayify)(this.privateKey));
5860
- const r = (0, import_math21.toBytes)(`0x${signature.r.toString(16)}`, 32);
5861
- const s = (0, import_math21.toBytes)(`0x${signature.s.toString(16)}`, 32);
5872
+ const signature = import_secp256k1.secp256k1.sign((0, import_utils30.arrayify)(data), (0, import_utils30.arrayify)(this.privateKey));
5873
+ const r = (0, import_math22.toBytes)(`0x${signature.r.toString(16)}`, 32);
5874
+ const s = (0, import_math22.toBytes)(`0x${signature.s.toString(16)}`, 32);
5862
5875
  s[0] |= (signature.recovery || 0) << 7;
5863
- return (0, import_utils29.hexlify)((0, import_utils29.concat)([r, s]));
5876
+ return (0, import_utils30.hexlify)((0, import_utils30.concat)([r, s]));
5864
5877
  }
5865
5878
  /**
5866
5879
  * Add point on the current elliptic curve
@@ -5869,8 +5882,8 @@ var Signer = class {
5869
5882
  * @returns compressed point on the curve
5870
5883
  */
5871
5884
  addPoint(point) {
5872
- const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(this.compressedPublicKey));
5873
- const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(point));
5885
+ const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils30.arrayify)(this.compressedPublicKey));
5886
+ const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils30.arrayify)(point));
5874
5887
  const result = p0.add(p1);
5875
5888
  return `0x${result.toHex(true)}`;
5876
5889
  }
@@ -5882,16 +5895,16 @@ var Signer = class {
5882
5895
  * @returns public key from signature from the
5883
5896
  */
5884
5897
  static recoverPublicKey(data, signature) {
5885
- const signedMessageBytes = (0, import_utils29.arrayify)(signature);
5898
+ const signedMessageBytes = (0, import_utils30.arrayify)(signature);
5886
5899
  const r = signedMessageBytes.slice(0, 32);
5887
5900
  const s = signedMessageBytes.slice(32, 64);
5888
5901
  const recoveryParam = (s[0] & 128) >> 7;
5889
5902
  s[0] &= 127;
5890
- const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils29.hexlify)(r)), BigInt((0, import_utils29.hexlify)(s))).addRecoveryBit(
5903
+ const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils30.hexlify)(r)), BigInt((0, import_utils30.hexlify)(s))).addRecoveryBit(
5891
5904
  recoveryParam
5892
5905
  );
5893
- const publicKey = sig.recoverPublicKey((0, import_utils29.arrayify)(data)).toRawBytes(false).slice(1);
5894
- return (0, import_utils29.hexlify)(publicKey);
5906
+ const publicKey = sig.recoverPublicKey((0, import_utils30.arrayify)(data)).toRawBytes(false).slice(1);
5907
+ return (0, import_utils30.hexlify)(publicKey);
5895
5908
  }
5896
5909
  /**
5897
5910
  * Recover the address from a signature performed with [`sign`](#sign).
@@ -5910,7 +5923,7 @@ var Signer = class {
5910
5923
  * @returns random 32-byte hashed
5911
5924
  */
5912
5925
  static generatePrivateKey(entropy) {
5913
- return entropy ? (0, import_hasher2.hash)((0, import_utils29.concat)([(0, import_crypto2.randomBytes)(32), (0, import_utils29.arrayify)(entropy)])) : (0, import_crypto2.randomBytes)(32);
5926
+ return entropy ? (0, import_hasher2.hash)((0, import_utils30.concat)([(0, import_crypto2.randomBytes)(32), (0, import_utils30.arrayify)(entropy)])) : (0, import_crypto2.randomBytes)(32);
5914
5927
  }
5915
5928
  /**
5916
5929
  * Extended publicKey from a compact publicKey
@@ -5919,8 +5932,8 @@ var Signer = class {
5919
5932
  * @returns extended publicKey
5920
5933
  */
5921
5934
  static extendPublicKey(publicKey) {
5922
- const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(publicKey));
5923
- return (0, import_utils29.hexlify)(point.toRawBytes(false).slice(1));
5935
+ const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils30.arrayify)(publicKey));
5936
+ return (0, import_utils30.hexlify)(point.toRawBytes(false).slice(1));
5924
5937
  }
5925
5938
  };
5926
5939
 
@@ -5928,7 +5941,7 @@ var Signer = class {
5928
5941
  var import_address6 = require("@fuel-ts/address");
5929
5942
  var import_crypto3 = require("@fuel-ts/crypto");
5930
5943
  var import_errors17 = require("@fuel-ts/errors");
5931
- var import_utils30 = require("@fuel-ts/utils");
5944
+ var import_utils31 = require("@fuel-ts/utils");
5932
5945
  var import_uuid = require("uuid");
5933
5946
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
5934
5947
  var DEFAULT_KDF_PARAMS_R = 8;
@@ -6011,7 +6024,7 @@ async function decryptKeystoreWallet(jsonWallet, password) {
6011
6024
  );
6012
6025
  }
6013
6026
  const buffer = await (0, import_crypto3.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
6014
- const privateKey = (0, import_utils30.hexlify)(buffer);
6027
+ const privateKey = (0, import_utils31.hexlify)(buffer);
6015
6028
  return privateKey;
6016
6029
  }
6017
6030
 
@@ -6056,7 +6069,7 @@ var BaseWalletUnlocked = class extends Account {
6056
6069
  */
6057
6070
  async signMessage(message) {
6058
6071
  const signedMessage = await this.signer().sign((0, import_hasher3.hashMessage)(message));
6059
- return (0, import_utils31.hexlify)(signedMessage);
6072
+ return (0, import_utils32.hexlify)(signedMessage);
6060
6073
  }
6061
6074
  /**
6062
6075
  * Signs a transaction with the wallet's private key.
@@ -6069,7 +6082,7 @@ var BaseWalletUnlocked = class extends Account {
6069
6082
  const chainId = this.provider.getChainId();
6070
6083
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
6071
6084
  const signature = await this.signer().sign(hashedTransaction);
6072
- return (0, import_utils31.hexlify)(signature);
6085
+ return (0, import_utils32.hexlify)(signature);
6073
6086
  }
6074
6087
  /**
6075
6088
  * Populates a transaction with the witnesses signature.
@@ -6131,14 +6144,14 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
6131
6144
  var import_crypto5 = require("@fuel-ts/crypto");
6132
6145
  var import_errors20 = require("@fuel-ts/errors");
6133
6146
  var import_hasher6 = require("@fuel-ts/hasher");
6134
- var import_math22 = require("@fuel-ts/math");
6135
- var import_utils35 = require("@fuel-ts/utils");
6147
+ var import_math23 = require("@fuel-ts/math");
6148
+ var import_utils36 = require("@fuel-ts/utils");
6136
6149
 
6137
6150
  // src/mnemonic/mnemonic.ts
6138
6151
  var import_crypto4 = require("@fuel-ts/crypto");
6139
6152
  var import_errors19 = require("@fuel-ts/errors");
6140
6153
  var import_hasher5 = require("@fuel-ts/hasher");
6141
- var import_utils33 = require("@fuel-ts/utils");
6154
+ var import_utils34 = require("@fuel-ts/utils");
6142
6155
 
6143
6156
  // src/wordlists/words/english.ts
6144
6157
  var english = [
@@ -8201,7 +8214,7 @@ var Language = /* @__PURE__ */ ((Language2) => {
8201
8214
  // src/mnemonic/utils.ts
8202
8215
  var import_errors18 = require("@fuel-ts/errors");
8203
8216
  var import_hasher4 = require("@fuel-ts/hasher");
8204
- var import_utils32 = require("@fuel-ts/utils");
8217
+ var import_utils33 = require("@fuel-ts/utils");
8205
8218
  function toUtf8Bytes(stri) {
8206
8219
  const str = stri.normalize("NFKD");
8207
8220
  const result = [];
@@ -8268,14 +8281,14 @@ function entropyToMnemonicIndices(entropy) {
8268
8281
  }
8269
8282
  }
8270
8283
  const checksumBits = entropy.length / 4;
8271
- const checksum = (0, import_utils32.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
8284
+ const checksum = (0, import_utils33.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
8272
8285
  indices[indices.length - 1] <<= checksumBits;
8273
8286
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
8274
8287
  return indices;
8275
8288
  }
8276
8289
  function mnemonicWordsToEntropy(words, wordlist) {
8277
8290
  const size = Math.ceil(11 * words.length / 8);
8278
- const entropy = (0, import_utils32.arrayify)(new Uint8Array(size));
8291
+ const entropy = (0, import_utils33.arrayify)(new Uint8Array(size));
8279
8292
  let offset = 0;
8280
8293
  for (let i = 0; i < words.length; i += 1) {
8281
8294
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
@@ -8295,7 +8308,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
8295
8308
  const entropyBits = 32 * words.length / 3;
8296
8309
  const checksumBits = words.length / 3;
8297
8310
  const checksumMask = getUpperMask(checksumBits);
8298
- const checksum = (0, import_utils32.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
8311
+ const checksum = (0, import_utils33.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
8299
8312
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
8300
8313
  throw new import_errors18.FuelError(
8301
8314
  import_errors18.ErrorCode.INVALID_CHECKSUM,
@@ -8370,7 +8383,7 @@ var Mnemonic = class {
8370
8383
  static mnemonicToEntropy(phrase, wordlist = english) {
8371
8384
  const words = getWords(phrase);
8372
8385
  assertMnemonic(words);
8373
- return (0, import_utils33.hexlify)(mnemonicWordsToEntropy(words, wordlist));
8386
+ return (0, import_utils34.hexlify)(mnemonicWordsToEntropy(words, wordlist));
8374
8387
  }
8375
8388
  /**
8376
8389
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -8378,7 +8391,7 @@ var Mnemonic = class {
8378
8391
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
8379
8392
  */
8380
8393
  static entropyToMnemonic(entropy, wordlist = english) {
8381
- const entropyBytes = (0, import_utils33.arrayify)(entropy);
8394
+ const entropyBytes = (0, import_utils34.arrayify)(entropy);
8382
8395
  assertWordList(wordlist);
8383
8396
  assertEntropy(entropyBytes);
8384
8397
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -8447,14 +8460,14 @@ var Mnemonic = class {
8447
8460
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
8448
8461
  */
8449
8462
  static masterKeysFromSeed(seed) {
8450
- const seedArray = (0, import_utils33.arrayify)(seed);
8463
+ const seedArray = (0, import_utils34.arrayify)(seed);
8451
8464
  if (seedArray.length < 16 || seedArray.length > 64) {
8452
8465
  throw new import_errors19.FuelError(
8453
8466
  import_errors19.ErrorCode.INVALID_SEED,
8454
8467
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
8455
8468
  );
8456
8469
  }
8457
- return (0, import_utils33.arrayify)((0, import_crypto4.computeHmac)("sha512", MasterSecret, seedArray));
8470
+ return (0, import_utils34.arrayify)((0, import_crypto4.computeHmac)("sha512", MasterSecret, seedArray));
8458
8471
  }
8459
8472
  /**
8460
8473
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -8465,22 +8478,22 @@ var Mnemonic = class {
8465
8478
  */
8466
8479
  static seedToExtendedKey(seed, testnet = false) {
8467
8480
  const masterKey = Mnemonic.masterKeysFromSeed(seed);
8468
- const prefix = (0, import_utils33.arrayify)(testnet ? TestnetPRV : MainnetPRV);
8481
+ const prefix = (0, import_utils34.arrayify)(testnet ? TestnetPRV : MainnetPRV);
8469
8482
  const depth = "0x00";
8470
8483
  const fingerprint = "0x00000000";
8471
8484
  const index = "0x00000000";
8472
8485
  const chainCode = masterKey.slice(32);
8473
8486
  const privateKey = masterKey.slice(0, 32);
8474
- const extendedKey = (0, import_utils33.concat)([
8487
+ const extendedKey = (0, import_utils34.concat)([
8475
8488
  prefix,
8476
8489
  depth,
8477
8490
  fingerprint,
8478
8491
  index,
8479
8492
  chainCode,
8480
- (0, import_utils33.concat)(["0x00", privateKey])
8493
+ (0, import_utils34.concat)(["0x00", privateKey])
8481
8494
  ]);
8482
- const checksum = (0, import_utils33.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
8483
- return (0, import_utils33.encodeBase58)((0, import_utils33.concat)([extendedKey, checksum]));
8495
+ const checksum = (0, import_utils34.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
8496
+ return (0, import_utils34.encodeBase58)((0, import_utils34.concat)([extendedKey, checksum]));
8484
8497
  }
8485
8498
  /**
8486
8499
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -8495,7 +8508,7 @@ var Mnemonic = class {
8495
8508
  * @returns A randomly generated mnemonic
8496
8509
  */
8497
8510
  static generate(size = 32, extraEntropy = "") {
8498
- const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils33.concat)([(0, import_crypto4.randomBytes)(size), (0, import_utils33.arrayify)(extraEntropy)])) : (0, import_crypto4.randomBytes)(size);
8511
+ const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils34.concat)([(0, import_crypto4.randomBytes)(size), (0, import_utils34.arrayify)(extraEntropy)])) : (0, import_crypto4.randomBytes)(size);
8499
8512
  return Mnemonic.entropyToMnemonic(entropy);
8500
8513
  }
8501
8514
  };
@@ -8503,12 +8516,12 @@ var mnemonic_default = Mnemonic;
8503
8516
 
8504
8517
  // src/hdwallet/hdwallet.ts
8505
8518
  var HARDENED_INDEX = 2147483648;
8506
- var MainnetPRV2 = (0, import_utils35.hexlify)("0x0488ade4");
8507
- var MainnetPUB = (0, import_utils35.hexlify)("0x0488b21e");
8508
- var TestnetPRV2 = (0, import_utils35.hexlify)("0x04358394");
8509
- var TestnetPUB = (0, import_utils35.hexlify)("0x043587cf");
8519
+ var MainnetPRV2 = (0, import_utils36.hexlify)("0x0488ade4");
8520
+ var MainnetPUB = (0, import_utils36.hexlify)("0x0488b21e");
8521
+ var TestnetPRV2 = (0, import_utils36.hexlify)("0x04358394");
8522
+ var TestnetPUB = (0, import_utils36.hexlify)("0x043587cf");
8510
8523
  function base58check(data) {
8511
- return (0, import_utils35.encodeBase58)((0, import_utils35.concat)([data, (0, import_utils35.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
8524
+ return (0, import_utils36.encodeBase58)((0, import_utils36.concat)([data, (0, import_utils36.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
8512
8525
  }
8513
8526
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
8514
8527
  if (isPublic) {
@@ -8517,11 +8530,11 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
8517
8530
  return testnet ? TestnetPRV2 : MainnetPRV2;
8518
8531
  }
8519
8532
  function isPublicExtendedKey(extendedKey) {
8520
- return [MainnetPUB, TestnetPUB].includes((0, import_utils35.hexlify)(extendedKey.slice(0, 4)));
8533
+ return [MainnetPUB, TestnetPUB].includes((0, import_utils36.hexlify)(extendedKey.slice(0, 4)));
8521
8534
  }
8522
8535
  function isValidExtendedKey(extendedKey) {
8523
8536
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
8524
- (0, import_utils35.hexlify)(extendedKey.slice(0, 4))
8537
+ (0, import_utils36.hexlify)(extendedKey.slice(0, 4))
8525
8538
  );
8526
8539
  }
8527
8540
  function parsePath(path, depth = 0) {
@@ -8539,8 +8552,8 @@ function parsePath(path, depth = 0) {
8539
8552
  var HDWallet = class {
8540
8553
  depth = 0;
8541
8554
  index = 0;
8542
- fingerprint = (0, import_utils35.hexlify)("0x00000000");
8543
- parentFingerprint = (0, import_utils35.hexlify)("0x00000000");
8555
+ fingerprint = (0, import_utils36.hexlify)("0x00000000");
8556
+ parentFingerprint = (0, import_utils36.hexlify)("0x00000000");
8544
8557
  privateKey;
8545
8558
  publicKey;
8546
8559
  chainCode;
@@ -8552,8 +8565,8 @@ var HDWallet = class {
8552
8565
  constructor(config) {
8553
8566
  if (config.privateKey) {
8554
8567
  const signer = new Signer(config.privateKey);
8555
- this.publicKey = (0, import_utils35.hexlify)(signer.compressedPublicKey);
8556
- this.privateKey = (0, import_utils35.hexlify)(config.privateKey);
8568
+ this.publicKey = (0, import_utils36.hexlify)(signer.compressedPublicKey);
8569
+ this.privateKey = (0, import_utils36.hexlify)(config.privateKey);
8557
8570
  } else {
8558
8571
  if (!config.publicKey) {
8559
8572
  throw new import_errors20.FuelError(
@@ -8561,10 +8574,10 @@ var HDWallet = class {
8561
8574
  "Both public and private Key cannot be missing. At least one should be provided."
8562
8575
  );
8563
8576
  }
8564
- this.publicKey = (0, import_utils35.hexlify)(config.publicKey);
8577
+ this.publicKey = (0, import_utils36.hexlify)(config.publicKey);
8565
8578
  }
8566
8579
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
8567
- this.fingerprint = (0, import_utils35.dataSlice)((0, import_crypto5.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
8580
+ this.fingerprint = (0, import_utils36.dataSlice)((0, import_crypto5.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
8568
8581
  this.depth = config.depth || this.depth;
8569
8582
  this.index = config.index || this.index;
8570
8583
  this.chainCode = config.chainCode;
@@ -8580,9 +8593,9 @@ var HDWallet = class {
8580
8593
  * @returns A new instance of HDWallet on the derived index
8581
8594
  */
8582
8595
  deriveIndex(index) {
8583
- const privateKey = this.privateKey && (0, import_utils35.arrayify)(this.privateKey);
8584
- const publicKey = (0, import_utils35.arrayify)(this.publicKey);
8585
- const chainCode = (0, import_utils35.arrayify)(this.chainCode);
8596
+ const privateKey = this.privateKey && (0, import_utils36.arrayify)(this.privateKey);
8597
+ const publicKey = (0, import_utils36.arrayify)(this.publicKey);
8598
+ const chainCode = (0, import_utils36.arrayify)(this.chainCode);
8586
8599
  const data = new Uint8Array(37);
8587
8600
  if (index & HARDENED_INDEX) {
8588
8601
  if (!privateKey) {
@@ -8593,15 +8606,15 @@ var HDWallet = class {
8593
8606
  }
8594
8607
  data.set(privateKey, 1);
8595
8608
  } else {
8596
- data.set((0, import_utils35.arrayify)(this.publicKey));
8609
+ data.set((0, import_utils36.arrayify)(this.publicKey));
8597
8610
  }
8598
- data.set((0, import_math22.toBytes)(index, 4), 33);
8599
- const bytes = (0, import_utils35.arrayify)((0, import_crypto5.computeHmac)("sha512", chainCode, data));
8611
+ data.set((0, import_math23.toBytes)(index, 4), 33);
8612
+ const bytes = (0, import_utils36.arrayify)((0, import_crypto5.computeHmac)("sha512", chainCode, data));
8600
8613
  const IL = bytes.slice(0, 32);
8601
8614
  const IR = bytes.slice(32);
8602
8615
  if (privateKey) {
8603
8616
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
8604
- const ki = (0, import_math22.bn)(IL).add(privateKey).mod(N).toBytes(32);
8617
+ const ki = (0, import_math23.bn)(IL).add(privateKey).mod(N).toBytes(32);
8605
8618
  return new HDWallet({
8606
8619
  privateKey: ki,
8607
8620
  chainCode: IR,
@@ -8610,7 +8623,7 @@ var HDWallet = class {
8610
8623
  parentFingerprint: this.fingerprint
8611
8624
  });
8612
8625
  }
8613
- const signer = new Signer((0, import_utils35.hexlify)(IL));
8626
+ const signer = new Signer((0, import_utils36.hexlify)(IL));
8614
8627
  const Ki = signer.addPoint(publicKey);
8615
8628
  return new HDWallet({
8616
8629
  publicKey: Ki,
@@ -8645,12 +8658,12 @@ var HDWallet = class {
8645
8658
  );
8646
8659
  }
8647
8660
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
8648
- const depth = (0, import_utils35.hexlify)(Uint8Array.from([this.depth]));
8661
+ const depth = (0, import_utils36.hexlify)(Uint8Array.from([this.depth]));
8649
8662
  const parentFingerprint = this.parentFingerprint;
8650
- const index = (0, import_math22.toHex)(this.index, 4);
8663
+ const index = (0, import_math23.toHex)(this.index, 4);
8651
8664
  const chainCode = this.chainCode;
8652
- const key = this.privateKey != null && !isPublic ? (0, import_utils35.concat)(["0x00", this.privateKey]) : this.publicKey;
8653
- const extendedKey = (0, import_utils35.arrayify)((0, import_utils35.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
8665
+ const key = this.privateKey != null && !isPublic ? (0, import_utils36.concat)(["0x00", this.privateKey]) : this.publicKey;
8666
+ const extendedKey = (0, import_utils36.arrayify)((0, import_utils36.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
8654
8667
  return base58check(extendedKey);
8655
8668
  }
8656
8669
  /**
@@ -8662,13 +8675,13 @@ var HDWallet = class {
8662
8675
  static fromSeed(seed) {
8663
8676
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
8664
8677
  return new HDWallet({
8665
- chainCode: (0, import_utils35.arrayify)(masterKey.slice(32)),
8666
- privateKey: (0, import_utils35.arrayify)(masterKey.slice(0, 32))
8678
+ chainCode: (0, import_utils36.arrayify)(masterKey.slice(32)),
8679
+ privateKey: (0, import_utils36.arrayify)(masterKey.slice(0, 32))
8667
8680
  });
8668
8681
  }
8669
8682
  static fromExtendedKey(extendedKey) {
8670
- const decoded = (0, import_utils35.hexlify)((0, import_math22.toBytes)((0, import_utils35.decodeBase58)(extendedKey)));
8671
- const bytes = (0, import_utils35.arrayify)(decoded);
8683
+ const decoded = (0, import_utils36.hexlify)((0, import_math23.toBytes)((0, import_utils36.decodeBase58)(extendedKey)));
8684
+ const bytes = (0, import_utils36.arrayify)(decoded);
8672
8685
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
8673
8686
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
8674
8687
  throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
@@ -8677,9 +8690,9 @@ var HDWallet = class {
8677
8690
  throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
8678
8691
  }
8679
8692
  const depth = bytes[4];
8680
- const parentFingerprint = (0, import_utils35.hexlify)(bytes.slice(5, 9));
8681
- const index = parseInt((0, import_utils35.hexlify)(bytes.slice(9, 13)).substring(2), 16);
8682
- const chainCode = (0, import_utils35.hexlify)(bytes.slice(13, 45));
8693
+ const parentFingerprint = (0, import_utils36.hexlify)(bytes.slice(5, 9));
8694
+ const index = parseInt((0, import_utils36.hexlify)(bytes.slice(9, 13)).substring(2), 16);
8695
+ const chainCode = (0, import_utils36.hexlify)(bytes.slice(13, 45));
8683
8696
  const key = bytes.slice(45, 78);
8684
8697
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
8685
8698
  throw new import_errors20.FuelError(
@@ -9283,18 +9296,19 @@ var StorageAbstract = class {
9283
9296
  var import_abi_coder7 = require("@fuel-ts/abi-coder");
9284
9297
  var import_address10 = require("@fuel-ts/address");
9285
9298
  var import_errors25 = require("@fuel-ts/errors");
9286
- var import_utils37 = require("@fuel-ts/utils");
9299
+ var import_transactions22 = require("@fuel-ts/transactions");
9300
+ var import_utils38 = require("@fuel-ts/utils");
9287
9301
 
9288
9302
  // src/predicate/utils/getPredicateRoot.ts
9289
9303
  var import_hasher7 = require("@fuel-ts/hasher");
9290
9304
  var import_merkle = require("@fuel-ts/merkle");
9291
- var import_utils36 = require("@fuel-ts/utils");
9305
+ var import_utils37 = require("@fuel-ts/utils");
9292
9306
  var getPredicateRoot = (bytecode) => {
9293
9307
  const chunkSize = 16 * 1024;
9294
- const bytes = (0, import_utils36.arrayify)(bytecode);
9295
- const chunks = (0, import_utils36.chunkAndPadBytes)(bytes, chunkSize);
9296
- const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0, import_utils36.hexlify)(c)));
9297
- const predicateRoot = (0, import_hasher7.hash)((0, import_utils36.concat)(["0x4655454C", codeRoot]));
9308
+ const bytes = (0, import_utils37.arrayify)(bytecode);
9309
+ const chunks = (0, import_utils37.chunkAndPadBytes)(bytes, chunkSize);
9310
+ const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0, import_utils37.hexlify)(c)));
9311
+ const predicateRoot = (0, import_hasher7.hash)((0, import_utils37.concat)(["0x4655454C", codeRoot]));
9298
9312
  return predicateRoot;
9299
9313
  };
9300
9314
 
@@ -9340,14 +9354,15 @@ var Predicate = class extends Account {
9340
9354
  */
9341
9355
  populateTransactionPredicateData(transactionRequestLike) {
9342
9356
  const request = transactionRequestify(transactionRequestLike);
9357
+ const { policies } = BaseTransactionRequest.getPolicyMeta(request);
9343
9358
  const placeholderIndex = this.getIndexFromPlaceholderWitness(request);
9344
9359
  if (placeholderIndex !== -1) {
9345
9360
  request.removeWitness(placeholderIndex);
9346
9361
  }
9347
9362
  request.inputs.filter(isRequestInputResource).forEach((input) => {
9348
9363
  if (isRequestInputResourceFromOwner(input, this.address)) {
9349
- input.predicate = (0, import_utils37.hexlify)(this.bytes);
9350
- input.predicateData = (0, import_utils37.hexlify)(this.getPredicateData());
9364
+ input.predicate = (0, import_utils38.hexlify)(this.bytes);
9365
+ input.predicateData = (0, import_utils38.hexlify)(this.getPredicateData(policies.length));
9351
9366
  input.witnessIndex = 0;
9352
9367
  }
9353
9368
  });
@@ -9373,12 +9388,17 @@ var Predicate = class extends Account {
9373
9388
  const transactionRequest = transactionRequestify(transactionRequestLike);
9374
9389
  return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
9375
9390
  }
9376
- getPredicateData() {
9391
+ getPredicateData(policiesLength) {
9377
9392
  if (!this.predicateData.length) {
9378
9393
  return new Uint8Array();
9379
9394
  }
9380
9395
  const mainFn = this.interface?.functions.main;
9381
- return mainFn?.encodeArguments(this.predicateData) || new Uint8Array();
9396
+ const paddedCode = new import_transactions22.ByteArrayCoder(this.bytes.length).encode(this.bytes);
9397
+ const VM_TX_MEMORY = (0, import_abi_coder7.calculateVmTxMemory)({
9398
+ maxInputs: this.provider.getChain().consensusParameters.txParameters.maxInputs.toNumber()
9399
+ });
9400
+ const OFFSET = VM_TX_MEMORY + import_abi_coder7.SCRIPT_FIXED_SIZE + import_abi_coder7.INPUT_COIN_FIXED_SIZE + import_abi_coder7.WORD_SIZE + paddedCode.byteLength + policiesLength * import_abi_coder7.WORD_SIZE;
9401
+ return mainFn?.encodeArguments(this.predicateData, OFFSET) || new Uint8Array();
9382
9402
  }
9383
9403
  /**
9384
9404
  * Processes the predicate data and returns the altered bytecode and interface.
@@ -9389,7 +9409,7 @@ var Predicate = class extends Account {
9389
9409
  * @returns An object containing the new predicate bytes and interface.
9390
9410
  */
9391
9411
  static processPredicateData(bytes, jsonAbi, configurableConstants) {
9392
- let predicateBytes = (0, import_utils37.arrayify)(bytes);
9412
+ let predicateBytes = (0, import_utils38.arrayify)(bytes);
9393
9413
  let abiInterface;
9394
9414
  if (jsonAbi) {
9395
9415
  abiInterface = new import_abi_coder7.Interface(jsonAbi);
@@ -9427,7 +9447,8 @@ var Predicate = class extends Account {
9427
9447
  );
9428
9448
  return resources.map((resource) => ({
9429
9449
  ...resource,
9430
- predicate: (0, import_utils37.hexlify)(this.bytes)
9450
+ predicate: (0, import_utils38.hexlify)(this.bytes),
9451
+ padPredicateData: (policiesLength) => (0, import_utils38.hexlify)(this.getPredicateData(policiesLength))
9431
9452
  }));
9432
9453
  }
9433
9454
  /**
@@ -10292,7 +10313,6 @@ __publicField(Fuel, "defaultConfig", {});
10292
10313
  resolveGasDependentCosts,
10293
10314
  resolveIconPaths,
10294
10315
  returnZeroScript,
10295
- sleep,
10296
10316
  transactionRequestify,
10297
10317
  urlJoin,
10298
10318
  withTimeout,