@fuel-ts/account 0.94.5 → 0.94.6

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 (64) 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 +3 -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 +1620 -967
  13. package/dist/index.global.js.map +1 -1
  14. package/dist/index.js +1308 -405
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +1237 -338
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  19. package/dist/providers/assets/assets.d.ts +1 -1
  20. package/dist/providers/assets/assets.d.ts.map +1 -1
  21. package/dist/providers/assets/utils/network.d.ts.map +1 -1
  22. package/dist/providers/assets/utils/resolveIconPaths.d.ts +1 -1
  23. package/dist/providers/chains.d.ts +2 -0
  24. package/dist/providers/chains.d.ts.map +1 -1
  25. package/dist/providers/fuel-graphql-subscriber.d.ts +0 -2
  26. package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
  27. package/dist/providers/message.d.ts.map +1 -1
  28. package/dist/providers/provider.d.ts +8 -3
  29. package/dist/providers/provider.d.ts.map +1 -1
  30. package/dist/providers/resource.d.ts.map +1 -1
  31. package/dist/providers/transaction-request/helpers.d.ts.map +1 -1
  32. package/dist/providers/transaction-request/index.d.ts +2 -0
  33. package/dist/providers/transaction-request/index.d.ts.map +1 -1
  34. package/dist/providers/transaction-request/transaction-request.d.ts +2 -2
  35. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  36. package/dist/providers/transaction-request/types.d.ts +8 -2
  37. package/dist/providers/transaction-request/types.d.ts.map +1 -1
  38. package/dist/providers/transaction-request/upgrade-transaction-request.d.ts +87 -0
  39. package/dist/providers/transaction-request/upgrade-transaction-request.d.ts.map +1 -0
  40. package/dist/providers/transaction-request/upload-transaction-request.d.ts +82 -0
  41. package/dist/providers/transaction-request/upload-transaction-request.d.ts.map +1 -0
  42. package/dist/providers/transaction-request/utils.d.ts +6 -0
  43. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  44. package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
  45. package/dist/providers/transaction-summary/input.d.ts.map +1 -1
  46. package/dist/providers/transaction-summary/operations.d.ts.map +1 -1
  47. package/dist/providers/transaction-summary/output.d.ts.map +1 -1
  48. package/dist/providers/transaction-summary/receipt.d.ts.map +1 -1
  49. package/dist/providers/utils/extract-tx-error.d.ts.map +1 -1
  50. package/dist/providers/utils/gas.d.ts +16 -0
  51. package/dist/providers/utils/gas.d.ts.map +1 -1
  52. package/dist/providers/utils/receipts.d.ts.map +1 -1
  53. package/dist/test-utils/launchNode.d.ts.map +1 -1
  54. package/dist/test-utils/resources.d.ts.map +1 -1
  55. package/dist/test-utils/transactionRequest.d.ts.map +1 -1
  56. package/dist/test-utils.global.js +1614 -963
  57. package/dist/test-utils.global.js.map +1 -1
  58. package/dist/test-utils.js +1219 -332
  59. package/dist/test-utils.js.map +1 -1
  60. package/dist/test-utils.mjs +1161 -271
  61. package/dist/test-utils.mjs.map +1 -1
  62. package/dist/wallet-manager/wallet-manager.d.ts +0 -1
  63. package/dist/wallet-manager/wallet-manager.d.ts.map +1 -1
  64. package/package.json +18 -17
@@ -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"));
@@ -2076,6 +2076,39 @@ function calculateMetadataGasForTxBlob({
2076
2076
  const blobLen = resolveGasDependentCosts(witnessBytesSize, gasCosts.s256);
2077
2077
  return txId.add(blobLen);
2078
2078
  }
2079
+ function calculateMetadataGasForTxUpgrade({
2080
+ gasCosts,
2081
+ txBytesSize,
2082
+ consensusSize
2083
+ }) {
2084
+ const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
2085
+ if (consensusSize) {
2086
+ const consensusLen = resolveGasDependentCosts(consensusSize, gasCosts.s256);
2087
+ txId.add(consensusLen);
2088
+ }
2089
+ return txId;
2090
+ }
2091
+ function calculateMetadataGasForTxUpload({
2092
+ gasCosts,
2093
+ txBytesSize,
2094
+ subsectionSize,
2095
+ subsectionsSize
2096
+ }) {
2097
+ const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
2098
+ const subsectionLen = resolveGasDependentCosts(subsectionSize, gasCosts.s256);
2099
+ txId.add(subsectionLen);
2100
+ const subsectionsLen = resolveGasDependentCosts(subsectionsSize, gasCosts.stateRoot);
2101
+ txId.add(subsectionsLen);
2102
+ return txId;
2103
+ }
2104
+ function calculateMinGasForTxUpload({
2105
+ gasCosts,
2106
+ baseMinGas,
2107
+ subsectionSize
2108
+ }) {
2109
+ const additionalStoragePerByte = (0, import_math6.bn)(gasCosts.newStoragePerByte).mul(subsectionSize);
2110
+ return (0, import_math6.bn)(baseMinGas).add(additionalStoragePerByte);
2111
+ }
2079
2112
  var calculateGasFee = (params) => {
2080
2113
  const { gas, gasPrice, priceFactor, tip } = params;
2081
2114
  return gas.mul(gasPrice).div(priceFactor).add((0, import_math6.bn)(tip));
@@ -3218,50 +3251,313 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
3218
3251
  }
3219
3252
  };
3220
3253
 
3221
- // src/providers/transaction-request/utils.ts
3254
+ // src/providers/transaction-request/upgrade-transaction-request.ts
3222
3255
  var import_errors11 = require("@fuel-ts/errors");
3256
+ var import_hasher3 = require("@fuel-ts/hasher");
3223
3257
  var import_transactions11 = require("@fuel-ts/transactions");
