@fuel-ts/account 0.0.0-rc-2238-20240514192918 → 0.0.0-rc-2143-20240514211533

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.

package/dist/index.js CHANGED
@@ -198,7 +198,7 @@ module.exports = __toCommonJS(src_exports);
198
198
  var import_address4 = require("@fuel-ts/address");
199
199
  var import_errors16 = require("@fuel-ts/errors");
200
200
  var import_interfaces = require("@fuel-ts/interfaces");
201
- var import_math20 = require("@fuel-ts/math");
201
+ var import_math21 = require("@fuel-ts/math");
202
202
  var import_utils28 = require("@fuel-ts/utils");
203
203
  var import_ramda4 = require("ramda");
204
204
 
@@ -240,7 +240,7 @@ var addAmountToCoinQuantities = (params) => {
240
240
  // src/providers/provider.ts
241
241
  var import_address3 = require("@fuel-ts/address");
242
242
  var import_errors14 = require("@fuel-ts/errors");
243
- var import_math17 = require("@fuel-ts/math");
243
+ var import_math18 = require("@fuel-ts/math");
244
244
  var import_transactions20 = require("@fuel-ts/transactions");
245
245
  var import_utils22 = require("@fuel-ts/utils");
246
246
  var import_versions = require("@fuel-ts/versions");
@@ -2520,6 +2520,15 @@ var BaseTransactionRequest = class {
2520
2520
  }
2521
2521
  });
2522
2522
  }
2523
+ shiftPredicateData() {
2524
+ this.inputs.forEach((input) => {
2525
+ if ("predicateData" in input && "padPredicateData" in input && typeof input.padPredicateData === "function") {
2526
+ input.predicateData = input.padPredicateData(
2527
+ BaseTransactionRequest.getPolicyMeta(this).policies.length
2528
+ );
2529
+ }
2530
+ });
2531
+ }
2523
2532
  };
2524
2533
 
2525
2534
  // src/providers/transaction-request/create-transaction-request.ts
