@fuel-ts/account 0.0.0-rc-2238-20240514123903 → 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.mjs CHANGED
@@ -31,7 +31,7 @@ var __privateMethod = (obj, member, method) => {
31
31
  import { Address as Address3 } from "@fuel-ts/address";
32
32
  import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
33
33
  import { AbstractAccount } from "@fuel-ts/interfaces";
34
- import { bn as bn19 } from "@fuel-ts/math";
34
+ import { bn as bn20 } from "@fuel-ts/math";
35
35
  import { arrayify as arrayify14, isDefined as isDefined2 } from "@fuel-ts/utils";
36
36
  import { clone as clone4 } from "ramda";
37
37
 
@@ -73,7 +73,7 @@ var addAmountToCoinQuantities = (params) => {
73
73
  // src/providers/provider.ts
74
74
  import { Address as Address2 } from "@fuel-ts/address";
75
75
  import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
76
- import { BN, bn as bn17 } from "@fuel-ts/math";
76
+ import { BN, bn as bn18 } from "@fuel-ts/math";
77
77
  import {
78
78
  InputType as InputType7,
79
79
  TransactionType as TransactionType8,
@@ -1712,15 +1712,6 @@ function normalizeJSON(root) {
1712
1712
  return normalize(clone(root));
1713
1713
  }
1714
1714
 
1715
- // src/providers/utils/sleep.ts
1716
- function sleep(time) {
1717
- return new Promise((resolve) => {
1718
- setTimeout(() => {
1719
- resolve(true);
1720
- }, time);
1721
- });
1722
- }
1723
-
1724
1715
  // src/providers/utils/extract-tx-error.ts
1725
1716
  import { ErrorCode as ErrorCode7, FuelError as FuelError7 } from "@fuel-ts/errors";
1726
1717
  import { bn as bn6 } from "@fuel-ts/math";
@@ -2377,6 +2368,15 @@ var BaseTransactionRequest = class {
2377
2368
  }
2378
2369
  });
2379
2370
  }
2371
+ shiftPredicateData() {
2372
+ this.inputs.forEach((input) => {
2373
+ if ("predicateData" in input && "padPredicateData" in input && typeof input.padPredicateData === "function") {
2374
+ input.predicateData = input.padPredicateData(
2375
+ BaseTransactionRequest.getPolicyMeta(this).policies.length
2376
+ );
2377
+ }
2378
+ });
2379
+ }
2380
2380
  };
2381
2381
 
2382
2382
  // src/providers/transaction-request/create-transaction-request.ts
