@fuel-ts/account 0.94.5 → 0.94.7

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.
Files changed (65) hide show
  1. package/dist/configs.d.ts +6 -0
  2. package/dist/configs.d.ts.map +1 -1
  3. package/dist/configs.global.js.map +1 -1
  4. package/dist/configs.js.map +1 -1
  5. package/dist/configs.mjs.map +1 -1
  6. package/dist/connectors/fuel-connector.d.ts +4 -4
  7. package/dist/connectors/fuel-connector.d.ts.map +1 -1
  8. package/dist/connectors/types/data-type.d.ts +7 -0
  9. package/dist/connectors/types/data-type.d.ts.map +1 -1
  10. package/dist/connectors/types/local-storage.d.ts +0 -1
  11. package/dist/connectors/types/local-storage.d.ts.map +1 -1
  12. package/dist/index.global.js +2008 -1286
  13. package/dist/index.global.js.map +1 -1
  14. package/dist/index.js +1264 -413
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +1137 -290
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/providers/__generated__/operations.d.ts +1 -0
  19. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  20. package/dist/providers/assets/assets.d.ts +1 -1
  21. package/dist/providers/assets/assets.d.ts.map +1 -1
  22. package/dist/providers/assets/utils/network.d.ts.map +1 -1
  23. package/dist/providers/assets/utils/resolveIconPaths.d.ts +1 -1
  24. package/dist/providers/chains.d.ts +2 -0
  25. package/dist/providers/chains.d.ts.map +1 -1
  26. package/dist/providers/fuel-graphql-subscriber.d.ts +0 -2
  27. package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
  28. package/dist/providers/message.d.ts.map +1 -1
  29. package/dist/providers/provider.d.ts +8 -3
  30. package/dist/providers/provider.d.ts.map +1 -1
  31. package/dist/providers/resource.d.ts.map +1 -1
  32. package/dist/providers/transaction-request/helpers.d.ts.map +1 -1
  33. package/dist/providers/transaction-request/index.d.ts +2 -0
  34. package/dist/providers/transaction-request/index.d.ts.map +1 -1
  35. package/dist/providers/transaction-request/transaction-request.d.ts +2 -2
  36. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  37. package/dist/providers/transaction-request/types.d.ts +8 -2
  38. package/dist/providers/transaction-request/types.d.ts.map +1 -1
  39. package/dist/providers/transaction-request/upgrade-transaction-request.d.ts +87 -0
  40. package/dist/providers/transaction-request/upgrade-transaction-request.d.ts.map +1 -0
  41. package/dist/providers/transaction-request/upload-transaction-request.d.ts +82 -0
  42. package/dist/providers/transaction-request/upload-transaction-request.d.ts.map +1 -0
  43. package/dist/providers/transaction-request/utils.d.ts +6 -0
  44. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  45. package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
  46. package/dist/providers/transaction-summary/input.d.ts.map +1 -1
  47. package/dist/providers/transaction-summary/operations.d.ts.map +1 -1
  48. package/dist/providers/transaction-summary/output.d.ts.map +1 -1
  49. package/dist/providers/transaction-summary/receipt.d.ts.map +1 -1
  50. package/dist/providers/utils/extract-tx-error.d.ts.map +1 -1
  51. package/dist/providers/utils/gas.d.ts +16 -0
  52. package/dist/providers/utils/gas.d.ts.map +1 -1
  53. package/dist/providers/utils/receipts.d.ts.map +1 -1
  54. package/dist/test-utils/launchNode.d.ts.map +1 -1
  55. package/dist/test-utils/resources.d.ts.map +1 -1
  56. package/dist/test-utils/transactionRequest.d.ts.map +1 -1
  57. package/dist/test-utils.global.js +2001 -1282
  58. package/dist/test-utils.global.js.map +1 -1
  59. package/dist/test-utils.js +1174 -340
  60. package/dist/test-utils.js.map +1 -1
  61. package/dist/test-utils.mjs +1059 -222
  62. package/dist/test-utils.mjs.map +1 -1
  63. package/dist/wallet-manager/wallet-manager.d.ts +0 -1
  64. package/dist/wallet-manager/wallet-manager.d.ts.map +1 -1
  65. package/package.json +25 -24
