@fuel-ts/account 0.83.0 → 0.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (54) hide show
  1. package/README.md +15 -12
  2. package/dist/account.d.ts +1 -1
  3. package/dist/account.d.ts.map +1 -1
  4. package/dist/index.global.js +1624 -1619
  5. package/dist/index.global.js.map +1 -1
  6. package/dist/index.js +365 -207
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +346 -190
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/providers/__generated__/operations.d.ts +203 -80
  11. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  12. package/dist/providers/message.d.ts +2 -2
  13. package/dist/providers/message.d.ts.map +1 -1
  14. package/dist/providers/provider.d.ts +30 -29
  15. package/dist/providers/provider.d.ts.map +1 -1
  16. package/dist/providers/resource.d.ts +0 -1
  17. package/dist/providers/resource.d.ts.map +1 -1
  18. package/dist/providers/transaction-request/helpers.d.ts +8 -0
  19. package/dist/providers/transaction-request/helpers.d.ts.map +1 -0
  20. package/dist/providers/transaction-request/script-transaction-request.d.ts +2 -3
  21. package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
  22. package/dist/providers/transaction-request/transaction-request.d.ts +5 -6
  23. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  24. package/dist/providers/transaction-request/utils.d.ts +2 -1
  25. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  26. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +2 -2
  27. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
  28. package/dist/providers/transaction-summary/calculate-tx-fee-for-summary.d.ts +20 -0
  29. package/dist/providers/transaction-summary/calculate-tx-fee-for-summary.d.ts.map +1 -0
  30. package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
  31. package/dist/providers/transaction-summary/index.d.ts +1 -1
  32. package/dist/providers/transaction-summary/index.d.ts.map +1 -1
  33. package/dist/providers/transaction-summary/operations.d.ts +4 -0
  34. package/dist/providers/transaction-summary/operations.d.ts.map +1 -1
  35. package/dist/providers/transaction-summary/status.d.ts +5 -1
  36. package/dist/providers/transaction-summary/status.d.ts.map +1 -1
  37. package/dist/providers/transaction-summary/types.d.ts +6 -1
  38. package/dist/providers/transaction-summary/types.d.ts.map +1 -1
  39. package/dist/providers/utils/gas.d.ts +7 -6
  40. package/dist/providers/utils/gas.d.ts.map +1 -1
  41. package/dist/test-utils/launchNode.d.ts.map +1 -1
  42. package/dist/test-utils/resources.d.ts +4 -0
  43. package/dist/test-utils/resources.d.ts.map +1 -0
  44. package/dist/test-utils/transactionRequest.d.ts +5 -0
  45. package/dist/test-utils/transactionRequest.d.ts.map +1 -0
  46. package/dist/test-utils.global.js +1628 -1622
  47. package/dist/test-utils.global.js.map +1 -1
  48. package/dist/test-utils.js +342 -196
  49. package/dist/test-utils.js.map +1 -1
  50. package/dist/test-utils.mjs +327 -181
  51. package/dist/test-utils.mjs.map +1 -1
  52. package/package.json +17 -17
  53. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +0 -22
  54. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +0 -1
package/dist/index.mjs CHANGED
@@ -31,8 +31,8 @@ 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 bn18 } from "@fuel-ts/math";
35
- import { arrayify as arrayify14, isDefined } from "@fuel-ts/utils";
34
+ import { bn as bn20 } from "@fuel-ts/math";
35
+ import { arrayify as arrayify14, isDefined as isDefined2 } from "@fuel-ts/utils";
36
36
  import { clone as clone4 } from "ramda";
37
37
 
38
38
  // src/providers/coin-quantity.ts
@@ -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 bn16 } 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,
@@ -83,7 +83,6 @@ import {
83
83
  import { arrayify as arrayify11, hexlify as hexlify12, DateTime as DateTime2 } from "@fuel-ts/utils";
84
84
  import { checkFuelCoreVersionCompatibility } from "@fuel-ts/versions";
85
85
  import { equalBytes } from "@noble/curves/abstract/utils";
86
- import { Network } from "ethers";
87
86
  import { GraphQLClient } from "graphql-request";
88
87
  import { clone as clone3 } from "ramda";
89
88
 
@@ -140,9 +139,6 @@ var TransactionStatusFragmentFragmentDoc = gql`
140
139
  id
141
140
  }
142
141
  time
143
- receipts {
144
- ...receiptFragment
145
- }
146
142
  programState {
147
143
  returnType
148
144
  data
@@ -150,11 +146,15 @@ var TransactionStatusFragmentFragmentDoc = gql`
150
146
  receipts {
151
147
  ...receiptFragment
152
148
  }
149
+ totalGas
150
+ totalFee
153
151
  }