@@ -2799,12 +2799,12 @@ var transactionRequestify = (obj) => {
2799
2799
 
2800
2800
  // src/providers/transaction-response/transaction-response.ts
2801
2801
  import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
2802
- import { bn as bn16 } from "@fuel-ts/math";
2802
+ import { bn as bn17 } from "@fuel-ts/math";
2803
2803
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2804
2804
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
2805
2805
 
2806
2806
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2807
- import { bn as bn15 } from "@fuel-ts/math";
2807
+ import { bn as bn16 } from "@fuel-ts/math";
2808
2808
  import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
2809
2809
  import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2810
2810
 
@@ -2881,32 +2881,43 @@ var calculateTXFeeForSummary = (params) => {
2881
2881
  // src/providers/transaction-summary/operations.ts
2882
2882
  import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
2883
2883
  import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
2884
- import { bn as bn13 } from "@fuel-ts/math";
2884
+ import { bn as bn14 } from "@fuel-ts/math";
2885
2885
  import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
2886
2886
 
2887
2887
  // src/providers/transaction-summary/call.ts
2888
- import { Interface as Interface2 } from "@fuel-ts/abi-coder";
2889
- var getFunctionCall = ({ abi, receipt }) => {
2888
+ import { Interface as Interface2, calculateVmTxMemory } from "@fuel-ts/abi-coder";
2889
+ import { bn as bn13 } from "@fuel-ts/math";
2890
+ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2890
2891
  const abiInterface = new Interface2(abi);
2891
2892
  const callFunctionSelector = receipt.param1.toHex(8);
2892
2893
  const functionFragment = abiInterface.getFunction(callFunctionSelector);
2893
2894
  const inputs = functionFragment.jsonFn.inputs;
2894
- const encodedArgs = receipt.param2.toHex();
2895
+ let encodedArgs;
2896
+ if (functionFragment.isInputDataPointer) {
2897
+ if (rawPayload) {
2898
+ const argsOffset = bn13(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2899
+ encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2900
+ }
2901
+ } else {
2902
+ encodedArgs = receipt.param2.toHex();
2903
+ }
2895
2904
  let argumentsProvided;
2896
- const data = functionFragment.decodeArguments(encodedArgs);
2897
- if (data) {
2898
- argumentsProvided = inputs.reduce((prev, input, index) => {
2899
- const value = data[index];
2900
- const name = input.name;
2901
- if (name) {
2902
- return {
2903
- ...prev,
2904
- // reparse to remove bn
2905
- [name]: JSON.parse(JSON.stringify(value))
2906
- };
2907
- }
2908
- return prev;
2909
- }, {});
2905
+ if (encodedArgs) {
2906
+ const data = functionFragment.decodeArguments(encodedArgs);
2907
+ if (data) {
2908
+ argumentsProvided = inputs.reduce((prev, input, index) => {
2909
+ const value = data[index];
2910
+ const name = input.name;
2911
+ if (name) {
2912
+ return {
2913
+ ...prev,
2914
+ // reparse to remove bn
2915
+ [name]: JSON.parse(JSON.stringify(value))
2916
+ };
2917
+ }
2918
+ return prev;
2919
+ }, {});
2920
+ }
2910
2921
  }
2911
2922
  const call = {
2912
2923
  functionSignature: functionFragment.signature,
@@ -3092,7 +3103,7 @@ var mergeAssets = (op1, op2) => {
3092
3103
  if (!matchingAsset) {
3093
3104
  return asset1;
3094
3105
  }
3095
- const mergedAmount = bn13(asset1.amount).add(matchingAsset.amount);
3106
+ const mergedAmount = bn14(asset1.amount).add(matchingAsset.amount);
3096
3107
  return { ...asset1, amount: mergedAmount };
3097
3108
  });
3098
3109
  return mergedAssets.concat(filteredAssets);
@@ -3418,7 +3429,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3418
3429
 
3419
3430
  // src/providers/transaction-summary/status.ts
3420
3431
  import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
3421
- import { bn as bn14 } from "@fuel-ts/math";
3432
+ import { bn as bn15 } from "@fuel-ts/math";
3422
3433
  var getTransactionStatusName = (gqlStatus) => {
3423
3434
  switch (gqlStatus) {
3424
3435
  case "FailureStatus":
@@ -3452,15 +3463,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3452
3463
  time = gqlTransactionStatus.time;
3453
3464
  blockId = gqlTransactionStatus.block.id;
3454
3465
  isStatusSuccess = true;
3455
- totalFee = bn14(gqlTransactionStatus.totalFee);
3456
- totalGas = bn14(gqlTransactionStatus.totalGas);
3466
+ totalFee = bn15(gqlTransactionStatus.totalFee);
3467
+ totalGas = bn15(gqlTransactionStatus.totalGas);
3457
3468
  break;
3458
3469
  case "FailureStatus":
3459
3470
  time = gqlTransactionStatus.time;
3460
3471
  blockId = gqlTransactionStatus.block.id;
3461
3472
  isStatusFailure = true;
3462
- totalFee = bn14(gqlTransactionStatus.totalFee);
3463
- totalGas = bn14(gqlTransactionStatus.totalGas);
3473
+ totalFee = bn15(gqlTransactionStatus.totalFee);
3474
+ totalGas = bn15(gqlTransactionStatus.totalGas);
3464
3475
  break;
3465
3476
  case "SubmittedStatus":
3466
3477
  time = gqlTransactionStatus.time;
@@ -3510,7 +3521,7 @@ function assembleTransactionSummary(params) {
3510
3521
  maxInputs
3511
3522
  });
3512
3523
  const typeName = getTransactionTypeName(transaction.type);
3513
- const tip = bn15(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3524
+ const tip = bn16(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3514
3525
  const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3515
3526
  const fee = calculateTXFeeForSummary({
3516
3527
  totalFee,
@@ -3581,7 +3592,7 @@ var TransactionResponse = class {
3581
3592
  /** Current provider */
3582
3593
  provider;
3583
3594
  /** Gas used on the transaction */
3584
- gasUsed = bn16(0);
3595
+ gasUsed = bn17(0);
3585
3596
  /** The graphql Transaction with receipts object. */
3586
3597
  gqlTransaction;
3587
3598
  abis;
@@ -3749,6 +3760,7 @@ var TransactionResponse = class {
3749
3760
  };
3750
3761
 
3751
3762
  // src/providers/utils/auto-retry-fetch.ts
3763
+ import { sleep } from "@fuel-ts/utils";
3752
3764
  function getWaitDelay(options, retryAttemptNum) {
3753
3765
  const duration = options.baseDelay ?? 150;
3754
3766
  switch (options.backoff) {
@@ -3815,47 +3827,47 @@ var processGqlChain = (chain) => {
3815
3827
  } = consensusParameters;
3816
3828
  return {
3817
3829
  name,
3818
- baseChainHeight: bn17(daHeight),
3830
+ baseChainHeight: bn18(daHeight),
3819
3831
  consensusParameters: {
3820
3832
  version,
3821
- chainId: bn17(chainId),
3833
+ chainId: bn18(chainId),
3822
3834
  baseAssetId,
3823
3835
  feeParameters: {
3824
3836
  version: feeParams.version,
3825
- gasPerByte: bn17(feeParams.gasPerByte),
3826
- gasPriceFactor: bn17(feeParams.gasPriceFactor)
3837
+ gasPerByte: bn18(feeParams.gasPerByte),
3838
+ gasPriceFactor: bn18(feeParams.gasPriceFactor)
3827
3839
  },
3828
3840
  contractParameters: {
3829
3841
  version: contractParams.version,
3830
- contractMaxSize: bn17(contractParams.contractMaxSize),
3831
- maxStorageSlots: bn17(contractParams.maxStorageSlots)
3842
+ contractMaxSize: bn18(contractParams.contractMaxSize),
3843
+ maxStorageSlots: bn18(contractParams.maxStorageSlots)
3832
3844
  },
3833
3845
  txParameters: {
3834
3846
  version: txParams.version,
3835
- maxInputs: bn17(txParams.maxInputs),
3836
- maxOutputs: bn17(txParams.maxOutputs),
3837
- maxWitnesses: bn17(txParams.maxWitnesses),
3838
- maxGasPerTx: bn17(txParams.maxGasPerTx),
3839
- maxSize: bn17(txParams.maxSize),
3840
- maxBytecodeSubsections: bn17(txParams.maxBytecodeSubsections)
3847
+ maxInputs: bn18(txParams.maxInputs),
3848
+ maxOutputs: bn18(txParams.maxOutputs),
3849
+ maxWitnesses: bn18(txParams.maxWitnesses),
3850
+ maxGasPerTx: bn18(txParams.maxGasPerTx),
3851
+ maxSize: bn18(txParams.maxSize),
3852
+ maxBytecodeSubsections: bn18(txParams.maxBytecodeSubsections)
3841
3853
  },
3842
3854
  predicateParameters: {
3843
3855
  version: predicateParams.version,
3844
- maxPredicateLength: bn17(predicateParams.maxPredicateLength),
3845
- maxPredicateDataLength: bn17(predicateParams.maxPredicateDataLength),
3846
- maxGasPerPredicate: bn17(predicateParams.maxGasPerPredicate),
3847
- maxMessageDataLength: bn17(predicateParams.maxMessageDataLength)
3856
+ maxPredicateLength: bn18(predicateParams.maxPredicateLength),
3857
+ maxPredicateDataLength: bn18(predicateParams.maxPredicateDataLength),
3858
+ maxGasPerPredicate: bn18(predicateParams.maxGasPerPredicate),
3859
+ maxMessageDataLength: bn18(predicateParams.maxMessageDataLength)
3848
3860
  },
3849
3861
  scriptParameters: {
3850
3862
  version: scriptParams.version,
3851
- maxScriptLength: bn17(scriptParams.maxScriptLength),
3852
- maxScriptDataLength: bn17(scriptParams.maxScriptDataLength)
3863
+ maxScriptLength: bn18(scriptParams.maxScriptLength),
3864
+ maxScriptDataLength: bn18(scriptParams.maxScriptDataLength)
3853
3865
  },
3854
3866
  gasCosts
3855
3867
  },
3856
3868
  latestBlock: {
3857
3869
  id: latestBlock.id,
3858
- height: bn17(latestBlock.height),
3870
+ height: bn18(latestBlock.height),
3859
3871
  time: latestBlock.header.time,
3860
3872
  transactions: latestBlock.transactions.map((i) => ({
3861
3873
  id: i.id
@@ -4051,7 +4063,7 @@ Supported fuel-core version: ${supportedVersion}.`
4051
4063
  */
4052
4064
  async getBlockNumber() {
4053
4065
  const { chain } = await this.operations.getChain();
4054
- return bn17(chain.latestBlock.height, 10);
4066
+ return bn18(chain.latestBlock.height, 10);
4055
4067
  }
4056
4068
  /**
4057
4069
  * Returns the chain information.
@@ -4061,8 +4073,8 @@ Supported fuel-core version: ${supportedVersion}.`
4061
4073
  async fetchNode() {
4062
4074
  const { nodeInfo } = await this.operations.getNodeInfo();
4063
4075
  const processedNodeInfo = {
4064
- maxDepth: bn17(nodeInfo.maxDepth),
4065
- maxTx: bn17(nodeInfo.maxTx),
4076
+ maxDepth: bn18(nodeInfo.maxDepth),
4077
+ maxTx: bn18(nodeInfo.maxTx),
4066
4078
  nodeVersion: nodeInfo.nodeVersion,
4067
4079
  utxoValidation: nodeInfo.utxoValidation,
4068
4080
  vmBacktrace: nodeInfo.vmBacktrace
@@ -4194,7 +4206,7 @@ Supported fuel-core version: ${supportedVersion}.`
4194
4206
  } = response;
4195
4207
  if (inputs) {
4196
4208
  inputs.forEach((input, index) => {
4197
- if ("predicateGasUsed" in input && bn17(input.predicateGasUsed).gt(0)) {
4209
+ if ("predicateGasUsed" in input && bn18(input.predicateGasUsed).gt(0)) {
4198
4210
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
4199
4211
  }
4200
4212
  });
@@ -4352,12 +4364,12 @@ Supported fuel-core version: ${supportedVersion}.`
4352
4364
  gasPrice = await this.estimateGasPrice(10);
4353
4365
  }
4354
4366
  const minFee = calculateGasFee({
4355
- gasPrice: bn17(gasPrice),
4367
+ gasPrice: bn18(gasPrice),
4356
4368
  gas: minGas,
4357
4369
  priceFactor: gasPriceFactor,
4358
4370
  tip: transactionRequest.tip
4359
4371
  }).add(1);
4360
- let gasLimit = bn17(0);
4372
+ let gasLimit = bn18(0);
4361
4373
  if (transactionRequest.type === TransactionType8.Script) {
4362
4374
  gasLimit = transactionRequest.gasLimit;
4363
4375
  if (transactionRequest.gasLimit.eq(0)) {
@@ -4370,7 +4382,7 @@ Supported fuel-core version: ${supportedVersion}.`
4370
4382
  }
4371
4383
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4372
4384
  const maxFee = calculateGasFee({
4373
- gasPrice: bn17(gasPrice),
4385
+ gasPrice: bn18(gasPrice),
4374
4386
  gas: maxGas,
4375
4387
  priceFactor: gasPriceFactor,
4376
4388
  tip: transactionRequest.tip
@@ -4435,7 +4447,7 @@ Supported fuel-core version: ${supportedVersion}.`
4435
4447
  const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
4436
4448
  txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
4437
4449
  if (isScriptTransaction) {
4438
- txRequestClone.gasLimit = bn17(0);
4450
+ txRequestClone.gasLimit = bn18(0);
4439
4451
  }
4440
4452
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4441
4453
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -4456,7 +4468,7 @@ Supported fuel-core version: ${supportedVersion}.`
4456
4468
  let dryRunStatus;
4457
4469
  let missingContractIds = [];
4458
4470
  let outputVariables = 0;
4459
- let gasUsed = bn17(0);
4471
+ let gasUsed = bn18(0);
4460
4472
  txRequestClone.maxFee = maxFee;
4461
4473
  if (isScriptTransaction) {
4462
4474
  txRequestClone.gasLimit = gasLimit;
@@ -4521,10 +4533,10 @@ Supported fuel-core version: ${supportedVersion}.`
4521
4533
  return coins.map((coin) => ({
4522
4534
  id: coin.utxoId,
4523
4535
  assetId: coin.assetId,
4524
- amount: bn17(coin.amount),
4536
+ amount: bn18(coin.amount),
4525
4537
  owner: Address2.fromAddressOrString(coin.owner),
4526
- blockCreated: bn17(coin.blockCreated),
4527
- txCreatedIdx: bn17(coin.txCreatedIdx)
4538
+ blockCreated: bn18(coin.blockCreated),
4539
+ txCreatedIdx: bn18(coin.txCreatedIdx)
4528
4540
  }));
4529
4541
  }
4530
4542
  /**
@@ -4561,9 +4573,9 @@ Supported fuel-core version: ${supportedVersion}.`
4561
4573
  switch (coin.type) {
4562
4574
  case "MessageCoin":
4563
4575
  return {
4564
- amount: bn17(coin.amount),
4576
+ amount: bn18(coin.amount),
4565
4577
  assetId: coin.assetId,
4566
- daHeight: bn17(coin.daHeight),
4578
+ daHeight: bn18(coin.daHeight),
4567
4579
  sender: Address2.fromAddressOrString(coin.sender),
4568
4580
  recipient: Address2.fromAddressOrString(coin.recipient),
4569
4581
  nonce: coin.nonce
@@ -4571,11 +4583,11 @@ Supported fuel-core version: ${supportedVersion}.`
4571
4583
  case "Coin":
4572
4584
  return {
4573
4585
  id: coin.utxoId,
4574
- amount: bn17(coin.amount),
4586
+ amount: bn18(coin.amount),
4575
4587
  assetId: coin.assetId,
4576
4588
  owner: Address2.fromAddressOrString(coin.owner),
4577
- blockCreated: bn17(coin.blockCreated),
4578
- txCreatedIdx: bn17(coin.txCreatedIdx)
4589
+ blockCreated: bn18(coin.blockCreated),
4590
+ txCreatedIdx: bn18(coin.txCreatedIdx)
4579
4591
  };
4580
4592
  default:
4581
4593
  return null;
@@ -4592,13 +4604,13 @@ Supported fuel-core version: ${supportedVersion}.`
4592
4604
  async getBlock(idOrHeight) {
4593
4605
  let variables;
4594
4606
  if (typeof idOrHeight === "number") {
4595
- variables = { height: bn17(idOrHeight).toString(10) };
4607
+ variables = { height: bn18(idOrHeight).toString(10) };
4596
4608
  } else if (idOrHeight === "latest") {
4597
4609
  variables = { height: (await this.getBlockNumber()).toString(10) };
4598
4610
  } else if (idOrHeight.length === 66) {
4599
4611
  variables = { blockId: idOrHeight };
4600
4612
  } else {
4601
- variables = { blockId: bn17(idOrHeight).toString(10) };
4613
+ variables = { blockId: bn18(idOrHeight).toString(10) };
4602
4614
  }
4603
4615
  const { block } = await this.operations.getBlock(variables);
4604
4616
  if (!block) {
@@ -4606,7 +4618,7 @@ Supported fuel-core version: ${supportedVersion}.`
4606
4618
  }
4607
4619
  return {
4608
4620
  id: block.id,
4609
- height: bn17(block.height),
4621
+ height: bn18(block.height),
4610
4622
  time: block.header.time,
4611
4623
  transactionIds: block.transactions.map((tx) => tx.id)
4612
4624
  };
@@ -4621,7 +4633,7 @@ Supported fuel-core version: ${supportedVersion}.`
4621
4633
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4622
4634
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4623
4635
  id: block.id,
4624
- height: bn17(block.height),
4636
+ height: bn18(block.height),
4625
4637
  time: block.header.time,
4626
4638
  transactionIds: block.transactions.map((tx) => tx.id)
4627
4639
  }));
@@ -4636,7 +4648,7 @@ Supported fuel-core version: ${supportedVersion}.`
4636
4648
  async getBlockWithTransactions(idOrHeight) {
4637
4649
  let variables;
4638
4650
  if (typeof idOrHeight === "number") {
4639
- variables = { blockHeight: bn17(idOrHeight).toString(10) };
4651
+ variables = { blockHeight: bn18(idOrHeight).toString(10) };
4640
4652
  } else if (idOrHeight === "latest") {
4641
4653
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4642
4654
  } else {
@@ -4648,7 +4660,7 @@ Supported fuel-core version: ${supportedVersion}.`
4648
4660
  }
4649
4661
  return {
4650
4662
  id: block.id,
4651
- height: bn17(block.height, 10),
4663
+ height: bn18(block.height, 10),
4652
4664
  time: block.header.time,
4653
4665
  transactionIds: block.transactions.map((tx) => tx.id),
4654
4666
  transactions: block.transactions.map(
@@ -4697,7 +4709,7 @@ Supported fuel-core version: ${supportedVersion}.`
4697
4709
  contract: Address2.fromAddressOrString(contractId).toB256(),
4698
4710
  asset: hexlify12(assetId)
4699
4711
  });
4700
- return bn17(contractBalance.amount, 10);
4712
+ return bn18(contractBalance.amount, 10);
4701
4713
  }
4702
4714
  /**
4703
4715
  * Returns the balance for the given owner for the given asset ID.
@@ -4711,7 +4723,7 @@ Supported fuel-core version: ${supportedVersion}.`
4711
4723
  owner: Address2.fromAddressOrString(owner).toB256(),
4712
4724
  assetId: hexlify12(assetId)
4713
4725
  });
4714
- return bn17(balance.amount, 10);
4726
+ return bn18(balance.amount, 10);
4715
4727
  }
4716
4728
  /**
4717
4729
  * Returns balances for the given owner.
@@ -4729,7 +4741,7 @@ Supported fuel-core version: ${supportedVersion}.`
4729
4741
  const balances = result.balances.edges.map((edge) => edge.node);
4730
4742
  return balances.map((balance) => ({
4731
4743
  assetId: balance.assetId,
4732
- amount: bn17(balance.amount)
4744
+ amount: bn18(balance.amount)
4733
4745
  }));
4734
4746
  }
4735
4747
  /**
@@ -4751,15 +4763,15 @@ Supported fuel-core version: ${supportedVersion}.`
4751
4763
  sender: message.sender,
4752
4764
  recipient: message.recipient,
4753
4765
  nonce: message.nonce,
4754
- amount: bn17(message.amount),
4766
+ amount: bn18(message.amount),
4755
4767
  data: message.data
4756
4768
  }),
4757
4769
  sender: Address2.fromAddressOrString(message.sender),
4758
4770
  recipient: Address2.fromAddressOrString(message.recipient),
4759
4771
  nonce: message.nonce,
4760
- amount: bn17(message.amount),
4772
+ amount: bn18(message.amount),
4761
4773
  data: InputMessageCoder.decodeData(message.data),
4762
- daHeight: bn17(message.daHeight)
4774
+ daHeight: bn18(message.daHeight)
4763
4775
  }));
4764
4776
  }
4765
4777
  /**
@@ -4812,19 +4824,19 @@ Supported fuel-core version: ${supportedVersion}.`
4812
4824
  } = result.messageProof;
4813
4825
  return {
4814
4826
  messageProof: {
4815
- proofIndex: bn17(messageProof.proofIndex),
4827
+ proofIndex: bn18(messageProof.proofIndex),
4816
4828
  proofSet: messageProof.proofSet
4817
4829
  },
4818
4830
  blockProof: {
4819
- proofIndex: bn17(blockProof.proofIndex),
4831
+ proofIndex: bn18(blockProof.proofIndex),
4820
4832
  proofSet: blockProof.proofSet
4821
4833
  },
4822
4834
  messageBlockHeader: {
4823
4835
  id: messageBlockHeader.id,
4824
- daHeight: bn17(messageBlockHeader.daHeight),
4836
+ daHeight: bn18(messageBlockHeader.daHeight),
4825
4837
  transactionsCount: Number(messageBlockHeader.transactionsCount),
4826
4838
  transactionsRoot: messageBlockHeader.transactionsRoot,
4827
- height: bn17(messageBlockHeader.height),
4839
+ height: bn18(messageBlockHeader.height),
4828
4840
  prevRoot: messageBlockHeader.prevRoot,
4829
4841
  time: messageBlockHeader.time,
4830
4842
  applicationHash: messageBlockHeader.applicationHash,
@@ -4836,10 +4848,10 @@ Supported fuel-core version: ${supportedVersion}.`
4836
4848
  },
4837
4849
  commitBlockHeader: {
4838
4850
  id: commitBlockHeader.id,
4839
- daHeight: bn17(commitBlockHeader.daHeight),
4851
+ daHeight: bn18(commitBlockHeader.daHeight),
4840
4852
  transactionsCount: Number(commitBlockHeader.transactionsCount),
4841
4853
  transactionsRoot: commitBlockHeader.transactionsRoot,
4842
- height: bn17(commitBlockHeader.height),
4854
+ height: bn18(commitBlockHeader.height),
4843
4855
  prevRoot: commitBlockHeader.prevRoot,
4844
4856
  time: commitBlockHeader.time,
4845
4857
  applicationHash: commitBlockHeader.applicationHash,
@@ -4852,19 +4864,19 @@ Supported fuel-core version: ${supportedVersion}.`
4852
4864
  sender: Address2.fromAddressOrString(sender),
4853
4865
  recipient: Address2.fromAddressOrString(recipient),
4854
4866
  nonce,
4855
- amount: bn17(amount),
4867
+ amount: bn18(amount),
4856
4868
  data
4857
4869
  };
4858
4870
  }
4859
4871
  async getLatestGasPrice() {
4860
4872
  const { latestGasPrice } = await this.operations.getLatestGasPrice();
4861
- return bn17(latestGasPrice.gasPrice);
4873
+ return bn18(latestGasPrice.gasPrice);
4862
4874
  }
4863
4875
  async estimateGasPrice(blockHorizon) {
4864
4876
  const { estimateGasPrice } = await this.operations.estimateGasPrice({
4865
4877
  blockHorizon: String(blockHorizon)
4866
4878
  });
4867
- return bn17(estimateGasPrice.gasPrice);
4879
+ return bn18(estimateGasPrice.gasPrice);
4868
4880
  }
4869
4881
  /**
4870
4882
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
@@ -4885,10 +4897,10 @@ Supported fuel-core version: ${supportedVersion}.`
4885
4897
  */
4886
4898
  async produceBlocks(amount, startTime) {
4887
4899
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4888
- blocksToProduce: bn17(amount).toString(10),
4900
+ blocksToProduce: bn18(amount).toString(10),
4889
4901
  startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4890
4902
  });
4891
- return bn17(latestBlockHeight);
4903
+ return bn18(latestBlockHeight);
4892
4904
  }
4893
4905
  // eslint-disable-next-line @typescript-eslint/require-await
4894
4906
  async getTransactionResponse(transactionId) {
@@ -4934,7 +4946,7 @@ __publicField(Provider, "nodeInfoCache", {});
4934
4946
 
4935
4947
  // src/providers/transaction-summary/get-transaction-summary.ts
4936
4948
  import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
4937
- import { bn as bn18 } from "@fuel-ts/math";
4949
+ import { bn as bn19 } from "@fuel-ts/math";
4938
4950
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4939
4951
  import { arrayify as arrayify12 } from "@fuel-ts/utils";
4940
4952
  async function getTransactionSummary(params) {
@@ -4971,8 +4983,8 @@ async function getTransactionSummary(params) {
4971
4983
  transaction: decodedTransaction,
4972
4984
  transactionBytes: arrayify12(gqlTransaction.rawPayload),
4973
4985
  gqlTransactionStatus: gqlTransaction.status,
4974
- gasPerByte: bn18(gasPerByte),
4975
- gasPriceFactor: bn18(gasPriceFactor),
4986
+ gasPerByte: bn19(gasPerByte),
4987
+ gasPriceFactor: bn19(gasPriceFactor),
4976
4988
  abiMap,
4977
4989
  maxInputs,
4978
4990
  gasCosts,
@@ -5381,9 +5393,9 @@ var Account = class extends AbstractAccount {
5381
5393
  const { addedSignatures, estimatedPredicates, requiredQuantities, updateMaxFee } = params;
5382
5394
  const fee = request.maxFee;
5383
5395
  const baseAssetId = this.provider.getBaseAssetId();
5384
- const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || bn19(0);
5396
+ const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || bn20(0);
5385
5397
  const requiredQuantitiesWithFee = addAmountToCoinQuantities({
5386
- amount: bn19(fee),
5398
+ amount: bn20(fee),
5387
5399
  assetId: baseAssetId,
5388
5400
  coinQuantities: requiredQuantities
5389
5401
  });
@@ -5391,7 +5403,7 @@ var Account = class extends AbstractAccount {
5391
5403
  requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
5392
5404
  quantitiesDict[assetId] = {
5393
5405
  required: amount,
5394
- owned: bn19(0)
5406
+ owned: bn20(0)
5395
5407
  };
5396
5408
  });
5397
5409
  request.inputs.filter(isRequestInputResource).forEach((input) => {
@@ -5418,6 +5430,7 @@ var Account = class extends AbstractAccount {
5418
5430
  cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
5419
5431
  );
5420
5432
  request.addResources(resources);
5433
+ request.shiftPredicateData();
5421
5434
  request.updatePredicateGasUsed(estimatedPredicates);
5422
5435
  const requestToReestimate2 = clone4(request);
5423
5436
  if (addedSignatures) {
@@ -5449,6 +5462,7 @@ var Account = class extends AbstractAccount {
5449
5462
  }
5450
5463
  fundingAttempts += 1;
5451
5464
  }
5465
+ request.shiftPredicateData();
5452
5466
  request.updatePredicateGasUsed(estimatedPredicates);
5453
5467
  const requestToReestimate = clone4(request);
5454
5468
  if (addedSignatures) {
@@ -5499,7 +5513,7 @@ var Account = class extends AbstractAccount {
5499
5513
  * @returns A promise that resolves to the transaction response.
5500
5514
  */
5501
5515
  async transfer(destination, amount, assetId, txParams = {}) {
5502
- if (bn19(amount).lte(0)) {
5516
+ if (bn20(amount).lte(0)) {
5503
5517
  throw new FuelError15(
5504
5518
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5505
5519
  "Transfer amount must be a positive number."
@@ -5519,7 +5533,7 @@ var Account = class extends AbstractAccount {
5519
5533
  * @returns A promise that resolves to the transaction response.
5520
5534
  */
5521
5535
  async transferToContract(contractId, amount, assetId, txParams = {}) {
5522
- if (bn19(amount).lte(0)) {
5536
+ if (bn20(amount).lte(0)) {
5523
5537
  throw new FuelError15(
5524
5538
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5525
5539
  "Transfer amount must be a positive number."
@@ -5529,7 +5543,7 @@ var Account = class extends AbstractAccount {
5529
5543
  const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5530
5544
  const { script, scriptData } = await assembleTransferToContractScript({
5531
5545
  hexlifiedContractId: contractAddress.toB256(),
5532
- amountToTransfer: bn19(amount),
5546
+ amountToTransfer: bn20(amount),
5533
5547
  assetId: assetIdToTransfer
5534
5548
  });
5535
5549
  let request = new ScriptTransactionRequest({
@@ -5540,7 +5554,7 @@ var Account = class extends AbstractAccount {
5540
5554
  request.addContractInputAndOutput(contractAddress);
5541
5555
  const txCost = await this.provider.getTransactionCost(request, {
5542
5556
  resourcesOwner: this,
5543
- quantitiesToContract: [{ amount: bn19(amount), assetId: String(assetIdToTransfer) }]
5557
+ quantitiesToContract: [{ amount: bn20(amount), assetId: String(assetIdToTransfer) }]
5544
5558
  });
5545
5559
  request = this.validateGasLimitAndMaxFee({
5546
5560
  transactionRequest: request,
@@ -5565,7 +5579,7 @@ var Account = class extends AbstractAccount {
5565
5579
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5566
5580
  );
5567
5581
  const amountDataArray = arrayify14(
5568
- "0x".concat(bn19(amount).toHex().substring(2).padStart(16, "0"))
5582
+ "0x".concat(bn20(amount).toHex().substring(2).padStart(16, "0"))
5569
5583
  );
5570
5584
  const script = new Uint8Array([
5571
5585
  ...arrayify14(withdrawScript.bytes),
@@ -5575,7 +5589,7 @@ var Account = class extends AbstractAccount {
5575
5589
  const params = { script, ...txParams };
5576
5590
  const baseAssetId = this.provider.getBaseAssetId();
5577
5591
  let request = new ScriptTransactionRequest(params);
5578
- const quantitiesToContract = [{ amount: bn19(amount), assetId: baseAssetId }];
5592
+ const quantitiesToContract = [{ amount: bn20(amount), assetId: baseAssetId }];
5579
5593
  const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
5580
5594
  request = this.validateGasLimitAndMaxFee({
5581
5595
  transactionRequest: request,
@@ -5996,7 +6010,7 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5996
6010
  import { computeHmac as computeHmac2, ripemd160 } from "@fuel-ts/crypto";
5997
6011
  import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
5998
6012
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
5999
- import { bn as bn20, toBytes as toBytes2, toHex } from "@fuel-ts/math";
6013
+ import { bn as bn21, toBytes as toBytes2, toHex } from "@fuel-ts/math";
6000
6014
  import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
6001
6015
 
6002
6016
  // src/mnemonic/mnemonic.ts
@@ -8466,7 +8480,7 @@ var HDWallet = class {
8466
8480
  const IR = bytes.slice(32);
8467
8481
  if (privateKey) {
8468
8482
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
8469
- const ki = bn20(IL).add(privateKey).mod(N).toBytes(32);
8483
+ const ki = bn21(IL).add(privateKey).mod(N).toBytes(32);
8470
8484
  return new HDWallet({
8471
8485
  privateKey: ki,
8472
8486
  chainCode: IR,
@@ -9145,9 +9159,16 @@ var StorageAbstract = class {
9145
9159
  };
9146
9160
 
9147
9161
  // src/predicate/predicate.ts
9148
- import { Interface as Interface4 } from "@fuel-ts/abi-coder";
9162
+ import {
9163
+ Interface as Interface4,
9164
+ INPUT_COIN_FIXED_SIZE,
9165
+ WORD_SIZE,
9166
+ calculateVmTxMemory as calculateVmTxMemory2,
9167
+ SCRIPT_FIXED_SIZE
9168
+ } from "@fuel-ts/abi-coder";
9149
9169
  import { Address as Address9 } from "@fuel-ts/address";
9150
9170
  import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
9171
+ import { ByteArrayCoder } from "@fuel-ts/transactions";
9151
9172
  import { arrayify as arrayify20, hexlify as hexlify19 } from "@fuel-ts/utils";
9152
9173
 
9153
9174
  // src/predicate/utils/getPredicateRoot.ts
@@ -9205,6 +9226,7 @@ var Predicate = class extends Account {
9205
9226
  */
9206
9227
  populateTransactionPredicateData(transactionRequestLike) {
9207
9228
  const request = transactionRequestify(transactionRequestLike);
9229
+ const { policies } = BaseTransactionRequest.getPolicyMeta(request);
9208
9230
  const placeholderIndex = this.getIndexFromPlaceholderWitness(request);
9209
9231
  if (placeholderIndex !== -1) {
9210
9232
  request.removeWitness(placeholderIndex);
@@ -9212,7 +9234,7 @@ var Predicate = class extends Account {
9212
9234
  request.inputs.filter(isRequestInputResource).forEach((input) => {
9213
9235
  if (isRequestInputResourceFromOwner(input, this.address)) {
9214
9236
  input.predicate = hexlify19(this.bytes);
9215
- input.predicateData = hexlify19(this.getPredicateData());
9237
+ input.predicateData = hexlify19(this.getPredicateData(policies.length));
9216
9238
  input.witnessIndex = 0;
9217
9239
  }
9218
9240
  });
@@ -9238,12 +9260,17 @@ var Predicate = class extends Account {
9238
9260
  const transactionRequest = transactionRequestify(transactionRequestLike);
9239
9261
  return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
9240
9262
  }
9241
- getPredicateData() {
9263
+ getPredicateData(policiesLength) {
9242
9264
  if (!this.predicateData.length) {
9243
9265
  return new Uint8Array();
9244
9266
  }
9245
9267
  const mainFn = this.interface?.functions.main;
9246
- return mainFn?.encodeArguments(this.predicateData) || new Uint8Array();
9268
+ const paddedCode = new ByteArrayCoder(this.bytes.length).encode(this.bytes);
9269
+ const VM_TX_MEMORY = calculateVmTxMemory2({
9270
+ maxInputs: this.provider.getChain().consensusParameters.txParameters.maxInputs.toNumber()
9271
+ });
9272
+ const OFFSET = VM_TX_MEMORY + SCRIPT_FIXED_SIZE + INPUT_COIN_FIXED_SIZE + WORD_SIZE + paddedCode.byteLength + policiesLength * WORD_SIZE;
9273
+ return mainFn?.encodeArguments(this.predicateData, OFFSET) || new Uint8Array();
9247
9274
  }
9248
9275
  /**
9249
9276
  * Processes the predicate data and returns the altered bytecode and interface.
@@ -9292,7 +9319,8 @@ var Predicate = class extends Account {
9292
9319
  );
9293
9320
  return resources.map((resource) => ({
9294
9321
  ...resource,
9295
- predicate: hexlify19(this.bytes)
9322
+ predicate: hexlify19(this.bytes),
9323
+ padPredicateData: (policiesLength) => hexlify19(this.getPredicateData(policiesLength))
9296
9324
  }));
9297
9325
  }
9298
9326
  /**
@@ -10156,7 +10184,6 @@ export {
10156
10184
  resolveGasDependentCosts,
10157
10185
  resolveIconPaths,
10158
10186
  returnZeroScript,
10159
- sleep,
10160
10187
  transactionRequestify,
10161
10188
  urlJoin,
10162
10189
  withTimeout,