@@ -2942,12 +2951,12 @@ var transactionRequestify = (obj) => {
2942
2951
 
2943
2952
  // src/providers/transaction-response/transaction-response.ts
2944
2953
  var import_errors13 = require("@fuel-ts/errors");
2945
- var import_math16 = require("@fuel-ts/math");
2954
+ var import_math17 = require("@fuel-ts/math");
2946
2955
  var import_transactions19 = require("@fuel-ts/transactions");
2947
2956
  var import_utils20 = require("@fuel-ts/utils");
2948
2957
 
2949
2958
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2950
- var import_math15 = require("@fuel-ts/math");
2959
+ var import_math16 = require("@fuel-ts/math");
2951
2960
  var import_transactions17 = require("@fuel-ts/transactions");
2952
2961
  var import_utils18 = require("@fuel-ts/utils");
2953
2962
 
@@ -3024,32 +3033,43 @@ var calculateTXFeeForSummary = (params) => {
3024
3033
  // src/providers/transaction-summary/operations.ts
3025
3034
  var import_configs10 = require("@fuel-ts/address/configs");
3026
3035
  var import_errors11 = require("@fuel-ts/errors");
3027
- var import_math13 = require("@fuel-ts/math");
3036
+ var import_math14 = require("@fuel-ts/math");
3028
3037
  var import_transactions15 = require("@fuel-ts/transactions");
3029
3038
 
3030
3039
  // src/providers/transaction-summary/call.ts
3031
3040
  var import_abi_coder4 = require("@fuel-ts/abi-coder");
3032
- var getFunctionCall = ({ abi, receipt }) => {
3041
+ var import_math13 = require("@fuel-ts/math");
3042
+ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
3033
3043
  const abiInterface = new import_abi_coder4.Interface(abi);
3034
3044
  const callFunctionSelector = receipt.param1.toHex(8);
3035
3045
  const functionFragment = abiInterface.getFunction(callFunctionSelector);
3036
3046
  const inputs = functionFragment.jsonFn.inputs;
3037
- const encodedArgs = receipt.param2.toHex();
3047
+ let encodedArgs;
3048
+ if (functionFragment.isInputDataPointer) {
3049
+ if (rawPayload) {
3050
+ const argsOffset = (0, import_math13.bn)(receipt.param2).sub((0, import_abi_coder4.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
3051
+ encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
3052
+ }
3053
+ } else {
3054
+ encodedArgs = receipt.param2.toHex();
3055
+ }
3038
3056
  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
- }, {});
3057
+ if (encodedArgs) {
3058
+ const data = functionFragment.decodeArguments(encodedArgs);
3059
+ if (data) {
3060
+ argumentsProvided = inputs.reduce((prev, input, index) => {
3061
+ const value = data[index];
3062
+ const name = input.name;
3063
+ if (name) {
3064
+ return {
3065
+ ...prev,
3066
+ // reparse to remove bn
3067
+ [name]: JSON.parse(JSON.stringify(value))
3068
+ };
3069
+ }
3070
+ return prev;
3071
+ }, {});
3072
+ }
3053
3073
  }
3054
3074
  const call = {
3055
3075
  functionSignature: functionFragment.signature,
@@ -3235,7 +3255,7 @@ var mergeAssets = (op1, op2) => {
3235
3255
  if (!matchingAsset) {
3236
3256
  return asset1;
3237
3257
  }
3238
- const mergedAmount = (0, import_math13.bn)(asset1.amount).add(matchingAsset.amount);
3258
+ const mergedAmount = (0, import_math14.bn)(asset1.amount).add(matchingAsset.amount);
3239
3259
  return { ...asset1, amount: mergedAmount };
3240
3260
  });
3241
3261
  return mergedAssets.concat(filteredAssets);
@@ -3561,7 +3581,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3561
3581
 
3562
3582
  // src/providers/transaction-summary/status.ts
3563
3583
  var import_errors12 = require("@fuel-ts/errors");
3564
- var import_math14 = require("@fuel-ts/math");
3584
+ var import_math15 = require("@fuel-ts/math");
3565
3585
  var getTransactionStatusName = (gqlStatus) => {
3566
3586
  switch (gqlStatus) {
3567
3587
  case "FailureStatus":
@@ -3595,15 +3615,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3595
3615
  time = gqlTransactionStatus.time;
3596
3616
  blockId = gqlTransactionStatus.block.id;
3597
3617
  isStatusSuccess = true;
3598
- totalFee = (0, import_math14.bn)(gqlTransactionStatus.totalFee);
3599
- totalGas = (0, import_math14.bn)(gqlTransactionStatus.totalGas);
3618
+ totalFee = (0, import_math15.bn)(gqlTransactionStatus.totalFee);
3619
+ totalGas = (0, import_math15.bn)(gqlTransactionStatus.totalGas);
3600
3620
  break;
3601
3621
  case "FailureStatus":
3602
3622
  time = gqlTransactionStatus.time;
3603
3623
  blockId = gqlTransactionStatus.block.id;
3604
3624
  isStatusFailure = true;
3605
- totalFee = (0, import_math14.bn)(gqlTransactionStatus.totalFee);
3606
- totalGas = (0, import_math14.bn)(gqlTransactionStatus.totalGas);
3625
+ totalFee = (0, import_math15.bn)(gqlTransactionStatus.totalFee);
3626
+ totalGas = (0, import_math15.bn)(gqlTransactionStatus.totalGas);
3607
3627
  break;
3608
3628
  case "SubmittedStatus":
3609
3629
  time = gqlTransactionStatus.time;
@@ -3653,7 +3673,7 @@ function assembleTransactionSummary(params) {
3653
3673
  maxInputs
3654
3674
  });
3655
3675
  const typeName = getTransactionTypeName(transaction.type);
3656
- const tip = (0, import_math15.bn)(transaction.policies?.find((policy) => policy.type === import_transactions17.PolicyType.Tip)?.data);
3676
+ const tip = (0, import_math16.bn)(transaction.policies?.find((policy) => policy.type === import_transactions17.PolicyType.Tip)?.data);
3657
3677
  const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3658
3678
  const fee = calculateTXFeeForSummary({
3659
3679
  totalFee,
@@ -3724,7 +3744,7 @@ var TransactionResponse = class {
3724
3744
  /** Current provider */
3725
3745
  provider;
3726
3746
  /** Gas used on the transaction */
3727
- gasUsed = (0, import_math16.bn)(0);
3747
+ gasUsed = (0, import_math17.bn)(0);
3728
3748
  /** The graphql Transaction with receipts object. */
3729
3749
  gqlTransaction;
3730
3750
  abis;
@@ -3958,47 +3978,47 @@ var processGqlChain = (chain) => {
3958
3978
  } = consensusParameters;
3959
3979
  return {
3960
3980
  name,
3961
- baseChainHeight: (0, import_math17.bn)(daHeight),
3981
+ baseChainHeight: (0, import_math18.bn)(daHeight),
3962
3982
  consensusParameters: {
3963
3983
  version,
3964
- chainId: (0, import_math17.bn)(chainId),
3984
+ chainId: (0, import_math18.bn)(chainId),
3965
3985
  baseAssetId,
3966
3986
  feeParameters: {
3967
3987
  version: feeParams.version,
3968
- gasPerByte: (0, import_math17.bn)(feeParams.gasPerByte),
3969
- gasPriceFactor: (0, import_math17.bn)(feeParams.gasPriceFactor)
3988
+ gasPerByte: (0, import_math18.bn)(feeParams.gasPerByte),
3989
+ gasPriceFactor: (0, import_math18.bn)(feeParams.gasPriceFactor)
3970
3990
  },
3971
3991
  contractParameters: {
3972
3992
  version: contractParams.version,
3973
- contractMaxSize: (0, import_math17.bn)(contractParams.contractMaxSize),
3974
- maxStorageSlots: (0, import_math17.bn)(contractParams.maxStorageSlots)
3993
+ contractMaxSize: (0, import_math18.bn)(contractParams.contractMaxSize),
3994
+ maxStorageSlots: (0, import_math18.bn)(contractParams.maxStorageSlots)
3975
3995
  },
3976
3996
  txParameters: {
3977
3997
  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)
3998
+ maxInputs: (0, import_math18.bn)(txParams.maxInputs),
3999
+ maxOutputs: (0, import_math18.bn)(txParams.maxOutputs),
4000
+ maxWitnesses: (0, import_math18.bn)(txParams.maxWitnesses),
4001
+ maxGasPerTx: (0, import_math18.bn)(txParams.maxGasPerTx),
4002
+ maxSize: (0, import_math18.bn)(txParams.maxSize),
4003
+ maxBytecodeSubsections: (0, import_math18.bn)(txParams.maxBytecodeSubsections)
3984
4004
  },
3985
4005
  predicateParameters: {
3986
4006
  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)
4007
+ maxPredicateLength: (0, import_math18.bn)(predicateParams.maxPredicateLength),
4008
+ maxPredicateDataLength: (0, import_math18.bn)(predicateParams.maxPredicateDataLength),
4009
+ maxGasPerPredicate: (0, import_math18.bn)(predicateParams.maxGasPerPredicate),
4010
+ maxMessageDataLength: (0, import_math18.bn)(predicateParams.maxMessageDataLength)
3991
4011
  },
3992
4012
  scriptParameters: {
3993
4013
  version: scriptParams.version,
3994
- maxScriptLength: (0, import_math17.bn)(scriptParams.maxScriptLength),
3995
- maxScriptDataLength: (0, import_math17.bn)(scriptParams.maxScriptDataLength)
4014
+ maxScriptLength: (0, import_math18.bn)(scriptParams.maxScriptLength),
4015
+ maxScriptDataLength: (0, import_math18.bn)(scriptParams.maxScriptDataLength)
3996
4016
  },
3997
4017
  gasCosts
3998
4018
  },
3999
4019
  latestBlock: {
4000
4020
  id: latestBlock.id,
4001
- height: (0, import_math17.bn)(latestBlock.height),
4021
+ height: (0, import_math18.bn)(latestBlock.height),
4002
4022
  time: latestBlock.header.time,
4003
4023
  transactions: latestBlock.transactions.map((i) => ({
4004
4024
  id: i.id
@@ -4194,7 +4214,7 @@ Supported fuel-core version: ${supportedVersion}.`
4194
4214
  */
4195
4215
  async getBlockNumber() {
4196
4216
  const { chain } = await this.operations.getChain();
4197
- return (0, import_math17.bn)(chain.latestBlock.height, 10);
4217
+ return (0, import_math18.bn)(chain.latestBlock.height, 10);
4198
4218
  }
4199
4219
  /**
4200
4220
  * Returns the chain information.
@@ -4204,8 +4224,8 @@ Supported fuel-core version: ${supportedVersion}.`
4204
4224
  async fetchNode() {
4205
4225
  const { nodeInfo } = await this.operations.getNodeInfo();
4206
4226
  const processedNodeInfo = {
4207
- maxDepth: (0, import_math17.bn)(nodeInfo.maxDepth),
4208
- maxTx: (0, import_math17.bn)(nodeInfo.maxTx),
4227
+ maxDepth: (0, import_math18.bn)(nodeInfo.maxDepth),
4228
+ maxTx: (0, import_math18.bn)(nodeInfo.maxTx),
4209
4229
  nodeVersion: nodeInfo.nodeVersion,
4210
4230
  utxoValidation: nodeInfo.utxoValidation,
4211
4231
  vmBacktrace: nodeInfo.vmBacktrace
@@ -4322,7 +4342,7 @@ Supported fuel-core version: ${supportedVersion}.`
4322
4342
  async estimatePredicates(transactionRequest) {
4323
4343
  const shouldEstimatePredicates = Boolean(
4324
4344
  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()
4345
+ (input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new import_math18.BN(input.predicateGasUsed).isZero()
4326
4346
  )
4327
4347
  );
4328
4348
  if (!shouldEstimatePredicates) {
@@ -4337,7 +4357,7 @@ Supported fuel-core version: ${supportedVersion}.`
4337
4357
  } = response;
4338
4358
  if (inputs) {
4339
4359
  inputs.forEach((input, index) => {
4340
- if ("predicateGasUsed" in input && (0, import_math17.bn)(input.predicateGasUsed).gt(0)) {
4360
+ if ("predicateGasUsed" in input && (0, import_math18.bn)(input.predicateGasUsed).gt(0)) {
4341
4361
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
4342
4362
  }
4343
4363
  });
@@ -4495,12 +4515,12 @@ Supported fuel-core version: ${supportedVersion}.`
4495
4515
  gasPrice = await this.estimateGasPrice(10);
4496
4516
  }
4497
4517
  const minFee = calculateGasFee({
4498
- gasPrice: (0, import_math17.bn)(gasPrice),
4518
+ gasPrice: (0, import_math18.bn)(gasPrice),
4499
4519
  gas: minGas,
4500
4520
  priceFactor: gasPriceFactor,
4501
4521
  tip: transactionRequest.tip
4502
4522
  }).add(1);
4503
- let gasLimit = (0, import_math17.bn)(0);
4523
+ let gasLimit = (0, import_math18.bn)(0);
4504
4524
  if (transactionRequest.type === import_transactions20.TransactionType.Script) {
4505
4525
  gasLimit = transactionRequest.gasLimit;
4506
4526
  if (transactionRequest.gasLimit.eq(0)) {
@@ -4513,7 +4533,7 @@ Supported fuel-core version: ${supportedVersion}.`
4513
4533
  }
4514
4534
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4515
4535
  const maxFee = calculateGasFee({
4516
- gasPrice: (0, import_math17.bn)(gasPrice),
4536
+ gasPrice: (0, import_math18.bn)(gasPrice),
4517
4537
  gas: maxGas,
4518
4538
  priceFactor: gasPriceFactor,
4519
4539
  tip: transactionRequest.tip
@@ -4578,7 +4598,7 @@ Supported fuel-core version: ${supportedVersion}.`
4578
4598
  const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
4579
4599
  txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
4580
4600
  if (isScriptTransaction) {
4581
- txRequestClone.gasLimit = (0, import_math17.bn)(0);
4601
+ txRequestClone.gasLimit = (0, import_math18.bn)(0);
4582
4602
  }
4583
4603
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4584
4604
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -4599,7 +4619,7 @@ Supported fuel-core version: ${supportedVersion}.`
4599
4619
  let dryRunStatus;
4600
4620
  let missingContractIds = [];
4601
4621
  let outputVariables = 0;
4602
- let gasUsed = (0, import_math17.bn)(0);
4622
+ let gasUsed = (0, import_math18.bn)(0);
4603
4623
  txRequestClone.maxFee = maxFee;
4604
4624
  if (isScriptTransaction) {
4605
4625
  txRequestClone.gasLimit = gasLimit;
@@ -4664,10 +4684,10 @@ Supported fuel-core version: ${supportedVersion}.`
4664
4684
  return coins.map((coin) => ({
4665
4685
  id: coin.utxoId,
4666
4686
  assetId: coin.assetId,
4667
- amount: (0, import_math17.bn)(coin.amount),
4687
+ amount: (0, import_math18.bn)(coin.amount),
4668
4688
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4669
- blockCreated: (0, import_math17.bn)(coin.blockCreated),
4670
- txCreatedIdx: (0, import_math17.bn)(coin.txCreatedIdx)
4689
+ blockCreated: (0, import_math18.bn)(coin.blockCreated),
4690
+ txCreatedIdx: (0, import_math18.bn)(coin.txCreatedIdx)
4671
4691
  }));
4672
4692
  }
4673
4693
  /**
@@ -4704,9 +4724,9 @@ Supported fuel-core version: ${supportedVersion}.`
4704
4724
  switch (coin.type) {
4705
4725
  case "MessageCoin":
4706
4726
  return {
4707
- amount: (0, import_math17.bn)(coin.amount),
4727
+ amount: (0, import_math18.bn)(coin.amount),
4708
4728
  assetId: coin.assetId,
4709
- daHeight: (0, import_math17.bn)(coin.daHeight),
4729
+ daHeight: (0, import_math18.bn)(coin.daHeight),
4710
4730
  sender: import_address3.Address.fromAddressOrString(coin.sender),
4711
4731
  recipient: import_address3.Address.fromAddressOrString(coin.recipient),
4712
4732
  nonce: coin.nonce
@@ -4714,11 +4734,11 @@ Supported fuel-core version: ${supportedVersion}.`
4714
4734
  case "Coin":
4715
4735
  return {
4716
4736
  id: coin.utxoId,
4717
- amount: (0, import_math17.bn)(coin.amount),
4737
+ amount: (0, import_math18.bn)(coin.amount),
4718
4738
  assetId: coin.assetId,
4719
4739
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4720
- blockCreated: (0, import_math17.bn)(coin.blockCreated),
4721
- txCreatedIdx: (0, import_math17.bn)(coin.txCreatedIdx)
4740
+ blockCreated: (0, import_math18.bn)(coin.blockCreated),
4741
+ txCreatedIdx: (0, import_math18.bn)(coin.txCreatedIdx)
4722
4742
  };
4723
4743
  default:
4724
4744
  return null;
@@ -4735,13 +4755,13 @@ Supported fuel-core version: ${supportedVersion}.`
4735
4755
  async getBlock(idOrHeight) {
4736
4756
  let variables;
4737
4757
  if (typeof idOrHeight === "number") {
4738
- variables = { height: (0, import_math17.bn)(idOrHeight).toString(10) };
4758
+ variables = { height: (0, import_math18.bn)(idOrHeight).toString(10) };
4739
4759
  } else if (idOrHeight === "latest") {
4740
4760
  variables = { height: (await this.getBlockNumber()).toString(10) };
4741
4761
  } else if (idOrHeight.length === 66) {
4742
4762
  variables = { blockId: idOrHeight };
4743
4763
  } else {
4744
- variables = { blockId: (0, import_math17.bn)(idOrHeight).toString(10) };
4764
+ variables = { blockId: (0, import_math18.bn)(idOrHeight).toString(10) };
4745
4765
  }
4746
4766
  const { block } = await this.operations.getBlock(variables);
4747
4767
  if (!block) {
@@ -4749,7 +4769,7 @@ Supported fuel-core version: ${supportedVersion}.`
4749
4769
  }
4750
4770
  return {
4751
4771
  id: block.id,
4752
- height: (0, import_math17.bn)(block.height),
4772
+ height: (0, import_math18.bn)(block.height),
4753
4773
  time: block.header.time,
4754
4774
  transactionIds: block.transactions.map((tx) => tx.id)
4755
4775
  };
@@ -4764,7 +4784,7 @@ Supported fuel-core version: ${supportedVersion}.`
4764
4784
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4765
4785
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4766
4786
  id: block.id,
4767
- height: (0, import_math17.bn)(block.height),
4787
+ height: (0, import_math18.bn)(block.height),
4768
4788
  time: block.header.time,
4769
4789
  transactionIds: block.transactions.map((tx) => tx.id)
4770
4790
  }));
@@ -4779,7 +4799,7 @@ Supported fuel-core version: ${supportedVersion}.`
4779
4799
  async getBlockWithTransactions(idOrHeight) {
4780
4800
  let variables;
4781
4801
  if (typeof idOrHeight === "number") {
4782
- variables = { blockHeight: (0, import_math17.bn)(idOrHeight).toString(10) };
4802
+ variables = { blockHeight: (0, import_math18.bn)(idOrHeight).toString(10) };
4783
4803
  } else if (idOrHeight === "latest") {
4784
4804
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4785
4805
  } else {
@@ -4791,7 +4811,7 @@ Supported fuel-core version: ${supportedVersion}.`
4791
4811
  }
4792
4812
  return {
4793
4813
  id: block.id,
4794
- height: (0, import_math17.bn)(block.height, 10),
4814
+ height: (0, import_math18.bn)(block.height, 10),
4795
4815
  time: block.header.time,
4796
4816
  transactionIds: block.transactions.map((tx) => tx.id),
4797
4817
  transactions: block.transactions.map(
@@ -4840,7 +4860,7 @@ Supported fuel-core version: ${supportedVersion}.`
4840
4860
  contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
4841
4861
  asset: (0, import_utils22.hexlify)(assetId)
4842
4862
  });
4843
- return (0, import_math17.bn)(contractBalance.amount, 10);
4863
+ return (0, import_math18.bn)(contractBalance.amount, 10);
4844
4864
  }
4845
4865
  /**
4846
4866
  * Returns the balance for the given owner for the given asset ID.
@@ -4854,7 +4874,7 @@ Supported fuel-core version: ${supportedVersion}.`
4854
4874
  owner: import_address3.Address.fromAddressOrString(owner).toB256(),
4855
4875
  assetId: (0, import_utils22.hexlify)(assetId)
4856
4876
  });
4857
- return (0, import_math17.bn)(balance.amount, 10);
4877
+ return (0, import_math18.bn)(balance.amount, 10);
4858
4878
  }
4859
4879
  /**
4860
4880
  * Returns balances for the given owner.
@@ -4872,7 +4892,7 @@ Supported fuel-core version: ${supportedVersion}.`
4872
4892
  const balances = result.balances.edges.map((edge) => edge.node);
4873
4893
  return balances.map((balance) => ({
4874
4894
  assetId: balance.assetId,
4875
- amount: (0, import_math17.bn)(balance.amount)
4895
+ amount: (0, import_math18.bn)(balance.amount)
4876
4896
  }));
4877
4897
  }
4878
4898
  /**
@@ -4894,15 +4914,15 @@ Supported fuel-core version: ${supportedVersion}.`
4894
4914
  sender: message.sender,
4895
4915
  recipient: message.recipient,
4896
4916
  nonce: message.nonce,
4897
- amount: (0, import_math17.bn)(message.amount),
4917
+ amount: (0, import_math18.bn)(message.amount),
4898
4918
  data: message.data
4899
4919
  }),
4900
4920
  sender: import_address3.Address.fromAddressOrString(message.sender),
4901
4921
  recipient: import_address3.Address.fromAddressOrString(message.recipient),
4902
4922
  nonce: message.nonce,
4903
- amount: (0, import_math17.bn)(message.amount),
4923
+ amount: (0, import_math18.bn)(message.amount),
4904
4924
  data: import_transactions20.InputMessageCoder.decodeData(message.data),
4905
- daHeight: (0, import_math17.bn)(message.daHeight)
4925
+ daHeight: (0, import_math18.bn)(message.daHeight)
4906
4926
  }));
4907
4927
  }
4908
4928
  /**
@@ -4955,19 +4975,19 @@ Supported fuel-core version: ${supportedVersion}.`
4955
4975
  } = result.messageProof;
4956
4976
  return {
4957
4977
  messageProof: {
4958
- proofIndex: (0, import_math17.bn)(messageProof.proofIndex),
4978
+ proofIndex: (0, import_math18.bn)(messageProof.proofIndex),
4959
4979
  proofSet: messageProof.proofSet
4960
4980
  },
4961
4981
  blockProof: {
4962
- proofIndex: (0, import_math17.bn)(blockProof.proofIndex),
4982
+ proofIndex: (0, import_math18.bn)(blockProof.proofIndex),
4963
4983
  proofSet: blockProof.proofSet
4964
4984
  },
4965
4985
  messageBlockHeader: {
4966
4986
  id: messageBlockHeader.id,
4967
- daHeight: (0, import_math17.bn)(messageBlockHeader.daHeight),
4987
+ daHeight: (0, import_math18.bn)(messageBlockHeader.daHeight),
4968
4988
  transactionsCount: Number(messageBlockHeader.transactionsCount),
4969
4989
  transactionsRoot: messageBlockHeader.transactionsRoot,
4970
- height: (0, import_math17.bn)(messageBlockHeader.height),
4990
+ height: (0, import_math18.bn)(messageBlockHeader.height),
4971
4991
  prevRoot: messageBlockHeader.prevRoot,
4972
4992
  time: messageBlockHeader.time,
4973
4993
  applicationHash: messageBlockHeader.applicationHash,
@@ -4979,10 +4999,10 @@ Supported fuel-core version: ${supportedVersion}.`
4979
4999
  },
4980
5000
  commitBlockHeader: {
4981
5001
  id: commitBlockHeader.id,
4982
- daHeight: (0, import_math17.bn)(commitBlockHeader.daHeight),
5002
+ daHeight: (0, import_math18.bn)(commitBlockHeader.daHeight),
4983
5003
  transactionsCount: Number(commitBlockHeader.transactionsCount),
4984
5004
  transactionsRoot: commitBlockHeader.transactionsRoot,
4985
- height: (0, import_math17.bn)(commitBlockHeader.height),
5005
+ height: (0, import_math18.bn)(commitBlockHeader.height),
4986
5006
  prevRoot: commitBlockHeader.prevRoot,
4987
5007
  time: commitBlockHeader.time,
4988
5008
  applicationHash: commitBlockHeader.applicationHash,
@@ -4995,19 +5015,19 @@ Supported fuel-core version: ${supportedVersion}.`
4995
5015
  sender: import_address3.Address.fromAddressOrString(sender),
4996
5016
  recipient: import_address3.Address.fromAddressOrString(recipient),
4997
5017
  nonce,
4998
- amount: (0, import_math17.bn)(amount),
5018
+ amount: (0, import_math18.bn)(amount),
4999
5019
  data
5000
5020
  };
5001
5021
  }
5002
5022
  async getLatestGasPrice() {
5003
5023
  const { latestGasPrice } = await this.operations.getLatestGasPrice();
5004
- return (0, import_math17.bn)(latestGasPrice.gasPrice);
5024
+ return (0, import_math18.bn)(latestGasPrice.gasPrice);
5005
5025
  }
5006
5026
  async estimateGasPrice(blockHorizon) {
5007
5027
  const { estimateGasPrice } = await this.operations.estimateGasPrice({
5008
5028
  blockHorizon: String(blockHorizon)
5009
5029
  });
5010
- return (0, import_math17.bn)(estimateGasPrice.gasPrice);
5030
+ return (0, import_math18.bn)(estimateGasPrice.gasPrice);
5011
5031
  }
5012
5032
  /**
5013
5033
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
@@ -5028,10 +5048,10 @@ Supported fuel-core version: ${supportedVersion}.`
5028
5048
  */
5029
5049
  async produceBlocks(amount, startTime) {
5030
5050
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
5031
- blocksToProduce: (0, import_math17.bn)(amount).toString(10),
5051
+ blocksToProduce: (0, import_math18.bn)(amount).toString(10),
5032
5052
  startTimestamp: startTime ? import_utils22.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
5033
5053
  });
5034
- return (0, import_math17.bn)(latestBlockHeight);
5054
+ return (0, import_math18.bn)(latestBlockHeight);
5035
5055
  }
5036
5056
  // eslint-disable-next-line @typescript-eslint/require-await
5037
5057
  async getTransactionResponse(transactionId) {
@@ -5077,7 +5097,7 @@ __publicField(Provider, "nodeInfoCache", {});
5077
5097
 
5078
5098
  // src/providers/transaction-summary/get-transaction-summary.ts
5079
5099
  var import_errors15 = require("@fuel-ts/errors");
5080
- var import_math18 = require("@fuel-ts/math");
5100
+ var import_math19 = require("@fuel-ts/math");
5081
5101
  var import_transactions21 = require("@fuel-ts/transactions");
5082
5102
  var import_utils25 = require("@fuel-ts/utils");
5083
5103
  async function getTransactionSummary(params) {
@@ -5114,8 +5134,8 @@ async function getTransactionSummary(params) {
5114
5134
  transaction: decodedTransaction,
5115
5135
  transactionBytes: (0, import_utils25.arrayify)(gqlTransaction.rawPayload),
5116
5136
  gqlTransactionStatus: gqlTransaction.status,
5117
- gasPerByte: (0, import_math18.bn)(gasPerByte),
5118
- gasPriceFactor: (0, import_math18.bn)(gasPriceFactor),
5137
+ gasPerByte: (0, import_math19.bn)(gasPerByte),
5138
+ gasPriceFactor: (0, import_math19.bn)(gasPriceFactor),
5119
5139
  abiMap,
5120
5140
  maxInputs,
5121
5141
  gasCosts,
@@ -5323,13 +5343,13 @@ var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
5323
5343
 
5324
5344
  // src/utils/formatTransferToContractScriptData.ts
5325
5345
  var import_abi_coder6 = require("@fuel-ts/abi-coder");
5326
- var import_math19 = require("@fuel-ts/math");
5346
+ var import_math20 = require("@fuel-ts/math");
5327
5347
  var import_utils27 = require("@fuel-ts/utils");
5328
5348
  var asm = __toESM(require("@fuels/vm-asm"));
5329
5349
  var formatTransferToContractScriptData = (params) => {
5330
5350
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
5331
5351
  const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
5332
- const encoded = numberCoder.encode(new import_math19.BN(amountToTransfer).toNumber());
5352
+ const encoded = numberCoder.encode(new import_math20.BN(amountToTransfer).toNumber());
5333
5353
  const scriptData = Uint8Array.from([
5334
5354
  ...(0, import_utils27.arrayify)(hexlifiedContractId),
5335
5355
  ...encoded,
@@ -5524,9 +5544,9 @@ var Account = class extends import_interfaces.AbstractAccount {
5524
5544
  const { addedSignatures, estimatedPredicates, requiredQuantities, updateMaxFee } = params;
5525
5545
  const fee = request.maxFee;
5526
5546
  const baseAssetId = this.provider.getBaseAssetId();
5527
- const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || (0, import_math20.bn)(0);
5547
+ const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || (0, import_math21.bn)(0);
5528
5548
  const requiredQuantitiesWithFee = addAmountToCoinQuantities({
5529
- amount: (0, import_math20.bn)(fee),
5549
+ amount: (0, import_math21.bn)(fee),
5530
5550
  assetId: baseAssetId,
5531
5551
  coinQuantities: requiredQuantities
5532
5552
  });
@@ -5534,7 +5554,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5534
5554
  requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
5535
5555
  quantitiesDict[assetId] = {
5536
5556
  required: amount,
5537
- owned: (0, import_math20.bn)(0)
5557
+ owned: (0, import_math21.bn)(0)
5538
5558
  };
5539
5559
  });
5540
5560
  request.inputs.filter(isRequestInputResource).forEach((input) => {
@@ -5561,6 +5581,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5561
5581
  cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
5562
5582
  );
5563
5583
  request.addResources(resources);
5584
+ request.shiftPredicateData();
5564
5585
  request.updatePredicateGasUsed(estimatedPredicates);
5565
5586
  const requestToReestimate2 = (0, import_ramda4.clone)(request);
5566
5587
  if (addedSignatures) {
@@ -5592,6 +5613,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5592
5613
  }
5593
5614
  fundingAttempts += 1;
5594
5615
  }
5616
+ request.shiftPredicateData();
5595
5617
  request.updatePredicateGasUsed(estimatedPredicates);
5596
5618
  const requestToReestimate = (0, import_ramda4.clone)(request);
5597
5619
  if (addedSignatures) {
@@ -5642,7 +5664,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5642
5664
  * @returns A promise that resolves to the transaction response.
5643
5665
  */
5644
5666
  async transfer(destination, amount, assetId, txParams = {}) {
5645
- if ((0, import_math20.bn)(amount).lte(0)) {
5667
+ if ((0, import_math21.bn)(amount).lte(0)) {
5646
5668
  throw new import_errors16.FuelError(
5647
5669
  import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
5648
5670
  "Transfer amount must be a positive number."
@@ -5662,7 +5684,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5662
5684
  * @returns A promise that resolves to the transaction response.
5663
5685
  */
5664
5686
  async transferToContract(contractId, amount, assetId, txParams = {}) {
5665
- if ((0, import_math20.bn)(amount).lte(0)) {
5687
+ if ((0, import_math21.bn)(amount).lte(0)) {
5666
5688
  throw new import_errors16.FuelError(
5667
5689
  import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
5668
5690
  "Transfer amount must be a positive number."
@@ -5672,7 +5694,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5672
5694
  const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5673
5695
  const { script, scriptData } = await assembleTransferToContractScript({
5674
5696
  hexlifiedContractId: contractAddress.toB256(),
5675
- amountToTransfer: (0, import_math20.bn)(amount),
5697
+ amountToTransfer: (0, import_math21.bn)(amount),
5676
5698
  assetId: assetIdToTransfer
5677
5699
  });
5678
5700
  let request = new ScriptTransactionRequest({
@@ -5683,7 +5705,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5683
5705
  request.addContractInputAndOutput(contractAddress);
5684
5706
  const txCost = await this.provider.getTransactionCost(request, {
5685
5707
  resourcesOwner: this,
5686
- quantitiesToContract: [{ amount: (0, import_math20.bn)(amount), assetId: String(assetIdToTransfer) }]
5708
+ quantitiesToContract: [{ amount: (0, import_math21.bn)(amount), assetId: String(assetIdToTransfer) }]
5687
5709
  });
5688
5710
  request = this.validateGasLimitAndMaxFee({
5689
5711
  transactionRequest: request,
@@ -5708,7 +5730,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5708
5730
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5709
5731
  );
5710
5732
  const amountDataArray = (0, import_utils28.arrayify)(
5711
- "0x".concat((0, import_math20.bn)(amount).toHex().substring(2).padStart(16, "0"))
5733
+ "0x".concat((0, import_math21.bn)(amount).toHex().substring(2).padStart(16, "0"))
5712
5734
  );
5713
5735
  const script = new Uint8Array([
5714
5736
  ...(0, import_utils28.arrayify)(withdrawScript.bytes),
@@ -5718,7 +5740,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5718
5740
  const params = { script, ...txParams };
5719
5741
  const baseAssetId = this.provider.getBaseAssetId();
5720
5742
  let request = new ScriptTransactionRequest(params);
5721
- const quantitiesToContract = [{ amount: (0, import_math20.bn)(amount), assetId: baseAssetId }];
5743
+ const quantitiesToContract = [{ amount: (0, import_math21.bn)(amount), assetId: baseAssetId }];
5722
5744
  const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
5723
5745
  request = this.validateGasLimitAndMaxFee({
5724
5746
  transactionRequest: request,
@@ -5819,7 +5841,7 @@ var import_utils31 = require("@fuel-ts/utils");
5819
5841
  var import_address5 = require("@fuel-ts/address");
5820
5842
  var import_crypto2 = require("@fuel-ts/crypto");
5821
5843
  var import_hasher2 = require("@fuel-ts/hasher");
5822
- var import_math21 = require("@fuel-ts/math");
5844
+ var import_math22 = require("@fuel-ts/math");
5823
5845
  var import_utils29 = require("@fuel-ts/utils");
5824
5846
  var import_secp256k1 = require("@noble/curves/secp256k1");
5825
5847
  var Signer = class {
@@ -5839,7 +5861,7 @@ var Signer = class {
5839
5861
  privateKey = `0x${privateKey}`;
5840
5862
  }
5841
5863
  }
5842
- const privateKeyBytes = (0, import_math21.toBytes)(privateKey, 32);
5864
+ const privateKeyBytes = (0, import_math22.toBytes)(privateKey, 32);
5843
5865
  this.privateKey = (0, import_utils29.hexlify)(privateKeyBytes);
5844
5866
  this.publicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
5845
5867
  this.compressedPublicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
@@ -5857,8 +5879,8 @@ var Signer = class {
5857
5879
  */
5858
5880
  sign(data) {
5859
5881
  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);
5882
+ const r = (0, import_math22.toBytes)(`0x${signature.r.toString(16)}`, 32);
5883
+ const s = (0, import_math22.toBytes)(`0x${signature.s.toString(16)}`, 32);
5862
5884
  s[0] |= (signature.recovery || 0) << 7;
5863
5885
  return (0, import_utils29.hexlify)((0, import_utils29.concat)([r, s]));
5864
5886
  }
@@ -6131,7 +6153,7 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
6131
6153
  var import_crypto5 = require("@fuel-ts/crypto");
6132
6154
  var import_errors20 = require("@fuel-ts/errors");
6133
6155
  var import_hasher6 = require("@fuel-ts/hasher");
6134
- var import_math22 = require("@fuel-ts/math");
6156
+ var import_math23 = require("@fuel-ts/math");
6135
6157
  var import_utils35 = require("@fuel-ts/utils");
6136
6158
 
6137
6159
  // src/mnemonic/mnemonic.ts
@@ -8202,38 +8224,6 @@ var Language = /* @__PURE__ */ ((Language2) => {
8202
8224
  var import_errors18 = require("@fuel-ts/errors");
8203
8225
  var import_hasher4 = require("@fuel-ts/hasher");
8204
8226
  var import_utils32 = require("@fuel-ts/utils");
8205
- function toUtf8Bytes(stri) {
8206
- const str = stri.normalize("NFKD");
8207
- const result = [];
8208
- for (let i = 0; i < str.length; i += 1) {
8209
- const c = str.charCodeAt(i);
8210
- if (c < 128) {
8211
- result.push(c);
8212
- } else if (c < 2048) {
8213
- result.push(c >> 6 | 192);
8214
- result.push(c & 63 | 128);
8215
- } else if ((c & 64512) === 55296) {
8216
- i += 1;
8217
- const c2 = str.charCodeAt(i);
8218
- if (i >= str.length || (c2 & 64512) !== 56320) {
8219
- throw new import_errors18.FuelError(
8220
- import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
8221
- "Invalid UTF-8 in the input string."
8222
- );
8223
- }
8224
- const pair = 65536 + ((c & 1023) << 10) + (c2 & 1023);
8225
- result.push(pair >> 18 | 240);
8226
- result.push(pair >> 12 & 63 | 128);
8227
- result.push(pair >> 6 & 63 | 128);
8228
- result.push(pair & 63 | 128);
8229
- } else {
8230
- result.push(c >> 12 | 224);
8231
- result.push(c >> 6 & 63 | 128);
8232
- result.push(c & 63 | 128);
8233
- }
8234
- }
8235
- return Uint8Array.from(result);
8236
- }
8237
8227
  function getLowerMask(bits) {
8238
8228
  return (1 << bits) - 1;
8239
8229
  }
@@ -8306,7 +8296,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
8306
8296
  }
8307
8297
 
8308
8298
  // src/mnemonic/mnemonic.ts
8309
- var MasterSecret = toUtf8Bytes("Bitcoin seed");
8299
+ var MasterSecret = (0, import_utils33.toUtf8Bytes)("Bitcoin seed");
8310
8300
  var MainnetPRV = "0x0488ade4";
8311
8301
  var TestnetPRV = "0x04358394";
8312
8302
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
@@ -8390,8 +8380,8 @@ var Mnemonic = class {
8390
8380
  */
8391
8381
  static mnemonicToSeed(phrase, passphrase = "") {
8392
8382
  assertMnemonic(getWords(phrase));
8393
- const phraseBytes = toUtf8Bytes(getPhrase(phrase));
8394
- const salt = toUtf8Bytes(`mnemonic${passphrase}`);
8383
+ const phraseBytes = (0, import_utils33.toUtf8Bytes)(getPhrase(phrase));
8384
+ const salt = (0, import_utils33.toUtf8Bytes)(`mnemonic${passphrase}`);
8395
8385
  return (0, import_crypto4.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
8396
8386
  }
8397
8387
  /**
@@ -8595,13 +8585,13 @@ var HDWallet = class {
8595
8585
  } else {
8596
8586
  data.set((0, import_utils35.arrayify)(this.publicKey));
8597
8587
  }
8598
- data.set((0, import_math22.toBytes)(index, 4), 33);
8588
+ data.set((0, import_math23.toBytes)(index, 4), 33);
8599
8589
  const bytes = (0, import_utils35.arrayify)((0, import_crypto5.computeHmac)("sha512", chainCode, data));
8600
8590
  const IL = bytes.slice(0, 32);
8601
8591
  const IR = bytes.slice(32);
8602
8592
  if (privateKey) {
8603
8593
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
8604
- const ki = (0, import_math22.bn)(IL).add(privateKey).mod(N).toBytes(32);
8594
+ const ki = (0, import_math23.bn)(IL).add(privateKey).mod(N).toBytes(32);
8605
8595
  return new HDWallet({
8606
8596
  privateKey: ki,
8607
8597
  chainCode: IR,
@@ -8647,7 +8637,7 @@ var HDWallet = class {
8647
8637
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
8648
8638
  const depth = (0, import_utils35.hexlify)(Uint8Array.from([this.depth]));
8649
8639
  const parentFingerprint = this.parentFingerprint;
8650
- const index = (0, import_math22.toHex)(this.index, 4);
8640
+ const index = (0, import_math23.toHex)(this.index, 4);
8651
8641
  const chainCode = this.chainCode;
8652
8642
  const key = this.privateKey != null && !isPublic ? (0, import_utils35.concat)(["0x00", this.privateKey]) : this.publicKey;
8653
8643
  const extendedKey = (0, import_utils35.arrayify)((0, import_utils35.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
@@ -8667,7 +8657,7 @@ var HDWallet = class {
8667
8657
  });
8668
8658
  }
8669
8659
  static fromExtendedKey(extendedKey) {
8670
- const decoded = (0, import_utils35.hexlify)((0, import_math22.toBytes)((0, import_utils35.decodeBase58)(extendedKey)));
8660
+ const decoded = (0, import_utils35.hexlify)((0, import_math23.toBytes)((0, import_utils35.decodeBase58)(extendedKey)));
8671
8661
  const bytes = (0, import_utils35.arrayify)(decoded);
8672
8662
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
8673
8663
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
@@ -9283,6 +9273,7 @@ var StorageAbstract = class {
9283
9273
  var import_abi_coder7 = require("@fuel-ts/abi-coder");
9284
9274
  var import_address10 = require("@fuel-ts/address");
9285
9275
  var import_errors25 = require("@fuel-ts/errors");
9276
+ var import_transactions22 = require("@fuel-ts/transactions");
9286
9277
  var import_utils37 = require("@fuel-ts/utils");
9287
9278
 
9288
9279
  // src/predicate/utils/getPredicateRoot.ts
@@ -9340,6 +9331,7 @@ var Predicate = class extends Account {
9340
9331
  */
9341
9332
  populateTransactionPredicateData(transactionRequestLike) {
9342
9333
  const request = transactionRequestify(transactionRequestLike);
9334
+ const { policies } = BaseTransactionRequest.getPolicyMeta(request);
9343
9335
  const placeholderIndex = this.getIndexFromPlaceholderWitness(request);
9344
9336
  if (placeholderIndex !== -1) {
9345
9337
  request.removeWitness(placeholderIndex);
@@ -9347,7 +9339,7 @@ var Predicate = class extends Account {
9347
9339
  request.inputs.filter(isRequestInputResource).forEach((input) => {
9348
9340
  if (isRequestInputResourceFromOwner(input, this.address)) {
9349
9341
  input.predicate = (0, import_utils37.hexlify)(this.bytes);
9350
- input.predicateData = (0, import_utils37.hexlify)(this.getPredicateData());
9342
+ input.predicateData = (0, import_utils37.hexlify)(this.getPredicateData(policies.length));
9351
9343
  input.witnessIndex = 0;
9352
9344
  }
9353
9345
  });
@@ -9373,12 +9365,17 @@ var Predicate = class extends Account {
9373
9365
  const transactionRequest = transactionRequestify(transactionRequestLike);
9374
9366
  return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
9375
9367
  }
9376
- getPredicateData() {
9368
+ getPredicateData(policiesLength) {
9377
9369
  if (!this.predicateData.length) {
9378
9370
  return new Uint8Array();
9379
9371
  }
9380
9372
  const mainFn = this.interface?.functions.main;
9381
- return mainFn?.encodeArguments(this.predicateData) || new Uint8Array();
9373
+ const paddedCode = new import_transactions22.ByteArrayCoder(this.bytes.length).encode(this.bytes);
9374
+ const VM_TX_MEMORY = (0, import_abi_coder7.calculateVmTxMemory)({
9375
+ maxInputs: this.provider.getChain().consensusParameters.txParameters.maxInputs.toNumber()
9376
+ });
9377
+ 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;
9378
+ return mainFn?.encodeArguments(this.predicateData, OFFSET) || new Uint8Array();
9382
9379
  }
9383
9380
  /**
9384
9381
  * Processes the predicate data and returns the altered bytecode and interface.
@@ -9427,7 +9424,8 @@ var Predicate = class extends Account {
9427
9424
  );
9428
9425
  return resources.map((resource) => ({
9429
9426
  ...resource,
9430
- predicate: (0, import_utils37.hexlify)(this.bytes)
9427
+ predicate: (0, import_utils37.hexlify)(this.bytes),
9428
+ padPredicateData: (policiesLength) => (0, import_utils37.hexlify)(this.getPredicateData(policiesLength))
9431
9429
  }));
9432
9430
  }
9433
9431
  /**