package/dist/index.js CHANGED
@@ -94,6 +94,8 @@ __export(src_exports, {
94
94
  TransactionStatus: () => TransactionStatus,
95
95
  TransactionType: () => import_transactions7.TransactionType,
96
96
  TransactionTypeName: () => TransactionTypeName,
97
+ UpgradeTransactionRequest: () => UpgradeTransactionRequest,
98
+ UploadTransactionRequest: () => UploadTransactionRequest,
97
99
  Vault: () => Vault,
98
100
  Wallet: () => Wallet,
99
101
  WalletLocked: () => WalletLocked,
@@ -115,6 +117,9 @@ __export(src_exports, {
115
117
  calculateMetadataGasForTxBlob: () => calculateMetadataGasForTxBlob,
116
118
  calculateMetadataGasForTxCreate: () => calculateMetadataGasForTxCreate,
117
119
  calculateMetadataGasForTxScript: () => calculateMetadataGasForTxScript,
120
+ calculateMetadataGasForTxUpgrade: () => calculateMetadataGasForTxUpgrade,
121
+ calculateMetadataGasForTxUpload: () => calculateMetadataGasForTxUpload,
122
+ calculateMinGasForTxUpload: () => calculateMinGasForTxUpload,
118
123
  calculateTXFeeForSummary: () => calculateTXFeeForSummary,
119
124
  coinQuantityfy: () => coinQuantityfy,
120
125
  deferPromise: () => deferPromise,
@@ -185,6 +190,8 @@ __export(src_exports, {
185
190
  isTransactionTypeBlob: () => isTransactionTypeBlob,
186
191
  isTransactionTypeCreate: () => isTransactionTypeCreate,
187
192
  isTransactionTypeScript: () => isTransactionTypeScript,
193
+ isTransactionTypeUpgrade: () => isTransactionTypeUpgrade,
194
+ isTransactionTypeUpload: () => isTransactionTypeUpload,
188
195
  isType: () => isType,
189
196
  isTypeBlob: () => isTypeBlob,
190
197
  isTypeCreate: () => isTypeCreate,
@@ -211,12 +218,12 @@ module.exports = __toCommonJS(src_exports);
211
218
  var import_abi_coder7 = require("@fuel-ts/abi-coder");
212
219
  var import_address4 = require("@fuel-ts/address");
213
220
  var import_crypto2 = require("@fuel-ts/crypto");
214
- var import_errors18 = require("@fuel-ts/errors");
221
+ var import_errors19 = require("@fuel-ts/errors");
215
222
  var import_interfaces = require("@fuel-ts/interfaces");
216
223
  var import_math21 = require("@fuel-ts/math");
217
- var import_transactions22 = require("@fuel-ts/transactions");
218
- var import_utils30 = require("@fuel-ts/utils");
219
- var import_ramda7 = require("ramda");
224
+ var import_transactions24 = require("@fuel-ts/transactions");
225
+ var import_utils34 = require("@fuel-ts/utils");
226
+ var import_ramda9 = require("ramda");
220
227
 
221
228
  // src/providers/coin-quantity.ts
222
229
  var import_math = require("@fuel-ts/math");
@@ -255,15 +262,15 @@ var addAmountToCoinQuantities = (params) => {
255
262
 
256
263
  // src/providers/provider.ts
257
264
  var import_address3 = require("@fuel-ts/address");
258
- var import_errors16 = require("@fuel-ts/errors");
265
+ var import_errors17 = require("@fuel-ts/errors");
259
266
  var import_math18 = require("@fuel-ts/math");
260
- var import_transactions20 = require("@fuel-ts/transactions");
261
- var import_utils24 = require("@fuel-ts/utils");
267
+ var import_transactions22 = require("@fuel-ts/transactions");
268
+ var import_utils28 = require("@fuel-ts/utils");
262
269
  var import_versions = require("@fuel-ts/versions");
263
- var import_utils25 = require("@noble/curves/abstract/utils");
270
+ var import_utils29 = require("@noble/curves/abstract/utils");
264
271
  var import_graphql_request = require("graphql-request");
265
272
  var import_graphql_tag2 = __toESM(require("graphql-tag"));
266
- var import_ramda6 = require("ramda");
273
+ var import_ramda8 = require("ramda");
267
274
 
268
275
  // src/providers/__generated__/operations.ts
269
276
  var import_graphql_tag = __toESM(require("graphql-tag"));
@@ -1672,6 +1679,7 @@ function assembleReceiptByType(receipt) {
1672
1679
  len: (0, import_math4.bn)(receipt.len),
1673
1680
  digest: hexOrZero(receipt.digest),
1674
1681
  pc: (0, import_math4.bn)(receipt.pc),
1682
+ data: hexOrZero(receipt.data),
1675
1683
  is: (0, import_math4.bn)(receipt.is)
1676
1684
  };
1677
1685
  return returnDataReceipt;
@@ -1720,6 +1728,7 @@ function assembleReceiptByType(receipt) {
1720
1728
  len: (0, import_math4.bn)(receipt.len),
1721
1729
  digest: hexOrZero(receipt.digest),
1722
1730
  pc: (0, import_math4.bn)(receipt.pc),
1731
+ data: hexOrZero(receipt.data),
1723
1732
  is: (0, import_math4.bn)(receipt.is)
1724
1733
  };
1725
1734
  return logDataReceipt;
@@ -1763,6 +1772,7 @@ function assembleReceiptByType(receipt) {
1763
1772
  const amount = (0, import_math4.bn)(receipt.amount);
1764
1773
  const data = receipt.data ? (0, import_utils5.arrayify)(receipt.data) : Uint8Array.from([]);
1765
1774
  const digest = hexOrZero(receipt.digest);
1775
+ const len = (0, import_math4.bn)(receipt.len).toNumber();
1766
1776
  const messageId = import_transactions3.InputMessageCoder.getMessageId({
1767
1777
  sender,
1768
1778
  recipient,
@@ -1776,6 +1786,7 @@ function assembleReceiptByType(receipt) {
1776
1786
  recipient,
1777
1787
  amount,
1778
1788
  nonce,
1789
+ len,
1779
1790
  data,
1780
1791
  digest,
1781
1792
  messageId
@@ -1819,7 +1830,7 @@ function assembleReceiptByType(receipt) {
1819
1830
 
1820
1831
  // src/providers/utils/block-explorer.ts
1821
1832
  var import_errors6 = require("@fuel-ts/errors");
1822
- var DEFAULT_BLOCK_EXPLORER_URL = "https://fuellabs.github.io/block-explorer-v2";
1833
+ var DEFAULT_BLOCK_EXPLORER_URL = "https://app.fuel.network";
1823
1834
  var getPathFromInput = (key, value) => {
1824
1835
  const pathMap = {
1825
1836
  address: `address`,
@@ -1979,6 +1990,39 @@ function calculateMetadataGasForTxBlob({
1979
1990
  const blobLen = resolveGasDependentCosts(witnessBytesSize, gasCosts.s256);
1980
1991
  return txId.add(blobLen);
1981
1992
  }
1993
+ function calculateMetadataGasForTxUpgrade({
1994
+ gasCosts,
1995
+ txBytesSize,
1996
+ consensusSize
1997
+ }) {
1998
+ const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
1999
+ if (consensusSize) {
2000
+ const consensusLen = resolveGasDependentCosts(consensusSize, gasCosts.s256);
2001
+ txId.add(consensusLen);
2002
+ }
2003
+ return txId;
2004
+ }
2005
+ function calculateMetadataGasForTxUpload({
2006
+ gasCosts,
2007
+ txBytesSize,
2008
+ subsectionSize,
2009
+ subsectionsSize
2010
+ }) {
2011
+ const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
2012
+ const subsectionLen = resolveGasDependentCosts(subsectionSize, gasCosts.s256);
2013
+ txId.add(subsectionLen);
2014
+ const subsectionsLen = resolveGasDependentCosts(subsectionsSize, gasCosts.stateRoot);
2015
+ txId.add(subsectionsLen);
2016
+ return txId;
2017
+ }
2018
+ function calculateMinGasForTxUpload({
2019
+ gasCosts,
2020
+ baseMinGas,
2021
+ subsectionSize
2022
+ }) {
2023
+ const additionalStoragePerByte = (0, import_math5.bn)(gasCosts.newStoragePerByte).mul(subsectionSize);
2024
+ return (0, import_math5.bn)(baseMinGas).add(additionalStoragePerByte);
2025
+ }
1982
2026
  var calculateGasFee = (params) => {
1983
2027
  const { gas, gasPrice, priceFactor, tip } = params;
1984
2028
  return gas.mul(gasPrice).div(priceFactor).add((0, import_math5.bn)(tip));
@@ -3147,51 +3191,316 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
3147
3191
  }
3148
3192
  };
3149
3193
 
3150
- // src/providers/transaction-request/utils.ts
3194
+ // src/providers/transaction-request/upgrade-transaction-request.ts
3151
3195
  var import_errors10 = require("@fuel-ts/errors");
3196
+ var import_hasher2 = require("@fuel-ts/hasher");
3152
3197
  var import_transactions11 = require("@fuel-ts/transactions");
3198
+ var import_utils17 = require("@fuel-ts/utils");
3199
+ var import_ramda6 = require("ramda");
3200
+ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3201
+ static from(obj) {
3202
+ if (obj instanceof UpgradeTransactionRequest) {
3203
+ return obj;
3204
+ }
3205
+ return new this((0, import_ramda6.clone)(obj));
3206
+ }
3207
+ /** The type of transaction */
3208
+ type = import_transactions11.TransactionType.Upgrade;
3209
+ /** The upgrade purpose */
3210
+ upgradePurpose;
3211
+ /** Witness index of consensus */
3212
+ bytecodeWitnessIndex;
3213
+ /**
3214
+ * Creates an instance `UpgradeTransactionRequest`.
3215
+ *
3216
+ * @param upgradeTransactionRequestLike - The initial values for the instance
3217
+ */
3218
+ constructor({
3219
+ upgradePurpose,
3220
+ bytecodeWitnessIndex,
3221
+ ...rest
3222
+ } = {}) {
3223
+ super(rest);
3224
+ this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
3225
+ this.upgradePurpose = upgradePurpose ?? {
3226
+ type: import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters,
3227
+ checksum: "0x"
3228
+ };
3229
+ }
3230
+ /**
3231
+ * Adds a consensus parameters upgrade purpose.
3232
+ *
3233
+ * @param consensus - The consensus bytecode.
3234
+ *
3235
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3236
+ */
3237
+ addConsensusParametersUpgradePurpose(consensus) {
3238
+ this.bytecodeWitnessIndex = this.addWitness(consensus);
3239
+ this.upgradePurpose = {
3240
+ type: import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters,
3241
+ checksum: (0, import_hasher2.hash)(consensus)
3242
+ };
3243
+ return this;
3244
+ }
3245
+ /**
3246
+ * Adds a state transition upgrade purpose.
3247
+ *
3248
+ * @param bytecodeRoot - The Merkle root of the state transition.
3249
+ *
3250
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3251
+ */
3252
+ addStateTransitionUpgradePurpose(bytecodeRoot) {
3253
+ this.upgradePurpose = {
3254
+ type: import_transactions11.UpgradePurposeTypeEnum.StateTransition,
3255
+ data: (0, import_utils17.hexlify)(bytecodeRoot)
3256
+ };
3257
+ return this;
3258
+ }
3259
+ /**
3260
+ * Adds an upgrade purpose.
3261
+ *
3262
+ * @param type - The upgrade purpose type.
3263
+ * @param data - The bytecode or merkle root of upgrade purpose
3264
+ *
3265
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3266
+ */
3267
+ addUpgradePurpose(type, data) {
3268
+ if (type === import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters) {
3269
+ this.addConsensusParametersUpgradePurpose(data);
3270
+ }
3271
+ if (type === import_transactions11.UpgradePurposeTypeEnum.StateTransition) {
3272
+ this.addStateTransitionUpgradePurpose(data);
3273
+ }
3274
+ return this;
3275
+ }
3276
+ /**
3277
+ * Converts the transaction request to a `TransactionUpgrade`.
3278
+ *
3279
+ * @returns The transaction create object.
3280
+ */
3281
+ toTransaction() {
3282
+ let upgradePurpose;
3283
+ if (this.upgradePurpose.type === import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters) {
3284
+ upgradePurpose = {
3285
+ type: import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters,
3286
+ data: {
3287
+ witnessIndex: this.bytecodeWitnessIndex,
3288
+ checksum: this.upgradePurpose.checksum
3289
+ }
3290
+ };
3291
+ } else if (this.upgradePurpose.type === import_transactions11.UpgradePurposeTypeEnum.StateTransition) {
3292
+ upgradePurpose = {
3293
+ type: import_transactions11.UpgradePurposeTypeEnum.StateTransition,
3294
+ data: {
3295
+ bytecodeRoot: (0, import_utils17.hexlify)(this.upgradePurpose.data)
3296
+ }
3297
+ };
3298
+ } else {
3299
+ throw new import_errors10.FuelError(import_errors10.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3300
+ }
3301
+ return {
3302
+ type: import_transactions11.TransactionType.Upgrade,
3303
+ ...super.getBaseTransaction(),
3304
+ upgradePurpose
3305
+ };
3306
+ }
3307
+ /**
3308
+ * Gets the Transaction ID by hashing the transaction
3309
+ *
3310
+ * @param chainId - The chain ID.
3311
+ *
3312
+ * @returns - A hash of the transaction, which is the transaction ID.
3313
+ */
3314
+ getTransactionId(chainId) {
3315
+ return hashTransaction(this, chainId);
3316
+ }
3317
+ /**
3318
+ * Calculates the metadata gas cost for an upgrade transaction.
3319
+ *
3320
+ * @param gasCosts - gas costs passed from the chain.
3321
+ *
3322
+ * @returns metadata gas cost for the upgrade transaction.
3323
+ */
3324
+ metadataGas(gasCosts) {
3325
+ const txBytesSize = this.byteSize();
3326
+ if (this.upgradePurpose.type === import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters) {
3327
+ const witnessIndex = this.bytecodeWitnessIndex;
3328
+ const consensusSize = this.witnesses[witnessIndex].length;
3329
+ return calculateMetadataGasForTxUpgrade({
3330
+ gasCosts,
3331
+ txBytesSize,
3332
+ consensusSize
3333
+ });
3334
+ }
3335
+ if (this.upgradePurpose.type === import_transactions11.UpgradePurposeTypeEnum.StateTransition) {
3336
+ return calculateMetadataGasForTxUpgrade({
3337
+ gasCosts,
3338
+ txBytesSize
3339
+ });
3340
+ }
3341
+ throw new import_errors10.FuelError(import_errors10.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3342
+ }
3343
+ };
3344
+
3345
+ // src/providers/transaction-request/upload-transaction-request.ts
3346
+ var import_configs10 = require("@fuel-ts/address/configs");
3347
+ var import_transactions12 = require("@fuel-ts/transactions");
3348
+ var import_utils19 = require("@fuel-ts/utils");
3349
+ var import_ramda7 = require("ramda");
3350
+ var UploadTransactionRequest = class extends BaseTransactionRequest {
3351
+ static from(obj) {
3352
+ if (obj instanceof UploadTransactionRequest) {
3353
+ return obj;
3354
+ }
3355
+ return new this((0, import_ramda7.clone)(obj));
3356
+ }
3357
+ /** Type of the transaction */
3358
+ type = import_transactions12.TransactionType.Upload;
3359
+ /** The witness index of the subsection of the bytecode. */
3360
+ witnessIndex;
3361
+ /** The subsection data. */
3362
+ subsection;
3363
+ /**
3364
+ * Creates an instance `UploadTransactionRequest`.
3365
+ *
3366
+ * @param uploadTransactionRequestLike - The initial values for the instance
3367
+ */
3368
+ constructor({ witnessIndex, subsection, ...rest } = {}) {
3369
+ super(rest);
3370
+ this.witnessIndex = witnessIndex ?? 0;
3371
+ this.subsection = subsection ?? {
3372
+ proofSet: [],
3373
+ root: import_configs10.ZeroBytes32,
3374
+ subsectionIndex: 0,
3375
+ subsectionsNumber: 0
3376
+ };
3377
+ }
3378
+ /**
3379
+ * Adds the subsection.
3380
+ *
3381
+ * @param subsection - The subsection data.
3382
+ */
3383
+ addSubsection(subsection) {
3384
+ const { subsection: subsectionBytecode, ...rest } = subsection;
3385
+ this.subsection = rest;
3386
+ this.witnessIndex = this.addWitness(subsectionBytecode);
3387
+ }
3388
+ /**
3389
+ * Gets the Transaction Request by hashing the transaction.
3390
+ *
3391
+ * @param chainId - The chain ID.
3392
+ *
3393
+ * @returns - A hash of the transaction, which is the transaction ID.
3394
+ */
3395
+ getTransactionId(chainId) {
3396
+ return hashTransaction(this, chainId);
3397
+ }
3398
+ /**
3399
+ * Converts the transaction request to a `TransactionUpload`.
3400
+ *
3401
+ * @returns The transaction create object.
3402
+ */
3403
+ toTransaction() {
3404
+ const baseTransaction = this.getBaseTransaction();
3405
+ const { subsectionIndex, subsectionsNumber, root, proofSet } = this.subsection;
3406
+ return {
3407
+ type: import_transactions12.TransactionType.Upload,
3408
+ ...baseTransaction,
3409
+ subsectionIndex,
3410
+ subsectionsNumber,
3411
+ root: (0, import_utils19.hexlify)(root),
3412
+ proofSet: proofSet.map(import_utils19.hexlify),
3413
+ witnessIndex: this.witnessIndex,
3414
+ proofSetCount: proofSet.length
3415
+ };
3416
+ }
3417
+ /**
3418
+ * Calculates the metadata gas cost for an upload transaction.
3419
+ *
3420
+ * @param gasCosts - gas costs passed from the chain.
3421
+ *
3422
+ * @returns metadata gas cost for the upload transaction.
3423
+ */
3424
+ metadataGas(gasCosts) {
3425
+ return calculateMetadataGasForTxUpload({
3426
+ gasCosts,
3427
+ txBytesSize: this.byteSize(),
3428
+ subsectionSize: (0, import_utils19.arrayify)(this.witnesses[this.witnessIndex]).length,
3429
+ subsectionsSize: this.subsection.subsectionsNumber
3430
+ });
3431
+ }
3432
+ /**
3433
+ * Calculates the minimum gas for an upload transaction.
3434
+ *
3435
+ * @param chainInfo - The chain information.
3436
+ *
3437
+ * @returns the minimum gas for the upload transaction
3438
+ */
3439
+ calculateMinGas(chainInfo) {
3440
+ const minGas = super.calculateMinGas(chainInfo);
3441
+ const { gasCosts } = chainInfo.consensusParameters;
3442
+ const bytecode = this.witnesses[this.witnessIndex] ?? import_configs10.ZeroBytes32;
3443
+ return calculateMinGasForTxUpload({
3444
+ gasCosts,
3445
+ baseMinGas: minGas.toNumber(),
3446
+ subsectionSize: (0, import_utils19.arrayify)(bytecode).length
3447
+ });
3448
+ }
3449
+ };
3450
+
3451
+ // src/providers/transaction-request/utils.ts
3452
+ var import_errors11 = require("@fuel-ts/errors");
3453
+ var import_transactions13 = require("@fuel-ts/transactions");
3153
3454
  var transactionRequestify = (obj) => {
3154
- if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest) {
3455
+ if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
3155
3456
  return obj;
3156
3457
  }
3157
3458
  const { type } = obj;
3158
3459
  switch (obj.type) {
3159
- case import_transactions11.TransactionType.Script: {
3460
+ case import_transactions13.TransactionType.Script: {
3160
3461
  return ScriptTransactionRequest.from(obj);
3161
3462
  }
3162
- case import_transactions11.TransactionType.Create: {
3463
+ case import_transactions13.TransactionType.Create: {
3163
3464
  return CreateTransactionRequest.from(obj);
3164
3465
  }
3165
- case import_transactions11.TransactionType.Blob: {
3466
+ case import_transactions13.TransactionType.Blob: {
3166
3467
  return BlobTransactionRequest.from(obj);
3167
3468
  }
3469
+ case import_transactions13.TransactionType.Upgrade: {
3470
+ return UpgradeTransactionRequest.from(obj);
3471
+ }
3472
+ case import_transactions13.TransactionType.Upload: {
3473
+ return UploadTransactionRequest.from(obj);
3474
+ }
3168
3475
  default: {
3169
- throw new import_errors10.FuelError(
3170
- import_errors10.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3476
+ throw new import_errors11.FuelError(
3477
+ import_errors11.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3171
3478
  `Unsupported transaction type: ${type}.`
3172
3479
  );
3173
3480
  }
3174
3481
  }
3175
3482
  };
3176
- var isTransactionTypeScript = (request) => request.type === import_transactions11.TransactionType.Script;
3177
- var isTransactionTypeCreate = (request) => request.type === import_transactions11.TransactionType.Create;
3178
- var isTransactionTypeBlob = (request) => request.type === import_transactions11.TransactionType.Blob;
3483
+ var isTransactionTypeScript = (request) => request.type === import_transactions13.TransactionType.Script;
3484
+ var isTransactionTypeCreate = (request) => request.type === import_transactions13.TransactionType.Create;
3485
+ var isTransactionTypeBlob = (request) => request.type === import_transactions13.TransactionType.Blob;
3486
+ var isTransactionTypeUpgrade = (request) => request.type === import_transactions13.TransactionType.Upgrade;
3487
+ var isTransactionTypeUpload = (request) => request.type === import_transactions13.TransactionType.Upload;
3179
3488
 
3180
3489
  // src/providers/transaction-response/transaction-response.ts
3181
- var import_errors14 = require("@fuel-ts/errors");
3490
+ var import_errors15 = require("@fuel-ts/errors");
3182
3491
  var import_math17 = require("@fuel-ts/math");
3183
- var import_transactions19 = require("@fuel-ts/transactions");
3184
- var import_utils21 = require("@fuel-ts/utils");
3492
+ var import_transactions21 = require("@fuel-ts/transactions");
3493
+ var import_utils25 = require("@fuel-ts/utils");
3185
3494
 
3186
3495
  // src/providers/transaction-summary/assemble-transaction-summary.ts
3187
3496
  var import_math16 = require("@fuel-ts/math");
3188
- var import_transactions17 = require("@fuel-ts/transactions");
3189
- var import_utils19 = require("@fuel-ts/utils");
3497
+ var import_transactions19 = require("@fuel-ts/transactions");
3498
+ var import_utils23 = require("@fuel-ts/utils");
3190
3499
 
3191
3500
  // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
3192
3501
  var import_math12 = require("@fuel-ts/math");
3193
- var import_transactions12 = require("@fuel-ts/transactions");
3194
- var import_utils17 = require("@fuel-ts/utils");
3502
+ var import_transactions14 = require("@fuel-ts/transactions");
3503
+ var import_utils21 = require("@fuel-ts/utils");
3195
3504
  var calculateTXFeeForSummary = (params) => {
3196
3505
  const {
3197
3506
  gasPrice,
@@ -3205,17 +3514,17 @@ var calculateTXFeeForSummary = (params) => {
3205
3514
  }
3206
3515
  const gasPerByte = (0, import_math12.bn)(feeParams.gasPerByte);
3207
3516
  const gasPriceFactor = (0, import_math12.bn)(feeParams.gasPriceFactor);
3208
- const transactionBytes = (0, import_utils17.arrayify)(rawPayload);
3209
- const [transaction] = new import_transactions12.TransactionCoder().decode(transactionBytes, 0);
3517
+ const transactionBytes = (0, import_utils21.arrayify)(rawPayload);
3518
+ const [transaction] = new import_transactions14.TransactionCoder().decode(transactionBytes, 0);
3210
3519
  const { type, witnesses, inputs, policies } = transaction;
3211
3520
  let metadataGas = (0, import_math12.bn)(0);
3212
3521
  let gasLimit = (0, import_math12.bn)(0);
3213
- if (type !== import_transactions12.TransactionType.Create && type !== import_transactions12.TransactionType.Script) {
3522
+ if (type !== import_transactions14.TransactionType.Create && type !== import_transactions14.TransactionType.Script) {
3214
3523
  return (0, import_math12.bn)(0);
3215
3524
  }
3216
- if (type === import_transactions12.TransactionType.Create) {
3525
+ if (type === import_transactions14.TransactionType.Create) {
3217
3526
  const { bytecodeWitnessIndex, storageSlots } = transaction;
3218
- const contractBytesSize = (0, import_math12.bn)((0, import_utils17.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
3527
+ const contractBytesSize = (0, import_math12.bn)((0, import_utils21.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
3219
3528
  metadataGas = calculateMetadataGasForTxCreate({
3220
3529
  contractBytesSize,
3221
3530
  gasCosts,
@@ -3239,7 +3548,7 @@ var calculateTXFeeForSummary = (params) => {
3239
3548
  metadataGas,
3240
3549
  txBytesSize: transactionBytes.length
3241
3550
  });
3242
- const witnessLimit = policies.find((policy) => policy.type === import_transactions12.PolicyType.WitnessLimit)?.data;
3551
+ const witnessLimit = policies.find((policy) => policy.type === import_transactions14.PolicyType.WitnessLimit)?.data;
3243
3552
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
3244
3553
  const maxGas = getMaxGas({
3245
3554
  gasPerByte,
@@ -3259,10 +3568,10 @@ var calculateTXFeeForSummary = (params) => {
3259
3568
  };
3260
3569
 
3261
3570
  // src/providers/transaction-summary/operations.ts
3262
- var import_configs10 = require("@fuel-ts/address/configs");
3263
- var import_errors12 = require("@fuel-ts/errors");
3571
+ var import_configs11 = require("@fuel-ts/address/configs");
3572
+ var import_errors13 = require("@fuel-ts/errors");
3264
3573
  var import_math14 = require("@fuel-ts/math");
3265
- var import_transactions15 = require("@fuel-ts/transactions");
3574
+ var import_transactions17 = require("@fuel-ts/transactions");
3266
3575
 
3267
3576
  // src/providers/transaction-summary/call.ts
3268
3577
  var import_abi_coder4 = require("@fuel-ts/abi-coder");
@@ -3298,9 +3607,9 @@ var getFunctionCall = ({ abi, receipt }) => {
3298
3607
  };
3299
3608
 
3300
3609
  // src/providers/transaction-summary/input.ts
3301
- var import_errors11 = require("@fuel-ts/errors");
3610
+ var import_errors12 = require("@fuel-ts/errors");
3302
3611
  var import_math13 = require("@fuel-ts/math");
3303
- var import_transactions13 = require("@fuel-ts/transactions");
3612
+ var import_transactions15 = require("@fuel-ts/transactions");
3304
3613
  function getInputsByTypes(inputs, types) {
3305
3614
  return inputs.filter((i) => types.includes(i.type));
3306
3615
  }
@@ -3308,19 +3617,19 @@ function getInputsByType(inputs, type) {
3308
3617
  return inputs.filter((i) => i.type === type);
3309
3618
  }
3310
3619
  function getInputsCoin(inputs) {
3311
- return getInputsByType(inputs, import_transactions13.InputType.Coin);
3620
+ return getInputsByType(inputs, import_transactions15.InputType.Coin);
3312
3621
  }
3313
3622
  function getInputsMessage(inputs) {
3314
- return getInputsByType(inputs, import_transactions13.InputType.Message);
3623
+ return getInputsByType(inputs, import_transactions15.InputType.Message);
3315
3624
  }
3316
3625
  function getInputsCoinAndMessage(inputs) {
3317
- return getInputsByTypes(inputs, [import_transactions13.InputType.Coin, import_transactions13.InputType.Message]);
3626
+ return getInputsByTypes(inputs, [import_transactions15.InputType.Coin, import_transactions15.InputType.Message]);
3318
3627
  }
3319
3628
  function isInputCoin(input) {
3320
- return input.type === import_transactions13.InputType.Coin;
3629
+ return input.type === import_transactions15.InputType.Coin;
3321
3630
  }
3322
3631
  function getInputsContract(inputs) {
3323
- return getInputsByType(inputs, import_transactions13.InputType.Contract);
3632
+ return getInputsByType(inputs, import_transactions15.InputType.Contract);
3324
3633
  }
3325
3634
  function findCoinInput(inputs, assetId) {
3326
3635
  const coinInputs = getInputsCoin(inputs);
@@ -3366,43 +3675,43 @@ function getInputContractFromIndex(inputs, inputIndex) {
3366
3675
  if (!contractInput) {
3367
3676
  return void 0;
3368
3677
  }
3369
- if (contractInput.type !== import_transactions13.InputType.Contract) {
3370
- throw new import_errors11.FuelError(
3371
- import_errors11.ErrorCode.INVALID_TRANSACTION_INPUT,
3678
+ if (contractInput.type !== import_transactions15.InputType.Contract) {
3679
+ throw new import_errors12.FuelError(
3680
+ import_errors12.ErrorCode.INVALID_TRANSACTION_INPUT,
3372
3681
  `Contract input should be of type 'contract'.`
3373
3682
  );
3374
3683
  }
3375
3684
  return contractInput;
3376
3685
  }
3377
3686
  function getInputAccountAddress(input) {
3378
- if (input.type === import_transactions13.InputType.Coin) {
3687
+ if (input.type === import_transactions15.InputType.Coin) {
3379
3688
  return input.owner.toString();
3380
3689
  }
3381
- if (input.type === import_transactions13.InputType.Message) {
3690
+ if (input.type === import_transactions15.InputType.Message) {
3382
3691
  return input.recipient.toString();
3383
3692
  }
3384
3693
  return "";
3385
3694
  }
3386
3695
 
3387
3696
  // src/providers/transaction-summary/output.ts
3388
- var import_transactions14 = require("@fuel-ts/transactions");
3697
+ var import_transactions16 = require("@fuel-ts/transactions");
3389
3698
  function getOutputsByType(outputs, type) {
3390
3699
  return outputs.filter((o) => o.type === type);
3391
3700
  }
3392
3701
  function getOutputsContractCreated(outputs) {
3393
- return getOutputsByType(outputs, import_transactions14.OutputType.ContractCreated);
3702
+ return getOutputsByType(outputs, import_transactions16.OutputType.ContractCreated);
3394
3703
  }
3395
3704
  function getOutputsCoin(outputs) {
3396
- return getOutputsByType(outputs, import_transactions14.OutputType.Coin);
3705
+ return getOutputsByType(outputs, import_transactions16.OutputType.Coin);
3397
3706
  }
3398
3707
  function getOutputsChange(outputs) {
3399
- return getOutputsByType(outputs, import_transactions14.OutputType.Change);
3708
+ return getOutputsByType(outputs, import_transactions16.OutputType.Change);
3400
3709
  }
3401
3710
  function getOutputsContract(outputs) {
3402
- return getOutputsByType(outputs, import_transactions14.OutputType.Contract);
3711
+ return getOutputsByType(outputs, import_transactions16.OutputType.Contract);
3403
3712
  }
3404
3713
  function getOutputsVariable(outputs) {
3405
- return getOutputsByType(outputs, import_transactions14.OutputType.Variable);
3714
+ return getOutputsByType(outputs, import_transactions16.OutputType.Variable);
3406
3715
  }
3407
3716
 
3408
3717
  // src/providers/transaction-summary/types.ts
@@ -3452,17 +3761,21 @@ function getReceiptsByType(receipts, type) {
3452
3761
  }
3453
3762
  function getTransactionTypeName(transactionType) {
3454
3763
  switch (transactionType) {
3455
- case import_transactions15.TransactionType.Mint:
3764
+ case import_transactions17.TransactionType.Mint:
3456
3765
  return "Mint" /* Mint */;
3457
- case import_transactions15.TransactionType.Create:
3766
+ case import_transactions17.TransactionType.Create:
3458
3767
  return "Create" /* Create */;
3459
- case import_transactions15.TransactionType.Script:
3768
+ case import_transactions17.TransactionType.Script:
3460
3769
  return "Script" /* Script */;
3461
- case import_transactions15.TransactionType.Blob:
3770
+ case import_transactions17.TransactionType.Blob:
3462
3771
  return "Blob" /* Blob */;
3772
+ case import_transactions17.TransactionType.Upgrade:
3773
+ return "Upgrade" /* Upgrade */;
3774
+ case import_transactions17.TransactionType.Upload:
3775
+ return "Upload" /* Upload */;
3463
3776
  default:
3464
- throw new import_errors12.FuelError(
3465
- import_errors12.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3777
+ throw new import_errors13.FuelError(
3778
+ import_errors13.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3466
3779
  `Unsupported transaction type: ${transactionType}.`
3467
3780
  );
3468
3781
  }
@@ -3493,10 +3806,10 @@ function hasSameAssetId(a) {
3493
3806
  return (b) => a.assetId === b.assetId;
3494
3807
  }
3495
3808
  function getReceiptsCall(receipts) {
3496
- return getReceiptsByType(receipts, import_transactions15.ReceiptType.Call);
3809
+ return getReceiptsByType(receipts, import_transactions17.ReceiptType.Call);
3497
3810
  }
3498
3811
  function getReceiptsMessageOut(receipts) {
3499
- return getReceiptsByType(receipts, import_transactions15.ReceiptType.MessageOut);
3812
+ return getReceiptsByType(receipts, import_transactions17.ReceiptType.MessageOut);
3500
3813
  }
3501
3814
  function mergeAssets(op1, op2) {
3502
3815
  const assets1 = op1.assetsSent || [];
@@ -3545,7 +3858,7 @@ function addOperation(operations, toAdd) {
3545
3858
  return operations.map((op, index) => index === existingIndex ? mergeOperations(op, toAdd) : op);
3546
3859
  }
3547
3860
  function getReceiptsTransferOut(receipts) {
3548
- return getReceiptsByType(receipts, import_transactions15.ReceiptType.TransferOut);
3861
+ return getReceiptsByType(receipts, import_transactions17.ReceiptType.TransferOut);
3549
3862
  }
3550
3863
  function getWithdrawFromFuelOperations({
3551
3864
  inputs,
@@ -3607,7 +3920,7 @@ function getAssetsSent(receipt) {
3607
3920
  ];
3608
3921
  }
3609
3922
  function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload, maxInputs, baseAssetId) {
3610
- const assetId = receipt.assetId === import_configs10.ZeroBytes32 ? baseAssetId : receipt.assetId;
3923
+ const assetId = receipt.assetId === import_configs11.ZeroBytes32 ? baseAssetId : receipt.assetId;
3611
3924
  const input = getInputFromAssetId(inputs, assetId, assetId === baseAssetId);
3612
3925
  if (!input) {
3613
3926
  return [];
@@ -3663,7 +3976,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
3663
3976
  const { to: toAddress, assetId, amount } = receipt;
3664
3977
  let { from: fromAddress } = receipt;
3665
3978
  const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
3666
- if (import_configs10.ZeroBytes32 === fromAddress) {
3979
+ if (import_configs11.ZeroBytes32 === fromAddress) {
3667
3980
  const change = changeOutputs.find((output) => output.assetId === assetId);
3668
3981
  fromAddress = change?.to || fromAddress;
3669
3982
  }
@@ -3728,11 +4041,11 @@ function getTransferOperations({
3728
4041
  });
3729
4042
  const transferReceipts = getReceiptsByType(
3730
4043
  receipts,
3731
- import_transactions15.ReceiptType.Transfer
4044
+ import_transactions17.ReceiptType.Transfer
3732
4045
  );
3733
4046
  const transferOutReceipts = getReceiptsByType(
3734
4047
  receipts,
3735
- import_transactions15.ReceiptType.TransferOut
4048
+ import_transactions17.ReceiptType.TransferOut
3736
4049
  );
3737
4050
  [...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
3738
4051
  const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
@@ -3816,30 +4129,12 @@ function getOperations({
3816
4129
  }
3817
4130
 
3818
4131
  // src/providers/transaction-summary/receipt.ts
3819
- var import_transactions16 = require("@fuel-ts/transactions");
3820
- var processGqlReceipt = (gqlReceipt) => {
3821
- const receipt = assembleReceiptByType(gqlReceipt);
3822
- switch (receipt.type) {
3823
- case import_transactions16.ReceiptType.ReturnData: {
3824
- return {
3825
- ...receipt,
3826
- data: gqlReceipt.data || "0x"
3827
- };
3828
- }
3829
- case import_transactions16.ReceiptType.LogData: {
3830
- return {
3831
- ...receipt,
3832
- data: gqlReceipt.data || "0x"
3833
- };
3834
- }
3835
- default:
3836
- return receipt;
3837
- }
3838
- };
4132
+ var import_transactions18 = require("@fuel-ts/transactions");
4133
+ var processGqlReceipt = (gqlReceipt) => assembleReceiptByType(gqlReceipt);
3839
4134
  var extractMintedAssetsFromReceipts = (receipts) => {
3840
4135
  const mintedAssets = [];
3841
4136
  receipts.forEach((receipt) => {
3842
- if (receipt.type === import_transactions16.ReceiptType.Mint) {
4137
+ if (receipt.type === import_transactions18.ReceiptType.Mint) {
3843
4138
  mintedAssets.push({
3844
4139
  subId: receipt.subId,
3845
4140
  contractId: receipt.contractId,
@@ -3853,7 +4148,7 @@ var extractMintedAssetsFromReceipts = (receipts) => {
3853
4148
  var extractBurnedAssetsFromReceipts = (receipts) => {
3854
4149
  const burnedAssets = [];
3855
4150
  receipts.forEach((receipt) => {
3856
- if (receipt.type === import_transactions16.ReceiptType.Burn) {
4151
+ if (receipt.type === import_transactions18.ReceiptType.Burn) {
3857
4152
  burnedAssets.push({
3858
4153
  subId: receipt.subId,
3859
4154
  contractId: receipt.contractId,
@@ -3866,7 +4161,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3866
4161
  };
3867
4162
 
3868
4163
  // src/providers/transaction-summary/status.ts
3869
- var import_errors13 = require("@fuel-ts/errors");
4164
+ var import_errors14 = require("@fuel-ts/errors");
3870
4165
  var import_math15 = require("@fuel-ts/math");
3871
4166
  var getTransactionStatusName = (gqlStatus) => {
3872
4167
  switch (gqlStatus) {
@@ -3879,8 +4174,8 @@ var getTransactionStatusName = (gqlStatus) => {
3879
4174
  case "SqueezedOutStatus":
3880
4175
  return "squeezedout" /* squeezedout */;
3881
4176
  default:
3882
- throw new import_errors13.FuelError(
3883
- import_errors13.ErrorCode.INVALID_TRANSACTION_STATUS,
4177
+ throw new import_errors14.FuelError(
4178
+ import_errors14.ErrorCode.INVALID_TRANSACTION_STATUS,
3884
4179
  `Invalid transaction status: ${gqlStatus}.`
3885
4180
  );
3886
4181
  }
@@ -3949,7 +4244,7 @@ function assembleTransactionSummary(params) {
3949
4244
  baseAssetId
3950
4245
  } = params;
3951
4246
  const gasUsed = getGasUsedFromReceipts(receipts);
3952
- const rawPayload = (0, import_utils19.hexlify)(transactionBytes);
4247
+ const rawPayload = (0, import_utils23.hexlify)(transactionBytes);
3953
4248
  const operations = getOperations({
3954
4249
  transactionType: transaction.type,
3955
4250
  inputs: transaction.inputs || [],
@@ -3961,7 +4256,7 @@ function assembleTransactionSummary(params) {
3961
4256
  baseAssetId
3962
4257
  });
3963
4258
  const typeName = getTransactionTypeName(transaction.type);
3964
- const tip = (0, import_math16.bn)(transaction.policies?.find((policy) => policy.type === import_transactions17.PolicyType.Tip)?.data);
4259
+ const tip = (0, import_math16.bn)(transaction.policies?.find((policy) => policy.type === import_transactions19.PolicyType.Tip)?.data);
3965
4260
  const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3966
4261
  const fee = calculateTXFeeForSummary({
3967
4262
  totalFee,
@@ -3981,7 +4276,7 @@ function assembleTransactionSummary(params) {
3981
4276
  const burnedAssets = extractBurnedAssetsFromReceipts(receipts);
3982
4277
  let date;
3983
4278
  if (time) {
3984
- date = import_utils19.DateTime.fromTai64(time);
4279
+ date = import_utils23.DateTime.fromTai64(time);
3985
4280
  }
3986
4281
  const transactionSummary = {
3987
4282
  id,
@@ -4013,12 +4308,12 @@ function assembleTransactionSummary(params) {
4013
4308
 
4014
4309
  // src/providers/transaction-response/getDecodedLogs.ts
4015
4310
  var import_abi_coder5 = require("@fuel-ts/abi-coder");
4016
- var import_transactions18 = require("@fuel-ts/transactions");
4311
+ var import_transactions20 = require("@fuel-ts/transactions");
4017
4312
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
4018
4313
  return receipts.reduce((logs, receipt) => {
4019
- if (receipt.type === import_transactions18.ReceiptType.LogData || receipt.type === import_transactions18.ReceiptType.Log) {
4314
+ if (receipt.type === import_transactions20.ReceiptType.LogData || receipt.type === import_transactions20.ReceiptType.Log) {
4020
4315
  const interfaceToUse = new import_abi_coder5.Interface(externalAbis[receipt.id] || mainAbi);
4021
- const data = receipt.type === import_transactions18.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
4316
+ const data = receipt.type === import_transactions20.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
4022
4317
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toString());
4023
4318
  logs.push(decodedLog);
4024
4319
  }
@@ -4032,28 +4327,28 @@ function mapGqlOutputsToTxOutputs(outputs) {
4032
4327
  const obj = "amount" in o ? { ...o, amount: (0, import_math17.bn)(o.amount) } : o;
4033
4328
  switch (obj.type) {
4034
4329
  case "CoinOutput":
4035
- return { ...obj, type: import_transactions19.OutputType.Coin };
4330
+ return { ...obj, type: import_transactions21.OutputType.Coin };
4036
4331
  case "ContractOutput":
4037
4332
  return {
4038
4333
  ...obj,
4039
- type: import_transactions19.OutputType.Contract,
4334
+ type: import_transactions21.OutputType.Contract,
4040
4335
  inputIndex: parseInt(obj.inputIndex, 10)
4041
4336
  };
4042
4337
  case "ChangeOutput":
4043
4338
  return {
4044
4339
  ...obj,
4045
- type: import_transactions19.OutputType.Change
4340
+ type: import_transactions21.OutputType.Change
4046
4341
  };
4047
4342
  case "VariableOutput":
4048
- return { ...obj, type: import_transactions19.OutputType.Variable };
4343
+ return { ...obj, type: import_transactions21.OutputType.Variable };
4049
4344
  case "ContractCreated":
4050
4345
  return {
4051
4346
  ...obj,
4052
- type: import_transactions19.OutputType.ContractCreated,
4347
+ type: import_transactions21.OutputType.ContractCreated,
4053
4348
  contractId: obj.contract
4054
4349
  };
4055
4350
  default:
4056
- return (0, import_utils21.assertUnreachable)(obj);
4351
+ return (0, import_utils25.assertUnreachable)(obj);
4057
4352
  }
4058
4353
  });
4059
4354
  }
@@ -4107,7 +4402,7 @@ var TransactionResponse = class {
4107
4402
  const correspondingInput = status.transaction.inputs?.[idx];
4108
4403
  return {
4109
4404
  ...input,
4110
- txPointer: import_transactions19.TxPointerCoder.decodeFromGqlScalar(correspondingInput.txPointer)
4405
+ txPointer: import_transactions21.TxPointerCoder.decodeFromGqlScalar(correspondingInput.txPointer)
4111
4406
  };
4112
4407
  }
4113
4408
  return input;
@@ -4130,7 +4425,7 @@ var TransactionResponse = class {
4130
4425
  const gqlTransaction = this.gqlTransaction ?? await this.fetch();
4131
4426
  return {
4132
4427
  tx: this.decodeTransaction(gqlTransaction),
4133
- bytes: (0, import_utils21.arrayify)(gqlTransaction.rawPayload)
4428
+ bytes: (0, import_utils25.arrayify)(gqlTransaction.rawPayload)
4134
4429
  };
4135
4430
  }
4136
4431
  getReceipts() {
@@ -4174,8 +4469,8 @@ var TransactionResponse = class {
4174
4469
  * @returns The decoded transaction.
4175
4470
  */
4176
4471
  decodeTransaction(transactionWithReceipts) {
4177
- return new import_transactions19.TransactionCoder().decode(
4178
- (0, import_utils21.arrayify)(transactionWithReceipts.rawPayload),
4472
+ return new import_transactions21.TransactionCoder().decode(
4473
+ (0, import_utils25.arrayify)(transactionWithReceipts.rawPayload),
4179
4474
  0
4180
4475
  )?.[0];
4181
4476
  }
@@ -4222,8 +4517,8 @@ var TransactionResponse = class {
4222
4517
  this.status = statusChange;
4223
4518
  if (statusChange.type === "SqueezedOutStatus") {
4224
4519
  this.unsetResourceCache();
4225
- throw new import_errors14.FuelError(
4226
- import_errors14.ErrorCode.TRANSACTION_SQUEEZED_OUT,
4520
+ throw new import_errors15.FuelError(
4521
+ import_errors15.ErrorCode.TRANSACTION_SQUEEZED_OUT,
4227
4522
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
4228
4523
  );
4229
4524
  }
@@ -4294,7 +4589,7 @@ var TransactionResponse = class {
4294
4589
  };
4295
4590
 
4296
4591
  // src/providers/utils/auto-retry-fetch.ts
4297
- var import_utils23 = require("@fuel-ts/utils");
4592
+ var import_utils27 = require("@fuel-ts/utils");
4298
4593
  function getWaitDelay(options, retryAttemptNum) {
4299
4594
  const duration = options.baseDelay ?? 150;
4300
4595
  switch (options.backoff) {
@@ -4324,25 +4619,25 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
4324
4619
  throw error;
4325
4620
  }
4326
4621
  const delay = getWaitDelay(options, retryNum);
4327
- await (0, import_utils23.sleep)(delay);
4622
+ await (0, import_utils27.sleep)(delay);
4328
4623
  return autoRetryFetch(fetchFn, options, retryNum)(...args);
4329
4624
  }
4330
4625
  };
4331
4626
  }
4332
4627
 
4333
4628
  // src/providers/utils/handle-gql-error-message.ts
4334
- var import_errors15 = require("@fuel-ts/errors");
4629
+ var import_errors16 = require("@fuel-ts/errors");
4335
4630
  var handleGqlErrorMessage = (errorMessage, rawError) => {
4336
4631
  switch (errorMessage) {
4337
4632
  case "not enough coins to fit the target" /* NOT_ENOUGH_COINS */:
4338
- throw new import_errors15.FuelError(
4339
- import_errors15.ErrorCode.NOT_ENOUGH_FUNDS,
4633
+ throw new import_errors16.FuelError(
4634
+ import_errors16.ErrorCode.NOT_ENOUGH_FUNDS,
4340
4635
  `The account(s) sending the transaction don't have enough funds to cover the transaction.`,
4341
4636
  {},
4342
4637
  rawError
4343
4638
  );
4344
4639
  default:
4345
- throw new import_errors15.FuelError(import_errors15.ErrorCode.INVALID_REQUEST, errorMessage);
4640
+ throw new import_errors16.FuelError(import_errors16.ErrorCode.INVALID_REQUEST, errorMessage);
4346
4641
  }
4347
4642
  };
4348
4643
 
@@ -4424,24 +4719,34 @@ var _Provider = class {
4424
4719
  * @hidden
4425
4720
  */
4426
4721
  constructor(url, options = {}) {
4427
- this.url = url;
4428
4722
  /**
4429
4723
  * @hidden
4430
4724
  */
4431
4725
  __privateAdd(this, _cacheInputs);
4432
4726
  __publicField(this, "operations");
4433
4727
  __publicField(this, "cache");
4728
+ /** @hidden */
4729
+ __publicField(this, "url");
4730
+ /** @hidden */
4731
+ __publicField(this, "urlWithoutAuth");
4434
4732
  __publicField(this, "options", {
4435
4733
  timeout: void 0,
4436
4734
  resourceCacheTTL: void 0,
4437
4735
  fetch: void 0,
4438
- retryOptions: void 0
4736
+ retryOptions: void 0,
4737
+ headers: void 0
4439
4738
  });
4739
+ const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
4740
+ this.url = rawUrl;
4741
+ this.urlWithoutAuth = urlWithoutAuth;
4440
4742
  this.options = { ...this.options, ...options };
4441
4743
  this.url = url;
4744
+ if (headers) {
4745
+ this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
4746
+ }
4442
4747
  this.operations = this.createOperations();
4443
4748
  const { resourceCacheTTL } = this.options;
4444
- if ((0, import_utils24.isDefined)(resourceCacheTTL)) {
4749
+ if ((0, import_utils28.isDefined)(resourceCacheTTL)) {
4445
4750
  if (resourceCacheTTL !== -1) {
4446
4751
  this.cache = new ResourceCache(resourceCacheTTL);
4447
4752
  } else {
@@ -4460,12 +4765,16 @@ var _Provider = class {
4460
4765
  * @hidden
4461
4766
  */
4462
4767
  static getFetchFn(options) {
4463
- const { retryOptions, timeout } = options;
4768
+ const { retryOptions, timeout, headers } = options;
4464
4769
  return autoRetryFetch(async (...args) => {
4465
4770
  const url = args[0];
4466
4771
  const request = args[1];
4467
4772
  const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
4468
- let fullRequest = { ...request, signal };
4773
+ let fullRequest = {
4774
+ ...request,
4775
+ signal,
4776
+ headers: { ...request?.headers, ...headers }
4777
+ };
4469
4778
  if (options.requestMiddleware) {
4470
4779
  fullRequest = await options.requestMiddleware(fullRequest);
4471
4780
  }
@@ -4473,15 +4782,23 @@ var _Provider = class {
4473
4782
  }, retryOptions);
4474
4783
  }
4475
4784
  static extractBasicAuth(url) {
4476
- const parsedUrl = new URL(url);
4785
+ let parsedUrl;
4786
+ try {
4787
+ parsedUrl = new URL(url);
4788
+ } catch (error) {
4789
+ throw new import_errors17.FuelError(import_errors17.FuelError.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
4790
+ }
4477
4791
  const username = parsedUrl.username;
4478
4792
  const password = parsedUrl.password;
4479
- const urlNoBasicAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
4793
+ const urlWithoutAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
4480
4794
  if (!(username && password)) {
4481
- return { url, auth: void 0 };
4795
+ return { url, urlWithoutAuth: url, headers: void 0 };
4482
4796
  }
4483
- const auth = `Basic ${btoa(`${username}:${password}`)}`;
4484
- return { url: urlNoBasicAuth, auth };
4797
+ return {
4798
+ url,
4799
+ urlWithoutAuth,
4800
+ headers: { Authorization: `Basic ${btoa(`${username}:${password}`)}` }
4801
+ };
4485
4802
  }
4486
4803
  /**
4487
4804
  * Creates a new instance of the Provider class. This is the recommended way to initialize a Provider.
@@ -4492,17 +4809,7 @@ var _Provider = class {
4492
4809
  * @returns A promise that resolves to a Provider instance.
4493
4810
  */
4494
4811
  static async create(url, options = {}) {
4495
- const { url: urlToUse, auth } = this.extractBasicAuth(url);
4496
- const provider = new _Provider(urlToUse, {
4497
- ...options,
4498
- requestMiddleware: async (request) => {
4499
- if (auth && request) {
4500
- request.headers ??= {};
4501
- request.headers.Authorization = auth;
4502
- }
4503
- return options.requestMiddleware?.(request) ?? request;
4504
- }
4505
- });
4812
+ const provider = new _Provider(url, options);
4506
4813
  await provider.fetchChainAndNodeInfo();
4507
4814
  return provider;
4508
4815
  }
@@ -4512,10 +4819,10 @@ var _Provider = class {
4512
4819
  * @returns the chain information configuration.
4513
4820
  */
4514
4821
  getChain() {
4515
- const chain = _Provider.chainInfoCache[this.url];
4822
+ const chain = _Provider.chainInfoCache[this.urlWithoutAuth];
4516
4823
  if (!chain) {
4517
- throw new import_errors16.FuelError(
4518
- import_errors16.ErrorCode.CHAIN_INFO_CACHE_EMPTY,
4824
+ throw new import_errors17.FuelError(
4825
+ import_errors17.ErrorCode.CHAIN_INFO_CACHE_EMPTY,
4519
4826
  "Chain info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
4520
4827
  );
4521
4828
  }
@@ -4527,10 +4834,10 @@ var _Provider = class {
4527
4834
  * @returns the node information configuration.
4528
4835
  */
4529
4836
  getNode() {
4530
- const node = _Provider.nodeInfoCache[this.url];
4837
+ const node = _Provider.nodeInfoCache[this.urlWithoutAuth];
4531
4838
  if (!node) {
4532
- throw new import_errors16.FuelError(
4533
- import_errors16.ErrorCode.NODE_INFO_CACHE_EMPTY,
4839
+ throw new import_errors17.FuelError(
4840
+ import_errors17.ErrorCode.NODE_INFO_CACHE_EMPTY,
4534
4841
  "Node info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
4535
4842
  );
4536
4843
  }
@@ -4561,8 +4868,11 @@ var _Provider = class {
4561
4868
  * @param options - Additional options for the provider.
4562
4869
  */
4563
4870
  async connect(url, options) {
4564
- this.url = url;
4871
+ const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
4872
+ this.url = rawUrl;
4873
+ this.urlWithoutAuth = urlWithoutAuth;
4565
4874
  this.options = options ?? this.options;
4875
+ this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
4566
4876
  this.operations = this.createOperations();
4567
4877
  await this.fetchChainAndNodeInfo();
4568
4878
  }
@@ -4602,7 +4912,7 @@ Supported fuel-core version: ${supportedVersion}.`
4602
4912
  */
4603
4913
  createOperations() {
4604
4914
  const fetchFn = _Provider.getFetchFn(this.options);
4605
- const gqlClient = new import_graphql_request.GraphQLClient(this.url, {
4915
+ const gqlClient = new import_graphql_request.GraphQLClient(this.urlWithoutAuth, {
4606
4916
  fetch: (url, requestInit) => fetchFn(url, requestInit, this.options),
4607
4917
  responseMiddleware: (response) => {
4608
4918
  if ("response" in response) {
@@ -4620,7 +4930,7 @@ Supported fuel-core version: ${supportedVersion}.`
4620
4930
  const isSubscription = opDefinition?.operation === "subscription";
4621
4931
  if (isSubscription) {
4622
4932
  return FuelGraphqlSubscriber.create({
4623
- url: this.url,
4933
+ url: this.urlWithoutAuth,
4624
4934
  query,
4625
4935
  fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
4626
4936
  variables: vars
@@ -4683,7 +4993,7 @@ Supported fuel-core version: ${supportedVersion}.`
4683
4993
  utxoValidation: nodeInfo.utxoValidation,
4684
4994
  vmBacktrace: nodeInfo.vmBacktrace
4685
4995
  };
4686
- _Provider.nodeInfoCache[this.url] = processedNodeInfo;
4996
+ _Provider.nodeInfoCache[this.urlWithoutAuth] = processedNodeInfo;
4687
4997
  return processedNodeInfo;
4688
4998
  }
4689
4999
  /**
@@ -4694,7 +5004,7 @@ Supported fuel-core version: ${supportedVersion}.`
4694
5004
  async fetchChain() {
4695
5005
  const { chain } = await this.operations.getChain();
4696
5006
  const processedChain = processGqlChain(chain);
4697
- _Provider.chainInfoCache[this.url] = processedChain;
5007
+ _Provider.chainInfoCache[this.urlWithoutAuth] = processedChain;
4698
5008
  return processedChain;
4699
5009
  }
4700
5010
  /**
@@ -4722,14 +5032,14 @@ Supported fuel-core version: ${supportedVersion}.`
4722
5032
  validateTransaction(tx, consensusParameters) {
4723
5033
  const { maxOutputs, maxInputs } = consensusParameters.txParameters;
4724
5034
  if ((0, import_math18.bn)(tx.inputs.length).gt(maxInputs)) {
4725
- throw new import_errors16.FuelError(
4726
- import_errors16.ErrorCode.MAX_INPUTS_EXCEEDED,
5035
+ throw new import_errors17.FuelError(
5036
+ import_errors17.ErrorCode.MAX_INPUTS_EXCEEDED,
4727
5037
  "The transaction exceeds the maximum allowed number of inputs."
4728
5038
  );
4729
5039
  }
4730
5040
  if ((0, import_math18.bn)(tx.outputs.length).gt(maxOutputs)) {
4731
- throw new import_errors16.FuelError(
4732
- import_errors16.ErrorCode.MAX_OUTPUTS_EXCEEDED,
5041
+ throw new import_errors17.FuelError(
5042
+ import_errors17.ErrorCode.MAX_OUTPUTS_EXCEEDED,
4733
5043
  "The transaction exceeds the maximum allowed number of outputs."
4734
5044
  );
4735
5045
  }
@@ -4751,7 +5061,7 @@ Supported fuel-core version: ${supportedVersion}.`
4751
5061
  }
4752
5062
  const { consensusParameters } = this.getChain();
4753
5063
  this.validateTransaction(transactionRequest, consensusParameters);
4754
- const encodedTransaction = (0, import_utils24.hexlify)(transactionRequest.toTransactionBytes());
5064
+ const encodedTransaction = (0, import_utils28.hexlify)(transactionRequest.toTransactionBytes());
4755
5065
  let abis;
4756
5066
  if (isTransactionTypeScript(transactionRequest)) {
4757
5067
  abis = transactionRequest.abis;
@@ -4775,7 +5085,7 @@ Supported fuel-core version: ${supportedVersion}.`
4775
5085
  if (estimateTxDependencies) {
4776
5086
  return this.estimateTxDependencies(transactionRequest);
4777
5087
  }
4778
- const encodedTransaction = (0, import_utils24.hexlify)(transactionRequest.toTransactionBytes());
5088
+ const encodedTransaction = (0, import_utils28.hexlify)(transactionRequest.toTransactionBytes());
4779
5089
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4780
5090
  encodedTransactions: encodedTransaction,
4781
5091
  utxoValidation: utxoValidation || false
@@ -4795,13 +5105,13 @@ Supported fuel-core version: ${supportedVersion}.`
4795
5105
  async estimatePredicates(transactionRequest) {
4796
5106
  const shouldEstimatePredicates = Boolean(
4797
5107
  transactionRequest.inputs.find(
4798
- (input) => "predicate" in input && input.predicate && !(0, import_utils25.equalBytes)((0, import_utils24.arrayify)(input.predicate), (0, import_utils24.arrayify)("0x")) && new import_math18.BN(input.predicateGasUsed).isZero()
5108
+ (input) => "predicate" in input && input.predicate && !(0, import_utils29.equalBytes)((0, import_utils28.arrayify)(input.predicate), (0, import_utils28.arrayify)("0x")) && new import_math18.BN(input.predicateGasUsed).isZero()
4799
5109
  )
4800
5110
  );
4801
5111
  if (!shouldEstimatePredicates) {
4802
5112
  return transactionRequest;
4803
5113
  }
4804
- const encodedTransaction = (0, import_utils24.hexlify)(transactionRequest.toTransactionBytes());
5114
+ const encodedTransaction = (0, import_utils28.hexlify)(transactionRequest.toTransactionBytes());
4805
5115
  const response = await this.operations.estimatePredicates({
4806
5116
  encodedTransaction
4807
5117
  });
@@ -4842,7 +5152,7 @@ Supported fuel-core version: ${supportedVersion}.`
4842
5152
  const {
4843
5153
  dryRun: [{ receipts: rawReceipts, status }]
4844
5154
  } = await this.operations.dryRun({
4845
- encodedTransactions: [(0, import_utils24.hexlify)(transactionRequest.toTransactionBytes())],
5155
+ encodedTransactions: [(0, import_utils28.hexlify)(transactionRequest.toTransactionBytes())],
4846
5156
  utxoValidation: false
4847
5157
  });
4848
5158
  receipts = rawReceipts.map(processGqlReceipt);
@@ -4888,11 +5198,11 @@ Supported fuel-core version: ${supportedVersion}.`
4888
5198
  missingContractIds: [],
4889
5199
  dryRunStatus: void 0
4890
5200
  }));
4891
- const allRequests = (0, import_ramda6.clone)(transactionRequests);
5201
+ const allRequests = (0, import_ramda8.clone)(transactionRequests);
4892
5202
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
4893
5203
  allRequests.forEach((req, index) => {
4894
5204
  if (isTransactionTypeScript(req)) {
4895
- serializedTransactionsMap.set(index, (0, import_utils24.hexlify)(req.toTransactionBytes()));
5205
+ serializedTransactionsMap.set(index, (0, import_utils28.hexlify)(req.toTransactionBytes()));
4896
5206
  }
4897
5207
  });
4898
5208
  let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
@@ -4928,7 +5238,7 @@ Supported fuel-core version: ${supportedVersion}.`
4928
5238
  transactionRequest: request
4929
5239
  });
4930
5240
  request.maxFee = maxFee;
4931
- serializedTransactionsMap.set(requestIdx, (0, import_utils24.hexlify)(request.toTransactionBytes()));
5241
+ serializedTransactionsMap.set(requestIdx, (0, import_utils28.hexlify)(request.toTransactionBytes()));
4932
5242
  nextRoundTransactions.push(requestIdx);
4933
5243
  }
4934
5244
  }
@@ -4949,7 +5259,7 @@ Supported fuel-core version: ${supportedVersion}.`
4949
5259
  if (estimateTxDependencies) {
4950
5260
  return this.estimateMultipleTxDependencies(transactionRequests);
4951
5261
  }
4952
- const encodedTransactions = transactionRequests.map((tx) => (0, import_utils24.hexlify)(tx.toTransactionBytes()));
5262
+ const encodedTransactions = transactionRequests.map((tx) => (0, import_utils28.hexlify)(tx.toTransactionBytes()));
4953
5263
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4954
5264
  encodedTransactions,
4955
5265
  utxoValidation: utxoValidation || false
@@ -5023,7 +5333,7 @@ Supported fuel-core version: ${supportedVersion}.`
5023
5333
  if (estimateTxDependencies) {
5024
5334
  return this.estimateTxDependencies(transactionRequest);
5025
5335
  }
5026
- const encodedTransactions = [(0, import_utils24.hexlify)(transactionRequest.toTransactionBytes())];
5336
+ const encodedTransactions = [(0, import_utils28.hexlify)(transactionRequest.toTransactionBytes())];
5027
5337
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
5028
5338
  encodedTransactions,
5029
5339
  utxoValidation: true
@@ -5048,13 +5358,13 @@ Supported fuel-core version: ${supportedVersion}.`
5048
5358
  * @returns A promise that resolves to the transaction cost object.
5049
5359
  */
5050
5360
  async getTransactionCost(transactionRequestLike, { signatureCallback } = {}) {
5051
- const txRequestClone = (0, import_ramda6.clone)(transactionRequestify(transactionRequestLike));
5361
+ const txRequestClone = (0, import_ramda8.clone)(transactionRequestify(transactionRequestLike));
5052
5362
  const updateMaxFee = txRequestClone.maxFee.eq(0);
5053
5363
  const isScriptTransaction = isTransactionTypeScript(txRequestClone);
5054
5364
  if (isScriptTransaction) {
5055
5365
  txRequestClone.gasLimit = (0, import_math18.bn)(0);
5056
5366
  }
5057
- const signedRequest = (0, import_ramda6.clone)(txRequestClone);
5367
+ const signedRequest = (0, import_ramda8.clone)(txRequestClone);
5058
5368
  let addedSignatures = 0;
5059
5369
  if (signatureCallback && isTransactionTypeScript(signedRequest)) {
5060
5370
  const lengthBefore = signedRequest.witnesses.length;
@@ -5122,7 +5432,7 @@ Supported fuel-core version: ${supportedVersion}.`
5122
5432
  paginationLimit: RESOURCES_PAGE_SIZE_LIMIT,
5123
5433
  inputArgs: paginationArgs
5124
5434
  }),
5125
- filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils24.hexlify)(assetId) }
5435
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils28.hexlify)(assetId) }
5126
5436
  });
5127
5437
  const coins = edges.map(({ node }) => ({
5128
5438
  id: node.utxoId,
@@ -5148,8 +5458,8 @@ Supported fuel-core version: ${supportedVersion}.`
5148
5458
  async getResourcesToSpend(owner, quantities, excludedIds) {
5149
5459
  const ownerAddress = import_address3.Address.fromAddressOrString(owner);
5150
5460
  const excludeInput = {
5151
- messages: excludedIds?.messages?.map((nonce) => (0, import_utils24.hexlify)(nonce)) || [],
5152
- utxos: excludedIds?.utxos?.map((id) => (0, import_utils24.hexlify)(id)) || []
5461
+ messages: excludedIds?.messages?.map((nonce) => (0, import_utils28.hexlify)(nonce)) || [],
5462
+ utxos: excludedIds?.utxos?.map((id) => (0, import_utils28.hexlify)(id)) || []
5153
5463
  };
5154
5464
  if (this.cache) {
5155
5465
  const cached = this.cache.getActiveData();
@@ -5159,7 +5469,7 @@ Supported fuel-core version: ${supportedVersion}.`
5159
5469
  const coinsQuery = {
5160
5470
  owner: ownerAddress.toB256(),
5161
5471
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
5162
- assetId: (0, import_utils24.hexlify)(assetId),
5472
+ assetId: (0, import_utils28.hexlify)(assetId),
5163
5473
  amount: amount.toString(10),
5164
5474
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
5165
5475
  })),
@@ -5314,7 +5624,7 @@ Supported fuel-core version: ${supportedVersion}.`
5314
5624
  },
5315
5625
  transactionIds: block.transactions.map((tx) => tx.id),
5316
5626
  transactions: block.transactions.map(
5317
- (tx) => new import_transactions20.TransactionCoder().decode((0, import_utils24.arrayify)(tx.rawPayload), 0)?.[0]
5627
+ (tx) => new import_transactions22.TransactionCoder().decode((0, import_utils28.arrayify)(tx.rawPayload), 0)?.[0]
5318
5628
  )
5319
5629
  };
5320
5630
  }
@@ -5330,12 +5640,12 @@ Supported fuel-core version: ${supportedVersion}.`
5330
5640
  return null;
5331
5641
  }
5332
5642
  try {
5333
- return new import_transactions20.TransactionCoder().decode(
5334
- (0, import_utils24.arrayify)(transaction.rawPayload),
5643
+ return new import_transactions22.TransactionCoder().decode(
5644
+ (0, import_utils28.arrayify)(transaction.rawPayload),
5335
5645
  0
5336
5646
  )?.[0];
5337
5647
  } catch (error) {
5338
- if (error instanceof import_errors16.FuelError && error.code === import_errors16.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5648
+ if (error instanceof import_errors17.FuelError && error.code === import_errors17.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5339
5649
  console.warn("Unsupported transaction type encountered");
5340
5650
  return null;
5341
5651
  }
@@ -5351,12 +5661,12 @@ Supported fuel-core version: ${supportedVersion}.`
5351
5661
  const {
5352
5662
  transactions: { edges, pageInfo }
5353
5663
  } = await this.operations.getTransactions(paginationArgs);
5354
- const coder = new import_transactions20.TransactionCoder();
5664
+ const coder = new import_transactions22.TransactionCoder();
5355
5665
  const transactions = edges.map(({ node: { rawPayload } }) => {
5356
5666
  try {
5357
- return coder.decode((0, import_utils24.arrayify)(rawPayload), 0)[0];
5667
+ return coder.decode((0, import_utils28.arrayify)(rawPayload), 0)[0];
5358
5668
  } catch (error) {
5359
- if (error instanceof import_errors16.FuelError && error.code === import_errors16.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5669
+ if (error instanceof import_errors17.FuelError && error.code === import_errors17.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5360
5670
  console.warn("Unsupported transaction type encountered");
5361
5671
  return null;
5362
5672
  }
@@ -5388,7 +5698,7 @@ Supported fuel-core version: ${supportedVersion}.`
5388
5698
  async getContractBalance(contractId, assetId) {
5389
5699
  const { contractBalance } = await this.operations.getContractBalance({
5390
5700
  contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
5391
- asset: (0, import_utils24.hexlify)(assetId)
5701
+ asset: (0, import_utils28.hexlify)(assetId)
5392
5702
  });
5393
5703
  return (0, import_math18.bn)(contractBalance.amount, 10);
5394
5704
  }
@@ -5402,7 +5712,7 @@ Supported fuel-core version: ${supportedVersion}.`
5402
5712
  async getBalance(owner, assetId) {
5403
5713
  const { balance } = await this.operations.getBalance({
5404
5714
  owner: import_address3.Address.fromAddressOrString(owner).toB256(),
5405
- assetId: (0, import_utils24.hexlify)(assetId)
5715
+ assetId: (0, import_utils28.hexlify)(assetId)
5406
5716
  });
5407
5717
  return (0, import_math18.bn)(balance.amount, 10);
5408
5718
  }
@@ -5448,7 +5758,7 @@ Supported fuel-core version: ${supportedVersion}.`
5448
5758
  owner: import_address3.Address.fromAddressOrString(address).toB256()
5449
5759
  });
5450
5760
  const messages = edges.map(({ node }) => ({
5451
- messageId: import_transactions20.InputMessageCoder.getMessageId({
5761
+ messageId: import_transactions22.InputMessageCoder.getMessageId({
5452
5762
  sender: node.sender,
5453
5763
  recipient: node.recipient,
5454
5764
  nonce: node.nonce,
@@ -5459,7 +5769,7 @@ Supported fuel-core version: ${supportedVersion}.`
5459
5769
  recipient: import_address3.Address.fromAddressOrString(node.recipient),
5460
5770
  nonce: node.nonce,
5461
5771
  amount: (0, import_math18.bn)(node.amount),
5462
- data: import_transactions20.InputMessageCoder.decodeData(node.data),
5772
+ data: import_transactions22.InputMessageCoder.decodeData(node.data),
5463
5773
  daHeight: (0, import_math18.bn)(node.daHeight)
5464
5774
  }));
5465
5775
  return {
@@ -5482,8 +5792,8 @@ Supported fuel-core version: ${supportedVersion}.`
5482
5792
  nonce
5483
5793
  };
5484
5794
  if (commitBlockId && commitBlockHeight) {
5485
- throw new import_errors16.FuelError(
5486
- import_errors16.ErrorCode.INVALID_INPUT_PARAMETERS,
5795
+ throw new import_errors17.FuelError(
5796
+ import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
5487
5797
  "commitBlockId and commitBlockHeight cannot be used together"
5488
5798
  );
5489
5799
  }
@@ -5602,7 +5912,7 @@ Supported fuel-core version: ${supportedVersion}.`
5602
5912
  async produceBlocks(amount, startTime) {
5603
5913
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
5604
5914
  blocksToProduce: (0, import_math18.bn)(amount).toString(10),
5605
- startTimestamp: startTime ? import_utils24.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
5915
+ startTimestamp: startTime ? import_utils28.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
5606
5916
  });
5607
5917
  return (0, import_math18.bn)(latestBlockHeight);
5608
5918
  }
@@ -5628,7 +5938,7 @@ Supported fuel-core version: ${supportedVersion}.`
5628
5938
  return null;
5629
5939
  }
5630
5940
  const message = {
5631
- messageId: import_transactions20.InputMessageCoder.getMessageId({
5941
+ messageId: import_transactions22.InputMessageCoder.getMessageId({
5632
5942
  sender: rawMessage.sender,
5633
5943
  recipient: rawMessage.recipient,
5634
5944
  nonce: rawMessage.nonce,
@@ -5639,7 +5949,7 @@ Supported fuel-core version: ${supportedVersion}.`
5639
5949
  recipient: import_address3.Address.fromAddressOrString(rawMessage.recipient),
5640
5950
  nonce: rawMessage.nonce,
5641
5951
  amount: (0, import_math18.bn)(rawMessage.amount),
5642
- data: import_transactions20.InputMessageCoder.decodeData(rawMessage.data),
5952
+ data: import_transactions22.InputMessageCoder.decodeData(rawMessage.data),
5643
5953
  daHeight: (0, import_math18.bn)(rawMessage.daHeight)
5644
5954
  };
5645
5955
  return message;
@@ -5666,26 +5976,26 @@ Supported fuel-core version: ${supportedVersion}.`
5666
5976
  const { paginationLimit, inputArgs = {} } = params;
5667
5977
  const { first, last, after, before } = inputArgs;
5668
5978
  if (after && before) {
5669
- throw new import_errors16.FuelError(
5670
- import_errors16.ErrorCode.INVALID_INPUT_PARAMETERS,
5979
+ throw new import_errors17.FuelError(
5980
+ import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
5671
5981
  'Pagination arguments "after" and "before" cannot be used together'
5672
5982
  );
5673
5983
  }
5674
5984
  if ((first || 0) > paginationLimit || (last || 0) > paginationLimit) {
5675
- throw new import_errors16.FuelError(
5676
- import_errors16.ErrorCode.INVALID_INPUT_PARAMETERS,
5985
+ throw new import_errors17.FuelError(
5986
+ import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
5677
5987
  `Pagination limit for this query cannot exceed ${paginationLimit} items`
5678
5988
  );
5679
5989
  }
5680
5990
  if (first && before) {
5681
- throw new import_errors16.FuelError(
5682
- import_errors16.ErrorCode.INVALID_INPUT_PARAMETERS,
5991
+ throw new import_errors17.FuelError(
5992
+ import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
5683
5993
  'The use of pagination argument "first" with "before" is not supported'
5684
5994
  );
5685
5995
  }
5686
5996
  if (last && after) {
5687
- throw new import_errors16.FuelError(
5688
- import_errors16.ErrorCode.INVALID_INPUT_PARAMETERS,
5997
+ throw new import_errors17.FuelError(
5998
+ import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
5689
5999
  'The use of pagination argument "last" with "after" is not supported'
5690
6000
  );
5691
6001
  }
@@ -5722,9 +6032,9 @@ cacheInputs_fn = function(inputs, transactionId) {
5722
6032
  }
5723
6033
  const inputsToCache = inputs.reduce(
5724
6034
  (acc, input) => {
5725
- if (input.type === import_transactions20.InputType.Coin) {
6035
+ if (input.type === import_transactions22.InputType.Coin) {
5726
6036
  acc.utxos.push(input.id);
5727
- } else if (input.type === import_transactions20.InputType.Message) {
6037
+ } else if (input.type === import_transactions22.InputType.Message) {
5728
6038
  acc.messages.push(input.nonce);
5729
6039
  }
5730
6040
  return acc;
@@ -5739,23 +6049,23 @@ __publicField(Provider, "chainInfoCache", {});
5739
6049
  __publicField(Provider, "nodeInfoCache", {});
5740
6050
 
5741
6051
  // src/providers/transaction-summary/get-transaction-summary.ts
5742
- var import_errors17 = require("@fuel-ts/errors");
6052
+ var import_errors18 = require("@fuel-ts/errors");
5743
6053
  var import_math19 = require("@fuel-ts/math");
5744
- var import_transactions21 = require("@fuel-ts/transactions");
5745
- var import_utils27 = require("@fuel-ts/utils");
6054
+ var import_transactions23 = require("@fuel-ts/transactions");
6055
+ var import_utils31 = require("@fuel-ts/utils");
5746
6056
  async function getTransactionSummary(params) {
5747
6057
  const { id, provider, abiMap } = params;
5748
6058
  const { transaction: gqlTransaction } = await provider.operations.getTransactionWithReceipts({
5749
6059
  transactionId: id
5750
6060
  });
5751
6061
  if (!gqlTransaction) {
5752
- throw new import_errors17.FuelError(
5753
- import_errors17.ErrorCode.TRANSACTION_NOT_FOUND,
6062
+ throw new import_errors18.FuelError(
6063
+ import_errors18.ErrorCode.TRANSACTION_NOT_FOUND,
5754
6064
  `Transaction not found for given id: ${id}.`
5755
6065
  );
5756
6066
  }
5757
- const [decodedTransaction] = new import_transactions21.TransactionCoder().decode(
5758
- (0, import_utils27.arrayify)(gqlTransaction.rawPayload),
6067
+ const [decodedTransaction] = new import_transactions23.TransactionCoder().decode(
6068
+ (0, import_utils31.arrayify)(gqlTransaction.rawPayload),
5759
6069
  0
5760
6070
  );
5761
6071
  let txReceipts = [];
@@ -5776,7 +6086,7 @@ async function getTransactionSummary(params) {
5776
6086
  id: gqlTransaction.id,
5777
6087
  receipts,
5778
6088
  transaction: decodedTransaction,
5779
- transactionBytes: (0, import_utils27.arrayify)(gqlTransaction.rawPayload),
6089
+ transactionBytes: (0, import_utils31.arrayify)(gqlTransaction.rawPayload),
5780
6090
  gqlTransactionStatus: gqlTransaction.status,
5781
6091
  gasPerByte: (0, import_math19.bn)(gasPerByte),
5782
6092
  gasPriceFactor: (0, import_math19.bn)(gasPriceFactor),
@@ -5832,7 +6142,7 @@ async function getTransactionsSummaries(params) {
5832
6142
  const transactions = edges.map((edge) => {
5833
6143
  const { node: gqlTransaction } = edge;
5834
6144
  const { id, rawPayload, status } = gqlTransaction;
5835
- const [decodedTransaction] = new import_transactions21.TransactionCoder().decode((0, import_utils27.arrayify)(rawPayload), 0);
6145
+ const [decodedTransaction] = new import_transactions23.TransactionCoder().decode((0, import_utils31.arrayify)(rawPayload), 0);
5836
6146
  let txReceipts = [];
5837
6147
  if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
5838
6148
  txReceipts = gqlTransaction.status.receipts;
@@ -5842,7 +6152,7 @@ async function getTransactionsSummaries(params) {
5842
6152
  id,
5843
6153
  receipts,
5844
6154
  transaction: decodedTransaction,
5845
- transactionBytes: (0, import_utils27.arrayify)(rawPayload),
6155
+ transactionBytes: (0, import_utils31.arrayify)(rawPayload),
5846
6156
  gqlTransactionStatus: status,
5847
6157
  abiMap,
5848
6158
  gasPerByte,
@@ -5867,12 +6177,14 @@ async function getTransactionsSummaries(params) {
5867
6177
  // src/providers/chains.ts
5868
6178
  var CHAIN_IDS = {
5869
6179
  eth: {
6180
+ mainnet: 1,
5870
6181
  sepolia: 11155111,
5871
6182
  foundry: 31337
5872
6183
  },
5873
6184
  fuel: {
5874
6185
  devnet: 0,
5875
- testnet: 0
6186
+ testnet: 0,
6187
+ mainnet: 9889
5876
6188
  }
5877
6189
  };
5878
6190
 
@@ -5972,6 +6284,11 @@ var rawAssets = [
5972
6284
  chainId: CHAIN_IDS.eth.foundry,
5973
6285
  decimals: 18
5974
6286
  },
6287
+ {
6288
+ type: "ethereum",
6289
+ chainId: CHAIN_IDS.eth.mainnet,
6290
+ decimals: 18
6291
+ },
5975
6292
  {
5976
6293
  type: "fuel",
5977
6294
  chainId: CHAIN_IDS.fuel.devnet,
@@ -5983,16 +6300,542 @@ var rawAssets = [
5983
6300
  chainId: CHAIN_IDS.fuel.testnet,
5984
6301
  decimals: 9,
5985
6302
  assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
6303
+ },
6304
+ {
6305
+ type: "fuel",
6306
+ chainId: CHAIN_IDS.fuel.mainnet,
6307
+ decimals: 9,
6308
+ assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
5986
6309
  }
5987
6310
  ]
5988
- }
5989
- ];
5990
- var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
5991
-
5992
- // src/providers/utils/merge-quantities.ts
5993
- var mergeQuantities = (...coinQuantities) => {
5994
- const resultMap = {};
5995
- function addToMap({ amount, assetId }) {
6311
+ },
6312
+ {
6313
+ name: "WETH",
6314
+ symbol: "WETH",
6315
+ icon: "weth.svg",
6316
+ networks: [
6317
+ {
6318
+ type: "ethereum",
6319
+ chainId: CHAIN_IDS.eth.mainnet,
6320
+ address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
6321
+ decimals: 18
6322
+ },
6323
+ {
6324
+ type: "fuel",
6325
+ chainId: CHAIN_IDS.fuel.mainnet,
6326
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6327
+ assetId: "0xa38a5a8beeb08d95744bc7f58528073f4052b254def59eba20c99c202b5acaa3",
6328
+ decimals: 9
6329
+ }
6330
+ ]
6331
+ },
6332
+ {
6333
+ name: "weETH",
6334
+ symbol: "weETH",
6335
+ icon: "weETH.webp",
6336
+ networks: [
6337
+ {
6338
+ type: "ethereum",
6339
+ chainId: CHAIN_IDS.eth.mainnet,
6340
+ address: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
6341
+ decimals: 18
6342
+ },
6343
+ {
6344
+ type: "fuel",
6345
+ chainId: CHAIN_IDS.fuel.mainnet,
6346
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6347
+ assetId: "0x239ed6e12b7ce4089ee245244e3bf906999a6429c2a9a445a1e1faf56914a4ab",
6348
+ decimals: 9
6349
+ }
6350
+ ]
6351
+ },
6352
+ {
6353
+ name: "rsETH",
6354
+ symbol: "rsETH",
6355
+ icon: "rsETH.webp",
6356
+ networks: [
6357
+ {
6358
+ type: "ethereum",
6359
+ chainId: CHAIN_IDS.eth.mainnet,
6360
+ address: "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7",
6361
+ decimals: 18
6362
+ },
6363
+ {
6364
+ type: "fuel",
6365
+ chainId: CHAIN_IDS.fuel.mainnet,
6366
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6367
+ assetId: "0xbae80f7fb8aa6b90d9b01ef726ec847cc4f59419c4d5f2ea88fec785d1b0e849",
6368
+ decimals: 9
6369
+ }
6370
+ ]
6371
+ },
6372
+ {
6373
+ name: "rETH",
6374
+ symbol: "rETH",
6375
+ icon: "reth.svg",
6376
+ networks: [
6377
+ {
6378
+ type: "ethereum",
6379
+ chainId: CHAIN_IDS.eth.mainnet,
6380
+ address: "0xae78736cd615f374d3085123a210448e74fc6393",
6381
+ decimals: 18
6382
+ },
6383
+ {
6384
+ type: "fuel",
6385
+ chainId: CHAIN_IDS.fuel.mainnet,
6386
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6387
+ assetId: "0xf3f9a0ed0ce8eac5f89d6b83e41b3848212d5b5f56108c54a205bb228ca30c16",
6388
+ decimals: 9
6389
+ }
6390
+ ]
6391
+ },
6392
+ {
6393
+ name: "wbETH",
6394
+ symbol: "wbETH",
6395
+ icon: "wbeth.png",
6396
+ networks: [
6397
+ {
6398
+ type: "ethereum",
6399
+ chainId: CHAIN_IDS.eth.mainnet,
6400
+ address: "0xa2E3356610840701BDf5611a53974510Ae27E2e1",
6401
+ decimals: 18
6402
+ },
6403
+ {
6404
+ type: "fuel",
6405
+ chainId: CHAIN_IDS.fuel.mainnet,
6406
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6407
+ assetId: "0x7843c74bef935e837f2bcf67b5d64ecb46dd53ff86375530b0caf3699e8ffafe",
6408
+ decimals: 9
6409
+ }
6410
+ ]
6411
+ },
6412
+ {
6413
+ name: "rstETH",
6414
+ symbol: "rstETH",
6415
+ icon: "rstETH.webp",
6416
+ networks: [
6417
+ {
6418
+ type: "ethereum",
6419
+ chainId: CHAIN_IDS.eth.mainnet,
6420
+ address: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
6421
+ decimals: 18
6422
+ },
6423
+ {
6424
+ type: "fuel",
6425
+ chainId: CHAIN_IDS.fuel.mainnet,
6426
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6427
+ assetId: "0x962792286fbc9b1d5860b4551362a12249362c21594c77abf4b3fe2bbe8d977a",
6428
+ decimals: 9
6429
+ }
6430
+ ]
6431
+ },
6432
+ {
6433
+ name: "amphrETH",
6434
+ symbol: "amphrETH",
6435
+ icon: "amphrETH.png",
6436
+ networks: [
6437
+ {
6438
+ type: "ethereum",
6439
+ chainId: CHAIN_IDS.eth.mainnet,
6440
+ address: "0x5fD13359Ba15A84B76f7F87568309040176167cd",
6441
+ decimals: 18
6442
+ },
6443
+ {
6444
+ type: "fuel",
6445
+ chainId: CHAIN_IDS.fuel.mainnet,
6446
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6447
+ assetId: "0x05fc623e57bd7bc1258efa8e4f62b05af5471d73df6f2c2dc11ecc81134c4f36",
6448
+ decimals: 9
6449
+ }
6450
+ ]
6451
+ },
6452
+ {
6453
+ name: "Manta mBTC",
6454
+ symbol: "Manta mBTC",
6455
+ icon: "manta-mbtc.svg",
6456
+ networks: [
6457
+ {
6458
+ type: "ethereum",
6459
+ chainId: CHAIN_IDS.eth.mainnet,
6460
+ address: "0x4041381e947CFD3D483d67a25C6aa9Dc924250c5",
6461
+ decimals: 18
6462
+ },
6463
+ {
6464
+ type: "fuel",
6465
+ chainId: CHAIN_IDS.fuel.mainnet,
6466
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6467
+ assetId: "0xaf3111a248ff7a3238cdeea845bb2d43cf3835f1f6b8c9d28360728b55b9ce5b",
6468
+ decimals: 9
6469
+ }
6470
+ ]
6471
+ },
6472
+ {
6473
+ name: "Manta mETH",
6474
+ symbol: "Manta mETH",
6475
+ icon: "manta-meth.svg",
6476
+ networks: [
6477
+ {
6478
+ type: "ethereum",
6479
+ chainId: CHAIN_IDS.eth.mainnet,
6480
+ address: "0x8CdF550C04Bc9B9F10938368349C9c8051A772b6",
6481
+ decimals: 18
6482
+ },
6483
+ {
6484
+ type: "fuel",
6485
+ chainId: CHAIN_IDS.fuel.mainnet,
6486
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6487
+ assetId: "0xafd219f513317b1750783c6581f55530d6cf189a5863fd18bd1b3ffcec1714b4",
6488
+ decimals: 9
6489
+ }
6490
+ ]
6491
+ },
6492
+ {
6493
+ name: "Manta mUSD",
6494
+ symbol: "Manta mUSD",
6495
+ icon: "manta-musd.svg",
6496
+ networks: [
6497
+ {
6498
+ type: "ethereum",
6499
+ chainId: CHAIN_IDS.eth.mainnet,
6500
+ address: "0x3f24E1d7a973867fC2A03fE199E5502514E0e11E",
6501
+ decimals: 18
6502
+ },
6503
+ {
6504
+ type: "fuel",
6505
+ chainId: CHAIN_IDS.fuel.mainnet,
6506
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6507
+ assetId: "0x89cb9401e55d49c3269654dd1cdfb0e80e57823a4a7db98ba8fc5953b120fef4",
6508
+ decimals: 9
6509
+ }
6510
+ ]
6511
+ },
6512
+ {
6513
+ name: "pumpBTC",
6514
+ symbol: "pumpBTC",
6515
+ icon: "pumpbtc.webp",
6516
+ networks: [
6517
+ {
6518
+ type: "ethereum",
6519
+ chainId: CHAIN_IDS.eth.mainnet,
6520
+ address: "0xf469fbd2abcd6b9de8e169d128226c0fc90a012e",
6521
+ decimals: 8
6522
+ },
6523
+ {
6524
+ type: "fuel",
6525
+ chainId: CHAIN_IDS.fuel.mainnet,
6526
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6527
+ assetId: "0x0aa5eb2bb97ca915288b653a2529355d4dc66de2b37533213f0e4aeee3d3421f",
6528
+ decimals: 8
6529
+ }
6530
+ ]
6531
+ },
6532
+ {
6533
+ name: "FBTC",
6534
+ symbol: "FBTC",
6535
+ icon: "fbtc.svg",
6536
+ networks: [
6537
+ {
6538
+ type: "ethereum",
6539
+ chainId: CHAIN_IDS.eth.mainnet,
6540
+ address: "0xc96de26018a54d51c097160568752c4e3bd6c364",
6541
+ decimals: 8
6542
+ },
6543
+ {
6544
+ type: "fuel",
6545
+ chainId: CHAIN_IDS.fuel.mainnet,
6546
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6547
+ assetId: "0xb5ecb0a1e08e2abbabf624ffea089df933376855f468ade35c6375b00c33996a",
6548
+ decimals: 8
6549
+ }
6550
+ ]
6551
+ },
6552
+ {
6553
+ name: "SolvBTC",
6554
+ symbol: "SolvBTC",
6555
+ icon: "solvBTC.webp",
6556
+ networks: [
6557
+ {
6558
+ type: "ethereum",
6559
+ chainId: CHAIN_IDS.eth.mainnet,
6560
+ address: "0x7a56e1c57c7475ccf742a1832b028f0456652f97",
6561
+ decimals: 18
6562
+ },
6563
+ {
6564
+ type: "fuel",
6565
+ chainId: CHAIN_IDS.fuel.mainnet,
6566
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6567
+ assetId: "0x1186afea9affb88809c210e13e2330b5258c2cef04bb8fff5eff372b7bd3f40f",
6568
+ decimals: 9
6569
+ }
6570
+ ]
6571
+ },
6572
+ {
6573
+ name: "SolvBTC.BBN",
6574
+ symbol: "SolvBTC.BBN",
6575
+ icon: "SolvBTC.BBN.png",
6576
+ networks: [
6577
+ {
6578
+ type: "ethereum",
6579
+ chainId: CHAIN_IDS.eth.mainnet,
6580
+ address: "0xd9d920aa40f578ab794426f5c90f6c731d159def",
6581
+ decimals: 18
6582
+ },
6583
+ {
6584
+ type: "fuel",
6585
+ chainId: CHAIN_IDS.fuel.mainnet,
6586
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6587
+ assetId: "0x7a4f087c957d30218223c2baaaa365355c9ca81b6ea49004cfb1590a5399216f",
6588
+ decimals: 9
6589
+ }
6590
+ ]
6591
+ },
6592
+ {
6593
+ name: "Mantle mETH",
6594
+ symbol: "Mantle mETH",
6595
+ icon: "mantle-meth.svg",
6596
+ networks: [
6597
+ {
6598
+ type: "ethereum",
6599
+ chainId: CHAIN_IDS.eth.mainnet,
6600
+ address: "0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa",
6601
+ decimals: 18
6602
+ },
6603
+ {
6604
+ type: "fuel",
6605
+ chainId: CHAIN_IDS.fuel.mainnet,
6606
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6607
+ assetId: "0x642a5db59ec323c2f846d4d4cf3e58d78aff64accf4f8f6455ba0aa3ef000a3b",
6608
+ decimals: 9
6609
+ }
6610
+ ]
6611
+ },
6612
+ {
6613
+ name: "sDAI",
6614
+ symbol: "sDAI",
6615
+ icon: "sdai.svg",
6616
+ networks: [
6617
+ {
6618
+ type: "ethereum",
6619
+ chainId: CHAIN_IDS.eth.mainnet,
6620
+ address: "0x83f20f44975d03b1b09e64809b757c47f942beea",
6621
+ decimals: 18
6622
+ },
6623
+ {
6624
+ type: "fuel",
6625
+ chainId: CHAIN_IDS.fuel.mainnet,
6626
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6627
+ assetId: "0x9e46f919fbf978f3cad7cd34cca982d5613af63ff8aab6c379e4faa179552958",
6628
+ decimals: 9
6629
+ }
6630
+ ]
6631
+ },
6632
+ {
6633
+ name: "USDT",
6634
+ symbol: "USDT",
6635
+ icon: "usdt.svg",
6636
+ networks: [
6637
+ {
6638
+ type: "ethereum",
6639
+ chainId: CHAIN_IDS.eth.mainnet,
6640
+ address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
6641
+ decimals: 6
6642
+ },
6643
+ {
6644
+ type: "fuel",
6645
+ chainId: CHAIN_IDS.fuel.mainnet,
6646
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6647
+ assetId: "0xa0265fb5c32f6e8db3197af3c7eb05c48ae373605b8165b6f4a51c5b0ba4812e",
6648
+ decimals: 6
6649
+ }
6650
+ ]
6651
+ },
6652
+ {
6653
+ name: "USDC",
6654
+ symbol: "USDC",
6655
+ icon: "usdc.svg",
6656
+ networks: [
6657
+ {
6658
+ type: "ethereum",
6659
+ chainId: CHAIN_IDS.eth.mainnet,
6660
+ address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
6661
+ decimals: 6
6662
+ },
6663
+ {
6664
+ type: "fuel",
6665
+ chainId: CHAIN_IDS.fuel.mainnet,
6666
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6667
+ assetId: "0x286c479da40dc953bddc3bb4c453b608bba2e0ac483b077bd475174115395e6b",
6668
+ decimals: 6
6669
+ }
6670
+ ]
6671
+ },
6672
+ {
6673
+ name: "USDe",
6674
+ symbol: "USDe",
6675
+ icon: "USDe.svg",
6676
+ networks: [
6677
+ {
6678
+ type: "ethereum",
6679
+ chainId: CHAIN_IDS.eth.mainnet,
6680
+ address: "0x4c9edd5852cd905f086c759e8383e09bff1e68b3",
6681
+ decimals: 18
6682
+ },
6683
+ {
6684
+ type: "fuel",
6685
+ chainId: CHAIN_IDS.fuel.mainnet,
6686
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6687
+ assetId: "0xb6133b2ef9f6153eb869125d23dcf20d1e735331b5e41b15a6a7a6cec70e8651",
6688
+ decimals: 9
6689
+ }
6690
+ ]
6691
+ },
6692
+ {
6693
+ name: "sUSDe",
6694
+ symbol: "sUSDe",
6695
+ icon: "sUSDe.webp",
6696
+ networks: [
6697
+ {
6698
+ type: "ethereum",
6699
+ chainId: CHAIN_IDS.eth.mainnet,
6700
+ address: "0x9d39a5de30e57443bff2a8307a4256c8797a3497",
6701
+ decimals: 18
6702
+ },
6703
+ {
6704
+ type: "fuel",
6705
+ chainId: CHAIN_IDS.fuel.mainnet,
6706
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6707
+ assetId: "0xd05563025104fc36496c15c7021ad6b31034b0e89a356f4f818045d1f48808bc",
6708
+ decimals: 9
6709
+ }
6710
+ ]
6711
+ },
6712
+ {
6713
+ name: "rsUSDe",
6714
+ symbol: "rsUSDe",
6715
+ icon: "rsUSDe.svg",
6716
+ networks: [
6717
+ {
6718
+ type: "ethereum",
6719
+ chainId: CHAIN_IDS.eth.mainnet,
6720
+ address: "0x82f5104b23FF2FA54C2345F821dAc9369e9E0B26",
6721
+ decimals: 18
6722
+ },
6723
+ {
6724
+ type: "fuel",
6725
+ chainId: CHAIN_IDS.fuel.mainnet,
6726
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6727
+ assetId: "0x78d4522ec607f6e8efb66ea49439d1ee48623cf763f9688a8eada025def033d9",
6728
+ decimals: 9
6729
+ }
6730
+ ]
6731
+ },
6732
+ {
6733
+ name: "wstETH",
6734
+ symbol: "wstETH",
6735
+ icon: "wsteth.svg",
6736
+ networks: [
6737
+ {
6738
+ type: "ethereum",
6739
+ chainId: CHAIN_IDS.eth.mainnet,
6740
+ address: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
6741
+ decimals: 18
6742
+ },
6743
+ {
6744
+ type: "fuel",
6745
+ chainId: CHAIN_IDS.fuel.mainnet,
6746
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6747
+ assetId: "0x1a7815cc9f75db5c24a5b0814bfb706bb9fe485333e98254015de8f48f84c67b",
6748
+ decimals: 9
6749
+ }
6750
+ ]
6751
+ },
6752
+ {
6753
+ name: "ezETH",
6754
+ symbol: "ezETH",
6755
+ icon: "ezeth.webp",
6756
+ networks: [
6757
+ {
6758
+ type: "ethereum",
6759
+ chainId: CHAIN_IDS.eth.mainnet,
6760
+ address: "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110",
6761
+ decimals: 18
6762
+ },
6763
+ {
6764
+ type: "fuel",
6765
+ chainId: CHAIN_IDS.fuel.mainnet,
6766
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6767
+ assetId: "0x91b3559edb2619cde8ffb2aa7b3c3be97efd794ea46700db7092abeee62281b0",
6768
+ decimals: 9
6769
+ }
6770
+ ]
6771
+ },
6772
+ {
6773
+ name: "pzETH",
6774
+ symbol: "pzETH",
6775
+ icon: "pzETH.webp",
6776
+ networks: [
6777
+ {
6778
+ type: "ethereum",
6779
+ chainId: CHAIN_IDS.eth.mainnet,
6780
+ address: "0x8c9532a60e0e7c6bbd2b2c1303f63ace1c3e9811",
6781
+ decimals: 18
6782
+ },
6783
+ {
6784
+ type: "fuel",
6785
+ chainId: CHAIN_IDS.fuel.mainnet,
6786
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6787
+ assetId: "0x1493d4ec82124de8f9b625682de69dcccda79e882b89a55a8c737b12de67bd68",
6788
+ decimals: 9
6789
+ }
6790
+ ]
6791
+ },
6792
+ {
6793
+ name: "Re7LRT",
6794
+ symbol: "Re7LRT",
6795
+ icon: "Re7LRT.png",
6796
+ networks: [
6797
+ {
6798
+ type: "ethereum",
6799
+ chainId: CHAIN_IDS.eth.mainnet,
6800
+ address: "0x84631c0d0081FDe56DeB72F6DE77abBbF6A9f93a",
6801
+ decimals: 18
6802
+ },
6803
+ {
6804
+ type: "fuel",
6805
+ chainId: CHAIN_IDS.fuel.mainnet,
6806
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6807
+ assetId: "0xf2fc648c23a5db24610a1cf696acc4f0f6d9a7d6028dd9944964ab23f6e35995",
6808
+ decimals: 9
6809
+ }
6810
+ ]
6811
+ },
6812
+ {
6813
+ name: "steakLRT",
6814
+ symbol: "steakLRT",
6815
+ icon: "steakLRT.png",
6816
+ networks: [
6817
+ {
6818
+ type: "ethereum",
6819
+ chainId: CHAIN_IDS.eth.mainnet,
6820
+ address: "0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc",
6821
+ decimals: 18
6822
+ },
6823
+ {
6824
+ type: "fuel",
6825
+ chainId: CHAIN_IDS.fuel.mainnet,
6826
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6827
+ assetId: "0x4fc8ac9f101df07e2c2dec4a53c8c42c439bdbe5e36ea2d863a61ff60afafc30",
6828
+ decimals: 9
6829
+ }
6830
+ ]
6831
+ }
6832
+ ];
6833
+ var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
6834
+
6835
+ // src/providers/utils/merge-quantities.ts
6836
+ var mergeQuantities = (...coinQuantities) => {
6837
+ const resultMap = {};
6838
+ function addToMap({ amount, assetId }) {
5996
6839
  if (resultMap[assetId]) {
5997
6840
  resultMap[assetId] = resultMap[assetId].add(amount);
5998
6841
  } else {
@@ -6006,16 +6849,16 @@ var mergeQuantities = (...coinQuantities) => {
6006
6849
  // src/utils/formatTransferToContractScriptData.ts
6007
6850
  var import_abi_coder6 = require("@fuel-ts/abi-coder");
6008
6851
  var import_math20 = require("@fuel-ts/math");
6009
- var import_utils29 = require("@fuel-ts/utils");
6852
+ var import_utils33 = require("@fuel-ts/utils");
6010
6853
  var asm = __toESM(require("@fuels/vm-asm"));
6011
6854
  var formatTransferToContractScriptData = (params) => {
6012
6855
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
6013
6856
  const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
6014
6857
  const encoded = numberCoder.encode(new import_math20.BN(amountToTransfer).toNumber());
6015
6858
  const scriptData = Uint8Array.from([
6016
- ...(0, import_utils29.arrayify)(hexlifiedContractId),
6859
+ ...(0, import_utils33.arrayify)(hexlifiedContractId),
6017
6860
  ...encoded,
6018
- ...(0, import_utils29.arrayify)(assetId)
6861
+ ...(0, import_utils33.arrayify)(assetId)
6019
6862
  ]);
6020
6863
  return scriptData;
6021
6864
  };
@@ -6076,7 +6919,7 @@ var Account = class extends import_interfaces.AbstractAccount {
6076
6919
  */
6077
6920
  get provider() {
6078
6921
  if (!this._provider) {
6079
- throw new import_errors18.FuelError(import_errors18.ErrorCode.MISSING_PROVIDER, "Provider not set");
6922
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.MISSING_PROVIDER, "Provider not set");
6080
6923
  }
6081
6924
  return this._provider;
6082
6925
  }
@@ -6194,7 +7037,7 @@ var Account = class extends import_interfaces.AbstractAccount {
6194
7037
  );
6195
7038
  request.addResources(resources);
6196
7039
  request.updatePredicateGasUsed(estimatedPredicates);
6197
- const requestToReestimate2 = (0, import_ramda7.clone)(request);
7040
+ const requestToReestimate2 = (0, import_ramda9.clone)(request);
6198
7041
  if (addedSignatures) {
6199
7042
  Array.from({ length: addedSignatures }).forEach(
6200
7043
  () => requestToReestimate2.addEmptyWitness()
@@ -6227,13 +7070,13 @@ var Account = class extends import_interfaces.AbstractAccount {
6227
7070
  fundingAttempts += 1;
6228
7071
  }
6229
7072
  if (needsToBeFunded) {
6230
- throw new import_errors18.FuelError(
6231
- import_errors18.ErrorCode.NOT_ENOUGH_FUNDS,
7073
+ throw new import_errors19.FuelError(
7074
+ import_errors19.ErrorCode.NOT_ENOUGH_FUNDS,
6232
7075
  `The account ${this.address} does not have enough base asset funds to cover the transaction execution.`
6233
7076
  );
6234
7077
  }
6235
7078
  request.updatePredicateGasUsed(estimatedPredicates);
6236
- const requestToReestimate = (0, import_ramda7.clone)(request);
7079
+ const requestToReestimate = (0, import_ramda9.clone)(request);
6237
7080
  if (addedSignatures) {
6238
7081
  Array.from({ length: addedSignatures }).forEach(() => requestToReestimate.addEmptyWitness());
6239
7082
  }
@@ -6333,8 +7176,8 @@ var Account = class extends import_interfaces.AbstractAccount {
6333
7176
  */
6334
7177
  async transferToContract(contractId, amount, assetId, txParams = {}) {
6335
7178
  if ((0, import_math21.bn)(amount).lte(0)) {
6336
- throw new import_errors18.FuelError(
6337
- import_errors18.ErrorCode.INVALID_TRANSFER_AMOUNT,
7179
+ throw new import_errors19.FuelError(
7180
+ import_errors19.ErrorCode.INVALID_TRANSFER_AMOUNT,
6338
7181
  "Transfer amount must be a positive number."
6339
7182
  );
6340
7183
  }
@@ -6373,14 +7216,14 @@ var Account = class extends import_interfaces.AbstractAccount {
6373
7216
  */
6374
7217
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
6375
7218
  const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
6376
- const recipientDataArray = (0, import_utils30.arrayify)(
7219
+ const recipientDataArray = (0, import_utils34.arrayify)(
6377
7220
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
6378
7221
  );
6379
- const amountDataArray = (0, import_utils30.arrayify)(
7222
+ const amountDataArray = (0, import_utils34.arrayify)(
6380
7223
  "0x".concat((0, import_math21.bn)(amount).toHex().substring(2).padStart(16, "0"))
6381
7224
  );
6382
7225
  const script = new Uint8Array([
6383
- ...(0, import_utils30.arrayify)(withdrawScript.bytes),
7226
+ ...(0, import_utils34.arrayify)(withdrawScript.bytes),
6384
7227
  ...recipientDataArray,
6385
7228
  ...amountDataArray
6386
7229
  ]);
@@ -6409,13 +7252,13 @@ var Account = class extends import_interfaces.AbstractAccount {
6409
7252
  * @returns A promise that resolves to the transaction cost object.
6410
7253
  */
6411
7254
  async getTransactionCost(transactionRequestLike, { signatureCallback, quantities = [] } = {}) {
6412
- const txRequestClone = (0, import_ramda7.clone)(transactionRequestify(transactionRequestLike));
7255
+ const txRequestClone = (0, import_ramda9.clone)(transactionRequestify(transactionRequestLike));
6413
7256
  const baseAssetId = this.provider.getBaseAssetId();
6414
7257
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
6415
7258
  const requiredQuantities = mergeQuantities(coinOutputsQuantities, quantities);
6416
7259
  const transactionFeeForDryRun = [{ assetId: baseAssetId, amount: (0, import_math21.bn)("100000000000000000") }];
6417
7260
  const findAssetInput = (assetId) => txRequestClone.inputs.find((input) => {
6418
- if (input.type === import_transactions22.InputType.Coin) {
7261
+ if (input.type === import_transactions24.InputType.Coin) {
6419
7262
  return input.assetId === assetId;
6420
7263
  }
6421
7264
  if (isRequestInputMessageWithoutData(input)) {
@@ -6460,7 +7303,7 @@ var Account = class extends import_interfaces.AbstractAccount {
6460
7303
  */
6461
7304
  async signMessage(message) {
6462
7305
  if (!this._connector) {
6463
- throw new import_errors18.FuelError(import_errors18.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
7306
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
6464
7307
  }
6465
7308
  return this._connector.signMessage(this.address.toString(), message);
6466
7309
  }
@@ -6472,8 +7315,8 @@ var Account = class extends import_interfaces.AbstractAccount {
6472
7315
  */
6473
7316
  async signTransaction(transactionRequestLike) {
6474
7317
  if (!this._connector) {
6475
- throw new import_errors18.FuelError(
6476
- import_errors18.ErrorCode.MISSING_CONNECTOR,
7318
+ throw new import_errors19.FuelError(
7319
+ import_errors19.ErrorCode.MISSING_CONNECTOR,
6477
7320
  "A connector is required to sign transactions."
6478
7321
  );
6479
7322
  }
@@ -6522,7 +7365,7 @@ var Account = class extends import_interfaces.AbstractAccount {
6522
7365
  */
6523
7366
  generateFakeResources(coins) {
6524
7367
  return coins.map((coin) => ({
6525
- id: (0, import_utils30.hexlify)((0, import_crypto2.randomBytes)(import_abi_coder7.UTXO_ID_LEN)),
7368
+ id: (0, import_utils34.hexlify)((0, import_crypto2.randomBytes)(import_abi_coder7.UTXO_ID_LEN)),
6526
7369
  owner: this.address,
6527
7370
  blockCreated: (0, import_math21.bn)(1),
6528
7371
  txCreatedIdx: (0, import_math21.bn)(1),
@@ -6532,8 +7375,8 @@ var Account = class extends import_interfaces.AbstractAccount {
6532
7375
  /** @hidden * */
6533
7376
  validateTransferAmount(amount) {
6534
7377
  if ((0, import_math21.bn)(amount).lte(0)) {
6535
- throw new import_errors18.FuelError(
6536
- import_errors18.ErrorCode.INVALID_TRANSFER_AMOUNT,
7378
+ throw new import_errors19.FuelError(
7379
+ import_errors19.ErrorCode.INVALID_TRANSFER_AMOUNT,
6537
7380
  "Transfer amount must be a positive number."
6538
7381
  );
6539
7382
  }
@@ -6559,19 +7402,19 @@ var Account = class extends import_interfaces.AbstractAccount {
6559
7402
  txParams: { gasLimit: setGasLimit, maxFee: setMaxFee }
6560
7403
  }) {
6561
7404
  const request = transactionRequestify(transactionRequest);
6562
- if (!(0, import_utils30.isDefined)(setGasLimit)) {
7405
+ if (!(0, import_utils34.isDefined)(setGasLimit)) {
6563
7406
  request.gasLimit = gasUsed;
6564
7407
  } else if (gasUsed.gt(setGasLimit)) {
6565
- throw new import_errors18.FuelError(
6566
- import_errors18.ErrorCode.GAS_LIMIT_TOO_LOW,
7408
+ throw new import_errors19.FuelError(
7409
+ import_errors19.ErrorCode.GAS_LIMIT_TOO_LOW,
6567
7410
  `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
6568
7411
  );
6569
7412
  }
6570
- if (!(0, import_utils30.isDefined)(setMaxFee)) {
7413
+ if (!(0, import_utils34.isDefined)(setMaxFee)) {
6571
7414
  request.maxFee = maxFee;
6572
7415
  } else if (maxFee.gt(setMaxFee)) {
6573
- throw new import_errors18.FuelError(
6574
- import_errors18.ErrorCode.MAX_FEE_TOO_LOW,
7416
+ throw new import_errors19.FuelError(
7417
+ import_errors19.ErrorCode.MAX_FEE_TOO_LOW,
6575
7418
  `Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
6576
7419
  );
6577
7420
  }
@@ -6580,15 +7423,15 @@ var Account = class extends import_interfaces.AbstractAccount {
6580
7423
  };
6581
7424
 
6582
7425
  // src/wallet/base-wallet-unlocked.ts
6583
- var import_hasher3 = require("@fuel-ts/hasher");
6584
- var import_utils33 = require("@fuel-ts/utils");
7426
+ var import_hasher4 = require("@fuel-ts/hasher");
7427
+ var import_utils37 = require("@fuel-ts/utils");
6585
7428
 
6586
7429
  // src/signer/signer.ts
6587
7430
  var import_address5 = require("@fuel-ts/address");
6588
7431
  var import_crypto3 = require("@fuel-ts/crypto");
6589
- var import_hasher2 = require("@fuel-ts/hasher");
7432
+ var import_hasher3 = require("@fuel-ts/hasher");
6590
7433
  var import_math22 = require("@fuel-ts/math");
6591
- var import_utils31 = require("@fuel-ts/utils");
7434
+ var import_utils35 = require("@fuel-ts/utils");
6592
7435
  var import_secp256k1 = require("@noble/curves/secp256k1");
6593
7436
  var Signer = class {
6594
7437
  address;
@@ -6608,9 +7451,9 @@ var Signer = class {
6608
7451
  }
6609
7452
  }
6610
7453
  const privateKeyBytes = (0, import_math22.toBytes)(privateKey, 32);
6611
- this.privateKey = (0, import_utils31.hexlify)(privateKeyBytes);
6612
- this.publicKey = (0, import_utils31.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
6613
- this.compressedPublicKey = (0, import_utils31.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
7454
+ this.privateKey = (0, import_utils35.hexlify)(privateKeyBytes);
7455
+ this.publicKey = (0, import_utils35.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
7456
+ this.compressedPublicKey = (0, import_utils35.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
6614
7457
  this.address = import_address5.Address.fromPublicKey(this.publicKey);
6615
7458
  }
6616
7459
  /**
@@ -6624,11 +7467,11 @@ var Signer = class {
6624
7467
  * @returns hashed signature
6625
7468
  */
6626
7469
  sign(data) {
6627
- const signature = import_secp256k1.secp256k1.sign((0, import_utils31.arrayify)(data), (0, import_utils31.arrayify)(this.privateKey));
7470
+ const signature = import_secp256k1.secp256k1.sign((0, import_utils35.arrayify)(data), (0, import_utils35.arrayify)(this.privateKey));
6628
7471
  const r = (0, import_math22.toBytes)(`0x${signature.r.toString(16)}`, 32);
6629
7472
  const s = (0, import_math22.toBytes)(`0x${signature.s.toString(16)}`, 32);
6630
7473
  s[0] |= (signature.recovery || 0) << 7;
6631
- return (0, import_utils31.hexlify)((0, import_utils31.concat)([r, s]));
7474
+ return (0, import_utils35.hexlify)((0, import_utils35.concat)([r, s]));
6632
7475
  }
6633
7476
  /**
6634
7477
  * Add point on the current elliptic curve
@@ -6637,8 +7480,8 @@ var Signer = class {
6637
7480
  * @returns compressed point on the curve
6638
7481
  */
6639
7482
  addPoint(point) {
6640
- const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils31.arrayify)(this.compressedPublicKey));
6641
- const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils31.arrayify)(point));
7483
+ const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils35.arrayify)(this.compressedPublicKey));
7484
+ const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils35.arrayify)(point));
6642
7485
  const result = p0.add(p1);
6643
7486
  return `0x${result.toHex(true)}`;
6644
7487
  }
@@ -6650,16 +7493,16 @@ var Signer = class {
6650
7493
  * @returns public key from signature from the
6651
7494
  */
6652
7495
  static recoverPublicKey(data, signature) {
6653
- const signedMessageBytes = (0, import_utils31.arrayify)(signature);
7496
+ const signedMessageBytes = (0, import_utils35.arrayify)(signature);
6654
7497
  const r = signedMessageBytes.slice(0, 32);
6655
7498
  const s = signedMessageBytes.slice(32, 64);
6656
7499
  const recoveryParam = (s[0] & 128) >> 7;
6657
7500
  s[0] &= 127;
6658
- const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils31.hexlify)(r)), BigInt((0, import_utils31.hexlify)(s))).addRecoveryBit(
7501
+ const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils35.hexlify)(r)), BigInt((0, import_utils35.hexlify)(s))).addRecoveryBit(
6659
7502
  recoveryParam
6660
7503
  );
6661
- const publicKey = sig.recoverPublicKey((0, import_utils31.arrayify)(data)).toRawBytes(false).slice(1);
6662
- return (0, import_utils31.hexlify)(publicKey);
7504
+ const publicKey = sig.recoverPublicKey((0, import_utils35.arrayify)(data)).toRawBytes(false).slice(1);
7505
+ return (0, import_utils35.hexlify)(publicKey);
6663
7506
  }
6664
7507
  /**
6665
7508
  * Recover the address from a signature performed with [`sign`](#sign).
@@ -6678,7 +7521,7 @@ var Signer = class {
6678
7521
  * @returns random 32-byte hashed
6679
7522
  */
6680
7523
  static generatePrivateKey(entropy) {
6681
- return entropy ? (0, import_hasher2.hash)((0, import_utils31.concat)([(0, import_crypto3.randomBytes)(32), (0, import_utils31.arrayify)(entropy)])) : (0, import_crypto3.randomBytes)(32);
7524
+ return entropy ? (0, import_hasher3.hash)((0, import_utils35.concat)([(0, import_crypto3.randomBytes)(32), (0, import_utils35.arrayify)(entropy)])) : (0, import_crypto3.randomBytes)(32);
6682
7525
  }
6683
7526
  /**
6684
7527
  * Extended publicKey from a compact publicKey
@@ -6687,16 +7530,16 @@ var Signer = class {
6687
7530
  * @returns extended publicKey
6688
7531
  */
6689
7532
  static extendPublicKey(publicKey) {
6690
- const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils31.arrayify)(publicKey));
6691
- return (0, import_utils31.hexlify)(point.toRawBytes(false).slice(1));
7533
+ const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils35.arrayify)(publicKey));
7534
+ return (0, import_utils35.hexlify)(point.toRawBytes(false).slice(1));
6692
7535
  }
6693
7536
  };
6694
7537
 
6695
7538
  // src/wallet/keystore-wallet.ts
6696
7539
  var import_address6 = require("@fuel-ts/address");
6697
7540
  var import_crypto4 = require("@fuel-ts/crypto");
6698
- var import_errors19 = require("@fuel-ts/errors");
6699
- var import_utils32 = require("@fuel-ts/utils");
7541
+ var import_errors20 = require("@fuel-ts/errors");
7542
+ var import_utils36 = require("@fuel-ts/utils");
6700
7543
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
6701
7544
  var DEFAULT_KDF_PARAMS_R = 8;
6702
7545
  var DEFAULT_KDF_PARAMS_P = 1;
@@ -6772,13 +7615,13 @@ async function decryptKeystoreWallet(jsonWallet, password) {
6772
7615
  const macHashUint8Array = (0, import_crypto4.keccak256)(data);
6773
7616
  const macHash = (0, import_crypto4.stringFromBuffer)(macHashUint8Array, "hex");
6774
7617
  if (mac !== macHash) {
6775
- throw new import_errors19.FuelError(
6776
- import_errors19.ErrorCode.INVALID_PASSWORD,
7618
+ throw new import_errors20.FuelError(
7619
+ import_errors20.ErrorCode.INVALID_PASSWORD,
6777
7620
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
6778
7621
  );
6779
7622
  }
6780
7623
  const buffer = await (0, import_crypto4.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
6781
- const privateKey = (0, import_utils32.hexlify)(buffer);
7624
+ const privateKey = (0, import_utils36.hexlify)(buffer);
6782
7625
  return privateKey;
6783
7626
  }
6784
7627
 
@@ -6822,8 +7665,8 @@ var BaseWalletUnlocked = class extends Account {
6822
7665
  * @returns A promise that resolves to the signature as a ECDSA 64 bytes string.
6823
7666
  */
6824
7667
  async signMessage(message) {
6825
- const signedMessage = await this.signer().sign((0, import_hasher3.hashMessage)(message));
6826
- return (0, import_utils33.hexlify)(signedMessage);
7668
+ const signedMessage = await this.signer().sign((0, import_hasher4.hashMessage)(message));
7669
+ return (0, import_utils37.hexlify)(signedMessage);
6827
7670
  }
6828
7671
  /**
6829
7672
  * Signs a transaction with the wallet's private key.
@@ -6836,7 +7679,7 @@ var BaseWalletUnlocked = class extends Account {
6836
7679
  const chainId = this.provider.getChainId();
6837
7680
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
6838
7681
  const signature = await this.signer().sign(hashedTransaction);
6839
- return (0, import_utils33.hexlify)(signature);
7682
+ return (0, import_utils37.hexlify)(signature);
6840
7683
  }
6841
7684
  /**
6842
7685
  * Populates a transaction with the witnesses signature.
@@ -6903,16 +7746,16 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
6903
7746
 
6904
7747
  // src/hdwallet/hdwallet.ts
6905
7748
  var import_crypto6 = require("@fuel-ts/crypto");
6906
- var import_errors22 = require("@fuel-ts/errors");
6907
- var import_hasher6 = require("@fuel-ts/hasher");
7749
+ var import_errors23 = require("@fuel-ts/errors");
7750
+ var import_hasher7 = require("@fuel-ts/hasher");
6908
7751
  var import_math23 = require("@fuel-ts/math");
6909
- var import_utils37 = require("@fuel-ts/utils");
7752
+ var import_utils41 = require("@fuel-ts/utils");
6910
7753
 
6911
7754
  // src/mnemonic/mnemonic.ts
6912
7755
  var import_crypto5 = require("@fuel-ts/crypto");
6913
- var import_errors21 = require("@fuel-ts/errors");
6914
- var import_hasher5 = require("@fuel-ts/hasher");
6915
- var import_utils35 = require("@fuel-ts/utils");
7756
+ var import_errors22 = require("@fuel-ts/errors");
7757
+ var import_hasher6 = require("@fuel-ts/hasher");
7758
+ var import_utils39 = require("@fuel-ts/utils");
6916
7759
 
6917
7760
  // src/wordlists/words/english.ts
6918
7761
  var english = [
@@ -8973,9 +9816,9 @@ var Language = /* @__PURE__ */ ((Language2) => {
8973
9816
  })(Language || {});
8974
9817
 
8975
9818
  // src/mnemonic/utils.ts
8976
- var import_errors20 = require("@fuel-ts/errors");
8977
- var import_hasher4 = require("@fuel-ts/hasher");
8978
- var import_utils34 = require("@fuel-ts/utils");
9819
+ var import_errors21 = require("@fuel-ts/errors");
9820
+ var import_hasher5 = require("@fuel-ts/hasher");
9821
+ var import_utils38 = require("@fuel-ts/utils");
8979
9822
  function getLowerMask(bits) {
8980
9823
  return (1 << bits) - 1;
8981
9824
  }
@@ -9010,20 +9853,20 @@ function entropyToMnemonicIndices(entropy) {
9010
9853
  }
9011
9854
  }
9012
9855
  const checksumBits = entropy.length / 4;
9013
- const checksum = (0, import_utils34.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
9856
+ const checksum = (0, import_utils38.arrayify)((0, import_hasher5.sha256)(entropy))[0] & getUpperMask(checksumBits);
9014
9857
  indices[indices.length - 1] <<= checksumBits;
9015
9858
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
9016
9859
  return indices;
9017
9860
  }
9018
9861
  function mnemonicWordsToEntropy(words, wordlist) {
9019
9862
  const size = Math.ceil(11 * words.length / 8);
9020
- const entropy = (0, import_utils34.arrayify)(new Uint8Array(size));
9863
+ const entropy = (0, import_utils38.arrayify)(new Uint8Array(size));
9021
9864
  let offset = 0;
9022
9865
  for (let i = 0; i < words.length; i += 1) {
9023
9866
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
9024
9867
  if (index === -1) {
9025
- throw new import_errors20.FuelError(
9026
- import_errors20.ErrorCode.INVALID_MNEMONIC,
9868
+ throw new import_errors21.FuelError(
9869
+ import_errors21.ErrorCode.INVALID_MNEMONIC,
9027
9870
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
9028
9871
  );
9029
9872
  }
@@ -9037,10 +9880,10 @@ function mnemonicWordsToEntropy(words, wordlist) {
9037
9880
  const entropyBits = 32 * words.length / 3;
9038
9881
  const checksumBits = words.length / 3;
9039
9882
  const checksumMask = getUpperMask(checksumBits);
9040
- const checksum = (0, import_utils34.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
9883
+ const checksum = (0, import_utils38.arrayify)((0, import_hasher5.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
9041
9884
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
9042
- throw new import_errors20.FuelError(
9043
- import_errors20.ErrorCode.INVALID_CHECKSUM,
9885
+ throw new import_errors21.FuelError(
9886
+ import_errors21.ErrorCode.INVALID_CHECKSUM,
9044
9887
  "Checksum validation failed for the provided mnemonic."
9045
9888
  );
9046
9889
  }
@@ -9048,22 +9891,22 @@ function mnemonicWordsToEntropy(words, wordlist) {
9048
9891
  }
9049
9892
 
9050
9893
  // src/mnemonic/mnemonic.ts
9051
- var MasterSecret = (0, import_utils35.toUtf8Bytes)("Bitcoin seed");
9894
+ var MasterSecret = (0, import_utils39.toUtf8Bytes)("Bitcoin seed");
9052
9895
  var MainnetPRV = "0x0488ade4";
9053
9896
  var TestnetPRV = "0x04358394";
9054
9897
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
9055
9898
  function assertWordList(wordlist) {
9056
9899
  if (wordlist.length !== 2048) {
9057
- throw new import_errors21.FuelError(
9058
- import_errors21.ErrorCode.INVALID_WORD_LIST,
9900
+ throw new import_errors22.FuelError(
9901
+ import_errors22.ErrorCode.INVALID_WORD_LIST,
9059
9902
  `Expected word list length of 2048, but got ${wordlist.length}.`
9060
9903
  );
9061
9904
  }
9062
9905
  }
9063
9906
  function assertEntropy(entropy) {
9064
9907
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
9065
- throw new import_errors21.FuelError(
9066
- import_errors21.ErrorCode.INVALID_ENTROPY,
9908
+ throw new import_errors22.FuelError(
9909
+ import_errors22.ErrorCode.INVALID_ENTROPY,
9067
9910
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
9068
9911
  );
9069
9912
  }
@@ -9073,7 +9916,7 @@ function assertMnemonic(words) {
9073
9916
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
9074
9917
  ", "
9075
9918
  )}] words, but got ${words.length}.`;
9076
- throw new import_errors21.FuelError(import_errors21.ErrorCode.INVALID_MNEMONIC, errorMsg);
9919
+ throw new import_errors22.FuelError(import_errors22.ErrorCode.INVALID_MNEMONIC, errorMsg);
9077
9920
  }
9078
9921
  }
9079
9922
  var Mnemonic = class {
@@ -9112,7 +9955,7 @@ var Mnemonic = class {
9112
9955
  static mnemonicToEntropy(phrase, wordlist = english) {
9113
9956
  const words = getWords(phrase);
9114
9957
  assertMnemonic(words);
9115
- return (0, import_utils35.hexlify)(mnemonicWordsToEntropy(words, wordlist));
9958
+ return (0, import_utils39.hexlify)(mnemonicWordsToEntropy(words, wordlist));
9116
9959
  }
9117
9960
  /**
9118
9961
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -9120,7 +9963,7 @@ var Mnemonic = class {
9120
9963
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
9121
9964
  */
9122
9965
  static entropyToMnemonic(entropy, wordlist = english) {
9123
- const entropyBytes = (0, import_utils35.arrayify)(entropy);
9966
+ const entropyBytes = (0, import_utils39.arrayify)(entropy);
9124
9967
  assertWordList(wordlist);
9125
9968
  assertEntropy(entropyBytes);
9126
9969
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -9132,8 +9975,8 @@ var Mnemonic = class {
9132
9975
  */
9133
9976
  static mnemonicToSeed(phrase, passphrase = "") {
9134
9977
  assertMnemonic(getWords(phrase));
9135
- const phraseBytes = (0, import_utils35.toUtf8Bytes)(getPhrase(phrase));
9136
- const salt = (0, import_utils35.toUtf8Bytes)(`mnemonic${passphrase}`);
9978
+ const phraseBytes = (0, import_utils39.toUtf8Bytes)(getPhrase(phrase));
9979
+ const salt = (0, import_utils39.toUtf8Bytes)(`mnemonic${passphrase}`);
9137
9980
  return (0, import_crypto5.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
9138
9981
  }
9139
9982
  /**
@@ -9189,14 +10032,14 @@ var Mnemonic = class {
9189
10032
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
9190
10033
  */
9191
10034
  static masterKeysFromSeed(seed) {
9192
- const seedArray = (0, import_utils35.arrayify)(seed);
10035
+ const seedArray = (0, import_utils39.arrayify)(seed);
9193
10036
  if (seedArray.length < 16 || seedArray.length > 64) {
9194
- throw new import_errors21.FuelError(
9195
- import_errors21.ErrorCode.INVALID_SEED,
10037
+ throw new import_errors22.FuelError(
10038
+ import_errors22.ErrorCode.INVALID_SEED,
9196
10039
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
9197
10040
  );
9198
10041
  }
9199
- return (0, import_utils35.arrayify)((0, import_crypto5.computeHmac)("sha512", MasterSecret, seedArray));
10042
+ return (0, import_utils39.arrayify)((0, import_crypto5.computeHmac)("sha512", MasterSecret, seedArray));
9200
10043
  }
9201
10044
  /**
9202
10045
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -9207,22 +10050,22 @@ var Mnemonic = class {
9207
10050
  */
9208
10051
  static seedToExtendedKey(seed, testnet = false) {
9209
10052
  const masterKey = Mnemonic.masterKeysFromSeed(seed);
9210
- const prefix = (0, import_utils35.arrayify)(testnet ? TestnetPRV : MainnetPRV);
10053
+ const prefix = (0, import_utils39.arrayify)(testnet ? TestnetPRV : MainnetPRV);
9211
10054
  const depth = "0x00";
9212
10055
  const fingerprint = "0x00000000";
9213
10056
  const index = "0x00000000";
9214
10057
  const chainCode = masterKey.slice(32);
9215
10058
  const privateKey = masterKey.slice(0, 32);
9216
- const extendedKey = (0, import_utils35.concat)([
10059
+ const extendedKey = (0, import_utils39.concat)([
9217
10060
  prefix,
9218
10061
  depth,
9219
10062
  fingerprint,
9220
10063
  index,
9221
10064
  chainCode,
9222
- (0, import_utils35.concat)(["0x00", privateKey])
10065
+ (0, import_utils39.concat)(["0x00", privateKey])
9223
10066
  ]);
9224
- const checksum = (0, import_utils35.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
9225
- return (0, import_utils35.encodeBase58)((0, import_utils35.concat)([extendedKey, checksum]));
10067
+ const checksum = (0, import_utils39.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(extendedKey)), 0, 4);
10068
+ return (0, import_utils39.encodeBase58)((0, import_utils39.concat)([extendedKey, checksum]));
9226
10069
  }
9227
10070
  /**
9228
10071
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -9237,7 +10080,7 @@ var Mnemonic = class {
9237
10080
  * @returns A randomly generated mnemonic
9238
10081
  */
9239
10082
  static generate(size = 32, extraEntropy = "") {
9240
- const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils35.concat)([(0, import_crypto5.randomBytes)(size), (0, import_utils35.arrayify)(extraEntropy)])) : (0, import_crypto5.randomBytes)(size);
10083
+ const entropy = extraEntropy ? (0, import_hasher6.sha256)((0, import_utils39.concat)([(0, import_crypto5.randomBytes)(size), (0, import_utils39.arrayify)(extraEntropy)])) : (0, import_crypto5.randomBytes)(size);
9241
10084
  return Mnemonic.entropyToMnemonic(entropy);
9242
10085
  }
9243
10086
  };
@@ -9245,12 +10088,12 @@ var mnemonic_default = Mnemonic;
9245
10088
 
9246
10089
  // src/hdwallet/hdwallet.ts
9247
10090
  var HARDENED_INDEX = 2147483648;
9248
- var MainnetPRV2 = (0, import_utils37.hexlify)("0x0488ade4");
9249
- var MainnetPUB = (0, import_utils37.hexlify)("0x0488b21e");
9250
- var TestnetPRV2 = (0, import_utils37.hexlify)("0x04358394");
9251
- var TestnetPUB = (0, import_utils37.hexlify)("0x043587cf");
10091
+ var MainnetPRV2 = (0, import_utils41.hexlify)("0x0488ade4");
10092
+ var MainnetPUB = (0, import_utils41.hexlify)("0x0488b21e");
10093
+ var TestnetPRV2 = (0, import_utils41.hexlify)("0x04358394");
10094
+ var TestnetPUB = (0, import_utils41.hexlify)("0x043587cf");
9252
10095
  function base58check(data) {
9253
- return (0, import_utils37.encodeBase58)((0, import_utils37.concat)([data, (0, import_utils37.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
10096
+ return (0, import_utils41.encodeBase58)((0, import_utils41.concat)([data, (0, import_utils41.dataSlice)((0, import_hasher7.sha256)((0, import_hasher7.sha256)(data)), 0, 4)]));
9254
10097
  }
9255
10098
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
9256
10099
  if (isPublic) {
@@ -9259,17 +10102,17 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
9259
10102
  return testnet ? TestnetPRV2 : MainnetPRV2;
9260
10103
  }
9261
10104
  function isPublicExtendedKey(extendedKey) {
9262
- return [MainnetPUB, TestnetPUB].includes((0, import_utils37.hexlify)(extendedKey.slice(0, 4)));
10105
+ return [MainnetPUB, TestnetPUB].includes((0, import_utils41.hexlify)(extendedKey.slice(0, 4)));
9263
10106
  }
9264
10107
  function isValidExtendedKey(extendedKey) {
9265
10108
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
9266
- (0, import_utils37.hexlify)(extendedKey.slice(0, 4))
10109
+ (0, import_utils41.hexlify)(extendedKey.slice(0, 4))
9267
10110
  );
9268
10111
  }
9269
10112
  function parsePath(path, depth = 0) {
9270
10113
  const components = path.split("/");
9271
10114
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
9272
- throw new import_errors22.FuelError(import_errors22.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path}`);
10115
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path}`);
9273
10116
  }
9274
10117
  if (components[0] === "m") {
9275
10118
  components.shift();
@@ -9281,8 +10124,8 @@ function parsePath(path, depth = 0) {
9281
10124
  var HDWallet = class {
9282
10125
  depth = 0;
9283
10126
  index = 0;
9284
- fingerprint = (0, import_utils37.hexlify)("0x00000000");
9285
- parentFingerprint = (0, import_utils37.hexlify)("0x00000000");
10127
+ fingerprint = (0, import_utils41.hexlify)("0x00000000");
10128
+ parentFingerprint = (0, import_utils41.hexlify)("0x00000000");
9286
10129
  privateKey;
9287
10130
  publicKey;
9288
10131
  chainCode;
@@ -9294,19 +10137,19 @@ var HDWallet = class {
9294
10137
  constructor(config) {
9295
10138
  if (config.privateKey) {
9296
10139
  const signer = new Signer(config.privateKey);
9297
- this.publicKey = (0, import_utils37.hexlify)(signer.compressedPublicKey);
9298
- this.privateKey = (0, import_utils37.hexlify)(config.privateKey);
10140
+ this.publicKey = (0, import_utils41.hexlify)(signer.compressedPublicKey);
10141
+ this.privateKey = (0, import_utils41.hexlify)(config.privateKey);
9299
10142
  } else {
9300
10143
  if (!config.publicKey) {
9301
- throw new import_errors22.FuelError(
9302
- import_errors22.ErrorCode.HD_WALLET_ERROR,
10144
+ throw new import_errors23.FuelError(
10145
+ import_errors23.ErrorCode.HD_WALLET_ERROR,
9303
10146
  "Both public and private Key cannot be missing. At least one should be provided."
9304
10147
  );
9305
10148
  }
9306
- this.publicKey = (0, import_utils37.hexlify)(config.publicKey);
10149
+ this.publicKey = (0, import_utils41.hexlify)(config.publicKey);
9307
10150
  }
9308
10151
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
9309
- this.fingerprint = (0, import_utils37.dataSlice)((0, import_crypto6.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
10152
+ this.fingerprint = (0, import_utils41.dataSlice)((0, import_crypto6.ripemd160)((0, import_hasher7.sha256)(this.publicKey)), 0, 4);
9310
10153
  this.depth = config.depth || this.depth;
9311
10154
  this.index = config.index || this.index;
9312
10155
  this.chainCode = config.chainCode;
@@ -9322,23 +10165,23 @@ var HDWallet = class {
9322
10165
  * @returns A new instance of HDWallet on the derived index
9323
10166
  */
9324
10167
  deriveIndex(index) {
9325
- const privateKey = this.privateKey && (0, import_utils37.arrayify)(this.privateKey);
9326
- const publicKey = (0, import_utils37.arrayify)(this.publicKey);
9327
- const chainCode = (0, import_utils37.arrayify)(this.chainCode);
10168
+ const privateKey = this.privateKey && (0, import_utils41.arrayify)(this.privateKey);
10169
+ const publicKey = (0, import_utils41.arrayify)(this.publicKey);
10170
+ const chainCode = (0, import_utils41.arrayify)(this.chainCode);
9328
10171
  const data = new Uint8Array(37);
9329
10172
  if (index & HARDENED_INDEX) {
9330
10173
  if (!privateKey) {
9331
- throw new import_errors22.FuelError(
9332
- import_errors22.ErrorCode.HD_WALLET_ERROR,
10174
+ throw new import_errors23.FuelError(
10175
+ import_errors23.ErrorCode.HD_WALLET_ERROR,
9333
10176
  "Cannot derive a hardened index without a private Key."
9334
10177
  );
9335
10178
  }
9336
10179
  data.set(privateKey, 1);
9337
10180
  } else {
9338
- data.set((0, import_utils37.arrayify)(this.publicKey));
10181
+ data.set((0, import_utils41.arrayify)(this.publicKey));
9339
10182
  }
9340
10183
  data.set((0, import_math23.toBytes)(index, 4), 33);
9341
- const bytes = (0, import_utils37.arrayify)((0, import_crypto6.computeHmac)("sha512", chainCode, data));
10184
+ const bytes = (0, import_utils41.arrayify)((0, import_crypto6.computeHmac)("sha512", chainCode, data));
9342
10185
  const IL = bytes.slice(0, 32);
9343
10186
  const IR = bytes.slice(32);
9344
10187
  if (privateKey) {
@@ -9352,7 +10195,7 @@ var HDWallet = class {
9352
10195
  parentFingerprint: this.fingerprint
9353
10196
  });
9354
10197
  }
9355
- const signer = new Signer((0, import_utils37.hexlify)(IL));
10198
+ const signer = new Signer((0, import_utils41.hexlify)(IL));
9356
10199
  const Ki = signer.addPoint(publicKey);
9357
10200
  return new HDWallet({
9358
10201
  publicKey: Ki,
@@ -9381,18 +10224,18 @@ var HDWallet = class {
9381
10224
  */
9382
10225
  toExtendedKey(isPublic = false, testnet = false) {
9383
10226
  if (this.depth >= 256) {
9384
- throw new import_errors22.FuelError(
9385
- import_errors22.ErrorCode.HD_WALLET_ERROR,
10227
+ throw new import_errors23.FuelError(
10228
+ import_errors23.ErrorCode.HD_WALLET_ERROR,
9386
10229
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
9387
10230
  );
9388
10231
  }
9389
10232
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
9390
- const depth = (0, import_utils37.hexlify)(Uint8Array.from([this.depth]));
10233
+ const depth = (0, import_utils41.hexlify)(Uint8Array.from([this.depth]));
9391
10234
  const parentFingerprint = this.parentFingerprint;
9392
10235
  const index = (0, import_math23.toHex)(this.index, 4);
9393
10236
  const chainCode = this.chainCode;
9394
- const key = this.privateKey != null && !isPublic ? (0, import_utils37.concat)(["0x00", this.privateKey]) : this.publicKey;
9395
- const extendedKey = (0, import_utils37.arrayify)((0, import_utils37.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
10237
+ const key = this.privateKey != null && !isPublic ? (0, import_utils41.concat)(["0x00", this.privateKey]) : this.publicKey;
10238
+ const extendedKey = (0, import_utils41.arrayify)((0, import_utils41.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
9396
10239
  return base58check(extendedKey);
9397
10240
  }
9398
10241
  /**
@@ -9404,34 +10247,34 @@ var HDWallet = class {
9404
10247
  static fromSeed(seed) {
9405
10248
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
9406
10249
  return new HDWallet({
9407
- chainCode: (0, import_utils37.arrayify)(masterKey.slice(32)),
9408
- privateKey: (0, import_utils37.arrayify)(masterKey.slice(0, 32))
10250
+ chainCode: (0, import_utils41.arrayify)(masterKey.slice(32)),
10251
+ privateKey: (0, import_utils41.arrayify)(masterKey.slice(0, 32))
9409
10252
  });
9410
10253
  }
9411
10254
  static fromExtendedKey(extendedKey) {
9412
- const decoded = (0, import_utils37.hexlify)((0, import_math23.toBytes)((0, import_utils37.decodeBase58)(extendedKey)));
9413
- const bytes = (0, import_utils37.arrayify)(decoded);
10255
+ const decoded = (0, import_utils41.hexlify)((0, import_math23.toBytes)((0, import_utils41.decodeBase58)(extendedKey)));
10256
+ const bytes = (0, import_utils41.arrayify)(decoded);
9414
10257
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
9415
10258
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
9416
- throw new import_errors22.FuelError(import_errors22.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
10259
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
9417
10260
  }
9418
10261
  if (!validChecksum) {
9419
- throw new import_errors22.FuelError(import_errors22.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
10262
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
9420
10263
  }
9421
10264
  const depth = bytes[4];
9422
- const parentFingerprint = (0, import_utils37.hexlify)(bytes.slice(5, 9));
9423
- const index = parseInt((0, import_utils37.hexlify)(bytes.slice(9, 13)).substring(2), 16);
9424
- const chainCode = (0, import_utils37.hexlify)(bytes.slice(13, 45));
10265
+ const parentFingerprint = (0, import_utils41.hexlify)(bytes.slice(5, 9));
10266
+ const index = parseInt((0, import_utils41.hexlify)(bytes.slice(9, 13)).substring(2), 16);
10267
+ const chainCode = (0, import_utils41.hexlify)(bytes.slice(13, 45));
9425
10268
  const key = bytes.slice(45, 78);
9426
10269
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
9427
- throw new import_errors22.FuelError(
9428
- import_errors22.ErrorCode.HD_WALLET_ERROR,
10270
+ throw new import_errors23.FuelError(
10271
+ import_errors23.ErrorCode.HD_WALLET_ERROR,
9429
10272
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
9430
10273
  );
9431
10274
  }
9432
10275
  if (isPublicExtendedKey(bytes)) {
9433
10276
  if (key[0] !== 3) {
9434
- throw new import_errors22.FuelError(import_errors22.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
10277
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
9435
10278
  }
9436
10279
  return new HDWallet({
9437
10280
  publicKey: key,
@@ -9442,7 +10285,7 @@ var HDWallet = class {
9442
10285
  });
9443
10286
  }
9444
10287
  if (key[0] !== 0) {
9445
- throw new import_errors22.FuelError(import_errors22.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
10288
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
9446
10289
  }
9447
10290
  return new HDWallet({
9448
10291
  privateKey: key.slice(1),
@@ -9610,7 +10453,7 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
9610
10453
  // src/wallet-manager/wallet-manager.ts
9611
10454
  var import_address9 = require("@fuel-ts/address");
9612
10455
  var import_crypto7 = require("@fuel-ts/crypto");
9613
- var import_errors25 = require("@fuel-ts/errors");
10456
+ var import_errors26 = require("@fuel-ts/errors");
9614
10457
  var import_events = require("events");
9615
10458
 
9616
10459
  // src/wallet-manager/storages/memory-storage.ts
@@ -9633,7 +10476,7 @@ var MemoryStorage = class {
9633
10476
 
9634
10477
  // src/wallet-manager/vaults/mnemonic-vault.ts
9635
10478
  var import_address7 = require("@fuel-ts/address");
9636
- var import_errors23 = require("@fuel-ts/errors");
10479
+ var import_errors24 = require("@fuel-ts/errors");
9637
10480
  var _secret;
9638
10481
  var MnemonicVault = class {
9639
10482
  constructor(options) {
@@ -9689,8 +10532,8 @@ var MnemonicVault = class {
9689
10532
  }
9690
10533
  numberOfAccounts += 1;
9691
10534
  } while (numberOfAccounts < this.numberOfAccounts);
9692
- throw new import_errors23.FuelError(
9693
- import_errors23.ErrorCode.WALLET_MANAGER_ERROR,
10535
+ throw new import_errors24.FuelError(
10536
+ import_errors24.ErrorCode.WALLET_MANAGER_ERROR,
9694
10537
  `Account with address '${address}' not found in derived wallets.`
9695
10538
  );
9696
10539
  }
@@ -9704,7 +10547,7 @@ __publicField(MnemonicVault, "type", "mnemonic");
9704
10547
 
9705
10548
  // src/wallet-manager/vaults/privatekey-vault.ts
9706
10549
  var import_address8 = require("@fuel-ts/address");
9707
- var import_errors24 = require("@fuel-ts/errors");
10550
+ var import_errors25 = require("@fuel-ts/errors");
9708
10551
  var _privateKeys;
9709
10552
  var PrivateKeyVault = class {
9710
10553
  /**
@@ -9745,8 +10588,8 @@ var PrivateKeyVault = class {
9745
10588
  (pk) => Wallet.fromPrivateKey(pk).address.equals(ownerAddress)
9746
10589
  );
9747
10590
  if (!privateKey) {
9748
- throw new import_errors24.FuelError(
9749
- import_errors24.ErrorCode.WALLET_MANAGER_ERROR,
10591
+ throw new import_errors25.FuelError(
10592
+ import_errors25.ErrorCode.WALLET_MANAGER_ERROR,
9750
10593
  `No private key found for address '${address}'.`
9751
10594
  );
9752
10595
  }
@@ -9770,7 +10613,7 @@ var ERROR_MESSAGES = {
9770
10613
  };
9771
10614
  function assert(condition, message) {
9772
10615
  if (!condition) {
9773
- throw new import_errors25.FuelError(import_errors25.ErrorCode.WALLET_MANAGER_ERROR, message);
10616
+ throw new import_errors26.FuelError(import_errors26.ErrorCode.WALLET_MANAGER_ERROR, message);
9774
10617
  }
9775
10618
  }
9776
10619
  var _vaults, _passphrase, _isLocked, _serializeVaults, serializeVaults_fn, _deserializeVaults, deserializeVaults_fn;
@@ -9996,25 +10839,25 @@ deserializeVaults_fn = function(vaults) {
9996
10839
  __publicField(WalletManager, "Vaults", [MnemonicVault, PrivateKeyVault]);
9997
10840
 
9998
10841
  // src/wallet-manager/types.ts
9999
- var import_errors26 = require("@fuel-ts/errors");
10842
+ var import_errors27 = require("@fuel-ts/errors");
10000
10843
  var Vault = class {
10001
10844
  constructor(_options) {
10002
- throw new import_errors26.FuelError(import_errors26.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10845
+ throw new import_errors27.FuelError(import_errors27.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10003
10846
  }
10004
10847
  serialize() {
10005
- throw new import_errors26.FuelError(import_errors26.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10848
+ throw new import_errors27.FuelError(import_errors27.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10006
10849
  }
10007
10850
  getAccounts() {
10008
- throw new import_errors26.FuelError(import_errors26.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10851
+ throw new import_errors27.FuelError(import_errors27.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10009
10852
  }
10010
10853
  addAccount() {
10011
- throw new import_errors26.FuelError(import_errors26.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10854
+ throw new import_errors27.FuelError(import_errors27.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10012
10855
  }
10013
10856
  exportAccount(_address) {
10014
- throw new import_errors26.FuelError(import_errors26.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10857
+ throw new import_errors27.FuelError(import_errors27.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10015
10858
  }
10016
10859
  getWallet(_address) {
10017
- throw new import_errors26.FuelError(import_errors26.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10860
+ throw new import_errors27.FuelError(import_errors27.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10018
10861
  }
10019
10862
  };
10020
10863
  __publicField(Vault, "type");
@@ -10024,19 +10867,19 @@ var StorageAbstract = class {
10024
10867
  // src/predicate/predicate.ts
10025
10868
  var import_abi_coder8 = require("@fuel-ts/abi-coder");
10026
10869
  var import_address10 = require("@fuel-ts/address");
10027
- var import_errors27 = require("@fuel-ts/errors");
10028
- var import_utils39 = require("@fuel-ts/utils");
10870
+ var import_errors28 = require("@fuel-ts/errors");
10871
+ var import_utils43 = require("@fuel-ts/utils");
10029
10872
 
10030
10873
  // src/predicate/utils/getPredicateRoot.ts
10031
- var import_hasher7 = require("@fuel-ts/hasher");
10874
+ var import_hasher8 = require("@fuel-ts/hasher");
10032
10875
  var import_merkle = require("@fuel-ts/merkle");
10033
- var import_utils38 = require("@fuel-ts/utils");
10876
+ var import_utils42 = require("@fuel-ts/utils");
10034
10877
  var getPredicateRoot = (bytecode) => {
10035
10878
  const chunkSize = 16 * 1024;
10036
- const bytes = (0, import_utils38.arrayify)(bytecode);
10037
- const chunks = (0, import_utils38.chunkAndPadBytes)(bytes, chunkSize);
10038
- const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0, import_utils38.hexlify)(c)));
10039
- const predicateRoot = (0, import_hasher7.hash)((0, import_utils38.concat)(["0x4655454C", codeRoot]));
10879
+ const bytes = (0, import_utils42.arrayify)(bytecode);
10880
+ const chunks = (0, import_utils42.chunkAndPadBytes)(bytes, chunkSize);
10881
+ const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0, import_utils42.hexlify)(c)));
10882
+ const predicateRoot = (0, import_hasher8.hash)((0, import_utils42.concat)(["0x4655454C", codeRoot]));
10040
10883
  return predicateRoot;
10041
10884
  };
10042
10885
 
@@ -10088,8 +10931,8 @@ var Predicate = class extends Account {
10088
10931
  }
10089
10932
  request.inputs.filter(isRequestInputCoinOrMessage).forEach((input) => {
10090
10933
  if (isRequestInputResourceFromOwner(input, this.address)) {
10091
- input.predicate = (0, import_utils39.hexlify)(this.bytes);
10092
- input.predicateData = (0, import_utils39.hexlify)(this.getPredicateData());
10934
+ input.predicate = (0, import_utils43.hexlify)(this.bytes);
10935
+ input.predicateData = (0, import_utils43.hexlify)(this.getPredicateData());
10093
10936
  input.witnessIndex = 0;
10094
10937
  }
10095
10938
  });
@@ -10131,13 +10974,13 @@ var Predicate = class extends Account {
10131
10974
  * @returns An object containing the new predicate bytes and interface.
10132
10975
  */
10133
10976
  static processPredicateData(bytes, jsonAbi, configurableConstants) {
10134
- let predicateBytes = (0, import_utils39.arrayify)(bytes);
10977
+ let predicateBytes = (0, import_utils43.arrayify)(bytes);
10135
10978
  let abiInterface;
10136
10979
  if (jsonAbi) {
10137
10980
  abiInterface = new import_abi_coder8.Interface(jsonAbi);
10138
10981
  if (abiInterface.functions.main === void 0) {
10139
- throw new import_errors27.FuelError(
10140
- import_errors27.ErrorCode.ABI_MAIN_METHOD_MISSING,
10982
+ throw new import_errors28.FuelError(
10983
+ import_errors28.ErrorCode.ABI_MAIN_METHOD_MISSING,
10141
10984
  'Cannot use ABI without "main" function.'
10142
10985
  );
10143
10986
  }
@@ -10169,8 +11012,8 @@ var Predicate = class extends Account {
10169
11012
  );
10170
11013
  return resources.map((resource) => ({
10171
11014
  ...resource,
10172
- predicate: (0, import_utils39.hexlify)(this.bytes),
10173
- predicateData: (0, import_utils39.hexlify)(this.getPredicateData())
11015
+ predicate: (0, import_utils43.hexlify)(this.bytes),
11016
+ predicateData: (0, import_utils43.hexlify)(this.getPredicateData())
10174
11017
  }));
10175
11018
  }
10176
11019
  /**
@@ -10182,8 +11025,8 @@ var Predicate = class extends Account {
10182
11025
  generateFakeResources(coins) {
10183
11026
  return super.generateFakeResources(coins).map((coin) => ({
10184
11027
  ...coin,
10185
- predicate: (0, import_utils39.hexlify)(this.bytes),
10186
- predicateData: (0, import_utils39.hexlify)(this.getPredicateData())
11028
+ predicate: (0, import_utils43.hexlify)(this.bytes),
11029
+ predicateData: (0, import_utils43.hexlify)(this.getPredicateData())
10187
11030
  }));
10188
11031
  }
10189
11032
  /**
@@ -10198,21 +11041,21 @@ var Predicate = class extends Account {
10198
11041
  const mutatedBytes = bytes;
10199
11042
  try {
10200
11043
  if (!abiInterface) {
10201
- throw new import_errors27.FuelError(
10202
- import_errors27.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
11044
+ throw new import_errors28.FuelError(
11045
+ import_errors28.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
10203
11046
  "Cannot validate configurable constants because the Predicate was instantiated without a JSON ABI"
10204
11047
  );
10205
11048
  }
10206
11049
  if (Object.keys(abiInterface.configurables).length === 0) {
10207
- throw new import_errors27.FuelError(
10208
- import_errors27.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
11050
+ throw new import_errors28.FuelError(
11051
+ import_errors28.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
10209
11052
  "Predicate has no configurable constants to be set"
10210
11053
  );
10211
11054
  }
10212
11055
  Object.entries(configurableConstants).forEach(([key, value]) => {
10213
11056
  if (!abiInterface?.configurables[key]) {
10214
- throw new import_errors27.FuelError(
10215
- import_errors27.ErrorCode.CONFIGURABLE_NOT_FOUND,
11057
+ throw new import_errors28.FuelError(
11058
+ import_errors28.ErrorCode.CONFIGURABLE_NOT_FOUND,
10216
11059
  `No configurable constant named '${key}' found in the Predicate`
10217
11060
  );
10218
11061
  }
@@ -10221,8 +11064,8 @@ var Predicate = class extends Account {
10221
11064
  mutatedBytes.set(encoded, offset);
10222
11065
  });
10223
11066
  } catch (err) {
10224
- throw new import_errors27.FuelError(
10225
- import_errors27.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
11067
+ throw new import_errors28.FuelError(
11068
+ import_errors28.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
10226
11069
  `Error setting configurable constants: ${err.message}.`
10227
11070
  );
10228
11071
  }
@@ -10253,10 +11096,10 @@ var Predicate = class extends Account {
10253
11096
  };
10254
11097
 
10255
11098
  // src/connectors/fuel.ts
10256
- var import_errors30 = require("@fuel-ts/errors");
11099
+ var import_errors31 = require("@fuel-ts/errors");
10257
11100
 
10258
11101
  // src/connectors/fuel-connector.ts
10259
- var import_errors28 = require("@fuel-ts/errors");
11102
+ var import_errors29 = require("@fuel-ts/errors");
10260
11103
  var import_events2 = require("events");
10261
11104
 
10262
11105
  // src/connectors/types/connector-types.ts
@@ -10322,6 +11165,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10322
11165
  metadata = {};
10323
11166
  connected = false;
10324
11167
  installed = false;
11168
+ external = true;
10325
11169
  events = FuelConnectorEventTypes;
10326
11170
  /**
10327
11171
  * Should return true if the connector is loaded
@@ -10330,7 +11174,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10330
11174
  * @returns Always true.
10331
11175
  */
10332
11176
  async ping() {
10333
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11177
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10334
11178
  }
10335
11179
  /**
10336
11180
  * Should return the current version of the connector
@@ -10339,7 +11183,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10339
11183
  * @returns boolean - connection status.
10340
11184
  */
10341
11185
  async version() {
10342
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11186
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10343
11187
  }
10344
11188
  /**
10345
11189
  * Should return true if the connector is connected
@@ -10348,7 +11192,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10348
11192
  * @returns The connection status.
10349
11193
  */
10350
11194
  async isConnected() {
10351
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11195
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10352
11196
  }
10353
11197
  /**
10354
11198
  * Should return all the accounts authorized for the
@@ -10357,7 +11201,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10357
11201
  * @returns The accounts addresses strings
10358
11202
  */
10359
11203
  async accounts() {
10360
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11204
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10361
11205
  }
10362
11206
  /**
10363
11207
  * Should start the connection process and return
@@ -10369,7 +11213,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10369
11213
  * @returns boolean - connection status.
10370
11214
  */
10371
11215
  async connect() {
10372
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11216
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10373
11217
  }
10374
11218
  /**
10375
11219
  * Should disconnect the current connection and
@@ -10379,7 +11223,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10379
11223
  * @returns The connection status.
10380
11224
  */
10381
11225
  async disconnect() {
10382
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11226
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10383
11227
  }
10384
11228
  /**
10385
11229
  * Should start the sign message process and return
@@ -10391,7 +11235,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10391
11235
  * @returns Message signature
10392
11236
  */
10393
11237
  async signMessage(_address, _message) {
10394
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11238
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10395
11239
  }
10396
11240
  /**
10397
11241
  * Should start the sign transaction process and return
@@ -10403,7 +11247,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10403
11247
  * @returns Transaction signature
10404
11248
  */
10405
11249
  async signTransaction(_address, _transaction) {
10406
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11250
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10407
11251
  }
10408
11252
  /**
10409
11253
  * Should start the send transaction process and return
@@ -10419,7 +11263,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10419
11263
  * @returns The transaction id
10420
11264
  */
10421
11265
  async sendTransaction(_address, _transaction) {
10422
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11266
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10423
11267
  }
10424
11268
  /**
10425
11269
  * Should return the current account selected inside the connector, if the account
@@ -10430,7 +11274,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10430
11274
  * @returns The current account selected otherwise null.
10431
11275
  */
10432
11276
  async currentAccount() {
10433
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11277
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10434
11278
  }
10435
11279
  /**
10436
11280
  * Should add the assets metadata to the connector and return true if the asset
@@ -10444,7 +11288,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10444
11288
  * @returns True if the asset was added successfully
10445
11289
  */
10446
11290
  async addAssets(_assets) {
10447
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11291
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10448
11292
  }
10449
11293
  /**
10450
11294
  * Should add the asset metadata to the connector and return true if the asset
@@ -10458,7 +11302,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10458
11302
  * @returns True if the asset was added successfully
10459
11303
  */
10460
11304
  async addAsset(_asset) {
10461
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11305
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10462
11306
  }
10463
11307
  /**
10464
11308
  * Should return all the assets added to the connector. If a connection is already established.
@@ -10466,7 +11310,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10466
11310
  * @returns Array of assets metadata from the connector vinculated to the all accounts from a specific Wallet.
10467
11311
  */
10468
11312
  async assets() {
10469
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11313
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10470
11314
  }
10471
11315
  /**
10472
11316
  * Should start the add network process and return true if the network was added successfully.
@@ -10477,7 +11321,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10477
11321
  * @returns Return true if the network was added successfully
10478
11322
  */
10479
11323
  async addNetwork(_networkUrl) {
10480
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11324
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10481
11325
  }
10482
11326
  /**
10483
11327
  * Should start the select network process and return true if the network has change successfully.
@@ -10488,7 +11332,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10488
11332
  * @returns Return true if the network was added successfully
10489
11333
  */
10490
11334
  async selectNetwork(_network) {
10491
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11335
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10492
11336
  }
10493
11337
  /**
10494
11338
  * Should return all the networks available from the connector. If the connection is already established.
@@ -10496,7 +11340,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10496
11340
  * @returns Return all the networks added to the connector.
10497
11341
  */
10498
11342
  async networks() {
10499
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11343
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10500
11344
  }
10501
11345
  /**
10502
11346
  * Should return the current network selected inside the connector. Even if the connection is not established.
@@ -10504,7 +11348,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10504
11348
  * @returns Return the current network selected inside the connector.
10505
11349
  */
10506
11350
  async currentNetwork() {
10507
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11351
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10508
11352
  }
10509
11353
  /**
10510
11354
  * Should add the ABI to the connector and return true if the ABI was added successfully.
@@ -10514,7 +11358,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10514
11358
  * @returns Return true if the ABI was added successfully.
10515
11359
  */
10516
11360
  async addABI(_contractId, _abi) {
10517
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11361
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10518
11362
  }
10519
11363
  /**
10520
11364
  * Should return the ABI from the connector vinculated to the all accounts from a specific Wallet.
@@ -10523,7 +11367,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10523
11367
  * @returns The ABI if it exists, otherwise return null.
10524
11368
  */
10525
11369
  async getABI(_id) {
10526
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11370
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10527
11371
  }
10528
11372
  /**
10529
11373
  * Should return true if the abi exists in the connector vinculated to the all accounts from a specific Wallet.
@@ -10532,7 +11376,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10532
11376
  * @returns Returns true if the abi exists or false if not.
10533
11377
  */
10534
11378
  async hasABI(_id) {
10535
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11379
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10536
11380
  }
10537
11381
  /**
10538
11382
  * Event listener for the connector.
@@ -10576,7 +11420,7 @@ function dispatchFuelConnectorEvent(connector) {
10576
11420
  }
10577
11421
 
10578
11422
  // src/connectors/utils/promises.ts
10579
- var import_errors29 = require("@fuel-ts/errors");
11423
+ var import_errors30 = require("@fuel-ts/errors");
10580
11424
  function deferPromise() {
10581
11425
  const defer = {};
10582
11426
  defer.promise = new Promise((resolve, reject) => {
@@ -10588,7 +11432,7 @@ function deferPromise() {
10588
11432
  async function withTimeout(promise, timeout = 1050) {
10589
11433
  const timeoutPromise = new Promise((resolve, reject) => {
10590
11434
  setTimeout(() => {
10591
- reject(new import_errors29.FuelError(import_errors29.FuelError.CODES.TIMEOUT_EXCEEDED, "Promise timed out"));
11435
+ reject(new import_errors30.FuelError(import_errors30.FuelError.CODES.TIMEOUT_EXCEEDED, "Promise timed out"));
10592
11436
  }, timeout);
10593
11437
  });
10594
11438
  return Promise.race([timeoutPromise, promise]);
@@ -10622,7 +11466,7 @@ var _Fuel = class extends FuelConnector {
10622
11466
  await this.setDefaultConnector();
10623
11467
  this._targetUnsubscribe = this.setupConnectorListener();
10624
11468
  } catch (error) {
10625
- throw new import_errors30.FuelError(import_errors30.ErrorCode.INVALID_PROVIDER, "Error initializing Fuel Connector");
11469
+ throw new import_errors31.FuelError(import_errors31.ErrorCode.INVALID_PROVIDER, "Error initializing Fuel Connector");
10626
11470
  }
10627
11471
  }
10628
11472
  async init() {
@@ -10688,8 +11532,8 @@ var _Fuel = class extends FuelConnector {
10688
11532
  const hasConnector = await this.hasConnector();
10689
11533
  await this.pingConnector();
10690
11534
  if (!this._currentConnector || !hasConnector) {
10691
- throw new import_errors30.FuelError(
10692
- import_errors30.ErrorCode.MISSING_CONNECTOR,
11535
+ throw new import_errors31.FuelError(
11536
+ import_errors31.ErrorCode.MISSING_CONNECTOR,
10693
11537
  `No connector selected for calling ${method}. Use hasConnector before executing other methods.`
10694
11538
  );
10695
11539
  }
@@ -10753,7 +11597,7 @@ var _Fuel = class extends FuelConnector {
10753
11597
  cacheTime: PING_CACHE_TIME
10754
11598
  })();
10755
11599
  } catch {
10756
- throw new import_errors30.FuelError(import_errors30.ErrorCode.INVALID_PROVIDER, "Current connector is not available.");
11600
+ throw new import_errors31.FuelError(import_errors31.ErrorCode.INVALID_PROVIDER, "Current connector is not available.");
10757
11601
  }
10758
11602
  }
10759
11603
  /**
@@ -10902,7 +11746,7 @@ var _Fuel = class extends FuelConnector {
10902
11746
  const currentNetwork = await this.currentNetwork();
10903
11747
  provider = await Provider.create(currentNetwork.url);
10904
11748
  } else {
10905
- throw new import_errors30.FuelError(import_errors30.ErrorCode.INVALID_PROVIDER, "Provider is not valid.");
11749
+ throw new import_errors31.FuelError(import_errors31.ErrorCode.INVALID_PROVIDER, "Provider is not valid.");
10906
11750
  }
10907
11751
  return provider;
10908
11752
  }
@@ -10979,6 +11823,8 @@ __publicField(Fuel, "defaultConfig", {});
10979
11823
  TransactionStatus,
10980
11824
  TransactionType,
10981
11825
  TransactionTypeName,
11826
+ UpgradeTransactionRequest,
11827
+ UploadTransactionRequest,
10982
11828
  Vault,
10983
11829
  Wallet,
10984
11830
  WalletLocked,
@@ -11000,6 +11846,9 @@ __publicField(Fuel, "defaultConfig", {});
11000
11846
  calculateMetadataGasForTxBlob,
11001
11847
  calculateMetadataGasForTxCreate,
11002
11848
  calculateMetadataGasForTxScript,
11849
+ calculateMetadataGasForTxUpgrade,
11850
+ calculateMetadataGasForTxUpload,
11851
+ calculateMinGasForTxUpload,
11003
11852
  calculateTXFeeForSummary,
11004
11853
  coinQuantityfy,
11005
11854
  deferPromise,
@@ -11070,6 +11919,8 @@ __publicField(Fuel, "defaultConfig", {});
11070
11919
  isTransactionTypeBlob,
11071
11920
  isTransactionTypeCreate,
11072
11921
  isTransactionTypeScript,
11922
+ isTransactionTypeUpgrade,
11923
+ isTransactionTypeUpload,
11073
11924
  isType,
11074
11925
  isTypeBlob,
11075
11926
  isTypeCreate,