@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
@@ -374,8 +374,8 @@ var launchNode = async ({
374
374
  );
375
375
 
376
376
  // src/test-utils/setup-test-provider-and-wallets.ts
377
- var import_utils41 = require("@fuel-ts/utils");
378
- var import_ramda8 = require("ramda");
377
+ var import_utils45 = require("@fuel-ts/utils");
378
+ var import_ramda10 = require("ramda");
379
379
 
380
380
  // src/providers/coin-quantity.ts
381
381
  var import_math2 = require("@fuel-ts/math");
@@ -414,15 +414,15 @@ var addAmountToCoinQuantities = (params) => {
414
414
 
415
415
  // src/providers/provider.ts
416
416
  var import_address4 = require("@fuel-ts/address");
417
- var import_errors17 = require("@fuel-ts/errors");
417
+ var import_errors18 = require("@fuel-ts/errors");
418
418
  var import_math19 = require("@fuel-ts/math");
419
- var import_transactions20 = require("@fuel-ts/transactions");
420
- var import_utils26 = require("@fuel-ts/utils");
419
+ var import_transactions22 = require("@fuel-ts/transactions");
420
+ var import_utils30 = require("@fuel-ts/utils");
421
421
  var import_versions = require("@fuel-ts/versions");
422
- var import_utils27 = require("@noble/curves/abstract/utils");
422
+ var import_utils31 = require("@noble/curves/abstract/utils");
423
423
  var import_graphql_request = require("graphql-request");
424
424
  var import_graphql_tag2 = __toESM(require("graphql-tag"));
425
- var import_ramda6 = require("ramda");
425
+ var import_ramda8 = require("ramda");
426
426
 
427
427
  // src/providers/__generated__/operations.ts
428
428
  var import_graphql_tag = __toESM(require("graphql-tag"));
@@ -1828,6 +1828,7 @@ function assembleReceiptByType(receipt) {
1828
1828
  len: (0, import_math5.bn)(receipt.len),
1829
1829
  digest: hexOrZero(receipt.digest),
1830
1830
  pc: (0, import_math5.bn)(receipt.pc),
1831
+ data: hexOrZero(receipt.data),
1831
1832
  is: (0, import_math5.bn)(receipt.is)
1832
1833
  };
1833
1834
  return returnDataReceipt;
@@ -1876,6 +1877,7 @@ function assembleReceiptByType(receipt) {
1876
1877
  len: (0, import_math5.bn)(receipt.len),
1877
1878
  digest: hexOrZero(receipt.digest),
1878
1879
  pc: (0, import_math5.bn)(receipt.pc),
1880
+ data: hexOrZero(receipt.data),
1879
1881
  is: (0, import_math5.bn)(receipt.is)
1880
1882
  };
1881
1883
  return logDataReceipt;
@@ -1919,6 +1921,7 @@ function assembleReceiptByType(receipt) {
1919
1921
  const amount = (0, import_math5.bn)(receipt.amount);
1920
1922
  const data = receipt.data ? (0, import_utils7.arrayify)(receipt.data) : Uint8Array.from([]);
1921
1923
  const digest = hexOrZero(receipt.digest);
1924
+ const len = (0, import_math5.bn)(receipt.len).toNumber();
1922
1925
  const messageId = import_transactions3.InputMessageCoder.getMessageId({
1923
1926
  sender,
1924
1927
  recipient,
@@ -1932,6 +1935,7 @@ function assembleReceiptByType(receipt) {
1932
1935
  recipient,
1933
1936
  amount,
1934
1937
  nonce,
1938
+ len,
1935
1939
  data,
1936
1940
  digest,
1937
1941
  messageId
@@ -2076,6 +2080,39 @@ function calculateMetadataGasForTxBlob({
2076
2080
  const blobLen = resolveGasDependentCosts(witnessBytesSize, gasCosts.s256);
2077
2081
  return txId.add(blobLen);
2078
2082
  }
2083
+ function calculateMetadataGasForTxUpgrade({
2084
+ gasCosts,
2085
+ txBytesSize,
2086
+ consensusSize
2087
+ }) {
2088
+ const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
2089
+ if (consensusSize) {
2090
+ const consensusLen = resolveGasDependentCosts(consensusSize, gasCosts.s256);
2091
+ txId.add(consensusLen);
2092
+ }
2093
+ return txId;
2094
+ }
2095
+ function calculateMetadataGasForTxUpload({
2096
+ gasCosts,
2097
+ txBytesSize,
2098
+ subsectionSize,
2099
+ subsectionsSize
2100
+ }) {
2101
+ const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
2102
+ const subsectionLen = resolveGasDependentCosts(subsectionSize, gasCosts.s256);
2103
+ txId.add(subsectionLen);
2104
+ const subsectionsLen = resolveGasDependentCosts(subsectionsSize, gasCosts.stateRoot);
2105
+ txId.add(subsectionsLen);
2106
+ return txId;
2107
+ }
2108
+ function calculateMinGasForTxUpload({
2109
+ gasCosts,
2110
+ baseMinGas,
2111
+ subsectionSize
2112
+ }) {
2113
+ const additionalStoragePerByte = (0, import_math6.bn)(gasCosts.newStoragePerByte).mul(subsectionSize);
2114
+ return (0, import_math6.bn)(baseMinGas).add(additionalStoragePerByte);
2115
+ }
2079
2116
  var calculateGasFee = (params) => {
2080
2117
  const { gas, gasPrice, priceFactor, tip } = params;
2081
2118
  return gas.mul(gasPrice).div(priceFactor).add((0, import_math6.bn)(tip));
@@ -3218,50 +3255,313 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
3218
3255
  }
3219
3256
  };
3220
3257
 
3221
- // src/providers/transaction-request/utils.ts
3258
+ // src/providers/transaction-request/upgrade-transaction-request.ts
3222
3259
  var import_errors11 = require("@fuel-ts/errors");
3260
+ var import_hasher3 = require("@fuel-ts/hasher");
3223
3261
  var import_transactions11 = require("@fuel-ts/transactions");
3262
+ var import_utils19 = require("@fuel-ts/utils");
3263
+ var import_ramda6 = require("ramda");
3264
+ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3265
+ static from(obj) {
3266
+ if (obj instanceof UpgradeTransactionRequest) {
3267
+ return obj;
3268
+ }
3269
+ return new this((0, import_ramda6.clone)(obj));
3270
+ }
3271
+ /** The type of transaction */
3272
+ type = import_transactions11.TransactionType.Upgrade;
3273
+ /** The upgrade purpose */
3274
+ upgradePurpose;
3275
+ /** Witness index of consensus */
3276
+ bytecodeWitnessIndex;
3277
+ /**
3278
+ * Creates an instance `UpgradeTransactionRequest`.
3279
+ *
3280
+ * @param upgradeTransactionRequestLike - The initial values for the instance
3281
+ */
3282
+ constructor({
3283
+ upgradePurpose,
3284
+ bytecodeWitnessIndex,
3285
+ ...rest
3286
+ } = {}) {
3287
+ super(rest);
3288
+ this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
3289
+ this.upgradePurpose = upgradePurpose ?? {
3290
+ type: import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters,
3291
+ checksum: "0x"
3292
+ };
3293
+ }
3294
+ /**
3295
+ * Adds a consensus parameters upgrade purpose.
3296
+ *
3297
+ * @param consensus - The consensus bytecode.
3298
+ *
3299
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3300
+ */
3301
+ addConsensusParametersUpgradePurpose(consensus) {
3302
+ this.bytecodeWitnessIndex = this.addWitness(consensus);
3303
+ this.upgradePurpose = {
3304
+ type: import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters,
3305
+ checksum: (0, import_hasher3.hash)(consensus)
3306
+ };
3307
+ return this;
3308
+ }
3309
+ /**
3310
+ * Adds a state transition upgrade purpose.
3311
+ *
3312
+ * @param bytecodeRoot - The Merkle root of the state transition.
3313
+ *
3314
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3315
+ */
3316
+ addStateTransitionUpgradePurpose(bytecodeRoot) {
3317
+ this.upgradePurpose = {
3318
+ type: import_transactions11.UpgradePurposeTypeEnum.StateTransition,
3319
+ data: (0, import_utils19.hexlify)(bytecodeRoot)
3320
+ };
3321
+ return this;
3322
+ }
3323
+ /**
3324
+ * Adds an upgrade purpose.
3325
+ *
3326
+ * @param type - The upgrade purpose type.
3327
+ * @param data - The bytecode or merkle root of upgrade purpose
3328
+ *
3329
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3330
+ */
3331
+ addUpgradePurpose(type, data) {
3332
+ if (type === import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters) {
3333
+ this.addConsensusParametersUpgradePurpose(data);
3334
+ }
3335
+ if (type === import_transactions11.UpgradePurposeTypeEnum.StateTransition) {
3336
+ this.addStateTransitionUpgradePurpose(data);
3337
+ }
3338
+ return this;
3339
+ }
3340
+ /**
3341
+ * Converts the transaction request to a `TransactionUpgrade`.
3342
+ *
3343
+ * @returns The transaction create object.
3344
+ */
3345
+ toTransaction() {
3346
+ let upgradePurpose;
3347
+ if (this.upgradePurpose.type === import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters) {
3348
+ upgradePurpose = {
3349
+ type: import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters,
3350
+ data: {
3351
+ witnessIndex: this.bytecodeWitnessIndex,
3352
+ checksum: this.upgradePurpose.checksum
3353
+ }
3354
+ };
3355
+ } else if (this.upgradePurpose.type === import_transactions11.UpgradePurposeTypeEnum.StateTransition) {
3356
+ upgradePurpose = {
3357
+ type: import_transactions11.UpgradePurposeTypeEnum.StateTransition,
3358
+ data: {
3359
+ bytecodeRoot: (0, import_utils19.hexlify)(this.upgradePurpose.data)
3360
+ }
3361
+ };
3362
+ } else {
3363
+ throw new import_errors11.FuelError(import_errors11.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3364
+ }
3365
+ return {
3366
+ type: import_transactions11.TransactionType.Upgrade,
3367
+ ...super.getBaseTransaction(),
3368
+ upgradePurpose
3369
+ };
3370
+ }
3371
+ /**
3372
+ * Gets the Transaction ID by hashing the transaction
3373
+ *
3374
+ * @param chainId - The chain ID.
3375
+ *
3376
+ * @returns - A hash of the transaction, which is the transaction ID.
3377
+ */
3378
+ getTransactionId(chainId) {
3379
+ return hashTransaction(this, chainId);
3380
+ }
3381
+ /**
3382
+ * Calculates the metadata gas cost for an upgrade transaction.
3383
+ *
3384
+ * @param gasCosts - gas costs passed from the chain.
3385
+ *
3386
+ * @returns metadata gas cost for the upgrade transaction.
3387
+ */
3388
+ metadataGas(gasCosts) {
3389
+ const txBytesSize = this.byteSize();
3390
+ if (this.upgradePurpose.type === import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters) {
3391
+ const witnessIndex = this.bytecodeWitnessIndex;
3392
+ const consensusSize = this.witnesses[witnessIndex].length;
3393
+ return calculateMetadataGasForTxUpgrade({
3394
+ gasCosts,
3395
+ txBytesSize,
3396
+ consensusSize
3397
+ });
3398
+ }
3399
+ if (this.upgradePurpose.type === import_transactions11.UpgradePurposeTypeEnum.StateTransition) {
3400
+ return calculateMetadataGasForTxUpgrade({
3401
+ gasCosts,
3402
+ txBytesSize
3403
+ });
3404
+ }
3405
+ throw new import_errors11.FuelError(import_errors11.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3406
+ }
3407
+ };
3408
+
3409
+ // src/providers/transaction-request/upload-transaction-request.ts
3410
+ var import_configs10 = require("@fuel-ts/address/configs");
3411
+ var import_transactions12 = require("@fuel-ts/transactions");
3412
+ var import_utils21 = require("@fuel-ts/utils");
3413
+ var import_ramda7 = require("ramda");
3414
+ var UploadTransactionRequest = class extends BaseTransactionRequest {
3415
+ static from(obj) {
3416
+ if (obj instanceof UploadTransactionRequest) {
3417
+ return obj;
3418
+ }
3419
+ return new this((0, import_ramda7.clone)(obj));
3420
+ }
3421
+ /** Type of the transaction */
3422
+ type = import_transactions12.TransactionType.Upload;
3423
+ /** The witness index of the subsection of the bytecode. */
3424
+ witnessIndex;
3425
+ /** The subsection data. */
3426
+ subsection;
3427
+ /**
3428
+ * Creates an instance `UploadTransactionRequest`.
3429
+ *
3430
+ * @param uploadTransactionRequestLike - The initial values for the instance
3431
+ */
3432
+ constructor({ witnessIndex, subsection, ...rest } = {}) {
3433
+ super(rest);
3434
+ this.witnessIndex = witnessIndex ?? 0;
3435
+ this.subsection = subsection ?? {
3436
+ proofSet: [],
3437
+ root: import_configs10.ZeroBytes32,
3438
+ subsectionIndex: 0,
3439
+ subsectionsNumber: 0
3440
+ };
3441
+ }
3442
+ /**
3443
+ * Adds the subsection.
3444
+ *
3445
+ * @param subsection - The subsection data.
3446
+ */
3447
+ addSubsection(subsection) {
3448
+ const { subsection: subsectionBytecode, ...rest } = subsection;
3449
+ this.subsection = rest;
3450
+ this.witnessIndex = this.addWitness(subsectionBytecode);
3451
+ }
3452
+ /**
3453
+ * Gets the Transaction Request by hashing the transaction.
3454
+ *
3455
+ * @param chainId - The chain ID.
3456
+ *
3457
+ * @returns - A hash of the transaction, which is the transaction ID.
3458
+ */
3459
+ getTransactionId(chainId) {
3460
+ return hashTransaction(this, chainId);
3461
+ }
3462
+ /**
3463
+ * Converts the transaction request to a `TransactionUpload`.
3464
+ *
3465
+ * @returns The transaction create object.
3466
+ */
3467
+ toTransaction() {
3468
+ const baseTransaction = this.getBaseTransaction();
3469
+ const { subsectionIndex, subsectionsNumber, root, proofSet } = this.subsection;
3470
+ return {
3471
+ type: import_transactions12.TransactionType.Upload,
3472
+ ...baseTransaction,
3473
+ subsectionIndex,
3474
+ subsectionsNumber,
3475
+ root: (0, import_utils21.hexlify)(root),
3476
+ proofSet: proofSet.map(import_utils21.hexlify),
3477
+ witnessIndex: this.witnessIndex,
3478
+ proofSetCount: proofSet.length
3479
+ };
3480
+ }
3481
+ /**
3482
+ * Calculates the metadata gas cost for an upload transaction.
3483
+ *
3484
+ * @param gasCosts - gas costs passed from the chain.
3485
+ *
3486
+ * @returns metadata gas cost for the upload transaction.
3487
+ */
3488
+ metadataGas(gasCosts) {
3489
+ return calculateMetadataGasForTxUpload({
3490
+ gasCosts,
3491
+ txBytesSize: this.byteSize(),
3492
+ subsectionSize: (0, import_utils21.arrayify)(this.witnesses[this.witnessIndex]).length,
3493
+ subsectionsSize: this.subsection.subsectionsNumber
3494
+ });
3495
+ }
3496
+ /**
3497
+ * Calculates the minimum gas for an upload transaction.
3498
+ *
3499
+ * @param chainInfo - The chain information.
3500
+ *
3501
+ * @returns the minimum gas for the upload transaction
3502
+ */
3503
+ calculateMinGas(chainInfo) {
3504
+ const minGas = super.calculateMinGas(chainInfo);
3505
+ const { gasCosts } = chainInfo.consensusParameters;
3506
+ const bytecode = this.witnesses[this.witnessIndex] ?? import_configs10.ZeroBytes32;
3507
+ return calculateMinGasForTxUpload({
3508
+ gasCosts,
3509
+ baseMinGas: minGas.toNumber(),
3510
+ subsectionSize: (0, import_utils21.arrayify)(bytecode).length
3511
+ });
3512
+ }
3513
+ };
3514
+
3515
+ // src/providers/transaction-request/utils.ts
3516
+ var import_errors12 = require("@fuel-ts/errors");
3517
+ var import_transactions13 = require("@fuel-ts/transactions");
3224
3518
  var transactionRequestify = (obj) => {
3225
- if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest) {
3519
+ if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
3226
3520
  return obj;
3227
3521
  }
3228
3522
  const { type } = obj;
3229
3523
  switch (obj.type) {
3230
- case import_transactions11.TransactionType.Script: {
3524
+ case import_transactions13.TransactionType.Script: {
3231
3525
  return ScriptTransactionRequest.from(obj);
3232
3526
  }
3233
- case import_transactions11.TransactionType.Create: {
3527
+ case import_transactions13.TransactionType.Create: {
3234
3528
  return CreateTransactionRequest.from(obj);
3235
3529
  }
3236
- case import_transactions11.TransactionType.Blob: {
3530
+ case import_transactions13.TransactionType.Blob: {
3237
3531
  return BlobTransactionRequest.from(obj);
3238
3532
  }
3533
+ case import_transactions13.TransactionType.Upgrade: {
3534
+ return UpgradeTransactionRequest.from(obj);
3535
+ }
3536
+ case import_transactions13.TransactionType.Upload: {
3537
+ return UploadTransactionRequest.from(obj);
3538
+ }
3239
3539
  default: {
3240
- throw new import_errors11.FuelError(
3241
- import_errors11.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3540
+ throw new import_errors12.FuelError(
3541
+ import_errors12.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3242
3542
  `Unsupported transaction type: ${type}.`
3243
3543
  );
3244
3544
  }
3245
3545
  }
3246
3546
  };
3247
- var isTransactionTypeScript = (request) => request.type === import_transactions11.TransactionType.Script;
3248
- var isTransactionTypeCreate = (request) => request.type === import_transactions11.TransactionType.Create;
3547
+ var isTransactionTypeScript = (request) => request.type === import_transactions13.TransactionType.Script;
3548
+ var isTransactionTypeCreate = (request) => request.type === import_transactions13.TransactionType.Create;
3249
3549
 
3250
3550
  // src/providers/transaction-response/transaction-response.ts
3251
- var import_errors15 = require("@fuel-ts/errors");
3551
+ var import_errors16 = require("@fuel-ts/errors");
3252
3552
  var import_math18 = require("@fuel-ts/math");
3253
- var import_transactions19 = require("@fuel-ts/transactions");
3254
- var import_utils23 = require("@fuel-ts/utils");
3553
+ var import_transactions21 = require("@fuel-ts/transactions");
3554
+ var import_utils27 = require("@fuel-ts/utils");
3255
3555
 
3256
3556
  // src/providers/transaction-summary/assemble-transaction-summary.ts
3257
3557
  var import_math17 = require("@fuel-ts/math");
3258
- var import_transactions17 = require("@fuel-ts/transactions");
3259
- var import_utils21 = require("@fuel-ts/utils");
3558
+ var import_transactions19 = require("@fuel-ts/transactions");
3559
+ var import_utils25 = require("@fuel-ts/utils");
3260
3560
 
3261
3561
  // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
3262
3562
  var import_math13 = require("@fuel-ts/math");
3263
- var import_transactions12 = require("@fuel-ts/transactions");
3264
- var import_utils19 = require("@fuel-ts/utils");
3563
+ var import_transactions14 = require("@fuel-ts/transactions");
3564
+ var import_utils23 = require("@fuel-ts/utils");
3265
3565
  var calculateTXFeeForSummary = (params) => {
3266
3566
  const {
3267
3567
  gasPrice,
@@ -3275,17 +3575,17 @@ var calculateTXFeeForSummary = (params) => {
3275
3575
  }
3276
3576
  const gasPerByte = (0, import_math13.bn)(feeParams.gasPerByte);
3277
3577
  const gasPriceFactor = (0, import_math13.bn)(feeParams.gasPriceFactor);
3278
- const transactionBytes = (0, import_utils19.arrayify)(rawPayload);
3279
- const [transaction] = new import_transactions12.TransactionCoder().decode(transactionBytes, 0);
3578
+ const transactionBytes = (0, import_utils23.arrayify)(rawPayload);
3579
+ const [transaction] = new import_transactions14.TransactionCoder().decode(transactionBytes, 0);
3280
3580
  const { type, witnesses, inputs, policies } = transaction;
3281
3581
  let metadataGas = (0, import_math13.bn)(0);
3282
3582
  let gasLimit = (0, import_math13.bn)(0);
3283
- if (type !== import_transactions12.TransactionType.Create && type !== import_transactions12.TransactionType.Script) {
3583
+ if (type !== import_transactions14.TransactionType.Create && type !== import_transactions14.TransactionType.Script) {
3284
3584
  return (0, import_math13.bn)(0);
3285
3585
  }
3286
- if (type === import_transactions12.TransactionType.Create) {
3586
+ if (type === import_transactions14.TransactionType.Create) {
3287
3587
  const { bytecodeWitnessIndex, storageSlots } = transaction;
3288
- const contractBytesSize = (0, import_math13.bn)((0, import_utils19.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
3588
+ const contractBytesSize = (0, import_math13.bn)((0, import_utils23.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
3289
3589
  metadataGas = calculateMetadataGasForTxCreate({
3290
3590
  contractBytesSize,
3291
3591
  gasCosts,
@@ -3309,7 +3609,7 @@ var calculateTXFeeForSummary = (params) => {
3309
3609
  metadataGas,
3310
3610
  txBytesSize: transactionBytes.length
3311
3611
  });
3312
- const witnessLimit = policies.find((policy) => policy.type === import_transactions12.PolicyType.WitnessLimit)?.data;
3612
+ const witnessLimit = policies.find((policy) => policy.type === import_transactions14.PolicyType.WitnessLimit)?.data;
3313
3613
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
3314
3614
  const maxGas = getMaxGas({
3315
3615
  gasPerByte,
@@ -3329,10 +3629,10 @@ var calculateTXFeeForSummary = (params) => {
3329
3629
  };
3330
3630
 
3331
3631
  // src/providers/transaction-summary/operations.ts
3332
- var import_configs10 = require("@fuel-ts/address/configs");
3333
- var import_errors13 = require("@fuel-ts/errors");
3632
+ var import_configs11 = require("@fuel-ts/address/configs");
3633
+ var import_errors14 = require("@fuel-ts/errors");
3334
3634
  var import_math15 = require("@fuel-ts/math");
3335
- var import_transactions15 = require("@fuel-ts/transactions");
3635
+ var import_transactions17 = require("@fuel-ts/transactions");
3336
3636
 
3337
3637
  // src/providers/transaction-summary/call.ts
3338
3638
  var import_abi_coder5 = require("@fuel-ts/abi-coder");
@@ -3368,9 +3668,9 @@ var getFunctionCall = ({ abi, receipt }) => {
3368
3668
  };
3369
3669
 
3370
3670
  // src/providers/transaction-summary/input.ts
3371
- var import_errors12 = require("@fuel-ts/errors");
3671
+ var import_errors13 = require("@fuel-ts/errors");
3372
3672
  var import_math14 = require("@fuel-ts/math");
3373
- var import_transactions13 = require("@fuel-ts/transactions");
3673
+ var import_transactions15 = require("@fuel-ts/transactions");
3374
3674
  function getInputsByTypes(inputs, types) {
3375
3675
  return inputs.filter((i) => types.includes(i.type));
3376
3676
  }
@@ -3378,19 +3678,19 @@ function getInputsByType(inputs, type) {
3378
3678
  return inputs.filter((i) => i.type === type);
3379
3679
  }
3380
3680
  function getInputsCoin(inputs) {
3381
- return getInputsByType(inputs, import_transactions13.InputType.Coin);
3681
+ return getInputsByType(inputs, import_transactions15.InputType.Coin);
3382
3682
  }
3383
3683
  function getInputsMessage(inputs) {
3384
- return getInputsByType(inputs, import_transactions13.InputType.Message);
3684
+ return getInputsByType(inputs, import_transactions15.InputType.Message);
3385
3685
  }
3386
3686
  function getInputsCoinAndMessage(inputs) {
3387
- return getInputsByTypes(inputs, [import_transactions13.InputType.Coin, import_transactions13.InputType.Message]);
3687
+ return getInputsByTypes(inputs, [import_transactions15.InputType.Coin, import_transactions15.InputType.Message]);
3388
3688
  }
3389
3689
  function isInputCoin(input) {
3390
- return input.type === import_transactions13.InputType.Coin;
3690
+ return input.type === import_transactions15.InputType.Coin;
3391
3691
  }
3392
3692
  function getInputsContract(inputs) {
3393
- return getInputsByType(inputs, import_transactions13.InputType.Contract);
3693
+ return getInputsByType(inputs, import_transactions15.InputType.Contract);
3394
3694
  }
3395
3695
  function findCoinInput(inputs, assetId) {
3396
3696
  const coinInputs = getInputsCoin(inputs);
@@ -3436,40 +3736,40 @@ function getInputContractFromIndex(inputs, inputIndex) {
3436
3736
  if (!contractInput) {
3437
3737
  return void 0;
3438
3738
  }
3439
- if (contractInput.type !== import_transactions13.InputType.Contract) {
3440
- throw new import_errors12.FuelError(
3441
- import_errors12.ErrorCode.INVALID_TRANSACTION_INPUT,
3739
+ if (contractInput.type !== import_transactions15.InputType.Contract) {
3740
+ throw new import_errors13.FuelError(
3741
+ import_errors13.ErrorCode.INVALID_TRANSACTION_INPUT,
3442
3742
  `Contract input should be of type 'contract'.`
3443
3743
  );
3444
3744
  }
3445
3745
  return contractInput;
3446
3746
  }
3447
3747
  function getInputAccountAddress(input) {
3448
- if (input.type === import_transactions13.InputType.Coin) {
3748
+ if (input.type === import_transactions15.InputType.Coin) {
3449
3749
  return input.owner.toString();
3450
3750
  }
3451
- if (input.type === import_transactions13.InputType.Message) {
3751
+ if (input.type === import_transactions15.InputType.Message) {
3452
3752
  return input.recipient.toString();
3453
3753
  }
3454
3754
  return "";
3455
3755
  }
3456
3756
 
3457
3757
  // src/providers/transaction-summary/output.ts
3458
- var import_transactions14 = require("@fuel-ts/transactions");
3758
+ var import_transactions16 = require("@fuel-ts/transactions");
3459
3759
  function getOutputsByType(outputs, type) {
3460
3760
  return outputs.filter((o) => o.type === type);
3461
3761
  }
3462
3762
  function getOutputsContractCreated(outputs) {
3463
- return getOutputsByType(outputs, import_transactions14.OutputType.ContractCreated);
3763
+ return getOutputsByType(outputs, import_transactions16.OutputType.ContractCreated);
3464
3764
  }
3465
3765
  function getOutputsCoin(outputs) {
3466
- return getOutputsByType(outputs, import_transactions14.OutputType.Coin);
3766
+ return getOutputsByType(outputs, import_transactions16.OutputType.Coin);
3467
3767
  }
3468
3768
  function getOutputsChange(outputs) {
3469
- return getOutputsByType(outputs, import_transactions14.OutputType.Change);
3769
+ return getOutputsByType(outputs, import_transactions16.OutputType.Change);
3470
3770
  }
3471
3771
  function getOutputsContract(outputs) {
3472
- return getOutputsByType(outputs, import_transactions14.OutputType.Contract);
3772
+ return getOutputsByType(outputs, import_transactions16.OutputType.Contract);
3473
3773
  }
3474
3774
 
3475
3775
  // src/providers/transaction-summary/operations.ts
@@ -3478,17 +3778,21 @@ function getReceiptsByType(receipts, type) {
3478
3778
  }
3479
3779
  function getTransactionTypeName(transactionType) {
3480
3780
  switch (transactionType) {
3481
- case import_transactions15.TransactionType.Mint:
3781
+ case import_transactions17.TransactionType.Mint:
3482
3782
  return "Mint" /* Mint */;
3483
- case import_transactions15.TransactionType.Create:
3783
+ case import_transactions17.TransactionType.Create:
3484
3784
  return "Create" /* Create */;
3485
- case import_transactions15.TransactionType.Script:
3785
+ case import_transactions17.TransactionType.Script:
3486
3786
  return "Script" /* Script */;
3487
- case import_transactions15.TransactionType.Blob:
3787
+ case import_transactions17.TransactionType.Blob:
3488
3788
  return "Blob" /* Blob */;
3789
+ case import_transactions17.TransactionType.Upgrade:
3790
+ return "Upgrade" /* Upgrade */;
3791
+ case import_transactions17.TransactionType.Upload:
3792
+ return "Upload" /* Upload */;
3489
3793
  default:
3490
- throw new import_errors13.FuelError(
3491
- import_errors13.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3794
+ throw new import_errors14.FuelError(
3795
+ import_errors14.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3492
3796
  `Unsupported transaction type: ${transactionType}.`
3493
3797
  );
3494
3798
  }
@@ -3516,10 +3820,10 @@ function isTypeBlob(transactionType) {
3516
3820
  return isType(transactionType, "Blob" /* Blob */);
3517
3821
  }
3518
3822
  function getReceiptsCall(receipts) {
3519
- return getReceiptsByType(receipts, import_transactions15.ReceiptType.Call);
3823
+ return getReceiptsByType(receipts, import_transactions17.ReceiptType.Call);
3520
3824
  }
3521
3825
  function getReceiptsMessageOut(receipts) {
3522
- return getReceiptsByType(receipts, import_transactions15.ReceiptType.MessageOut);
3826
+ return getReceiptsByType(receipts, import_transactions17.ReceiptType.MessageOut);
3523
3827
  }
3524
3828
  function mergeAssets(op1, op2) {
3525
3829
  const assets1 = op1.assetsSent || [];
@@ -3627,7 +3931,7 @@ function getAssetsSent(receipt) {
3627
3931
  ];
3628
3932
  }
3629
3933
  function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload, maxInputs, baseAssetId) {
3630
- const assetId = receipt.assetId === import_configs10.ZeroBytes32 ? baseAssetId : receipt.assetId;
3934
+ const assetId = receipt.assetId === import_configs11.ZeroBytes32 ? baseAssetId : receipt.assetId;
3631
3935
  const input = getInputFromAssetId(inputs, assetId, assetId === baseAssetId);
3632
3936
  if (!input) {
3633
3937
  return [];
@@ -3683,7 +3987,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
3683
3987
  const { to: toAddress, assetId, amount } = receipt;
3684
3988
  let { from: fromAddress } = receipt;
3685
3989
  const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
3686
- if (import_configs10.ZeroBytes32 === fromAddress) {
3990
+ if (import_configs11.ZeroBytes32 === fromAddress) {
3687
3991
  const change = changeOutputs.find((output) => output.assetId === assetId);
3688
3992
  fromAddress = change?.to || fromAddress;
3689
3993
  }
@@ -3748,11 +4052,11 @@ function getTransferOperations({
3748
4052
  });
3749
4053
  const transferReceipts = getReceiptsByType(
3750
4054
  receipts,
3751
- import_transactions15.ReceiptType.Transfer
4055
+ import_transactions17.ReceiptType.Transfer
3752
4056
  );
3753
4057
  const transferOutReceipts = getReceiptsByType(
3754
4058
  receipts,
3755
- import_transactions15.ReceiptType.TransferOut
4059
+ import_transactions17.ReceiptType.TransferOut
3756
4060
  );
3757
4061
  [...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
3758
4062
  const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
@@ -3836,30 +4140,12 @@ function getOperations({
3836
4140
  }
3837
4141
 
3838
4142
  // src/providers/transaction-summary/receipt.ts
3839
- var import_transactions16 = require("@fuel-ts/transactions");
3840
- var processGqlReceipt = (gqlReceipt) => {
3841
- const receipt = assembleReceiptByType(gqlReceipt);
3842
- switch (receipt.type) {
3843
- case import_transactions16.ReceiptType.ReturnData: {
3844
- return {
3845
- ...receipt,
3846
- data: gqlReceipt.data || "0x"
3847
- };
3848
- }
3849
- case import_transactions16.ReceiptType.LogData: {
3850
- return {
3851
- ...receipt,
3852
- data: gqlReceipt.data || "0x"
3853
- };
3854
- }
3855
- default:
3856
- return receipt;
3857
- }
3858
- };
4143
+ var import_transactions18 = require("@fuel-ts/transactions");
4144
+ var processGqlReceipt = (gqlReceipt) => assembleReceiptByType(gqlReceipt);
3859
4145
  var extractMintedAssetsFromReceipts = (receipts) => {
3860
4146
  const mintedAssets = [];
3861
4147
  receipts.forEach((receipt) => {
3862
- if (receipt.type === import_transactions16.ReceiptType.Mint) {
4148
+ if (receipt.type === import_transactions18.ReceiptType.Mint) {
3863
4149
  mintedAssets.push({
3864
4150
  subId: receipt.subId,
3865
4151
  contractId: receipt.contractId,
@@ -3873,7 +4159,7 @@ var extractMintedAssetsFromReceipts = (receipts) => {
3873
4159
  var extractBurnedAssetsFromReceipts = (receipts) => {
3874
4160
  const burnedAssets = [];
3875
4161
  receipts.forEach((receipt) => {
3876
- if (receipt.type === import_transactions16.ReceiptType.Burn) {
4162
+ if (receipt.type === import_transactions18.ReceiptType.Burn) {
3877
4163
  burnedAssets.push({
3878
4164
  subId: receipt.subId,
3879
4165
  contractId: receipt.contractId,
@@ -3886,7 +4172,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3886
4172
  };
3887
4173
 
3888
4174
  // src/providers/transaction-summary/status.ts
3889
- var import_errors14 = require("@fuel-ts/errors");
4175
+ var import_errors15 = require("@fuel-ts/errors");
3890
4176
  var import_math16 = require("@fuel-ts/math");
3891
4177
  var getTransactionStatusName = (gqlStatus) => {
3892
4178
  switch (gqlStatus) {
@@ -3899,8 +4185,8 @@ var getTransactionStatusName = (gqlStatus) => {
3899
4185
  case "SqueezedOutStatus":
3900
4186
  return "squeezedout" /* squeezedout */;
3901
4187
  default:
3902
- throw new import_errors14.FuelError(
3903
- import_errors14.ErrorCode.INVALID_TRANSACTION_STATUS,
4188
+ throw new import_errors15.FuelError(
4189
+ import_errors15.ErrorCode.INVALID_TRANSACTION_STATUS,
3904
4190
  `Invalid transaction status: ${gqlStatus}.`
3905
4191
  );
3906
4192
  }
@@ -3969,7 +4255,7 @@ function assembleTransactionSummary(params) {
3969
4255
  baseAssetId
3970
4256
  } = params;
3971
4257
  const gasUsed = getGasUsedFromReceipts(receipts);
3972
- const rawPayload = (0, import_utils21.hexlify)(transactionBytes);
4258
+ const rawPayload = (0, import_utils25.hexlify)(transactionBytes);
3973
4259
  const operations = getOperations({
3974
4260
  transactionType: transaction.type,
3975
4261
  inputs: transaction.inputs || [],
@@ -3981,7 +4267,7 @@ function assembleTransactionSummary(params) {
3981
4267
  baseAssetId
3982
4268
  });
3983
4269
  const typeName = getTransactionTypeName(transaction.type);
3984
- const tip = (0, import_math17.bn)(transaction.policies?.find((policy) => policy.type === import_transactions17.PolicyType.Tip)?.data);
4270
+ const tip = (0, import_math17.bn)(transaction.policies?.find((policy) => policy.type === import_transactions19.PolicyType.Tip)?.data);
3985
4271
  const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3986
4272
  const fee = calculateTXFeeForSummary({
3987
4273
  totalFee,
@@ -4001,7 +4287,7 @@ function assembleTransactionSummary(params) {
4001
4287
  const burnedAssets = extractBurnedAssetsFromReceipts(receipts);
4002
4288
  let date;
4003
4289
  if (time) {
4004
- date = import_utils21.DateTime.fromTai64(time);
4290
+ date = import_utils25.DateTime.fromTai64(time);
4005
4291
  }
4006
4292
  const transactionSummary = {
4007
4293
  id,
@@ -4033,12 +4319,12 @@ function assembleTransactionSummary(params) {
4033
4319
 
4034
4320
  // src/providers/transaction-response/getDecodedLogs.ts
4035
4321
  var import_abi_coder6 = require("@fuel-ts/abi-coder");
4036
- var import_transactions18 = require("@fuel-ts/transactions");
4322
+ var import_transactions20 = require("@fuel-ts/transactions");
4037
4323
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
4038
4324
  return receipts.reduce((logs, receipt) => {
4039
- if (receipt.type === import_transactions18.ReceiptType.LogData || receipt.type === import_transactions18.ReceiptType.Log) {
4325
+ if (receipt.type === import_transactions20.ReceiptType.LogData || receipt.type === import_transactions20.ReceiptType.Log) {
4040
4326
  const interfaceToUse = new import_abi_coder6.Interface(externalAbis[receipt.id] || mainAbi);
4041
- const data = receipt.type === import_transactions18.ReceiptType.Log ? new import_abi_coder6.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
4327
+ const data = receipt.type === import_transactions20.ReceiptType.Log ? new import_abi_coder6.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
4042
4328
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toString());
4043
4329
  logs.push(decodedLog);
4044
4330
  }
@@ -4052,28 +4338,28 @@ function mapGqlOutputsToTxOutputs(outputs) {
4052
4338
  const obj = "amount" in o ? { ...o, amount: (0, import_math18.bn)(o.amount) } : o;
4053
4339
  switch (obj.type) {
4054
4340
  case "CoinOutput":
4055
- return { ...obj, type: import_transactions19.OutputType.Coin };
4341
+ return { ...obj, type: import_transactions21.OutputType.Coin };
4056
4342
  case "ContractOutput":
4057
4343
  return {
4058
4344
  ...obj,
4059
- type: import_transactions19.OutputType.Contract,
4345
+ type: import_transactions21.OutputType.Contract,
4060
4346
  inputIndex: parseInt(obj.inputIndex, 10)
4061
4347
  };
4062
4348
  case "ChangeOutput":
4063
4349
  return {
4064
4350
  ...obj,
4065
- type: import_transactions19.OutputType.Change
4351
+ type: import_transactions21.OutputType.Change
4066
4352
  };
4067
4353
  case "VariableOutput":
4068
- return { ...obj, type: import_transactions19.OutputType.Variable };
4354
+ return { ...obj, type: import_transactions21.OutputType.Variable };
4069
4355
  case "ContractCreated":
4070
4356
  return {
4071
4357
  ...obj,
4072
- type: import_transactions19.OutputType.ContractCreated,
4358
+ type: import_transactions21.OutputType.ContractCreated,
4073
4359
  contractId: obj.contract
4074
4360
  };
4075
4361
  default:
4076
- return (0, import_utils23.assertUnreachable)(obj);
4362
+ return (0, import_utils27.assertUnreachable)(obj);
4077
4363
  }
4078
4364
  });
4079
4365
  }
@@ -4127,7 +4413,7 @@ var TransactionResponse = class {
4127
4413
  const correspondingInput = status.transaction.inputs?.[idx];
4128
4414
  return {
4129
4415
  ...input,
4130
- txPointer: import_transactions19.TxPointerCoder.decodeFromGqlScalar(correspondingInput.txPointer)
4416
+ txPointer: import_transactions21.TxPointerCoder.decodeFromGqlScalar(correspondingInput.txPointer)
4131
4417
  };
4132
4418
  }
4133
4419
  return input;
@@ -4150,7 +4436,7 @@ var TransactionResponse = class {
4150
4436
  const gqlTransaction = this.gqlTransaction ?? await this.fetch();
4151
4437
  return {
4152
4438
  tx: this.decodeTransaction(gqlTransaction),
4153
- bytes: (0, import_utils23.arrayify)(gqlTransaction.rawPayload)
4439
+ bytes: (0, import_utils27.arrayify)(gqlTransaction.rawPayload)
4154
4440
  };
4155
4441
  }
4156
4442
  getReceipts() {
@@ -4194,8 +4480,8 @@ var TransactionResponse = class {
4194
4480
  * @returns The decoded transaction.
4195
4481
  */
4196
4482
  decodeTransaction(transactionWithReceipts) {
4197
- return new import_transactions19.TransactionCoder().decode(
4198
- (0, import_utils23.arrayify)(transactionWithReceipts.rawPayload),
4483
+ return new import_transactions21.TransactionCoder().decode(
4484
+ (0, import_utils27.arrayify)(transactionWithReceipts.rawPayload),
4199
4485
  0
4200
4486
  )?.[0];
4201
4487
  }
@@ -4242,8 +4528,8 @@ var TransactionResponse = class {
4242
4528
  this.status = statusChange;
4243
4529
  if (statusChange.type === "SqueezedOutStatus") {
4244
4530
  this.unsetResourceCache();
4245
- throw new import_errors15.FuelError(
4246
- import_errors15.ErrorCode.TRANSACTION_SQUEEZED_OUT,
4531
+ throw new import_errors16.FuelError(
4532
+ import_errors16.ErrorCode.TRANSACTION_SQUEEZED_OUT,
4247
4533
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
4248
4534
  );
4249
4535
  }
@@ -4314,7 +4600,7 @@ var TransactionResponse = class {
4314
4600
  };
4315
4601
 
4316
4602
  // src/providers/utils/auto-retry-fetch.ts
4317
- var import_utils25 = require("@fuel-ts/utils");
4603
+ var import_utils29 = require("@fuel-ts/utils");
4318
4604
  function getWaitDelay(options, retryAttemptNum) {
4319
4605
  const duration = options.baseDelay ?? 150;
4320
4606
  switch (options.backoff) {
@@ -4344,25 +4630,25 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
4344
4630
  throw error;
4345
4631
  }
4346
4632
  const delay = getWaitDelay(options, retryNum);
4347
- await (0, import_utils25.sleep)(delay);
4633
+ await (0, import_utils29.sleep)(delay);
4348
4634
  return autoRetryFetch(fetchFn, options, retryNum)(...args);
4349
4635
  }
4350
4636
  };
4351
4637
  }
4352
4638
 
4353
4639
  // src/providers/utils/handle-gql-error-message.ts
4354
- var import_errors16 = require("@fuel-ts/errors");
4640
+ var import_errors17 = require("@fuel-ts/errors");
4355
4641
  var handleGqlErrorMessage = (errorMessage, rawError) => {
4356
4642
  switch (errorMessage) {
4357
4643
  case "not enough coins to fit the target" /* NOT_ENOUGH_COINS */:
4358
- throw new import_errors16.FuelError(
4359
- import_errors16.ErrorCode.NOT_ENOUGH_FUNDS,
4644
+ throw new import_errors17.FuelError(
4645
+ import_errors17.ErrorCode.NOT_ENOUGH_FUNDS,
4360
4646
  `The account(s) sending the transaction don't have enough funds to cover the transaction.`,
4361
4647
  {},
4362
4648
  rawError
4363
4649
  );
4364
4650
  default:
4365
- throw new import_errors16.FuelError(import_errors16.ErrorCode.INVALID_REQUEST, errorMessage);
4651
+ throw new import_errors17.FuelError(import_errors17.ErrorCode.INVALID_REQUEST, errorMessage);
4366
4652
  }
4367
4653
  };
4368
4654
 
@@ -4444,24 +4730,34 @@ var _Provider = class {
4444
4730
  * @hidden
4445
4731
  */
4446
4732
  constructor(url, options = {}) {
4447
- this.url = url;
4448
4733
  /**
4449
4734
  * @hidden
4450
4735
  */
4451
4736
  __privateAdd(this, _cacheInputs);
4452
4737
  __publicField(this, "operations");
4453
4738
  __publicField(this, "cache");
4739
+ /** @hidden */
4740
+ __publicField(this, "url");
4741
+ /** @hidden */
4742
+ __publicField(this, "urlWithoutAuth");
4454
4743
  __publicField(this, "options", {
4455
4744
  timeout: void 0,
4456
4745
  resourceCacheTTL: void 0,
4457
4746
  fetch: void 0,
4458
- retryOptions: void 0
4747
+ retryOptions: void 0,
4748
+ headers: void 0
4459
4749
  });
4750
+ const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
4751
+ this.url = rawUrl;
4752
+ this.urlWithoutAuth = urlWithoutAuth;
4460
4753
  this.options = { ...this.options, ...options };
4461
4754
  this.url = url;
4755
+ if (headers) {
4756
+ this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
4757
+ }
4462
4758
  this.operations = this.createOperations();
4463
4759
  const { resourceCacheTTL } = this.options;
4464
- if ((0, import_utils26.isDefined)(resourceCacheTTL)) {
4760
+ if ((0, import_utils30.isDefined)(resourceCacheTTL)) {
4465
4761
  if (resourceCacheTTL !== -1) {
4466
4762
  this.cache = new ResourceCache(resourceCacheTTL);
4467
4763
  } else {
@@ -4480,12 +4776,16 @@ var _Provider = class {
4480
4776
  * @hidden
4481
4777
  */
4482
4778
  static getFetchFn(options) {
4483
- const { retryOptions, timeout } = options;
4779
+ const { retryOptions, timeout, headers } = options;
4484
4780
  return autoRetryFetch(async (...args) => {
4485
4781
  const url = args[0];
4486
4782
  const request = args[1];
4487
4783
  const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
4488
- let fullRequest = { ...request, signal };
4784
+ let fullRequest = {
4785
+ ...request,
4786
+ signal,
4787
+ headers: { ...request?.headers, ...headers }
4788
+ };
4489
4789
  if (options.requestMiddleware) {
4490
4790
  fullRequest = await options.requestMiddleware(fullRequest);
4491
4791
  }
@@ -4493,15 +4793,23 @@ var _Provider = class {
4493
4793
  }, retryOptions);
4494
4794
  }
4495
4795
  static extractBasicAuth(url) {
4496
- const parsedUrl = new URL(url);
4796
+ let parsedUrl;
4797
+ try {
4798
+ parsedUrl = new URL(url);
4799
+ } catch (error) {
4800
+ throw new import_errors18.FuelError(import_errors18.FuelError.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
4801
+ }
4497
4802
  const username = parsedUrl.username;
4498
4803
  const password = parsedUrl.password;
4499
- const urlNoBasicAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
4804
+ const urlWithoutAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
4500
4805
  if (!(username && password)) {
4501
- return { url, auth: void 0 };
4806
+ return { url, urlWithoutAuth: url, headers: void 0 };
4502
4807
  }
4503
- const auth = `Basic ${btoa(`${username}:${password}`)}`;
4504
- return { url: urlNoBasicAuth, auth };
4808
+ return {
4809
+ url,
4810
+ urlWithoutAuth,
4811
+ headers: { Authorization: `Basic ${btoa(`${username}:${password}`)}` }
4812
+ };
4505
4813
  }
4506
4814
  /**
4507
4815
  * Creates a new instance of the Provider class. This is the recommended way to initialize a Provider.
@@ -4512,17 +4820,7 @@ var _Provider = class {
4512
4820
  * @returns A promise that resolves to a Provider instance.
4513
4821
  */
4514
4822
  static async create(url, options = {}) {
4515
- const { url: urlToUse, auth } = this.extractBasicAuth(url);
4516
- const provider = new _Provider(urlToUse, {
4517
- ...options,
4518
- requestMiddleware: async (request) => {
4519
- if (auth && request) {
4520
- request.headers ??= {};
4521
- request.headers.Authorization = auth;
4522
- }
4523
- return options.requestMiddleware?.(request) ?? request;
4524
- }
4525
- });
4823
+ const provider = new _Provider(url, options);
4526
4824
  await provider.fetchChainAndNodeInfo();
4527
4825
  return provider;
4528
4826
  }
@@ -4532,10 +4830,10 @@ var _Provider = class {
4532
4830
  * @returns the chain information configuration.
4533
4831
  */
4534
4832
  getChain() {
4535
- const chain = _Provider.chainInfoCache[this.url];
4833
+ const chain = _Provider.chainInfoCache[this.urlWithoutAuth];
4536
4834
  if (!chain) {
4537
- throw new import_errors17.FuelError(
4538
- import_errors17.ErrorCode.CHAIN_INFO_CACHE_EMPTY,
4835
+ throw new import_errors18.FuelError(
4836
+ import_errors18.ErrorCode.CHAIN_INFO_CACHE_EMPTY,
4539
4837
  "Chain info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
4540
4838
  );
4541
4839
  }
@@ -4547,10 +4845,10 @@ var _Provider = class {
4547
4845
  * @returns the node information configuration.
4548
4846
  */
4549
4847
  getNode() {
4550
- const node = _Provider.nodeInfoCache[this.url];
4848
+ const node = _Provider.nodeInfoCache[this.urlWithoutAuth];
4551
4849
  if (!node) {
4552
- throw new import_errors17.FuelError(
4553
- import_errors17.ErrorCode.NODE_INFO_CACHE_EMPTY,
4850
+ throw new import_errors18.FuelError(
4851
+ import_errors18.ErrorCode.NODE_INFO_CACHE_EMPTY,
4554
4852
  "Node info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
4555
4853
  );
4556
4854
  }
@@ -4581,8 +4879,11 @@ var _Provider = class {
4581
4879
  * @param options - Additional options for the provider.
4582
4880
  */
4583
4881
  async connect(url, options) {
4584
- this.url = url;
4882
+ const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
4883
+ this.url = rawUrl;
4884
+ this.urlWithoutAuth = urlWithoutAuth;
4585
4885
  this.options = options ?? this.options;
4886
+ this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
4586
4887
  this.operations = this.createOperations();
4587
4888
  await this.fetchChainAndNodeInfo();
4588
4889
  }
@@ -4622,7 +4923,7 @@ Supported fuel-core version: ${supportedVersion}.`
4622
4923
  */
4623
4924
  createOperations() {
4624
4925
  const fetchFn = _Provider.getFetchFn(this.options);
4625
- const gqlClient = new import_graphql_request.GraphQLClient(this.url, {
4926
+ const gqlClient = new import_graphql_request.GraphQLClient(this.urlWithoutAuth, {
4626
4927
  fetch: (url, requestInit) => fetchFn(url, requestInit, this.options),
4627
4928
  responseMiddleware: (response) => {
4628
4929
  if ("response" in response) {
@@ -4640,7 +4941,7 @@ Supported fuel-core version: ${supportedVersion}.`
4640
4941
  const isSubscription = opDefinition?.operation === "subscription";
4641
4942
  if (isSubscription) {
4642
4943
  return FuelGraphqlSubscriber.create({
4643
- url: this.url,
4944
+ url: this.urlWithoutAuth,
4644
4945
  query,
4645
4946
  fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
4646
4947
  variables: vars
@@ -4703,7 +5004,7 @@ Supported fuel-core version: ${supportedVersion}.`
4703
5004
  utxoValidation: nodeInfo.utxoValidation,
4704
5005
  vmBacktrace: nodeInfo.vmBacktrace
4705
5006
  };
4706
- _Provider.nodeInfoCache[this.url] = processedNodeInfo;
5007
+ _Provider.nodeInfoCache[this.urlWithoutAuth] = processedNodeInfo;
4707
5008
  return processedNodeInfo;
4708
5009
  }
4709
5010
  /**
@@ -4714,7 +5015,7 @@ Supported fuel-core version: ${supportedVersion}.`
4714
5015
  async fetchChain() {
4715
5016
  const { chain } = await this.operations.getChain();
4716
5017
  const processedChain = processGqlChain(chain);
4717
- _Provider.chainInfoCache[this.url] = processedChain;
5018
+ _Provider.chainInfoCache[this.urlWithoutAuth] = processedChain;
4718
5019
  return processedChain;
4719
5020
  }
4720
5021
  /**
@@ -4742,14 +5043,14 @@ Supported fuel-core version: ${supportedVersion}.`
4742
5043
  validateTransaction(tx, consensusParameters) {
4743
5044
  const { maxOutputs, maxInputs } = consensusParameters.txParameters;
4744
5045
  if ((0, import_math19.bn)(tx.inputs.length).gt(maxInputs)) {
4745
- throw new import_errors17.FuelError(
4746
- import_errors17.ErrorCode.MAX_INPUTS_EXCEEDED,
5046
+ throw new import_errors18.FuelError(
5047
+ import_errors18.ErrorCode.MAX_INPUTS_EXCEEDED,
4747
5048
  "The transaction exceeds the maximum allowed number of inputs."
4748
5049
  );
4749
5050
  }
4750
5051
  if ((0, import_math19.bn)(tx.outputs.length).gt(maxOutputs)) {
4751
- throw new import_errors17.FuelError(
4752
- import_errors17.ErrorCode.MAX_OUTPUTS_EXCEEDED,
5052
+ throw new import_errors18.FuelError(
5053
+ import_errors18.ErrorCode.MAX_OUTPUTS_EXCEEDED,
4753
5054
  "The transaction exceeds the maximum allowed number of outputs."
4754
5055
  );
4755
5056
  }
@@ -4771,7 +5072,7 @@ Supported fuel-core version: ${supportedVersion}.`
4771
5072
  }
4772
5073
  const { consensusParameters } = this.getChain();
4773
5074
  this.validateTransaction(transactionRequest, consensusParameters);
4774
- const encodedTransaction = (0, import_utils26.hexlify)(transactionRequest.toTransactionBytes());
5075
+ const encodedTransaction = (0, import_utils30.hexlify)(transactionRequest.toTransactionBytes());
4775
5076
  let abis;
4776
5077
  if (isTransactionTypeScript(transactionRequest)) {
4777
5078
  abis = transactionRequest.abis;
@@ -4795,7 +5096,7 @@ Supported fuel-core version: ${supportedVersion}.`
4795
5096
  if (estimateTxDependencies) {
4796
5097
  return this.estimateTxDependencies(transactionRequest);
4797
5098
  }
4798
- const encodedTransaction = (0, import_utils26.hexlify)(transactionRequest.toTransactionBytes());
5099
+ const encodedTransaction = (0, import_utils30.hexlify)(transactionRequest.toTransactionBytes());
4799
5100
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4800
5101
  encodedTransactions: encodedTransaction,
4801
5102
  utxoValidation: utxoValidation || false
@@ -4815,13 +5116,13 @@ Supported fuel-core version: ${supportedVersion}.`
4815
5116
  async estimatePredicates(transactionRequest) {
4816
5117
  const shouldEstimatePredicates = Boolean(
4817
5118
  transactionRequest.inputs.find(
4818
- (input) => "predicate" in input && input.predicate && !(0, import_utils27.equalBytes)((0, import_utils26.arrayify)(input.predicate), (0, import_utils26.arrayify)("0x")) && new import_math19.BN(input.predicateGasUsed).isZero()
5119
+ (input) => "predicate" in input && input.predicate && !(0, import_utils31.equalBytes)((0, import_utils30.arrayify)(input.predicate), (0, import_utils30.arrayify)("0x")) && new import_math19.BN(input.predicateGasUsed).isZero()
4819
5120
  )
4820
5121
  );
4821
5122
  if (!shouldEstimatePredicates) {
4822
5123
  return transactionRequest;
4823
5124
  }
4824
- const encodedTransaction = (0, import_utils26.hexlify)(transactionRequest.toTransactionBytes());
5125
+ const encodedTransaction = (0, import_utils30.hexlify)(transactionRequest.toTransactionBytes());
4825
5126
  const response = await this.operations.estimatePredicates({
4826
5127
  encodedTransaction
4827
5128
  });
@@ -4862,7 +5163,7 @@ Supported fuel-core version: ${supportedVersion}.`
4862
5163
  const {
4863
5164
  dryRun: [{ receipts: rawReceipts, status }]
4864
5165
  } = await this.operations.dryRun({
4865
- encodedTransactions: [(0, import_utils26.hexlify)(transactionRequest.toTransactionBytes())],
5166
+ encodedTransactions: [(0, import_utils30.hexlify)(transactionRequest.toTransactionBytes())],
4866
5167
  utxoValidation: false
4867
5168
  });
4868
5169
  receipts = rawReceipts.map(processGqlReceipt);
@@ -4908,11 +5209,11 @@ Supported fuel-core version: ${supportedVersion}.`
4908
5209
  missingContractIds: [],
4909
5210
  dryRunStatus: void 0
4910
5211
  }));
4911
- const allRequests = (0, import_ramda6.clone)(transactionRequests);
5212
+ const allRequests = (0, import_ramda8.clone)(transactionRequests);
4912
5213
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
4913
5214
  allRequests.forEach((req, index) => {
4914
5215
  if (isTransactionTypeScript(req)) {
4915
- serializedTransactionsMap.set(index, (0, import_utils26.hexlify)(req.toTransactionBytes()));
5216
+ serializedTransactionsMap.set(index, (0, import_utils30.hexlify)(req.toTransactionBytes()));
4916
5217
  }
4917
5218
  });
4918
5219
  let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
@@ -4948,7 +5249,7 @@ Supported fuel-core version: ${supportedVersion}.`
4948
5249
  transactionRequest: request
4949
5250
  });
4950
5251
  request.maxFee = maxFee;
4951
- serializedTransactionsMap.set(requestIdx, (0, import_utils26.hexlify)(request.toTransactionBytes()));
5252
+ serializedTransactionsMap.set(requestIdx, (0, import_utils30.hexlify)(request.toTransactionBytes()));
4952
5253
  nextRoundTransactions.push(requestIdx);
4953
5254
  }
4954
5255
  }
@@ -4969,7 +5270,7 @@ Supported fuel-core version: ${supportedVersion}.`
4969
5270
  if (estimateTxDependencies) {
4970
5271
  return this.estimateMultipleTxDependencies(transactionRequests);
4971
5272
  }
4972
- const encodedTransactions = transactionRequests.map((tx) => (0, import_utils26.hexlify)(tx.toTransactionBytes()));
5273
+ const encodedTransactions = transactionRequests.map((tx) => (0, import_utils30.hexlify)(tx.toTransactionBytes()));
4973
5274
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4974
5275
  encodedTransactions,
4975
5276
  utxoValidation: utxoValidation || false
@@ -5043,7 +5344,7 @@ Supported fuel-core version: ${supportedVersion}.`
5043
5344
  if (estimateTxDependencies) {
5044
5345
  return this.estimateTxDependencies(transactionRequest);
5045
5346
  }
5046
- const encodedTransactions = [(0, import_utils26.hexlify)(transactionRequest.toTransactionBytes())];
5347
+ const encodedTransactions = [(0, import_utils30.hexlify)(transactionRequest.toTransactionBytes())];
5047
5348
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
5048
5349
  encodedTransactions,
5049
5350
  utxoValidation: true
@@ -5068,13 +5369,13 @@ Supported fuel-core version: ${supportedVersion}.`
5068
5369
  * @returns A promise that resolves to the transaction cost object.
5069
5370
  */
5070
5371
  async getTransactionCost(transactionRequestLike, { signatureCallback } = {}) {
5071
- const txRequestClone = (0, import_ramda6.clone)(transactionRequestify(transactionRequestLike));
5372
+ const txRequestClone = (0, import_ramda8.clone)(transactionRequestify(transactionRequestLike));
5072
5373
  const updateMaxFee = txRequestClone.maxFee.eq(0);
5073
5374
  const isScriptTransaction = isTransactionTypeScript(txRequestClone);
5074
5375
  if (isScriptTransaction) {
5075
5376
  txRequestClone.gasLimit = (0, import_math19.bn)(0);
5076
5377
  }
5077
- const signedRequest = (0, import_ramda6.clone)(txRequestClone);
5378
+ const signedRequest = (0, import_ramda8.clone)(txRequestClone);
5078
5379
  let addedSignatures = 0;
5079
5380
  if (signatureCallback && isTransactionTypeScript(signedRequest)) {
5080
5381
  const lengthBefore = signedRequest.witnesses.length;
@@ -5142,7 +5443,7 @@ Supported fuel-core version: ${supportedVersion}.`
5142
5443
  paginationLimit: RESOURCES_PAGE_SIZE_LIMIT,
5143
5444
  inputArgs: paginationArgs
5144
5445
  }),
5145
- filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils26.hexlify)(assetId) }
5446
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils30.hexlify)(assetId) }
5146
5447
  });
5147
5448
  const coins = edges.map(({ node }) => ({
5148
5449
  id: node.utxoId,
@@ -5168,8 +5469,8 @@ Supported fuel-core version: ${supportedVersion}.`
5168
5469
  async getResourcesToSpend(owner, quantities, excludedIds) {
5169
5470
  const ownerAddress = import_address4.Address.fromAddressOrString(owner);
5170
5471
  const excludeInput = {
5171
- messages: excludedIds?.messages?.map((nonce) => (0, import_utils26.hexlify)(nonce)) || [],
5172
- utxos: excludedIds?.utxos?.map((id) => (0, import_utils26.hexlify)(id)) || []
5472
+ messages: excludedIds?.messages?.map((nonce) => (0, import_utils30.hexlify)(nonce)) || [],
5473
+ utxos: excludedIds?.utxos?.map((id) => (0, import_utils30.hexlify)(id)) || []
5173
5474
  };
5174
5475
  if (this.cache) {
5175
5476
  const cached = this.cache.getActiveData();
@@ -5179,7 +5480,7 @@ Supported fuel-core version: ${supportedVersion}.`
5179
5480
  const coinsQuery = {
5180
5481
  owner: ownerAddress.toB256(),
5181
5482
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
5182
- assetId: (0, import_utils26.hexlify)(assetId),
5483
+ assetId: (0, import_utils30.hexlify)(assetId),
5183
5484
  amount: amount.toString(10),
5184
5485
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
5185
5486
  })),
@@ -5334,7 +5635,7 @@ Supported fuel-core version: ${supportedVersion}.`
5334
5635
  },
5335
5636
  transactionIds: block.transactions.map((tx) => tx.id),
5336
5637
  transactions: block.transactions.map(
5337
- (tx) => new import_transactions20.TransactionCoder().decode((0, import_utils26.arrayify)(tx.rawPayload), 0)?.[0]
5638
+ (tx) => new import_transactions22.TransactionCoder().decode((0, import_utils30.arrayify)(tx.rawPayload), 0)?.[0]
5338
5639
  )
5339
5640
  };
5340
5641
  }
@@ -5350,12 +5651,12 @@ Supported fuel-core version: ${supportedVersion}.`
5350
5651
  return null;
5351
5652
  }
5352
5653
  try {
5353
- return new import_transactions20.TransactionCoder().decode(
5354
- (0, import_utils26.arrayify)(transaction.rawPayload),
5654
+ return new import_transactions22.TransactionCoder().decode(
5655
+ (0, import_utils30.arrayify)(transaction.rawPayload),
5355
5656
  0
5356
5657
  )?.[0];
5357
5658
  } catch (error) {
5358
- if (error instanceof import_errors17.FuelError && error.code === import_errors17.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5659
+ if (error instanceof import_errors18.FuelError && error.code === import_errors18.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5359
5660
  console.warn("Unsupported transaction type encountered");
5360
5661
  return null;
5361
5662
  }
@@ -5371,12 +5672,12 @@ Supported fuel-core version: ${supportedVersion}.`
5371
5672
  const {
5372
5673
  transactions: { edges, pageInfo }
5373
5674
  } = await this.operations.getTransactions(paginationArgs);
5374
- const coder = new import_transactions20.TransactionCoder();
5675
+ const coder = new import_transactions22.TransactionCoder();
5375
5676
  const transactions = edges.map(({ node: { rawPayload } }) => {
5376
5677
  try {
5377
- return coder.decode((0, import_utils26.arrayify)(rawPayload), 0)[0];
5678
+ return coder.decode((0, import_utils30.arrayify)(rawPayload), 0)[0];
5378
5679
  } catch (error) {
5379
- if (error instanceof import_errors17.FuelError && error.code === import_errors17.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5680
+ if (error instanceof import_errors18.FuelError && error.code === import_errors18.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5380
5681
  console.warn("Unsupported transaction type encountered");
5381
5682
  return null;
5382
5683
  }
@@ -5408,7 +5709,7 @@ Supported fuel-core version: ${supportedVersion}.`
5408
5709
  async getContractBalance(contractId, assetId) {
5409
5710
  const { contractBalance } = await this.operations.getContractBalance({
5410
5711
  contract: import_address4.Address.fromAddressOrString(contractId).toB256(),
5411
- asset: (0, import_utils26.hexlify)(assetId)
5712
+ asset: (0, import_utils30.hexlify)(assetId)
5412
5713
  });
5413
5714
  return (0, import_math19.bn)(contractBalance.amount, 10);
5414
5715
  }
@@ -5422,7 +5723,7 @@ Supported fuel-core version: ${supportedVersion}.`
5422
5723
  async getBalance(owner, assetId) {
5423
5724
  const { balance } = await this.operations.getBalance({
5424
5725
  owner: import_address4.Address.fromAddressOrString(owner).toB256(),
5425
- assetId: (0, import_utils26.hexlify)(assetId)
5726
+ assetId: (0, import_utils30.hexlify)(assetId)
5426
5727
  });
5427
5728
  return (0, import_math19.bn)(balance.amount, 10);
5428
5729
  }
@@ -5468,7 +5769,7 @@ Supported fuel-core version: ${supportedVersion}.`
5468
5769
  owner: import_address4.Address.fromAddressOrString(address).toB256()
5469
5770
  });
5470
5771
  const messages = edges.map(({ node }) => ({
5471
- messageId: import_transactions20.InputMessageCoder.getMessageId({
5772
+ messageId: import_transactions22.InputMessageCoder.getMessageId({
5472
5773
  sender: node.sender,
5473
5774
  recipient: node.recipient,
5474
5775
  nonce: node.nonce,
@@ -5479,7 +5780,7 @@ Supported fuel-core version: ${supportedVersion}.`
5479
5780
  recipient: import_address4.Address.fromAddressOrString(node.recipient),
5480
5781
  nonce: node.nonce,
5481
5782
  amount: (0, import_math19.bn)(node.amount),
5482
- data: import_transactions20.InputMessageCoder.decodeData(node.data),
5783
+ data: import_transactions22.InputMessageCoder.decodeData(node.data),
5483
5784
  daHeight: (0, import_math19.bn)(node.daHeight)
5484
5785
  }));
5485
5786
  return {
@@ -5502,8 +5803,8 @@ Supported fuel-core version: ${supportedVersion}.`
5502
5803
  nonce
5503
5804
  };
5504
5805
  if (commitBlockId && commitBlockHeight) {
5505
- throw new import_errors17.FuelError(
5506
- import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
5806
+ throw new import_errors18.FuelError(
5807
+ import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
5507
5808
  "commitBlockId and commitBlockHeight cannot be used together"
5508
5809
  );
5509
5810
  }
@@ -5622,7 +5923,7 @@ Supported fuel-core version: ${supportedVersion}.`
5622
5923
  async produceBlocks(amount, startTime) {
5623
5924
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
5624
5925
  blocksToProduce: (0, import_math19.bn)(amount).toString(10),
5625
- startTimestamp: startTime ? import_utils26.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
5926
+ startTimestamp: startTime ? import_utils30.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
5626
5927
  });
5627
5928
  return (0, import_math19.bn)(latestBlockHeight);
5628
5929
  }
@@ -5648,7 +5949,7 @@ Supported fuel-core version: ${supportedVersion}.`
5648
5949
  return null;
5649
5950
  }
5650
5951
  const message = {
5651
- messageId: import_transactions20.InputMessageCoder.getMessageId({
5952
+ messageId: import_transactions22.InputMessageCoder.getMessageId({
5652
5953
  sender: rawMessage.sender,
5653
5954
  recipient: rawMessage.recipient,
5654
5955
  nonce: rawMessage.nonce,
@@ -5659,7 +5960,7 @@ Supported fuel-core version: ${supportedVersion}.`
5659
5960
  recipient: import_address4.Address.fromAddressOrString(rawMessage.recipient),
5660
5961
  nonce: rawMessage.nonce,
5661
5962
  amount: (0, import_math19.bn)(rawMessage.amount),
5662
- data: import_transactions20.InputMessageCoder.decodeData(rawMessage.data),
5963
+ data: import_transactions22.InputMessageCoder.decodeData(rawMessage.data),
5663
5964
  daHeight: (0, import_math19.bn)(rawMessage.daHeight)
5664
5965
  };
5665
5966
  return message;
@@ -5686,26 +5987,26 @@ Supported fuel-core version: ${supportedVersion}.`
5686
5987
  const { paginationLimit, inputArgs = {} } = params;
5687
5988
  const { first, last, after, before } = inputArgs;
5688
5989
  if (after && before) {
5689
- throw new import_errors17.FuelError(
5690
- import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
5990
+ throw new import_errors18.FuelError(
5991
+ import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
5691
5992
  'Pagination arguments "after" and "before" cannot be used together'
5692
5993
  );
5693
5994
  }
5694
5995
  if ((first || 0) > paginationLimit || (last || 0) > paginationLimit) {
5695
- throw new import_errors17.FuelError(
5696
- import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
5996
+ throw new import_errors18.FuelError(
5997
+ import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
5697
5998
  `Pagination limit for this query cannot exceed ${paginationLimit} items`
5698
5999
  );
5699
6000
  }
5700
6001
  if (first && before) {
5701
- throw new import_errors17.FuelError(
5702
- import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
6002
+ throw new import_errors18.FuelError(
6003
+ import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
5703
6004
  'The use of pagination argument "first" with "before" is not supported'
5704
6005
  );
5705
6006
  }
5706
6007
  if (last && after) {
5707
- throw new import_errors17.FuelError(
5708
- import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
6008
+ throw new import_errors18.FuelError(
6009
+ import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
5709
6010
  'The use of pagination argument "last" with "after" is not supported'
5710
6011
  );
5711
6012
  }
@@ -5742,9 +6043,9 @@ cacheInputs_fn = function(inputs, transactionId) {
5742
6043
  }
5743
6044
  const inputsToCache = inputs.reduce(
5744
6045
  (acc, input) => {
5745
- if (input.type === import_transactions20.InputType.Coin) {
6046
+ if (input.type === import_transactions22.InputType.Coin) {
5746
6047
  acc.utxos.push(input.id);
5747
- } else if (input.type === import_transactions20.InputType.Message) {
6048
+ } else if (input.type === import_transactions22.InputType.Message) {
5748
6049
  acc.messages.push(input.nonce);
5749
6050
  }
5750
6051
  return acc;
@@ -5759,20 +6060,22 @@ __publicField(Provider, "chainInfoCache", {});
5759
6060
  __publicField(Provider, "nodeInfoCache", {});
5760
6061
 
5761
6062
  // src/providers/transaction-summary/get-transaction-summary.ts
5762
- var import_errors18 = require("@fuel-ts/errors");
6063
+ var import_errors19 = require("@fuel-ts/errors");
5763
6064
  var import_math20 = require("@fuel-ts/math");
5764
- var import_transactions21 = require("@fuel-ts/transactions");
5765
- var import_utils29 = require("@fuel-ts/utils");
6065
+ var import_transactions23 = require("@fuel-ts/transactions");
6066
+ var import_utils33 = require("@fuel-ts/utils");
5766
6067
 
5767
6068
  // src/providers/chains.ts
5768
6069
  var CHAIN_IDS = {
5769
6070
  eth: {
6071
+ mainnet: 1,
5770
6072
  sepolia: 11155111,
5771
6073
  foundry: 31337
5772
6074
  },
5773
6075
  fuel: {
5774
6076
  devnet: 0,
5775
- testnet: 0
6077
+ testnet: 0,
6078
+ mainnet: 9889
5776
6079
  }
5777
6080
  };
5778
6081
 
@@ -5818,6 +6121,11 @@ var rawAssets = [
5818
6121
  chainId: CHAIN_IDS.eth.foundry,
5819
6122
  decimals: 18
5820
6123
  },
6124
+ {
6125
+ type: "ethereum",
6126
+ chainId: CHAIN_IDS.eth.mainnet,
6127
+ decimals: 18
6128
+ },
5821
6129
  {
5822
6130
  type: "fuel",
5823
6131
  chainId: CHAIN_IDS.fuel.devnet,
@@ -5829,23 +6137,549 @@ var rawAssets = [
5829
6137
  chainId: CHAIN_IDS.fuel.testnet,
5830
6138
  decimals: 9,
5831
6139
  assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
6140
+ },
6141
+ {
6142
+ type: "fuel",
6143
+ chainId: CHAIN_IDS.fuel.mainnet,
6144
+ decimals: 9,
6145
+ assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
5832
6146
  }
5833
6147
  ]
5834
- }
5835
- ];
5836
- var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
5837
-
5838
- // src/test-utils/test-asset-id.ts
5839
- var import_crypto4 = require("@fuel-ts/crypto");
5840
- var import_utils31 = require("@fuel-ts/utils");
5841
- var _TestAssetId = class {
5842
- constructor(value) {
5843
- this.value = value;
5844
- }
6148
+ },
6149
+ {
6150
+ name: "WETH",
6151
+ symbol: "WETH",
6152
+ icon: "weth.svg",
6153
+ networks: [
6154
+ {
6155
+ type: "ethereum",
6156
+ chainId: CHAIN_IDS.eth.mainnet,
6157
+ address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
6158
+ decimals: 18
6159
+ },
6160
+ {
6161
+ type: "fuel",
6162
+ chainId: CHAIN_IDS.fuel.mainnet,
6163
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6164
+ assetId: "0xa38a5a8beeb08d95744bc7f58528073f4052b254def59eba20c99c202b5acaa3",
6165
+ decimals: 9
6166
+ }
6167
+ ]
6168
+ },
6169
+ {
6170
+ name: "weETH",
6171
+ symbol: "weETH",
6172
+ icon: "weETH.webp",
6173
+ networks: [
6174
+ {
6175
+ type: "ethereum",
6176
+ chainId: CHAIN_IDS.eth.mainnet,
6177
+ address: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
6178
+ decimals: 18
6179
+ },
6180
+ {
6181
+ type: "fuel",
6182
+ chainId: CHAIN_IDS.fuel.mainnet,
6183
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6184
+ assetId: "0x239ed6e12b7ce4089ee245244e3bf906999a6429c2a9a445a1e1faf56914a4ab",
6185
+ decimals: 9
6186
+ }
6187
+ ]
6188
+ },
6189
+ {
6190
+ name: "rsETH",
6191
+ symbol: "rsETH",
6192
+ icon: "rsETH.webp",
6193
+ networks: [
6194
+ {
6195
+ type: "ethereum",
6196
+ chainId: CHAIN_IDS.eth.mainnet,
6197
+ address: "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7",
6198
+ decimals: 18
6199
+ },
6200
+ {
6201
+ type: "fuel",
6202
+ chainId: CHAIN_IDS.fuel.mainnet,
6203
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6204
+ assetId: "0xbae80f7fb8aa6b90d9b01ef726ec847cc4f59419c4d5f2ea88fec785d1b0e849",
6205
+ decimals: 9
6206
+ }
6207
+ ]
6208
+ },
6209
+ {
6210
+ name: "rETH",
6211
+ symbol: "rETH",
6212
+ icon: "reth.svg",
6213
+ networks: [
6214
+ {
6215
+ type: "ethereum",
6216
+ chainId: CHAIN_IDS.eth.mainnet,
6217
+ address: "0xae78736cd615f374d3085123a210448e74fc6393",
6218
+ decimals: 18
6219
+ },
6220
+ {
6221
+ type: "fuel",
6222
+ chainId: CHAIN_IDS.fuel.mainnet,
6223
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6224
+ assetId: "0xf3f9a0ed0ce8eac5f89d6b83e41b3848212d5b5f56108c54a205bb228ca30c16",
6225
+ decimals: 9
6226
+ }
6227
+ ]
6228
+ },
6229
+ {
6230
+ name: "wbETH",
6231
+ symbol: "wbETH",
6232
+ icon: "wbeth.png",
6233
+ networks: [
6234
+ {
6235
+ type: "ethereum",
6236
+ chainId: CHAIN_IDS.eth.mainnet,
6237
+ address: "0xa2E3356610840701BDf5611a53974510Ae27E2e1",
6238
+ decimals: 18
6239
+ },
6240
+ {
6241
+ type: "fuel",
6242
+ chainId: CHAIN_IDS.fuel.mainnet,
6243
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6244
+ assetId: "0x7843c74bef935e837f2bcf67b5d64ecb46dd53ff86375530b0caf3699e8ffafe",
6245
+ decimals: 9
6246
+ }
6247
+ ]
6248
+ },
6249
+ {
6250
+ name: "rstETH",
6251
+ symbol: "rstETH",
6252
+ icon: "rstETH.webp",
6253
+ networks: [
6254
+ {
6255
+ type: "ethereum",
6256
+ chainId: CHAIN_IDS.eth.mainnet,
6257
+ address: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
6258
+ decimals: 18
6259
+ },
6260
+ {
6261
+ type: "fuel",
6262
+ chainId: CHAIN_IDS.fuel.mainnet,
6263
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6264
+ assetId: "0x962792286fbc9b1d5860b4551362a12249362c21594c77abf4b3fe2bbe8d977a",
6265
+ decimals: 9
6266
+ }
6267
+ ]
6268
+ },
6269
+ {
6270
+ name: "amphrETH",
6271
+ symbol: "amphrETH",
6272
+ icon: "amphrETH.png",
6273
+ networks: [
6274
+ {
6275
+ type: "ethereum",
6276
+ chainId: CHAIN_IDS.eth.mainnet,
6277
+ address: "0x5fD13359Ba15A84B76f7F87568309040176167cd",
6278
+ decimals: 18
6279
+ },
6280
+ {
6281
+ type: "fuel",
6282
+ chainId: CHAIN_IDS.fuel.mainnet,
6283
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6284
+ assetId: "0x05fc623e57bd7bc1258efa8e4f62b05af5471d73df6f2c2dc11ecc81134c4f36",
6285
+ decimals: 9
6286
+ }
6287
+ ]
6288
+ },
6289
+ {
6290
+ name: "Manta mBTC",
6291
+ symbol: "Manta mBTC",
6292
+ icon: "manta-mbtc.svg",
6293
+ networks: [
6294
+ {
6295
+ type: "ethereum",
6296
+ chainId: CHAIN_IDS.eth.mainnet,
6297
+ address: "0x4041381e947CFD3D483d67a25C6aa9Dc924250c5",
6298
+ decimals: 18
6299
+ },
6300
+ {
6301
+ type: "fuel",
6302
+ chainId: CHAIN_IDS.fuel.mainnet,
6303
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6304
+ assetId: "0xaf3111a248ff7a3238cdeea845bb2d43cf3835f1f6b8c9d28360728b55b9ce5b",
6305
+ decimals: 9
6306
+ }
6307
+ ]
6308
+ },
6309
+ {
6310
+ name: "Manta mETH",
6311
+ symbol: "Manta mETH",
6312
+ icon: "manta-meth.svg",
6313
+ networks: [
6314
+ {
6315
+ type: "ethereum",
6316
+ chainId: CHAIN_IDS.eth.mainnet,
6317
+ address: "0x8CdF550C04Bc9B9F10938368349C9c8051A772b6",
6318
+ decimals: 18
6319
+ },
6320
+ {
6321
+ type: "fuel",
6322
+ chainId: CHAIN_IDS.fuel.mainnet,
6323
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6324
+ assetId: "0xafd219f513317b1750783c6581f55530d6cf189a5863fd18bd1b3ffcec1714b4",
6325
+ decimals: 9
6326
+ }
6327
+ ]
6328
+ },
6329
+ {
6330
+ name: "Manta mUSD",
6331
+ symbol: "Manta mUSD",
6332
+ icon: "manta-musd.svg",
6333
+ networks: [
6334
+ {
6335
+ type: "ethereum",
6336
+ chainId: CHAIN_IDS.eth.mainnet,
6337
+ address: "0x3f24E1d7a973867fC2A03fE199E5502514E0e11E",
6338
+ decimals: 18
6339
+ },
6340
+ {
6341
+ type: "fuel",
6342
+ chainId: CHAIN_IDS.fuel.mainnet,
6343
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6344
+ assetId: "0x89cb9401e55d49c3269654dd1cdfb0e80e57823a4a7db98ba8fc5953b120fef4",
6345
+ decimals: 9
6346
+ }
6347
+ ]
6348
+ },
6349
+ {
6350
+ name: "pumpBTC",
6351
+ symbol: "pumpBTC",
6352
+ icon: "pumpbtc.webp",
6353
+ networks: [
6354
+ {
6355
+ type: "ethereum",
6356
+ chainId: CHAIN_IDS.eth.mainnet,
6357
+ address: "0xf469fbd2abcd6b9de8e169d128226c0fc90a012e",
6358
+ decimals: 8
6359
+ },
6360
+ {
6361
+ type: "fuel",
6362
+ chainId: CHAIN_IDS.fuel.mainnet,
6363
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6364
+ assetId: "0x0aa5eb2bb97ca915288b653a2529355d4dc66de2b37533213f0e4aeee3d3421f",
6365
+ decimals: 8
6366
+ }
6367
+ ]
6368
+ },
6369
+ {
6370
+ name: "FBTC",
6371
+ symbol: "FBTC",
6372
+ icon: "fbtc.svg",
6373
+ networks: [
6374
+ {
6375
+ type: "ethereum",
6376
+ chainId: CHAIN_IDS.eth.mainnet,
6377
+ address: "0xc96de26018a54d51c097160568752c4e3bd6c364",
6378
+ decimals: 8
6379
+ },
6380
+ {
6381
+ type: "fuel",
6382
+ chainId: CHAIN_IDS.fuel.mainnet,
6383
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6384
+ assetId: "0xb5ecb0a1e08e2abbabf624ffea089df933376855f468ade35c6375b00c33996a",
6385
+ decimals: 8
6386
+ }
6387
+ ]
6388
+ },
6389
+ {
6390
+ name: "SolvBTC",
6391
+ symbol: "SolvBTC",
6392
+ icon: "solvBTC.webp",
6393
+ networks: [
6394
+ {
6395
+ type: "ethereum",
6396
+ chainId: CHAIN_IDS.eth.mainnet,
6397
+ address: "0x7a56e1c57c7475ccf742a1832b028f0456652f97",
6398
+ decimals: 18
6399
+ },
6400
+ {
6401
+ type: "fuel",
6402
+ chainId: CHAIN_IDS.fuel.mainnet,
6403
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6404
+ assetId: "0x1186afea9affb88809c210e13e2330b5258c2cef04bb8fff5eff372b7bd3f40f",
6405
+ decimals: 9
6406
+ }
6407
+ ]
6408
+ },
6409
+ {
6410
+ name: "SolvBTC.BBN",
6411
+ symbol: "SolvBTC.BBN",
6412
+ icon: "SolvBTC.BBN.png",
6413
+ networks: [
6414
+ {
6415
+ type: "ethereum",
6416
+ chainId: CHAIN_IDS.eth.mainnet,
6417
+ address: "0xd9d920aa40f578ab794426f5c90f6c731d159def",
6418
+ decimals: 18
6419
+ },
6420
+ {
6421
+ type: "fuel",
6422
+ chainId: CHAIN_IDS.fuel.mainnet,
6423
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6424
+ assetId: "0x7a4f087c957d30218223c2baaaa365355c9ca81b6ea49004cfb1590a5399216f",
6425
+ decimals: 9
6426
+ }
6427
+ ]
6428
+ },
6429
+ {
6430
+ name: "Mantle mETH",
6431
+ symbol: "Mantle mETH",
6432
+ icon: "mantle-meth.svg",
6433
+ networks: [
6434
+ {
6435
+ type: "ethereum",
6436
+ chainId: CHAIN_IDS.eth.mainnet,
6437
+ address: "0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa",
6438
+ decimals: 18
6439
+ },
6440
+ {
6441
+ type: "fuel",
6442
+ chainId: CHAIN_IDS.fuel.mainnet,
6443
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6444
+ assetId: "0x642a5db59ec323c2f846d4d4cf3e58d78aff64accf4f8f6455ba0aa3ef000a3b",
6445
+ decimals: 9
6446
+ }
6447
+ ]
6448
+ },
6449
+ {
6450
+ name: "sDAI",
6451
+ symbol: "sDAI",
6452
+ icon: "sdai.svg",
6453
+ networks: [
6454
+ {
6455
+ type: "ethereum",
6456
+ chainId: CHAIN_IDS.eth.mainnet,
6457
+ address: "0x83f20f44975d03b1b09e64809b757c47f942beea",
6458
+ decimals: 18
6459
+ },
6460
+ {
6461
+ type: "fuel",
6462
+ chainId: CHAIN_IDS.fuel.mainnet,
6463
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6464
+ assetId: "0x9e46f919fbf978f3cad7cd34cca982d5613af63ff8aab6c379e4faa179552958",
6465
+ decimals: 9
6466
+ }
6467
+ ]
6468
+ },
6469
+ {
6470
+ name: "USDT",
6471
+ symbol: "USDT",
6472
+ icon: "usdt.svg",
6473
+ networks: [
6474
+ {
6475
+ type: "ethereum",
6476
+ chainId: CHAIN_IDS.eth.mainnet,
6477
+ address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
6478
+ decimals: 6
6479
+ },
6480
+ {
6481
+ type: "fuel",
6482
+ chainId: CHAIN_IDS.fuel.mainnet,
6483
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6484
+ assetId: "0xa0265fb5c32f6e8db3197af3c7eb05c48ae373605b8165b6f4a51c5b0ba4812e",
6485
+ decimals: 6
6486
+ }
6487
+ ]
6488
+ },
6489
+ {
6490
+ name: "USDC",
6491
+ symbol: "USDC",
6492
+ icon: "usdc.svg",
6493
+ networks: [
6494
+ {
6495
+ type: "ethereum",
6496
+ chainId: CHAIN_IDS.eth.mainnet,
6497
+ address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
6498
+ decimals: 6
6499
+ },
6500
+ {
6501
+ type: "fuel",
6502
+ chainId: CHAIN_IDS.fuel.mainnet,
6503
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6504
+ assetId: "0x286c479da40dc953bddc3bb4c453b608bba2e0ac483b077bd475174115395e6b",
6505
+ decimals: 6
6506
+ }
6507
+ ]
6508
+ },
6509
+ {
6510
+ name: "USDe",
6511
+ symbol: "USDe",
6512
+ icon: "USDe.svg",
6513
+ networks: [
6514
+ {
6515
+ type: "ethereum",
6516
+ chainId: CHAIN_IDS.eth.mainnet,
6517
+ address: "0x4c9edd5852cd905f086c759e8383e09bff1e68b3",
6518
+ decimals: 18
6519
+ },
6520
+ {
6521
+ type: "fuel",
6522
+ chainId: CHAIN_IDS.fuel.mainnet,
6523
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6524
+ assetId: "0xb6133b2ef9f6153eb869125d23dcf20d1e735331b5e41b15a6a7a6cec70e8651",
6525
+ decimals: 9
6526
+ }
6527
+ ]
6528
+ },
6529
+ {
6530
+ name: "sUSDe",
6531
+ symbol: "sUSDe",
6532
+ icon: "sUSDe.webp",
6533
+ networks: [
6534
+ {
6535
+ type: "ethereum",
6536
+ chainId: CHAIN_IDS.eth.mainnet,
6537
+ address: "0x9d39a5de30e57443bff2a8307a4256c8797a3497",
6538
+ decimals: 18
6539
+ },
6540
+ {
6541
+ type: "fuel",
6542
+ chainId: CHAIN_IDS.fuel.mainnet,
6543
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6544
+ assetId: "0xd05563025104fc36496c15c7021ad6b31034b0e89a356f4f818045d1f48808bc",
6545
+ decimals: 9
6546
+ }
6547
+ ]
6548
+ },
6549
+ {
6550
+ name: "rsUSDe",
6551
+ symbol: "rsUSDe",
6552
+ icon: "rsUSDe.svg",
6553
+ networks: [
6554
+ {
6555
+ type: "ethereum",
6556
+ chainId: CHAIN_IDS.eth.mainnet,
6557
+ address: "0x82f5104b23FF2FA54C2345F821dAc9369e9E0B26",
6558
+ decimals: 18
6559
+ },
6560
+ {
6561
+ type: "fuel",
6562
+ chainId: CHAIN_IDS.fuel.mainnet,
6563
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6564
+ assetId: "0x78d4522ec607f6e8efb66ea49439d1ee48623cf763f9688a8eada025def033d9",
6565
+ decimals: 9
6566
+ }
6567
+ ]
6568
+ },
6569
+ {
6570
+ name: "wstETH",
6571
+ symbol: "wstETH",
6572
+ icon: "wsteth.svg",
6573
+ networks: [
6574
+ {
6575
+ type: "ethereum",
6576
+ chainId: CHAIN_IDS.eth.mainnet,
6577
+ address: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
6578
+ decimals: 18
6579
+ },
6580
+ {
6581
+ type: "fuel",
6582
+ chainId: CHAIN_IDS.fuel.mainnet,
6583
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6584
+ assetId: "0x1a7815cc9f75db5c24a5b0814bfb706bb9fe485333e98254015de8f48f84c67b",
6585
+ decimals: 9
6586
+ }
6587
+ ]
6588
+ },
6589
+ {
6590
+ name: "ezETH",
6591
+ symbol: "ezETH",
6592
+ icon: "ezeth.webp",
6593
+ networks: [
6594
+ {
6595
+ type: "ethereum",
6596
+ chainId: CHAIN_IDS.eth.mainnet,
6597
+ address: "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110",
6598
+ decimals: 18
6599
+ },
6600
+ {
6601
+ type: "fuel",
6602
+ chainId: CHAIN_IDS.fuel.mainnet,
6603
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6604
+ assetId: "0x91b3559edb2619cde8ffb2aa7b3c3be97efd794ea46700db7092abeee62281b0",
6605
+ decimals: 9
6606
+ }
6607
+ ]
6608
+ },
6609
+ {
6610
+ name: "pzETH",
6611
+ symbol: "pzETH",
6612
+ icon: "pzETH.webp",
6613
+ networks: [
6614
+ {
6615
+ type: "ethereum",
6616
+ chainId: CHAIN_IDS.eth.mainnet,
6617
+ address: "0x8c9532a60e0e7c6bbd2b2c1303f63ace1c3e9811",
6618
+ decimals: 18
6619
+ },
6620
+ {
6621
+ type: "fuel",
6622
+ chainId: CHAIN_IDS.fuel.mainnet,
6623
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6624
+ assetId: "0x1493d4ec82124de8f9b625682de69dcccda79e882b89a55a8c737b12de67bd68",
6625
+ decimals: 9
6626
+ }
6627
+ ]
6628
+ },
6629
+ {
6630
+ name: "Re7LRT",
6631
+ symbol: "Re7LRT",
6632
+ icon: "Re7LRT.png",
6633
+ networks: [
6634
+ {
6635
+ type: "ethereum",
6636
+ chainId: CHAIN_IDS.eth.mainnet,
6637
+ address: "0x84631c0d0081FDe56DeB72F6DE77abBbF6A9f93a",
6638
+ decimals: 18
6639
+ },
6640
+ {
6641
+ type: "fuel",
6642
+ chainId: CHAIN_IDS.fuel.mainnet,
6643
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6644
+ assetId: "0xf2fc648c23a5db24610a1cf696acc4f0f6d9a7d6028dd9944964ab23f6e35995",
6645
+ decimals: 9
6646
+ }
6647
+ ]
6648
+ },
6649
+ {
6650
+ name: "steakLRT",
6651
+ symbol: "steakLRT",
6652
+ icon: "steakLRT.png",
6653
+ networks: [
6654
+ {
6655
+ type: "ethereum",
6656
+ chainId: CHAIN_IDS.eth.mainnet,
6657
+ address: "0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc",
6658
+ decimals: 18
6659
+ },
6660
+ {
6661
+ type: "fuel",
6662
+ chainId: CHAIN_IDS.fuel.mainnet,
6663
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6664
+ assetId: "0x4fc8ac9f101df07e2c2dec4a53c8c42c439bdbe5e36ea2d863a61ff60afafc30",
6665
+ decimals: 9
6666
+ }
6667
+ ]
6668
+ }
6669
+ ];
6670
+ var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
6671
+
6672
+ // src/test-utils/test-asset-id.ts
6673
+ var import_crypto4 = require("@fuel-ts/crypto");
6674
+ var import_utils35 = require("@fuel-ts/utils");
6675
+ var _TestAssetId = class {
6676
+ constructor(value) {
6677
+ this.value = value;
6678
+ }
5845
6679
  static random(count = 1) {
5846
6680
  const assetIds = [];
5847
6681
  for (let i = 0; i < count; i++) {
5848
- assetIds.push(new _TestAssetId((0, import_utils31.hexlify)((0, import_crypto4.randomBytes)(32))));
6682
+ assetIds.push(new _TestAssetId((0, import_utils35.hexlify)((0, import_crypto4.randomBytes)(32))));
5849
6683
  }
5850
6684
  return assetIds;
5851
6685
  }
@@ -5860,23 +6694,23 @@ __publicField(TestAssetId, "B", new _TestAssetId(
5860
6694
 
5861
6695
  // src/test-utils/wallet-config.ts
5862
6696
  var import_crypto9 = require("@fuel-ts/crypto");
5863
- var import_errors24 = require("@fuel-ts/errors");
5864
- var import_utils40 = require("@fuel-ts/utils");
6697
+ var import_errors25 = require("@fuel-ts/errors");
6698
+ var import_utils44 = require("@fuel-ts/utils");
5865
6699
 
5866
6700
  // src/wallet/base-wallet-unlocked.ts
5867
- var import_hasher3 = require("@fuel-ts/hasher");
5868
- var import_utils35 = require("@fuel-ts/utils");
6701
+ var import_hasher4 = require("@fuel-ts/hasher");
6702
+ var import_utils39 = require("@fuel-ts/utils");
5869
6703
 
5870
6704
  // src/account.ts
5871
6705
  var import_abi_coder8 = require("@fuel-ts/abi-coder");
5872
6706
  var import_address5 = require("@fuel-ts/address");
5873
6707
  var import_crypto5 = require("@fuel-ts/crypto");
5874
- var import_errors19 = require("@fuel-ts/errors");
6708
+ var import_errors20 = require("@fuel-ts/errors");
5875
6709
  var import_interfaces = require("@fuel-ts/interfaces");
5876
6710
  var import_math22 = require("@fuel-ts/math");
5877
- var import_transactions22 = require("@fuel-ts/transactions");
5878
- var import_utils33 = require("@fuel-ts/utils");
5879
- var import_ramda7 = require("ramda");
6711
+ var import_transactions24 = require("@fuel-ts/transactions");
6712
+ var import_utils37 = require("@fuel-ts/utils");
6713
+ var import_ramda9 = require("ramda");
5880
6714
 
5881
6715
  // src/providers/utils/merge-quantities.ts
5882
6716
  var mergeQuantities = (...coinQuantities) => {
@@ -5895,16 +6729,16 @@ var mergeQuantities = (...coinQuantities) => {
5895
6729
  // src/utils/formatTransferToContractScriptData.ts
5896
6730
  var import_abi_coder7 = require("@fuel-ts/abi-coder");
5897
6731
  var import_math21 = require("@fuel-ts/math");
5898
- var import_utils32 = require("@fuel-ts/utils");
6732
+ var import_utils36 = require("@fuel-ts/utils");
5899
6733
  var asm = __toESM(require("@fuels/vm-asm"));
5900
6734
  var formatTransferToContractScriptData = (params) => {
5901
6735
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
5902
6736
  const numberCoder = new import_abi_coder7.BigNumberCoder("u64");
5903
6737
  const encoded = numberCoder.encode(new import_math21.BN(amountToTransfer).toNumber());
5904
6738
  const scriptData = Uint8Array.from([
5905
- ...(0, import_utils32.arrayify)(hexlifiedContractId),
6739
+ ...(0, import_utils36.arrayify)(hexlifiedContractId),
5906
6740
  ...encoded,
5907
- ...(0, import_utils32.arrayify)(assetId)
6741
+ ...(0, import_utils36.arrayify)(assetId)
5908
6742
  ]);
5909
6743
  return scriptData;
5910
6744
  };
@@ -5965,7 +6799,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5965
6799
  */
5966
6800
  get provider() {
5967
6801
  if (!this._provider) {
5968
- throw new import_errors19.FuelError(import_errors19.ErrorCode.MISSING_PROVIDER, "Provider not set");
6802
+ throw new import_errors20.FuelError(import_errors20.ErrorCode.MISSING_PROVIDER, "Provider not set");
5969
6803
  }
5970
6804
  return this._provider;
5971
6805
  }
@@ -6083,7 +6917,7 @@ var Account = class extends import_interfaces.AbstractAccount {
6083
6917
  );
6084
6918
  request.addResources(resources);
6085
6919
  request.updatePredicateGasUsed(estimatedPredicates);
6086
- const requestToReestimate2 = (0, import_ramda7.clone)(request);
6920
+ const requestToReestimate2 = (0, import_ramda9.clone)(request);
6087
6921
  if (addedSignatures) {
6088
6922
  Array.from({ length: addedSignatures }).forEach(
6089
6923
  () => requestToReestimate2.addEmptyWitness()
@@ -6116,13 +6950,13 @@ var Account = class extends import_interfaces.AbstractAccount {
6116
6950
  fundingAttempts += 1;
6117
6951
  }
6118
6952
  if (needsToBeFunded) {
6119
- throw new import_errors19.FuelError(
6120
- import_errors19.ErrorCode.NOT_ENOUGH_FUNDS,
6953
+ throw new import_errors20.FuelError(
6954
+ import_errors20.ErrorCode.NOT_ENOUGH_FUNDS,
6121
6955
  `The account ${this.address} does not have enough base asset funds to cover the transaction execution.`
6122
6956
  );
6123
6957
  }
6124
6958
  request.updatePredicateGasUsed(estimatedPredicates);
6125
- const requestToReestimate = (0, import_ramda7.clone)(request);
6959
+ const requestToReestimate = (0, import_ramda9.clone)(request);
6126
6960
  if (addedSignatures) {
6127
6961
  Array.from({ length: addedSignatures }).forEach(() => requestToReestimate.addEmptyWitness());
6128
6962
  }
@@ -6222,8 +7056,8 @@ var Account = class extends import_interfaces.AbstractAccount {
6222
7056
  */
6223
7057
  async transferToContract(contractId, amount, assetId, txParams = {}) {
6224
7058
  if ((0, import_math22.bn)(amount).lte(0)) {
6225
- throw new import_errors19.FuelError(
6226
- import_errors19.ErrorCode.INVALID_TRANSFER_AMOUNT,
7059
+ throw new import_errors20.FuelError(
7060
+ import_errors20.ErrorCode.INVALID_TRANSFER_AMOUNT,
6227
7061
  "Transfer amount must be a positive number."
6228
7062
  );
6229
7063
  }
@@ -6262,14 +7096,14 @@ var Account = class extends import_interfaces.AbstractAccount {
6262
7096
  */
6263
7097
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
6264
7098
  const recipientAddress = import_address5.Address.fromAddressOrString(recipient);
6265
- const recipientDataArray = (0, import_utils33.arrayify)(
7099
+ const recipientDataArray = (0, import_utils37.arrayify)(
6266
7100
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
6267
7101
  );
6268
- const amountDataArray = (0, import_utils33.arrayify)(
7102
+ const amountDataArray = (0, import_utils37.arrayify)(
6269
7103
  "0x".concat((0, import_math22.bn)(amount).toHex().substring(2).padStart(16, "0"))
6270
7104
  );
6271
7105
  const script = new Uint8Array([
6272
- ...(0, import_utils33.arrayify)(withdrawScript.bytes),
7106
+ ...(0, import_utils37.arrayify)(withdrawScript.bytes),
6273
7107
  ...recipientDataArray,
6274
7108
  ...amountDataArray
6275
7109
  ]);
@@ -6298,13 +7132,13 @@ var Account = class extends import_interfaces.AbstractAccount {
6298
7132
  * @returns A promise that resolves to the transaction cost object.
6299
7133
  */
6300
7134
  async getTransactionCost(transactionRequestLike, { signatureCallback, quantities = [] } = {}) {
6301
- const txRequestClone = (0, import_ramda7.clone)(transactionRequestify(transactionRequestLike));
7135
+ const txRequestClone = (0, import_ramda9.clone)(transactionRequestify(transactionRequestLike));
6302
7136
  const baseAssetId = this.provider.getBaseAssetId();
6303
7137
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
6304
7138
  const requiredQuantities = mergeQuantities(coinOutputsQuantities, quantities);
6305
7139
  const transactionFeeForDryRun = [{ assetId: baseAssetId, amount: (0, import_math22.bn)("100000000000000000") }];
6306
7140
  const findAssetInput = (assetId) => txRequestClone.inputs.find((input) => {
6307
- if (input.type === import_transactions22.InputType.Coin) {
7141
+ if (input.type === import_transactions24.InputType.Coin) {
6308
7142
  return input.assetId === assetId;
6309
7143
  }
6310
7144
  if (isRequestInputMessageWithoutData(input)) {
@@ -6349,7 +7183,7 @@ var Account = class extends import_interfaces.AbstractAccount {
6349
7183
  */
6350
7184
  async signMessage(message) {
6351
7185
  if (!this._connector) {
6352
- throw new import_errors19.FuelError(import_errors19.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
7186
+ throw new import_errors20.FuelError(import_errors20.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
6353
7187
  }
6354
7188
  return this._connector.signMessage(this.address.toString(), message);
6355
7189
  }
@@ -6361,8 +7195,8 @@ var Account = class extends import_interfaces.AbstractAccount {
6361
7195
  */
6362
7196
  async signTransaction(transactionRequestLike) {
6363
7197
  if (!this._connector) {
6364
- throw new import_errors19.FuelError(
6365
- import_errors19.ErrorCode.MISSING_CONNECTOR,
7198
+ throw new import_errors20.FuelError(
7199
+ import_errors20.ErrorCode.MISSING_CONNECTOR,
6366
7200
  "A connector is required to sign transactions."
6367
7201
  );
6368
7202
  }
@@ -6411,7 +7245,7 @@ var Account = class extends import_interfaces.AbstractAccount {
6411
7245
  */
6412
7246
  generateFakeResources(coins) {
6413
7247
  return coins.map((coin) => ({
6414
- id: (0, import_utils33.hexlify)((0, import_crypto5.randomBytes)(import_abi_coder8.UTXO_ID_LEN)),
7248
+ id: (0, import_utils37.hexlify)((0, import_crypto5.randomBytes)(import_abi_coder8.UTXO_ID_LEN)),
6415
7249
  owner: this.address,
6416
7250
  blockCreated: (0, import_math22.bn)(1),
6417
7251
  txCreatedIdx: (0, import_math22.bn)(1),
@@ -6421,8 +7255,8 @@ var Account = class extends import_interfaces.AbstractAccount {
6421
7255
  /** @hidden * */
6422
7256
  validateTransferAmount(amount) {
6423
7257
  if ((0, import_math22.bn)(amount).lte(0)) {
6424
- throw new import_errors19.FuelError(
6425
- import_errors19.ErrorCode.INVALID_TRANSFER_AMOUNT,
7258
+ throw new import_errors20.FuelError(
7259
+ import_errors20.ErrorCode.INVALID_TRANSFER_AMOUNT,
6426
7260
  "Transfer amount must be a positive number."
6427
7261
  );
6428
7262
  }
@@ -6448,19 +7282,19 @@ var Account = class extends import_interfaces.AbstractAccount {
6448
7282
  txParams: { gasLimit: setGasLimit, maxFee: setMaxFee }
6449
7283
  }) {
6450
7284
  const request = transactionRequestify(transactionRequest);
6451
- if (!(0, import_utils33.isDefined)(setGasLimit)) {
7285
+ if (!(0, import_utils37.isDefined)(setGasLimit)) {
6452
7286
  request.gasLimit = gasUsed;
6453
7287
  } else if (gasUsed.gt(setGasLimit)) {
6454
- throw new import_errors19.FuelError(
6455
- import_errors19.ErrorCode.GAS_LIMIT_TOO_LOW,
7288
+ throw new import_errors20.FuelError(
7289
+ import_errors20.ErrorCode.GAS_LIMIT_TOO_LOW,
6456
7290
  `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
6457
7291
  );
6458
7292
  }
6459
- if (!(0, import_utils33.isDefined)(setMaxFee)) {
7293
+ if (!(0, import_utils37.isDefined)(setMaxFee)) {
6460
7294
  request.maxFee = maxFee;
6461
7295
  } else if (maxFee.gt(setMaxFee)) {
6462
- throw new import_errors19.FuelError(
6463
- import_errors19.ErrorCode.MAX_FEE_TOO_LOW,
7296
+ throw new import_errors20.FuelError(
7297
+ import_errors20.ErrorCode.MAX_FEE_TOO_LOW,
6464
7298
  `Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
6465
7299
  );
6466
7300
  }
@@ -6471,8 +7305,8 @@ var Account = class extends import_interfaces.AbstractAccount {
6471
7305
  // src/wallet/keystore-wallet.ts
6472
7306
  var import_address6 = require("@fuel-ts/address");
6473
7307
  var import_crypto6 = require("@fuel-ts/crypto");
6474
- var import_errors20 = require("@fuel-ts/errors");
6475
- var import_utils34 = require("@fuel-ts/utils");
7308
+ var import_errors21 = require("@fuel-ts/errors");
7309
+ var import_utils38 = require("@fuel-ts/utils");
6476
7310
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
6477
7311
  var DEFAULT_KDF_PARAMS_R = 8;
6478
7312
  var DEFAULT_KDF_PARAMS_P = 1;
@@ -6548,13 +7382,13 @@ async function decryptKeystoreWallet(jsonWallet, password) {
6548
7382
  const macHashUint8Array = (0, import_crypto6.keccak256)(data);
6549
7383
  const macHash = (0, import_crypto6.stringFromBuffer)(macHashUint8Array, "hex");
6550
7384
  if (mac !== macHash) {
6551
- throw new import_errors20.FuelError(
6552
- import_errors20.ErrorCode.INVALID_PASSWORD,
7385
+ throw new import_errors21.FuelError(
7386
+ import_errors21.ErrorCode.INVALID_PASSWORD,
6553
7387
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
6554
7388
  );
6555
7389
  }
6556
7390
  const buffer = await (0, import_crypto6.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
6557
- const privateKey = (0, import_utils34.hexlify)(buffer);
7391
+ const privateKey = (0, import_utils38.hexlify)(buffer);
6558
7392
  return privateKey;
6559
7393
  }
6560
7394
 
@@ -6598,8 +7432,8 @@ var BaseWalletUnlocked = class extends Account {
6598
7432
  * @returns A promise that resolves to the signature as a ECDSA 64 bytes string.
6599
7433
  */
6600
7434
  async signMessage(message) {
6601
- const signedMessage = await this.signer().sign((0, import_hasher3.hashMessage)(message));
6602
- return (0, import_utils35.hexlify)(signedMessage);
7435
+ const signedMessage = await this.signer().sign((0, import_hasher4.hashMessage)(message));
7436
+ return (0, import_utils39.hexlify)(signedMessage);
6603
7437
  }
6604
7438
  /**
6605
7439
  * Signs a transaction with the wallet's private key.
@@ -6612,7 +7446,7 @@ var BaseWalletUnlocked = class extends Account {
6612
7446
  const chainId = this.provider.getChainId();
6613
7447
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
6614
7448
  const signature = await this.signer().sign(hashedTransaction);
6615
- return (0, import_utils35.hexlify)(signature);
7449
+ return (0, import_utils39.hexlify)(signature);
6616
7450
  }
6617
7451
  /**
6618
7452
  * Populates a transaction with the witnesses signature.
@@ -6679,16 +7513,16 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
6679
7513
 
6680
7514
  // src/hdwallet/hdwallet.ts
6681
7515
  var import_crypto8 = require("@fuel-ts/crypto");
6682
- var import_errors23 = require("@fuel-ts/errors");
6683
- var import_hasher6 = require("@fuel-ts/hasher");
7516
+ var import_errors24 = require("@fuel-ts/errors");
7517
+ var import_hasher7 = require("@fuel-ts/hasher");
6684
7518
  var import_math23 = require("@fuel-ts/math");
6685
- var import_utils39 = require("@fuel-ts/utils");
7519
+ var import_utils43 = require("@fuel-ts/utils");
6686
7520
 
6687
7521
  // src/mnemonic/mnemonic.ts
6688
7522
  var import_crypto7 = require("@fuel-ts/crypto");
6689
- var import_errors22 = require("@fuel-ts/errors");
6690
- var import_hasher5 = require("@fuel-ts/hasher");
6691
- var import_utils37 = require("@fuel-ts/utils");
7523
+ var import_errors23 = require("@fuel-ts/errors");
7524
+ var import_hasher6 = require("@fuel-ts/hasher");
7525
+ var import_utils41 = require("@fuel-ts/utils");
6692
7526
 
6693
7527
  // src/wordlists/words/english.ts
6694
7528
  var english = [
@@ -8743,9 +9577,9 @@ var english = [
8743
9577
  ];
8744
9578
 
8745
9579
  // src/mnemonic/utils.ts
8746
- var import_errors21 = require("@fuel-ts/errors");
8747
- var import_hasher4 = require("@fuel-ts/hasher");
8748
- var import_utils36 = require("@fuel-ts/utils");
9580
+ var import_errors22 = require("@fuel-ts/errors");
9581
+ var import_hasher5 = require("@fuel-ts/hasher");
9582
+ var import_utils40 = require("@fuel-ts/utils");
8749
9583
  function getLowerMask(bits) {
8750
9584
  return (1 << bits) - 1;
8751
9585
  }
@@ -8780,20 +9614,20 @@ function entropyToMnemonicIndices(entropy) {
8780
9614
  }
8781
9615
  }
8782
9616
  const checksumBits = entropy.length / 4;
8783
- const checksum = (0, import_utils36.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
9617
+ const checksum = (0, import_utils40.arrayify)((0, import_hasher5.sha256)(entropy))[0] & getUpperMask(checksumBits);
8784
9618
  indices[indices.length - 1] <<= checksumBits;
8785
9619
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
8786
9620
  return indices;
8787
9621
  }
8788
9622
  function mnemonicWordsToEntropy(words, wordlist) {
8789
9623
  const size = Math.ceil(11 * words.length / 8);
8790
- const entropy = (0, import_utils36.arrayify)(new Uint8Array(size));
9624
+ const entropy = (0, import_utils40.arrayify)(new Uint8Array(size));
8791
9625
  let offset = 0;
8792
9626
  for (let i = 0; i < words.length; i += 1) {
8793
9627
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
8794
9628
  if (index === -1) {
8795
- throw new import_errors21.FuelError(
8796
- import_errors21.ErrorCode.INVALID_MNEMONIC,
9629
+ throw new import_errors22.FuelError(
9630
+ import_errors22.ErrorCode.INVALID_MNEMONIC,
8797
9631
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
8798
9632
  );
8799
9633
  }
@@ -8807,10 +9641,10 @@ function mnemonicWordsToEntropy(words, wordlist) {
8807
9641
  const entropyBits = 32 * words.length / 3;
8808
9642
  const checksumBits = words.length / 3;
8809
9643
  const checksumMask = getUpperMask(checksumBits);
8810
- const checksum = (0, import_utils36.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
9644
+ const checksum = (0, import_utils40.arrayify)((0, import_hasher5.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
8811
9645
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
8812
- throw new import_errors21.FuelError(
8813
- import_errors21.ErrorCode.INVALID_CHECKSUM,
9646
+ throw new import_errors22.FuelError(
9647
+ import_errors22.ErrorCode.INVALID_CHECKSUM,
8814
9648
  "Checksum validation failed for the provided mnemonic."
8815
9649
  );
8816
9650
  }
@@ -8818,22 +9652,22 @@ function mnemonicWordsToEntropy(words, wordlist) {
8818
9652
  }
8819
9653
 
8820
9654
  // src/mnemonic/mnemonic.ts
8821
- var MasterSecret = (0, import_utils37.toUtf8Bytes)("Bitcoin seed");
9655
+ var MasterSecret = (0, import_utils41.toUtf8Bytes)("Bitcoin seed");
8822
9656
  var MainnetPRV = "0x0488ade4";
8823
9657
  var TestnetPRV = "0x04358394";
8824
9658
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
8825
9659
  function assertWordList(wordlist) {
8826
9660
  if (wordlist.length !== 2048) {
8827
- throw new import_errors22.FuelError(
8828
- import_errors22.ErrorCode.INVALID_WORD_LIST,
9661
+ throw new import_errors23.FuelError(
9662
+ import_errors23.ErrorCode.INVALID_WORD_LIST,
8829
9663
  `Expected word list length of 2048, but got ${wordlist.length}.`
8830
9664
  );
8831
9665
  }
8832
9666
  }
8833
9667
  function assertEntropy(entropy) {
8834
9668
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
8835
- throw new import_errors22.FuelError(
8836
- import_errors22.ErrorCode.INVALID_ENTROPY,
9669
+ throw new import_errors23.FuelError(
9670
+ import_errors23.ErrorCode.INVALID_ENTROPY,
8837
9671
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
8838
9672
  );
8839
9673
  }
@@ -8843,7 +9677,7 @@ function assertMnemonic(words) {
8843
9677
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
8844
9678
  ", "
8845
9679
  )}] words, but got ${words.length}.`;
8846
- throw new import_errors22.FuelError(import_errors22.ErrorCode.INVALID_MNEMONIC, errorMsg);
9680
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.INVALID_MNEMONIC, errorMsg);
8847
9681
  }
8848
9682
  }
8849
9683
  var Mnemonic = class {
@@ -8882,7 +9716,7 @@ var Mnemonic = class {
8882
9716
  static mnemonicToEntropy(phrase, wordlist = english) {
8883
9717
  const words = getWords(phrase);
8884
9718
  assertMnemonic(words);
8885
- return (0, import_utils37.hexlify)(mnemonicWordsToEntropy(words, wordlist));
9719
+ return (0, import_utils41.hexlify)(mnemonicWordsToEntropy(words, wordlist));
8886
9720
  }
8887
9721
  /**
8888
9722
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -8890,7 +9724,7 @@ var Mnemonic = class {
8890
9724
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
8891
9725
  */
8892
9726
  static entropyToMnemonic(entropy, wordlist = english) {
8893
- const entropyBytes = (0, import_utils37.arrayify)(entropy);
9727
+ const entropyBytes = (0, import_utils41.arrayify)(entropy);
8894
9728
  assertWordList(wordlist);
8895
9729
  assertEntropy(entropyBytes);
8896
9730
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -8902,8 +9736,8 @@ var Mnemonic = class {
8902
9736
  */
8903
9737
  static mnemonicToSeed(phrase, passphrase = "") {
8904
9738
  assertMnemonic(getWords(phrase));
8905
- const phraseBytes = (0, import_utils37.toUtf8Bytes)(getPhrase(phrase));
8906
- const salt = (0, import_utils37.toUtf8Bytes)(`mnemonic${passphrase}`);
9739
+ const phraseBytes = (0, import_utils41.toUtf8Bytes)(getPhrase(phrase));
9740
+ const salt = (0, import_utils41.toUtf8Bytes)(`mnemonic${passphrase}`);
8907
9741
  return (0, import_crypto7.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
8908
9742
  }
8909
9743
  /**
@@ -8959,14 +9793,14 @@ var Mnemonic = class {
8959
9793
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
8960
9794
  */
8961
9795
  static masterKeysFromSeed(seed) {
8962
- const seedArray = (0, import_utils37.arrayify)(seed);
9796
+ const seedArray = (0, import_utils41.arrayify)(seed);
8963
9797
  if (seedArray.length < 16 || seedArray.length > 64) {
8964
- throw new import_errors22.FuelError(
8965
- import_errors22.ErrorCode.INVALID_SEED,
9798
+ throw new import_errors23.FuelError(
9799
+ import_errors23.ErrorCode.INVALID_SEED,
8966
9800
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
8967
9801
  );
8968
9802
  }
8969
- return (0, import_utils37.arrayify)((0, import_crypto7.computeHmac)("sha512", MasterSecret, seedArray));
9803
+ return (0, import_utils41.arrayify)((0, import_crypto7.computeHmac)("sha512", MasterSecret, seedArray));
8970
9804
  }
8971
9805
  /**
8972
9806
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -8977,22 +9811,22 @@ var Mnemonic = class {
8977
9811
  */
8978
9812
  static seedToExtendedKey(seed, testnet = false) {
8979
9813
  const masterKey = Mnemonic.masterKeysFromSeed(seed);
8980
- const prefix = (0, import_utils37.arrayify)(testnet ? TestnetPRV : MainnetPRV);
9814
+ const prefix = (0, import_utils41.arrayify)(testnet ? TestnetPRV : MainnetPRV);
8981
9815
  const depth = "0x00";
8982
9816
  const fingerprint = "0x00000000";
8983
9817
  const index = "0x00000000";
8984
9818
  const chainCode = masterKey.slice(32);
8985
9819
  const privateKey = masterKey.slice(0, 32);
8986
- const extendedKey = (0, import_utils37.concat)([
9820
+ const extendedKey = (0, import_utils41.concat)([
8987
9821
  prefix,
8988
9822
  depth,
8989
9823
  fingerprint,
8990
9824
  index,
8991
9825
  chainCode,
8992
- (0, import_utils37.concat)(["0x00", privateKey])
9826
+ (0, import_utils41.concat)(["0x00", privateKey])
8993
9827
  ]);
8994
- const checksum = (0, import_utils37.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
8995
- return (0, import_utils37.encodeBase58)((0, import_utils37.concat)([extendedKey, checksum]));
9828
+ const checksum = (0, import_utils41.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(extendedKey)), 0, 4);
9829
+ return (0, import_utils41.encodeBase58)((0, import_utils41.concat)([extendedKey, checksum]));
8996
9830
  }
8997
9831
  /**
8998
9832
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -9007,7 +9841,7 @@ var Mnemonic = class {
9007
9841
  * @returns A randomly generated mnemonic
9008
9842
  */
9009
9843
  static generate(size = 32, extraEntropy = "") {
9010
- const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils37.concat)([(0, import_crypto7.randomBytes)(size), (0, import_utils37.arrayify)(extraEntropy)])) : (0, import_crypto7.randomBytes)(size);
9844
+ const entropy = extraEntropy ? (0, import_hasher6.sha256)((0, import_utils41.concat)([(0, import_crypto7.randomBytes)(size), (0, import_utils41.arrayify)(extraEntropy)])) : (0, import_crypto7.randomBytes)(size);
9011
9845
  return Mnemonic.entropyToMnemonic(entropy);
9012
9846
  }
9013
9847
  };
@@ -9015,12 +9849,12 @@ var mnemonic_default = Mnemonic;
9015
9849
 
9016
9850
  // src/hdwallet/hdwallet.ts
9017
9851
  var HARDENED_INDEX = 2147483648;
9018
- var MainnetPRV2 = (0, import_utils39.hexlify)("0x0488ade4");
9019
- var MainnetPUB = (0, import_utils39.hexlify)("0x0488b21e");
9020
- var TestnetPRV2 = (0, import_utils39.hexlify)("0x04358394");
9021
- var TestnetPUB = (0, import_utils39.hexlify)("0x043587cf");
9852
+ var MainnetPRV2 = (0, import_utils43.hexlify)("0x0488ade4");
9853
+ var MainnetPUB = (0, import_utils43.hexlify)("0x0488b21e");
9854
+ var TestnetPRV2 = (0, import_utils43.hexlify)("0x04358394");
9855
+ var TestnetPUB = (0, import_utils43.hexlify)("0x043587cf");
9022
9856
  function base58check(data) {
9023
- return (0, import_utils39.encodeBase58)((0, import_utils39.concat)([data, (0, import_utils39.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
9857
+ return (0, import_utils43.encodeBase58)((0, import_utils43.concat)([data, (0, import_utils43.dataSlice)((0, import_hasher7.sha256)((0, import_hasher7.sha256)(data)), 0, 4)]));
9024
9858
  }
9025
9859
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
9026
9860
  if (isPublic) {
@@ -9029,17 +9863,17 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
9029
9863
  return testnet ? TestnetPRV2 : MainnetPRV2;
9030
9864
  }
9031
9865
  function isPublicExtendedKey(extendedKey) {
9032
- return [MainnetPUB, TestnetPUB].includes((0, import_utils39.hexlify)(extendedKey.slice(0, 4)));
9866
+ return [MainnetPUB, TestnetPUB].includes((0, import_utils43.hexlify)(extendedKey.slice(0, 4)));
9033
9867
  }
9034
9868
  function isValidExtendedKey(extendedKey) {
9035
9869
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
9036
- (0, import_utils39.hexlify)(extendedKey.slice(0, 4))
9870
+ (0, import_utils43.hexlify)(extendedKey.slice(0, 4))
9037
9871
  );
9038
9872
  }
9039
9873
  function parsePath(path2, depth = 0) {
9040
9874
  const components = path2.split("/");
9041
9875
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
9042
- throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path2}`);
9876
+ throw new import_errors24.FuelError(import_errors24.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path2}`);
9043
9877
  }
9044
9878
  if (components[0] === "m") {
9045
9879
  components.shift();
@@ -9051,8 +9885,8 @@ function parsePath(path2, depth = 0) {
9051
9885
  var HDWallet = class {
9052
9886
  depth = 0;
9053
9887
  index = 0;
9054
- fingerprint = (0, import_utils39.hexlify)("0x00000000");
9055
- parentFingerprint = (0, import_utils39.hexlify)("0x00000000");
9888
+ fingerprint = (0, import_utils43.hexlify)("0x00000000");
9889
+ parentFingerprint = (0, import_utils43.hexlify)("0x00000000");
9056
9890
  privateKey;
9057
9891
  publicKey;
9058
9892
  chainCode;
@@ -9064,19 +9898,19 @@ var HDWallet = class {
9064
9898
  constructor(config) {
9065
9899
  if (config.privateKey) {
9066
9900
  const signer = new Signer(config.privateKey);
9067
- this.publicKey = (0, import_utils39.hexlify)(signer.compressedPublicKey);
9068
- this.privateKey = (0, import_utils39.hexlify)(config.privateKey);
9901
+ this.publicKey = (0, import_utils43.hexlify)(signer.compressedPublicKey);
9902
+ this.privateKey = (0, import_utils43.hexlify)(config.privateKey);
9069
9903
  } else {
9070
9904
  if (!config.publicKey) {
9071
- throw new import_errors23.FuelError(
9072
- import_errors23.ErrorCode.HD_WALLET_ERROR,
9905
+ throw new import_errors24.FuelError(
9906
+ import_errors24.ErrorCode.HD_WALLET_ERROR,
9073
9907
  "Both public and private Key cannot be missing. At least one should be provided."
9074
9908
  );
9075
9909
  }
9076
- this.publicKey = (0, import_utils39.hexlify)(config.publicKey);
9910
+ this.publicKey = (0, import_utils43.hexlify)(config.publicKey);
9077
9911
  }
9078
9912
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
9079
- this.fingerprint = (0, import_utils39.dataSlice)((0, import_crypto8.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
9913
+ this.fingerprint = (0, import_utils43.dataSlice)((0, import_crypto8.ripemd160)((0, import_hasher7.sha256)(this.publicKey)), 0, 4);
9080
9914
  this.depth = config.depth || this.depth;
9081
9915
  this.index = config.index || this.index;
9082
9916
  this.chainCode = config.chainCode;
@@ -9092,23 +9926,23 @@ var HDWallet = class {
9092
9926
  * @returns A new instance of HDWallet on the derived index
9093
9927
  */
9094
9928
  deriveIndex(index) {
9095
- const privateKey = this.privateKey && (0, import_utils39.arrayify)(this.privateKey);
9096
- const publicKey = (0, import_utils39.arrayify)(this.publicKey);
9097
- const chainCode = (0, import_utils39.arrayify)(this.chainCode);
9929
+ const privateKey = this.privateKey && (0, import_utils43.arrayify)(this.privateKey);
9930
+ const publicKey = (0, import_utils43.arrayify)(this.publicKey);
9931
+ const chainCode = (0, import_utils43.arrayify)(this.chainCode);
9098
9932
  const data = new Uint8Array(37);
9099
9933
  if (index & HARDENED_INDEX) {
9100
9934
  if (!privateKey) {
9101
- throw new import_errors23.FuelError(
9102
- import_errors23.ErrorCode.HD_WALLET_ERROR,
9935
+ throw new import_errors24.FuelError(
9936
+ import_errors24.ErrorCode.HD_WALLET_ERROR,
9103
9937
  "Cannot derive a hardened index without a private Key."
9104
9938
  );
9105
9939
  }
9106
9940
  data.set(privateKey, 1);
9107
9941
  } else {
9108
- data.set((0, import_utils39.arrayify)(this.publicKey));
9942
+ data.set((0, import_utils43.arrayify)(this.publicKey));
9109
9943
  }
9110
9944
  data.set((0, import_math23.toBytes)(index, 4), 33);
9111
- const bytes = (0, import_utils39.arrayify)((0, import_crypto8.computeHmac)("sha512", chainCode, data));
9945
+ const bytes = (0, import_utils43.arrayify)((0, import_crypto8.computeHmac)("sha512", chainCode, data));
9112
9946
  const IL = bytes.slice(0, 32);
9113
9947
  const IR = bytes.slice(32);
9114
9948
  if (privateKey) {
@@ -9122,7 +9956,7 @@ var HDWallet = class {
9122
9956
  parentFingerprint: this.fingerprint
9123
9957
  });
9124
9958
  }
9125
- const signer = new Signer((0, import_utils39.hexlify)(IL));
9959
+ const signer = new Signer((0, import_utils43.hexlify)(IL));
9126
9960
  const Ki = signer.addPoint(publicKey);
9127
9961
  return new HDWallet({
9128
9962
  publicKey: Ki,
@@ -9151,18 +9985,18 @@ var HDWallet = class {
9151
9985
  */
9152
9986
  toExtendedKey(isPublic = false, testnet = false) {
9153
9987
  if (this.depth >= 256) {
9154
- throw new import_errors23.FuelError(
9155
- import_errors23.ErrorCode.HD_WALLET_ERROR,
9988
+ throw new import_errors24.FuelError(
9989
+ import_errors24.ErrorCode.HD_WALLET_ERROR,
9156
9990
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
9157
9991
  );
9158
9992
  }
9159
9993
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
9160
- const depth = (0, import_utils39.hexlify)(Uint8Array.from([this.depth]));
9994
+ const depth = (0, import_utils43.hexlify)(Uint8Array.from([this.depth]));
9161
9995
  const parentFingerprint = this.parentFingerprint;
9162
9996
  const index = (0, import_math23.toHex)(this.index, 4);
9163
9997
  const chainCode = this.chainCode;
9164
- const key = this.privateKey != null && !isPublic ? (0, import_utils39.concat)(["0x00", this.privateKey]) : this.publicKey;
9165
- const extendedKey = (0, import_utils39.arrayify)((0, import_utils39.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
9998
+ const key = this.privateKey != null && !isPublic ? (0, import_utils43.concat)(["0x00", this.privateKey]) : this.publicKey;
9999
+ const extendedKey = (0, import_utils43.arrayify)((0, import_utils43.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
9166
10000
  return base58check(extendedKey);
9167
10001
  }
9168
10002
  /**
@@ -9174,34 +10008,34 @@ var HDWallet = class {
9174
10008
  static fromSeed(seed) {
9175
10009
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
9176
10010
  return new HDWallet({
9177
- chainCode: (0, import_utils39.arrayify)(masterKey.slice(32)),
9178
- privateKey: (0, import_utils39.arrayify)(masterKey.slice(0, 32))
10011
+ chainCode: (0, import_utils43.arrayify)(masterKey.slice(32)),
10012
+ privateKey: (0, import_utils43.arrayify)(masterKey.slice(0, 32))
9179
10013
  });
9180
10014
  }
9181
10015
  static fromExtendedKey(extendedKey) {
9182
- const decoded = (0, import_utils39.hexlify)((0, import_math23.toBytes)((0, import_utils39.decodeBase58)(extendedKey)));
9183
- const bytes = (0, import_utils39.arrayify)(decoded);
10016
+ const decoded = (0, import_utils43.hexlify)((0, import_math23.toBytes)((0, import_utils43.decodeBase58)(extendedKey)));
10017
+ const bytes = (0, import_utils43.arrayify)(decoded);
9184
10018
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
9185
10019
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
9186
- throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
10020
+ throw new import_errors24.FuelError(import_errors24.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
9187
10021
  }
9188
10022
  if (!validChecksum) {
9189
- throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
10023
+ throw new import_errors24.FuelError(import_errors24.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
9190
10024
  }
9191
10025
  const depth = bytes[4];
9192
- const parentFingerprint = (0, import_utils39.hexlify)(bytes.slice(5, 9));
9193
- const index = parseInt((0, import_utils39.hexlify)(bytes.slice(9, 13)).substring(2), 16);
9194
- const chainCode = (0, import_utils39.hexlify)(bytes.slice(13, 45));
10026
+ const parentFingerprint = (0, import_utils43.hexlify)(bytes.slice(5, 9));
10027
+ const index = parseInt((0, import_utils43.hexlify)(bytes.slice(9, 13)).substring(2), 16);
10028
+ const chainCode = (0, import_utils43.hexlify)(bytes.slice(13, 45));
9195
10029
  const key = bytes.slice(45, 78);
9196
10030
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
9197
- throw new import_errors23.FuelError(
9198
- import_errors23.ErrorCode.HD_WALLET_ERROR,
10031
+ throw new import_errors24.FuelError(
10032
+ import_errors24.ErrorCode.HD_WALLET_ERROR,
9199
10033
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
9200
10034
  );
9201
10035
  }
9202
10036
  if (isPublicExtendedKey(bytes)) {
9203
10037
  if (key[0] !== 3) {
9204
- throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
10038
+ throw new import_errors24.FuelError(import_errors24.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
9205
10039
  }
9206
10040
  return new HDWallet({
9207
10041
  publicKey: key,
@@ -9212,7 +10046,7 @@ var HDWallet = class {
9212
10046
  });
9213
10047
  }
9214
10048
  if (key[0] !== 0) {
9215
- throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
10049
+ throw new import_errors24.FuelError(import_errors24.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
9216
10050
  }
9217
10051
  return new HDWallet({
9218
10052
  privateKey: key.slice(1),
@@ -9409,7 +10243,7 @@ var WalletsConfig = class {
9409
10243
  return {
9410
10244
  ...snapshotConfig,
9411
10245
  stateConfig: {
9412
- ...snapshotConfig?.stateConfig ?? import_utils40.defaultSnapshotConfigs.stateConfig,
10246
+ ...snapshotConfig?.stateConfig ?? import_utils44.defaultSnapshotConfigs.stateConfig,
9413
10247
  coins: this.initialState.coins.concat(snapshotConfig?.stateConfig?.coins || []),
9414
10248
  messages: this.initialState.messages.concat(snapshotConfig?.stateConfig?.messages ?? [])
9415
10249
  }
@@ -9442,7 +10276,7 @@ var WalletsConfig = class {
9442
10276
  tx_pointer_block_height: 0,
9443
10277
  tx_pointer_tx_idx: 0,
9444
10278
  output_index: 0,
9445
- tx_id: (0, import_utils40.hexlify)((0, import_crypto9.randomBytes)(32))
10279
+ tx_id: (0, import_utils44.hexlify)((0, import_crypto9.randomBytes)(32))
9446
10280
  });
9447
10281
  }
9448
10282
  });
@@ -9456,26 +10290,26 @@ var WalletsConfig = class {
9456
10290
  amountPerCoin
9457
10291
  }) {
9458
10292
  if (Array.isArray(wallets) && wallets.length === 0 || typeof wallets === "number" && wallets <= 0) {
9459
- throw new import_errors24.FuelError(
9460
- import_errors24.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10293
+ throw new import_errors25.FuelError(
10294
+ import_errors25.FuelError.CODES.INVALID_INPUT_PARAMETERS,
9461
10295
  "Number of wallets must be greater than zero."
9462
10296
  );
9463
10297
  }
9464
10298
  if (Array.isArray(assets2) && assets2.length === 0 || typeof assets2 === "number" && assets2 <= 0) {
9465
- throw new import_errors24.FuelError(
9466
- import_errors24.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10299
+ throw new import_errors25.FuelError(
10300
+ import_errors25.FuelError.CODES.INVALID_INPUT_PARAMETERS,
9467
10301
  "Number of assets per wallet must be greater than zero."
9468
10302
  );
9469
10303
  }
9470
10304
  if (coinsPerAsset <= 0) {
9471
- throw new import_errors24.FuelError(
9472
- import_errors24.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10305
+ throw new import_errors25.FuelError(
10306
+ import_errors25.FuelError.CODES.INVALID_INPUT_PARAMETERS,
9473
10307
  "Number of coins per asset must be greater than zero."
9474
10308
  );
9475
10309
  }
9476
10310
  if (amountPerCoin < 0) {
9477
- throw new import_errors24.FuelError(
9478
- import_errors24.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10311
+ throw new import_errors25.FuelError(
10312
+ import_errors25.FuelError.CODES.INVALID_INPUT_PARAMETERS,
9479
10313
  "Amount per coin must be greater than or equal to zero."
9480
10314
  );
9481
10315
  }
@@ -9498,7 +10332,7 @@ async function setupTestProviderAndWallets({
9498
10332
  } = {}) {
9499
10333
  Symbol.dispose ??= Symbol("Symbol.dispose");
9500
10334
  const walletsConfig = new WalletsConfig(
9501
- nodeOptions.snapshotConfig?.chainConfig?.consensus_parameters?.V1?.base_asset_id ?? import_utils41.defaultSnapshotConfigs.chainConfig.consensus_parameters.V1.base_asset_id,
10335
+ nodeOptions.snapshotConfig?.chainConfig?.consensus_parameters?.V1?.base_asset_id ?? import_utils45.defaultSnapshotConfigs.chainConfig.consensus_parameters.V1.base_asset_id,
9502
10336
  {
9503
10337
  ...defaultWalletConfigOptions,
9504
10338
  ...walletsConfigOptions
@@ -9507,8 +10341,8 @@ async function setupTestProviderAndWallets({
9507
10341
  const launchNodeOptions = {
9508
10342
  loggingEnabled: false,
9509
10343
  ...nodeOptions,
9510
- snapshotConfig: (0, import_ramda8.mergeDeepRight)(
9511
- import_utils41.defaultSnapshotConfigs,
10344
+ snapshotConfig: (0, import_ramda10.mergeDeepRight)(
10345
+ import_utils45.defaultSnapshotConfigs,
9512
10346
  walletsConfig.apply(nodeOptions?.snapshotConfig)
9513
10347
  ),
9514
10348
  port: nodeOptions.port || "0"
@@ -9549,7 +10383,7 @@ async function setupTestProviderAndWallets({
9549
10383
  var import_address7 = require("@fuel-ts/address");
9550
10384
  var import_crypto10 = require("@fuel-ts/crypto");
9551
10385
  var import_math24 = require("@fuel-ts/math");
9552
- var import_utils42 = require("@fuel-ts/utils");
10386
+ var import_utils46 = require("@fuel-ts/utils");
9553
10387
  var TestMessage = class {
9554
10388
  sender;
9555
10389
  recipient;
@@ -9566,7 +10400,7 @@ var TestMessage = class {
9566
10400
  constructor({
9567
10401
  sender = import_address7.Address.fromRandom(),
9568
10402
  recipient = import_address7.Address.fromRandom(),
9569
- nonce = (0, import_utils42.hexlify)((0, import_crypto10.randomBytes)(32)),
10403
+ nonce = (0, import_utils46.hexlify)((0, import_crypto10.randomBytes)(32)),
9570
10404
  amount = 1e6,
9571
10405
  data = "",
9572
10406
  // Will default to empty data in order to be a spendable message