154
152
  ... on FailureStatus {
155
153
  block {
156
154
  id
157
155
  }
156
+ totalGas
157
+ totalFee
158
158
  time
159
159
  reason
160
160
  receipts {
@@ -194,6 +194,8 @@ var TransactionEstimatePredicatesFragmentFragmentDoc = gql`
194
194
  ${InputEstimatePredicatesFragmentFragmentDoc}`;
195
195
  var DryRunFailureStatusFragmentFragmentDoc = gql`
196
196
  fragment dryRunFailureStatusFragment on DryRunFailureStatus {
197
+ totalGas
198
+ totalFee
197
199
  reason
198
200
  programState {
199
201
  returnType
@@ -203,6 +205,8 @@ var DryRunFailureStatusFragmentFragmentDoc = gql`
203
205
  `;
204
206
  var DryRunSuccessStatusFragmentFragmentDoc = gql`
205
207
  fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
208
+ totalGas
209
+ totalFee
206
210
  programState {
207
211
  returnType
208
212
  data
@@ -338,6 +342,7 @@ var TxParametersFragmentFragmentDoc = gql`
338
342
  maxWitnesses
339
343
  maxGasPerTx
340
344
  maxSize
345
+ maxBytecodeSubsections
341
346
  }
342
347
  `;
343
348
  var PredicateParametersFragmentFragmentDoc = gql`
@@ -607,6 +612,14 @@ var NodeInfoFragmentFragmentDoc = gql`
607
612
  nodeVersion
608
613
  }
609
614
  `;
615
+ var RelayedTransactionStatusFragmentFragmentDoc = gql`
616
+ fragment relayedTransactionStatusFragment on RelayedTransactionStatus {
617
+ ... on RelayedTransactionFailed {
618
+ blockHeight
619
+ failure
620
+ }
621
+ }
622
+ `;
610
623
  var GetVersionDocument = gql`
611
624
  query getVersion {
612
625
  nodeInfo {
@@ -836,6 +849,13 @@ var GetMessageStatusDocument = gql`
836
849
  }
837
850
  }
838
851
  `;
852
+ var GetRelayedTransactionStatusDocument = gql`
853
+ query getRelayedTransactionStatus($relayedTransactionId: RelayedTransactionId!) {
854
+ relayedTransactionStatus(id: $relayedTransactionId) {
855
+ ...relayedTransactionStatusFragment
856
+ }
857
+ }
858
+ ${RelayedTransactionStatusFragmentFragmentDoc}`;
839
859
  var DryRunDocument = gql`
840
860
  mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
841
861
  dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
@@ -858,6 +878,13 @@ var ProduceBlocksDocument = gql`
858
878
  )
859
879
  }
860
880
  `;
881
+ var GetMessageByNonceDocument = gql`
882
+ query getMessageByNonce($nonce: Nonce!) {
883
+ message(nonce: $nonce) {
884
+ ...messageFragment
885
+ }
886
+ }
887
+ ${MessageFragmentFragmentDoc}`;
861
888
  var SubmitAndAwaitDocument = gql`
862
889
  subscription submitAndAwait($encodedTransaction: HexString!) {
863
890
  submitAndAwait(tx: $encodedTransaction) {
@@ -943,6 +970,9 @@ function getSdk(requester) {
943
970
  getMessageStatus(variables, options) {
944
971
  return requester(GetMessageStatusDocument, variables, options);
945
972
  },
973
+ getRelayedTransactionStatus(variables, options) {
974
+ return requester(GetRelayedTransactionStatusDocument, variables, options);
975
+ },
946
976
  dryRun(variables, options) {
947
977
  return requester(DryRunDocument, variables, options);
948
978
  },
@@ -952,6 +982,9 @@ function getSdk(requester) {
952
982
  produceBlocks(variables, options) {
953
983
  return requester(ProduceBlocksDocument, variables, options);
954
984
  },
985
+ getMessageByNonce(variables, options) {
986
+ return requester(GetMessageByNonceDocument, variables, options);
987
+ },
955
988
  submitAndAwait(variables, options) {
956
989
  return requester(SubmitAndAwaitDocument, variables, options);
957
990
  },
@@ -1244,7 +1277,7 @@ import {
1244
1277
  OutputType as OutputType2,
1245
1278
  TransactionType
1246
1279
  } from "@fuel-ts/transactions";
1247
- import { concat, hexlify as hexlify7 } from "@fuel-ts/utils";
1280
+ import { concat, hexlify as hexlify7, isDefined } from "@fuel-ts/utils";
1248
1281
 
1249
1282
  // src/providers/resource.ts
1250
1283
  var isRawCoin = (resource) => "utxoId" in resource;
@@ -1619,7 +1652,7 @@ function calculateMetadataGasForTxScript({
1619
1652
  }
1620
1653
  var calculateGasFee = (params) => {
1621
1654
  const { gas, gasPrice, priceFactor, tip } = params;
1622
- return gas.mul(gasPrice).div(priceFactor).add(tip);
1655
+ return gas.mul(gasPrice).div(priceFactor).add(bn5(tip));
1623
1656
  };
1624
1657
 
1625
1658
  // src/providers/utils/json.ts
@@ -1804,10 +1837,10 @@ var BaseTransactionRequest = class {
1804
1837
  outputs,
1805
1838
  witnesses
1806
1839
  } = {}) {
1807
- this.tip = bn7(tip);
1808
- this.maturity = maturity ?? 0;
1809
- this.witnessLimit = witnessLimit ? bn7(witnessLimit) : void 0;
1810
- this.maxFee = maxFee ? bn7(maxFee) : void 0;
1840
+ this.tip = tip ? bn7(tip) : void 0;
1841
+ this.maturity = maturity && maturity > 0 ? maturity : void 0;
1842
+ this.witnessLimit = isDefined(witnessLimit) ? bn7(witnessLimit) : void 0;
1843
+ this.maxFee = bn7(maxFee);
1811
1844
  this.inputs = inputs ?? [];
1812
1845
  this.outputs = outputs ?? [];
1813
1846
  this.witnesses = witnesses ?? [];
@@ -1815,22 +1848,21 @@ var BaseTransactionRequest = class {
1815
1848
  static getPolicyMeta(req) {
1816
1849
  let policyTypes = 0;
1817
1850
  const policies = [];
1818
- if (req.tip) {
1851
+ const { tip, witnessLimit, maturity } = req;
1852
+ if (bn7(tip).gt(0)) {
1819
1853
  policyTypes += PolicyType.Tip;
1820
- policies.push({ data: req.tip, type: PolicyType.Tip });
1854
+ policies.push({ data: bn7(tip), type: PolicyType.Tip });
1821
1855
  }
1822
- if (req.witnessLimit) {
1856
+ if (isDefined(witnessLimit) && bn7(witnessLimit).gte(0)) {
1823
1857
  policyTypes += PolicyType.WitnessLimit;
1824
- policies.push({ data: req.witnessLimit, type: PolicyType.WitnessLimit });
1858
+ policies.push({ data: bn7(witnessLimit), type: PolicyType.WitnessLimit });
1825
1859
  }
1826
- if (req.maturity > 0) {
1860
+ if (maturity && maturity > 0) {
1827
1861
  policyTypes += PolicyType.Maturity;
1828
- policies.push({ data: req.maturity, type: PolicyType.Maturity });
1829
- }
1830
- if (req.maxFee) {
1831
- policyTypes += PolicyType.MaxFee;
1832
- policies.push({ data: req.maxFee, type: PolicyType.MaxFee });
1862
+ policies.push({ data: maturity, type: PolicyType.Maturity });
1833
1863
  }
1864
+ policyTypes += PolicyType.MaxFee;
1865
+ policies.push({ data: req.maxFee, type: PolicyType.MaxFee });
1834
1866
  return {
1835
1867
  policyTypes,
1836
1868
  policies
@@ -2146,8 +2178,11 @@ var BaseTransactionRequest = class {
2146
2178
  * @hidden
2147
2179
  */
2148
2180
  calculateMinGas(chainInfo) {
2149
- const { gasCosts, consensusParameters } = chainInfo;
2150
- const { gasPerByte } = consensusParameters;
2181
+ const { consensusParameters } = chainInfo;
2182
+ const {
2183
+ gasCosts,
2184
+ feeParameters: { gasPerByte }
2185
+ } = consensusParameters;
2151
2186
  return getMinGas({
2152
2187
  gasPerByte,
2153
2188
  gasCosts,
@@ -2158,7 +2193,10 @@ var BaseTransactionRequest = class {
2158
2193
  }
2159
2194
  calculateMaxGas(chainInfo, minGas) {
2160
2195
  const { consensusParameters } = chainInfo;
2161
- const { gasPerByte, maxGasPerTx } = consensusParameters;
2196
+ const {
2197
+ feeParameters: { gasPerByte },
2198
+ txParameters: { maxGasPerTx }
2199
+ } = consensusParameters;
2162
2200
  const witnessesLength = this.toTransaction().witnesses.reduce(
2163
2201
  (acc, wit) => acc + wit.dataLength,
2164
2202
  0
@@ -2593,7 +2631,10 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2593
2631
  }
2594
2632
  calculateMaxGas(chainInfo, minGas) {
2595
2633
  const { consensusParameters } = chainInfo;
2596
- const { gasPerByte, maxGasPerTx } = consensusParameters;
2634
+ const {
2635
+ feeParameters: { gasPerByte },
2636
+ txParameters: { maxGasPerTx }
2637
+ } = consensusParameters;
2597
2638
  const witnessesLength = this.toTransaction().witnesses.reduce(
2598
2639
  (acc, wit) => acc + wit.dataLength,
2599
2640
  0
@@ -2681,10 +2722,10 @@ var transactionRequestify = (obj) => {
2681
2722
  };
2682
2723
  var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
2683
2724
  (acc, input) => {
2684
- if (input.type === InputType5.Coin && input.owner === owner) {
2725
+ if (input.type === InputType5.Coin && input.owner === owner.toB256()) {
2685
2726
  acc.utxos.push(input.id);
2686
2727
  }
2687
- if (input.type === InputType5.Message && input.recipient === owner) {
2728
+ if (input.type === InputType5.Message && input.recipient === owner.toB256()) {
2688
2729
  acc.messages.push(input.nonce);
2689
2730
  }
2690
2731
  return acc;
@@ -2697,40 +2738,40 @@ var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
2697
2738
 
2698
2739
  // src/providers/transaction-response/transaction-response.ts
2699
2740
  import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
2700
- import { bn as bn15 } from "@fuel-ts/math";
2741
+ import { bn as bn16 } from "@fuel-ts/math";
2701
2742
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2702
2743
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
2703
2744
 
2704
2745
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2705
- import { bn as bn14 } from "@fuel-ts/math";
2746
+ import { bn as bn15 } from "@fuel-ts/math";
2706
2747
  import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
2707
2748
  import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2708
2749
 
2709
- // src/providers/transaction-summary/calculate-transaction-fee.ts
2750
+ // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
2710
2751
  import { bn as bn11 } from "@fuel-ts/math";
2711
2752
  import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType6 } from "@fuel-ts/transactions";
2712
2753
  import { arrayify as arrayify9 } from "@fuel-ts/utils";
2713
- var calculateTransactionFee = (params) => {
2754
+ var calculateTXFeeForSummary = (params) => {
2714
2755
  const {
2715
2756
  gasPrice,
2716
2757
  rawPayload,
2717
2758
  tip,
2759
+ totalFee,
2718
2760
  consensusParameters: { gasCosts, feeParams, maxGasPerTx }
2719
2761
  } = params;
2762
+ if (totalFee) {
2763
+ return totalFee;
2764
+ }
2720
2765
  const gasPerByte = bn11(feeParams.gasPerByte);
2721
2766
  const gasPriceFactor = bn11(feeParams.gasPriceFactor);
2722
2767
  const transactionBytes = arrayify9(rawPayload);
2723
2768
  const [transaction] = new TransactionCoder3().decode(transactionBytes, 0);
2724
- if (transaction.type === TransactionType6.Mint) {
2725
- return {
2726
- fee: bn11(0),
2727
- minFee: bn11(0),
2728
- maxFee: bn11(0)
2729
- };
2730
- }
2731
2769
  const { type, witnesses, inputs, policies } = transaction;
2732
2770
  let metadataGas = bn11(0);
2733
2771
  let gasLimit = bn11(0);
2772
+ if (type !== TransactionType6.Create && type !== TransactionType6.Script) {
2773
+ return bn11(0);
2774
+ }
2734
2775
  if (type === TransactionType6.Create) {
2735
2776
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2736
2777
  const contractBytesSize = bn11(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
@@ -2767,23 +2808,13 @@ var calculateTransactionFee = (params) => {
2767
2808
  witnessLimit,
2768
2809
  maxGasPerTx
2769
2810
  });
2770
- const minFee = calculateGasFee({
2771
- gasPrice,
2772
- gas: minGas,
2773
- priceFactor: gasPriceFactor,
2774
- tip
2775
- });
2776
2811
  const maxFee = calculateGasFee({
2777
2812
  gasPrice,
2778
2813
  gas: maxGas,
2779
2814
  priceFactor: gasPriceFactor,
2780
2815
  tip
2781
2816
  });
2782
- return {
2783
- minFee,
2784
- maxFee,
2785
- fee: maxFee
2786
- };
2817
+ return maxFee;
2787
2818
  };
2788
2819
 
2789
2820
  // src/providers/transaction-summary/operations.ts
@@ -2918,6 +2949,8 @@ var TransactionTypeName = /* @__PURE__ */ ((TransactionTypeName2) => {
2918
2949
  TransactionTypeName2["Create"] = "Create";
2919
2950
  TransactionTypeName2["Mint"] = "Mint";
2920
2951
  TransactionTypeName2["Script"] = "Script";
2952
+ TransactionTypeName2["Upgrade"] = "Upgrade";
2953
+ TransactionTypeName2["Upload"] = "Upload";
2921
2954
  return TransactionTypeName2;
2922
2955
  })(TransactionTypeName || {});
2923
2956
  var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
@@ -2983,6 +3016,12 @@ function isTypeCreate(transactionType) {
2983
3016
  function isTypeScript(transactionType) {
2984
3017
  return isType(transactionType, "Script" /* Script */);
2985
3018
  }
3019
+ function isTypeUpgrade(transactionType) {
3020
+ return isType(transactionType, "Upgrade" /* Upgrade */);
3021
+ }
3022
+ function isTypeUpload(transactionType) {
3023
+ return isType(transactionType, "Upload" /* Upload */);
3024
+ }
2986
3025
  function hasSameAssetId(a) {
2987
3026
  return (b) => a.assetId === b.assetId;
2988
3027
  }
@@ -3329,6 +3368,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3329
3368
 
3330
3369
  // src/providers/transaction-summary/status.ts
3331
3370
  import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
3371
+ import { bn as bn14 } from "@fuel-ts/math";
3332
3372
  var getTransactionStatusName = (gqlStatus) => {
3333
3373
  switch (gqlStatus) {
3334
3374
  case "FailureStatus":
@@ -3350,6 +3390,8 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3350
3390
  let time;
3351
3391
  let blockId;
3352
3392
  let status;
3393
+ let totalFee;
3394
+ let totalGas;
3353
3395
  let isStatusFailure = false;
3354
3396
  let isStatusSuccess = false;
3355
3397
  let isStatusPending = false;
@@ -3360,11 +3402,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3360
3402
  time = gqlTransactionStatus.time;
3361
3403
  blockId = gqlTransactionStatus.block.id;
3362
3404
  isStatusSuccess = true;
3405
+ totalFee = bn14(gqlTransactionStatus.totalFee);
3406
+ totalGas = bn14(gqlTransactionStatus.totalGas);
3363
3407
  break;
3364
3408
  case "FailureStatus":
3365
3409
  time = gqlTransactionStatus.time;
3366
3410
  blockId = gqlTransactionStatus.block.id;
3367
3411
  isStatusFailure = true;
3412
+ totalFee = bn14(gqlTransactionStatus.totalFee);
3413
+ totalGas = bn14(gqlTransactionStatus.totalGas);
3368
3414
  break;
3369
3415
  case "SubmittedStatus":
3370
3416
  time = gqlTransactionStatus.time;
@@ -3377,6 +3423,8 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3377
3423
  time,
3378
3424
  blockId,
3379
3425
  status,
3426
+ totalFee,
3427
+ totalGas,
3380
3428
  isStatusFailure,
3381
3429
  isStatusSuccess,
3382
3430
  isStatusPending
@@ -3412,8 +3460,10 @@ function assembleTransactionSummary(params) {
3412
3460
  maxInputs
3413
3461
  });
3414
3462
  const typeName = getTransactionTypeName(transaction.type);
3415
- const tip = bn14(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3416
- const { fee } = calculateTransactionFee({
3463
+ const tip = bn15(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3464
+ const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3465
+ const fee = calculateTXFeeForSummary({
3466
+ totalFee,
3417
3467
  gasPrice,
3418
3468
  rawPayload,
3419
3469
  tip,
@@ -3426,7 +3476,6 @@ function assembleTransactionSummary(params) {
3426
3476
  }
3427
3477
  }
3428
3478
  });
3429
- const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time } = processGraphqlStatus(gqlTransactionStatus);
3430
3479
  const mintedAssets = extractMintedAssetsFromReceipts(receipts);
3431
3480
  const burnedAssets = extractBurnedAssetsFromReceipts(receipts);
3432
3481
  let date;
@@ -3435,6 +3484,7 @@ function assembleTransactionSummary(params) {
3435
3484
  }
3436
3485
  const transactionSummary = {
3437
3486
  id,
3487
+ tip,
3438
3488
  fee,
3439
3489
  gasUsed,
3440
3490
  operations,
@@ -3448,6 +3498,8 @@ function assembleTransactionSummary(params) {
3448
3498
  isTypeMint: isTypeMint(transaction.type),
3449
3499
  isTypeCreate: isTypeCreate(transaction.type),
3450
3500
  isTypeScript: isTypeScript(transaction.type),
3501
+ isTypeUpgrade: isTypeUpgrade(transaction.type),
3502
+ isTypeUpload: isTypeUpload(transaction.type),
3451
3503
  isStatusFailure,
3452
3504
  isStatusSuccess,
3453
3505
  isStatusPending,
@@ -3479,7 +3531,7 @@ var TransactionResponse = class {
3479
3531
  /** Current provider */
3480
3532
  provider;
3481
3533
  /** Gas used on the transaction */
3482
- gasUsed = bn15(0);
3534
+ gasUsed = bn16(0);
3483
3535
  /** The graphql Transaction with receipts object. */
3484
3536
  gqlTransaction;
3485
3537
  abis;
@@ -3564,7 +3616,7 @@ var TransactionResponse = class {
3564
3616
  const receipts = txReceipts.map(processGqlReceipt) || [];
3565
3617
  const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
3566
3618
  const gasPrice = await this.provider.getLatestGasPrice();
3567
- const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
3619
+ const maxInputs = this.provider.getChain().consensusParameters.txParameters.maxInputs;
3568
3620
  const transactionSummary = assembleTransactionSummary({
3569
3621
  id: this.id,
3570
3622
  receipts,
@@ -3700,33 +3752,60 @@ var mergeQuantities = (...coinQuantities) => {
3700
3752
  var MAX_RETRIES = 10;
3701
3753
  var processGqlChain = (chain) => {
3702
3754
  const { name, daHeight, consensusParameters, latestBlock } = chain;
3703
- const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } = consensusParameters;
3755
+ const {
3756
+ contractParams,
3757
+ feeParams,
3758
+ predicateParams,
3759
+ scriptParams,
3760
+ txParams,
3761
+ gasCosts,
3762
+ baseAssetId,
3763
+ chainId,
3764
+ version
3765
+ } = consensusParameters;
3704
3766
  return {
3705
3767
  name,
3706
- baseChainHeight: bn16(daHeight),
3768
+ baseChainHeight: bn17(daHeight),
3707
3769
  consensusParameters: {
3708
- contractMaxSize: bn16(contractParams.contractMaxSize),
3709
- maxInputs: bn16(txParams.maxInputs),
3710
- maxOutputs: bn16(txParams.maxOutputs),
3711
- maxWitnesses: bn16(txParams.maxWitnesses),
3712
- maxGasPerTx: bn16(txParams.maxGasPerTx),
3713
- maxScriptLength: bn16(scriptParams.maxScriptLength),
3714
- maxScriptDataLength: bn16(scriptParams.maxScriptDataLength),
3715
- maxStorageSlots: bn16(contractParams.maxStorageSlots),
3716
- maxPredicateLength: bn16(predicateParams.maxPredicateLength),
3717
- maxPredicateDataLength: bn16(predicateParams.maxPredicateDataLength),
3718
- maxGasPerPredicate: bn16(predicateParams.maxGasPerPredicate),
3719
- gasPriceFactor: bn16(feeParams.gasPriceFactor),
3720
- gasPerByte: bn16(feeParams.gasPerByte),
3721
- maxMessageDataLength: bn16(predicateParams.maxMessageDataLength),
3722
- chainId: bn16(consensusParameters.chainId),
3723
- baseAssetId: consensusParameters.baseAssetId,
3770
+ version,
3771
+ chainId: bn17(chainId),
3772
+ baseAssetId,
3773
+ feeParameters: {
3774
+ version: feeParams.version,
3775
+ gasPerByte: bn17(feeParams.gasPerByte),
3776
+ gasPriceFactor: bn17(feeParams.gasPriceFactor)
3777
+ },
3778
+ contractParameters: {
3779
+ version: contractParams.version,
3780
+ contractMaxSize: bn17(contractParams.contractMaxSize),
3781
+ maxStorageSlots: bn17(contractParams.maxStorageSlots)
3782
+ },
3783
+ txParameters: {
3784
+ version: txParams.version,
3785
+ maxInputs: bn17(txParams.maxInputs),
3786
+ maxOutputs: bn17(txParams.maxOutputs),
3787
+ maxWitnesses: bn17(txParams.maxWitnesses),
3788
+ maxGasPerTx: bn17(txParams.maxGasPerTx),
3789
+ maxSize: bn17(txParams.maxSize),
3790
+ maxBytecodeSubsections: bn17(txParams.maxBytecodeSubsections)
3791
+ },
3792
+ predicateParameters: {
3793
+ version: predicateParams.version,
3794
+ maxPredicateLength: bn17(predicateParams.maxPredicateLength),
3795
+ maxPredicateDataLength: bn17(predicateParams.maxPredicateDataLength),
3796
+ maxGasPerPredicate: bn17(predicateParams.maxGasPerPredicate),
3797
+ maxMessageDataLength: bn17(predicateParams.maxMessageDataLength)
3798
+ },
3799
+ scriptParameters: {
3800
+ version: scriptParams.version,
3801
+ maxScriptLength: bn17(scriptParams.maxScriptLength),
3802
+ maxScriptDataLength: bn17(scriptParams.maxScriptDataLength)
3803
+ },
3724
3804
  gasCosts
3725
3805
  },
3726
- gasCosts,
3727
3806
  latestBlock: {
3728
3807
  id: latestBlock.id,
3729
- height: bn16(latestBlock.height),
3808
+ height: bn17(latestBlock.height),
3730
3809
  time: latestBlock.header.time,
3731
3810
  transactions: latestBlock.transactions.map((i) => ({
3732
3811
  id: i.id
@@ -3820,7 +3899,12 @@ var _Provider = class {
3820
3899
  * Returns some helpful parameters related to gas fees.
3821
3900
  */
3822
3901
  getGasConfig() {
3823
- const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
3902
+ const {
3903
+ txParameters: { maxGasPerTx },
3904
+ predicateParameters: { maxGasPerPredicate },
3905
+ feeParameters: { gasPriceFactor, gasPerByte },
3906
+ gasCosts
3907
+ } = this.getChain().consensusParameters;
3824
3908
  return {
3825
3909
  maxGasPerTx,
3826
3910
  maxGasPerPredicate,
@@ -3869,7 +3953,18 @@ var _Provider = class {
3869
3953
  createOperations() {
3870
3954
  const fetchFn = _Provider.getFetchFn(this.options);
3871
3955
  const gqlClient = new GraphQLClient(this.url, {
3872
- fetch: (url, requestInit) => fetchFn(url, requestInit, this.options)
3956
+ fetch: (url, requestInit) => fetchFn(url, requestInit, this.options),
3957
+ responseMiddleware: (response) => {
3958
+ if ("response" in response) {
3959
+ const graphQlResponse = response.response;
3960
+ if (Array.isArray(graphQlResponse?.errors)) {
3961
+ throw new FuelError13(
3962
+ FuelError13.CODES.INVALID_REQUEST,
3963
+ graphQlResponse.errors.map((err) => err.message).join("\n\n")
3964
+ );
3965
+ }
3966
+ }
3967
+ }
3873
3968
  });
3874
3969
  const executeQuery = (query, vars) => {
3875
3970
  const opDefinition = query.definitions.find((x) => x.kind === "OperationDefinition");
@@ -3897,21 +3992,6 @@ var _Provider = class {
3897
3992
  } = await this.operations.getVersion();
3898
3993
  return nodeVersion;
3899
3994
  }
3900
- /**
3901
- * @hidden
3902
- *
3903
- * Returns the network configuration of the connected Fuel node.
3904
- *
3905
- * @returns A promise that resolves to the network configuration object
3906
- */
3907
- async getNetwork() {
3908
- const {
3909
- name,
3910
- consensusParameters: { chainId }
3911
- } = await this.getChain();
3912
- const network = new Network(name, chainId.toNumber());
3913
- return Promise.resolve(network);
3914
- }
3915
3995
  /**
3916
3996
  * Returns the block number.
3917
3997
  *
@@ -3919,7 +3999,7 @@ var _Provider = class {
3919
3999
  */
3920
4000
  async getBlockNumber() {
3921
4001
  const { chain } = await this.operations.getChain();
3922
- return bn16(chain.latestBlock.height, 10);
4002
+ return bn17(chain.latestBlock.height, 10);
3923
4003
  }
3924
4004
  /**
3925
4005
  * Returns the chain information.
@@ -3929,8 +4009,8 @@ var _Provider = class {
3929
4009
  async fetchNode() {
3930
4010
  const { nodeInfo } = await this.operations.getNodeInfo();
3931
4011
  const processedNodeInfo = {
3932
- maxDepth: bn16(nodeInfo.maxDepth),
3933
- maxTx: bn16(nodeInfo.maxTx),
4012
+ maxDepth: bn17(nodeInfo.maxDepth),
4013
+ maxTx: bn17(nodeInfo.maxTx),
3934
4014
  nodeVersion: nodeInfo.nodeVersion,
3935
4015
  utxoValidation: nodeInfo.utxoValidation,
3936
4016
  vmBacktrace: nodeInfo.vmBacktrace
@@ -4034,9 +4114,9 @@ var _Provider = class {
4034
4114
  encodedTransactions: encodedTransaction,
4035
4115
  utxoValidation: utxoValidation || false
4036
4116
  });
4037
- const [{ receipts: rawReceipts, status }] = dryRunStatuses;
4117
+ const [{ receipts: rawReceipts, status: dryRunStatus }] = dryRunStatuses;
4038
4118
  const receipts = rawReceipts.map(processGqlReceipt);
4039
- return { receipts, dryrunStatus: status };
4119
+ return { receipts, dryRunStatus };
4040
4120
  }
4041
4121
  /**
4042
4122
  * Verifies whether enough gas is available to complete transaction.
@@ -4062,7 +4142,7 @@ var _Provider = class {
4062
4142
  } = response;
4063
4143
  if (inputs) {
4064
4144
  inputs.forEach((input, index) => {
4065
- if ("predicateGasUsed" in input && bn16(input.predicateGasUsed).gt(0)) {
4145
+ if ("predicateGasUsed" in input && bn17(input.predicateGasUsed).gt(0)) {
4066
4146
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
4067
4147
  }
4068
4148
  });
@@ -4090,7 +4170,7 @@ var _Provider = class {
4090
4170
  let receipts = [];
4091
4171
  const missingContractIds = [];
4092
4172
  let outputVariables = 0;
4093
- let dryrunStatus;
4173
+ let dryRunStatus;
4094
4174
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
4095
4175
  const {
4096
4176
  dryRun: [{ receipts: rawReceipts, status }]
@@ -4099,7 +4179,7 @@ var _Provider = class {
4099
4179
  utxoValidation: false
4100
4180
  });
4101
4181
  receipts = rawReceipts.map(processGqlReceipt);
4102
- dryrunStatus = status;
4182
+ dryRunStatus = status;
4103
4183
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
4104
4184
  const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
4105
4185
  if (hasMissingOutputs) {
@@ -4121,7 +4201,7 @@ var _Provider = class {
4121
4201
  receipts,
4122
4202
  outputVariables,
4123
4203
  missingContractIds,
4124
- dryrunStatus
4204
+ dryRunStatus
4125
4205
  };
4126
4206
  }
4127
4207
  /**
@@ -4139,7 +4219,7 @@ var _Provider = class {
4139
4219
  receipts: [],
4140
4220
  outputVariables: 0,
4141
4221
  missingContractIds: [],
4142
- dryrunStatus: void 0
4222
+ dryRunStatus: void 0
4143
4223
  }));
4144
4224
  const allRequests = clone3(transactionRequests);
4145
4225
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
@@ -4164,7 +4244,7 @@ var _Provider = class {
4164
4244
  const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
4165
4245
  const result = results[requestIdx];
4166
4246
  result.receipts = rawReceipts.map(processGqlReceipt);
4167
- result.dryrunStatus = status;
4247
+ result.dryRunStatus = status;
4168
4248
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
4169
4249
  result.receipts
4170
4250
  );
@@ -4201,7 +4281,7 @@ var _Provider = class {
4201
4281
  });
4202
4282
  const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
4203
4283
  const receipts = rawReceipts.map(processGqlReceipt);
4204
- return { receipts, dryrunStatus: status };
4284
+ return { receipts, dryRunStatus: status };
4205
4285
  });
4206
4286
  return results;
4207
4287
  }
@@ -4220,12 +4300,12 @@ var _Provider = class {
4220
4300
  gasPrice = await this.estimateGasPrice(10);
4221
4301
  }
4222
4302
  const minFee = calculateGasFee({
4223
- gasPrice: bn16(gasPrice),
4303
+ gasPrice: bn17(gasPrice),
4224
4304
  gas: minGas,
4225
4305
  priceFactor: gasPriceFactor,
4226
4306
  tip: transactionRequest.tip
4227
4307
  }).add(1);
4228
- let gasLimit = bn16(0);
4308
+ let gasLimit = bn17(0);
4229
4309
  if (transactionRequest.type === TransactionType8.Script) {
4230
4310
  gasLimit = transactionRequest.gasLimit;
4231
4311
  if (transactionRequest.gasLimit.eq(0)) {
@@ -4238,7 +4318,7 @@ var _Provider = class {
4238
4318
  }
4239
4319
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4240
4320
  const maxFee = calculateGasFee({
4241
- gasPrice: bn16(gasPrice),
4321
+ gasPrice: bn17(gasPrice),
4242
4322
  gas: maxGas,
4243
4323
  priceFactor: gasPriceFactor,
4244
4324
  tip: transactionRequest.tip
@@ -4301,9 +4381,9 @@ var _Provider = class {
4301
4381
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
4302
4382
  const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
4303
4383
  txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
4304
- txRequestClone.maxFee = bn16(0);
4384
+ txRequestClone.maxFee = bn17(0);
4305
4385
  if (isScriptTransaction) {
4306
- txRequestClone.gasLimit = bn16(0);
4386
+ txRequestClone.gasLimit = bn17(0);
4307
4387
  }
4308
4388
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4309
4389
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -4320,9 +4400,10 @@ var _Provider = class {
4320
4400
  transactionRequest: signedRequest
4321
4401
  });
4322
4402
  let receipts = [];
4403
+ let dryRunStatus;
4323
4404
  let missingContractIds = [];
4324
4405
  let outputVariables = 0;
4325
- let gasUsed = bn16(0);
4406
+ let gasUsed = bn17(0);
4326
4407
  txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
4327
4408
  txRequestClone.maxFee = maxFee;
4328
4409
  if (isScriptTransaction) {
@@ -4330,10 +4411,7 @@ var _Provider = class {
4330
4411
  if (signatureCallback) {
4331
4412
  await signatureCallback(txRequestClone);
4332
4413
  }
4333
- const result = await this.estimateTxDependencies(txRequestClone);
4334
- receipts = result.receipts;
4335
- outputVariables = result.outputVariables;
4336
- missingContractIds = result.missingContractIds;
4414
+ ({ receipts, missingContractIds, outputVariables, dryRunStatus } = await this.estimateTxDependencies(txRequestClone));
4337
4415
  gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
4338
4416
  txRequestClone.gasLimit = gasUsed;
4339
4417
  ({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
@@ -4353,7 +4431,8 @@ var _Provider = class {
4353
4431
  outputVariables,
4354
4432
  missingContractIds,
4355
4433
  addedSignatures,
4356
- estimatedPredicates: txRequestClone.inputs
4434
+ estimatedPredicates: txRequestClone.inputs,
4435
+ dryRunStatus
4357
4436
  };
4358
4437
  }
4359
4438
  async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
@@ -4389,10 +4468,10 @@ var _Provider = class {
4389
4468
  return coins.map((coin) => ({
4390
4469
  id: coin.utxoId,
4391
4470
  assetId: coin.assetId,
4392
- amount: bn16(coin.amount),
4471
+ amount: bn17(coin.amount),
4393
4472
  owner: Address2.fromAddressOrString(coin.owner),
4394
- blockCreated: bn16(coin.blockCreated),
4395
- txCreatedIdx: bn16(coin.txCreatedIdx)
4473
+ blockCreated: bn17(coin.blockCreated),
4474
+ txCreatedIdx: bn17(coin.txCreatedIdx)
4396
4475
  }));
4397
4476
  }
4398
4477
  /**
@@ -4429,9 +4508,9 @@ var _Provider = class {
4429
4508
  switch (coin.__typename) {
4430
4509
  case "MessageCoin":
4431
4510
  return {
4432
- amount: bn16(coin.amount),
4511
+ amount: bn17(coin.amount),
4433
4512
  assetId: coin.assetId,
4434
- daHeight: bn16(coin.daHeight),
4513
+ daHeight: bn17(coin.daHeight),
4435
4514
  sender: Address2.fromAddressOrString(coin.sender),
4436
4515
  recipient: Address2.fromAddressOrString(coin.recipient),
4437
4516
  nonce: coin.nonce
@@ -4439,11 +4518,11 @@ var _Provider = class {
4439
4518
  case "Coin":
4440
4519
  return {
4441
4520
  id: coin.utxoId,
4442
- amount: bn16(coin.amount),
4521
+ amount: bn17(coin.amount),
4443
4522
  assetId: coin.assetId,
4444
4523
  owner: Address2.fromAddressOrString(coin.owner),
4445
- blockCreated: bn16(coin.blockCreated),
4446
- txCreatedIdx: bn16(coin.txCreatedIdx)
4524
+ blockCreated: bn17(coin.blockCreated),
4525
+ txCreatedIdx: bn17(coin.txCreatedIdx)
4447
4526
  };
4448
4527
  default:
4449
4528
  return null;
@@ -4460,13 +4539,13 @@ var _Provider = class {
4460
4539
  async getBlock(idOrHeight) {
4461
4540
  let variables;
4462
4541
  if (typeof idOrHeight === "number") {
4463
- variables = { height: bn16(idOrHeight).toString(10) };
4542
+ variables = { height: bn17(idOrHeight).toString(10) };
4464
4543
  } else if (idOrHeight === "latest") {
4465
4544
  variables = { height: (await this.getBlockNumber()).toString(10) };
4466
4545
  } else if (idOrHeight.length === 66) {
4467
4546
  variables = { blockId: idOrHeight };
4468
4547
  } else {
4469
- variables = { blockId: bn16(idOrHeight).toString(10) };
4548
+ variables = { blockId: bn17(idOrHeight).toString(10) };
4470
4549
  }
4471
4550
  const { block } = await this.operations.getBlock(variables);
4472
4551
  if (!block) {
@@ -4474,7 +4553,7 @@ var _Provider = class {
4474
4553
  }
4475
4554
  return {
4476
4555
  id: block.id,
4477
- height: bn16(block.height),
4556
+ height: bn17(block.height),
4478
4557
  time: block.header.time,
4479
4558
  transactionIds: block.transactions.map((tx) => tx.id)
4480
4559
  };
@@ -4489,7 +4568,7 @@ var _Provider = class {
4489
4568
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4490
4569
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4491
4570
  id: block.id,
4492
- height: bn16(block.height),
4571
+ height: bn17(block.height),
4493
4572
  time: block.header.time,
4494
4573
  transactionIds: block.transactions.map((tx) => tx.id)
4495
4574
  }));
@@ -4504,7 +4583,7 @@ var _Provider = class {
4504
4583
  async getBlockWithTransactions(idOrHeight) {
4505
4584
  let variables;
4506
4585
  if (typeof idOrHeight === "number") {
4507
- variables = { blockHeight: bn16(idOrHeight).toString(10) };
4586
+ variables = { blockHeight: bn17(idOrHeight).toString(10) };
4508
4587
  } else if (idOrHeight === "latest") {
4509
4588
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4510
4589
  } else {
@@ -4516,7 +4595,7 @@ var _Provider = class {
4516
4595
  }
4517
4596
  return {
4518
4597
  id: block.id,
4519
- height: bn16(block.height, 10),
4598
+ height: bn17(block.height, 10),
4520
4599
  time: block.header.time,
4521
4600
  transactionIds: block.transactions.map((tx) => tx.id),
4522
4601
  transactions: block.transactions.map(
@@ -4565,7 +4644,7 @@ var _Provider = class {
4565
4644
  contract: Address2.fromAddressOrString(contractId).toB256(),
4566
4645
  asset: hexlify12(assetId)
4567
4646
  });
4568
- return bn16(contractBalance.amount, 10);
4647
+ return bn17(contractBalance.amount, 10);
4569
4648
  }
4570
4649
  /**
4571
4650
  * Returns the balance for the given owner for the given asset ID.
@@ -4579,7 +4658,7 @@ var _Provider = class {
4579
4658
  owner: Address2.fromAddressOrString(owner).toB256(),
4580
4659
  assetId: hexlify12(assetId)
4581
4660
  });
4582
- return bn16(balance.amount, 10);
4661
+ return bn17(balance.amount, 10);
4583
4662
  }
4584
4663
  /**
4585
4664
  * Returns balances for the given owner.
@@ -4597,7 +4676,7 @@ var _Provider = class {
4597
4676
  const balances = result.balances.edges.map((edge) => edge.node);
4598
4677
  return balances.map((balance) => ({
4599
4678
  assetId: balance.assetId,
4600
- amount: bn16(balance.amount)
4679
+ amount: bn17(balance.amount)
4601
4680
  }));
4602
4681
  }
4603
4682
  /**
@@ -4619,15 +4698,15 @@ var _Provider = class {
4619
4698
  sender: message.sender,
4620
4699
  recipient: message.recipient,
4621
4700
  nonce: message.nonce,
4622
- amount: bn16(message.amount),
4701
+ amount: bn17(message.amount),
4623
4702
  data: message.data
4624
4703
  }),
4625
4704
  sender: Address2.fromAddressOrString(message.sender),
4626
4705
  recipient: Address2.fromAddressOrString(message.recipient),
4627
4706
  nonce: message.nonce,
4628
- amount: bn16(message.amount),
4707
+ amount: bn17(message.amount),
4629
4708
  data: InputMessageCoder.decodeData(message.data),
4630
- daHeight: bn16(message.daHeight)
4709
+ daHeight: bn17(message.daHeight)
4631
4710
  }));
4632
4711
  }
4633
4712
  /**
@@ -4680,59 +4759,59 @@ var _Provider = class {
4680
4759
  } = result.messageProof;
4681
4760
  return {
4682
4761
  messageProof: {
4683
- proofIndex: bn16(messageProof.proofIndex),
4762
+ proofIndex: bn17(messageProof.proofIndex),
4684
4763
  proofSet: messageProof.proofSet
4685
4764
  },
4686
4765
  blockProof: {
4687
- proofIndex: bn16(blockProof.proofIndex),
4766
+ proofIndex: bn17(blockProof.proofIndex),
4688
4767
  proofSet: blockProof.proofSet
4689
4768
  },
4690
4769
  messageBlockHeader: {
4691
4770
  id: messageBlockHeader.id,
4692
- daHeight: bn16(messageBlockHeader.daHeight),
4693
- transactionsCount: bn16(messageBlockHeader.transactionsCount),
4771
+ daHeight: bn17(messageBlockHeader.daHeight),
4772
+ transactionsCount: Number(messageBlockHeader.transactionsCount),
4694
4773
  transactionsRoot: messageBlockHeader.transactionsRoot,
4695
- height: bn16(messageBlockHeader.height),
4774
+ height: bn17(messageBlockHeader.height),
4696
4775
  prevRoot: messageBlockHeader.prevRoot,
4697
4776
  time: messageBlockHeader.time,
4698
4777
  applicationHash: messageBlockHeader.applicationHash,
4699
- messageReceiptCount: bn16(messageBlockHeader.messageReceiptCount),
4778
+ messageReceiptCount: Number(messageBlockHeader.messageReceiptCount),
4700
4779
  messageOutboxRoot: messageBlockHeader.messageOutboxRoot,
4701
- consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
4780
+ consensusParametersVersion: Number(messageBlockHeader.consensusParametersVersion),
4702
4781
  eventInboxRoot: messageBlockHeader.eventInboxRoot,
4703
- stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
4782
+ stateTransitionBytecodeVersion: Number(messageBlockHeader.stateTransitionBytecodeVersion)
4704
4783
  },
4705
4784
  commitBlockHeader: {
4706
4785
  id: commitBlockHeader.id,
4707
- daHeight: bn16(commitBlockHeader.daHeight),
4708
- transactionsCount: bn16(commitBlockHeader.transactionsCount),
4786
+ daHeight: bn17(commitBlockHeader.daHeight),
4787
+ transactionsCount: Number(commitBlockHeader.transactionsCount),
4709
4788
  transactionsRoot: commitBlockHeader.transactionsRoot,
4710
- height: bn16(commitBlockHeader.height),
4789
+ height: bn17(commitBlockHeader.height),
4711
4790
  prevRoot: commitBlockHeader.prevRoot,
4712
4791
  time: commitBlockHeader.time,
4713
4792
  applicationHash: commitBlockHeader.applicationHash,
4714
- messageReceiptCount: bn16(commitBlockHeader.messageReceiptCount),
4793
+ messageReceiptCount: Number(commitBlockHeader.messageReceiptCount),
4715
4794
  messageOutboxRoot: commitBlockHeader.messageOutboxRoot,
4716
- consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
4795
+ consensusParametersVersion: Number(commitBlockHeader.consensusParametersVersion),
4717
4796
  eventInboxRoot: commitBlockHeader.eventInboxRoot,
4718
- stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
4797
+ stateTransitionBytecodeVersion: Number(commitBlockHeader.stateTransitionBytecodeVersion)
4719
4798
  },
4720
4799
  sender: Address2.fromAddressOrString(sender),
4721
4800
  recipient: Address2.fromAddressOrString(recipient),
4722
4801
  nonce,
4723
- amount: bn16(amount),
4802
+ amount: bn17(amount),
4724
4803
  data
4725
4804
  };
4726
4805
  }
4727
4806
  async getLatestGasPrice() {
4728
4807
  const { latestGasPrice } = await this.operations.getLatestGasPrice();
4729
- return bn16(latestGasPrice.gasPrice);
4808
+ return bn17(latestGasPrice.gasPrice);
4730
4809
  }
4731
4810
  async estimateGasPrice(blockHorizon) {
4732
4811
  const { estimateGasPrice } = await this.operations.estimateGasPrice({
4733
4812
  blockHorizon: String(blockHorizon)
4734
4813
  });
4735
- return bn16(estimateGasPrice.gasPrice);
4814
+ return bn17(estimateGasPrice.gasPrice);
4736
4815
  }
4737
4816
  /**
4738
4817
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
@@ -4753,15 +4832,37 @@ var _Provider = class {
4753
4832
  */
4754
4833
  async produceBlocks(amount, startTime) {
4755
4834
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4756
- blocksToProduce: bn16(amount).toString(10),
4835
+ blocksToProduce: bn17(amount).toString(10),
4757
4836
  startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4758
4837
  });
4759
- return bn16(latestBlockHeight);
4838
+ return bn17(latestBlockHeight);
4760
4839
  }
4761
4840
  // eslint-disable-next-line @typescript-eslint/require-await
4762
4841
  async getTransactionResponse(transactionId) {
4763
4842
  return new TransactionResponse(transactionId, this);
4764
4843
  }
4844
+ /**
4845
+ * Returns Message for given nonce.
4846
+ *
4847
+ * @param nonce - The nonce of the message to retrieve.
4848
+ * @returns A promise that resolves to the Message object.
4849
+ */
4850
+ async getMessageByNonce(nonce) {
4851
+ const { message } = await this.operations.getMessageByNonce({ nonce });
4852
+ if (!message) {
4853
+ return null;
4854
+ }
4855
+ return message;
4856
+ }
4857
+ async getRelayedTransactionStatus(relayedTransactionId) {
4858
+ const { relayedTransactionStatus } = await this.operations.getRelayedTransactionStatus({
4859
+ relayedTransactionId
4860
+ });
4861
+ if (!relayedTransactionStatus) {
4862
+ return null;
4863
+ }
4864
+ return relayedTransactionStatus;
4865
+ }
4765
4866
  };
4766
4867
  var Provider = _Provider;
4767
4868
  _cacheInputs = new WeakSet();
@@ -4780,7 +4881,7 @@ __publicField(Provider, "nodeInfoCache", {});
4780
4881
 
4781
4882
  // src/providers/transaction-summary/get-transaction-summary.ts
4782
4883
  import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
4783
- import { bn as bn17 } from "@fuel-ts/math";
4884
+ import { bn as bn18 } from "@fuel-ts/math";
4784
4885
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4785
4886
  import { arrayify as arrayify12 } from "@fuel-ts/utils";
4786
4887
  async function getTransactionSummary(params) {
@@ -4804,7 +4905,11 @@ async function getTransactionSummary(params) {
4804
4905
  }
4805
4906
  const receipts = txReceipts.map(processGqlReceipt);
4806
4907
  const {
4807
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
4908
+ consensusParameters: {
4909
+ feeParameters: { gasPerByte, gasPriceFactor },
4910
+ txParameters: { maxInputs, maxGasPerTx },
4911
+ gasCosts
4912
+ }
4808
4913
  } = provider.getChain();
4809
4914
  const gasPrice = await provider.getLatestGasPrice();
4810
4915
  const transactionInfo = assembleTransactionSummary({
@@ -4813,8 +4918,8 @@ async function getTransactionSummary(params) {
4813
4918
  transaction: decodedTransaction,
4814
4919
  transactionBytes: arrayify12(gqlTransaction.rawPayload),
4815
4920
  gqlTransactionStatus: gqlTransaction.status,
4816
- gasPerByte: bn17(gasPerByte),
4817
- gasPriceFactor: bn17(gasPriceFactor),
4921
+ gasPerByte: bn18(gasPerByte),
4922
+ gasPriceFactor: bn18(gasPriceFactor),
4818
4923
  abiMap,
4819
4924
  maxInputs,
4820
4925
  gasCosts,
@@ -4830,7 +4935,7 @@ async function getTransactionSummaryFromRequest(params) {
4830
4935
  const { provider, transactionRequest, abiMap } = params;
4831
4936
  const { receipts } = await provider.call(transactionRequest);
4832
4937
  const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
4833
- const maxInputs = provider.getChain().consensusParameters.maxInputs;
4938
+ const maxInputs = provider.getChain().consensusParameters.txParameters.maxInputs;
4834
4939
  const transaction = transactionRequest.toTransaction();
4835
4940
  const transactionBytes = transactionRequest.toTransactionBytes();
4836
4941
  const gasPrice = await provider.getLatestGasPrice();
@@ -4853,7 +4958,11 @@ async function getTransactionsSummaries(params) {
4853
4958
  const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
4854
4959
  const { edges, pageInfo } = transactionsByOwner;
4855
4960
  const {
4856
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
4961
+ consensusParameters: {
4962
+ feeParameters: { gasPerByte, gasPriceFactor },
4963
+ txParameters: { maxInputs, maxGasPerTx },
4964
+ gasCosts
4965
+ }
4857
4966
  } = provider.getChain();
4858
4967
  const gasPrice = await provider.getLatestGasPrice();
4859
4968
  const transactions = edges.map((edge) => {
@@ -5012,6 +5121,22 @@ var assets = [
5012
5121
  }
5013
5122
  ];
5014
5123
 
5124
+ // src/providers/transaction-request/helpers.ts
5125
+ import { bn as bn19 } from "@fuel-ts/math";
5126
+ import { InputType as InputType8 } from "@fuel-ts/transactions";
5127
+ var isRequestInputCoin = (input) => input.type === InputType8.Coin;
5128
+ var isRequestInputMessage = (input) => input.type === InputType8.Message;
5129
+ var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
5130
+ var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
5131
+ if (isRequestInputCoin(input) && input.assetId === assetId) {
5132
+ return acc.add(input.amount);
5133
+ }
5134
+ if (isRequestInputMessage(input) && assetId === baseAsset) {
5135
+ return acc.add(input.amount);
5136
+ }
5137
+ return acc;
5138
+ }, bn19(0));
5139
+
5015
5140
  // src/utils/formatTransferToContractScriptData.ts
5016
5141
  import { BigNumberCoder as BigNumberCoder2 } from "@fuel-ts/abi-coder";
5017
5142
  import { BN as BN2 } from "@fuel-ts/math";
@@ -5049,6 +5174,7 @@ var assembleTransferToContractScript = async (params) => {
5049
5174
  };
5050
5175
 
5051
5176
  // src/account.ts
5177
+ var MAX_FUNDING_ATTEMPTS = 2;
5052
5178
  var Account = class extends AbstractAccount {
5053
5179
  /**
5054
5180
  * The address associated with the account.
@@ -5206,16 +5332,17 @@ var Account = class extends AbstractAccount {
5206
5332
  * Adds resources to the transaction enough to fund it.
5207
5333
  *
5208
5334
  * @param request - The transaction request.
5209
- * @param coinQuantities - The coin quantities required to execute the transaction.
5335
+ * @param requiredQuantities - The coin quantities required to execute the transaction.
5210
5336
  * @param fee - The estimated transaction fee.
5211
5337
  * @returns A promise that resolves when the resources are added to the transaction.
5212
5338
  */
5213
5339
  async fund(request, params) {
5214
5340
  const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
5215
5341
  const baseAssetId = this.provider.getBaseAssetId();
5342
+ const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || bn20(0);
5216
5343
  const txRequest = request;
5217
5344
  const requiredQuantitiesWithFee = addAmountToCoinQuantities({
5218
- amount: bn18(fee),
5345
+ amount: bn20(fee),
5219
5346
  assetId: baseAssetId,
5220
5347
  coinQuantities: requiredQuantities
5221
5348
  });
@@ -5223,21 +5350,17 @@ var Account = class extends AbstractAccount {
5223
5350
  requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
5224
5351
  quantitiesDict[assetId] = {
5225
5352
  required: amount,
5226
- owned: bn18(0)
5353
+ owned: bn20(0)
5227
5354
  };
5228
5355
  });
5229
- txRequest.inputs.forEach((input) => {
5230
- const isResource = "amount" in input;
5231
- if (!isResource) {
5232
- return;
5233
- }
5234
- const isCoin2 = "owner" in input;
5356
+ request.inputs.filter(isRequestInputResource).forEach((input) => {
5357
+ const isCoin2 = isRequestInputCoin(input);
5235
5358
  const assetId = isCoin2 ? String(input.assetId) : baseAssetId;
5236
5359
  if (quantitiesDict[assetId]) {
5237
5360
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(input.amount);
5238
5361
  }
5239
5362
  });
5240
- const missingQuantities = [];
5363
+ let missingQuantities = [];
5241
5364
  Object.entries(quantitiesDict).forEach(([assetId, { owned, required }]) => {
5242
5365
  if (owned.lt(required)) {
5243
5366
  missingQuantities.push({
@@ -5246,11 +5369,42 @@ var Account = class extends AbstractAccount {
5246
5369
  });
5247
5370
  }
5248
5371
  });
5249
- const needsToBeFunded = missingQuantities.length;
5250
- if (needsToBeFunded) {
5251
- const excludedIds = cacheTxInputsFromOwner(txRequest.inputs, this.address.toB256());
5252
- const resources = await this.getResourcesToSpend(missingQuantities, excludedIds);
5253
- txRequest.addResources(resources);
5372
+ let needsToBeFunded = missingQuantities.length > 0;
5373
+ let fundingAttempts = 0;
5374
+ while (needsToBeFunded && fundingAttempts < MAX_FUNDING_ATTEMPTS) {
5375
+ const resources = await this.getResourcesToSpend(
5376
+ missingQuantities,
5377
+ cacheTxInputsFromOwner(request.inputs, this.address)
5378
+ );
5379
+ request.addResources(resources);
5380
+ txRequest.shiftPredicateData();
5381
+ txRequest.updatePredicateGasUsed(estimatedPredicates);
5382
+ const requestToReestimate2 = clone4(txRequest);
5383
+ if (addedSignatures) {
5384
+ Array.from({ length: addedSignatures }).forEach(
5385
+ () => requestToReestimate2.addEmptyWitness()
5386
+ );
5387
+ }
5388
+ const { maxFee: newFee } = await this.provider.estimateTxGasAndFee({
5389
+ transactionRequest: requestToReestimate2
5390
+ });
5391
+ const totalBaseAssetOnInputs = getAssetAmountInRequestInputs(
5392
+ request.inputs,
5393
+ baseAssetId,
5394
+ baseAssetId
5395
+ );
5396
+ const totalBaseAssetRequiredWithFee = requiredInBaseAsset.add(newFee);
5397
+ if (totalBaseAssetOnInputs.gt(totalBaseAssetRequiredWithFee)) {
5398
+ needsToBeFunded = false;
5399
+ } else {
5400
+ missingQuantities = [
5401
+ {
5402
+ amount: totalBaseAssetRequiredWithFee.sub(totalBaseAssetOnInputs),
5403
+ assetId: baseAssetId
5404
+ }
5405
+ ];
5406
+ }
5407
+ fundingAttempts += 1;
5254
5408
  }
5255
5409
  txRequest.shiftPredicateData();
5256
5410
  txRequest.updatePredicateGasUsed(estimatedPredicates);
@@ -5301,7 +5455,7 @@ var Account = class extends AbstractAccount {
5301
5455
  * @returns A promise that resolves to the transaction response.
5302
5456
  */
5303
5457
  async transfer(destination, amount, assetId, txParams = {}) {
5304
- if (bn18(amount).lte(0)) {
5458
+ if (bn20(amount).lte(0)) {
5305
5459
  throw new FuelError15(
5306
5460
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5307
5461
  "Transfer amount must be a positive number."
@@ -5321,7 +5475,7 @@ var Account = class extends AbstractAccount {
5321
5475
  * @returns A promise that resolves to the transaction response.
5322
5476
  */
5323
5477
  async transferToContract(contractId, amount, assetId, txParams = {}) {
5324
- if (bn18(amount).lte(0)) {
5478
+ if (bn20(amount).lte(0)) {
5325
5479
  throw new FuelError15(
5326
5480
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5327
5481
  "Transfer amount must be a positive number."
@@ -5331,7 +5485,7 @@ var Account = class extends AbstractAccount {
5331
5485
  const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5332
5486
  const { script, scriptData } = await assembleTransferToContractScript({
5333
5487
  hexlifiedContractId: contractAddress.toB256(),
5334
- amountToTransfer: bn18(amount),
5488
+ amountToTransfer: bn20(amount),
5335
5489
  assetId: assetIdToTransfer
5336
5490
  });
5337
5491
  const request = new ScriptTransactionRequest({
@@ -5342,7 +5496,7 @@ var Account = class extends AbstractAccount {
5342
5496
  request.addContractInputAndOutput(contractAddress);
5343
5497
  const txCost = await this.provider.getTransactionCost(request, {
5344
5498
  resourcesOwner: this,
5345
- quantitiesToContract: [{ amount: bn18(amount), assetId: String(assetIdToTransfer) }]
5499
+ quantitiesToContract: [{ amount: bn20(amount), assetId: String(assetIdToTransfer) }]
5346
5500
  });
5347
5501
  this.validateGasLimitAndMaxFee({
5348
5502
  gasUsed: txCost.gasUsed,
@@ -5368,7 +5522,7 @@ var Account = class extends AbstractAccount {
5368
5522
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5369
5523
  );
5370
5524
  const amountDataArray = arrayify14(
5371
- "0x".concat(bn18(amount).toHex().substring(2).padStart(16, "0"))
5525
+ "0x".concat(bn20(amount).toHex().substring(2).padStart(16, "0"))
5372
5526
  );
5373
5527
  const script = new Uint8Array([
5374
5528
  ...arrayify14(withdrawScript.bytes),
@@ -5378,7 +5532,7 @@ var Account = class extends AbstractAccount {
5378
5532
  const params = { script, ...txParams };
5379
5533
  const baseAssetId = this.provider.getBaseAssetId();
5380
5534
  const request = new ScriptTransactionRequest(params);
5381
- const quantitiesToContract = [{ amount: bn18(amount), assetId: baseAssetId }];
5535
+ const quantitiesToContract = [{ amount: bn20(amount), assetId: baseAssetId }];
5382
5536
  const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
5383
5537
  this.validateGasLimitAndMaxFee({
5384
5538
  gasUsed: txCost.gasUsed,
@@ -5450,13 +5604,13 @@ var Account = class extends AbstractAccount {
5450
5604
  gasUsed,
5451
5605
  maxFee
5452
5606
  }) {
5453
- if (isDefined(setGasLimit) && gasUsed.gt(setGasLimit)) {
5607
+ if (isDefined2(setGasLimit) && gasUsed.gt(setGasLimit)) {
5454
5608
  throw new FuelError15(
5455
5609
  ErrorCode15.GAS_LIMIT_TOO_LOW,
5456
5610
  `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
5457
5611
  );
5458
5612
  }
5459
- if (isDefined(setMaxFee) && maxFee.gt(setMaxFee)) {
5613
+ if (isDefined2(setMaxFee) && maxFee.gt(setMaxFee)) {
5460
5614
  throw new FuelError15(
5461
5615
  ErrorCode15.MAX_FEE_TOO_LOW,
5462
5616
  `Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
@@ -5792,7 +5946,7 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5792
5946
  // src/hdwallet/hdwallet.ts
5793
5947
  import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
5794
5948
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
5795
- import { bn as bn19, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5949
+ import { bn as bn21, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5796
5950
  import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
5797
5951
  import { toBeHex, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58, computeHmac as computeHmac2, ripemd160 } from "ethers";
5798
5952
 
@@ -8264,7 +8418,7 @@ var HDWallet = class {
8264
8418
  const IR = bytes.slice(32);
8265
8419
  if (privateKey) {
8266
8420
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
8267
- const ki = bn19(IL).add(privateKey).mod(N).toBytes(32);
8421
+ const ki = bn21(IL).add(privateKey).mod(N).toBytes(32);
8268
8422
  return new HDWallet({
8269
8423
  privateKey: ki,
8270
8424
  chainCode: IR,
@@ -8952,7 +9106,7 @@ import {
8952
9106
  } from "@fuel-ts/abi-coder";
8953
9107
  import { Address as Address9 } from "@fuel-ts/address";
8954
9108
  import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
8955
- import { ByteArrayCoder, InputType as InputType8 } from "@fuel-ts/transactions";
9109
+ import { ByteArrayCoder, InputType as InputType9 } from "@fuel-ts/transactions";
8956
9110
  import { arrayify as arrayify20, hexlify as hexlify19 } from "@fuel-ts/utils";
8957
9111
 
8958
9112
  // src/predicate/utils/getPredicateRoot.ts
@@ -9012,7 +9166,7 @@ var Predicate = class extends Account {
9012
9166
  const request = transactionRequestify(transactionRequestLike);
9013
9167
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
9014
9168
  request.inputs?.forEach((input) => {
9015
- if (input.type === InputType8.Coin && hexlify19(input.owner) === this.address.toB256()) {
9169
+ if (input.type === InputType9.Coin && hexlify19(input.owner) === this.address.toB256()) {
9016
9170
  input.predicate = hexlify19(this.bytes);
9017
9171
  input.predicateData = hexlify19(this.getPredicateData(policies.length));
9018
9172
  }
@@ -9046,7 +9200,7 @@ var Predicate = class extends Account {
9046
9200
  const mainFn = this.interface?.functions.main;
9047
9201
  const paddedCode = new ByteArrayCoder(this.bytes.length).encode(this.bytes);
9048
9202
  const VM_TX_MEMORY = calculateVmTxMemory2({
9049
- maxInputs: this.provider.getChain().consensusParameters.maxInputs.toNumber()
9203
+ maxInputs: this.provider.getChain().consensusParameters.txParameters.maxInputs.toNumber()
9050
9204
  });
9051
9205
  const OFFSET = VM_TX_MEMORY + SCRIPT_FIXED_SIZE + INPUT_COIN_FIXED_SIZE + WORD_SIZE + paddedCode.byteLength + policiesLength * WORD_SIZE;
9052
9206
  return mainFn?.encodeArguments(this.predicateData, OFFSET) || new Uint8Array();
@@ -9863,7 +10017,7 @@ export {
9863
10017
  calculateGasFee,
9864
10018
  calculateMetadataGasForTxCreate,
9865
10019
  calculateMetadataGasForTxScript,
9866
- calculateTransactionFee,
10020
+ calculateTXFeeForSummary,
9867
10021
  coinQuantityfy,
9868
10022
  deferPromise,
9869
10023
  dispatchFuelConnectorEvent,
@@ -9923,6 +10077,8 @@ export {
9923
10077
  isTypeCreate,
9924
10078
  isTypeMint,
9925
10079
  isTypeScript,
10080
+ isTypeUpgrade,
10081
+ isTypeUpload,
9926
10082
  normalizeJSON,
9927
10083
  outputify,
9928
10084
  processGqlReceipt,