@fuel-ts/account 0.0.0-rc-2143-20240513161105 → 0.0.0-rc-2238-20240513190659

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.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 bn20 } from "@fuel-ts/math";
34
+ import { bn as bn19 } 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 bn18 } from "@fuel-ts/math";
76
+ import { BN, bn as bn17 } from "@fuel-ts/math";
77
77
  import {
78
78
  InputType as InputType7,
79
79
  TransactionType as TransactionType8,
@@ -2377,15 +2377,6 @@ var BaseTransactionRequest = class {
2377
2377
  }
2378
2378
  });
2379
2379
  }
2380
- shiftPredicateData() {
2381
- this.inputs.forEach((input) => {
2382
- if ("predicateData" in input && "padPredicateData" in input && typeof input.padPredicateData === "function") {
2383
- input.predicateData = input.padPredicateData(
2384
- BaseTransactionRequest.getPolicyMeta(this).policies.length
2385
- );
2386
- }
2387
- });
2388
- }
2389
2380
  };
2390
2381
 
2391
2382
  // src/providers/transaction-request/create-transaction-request.ts
@@ -2808,12 +2799,12 @@ var transactionRequestify = (obj) => {
2808
2799
 
2809
2800
  // src/providers/transaction-response/transaction-response.ts
2810
2801
  import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
2811
- import { bn as bn17 } from "@fuel-ts/math";
2802
+ import { bn as bn16 } from "@fuel-ts/math";
2812
2803
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2813
2804
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
2814
2805
 
2815
2806
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2816
- import { bn as bn16 } from "@fuel-ts/math";
2807
+ import { bn as bn15 } from "@fuel-ts/math";
2817
2808
  import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
2818
2809
  import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2819
2810
 
@@ -2890,43 +2881,32 @@ var calculateTXFeeForSummary = (params) => {
2890
2881
  // src/providers/transaction-summary/operations.ts
2891
2882
  import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
2892
2883
  import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
2893
- import { bn as bn14 } from "@fuel-ts/math";
2884
+ import { bn as bn13 } from "@fuel-ts/math";
2894
2885
  import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
2895
2886
 
2896
2887
  // src/providers/transaction-summary/call.ts
2897
- import { Interface as Interface2, calculateVmTxMemory } from "@fuel-ts/abi-coder";
2898
- import { bn as bn13 } from "@fuel-ts/math";
2899
- var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2888
+ import { Interface as Interface2 } from "@fuel-ts/abi-coder";
2889
+ var getFunctionCall = ({ abi, receipt }) => {
2900
2890
  const abiInterface = new Interface2(abi);
2901
2891
  const callFunctionSelector = receipt.param1.toHex(8);
2902
2892
  const functionFragment = abiInterface.getFunction(callFunctionSelector);
2903
2893
  const inputs = functionFragment.jsonFn.inputs;
2904
- let encodedArgs;
2905
- if (functionFragment.isInputDataPointer) {
2906
- if (rawPayload) {
2907
- const argsOffset = bn13(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2908
- encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2909
- }
2910
- } else {
2911
- encodedArgs = receipt.param2.toHex();
2912
- }
2894
+ const encodedArgs = receipt.param2.toHex();
2913
2895
  let argumentsProvided;
2914
- if (encodedArgs) {
2915
- const data = functionFragment.decodeArguments(encodedArgs);
2916
- if (data) {
2917
- argumentsProvided = inputs.reduce((prev, input, index) => {
2918
- const value = data[index];
2919
- const name = input.name;
2920
- if (name) {
2921
- return {
2922
- ...prev,
2923
- // reparse to remove bn
2924
- [name]: JSON.parse(JSON.stringify(value))
2925
- };
2926
- }
2927
- return prev;
2928
- }, {});
2929
- }
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
+ }, {});
2930
2910
  }
2931
2911
  const call = {
2932
2912
  functionSignature: functionFragment.signature,
@@ -3112,7 +3092,7 @@ var mergeAssets = (op1, op2) => {
3112
3092
  if (!matchingAsset) {
3113
3093
  return asset1;
3114
3094
  }
3115
- const mergedAmount = bn14(asset1.amount).add(matchingAsset.amount);
3095
+ const mergedAmount = bn13(asset1.amount).add(matchingAsset.amount);
3116
3096
  return { ...asset1, amount: mergedAmount };
3117
3097
  });
3118
3098
  return mergedAssets.concat(filteredAssets);
@@ -3438,7 +3418,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3438
3418
 
3439
3419
  // src/providers/transaction-summary/status.ts
3440
3420
  import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
3441
- import { bn as bn15 } from "@fuel-ts/math";
3421
+ import { bn as bn14 } from "@fuel-ts/math";
3442
3422
  var getTransactionStatusName = (gqlStatus) => {
3443
3423
  switch (gqlStatus) {
3444
3424
  case "FailureStatus":
@@ -3472,15 +3452,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3472
3452
  time = gqlTransactionStatus.time;
3473
3453
  blockId = gqlTransactionStatus.block.id;
3474
3454
  isStatusSuccess = true;
3475
- totalFee = bn15(gqlTransactionStatus.totalFee);
3476
- totalGas = bn15(gqlTransactionStatus.totalGas);
3455
+ totalFee = bn14(gqlTransactionStatus.totalFee);
3456
+ totalGas = bn14(gqlTransactionStatus.totalGas);
3477
3457
  break;
3478
3458
  case "FailureStatus":
3479
3459
  time = gqlTransactionStatus.time;
3480
3460
  blockId = gqlTransactionStatus.block.id;
3481
3461
  isStatusFailure = true;
3482
- totalFee = bn15(gqlTransactionStatus.totalFee);
3483
- totalGas = bn15(gqlTransactionStatus.totalGas);
3462
+ totalFee = bn14(gqlTransactionStatus.totalFee);
3463
+ totalGas = bn14(gqlTransactionStatus.totalGas);
3484
3464
  break;
3485
3465
  case "SubmittedStatus":
3486
3466
  time = gqlTransactionStatus.time;
@@ -3530,7 +3510,7 @@ function assembleTransactionSummary(params) {
3530
3510
  maxInputs
3531
3511
  });
3532
3512
  const typeName = getTransactionTypeName(transaction.type);
3533
- const tip = bn16(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3513
+ const tip = bn15(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3534
3514
  const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3535
3515
  const fee = calculateTXFeeForSummary({
3536
3516
  totalFee,
@@ -3601,7 +3581,7 @@ var TransactionResponse = class {
3601
3581
  /** Current provider */
3602
3582
  provider;
3603
3583
  /** Gas used on the transaction */
3604
- gasUsed = bn17(0);
3584
+ gasUsed = bn16(0);
3605
3585
  /** The graphql Transaction with receipts object. */
3606
3586
  gqlTransaction;
3607
3587
  abis;
@@ -3835,47 +3815,47 @@ var processGqlChain = (chain) => {
3835
3815
  } = consensusParameters;
3836
3816
  return {
3837
3817
  name,
3838
- baseChainHeight: bn18(daHeight),
3818
+ baseChainHeight: bn17(daHeight),
3839
3819
  consensusParameters: {
3840
3820
  version,
3841
- chainId: bn18(chainId),
3821
+ chainId: bn17(chainId),
3842
3822
  baseAssetId,
3843
3823
  feeParameters: {
3844
3824
  version: feeParams.version,
3845
- gasPerByte: bn18(feeParams.gasPerByte),
3846
- gasPriceFactor: bn18(feeParams.gasPriceFactor)
3825
+ gasPerByte: bn17(feeParams.gasPerByte),
3826
+ gasPriceFactor: bn17(feeParams.gasPriceFactor)
3847
3827
  },
3848
3828
  contractParameters: {
3849
3829
  version: contractParams.version,
3850
- contractMaxSize: bn18(contractParams.contractMaxSize),
3851
- maxStorageSlots: bn18(contractParams.maxStorageSlots)
3830
+ contractMaxSize: bn17(contractParams.contractMaxSize),
3831
+ maxStorageSlots: bn17(contractParams.maxStorageSlots)
3852
3832
  },
3853
3833
  txParameters: {
3854
3834
  version: txParams.version,
3855
- maxInputs: bn18(txParams.maxInputs),
3856
- maxOutputs: bn18(txParams.maxOutputs),
3857
- maxWitnesses: bn18(txParams.maxWitnesses),
3858
- maxGasPerTx: bn18(txParams.maxGasPerTx),
3859
- maxSize: bn18(txParams.maxSize),
3860
- maxBytecodeSubsections: bn18(txParams.maxBytecodeSubsections)
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)
3861
3841
  },
3862
3842
  predicateParameters: {
3863
3843
  version: predicateParams.version,
3864
- maxPredicateLength: bn18(predicateParams.maxPredicateLength),
3865
- maxPredicateDataLength: bn18(predicateParams.maxPredicateDataLength),
3866
- maxGasPerPredicate: bn18(predicateParams.maxGasPerPredicate),
3867
- maxMessageDataLength: bn18(predicateParams.maxMessageDataLength)
3844
+ maxPredicateLength: bn17(predicateParams.maxPredicateLength),
3845
+ maxPredicateDataLength: bn17(predicateParams.maxPredicateDataLength),
3846
+ maxGasPerPredicate: bn17(predicateParams.maxGasPerPredicate),
3847
+ maxMessageDataLength: bn17(predicateParams.maxMessageDataLength)
3868
3848
  },
3869
3849
  scriptParameters: {
3870
3850
  version: scriptParams.version,
3871
- maxScriptLength: bn18(scriptParams.maxScriptLength),
3872
- maxScriptDataLength: bn18(scriptParams.maxScriptDataLength)
3851
+ maxScriptLength: bn17(scriptParams.maxScriptLength),
3852
+ maxScriptDataLength: bn17(scriptParams.maxScriptDataLength)
3873
3853
  },
3874
3854
  gasCosts
3875
3855
  },
3876
3856
  latestBlock: {
3877
3857
  id: latestBlock.id,
3878
- height: bn18(latestBlock.height),
3858
+ height: bn17(latestBlock.height),
3879
3859
  time: latestBlock.header.time,
3880
3860
  transactions: latestBlock.transactions.map((i) => ({
3881
3861
  id: i.id
@@ -4071,7 +4051,7 @@ Supported fuel-core version: ${supportedVersion}.`
4071
4051
  */
4072
4052
  async getBlockNumber() {
4073
4053
  const { chain } = await this.operations.getChain();
4074
- return bn18(chain.latestBlock.height, 10);
4054
+ return bn17(chain.latestBlock.height, 10);
4075
4055
  }
4076
4056
  /**
4077
4057
  * Returns the chain information.
@@ -4081,8 +4061,8 @@ Supported fuel-core version: ${supportedVersion}.`
4081
4061
  async fetchNode() {
4082
4062
  const { nodeInfo } = await this.operations.getNodeInfo();
4083
4063
  const processedNodeInfo = {
4084
- maxDepth: bn18(nodeInfo.maxDepth),
4085
- maxTx: bn18(nodeInfo.maxTx),
4064
+ maxDepth: bn17(nodeInfo.maxDepth),
4065
+ maxTx: bn17(nodeInfo.maxTx),
4086
4066
  nodeVersion: nodeInfo.nodeVersion,
4087
4067
  utxoValidation: nodeInfo.utxoValidation,
4088
4068
  vmBacktrace: nodeInfo.vmBacktrace
@@ -4214,7 +4194,7 @@ Supported fuel-core version: ${supportedVersion}.`
4214
4194
  } = response;
4215
4195
  if (inputs) {
4216
4196
  inputs.forEach((input, index) => {
4217
- if ("predicateGasUsed" in input && bn18(input.predicateGasUsed).gt(0)) {
4197
+ if ("predicateGasUsed" in input && bn17(input.predicateGasUsed).gt(0)) {
4218
4198
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
4219
4199
  }
4220
4200
  });
@@ -4372,12 +4352,12 @@ Supported fuel-core version: ${supportedVersion}.`
4372
4352
  gasPrice = await this.estimateGasPrice(10);
4373
4353
  }
4374
4354
  const minFee = calculateGasFee({
4375
- gasPrice: bn18(gasPrice),
4355
+ gasPrice: bn17(gasPrice),
4376
4356
  gas: minGas,
4377
4357
  priceFactor: gasPriceFactor,
4378
4358
  tip: transactionRequest.tip
4379
4359
  }).add(1);
4380
- let gasLimit = bn18(0);
4360
+ let gasLimit = bn17(0);
4381
4361
  if (transactionRequest.type === TransactionType8.Script) {
4382
4362
  gasLimit = transactionRequest.gasLimit;
4383
4363
  if (transactionRequest.gasLimit.eq(0)) {
@@ -4390,7 +4370,7 @@ Supported fuel-core version: ${supportedVersion}.`
4390
4370
  }
4391
4371
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4392
4372
  const maxFee = calculateGasFee({
4393
- gasPrice: bn18(gasPrice),
4373
+ gasPrice: bn17(gasPrice),
4394
4374
  gas: maxGas,
4395
4375
  priceFactor: gasPriceFactor,
4396
4376
  tip: transactionRequest.tip
@@ -4455,7 +4435,7 @@ Supported fuel-core version: ${supportedVersion}.`
4455
4435
  const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
4456
4436
  txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
4457
4437
  if (isScriptTransaction) {
4458
- txRequestClone.gasLimit = bn18(0);
4438
+ txRequestClone.gasLimit = bn17(0);
4459
4439
  }
4460
4440
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4461
4441
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -4476,7 +4456,7 @@ Supported fuel-core version: ${supportedVersion}.`
4476
4456
  let dryRunStatus;
4477
4457
  let missingContractIds = [];
4478
4458
  let outputVariables = 0;
4479
- let gasUsed = bn18(0);
4459
+ let gasUsed = bn17(0);
4480
4460
  txRequestClone.maxFee = maxFee;
4481
4461
  if (isScriptTransaction) {
4482
4462
  txRequestClone.gasLimit = gasLimit;
@@ -4541,10 +4521,10 @@ Supported fuel-core version: ${supportedVersion}.`
4541
4521
  return coins.map((coin) => ({
4542
4522
  id: coin.utxoId,
4543
4523
  assetId: coin.assetId,
4544
- amount: bn18(coin.amount),
4524
+ amount: bn17(coin.amount),
4545
4525
  owner: Address2.fromAddressOrString(coin.owner),
4546
- blockCreated: bn18(coin.blockCreated),
4547
- txCreatedIdx: bn18(coin.txCreatedIdx)
4526
+ blockCreated: bn17(coin.blockCreated),
4527
+ txCreatedIdx: bn17(coin.txCreatedIdx)
4548
4528
  }));
4549
4529
  }
4550
4530
  /**
@@ -4581,9 +4561,9 @@ Supported fuel-core version: ${supportedVersion}.`
4581
4561
  switch (coin.type) {
4582
4562
  case "MessageCoin":
4583
4563
  return {
4584
- amount: bn18(coin.amount),
4564
+ amount: bn17(coin.amount),
4585
4565
  assetId: coin.assetId,
4586
- daHeight: bn18(coin.daHeight),
4566
+ daHeight: bn17(coin.daHeight),
4587
4567
  sender: Address2.fromAddressOrString(coin.sender),
4588
4568
  recipient: Address2.fromAddressOrString(coin.recipient),
4589
4569
  nonce: coin.nonce
@@ -4591,11 +4571,11 @@ Supported fuel-core version: ${supportedVersion}.`
4591
4571
  case "Coin":
4592
4572
  return {
4593
4573
  id: coin.utxoId,
4594
- amount: bn18(coin.amount),
4574
+ amount: bn17(coin.amount),
4595
4575
  assetId: coin.assetId,
4596
4576
  owner: Address2.fromAddressOrString(coin.owner),
4597
- blockCreated: bn18(coin.blockCreated),
4598
- txCreatedIdx: bn18(coin.txCreatedIdx)
4577
+ blockCreated: bn17(coin.blockCreated),
4578
+ txCreatedIdx: bn17(coin.txCreatedIdx)
4599
4579
  };
4600
4580
  default:
4601
4581
  return null;
@@ -4612,13 +4592,13 @@ Supported fuel-core version: ${supportedVersion}.`
4612
4592
  async getBlock(idOrHeight) {
4613
4593
  let variables;
4614
4594
  if (typeof idOrHeight === "number") {
4615
- variables = { height: bn18(idOrHeight).toString(10) };
4595
+ variables = { height: bn17(idOrHeight).toString(10) };
4616
4596
  } else if (idOrHeight === "latest") {
4617
4597
  variables = { height: (await this.getBlockNumber()).toString(10) };
4618
4598
  } else if (idOrHeight.length === 66) {
4619
4599
  variables = { blockId: idOrHeight };
4620
4600
  } else {
4621
- variables = { blockId: bn18(idOrHeight).toString(10) };
4601
+ variables = { blockId: bn17(idOrHeight).toString(10) };
4622
4602
  }
4623
4603
  const { block } = await this.operations.getBlock(variables);
4624
4604
  if (!block) {
@@ -4626,7 +4606,7 @@ Supported fuel-core version: ${supportedVersion}.`
4626
4606
  }
4627
4607
  return {
4628
4608
  id: block.id,
4629
- height: bn18(block.height),
4609
+ height: bn17(block.height),
4630
4610
  time: block.header.time,
4631
4611
  transactionIds: block.transactions.map((tx) => tx.id)
4632
4612
  };
@@ -4641,7 +4621,7 @@ Supported fuel-core version: ${supportedVersion}.`
4641
4621
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4642
4622
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4643
4623
  id: block.id,
4644
- height: bn18(block.height),
4624
+ height: bn17(block.height),
4645
4625
  time: block.header.time,
4646
4626
  transactionIds: block.transactions.map((tx) => tx.id)
4647
4627
  }));
@@ -4656,7 +4636,7 @@ Supported fuel-core version: ${supportedVersion}.`
4656
4636
  async getBlockWithTransactions(idOrHeight) {
4657
4637
  let variables;
4658
4638
  if (typeof idOrHeight === "number") {
4659
- variables = { blockHeight: bn18(idOrHeight).toString(10) };
4639
+ variables = { blockHeight: bn17(idOrHeight).toString(10) };
4660
4640
  } else if (idOrHeight === "latest") {
4661
4641
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4662
4642
  } else {
@@ -4668,7 +4648,7 @@ Supported fuel-core version: ${supportedVersion}.`
4668
4648
  }
4669
4649
  return {
4670
4650
  id: block.id,
4671
- height: bn18(block.height, 10),
4651
+ height: bn17(block.height, 10),
4672
4652
  time: block.header.time,
4673
4653
  transactionIds: block.transactions.map((tx) => tx.id),
4674
4654
  transactions: block.transactions.map(
@@ -4717,7 +4697,7 @@ Supported fuel-core version: ${supportedVersion}.`
4717
4697
  contract: Address2.fromAddressOrString(contractId).toB256(),
4718
4698
  asset: hexlify12(assetId)
4719
4699
  });
4720
- return bn18(contractBalance.amount, 10);
4700
+ return bn17(contractBalance.amount, 10);
4721
4701
  }
4722
4702
  /**
4723
4703
  * Returns the balance for the given owner for the given asset ID.
@@ -4731,7 +4711,7 @@ Supported fuel-core version: ${supportedVersion}.`
4731
4711
  owner: Address2.fromAddressOrString(owner).toB256(),
4732
4712
  assetId: hexlify12(assetId)
4733
4713
  });
4734
- return bn18(balance.amount, 10);
4714
+ return bn17(balance.amount, 10);
4735
4715
  }
4736
4716
  /**
4737
4717
  * Returns balances for the given owner.
@@ -4749,7 +4729,7 @@ Supported fuel-core version: ${supportedVersion}.`
4749
4729
  const balances = result.balances.edges.map((edge) => edge.node);
4750
4730
  return balances.map((balance) => ({
4751
4731
  assetId: balance.assetId,
4752
- amount: bn18(balance.amount)
4732
+ amount: bn17(balance.amount)
4753
4733
  }));
4754
4734
  }
4755
4735
  /**
@@ -4771,15 +4751,15 @@ Supported fuel-core version: ${supportedVersion}.`
4771
4751
  sender: message.sender,
4772
4752
  recipient: message.recipient,
4773
4753
  nonce: message.nonce,
4774
- amount: bn18(message.amount),
4754
+ amount: bn17(message.amount),
4775
4755
  data: message.data
4776
4756
  }),
4777
4757
  sender: Address2.fromAddressOrString(message.sender),
4778
4758
  recipient: Address2.fromAddressOrString(message.recipient),
4779
4759
  nonce: message.nonce,
4780
- amount: bn18(message.amount),
4760
+ amount: bn17(message.amount),
4781
4761
  data: InputMessageCoder.decodeData(message.data),
4782
- daHeight: bn18(message.daHeight)
4762
+ daHeight: bn17(message.daHeight)
4783
4763
  }));
4784
4764
  }
4785
4765
  /**
@@ -4832,19 +4812,19 @@ Supported fuel-core version: ${supportedVersion}.`
4832
4812
  } = result.messageProof;
4833
4813
  return {
4834
4814
  messageProof: {
4835
- proofIndex: bn18(messageProof.proofIndex),
4815
+ proofIndex: bn17(messageProof.proofIndex),
4836
4816
  proofSet: messageProof.proofSet
4837
4817
  },
4838
4818
  blockProof: {
4839
- proofIndex: bn18(blockProof.proofIndex),
4819
+ proofIndex: bn17(blockProof.proofIndex),
4840
4820
  proofSet: blockProof.proofSet
4841
4821
  },
4842
4822
  messageBlockHeader: {
4843
4823
  id: messageBlockHeader.id,
4844
- daHeight: bn18(messageBlockHeader.daHeight),
4824
+ daHeight: bn17(messageBlockHeader.daHeight),
4845
4825
  transactionsCount: Number(messageBlockHeader.transactionsCount),
4846
4826
  transactionsRoot: messageBlockHeader.transactionsRoot,
4847
- height: bn18(messageBlockHeader.height),
4827
+ height: bn17(messageBlockHeader.height),
4848
4828
  prevRoot: messageBlockHeader.prevRoot,
4849
4829
  time: messageBlockHeader.time,
4850
4830
  applicationHash: messageBlockHeader.applicationHash,
@@ -4856,10 +4836,10 @@ Supported fuel-core version: ${supportedVersion}.`
4856
4836
  },
4857
4837
  commitBlockHeader: {
4858
4838
  id: commitBlockHeader.id,
4859
- daHeight: bn18(commitBlockHeader.daHeight),
4839
+ daHeight: bn17(commitBlockHeader.daHeight),
4860
4840
  transactionsCount: Number(commitBlockHeader.transactionsCount),
4861
4841
  transactionsRoot: commitBlockHeader.transactionsRoot,
4862
- height: bn18(commitBlockHeader.height),
4842
+ height: bn17(commitBlockHeader.height),
4863
4843
  prevRoot: commitBlockHeader.prevRoot,
4864
4844
  time: commitBlockHeader.time,
4865
4845
  applicationHash: commitBlockHeader.applicationHash,
@@ -4872,19 +4852,19 @@ Supported fuel-core version: ${supportedVersion}.`
4872
4852
  sender: Address2.fromAddressOrString(sender),
4873
4853
  recipient: Address2.fromAddressOrString(recipient),
4874
4854
  nonce,
4875
- amount: bn18(amount),
4855
+ amount: bn17(amount),
4876
4856
  data
4877
4857
  };
4878
4858
  }
4879
4859
  async getLatestGasPrice() {
4880
4860
  const { latestGasPrice } = await this.operations.getLatestGasPrice();
4881
- return bn18(latestGasPrice.gasPrice);
4861
+ return bn17(latestGasPrice.gasPrice);
4882
4862
  }
4883
4863
  async estimateGasPrice(blockHorizon) {
4884
4864
  const { estimateGasPrice } = await this.operations.estimateGasPrice({
4885
4865
  blockHorizon: String(blockHorizon)
4886
4866
  });
4887
- return bn18(estimateGasPrice.gasPrice);
4867
+ return bn17(estimateGasPrice.gasPrice);
4888
4868
  }
4889
4869
  /**
4890
4870
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
@@ -4905,10 +4885,10 @@ Supported fuel-core version: ${supportedVersion}.`
4905
4885
  */
4906
4886
  async produceBlocks(amount, startTime) {
4907
4887
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4908
- blocksToProduce: bn18(amount).toString(10),
4888
+ blocksToProduce: bn17(amount).toString(10),
4909
4889
  startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4910
4890
  });
4911
- return bn18(latestBlockHeight);
4891
+ return bn17(latestBlockHeight);
4912
4892
  }
4913
4893
  // eslint-disable-next-line @typescript-eslint/require-await
4914
4894
  async getTransactionResponse(transactionId) {
@@ -4954,7 +4934,7 @@ __publicField(Provider, "nodeInfoCache", {});
4954
4934
 
4955
4935
  // src/providers/transaction-summary/get-transaction-summary.ts
4956
4936
  import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
4957
- import { bn as bn19 } from "@fuel-ts/math";
4937
+ import { bn as bn18 } from "@fuel-ts/math";
4958
4938
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4959
4939
  import { arrayify as arrayify12 } from "@fuel-ts/utils";
4960
4940
  async function getTransactionSummary(params) {
@@ -4991,8 +4971,8 @@ async function getTransactionSummary(params) {
4991
4971
  transaction: decodedTransaction,
4992
4972
  transactionBytes: arrayify12(gqlTransaction.rawPayload),
4993
4973
  gqlTransactionStatus: gqlTransaction.status,
4994
- gasPerByte: bn19(gasPerByte),
4995
- gasPriceFactor: bn19(gasPriceFactor),
4974
+ gasPerByte: bn18(gasPerByte),
4975
+ gasPriceFactor: bn18(gasPriceFactor),
4996
4976
  abiMap,
4997
4977
  maxInputs,
4998
4978
  gasCosts,
@@ -5401,9 +5381,9 @@ var Account = class extends AbstractAccount {
5401
5381
  const { addedSignatures, estimatedPredicates, requiredQuantities, updateMaxFee } = params;
5402
5382
  const fee = request.maxFee;
5403
5383
  const baseAssetId = this.provider.getBaseAssetId();
5404
- const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || bn20(0);
5384
+ const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || bn19(0);
5405
5385
  const requiredQuantitiesWithFee = addAmountToCoinQuantities({
5406
- amount: bn20(fee),
5386
+ amount: bn19(fee),
5407
5387
  assetId: baseAssetId,
5408
5388
  coinQuantities: requiredQuantities
5409
5389
  });
@@ -5411,7 +5391,7 @@ var Account = class extends AbstractAccount {
5411
5391
  requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
5412
5392
  quantitiesDict[assetId] = {
5413
5393
  required: amount,
5414
- owned: bn20(0)
5394
+ owned: bn19(0)
5415
5395
  };
5416
5396
  });
5417
5397
  request.inputs.filter(isRequestInputResource).forEach((input) => {
@@ -5438,7 +5418,6 @@ var Account = class extends AbstractAccount {
5438
5418
  cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
5439
5419
  );
5440
5420
  request.addResources(resources);
5441
- request.shiftPredicateData();
5442
5421
  request.updatePredicateGasUsed(estimatedPredicates);
5443
5422
  const requestToReestimate2 = clone4(request);
5444
5423
  if (addedSignatures) {
@@ -5470,7 +5449,6 @@ var Account = class extends AbstractAccount {
5470
5449
  }
5471
5450
  fundingAttempts += 1;
5472
5451
  }
5473
- request.shiftPredicateData();
5474
5452
  request.updatePredicateGasUsed(estimatedPredicates);
5475
5453
  const requestToReestimate = clone4(request);
5476
5454
  if (addedSignatures) {
@@ -5521,7 +5499,7 @@ var Account = class extends AbstractAccount {
5521
5499
  * @returns A promise that resolves to the transaction response.
5522
5500
  */
5523
5501
  async transfer(destination, amount, assetId, txParams = {}) {
5524
- if (bn20(amount).lte(0)) {
5502
+ if (bn19(amount).lte(0)) {
5525
5503
  throw new FuelError15(
5526
5504
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5527
5505
  "Transfer amount must be a positive number."
@@ -5541,7 +5519,7 @@ var Account = class extends AbstractAccount {
5541
5519
  * @returns A promise that resolves to the transaction response.
5542
5520
  */
5543
5521
  async transferToContract(contractId, amount, assetId, txParams = {}) {
5544
- if (bn20(amount).lte(0)) {
5522
+ if (bn19(amount).lte(0)) {
5545
5523
  throw new FuelError15(
5546
5524
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5547
5525
  "Transfer amount must be a positive number."
@@ -5551,7 +5529,7 @@ var Account = class extends AbstractAccount {
5551
5529
  const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5552
5530
  const { script, scriptData } = await assembleTransferToContractScript({
5553
5531
  hexlifiedContractId: contractAddress.toB256(),
5554
- amountToTransfer: bn20(amount),
5532
+ amountToTransfer: bn19(amount),
5555
5533
  assetId: assetIdToTransfer
5556
5534
  });
5557
5535
  let request = new ScriptTransactionRequest({
@@ -5562,7 +5540,7 @@ var Account = class extends AbstractAccount {
5562
5540
  request.addContractInputAndOutput(contractAddress);
5563
5541
  const txCost = await this.provider.getTransactionCost(request, {
5564
5542
  resourcesOwner: this,
5565
- quantitiesToContract: [{ amount: bn20(amount), assetId: String(assetIdToTransfer) }]
5543
+ quantitiesToContract: [{ amount: bn19(amount), assetId: String(assetIdToTransfer) }]
5566
5544
  });
5567
5545
  request = this.validateGasLimitAndMaxFee({
5568
5546
  transactionRequest: request,
@@ -5587,7 +5565,7 @@ var Account = class extends AbstractAccount {
5587
5565
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5588
5566
  );
5589
5567
  const amountDataArray = arrayify14(
5590
- "0x".concat(bn20(amount).toHex().substring(2).padStart(16, "0"))
5568
+ "0x".concat(bn19(amount).toHex().substring(2).padStart(16, "0"))
5591
5569
  );
5592
5570
  const script = new Uint8Array([
5593
5571
  ...arrayify14(withdrawScript.bytes),
@@ -5597,7 +5575,7 @@ var Account = class extends AbstractAccount {
5597
5575
  const params = { script, ...txParams };
5598
5576
  const baseAssetId = this.provider.getBaseAssetId();
5599
5577
  let request = new ScriptTransactionRequest(params);
5600
- const quantitiesToContract = [{ amount: bn20(amount), assetId: baseAssetId }];
5578
+ const quantitiesToContract = [{ amount: bn19(amount), assetId: baseAssetId }];
5601
5579
  const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
5602
5580
  request = this.validateGasLimitAndMaxFee({
5603
5581
  transactionRequest: request,
@@ -6018,7 +5996,7 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
6018
5996
  import { computeHmac as computeHmac2, ripemd160 } from "@fuel-ts/crypto";
6019
5997
  import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
6020
5998
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
6021
- import { bn as bn21, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5999
+ import { bn as bn20, toBytes as toBytes2, toHex } from "@fuel-ts/math";
6022
6000
  import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
6023
6001
 
6024
6002
  // src/mnemonic/mnemonic.ts
@@ -8488,7 +8466,7 @@ var HDWallet = class {
8488
8466
  const IR = bytes.slice(32);
8489
8467
  if (privateKey) {
8490
8468
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
8491
- const ki = bn21(IL).add(privateKey).mod(N).toBytes(32);
8469
+ const ki = bn20(IL).add(privateKey).mod(N).toBytes(32);
8492
8470
  return new HDWallet({
8493
8471
  privateKey: ki,
8494
8472
  chainCode: IR,
@@ -9167,16 +9145,9 @@ var StorageAbstract = class {
9167
9145
  };
9168
9146
 
9169
9147
  // src/predicate/predicate.ts
9170
- import {
9171
- Interface as Interface4,
9172
- INPUT_COIN_FIXED_SIZE,
9173
- WORD_SIZE,
9174
- calculateVmTxMemory as calculateVmTxMemory2,
9175
- SCRIPT_FIXED_SIZE
9176
- } from "@fuel-ts/abi-coder";
9148
+ import { Interface as Interface4 } from "@fuel-ts/abi-coder";
9177
9149
  import { Address as Address9 } from "@fuel-ts/address";
9178
9150
  import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
9179
- import { ByteArrayCoder } from "@fuel-ts/transactions";
9180
9151
  import { arrayify as arrayify20, hexlify as hexlify19 } from "@fuel-ts/utils";
9181
9152
 
9182
9153
  // src/predicate/utils/getPredicateRoot.ts
@@ -9234,7 +9205,6 @@ var Predicate = class extends Account {
9234
9205
  */
9235
9206
  populateTransactionPredicateData(transactionRequestLike) {
9236
9207
  const request = transactionRequestify(transactionRequestLike);
9237
- const { policies } = BaseTransactionRequest.getPolicyMeta(request);
9238
9208
  const placeholderIndex = this.getIndexFromPlaceholderWitness(request);
9239
9209
  if (placeholderIndex !== -1) {
9240
9210
  request.removeWitness(placeholderIndex);
@@ -9242,7 +9212,7 @@ var Predicate = class extends Account {
9242
9212
  request.inputs.filter(isRequestInputResource).forEach((input) => {
9243
9213
  if (isRequestInputResourceFromOwner(input, this.address)) {
9244
9214
  input.predicate = hexlify19(this.bytes);
9245
- input.predicateData = hexlify19(this.getPredicateData(policies.length));
9215
+ input.predicateData = hexlify19(this.getPredicateData());
9246
9216
  input.witnessIndex = 0;
9247
9217
  }
9248
9218
  });
@@ -9268,17 +9238,12 @@ var Predicate = class extends Account {
9268
9238
  const transactionRequest = transactionRequestify(transactionRequestLike);
9269
9239
  return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
9270
9240
  }
9271
- getPredicateData(policiesLength) {
9241
+ getPredicateData() {
9272
9242
  if (!this.predicateData.length) {
9273
9243
  return new Uint8Array();
9274
9244
  }
9275
9245
  const mainFn = this.interface?.functions.main;
9276
- const paddedCode = new ByteArrayCoder(this.bytes.length).encode(this.bytes);
9277
- const VM_TX_MEMORY = calculateVmTxMemory2({
9278
- maxInputs: this.provider.getChain().consensusParameters.txParameters.maxInputs.toNumber()
9279
- });
9280
- const OFFSET = VM_TX_MEMORY + SCRIPT_FIXED_SIZE + INPUT_COIN_FIXED_SIZE + WORD_SIZE + paddedCode.byteLength + policiesLength * WORD_SIZE;
9281
- return mainFn?.encodeArguments(this.predicateData, OFFSET) || new Uint8Array();
9246
+ return mainFn?.encodeArguments(this.predicateData) || new Uint8Array();
9282
9247
  }
9283
9248
  /**
9284
9249
  * Processes the predicate data and returns the altered bytecode and interface.
@@ -9327,8 +9292,7 @@ var Predicate = class extends Account {
9327
9292
  );
9328
9293
  return resources.map((resource) => ({
9329
9294
  ...resource,
9330
- predicate: hexlify19(this.bytes),
9331
- padPredicateData: (policiesLength) => hexlify19(this.getPredicateData(policiesLength))
9295
+ predicate: hexlify19(this.bytes)
9332
9296
  }));
9333
9297
  }
9334
9298
  /**