3258
+ var import_utils19 = require("@fuel-ts/utils");
3259
+ var import_ramda6 = require("ramda");
3260
+ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3261
+ static from(obj) {
3262
+ if (obj instanceof UpgradeTransactionRequest) {
3263
+ return obj;
3264
+ }
3265
+ return new this((0, import_ramda6.clone)(obj));
3266
+ }
3267
+ /** The type of transaction */
3268
+ type = import_transactions11.TransactionType.Upgrade;
3269
+ /** The upgrade purpose */
3270
+ upgradePurpose;
3271
+ /** Witness index of consensus */
3272
+ bytecodeWitnessIndex;
3273
+ /**
3274
+ * Creates an instance `UpgradeTransactionRequest`.
3275
+ *
3276
+ * @param upgradeTransactionRequestLike - The initial values for the instance
3277
+ */
3278
+ constructor({
3279
+ upgradePurpose,
3280
+ bytecodeWitnessIndex,
3281
+ ...rest
3282
+ } = {}) {
3283
+ super(rest);
3284
+ this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
3285
+ this.upgradePurpose = upgradePurpose ?? {
3286
+ type: import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters,
3287
+ checksum: "0x"
3288
+ };
3289
+ }
3290
+ /**
3291
+ * Adds a consensus parameters upgrade purpose.
3292
+ *
3293
+ * @param consensus - The consensus bytecode.
3294
+ *
3295
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3296
+ */
3297
+ addConsensusParametersUpgradePurpose(consensus) {
3298
+ this.bytecodeWitnessIndex = this.addWitness(consensus);
3299
+ this.upgradePurpose = {
3300
+ type: import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters,
3301
+ checksum: (0, import_hasher3.hash)(consensus)
3302
+ };
3303
+ return this;
3304
+ }
3305
+ /**
3306
+ * Adds a state transition upgrade purpose.
3307
+ *
3308
+ * @param bytecodeRoot - The Merkle root of the state transition.
3309
+ *
3310
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3311
+ */
3312
+ addStateTransitionUpgradePurpose(bytecodeRoot) {
3313
+ this.upgradePurpose = {
3314
+ type: import_transactions11.UpgradePurposeTypeEnum.StateTransition,
3315
+ data: (0, import_utils19.hexlify)(bytecodeRoot)
3316
+ };
3317
+ return this;
3318
+ }
3319
+ /**
3320
+ * Adds an upgrade purpose.
3321
+ *
3322
+ * @param type - The upgrade purpose type.
3323
+ * @param data - The bytecode or merkle root of upgrade purpose
3324
+ *
3325
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3326
+ */
3327
+ addUpgradePurpose(type, data) {
3328
+ if (type === import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters) {
3329
+ this.addConsensusParametersUpgradePurpose(data);
3330
+ }
3331
+ if (type === import_transactions11.UpgradePurposeTypeEnum.StateTransition) {
3332
+ this.addStateTransitionUpgradePurpose(data);
3333
+ }
3334
+ return this;
3335
+ }
3336
+ /**
3337
+ * Converts the transaction request to a `TransactionUpgrade`.
3338
+ *
3339
+ * @returns The transaction create object.
3340
+ */
3341
+ toTransaction() {
3342
+ let upgradePurpose;
3343
+ if (this.upgradePurpose.type === import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters) {
3344
+ upgradePurpose = {
3345
+ type: import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters,
3346
+ data: {
3347
+ witnessIndex: this.bytecodeWitnessIndex,
3348
+ checksum: this.upgradePurpose.checksum
3349
+ }
3350
+ };
3351
+ } else if (this.upgradePurpose.type === import_transactions11.UpgradePurposeTypeEnum.StateTransition) {
3352
+ upgradePurpose = {
3353
+ type: import_transactions11.UpgradePurposeTypeEnum.StateTransition,
3354
+ data: {
3355
+ bytecodeRoot: (0, import_utils19.hexlify)(this.upgradePurpose.data)
3356
+ }
3357
+ };
3358
+ } else {
3359
+ throw new import_errors11.FuelError(import_errors11.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3360
+ }
3361
+ return {
3362
+ type: import_transactions11.TransactionType.Upgrade,
3363
+ ...super.getBaseTransaction(),
3364
+ upgradePurpose
3365
+ };
3366
+ }
3367
+ /**
3368
+ * Gets the Transaction ID by hashing the transaction
3369
+ *
3370
+ * @param chainId - The chain ID.
3371
+ *
3372
+ * @returns - A hash of the transaction, which is the transaction ID.
3373
+ */
3374
+ getTransactionId(chainId) {
3375
+ return hashTransaction(this, chainId);
3376
+ }
3377
+ /**
3378
+ * Calculates the metadata gas cost for an upgrade transaction.
3379
+ *
3380
+ * @param gasCosts - gas costs passed from the chain.
3381
+ *
3382
+ * @returns metadata gas cost for the upgrade transaction.
3383
+ */
3384
+ metadataGas(gasCosts) {
3385
+ const txBytesSize = this.byteSize();
3386
+ if (this.upgradePurpose.type === import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters) {
3387
+ const witnessIndex = this.bytecodeWitnessIndex;
3388
+ const consensusSize = this.witnesses[witnessIndex].length;
3389
+ return calculateMetadataGasForTxUpgrade({
3390
+ gasCosts,
3391
+ txBytesSize,
3392
+ consensusSize
3393
+ });
3394
+ }
3395
+ if (this.upgradePurpose.type === import_transactions11.UpgradePurposeTypeEnum.StateTransition) {
3396
+ return calculateMetadataGasForTxUpgrade({
3397
+ gasCosts,
3398
+ txBytesSize
3399
+ });
3400
+ }
3401
+ throw new import_errors11.FuelError(import_errors11.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3402
+ }
3403
+ };
3404
+
3405
+ // src/providers/transaction-request/upload-transaction-request.ts
3406
+ var import_configs10 = require("@fuel-ts/address/configs");
3407
+ var import_transactions12 = require("@fuel-ts/transactions");
3408
+ var import_utils21 = require("@fuel-ts/utils");
3409
+ var import_ramda7 = require("ramda");
3410
+ var UploadTransactionRequest = class extends BaseTransactionRequest {
3411
+ static from(obj) {
3412
+ if (obj instanceof UploadTransactionRequest) {
3413
+ return obj;
3414
+ }
3415
+ return new this((0, import_ramda7.clone)(obj));
3416
+ }
3417
+ /** Type of the transaction */
3418
+ type = import_transactions12.TransactionType.Upload;
3419
+ /** The witness index of the subsection of the bytecode. */
3420
+ witnessIndex;
3421
+ /** The subsection data. */
3422
+ subsection;
3423
+ /**
3424
+ * Creates an instance `UploadTransactionRequest`.
3425
+ *
3426
+ * @param uploadTransactionRequestLike - The initial values for the instance
3427
+ */
3428
+ constructor({ witnessIndex, subsection, ...rest } = {}) {
3429
+ super(rest);
3430
+ this.witnessIndex = witnessIndex ?? 0;
3431
+ this.subsection = subsection ?? {
3432
+ proofSet: [],
3433
+ root: import_configs10.ZeroBytes32,
3434
+ subsectionIndex: 0,
3435
+ subsectionsNumber: 0
3436
+ };
3437
+ }
3438
+ /**
3439
+ * Adds the subsection.
3440
+ *
3441
+ * @param subsection - The subsection data.
3442
+ */
3443
+ addSubsection(subsection) {
3444
+ const { subsection: subsectionBytecode, ...rest } = subsection;
3445
+ this.subsection = rest;
3446
+ this.witnessIndex = this.addWitness(subsectionBytecode);
3447
+ }
3448
+ /**
3449
+ * Gets the Transaction Request by hashing the transaction.
3450
+ *
3451
+ * @param chainId - The chain ID.
3452
+ *
3453
+ * @returns - A hash of the transaction, which is the transaction ID.
3454
+ */
3455
+ getTransactionId(chainId) {
3456
+ return hashTransaction(this, chainId);
3457
+ }
3458
+ /**
3459
+ * Converts the transaction request to a `TransactionUpload`.
3460
+ *
3461
+ * @returns The transaction create object.
3462
+ */
3463
+ toTransaction() {
3464
+ const baseTransaction = this.getBaseTransaction();
3465
+ const { subsectionIndex, subsectionsNumber, root, proofSet } = this.subsection;
3466
+ return {
3467
+ type: import_transactions12.TransactionType.Upload,
3468
+ ...baseTransaction,
3469
+ subsectionIndex,
3470
+ subsectionsNumber,
3471
+ root: (0, import_utils21.hexlify)(root),
3472
+ proofSet: proofSet.map(import_utils21.hexlify),
3473
+ witnessIndex: this.witnessIndex,
3474
+ proofSetCount: proofSet.length
3475
+ };
3476
+ }
3477
+ /**
3478
+ * Calculates the metadata gas cost for an upload transaction.
3479
+ *
3480
+ * @param gasCosts - gas costs passed from the chain.
3481
+ *
3482
+ * @returns metadata gas cost for the upload transaction.
3483
+ */
3484
+ metadataGas(gasCosts) {
3485
+ return calculateMetadataGasForTxUpload({
3486
+ gasCosts,
3487
+ txBytesSize: this.byteSize(),
3488
+ subsectionSize: (0, import_utils21.arrayify)(this.witnesses[this.witnessIndex]).length,
3489
+ subsectionsSize: this.subsection.subsectionsNumber
3490
+ });
3491
+ }
3492
+ /**
3493
+ * Calculates the minimum gas for an upload transaction.
3494
+ *
3495
+ * @param chainInfo - The chain information.
3496
+ *
3497
+ * @returns the minimum gas for the upload transaction
3498
+ */
3499
+ calculateMinGas(chainInfo) {
3500
+ const minGas = super.calculateMinGas(chainInfo);
3501
+ const { gasCosts } = chainInfo.consensusParameters;
3502
+ const bytecode = this.witnesses[this.witnessIndex] ?? import_configs10.ZeroBytes32;
3503
+ return calculateMinGasForTxUpload({
3504
+ gasCosts,
3505
+ baseMinGas: minGas.toNumber(),
3506
+ subsectionSize: (0, import_utils21.arrayify)(bytecode).length
3507
+ });
3508
+ }
3509
+ };
3510
+
3511
+ // src/providers/transaction-request/utils.ts
3512
+ var import_errors12 = require("@fuel-ts/errors");
3513
+ var import_transactions13 = require("@fuel-ts/transactions");
3224
3514
  var transactionRequestify = (obj) => {
3225
- if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest) {
3515
+ if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
3226
3516
  return obj;
3227
3517
  }
3228
3518
  const { type } = obj;
3229
3519
  switch (obj.type) {
3230
- case import_transactions11.TransactionType.Script: {
3520
+ case import_transactions13.TransactionType.Script: {
3231
3521
  return ScriptTransactionRequest.from(obj);
3232
3522
  }
3233
- case import_transactions11.TransactionType.Create: {
3523
+ case import_transactions13.TransactionType.Create: {
3234
3524
  return CreateTransactionRequest.from(obj);
3235
3525
  }
3236
- case import_transactions11.TransactionType.Blob: {
3526
+ case import_transactions13.TransactionType.Blob: {
3237
3527
  return BlobTransactionRequest.from(obj);
3238
3528
  }
3529
+ case import_transactions13.TransactionType.Upgrade: {
3530
+ return UpgradeTransactionRequest.from(obj);
3531
+ }
3532
+ case import_transactions13.TransactionType.Upload: {
3533
+ return UploadTransactionRequest.from(obj);
3534
+ }
3239
3535
  default: {
3240
- throw new import_errors11.FuelError(
3241
- import_errors11.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3536
+ throw new import_errors12.FuelError(
3537
+ import_errors12.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3242
3538
  `Unsupported transaction type: ${type}.`
3243
3539
  );
3244
3540
  }
3245
3541
  }
3246
3542
  };
3247
- var isTransactionTypeScript = (request) => request.type === import_transactions11.TransactionType.Script;
3248
- var isTransactionTypeCreate = (request) => request.type === import_transactions11.TransactionType.Create;
3543
+ var isTransactionTypeScript = (request) => request.type === import_transactions13.TransactionType.Script;
3544
+ var isTransactionTypeCreate = (request) => request.type === import_transactions13.TransactionType.Create;
3249
3545
 
3250
3546
  // src/providers/transaction-response/transaction-response.ts
3251
- var import_errors15 = require("@fuel-ts/errors");
3547
+ var import_errors16 = require("@fuel-ts/errors");
3252
3548
  var import_math18 = require("@fuel-ts/math");
3253
- var import_transactions19 = require("@fuel-ts/transactions");
3254
- var import_utils23 = require("@fuel-ts/utils");
3549
+ var import_transactions21 = require("@fuel-ts/transactions");
3550
+ var import_utils27 = require("@fuel-ts/utils");
3255
3551
 
3256
3552
  // src/providers/transaction-summary/assemble-transaction-summary.ts
3257
3553
  var import_math17 = require("@fuel-ts/math");
3258
- var import_transactions17 = require("@fuel-ts/transactions");
3259
- var import_utils21 = require("@fuel-ts/utils");
3554
+ var import_transactions19 = require("@fuel-ts/transactions");
3555
+ var import_utils25 = require("@fuel-ts/utils");
3260
3556
 
3261
3557
  // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
3262
3558
  var import_math13 = require("@fuel-ts/math");
3263
- var import_transactions12 = require("@fuel-ts/transactions");
3264
- var import_utils19 = require("@fuel-ts/utils");
3559
+ var import_transactions14 = require("@fuel-ts/transactions");
3560
+ var import_utils23 = require("@fuel-ts/utils");
3265
3561
  var calculateTXFeeForSummary = (params) => {
3266
3562
  const {
3267
3563
  gasPrice,
@@ -3275,17 +3571,17 @@ var calculateTXFeeForSummary = (params) => {
3275
3571
  }
3276
3572
  const gasPerByte = (0, import_math13.bn)(feeParams.gasPerByte);
3277
3573
  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);
3574
+ const transactionBytes = (0, import_utils23.arrayify)(rawPayload);
3575
+ const [transaction] = new import_transactions14.TransactionCoder().decode(transactionBytes, 0);
3280
3576
  const { type, witnesses, inputs, policies } = transaction;
3281
3577
  let metadataGas = (0, import_math13.bn)(0);
3282
3578
  let gasLimit = (0, import_math13.bn)(0);
3283
- if (type !== import_transactions12.TransactionType.Create && type !== import_transactions12.TransactionType.Script) {
3579
+ if (type !== import_transactions14.TransactionType.Create && type !== import_transactions14.TransactionType.Script) {
3284
3580
  return (0, import_math13.bn)(0);
3285
3581
  }
3286
- if (type === import_transactions12.TransactionType.Create) {
3582
+ if (type === import_transactions14.TransactionType.Create) {
3287
3583
  const { bytecodeWitnessIndex, storageSlots } = transaction;
3288
- const contractBytesSize = (0, import_math13.bn)((0, import_utils19.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
3584
+ const contractBytesSize = (0, import_math13.bn)((0, import_utils23.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
3289
3585
  metadataGas = calculateMetadataGasForTxCreate({
3290
3586
  contractBytesSize,
3291
3587
  gasCosts,
@@ -3309,7 +3605,7 @@ var calculateTXFeeForSummary = (params) => {
3309
3605
  metadataGas,
3310
3606
  txBytesSize: transactionBytes.length
3311
3607
  });
3312
- const witnessLimit = policies.find((policy) => policy.type === import_transactions12.PolicyType.WitnessLimit)?.data;
3608
+ const witnessLimit = policies.find((policy) => policy.type === import_transactions14.PolicyType.WitnessLimit)?.data;
3313
3609
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
3314
3610
  const maxGas = getMaxGas({
3315
3611
  gasPerByte,
@@ -3329,10 +3625,10 @@ var calculateTXFeeForSummary = (params) => {
3329
3625
  };
3330
3626
 
3331
3627
  // src/providers/transaction-summary/operations.ts
3332
- var import_configs10 = require("@fuel-ts/address/configs");
3333
- var import_errors13 = require("@fuel-ts/errors");
3628
+ var import_configs11 = require("@fuel-ts/address/configs");
3629
+ var import_errors14 = require("@fuel-ts/errors");
3334
3630
  var import_math15 = require("@fuel-ts/math");
3335
- var import_transactions15 = require("@fuel-ts/transactions");
3631
+ var import_transactions17 = require("@fuel-ts/transactions");
3336
3632
 
3337
3633
  // src/providers/transaction-summary/call.ts
3338
3634
  var import_abi_coder5 = require("@fuel-ts/abi-coder");
@@ -3368,9 +3664,9 @@ var getFunctionCall = ({ abi, receipt }) => {
3368
3664
  };
3369
3665
 
3370
3666
  // src/providers/transaction-summary/input.ts
3371
- var import_errors12 = require("@fuel-ts/errors");
3667
+ var import_errors13 = require("@fuel-ts/errors");
3372
3668
  var import_math14 = require("@fuel-ts/math");
3373
- var import_transactions13 = require("@fuel-ts/transactions");
3669
+ var import_transactions15 = require("@fuel-ts/transactions");
3374
3670
  function getInputsByTypes(inputs, types) {
3375
3671
  return inputs.filter((i) => types.includes(i.type));
3376
3672
  }
@@ -3378,19 +3674,19 @@ function getInputsByType(inputs, type) {
3378
3674
  return inputs.filter((i) => i.type === type);
3379
3675
  }
3380
3676
  function getInputsCoin(inputs) {
3381
- return getInputsByType(inputs, import_transactions13.InputType.Coin);
3677
+ return getInputsByType(inputs, import_transactions15.InputType.Coin);
3382
3678
  }
3383
3679
  function getInputsMessage(inputs) {
3384
- return getInputsByType(inputs, import_transactions13.InputType.Message);
3680
+ return getInputsByType(inputs, import_transactions15.InputType.Message);
3385
3681
  }
3386
3682
  function getInputsCoinAndMessage(inputs) {
3387
- return getInputsByTypes(inputs, [import_transactions13.InputType.Coin, import_transactions13.InputType.Message]);
3683
+ return getInputsByTypes(inputs, [import_transactions15.InputType.Coin, import_transactions15.InputType.Message]);
3388
3684
  }
3389
3685
  function isInputCoin(input) {
3390
- return input.type === import_transactions13.InputType.Coin;
3686
+ return input.type === import_transactions15.InputType.Coin;
3391
3687
  }
3392
3688
  function getInputsContract(inputs) {
3393
- return getInputsByType(inputs, import_transactions13.InputType.Contract);
3689
+ return getInputsByType(inputs, import_transactions15.InputType.Contract);
3394
3690
  }
3395
3691
  function findCoinInput(inputs, assetId) {
3396
3692
  const coinInputs = getInputsCoin(inputs);
@@ -3436,40 +3732,40 @@ function getInputContractFromIndex(inputs, inputIndex) {
3436
3732
  if (!contractInput) {
3437
3733
  return void 0;
3438
3734
  }
3439
- if (contractInput.type !== import_transactions13.InputType.Contract) {
3440
- throw new import_errors12.FuelError(
3441
- import_errors12.ErrorCode.INVALID_TRANSACTION_INPUT,
3735
+ if (contractInput.type !== import_transactions15.InputType.Contract) {
3736
+ throw new import_errors13.FuelError(
3737
+ import_errors13.ErrorCode.INVALID_TRANSACTION_INPUT,
3442
3738
  `Contract input should be of type 'contract'.`
3443
3739
  );
3444
3740
  }
3445
3741
  return contractInput;
3446
3742
  }
3447
3743
  function getInputAccountAddress(input) {
3448
- if (input.type === import_transactions13.InputType.Coin) {
3744
+ if (input.type === import_transactions15.InputType.Coin) {
3449
3745
  return input.owner.toString();
3450
3746
  }
3451
- if (input.type === import_transactions13.InputType.Message) {
3747
+ if (input.type === import_transactions15.InputType.Message) {
3452
3748
  return input.recipient.toString();
3453
3749
  }
3454
3750
  return "";
3455
3751
  }
3456
3752
 
3457
3753
  // src/providers/transaction-summary/output.ts
3458
- var import_transactions14 = require("@fuel-ts/transactions");
3754
+ var import_transactions16 = require("@fuel-ts/transactions");
3459
3755
  function getOutputsByType(outputs, type) {
3460
3756
  return outputs.filter((o) => o.type === type);
3461
3757
  }
3462
3758
  function getOutputsContractCreated(outputs) {
3463
- return getOutputsByType(outputs, import_transactions14.OutputType.ContractCreated);
3759
+ return getOutputsByType(outputs, import_transactions16.OutputType.ContractCreated);
3464
3760
  }
3465
3761
  function getOutputsCoin(outputs) {
3466
- return getOutputsByType(outputs, import_transactions14.OutputType.Coin);
3762
+ return getOutputsByType(outputs, import_transactions16.OutputType.Coin);
3467
3763
  }
3468
3764
  function getOutputsChange(outputs) {
3469
- return getOutputsByType(outputs, import_transactions14.OutputType.Change);
3765
+ return getOutputsByType(outputs, import_transactions16.OutputType.Change);
3470
3766
  }
3471
3767
  function getOutputsContract(outputs) {
3472
- return getOutputsByType(outputs, import_transactions14.OutputType.Contract);
3768
+ return getOutputsByType(outputs, import_transactions16.OutputType.Contract);
3473
3769
  }
3474
3770
 
3475
3771
  // src/providers/transaction-summary/operations.ts
@@ -3478,17 +3774,21 @@ function getReceiptsByType(receipts, type) {
3478
3774
  }
3479
3775
  function getTransactionTypeName(transactionType) {
3480
3776
  switch (transactionType) {
3481
- case import_transactions15.TransactionType.Mint:
3777
+ case import_transactions17.TransactionType.Mint:
3482
3778
  return "Mint" /* Mint */;
3483
- case import_transactions15.TransactionType.Create:
3779
+ case import_transactions17.TransactionType.Create:
3484
3780
  return "Create" /* Create */;
3485
- case import_transactions15.TransactionType.Script:
3781
+ case import_transactions17.TransactionType.Script:
3486
3782
  return "Script" /* Script */;
3487
- case import_transactions15.TransactionType.Blob:
3783
+ case import_transactions17.TransactionType.Blob:
3488
3784
  return "Blob" /* Blob */;
3785
+ case import_transactions17.TransactionType.Upgrade:
3786
+ return "Upgrade" /* Upgrade */;
3787
+ case import_transactions17.TransactionType.Upload:
3788
+ return "Upload" /* Upload */;
3489
3789
  default:
3490
- throw new import_errors13.FuelError(
3491
- import_errors13.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3790
+ throw new import_errors14.FuelError(
3791
+ import_errors14.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3492
3792
  `Unsupported transaction type: ${transactionType}.`
3493
3793
  );
3494
3794
  }
@@ -3516,10 +3816,10 @@ function isTypeBlob(transactionType) {
3516
3816
  return isType(transactionType, "Blob" /* Blob */);
3517
3817
  }
3518
3818
  function getReceiptsCall(receipts) {
3519
- return getReceiptsByType(receipts, import_transactions15.ReceiptType.Call);
3819
+ return getReceiptsByType(receipts, import_transactions17.ReceiptType.Call);
3520
3820
  }
3521
3821
  function getReceiptsMessageOut(receipts) {
3522
- return getReceiptsByType(receipts, import_transactions15.ReceiptType.MessageOut);
3822
+ return getReceiptsByType(receipts, import_transactions17.ReceiptType.MessageOut);
3523
3823
  }
3524
3824
  function mergeAssets(op1, op2) {
3525
3825
  const assets1 = op1.assetsSent || [];
@@ -3627,7 +3927,7 @@ function getAssetsSent(receipt) {
3627
3927
  ];
3628
3928
  }
3629
3929
  function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload, maxInputs, baseAssetId) {
3630
- const assetId = receipt.assetId === import_configs10.ZeroBytes32 ? baseAssetId : receipt.assetId;
3930
+ const assetId = receipt.assetId === import_configs11.ZeroBytes32 ? baseAssetId : receipt.assetId;
3631
3931
  const input = getInputFromAssetId(inputs, assetId, assetId === baseAssetId);
3632
3932
  if (!input) {
3633
3933
  return [];
@@ -3683,7 +3983,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
3683
3983
  const { to: toAddress, assetId, amount } = receipt;
3684
3984
  let { from: fromAddress } = receipt;
3685
3985
  const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
3686
- if (import_configs10.ZeroBytes32 === fromAddress) {
3986
+ if (import_configs11.ZeroBytes32 === fromAddress) {
3687
3987
  const change = changeOutputs.find((output) => output.assetId === assetId);
3688
3988
  fromAddress = change?.to || fromAddress;
3689
3989
  }
@@ -3748,11 +4048,11 @@ function getTransferOperations({
3748
4048
  });
3749
4049
  const transferReceipts = getReceiptsByType(
3750
4050
  receipts,
3751
- import_transactions15.ReceiptType.Transfer
4051
+ import_transactions17.ReceiptType.Transfer
3752
4052
  );
3753
4053
  const transferOutReceipts = getReceiptsByType(
3754
4054
  receipts,
3755
- import_transactions15.ReceiptType.TransferOut
4055
+ import_transactions17.ReceiptType.TransferOut
3756
4056
  );
3757
4057
  [...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
3758
4058
  const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
@@ -3836,17 +4136,17 @@ function getOperations({
3836
4136
  }
3837
4137
 
3838
4138
  // src/providers/transaction-summary/receipt.ts
3839
- var import_transactions16 = require("@fuel-ts/transactions");
4139
+ var import_transactions18 = require("@fuel-ts/transactions");
3840
4140
  var processGqlReceipt = (gqlReceipt) => {
3841
4141
  const receipt = assembleReceiptByType(gqlReceipt);
3842
4142
  switch (receipt.type) {
3843
- case import_transactions16.ReceiptType.ReturnData: {
4143
+ case import_transactions18.ReceiptType.ReturnData: {
3844
4144
  return {
3845
4145
  ...receipt,
3846
4146
  data: gqlReceipt.data || "0x"
3847
4147
  };
3848
4148
  }
3849
- case import_transactions16.ReceiptType.LogData: {
4149
+ case import_transactions18.ReceiptType.LogData: {
3850
4150
  return {
3851
4151
  ...receipt,
3852
4152
  data: gqlReceipt.data || "0x"
@@ -3859,7 +4159,7 @@ var processGqlReceipt = (gqlReceipt) => {
3859
4159
  var extractMintedAssetsFromReceipts = (receipts) => {
3860
4160
  const mintedAssets = [];
3861
4161
  receipts.forEach((receipt) => {
3862
- if (receipt.type === import_transactions16.ReceiptType.Mint) {
4162
+ if (receipt.type === import_transactions18.ReceiptType.Mint) {
3863
4163
  mintedAssets.push({
3864
4164
  subId: receipt.subId,
3865
4165
  contractId: receipt.contractId,
@@ -3873,7 +4173,7 @@ var extractMintedAssetsFromReceipts = (receipts) => {
3873
4173
  var extractBurnedAssetsFromReceipts = (receipts) => {
3874
4174
  const burnedAssets = [];
3875
4175
  receipts.forEach((receipt) => {
3876
- if (receipt.type === import_transactions16.ReceiptType.Burn) {
4176
+ if (receipt.type === import_transactions18.ReceiptType.Burn) {
3877
4177
  burnedAssets.push({
3878
4178
  subId: receipt.subId,
3879
4179
  contractId: receipt.contractId,
@@ -3886,7 +4186,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3886
4186
  };
3887
4187
 
3888
4188
  // src/providers/transaction-summary/status.ts
3889
- var import_errors14 = require("@fuel-ts/errors");
4189
+ var import_errors15 = require("@fuel-ts/errors");
3890
4190
  var import_math16 = require("@fuel-ts/math");
3891
4191
  var getTransactionStatusName = (gqlStatus) => {
3892
4192
  switch (gqlStatus) {
@@ -3899,8 +4199,8 @@ var getTransactionStatusName = (gqlStatus) => {
3899
4199
  case "SqueezedOutStatus":
3900
4200
  return "squeezedout" /* squeezedout */;
3901
4201
  default:
3902
- throw new import_errors14.FuelError(
3903
- import_errors14.ErrorCode.INVALID_TRANSACTION_STATUS,
4202
+ throw new import_errors15.FuelError(
4203
+ import_errors15.ErrorCode.INVALID_TRANSACTION_STATUS,
3904
4204
  `Invalid transaction status: ${gqlStatus}.`
3905
4205
  );
3906
4206
  }
@@ -3969,7 +4269,7 @@ function assembleTransactionSummary(params) {
3969
4269
  baseAssetId
3970
4270
  } = params;
3971
4271
  const gasUsed = getGasUsedFromReceipts(receipts);
3972
- const rawPayload = (0, import_utils21.hexlify)(transactionBytes);
4272
+ const rawPayload = (0, import_utils25.hexlify)(transactionBytes);
3973
4273
  const operations = getOperations({
3974
4274
  transactionType: transaction.type,
3975
4275
  inputs: transaction.inputs || [],
@@ -3981,7 +4281,7 @@ function assembleTransactionSummary(params) {
3981
4281
  baseAssetId
3982
4282
  });
3983
4283
  const typeName = getTransactionTypeName(transaction.type);
3984
- const tip = (0, import_math17.bn)(transaction.policies?.find((policy) => policy.type === import_transactions17.PolicyType.Tip)?.data);
4284
+ const tip = (0, import_math17.bn)(transaction.policies?.find((policy) => policy.type === import_transactions19.PolicyType.Tip)?.data);
3985
4285
  const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3986
4286
  const fee = calculateTXFeeForSummary({
3987
4287
  totalFee,
@@ -4001,7 +4301,7 @@ function assembleTransactionSummary(params) {
4001
4301
  const burnedAssets = extractBurnedAssetsFromReceipts(receipts);
4002
4302
  let date;
4003
4303
  if (time) {
4004
- date = import_utils21.DateTime.fromTai64(time);
4304
+ date = import_utils25.DateTime.fromTai64(time);
4005
4305
  }
4006
4306
  const transactionSummary = {
4007
4307
  id,
@@ -4033,12 +4333,12 @@ function assembleTransactionSummary(params) {
4033
4333
 
4034
4334
  // src/providers/transaction-response/getDecodedLogs.ts
4035
4335
  var import_abi_coder6 = require("@fuel-ts/abi-coder");
4036
- var import_transactions18 = require("@fuel-ts/transactions");
4336
+ var import_transactions20 = require("@fuel-ts/transactions");
4037
4337
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
4038
4338
  return receipts.reduce((logs, receipt) => {
4039
- if (receipt.type === import_transactions18.ReceiptType.LogData || receipt.type === import_transactions18.ReceiptType.Log) {
4339
+ if (receipt.type === import_transactions20.ReceiptType.LogData || receipt.type === import_transactions20.ReceiptType.Log) {
4040
4340
  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;
4341
+ const data = receipt.type === import_transactions20.ReceiptType.Log ? new import_abi_coder6.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
4042
4342
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toString());
4043
4343
  logs.push(decodedLog);
4044
4344
  }
@@ -4052,28 +4352,28 @@ function mapGqlOutputsToTxOutputs(outputs) {
4052
4352
  const obj = "amount" in o ? { ...o, amount: (0, import_math18.bn)(o.amount) } : o;
4053
4353
  switch (obj.type) {
4054
4354
  case "CoinOutput":
4055
- return { ...obj, type: import_transactions19.OutputType.Coin };
4355
+ return { ...obj, type: import_transactions21.OutputType.Coin };
4056
4356
  case "ContractOutput":
4057
4357
  return {
4058
4358
  ...obj,
4059
- type: import_transactions19.OutputType.Contract,
4359
+ type: import_transactions21.OutputType.Contract,
4060
4360
  inputIndex: parseInt(obj.inputIndex, 10)
4061
4361
  };
4062
4362
  case "ChangeOutput":
4063
4363
  return {
4064
4364
  ...obj,
4065
- type: import_transactions19.OutputType.Change
4365
+ type: import_transactions21.OutputType.Change
4066
4366
  };
4067
4367
  case "VariableOutput":
4068
- return { ...obj, type: import_transactions19.OutputType.Variable };
4368
+ return { ...obj, type: import_transactions21.OutputType.Variable };
4069
4369
  case "ContractCreated":
4070
4370
  return {
4071
4371
  ...obj,
4072
- type: import_transactions19.OutputType.ContractCreated,
4372
+ type: import_transactions21.OutputType.ContractCreated,
4073
4373
  contractId: obj.contract
4074
4374
  };
4075
4375
  default:
4076
- return (0, import_utils23.assertUnreachable)(obj);
4376
+ return (0, import_utils27.assertUnreachable)(obj);
4077
4377
  }
4078
4378
  });
4079
4379
  }
@@ -4127,7 +4427,7 @@ var TransactionResponse = class {
4127
4427
  const correspondingInput = status.transaction.inputs?.[idx];
4128
4428
  return {
4129
4429
  ...input,
4130
- txPointer: import_transactions19.TxPointerCoder.decodeFromGqlScalar(correspondingInput.txPointer)
4430
+ txPointer: import_transactions21.TxPointerCoder.decodeFromGqlScalar(correspondingInput.txPointer)
4131
4431
  };
4132
4432
  }
4133
4433
  return input;
@@ -4150,7 +4450,7 @@ var TransactionResponse = class {
4150
4450
  const gqlTransaction = this.gqlTransaction ?? await this.fetch();
4151
4451
  return {
4152
4452
  tx: this.decodeTransaction(gqlTransaction),
4153
- bytes: (0, import_utils23.arrayify)(gqlTransaction.rawPayload)
4453
+ bytes: (0, import_utils27.arrayify)(gqlTransaction.rawPayload)
4154
4454
  };
4155
4455
  }
4156
4456
  getReceipts() {
@@ -4194,8 +4494,8 @@ var TransactionResponse = class {
4194
4494
  * @returns The decoded transaction.
4195
4495
  */
4196
4496
  decodeTransaction(transactionWithReceipts) {
4197
- return new import_transactions19.TransactionCoder().decode(
4198
- (0, import_utils23.arrayify)(transactionWithReceipts.rawPayload),
4497
+ return new import_transactions21.TransactionCoder().decode(
4498
+ (0, import_utils27.arrayify)(transactionWithReceipts.rawPayload),
4199
4499
  0
4200
4500
  )?.[0];
4201
4501
  }
@@ -4242,8 +4542,8 @@ var TransactionResponse = class {
4242
4542
  this.status = statusChange;
4243
4543
  if (statusChange.type === "SqueezedOutStatus") {
4244
4544
  this.unsetResourceCache();
4245
- throw new import_errors15.FuelError(
4246
- import_errors15.ErrorCode.TRANSACTION_SQUEEZED_OUT,
4545
+ throw new import_errors16.FuelError(
4546
+ import_errors16.ErrorCode.TRANSACTION_SQUEEZED_OUT,
4247
4547
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
4248
4548
  );
4249
4549
  }
@@ -4314,7 +4614,7 @@ var TransactionResponse = class {
4314
4614
  };
4315
4615
 
4316
4616
  // src/providers/utils/auto-retry-fetch.ts
4317
- var import_utils25 = require("@fuel-ts/utils");
4617
+ var import_utils29 = require("@fuel-ts/utils");
4318
4618
  function getWaitDelay(options, retryAttemptNum) {
4319
4619
  const duration = options.baseDelay ?? 150;
4320
4620
  switch (options.backoff) {
@@ -4344,25 +4644,25 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
4344
4644
  throw error;
4345
4645
  }
4346
4646
  const delay = getWaitDelay(options, retryNum);
4347
- await (0, import_utils25.sleep)(delay);
4647
+ await (0, import_utils29.sleep)(delay);
4348
4648
  return autoRetryFetch(fetchFn, options, retryNum)(...args);
4349
4649
  }
4350
4650
  };
4351
4651
  }
4352
4652
 
4353
4653
  // src/providers/utils/handle-gql-error-message.ts
4354
- var import_errors16 = require("@fuel-ts/errors");
4654
+ var import_errors17 = require("@fuel-ts/errors");
4355
4655
  var handleGqlErrorMessage = (errorMessage, rawError) => {
4356
4656
  switch (errorMessage) {
4357
4657
  case "not enough coins to fit the target" /* NOT_ENOUGH_COINS */:
4358
- throw new import_errors16.FuelError(
4359
- import_errors16.ErrorCode.NOT_ENOUGH_FUNDS,
4658
+ throw new import_errors17.FuelError(
4659
+ import_errors17.ErrorCode.NOT_ENOUGH_FUNDS,
4360
4660
  `The account(s) sending the transaction don't have enough funds to cover the transaction.`,
4361
4661
  {},
4362
4662
  rawError
4363
4663
  );
4364
4664
  default:
4365
- throw new import_errors16.FuelError(import_errors16.ErrorCode.INVALID_REQUEST, errorMessage);
4665
+ throw new import_errors17.FuelError(import_errors17.ErrorCode.INVALID_REQUEST, errorMessage);
4366
4666
  }
4367
4667
  };
4368
4668
 
@@ -4444,24 +4744,34 @@ var _Provider = class {
4444
4744
  * @hidden
4445
4745
  */
4446
4746
  constructor(url, options = {}) {
4447
- this.url = url;
4448
4747
  /**
4449
4748
  * @hidden
4450
4749
  */
4451
4750
  __privateAdd(this, _cacheInputs);
4452
4751
  __publicField(this, "operations");
4453
4752
  __publicField(this, "cache");
4753
+ /** @hidden */
4754
+ __publicField(this, "url");
4755
+ /** @hidden */
4756
+ __publicField(this, "urlWithoutAuth");
4454
4757
  __publicField(this, "options", {
4455
4758
  timeout: void 0,
4456
4759
  resourceCacheTTL: void 0,
4457
4760
  fetch: void 0,
4458
- retryOptions: void 0
4761
+ retryOptions: void 0,
4762
+ headers: void 0
4459
4763
  });
4764
+ const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
4765
+ this.url = rawUrl;
4766
+ this.urlWithoutAuth = urlWithoutAuth;
4460
4767
  this.options = { ...this.options, ...options };
4461
4768
  this.url = url;
4769
+ if (headers) {
4770
+ this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
4771
+ }
4462
4772
  this.operations = this.createOperations();
4463
4773
  const { resourceCacheTTL } = this.options;
4464
- if ((0, import_utils26.isDefined)(resourceCacheTTL)) {
4774
+ if ((0, import_utils30.isDefined)(resourceCacheTTL)) {
4465
4775
  if (resourceCacheTTL !== -1) {
4466
4776
  this.cache = new ResourceCache(resourceCacheTTL);
4467
4777
  } else {
@@ -4480,12 +4790,16 @@ var _Provider = class {
4480
4790
  * @hidden
4481
4791
  */
4482
4792
  static getFetchFn(options) {
4483
- const { retryOptions, timeout } = options;
4793
+ const { retryOptions, timeout, headers } = options;
4484
4794
  return autoRetryFetch(async (...args) => {
4485
4795
  const url = args[0];
4486
4796
  const request = args[1];
4487
4797
  const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
4488
- let fullRequest = { ...request, signal };
4798
+ let fullRequest = {
4799
+ ...request,
4800
+ signal,
4801
+ headers: { ...request?.headers, ...headers }
4802
+ };
4489
4803
  if (options.requestMiddleware) {
4490
4804
  fullRequest = await options.requestMiddleware(fullRequest);
4491
4805
  }
@@ -4493,15 +4807,23 @@ var _Provider = class {
4493
4807
  }, retryOptions);
4494
4808
  }
4495
4809
  static extractBasicAuth(url) {
4496
- const parsedUrl = new URL(url);
4810
+ let parsedUrl;
4811
+ try {
4812
+ parsedUrl = new URL(url);
4813
+ } catch (error) {
4814
+ throw new import_errors18.FuelError(import_errors18.FuelError.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
4815
+ }
4497
4816
  const username = parsedUrl.username;
4498
4817
  const password = parsedUrl.password;
4499
- const urlNoBasicAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
4818
+ const urlWithoutAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
4500
4819
  if (!(username && password)) {
4501
- return { url, auth: void 0 };
4820
+ return { url, urlWithoutAuth: url, headers: void 0 };
4502
4821
  }
4503
- const auth = `Basic ${btoa(`${username}:${password}`)}`;
4504
- return { url: urlNoBasicAuth, auth };
4822
+ return {
4823
+ url,
4824
+ urlWithoutAuth,
4825
+ headers: { Authorization: `Basic ${btoa(`${username}:${password}`)}` }
4826
+ };
4505
4827
  }
4506
4828
  /**
4507
4829
  * Creates a new instance of the Provider class. This is the recommended way to initialize a Provider.
@@ -4512,17 +4834,7 @@ var _Provider = class {
4512
4834
  * @returns A promise that resolves to a Provider instance.
4513
4835
  */
4514
4836
  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
- });
4837
+ const provider = new _Provider(url, options);
4526
4838
  await provider.fetchChainAndNodeInfo();
4527
4839
  return provider;
4528
4840
  }
@@ -4532,10 +4844,10 @@ var _Provider = class {
4532
4844
  * @returns the chain information configuration.
4533
4845
  */
4534
4846
  getChain() {
4535
- const chain = _Provider.chainInfoCache[this.url];
4847
+ const chain = _Provider.chainInfoCache[this.urlWithoutAuth];
4536
4848
  if (!chain) {
4537
- throw new import_errors17.FuelError(
4538
- import_errors17.ErrorCode.CHAIN_INFO_CACHE_EMPTY,
4849
+ throw new import_errors18.FuelError(
4850
+ import_errors18.ErrorCode.CHAIN_INFO_CACHE_EMPTY,
4539
4851
  "Chain info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
4540
4852
  );
4541
4853
  }
@@ -4547,10 +4859,10 @@ var _Provider = class {
4547
4859
  * @returns the node information configuration.
4548
4860
  */
4549
4861
  getNode() {
4550
- const node = _Provider.nodeInfoCache[this.url];
4862
+ const node = _Provider.nodeInfoCache[this.urlWithoutAuth];
4551
4863
  if (!node) {
4552
- throw new import_errors17.FuelError(
4553
- import_errors17.ErrorCode.NODE_INFO_CACHE_EMPTY,
4864
+ throw new import_errors18.FuelError(
4865
+ import_errors18.ErrorCode.NODE_INFO_CACHE_EMPTY,
4554
4866
  "Node info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
4555
4867
  );
4556
4868
  }
@@ -4581,8 +4893,11 @@ var _Provider = class {
4581
4893
  * @param options - Additional options for the provider.
4582
4894
  */
4583
4895
  async connect(url, options) {
4584
- this.url = url;
4896
+ const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
4897
+ this.url = rawUrl;
4898
+ this.urlWithoutAuth = urlWithoutAuth;
4585
4899
  this.options = options ?? this.options;
4900
+ this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
4586
4901
  this.operations = this.createOperations();
4587
4902
  await this.fetchChainAndNodeInfo();
4588
4903
  }
@@ -4622,7 +4937,7 @@ Supported fuel-core version: ${supportedVersion}.`
4622
4937
  */
4623
4938
  createOperations() {
4624
4939
  const fetchFn = _Provider.getFetchFn(this.options);
4625
- const gqlClient = new import_graphql_request.GraphQLClient(this.url, {
4940
+ const gqlClient = new import_graphql_request.GraphQLClient(this.urlWithoutAuth, {
4626
4941
  fetch: (url, requestInit) => fetchFn(url, requestInit, this.options),
4627
4942
  responseMiddleware: (response) => {
4628
4943
  if ("response" in response) {
@@ -4640,7 +4955,7 @@ Supported fuel-core version: ${supportedVersion}.`
4640
4955
  const isSubscription = opDefinition?.operation === "subscription";
4641
4956
  if (isSubscription) {
4642
4957
  return FuelGraphqlSubscriber.create({
4643
- url: this.url,
4958
+ url: this.urlWithoutAuth,
4644
4959
  query,
4645
4960
  fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
4646
4961
  variables: vars
@@ -4703,7 +5018,7 @@ Supported fuel-core version: ${supportedVersion}.`
4703
5018
  utxoValidation: nodeInfo.utxoValidation,
4704
5019
  vmBacktrace: nodeInfo.vmBacktrace
4705
5020
  };
4706
- _Provider.nodeInfoCache[this.url] = processedNodeInfo;
5021
+ _Provider.nodeInfoCache[this.urlWithoutAuth] = processedNodeInfo;
4707
5022
  return processedNodeInfo;
4708
5023
  }
4709
5024
  /**
@@ -4714,7 +5029,7 @@ Supported fuel-core version: ${supportedVersion}.`
4714
5029
  async fetchChain() {
4715
5030
  const { chain } = await this.operations.getChain();
4716
5031
  const processedChain = processGqlChain(chain);
4717
- _Provider.chainInfoCache[this.url] = processedChain;
5032
+ _Provider.chainInfoCache[this.urlWithoutAuth] = processedChain;
4718
5033
  return processedChain;
4719
5034
  }
4720
5035
  /**
@@ -4742,14 +5057,14 @@ Supported fuel-core version: ${supportedVersion}.`
4742
5057
  validateTransaction(tx, consensusParameters) {
4743
5058
  const { maxOutputs, maxInputs } = consensusParameters.txParameters;
4744
5059
  if ((0, import_math19.bn)(tx.inputs.length).gt(maxInputs)) {
4745
- throw new import_errors17.FuelError(
4746
- import_errors17.ErrorCode.MAX_INPUTS_EXCEEDED,
5060
+ throw new import_errors18.FuelError(
5061
+ import_errors18.ErrorCode.MAX_INPUTS_EXCEEDED,
4747
5062
  "The transaction exceeds the maximum allowed number of inputs."
4748
5063
  );
4749
5064
  }
4750
5065
  if ((0, import_math19.bn)(tx.outputs.length).gt(maxOutputs)) {
4751
- throw new import_errors17.FuelError(
4752
- import_errors17.ErrorCode.MAX_OUTPUTS_EXCEEDED,
5066
+ throw new import_errors18.FuelError(
5067
+ import_errors18.ErrorCode.MAX_OUTPUTS_EXCEEDED,
4753
5068
  "The transaction exceeds the maximum allowed number of outputs."
4754
5069
  );
4755
5070
  }
@@ -4771,7 +5086,7 @@ Supported fuel-core version: ${supportedVersion}.`
4771
5086
  }
4772
5087
  const { consensusParameters } = this.getChain();
4773
5088
  this.validateTransaction(transactionRequest, consensusParameters);
4774
- const encodedTransaction = (0, import_utils26.hexlify)(transactionRequest.toTransactionBytes());
5089
+ const encodedTransaction = (0, import_utils30.hexlify)(transactionRequest.toTransactionBytes());
4775
5090
  let abis;
4776
5091
  if (isTransactionTypeScript(transactionRequest)) {
4777
5092
  abis = transactionRequest.abis;
@@ -4795,7 +5110,7 @@ Supported fuel-core version: ${supportedVersion}.`
4795
5110
  if (estimateTxDependencies) {
4796
5111
  return this.estimateTxDependencies(transactionRequest);
4797
5112
  }
4798
- const encodedTransaction = (0, import_utils26.hexlify)(transactionRequest.toTransactionBytes());
5113
+ const encodedTransaction = (0, import_utils30.hexlify)(transactionRequest.toTransactionBytes());
4799
5114
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4800
5115
  encodedTransactions: encodedTransaction,
4801
5116
  utxoValidation: utxoValidation || false
@@ -4815,13 +5130,13 @@ Supported fuel-core version: ${supportedVersion}.`
4815
5130
  async estimatePredicates(transactionRequest) {
4816
5131
  const shouldEstimatePredicates = Boolean(
4817
5132
  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()
5133
+ (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
5134
  )
4820
5135
  );
4821
5136
  if (!shouldEstimatePredicates) {
4822
5137
  return transactionRequest;
4823
5138
  }
4824
- const encodedTransaction = (0, import_utils26.hexlify)(transactionRequest.toTransactionBytes());
5139
+ const encodedTransaction = (0, import_utils30.hexlify)(transactionRequest.toTransactionBytes());
4825
5140
  const response = await this.operations.estimatePredicates({
4826
5141
  encodedTransaction
4827
5142
  });
@@ -4862,7 +5177,7 @@ Supported fuel-core version: ${supportedVersion}.`
4862
5177
  const {
4863
5178
  dryRun: [{ receipts: rawReceipts, status }]
4864
5179
  } = await this.operations.dryRun({
4865
- encodedTransactions: [(0, import_utils26.hexlify)(transactionRequest.toTransactionBytes())],
5180
+ encodedTransactions: [(0, import_utils30.hexlify)(transactionRequest.toTransactionBytes())],
4866
5181
  utxoValidation: false
4867
5182
  });
4868
5183
  receipts = rawReceipts.map(processGqlReceipt);
@@ -4908,11 +5223,11 @@ Supported fuel-core version: ${supportedVersion}.`
4908
5223
  missingContractIds: [],
4909
5224
  dryRunStatus: void 0
4910
5225
  }));
4911
- const allRequests = (0, import_ramda6.clone)(transactionRequests);
5226
+ const allRequests = (0, import_ramda8.clone)(transactionRequests);
4912
5227
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
4913
5228
  allRequests.forEach((req, index) => {
4914
5229
  if (isTransactionTypeScript(req)) {
4915
- serializedTransactionsMap.set(index, (0, import_utils26.hexlify)(req.toTransactionBytes()));
5230
+ serializedTransactionsMap.set(index, (0, import_utils30.hexlify)(req.toTransactionBytes()));
4916
5231
  }
4917
5232
  });
4918
5233
  let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
@@ -4948,7 +5263,7 @@ Supported fuel-core version: ${supportedVersion}.`
4948
5263
  transactionRequest: request
4949
5264
  });
4950
5265
  request.maxFee = maxFee;
4951
- serializedTransactionsMap.set(requestIdx, (0, import_utils26.hexlify)(request.toTransactionBytes()));
5266
+ serializedTransactionsMap.set(requestIdx, (0, import_utils30.hexlify)(request.toTransactionBytes()));
4952
5267
  nextRoundTransactions.push(requestIdx);
4953
5268
  }
4954
5269
  }
@@ -4969,7 +5284,7 @@ Supported fuel-core version: ${supportedVersion}.`
4969
5284
  if (estimateTxDependencies) {
4970
5285
  return this.estimateMultipleTxDependencies(transactionRequests);
4971
5286
  }
4972
- const encodedTransactions = transactionRequests.map((tx) => (0, import_utils26.hexlify)(tx.toTransactionBytes()));
5287
+ const encodedTransactions = transactionRequests.map((tx) => (0, import_utils30.hexlify)(tx.toTransactionBytes()));
4973
5288
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4974
5289
  encodedTransactions,
4975
5290
  utxoValidation: utxoValidation || false
@@ -5043,7 +5358,7 @@ Supported fuel-core version: ${supportedVersion}.`
5043
5358
  if (estimateTxDependencies) {
5044
5359
  return this.estimateTxDependencies(transactionRequest);
5045
5360
  }
5046
- const encodedTransactions = [(0, import_utils26.hexlify)(transactionRequest.toTransactionBytes())];
5361
+ const encodedTransactions = [(0, import_utils30.hexlify)(transactionRequest.toTransactionBytes())];
5047
5362
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
5048
5363
  encodedTransactions,
5049
5364
  utxoValidation: true
@@ -5068,13 +5383,13 @@ Supported fuel-core version: ${supportedVersion}.`
5068
5383
  * @returns A promise that resolves to the transaction cost object.
5069
5384
  */
5070
5385
  async getTransactionCost(transactionRequestLike, { signatureCallback } = {}) {
5071
- const txRequestClone = (0, import_ramda6.clone)(transactionRequestify(transactionRequestLike));
5386
+ const txRequestClone = (0, import_ramda8.clone)(transactionRequestify(transactionRequestLike));
5072
5387
  const updateMaxFee = txRequestClone.maxFee.eq(0);
5073
5388
  const isScriptTransaction = isTransactionTypeScript(txRequestClone);
5074
5389
  if (isScriptTransaction) {
5075
5390
  txRequestClone.gasLimit = (0, import_math19.bn)(0);
5076
5391
  }
5077
- const signedRequest = (0, import_ramda6.clone)(txRequestClone);
5392
+ const signedRequest = (0, import_ramda8.clone)(txRequestClone);
5078
5393
  let addedSignatures = 0;
5079
5394
  if (signatureCallback && isTransactionTypeScript(signedRequest)) {
5080
5395
  const lengthBefore = signedRequest.witnesses.length;
@@ -5142,7 +5457,7 @@ Supported fuel-core version: ${supportedVersion}.`
5142
5457
  paginationLimit: RESOURCES_PAGE_SIZE_LIMIT,
5143
5458
  inputArgs: paginationArgs
5144
5459
  }),
5145
- filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils26.hexlify)(assetId) }
5460
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils30.hexlify)(assetId) }
5146
5461
  });
5147
5462
  const coins = edges.map(({ node }) => ({
5148
5463
  id: node.utxoId,
@@ -5168,8 +5483,8 @@ Supported fuel-core version: ${supportedVersion}.`
5168
5483
  async getResourcesToSpend(owner, quantities, excludedIds) {
5169
5484
  const ownerAddress = import_address4.Address.fromAddressOrString(owner);
5170
5485
  const excludeInput = {
5171
- messages: excludedIds?.messages?.map((nonce) => (0, import_utils26.hexlify)(nonce)) || [],
5172
- utxos: excludedIds?.utxos?.map((id) => (0, import_utils26.hexlify)(id)) || []
5486
+ messages: excludedIds?.messages?.map((nonce) => (0, import_utils30.hexlify)(nonce)) || [],
5487
+ utxos: excludedIds?.utxos?.map((id) => (0, import_utils30.hexlify)(id)) || []
5173
5488
  };
5174
5489
  if (this.cache) {
5175
5490
  const cached = this.cache.getActiveData();
@@ -5179,7 +5494,7 @@ Supported fuel-core version: ${supportedVersion}.`
5179
5494
  const coinsQuery = {
5180
5495
  owner: ownerAddress.toB256(),
5181
5496
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
5182
- assetId: (0, import_utils26.hexlify)(assetId),
5497
+ assetId: (0, import_utils30.hexlify)(assetId),
5183
5498
  amount: amount.toString(10),
5184
5499
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
5185
5500
  })),
@@ -5334,7 +5649,7 @@ Supported fuel-core version: ${supportedVersion}.`
5334
5649
  },
5335
5650
  transactionIds: block.transactions.map((tx) => tx.id),
5336
5651
  transactions: block.transactions.map(
5337
- (tx) => new import_transactions20.TransactionCoder().decode((0, import_utils26.arrayify)(tx.rawPayload), 0)?.[0]
5652
+ (tx) => new import_transactions22.TransactionCoder().decode((0, import_utils30.arrayify)(tx.rawPayload), 0)?.[0]
5338
5653
  )
5339
5654
  };
5340
5655
  }
@@ -5350,12 +5665,12 @@ Supported fuel-core version: ${supportedVersion}.`
5350
5665
  return null;
5351
5666
  }
5352
5667
  try {
5353
- return new import_transactions20.TransactionCoder().decode(
5354
- (0, import_utils26.arrayify)(transaction.rawPayload),
5668
+ return new import_transactions22.TransactionCoder().decode(
5669
+ (0, import_utils30.arrayify)(transaction.rawPayload),
5355
5670
  0
5356
5671
  )?.[0];
5357
5672
  } catch (error) {
5358
- if (error instanceof import_errors17.FuelError && error.code === import_errors17.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5673
+ if (error instanceof import_errors18.FuelError && error.code === import_errors18.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5359
5674
  console.warn("Unsupported transaction type encountered");
5360
5675
  return null;
5361
5676
  }
@@ -5371,12 +5686,12 @@ Supported fuel-core version: ${supportedVersion}.`
5371
5686
  const {
5372
5687
  transactions: { edges, pageInfo }
5373
5688
  } = await this.operations.getTransactions(paginationArgs);
5374
- const coder = new import_transactions20.TransactionCoder();
5689
+ const coder = new import_transactions22.TransactionCoder();
5375
5690
  const transactions = edges.map(({ node: { rawPayload } }) => {
5376
5691
  try {
5377
- return coder.decode((0, import_utils26.arrayify)(rawPayload), 0)[0];
5692
+ return coder.decode((0, import_utils30.arrayify)(rawPayload), 0)[0];
5378
5693
  } catch (error) {
5379
- if (error instanceof import_errors17.FuelError && error.code === import_errors17.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5694
+ if (error instanceof import_errors18.FuelError && error.code === import_errors18.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5380
5695
  console.warn("Unsupported transaction type encountered");
5381
5696
  return null;
5382
5697
  }
@@ -5408,7 +5723,7 @@ Supported fuel-core version: ${supportedVersion}.`
5408
5723
  async getContractBalance(contractId, assetId) {
5409
5724
  const { contractBalance } = await this.operations.getContractBalance({
5410
5725
  contract: import_address4.Address.fromAddressOrString(contractId).toB256(),
5411
- asset: (0, import_utils26.hexlify)(assetId)
5726
+ asset: (0, import_utils30.hexlify)(assetId)
5412
5727
  });
5413
5728
  return (0, import_math19.bn)(contractBalance.amount, 10);
5414
5729
  }
@@ -5422,7 +5737,7 @@ Supported fuel-core version: ${supportedVersion}.`
5422
5737
  async getBalance(owner, assetId) {
5423
5738
  const { balance } = await this.operations.getBalance({
5424
5739
  owner: import_address4.Address.fromAddressOrString(owner).toB256(),
5425
- assetId: (0, import_utils26.hexlify)(assetId)
5740
+ assetId: (0, import_utils30.hexlify)(assetId)
5426
5741
  });
5427
5742
  return (0, import_math19.bn)(balance.amount, 10);
5428
5743
  }
@@ -5468,7 +5783,7 @@ Supported fuel-core version: ${supportedVersion}.`
5468
5783
  owner: import_address4.Address.fromAddressOrString(address).toB256()
5469
5784
  });
5470
5785
  const messages = edges.map(({ node }) => ({
5471
- messageId: import_transactions20.InputMessageCoder.getMessageId({
5786
+ messageId: import_transactions22.InputMessageCoder.getMessageId({
5472
5787
  sender: node.sender,
5473
5788
  recipient: node.recipient,
5474
5789
  nonce: node.nonce,
@@ -5479,7 +5794,7 @@ Supported fuel-core version: ${supportedVersion}.`
5479
5794
  recipient: import_address4.Address.fromAddressOrString(node.recipient),
5480
5795
  nonce: node.nonce,
5481
5796
  amount: (0, import_math19.bn)(node.amount),
5482
- data: import_transactions20.InputMessageCoder.decodeData(node.data),
5797
+ data: import_transactions22.InputMessageCoder.decodeData(node.data),
5483
5798
  daHeight: (0, import_math19.bn)(node.daHeight)
5484
5799
  }));
5485
5800
  return {
@@ -5502,8 +5817,8 @@ Supported fuel-core version: ${supportedVersion}.`
5502
5817
  nonce
5503
5818
  };
5504
5819
  if (commitBlockId && commitBlockHeight) {
5505
- throw new import_errors17.FuelError(
5506
- import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
5820
+ throw new import_errors18.FuelError(
5821
+ import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
5507
5822
  "commitBlockId and commitBlockHeight cannot be used together"
5508
5823
  );
5509
5824
  }
@@ -5622,7 +5937,7 @@ Supported fuel-core version: ${supportedVersion}.`
5622
5937
  async produceBlocks(amount, startTime) {
5623
5938
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
5624
5939
  blocksToProduce: (0, import_math19.bn)(amount).toString(10),
5625
- startTimestamp: startTime ? import_utils26.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
5940
+ startTimestamp: startTime ? import_utils30.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
5626
5941
  });
5627
5942
  return (0, import_math19.bn)(latestBlockHeight);
5628
5943
  }
@@ -5648,7 +5963,7 @@ Supported fuel-core version: ${supportedVersion}.`
5648
5963
  return null;
5649
5964
  }
5650
5965
  const message = {
5651
- messageId: import_transactions20.InputMessageCoder.getMessageId({
5966
+ messageId: import_transactions22.InputMessageCoder.getMessageId({
5652
5967
  sender: rawMessage.sender,
5653
5968
  recipient: rawMessage.recipient,
5654
5969
  nonce: rawMessage.nonce,
@@ -5659,7 +5974,7 @@ Supported fuel-core version: ${supportedVersion}.`
5659
5974
  recipient: import_address4.Address.fromAddressOrString(rawMessage.recipient),
5660
5975
  nonce: rawMessage.nonce,
5661
5976
  amount: (0, import_math19.bn)(rawMessage.amount),
5662
- data: import_transactions20.InputMessageCoder.decodeData(rawMessage.data),
5977
+ data: import_transactions22.InputMessageCoder.decodeData(rawMessage.data),
5663
5978
  daHeight: (0, import_math19.bn)(rawMessage.daHeight)
5664
5979
  };
5665
5980
  return message;
@@ -5686,26 +6001,26 @@ Supported fuel-core version: ${supportedVersion}.`
5686
6001
  const { paginationLimit, inputArgs = {} } = params;
5687
6002
  const { first, last, after, before } = inputArgs;
5688
6003
  if (after && before) {
5689
- throw new import_errors17.FuelError(
5690
- import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
6004
+ throw new import_errors18.FuelError(
6005
+ import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
5691
6006
  'Pagination arguments "after" and "before" cannot be used together'
5692
6007
  );
5693
6008
  }
5694
6009
  if ((first || 0) > paginationLimit || (last || 0) > paginationLimit) {
5695
- throw new import_errors17.FuelError(
5696
- import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
6010
+ throw new import_errors18.FuelError(
6011
+ import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
5697
6012
  `Pagination limit for this query cannot exceed ${paginationLimit} items`
5698
6013
  );
5699
6014
  }
5700
6015
  if (first && before) {
5701
- throw new import_errors17.FuelError(
5702
- import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
6016
+ throw new import_errors18.FuelError(
6017
+ import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
5703
6018
  'The use of pagination argument "first" with "before" is not supported'
5704
6019
  );
5705
6020
  }
5706
6021
  if (last && after) {
5707
- throw new import_errors17.FuelError(
5708
- import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
6022
+ throw new import_errors18.FuelError(
6023
+ import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
5709
6024
  'The use of pagination argument "last" with "after" is not supported'
5710
6025
  );
5711
6026
  }
@@ -5742,9 +6057,9 @@ cacheInputs_fn = function(inputs, transactionId) {
5742
6057
  }
5743
6058
  const inputsToCache = inputs.reduce(
5744
6059
  (acc, input) => {
5745
- if (input.type === import_transactions20.InputType.Coin) {
6060
+ if (input.type === import_transactions22.InputType.Coin) {
5746
6061
  acc.utxos.push(input.id);
5747
- } else if (input.type === import_transactions20.InputType.Message) {
6062
+ } else if (input.type === import_transactions22.InputType.Message) {
5748
6063
  acc.messages.push(input.nonce);
5749
6064
  }
5750
6065
  return acc;
@@ -5759,20 +6074,22 @@ __publicField(Provider, "chainInfoCache", {});
5759
6074
  __publicField(Provider, "nodeInfoCache", {});
5760
6075
 
5761
6076
  // src/providers/transaction-summary/get-transaction-summary.ts
5762
- var import_errors18 = require("@fuel-ts/errors");
6077
+ var import_errors19 = require("@fuel-ts/errors");
5763
6078
  var import_math20 = require("@fuel-ts/math");
5764
- var import_transactions21 = require("@fuel-ts/transactions");
5765
- var import_utils29 = require("@fuel-ts/utils");
6079
+ var import_transactions23 = require("@fuel-ts/transactions");
6080
+ var import_utils33 = require("@fuel-ts/utils");
5766
6081
 
5767
6082
  // src/providers/chains.ts
5768
6083
  var CHAIN_IDS = {
5769
6084
  eth: {
6085
+ mainnet: 1,
5770
6086
  sepolia: 11155111,
5771
6087
  foundry: 31337
5772
6088
  },
5773
6089
  fuel: {
5774
6090
  devnet: 0,
5775
- testnet: 0
6091
+ testnet: 0,
6092
+ mainnet: 9889
5776
6093
  }
5777
6094
  };
5778
6095
 
@@ -5818,6 +6135,11 @@ var rawAssets = [
5818
6135
  chainId: CHAIN_IDS.eth.foundry,
5819
6136
  decimals: 18
5820
6137
  },
6138
+ {
6139
+ type: "ethereum",
6140
+ chainId: CHAIN_IDS.eth.mainnet,
6141
+ decimals: 18
6142
+ },
5821
6143
  {
5822
6144
  type: "fuel",
5823
6145
  chainId: CHAIN_IDS.fuel.devnet,
@@ -5829,29 +6151,594 @@ var rawAssets = [
5829
6151
  chainId: CHAIN_IDS.fuel.testnet,
5830
6152
  decimals: 9,
5831
6153
  assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
6154
+ },
6155
+ {
6156
+ type: "fuel",
6157
+ chainId: CHAIN_IDS.fuel.mainnet,
6158
+ decimals: 9,
6159
+ assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
5832
6160
  }
5833
6161
  ]
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
- }
5845
- static random(count = 1) {
5846
- const assetIds = [];
5847
- for (let i = 0; i < count; i++) {
5848
- assetIds.push(new _TestAssetId((0, import_utils31.hexlify)((0, import_crypto4.randomBytes)(32))));
5849
- }
5850
- return assetIds;
5851
- }
5852
- };
5853
- var TestAssetId = _TestAssetId;
5854
- __publicField(TestAssetId, "A", new _TestAssetId(
6162
+ },
6163
+ {
6164
+ name: "WETH",
6165
+ symbol: "WETH",
6166
+ icon: "weth.svg",
6167
+ networks: [
6168
+ {
6169
+ type: "ethereum",
6170
+ chainId: CHAIN_IDS.eth.mainnet,
6171
+ address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
6172
+ decimals: 18
6173
+ },
6174
+ {
6175
+ type: "fuel",
6176
+ chainId: CHAIN_IDS.fuel.mainnet,
6177
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6178
+ assetId: "0xa38a5a8beeb08d95744bc7f58528073f4052b254def59eba20c99c202b5acaa3",
6179
+ decimals: 18
6180
+ }
6181
+ ]
6182
+ },
6183
+ {
6184
+ name: "weETH",
6185
+ symbol: "weETH",
6186
+ icon: "weETH.webp",
6187
+ networks: [
6188
+ {
6189
+ type: "ethereum",
6190
+ chainId: CHAIN_IDS.eth.mainnet,
6191
+ address: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
6192
+ decimals: 18
6193
+ },
6194
+ {
6195
+ type: "fuel",
6196
+ chainId: CHAIN_IDS.fuel.mainnet,
6197
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6198
+ assetId: "0x239ed6e12b7ce4089ee245244e3bf906999a6429c2a9a445a1e1faf56914a4ab",
6199
+ decimals: 18
6200
+ }
6201
+ ]
6202
+ },
6203
+ {
6204
+ name: "rsETH",
6205
+ symbol: "rsETH",
6206
+ icon: "rsETH.webp",
6207
+ networks: [
6208
+ {
6209
+ type: "ethereum",
6210
+ chainId: CHAIN_IDS.eth.mainnet,
6211
+ address: "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7",
6212
+ decimals: 18
6213
+ },
6214
+ {
6215
+ type: "fuel",
6216
+ chainId: CHAIN_IDS.fuel.mainnet,
6217
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6218
+ assetId: "0xbae80f7fb8aa6b90d9b01ef726ec847cc4f59419c4d5f2ea88fec785d1b0e849",
6219
+ decimals: 18
6220
+ }
6221
+ ]
6222
+ },
6223
+ {
6224
+ name: "rETH",
6225
+ symbol: "rETH",
6226
+ icon: "reth.svg",
6227
+ networks: [
6228
+ {
6229
+ type: "ethereum",
6230
+ chainId: CHAIN_IDS.eth.mainnet,
6231
+ address: "0xae78736cd615f374d3085123a210448e74fc6393",
6232
+ decimals: 18
6233
+ },
6234
+ {
6235
+ type: "fuel",
6236
+ chainId: CHAIN_IDS.fuel.mainnet,
6237
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6238
+ assetId: "0xf3f9a0ed0ce8eac5f89d6b83e41b3848212d5b5f56108c54a205bb228ca30c16",
6239
+ decimals: 18
6240
+ }
6241
+ ]
6242
+ },
6243
+ {
6244
+ name: "wbETH",
6245
+ symbol: "wbETH",
6246
+ icon: "wbeth.png",
6247
+ networks: [
6248
+ {
6249
+ type: "ethereum",
6250
+ chainId: CHAIN_IDS.eth.mainnet,
6251
+ address: "0xa2E3356610840701BDf5611a53974510Ae27E2e1",
6252
+ decimals: 18
6253
+ },
6254
+ {
6255
+ type: "fuel",
6256
+ chainId: CHAIN_IDS.fuel.mainnet,
6257
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6258
+ assetId: "0x7843c74bef935e837f2bcf67b5d64ecb46dd53ff86375530b0caf3699e8ffafe",
6259
+ decimals: 18
6260
+ }
6261
+ ]
6262
+ },
6263
+ {
6264
+ name: "rstETH",
6265
+ symbol: "rstETH",
6266
+ icon: "rstETH.webp",
6267
+ networks: [
6268
+ {
6269
+ type: "ethereum",
6270
+ chainId: CHAIN_IDS.eth.mainnet,
6271
+ address: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
6272
+ decimals: 18
6273
+ },
6274
+ {
6275
+ type: "fuel",
6276
+ chainId: CHAIN_IDS.fuel.mainnet,
6277
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6278
+ assetId: "0x962792286fbc9b1d5860b4551362a12249362c21594c77abf4b3fe2bbe8d977a",
6279
+ decimals: 18
6280
+ }
6281
+ ]
6282
+ },
6283
+ {
6284
+ name: "amphrETH",
6285
+ symbol: "amphrETH",
6286
+ icon: "amphrETH.png",
6287
+ networks: [
6288
+ {
6289
+ type: "ethereum",
6290
+ chainId: CHAIN_IDS.eth.mainnet,
6291
+ address: "0x5fD13359Ba15A84B76f7F87568309040176167cd",
6292
+ decimals: 18
6293
+ },
6294
+ {
6295
+ type: "fuel",
6296
+ chainId: CHAIN_IDS.fuel.mainnet,
6297
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6298
+ assetId: "0x05fc623e57bd7bc1258efa8e4f62b05af5471d73df6f2c2dc11ecc81134c4f36",
6299
+ decimals: 18
6300
+ }
6301
+ ]
6302
+ },
6303
+ {
6304
+ name: "Manta mBTC",
6305
+ symbol: "Manta mBTC",
6306
+ icon: "manta-mbtc.svg",
6307
+ networks: [
6308
+ {
6309
+ type: "ethereum",
6310
+ chainId: CHAIN_IDS.eth.mainnet,
6311
+ address: "0x4041381e947CFD3D483d67a25C6aa9Dc924250c5",
6312
+ decimals: 18
6313
+ },
6314
+ {
6315
+ type: "fuel",
6316
+ chainId: CHAIN_IDS.fuel.mainnet,
6317
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6318
+ assetId: "0xaf3111a248ff7a3238cdeea845bb2d43cf3835f1f6b8c9d28360728b55b9ce5b",
6319
+ decimals: 18
6320
+ }
6321
+ ]
6322
+ },
6323
+ {
6324
+ name: "Manta mETH",
6325
+ symbol: "Manta mETH",
6326
+ icon: "manta-meth.svg",
6327
+ networks: [
6328
+ {
6329
+ type: "ethereum",
6330
+ chainId: CHAIN_IDS.eth.mainnet,
6331
+ address: "0x8CdF550C04Bc9B9F10938368349C9c8051A772b6",
6332
+ decimals: 18
6333
+ },
6334
+ {
6335
+ type: "fuel",
6336
+ chainId: CHAIN_IDS.fuel.mainnet,
6337
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6338
+ assetId: "0xafd219f513317b1750783c6581f55530d6cf189a5863fd18bd1b3ffcec1714b4",
6339
+ decimals: 18
6340
+ }
6341
+ ]
6342
+ },
6343
+ {
6344
+ name: "Manta mUSD",
6345
+ symbol: "Manta mUSD",
6346
+ icon: "manta-musd.svg",
6347
+ networks: [
6348
+ {
6349
+ type: "ethereum",
6350
+ chainId: CHAIN_IDS.eth.mainnet,
6351
+ address: "0x3f24E1d7a973867fC2A03fE199E5502514E0e11E",
6352
+ decimals: 18
6353
+ },
6354
+ {
6355
+ type: "fuel",
6356
+ chainId: CHAIN_IDS.fuel.mainnet,
6357
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6358
+ assetId: "0x89cb9401e55d49c3269654dd1cdfb0e80e57823a4a7db98ba8fc5953b120fef4",
6359
+ decimals: 18
6360
+ }
6361
+ ]
6362
+ },
6363
+ {
6364
+ name: "pumpBTC",
6365
+ symbol: "pumpBTC",
6366
+ icon: "pumpbtc.webp",
6367
+ networks: [
6368
+ {
6369
+ type: "ethereum",
6370
+ chainId: CHAIN_IDS.eth.mainnet,
6371
+ address: "0xf469fbd2abcd6b9de8e169d128226c0fc90a012e",
6372
+ decimals: 8
6373
+ },
6374
+ {
6375
+ type: "fuel",
6376
+ chainId: CHAIN_IDS.fuel.mainnet,
6377
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6378
+ assetId: "0x0aa5eb2bb97ca915288b653a2529355d4dc66de2b37533213f0e4aeee3d3421f",
6379
+ decimals: 8
6380
+ }
6381
+ ]
6382
+ },
6383
+ {
6384
+ name: "FBTC",
6385
+ symbol: "FBTC",
6386
+ icon: "fbtc.svg",
6387
+ networks: [
6388
+ {
6389
+ type: "ethereum",
6390
+ chainId: CHAIN_IDS.eth.mainnet,
6391
+ address: "0xc96de26018a54d51c097160568752c4e3bd6c364",
6392
+ decimals: 8
6393
+ },
6394
+ {
6395
+ type: "fuel",
6396
+ chainId: CHAIN_IDS.fuel.mainnet,
6397
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6398
+ assetId: "0xb5ecb0a1e08e2abbabf624ffea089df933376855f468ade35c6375b00c33996a",
6399
+ decimals: 8
6400
+ }
6401
+ ]
6402
+ },
6403
+ {
6404
+ name: "SolvBTC",
6405
+ symbol: "SolvBTC",
6406
+ icon: "solvBTC.webp",
6407
+ networks: [
6408
+ {
6409
+ type: "ethereum",
6410
+ chainId: CHAIN_IDS.eth.mainnet,
6411
+ address: "0x7a56e1c57c7475ccf742a1832b028f0456652f97",
6412
+ decimals: 18
6413
+ },
6414
+ {
6415
+ type: "fuel",
6416
+ chainId: CHAIN_IDS.fuel.mainnet,
6417
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6418
+ assetId: "0x1186afea9affb88809c210e13e2330b5258c2cef04bb8fff5eff372b7bd3f40f",
6419
+ decimals: 18
6420
+ }
6421
+ ]
6422
+ },
6423
+ {
6424
+ name: "SolvBTC.BBN",
6425
+ symbol: "SolvBTC.BBN",
6426
+ icon: "SolvBTC.BBN.png",
6427
+ networks: [
6428
+ {
6429
+ type: "ethereum",
6430
+ chainId: CHAIN_IDS.eth.mainnet,
6431
+ address: "0xd9d920aa40f578ab794426f5c90f6c731d159def",
6432
+ decimals: 18
6433
+ },
6434
+ {
6435
+ type: "fuel",
6436
+ chainId: CHAIN_IDS.fuel.mainnet,
6437
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6438
+ assetId: "0x7a4f087c957d30218223c2baaaa365355c9ca81b6ea49004cfb1590a5399216f",
6439
+ decimals: 18
6440
+ }
6441
+ ]
6442
+ },
6443
+ {
6444
+ name: "Mantle mETH",
6445
+ symbol: "Mantle mETH",
6446
+ icon: "mantle-meth.svg",
6447
+ networks: [
6448
+ {
6449
+ type: "ethereum",
6450
+ chainId: CHAIN_IDS.eth.mainnet,
6451
+ address: "0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa",
6452
+ decimals: 18
6453
+ },
6454
+ {
6455
+ type: "fuel",
6456
+ chainId: CHAIN_IDS.fuel.mainnet,
6457
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6458
+ assetId: "0x642a5db59ec323c2f846d4d4cf3e58d78aff64accf4f8f6455ba0aa3ef000a3b",
6459
+ decimals: 18
6460
+ }
6461
+ ]
6462
+ },
6463
+ {
6464
+ name: "sDAI",
6465
+ symbol: "sDAI",
6466
+ icon: "sdai.svg",
6467
+ networks: [
6468
+ {
6469
+ type: "ethereum",
6470
+ chainId: CHAIN_IDS.eth.mainnet,
6471
+ address: "0x83f20f44975d03b1b09e64809b757c47f942beea",
6472
+ decimals: 18
6473
+ },
6474
+ {
6475
+ type: "fuel",
6476
+ chainId: CHAIN_IDS.fuel.mainnet,
6477
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6478
+ assetId: "0x9e46f919fbf978f3cad7cd34cca982d5613af63ff8aab6c379e4faa179552958",
6479
+ decimals: 18
6480
+ }
6481
+ ]
6482
+ },
6483
+ {
6484
+ name: "USDT",
6485
+ symbol: "USDT",
6486
+ icon: "usdt.svg",
6487
+ networks: [
6488
+ {
6489
+ type: "ethereum",
6490
+ chainId: CHAIN_IDS.eth.mainnet,
6491
+ address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
6492
+ decimals: 6
6493
+ },
6494
+ {
6495
+ type: "fuel",
6496
+ chainId: CHAIN_IDS.fuel.mainnet,
6497
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6498
+ assetId: "0xa0265fb5c32f6e8db3197af3c7eb05c48ae373605b8165b6f4a51c5b0ba4812e",
6499
+ decimals: 6
6500
+ }
6501
+ ]
6502
+ },
6503
+ {
6504
+ name: "USDC",
6505
+ symbol: "USDC",
6506
+ icon: "usdc.svg",
6507
+ networks: [
6508
+ {
6509
+ type: "ethereum",
6510
+ chainId: CHAIN_IDS.eth.mainnet,
6511
+ address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
6512
+ decimals: 6
6513
+ },
6514
+ {
6515
+ type: "fuel",
6516
+ chainId: CHAIN_IDS.fuel.mainnet,
6517
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6518
+ assetId: "0x286c479da40dc953bddc3bb4c453b608bba2e0ac483b077bd475174115395e6b",
6519
+ decimals: 6
6520
+ }
6521
+ ]
6522
+ },
6523
+ {
6524
+ name: "USDe",
6525
+ symbol: "USDe",
6526
+ icon: "USDe.svg",
6527
+ networks: [
6528
+ {
6529
+ type: "ethereum",
6530
+ chainId: CHAIN_IDS.eth.mainnet,
6531
+ address: "0x4c9edd5852cd905f086c759e8383e09bff1e68b3",
6532
+ decimals: 18
6533
+ },
6534
+ {
6535
+ type: "ethereum",
6536
+ chainId: CHAIN_IDS.eth.sepolia,
6537
+ address: "0xc6387efad0f184a90b34f397c3d6fd63135ef790",
6538
+ decimals: 18
6539
+ },
6540
+ {
6541
+ type: "fuel",
6542
+ chainId: CHAIN_IDS.fuel.mainnet,
6543
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6544
+ assetId: "0xb6133b2ef9f6153eb869125d23dcf20d1e735331b5e41b15a6a7a6cec70e8651",
6545
+ decimals: 18
6546
+ },
6547
+ {
6548
+ type: "fuel",
6549
+ chainId: CHAIN_IDS.fuel.testnet,
6550
+ contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
6551
+ assetId: "0xf5c6d72d0f2c782fa47d8e228c198a08654e9fc66ca60ad85902b1d09046a7ab",
6552
+ decimals: 18
6553
+ }
6554
+ ]
6555
+ },
6556
+ {
6557
+ name: "sUSDe",
6558
+ symbol: "sUSDe",
6559
+ icon: "sUSDe.webp",
6560
+ networks: [
6561
+ {
6562
+ type: "ethereum",
6563
+ chainId: CHAIN_IDS.eth.mainnet,
6564
+ address: "0x9d39a5de30e57443bff2a8307a4256c8797a3497",
6565
+ decimals: 18
6566
+ },
6567
+ {
6568
+ type: "ethereum",
6569
+ chainId: CHAIN_IDS.eth.sepolia,
6570
+ address: "0xb8f4f4eafc1d2a3c0a4d519bbf1114c311cc9b1b",
6571
+ decimals: 18
6572
+ },
6573
+ {
6574
+ type: "fuel",
6575
+ chainId: CHAIN_IDS.fuel.mainnet,
6576
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6577
+ assetId: "0xd05563025104fc36496c15c7021ad6b31034b0e89a356f4f818045d1f48808bc",
6578
+ decimals: 18
6579
+ },
6580
+ {
6581
+ type: "fuel",
6582
+ chainId: CHAIN_IDS.fuel.testnet,
6583
+ contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
6584
+ assetId: "0xa86e37d385c08beddbb02c8260f9ec535d484c8ea908fc19d4e6dc8d5141fb2e",
6585
+ decimals: 18
6586
+ }
6587
+ ]
6588
+ },
6589
+ {
6590
+ name: "rsUSDe",
6591
+ symbol: "rsUSDe",
6592
+ icon: "rsUSDe.svg",
6593
+ networks: [
6594
+ {
6595
+ type: "ethereum",
6596
+ chainId: CHAIN_IDS.eth.mainnet,
6597
+ address: "0x82f5104b23FF2FA54C2345F821dAc9369e9E0B26",
6598
+ decimals: 18
6599
+ },
6600
+ {
6601
+ type: "fuel",
6602
+ chainId: CHAIN_IDS.fuel.mainnet,
6603
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6604
+ assetId: "0x78d4522ec607f6e8efb66ea49439d1ee48623cf763f9688a8eada025def033d9",
6605
+ decimals: 18
6606
+ }
6607
+ ]
6608
+ },
6609
+ {
6610
+ name: "wstETH",
6611
+ symbol: "wstETH",
6612
+ icon: "wsteth.svg",
6613
+ networks: [
6614
+ {
6615
+ type: "ethereum",
6616
+ chainId: CHAIN_IDS.eth.mainnet,
6617
+ address: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
6618
+ decimals: 18
6619
+ },
6620
+ {
6621
+ type: "ethereum",
6622
+ chainId: CHAIN_IDS.eth.sepolia,
6623
+ address: "0xB82381A3fBD3FaFA77B3a7bE693342618240067b",
6624
+ decimals: 18
6625
+ },
6626
+ {
6627
+ type: "fuel",
6628
+ chainId: CHAIN_IDS.fuel.mainnet,
6629
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6630
+ assetId: "0x1a7815cc9f75db5c24a5b0814bfb706bb9fe485333e98254015de8f48f84c67b",
6631
+ decimals: 18
6632
+ },
6633
+ {
6634
+ type: "fuel",
6635
+ chainId: CHAIN_IDS.fuel.testnet,
6636
+ contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
6637
+ assetId: "0x4c467e3fd4f32179e1aad3b92ebbdaa6ff6aeda5b8da5f8e64e96405eb52a7f5",
6638
+ decimals: 18
6639
+ }
6640
+ ]
6641
+ },
6642
+ {
6643
+ name: "ezETH",
6644
+ symbol: "ezETH",
6645
+ icon: "ezeth.webp",
6646
+ networks: [
6647
+ {
6648
+ type: "ethereum",
6649
+ chainId: CHAIN_IDS.eth.mainnet,
6650
+ address: "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110",
6651
+ decimals: 18
6652
+ },
6653
+ {
6654
+ type: "fuel",
6655
+ chainId: CHAIN_IDS.fuel.mainnet,
6656
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6657
+ assetId: "0x91b3559edb2619cde8ffb2aa7b3c3be97efd794ea46700db7092abeee62281b0",
6658
+ decimals: 18
6659
+ }
6660
+ ]
6661
+ },
6662
+ {
6663
+ name: "pzETH",
6664
+ symbol: "pzETH",
6665
+ icon: "pzETH.webp",
6666
+ networks: [
6667
+ {
6668
+ type: "ethereum",
6669
+ chainId: CHAIN_IDS.eth.mainnet,
6670
+ address: "0x8c9532a60e0e7c6bbd2b2c1303f63ace1c3e9811",
6671
+ decimals: 18
6672
+ },
6673
+ {
6674
+ type: "fuel",
6675
+ chainId: CHAIN_IDS.fuel.mainnet,
6676
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6677
+ assetId: "0x1493d4ec82124de8f9b625682de69dcccda79e882b89a55a8c737b12de67bd68",
6678
+ decimals: 18
6679
+ }
6680
+ ]
6681
+ },
6682
+ {
6683
+ name: "Re7LRT",
6684
+ symbol: "Re7LRT",
6685
+ icon: "Re7LRT.png",
6686
+ networks: [
6687
+ {
6688
+ type: "ethereum",
6689
+ chainId: CHAIN_IDS.eth.mainnet,
6690
+ address: "0x84631c0d0081FDe56DeB72F6DE77abBbF6A9f93a",
6691
+ decimals: 18
6692
+ },
6693
+ {
6694
+ type: "fuel",
6695
+ chainId: CHAIN_IDS.fuel.mainnet,
6696
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6697
+ assetId: "0xf2fc648c23a5db24610a1cf696acc4f0f6d9a7d6028dd9944964ab23f6e35995",
6698
+ decimals: 18
6699
+ }
6700
+ ]
6701
+ },
6702
+ {
6703
+ name: "steakLRT",
6704
+ symbol: "steakLRT",
6705
+ icon: "steakLRT.png",
6706
+ networks: [
6707
+ {
6708
+ type: "ethereum",
6709
+ chainId: CHAIN_IDS.eth.mainnet,
6710
+ address: "0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc",
6711
+ decimals: 18
6712
+ },
6713
+ {
6714
+ type: "fuel",
6715
+ chainId: CHAIN_IDS.fuel.mainnet,
6716
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6717
+ assetId: "0x4fc8ac9f101df07e2c2dec4a53c8c42c439bdbe5e36ea2d863a61ff60afafc30",
6718
+ decimals: 18
6719
+ }
6720
+ ]
6721
+ }
6722
+ ];
6723
+ var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
6724
+
6725
+ // src/test-utils/test-asset-id.ts
6726
+ var import_crypto4 = require("@fuel-ts/crypto");
6727
+ var import_utils35 = require("@fuel-ts/utils");
6728
+ var _TestAssetId = class {
6729
+ constructor(value) {
6730
+ this.value = value;
6731
+ }
6732
+ static random(count = 1) {
6733
+ const assetIds = [];
6734
+ for (let i = 0; i < count; i++) {
6735
+ assetIds.push(new _TestAssetId((0, import_utils35.hexlify)((0, import_crypto4.randomBytes)(32))));
6736
+ }
6737
+ return assetIds;
6738
+ }
6739
+ };
6740
+ var TestAssetId = _TestAssetId;
6741
+ __publicField(TestAssetId, "A", new _TestAssetId(
5855
6742
  "0x0101010101010101010101010101010101010101010101010101010101010101"
5856
6743
  ));
5857
6744
  __publicField(TestAssetId, "B", new _TestAssetId(
@@ -5860,23 +6747,23 @@ __publicField(TestAssetId, "B", new _TestAssetId(
5860
6747
 
5861
6748
  // src/test-utils/wallet-config.ts
5862
6749
  var import_crypto9 = require("@fuel-ts/crypto");
5863
- var import_errors24 = require("@fuel-ts/errors");
5864
- var import_utils40 = require("@fuel-ts/utils");
6750
+ var import_errors25 = require("@fuel-ts/errors");
6751
+ var import_utils44 = require("@fuel-ts/utils");
5865
6752
 
5866
6753
  // src/wallet/base-wallet-unlocked.ts
5867
- var import_hasher3 = require("@fuel-ts/hasher");
5868
- var import_utils35 = require("@fuel-ts/utils");
6754
+ var import_hasher4 = require("@fuel-ts/hasher");
6755
+ var import_utils39 = require("@fuel-ts/utils");
5869
6756
 
5870
6757
  // src/account.ts
5871
6758
  var import_abi_coder8 = require("@fuel-ts/abi-coder");
5872
6759
  var import_address5 = require("@fuel-ts/address");
5873
6760
  var import_crypto5 = require("@fuel-ts/crypto");
5874
- var import_errors19 = require("@fuel-ts/errors");
6761
+ var import_errors20 = require("@fuel-ts/errors");
5875
6762
  var import_interfaces = require("@fuel-ts/interfaces");
5876
6763
  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");
6764
+ var import_transactions24 = require("@fuel-ts/transactions");
6765
+ var import_utils37 = require("@fuel-ts/utils");
6766
+ var import_ramda9 = require("ramda");
5880
6767
 
5881
6768
  // src/providers/utils/merge-quantities.ts
5882
6769
  var mergeQuantities = (...coinQuantities) => {
@@ -5895,16 +6782,16 @@ var mergeQuantities = (...coinQuantities) => {
5895
6782
  // src/utils/formatTransferToContractScriptData.ts
5896
6783
  var import_abi_coder7 = require("@fuel-ts/abi-coder");
5897
6784
  var import_math21 = require("@fuel-ts/math");
5898
- var import_utils32 = require("@fuel-ts/utils");
6785
+ var import_utils36 = require("@fuel-ts/utils");
5899
6786
  var asm = __toESM(require("@fuels/vm-asm"));
5900
6787
  var formatTransferToContractScriptData = (params) => {
5901
6788
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
5902
6789
  const numberCoder = new import_abi_coder7.BigNumberCoder("u64");
5903
6790
  const encoded = numberCoder.encode(new import_math21.BN(amountToTransfer).toNumber());
5904
6791
  const scriptData = Uint8Array.from([
5905
- ...(0, import_utils32.arrayify)(hexlifiedContractId),
6792
+ ...(0, import_utils36.arrayify)(hexlifiedContractId),
5906
6793
  ...encoded,
5907
- ...(0, import_utils32.arrayify)(assetId)
6794
+ ...(0, import_utils36.arrayify)(assetId)
5908
6795
  ]);
5909
6796
  return scriptData;
5910
6797
  };
@@ -5965,7 +6852,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5965
6852
  */
5966
6853
  get provider() {
5967
6854
  if (!this._provider) {
5968
- throw new import_errors19.FuelError(import_errors19.ErrorCode.MISSING_PROVIDER, "Provider not set");
6855
+ throw new import_errors20.FuelError(import_errors20.ErrorCode.MISSING_PROVIDER, "Provider not set");
5969
6856
  }
5970
6857
  return this._provider;
5971
6858
  }
@@ -6083,7 +6970,7 @@ var Account = class extends import_interfaces.AbstractAccount {
6083
6970
  );
6084
6971
  request.addResources(resources);
6085
6972
  request.updatePredicateGasUsed(estimatedPredicates);
6086
- const requestToReestimate2 = (0, import_ramda7.clone)(request);
6973
+ const requestToReestimate2 = (0, import_ramda9.clone)(request);
6087
6974
  if (addedSignatures) {
6088
6975
  Array.from({ length: addedSignatures }).forEach(
6089
6976
  () => requestToReestimate2.addEmptyWitness()
@@ -6116,13 +7003,13 @@ var Account = class extends import_interfaces.AbstractAccount {
6116
7003
  fundingAttempts += 1;
6117
7004
  }
6118
7005
  if (needsToBeFunded) {
6119
- throw new import_errors19.FuelError(
6120
- import_errors19.ErrorCode.NOT_ENOUGH_FUNDS,
7006
+ throw new import_errors20.FuelError(
7007
+ import_errors20.ErrorCode.NOT_ENOUGH_FUNDS,
6121
7008
  `The account ${this.address} does not have enough base asset funds to cover the transaction execution.`
6122
7009
  );
6123
7010
  }
6124
7011
  request.updatePredicateGasUsed(estimatedPredicates);
6125
- const requestToReestimate = (0, import_ramda7.clone)(request);
7012
+ const requestToReestimate = (0, import_ramda9.clone)(request);
6126
7013
  if (addedSignatures) {
6127
7014
  Array.from({ length: addedSignatures }).forEach(() => requestToReestimate.addEmptyWitness());
6128
7015
  }
@@ -6222,8 +7109,8 @@ var Account = class extends import_interfaces.AbstractAccount {
6222
7109
  */
6223
7110
  async transferToContract(contractId, amount, assetId, txParams = {}) {
6224
7111
  if ((0, import_math22.bn)(amount).lte(0)) {
6225
- throw new import_errors19.FuelError(
6226
- import_errors19.ErrorCode.INVALID_TRANSFER_AMOUNT,
7112
+ throw new import_errors20.FuelError(
7113
+ import_errors20.ErrorCode.INVALID_TRANSFER_AMOUNT,
6227
7114
  "Transfer amount must be a positive number."
6228
7115
  );
6229
7116
  }
@@ -6262,14 +7149,14 @@ var Account = class extends import_interfaces.AbstractAccount {
6262
7149
  */
6263
7150
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
6264
7151
  const recipientAddress = import_address5.Address.fromAddressOrString(recipient);
6265
- const recipientDataArray = (0, import_utils33.arrayify)(
7152
+ const recipientDataArray = (0, import_utils37.arrayify)(
6266
7153
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
6267
7154
  );
6268
- const amountDataArray = (0, import_utils33.arrayify)(
7155
+ const amountDataArray = (0, import_utils37.arrayify)(
6269
7156
  "0x".concat((0, import_math22.bn)(amount).toHex().substring(2).padStart(16, "0"))
6270
7157
  );
6271
7158
  const script = new Uint8Array([
6272
- ...(0, import_utils33.arrayify)(withdrawScript.bytes),
7159
+ ...(0, import_utils37.arrayify)(withdrawScript.bytes),
6273
7160
  ...recipientDataArray,
6274
7161
  ...amountDataArray
6275
7162
  ]);
@@ -6298,13 +7185,13 @@ var Account = class extends import_interfaces.AbstractAccount {
6298
7185
  * @returns A promise that resolves to the transaction cost object.
6299
7186
  */
6300
7187
  async getTransactionCost(transactionRequestLike, { signatureCallback, quantities = [] } = {}) {
6301
- const txRequestClone = (0, import_ramda7.clone)(transactionRequestify(transactionRequestLike));
7188
+ const txRequestClone = (0, import_ramda9.clone)(transactionRequestify(transactionRequestLike));
6302
7189
  const baseAssetId = this.provider.getBaseAssetId();
6303
7190
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
6304
7191
  const requiredQuantities = mergeQuantities(coinOutputsQuantities, quantities);
6305
7192
  const transactionFeeForDryRun = [{ assetId: baseAssetId, amount: (0, import_math22.bn)("100000000000000000") }];
6306
7193
  const findAssetInput = (assetId) => txRequestClone.inputs.find((input) => {
6307
- if (input.type === import_transactions22.InputType.Coin) {
7194
+ if (input.type === import_transactions24.InputType.Coin) {
6308
7195
  return input.assetId === assetId;
6309
7196
  }
6310
7197
  if (isRequestInputMessageWithoutData(input)) {
@@ -6349,7 +7236,7 @@ var Account = class extends import_interfaces.AbstractAccount {
6349
7236
  */
6350
7237
  async signMessage(message) {
6351
7238
  if (!this._connector) {
6352
- throw new import_errors19.FuelError(import_errors19.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
7239
+ throw new import_errors20.FuelError(import_errors20.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
6353
7240
  }
6354
7241
  return this._connector.signMessage(this.address.toString(), message);
6355
7242
  }
@@ -6361,8 +7248,8 @@ var Account = class extends import_interfaces.AbstractAccount {
6361
7248
  */
6362
7249
  async signTransaction(transactionRequestLike) {
6363
7250
  if (!this._connector) {
6364
- throw new import_errors19.FuelError(
6365
- import_errors19.ErrorCode.MISSING_CONNECTOR,
7251
+ throw new import_errors20.FuelError(
7252
+ import_errors20.ErrorCode.MISSING_CONNECTOR,
6366
7253
  "A connector is required to sign transactions."
6367
7254
  );
6368
7255
  }
@@ -6411,7 +7298,7 @@ var Account = class extends import_interfaces.AbstractAccount {
6411
7298
  */
6412
7299
  generateFakeResources(coins) {
6413
7300
  return coins.map((coin) => ({
6414
- id: (0, import_utils33.hexlify)((0, import_crypto5.randomBytes)(import_abi_coder8.UTXO_ID_LEN)),
7301
+ id: (0, import_utils37.hexlify)((0, import_crypto5.randomBytes)(import_abi_coder8.UTXO_ID_LEN)),
6415
7302
  owner: this.address,
6416
7303
  blockCreated: (0, import_math22.bn)(1),
6417
7304
  txCreatedIdx: (0, import_math22.bn)(1),
@@ -6421,8 +7308,8 @@ var Account = class extends import_interfaces.AbstractAccount {
6421
7308
  /** @hidden * */
6422
7309
  validateTransferAmount(amount) {
6423
7310
  if ((0, import_math22.bn)(amount).lte(0)) {
6424
- throw new import_errors19.FuelError(
6425
- import_errors19.ErrorCode.INVALID_TRANSFER_AMOUNT,
7311
+ throw new import_errors20.FuelError(
7312
+ import_errors20.ErrorCode.INVALID_TRANSFER_AMOUNT,
6426
7313
  "Transfer amount must be a positive number."
6427
7314
  );
6428
7315
  }
@@ -6448,19 +7335,19 @@ var Account = class extends import_interfaces.AbstractAccount {
6448
7335
  txParams: { gasLimit: setGasLimit, maxFee: setMaxFee }
6449
7336
  }) {
6450
7337
  const request = transactionRequestify(transactionRequest);
6451
- if (!(0, import_utils33.isDefined)(setGasLimit)) {
7338
+ if (!(0, import_utils37.isDefined)(setGasLimit)) {
6452
7339
  request.gasLimit = gasUsed;
6453
7340
  } else if (gasUsed.gt(setGasLimit)) {
6454
- throw new import_errors19.FuelError(
6455
- import_errors19.ErrorCode.GAS_LIMIT_TOO_LOW,
7341
+ throw new import_errors20.FuelError(
7342
+ import_errors20.ErrorCode.GAS_LIMIT_TOO_LOW,
6456
7343
  `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
6457
7344
  );
6458
7345
  }
6459
- if (!(0, import_utils33.isDefined)(setMaxFee)) {
7346
+ if (!(0, import_utils37.isDefined)(setMaxFee)) {
6460
7347
  request.maxFee = maxFee;
6461
7348
  } else if (maxFee.gt(setMaxFee)) {
6462
- throw new import_errors19.FuelError(
6463
- import_errors19.ErrorCode.MAX_FEE_TOO_LOW,
7349
+ throw new import_errors20.FuelError(
7350
+ import_errors20.ErrorCode.MAX_FEE_TOO_LOW,
6464
7351
  `Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
6465
7352
  );
6466
7353
  }
@@ -6471,8 +7358,8 @@ var Account = class extends import_interfaces.AbstractAccount {
6471
7358
  // src/wallet/keystore-wallet.ts
6472
7359
  var import_address6 = require("@fuel-ts/address");
6473
7360
  var import_crypto6 = require("@fuel-ts/crypto");
6474
- var import_errors20 = require("@fuel-ts/errors");
6475
- var import_utils34 = require("@fuel-ts/utils");
7361
+ var import_errors21 = require("@fuel-ts/errors");
7362
+ var import_utils38 = require("@fuel-ts/utils");
6476
7363
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
6477
7364
  var DEFAULT_KDF_PARAMS_R = 8;
6478
7365
  var DEFAULT_KDF_PARAMS_P = 1;
@@ -6548,13 +7435,13 @@ async function decryptKeystoreWallet(jsonWallet, password) {
6548
7435
  const macHashUint8Array = (0, import_crypto6.keccak256)(data);
6549
7436
  const macHash = (0, import_crypto6.stringFromBuffer)(macHashUint8Array, "hex");
6550
7437
  if (mac !== macHash) {
6551
- throw new import_errors20.FuelError(
6552
- import_errors20.ErrorCode.INVALID_PASSWORD,
7438
+ throw new import_errors21.FuelError(
7439
+ import_errors21.ErrorCode.INVALID_PASSWORD,
6553
7440
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
6554
7441
  );
6555
7442
  }
6556
7443
  const buffer = await (0, import_crypto6.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
6557
- const privateKey = (0, import_utils34.hexlify)(buffer);
7444
+ const privateKey = (0, import_utils38.hexlify)(buffer);
6558
7445
  return privateKey;
6559
7446
  }
6560
7447
 
@@ -6598,8 +7485,8 @@ var BaseWalletUnlocked = class extends Account {
6598
7485
  * @returns A promise that resolves to the signature as a ECDSA 64 bytes string.
6599
7486
  */
6600
7487
  async signMessage(message) {
6601
- const signedMessage = await this.signer().sign((0, import_hasher3.hashMessage)(message));
6602
- return (0, import_utils35.hexlify)(signedMessage);
7488
+ const signedMessage = await this.signer().sign((0, import_hasher4.hashMessage)(message));
7489
+ return (0, import_utils39.hexlify)(signedMessage);
6603
7490
  }
6604
7491
  /**
6605
7492
  * Signs a transaction with the wallet's private key.
@@ -6612,7 +7499,7 @@ var BaseWalletUnlocked = class extends Account {
6612
7499
  const chainId = this.provider.getChainId();
6613
7500
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
6614
7501
  const signature = await this.signer().sign(hashedTransaction);
6615
- return (0, import_utils35.hexlify)(signature);
7502
+ return (0, import_utils39.hexlify)(signature);
6616
7503
  }
6617
7504
  /**
6618
7505
  * Populates a transaction with the witnesses signature.
@@ -6679,16 +7566,16 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
6679
7566
 
6680
7567
  // src/hdwallet/hdwallet.ts
6681
7568
  var import_crypto8 = require("@fuel-ts/crypto");
6682
- var import_errors23 = require("@fuel-ts/errors");
6683
- var import_hasher6 = require("@fuel-ts/hasher");
7569
+ var import_errors24 = require("@fuel-ts/errors");
7570
+ var import_hasher7 = require("@fuel-ts/hasher");
6684
7571
  var import_math23 = require("@fuel-ts/math");
6685
- var import_utils39 = require("@fuel-ts/utils");
7572
+ var import_utils43 = require("@fuel-ts/utils");
6686
7573
 
6687
7574
  // src/mnemonic/mnemonic.ts
6688
7575
  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");
7576
+ var import_errors23 = require("@fuel-ts/errors");
7577
+ var import_hasher6 = require("@fuel-ts/hasher");
7578
+ var import_utils41 = require("@fuel-ts/utils");
6692
7579
 
6693
7580
  // src/wordlists/words/english.ts
6694
7581
  var english = [
@@ -8743,9 +9630,9 @@ var english = [
8743
9630
  ];
8744
9631
 
8745
9632
  // 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");
9633
+ var import_errors22 = require("@fuel-ts/errors");
9634
+ var import_hasher5 = require("@fuel-ts/hasher");
9635
+ var import_utils40 = require("@fuel-ts/utils");
8749
9636
  function getLowerMask(bits) {
8750
9637
  return (1 << bits) - 1;
8751
9638
  }
@@ -8780,20 +9667,20 @@ function entropyToMnemonicIndices(entropy) {
8780
9667
  }
8781
9668
  }
8782
9669
  const checksumBits = entropy.length / 4;
8783
- const checksum = (0, import_utils36.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
9670
+ const checksum = (0, import_utils40.arrayify)((0, import_hasher5.sha256)(entropy))[0] & getUpperMask(checksumBits);
8784
9671
  indices[indices.length - 1] <<= checksumBits;
8785
9672
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
8786
9673
  return indices;
8787
9674
  }
8788
9675
  function mnemonicWordsToEntropy(words, wordlist) {
8789
9676
  const size = Math.ceil(11 * words.length / 8);
8790
- const entropy = (0, import_utils36.arrayify)(new Uint8Array(size));
9677
+ const entropy = (0, import_utils40.arrayify)(new Uint8Array(size));
8791
9678
  let offset = 0;
8792
9679
  for (let i = 0; i < words.length; i += 1) {
8793
9680
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
8794
9681
  if (index === -1) {
8795
- throw new import_errors21.FuelError(
8796
- import_errors21.ErrorCode.INVALID_MNEMONIC,
9682
+ throw new import_errors22.FuelError(
9683
+ import_errors22.ErrorCode.INVALID_MNEMONIC,
8797
9684
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
8798
9685
  );
8799
9686
  }
@@ -8807,10 +9694,10 @@ function mnemonicWordsToEntropy(words, wordlist) {
8807
9694
  const entropyBits = 32 * words.length / 3;
8808
9695
  const checksumBits = words.length / 3;
8809
9696
  const checksumMask = getUpperMask(checksumBits);
8810
- const checksum = (0, import_utils36.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
9697
+ const checksum = (0, import_utils40.arrayify)((0, import_hasher5.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
8811
9698
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
8812
- throw new import_errors21.FuelError(
8813
- import_errors21.ErrorCode.INVALID_CHECKSUM,
9699
+ throw new import_errors22.FuelError(
9700
+ import_errors22.ErrorCode.INVALID_CHECKSUM,
8814
9701
  "Checksum validation failed for the provided mnemonic."
8815
9702
  );
8816
9703
  }
@@ -8818,22 +9705,22 @@ function mnemonicWordsToEntropy(words, wordlist) {
8818
9705
  }
8819
9706
 
8820
9707
  // src/mnemonic/mnemonic.ts
8821
- var MasterSecret = (0, import_utils37.toUtf8Bytes)("Bitcoin seed");
9708
+ var MasterSecret = (0, import_utils41.toUtf8Bytes)("Bitcoin seed");
8822
9709
  var MainnetPRV = "0x0488ade4";
8823
9710
  var TestnetPRV = "0x04358394";
8824
9711
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
8825
9712
  function assertWordList(wordlist) {
8826
9713
  if (wordlist.length !== 2048) {
8827
- throw new import_errors22.FuelError(
8828
- import_errors22.ErrorCode.INVALID_WORD_LIST,
9714
+ throw new import_errors23.FuelError(
9715
+ import_errors23.ErrorCode.INVALID_WORD_LIST,
8829
9716
  `Expected word list length of 2048, but got ${wordlist.length}.`
8830
9717
  );
8831
9718
  }
8832
9719
  }
8833
9720
  function assertEntropy(entropy) {
8834
9721
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
8835
- throw new import_errors22.FuelError(
8836
- import_errors22.ErrorCode.INVALID_ENTROPY,
9722
+ throw new import_errors23.FuelError(
9723
+ import_errors23.ErrorCode.INVALID_ENTROPY,
8837
9724
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
8838
9725
  );
8839
9726
  }
@@ -8843,7 +9730,7 @@ function assertMnemonic(words) {
8843
9730
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
8844
9731
  ", "
8845
9732
  )}] words, but got ${words.length}.`;
8846
- throw new import_errors22.FuelError(import_errors22.ErrorCode.INVALID_MNEMONIC, errorMsg);
9733
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.INVALID_MNEMONIC, errorMsg);
8847
9734
  }
8848
9735
  }
8849
9736
  var Mnemonic = class {
@@ -8882,7 +9769,7 @@ var Mnemonic = class {
8882
9769
  static mnemonicToEntropy(phrase, wordlist = english) {
8883
9770
  const words = getWords(phrase);
8884
9771
  assertMnemonic(words);
8885
- return (0, import_utils37.hexlify)(mnemonicWordsToEntropy(words, wordlist));
9772
+ return (0, import_utils41.hexlify)(mnemonicWordsToEntropy(words, wordlist));
8886
9773
  }
8887
9774
  /**
8888
9775
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -8890,7 +9777,7 @@ var Mnemonic = class {
8890
9777
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
8891
9778
  */
8892
9779
  static entropyToMnemonic(entropy, wordlist = english) {
8893
- const entropyBytes = (0, import_utils37.arrayify)(entropy);
9780
+ const entropyBytes = (0, import_utils41.arrayify)(entropy);
8894
9781
  assertWordList(wordlist);
8895
9782
  assertEntropy(entropyBytes);
8896
9783
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -8902,8 +9789,8 @@ var Mnemonic = class {
8902
9789
  */
8903
9790
  static mnemonicToSeed(phrase, passphrase = "") {
8904
9791
  assertMnemonic(getWords(phrase));
8905
- const phraseBytes = (0, import_utils37.toUtf8Bytes)(getPhrase(phrase));
8906
- const salt = (0, import_utils37.toUtf8Bytes)(`mnemonic${passphrase}`);
9792
+ const phraseBytes = (0, import_utils41.toUtf8Bytes)(getPhrase(phrase));
9793
+ const salt = (0, import_utils41.toUtf8Bytes)(`mnemonic${passphrase}`);
8907
9794
  return (0, import_crypto7.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
8908
9795
  }
8909
9796
  /**
@@ -8959,14 +9846,14 @@ var Mnemonic = class {
8959
9846
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
8960
9847
  */
8961
9848
  static masterKeysFromSeed(seed) {
8962
- const seedArray = (0, import_utils37.arrayify)(seed);
9849
+ const seedArray = (0, import_utils41.arrayify)(seed);
8963
9850
  if (seedArray.length < 16 || seedArray.length > 64) {
8964
- throw new import_errors22.FuelError(
8965
- import_errors22.ErrorCode.INVALID_SEED,
9851
+ throw new import_errors23.FuelError(
9852
+ import_errors23.ErrorCode.INVALID_SEED,
8966
9853
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
8967
9854
  );
8968
9855
  }
8969
- return (0, import_utils37.arrayify)((0, import_crypto7.computeHmac)("sha512", MasterSecret, seedArray));
9856
+ return (0, import_utils41.arrayify)((0, import_crypto7.computeHmac)("sha512", MasterSecret, seedArray));
8970
9857
  }
8971
9858
  /**
8972
9859
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -8977,22 +9864,22 @@ var Mnemonic = class {
8977
9864
  */
8978
9865
  static seedToExtendedKey(seed, testnet = false) {
8979
9866
  const masterKey = Mnemonic.masterKeysFromSeed(seed);
8980
- const prefix = (0, import_utils37.arrayify)(testnet ? TestnetPRV : MainnetPRV);
9867
+ const prefix = (0, import_utils41.arrayify)(testnet ? TestnetPRV : MainnetPRV);
8981
9868
  const depth = "0x00";
8982
9869
  const fingerprint = "0x00000000";
8983
9870
  const index = "0x00000000";
8984
9871
  const chainCode = masterKey.slice(32);
8985
9872
  const privateKey = masterKey.slice(0, 32);
8986
- const extendedKey = (0, import_utils37.concat)([
9873
+ const extendedKey = (0, import_utils41.concat)([
8987
9874
  prefix,
8988
9875
  depth,
8989
9876
  fingerprint,
8990
9877
  index,
8991
9878
  chainCode,
8992
- (0, import_utils37.concat)(["0x00", privateKey])
9879
+ (0, import_utils41.concat)(["0x00", privateKey])
8993
9880
  ]);
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]));
9881
+ const checksum = (0, import_utils41.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(extendedKey)), 0, 4);
9882
+ return (0, import_utils41.encodeBase58)((0, import_utils41.concat)([extendedKey, checksum]));
8996
9883
  }
8997
9884
  /**
8998
9885
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -9007,7 +9894,7 @@ var Mnemonic = class {
9007
9894
  * @returns A randomly generated mnemonic
9008
9895
  */
9009
9896
  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);
9897
+ 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
9898
  return Mnemonic.entropyToMnemonic(entropy);
9012
9899
  }
9013
9900
  };
@@ -9015,12 +9902,12 @@ var mnemonic_default = Mnemonic;
9015
9902
 
9016
9903
  // src/hdwallet/hdwallet.ts
9017
9904
  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");
9905
+ var MainnetPRV2 = (0, import_utils43.hexlify)("0x0488ade4");
9906
+ var MainnetPUB = (0, import_utils43.hexlify)("0x0488b21e");
9907
+ var TestnetPRV2 = (0, import_utils43.hexlify)("0x04358394");
9908
+ var TestnetPUB = (0, import_utils43.hexlify)("0x043587cf");
9022
9909
  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)]));
9910
+ 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
9911
  }
9025
9912
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
9026
9913
  if (isPublic) {
@@ -9029,17 +9916,17 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
9029
9916
  return testnet ? TestnetPRV2 : MainnetPRV2;
9030
9917
  }
9031
9918
  function isPublicExtendedKey(extendedKey) {
9032
- return [MainnetPUB, TestnetPUB].includes((0, import_utils39.hexlify)(extendedKey.slice(0, 4)));
9919
+ return [MainnetPUB, TestnetPUB].includes((0, import_utils43.hexlify)(extendedKey.slice(0, 4)));
9033
9920
  }
9034
9921
  function isValidExtendedKey(extendedKey) {
9035
9922
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
9036
- (0, import_utils39.hexlify)(extendedKey.slice(0, 4))
9923
+ (0, import_utils43.hexlify)(extendedKey.slice(0, 4))
9037
9924
  );
9038
9925
  }
9039
9926
  function parsePath(path2, depth = 0) {
9040
9927
  const components = path2.split("/");
9041
9928
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
9042
- throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path2}`);
9929
+ throw new import_errors24.FuelError(import_errors24.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path2}`);
9043
9930
  }
9044
9931
  if (components[0] === "m") {
9045
9932
  components.shift();
@@ -9051,8 +9938,8 @@ function parsePath(path2, depth = 0) {
9051
9938
  var HDWallet = class {
9052
9939
  depth = 0;
9053
9940
  index = 0;
9054
- fingerprint = (0, import_utils39.hexlify)("0x00000000");
9055
- parentFingerprint = (0, import_utils39.hexlify)("0x00000000");
9941
+ fingerprint = (0, import_utils43.hexlify)("0x00000000");
9942
+ parentFingerprint = (0, import_utils43.hexlify)("0x00000000");
9056
9943
  privateKey;
9057
9944
  publicKey;
9058
9945
  chainCode;
@@ -9064,19 +9951,19 @@ var HDWallet = class {
9064
9951
  constructor(config) {
9065
9952
  if (config.privateKey) {
9066
9953
  const signer = new Signer(config.privateKey);
9067
- this.publicKey = (0, import_utils39.hexlify)(signer.compressedPublicKey);
9068
- this.privateKey = (0, import_utils39.hexlify)(config.privateKey);
9954
+ this.publicKey = (0, import_utils43.hexlify)(signer.compressedPublicKey);
9955
+ this.privateKey = (0, import_utils43.hexlify)(config.privateKey);
9069
9956
  } else {
9070
9957
  if (!config.publicKey) {
9071
- throw new import_errors23.FuelError(
9072
- import_errors23.ErrorCode.HD_WALLET_ERROR,
9958
+ throw new import_errors24.FuelError(
9959
+ import_errors24.ErrorCode.HD_WALLET_ERROR,
9073
9960
  "Both public and private Key cannot be missing. At least one should be provided."
9074
9961
  );
9075
9962
  }
9076
- this.publicKey = (0, import_utils39.hexlify)(config.publicKey);
9963
+ this.publicKey = (0, import_utils43.hexlify)(config.publicKey);
9077
9964
  }
9078
9965
  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);
9966
+ this.fingerprint = (0, import_utils43.dataSlice)((0, import_crypto8.ripemd160)((0, import_hasher7.sha256)(this.publicKey)), 0, 4);
9080
9967
  this.depth = config.depth || this.depth;
9081
9968
  this.index = config.index || this.index;
9082
9969
  this.chainCode = config.chainCode;
@@ -9092,23 +9979,23 @@ var HDWallet = class {
9092
9979
  * @returns A new instance of HDWallet on the derived index
9093
9980
  */
9094
9981
  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);
9982
+ const privateKey = this.privateKey && (0, import_utils43.arrayify)(this.privateKey);
9983
+ const publicKey = (0, import_utils43.arrayify)(this.publicKey);
9984
+ const chainCode = (0, import_utils43.arrayify)(this.chainCode);
9098
9985
  const data = new Uint8Array(37);
9099
9986
  if (index & HARDENED_INDEX) {
9100
9987
  if (!privateKey) {
9101
- throw new import_errors23.FuelError(
9102
- import_errors23.ErrorCode.HD_WALLET_ERROR,
9988
+ throw new import_errors24.FuelError(
9989
+ import_errors24.ErrorCode.HD_WALLET_ERROR,
9103
9990
  "Cannot derive a hardened index without a private Key."
9104
9991
  );
9105
9992
  }
9106
9993
  data.set(privateKey, 1);
9107
9994
  } else {
9108
- data.set((0, import_utils39.arrayify)(this.publicKey));
9995
+ data.set((0, import_utils43.arrayify)(this.publicKey));
9109
9996
  }
9110
9997
  data.set((0, import_math23.toBytes)(index, 4), 33);
9111
- const bytes = (0, import_utils39.arrayify)((0, import_crypto8.computeHmac)("sha512", chainCode, data));
9998
+ const bytes = (0, import_utils43.arrayify)((0, import_crypto8.computeHmac)("sha512", chainCode, data));
9112
9999
  const IL = bytes.slice(0, 32);
9113
10000
  const IR = bytes.slice(32);
9114
10001
  if (privateKey) {
@@ -9122,7 +10009,7 @@ var HDWallet = class {
9122
10009
  parentFingerprint: this.fingerprint
9123
10010
  });
9124
10011
  }
9125
- const signer = new Signer((0, import_utils39.hexlify)(IL));
10012
+ const signer = new Signer((0, import_utils43.hexlify)(IL));
9126
10013
  const Ki = signer.addPoint(publicKey);
9127
10014
  return new HDWallet({
9128
10015
  publicKey: Ki,
@@ -9151,18 +10038,18 @@ var HDWallet = class {
9151
10038
  */
9152
10039
  toExtendedKey(isPublic = false, testnet = false) {
9153
10040
  if (this.depth >= 256) {
9154
- throw new import_errors23.FuelError(
9155
- import_errors23.ErrorCode.HD_WALLET_ERROR,
10041
+ throw new import_errors24.FuelError(
10042
+ import_errors24.ErrorCode.HD_WALLET_ERROR,
9156
10043
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
9157
10044
  );
9158
10045
  }
9159
10046
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
9160
- const depth = (0, import_utils39.hexlify)(Uint8Array.from([this.depth]));
10047
+ const depth = (0, import_utils43.hexlify)(Uint8Array.from([this.depth]));
9161
10048
  const parentFingerprint = this.parentFingerprint;
9162
10049
  const index = (0, import_math23.toHex)(this.index, 4);
9163
10050
  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]));
10051
+ const key = this.privateKey != null && !isPublic ? (0, import_utils43.concat)(["0x00", this.privateKey]) : this.publicKey;
10052
+ const extendedKey = (0, import_utils43.arrayify)((0, import_utils43.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
9166
10053
  return base58check(extendedKey);
9167
10054
  }
9168
10055
  /**
@@ -9174,34 +10061,34 @@ var HDWallet = class {
9174
10061
  static fromSeed(seed) {
9175
10062
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
9176
10063
  return new HDWallet({
9177
- chainCode: (0, import_utils39.arrayify)(masterKey.slice(32)),
9178
- privateKey: (0, import_utils39.arrayify)(masterKey.slice(0, 32))
10064
+ chainCode: (0, import_utils43.arrayify)(masterKey.slice(32)),
10065
+ privateKey: (0, import_utils43.arrayify)(masterKey.slice(0, 32))
9179
10066
  });
9180
10067
  }
9181
10068
  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);
10069
+ const decoded = (0, import_utils43.hexlify)((0, import_math23.toBytes)((0, import_utils43.decodeBase58)(extendedKey)));
10070
+ const bytes = (0, import_utils43.arrayify)(decoded);
9184
10071
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
9185
10072
  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.");
10073
+ throw new import_errors24.FuelError(import_errors24.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
9187
10074
  }
9188
10075
  if (!validChecksum) {
9189
- throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
10076
+ throw new import_errors24.FuelError(import_errors24.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
9190
10077
  }
9191
10078
  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));
10079
+ const parentFingerprint = (0, import_utils43.hexlify)(bytes.slice(5, 9));
10080
+ const index = parseInt((0, import_utils43.hexlify)(bytes.slice(9, 13)).substring(2), 16);
10081
+ const chainCode = (0, import_utils43.hexlify)(bytes.slice(13, 45));
9195
10082
  const key = bytes.slice(45, 78);
9196
10083
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
9197
- throw new import_errors23.FuelError(
9198
- import_errors23.ErrorCode.HD_WALLET_ERROR,
10084
+ throw new import_errors24.FuelError(
10085
+ import_errors24.ErrorCode.HD_WALLET_ERROR,
9199
10086
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
9200
10087
  );
9201
10088
  }
9202
10089
  if (isPublicExtendedKey(bytes)) {
9203
10090
  if (key[0] !== 3) {
9204
- throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
10091
+ throw new import_errors24.FuelError(import_errors24.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
9205
10092
  }
9206
10093
  return new HDWallet({
9207
10094
  publicKey: key,
@@ -9212,7 +10099,7 @@ var HDWallet = class {
9212
10099
  });
9213
10100
  }
9214
10101
  if (key[0] !== 0) {
9215
- throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
10102
+ throw new import_errors24.FuelError(import_errors24.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
9216
10103
  }
9217
10104
  return new HDWallet({
9218
10105
  privateKey: key.slice(1),
@@ -9409,7 +10296,7 @@ var WalletsConfig = class {
9409
10296
  return {
9410
10297
  ...snapshotConfig,
9411
10298
  stateConfig: {
9412
- ...snapshotConfig?.stateConfig ?? import_utils40.defaultSnapshotConfigs.stateConfig,
10299
+ ...snapshotConfig?.stateConfig ?? import_utils44.defaultSnapshotConfigs.stateConfig,
9413
10300
  coins: this.initialState.coins.concat(snapshotConfig?.stateConfig?.coins || []),
9414
10301
  messages: this.initialState.messages.concat(snapshotConfig?.stateConfig?.messages ?? [])
9415
10302
  }
@@ -9442,7 +10329,7 @@ var WalletsConfig = class {
9442
10329
  tx_pointer_block_height: 0,
9443
10330
  tx_pointer_tx_idx: 0,
9444
10331
  output_index: 0,
9445
- tx_id: (0, import_utils40.hexlify)((0, import_crypto9.randomBytes)(32))
10332
+ tx_id: (0, import_utils44.hexlify)((0, import_crypto9.randomBytes)(32))
9446
10333
  });
9447
10334
  }
9448
10335
  });
@@ -9456,26 +10343,26 @@ var WalletsConfig = class {
9456
10343
  amountPerCoin
9457
10344
  }) {
9458
10345
  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,
10346
+ throw new import_errors25.FuelError(
10347
+ import_errors25.FuelError.CODES.INVALID_INPUT_PARAMETERS,
9461
10348
  "Number of wallets must be greater than zero."
9462
10349
  );
9463
10350
  }
9464
10351
  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,
10352
+ throw new import_errors25.FuelError(
10353
+ import_errors25.FuelError.CODES.INVALID_INPUT_PARAMETERS,
9467
10354
  "Number of assets per wallet must be greater than zero."
9468
10355
  );
9469
10356
  }
9470
10357
  if (coinsPerAsset <= 0) {
9471
- throw new import_errors24.FuelError(
9472
- import_errors24.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10358
+ throw new import_errors25.FuelError(
10359
+ import_errors25.FuelError.CODES.INVALID_INPUT_PARAMETERS,
9473
10360
  "Number of coins per asset must be greater than zero."
9474
10361
  );
9475
10362
  }
9476
10363
  if (amountPerCoin < 0) {
9477
- throw new import_errors24.FuelError(
9478
- import_errors24.FuelError.CODES.INVALID_INPUT_PARAMETERS,
10364
+ throw new import_errors25.FuelError(
10365
+ import_errors25.FuelError.CODES.INVALID_INPUT_PARAMETERS,
9479
10366
  "Amount per coin must be greater than or equal to zero."
9480
10367
  );
9481
10368
  }
@@ -9498,7 +10385,7 @@ async function setupTestProviderAndWallets({
9498
10385
  } = {}) {
9499
10386
  Symbol.dispose ??= Symbol("Symbol.dispose");
9500
10387
  const walletsConfig = new WalletsConfig(
9501
- nodeOptions.snapshotConfig?.chainConfig?.consensus_parameters?.V1?.base_asset_id ?? import_utils41.defaultSnapshotConfigs.chainConfig.consensus_parameters.V1.base_asset_id,
10388
+ nodeOptions.snapshotConfig?.chainConfig?.consensus_parameters?.V1?.base_asset_id ?? import_utils45.defaultSnapshotConfigs.chainConfig.consensus_parameters.V1.base_asset_id,
9502
10389
  {
9503
10390
  ...defaultWalletConfigOptions,
9504
10391
  ...walletsConfigOptions
@@ -9507,8 +10394,8 @@ async function setupTestProviderAndWallets({
9507
10394
  const launchNodeOptions = {
9508
10395
  loggingEnabled: false,
9509
10396
  ...nodeOptions,
9510
- snapshotConfig: (0, import_ramda8.mergeDeepRight)(
9511
- import_utils41.defaultSnapshotConfigs,
10397
+ snapshotConfig: (0, import_ramda10.mergeDeepRight)(
10398
+ import_utils45.defaultSnapshotConfigs,
9512
10399
  walletsConfig.apply(nodeOptions?.snapshotConfig)
9513
10400
  ),
9514
10401
  port: nodeOptions.port || "0"
@@ -9549,7 +10436,7 @@ async function setupTestProviderAndWallets({
9549
10436
  var import_address7 = require("@fuel-ts/address");
9550
10437
  var import_crypto10 = require("@fuel-ts/crypto");
9551
10438
  var import_math24 = require("@fuel-ts/math");
9552
- var import_utils42 = require("@fuel-ts/utils");
10439
+ var import_utils46 = require("@fuel-ts/utils");
9553
10440
  var TestMessage = class {
9554
10441
  sender;
9555
10442
  recipient;
@@ -9566,7 +10453,7 @@ var TestMessage = class {
9566
10453
  constructor({
9567
10454
  sender = import_address7.Address.fromRandom(),
9568
10455
  recipient = import_address7.Address.fromRandom(),
9569
- nonce = (0, import_utils42.hexlify)((0, import_crypto10.randomBytes)(32)),
10456
+ nonce = (0, import_utils46.hexlify)((0, import_crypto10.randomBytes)(32)),
9570
10457
  amount = 1e6,
9571
10458
  data = "",
9572
10459
  // Will default to empty data in order to be a spendable message