@fuel-ts/account 0.0.0-rc-2217-20240503120735 → 0.0.0-rc-2224-20240503155836

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 (41) hide show
  1. package/dist/index.global.js +449 -1266
  2. package/dist/index.global.js.map +1 -1
  3. package/dist/index.js +155 -249
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +145 -237
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/providers/__generated__/operations.d.ts +80 -186
  8. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  9. package/dist/providers/message.d.ts +2 -2
  10. package/dist/providers/message.d.ts.map +1 -1
  11. package/dist/providers/provider.d.ts +20 -23
  12. package/dist/providers/provider.d.ts.map +1 -1
  13. package/dist/providers/transaction-request/script-transaction-request.d.ts +3 -2
  14. package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
  15. package/dist/providers/transaction-request/transaction-request.d.ts +3 -2
  16. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  17. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +2 -2
  18. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
  19. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +22 -0
  20. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +1 -0
  21. package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
  22. package/dist/providers/transaction-summary/index.d.ts +1 -1
  23. package/dist/providers/transaction-summary/index.d.ts.map +1 -1
  24. package/dist/providers/transaction-summary/operations.d.ts +0 -4
  25. package/dist/providers/transaction-summary/operations.d.ts.map +1 -1
  26. package/dist/providers/transaction-summary/status.d.ts +1 -5
  27. package/dist/providers/transaction-summary/status.d.ts.map +1 -1
  28. package/dist/providers/transaction-summary/types.d.ts +1 -6
  29. package/dist/providers/transaction-summary/types.d.ts.map +1 -1
  30. package/dist/providers/utils/gas.d.ts +5 -6
  31. package/dist/providers/utils/gas.d.ts.map +1 -1
  32. package/dist/test-utils/launchNode.d.ts.map +1 -1
  33. package/dist/test-utils.global.js +448 -1258
  34. package/dist/test-utils.global.js.map +1 -1
  35. package/dist/test-utils.js +147 -229
  36. package/dist/test-utils.js.map +1 -1
  37. package/dist/test-utils.mjs +138 -220
  38. package/dist/test-utils.mjs.map +1 -1
  39. package/package.json +16 -16
  40. package/dist/providers/transaction-summary/calculate-tx-fee-for-summary.d.ts +0 -20
  41. package/dist/providers/transaction-summary/calculate-tx-fee-for-summary.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -108,7 +108,7 @@ __export(src_exports, {
108
108
  calculateGasFee: () => calculateGasFee,
109
109
  calculateMetadataGasForTxCreate: () => calculateMetadataGasForTxCreate,
110
110
  calculateMetadataGasForTxScript: () => calculateMetadataGasForTxScript,
111
- calculateTXFeeForSummary: () => calculateTXFeeForSummary,
111
+ calculateTransactionFee: () => calculateTransactionFee,
112
112
  coinQuantityfy: () => coinQuantityfy,
113
113
  deferPromise: () => deferPromise,
114
114
  dispatchFuelConnectorEvent: () => dispatchFuelConnectorEvent,
@@ -168,8 +168,6 @@ __export(src_exports, {
168
168
  isTypeCreate: () => isTypeCreate,
169
169
  isTypeMint: () => isTypeMint,
170
170
  isTypeScript: () => isTypeScript,
171
- isTypeUpgrade: () => isTypeUpgrade,
172
- isTypeUpload: () => isTypeUpload,
173
171
  normalizeJSON: () => normalizeJSON,
174
172
  outputify: () => outputify,
175
173
  processGqlReceipt: () => processGqlReceipt,
@@ -189,7 +187,7 @@ module.exports = __toCommonJS(src_exports);
189
187
  var import_address4 = require("@fuel-ts/address");
190
188
  var import_errors16 = require("@fuel-ts/errors");
191
189
  var import_interfaces = require("@fuel-ts/interfaces");
192
- var import_math21 = require("@fuel-ts/math");
190
+ var import_math20 = require("@fuel-ts/math");
193
191
  var import_utils27 = require("@fuel-ts/utils");
194
192
  var import_ramda4 = require("ramda");
195
193
 
@@ -231,7 +229,7 @@ var addAmountToCoinQuantities = (params) => {
231
229
  // src/providers/provider.ts
232
230
  var import_address3 = require("@fuel-ts/address");
233
231
  var import_errors14 = require("@fuel-ts/errors");
234
- var import_math17 = require("@fuel-ts/math");
232
+ var import_math16 = require("@fuel-ts/math");
235
233
  var import_transactions19 = require("@fuel-ts/transactions");
236
234
  var import_utils22 = require("@fuel-ts/utils");
237
235
  var import_versions = require("@fuel-ts/versions");
@@ -292,6 +290,9 @@ var TransactionStatusFragmentFragmentDoc = import_graphql_tag.default`
292
290
  id
293
291
  }
294
292
  time
293
+ receipts {
294
+ ...receiptFragment
295
+ }
295
296
  programState {
296
297
  returnType
297
298
  data
@@ -299,15 +300,11 @@ var TransactionStatusFragmentFragmentDoc = import_graphql_tag.default`
299
300
  receipts {
300
301
  ...receiptFragment
301
302
  }
302
- totalGas
303
- totalFee
304
303
  }
305
304
  ... on FailureStatus {
306
305
  block {
307
306
  id
308
307
  }
309
- totalGas
310
- totalFee
311
308
  time
312
309
  reason
313
310
  receipts {
@@ -347,8 +344,6 @@ var TransactionEstimatePredicatesFragmentFragmentDoc = import_graphql_tag.defaul
347
344
  ${InputEstimatePredicatesFragmentFragmentDoc}`;
348
345
  var DryRunFailureStatusFragmentFragmentDoc = import_graphql_tag.default`
349
346
  fragment dryRunFailureStatusFragment on DryRunFailureStatus {
350
- totalGas
351
- totalFee
352
347
  reason
353
348
  programState {
354
349
  returnType
@@ -358,8 +353,6 @@ var DryRunFailureStatusFragmentFragmentDoc = import_graphql_tag.default`
358
353
  `;
359
354
  var DryRunSuccessStatusFragmentFragmentDoc = import_graphql_tag.default`
360
355
  fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
361
- totalGas
362
- totalFee
363
356
  programState {
364
357
  returnType
365
358
  data
@@ -495,7 +488,6 @@ var TxParametersFragmentFragmentDoc = import_graphql_tag.default`
495
488
  maxWitnesses
496
489
  maxGasPerTx
497
490
  maxSize
498
- maxBytecodeSubsections
499
491
  }
500
492
  `;
501
493
  var PredicateParametersFragmentFragmentDoc = import_graphql_tag.default`
@@ -765,14 +757,6 @@ var NodeInfoFragmentFragmentDoc = import_graphql_tag.default`
765
757
  nodeVersion
766
758
  }
767
759
  `;
768
- var RelayedTransactionStatusFragmentFragmentDoc = import_graphql_tag.default`
769
- fragment relayedTransactionStatusFragment on RelayedTransactionStatus {
770
- ... on RelayedTransactionFailed {
771
- blockHeight
772
- failure
773
- }
774
- }
775
- `;
776
760
  var GetVersionDocument = import_graphql_tag.default`
777
761
  query getVersion {
778
762
  nodeInfo {
@@ -1002,13 +986,6 @@ var GetMessageStatusDocument = import_graphql_tag.default`
1002
986
  }
1003
987
  }
1004
988
  `;
1005
- var GetRelayedTransactionStatusDocument = import_graphql_tag.default`
1006
- query getRelayedTransactionStatus($relayedTransactionId: RelayedTransactionId!) {
1007
- relayedTransactionStatus(id: $relayedTransactionId) {
1008
- ...relayedTransactionStatusFragment
1009
- }
1010
- }
1011
- ${RelayedTransactionStatusFragmentFragmentDoc}`;
1012
989
  var DryRunDocument = import_graphql_tag.default`
1013
990
  mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
1014
991
  dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
@@ -1123,9 +1100,6 @@ function getSdk(requester) {
1123
1100
  getMessageStatus(variables, options) {
1124
1101
  return requester(GetMessageStatusDocument, variables, options);
1125
1102
  },
1126
- getRelayedTransactionStatus(variables, options) {
1127
- return requester(GetRelayedTransactionStatusDocument, variables, options);
1128
- },
1129
1103
  dryRun(variables, options) {
1130
1104
  return requester(DryRunDocument, variables, options);
1131
1105
  },
@@ -2312,11 +2286,8 @@ var BaseTransactionRequest = class {
2312
2286
  * @hidden
2313
2287
  */
2314
2288
  calculateMinGas(chainInfo) {
2315
- const { consensusParameters } = chainInfo;
2316
- const {
2317
- gasCosts,
2318
- feeParameters: { gasPerByte }
2319
- } = consensusParameters;
2289
+ const { gasCosts, consensusParameters } = chainInfo;
2290
+ const { gasPerByte } = consensusParameters;
2320
2291
  return getMinGas({
2321
2292
  gasPerByte,
2322
2293
  gasCosts,
@@ -2327,10 +2298,7 @@ var BaseTransactionRequest = class {
2327
2298
  }
2328
2299
  calculateMaxGas(chainInfo, minGas) {
2329
2300
  const { consensusParameters } = chainInfo;
2330
- const {
2331
- feeParameters: { gasPerByte },
2332
- txParameters: { maxGasPerTx }
2333
- } = consensusParameters;
2301
+ const { gasPerByte, maxGasPerTx } = consensusParameters;
2334
2302
  const witnessesLength = this.toTransaction().witnesses.reduce(
2335
2303
  (acc, wit) => acc + wit.dataLength,
2336
2304
  0
@@ -2765,10 +2733,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2765
2733
  }
2766
2734
  calculateMaxGas(chainInfo, minGas) {
2767
2735
  const { consensusParameters } = chainInfo;
2768
- const {
2769
- feeParameters: { gasPerByte },
2770
- txParameters: { maxGasPerTx }
2771
- } = consensusParameters;
2736
+ const { gasPerByte, maxGasPerTx } = consensusParameters;
2772
2737
  const witnessesLength = this.toTransaction().witnesses.reduce(
2773
2738
  (acc, wit) => acc + wit.dataLength,
2774
2739
  0
@@ -2872,40 +2837,40 @@ var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
2872
2837
 
2873
2838
  // src/providers/transaction-response/transaction-response.ts
2874
2839
  var import_errors13 = require("@fuel-ts/errors");
2875
- var import_math16 = require("@fuel-ts/math");
2840
+ var import_math15 = require("@fuel-ts/math");
2876
2841
  var import_transactions18 = require("@fuel-ts/transactions");
2877
2842
  var import_utils20 = require("@fuel-ts/utils");
2878
2843
 
2879
2844
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2880
- var import_math15 = require("@fuel-ts/math");
2845
+ var import_math14 = require("@fuel-ts/math");
2881
2846
  var import_transactions16 = require("@fuel-ts/transactions");
2882
2847
  var import_utils18 = require("@fuel-ts/utils");
2883
2848
 
2884
- // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
2849
+ // src/providers/transaction-summary/calculate-transaction-fee.ts
2885
2850
  var import_math11 = require("@fuel-ts/math");
2886
2851
  var import_transactions11 = require("@fuel-ts/transactions");
2887
2852
  var import_utils16 = require("@fuel-ts/utils");
2888
- var calculateTXFeeForSummary = (params) => {
2853
+ var calculateTransactionFee = (params) => {
2889
2854
  const {
2890
2855
  gasPrice,
2891
2856
  rawPayload,
2892
2857
  tip,
2893
- totalFee,
2894
2858
  consensusParameters: { gasCosts, feeParams, maxGasPerTx }
2895
2859
  } = params;
2896
- if (totalFee) {
2897
- return totalFee;
2898
- }
2899
2860
  const gasPerByte = (0, import_math11.bn)(feeParams.gasPerByte);
2900
2861
  const gasPriceFactor = (0, import_math11.bn)(feeParams.gasPriceFactor);
2901
2862
  const transactionBytes = (0, import_utils16.arrayify)(rawPayload);
2902
2863
  const [transaction] = new import_transactions11.TransactionCoder().decode(transactionBytes, 0);
2864
+ if (transaction.type === import_transactions11.TransactionType.Mint) {
2865
+ return {
2866
+ fee: (0, import_math11.bn)(0),
2867
+ minFee: (0, import_math11.bn)(0),
2868
+ maxFee: (0, import_math11.bn)(0)
2869
+ };
2870
+ }
2903
2871
  const { type, witnesses, inputs, policies } = transaction;
2904
2872
  let metadataGas = (0, import_math11.bn)(0);
2905
2873
  let gasLimit = (0, import_math11.bn)(0);
2906
- if (type !== import_transactions11.TransactionType.Create && type !== import_transactions11.TransactionType.Script) {
2907
- return (0, import_math11.bn)(0);
2908
- }
2909
2874
  if (type === import_transactions11.TransactionType.Create) {
2910
2875
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2911
2876
  const contractBytesSize = (0, import_math11.bn)((0, import_utils16.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
@@ -2942,13 +2907,23 @@ var calculateTXFeeForSummary = (params) => {
2942
2907
  witnessLimit,
2943
2908
  maxGasPerTx
2944
2909
  });
2910
+ const minFee = calculateGasFee({
2911
+ gasPrice,
2912
+ gas: minGas,
2913
+ priceFactor: gasPriceFactor,
2914
+ tip
2915
+ });
2945
2916
  const maxFee = calculateGasFee({
2946
2917
  gasPrice,
2947
2918
  gas: maxGas,
2948
2919
  priceFactor: gasPriceFactor,
2949
2920
  tip
2950
2921
  });
2951
- return maxFee;
2922
+ return {
2923
+ minFee,
2924
+ maxFee,
2925
+ fee: maxFee
2926
+ };
2952
2927
  };
2953
2928
 
2954
2929
  // src/providers/transaction-summary/operations.ts
@@ -3083,8 +3058,6 @@ var TransactionTypeName = /* @__PURE__ */ ((TransactionTypeName2) => {
3083
3058
  TransactionTypeName2["Create"] = "Create";
3084
3059
  TransactionTypeName2["Mint"] = "Mint";
3085
3060
  TransactionTypeName2["Script"] = "Script";
3086
- TransactionTypeName2["Upgrade"] = "Upgrade";
3087
- TransactionTypeName2["Upload"] = "Upload";
3088
3061
  return TransactionTypeName2;
3089
3062
  })(TransactionTypeName || {});
3090
3063
  var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
@@ -3150,12 +3123,6 @@ function isTypeCreate(transactionType) {
3150
3123
  function isTypeScript(transactionType) {
3151
3124
  return isType(transactionType, "Script" /* Script */);
3152
3125
  }
3153
- function isTypeUpgrade(transactionType) {
3154
- return isType(transactionType, "Upgrade" /* Upgrade */);
3155
- }
3156
- function isTypeUpload(transactionType) {
3157
- return isType(transactionType, "Upload" /* Upload */);
3158
- }
3159
3126
  function hasSameAssetId(a) {
3160
3127
  return (b) => a.assetId === b.assetId;
3161
3128
  }
@@ -3502,7 +3469,6 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3502
3469
 
3503
3470
  // src/providers/transaction-summary/status.ts
3504
3471
  var import_errors12 = require("@fuel-ts/errors");
3505
- var import_math14 = require("@fuel-ts/math");
3506
3472
  var getTransactionStatusName = (gqlStatus) => {
3507
3473
  switch (gqlStatus) {
3508
3474
  case "FailureStatus":
@@ -3524,8 +3490,6 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3524
3490
  let time;
3525
3491
  let blockId;
3526
3492
  let status;
3527
- let totalFee;
3528
- let totalGas;
3529
3493
  let isStatusFailure = false;
3530
3494
  let isStatusSuccess = false;
3531
3495
  let isStatusPending = false;
@@ -3536,15 +3500,11 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3536
3500
  time = gqlTransactionStatus.time;
3537
3501
  blockId = gqlTransactionStatus.block.id;
3538
3502
  isStatusSuccess = true;
3539
- totalFee = (0, import_math14.bn)(gqlTransactionStatus.totalFee);
3540
- totalGas = (0, import_math14.bn)(gqlTransactionStatus.totalGas);
3541
3503
  break;
3542
3504
  case "FailureStatus":
3543
3505
  time = gqlTransactionStatus.time;
3544
3506
  blockId = gqlTransactionStatus.block.id;
3545
3507
  isStatusFailure = true;
3546
- totalFee = (0, import_math14.bn)(gqlTransactionStatus.totalFee);
3547
- totalGas = (0, import_math14.bn)(gqlTransactionStatus.totalGas);
3548
3508
  break;
3549
3509
  case "SubmittedStatus":
3550
3510
  time = gqlTransactionStatus.time;
@@ -3557,8 +3517,6 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3557
3517
  time,
3558
3518
  blockId,
3559
3519
  status,
3560
- totalFee,
3561
- totalGas,
3562
3520
  isStatusFailure,
3563
3521
  isStatusSuccess,
3564
3522
  isStatusPending
@@ -3594,10 +3552,8 @@ function assembleTransactionSummary(params) {
3594
3552
  maxInputs
3595
3553
  });
3596
3554
  const typeName = getTransactionTypeName(transaction.type);
3597
- const tip = (0, import_math15.bn)(transaction.policies?.find((policy) => policy.type === import_transactions16.PolicyType.Tip)?.data);
3598
- const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3599
- const fee = calculateTXFeeForSummary({
3600
- totalFee,
3555
+ const tip = (0, import_math14.bn)(transaction.policies?.find((policy) => policy.type === import_transactions16.PolicyType.Tip)?.data);
3556
+ const { fee } = calculateTransactionFee({
3601
3557
  gasPrice,
3602
3558
  rawPayload,
3603
3559
  tip,
@@ -3610,6 +3566,7 @@ function assembleTransactionSummary(params) {
3610
3566
  }
3611
3567
  }
3612
3568
  });
3569
+ const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time } = processGraphqlStatus(gqlTransactionStatus);
3613
3570
  const mintedAssets = extractMintedAssetsFromReceipts(receipts);
3614
3571
  const burnedAssets = extractBurnedAssetsFromReceipts(receipts);
3615
3572
  let date;
@@ -3618,7 +3575,6 @@ function assembleTransactionSummary(params) {
3618
3575
  }
3619
3576
  const transactionSummary = {
3620
3577
  id,
3621
- tip,
3622
3578
  fee,
3623
3579
  gasUsed,
3624
3580
  operations,
@@ -3632,8 +3588,6 @@ function assembleTransactionSummary(params) {
3632
3588
  isTypeMint: isTypeMint(transaction.type),
3633
3589
  isTypeCreate: isTypeCreate(transaction.type),
3634
3590
  isTypeScript: isTypeScript(transaction.type),
3635
- isTypeUpgrade: isTypeUpgrade(transaction.type),
3636
- isTypeUpload: isTypeUpload(transaction.type),
3637
3591
  isStatusFailure,
3638
3592
  isStatusSuccess,
3639
3593
  isStatusPending,
@@ -3665,7 +3619,7 @@ var TransactionResponse = class {
3665
3619
  /** Current provider */
3666
3620
  provider;
3667
3621
  /** Gas used on the transaction */
3668
- gasUsed = (0, import_math16.bn)(0);
3622
+ gasUsed = (0, import_math15.bn)(0);
3669
3623
  /** The graphql Transaction with receipts object. */
3670
3624
  gqlTransaction;
3671
3625
  abis;
@@ -3750,7 +3704,7 @@ var TransactionResponse = class {
3750
3704
  const receipts = txReceipts.map(processGqlReceipt) || [];
3751
3705
  const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
3752
3706
  const gasPrice = await this.provider.getLatestGasPrice();
3753
- const maxInputs = this.provider.getChain().consensusParameters.txParameters.maxInputs;
3707
+ const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
3754
3708
  const transactionSummary = assembleTransactionSummary({
3755
3709
  id: this.id,
3756
3710
  receipts,
@@ -3886,60 +3840,33 @@ var mergeQuantities = (...coinQuantities) => {
3886
3840
  var MAX_RETRIES = 10;
3887
3841
  var processGqlChain = (chain) => {
3888
3842
  const { name, daHeight, consensusParameters, latestBlock } = chain;
3889
- const {
3890
- contractParams,
3891
- feeParams,
3892
- predicateParams,
3893
- scriptParams,
3894
- txParams,
3895
- gasCosts,
3896
- baseAssetId,
3897
- chainId,
3898
- version
3899
- } = consensusParameters;
3843
+ const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } = consensusParameters;
3900
3844
  return {
3901
3845
  name,
3902
- baseChainHeight: (0, import_math17.bn)(daHeight),
3846
+ baseChainHeight: (0, import_math16.bn)(daHeight),
3903
3847
  consensusParameters: {
3904
- version,
3905
- chainId: (0, import_math17.bn)(chainId),
3906
- baseAssetId,
3907
- feeParameters: {
3908
- version: feeParams.version,
3909
- gasPerByte: (0, import_math17.bn)(feeParams.gasPerByte),
3910
- gasPriceFactor: (0, import_math17.bn)(feeParams.gasPriceFactor)
3911
- },
3912
- contractParameters: {
3913
- version: contractParams.version,
3914
- contractMaxSize: (0, import_math17.bn)(contractParams.contractMaxSize),
3915
- maxStorageSlots: (0, import_math17.bn)(contractParams.maxStorageSlots)
3916
- },
3917
- txParameters: {
3918
- version: txParams.version,
3919
- maxInputs: (0, import_math17.bn)(txParams.maxInputs),
3920
- maxOutputs: (0, import_math17.bn)(txParams.maxOutputs),
3921
- maxWitnesses: (0, import_math17.bn)(txParams.maxWitnesses),
3922
- maxGasPerTx: (0, import_math17.bn)(txParams.maxGasPerTx),
3923
- maxSize: (0, import_math17.bn)(txParams.maxSize),
3924
- maxBytecodeSubsections: (0, import_math17.bn)(txParams.maxBytecodeSubsections)
3925
- },
3926
- predicateParameters: {
3927
- version: predicateParams.version,
3928
- maxPredicateLength: (0, import_math17.bn)(predicateParams.maxPredicateLength),
3929
- maxPredicateDataLength: (0, import_math17.bn)(predicateParams.maxPredicateDataLength),
3930
- maxGasPerPredicate: (0, import_math17.bn)(predicateParams.maxGasPerPredicate),
3931
- maxMessageDataLength: (0, import_math17.bn)(predicateParams.maxMessageDataLength)
3932
- },
3933
- scriptParameters: {
3934
- version: scriptParams.version,
3935
- maxScriptLength: (0, import_math17.bn)(scriptParams.maxScriptLength),
3936
- maxScriptDataLength: (0, import_math17.bn)(scriptParams.maxScriptDataLength)
3937
- },
3848
+ contractMaxSize: (0, import_math16.bn)(contractParams.contractMaxSize),
3849
+ maxInputs: (0, import_math16.bn)(txParams.maxInputs),
3850
+ maxOutputs: (0, import_math16.bn)(txParams.maxOutputs),
3851
+ maxWitnesses: (0, import_math16.bn)(txParams.maxWitnesses),
3852
+ maxGasPerTx: (0, import_math16.bn)(txParams.maxGasPerTx),
3853
+ maxScriptLength: (0, import_math16.bn)(scriptParams.maxScriptLength),
3854
+ maxScriptDataLength: (0, import_math16.bn)(scriptParams.maxScriptDataLength),
3855
+ maxStorageSlots: (0, import_math16.bn)(contractParams.maxStorageSlots),
3856
+ maxPredicateLength: (0, import_math16.bn)(predicateParams.maxPredicateLength),
3857
+ maxPredicateDataLength: (0, import_math16.bn)(predicateParams.maxPredicateDataLength),
3858
+ maxGasPerPredicate: (0, import_math16.bn)(predicateParams.maxGasPerPredicate),
3859
+ gasPriceFactor: (0, import_math16.bn)(feeParams.gasPriceFactor),
3860
+ gasPerByte: (0, import_math16.bn)(feeParams.gasPerByte),
3861
+ maxMessageDataLength: (0, import_math16.bn)(predicateParams.maxMessageDataLength),
3862
+ chainId: (0, import_math16.bn)(consensusParameters.chainId),
3863
+ baseAssetId: consensusParameters.baseAssetId,
3938
3864
  gasCosts
3939
3865
  },
3866
+ gasCosts,
3940
3867
  latestBlock: {
3941
3868
  id: latestBlock.id,
3942
- height: (0, import_math17.bn)(latestBlock.height),
3869
+ height: (0, import_math16.bn)(latestBlock.height),
3943
3870
  time: latestBlock.header.time,
3944
3871
  transactions: latestBlock.transactions.map((i) => ({
3945
3872
  id: i.id
@@ -4033,12 +3960,7 @@ var _Provider = class {
4033
3960
  * Returns some helpful parameters related to gas fees.
4034
3961
  */
4035
3962
  getGasConfig() {
4036
- const {
4037
- txParameters: { maxGasPerTx },
4038
- predicateParameters: { maxGasPerPredicate },
4039
- feeParameters: { gasPriceFactor, gasPerByte },
4040
- gasCosts
4041
- } = this.getChain().consensusParameters;
3963
+ const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
4042
3964
  return {
4043
3965
  maxGasPerTx,
4044
3966
  maxGasPerPredicate,
@@ -4073,9 +3995,11 @@ var _Provider = class {
4073
3995
  static ensureClientVersionIsSupported(nodeInfo) {
4074
3996
  const { isMajorSupported, isMinorSupported, supportedVersion } = (0, import_versions.checkFuelCoreVersionCompatibility)(nodeInfo.nodeVersion);
4075
3997
  if (!isMajorSupported || !isMinorSupported) {
4076
- throw new import_errors14.FuelError(
4077
- import_errors14.FuelError.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
4078
- `Fuel client version: ${nodeInfo.nodeVersion}, Supported version: ${supportedVersion}`
3998
+ console.warn(
3999
+ `The Fuel Node that you are trying to connect to is using fuel-core version ${nodeInfo.nodeVersion},
4000
+ which is not supported by the version of the TS SDK that you are using.
4001
+ Things might or might not work as expected.
4002
+ Supported fuel-core version: ${supportedVersion}.`
4079
4003
  );
4080
4004
  }
4081
4005
  }
@@ -4133,7 +4057,7 @@ var _Provider = class {
4133
4057
  */
4134
4058
  async getBlockNumber() {
4135
4059
  const { chain } = await this.operations.getChain();
4136
- return (0, import_math17.bn)(chain.latestBlock.height, 10);
4060
+ return (0, import_math16.bn)(chain.latestBlock.height, 10);
4137
4061
  }
4138
4062
  /**
4139
4063
  * Returns the chain information.
@@ -4143,8 +4067,8 @@ var _Provider = class {
4143
4067
  async fetchNode() {
4144
4068
  const { nodeInfo } = await this.operations.getNodeInfo();
4145
4069
  const processedNodeInfo = {
4146
- maxDepth: (0, import_math17.bn)(nodeInfo.maxDepth),
4147
- maxTx: (0, import_math17.bn)(nodeInfo.maxTx),
4070
+ maxDepth: (0, import_math16.bn)(nodeInfo.maxDepth),
4071
+ maxTx: (0, import_math16.bn)(nodeInfo.maxTx),
4148
4072
  nodeVersion: nodeInfo.nodeVersion,
4149
4073
  utxoValidation: nodeInfo.utxoValidation,
4150
4074
  vmBacktrace: nodeInfo.vmBacktrace
@@ -4248,9 +4172,9 @@ var _Provider = class {
4248
4172
  encodedTransactions: encodedTransaction,
4249
4173
  utxoValidation: utxoValidation || false
4250
4174
  });
4251
- const [{ receipts: rawReceipts, status: dryRunStatus }] = dryRunStatuses;
4175
+ const [{ receipts: rawReceipts, status }] = dryRunStatuses;
4252
4176
  const receipts = rawReceipts.map(processGqlReceipt);
4253
- return { receipts, dryRunStatus };
4177
+ return { receipts, dryrunStatus: status };
4254
4178
  }
4255
4179
  /**
4256
4180
  * Verifies whether enough gas is available to complete transaction.
@@ -4261,7 +4185,7 @@ var _Provider = class {
4261
4185
  async estimatePredicates(transactionRequest) {
4262
4186
  const shouldEstimatePredicates = Boolean(
4263
4187
  transactionRequest.inputs.find(
4264
- (input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new import_math17.BN(input.predicateGasUsed).isZero()
4188
+ (input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new import_math16.BN(input.predicateGasUsed).isZero()
4265
4189
  )
4266
4190
  );
4267
4191
  if (!shouldEstimatePredicates) {
@@ -4276,7 +4200,7 @@ var _Provider = class {
4276
4200
  } = response;
4277
4201
  if (inputs) {
4278
4202
  inputs.forEach((input, index) => {
4279
- if ("predicateGasUsed" in input && (0, import_math17.bn)(input.predicateGasUsed).gt(0)) {
4203
+ if ("predicateGasUsed" in input && (0, import_math16.bn)(input.predicateGasUsed).gt(0)) {
4280
4204
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
4281
4205
  }
4282
4206
  });
@@ -4304,7 +4228,7 @@ var _Provider = class {
4304
4228
  let receipts = [];
4305
4229
  const missingContractIds = [];
4306
4230
  let outputVariables = 0;
4307
- let dryRunStatus;
4231
+ let dryrunStatus;
4308
4232
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
4309
4233
  const {
4310
4234
  dryRun: [{ receipts: rawReceipts, status }]
@@ -4313,7 +4237,7 @@ var _Provider = class {
4313
4237
  utxoValidation: false
4314
4238
  });
4315
4239
  receipts = rawReceipts.map(processGqlReceipt);
4316
- dryRunStatus = status;
4240
+ dryrunStatus = status;
4317
4241
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
4318
4242
  const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
4319
4243
  if (hasMissingOutputs) {
@@ -4335,7 +4259,7 @@ var _Provider = class {
4335
4259
  receipts,
4336
4260
  outputVariables,
4337
4261
  missingContractIds,
4338
- dryRunStatus
4262
+ dryrunStatus
4339
4263
  };
4340
4264
  }
4341
4265
  /**
@@ -4353,7 +4277,7 @@ var _Provider = class {
4353
4277
  receipts: [],
4354
4278
  outputVariables: 0,
4355
4279
  missingContractIds: [],
4356
- dryRunStatus: void 0
4280
+ dryrunStatus: void 0
4357
4281
  }));
4358
4282
  const allRequests = (0, import_ramda3.clone)(transactionRequests);
4359
4283
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
@@ -4378,7 +4302,7 @@ var _Provider = class {
4378
4302
  const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
4379
4303
  const result = results[requestIdx];
4380
4304
  result.receipts = rawReceipts.map(processGqlReceipt);
4381
- result.dryRunStatus = status;
4305
+ result.dryrunStatus = status;
4382
4306
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
4383
4307
  result.receipts
4384
4308
  );
@@ -4415,7 +4339,7 @@ var _Provider = class {
4415
4339
  });
4416
4340
  const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
4417
4341
  const receipts = rawReceipts.map(processGqlReceipt);
4418
- return { receipts, dryRunStatus: status };
4342
+ return { receipts, dryrunStatus: status };
4419
4343
  });
4420
4344
  return results;
4421
4345
  }
@@ -4434,12 +4358,12 @@ var _Provider = class {
4434
4358
  gasPrice = await this.estimateGasPrice(10);
4435
4359
  }
4436
4360
  const minFee = calculateGasFee({
4437
- gasPrice: (0, import_math17.bn)(gasPrice),
4361
+ gasPrice: (0, import_math16.bn)(gasPrice),
4438
4362
  gas: minGas,
4439
4363
  priceFactor: gasPriceFactor,
4440
4364
  tip: transactionRequest.tip
4441
4365
  }).add(1);
4442
- let gasLimit = (0, import_math17.bn)(0);
4366
+ let gasLimit = (0, import_math16.bn)(0);
4443
4367
  if (transactionRequest.type === import_transactions19.TransactionType.Script) {
4444
4368
  gasLimit = transactionRequest.gasLimit;
4445
4369
  if (transactionRequest.gasLimit.eq(0)) {
@@ -4452,7 +4376,7 @@ var _Provider = class {
4452
4376
  }
4453
4377
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4454
4378
  const maxFee = calculateGasFee({
4455
- gasPrice: (0, import_math17.bn)(gasPrice),
4379
+ gasPrice: (0, import_math16.bn)(gasPrice),
4456
4380
  gas: maxGas,
4457
4381
  priceFactor: gasPriceFactor,
4458
4382
  tip: transactionRequest.tip
@@ -4515,9 +4439,9 @@ var _Provider = class {
4515
4439
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
4516
4440
  const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
4517
4441
  txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
4518
- txRequestClone.maxFee = (0, import_math17.bn)(0);
4442
+ txRequestClone.maxFee = (0, import_math16.bn)(0);
4519
4443
  if (isScriptTransaction) {
4520
- txRequestClone.gasLimit = (0, import_math17.bn)(0);
4444
+ txRequestClone.gasLimit = (0, import_math16.bn)(0);
4521
4445
  }
4522
4446
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4523
4447
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -4534,10 +4458,9 @@ var _Provider = class {
4534
4458
  transactionRequest: signedRequest
4535
4459
  });
4536
4460
  let receipts = [];
4537
- let dryRunStatus;
4538
4461
  let missingContractIds = [];
4539
4462
  let outputVariables = 0;
4540
- let gasUsed = (0, import_math17.bn)(0);
4463
+ let gasUsed = (0, import_math16.bn)(0);
4541
4464
  txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
4542
4465
  txRequestClone.maxFee = maxFee;
4543
4466
  if (isScriptTransaction) {
@@ -4545,7 +4468,10 @@ var _Provider = class {
4545
4468
  if (signatureCallback) {
4546
4469
  await signatureCallback(txRequestClone);
4547
4470
  }
4548
- ({ receipts, missingContractIds, outputVariables, dryRunStatus } = await this.estimateTxDependencies(txRequestClone));
4471
+ const result = await this.estimateTxDependencies(txRequestClone);
4472
+ receipts = result.receipts;
4473
+ outputVariables = result.outputVariables;
4474
+ missingContractIds = result.missingContractIds;
4549
4475
  gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
4550
4476
  txRequestClone.gasLimit = gasUsed;
4551
4477
  ({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
@@ -4565,8 +4491,7 @@ var _Provider = class {
4565
4491
  outputVariables,
4566
4492
  missingContractIds,
4567
4493
  addedSignatures,
4568
- estimatedPredicates: txRequestClone.inputs,
4569
- dryRunStatus
4494
+ estimatedPredicates: txRequestClone.inputs
4570
4495
  };
4571
4496
  }
4572
4497
  async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
@@ -4602,10 +4527,10 @@ var _Provider = class {
4602
4527
  return coins.map((coin) => ({
4603
4528
  id: coin.utxoId,
4604
4529
  assetId: coin.assetId,
4605
- amount: (0, import_math17.bn)(coin.amount),
4530
+ amount: (0, import_math16.bn)(coin.amount),
4606
4531
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4607
- blockCreated: (0, import_math17.bn)(coin.blockCreated),
4608
- txCreatedIdx: (0, import_math17.bn)(coin.txCreatedIdx)
4532
+ blockCreated: (0, import_math16.bn)(coin.blockCreated),
4533
+ txCreatedIdx: (0, import_math16.bn)(coin.txCreatedIdx)
4609
4534
  }));
4610
4535
  }
4611
4536
  /**
@@ -4642,9 +4567,9 @@ var _Provider = class {
4642
4567
  switch (coin.__typename) {
4643
4568
  case "MessageCoin":
4644
4569
  return {
4645
- amount: (0, import_math17.bn)(coin.amount),
4570
+ amount: (0, import_math16.bn)(coin.amount),
4646
4571
  assetId: coin.assetId,
4647
- daHeight: (0, import_math17.bn)(coin.daHeight),
4572
+ daHeight: (0, import_math16.bn)(coin.daHeight),
4648
4573
  sender: import_address3.Address.fromAddressOrString(coin.sender),
4649
4574
  recipient: import_address3.Address.fromAddressOrString(coin.recipient),
4650
4575
  nonce: coin.nonce
@@ -4652,11 +4577,11 @@ var _Provider = class {
4652
4577
  case "Coin":
4653
4578
  return {
4654
4579
  id: coin.utxoId,
4655
- amount: (0, import_math17.bn)(coin.amount),
4580
+ amount: (0, import_math16.bn)(coin.amount),
4656
4581
  assetId: coin.assetId,
4657
4582
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4658
- blockCreated: (0, import_math17.bn)(coin.blockCreated),
4659
- txCreatedIdx: (0, import_math17.bn)(coin.txCreatedIdx)
4583
+ blockCreated: (0, import_math16.bn)(coin.blockCreated),
4584
+ txCreatedIdx: (0, import_math16.bn)(coin.txCreatedIdx)
4660
4585
  };
4661
4586
  default:
4662
4587
  return null;
@@ -4673,13 +4598,13 @@ var _Provider = class {
4673
4598
  async getBlock(idOrHeight) {
4674
4599
  let variables;
4675
4600
  if (typeof idOrHeight === "number") {
4676
- variables = { height: (0, import_math17.bn)(idOrHeight).toString(10) };
4601
+ variables = { height: (0, import_math16.bn)(idOrHeight).toString(10) };
4677
4602
  } else if (idOrHeight === "latest") {
4678
4603
  variables = { height: (await this.getBlockNumber()).toString(10) };
4679
4604
  } else if (idOrHeight.length === 66) {
4680
4605
  variables = { blockId: idOrHeight };
4681
4606
  } else {
4682
- variables = { blockId: (0, import_math17.bn)(idOrHeight).toString(10) };
4607
+ variables = { blockId: (0, import_math16.bn)(idOrHeight).toString(10) };
4683
4608
  }
4684
4609
  const { block } = await this.operations.getBlock(variables);
4685
4610
  if (!block) {
@@ -4687,7 +4612,7 @@ var _Provider = class {
4687
4612
  }
4688
4613
  return {
4689
4614
  id: block.id,
4690
- height: (0, import_math17.bn)(block.height),
4615
+ height: (0, import_math16.bn)(block.height),
4691
4616
  time: block.header.time,
4692
4617
  transactionIds: block.transactions.map((tx) => tx.id)
4693
4618
  };
@@ -4702,7 +4627,7 @@ var _Provider = class {
4702
4627
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4703
4628
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4704
4629
  id: block.id,
4705
- height: (0, import_math17.bn)(block.height),
4630
+ height: (0, import_math16.bn)(block.height),
4706
4631
  time: block.header.time,
4707
4632
  transactionIds: block.transactions.map((tx) => tx.id)
4708
4633
  }));
@@ -4717,7 +4642,7 @@ var _Provider = class {
4717
4642
  async getBlockWithTransactions(idOrHeight) {
4718
4643
  let variables;
4719
4644
  if (typeof idOrHeight === "number") {
4720
- variables = { blockHeight: (0, import_math17.bn)(idOrHeight).toString(10) };
4645
+ variables = { blockHeight: (0, import_math16.bn)(idOrHeight).toString(10) };
4721
4646
  } else if (idOrHeight === "latest") {
4722
4647
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4723
4648
  } else {
@@ -4729,7 +4654,7 @@ var _Provider = class {
4729
4654
  }
4730
4655
  return {
4731
4656
  id: block.id,
4732
- height: (0, import_math17.bn)(block.height, 10),
4657
+ height: (0, import_math16.bn)(block.height, 10),
4733
4658
  time: block.header.time,
4734
4659
  transactionIds: block.transactions.map((tx) => tx.id),
4735
4660
  transactions: block.transactions.map(
@@ -4778,7 +4703,7 @@ var _Provider = class {
4778
4703
  contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
4779
4704
  asset: (0, import_utils22.hexlify)(assetId)
4780
4705
  });
4781
- return (0, import_math17.bn)(contractBalance.amount, 10);
4706
+ return (0, import_math16.bn)(contractBalance.amount, 10);
4782
4707
  }
4783
4708
  /**
4784
4709
  * Returns the balance for the given owner for the given asset ID.
@@ -4792,7 +4717,7 @@ var _Provider = class {
4792
4717
  owner: import_address3.Address.fromAddressOrString(owner).toB256(),
4793
4718
  assetId: (0, import_utils22.hexlify)(assetId)
4794
4719
  });
4795
- return (0, import_math17.bn)(balance.amount, 10);
4720
+ return (0, import_math16.bn)(balance.amount, 10);
4796
4721
  }
4797
4722
  /**
4798
4723
  * Returns balances for the given owner.
@@ -4810,7 +4735,7 @@ var _Provider = class {
4810
4735
  const balances = result.balances.edges.map((edge) => edge.node);
4811
4736
  return balances.map((balance) => ({
4812
4737
  assetId: balance.assetId,
4813
- amount: (0, import_math17.bn)(balance.amount)
4738
+ amount: (0, import_math16.bn)(balance.amount)
4814
4739
  }));
4815
4740
  }
4816
4741
  /**
@@ -4832,15 +4757,15 @@ var _Provider = class {
4832
4757
  sender: message.sender,
4833
4758
  recipient: message.recipient,
4834
4759
  nonce: message.nonce,
4835
- amount: (0, import_math17.bn)(message.amount),
4760
+ amount: (0, import_math16.bn)(message.amount),
4836
4761
  data: message.data
4837
4762
  }),
4838
4763
  sender: import_address3.Address.fromAddressOrString(message.sender),
4839
4764
  recipient: import_address3.Address.fromAddressOrString(message.recipient),
4840
4765
  nonce: message.nonce,
4841
- amount: (0, import_math17.bn)(message.amount),
4766
+ amount: (0, import_math16.bn)(message.amount),
4842
4767
  data: import_transactions19.InputMessageCoder.decodeData(message.data),
4843
- daHeight: (0, import_math17.bn)(message.daHeight)
4768
+ daHeight: (0, import_math16.bn)(message.daHeight)
4844
4769
  }));
4845
4770
  }
4846
4771
  /**
@@ -4893,59 +4818,59 @@ var _Provider = class {
4893
4818
  } = result.messageProof;
4894
4819
  return {
4895
4820
  messageProof: {
4896
- proofIndex: (0, import_math17.bn)(messageProof.proofIndex),
4821
+ proofIndex: (0, import_math16.bn)(messageProof.proofIndex),
4897
4822
  proofSet: messageProof.proofSet
4898
4823
  },
4899
4824
  blockProof: {
4900
- proofIndex: (0, import_math17.bn)(blockProof.proofIndex),
4825
+ proofIndex: (0, import_math16.bn)(blockProof.proofIndex),
4901
4826
  proofSet: blockProof.proofSet
4902
4827
  },
4903
4828
  messageBlockHeader: {
4904
4829
  id: messageBlockHeader.id,
4905
- daHeight: (0, import_math17.bn)(messageBlockHeader.daHeight),
4906
- transactionsCount: Number(messageBlockHeader.transactionsCount),
4830
+ daHeight: (0, import_math16.bn)(messageBlockHeader.daHeight),
4831
+ transactionsCount: (0, import_math16.bn)(messageBlockHeader.transactionsCount),
4907
4832
  transactionsRoot: messageBlockHeader.transactionsRoot,
4908
- height: (0, import_math17.bn)(messageBlockHeader.height),
4833
+ height: (0, import_math16.bn)(messageBlockHeader.height),
4909
4834
  prevRoot: messageBlockHeader.prevRoot,
4910
4835
  time: messageBlockHeader.time,
4911
4836
  applicationHash: messageBlockHeader.applicationHash,
4912
- messageReceiptCount: Number(messageBlockHeader.messageReceiptCount),
4837
+ messageReceiptCount: (0, import_math16.bn)(messageBlockHeader.messageReceiptCount),
4913
4838
  messageOutboxRoot: messageBlockHeader.messageOutboxRoot,
4914
- consensusParametersVersion: Number(messageBlockHeader.consensusParametersVersion),
4839
+ consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
4915
4840
  eventInboxRoot: messageBlockHeader.eventInboxRoot,
4916
- stateTransitionBytecodeVersion: Number(messageBlockHeader.stateTransitionBytecodeVersion)
4841
+ stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
4917
4842
  },
4918
4843
  commitBlockHeader: {
4919
4844
  id: commitBlockHeader.id,
4920
- daHeight: (0, import_math17.bn)(commitBlockHeader.daHeight),
4921
- transactionsCount: Number(commitBlockHeader.transactionsCount),
4845
+ daHeight: (0, import_math16.bn)(commitBlockHeader.daHeight),
4846
+ transactionsCount: (0, import_math16.bn)(commitBlockHeader.transactionsCount),
4922
4847
  transactionsRoot: commitBlockHeader.transactionsRoot,
4923
- height: (0, import_math17.bn)(commitBlockHeader.height),
4848
+ height: (0, import_math16.bn)(commitBlockHeader.height),
4924
4849
  prevRoot: commitBlockHeader.prevRoot,
4925
4850
  time: commitBlockHeader.time,
4926
4851
  applicationHash: commitBlockHeader.applicationHash,
4927
- messageReceiptCount: Number(commitBlockHeader.messageReceiptCount),
4852
+ messageReceiptCount: (0, import_math16.bn)(commitBlockHeader.messageReceiptCount),
4928
4853
  messageOutboxRoot: commitBlockHeader.messageOutboxRoot,
4929
- consensusParametersVersion: Number(commitBlockHeader.consensusParametersVersion),
4854
+ consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
4930
4855
  eventInboxRoot: commitBlockHeader.eventInboxRoot,
4931
- stateTransitionBytecodeVersion: Number(commitBlockHeader.stateTransitionBytecodeVersion)
4856
+ stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
4932
4857
  },
4933
4858
  sender: import_address3.Address.fromAddressOrString(sender),
4934
4859
  recipient: import_address3.Address.fromAddressOrString(recipient),
4935
4860
  nonce,
4936
- amount: (0, import_math17.bn)(amount),
4861
+ amount: (0, import_math16.bn)(amount),
4937
4862
  data
4938
4863
  };
4939
4864
  }
4940
4865
  async getLatestGasPrice() {
4941
4866
  const { latestGasPrice } = await this.operations.getLatestGasPrice();
4942
- return (0, import_math17.bn)(latestGasPrice.gasPrice);
4867
+ return (0, import_math16.bn)(latestGasPrice.gasPrice);
4943
4868
  }
4944
4869
  async estimateGasPrice(blockHorizon) {
4945
4870
  const { estimateGasPrice } = await this.operations.estimateGasPrice({
4946
4871
  blockHorizon: String(blockHorizon)
4947
4872
  });
4948
- return (0, import_math17.bn)(estimateGasPrice.gasPrice);
4873
+ return (0, import_math16.bn)(estimateGasPrice.gasPrice);
4949
4874
  }
4950
4875
  /**
4951
4876
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
@@ -4966,10 +4891,10 @@ var _Provider = class {
4966
4891
  */
4967
4892
  async produceBlocks(amount, startTime) {
4968
4893
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4969
- blocksToProduce: (0, import_math17.bn)(amount).toString(10),
4894
+ blocksToProduce: (0, import_math16.bn)(amount).toString(10),
4970
4895
  startTimestamp: startTime ? import_utils22.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
4971
4896
  });
4972
- return (0, import_math17.bn)(latestBlockHeight);
4897
+ return (0, import_math16.bn)(latestBlockHeight);
4973
4898
  }
4974
4899
  // eslint-disable-next-line @typescript-eslint/require-await
4975
4900
  async getTransactionResponse(transactionId) {
@@ -4988,15 +4913,6 @@ var _Provider = class {
4988
4913
  }
4989
4914
  return message;
4990
4915
  }
4991
- async getRelayedTransactionStatus(relayedTransactionId) {
4992
- const { relayedTransactionStatus } = await this.operations.getRelayedTransactionStatus({
4993
- relayedTransactionId
4994
- });
4995
- if (!relayedTransactionStatus) {
4996
- return null;
4997
- }
4998
- return relayedTransactionStatus;
4999
- }
5000
4916
  };
5001
4917
  var Provider = _Provider;
5002
4918
  _cacheInputs = new WeakSet();
@@ -5015,7 +4931,7 @@ __publicField(Provider, "nodeInfoCache", {});
5015
4931
 
5016
4932
  // src/providers/transaction-summary/get-transaction-summary.ts
5017
4933
  var import_errors15 = require("@fuel-ts/errors");
5018
- var import_math18 = require("@fuel-ts/math");
4934
+ var import_math17 = require("@fuel-ts/math");
5019
4935
  var import_transactions20 = require("@fuel-ts/transactions");
5020
4936
  var import_utils25 = require("@fuel-ts/utils");
5021
4937
  async function getTransactionSummary(params) {
@@ -5039,11 +4955,7 @@ async function getTransactionSummary(params) {
5039
4955
  }
5040
4956
  const receipts = txReceipts.map(processGqlReceipt);
5041
4957
  const {
5042
- consensusParameters: {
5043
- feeParameters: { gasPerByte, gasPriceFactor },
5044
- txParameters: { maxInputs, maxGasPerTx },
5045
- gasCosts
5046
- }
4958
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
5047
4959
  } = provider.getChain();
5048
4960
  const gasPrice = await provider.getLatestGasPrice();
5049
4961
  const transactionInfo = assembleTransactionSummary({
@@ -5052,8 +4964,8 @@ async function getTransactionSummary(params) {
5052
4964
  transaction: decodedTransaction,
5053
4965
  transactionBytes: (0, import_utils25.arrayify)(gqlTransaction.rawPayload),
5054
4966
  gqlTransactionStatus: gqlTransaction.status,
5055
- gasPerByte: (0, import_math18.bn)(gasPerByte),
5056
- gasPriceFactor: (0, import_math18.bn)(gasPriceFactor),
4967
+ gasPerByte: (0, import_math17.bn)(gasPerByte),
4968
+ gasPriceFactor: (0, import_math17.bn)(gasPriceFactor),
5057
4969
  abiMap,
5058
4970
  maxInputs,
5059
4971
  gasCosts,
@@ -5069,7 +4981,7 @@ async function getTransactionSummaryFromRequest(params) {
5069
4981
  const { provider, transactionRequest, abiMap } = params;
5070
4982
  const { receipts } = await provider.call(transactionRequest);
5071
4983
  const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
5072
- const maxInputs = provider.getChain().consensusParameters.txParameters.maxInputs;
4984
+ const maxInputs = provider.getChain().consensusParameters.maxInputs;
5073
4985
  const transaction = transactionRequest.toTransaction();
5074
4986
  const transactionBytes = transactionRequest.toTransactionBytes();
5075
4987
  const gasPrice = await provider.getLatestGasPrice();
@@ -5092,11 +5004,7 @@ async function getTransactionsSummaries(params) {
5092
5004
  const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
5093
5005
  const { edges, pageInfo } = transactionsByOwner;
5094
5006
  const {
5095
- consensusParameters: {
5096
- feeParameters: { gasPerByte, gasPriceFactor },
5097
- txParameters: { maxInputs, maxGasPerTx },
5098
- gasCosts
5099
- }
5007
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
5100
5008
  } = provider.getChain();
5101
5009
  const gasPrice = await provider.getLatestGasPrice();
5102
5010
  const transactions = edges.map((edge) => {
@@ -5256,7 +5164,7 @@ var assets = [
5256
5164
  ];
5257
5165
 
5258
5166
  // src/providers/transaction-request/helpers.ts
5259
- var import_math19 = require("@fuel-ts/math");
5167
+ var import_math18 = require("@fuel-ts/math");
5260
5168
  var import_transactions21 = require("@fuel-ts/transactions");
5261
5169
  var isRequestInputCoin = (input) => input.type === import_transactions21.InputType.Coin;
5262
5170
  var isRequestInputMessage = (input) => input.type === import_transactions21.InputType.Message;
@@ -5269,17 +5177,17 @@ var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filte
5269
5177
  return acc.add(input.amount);
5270
5178
  }
5271
5179
  return acc;
5272
- }, (0, import_math19.bn)(0));
5180
+ }, (0, import_math18.bn)(0));
5273
5181
 
5274
5182
  // src/utils/formatTransferToContractScriptData.ts
5275
5183
  var import_abi_coder6 = require("@fuel-ts/abi-coder");
5276
- var import_math20 = require("@fuel-ts/math");
5184
+ var import_math19 = require("@fuel-ts/math");
5277
5185
  var import_utils26 = require("@fuel-ts/utils");
5278
5186
  var asm = __toESM(require("@fuels/vm-asm"));
5279
5187
  var formatTransferToContractScriptData = (params) => {
5280
5188
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
5281
5189
  const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
5282
- const encoded = numberCoder.encode(new import_math20.BN(amountToTransfer).toNumber());
5190
+ const encoded = numberCoder.encode(new import_math19.BN(amountToTransfer).toNumber());
5283
5191
  const scriptData = Uint8Array.from([
5284
5192
  ...(0, import_utils26.arrayify)(hexlifiedContractId),
5285
5193
  ...encoded,
@@ -5473,10 +5381,10 @@ var Account = class extends import_interfaces.AbstractAccount {
5473
5381
  async fund(request, params) {
5474
5382
  const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
5475
5383
  const baseAssetId = this.provider.getBaseAssetId();
5476
- const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || (0, import_math21.bn)(0);
5384
+ const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || (0, import_math20.bn)(0);
5477
5385
  const txRequest = request;
5478
5386
  const requiredQuantitiesWithFee = addAmountToCoinQuantities({
5479
- amount: (0, import_math21.bn)(fee),
5387
+ amount: (0, import_math20.bn)(fee),
5480
5388
  assetId: baseAssetId,
5481
5389
  coinQuantities: requiredQuantities
5482
5390
  });
@@ -5484,7 +5392,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5484
5392
  requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
5485
5393
  quantitiesDict[assetId] = {
5486
5394
  required: amount,
5487
- owned: (0, import_math21.bn)(0)
5395
+ owned: (0, import_math20.bn)(0)
5488
5396
  };
5489
5397
  });
5490
5398
  request.inputs.filter(isRequestInputResource).forEach((input) => {
@@ -5589,7 +5497,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5589
5497
  * @returns A promise that resolves to the transaction response.
5590
5498
  */
5591
5499
  async transfer(destination, amount, assetId, txParams = {}) {
5592
- if ((0, import_math21.bn)(amount).lte(0)) {
5500
+ if ((0, import_math20.bn)(amount).lte(0)) {
5593
5501
  throw new import_errors16.FuelError(
5594
5502
  import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
5595
5503
  "Transfer amount must be a positive number."
@@ -5609,7 +5517,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5609
5517
  * @returns A promise that resolves to the transaction response.
5610
5518
  */
5611
5519
  async transferToContract(contractId, amount, assetId, txParams = {}) {
5612
- if ((0, import_math21.bn)(amount).lte(0)) {
5520
+ if ((0, import_math20.bn)(amount).lte(0)) {
5613
5521
  throw new import_errors16.FuelError(
5614
5522
  import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
5615
5523
  "Transfer amount must be a positive number."
@@ -5619,7 +5527,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5619
5527
  const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5620
5528
  const { script, scriptData } = await assembleTransferToContractScript({
5621
5529
  hexlifiedContractId: contractAddress.toB256(),
5622
- amountToTransfer: (0, import_math21.bn)(amount),
5530
+ amountToTransfer: (0, import_math20.bn)(amount),
5623
5531
  assetId: assetIdToTransfer
5624
5532
  });
5625
5533
  const request = new ScriptTransactionRequest({
@@ -5630,7 +5538,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5630
5538
  request.addContractInputAndOutput(contractAddress);
5631
5539
  const txCost = await this.provider.getTransactionCost(request, {
5632
5540
  resourcesOwner: this,
5633
- quantitiesToContract: [{ amount: (0, import_math21.bn)(amount), assetId: String(assetIdToTransfer) }]
5541
+ quantitiesToContract: [{ amount: (0, import_math20.bn)(amount), assetId: String(assetIdToTransfer) }]
5634
5542
  });
5635
5543
  this.validateGasLimitAndMaxFee({
5636
5544
  gasUsed: txCost.gasUsed,
@@ -5656,7 +5564,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5656
5564
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5657
5565
  );
5658
5566
  const amountDataArray = (0, import_utils27.arrayify)(
5659
- "0x".concat((0, import_math21.bn)(amount).toHex().substring(2).padStart(16, "0"))
5567
+ "0x".concat((0, import_math20.bn)(amount).toHex().substring(2).padStart(16, "0"))
5660
5568
  );
5661
5569
  const script = new Uint8Array([
5662
5570
  ...(0, import_utils27.arrayify)(withdrawScript.bytes),
@@ -5666,7 +5574,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5666
5574
  const params = { script, ...txParams };
5667
5575
  const baseAssetId = this.provider.getBaseAssetId();
5668
5576
  const request = new ScriptTransactionRequest(params);
5669
- const quantitiesToContract = [{ amount: (0, import_math21.bn)(amount), assetId: baseAssetId }];
5577
+ const quantitiesToContract = [{ amount: (0, import_math20.bn)(amount), assetId: baseAssetId }];
5670
5578
  const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
5671
5579
  this.validateGasLimitAndMaxFee({
5672
5580
  gasUsed: txCost.gasUsed,
@@ -5761,7 +5669,7 @@ var import_utils30 = require("@fuel-ts/utils");
5761
5669
  var import_address5 = require("@fuel-ts/address");
5762
5670
  var import_crypto2 = require("@fuel-ts/crypto");
5763
5671
  var import_hasher2 = require("@fuel-ts/hasher");
5764
- var import_math22 = require("@fuel-ts/math");
5672
+ var import_math21 = require("@fuel-ts/math");
5765
5673
  var import_utils28 = require("@fuel-ts/utils");
5766
5674
  var import_secp256k1 = require("@noble/curves/secp256k1");
5767
5675
  var Signer = class {
@@ -5781,7 +5689,7 @@ var Signer = class {
5781
5689
  privateKey = `0x${privateKey}`;
5782
5690
  }
5783
5691
  }
5784
- const privateKeyBytes = (0, import_math22.toBytes)(privateKey, 32);
5692
+ const privateKeyBytes = (0, import_math21.toBytes)(privateKey, 32);
5785
5693
  this.privateKey = (0, import_utils28.hexlify)(privateKeyBytes);
5786
5694
  this.publicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
5787
5695
  this.compressedPublicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
@@ -5799,8 +5707,8 @@ var Signer = class {
5799
5707
  */
5800
5708
  sign(data) {
5801
5709
  const signature = import_secp256k1.secp256k1.sign((0, import_utils28.arrayify)(data), (0, import_utils28.arrayify)(this.privateKey));
5802
- const r = (0, import_math22.toBytes)(`0x${signature.r.toString(16)}`, 32);
5803
- const s = (0, import_math22.toBytes)(`0x${signature.s.toString(16)}`, 32);
5710
+ const r = (0, import_math21.toBytes)(`0x${signature.r.toString(16)}`, 32);
5711
+ const s = (0, import_math21.toBytes)(`0x${signature.s.toString(16)}`, 32);
5804
5712
  s[0] |= (signature.recovery || 0) << 7;
5805
5713
  return (0, import_utils28.hexlify)((0, import_utils28.concat)([r, s]));
5806
5714
  }
@@ -6072,7 +5980,7 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
6072
5980
  // src/hdwallet/hdwallet.ts
6073
5981
  var import_errors20 = require("@fuel-ts/errors");
6074
5982
  var import_hasher6 = require("@fuel-ts/hasher");
6075
- var import_math23 = require("@fuel-ts/math");
5983
+ var import_math22 = require("@fuel-ts/math");
6076
5984
  var import_utils34 = require("@fuel-ts/utils");
6077
5985
  var import_ethers2 = require("ethers");
6078
5986
 
@@ -8538,13 +8446,13 @@ var HDWallet = class {
8538
8446
  } else {
8539
8447
  data.set((0, import_utils34.arrayify)(this.publicKey));
8540
8448
  }
8541
- data.set((0, import_math23.toBytes)(index, 4), 33);
8449
+ data.set((0, import_math22.toBytes)(index, 4), 33);
8542
8450
  const bytes = (0, import_utils34.arrayify)((0, import_ethers2.computeHmac)("sha512", chainCode, data));
8543
8451
  const IL = bytes.slice(0, 32);
8544
8452
  const IR = bytes.slice(32);
8545
8453
  if (privateKey) {
8546
8454
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
8547
- const ki = (0, import_math23.bn)(IL).add(privateKey).mod(N).toBytes(32);
8455
+ const ki = (0, import_math22.bn)(IL).add(privateKey).mod(N).toBytes(32);
8548
8456
  return new HDWallet({
8549
8457
  privateKey: ki,
8550
8458
  chainCode: IR,
@@ -8590,7 +8498,7 @@ var HDWallet = class {
8590
8498
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
8591
8499
  const depth = (0, import_utils34.hexlify)(Uint8Array.from([this.depth]));
8592
8500
  const parentFingerprint = this.parentFingerprint;
8593
- const index = (0, import_math23.toHex)(this.index, 4);
8501
+ const index = (0, import_math22.toHex)(this.index, 4);
8594
8502
  const chainCode = this.chainCode;
8595
8503
  const key = this.privateKey != null && !isPublic ? (0, import_utils34.concat)(["0x00", this.privateKey]) : this.publicKey;
8596
8504
  const extendedKey = (0, import_utils34.arrayify)((0, import_utils34.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
@@ -9320,7 +9228,7 @@ var Predicate = class extends Account {
9320
9228
  const mainFn = this.interface?.functions.main;
9321
9229
  const paddedCode = new import_transactions22.ByteArrayCoder(this.bytes.length).encode(this.bytes);
9322
9230
  const VM_TX_MEMORY = (0, import_abi_coder7.calculateVmTxMemory)({
9323
- maxInputs: this.provider.getChain().consensusParameters.txParameters.maxInputs.toNumber()
9231
+ maxInputs: this.provider.getChain().consensusParameters.maxInputs.toNumber()
9324
9232
  });
9325
9233
  const OFFSET = VM_TX_MEMORY + import_abi_coder7.SCRIPT_FIXED_SIZE + import_abi_coder7.INPUT_COIN_FIXED_SIZE + import_abi_coder7.WORD_SIZE + paddedCode.byteLength + policiesLength * import_abi_coder7.WORD_SIZE;
9326
9234
  return mainFn?.encodeArguments(this.predicateData, OFFSET) || new Uint8Array();
@@ -10138,7 +10046,7 @@ __publicField(Fuel, "defaultConfig", {});
10138
10046
  calculateGasFee,
10139
10047
  calculateMetadataGasForTxCreate,
10140
10048
  calculateMetadataGasForTxScript,
10141
- calculateTXFeeForSummary,
10049
+ calculateTransactionFee,
10142
10050
  coinQuantityfy,
10143
10051
  deferPromise,
10144
10052
  dispatchFuelConnectorEvent,
@@ -10198,8 +10106,6 @@ __publicField(Fuel, "defaultConfig", {});
10198
10106
  isTypeCreate,
10199
10107
  isTypeMint,
10200
10108
  isTypeScript,
10201
- isTypeUpgrade,
10202
- isTypeUpload,
10203
10109
  normalizeJSON,
10204
10110
  outputify,
10205
10111
  processGqlReceipt,