@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
package/dist/index.js CHANGED
@@ -94,6 +94,8 @@ __export(src_exports, {
94
94
  TransactionStatus: () => TransactionStatus,
95
95
  TransactionType: () => import_transactions7.TransactionType,
96
96
  TransactionTypeName: () => TransactionTypeName,
97
+ UpgradeTransactionRequest: () => UpgradeTransactionRequest,
98
+ UploadTransactionRequest: () => UploadTransactionRequest,
97
99
  Vault: () => Vault,
98
100
  Wallet: () => Wallet,
99
101
  WalletLocked: () => WalletLocked,
@@ -115,6 +117,9 @@ __export(src_exports, {
115
117
  calculateMetadataGasForTxBlob: () => calculateMetadataGasForTxBlob,
116
118
  calculateMetadataGasForTxCreate: () => calculateMetadataGasForTxCreate,
117
119
  calculateMetadataGasForTxScript: () => calculateMetadataGasForTxScript,
120
+ calculateMetadataGasForTxUpgrade: () => calculateMetadataGasForTxUpgrade,
121
+ calculateMetadataGasForTxUpload: () => calculateMetadataGasForTxUpload,
122
+ calculateMinGasForTxUpload: () => calculateMinGasForTxUpload,
118
123
  calculateTXFeeForSummary: () => calculateTXFeeForSummary,
119
124
  coinQuantityfy: () => coinQuantityfy,
120
125
  deferPromise: () => deferPromise,
@@ -185,6 +190,8 @@ __export(src_exports, {
185
190
  isTransactionTypeBlob: () => isTransactionTypeBlob,
186
191
  isTransactionTypeCreate: () => isTransactionTypeCreate,
187
192
  isTransactionTypeScript: () => isTransactionTypeScript,
193
+ isTransactionTypeUpgrade: () => isTransactionTypeUpgrade,
194
+ isTransactionTypeUpload: () => isTransactionTypeUpload,
188
195
  isType: () => isType,
189
196
  isTypeBlob: () => isTypeBlob,
190
197
  isTypeCreate: () => isTypeCreate,
@@ -211,12 +218,12 @@ module.exports = __toCommonJS(src_exports);
211
218
  var import_abi_coder7 = require("@fuel-ts/abi-coder");
212
219
  var import_address4 = require("@fuel-ts/address");
213
220
  var import_crypto2 = require("@fuel-ts/crypto");
214
- var import_errors18 = require("@fuel-ts/errors");
221
+ var import_errors19 = require("@fuel-ts/errors");
215
222
  var import_interfaces = require("@fuel-ts/interfaces");
216
223
  var import_math21 = require("@fuel-ts/math");
217
- var import_transactions22 = require("@fuel-ts/transactions");
218
- var import_utils30 = require("@fuel-ts/utils");
219
- var import_ramda7 = require("ramda");
224
+ var import_transactions24 = require("@fuel-ts/transactions");
225
+ var import_utils34 = require("@fuel-ts/utils");
226
+ var import_ramda9 = require("ramda");
220
227
 
221
228
  // src/providers/coin-quantity.ts
222
229
  var import_math = require("@fuel-ts/math");
@@ -255,15 +262,15 @@ var addAmountToCoinQuantities = (params) => {
255
262
 
256
263
  // src/providers/provider.ts
257
264
  var import_address3 = require("@fuel-ts/address");
258
- var import_errors16 = require("@fuel-ts/errors");
265
+ var import_errors17 = require("@fuel-ts/errors");
259
266
  var import_math18 = require("@fuel-ts/math");
260
- var import_transactions20 = require("@fuel-ts/transactions");
261
- var import_utils24 = require("@fuel-ts/utils");
267
+ var import_transactions22 = require("@fuel-ts/transactions");
268
+ var import_utils28 = require("@fuel-ts/utils");
262
269
  var import_versions = require("@fuel-ts/versions");
263
- var import_utils25 = require("@noble/curves/abstract/utils");
270
+ var import_utils29 = require("@noble/curves/abstract/utils");
264
271
  var import_graphql_request = require("graphql-request");
265
272
  var import_graphql_tag2 = __toESM(require("graphql-tag"));
266
- var import_ramda6 = require("ramda");
273
+ var import_ramda8 = require("ramda");
267
274
 
268
275
  // src/providers/__generated__/operations.ts
269
276
  var import_graphql_tag = __toESM(require("graphql-tag"));
@@ -1819,7 +1826,7 @@ function assembleReceiptByType(receipt) {
1819
1826
 
1820
1827
  // src/providers/utils/block-explorer.ts
1821
1828
  var import_errors6 = require("@fuel-ts/errors");
1822
- var DEFAULT_BLOCK_EXPLORER_URL = "https://fuellabs.github.io/block-explorer-v2";
1829
+ var DEFAULT_BLOCK_EXPLORER_URL = "https://app.fuel.network";
1823
1830
  var getPathFromInput = (key, value) => {
1824
1831
  const pathMap = {
1825
1832
  address: `address`,
@@ -1979,6 +1986,39 @@ function calculateMetadataGasForTxBlob({
1979
1986
  const blobLen = resolveGasDependentCosts(witnessBytesSize, gasCosts.s256);
1980
1987
  return txId.add(blobLen);
1981
1988
  }
1989
+ function calculateMetadataGasForTxUpgrade({
1990
+ gasCosts,
1991
+ txBytesSize,
1992
+ consensusSize
1993
+ }) {
1994
+ const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
1995
+ if (consensusSize) {
1996
+ const consensusLen = resolveGasDependentCosts(consensusSize, gasCosts.s256);
1997
+ txId.add(consensusLen);
1998
+ }
1999
+ return txId;
2000
+ }
2001
+ function calculateMetadataGasForTxUpload({
2002
+ gasCosts,
2003
+ txBytesSize,
2004
+ subsectionSize,
2005
+ subsectionsSize
2006
+ }) {
2007
+ const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
2008
+ const subsectionLen = resolveGasDependentCosts(subsectionSize, gasCosts.s256);
2009
+ txId.add(subsectionLen);
2010
+ const subsectionsLen = resolveGasDependentCosts(subsectionsSize, gasCosts.stateRoot);
2011
+ txId.add(subsectionsLen);
2012
+ return txId;
2013
+ }
2014
+ function calculateMinGasForTxUpload({
2015
+ gasCosts,
2016
+ baseMinGas,
2017
+ subsectionSize
2018
+ }) {
2019
+ const additionalStoragePerByte = (0, import_math5.bn)(gasCosts.newStoragePerByte).mul(subsectionSize);
2020
+ return (0, import_math5.bn)(baseMinGas).add(additionalStoragePerByte);
2021
+ }
1982
2022
  var calculateGasFee = (params) => {
1983
2023
  const { gas, gasPrice, priceFactor, tip } = params;
1984
2024
  return gas.mul(gasPrice).div(priceFactor).add((0, import_math5.bn)(tip));
@@ -3147,51 +3187,316 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
3147
3187
  }
3148
3188
  };
3149
3189
 
3150
- // src/providers/transaction-request/utils.ts
3190
+ // src/providers/transaction-request/upgrade-transaction-request.ts
3151
3191
  var import_errors10 = require("@fuel-ts/errors");
3192
+ var import_hasher2 = require("@fuel-ts/hasher");
3152
3193
  var import_transactions11 = require("@fuel-ts/transactions");
3194
+ var import_utils17 = require("@fuel-ts/utils");
3195
+ var import_ramda6 = require("ramda");
3196
+ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3197
+ static from(obj) {
3198
+ if (obj instanceof UpgradeTransactionRequest) {
3199
+ return obj;
3200
+ }
3201
+ return new this((0, import_ramda6.clone)(obj));
3202
+ }
3203
+ /** The type of transaction */
3204
+ type = import_transactions11.TransactionType.Upgrade;
3205
+ /** The upgrade purpose */
3206
+ upgradePurpose;
3207
+ /** Witness index of consensus */
3208
+ bytecodeWitnessIndex;
3209
+ /**
3210
+ * Creates an instance `UpgradeTransactionRequest`.
3211
+ *
3212
+ * @param upgradeTransactionRequestLike - The initial values for the instance
3213
+ */
3214
+ constructor({
3215
+ upgradePurpose,
3216
+ bytecodeWitnessIndex,
3217
+ ...rest
3218
+ } = {}) {
3219
+ super(rest);
3220
+ this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
3221
+ this.upgradePurpose = upgradePurpose ?? {
3222
+ type: import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters,
3223
+ checksum: "0x"
3224
+ };
3225
+ }
3226
+ /**
3227
+ * Adds a consensus parameters upgrade purpose.
3228
+ *
3229
+ * @param consensus - The consensus bytecode.
3230
+ *
3231
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3232
+ */
3233
+ addConsensusParametersUpgradePurpose(consensus) {
3234
+ this.bytecodeWitnessIndex = this.addWitness(consensus);
3235
+ this.upgradePurpose = {
3236
+ type: import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters,
3237
+ checksum: (0, import_hasher2.hash)(consensus)
3238
+ };
3239
+ return this;
3240
+ }
3241
+ /**
3242
+ * Adds a state transition upgrade purpose.
3243
+ *
3244
+ * @param bytecodeRoot - The Merkle root of the state transition.
3245
+ *
3246
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3247
+ */
3248
+ addStateTransitionUpgradePurpose(bytecodeRoot) {
3249
+ this.upgradePurpose = {
3250
+ type: import_transactions11.UpgradePurposeTypeEnum.StateTransition,
3251
+ data: (0, import_utils17.hexlify)(bytecodeRoot)
3252
+ };
3253
+ return this;
3254
+ }
3255
+ /**
3256
+ * Adds an upgrade purpose.
3257
+ *
3258
+ * @param type - The upgrade purpose type.
3259
+ * @param data - The bytecode or merkle root of upgrade purpose
3260
+ *
3261
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3262
+ */
3263
+ addUpgradePurpose(type, data) {
3264
+ if (type === import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters) {
3265
+ this.addConsensusParametersUpgradePurpose(data);
3266
+ }
3267
+ if (type === import_transactions11.UpgradePurposeTypeEnum.StateTransition) {
3268
+ this.addStateTransitionUpgradePurpose(data);
3269
+ }
3270
+ return this;
3271
+ }
3272
+ /**
3273
+ * Converts the transaction request to a `TransactionUpgrade`.
3274
+ *
3275
+ * @returns The transaction create object.
3276
+ */
3277
+ toTransaction() {
3278
+ let upgradePurpose;
3279
+ if (this.upgradePurpose.type === import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters) {
3280
+ upgradePurpose = {
3281
+ type: import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters,
3282
+ data: {
3283
+ witnessIndex: this.bytecodeWitnessIndex,
3284
+ checksum: this.upgradePurpose.checksum
3285
+ }
3286
+ };
3287
+ } else if (this.upgradePurpose.type === import_transactions11.UpgradePurposeTypeEnum.StateTransition) {
3288
+ upgradePurpose = {
3289
+ type: import_transactions11.UpgradePurposeTypeEnum.StateTransition,
3290
+ data: {
3291
+ bytecodeRoot: (0, import_utils17.hexlify)(this.upgradePurpose.data)
3292
+ }
3293
+ };
3294
+ } else {
3295
+ throw new import_errors10.FuelError(import_errors10.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3296
+ }
3297
+ return {
3298
+ type: import_transactions11.TransactionType.Upgrade,
3299
+ ...super.getBaseTransaction(),
3300
+ upgradePurpose
3301
+ };
3302
+ }
3303
+ /**
3304
+ * Gets the Transaction ID by hashing the transaction
3305
+ *
3306
+ * @param chainId - The chain ID.
3307
+ *
3308
+ * @returns - A hash of the transaction, which is the transaction ID.
3309
+ */
3310
+ getTransactionId(chainId) {
3311
+ return hashTransaction(this, chainId);
3312
+ }
3313
+ /**
3314
+ * Calculates the metadata gas cost for an upgrade transaction.
3315
+ *
3316
+ * @param gasCosts - gas costs passed from the chain.
3317
+ *
3318
+ * @returns metadata gas cost for the upgrade transaction.
3319
+ */
3320
+ metadataGas(gasCosts) {
3321
+ const txBytesSize = this.byteSize();
3322
+ if (this.upgradePurpose.type === import_transactions11.UpgradePurposeTypeEnum.ConsensusParameters) {
3323
+ const witnessIndex = this.bytecodeWitnessIndex;
3324
+ const consensusSize = this.witnesses[witnessIndex].length;
3325
+ return calculateMetadataGasForTxUpgrade({
3326
+ gasCosts,
3327
+ txBytesSize,
3328
+ consensusSize
3329
+ });
3330
+ }
3331
+ if (this.upgradePurpose.type === import_transactions11.UpgradePurposeTypeEnum.StateTransition) {
3332
+ return calculateMetadataGasForTxUpgrade({
3333
+ gasCosts,
3334
+ txBytesSize
3335
+ });
3336
+ }
3337
+ throw new import_errors10.FuelError(import_errors10.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3338
+ }
3339
+ };
3340
+
3341
+ // src/providers/transaction-request/upload-transaction-request.ts
3342
+ var import_configs10 = require("@fuel-ts/address/configs");
3343
+ var import_transactions12 = require("@fuel-ts/transactions");
3344
+ var import_utils19 = require("@fuel-ts/utils");
3345
+ var import_ramda7 = require("ramda");
3346
+ var UploadTransactionRequest = class extends BaseTransactionRequest {
3347
+ static from(obj) {
3348
+ if (obj instanceof UploadTransactionRequest) {
3349
+ return obj;
3350
+ }
3351
+ return new this((0, import_ramda7.clone)(obj));
3352
+ }
3353
+ /** Type of the transaction */
3354
+ type = import_transactions12.TransactionType.Upload;
3355
+ /** The witness index of the subsection of the bytecode. */
3356
+ witnessIndex;
3357
+ /** The subsection data. */
3358
+ subsection;
3359
+ /**
3360
+ * Creates an instance `UploadTransactionRequest`.
3361
+ *
3362
+ * @param uploadTransactionRequestLike - The initial values for the instance
3363
+ */
3364
+ constructor({ witnessIndex, subsection, ...rest } = {}) {
3365
+ super(rest);
3366
+ this.witnessIndex = witnessIndex ?? 0;
3367
+ this.subsection = subsection ?? {
3368
+ proofSet: [],
3369
+ root: import_configs10.ZeroBytes32,
3370
+ subsectionIndex: 0,
3371
+ subsectionsNumber: 0
3372
+ };
3373
+ }
3374
+ /**
3375
+ * Adds the subsection.
3376
+ *
3377
+ * @param subsection - The subsection data.
3378
+ */
3379
+ addSubsection(subsection) {
3380
+ const { subsection: subsectionBytecode, ...rest } = subsection;
3381
+ this.subsection = rest;
3382
+ this.witnessIndex = this.addWitness(subsectionBytecode);
3383
+ }
3384
+ /**
3385
+ * Gets the Transaction Request by hashing the transaction.
3386
+ *
3387
+ * @param chainId - The chain ID.
3388
+ *
3389
+ * @returns - A hash of the transaction, which is the transaction ID.
3390
+ */
3391
+ getTransactionId(chainId) {
3392
+ return hashTransaction(this, chainId);
3393
+ }
3394
+ /**
3395
+ * Converts the transaction request to a `TransactionUpload`.
3396
+ *
3397
+ * @returns The transaction create object.
3398
+ */
3399
+ toTransaction() {
3400
+ const baseTransaction = this.getBaseTransaction();
3401
+ const { subsectionIndex, subsectionsNumber, root, proofSet } = this.subsection;
3402
+ return {
3403
+ type: import_transactions12.TransactionType.Upload,
3404
+ ...baseTransaction,
3405
+ subsectionIndex,
3406
+ subsectionsNumber,
3407
+ root: (0, import_utils19.hexlify)(root),
3408
+ proofSet: proofSet.map(import_utils19.hexlify),
3409
+ witnessIndex: this.witnessIndex,
3410
+ proofSetCount: proofSet.length
3411
+ };
3412
+ }
3413
+ /**
3414
+ * Calculates the metadata gas cost for an upload transaction.
3415
+ *
3416
+ * @param gasCosts - gas costs passed from the chain.
3417
+ *
3418
+ * @returns metadata gas cost for the upload transaction.
3419
+ */
3420
+ metadataGas(gasCosts) {
3421
+ return calculateMetadataGasForTxUpload({
3422
+ gasCosts,
3423
+ txBytesSize: this.byteSize(),
3424
+ subsectionSize: (0, import_utils19.arrayify)(this.witnesses[this.witnessIndex]).length,
3425
+ subsectionsSize: this.subsection.subsectionsNumber
3426
+ });
3427
+ }
3428
+ /**
3429
+ * Calculates the minimum gas for an upload transaction.
3430
+ *
3431
+ * @param chainInfo - The chain information.
3432
+ *
3433
+ * @returns the minimum gas for the upload transaction
3434
+ */
3435
+ calculateMinGas(chainInfo) {
3436
+ const minGas = super.calculateMinGas(chainInfo);
3437
+ const { gasCosts } = chainInfo.consensusParameters;
3438
+ const bytecode = this.witnesses[this.witnessIndex] ?? import_configs10.ZeroBytes32;
3439
+ return calculateMinGasForTxUpload({
3440
+ gasCosts,
3441
+ baseMinGas: minGas.toNumber(),
3442
+ subsectionSize: (0, import_utils19.arrayify)(bytecode).length
3443
+ });
3444
+ }
3445
+ };
3446
+
3447
+ // src/providers/transaction-request/utils.ts
3448
+ var import_errors11 = require("@fuel-ts/errors");
3449
+ var import_transactions13 = require("@fuel-ts/transactions");
3153
3450
  var transactionRequestify = (obj) => {
3154
- if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest) {
3451
+ if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
3155
3452
  return obj;
3156
3453
  }
3157
3454
  const { type } = obj;
3158
3455
  switch (obj.type) {
3159
- case import_transactions11.TransactionType.Script: {
3456
+ case import_transactions13.TransactionType.Script: {
3160
3457
  return ScriptTransactionRequest.from(obj);
3161
3458
  }
3162
- case import_transactions11.TransactionType.Create: {
3459
+ case import_transactions13.TransactionType.Create: {
3163
3460
  return CreateTransactionRequest.from(obj);
3164
3461
  }
3165
- case import_transactions11.TransactionType.Blob: {
3462
+ case import_transactions13.TransactionType.Blob: {
3166
3463
  return BlobTransactionRequest.from(obj);
3167
3464
  }
3465
+ case import_transactions13.TransactionType.Upgrade: {
3466
+ return UpgradeTransactionRequest.from(obj);
3467
+ }
3468
+ case import_transactions13.TransactionType.Upload: {
3469
+ return UploadTransactionRequest.from(obj);
3470
+ }
3168
3471
  default: {
3169
- throw new import_errors10.FuelError(
3170
- import_errors10.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3472
+ throw new import_errors11.FuelError(
3473
+ import_errors11.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3171
3474
  `Unsupported transaction type: ${type}.`
3172
3475
  );
3173
3476
  }
3174
3477
  }
3175
3478
  };
3176
- var isTransactionTypeScript = (request) => request.type === import_transactions11.TransactionType.Script;
3177
- var isTransactionTypeCreate = (request) => request.type === import_transactions11.TransactionType.Create;
3178
- var isTransactionTypeBlob = (request) => request.type === import_transactions11.TransactionType.Blob;
3479
+ var isTransactionTypeScript = (request) => request.type === import_transactions13.TransactionType.Script;
3480
+ var isTransactionTypeCreate = (request) => request.type === import_transactions13.TransactionType.Create;
3481
+ var isTransactionTypeBlob = (request) => request.type === import_transactions13.TransactionType.Blob;
3482
+ var isTransactionTypeUpgrade = (request) => request.type === import_transactions13.TransactionType.Upgrade;
3483
+ var isTransactionTypeUpload = (request) => request.type === import_transactions13.TransactionType.Upload;
3179
3484
 
3180
3485
  // src/providers/transaction-response/transaction-response.ts
3181
- var import_errors14 = require("@fuel-ts/errors");
3486
+ var import_errors15 = require("@fuel-ts/errors");
3182
3487
  var import_math17 = require("@fuel-ts/math");
3183
- var import_transactions19 = require("@fuel-ts/transactions");
3184
- var import_utils21 = require("@fuel-ts/utils");
3488
+ var import_transactions21 = require("@fuel-ts/transactions");
3489
+ var import_utils25 = require("@fuel-ts/utils");
3185
3490
 
3186
3491
  // src/providers/transaction-summary/assemble-transaction-summary.ts
3187
3492
  var import_math16 = require("@fuel-ts/math");
3188
- var import_transactions17 = require("@fuel-ts/transactions");
3189
- var import_utils19 = require("@fuel-ts/utils");
3493
+ var import_transactions19 = require("@fuel-ts/transactions");
3494
+ var import_utils23 = require("@fuel-ts/utils");
3190
3495
 
3191
3496
  // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
3192
3497
  var import_math12 = require("@fuel-ts/math");
3193
- var import_transactions12 = require("@fuel-ts/transactions");
3194
- var import_utils17 = require("@fuel-ts/utils");
3498
+ var import_transactions14 = require("@fuel-ts/transactions");
3499
+ var import_utils21 = require("@fuel-ts/utils");
3195
3500
  var calculateTXFeeForSummary = (params) => {
3196
3501
  const {
3197
3502
  gasPrice,
@@ -3205,17 +3510,17 @@ var calculateTXFeeForSummary = (params) => {
3205
3510
  }
3206
3511
  const gasPerByte = (0, import_math12.bn)(feeParams.gasPerByte);
3207
3512
  const gasPriceFactor = (0, import_math12.bn)(feeParams.gasPriceFactor);
3208
- const transactionBytes = (0, import_utils17.arrayify)(rawPayload);
3209
- const [transaction] = new import_transactions12.TransactionCoder().decode(transactionBytes, 0);
3513
+ const transactionBytes = (0, import_utils21.arrayify)(rawPayload);
3514
+ const [transaction] = new import_transactions14.TransactionCoder().decode(transactionBytes, 0);
3210
3515
  const { type, witnesses, inputs, policies } = transaction;
3211
3516
  let metadataGas = (0, import_math12.bn)(0);
3212
3517
  let gasLimit = (0, import_math12.bn)(0);
3213
- if (type !== import_transactions12.TransactionType.Create && type !== import_transactions12.TransactionType.Script) {
3518
+ if (type !== import_transactions14.TransactionType.Create && type !== import_transactions14.TransactionType.Script) {
3214
3519
  return (0, import_math12.bn)(0);
3215
3520
  }
3216
- if (type === import_transactions12.TransactionType.Create) {
3521
+ if (type === import_transactions14.TransactionType.Create) {
3217
3522
  const { bytecodeWitnessIndex, storageSlots } = transaction;
3218
- const contractBytesSize = (0, import_math12.bn)((0, import_utils17.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
3523
+ const contractBytesSize = (0, import_math12.bn)((0, import_utils21.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
3219
3524
  metadataGas = calculateMetadataGasForTxCreate({
3220
3525
  contractBytesSize,
3221
3526
  gasCosts,
@@ -3239,7 +3544,7 @@ var calculateTXFeeForSummary = (params) => {
3239
3544
  metadataGas,
3240
3545
  txBytesSize: transactionBytes.length
3241
3546
  });
3242
- const witnessLimit = policies.find((policy) => policy.type === import_transactions12.PolicyType.WitnessLimit)?.data;
3547
+ const witnessLimit = policies.find((policy) => policy.type === import_transactions14.PolicyType.WitnessLimit)?.data;
3243
3548
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
3244
3549
  const maxGas = getMaxGas({
3245
3550
  gasPerByte,
@@ -3259,10 +3564,10 @@ var calculateTXFeeForSummary = (params) => {
3259
3564
  };
3260
3565
 
3261
3566
  // src/providers/transaction-summary/operations.ts
3262
- var import_configs10 = require("@fuel-ts/address/configs");
3263
- var import_errors12 = require("@fuel-ts/errors");
3567
+ var import_configs11 = require("@fuel-ts/address/configs");
3568
+ var import_errors13 = require("@fuel-ts/errors");
3264
3569
  var import_math14 = require("@fuel-ts/math");
3265
- var import_transactions15 = require("@fuel-ts/transactions");
3570
+ var import_transactions17 = require("@fuel-ts/transactions");
3266
3571
 
3267
3572
  // src/providers/transaction-summary/call.ts
3268
3573
  var import_abi_coder4 = require("@fuel-ts/abi-coder");
@@ -3298,9 +3603,9 @@ var getFunctionCall = ({ abi, receipt }) => {
3298
3603
  };
3299
3604
 
3300
3605
  // src/providers/transaction-summary/input.ts
3301
- var import_errors11 = require("@fuel-ts/errors");
3606
+ var import_errors12 = require("@fuel-ts/errors");
3302
3607
  var import_math13 = require("@fuel-ts/math");
3303
- var import_transactions13 = require("@fuel-ts/transactions");
3608
+ var import_transactions15 = require("@fuel-ts/transactions");
3304
3609
  function getInputsByTypes(inputs, types) {
3305
3610
  return inputs.filter((i) => types.includes(i.type));
3306
3611
  }
@@ -3308,19 +3613,19 @@ function getInputsByType(inputs, type) {
3308
3613
  return inputs.filter((i) => i.type === type);
3309
3614
  }
3310
3615
  function getInputsCoin(inputs) {
3311
- return getInputsByType(inputs, import_transactions13.InputType.Coin);
3616
+ return getInputsByType(inputs, import_transactions15.InputType.Coin);
3312
3617
  }
3313
3618
  function getInputsMessage(inputs) {
3314
- return getInputsByType(inputs, import_transactions13.InputType.Message);
3619
+ return getInputsByType(inputs, import_transactions15.InputType.Message);
3315
3620
  }
3316
3621
  function getInputsCoinAndMessage(inputs) {
3317
- return getInputsByTypes(inputs, [import_transactions13.InputType.Coin, import_transactions13.InputType.Message]);
3622
+ return getInputsByTypes(inputs, [import_transactions15.InputType.Coin, import_transactions15.InputType.Message]);
3318
3623
  }
3319
3624
  function isInputCoin(input) {
3320
- return input.type === import_transactions13.InputType.Coin;
3625
+ return input.type === import_transactions15.InputType.Coin;
3321
3626
  }
3322
3627
  function getInputsContract(inputs) {
3323
- return getInputsByType(inputs, import_transactions13.InputType.Contract);
3628
+ return getInputsByType(inputs, import_transactions15.InputType.Contract);
3324
3629
  }
3325
3630
  function findCoinInput(inputs, assetId) {
3326
3631
  const coinInputs = getInputsCoin(inputs);
@@ -3366,43 +3671,43 @@ function getInputContractFromIndex(inputs, inputIndex) {
3366
3671
  if (!contractInput) {
3367
3672
  return void 0;
3368
3673
  }
3369
- if (contractInput.type !== import_transactions13.InputType.Contract) {
3370
- throw new import_errors11.FuelError(
3371
- import_errors11.ErrorCode.INVALID_TRANSACTION_INPUT,
3674
+ if (contractInput.type !== import_transactions15.InputType.Contract) {
3675
+ throw new import_errors12.FuelError(
3676
+ import_errors12.ErrorCode.INVALID_TRANSACTION_INPUT,
3372
3677
  `Contract input should be of type 'contract'.`
3373
3678
  );
3374
3679
  }
3375
3680
  return contractInput;
3376
3681
  }
3377
3682
  function getInputAccountAddress(input) {
3378
- if (input.type === import_transactions13.InputType.Coin) {
3683
+ if (input.type === import_transactions15.InputType.Coin) {
3379
3684
  return input.owner.toString();
3380
3685
  }
3381
- if (input.type === import_transactions13.InputType.Message) {
3686
+ if (input.type === import_transactions15.InputType.Message) {
3382
3687
  return input.recipient.toString();
3383
3688
  }
3384
3689
  return "";
3385
3690
  }
3386
3691
 
3387
3692
  // src/providers/transaction-summary/output.ts
3388
- var import_transactions14 = require("@fuel-ts/transactions");
3693
+ var import_transactions16 = require("@fuel-ts/transactions");
3389
3694
  function getOutputsByType(outputs, type) {
3390
3695
  return outputs.filter((o) => o.type === type);
3391
3696
  }
3392
3697
  function getOutputsContractCreated(outputs) {
3393
- return getOutputsByType(outputs, import_transactions14.OutputType.ContractCreated);
3698
+ return getOutputsByType(outputs, import_transactions16.OutputType.ContractCreated);
3394
3699
  }
3395
3700
  function getOutputsCoin(outputs) {
3396
- return getOutputsByType(outputs, import_transactions14.OutputType.Coin);
3701
+ return getOutputsByType(outputs, import_transactions16.OutputType.Coin);
3397
3702
  }
3398
3703
  function getOutputsChange(outputs) {
3399
- return getOutputsByType(outputs, import_transactions14.OutputType.Change);
3704
+ return getOutputsByType(outputs, import_transactions16.OutputType.Change);
3400
3705
  }
3401
3706
  function getOutputsContract(outputs) {
3402
- return getOutputsByType(outputs, import_transactions14.OutputType.Contract);
3707
+ return getOutputsByType(outputs, import_transactions16.OutputType.Contract);
3403
3708
  }
3404
3709
  function getOutputsVariable(outputs) {
3405
- return getOutputsByType(outputs, import_transactions14.OutputType.Variable);
3710
+ return getOutputsByType(outputs, import_transactions16.OutputType.Variable);
3406
3711
  }
3407
3712
 
3408
3713
  // src/providers/transaction-summary/types.ts
@@ -3452,17 +3757,21 @@ function getReceiptsByType(receipts, type) {
3452
3757
  }
3453
3758
  function getTransactionTypeName(transactionType) {
3454
3759
  switch (transactionType) {
3455
- case import_transactions15.TransactionType.Mint:
3760
+ case import_transactions17.TransactionType.Mint:
3456
3761
  return "Mint" /* Mint */;
3457
- case import_transactions15.TransactionType.Create:
3762
+ case import_transactions17.TransactionType.Create:
3458
3763
  return "Create" /* Create */;
3459
- case import_transactions15.TransactionType.Script:
3764
+ case import_transactions17.TransactionType.Script:
3460
3765
  return "Script" /* Script */;
3461
- case import_transactions15.TransactionType.Blob:
3766
+ case import_transactions17.TransactionType.Blob:
3462
3767
  return "Blob" /* Blob */;
3768
+ case import_transactions17.TransactionType.Upgrade:
3769
+ return "Upgrade" /* Upgrade */;
3770
+ case import_transactions17.TransactionType.Upload:
3771
+ return "Upload" /* Upload */;
3463
3772
  default:
3464
- throw new import_errors12.FuelError(
3465
- import_errors12.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3773
+ throw new import_errors13.FuelError(
3774
+ import_errors13.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
3466
3775
  `Unsupported transaction type: ${transactionType}.`
3467
3776
  );
3468
3777
  }
@@ -3493,10 +3802,10 @@ function hasSameAssetId(a) {
3493
3802
  return (b) => a.assetId === b.assetId;
3494
3803
  }
3495
3804
  function getReceiptsCall(receipts) {
3496
- return getReceiptsByType(receipts, import_transactions15.ReceiptType.Call);
3805
+ return getReceiptsByType(receipts, import_transactions17.ReceiptType.Call);
3497
3806
  }
3498
3807
  function getReceiptsMessageOut(receipts) {
3499
- return getReceiptsByType(receipts, import_transactions15.ReceiptType.MessageOut);
3808
+ return getReceiptsByType(receipts, import_transactions17.ReceiptType.MessageOut);
3500
3809
  }
3501
3810
  function mergeAssets(op1, op2) {
3502
3811
  const assets1 = op1.assetsSent || [];
@@ -3545,7 +3854,7 @@ function addOperation(operations, toAdd) {
3545
3854
  return operations.map((op, index) => index === existingIndex ? mergeOperations(op, toAdd) : op);
3546
3855
  }
3547
3856
  function getReceiptsTransferOut(receipts) {
3548
- return getReceiptsByType(receipts, import_transactions15.ReceiptType.TransferOut);
3857
+ return getReceiptsByType(receipts, import_transactions17.ReceiptType.TransferOut);
3549
3858
  }
3550
3859
  function getWithdrawFromFuelOperations({
3551
3860
  inputs,
@@ -3607,7 +3916,7 @@ function getAssetsSent(receipt) {
3607
3916
  ];
3608
3917
  }
3609
3918
  function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload, maxInputs, baseAssetId) {
3610
- const assetId = receipt.assetId === import_configs10.ZeroBytes32 ? baseAssetId : receipt.assetId;
3919
+ const assetId = receipt.assetId === import_configs11.ZeroBytes32 ? baseAssetId : receipt.assetId;
3611
3920
  const input = getInputFromAssetId(inputs, assetId, assetId === baseAssetId);
3612
3921
  if (!input) {
3613
3922
  return [];
@@ -3663,7 +3972,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
3663
3972
  const { to: toAddress, assetId, amount } = receipt;
3664
3973
  let { from: fromAddress } = receipt;
3665
3974
  const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
3666
- if (import_configs10.ZeroBytes32 === fromAddress) {
3975
+ if (import_configs11.ZeroBytes32 === fromAddress) {
3667
3976
  const change = changeOutputs.find((output) => output.assetId === assetId);
3668
3977
  fromAddress = change?.to || fromAddress;
3669
3978
  }
@@ -3728,11 +4037,11 @@ function getTransferOperations({
3728
4037
  });
3729
4038
  const transferReceipts = getReceiptsByType(
3730
4039
  receipts,
3731
- import_transactions15.ReceiptType.Transfer
4040
+ import_transactions17.ReceiptType.Transfer
3732
4041
  );
3733
4042
  const transferOutReceipts = getReceiptsByType(
3734
4043
  receipts,
3735
- import_transactions15.ReceiptType.TransferOut
4044
+ import_transactions17.ReceiptType.TransferOut
3736
4045
  );
3737
4046
  [...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
3738
4047
  const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
@@ -3816,17 +4125,17 @@ function getOperations({
3816
4125
  }
3817
4126
 
3818
4127
  // src/providers/transaction-summary/receipt.ts
3819
- var import_transactions16 = require("@fuel-ts/transactions");
4128
+ var import_transactions18 = require("@fuel-ts/transactions");
3820
4129
  var processGqlReceipt = (gqlReceipt) => {
3821
4130
  const receipt = assembleReceiptByType(gqlReceipt);
3822
4131
  switch (receipt.type) {
3823
- case import_transactions16.ReceiptType.ReturnData: {
4132
+ case import_transactions18.ReceiptType.ReturnData: {
3824
4133
  return {
3825
4134
  ...receipt,
3826
4135
  data: gqlReceipt.data || "0x"
3827
4136
  };
3828
4137
  }
3829
- case import_transactions16.ReceiptType.LogData: {
4138
+ case import_transactions18.ReceiptType.LogData: {
3830
4139
  return {
3831
4140
  ...receipt,
3832
4141
  data: gqlReceipt.data || "0x"
@@ -3839,7 +4148,7 @@ var processGqlReceipt = (gqlReceipt) => {
3839
4148
  var extractMintedAssetsFromReceipts = (receipts) => {
3840
4149
  const mintedAssets = [];
3841
4150
  receipts.forEach((receipt) => {
3842
- if (receipt.type === import_transactions16.ReceiptType.Mint) {
4151
+ if (receipt.type === import_transactions18.ReceiptType.Mint) {
3843
4152
  mintedAssets.push({
3844
4153
  subId: receipt.subId,
3845
4154
  contractId: receipt.contractId,
@@ -3853,7 +4162,7 @@ var extractMintedAssetsFromReceipts = (receipts) => {
3853
4162
  var extractBurnedAssetsFromReceipts = (receipts) => {
3854
4163
  const burnedAssets = [];
3855
4164
  receipts.forEach((receipt) => {
3856
- if (receipt.type === import_transactions16.ReceiptType.Burn) {
4165
+ if (receipt.type === import_transactions18.ReceiptType.Burn) {
3857
4166
  burnedAssets.push({
3858
4167
  subId: receipt.subId,
3859
4168
  contractId: receipt.contractId,
@@ -3866,7 +4175,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3866
4175
  };
3867
4176
 
3868
4177
  // src/providers/transaction-summary/status.ts
3869
- var import_errors13 = require("@fuel-ts/errors");
4178
+ var import_errors14 = require("@fuel-ts/errors");
3870
4179
  var import_math15 = require("@fuel-ts/math");
3871
4180
  var getTransactionStatusName = (gqlStatus) => {
3872
4181
  switch (gqlStatus) {
@@ -3879,8 +4188,8 @@ var getTransactionStatusName = (gqlStatus) => {
3879
4188
  case "SqueezedOutStatus":
3880
4189
  return "squeezedout" /* squeezedout */;
3881
4190
  default:
3882
- throw new import_errors13.FuelError(
3883
- import_errors13.ErrorCode.INVALID_TRANSACTION_STATUS,
4191
+ throw new import_errors14.FuelError(
4192
+ import_errors14.ErrorCode.INVALID_TRANSACTION_STATUS,
3884
4193
  `Invalid transaction status: ${gqlStatus}.`
3885
4194
  );
3886
4195
  }
@@ -3949,7 +4258,7 @@ function assembleTransactionSummary(params) {
3949
4258
  baseAssetId
3950
4259
  } = params;
3951
4260
  const gasUsed = getGasUsedFromReceipts(receipts);
3952
- const rawPayload = (0, import_utils19.hexlify)(transactionBytes);
4261
+ const rawPayload = (0, import_utils23.hexlify)(transactionBytes);
3953
4262
  const operations = getOperations({
3954
4263
  transactionType: transaction.type,
3955
4264
  inputs: transaction.inputs || [],
@@ -3961,7 +4270,7 @@ function assembleTransactionSummary(params) {
3961
4270
  baseAssetId
3962
4271
  });
3963
4272
  const typeName = getTransactionTypeName(transaction.type);
3964
- const tip = (0, import_math16.bn)(transaction.policies?.find((policy) => policy.type === import_transactions17.PolicyType.Tip)?.data);
4273
+ const tip = (0, import_math16.bn)(transaction.policies?.find((policy) => policy.type === import_transactions19.PolicyType.Tip)?.data);
3965
4274
  const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3966
4275
  const fee = calculateTXFeeForSummary({
3967
4276
  totalFee,
@@ -3981,7 +4290,7 @@ function assembleTransactionSummary(params) {
3981
4290
  const burnedAssets = extractBurnedAssetsFromReceipts(receipts);
3982
4291
  let date;
3983
4292
  if (time) {
3984
- date = import_utils19.DateTime.fromTai64(time);
4293
+ date = import_utils23.DateTime.fromTai64(time);
3985
4294
  }
3986
4295
  const transactionSummary = {
3987
4296
  id,
@@ -4013,12 +4322,12 @@ function assembleTransactionSummary(params) {
4013
4322
 
4014
4323
  // src/providers/transaction-response/getDecodedLogs.ts
4015
4324
  var import_abi_coder5 = require("@fuel-ts/abi-coder");
4016
- var import_transactions18 = require("@fuel-ts/transactions");
4325
+ var import_transactions20 = require("@fuel-ts/transactions");
4017
4326
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
4018
4327
  return receipts.reduce((logs, receipt) => {
4019
- if (receipt.type === import_transactions18.ReceiptType.LogData || receipt.type === import_transactions18.ReceiptType.Log) {
4328
+ if (receipt.type === import_transactions20.ReceiptType.LogData || receipt.type === import_transactions20.ReceiptType.Log) {
4020
4329
  const interfaceToUse = new import_abi_coder5.Interface(externalAbis[receipt.id] || mainAbi);
4021
- const data = receipt.type === import_transactions18.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
4330
+ const data = receipt.type === import_transactions20.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
4022
4331
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toString());
4023
4332
  logs.push(decodedLog);
4024
4333
  }
@@ -4032,28 +4341,28 @@ function mapGqlOutputsToTxOutputs(outputs) {
4032
4341
  const obj = "amount" in o ? { ...o, amount: (0, import_math17.bn)(o.amount) } : o;
4033
4342
  switch (obj.type) {
4034
4343
  case "CoinOutput":
4035
- return { ...obj, type: import_transactions19.OutputType.Coin };
4344
+ return { ...obj, type: import_transactions21.OutputType.Coin };
4036
4345
  case "ContractOutput":
4037
4346
  return {
4038
4347
  ...obj,
4039
- type: import_transactions19.OutputType.Contract,
4348
+ type: import_transactions21.OutputType.Contract,
4040
4349
  inputIndex: parseInt(obj.inputIndex, 10)
4041
4350
  };
4042
4351
  case "ChangeOutput":
4043
4352
  return {
4044
4353
  ...obj,
4045
- type: import_transactions19.OutputType.Change
4354
+ type: import_transactions21.OutputType.Change
4046
4355
  };
4047
4356
  case "VariableOutput":
4048
- return { ...obj, type: import_transactions19.OutputType.Variable };
4357
+ return { ...obj, type: import_transactions21.OutputType.Variable };
4049
4358
  case "ContractCreated":
4050
4359
  return {
4051
4360
  ...obj,
4052
- type: import_transactions19.OutputType.ContractCreated,
4361
+ type: import_transactions21.OutputType.ContractCreated,
4053
4362
  contractId: obj.contract
4054
4363
  };
4055
4364
  default:
4056
- return (0, import_utils21.assertUnreachable)(obj);
4365
+ return (0, import_utils25.assertUnreachable)(obj);
4057
4366
  }
4058
4367
  });
4059
4368
  }
@@ -4107,7 +4416,7 @@ var TransactionResponse = class {
4107
4416
  const correspondingInput = status.transaction.inputs?.[idx];
4108
4417
  return {
4109
4418
  ...input,
4110
- txPointer: import_transactions19.TxPointerCoder.decodeFromGqlScalar(correspondingInput.txPointer)
4419
+ txPointer: import_transactions21.TxPointerCoder.decodeFromGqlScalar(correspondingInput.txPointer)
4111
4420
  };
4112
4421
  }
4113
4422
  return input;
@@ -4130,7 +4439,7 @@ var TransactionResponse = class {
4130
4439
  const gqlTransaction = this.gqlTransaction ?? await this.fetch();
4131
4440
  return {
4132
4441
  tx: this.decodeTransaction(gqlTransaction),
4133
- bytes: (0, import_utils21.arrayify)(gqlTransaction.rawPayload)
4442
+ bytes: (0, import_utils25.arrayify)(gqlTransaction.rawPayload)
4134
4443
  };
4135
4444
  }
4136
4445
  getReceipts() {
@@ -4174,8 +4483,8 @@ var TransactionResponse = class {
4174
4483
  * @returns The decoded transaction.
4175
4484
  */
4176
4485
  decodeTransaction(transactionWithReceipts) {
4177
- return new import_transactions19.TransactionCoder().decode(
4178
- (0, import_utils21.arrayify)(transactionWithReceipts.rawPayload),
4486
+ return new import_transactions21.TransactionCoder().decode(
4487
+ (0, import_utils25.arrayify)(transactionWithReceipts.rawPayload),
4179
4488
  0
4180
4489
  )?.[0];
4181
4490
  }
@@ -4222,8 +4531,8 @@ var TransactionResponse = class {
4222
4531
  this.status = statusChange;
4223
4532
  if (statusChange.type === "SqueezedOutStatus") {
4224
4533
  this.unsetResourceCache();
4225
- throw new import_errors14.FuelError(
4226
- import_errors14.ErrorCode.TRANSACTION_SQUEEZED_OUT,
4534
+ throw new import_errors15.FuelError(
4535
+ import_errors15.ErrorCode.TRANSACTION_SQUEEZED_OUT,
4227
4536
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
4228
4537
  );
4229
4538
  }
@@ -4294,7 +4603,7 @@ var TransactionResponse = class {
4294
4603
  };
4295
4604
 
4296
4605
  // src/providers/utils/auto-retry-fetch.ts
4297
- var import_utils23 = require("@fuel-ts/utils");
4606
+ var import_utils27 = require("@fuel-ts/utils");
4298
4607
  function getWaitDelay(options, retryAttemptNum) {
4299
4608
  const duration = options.baseDelay ?? 150;
4300
4609
  switch (options.backoff) {
@@ -4324,25 +4633,25 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
4324
4633
  throw error;
4325
4634
  }
4326
4635
  const delay = getWaitDelay(options, retryNum);
4327
- await (0, import_utils23.sleep)(delay);
4636
+ await (0, import_utils27.sleep)(delay);
4328
4637
  return autoRetryFetch(fetchFn, options, retryNum)(...args);
4329
4638
  }
4330
4639
  };
4331
4640
  }
4332
4641
 
4333
4642
  // src/providers/utils/handle-gql-error-message.ts
4334
- var import_errors15 = require("@fuel-ts/errors");
4643
+ var import_errors16 = require("@fuel-ts/errors");
4335
4644
  var handleGqlErrorMessage = (errorMessage, rawError) => {
4336
4645
  switch (errorMessage) {
4337
4646
  case "not enough coins to fit the target" /* NOT_ENOUGH_COINS */:
4338
- throw new import_errors15.FuelError(
4339
- import_errors15.ErrorCode.NOT_ENOUGH_FUNDS,
4647
+ throw new import_errors16.FuelError(
4648
+ import_errors16.ErrorCode.NOT_ENOUGH_FUNDS,
4340
4649
  `The account(s) sending the transaction don't have enough funds to cover the transaction.`,
4341
4650
  {},
4342
4651
  rawError
4343
4652
  );
4344
4653
  default:
4345
- throw new import_errors15.FuelError(import_errors15.ErrorCode.INVALID_REQUEST, errorMessage);
4654
+ throw new import_errors16.FuelError(import_errors16.ErrorCode.INVALID_REQUEST, errorMessage);
4346
4655
  }
4347
4656
  };
4348
4657
 
@@ -4424,24 +4733,34 @@ var _Provider = class {
4424
4733
  * @hidden
4425
4734
  */
4426
4735
  constructor(url, options = {}) {
4427
- this.url = url;
4428
4736
  /**
4429
4737
  * @hidden
4430
4738
  */
4431
4739
  __privateAdd(this, _cacheInputs);
4432
4740
  __publicField(this, "operations");
4433
4741
  __publicField(this, "cache");
4742
+ /** @hidden */
4743
+ __publicField(this, "url");
4744
+ /** @hidden */
4745
+ __publicField(this, "urlWithoutAuth");
4434
4746
  __publicField(this, "options", {
4435
4747
  timeout: void 0,
4436
4748
  resourceCacheTTL: void 0,
4437
4749
  fetch: void 0,
4438
- retryOptions: void 0
4750
+ retryOptions: void 0,
4751
+ headers: void 0
4439
4752
  });
4753
+ const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
4754
+ this.url = rawUrl;
4755
+ this.urlWithoutAuth = urlWithoutAuth;
4440
4756
  this.options = { ...this.options, ...options };
4441
4757
  this.url = url;
4758
+ if (headers) {
4759
+ this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
4760
+ }
4442
4761
  this.operations = this.createOperations();
4443
4762
  const { resourceCacheTTL } = this.options;
4444
- if ((0, import_utils24.isDefined)(resourceCacheTTL)) {
4763
+ if ((0, import_utils28.isDefined)(resourceCacheTTL)) {
4445
4764
  if (resourceCacheTTL !== -1) {
4446
4765
  this.cache = new ResourceCache(resourceCacheTTL);
4447
4766
  } else {
@@ -4460,12 +4779,16 @@ var _Provider = class {
4460
4779
  * @hidden
4461
4780
  */
4462
4781
  static getFetchFn(options) {
4463
- const { retryOptions, timeout } = options;
4782
+ const { retryOptions, timeout, headers } = options;
4464
4783
  return autoRetryFetch(async (...args) => {
4465
4784
  const url = args[0];
4466
4785
  const request = args[1];
4467
4786
  const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
4468
- let fullRequest = { ...request, signal };
4787
+ let fullRequest = {
4788
+ ...request,
4789
+ signal,
4790
+ headers: { ...request?.headers, ...headers }
4791
+ };
4469
4792
  if (options.requestMiddleware) {
4470
4793
  fullRequest = await options.requestMiddleware(fullRequest);
4471
4794
  }
@@ -4473,15 +4796,23 @@ var _Provider = class {
4473
4796
  }, retryOptions);
4474
4797
  }
4475
4798
  static extractBasicAuth(url) {
4476
- const parsedUrl = new URL(url);
4799
+ let parsedUrl;
4800
+ try {
4801
+ parsedUrl = new URL(url);
4802
+ } catch (error) {
4803
+ throw new import_errors17.FuelError(import_errors17.FuelError.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
4804
+ }
4477
4805
  const username = parsedUrl.username;
4478
4806
  const password = parsedUrl.password;
4479
- const urlNoBasicAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
4807
+ const urlWithoutAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
4480
4808
  if (!(username && password)) {
4481
- return { url, auth: void 0 };
4809
+ return { url, urlWithoutAuth: url, headers: void 0 };
4482
4810
  }
4483
- const auth = `Basic ${btoa(`${username}:${password}`)}`;
4484
- return { url: urlNoBasicAuth, auth };
4811
+ return {
4812
+ url,
4813
+ urlWithoutAuth,
4814
+ headers: { Authorization: `Basic ${btoa(`${username}:${password}`)}` }
4815
+ };
4485
4816
  }
4486
4817
  /**
4487
4818
  * Creates a new instance of the Provider class. This is the recommended way to initialize a Provider.
@@ -4492,17 +4823,7 @@ var _Provider = class {
4492
4823
  * @returns A promise that resolves to a Provider instance.
4493
4824
  */
4494
4825
  static async create(url, options = {}) {
4495
- const { url: urlToUse, auth } = this.extractBasicAuth(url);
4496
- const provider = new _Provider(urlToUse, {
4497
- ...options,
4498
- requestMiddleware: async (request) => {
4499
- if (auth && request) {
4500
- request.headers ??= {};
4501
- request.headers.Authorization = auth;
4502
- }
4503
- return options.requestMiddleware?.(request) ?? request;
4504
- }
4505
- });
4826
+ const provider = new _Provider(url, options);
4506
4827
  await provider.fetchChainAndNodeInfo();
4507
4828
  return provider;
4508
4829
  }
@@ -4512,10 +4833,10 @@ var _Provider = class {
4512
4833
  * @returns the chain information configuration.
4513
4834
  */
4514
4835
  getChain() {
4515
- const chain = _Provider.chainInfoCache[this.url];
4836
+ const chain = _Provider.chainInfoCache[this.urlWithoutAuth];
4516
4837
  if (!chain) {
4517
- throw new import_errors16.FuelError(
4518
- import_errors16.ErrorCode.CHAIN_INFO_CACHE_EMPTY,
4838
+ throw new import_errors17.FuelError(
4839
+ import_errors17.ErrorCode.CHAIN_INFO_CACHE_EMPTY,
4519
4840
  "Chain info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
4520
4841
  );
4521
4842
  }
@@ -4527,10 +4848,10 @@ var _Provider = class {
4527
4848
  * @returns the node information configuration.
4528
4849
  */
4529
4850
  getNode() {
4530
- const node = _Provider.nodeInfoCache[this.url];
4851
+ const node = _Provider.nodeInfoCache[this.urlWithoutAuth];
4531
4852
  if (!node) {
4532
- throw new import_errors16.FuelError(
4533
- import_errors16.ErrorCode.NODE_INFO_CACHE_EMPTY,
4853
+ throw new import_errors17.FuelError(
4854
+ import_errors17.ErrorCode.NODE_INFO_CACHE_EMPTY,
4534
4855
  "Node info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
4535
4856
  );
4536
4857
  }
@@ -4561,8 +4882,11 @@ var _Provider = class {
4561
4882
  * @param options - Additional options for the provider.
4562
4883
  */
4563
4884
  async connect(url, options) {
4564
- this.url = url;
4885
+ const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
4886
+ this.url = rawUrl;
4887
+ this.urlWithoutAuth = urlWithoutAuth;
4565
4888
  this.options = options ?? this.options;
4889
+ this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
4566
4890
  this.operations = this.createOperations();
4567
4891
  await this.fetchChainAndNodeInfo();
4568
4892
  }
@@ -4602,7 +4926,7 @@ Supported fuel-core version: ${supportedVersion}.`
4602
4926
  */
4603
4927
  createOperations() {
4604
4928
  const fetchFn = _Provider.getFetchFn(this.options);
4605
- const gqlClient = new import_graphql_request.GraphQLClient(this.url, {
4929
+ const gqlClient = new import_graphql_request.GraphQLClient(this.urlWithoutAuth, {
4606
4930
  fetch: (url, requestInit) => fetchFn(url, requestInit, this.options),
4607
4931
  responseMiddleware: (response) => {
4608
4932
  if ("response" in response) {
@@ -4620,7 +4944,7 @@ Supported fuel-core version: ${supportedVersion}.`
4620
4944
  const isSubscription = opDefinition?.operation === "subscription";
4621
4945
  if (isSubscription) {
4622
4946
  return FuelGraphqlSubscriber.create({
4623
- url: this.url,
4947
+ url: this.urlWithoutAuth,
4624
4948
  query,
4625
4949
  fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
4626
4950
  variables: vars
@@ -4683,7 +5007,7 @@ Supported fuel-core version: ${supportedVersion}.`
4683
5007
  utxoValidation: nodeInfo.utxoValidation,
4684
5008
  vmBacktrace: nodeInfo.vmBacktrace
4685
5009
  };
4686
- _Provider.nodeInfoCache[this.url] = processedNodeInfo;
5010
+ _Provider.nodeInfoCache[this.urlWithoutAuth] = processedNodeInfo;
4687
5011
  return processedNodeInfo;
4688
5012
  }
4689
5013
  /**
@@ -4694,7 +5018,7 @@ Supported fuel-core version: ${supportedVersion}.`
4694
5018
  async fetchChain() {
4695
5019
  const { chain } = await this.operations.getChain();
4696
5020
  const processedChain = processGqlChain(chain);
4697
- _Provider.chainInfoCache[this.url] = processedChain;
5021
+ _Provider.chainInfoCache[this.urlWithoutAuth] = processedChain;
4698
5022
  return processedChain;
4699
5023
  }
4700
5024
  /**
@@ -4722,14 +5046,14 @@ Supported fuel-core version: ${supportedVersion}.`
4722
5046
  validateTransaction(tx, consensusParameters) {
4723
5047
  const { maxOutputs, maxInputs } = consensusParameters.txParameters;
4724
5048
  if ((0, import_math18.bn)(tx.inputs.length).gt(maxInputs)) {
4725
- throw new import_errors16.FuelError(
4726
- import_errors16.ErrorCode.MAX_INPUTS_EXCEEDED,
5049
+ throw new import_errors17.FuelError(
5050
+ import_errors17.ErrorCode.MAX_INPUTS_EXCEEDED,
4727
5051
  "The transaction exceeds the maximum allowed number of inputs."
4728
5052
  );
4729
5053
  }
4730
5054
  if ((0, import_math18.bn)(tx.outputs.length).gt(maxOutputs)) {
4731
- throw new import_errors16.FuelError(
4732
- import_errors16.ErrorCode.MAX_OUTPUTS_EXCEEDED,
5055
+ throw new import_errors17.FuelError(
5056
+ import_errors17.ErrorCode.MAX_OUTPUTS_EXCEEDED,
4733
5057
  "The transaction exceeds the maximum allowed number of outputs."
4734
5058
  );
4735
5059
  }
@@ -4751,7 +5075,7 @@ Supported fuel-core version: ${supportedVersion}.`
4751
5075
  }
4752
5076
  const { consensusParameters } = this.getChain();
4753
5077
  this.validateTransaction(transactionRequest, consensusParameters);
4754
- const encodedTransaction = (0, import_utils24.hexlify)(transactionRequest.toTransactionBytes());
5078
+ const encodedTransaction = (0, import_utils28.hexlify)(transactionRequest.toTransactionBytes());
4755
5079
  let abis;
4756
5080
  if (isTransactionTypeScript(transactionRequest)) {
4757
5081
  abis = transactionRequest.abis;
@@ -4775,7 +5099,7 @@ Supported fuel-core version: ${supportedVersion}.`
4775
5099
  if (estimateTxDependencies) {
4776
5100
  return this.estimateTxDependencies(transactionRequest);
4777
5101
  }
4778
- const encodedTransaction = (0, import_utils24.hexlify)(transactionRequest.toTransactionBytes());
5102
+ const encodedTransaction = (0, import_utils28.hexlify)(transactionRequest.toTransactionBytes());
4779
5103
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4780
5104
  encodedTransactions: encodedTransaction,
4781
5105
  utxoValidation: utxoValidation || false
@@ -4795,13 +5119,13 @@ Supported fuel-core version: ${supportedVersion}.`
4795
5119
  async estimatePredicates(transactionRequest) {
4796
5120
  const shouldEstimatePredicates = Boolean(
4797
5121
  transactionRequest.inputs.find(
4798
- (input) => "predicate" in input && input.predicate && !(0, import_utils25.equalBytes)((0, import_utils24.arrayify)(input.predicate), (0, import_utils24.arrayify)("0x")) && new import_math18.BN(input.predicateGasUsed).isZero()
5122
+ (input) => "predicate" in input && input.predicate && !(0, import_utils29.equalBytes)((0, import_utils28.arrayify)(input.predicate), (0, import_utils28.arrayify)("0x")) && new import_math18.BN(input.predicateGasUsed).isZero()
4799
5123
  )
4800
5124
  );
4801
5125
  if (!shouldEstimatePredicates) {
4802
5126
  return transactionRequest;
4803
5127
  }
4804
- const encodedTransaction = (0, import_utils24.hexlify)(transactionRequest.toTransactionBytes());
5128
+ const encodedTransaction = (0, import_utils28.hexlify)(transactionRequest.toTransactionBytes());
4805
5129
  const response = await this.operations.estimatePredicates({
4806
5130
  encodedTransaction
4807
5131
  });
@@ -4842,7 +5166,7 @@ Supported fuel-core version: ${supportedVersion}.`
4842
5166
  const {
4843
5167
  dryRun: [{ receipts: rawReceipts, status }]
4844
5168
  } = await this.operations.dryRun({
4845
- encodedTransactions: [(0, import_utils24.hexlify)(transactionRequest.toTransactionBytes())],
5169
+ encodedTransactions: [(0, import_utils28.hexlify)(transactionRequest.toTransactionBytes())],
4846
5170
  utxoValidation: false
4847
5171
  });
4848
5172
  receipts = rawReceipts.map(processGqlReceipt);
@@ -4888,11 +5212,11 @@ Supported fuel-core version: ${supportedVersion}.`
4888
5212
  missingContractIds: [],
4889
5213
  dryRunStatus: void 0
4890
5214
  }));
4891
- const allRequests = (0, import_ramda6.clone)(transactionRequests);
5215
+ const allRequests = (0, import_ramda8.clone)(transactionRequests);
4892
5216
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
4893
5217
  allRequests.forEach((req, index) => {
4894
5218
  if (isTransactionTypeScript(req)) {
4895
- serializedTransactionsMap.set(index, (0, import_utils24.hexlify)(req.toTransactionBytes()));
5219
+ serializedTransactionsMap.set(index, (0, import_utils28.hexlify)(req.toTransactionBytes()));
4896
5220
  }
4897
5221
  });
4898
5222
  let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
@@ -4928,7 +5252,7 @@ Supported fuel-core version: ${supportedVersion}.`
4928
5252
  transactionRequest: request
4929
5253
  });
4930
5254
  request.maxFee = maxFee;
4931
- serializedTransactionsMap.set(requestIdx, (0, import_utils24.hexlify)(request.toTransactionBytes()));
5255
+ serializedTransactionsMap.set(requestIdx, (0, import_utils28.hexlify)(request.toTransactionBytes()));
4932
5256
  nextRoundTransactions.push(requestIdx);
4933
5257
  }
4934
5258
  }
@@ -4949,7 +5273,7 @@ Supported fuel-core version: ${supportedVersion}.`
4949
5273
  if (estimateTxDependencies) {
4950
5274
  return this.estimateMultipleTxDependencies(transactionRequests);
4951
5275
  }
4952
- const encodedTransactions = transactionRequests.map((tx) => (0, import_utils24.hexlify)(tx.toTransactionBytes()));
5276
+ const encodedTransactions = transactionRequests.map((tx) => (0, import_utils28.hexlify)(tx.toTransactionBytes()));
4953
5277
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4954
5278
  encodedTransactions,
4955
5279
  utxoValidation: utxoValidation || false
@@ -5023,7 +5347,7 @@ Supported fuel-core version: ${supportedVersion}.`
5023
5347
  if (estimateTxDependencies) {
5024
5348
  return this.estimateTxDependencies(transactionRequest);
5025
5349
  }
5026
- const encodedTransactions = [(0, import_utils24.hexlify)(transactionRequest.toTransactionBytes())];
5350
+ const encodedTransactions = [(0, import_utils28.hexlify)(transactionRequest.toTransactionBytes())];
5027
5351
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
5028
5352
  encodedTransactions,
5029
5353
  utxoValidation: true
@@ -5048,13 +5372,13 @@ Supported fuel-core version: ${supportedVersion}.`
5048
5372
  * @returns A promise that resolves to the transaction cost object.
5049
5373
  */
5050
5374
  async getTransactionCost(transactionRequestLike, { signatureCallback } = {}) {
5051
- const txRequestClone = (0, import_ramda6.clone)(transactionRequestify(transactionRequestLike));
5375
+ const txRequestClone = (0, import_ramda8.clone)(transactionRequestify(transactionRequestLike));
5052
5376
  const updateMaxFee = txRequestClone.maxFee.eq(0);
5053
5377
  const isScriptTransaction = isTransactionTypeScript(txRequestClone);
5054
5378
  if (isScriptTransaction) {
5055
5379
  txRequestClone.gasLimit = (0, import_math18.bn)(0);
5056
5380
  }
5057
- const signedRequest = (0, import_ramda6.clone)(txRequestClone);
5381
+ const signedRequest = (0, import_ramda8.clone)(txRequestClone);
5058
5382
  let addedSignatures = 0;
5059
5383
  if (signatureCallback && isTransactionTypeScript(signedRequest)) {
5060
5384
  const lengthBefore = signedRequest.witnesses.length;
@@ -5122,7 +5446,7 @@ Supported fuel-core version: ${supportedVersion}.`
5122
5446
  paginationLimit: RESOURCES_PAGE_SIZE_LIMIT,
5123
5447
  inputArgs: paginationArgs
5124
5448
  }),
5125
- filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils24.hexlify)(assetId) }
5449
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils28.hexlify)(assetId) }
5126
5450
  });
5127
5451
  const coins = edges.map(({ node }) => ({
5128
5452
  id: node.utxoId,
@@ -5148,8 +5472,8 @@ Supported fuel-core version: ${supportedVersion}.`
5148
5472
  async getResourcesToSpend(owner, quantities, excludedIds) {
5149
5473
  const ownerAddress = import_address3.Address.fromAddressOrString(owner);
5150
5474
  const excludeInput = {
5151
- messages: excludedIds?.messages?.map((nonce) => (0, import_utils24.hexlify)(nonce)) || [],
5152
- utxos: excludedIds?.utxos?.map((id) => (0, import_utils24.hexlify)(id)) || []
5475
+ messages: excludedIds?.messages?.map((nonce) => (0, import_utils28.hexlify)(nonce)) || [],
5476
+ utxos: excludedIds?.utxos?.map((id) => (0, import_utils28.hexlify)(id)) || []
5153
5477
  };
5154
5478
  if (this.cache) {
5155
5479
  const cached = this.cache.getActiveData();
@@ -5159,7 +5483,7 @@ Supported fuel-core version: ${supportedVersion}.`
5159
5483
  const coinsQuery = {
5160
5484
  owner: ownerAddress.toB256(),
5161
5485
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
5162
- assetId: (0, import_utils24.hexlify)(assetId),
5486
+ assetId: (0, import_utils28.hexlify)(assetId),
5163
5487
  amount: amount.toString(10),
5164
5488
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
5165
5489
  })),
@@ -5314,7 +5638,7 @@ Supported fuel-core version: ${supportedVersion}.`
5314
5638
  },
5315
5639
  transactionIds: block.transactions.map((tx) => tx.id),
5316
5640
  transactions: block.transactions.map(
5317
- (tx) => new import_transactions20.TransactionCoder().decode((0, import_utils24.arrayify)(tx.rawPayload), 0)?.[0]
5641
+ (tx) => new import_transactions22.TransactionCoder().decode((0, import_utils28.arrayify)(tx.rawPayload), 0)?.[0]
5318
5642
  )
5319
5643
  };
5320
5644
  }
@@ -5330,12 +5654,12 @@ Supported fuel-core version: ${supportedVersion}.`
5330
5654
  return null;
5331
5655
  }
5332
5656
  try {
5333
- return new import_transactions20.TransactionCoder().decode(
5334
- (0, import_utils24.arrayify)(transaction.rawPayload),
5657
+ return new import_transactions22.TransactionCoder().decode(
5658
+ (0, import_utils28.arrayify)(transaction.rawPayload),
5335
5659
  0
5336
5660
  )?.[0];
5337
5661
  } catch (error) {
5338
- if (error instanceof import_errors16.FuelError && error.code === import_errors16.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5662
+ if (error instanceof import_errors17.FuelError && error.code === import_errors17.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5339
5663
  console.warn("Unsupported transaction type encountered");
5340
5664
  return null;
5341
5665
  }
@@ -5351,12 +5675,12 @@ Supported fuel-core version: ${supportedVersion}.`
5351
5675
  const {
5352
5676
  transactions: { edges, pageInfo }
5353
5677
  } = await this.operations.getTransactions(paginationArgs);
5354
- const coder = new import_transactions20.TransactionCoder();
5678
+ const coder = new import_transactions22.TransactionCoder();
5355
5679
  const transactions = edges.map(({ node: { rawPayload } }) => {
5356
5680
  try {
5357
- return coder.decode((0, import_utils24.arrayify)(rawPayload), 0)[0];
5681
+ return coder.decode((0, import_utils28.arrayify)(rawPayload), 0)[0];
5358
5682
  } catch (error) {
5359
- if (error instanceof import_errors16.FuelError && error.code === import_errors16.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5683
+ if (error instanceof import_errors17.FuelError && error.code === import_errors17.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5360
5684
  console.warn("Unsupported transaction type encountered");
5361
5685
  return null;
5362
5686
  }
@@ -5388,7 +5712,7 @@ Supported fuel-core version: ${supportedVersion}.`
5388
5712
  async getContractBalance(contractId, assetId) {
5389
5713
  const { contractBalance } = await this.operations.getContractBalance({
5390
5714
  contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
5391
- asset: (0, import_utils24.hexlify)(assetId)
5715
+ asset: (0, import_utils28.hexlify)(assetId)
5392
5716
  });
5393
5717
  return (0, import_math18.bn)(contractBalance.amount, 10);
5394
5718
  }
@@ -5402,7 +5726,7 @@ Supported fuel-core version: ${supportedVersion}.`
5402
5726
  async getBalance(owner, assetId) {
5403
5727
  const { balance } = await this.operations.getBalance({
5404
5728
  owner: import_address3.Address.fromAddressOrString(owner).toB256(),
5405
- assetId: (0, import_utils24.hexlify)(assetId)
5729
+ assetId: (0, import_utils28.hexlify)(assetId)
5406
5730
  });
5407
5731
  return (0, import_math18.bn)(balance.amount, 10);
5408
5732
  }
@@ -5448,7 +5772,7 @@ Supported fuel-core version: ${supportedVersion}.`
5448
5772
  owner: import_address3.Address.fromAddressOrString(address).toB256()
5449
5773
  });
5450
5774
  const messages = edges.map(({ node }) => ({
5451
- messageId: import_transactions20.InputMessageCoder.getMessageId({
5775
+ messageId: import_transactions22.InputMessageCoder.getMessageId({
5452
5776
  sender: node.sender,
5453
5777
  recipient: node.recipient,
5454
5778
  nonce: node.nonce,
@@ -5459,7 +5783,7 @@ Supported fuel-core version: ${supportedVersion}.`
5459
5783
  recipient: import_address3.Address.fromAddressOrString(node.recipient),
5460
5784
  nonce: node.nonce,
5461
5785
  amount: (0, import_math18.bn)(node.amount),
5462
- data: import_transactions20.InputMessageCoder.decodeData(node.data),
5786
+ data: import_transactions22.InputMessageCoder.decodeData(node.data),
5463
5787
  daHeight: (0, import_math18.bn)(node.daHeight)
5464
5788
  }));
5465
5789
  return {
@@ -5482,8 +5806,8 @@ Supported fuel-core version: ${supportedVersion}.`
5482
5806
  nonce
5483
5807
  };
5484
5808
  if (commitBlockId && commitBlockHeight) {
5485
- throw new import_errors16.FuelError(
5486
- import_errors16.ErrorCode.INVALID_INPUT_PARAMETERS,
5809
+ throw new import_errors17.FuelError(
5810
+ import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
5487
5811
  "commitBlockId and commitBlockHeight cannot be used together"
5488
5812
  );
5489
5813
  }
@@ -5602,7 +5926,7 @@ Supported fuel-core version: ${supportedVersion}.`
5602
5926
  async produceBlocks(amount, startTime) {
5603
5927
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
5604
5928
  blocksToProduce: (0, import_math18.bn)(amount).toString(10),
5605
- startTimestamp: startTime ? import_utils24.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
5929
+ startTimestamp: startTime ? import_utils28.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
5606
5930
  });
5607
5931
  return (0, import_math18.bn)(latestBlockHeight);
5608
5932
  }
@@ -5628,7 +5952,7 @@ Supported fuel-core version: ${supportedVersion}.`
5628
5952
  return null;
5629
5953
  }
5630
5954
  const message = {
5631
- messageId: import_transactions20.InputMessageCoder.getMessageId({
5955
+ messageId: import_transactions22.InputMessageCoder.getMessageId({
5632
5956
  sender: rawMessage.sender,
5633
5957
  recipient: rawMessage.recipient,
5634
5958
  nonce: rawMessage.nonce,
@@ -5639,7 +5963,7 @@ Supported fuel-core version: ${supportedVersion}.`
5639
5963
  recipient: import_address3.Address.fromAddressOrString(rawMessage.recipient),
5640
5964
  nonce: rawMessage.nonce,
5641
5965
  amount: (0, import_math18.bn)(rawMessage.amount),
5642
- data: import_transactions20.InputMessageCoder.decodeData(rawMessage.data),
5966
+ data: import_transactions22.InputMessageCoder.decodeData(rawMessage.data),
5643
5967
  daHeight: (0, import_math18.bn)(rawMessage.daHeight)
5644
5968
  };
5645
5969
  return message;
@@ -5666,26 +5990,26 @@ Supported fuel-core version: ${supportedVersion}.`
5666
5990
  const { paginationLimit, inputArgs = {} } = params;
5667
5991
  const { first, last, after, before } = inputArgs;
5668
5992
  if (after && before) {
5669
- throw new import_errors16.FuelError(
5670
- import_errors16.ErrorCode.INVALID_INPUT_PARAMETERS,
5993
+ throw new import_errors17.FuelError(
5994
+ import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
5671
5995
  'Pagination arguments "after" and "before" cannot be used together'
5672
5996
  );
5673
5997
  }
5674
5998
  if ((first || 0) > paginationLimit || (last || 0) > paginationLimit) {
5675
- throw new import_errors16.FuelError(
5676
- import_errors16.ErrorCode.INVALID_INPUT_PARAMETERS,
5999
+ throw new import_errors17.FuelError(
6000
+ import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
5677
6001
  `Pagination limit for this query cannot exceed ${paginationLimit} items`
5678
6002
  );
5679
6003
  }
5680
6004
  if (first && before) {
5681
- throw new import_errors16.FuelError(
5682
- import_errors16.ErrorCode.INVALID_INPUT_PARAMETERS,
6005
+ throw new import_errors17.FuelError(
6006
+ import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
5683
6007
  'The use of pagination argument "first" with "before" is not supported'
5684
6008
  );
5685
6009
  }
5686
6010
  if (last && after) {
5687
- throw new import_errors16.FuelError(
5688
- import_errors16.ErrorCode.INVALID_INPUT_PARAMETERS,
6011
+ throw new import_errors17.FuelError(
6012
+ import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
5689
6013
  'The use of pagination argument "last" with "after" is not supported'
5690
6014
  );
5691
6015
  }
@@ -5722,9 +6046,9 @@ cacheInputs_fn = function(inputs, transactionId) {
5722
6046
  }
5723
6047
  const inputsToCache = inputs.reduce(
5724
6048
  (acc, input) => {
5725
- if (input.type === import_transactions20.InputType.Coin) {
6049
+ if (input.type === import_transactions22.InputType.Coin) {
5726
6050
  acc.utxos.push(input.id);
5727
- } else if (input.type === import_transactions20.InputType.Message) {
6051
+ } else if (input.type === import_transactions22.InputType.Message) {
5728
6052
  acc.messages.push(input.nonce);
5729
6053
  }
5730
6054
  return acc;
@@ -5739,23 +6063,23 @@ __publicField(Provider, "chainInfoCache", {});
5739
6063
  __publicField(Provider, "nodeInfoCache", {});
5740
6064
 
5741
6065
  // src/providers/transaction-summary/get-transaction-summary.ts
5742
- var import_errors17 = require("@fuel-ts/errors");
6066
+ var import_errors18 = require("@fuel-ts/errors");
5743
6067
  var import_math19 = require("@fuel-ts/math");
5744
- var import_transactions21 = require("@fuel-ts/transactions");
5745
- var import_utils27 = require("@fuel-ts/utils");
6068
+ var import_transactions23 = require("@fuel-ts/transactions");
6069
+ var import_utils31 = require("@fuel-ts/utils");
5746
6070
  async function getTransactionSummary(params) {
5747
6071
  const { id, provider, abiMap } = params;
5748
6072
  const { transaction: gqlTransaction } = await provider.operations.getTransactionWithReceipts({
5749
6073
  transactionId: id
5750
6074
  });
5751
6075
  if (!gqlTransaction) {
5752
- throw new import_errors17.FuelError(
5753
- import_errors17.ErrorCode.TRANSACTION_NOT_FOUND,
6076
+ throw new import_errors18.FuelError(
6077
+ import_errors18.ErrorCode.TRANSACTION_NOT_FOUND,
5754
6078
  `Transaction not found for given id: ${id}.`
5755
6079
  );
5756
6080
  }
5757
- const [decodedTransaction] = new import_transactions21.TransactionCoder().decode(
5758
- (0, import_utils27.arrayify)(gqlTransaction.rawPayload),
6081
+ const [decodedTransaction] = new import_transactions23.TransactionCoder().decode(
6082
+ (0, import_utils31.arrayify)(gqlTransaction.rawPayload),
5759
6083
  0
5760
6084
  );
5761
6085
  let txReceipts = [];
@@ -5776,7 +6100,7 @@ async function getTransactionSummary(params) {
5776
6100
  id: gqlTransaction.id,
5777
6101
  receipts,
5778
6102
  transaction: decodedTransaction,
5779
- transactionBytes: (0, import_utils27.arrayify)(gqlTransaction.rawPayload),
6103
+ transactionBytes: (0, import_utils31.arrayify)(gqlTransaction.rawPayload),
5780
6104
  gqlTransactionStatus: gqlTransaction.status,
5781
6105
  gasPerByte: (0, import_math19.bn)(gasPerByte),
5782
6106
  gasPriceFactor: (0, import_math19.bn)(gasPriceFactor),
@@ -5832,7 +6156,7 @@ async function getTransactionsSummaries(params) {
5832
6156
  const transactions = edges.map((edge) => {
5833
6157
  const { node: gqlTransaction } = edge;
5834
6158
  const { id, rawPayload, status } = gqlTransaction;
5835
- const [decodedTransaction] = new import_transactions21.TransactionCoder().decode((0, import_utils27.arrayify)(rawPayload), 0);
6159
+ const [decodedTransaction] = new import_transactions23.TransactionCoder().decode((0, import_utils31.arrayify)(rawPayload), 0);
5836
6160
  let txReceipts = [];
5837
6161
  if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
5838
6162
  txReceipts = gqlTransaction.status.receipts;
@@ -5842,7 +6166,7 @@ async function getTransactionsSummaries(params) {
5842
6166
  id,
5843
6167
  receipts,
5844
6168
  transaction: decodedTransaction,
5845
- transactionBytes: (0, import_utils27.arrayify)(rawPayload),
6169
+ transactionBytes: (0, import_utils31.arrayify)(rawPayload),
5846
6170
  gqlTransactionStatus: status,
5847
6171
  abiMap,
5848
6172
  gasPerByte,
@@ -5867,12 +6191,14 @@ async function getTransactionsSummaries(params) {
5867
6191
  // src/providers/chains.ts
5868
6192
  var CHAIN_IDS = {
5869
6193
  eth: {
6194
+ mainnet: 1,
5870
6195
  sepolia: 11155111,
5871
6196
  foundry: 31337
5872
6197
  },
5873
6198
  fuel: {
5874
6199
  devnet: 0,
5875
- testnet: 0
6200
+ testnet: 0,
6201
+ mainnet: 9889
5876
6202
  }
5877
6203
  };
5878
6204
 
@@ -5972,6 +6298,11 @@ var rawAssets = [
5972
6298
  chainId: CHAIN_IDS.eth.foundry,
5973
6299
  decimals: 18
5974
6300
  },
6301
+ {
6302
+ type: "ethereum",
6303
+ chainId: CHAIN_IDS.eth.mainnet,
6304
+ decimals: 18
6305
+ },
5975
6306
  {
5976
6307
  type: "fuel",
5977
6308
  chainId: CHAIN_IDS.fuel.devnet,
@@ -5983,39 +6314,604 @@ var rawAssets = [
5983
6314
  chainId: CHAIN_IDS.fuel.testnet,
5984
6315
  decimals: 9,
5985
6316
  assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
6317
+ },
6318
+ {
6319
+ type: "fuel",
6320
+ chainId: CHAIN_IDS.fuel.mainnet,
6321
+ decimals: 9,
6322
+ assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
5986
6323
  }
5987
6324
  ]
5988
- }
5989
- ];
5990
- var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
5991
-
5992
- // src/providers/utils/merge-quantities.ts
5993
- var mergeQuantities = (...coinQuantities) => {
5994
- const resultMap = {};
5995
- function addToMap({ amount, assetId }) {
5996
- if (resultMap[assetId]) {
5997
- resultMap[assetId] = resultMap[assetId].add(amount);
5998
- } else {
5999
- resultMap[assetId] = amount;
6000
- }
6001
- }
6002
- coinQuantities.forEach((arr) => arr.forEach(addToMap));
6003
- return Object.entries(resultMap).map(([assetId, amount]) => ({ assetId, amount }));
6004
- };
6325
+ },
6326
+ {
6327
+ name: "WETH",
6328
+ symbol: "WETH",
6329
+ icon: "weth.svg",
6330
+ networks: [
6331
+ {
6332
+ type: "ethereum",
6333
+ chainId: CHAIN_IDS.eth.mainnet,
6334
+ address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
6335
+ decimals: 18
6336
+ },
6337
+ {
6338
+ type: "fuel",
6339
+ chainId: CHAIN_IDS.fuel.mainnet,
6340
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6341
+ assetId: "0xa38a5a8beeb08d95744bc7f58528073f4052b254def59eba20c99c202b5acaa3",
6342
+ decimals: 18
6343
+ }
6344
+ ]
6345
+ },
6346
+ {
6347
+ name: "weETH",
6348
+ symbol: "weETH",
6349
+ icon: "weETH.webp",
6350
+ networks: [
6351
+ {
6352
+ type: "ethereum",
6353
+ chainId: CHAIN_IDS.eth.mainnet,
6354
+ address: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
6355
+ decimals: 18
6356
+ },
6357
+ {
6358
+ type: "fuel",
6359
+ chainId: CHAIN_IDS.fuel.mainnet,
6360
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6361
+ assetId: "0x239ed6e12b7ce4089ee245244e3bf906999a6429c2a9a445a1e1faf56914a4ab",
6362
+ decimals: 18
6363
+ }
6364
+ ]
6365
+ },
6366
+ {
6367
+ name: "rsETH",
6368
+ symbol: "rsETH",
6369
+ icon: "rsETH.webp",
6370
+ networks: [
6371
+ {
6372
+ type: "ethereum",
6373
+ chainId: CHAIN_IDS.eth.mainnet,
6374
+ address: "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7",
6375
+ decimals: 18
6376
+ },
6377
+ {
6378
+ type: "fuel",
6379
+ chainId: CHAIN_IDS.fuel.mainnet,
6380
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6381
+ assetId: "0xbae80f7fb8aa6b90d9b01ef726ec847cc4f59419c4d5f2ea88fec785d1b0e849",
6382
+ decimals: 18
6383
+ }
6384
+ ]
6385
+ },
6386
+ {
6387
+ name: "rETH",
6388
+ symbol: "rETH",
6389
+ icon: "reth.svg",
6390
+ networks: [
6391
+ {
6392
+ type: "ethereum",
6393
+ chainId: CHAIN_IDS.eth.mainnet,
6394
+ address: "0xae78736cd615f374d3085123a210448e74fc6393",
6395
+ decimals: 18
6396
+ },
6397
+ {
6398
+ type: "fuel",
6399
+ chainId: CHAIN_IDS.fuel.mainnet,
6400
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6401
+ assetId: "0xf3f9a0ed0ce8eac5f89d6b83e41b3848212d5b5f56108c54a205bb228ca30c16",
6402
+ decimals: 18
6403
+ }
6404
+ ]
6405
+ },
6406
+ {
6407
+ name: "wbETH",
6408
+ symbol: "wbETH",
6409
+ icon: "wbeth.png",
6410
+ networks: [
6411
+ {
6412
+ type: "ethereum",
6413
+ chainId: CHAIN_IDS.eth.mainnet,
6414
+ address: "0xa2E3356610840701BDf5611a53974510Ae27E2e1",
6415
+ decimals: 18
6416
+ },
6417
+ {
6418
+ type: "fuel",
6419
+ chainId: CHAIN_IDS.fuel.mainnet,
6420
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6421
+ assetId: "0x7843c74bef935e837f2bcf67b5d64ecb46dd53ff86375530b0caf3699e8ffafe",
6422
+ decimals: 18
6423
+ }
6424
+ ]
6425
+ },
6426
+ {
6427
+ name: "rstETH",
6428
+ symbol: "rstETH",
6429
+ icon: "rstETH.webp",
6430
+ networks: [
6431
+ {
6432
+ type: "ethereum",
6433
+ chainId: CHAIN_IDS.eth.mainnet,
6434
+ address: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
6435
+ decimals: 18
6436
+ },
6437
+ {
6438
+ type: "fuel",
6439
+ chainId: CHAIN_IDS.fuel.mainnet,
6440
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6441
+ assetId: "0x962792286fbc9b1d5860b4551362a12249362c21594c77abf4b3fe2bbe8d977a",
6442
+ decimals: 18
6443
+ }
6444
+ ]
6445
+ },
6446
+ {
6447
+ name: "amphrETH",
6448
+ symbol: "amphrETH",
6449
+ icon: "amphrETH.png",
6450
+ networks: [
6451
+ {
6452
+ type: "ethereum",
6453
+ chainId: CHAIN_IDS.eth.mainnet,
6454
+ address: "0x5fD13359Ba15A84B76f7F87568309040176167cd",
6455
+ decimals: 18
6456
+ },
6457
+ {
6458
+ type: "fuel",
6459
+ chainId: CHAIN_IDS.fuel.mainnet,
6460
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6461
+ assetId: "0x05fc623e57bd7bc1258efa8e4f62b05af5471d73df6f2c2dc11ecc81134c4f36",
6462
+ decimals: 18
6463
+ }
6464
+ ]
6465
+ },
6466
+ {
6467
+ name: "Manta mBTC",
6468
+ symbol: "Manta mBTC",
6469
+ icon: "manta-mbtc.svg",
6470
+ networks: [
6471
+ {
6472
+ type: "ethereum",
6473
+ chainId: CHAIN_IDS.eth.mainnet,
6474
+ address: "0x4041381e947CFD3D483d67a25C6aa9Dc924250c5",
6475
+ decimals: 18
6476
+ },
6477
+ {
6478
+ type: "fuel",
6479
+ chainId: CHAIN_IDS.fuel.mainnet,
6480
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6481
+ assetId: "0xaf3111a248ff7a3238cdeea845bb2d43cf3835f1f6b8c9d28360728b55b9ce5b",
6482
+ decimals: 18
6483
+ }
6484
+ ]
6485
+ },
6486
+ {
6487
+ name: "Manta mETH",
6488
+ symbol: "Manta mETH",
6489
+ icon: "manta-meth.svg",
6490
+ networks: [
6491
+ {
6492
+ type: "ethereum",
6493
+ chainId: CHAIN_IDS.eth.mainnet,
6494
+ address: "0x8CdF550C04Bc9B9F10938368349C9c8051A772b6",
6495
+ decimals: 18
6496
+ },
6497
+ {
6498
+ type: "fuel",
6499
+ chainId: CHAIN_IDS.fuel.mainnet,
6500
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6501
+ assetId: "0xafd219f513317b1750783c6581f55530d6cf189a5863fd18bd1b3ffcec1714b4",
6502
+ decimals: 18
6503
+ }
6504
+ ]
6505
+ },
6506
+ {
6507
+ name: "Manta mUSD",
6508
+ symbol: "Manta mUSD",
6509
+ icon: "manta-musd.svg",
6510
+ networks: [
6511
+ {
6512
+ type: "ethereum",
6513
+ chainId: CHAIN_IDS.eth.mainnet,
6514
+ address: "0x3f24E1d7a973867fC2A03fE199E5502514E0e11E",
6515
+ decimals: 18
6516
+ },
6517
+ {
6518
+ type: "fuel",
6519
+ chainId: CHAIN_IDS.fuel.mainnet,
6520
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6521
+ assetId: "0x89cb9401e55d49c3269654dd1cdfb0e80e57823a4a7db98ba8fc5953b120fef4",
6522
+ decimals: 18
6523
+ }
6524
+ ]
6525
+ },
6526
+ {
6527
+ name: "pumpBTC",
6528
+ symbol: "pumpBTC",
6529
+ icon: "pumpbtc.webp",
6530
+ networks: [
6531
+ {
6532
+ type: "ethereum",
6533
+ chainId: CHAIN_IDS.eth.mainnet,
6534
+ address: "0xf469fbd2abcd6b9de8e169d128226c0fc90a012e",
6535
+ decimals: 8
6536
+ },
6537
+ {
6538
+ type: "fuel",
6539
+ chainId: CHAIN_IDS.fuel.mainnet,
6540
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6541
+ assetId: "0x0aa5eb2bb97ca915288b653a2529355d4dc66de2b37533213f0e4aeee3d3421f",
6542
+ decimals: 8
6543
+ }
6544
+ ]
6545
+ },
6546
+ {
6547
+ name: "FBTC",
6548
+ symbol: "FBTC",
6549
+ icon: "fbtc.svg",
6550
+ networks: [
6551
+ {
6552
+ type: "ethereum",
6553
+ chainId: CHAIN_IDS.eth.mainnet,
6554
+ address: "0xc96de26018a54d51c097160568752c4e3bd6c364",
6555
+ decimals: 8
6556
+ },
6557
+ {
6558
+ type: "fuel",
6559
+ chainId: CHAIN_IDS.fuel.mainnet,
6560
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6561
+ assetId: "0xb5ecb0a1e08e2abbabf624ffea089df933376855f468ade35c6375b00c33996a",
6562
+ decimals: 8
6563
+ }
6564
+ ]
6565
+ },
6566
+ {
6567
+ name: "SolvBTC",
6568
+ symbol: "SolvBTC",
6569
+ icon: "solvBTC.webp",
6570
+ networks: [
6571
+ {
6572
+ type: "ethereum",
6573
+ chainId: CHAIN_IDS.eth.mainnet,
6574
+ address: "0x7a56e1c57c7475ccf742a1832b028f0456652f97",
6575
+ decimals: 18
6576
+ },
6577
+ {
6578
+ type: "fuel",
6579
+ chainId: CHAIN_IDS.fuel.mainnet,
6580
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6581
+ assetId: "0x1186afea9affb88809c210e13e2330b5258c2cef04bb8fff5eff372b7bd3f40f",
6582
+ decimals: 18
6583
+ }
6584
+ ]
6585
+ },
6586
+ {
6587
+ name: "SolvBTC.BBN",
6588
+ symbol: "SolvBTC.BBN",
6589
+ icon: "SolvBTC.BBN.png",
6590
+ networks: [
6591
+ {
6592
+ type: "ethereum",
6593
+ chainId: CHAIN_IDS.eth.mainnet,
6594
+ address: "0xd9d920aa40f578ab794426f5c90f6c731d159def",
6595
+ decimals: 18
6596
+ },
6597
+ {
6598
+ type: "fuel",
6599
+ chainId: CHAIN_IDS.fuel.mainnet,
6600
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6601
+ assetId: "0x7a4f087c957d30218223c2baaaa365355c9ca81b6ea49004cfb1590a5399216f",
6602
+ decimals: 18
6603
+ }
6604
+ ]
6605
+ },
6606
+ {
6607
+ name: "Mantle mETH",
6608
+ symbol: "Mantle mETH",
6609
+ icon: "mantle-meth.svg",
6610
+ networks: [
6611
+ {
6612
+ type: "ethereum",
6613
+ chainId: CHAIN_IDS.eth.mainnet,
6614
+ address: "0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa",
6615
+ decimals: 18
6616
+ },
6617
+ {
6618
+ type: "fuel",
6619
+ chainId: CHAIN_IDS.fuel.mainnet,
6620
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6621
+ assetId: "0x642a5db59ec323c2f846d4d4cf3e58d78aff64accf4f8f6455ba0aa3ef000a3b",
6622
+ decimals: 18
6623
+ }
6624
+ ]
6625
+ },
6626
+ {
6627
+ name: "sDAI",
6628
+ symbol: "sDAI",
6629
+ icon: "sdai.svg",
6630
+ networks: [
6631
+ {
6632
+ type: "ethereum",
6633
+ chainId: CHAIN_IDS.eth.mainnet,
6634
+ address: "0x83f20f44975d03b1b09e64809b757c47f942beea",
6635
+ decimals: 18
6636
+ },
6637
+ {
6638
+ type: "fuel",
6639
+ chainId: CHAIN_IDS.fuel.mainnet,
6640
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6641
+ assetId: "0x9e46f919fbf978f3cad7cd34cca982d5613af63ff8aab6c379e4faa179552958",
6642
+ decimals: 18
6643
+ }
6644
+ ]
6645
+ },
6646
+ {
6647
+ name: "USDT",
6648
+ symbol: "USDT",
6649
+ icon: "usdt.svg",
6650
+ networks: [
6651
+ {
6652
+ type: "ethereum",
6653
+ chainId: CHAIN_IDS.eth.mainnet,
6654
+ address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
6655
+ decimals: 6
6656
+ },
6657
+ {
6658
+ type: "fuel",
6659
+ chainId: CHAIN_IDS.fuel.mainnet,
6660
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6661
+ assetId: "0xa0265fb5c32f6e8db3197af3c7eb05c48ae373605b8165b6f4a51c5b0ba4812e",
6662
+ decimals: 6
6663
+ }
6664
+ ]
6665
+ },
6666
+ {
6667
+ name: "USDC",
6668
+ symbol: "USDC",
6669
+ icon: "usdc.svg",
6670
+ networks: [
6671
+ {
6672
+ type: "ethereum",
6673
+ chainId: CHAIN_IDS.eth.mainnet,
6674
+ address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
6675
+ decimals: 6
6676
+ },
6677
+ {
6678
+ type: "fuel",
6679
+ chainId: CHAIN_IDS.fuel.mainnet,
6680
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6681
+ assetId: "0x286c479da40dc953bddc3bb4c453b608bba2e0ac483b077bd475174115395e6b",
6682
+ decimals: 6
6683
+ }
6684
+ ]
6685
+ },
6686
+ {
6687
+ name: "USDe",
6688
+ symbol: "USDe",
6689
+ icon: "USDe.svg",
6690
+ networks: [
6691
+ {
6692
+ type: "ethereum",
6693
+ chainId: CHAIN_IDS.eth.mainnet,
6694
+ address: "0x4c9edd5852cd905f086c759e8383e09bff1e68b3",
6695
+ decimals: 18
6696
+ },
6697
+ {
6698
+ type: "ethereum",
6699
+ chainId: CHAIN_IDS.eth.sepolia,
6700
+ address: "0xc6387efad0f184a90b34f397c3d6fd63135ef790",
6701
+ decimals: 18
6702
+ },
6703
+ {
6704
+ type: "fuel",
6705
+ chainId: CHAIN_IDS.fuel.mainnet,
6706
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6707
+ assetId: "0xb6133b2ef9f6153eb869125d23dcf20d1e735331b5e41b15a6a7a6cec70e8651",
6708
+ decimals: 18
6709
+ },
6710
+ {
6711
+ type: "fuel",
6712
+ chainId: CHAIN_IDS.fuel.testnet,
6713
+ contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
6714
+ assetId: "0xf5c6d72d0f2c782fa47d8e228c198a08654e9fc66ca60ad85902b1d09046a7ab",
6715
+ decimals: 18
6716
+ }
6717
+ ]
6718
+ },
6719
+ {
6720
+ name: "sUSDe",
6721
+ symbol: "sUSDe",
6722
+ icon: "sUSDe.webp",
6723
+ networks: [
6724
+ {
6725
+ type: "ethereum",
6726
+ chainId: CHAIN_IDS.eth.mainnet,
6727
+ address: "0x9d39a5de30e57443bff2a8307a4256c8797a3497",
6728
+ decimals: 18
6729
+ },
6730
+ {
6731
+ type: "ethereum",
6732
+ chainId: CHAIN_IDS.eth.sepolia,
6733
+ address: "0xb8f4f4eafc1d2a3c0a4d519bbf1114c311cc9b1b",
6734
+ decimals: 18
6735
+ },
6736
+ {
6737
+ type: "fuel",
6738
+ chainId: CHAIN_IDS.fuel.mainnet,
6739
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6740
+ assetId: "0xd05563025104fc36496c15c7021ad6b31034b0e89a356f4f818045d1f48808bc",
6741
+ decimals: 18
6742
+ },
6743
+ {
6744
+ type: "fuel",
6745
+ chainId: CHAIN_IDS.fuel.testnet,
6746
+ contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
6747
+ assetId: "0xa86e37d385c08beddbb02c8260f9ec535d484c8ea908fc19d4e6dc8d5141fb2e",
6748
+ decimals: 18
6749
+ }
6750
+ ]
6751
+ },
6752
+ {
6753
+ name: "rsUSDe",
6754
+ symbol: "rsUSDe",
6755
+ icon: "rsUSDe.svg",
6756
+ networks: [
6757
+ {
6758
+ type: "ethereum",
6759
+ chainId: CHAIN_IDS.eth.mainnet,
6760
+ address: "0x82f5104b23FF2FA54C2345F821dAc9369e9E0B26",
6761
+ decimals: 18
6762
+ },
6763
+ {
6764
+ type: "fuel",
6765
+ chainId: CHAIN_IDS.fuel.mainnet,
6766
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6767
+ assetId: "0x78d4522ec607f6e8efb66ea49439d1ee48623cf763f9688a8eada025def033d9",
6768
+ decimals: 18
6769
+ }
6770
+ ]
6771
+ },
6772
+ {
6773
+ name: "wstETH",
6774
+ symbol: "wstETH",
6775
+ icon: "wsteth.svg",
6776
+ networks: [
6777
+ {
6778
+ type: "ethereum",
6779
+ chainId: CHAIN_IDS.eth.mainnet,
6780
+ address: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
6781
+ decimals: 18
6782
+ },
6783
+ {
6784
+ type: "ethereum",
6785
+ chainId: CHAIN_IDS.eth.sepolia,
6786
+ address: "0xB82381A3fBD3FaFA77B3a7bE693342618240067b",
6787
+ decimals: 18
6788
+ },
6789
+ {
6790
+ type: "fuel",
6791
+ chainId: CHAIN_IDS.fuel.mainnet,
6792
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6793
+ assetId: "0x1a7815cc9f75db5c24a5b0814bfb706bb9fe485333e98254015de8f48f84c67b",
6794
+ decimals: 18
6795
+ },
6796
+ {
6797
+ type: "fuel",
6798
+ chainId: CHAIN_IDS.fuel.testnet,
6799
+ contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
6800
+ assetId: "0x4c467e3fd4f32179e1aad3b92ebbdaa6ff6aeda5b8da5f8e64e96405eb52a7f5",
6801
+ decimals: 18
6802
+ }
6803
+ ]
6804
+ },
6805
+ {
6806
+ name: "ezETH",
6807
+ symbol: "ezETH",
6808
+ icon: "ezeth.webp",
6809
+ networks: [
6810
+ {
6811
+ type: "ethereum",
6812
+ chainId: CHAIN_IDS.eth.mainnet,
6813
+ address: "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110",
6814
+ decimals: 18
6815
+ },
6816
+ {
6817
+ type: "fuel",
6818
+ chainId: CHAIN_IDS.fuel.mainnet,
6819
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6820
+ assetId: "0x91b3559edb2619cde8ffb2aa7b3c3be97efd794ea46700db7092abeee62281b0",
6821
+ decimals: 18
6822
+ }
6823
+ ]
6824
+ },
6825
+ {
6826
+ name: "pzETH",
6827
+ symbol: "pzETH",
6828
+ icon: "pzETH.webp",
6829
+ networks: [
6830
+ {
6831
+ type: "ethereum",
6832
+ chainId: CHAIN_IDS.eth.mainnet,
6833
+ address: "0x8c9532a60e0e7c6bbd2b2c1303f63ace1c3e9811",
6834
+ decimals: 18
6835
+ },
6836
+ {
6837
+ type: "fuel",
6838
+ chainId: CHAIN_IDS.fuel.mainnet,
6839
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6840
+ assetId: "0x1493d4ec82124de8f9b625682de69dcccda79e882b89a55a8c737b12de67bd68",
6841
+ decimals: 18
6842
+ }
6843
+ ]
6844
+ },
6845
+ {
6846
+ name: "Re7LRT",
6847
+ symbol: "Re7LRT",
6848
+ icon: "Re7LRT.png",
6849
+ networks: [
6850
+ {
6851
+ type: "ethereum",
6852
+ chainId: CHAIN_IDS.eth.mainnet,
6853
+ address: "0x84631c0d0081FDe56DeB72F6DE77abBbF6A9f93a",
6854
+ decimals: 18
6855
+ },
6856
+ {
6857
+ type: "fuel",
6858
+ chainId: CHAIN_IDS.fuel.mainnet,
6859
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6860
+ assetId: "0xf2fc648c23a5db24610a1cf696acc4f0f6d9a7d6028dd9944964ab23f6e35995",
6861
+ decimals: 18
6862
+ }
6863
+ ]
6864
+ },
6865
+ {
6866
+ name: "steakLRT",
6867
+ symbol: "steakLRT",
6868
+ icon: "steakLRT.png",
6869
+ networks: [
6870
+ {
6871
+ type: "ethereum",
6872
+ chainId: CHAIN_IDS.eth.mainnet,
6873
+ address: "0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc",
6874
+ decimals: 18
6875
+ },
6876
+ {
6877
+ type: "fuel",
6878
+ chainId: CHAIN_IDS.fuel.mainnet,
6879
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6880
+ assetId: "0x4fc8ac9f101df07e2c2dec4a53c8c42c439bdbe5e36ea2d863a61ff60afafc30",
6881
+ decimals: 18
6882
+ }
6883
+ ]
6884
+ }
6885
+ ];
6886
+ var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
6887
+
6888
+ // src/providers/utils/merge-quantities.ts
6889
+ var mergeQuantities = (...coinQuantities) => {
6890
+ const resultMap = {};
6891
+ function addToMap({ amount, assetId }) {
6892
+ if (resultMap[assetId]) {
6893
+ resultMap[assetId] = resultMap[assetId].add(amount);
6894
+ } else {
6895
+ resultMap[assetId] = amount;
6896
+ }
6897
+ }
6898
+ coinQuantities.forEach((arr) => arr.forEach(addToMap));
6899
+ return Object.entries(resultMap).map(([assetId, amount]) => ({ assetId, amount }));
6900
+ };
6005
6901
 
6006
6902
  // src/utils/formatTransferToContractScriptData.ts
6007
6903
  var import_abi_coder6 = require("@fuel-ts/abi-coder");
6008
6904
  var import_math20 = require("@fuel-ts/math");
6009
- var import_utils29 = require("@fuel-ts/utils");
6905
+ var import_utils33 = require("@fuel-ts/utils");
6010
6906
  var asm = __toESM(require("@fuels/vm-asm"));
6011
6907
  var formatTransferToContractScriptData = (params) => {
6012
6908
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
6013
6909
  const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
6014
6910
  const encoded = numberCoder.encode(new import_math20.BN(amountToTransfer).toNumber());
6015
6911
  const scriptData = Uint8Array.from([
6016
- ...(0, import_utils29.arrayify)(hexlifiedContractId),
6912
+ ...(0, import_utils33.arrayify)(hexlifiedContractId),
6017
6913
  ...encoded,
6018
- ...(0, import_utils29.arrayify)(assetId)
6914
+ ...(0, import_utils33.arrayify)(assetId)
6019
6915
  ]);
6020
6916
  return scriptData;
6021
6917
  };
@@ -6076,7 +6972,7 @@ var Account = class extends import_interfaces.AbstractAccount {
6076
6972
  */
6077
6973
  get provider() {
6078
6974
  if (!this._provider) {
6079
- throw new import_errors18.FuelError(import_errors18.ErrorCode.MISSING_PROVIDER, "Provider not set");
6975
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.MISSING_PROVIDER, "Provider not set");
6080
6976
  }
6081
6977
  return this._provider;
6082
6978
  }
@@ -6194,7 +7090,7 @@ var Account = class extends import_interfaces.AbstractAccount {
6194
7090
  );
6195
7091
  request.addResources(resources);
6196
7092
  request.updatePredicateGasUsed(estimatedPredicates);
6197
- const requestToReestimate2 = (0, import_ramda7.clone)(request);
7093
+ const requestToReestimate2 = (0, import_ramda9.clone)(request);
6198
7094
  if (addedSignatures) {
6199
7095
  Array.from({ length: addedSignatures }).forEach(
6200
7096
  () => requestToReestimate2.addEmptyWitness()
@@ -6227,13 +7123,13 @@ var Account = class extends import_interfaces.AbstractAccount {
6227
7123
  fundingAttempts += 1;
6228
7124
  }
6229
7125
  if (needsToBeFunded) {
6230
- throw new import_errors18.FuelError(
6231
- import_errors18.ErrorCode.NOT_ENOUGH_FUNDS,
7126
+ throw new import_errors19.FuelError(
7127
+ import_errors19.ErrorCode.NOT_ENOUGH_FUNDS,
6232
7128
  `The account ${this.address} does not have enough base asset funds to cover the transaction execution.`
6233
7129
  );
6234
7130
  }
6235
7131
  request.updatePredicateGasUsed(estimatedPredicates);
6236
- const requestToReestimate = (0, import_ramda7.clone)(request);
7132
+ const requestToReestimate = (0, import_ramda9.clone)(request);
6237
7133
  if (addedSignatures) {
6238
7134
  Array.from({ length: addedSignatures }).forEach(() => requestToReestimate.addEmptyWitness());
6239
7135
  }
@@ -6333,8 +7229,8 @@ var Account = class extends import_interfaces.AbstractAccount {
6333
7229
  */
6334
7230
  async transferToContract(contractId, amount, assetId, txParams = {}) {
6335
7231
  if ((0, import_math21.bn)(amount).lte(0)) {
6336
- throw new import_errors18.FuelError(
6337
- import_errors18.ErrorCode.INVALID_TRANSFER_AMOUNT,
7232
+ throw new import_errors19.FuelError(
7233
+ import_errors19.ErrorCode.INVALID_TRANSFER_AMOUNT,
6338
7234
  "Transfer amount must be a positive number."
6339
7235
  );
6340
7236
  }
@@ -6373,14 +7269,14 @@ var Account = class extends import_interfaces.AbstractAccount {
6373
7269
  */
6374
7270
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
6375
7271
  const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
6376
- const recipientDataArray = (0, import_utils30.arrayify)(
7272
+ const recipientDataArray = (0, import_utils34.arrayify)(
6377
7273
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
6378
7274
  );
6379
- const amountDataArray = (0, import_utils30.arrayify)(
7275
+ const amountDataArray = (0, import_utils34.arrayify)(
6380
7276
  "0x".concat((0, import_math21.bn)(amount).toHex().substring(2).padStart(16, "0"))
6381
7277
  );
6382
7278
  const script = new Uint8Array([
6383
- ...(0, import_utils30.arrayify)(withdrawScript.bytes),
7279
+ ...(0, import_utils34.arrayify)(withdrawScript.bytes),
6384
7280
  ...recipientDataArray,
6385
7281
  ...amountDataArray
6386
7282
  ]);
@@ -6409,13 +7305,13 @@ var Account = class extends import_interfaces.AbstractAccount {
6409
7305
  * @returns A promise that resolves to the transaction cost object.
6410
7306
  */
6411
7307
  async getTransactionCost(transactionRequestLike, { signatureCallback, quantities = [] } = {}) {
6412
- const txRequestClone = (0, import_ramda7.clone)(transactionRequestify(transactionRequestLike));
7308
+ const txRequestClone = (0, import_ramda9.clone)(transactionRequestify(transactionRequestLike));
6413
7309
  const baseAssetId = this.provider.getBaseAssetId();
6414
7310
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
6415
7311
  const requiredQuantities = mergeQuantities(coinOutputsQuantities, quantities);
6416
7312
  const transactionFeeForDryRun = [{ assetId: baseAssetId, amount: (0, import_math21.bn)("100000000000000000") }];
6417
7313
  const findAssetInput = (assetId) => txRequestClone.inputs.find((input) => {
6418
- if (input.type === import_transactions22.InputType.Coin) {
7314
+ if (input.type === import_transactions24.InputType.Coin) {
6419
7315
  return input.assetId === assetId;
6420
7316
  }
6421
7317
  if (isRequestInputMessageWithoutData(input)) {
@@ -6460,7 +7356,7 @@ var Account = class extends import_interfaces.AbstractAccount {
6460
7356
  */
6461
7357
  async signMessage(message) {
6462
7358
  if (!this._connector) {
6463
- throw new import_errors18.FuelError(import_errors18.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
7359
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
6464
7360
  }
6465
7361
  return this._connector.signMessage(this.address.toString(), message);
6466
7362
  }
@@ -6472,8 +7368,8 @@ var Account = class extends import_interfaces.AbstractAccount {
6472
7368
  */
6473
7369
  async signTransaction(transactionRequestLike) {
6474
7370
  if (!this._connector) {
6475
- throw new import_errors18.FuelError(
6476
- import_errors18.ErrorCode.MISSING_CONNECTOR,
7371
+ throw new import_errors19.FuelError(
7372
+ import_errors19.ErrorCode.MISSING_CONNECTOR,
6477
7373
  "A connector is required to sign transactions."
6478
7374
  );
6479
7375
  }
@@ -6522,7 +7418,7 @@ var Account = class extends import_interfaces.AbstractAccount {
6522
7418
  */
6523
7419
  generateFakeResources(coins) {
6524
7420
  return coins.map((coin) => ({
6525
- id: (0, import_utils30.hexlify)((0, import_crypto2.randomBytes)(import_abi_coder7.UTXO_ID_LEN)),
7421
+ id: (0, import_utils34.hexlify)((0, import_crypto2.randomBytes)(import_abi_coder7.UTXO_ID_LEN)),
6526
7422
  owner: this.address,
6527
7423
  blockCreated: (0, import_math21.bn)(1),
6528
7424
  txCreatedIdx: (0, import_math21.bn)(1),
@@ -6532,8 +7428,8 @@ var Account = class extends import_interfaces.AbstractAccount {
6532
7428
  /** @hidden * */
6533
7429
  validateTransferAmount(amount) {
6534
7430
  if ((0, import_math21.bn)(amount).lte(0)) {
6535
- throw new import_errors18.FuelError(
6536
- import_errors18.ErrorCode.INVALID_TRANSFER_AMOUNT,
7431
+ throw new import_errors19.FuelError(
7432
+ import_errors19.ErrorCode.INVALID_TRANSFER_AMOUNT,
6537
7433
  "Transfer amount must be a positive number."
6538
7434
  );
6539
7435
  }
@@ -6559,19 +7455,19 @@ var Account = class extends import_interfaces.AbstractAccount {
6559
7455
  txParams: { gasLimit: setGasLimit, maxFee: setMaxFee }
6560
7456
  }) {
6561
7457
  const request = transactionRequestify(transactionRequest);
6562
- if (!(0, import_utils30.isDefined)(setGasLimit)) {
7458
+ if (!(0, import_utils34.isDefined)(setGasLimit)) {
6563
7459
  request.gasLimit = gasUsed;
6564
7460
  } else if (gasUsed.gt(setGasLimit)) {
6565
- throw new import_errors18.FuelError(
6566
- import_errors18.ErrorCode.GAS_LIMIT_TOO_LOW,
7461
+ throw new import_errors19.FuelError(
7462
+ import_errors19.ErrorCode.GAS_LIMIT_TOO_LOW,
6567
7463
  `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
6568
7464
  );
6569
7465
  }
6570
- if (!(0, import_utils30.isDefined)(setMaxFee)) {
7466
+ if (!(0, import_utils34.isDefined)(setMaxFee)) {
6571
7467
  request.maxFee = maxFee;
6572
7468
  } else if (maxFee.gt(setMaxFee)) {
6573
- throw new import_errors18.FuelError(
6574
- import_errors18.ErrorCode.MAX_FEE_TOO_LOW,
7469
+ throw new import_errors19.FuelError(
7470
+ import_errors19.ErrorCode.MAX_FEE_TOO_LOW,
6575
7471
  `Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
6576
7472
  );
6577
7473
  }
@@ -6580,15 +7476,15 @@ var Account = class extends import_interfaces.AbstractAccount {
6580
7476
  };
6581
7477
 
6582
7478
  // src/wallet/base-wallet-unlocked.ts
6583
- var import_hasher3 = require("@fuel-ts/hasher");
6584
- var import_utils33 = require("@fuel-ts/utils");
7479
+ var import_hasher4 = require("@fuel-ts/hasher");
7480
+ var import_utils37 = require("@fuel-ts/utils");
6585
7481
 
6586
7482
  // src/signer/signer.ts
6587
7483
  var import_address5 = require("@fuel-ts/address");
6588
7484
  var import_crypto3 = require("@fuel-ts/crypto");
6589
- var import_hasher2 = require("@fuel-ts/hasher");
7485
+ var import_hasher3 = require("@fuel-ts/hasher");
6590
7486
  var import_math22 = require("@fuel-ts/math");
6591
- var import_utils31 = require("@fuel-ts/utils");
7487
+ var import_utils35 = require("@fuel-ts/utils");
6592
7488
  var import_secp256k1 = require("@noble/curves/secp256k1");
6593
7489
  var Signer = class {
6594
7490
  address;
@@ -6608,9 +7504,9 @@ var Signer = class {
6608
7504
  }
6609
7505
  }
6610
7506
  const privateKeyBytes = (0, import_math22.toBytes)(privateKey, 32);
6611
- this.privateKey = (0, import_utils31.hexlify)(privateKeyBytes);
6612
- this.publicKey = (0, import_utils31.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
6613
- this.compressedPublicKey = (0, import_utils31.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
7507
+ this.privateKey = (0, import_utils35.hexlify)(privateKeyBytes);
7508
+ this.publicKey = (0, import_utils35.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
7509
+ this.compressedPublicKey = (0, import_utils35.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
6614
7510
  this.address = import_address5.Address.fromPublicKey(this.publicKey);
6615
7511
  }
6616
7512
  /**
@@ -6624,11 +7520,11 @@ var Signer = class {
6624
7520
  * @returns hashed signature
6625
7521
  */
6626
7522
  sign(data) {
6627
- const signature = import_secp256k1.secp256k1.sign((0, import_utils31.arrayify)(data), (0, import_utils31.arrayify)(this.privateKey));
7523
+ const signature = import_secp256k1.secp256k1.sign((0, import_utils35.arrayify)(data), (0, import_utils35.arrayify)(this.privateKey));
6628
7524
  const r = (0, import_math22.toBytes)(`0x${signature.r.toString(16)}`, 32);
6629
7525
  const s = (0, import_math22.toBytes)(`0x${signature.s.toString(16)}`, 32);
6630
7526
  s[0] |= (signature.recovery || 0) << 7;
6631
- return (0, import_utils31.hexlify)((0, import_utils31.concat)([r, s]));
7527
+ return (0, import_utils35.hexlify)((0, import_utils35.concat)([r, s]));
6632
7528
  }
6633
7529
  /**
6634
7530
  * Add point on the current elliptic curve
@@ -6637,8 +7533,8 @@ var Signer = class {
6637
7533
  * @returns compressed point on the curve
6638
7534
  */
6639
7535
  addPoint(point) {
6640
- const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils31.arrayify)(this.compressedPublicKey));
6641
- const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils31.arrayify)(point));
7536
+ const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils35.arrayify)(this.compressedPublicKey));
7537
+ const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils35.arrayify)(point));
6642
7538
  const result = p0.add(p1);
6643
7539
  return `0x${result.toHex(true)}`;
6644
7540
  }
@@ -6650,16 +7546,16 @@ var Signer = class {
6650
7546
  * @returns public key from signature from the
6651
7547
  */
6652
7548
  static recoverPublicKey(data, signature) {
6653
- const signedMessageBytes = (0, import_utils31.arrayify)(signature);
7549
+ const signedMessageBytes = (0, import_utils35.arrayify)(signature);
6654
7550
  const r = signedMessageBytes.slice(0, 32);
6655
7551
  const s = signedMessageBytes.slice(32, 64);
6656
7552
  const recoveryParam = (s[0] & 128) >> 7;
6657
7553
  s[0] &= 127;
6658
- const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils31.hexlify)(r)), BigInt((0, import_utils31.hexlify)(s))).addRecoveryBit(
7554
+ const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils35.hexlify)(r)), BigInt((0, import_utils35.hexlify)(s))).addRecoveryBit(
6659
7555
  recoveryParam
6660
7556
  );
6661
- const publicKey = sig.recoverPublicKey((0, import_utils31.arrayify)(data)).toRawBytes(false).slice(1);
6662
- return (0, import_utils31.hexlify)(publicKey);
7557
+ const publicKey = sig.recoverPublicKey((0, import_utils35.arrayify)(data)).toRawBytes(false).slice(1);
7558
+ return (0, import_utils35.hexlify)(publicKey);
6663
7559
  }
6664
7560
  /**
6665
7561
  * Recover the address from a signature performed with [`sign`](#sign).
@@ -6678,7 +7574,7 @@ var Signer = class {
6678
7574
  * @returns random 32-byte hashed
6679
7575
  */
6680
7576
  static generatePrivateKey(entropy) {
6681
- return entropy ? (0, import_hasher2.hash)((0, import_utils31.concat)([(0, import_crypto3.randomBytes)(32), (0, import_utils31.arrayify)(entropy)])) : (0, import_crypto3.randomBytes)(32);
7577
+ return entropy ? (0, import_hasher3.hash)((0, import_utils35.concat)([(0, import_crypto3.randomBytes)(32), (0, import_utils35.arrayify)(entropy)])) : (0, import_crypto3.randomBytes)(32);
6682
7578
  }
6683
7579
  /**
6684
7580
  * Extended publicKey from a compact publicKey
@@ -6687,16 +7583,16 @@ var Signer = class {
6687
7583
  * @returns extended publicKey
6688
7584
  */
6689
7585
  static extendPublicKey(publicKey) {
6690
- const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils31.arrayify)(publicKey));
6691
- return (0, import_utils31.hexlify)(point.toRawBytes(false).slice(1));
7586
+ const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils35.arrayify)(publicKey));
7587
+ return (0, import_utils35.hexlify)(point.toRawBytes(false).slice(1));
6692
7588
  }
6693
7589
  };
6694
7590
 
6695
7591
  // src/wallet/keystore-wallet.ts
6696
7592
  var import_address6 = require("@fuel-ts/address");
6697
7593
  var import_crypto4 = require("@fuel-ts/crypto");
6698
- var import_errors19 = require("@fuel-ts/errors");
6699
- var import_utils32 = require("@fuel-ts/utils");
7594
+ var import_errors20 = require("@fuel-ts/errors");
7595
+ var import_utils36 = require("@fuel-ts/utils");
6700
7596
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
6701
7597
  var DEFAULT_KDF_PARAMS_R = 8;
6702
7598
  var DEFAULT_KDF_PARAMS_P = 1;
@@ -6772,13 +7668,13 @@ async function decryptKeystoreWallet(jsonWallet, password) {
6772
7668
  const macHashUint8Array = (0, import_crypto4.keccak256)(data);
6773
7669
  const macHash = (0, import_crypto4.stringFromBuffer)(macHashUint8Array, "hex");
6774
7670
  if (mac !== macHash) {
6775
- throw new import_errors19.FuelError(
6776
- import_errors19.ErrorCode.INVALID_PASSWORD,
7671
+ throw new import_errors20.FuelError(
7672
+ import_errors20.ErrorCode.INVALID_PASSWORD,
6777
7673
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
6778
7674
  );
6779
7675
  }
6780
7676
  const buffer = await (0, import_crypto4.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
6781
- const privateKey = (0, import_utils32.hexlify)(buffer);
7677
+ const privateKey = (0, import_utils36.hexlify)(buffer);
6782
7678
  return privateKey;
6783
7679
  }
6784
7680
 
@@ -6822,8 +7718,8 @@ var BaseWalletUnlocked = class extends Account {
6822
7718
  * @returns A promise that resolves to the signature as a ECDSA 64 bytes string.
6823
7719
  */
6824
7720
  async signMessage(message) {
6825
- const signedMessage = await this.signer().sign((0, import_hasher3.hashMessage)(message));
6826
- return (0, import_utils33.hexlify)(signedMessage);
7721
+ const signedMessage = await this.signer().sign((0, import_hasher4.hashMessage)(message));
7722
+ return (0, import_utils37.hexlify)(signedMessage);
6827
7723
  }
6828
7724
  /**
6829
7725
  * Signs a transaction with the wallet's private key.
@@ -6836,7 +7732,7 @@ var BaseWalletUnlocked = class extends Account {
6836
7732
  const chainId = this.provider.getChainId();
6837
7733
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
6838
7734
  const signature = await this.signer().sign(hashedTransaction);
6839
- return (0, import_utils33.hexlify)(signature);
7735
+ return (0, import_utils37.hexlify)(signature);
6840
7736
  }
6841
7737
  /**
6842
7738
  * Populates a transaction with the witnesses signature.
@@ -6903,16 +7799,16 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
6903
7799
 
6904
7800
  // src/hdwallet/hdwallet.ts
6905
7801
  var import_crypto6 = require("@fuel-ts/crypto");
6906
- var import_errors22 = require("@fuel-ts/errors");
6907
- var import_hasher6 = require("@fuel-ts/hasher");
7802
+ var import_errors23 = require("@fuel-ts/errors");
7803
+ var import_hasher7 = require("@fuel-ts/hasher");
6908
7804
  var import_math23 = require("@fuel-ts/math");
6909
- var import_utils37 = require("@fuel-ts/utils");
7805
+ var import_utils41 = require("@fuel-ts/utils");
6910
7806
 
6911
7807
  // src/mnemonic/mnemonic.ts
6912
7808
  var import_crypto5 = require("@fuel-ts/crypto");
6913
- var import_errors21 = require("@fuel-ts/errors");
6914
- var import_hasher5 = require("@fuel-ts/hasher");
6915
- var import_utils35 = require("@fuel-ts/utils");
7809
+ var import_errors22 = require("@fuel-ts/errors");
7810
+ var import_hasher6 = require("@fuel-ts/hasher");
7811
+ var import_utils39 = require("@fuel-ts/utils");
6916
7812
 
6917
7813
  // src/wordlists/words/english.ts
6918
7814
  var english = [
@@ -8973,9 +9869,9 @@ var Language = /* @__PURE__ */ ((Language2) => {
8973
9869
  })(Language || {});
8974
9870
 
8975
9871
  // src/mnemonic/utils.ts
8976
- var import_errors20 = require("@fuel-ts/errors");
8977
- var import_hasher4 = require("@fuel-ts/hasher");
8978
- var import_utils34 = require("@fuel-ts/utils");
9872
+ var import_errors21 = require("@fuel-ts/errors");
9873
+ var import_hasher5 = require("@fuel-ts/hasher");
9874
+ var import_utils38 = require("@fuel-ts/utils");
8979
9875
  function getLowerMask(bits) {
8980
9876
  return (1 << bits) - 1;
8981
9877
  }
@@ -9010,20 +9906,20 @@ function entropyToMnemonicIndices(entropy) {
9010
9906
  }
9011
9907
  }
9012
9908
  const checksumBits = entropy.length / 4;
9013
- const checksum = (0, import_utils34.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
9909
+ const checksum = (0, import_utils38.arrayify)((0, import_hasher5.sha256)(entropy))[0] & getUpperMask(checksumBits);
9014
9910
  indices[indices.length - 1] <<= checksumBits;
9015
9911
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
9016
9912
  return indices;
9017
9913
  }
9018
9914
  function mnemonicWordsToEntropy(words, wordlist) {
9019
9915
  const size = Math.ceil(11 * words.length / 8);
9020
- const entropy = (0, import_utils34.arrayify)(new Uint8Array(size));
9916
+ const entropy = (0, import_utils38.arrayify)(new Uint8Array(size));
9021
9917
  let offset = 0;
9022
9918
  for (let i = 0; i < words.length; i += 1) {
9023
9919
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
9024
9920
  if (index === -1) {
9025
- throw new import_errors20.FuelError(
9026
- import_errors20.ErrorCode.INVALID_MNEMONIC,
9921
+ throw new import_errors21.FuelError(
9922
+ import_errors21.ErrorCode.INVALID_MNEMONIC,
9027
9923
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
9028
9924
  );
9029
9925
  }
@@ -9037,10 +9933,10 @@ function mnemonicWordsToEntropy(words, wordlist) {
9037
9933
  const entropyBits = 32 * words.length / 3;
9038
9934
  const checksumBits = words.length / 3;
9039
9935
  const checksumMask = getUpperMask(checksumBits);
9040
- const checksum = (0, import_utils34.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
9936
+ const checksum = (0, import_utils38.arrayify)((0, import_hasher5.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
9041
9937
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
9042
- throw new import_errors20.FuelError(
9043
- import_errors20.ErrorCode.INVALID_CHECKSUM,
9938
+ throw new import_errors21.FuelError(
9939
+ import_errors21.ErrorCode.INVALID_CHECKSUM,
9044
9940
  "Checksum validation failed for the provided mnemonic."
9045
9941
  );
9046
9942
  }
@@ -9048,22 +9944,22 @@ function mnemonicWordsToEntropy(words, wordlist) {
9048
9944
  }
9049
9945
 
9050
9946
  // src/mnemonic/mnemonic.ts
9051
- var MasterSecret = (0, import_utils35.toUtf8Bytes)("Bitcoin seed");
9947
+ var MasterSecret = (0, import_utils39.toUtf8Bytes)("Bitcoin seed");
9052
9948
  var MainnetPRV = "0x0488ade4";
9053
9949
  var TestnetPRV = "0x04358394";
9054
9950
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
9055
9951
  function assertWordList(wordlist) {
9056
9952
  if (wordlist.length !== 2048) {
9057
- throw new import_errors21.FuelError(
9058
- import_errors21.ErrorCode.INVALID_WORD_LIST,
9953
+ throw new import_errors22.FuelError(
9954
+ import_errors22.ErrorCode.INVALID_WORD_LIST,
9059
9955
  `Expected word list length of 2048, but got ${wordlist.length}.`
9060
9956
  );
9061
9957
  }
9062
9958
  }
9063
9959
  function assertEntropy(entropy) {
9064
9960
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
9065
- throw new import_errors21.FuelError(
9066
- import_errors21.ErrorCode.INVALID_ENTROPY,
9961
+ throw new import_errors22.FuelError(
9962
+ import_errors22.ErrorCode.INVALID_ENTROPY,
9067
9963
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
9068
9964
  );
9069
9965
  }
@@ -9073,7 +9969,7 @@ function assertMnemonic(words) {
9073
9969
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
9074
9970
  ", "
9075
9971
  )}] words, but got ${words.length}.`;
9076
- throw new import_errors21.FuelError(import_errors21.ErrorCode.INVALID_MNEMONIC, errorMsg);
9972
+ throw new import_errors22.FuelError(import_errors22.ErrorCode.INVALID_MNEMONIC, errorMsg);
9077
9973
  }
9078
9974
  }
9079
9975
  var Mnemonic = class {
@@ -9112,7 +10008,7 @@ var Mnemonic = class {
9112
10008
  static mnemonicToEntropy(phrase, wordlist = english) {
9113
10009
  const words = getWords(phrase);
9114
10010
  assertMnemonic(words);
9115
- return (0, import_utils35.hexlify)(mnemonicWordsToEntropy(words, wordlist));
10011
+ return (0, import_utils39.hexlify)(mnemonicWordsToEntropy(words, wordlist));
9116
10012
  }
9117
10013
  /**
9118
10014
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -9120,7 +10016,7 @@ var Mnemonic = class {
9120
10016
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
9121
10017
  */
9122
10018
  static entropyToMnemonic(entropy, wordlist = english) {
9123
- const entropyBytes = (0, import_utils35.arrayify)(entropy);
10019
+ const entropyBytes = (0, import_utils39.arrayify)(entropy);
9124
10020
  assertWordList(wordlist);
9125
10021
  assertEntropy(entropyBytes);
9126
10022
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -9132,8 +10028,8 @@ var Mnemonic = class {
9132
10028
  */
9133
10029
  static mnemonicToSeed(phrase, passphrase = "") {
9134
10030
  assertMnemonic(getWords(phrase));
9135
- const phraseBytes = (0, import_utils35.toUtf8Bytes)(getPhrase(phrase));
9136
- const salt = (0, import_utils35.toUtf8Bytes)(`mnemonic${passphrase}`);
10031
+ const phraseBytes = (0, import_utils39.toUtf8Bytes)(getPhrase(phrase));
10032
+ const salt = (0, import_utils39.toUtf8Bytes)(`mnemonic${passphrase}`);
9137
10033
  return (0, import_crypto5.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
9138
10034
  }
9139
10035
  /**
@@ -9189,14 +10085,14 @@ var Mnemonic = class {
9189
10085
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
9190
10086
  */
9191
10087
  static masterKeysFromSeed(seed) {
9192
- const seedArray = (0, import_utils35.arrayify)(seed);
10088
+ const seedArray = (0, import_utils39.arrayify)(seed);
9193
10089
  if (seedArray.length < 16 || seedArray.length > 64) {
9194
- throw new import_errors21.FuelError(
9195
- import_errors21.ErrorCode.INVALID_SEED,
10090
+ throw new import_errors22.FuelError(
10091
+ import_errors22.ErrorCode.INVALID_SEED,
9196
10092
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
9197
10093
  );
9198
10094
  }
9199
- return (0, import_utils35.arrayify)((0, import_crypto5.computeHmac)("sha512", MasterSecret, seedArray));
10095
+ return (0, import_utils39.arrayify)((0, import_crypto5.computeHmac)("sha512", MasterSecret, seedArray));
9200
10096
  }
9201
10097
  /**
9202
10098
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -9207,22 +10103,22 @@ var Mnemonic = class {
9207
10103
  */
9208
10104
  static seedToExtendedKey(seed, testnet = false) {
9209
10105
  const masterKey = Mnemonic.masterKeysFromSeed(seed);
9210
- const prefix = (0, import_utils35.arrayify)(testnet ? TestnetPRV : MainnetPRV);
10106
+ const prefix = (0, import_utils39.arrayify)(testnet ? TestnetPRV : MainnetPRV);
9211
10107
  const depth = "0x00";
9212
10108
  const fingerprint = "0x00000000";
9213
10109
  const index = "0x00000000";
9214
10110
  const chainCode = masterKey.slice(32);
9215
10111
  const privateKey = masterKey.slice(0, 32);
9216
- const extendedKey = (0, import_utils35.concat)([
10112
+ const extendedKey = (0, import_utils39.concat)([
9217
10113
  prefix,
9218
10114
  depth,
9219
10115
  fingerprint,
9220
10116
  index,
9221
10117
  chainCode,
9222
- (0, import_utils35.concat)(["0x00", privateKey])
10118
+ (0, import_utils39.concat)(["0x00", privateKey])
9223
10119
  ]);
9224
- const checksum = (0, import_utils35.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
9225
- return (0, import_utils35.encodeBase58)((0, import_utils35.concat)([extendedKey, checksum]));
10120
+ const checksum = (0, import_utils39.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(extendedKey)), 0, 4);
10121
+ return (0, import_utils39.encodeBase58)((0, import_utils39.concat)([extendedKey, checksum]));
9226
10122
  }
9227
10123
  /**
9228
10124
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -9237,7 +10133,7 @@ var Mnemonic = class {
9237
10133
  * @returns A randomly generated mnemonic
9238
10134
  */
9239
10135
  static generate(size = 32, extraEntropy = "") {
9240
- const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils35.concat)([(0, import_crypto5.randomBytes)(size), (0, import_utils35.arrayify)(extraEntropy)])) : (0, import_crypto5.randomBytes)(size);
10136
+ const entropy = extraEntropy ? (0, import_hasher6.sha256)((0, import_utils39.concat)([(0, import_crypto5.randomBytes)(size), (0, import_utils39.arrayify)(extraEntropy)])) : (0, import_crypto5.randomBytes)(size);
9241
10137
  return Mnemonic.entropyToMnemonic(entropy);
9242
10138
  }
9243
10139
  };
@@ -9245,12 +10141,12 @@ var mnemonic_default = Mnemonic;
9245
10141
 
9246
10142
  // src/hdwallet/hdwallet.ts
9247
10143
  var HARDENED_INDEX = 2147483648;
9248
- var MainnetPRV2 = (0, import_utils37.hexlify)("0x0488ade4");
9249
- var MainnetPUB = (0, import_utils37.hexlify)("0x0488b21e");
9250
- var TestnetPRV2 = (0, import_utils37.hexlify)("0x04358394");
9251
- var TestnetPUB = (0, import_utils37.hexlify)("0x043587cf");
10144
+ var MainnetPRV2 = (0, import_utils41.hexlify)("0x0488ade4");
10145
+ var MainnetPUB = (0, import_utils41.hexlify)("0x0488b21e");
10146
+ var TestnetPRV2 = (0, import_utils41.hexlify)("0x04358394");
10147
+ var TestnetPUB = (0, import_utils41.hexlify)("0x043587cf");
9252
10148
  function base58check(data) {
9253
- return (0, import_utils37.encodeBase58)((0, import_utils37.concat)([data, (0, import_utils37.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
10149
+ return (0, import_utils41.encodeBase58)((0, import_utils41.concat)([data, (0, import_utils41.dataSlice)((0, import_hasher7.sha256)((0, import_hasher7.sha256)(data)), 0, 4)]));
9254
10150
  }
9255
10151
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
9256
10152
  if (isPublic) {
@@ -9259,17 +10155,17 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
9259
10155
  return testnet ? TestnetPRV2 : MainnetPRV2;
9260
10156
  }
9261
10157
  function isPublicExtendedKey(extendedKey) {
9262
- return [MainnetPUB, TestnetPUB].includes((0, import_utils37.hexlify)(extendedKey.slice(0, 4)));
10158
+ return [MainnetPUB, TestnetPUB].includes((0, import_utils41.hexlify)(extendedKey.slice(0, 4)));
9263
10159
  }
9264
10160
  function isValidExtendedKey(extendedKey) {
9265
10161
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
9266
- (0, import_utils37.hexlify)(extendedKey.slice(0, 4))
10162
+ (0, import_utils41.hexlify)(extendedKey.slice(0, 4))
9267
10163
  );
9268
10164
  }
9269
10165
  function parsePath(path, depth = 0) {
9270
10166
  const components = path.split("/");
9271
10167
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
9272
- throw new import_errors22.FuelError(import_errors22.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path}`);
10168
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path}`);
9273
10169
  }
9274
10170
  if (components[0] === "m") {
9275
10171
  components.shift();
@@ -9281,8 +10177,8 @@ function parsePath(path, depth = 0) {
9281
10177
  var HDWallet = class {
9282
10178
  depth = 0;
9283
10179
  index = 0;
9284
- fingerprint = (0, import_utils37.hexlify)("0x00000000");
9285
- parentFingerprint = (0, import_utils37.hexlify)("0x00000000");
10180
+ fingerprint = (0, import_utils41.hexlify)("0x00000000");
10181
+ parentFingerprint = (0, import_utils41.hexlify)("0x00000000");
9286
10182
  privateKey;
9287
10183
  publicKey;
9288
10184
  chainCode;
@@ -9294,19 +10190,19 @@ var HDWallet = class {
9294
10190
  constructor(config) {
9295
10191
  if (config.privateKey) {
9296
10192
  const signer = new Signer(config.privateKey);
9297
- this.publicKey = (0, import_utils37.hexlify)(signer.compressedPublicKey);
9298
- this.privateKey = (0, import_utils37.hexlify)(config.privateKey);
10193
+ this.publicKey = (0, import_utils41.hexlify)(signer.compressedPublicKey);
10194
+ this.privateKey = (0, import_utils41.hexlify)(config.privateKey);
9299
10195
  } else {
9300
10196
  if (!config.publicKey) {
9301
- throw new import_errors22.FuelError(
9302
- import_errors22.ErrorCode.HD_WALLET_ERROR,
10197
+ throw new import_errors23.FuelError(
10198
+ import_errors23.ErrorCode.HD_WALLET_ERROR,
9303
10199
  "Both public and private Key cannot be missing. At least one should be provided."
9304
10200
  );
9305
10201
  }
9306
- this.publicKey = (0, import_utils37.hexlify)(config.publicKey);
10202
+ this.publicKey = (0, import_utils41.hexlify)(config.publicKey);
9307
10203
  }
9308
10204
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
9309
- this.fingerprint = (0, import_utils37.dataSlice)((0, import_crypto6.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
10205
+ this.fingerprint = (0, import_utils41.dataSlice)((0, import_crypto6.ripemd160)((0, import_hasher7.sha256)(this.publicKey)), 0, 4);
9310
10206
  this.depth = config.depth || this.depth;
9311
10207
  this.index = config.index || this.index;
9312
10208
  this.chainCode = config.chainCode;
@@ -9322,23 +10218,23 @@ var HDWallet = class {
9322
10218
  * @returns A new instance of HDWallet on the derived index
9323
10219
  */
9324
10220
  deriveIndex(index) {
9325
- const privateKey = this.privateKey && (0, import_utils37.arrayify)(this.privateKey);
9326
- const publicKey = (0, import_utils37.arrayify)(this.publicKey);
9327
- const chainCode = (0, import_utils37.arrayify)(this.chainCode);
10221
+ const privateKey = this.privateKey && (0, import_utils41.arrayify)(this.privateKey);
10222
+ const publicKey = (0, import_utils41.arrayify)(this.publicKey);
10223
+ const chainCode = (0, import_utils41.arrayify)(this.chainCode);
9328
10224
  const data = new Uint8Array(37);
9329
10225
  if (index & HARDENED_INDEX) {
9330
10226
  if (!privateKey) {
9331
- throw new import_errors22.FuelError(
9332
- import_errors22.ErrorCode.HD_WALLET_ERROR,
10227
+ throw new import_errors23.FuelError(
10228
+ import_errors23.ErrorCode.HD_WALLET_ERROR,
9333
10229
  "Cannot derive a hardened index without a private Key."
9334
10230
  );
9335
10231
  }
9336
10232
  data.set(privateKey, 1);
9337
10233
  } else {
9338
- data.set((0, import_utils37.arrayify)(this.publicKey));
10234
+ data.set((0, import_utils41.arrayify)(this.publicKey));
9339
10235
  }
9340
10236
  data.set((0, import_math23.toBytes)(index, 4), 33);
9341
- const bytes = (0, import_utils37.arrayify)((0, import_crypto6.computeHmac)("sha512", chainCode, data));
10237
+ const bytes = (0, import_utils41.arrayify)((0, import_crypto6.computeHmac)("sha512", chainCode, data));
9342
10238
  const IL = bytes.slice(0, 32);
9343
10239
  const IR = bytes.slice(32);
9344
10240
  if (privateKey) {
@@ -9352,7 +10248,7 @@ var HDWallet = class {
9352
10248
  parentFingerprint: this.fingerprint
9353
10249
  });
9354
10250
  }
9355
- const signer = new Signer((0, import_utils37.hexlify)(IL));
10251
+ const signer = new Signer((0, import_utils41.hexlify)(IL));
9356
10252
  const Ki = signer.addPoint(publicKey);
9357
10253
  return new HDWallet({
9358
10254
  publicKey: Ki,
@@ -9381,18 +10277,18 @@ var HDWallet = class {
9381
10277
  */
9382
10278
  toExtendedKey(isPublic = false, testnet = false) {
9383
10279
  if (this.depth >= 256) {
9384
- throw new import_errors22.FuelError(
9385
- import_errors22.ErrorCode.HD_WALLET_ERROR,
10280
+ throw new import_errors23.FuelError(
10281
+ import_errors23.ErrorCode.HD_WALLET_ERROR,
9386
10282
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
9387
10283
  );
9388
10284
  }
9389
10285
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
9390
- const depth = (0, import_utils37.hexlify)(Uint8Array.from([this.depth]));
10286
+ const depth = (0, import_utils41.hexlify)(Uint8Array.from([this.depth]));
9391
10287
  const parentFingerprint = this.parentFingerprint;
9392
10288
  const index = (0, import_math23.toHex)(this.index, 4);
9393
10289
  const chainCode = this.chainCode;
9394
- const key = this.privateKey != null && !isPublic ? (0, import_utils37.concat)(["0x00", this.privateKey]) : this.publicKey;
9395
- const extendedKey = (0, import_utils37.arrayify)((0, import_utils37.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
10290
+ const key = this.privateKey != null && !isPublic ? (0, import_utils41.concat)(["0x00", this.privateKey]) : this.publicKey;
10291
+ const extendedKey = (0, import_utils41.arrayify)((0, import_utils41.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
9396
10292
  return base58check(extendedKey);
9397
10293
  }
9398
10294
  /**
@@ -9404,34 +10300,34 @@ var HDWallet = class {
9404
10300
  static fromSeed(seed) {
9405
10301
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
9406
10302
  return new HDWallet({
9407
- chainCode: (0, import_utils37.arrayify)(masterKey.slice(32)),
9408
- privateKey: (0, import_utils37.arrayify)(masterKey.slice(0, 32))
10303
+ chainCode: (0, import_utils41.arrayify)(masterKey.slice(32)),
10304
+ privateKey: (0, import_utils41.arrayify)(masterKey.slice(0, 32))
9409
10305
  });
9410
10306
  }
9411
10307
  static fromExtendedKey(extendedKey) {
9412
- const decoded = (0, import_utils37.hexlify)((0, import_math23.toBytes)((0, import_utils37.decodeBase58)(extendedKey)));
9413
- const bytes = (0, import_utils37.arrayify)(decoded);
10308
+ const decoded = (0, import_utils41.hexlify)((0, import_math23.toBytes)((0, import_utils41.decodeBase58)(extendedKey)));
10309
+ const bytes = (0, import_utils41.arrayify)(decoded);
9414
10310
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
9415
10311
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
9416
- throw new import_errors22.FuelError(import_errors22.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
10312
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
9417
10313
  }
9418
10314
  if (!validChecksum) {
9419
- throw new import_errors22.FuelError(import_errors22.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
10315
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
9420
10316
  }
9421
10317
  const depth = bytes[4];
9422
- const parentFingerprint = (0, import_utils37.hexlify)(bytes.slice(5, 9));
9423
- const index = parseInt((0, import_utils37.hexlify)(bytes.slice(9, 13)).substring(2), 16);
9424
- const chainCode = (0, import_utils37.hexlify)(bytes.slice(13, 45));
10318
+ const parentFingerprint = (0, import_utils41.hexlify)(bytes.slice(5, 9));
10319
+ const index = parseInt((0, import_utils41.hexlify)(bytes.slice(9, 13)).substring(2), 16);
10320
+ const chainCode = (0, import_utils41.hexlify)(bytes.slice(13, 45));
9425
10321
  const key = bytes.slice(45, 78);
9426
10322
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
9427
- throw new import_errors22.FuelError(
9428
- import_errors22.ErrorCode.HD_WALLET_ERROR,
10323
+ throw new import_errors23.FuelError(
10324
+ import_errors23.ErrorCode.HD_WALLET_ERROR,
9429
10325
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
9430
10326
  );
9431
10327
  }
9432
10328
  if (isPublicExtendedKey(bytes)) {
9433
10329
  if (key[0] !== 3) {
9434
- throw new import_errors22.FuelError(import_errors22.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
10330
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
9435
10331
  }
9436
10332
  return new HDWallet({
9437
10333
  publicKey: key,
@@ -9442,7 +10338,7 @@ var HDWallet = class {
9442
10338
  });
9443
10339
  }
9444
10340
  if (key[0] !== 0) {
9445
- throw new import_errors22.FuelError(import_errors22.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
10341
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
9446
10342
  }
9447
10343
  return new HDWallet({
9448
10344
  privateKey: key.slice(1),
@@ -9610,7 +10506,7 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
9610
10506
  // src/wallet-manager/wallet-manager.ts
9611
10507
  var import_address9 = require("@fuel-ts/address");
9612
10508
  var import_crypto7 = require("@fuel-ts/crypto");
9613
- var import_errors25 = require("@fuel-ts/errors");
10509
+ var import_errors26 = require("@fuel-ts/errors");
9614
10510
  var import_events = require("events");
9615
10511
 
9616
10512
  // src/wallet-manager/storages/memory-storage.ts
@@ -9633,7 +10529,7 @@ var MemoryStorage = class {
9633
10529
 
9634
10530
  // src/wallet-manager/vaults/mnemonic-vault.ts
9635
10531
  var import_address7 = require("@fuel-ts/address");
9636
- var import_errors23 = require("@fuel-ts/errors");
10532
+ var import_errors24 = require("@fuel-ts/errors");
9637
10533
  var _secret;
9638
10534
  var MnemonicVault = class {
9639
10535
  constructor(options) {
@@ -9689,8 +10585,8 @@ var MnemonicVault = class {
9689
10585
  }
9690
10586
  numberOfAccounts += 1;
9691
10587
  } while (numberOfAccounts < this.numberOfAccounts);
9692
- throw new import_errors23.FuelError(
9693
- import_errors23.ErrorCode.WALLET_MANAGER_ERROR,
10588
+ throw new import_errors24.FuelError(
10589
+ import_errors24.ErrorCode.WALLET_MANAGER_ERROR,
9694
10590
  `Account with address '${address}' not found in derived wallets.`
9695
10591
  );
9696
10592
  }
@@ -9704,7 +10600,7 @@ __publicField(MnemonicVault, "type", "mnemonic");
9704
10600
 
9705
10601
  // src/wallet-manager/vaults/privatekey-vault.ts
9706
10602
  var import_address8 = require("@fuel-ts/address");
9707
- var import_errors24 = require("@fuel-ts/errors");
10603
+ var import_errors25 = require("@fuel-ts/errors");
9708
10604
  var _privateKeys;
9709
10605
  var PrivateKeyVault = class {
9710
10606
  /**
@@ -9745,8 +10641,8 @@ var PrivateKeyVault = class {
9745
10641
  (pk) => Wallet.fromPrivateKey(pk).address.equals(ownerAddress)
9746
10642
  );
9747
10643
  if (!privateKey) {
9748
- throw new import_errors24.FuelError(
9749
- import_errors24.ErrorCode.WALLET_MANAGER_ERROR,
10644
+ throw new import_errors25.FuelError(
10645
+ import_errors25.ErrorCode.WALLET_MANAGER_ERROR,
9750
10646
  `No private key found for address '${address}'.`
9751
10647
  );
9752
10648
  }
@@ -9770,7 +10666,7 @@ var ERROR_MESSAGES = {
9770
10666
  };
9771
10667
  function assert(condition, message) {
9772
10668
  if (!condition) {
9773
- throw new import_errors25.FuelError(import_errors25.ErrorCode.WALLET_MANAGER_ERROR, message);
10669
+ throw new import_errors26.FuelError(import_errors26.ErrorCode.WALLET_MANAGER_ERROR, message);
9774
10670
  }
9775
10671
  }
9776
10672
  var _vaults, _passphrase, _isLocked, _serializeVaults, serializeVaults_fn, _deserializeVaults, deserializeVaults_fn;
@@ -9996,25 +10892,25 @@ deserializeVaults_fn = function(vaults) {
9996
10892
  __publicField(WalletManager, "Vaults", [MnemonicVault, PrivateKeyVault]);
9997
10893
 
9998
10894
  // src/wallet-manager/types.ts
9999
- var import_errors26 = require("@fuel-ts/errors");
10895
+ var import_errors27 = require("@fuel-ts/errors");
10000
10896
  var Vault = class {
10001
10897
  constructor(_options) {
10002
- throw new import_errors26.FuelError(import_errors26.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10898
+ throw new import_errors27.FuelError(import_errors27.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10003
10899
  }
10004
10900
  serialize() {
10005
- throw new import_errors26.FuelError(import_errors26.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10901
+ throw new import_errors27.FuelError(import_errors27.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10006
10902
  }
10007
10903
  getAccounts() {
10008
- throw new import_errors26.FuelError(import_errors26.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10904
+ throw new import_errors27.FuelError(import_errors27.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10009
10905
  }
10010
10906
  addAccount() {
10011
- throw new import_errors26.FuelError(import_errors26.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10907
+ throw new import_errors27.FuelError(import_errors27.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10012
10908
  }
10013
10909
  exportAccount(_address) {
10014
- throw new import_errors26.FuelError(import_errors26.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10910
+ throw new import_errors27.FuelError(import_errors27.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10015
10911
  }
10016
10912
  getWallet(_address) {
10017
- throw new import_errors26.FuelError(import_errors26.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10913
+ throw new import_errors27.FuelError(import_errors27.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
10018
10914
  }
10019
10915
  };
10020
10916
  __publicField(Vault, "type");
@@ -10024,19 +10920,19 @@ var StorageAbstract = class {
10024
10920
  // src/predicate/predicate.ts
10025
10921
  var import_abi_coder8 = require("@fuel-ts/abi-coder");
10026
10922
  var import_address10 = require("@fuel-ts/address");
10027
- var import_errors27 = require("@fuel-ts/errors");
10028
- var import_utils39 = require("@fuel-ts/utils");
10923
+ var import_errors28 = require("@fuel-ts/errors");
10924
+ var import_utils43 = require("@fuel-ts/utils");
10029
10925
 
10030
10926
  // src/predicate/utils/getPredicateRoot.ts
10031
- var import_hasher7 = require("@fuel-ts/hasher");
10927
+ var import_hasher8 = require("@fuel-ts/hasher");
10032
10928
  var import_merkle = require("@fuel-ts/merkle");
10033
- var import_utils38 = require("@fuel-ts/utils");
10929
+ var import_utils42 = require("@fuel-ts/utils");
10034
10930
  var getPredicateRoot = (bytecode) => {
10035
10931
  const chunkSize = 16 * 1024;
10036
- const bytes = (0, import_utils38.arrayify)(bytecode);
10037
- const chunks = (0, import_utils38.chunkAndPadBytes)(bytes, chunkSize);
10038
- const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0, import_utils38.hexlify)(c)));
10039
- const predicateRoot = (0, import_hasher7.hash)((0, import_utils38.concat)(["0x4655454C", codeRoot]));
10932
+ const bytes = (0, import_utils42.arrayify)(bytecode);
10933
+ const chunks = (0, import_utils42.chunkAndPadBytes)(bytes, chunkSize);
10934
+ const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0, import_utils42.hexlify)(c)));
10935
+ const predicateRoot = (0, import_hasher8.hash)((0, import_utils42.concat)(["0x4655454C", codeRoot]));
10040
10936
  return predicateRoot;
10041
10937
  };
10042
10938
 
@@ -10088,8 +10984,8 @@ var Predicate = class extends Account {
10088
10984
  }
10089
10985
  request.inputs.filter(isRequestInputCoinOrMessage).forEach((input) => {
10090
10986
  if (isRequestInputResourceFromOwner(input, this.address)) {
10091
- input.predicate = (0, import_utils39.hexlify)(this.bytes);
10092
- input.predicateData = (0, import_utils39.hexlify)(this.getPredicateData());
10987
+ input.predicate = (0, import_utils43.hexlify)(this.bytes);
10988
+ input.predicateData = (0, import_utils43.hexlify)(this.getPredicateData());
10093
10989
  input.witnessIndex = 0;
10094
10990
  }
10095
10991
  });
@@ -10131,13 +11027,13 @@ var Predicate = class extends Account {
10131
11027
  * @returns An object containing the new predicate bytes and interface.
10132
11028
  */
10133
11029
  static processPredicateData(bytes, jsonAbi, configurableConstants) {
10134
- let predicateBytes = (0, import_utils39.arrayify)(bytes);
11030
+ let predicateBytes = (0, import_utils43.arrayify)(bytes);
10135
11031
  let abiInterface;
10136
11032
  if (jsonAbi) {
10137
11033
  abiInterface = new import_abi_coder8.Interface(jsonAbi);
10138
11034
  if (abiInterface.functions.main === void 0) {
10139
- throw new import_errors27.FuelError(
10140
- import_errors27.ErrorCode.ABI_MAIN_METHOD_MISSING,
11035
+ throw new import_errors28.FuelError(
11036
+ import_errors28.ErrorCode.ABI_MAIN_METHOD_MISSING,
10141
11037
  'Cannot use ABI without "main" function.'
10142
11038
  );
10143
11039
  }
@@ -10169,8 +11065,8 @@ var Predicate = class extends Account {
10169
11065
  );
10170
11066
  return resources.map((resource) => ({
10171
11067
  ...resource,
10172
- predicate: (0, import_utils39.hexlify)(this.bytes),
10173
- predicateData: (0, import_utils39.hexlify)(this.getPredicateData())
11068
+ predicate: (0, import_utils43.hexlify)(this.bytes),
11069
+ predicateData: (0, import_utils43.hexlify)(this.getPredicateData())
10174
11070
  }));
10175
11071
  }
10176
11072
  /**
@@ -10182,8 +11078,8 @@ var Predicate = class extends Account {
10182
11078
  generateFakeResources(coins) {
10183
11079
  return super.generateFakeResources(coins).map((coin) => ({
10184
11080
  ...coin,
10185
- predicate: (0, import_utils39.hexlify)(this.bytes),
10186
- predicateData: (0, import_utils39.hexlify)(this.getPredicateData())
11081
+ predicate: (0, import_utils43.hexlify)(this.bytes),
11082
+ predicateData: (0, import_utils43.hexlify)(this.getPredicateData())
10187
11083
  }));
10188
11084
  }
10189
11085
  /**
@@ -10198,21 +11094,21 @@ var Predicate = class extends Account {
10198
11094
  const mutatedBytes = bytes;
10199
11095
  try {
10200
11096
  if (!abiInterface) {
10201
- throw new import_errors27.FuelError(
10202
- import_errors27.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
11097
+ throw new import_errors28.FuelError(
11098
+ import_errors28.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
10203
11099
  "Cannot validate configurable constants because the Predicate was instantiated without a JSON ABI"
10204
11100
  );
10205
11101
  }
10206
11102
  if (Object.keys(abiInterface.configurables).length === 0) {
10207
- throw new import_errors27.FuelError(
10208
- import_errors27.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
11103
+ throw new import_errors28.FuelError(
11104
+ import_errors28.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
10209
11105
  "Predicate has no configurable constants to be set"
10210
11106
  );
10211
11107
  }
10212
11108
  Object.entries(configurableConstants).forEach(([key, value]) => {
10213
11109
  if (!abiInterface?.configurables[key]) {
10214
- throw new import_errors27.FuelError(
10215
- import_errors27.ErrorCode.CONFIGURABLE_NOT_FOUND,
11110
+ throw new import_errors28.FuelError(
11111
+ import_errors28.ErrorCode.CONFIGURABLE_NOT_FOUND,
10216
11112
  `No configurable constant named '${key}' found in the Predicate`
10217
11113
  );
10218
11114
  }
@@ -10221,8 +11117,8 @@ var Predicate = class extends Account {
10221
11117
  mutatedBytes.set(encoded, offset);
10222
11118
  });
10223
11119
  } catch (err) {
10224
- throw new import_errors27.FuelError(
10225
- import_errors27.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
11120
+ throw new import_errors28.FuelError(
11121
+ import_errors28.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
10226
11122
  `Error setting configurable constants: ${err.message}.`
10227
11123
  );
10228
11124
  }
@@ -10253,10 +11149,10 @@ var Predicate = class extends Account {
10253
11149
  };
10254
11150
 
10255
11151
  // src/connectors/fuel.ts
10256
- var import_errors30 = require("@fuel-ts/errors");
11152
+ var import_errors31 = require("@fuel-ts/errors");
10257
11153
 
10258
11154
  // src/connectors/fuel-connector.ts
10259
- var import_errors28 = require("@fuel-ts/errors");
11155
+ var import_errors29 = require("@fuel-ts/errors");
10260
11156
  var import_events2 = require("events");
10261
11157
 
10262
11158
  // src/connectors/types/connector-types.ts
@@ -10330,7 +11226,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10330
11226
  * @returns Always true.
10331
11227
  */
10332
11228
  async ping() {
10333
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11229
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10334
11230
  }
10335
11231
  /**
10336
11232
  * Should return the current version of the connector
@@ -10339,7 +11235,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10339
11235
  * @returns boolean - connection status.
10340
11236
  */
10341
11237
  async version() {
10342
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11238
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10343
11239
  }
10344
11240
  /**
10345
11241
  * Should return true if the connector is connected
@@ -10348,7 +11244,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10348
11244
  * @returns The connection status.
10349
11245
  */
10350
11246
  async isConnected() {
10351
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11247
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10352
11248
  }
10353
11249
  /**
10354
11250
  * Should return all the accounts authorized for the
@@ -10357,7 +11253,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10357
11253
  * @returns The accounts addresses strings
10358
11254
  */
10359
11255
  async accounts() {
10360
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11256
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10361
11257
  }
10362
11258
  /**
10363
11259
  * Should start the connection process and return
@@ -10369,7 +11265,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10369
11265
  * @returns boolean - connection status.
10370
11266
  */
10371
11267
  async connect() {
10372
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11268
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10373
11269
  }
10374
11270
  /**
10375
11271
  * Should disconnect the current connection and
@@ -10379,7 +11275,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10379
11275
  * @returns The connection status.
10380
11276
  */
10381
11277
  async disconnect() {
10382
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11278
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10383
11279
  }
10384
11280
  /**
10385
11281
  * Should start the sign message process and return
@@ -10391,7 +11287,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10391
11287
  * @returns Message signature
10392
11288
  */
10393
11289
  async signMessage(_address, _message) {
10394
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11290
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10395
11291
  }
10396
11292
  /**
10397
11293
  * Should start the sign transaction process and return
@@ -10403,7 +11299,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10403
11299
  * @returns Transaction signature
10404
11300
  */
10405
11301
  async signTransaction(_address, _transaction) {
10406
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11302
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10407
11303
  }
10408
11304
  /**
10409
11305
  * Should start the send transaction process and return
@@ -10419,7 +11315,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10419
11315
  * @returns The transaction id
10420
11316
  */
10421
11317
  async sendTransaction(_address, _transaction) {
10422
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11318
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10423
11319
  }
10424
11320
  /**
10425
11321
  * Should return the current account selected inside the connector, if the account
@@ -10430,7 +11326,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10430
11326
  * @returns The current account selected otherwise null.
10431
11327
  */
10432
11328
  async currentAccount() {
10433
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11329
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10434
11330
  }
10435
11331
  /**
10436
11332
  * Should add the assets metadata to the connector and return true if the asset
@@ -10444,7 +11340,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10444
11340
  * @returns True if the asset was added successfully
10445
11341
  */
10446
11342
  async addAssets(_assets) {
10447
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11343
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10448
11344
  }
10449
11345
  /**
10450
11346
  * Should add the asset metadata to the connector and return true if the asset
@@ -10458,7 +11354,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10458
11354
  * @returns True if the asset was added successfully
10459
11355
  */
10460
11356
  async addAsset(_asset) {
10461
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11357
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10462
11358
  }
10463
11359
  /**
10464
11360
  * Should return all the assets added to the connector. If a connection is already established.
@@ -10466,7 +11362,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10466
11362
  * @returns Array of assets metadata from the connector vinculated to the all accounts from a specific Wallet.
10467
11363
  */
10468
11364
  async assets() {
10469
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11365
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10470
11366
  }
10471
11367
  /**
10472
11368
  * Should start the add network process and return true if the network was added successfully.
@@ -10477,7 +11373,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10477
11373
  * @returns Return true if the network was added successfully
10478
11374
  */
10479
11375
  async addNetwork(_networkUrl) {
10480
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11376
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10481
11377
  }
10482
11378
  /**
10483
11379
  * Should start the select network process and return true if the network has change successfully.
@@ -10488,7 +11384,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10488
11384
  * @returns Return true if the network was added successfully
10489
11385
  */
10490
11386
  async selectNetwork(_network) {
10491
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11387
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10492
11388
  }
10493
11389
  /**
10494
11390
  * Should return all the networks available from the connector. If the connection is already established.
@@ -10496,7 +11392,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10496
11392
  * @returns Return all the networks added to the connector.
10497
11393
  */
10498
11394
  async networks() {
10499
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11395
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10500
11396
  }
10501
11397
  /**
10502
11398
  * Should return the current network selected inside the connector. Even if the connection is not established.
@@ -10504,7 +11400,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10504
11400
  * @returns Return the current network selected inside the connector.
10505
11401
  */
10506
11402
  async currentNetwork() {
10507
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11403
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10508
11404
  }
10509
11405
  /**
10510
11406
  * Should add the ABI to the connector and return true if the ABI was added successfully.
@@ -10514,7 +11410,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10514
11410
  * @returns Return true if the ABI was added successfully.
10515
11411
  */
10516
11412
  async addABI(_contractId, _abi) {
10517
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11413
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10518
11414
  }
10519
11415
  /**
10520
11416
  * Should return the ABI from the connector vinculated to the all accounts from a specific Wallet.
@@ -10523,7 +11419,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10523
11419
  * @returns The ABI if it exists, otherwise return null.
10524
11420
  */
10525
11421
  async getABI(_id) {
10526
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11422
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10527
11423
  }
10528
11424
  /**
10529
11425
  * Should return true if the abi exists in the connector vinculated to the all accounts from a specific Wallet.
@@ -10532,7 +11428,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
10532
11428
  * @returns Returns true if the abi exists or false if not.
10533
11429
  */
10534
11430
  async hasABI(_id) {
10535
- throw new import_errors28.FuelError(import_errors28.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11431
+ throw new import_errors29.FuelError(import_errors29.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10536
11432
  }
10537
11433
  /**
10538
11434
  * Event listener for the connector.
@@ -10576,7 +11472,7 @@ function dispatchFuelConnectorEvent(connector) {
10576
11472
  }
10577
11473
 
10578
11474
  // src/connectors/utils/promises.ts
10579
- var import_errors29 = require("@fuel-ts/errors");
11475
+ var import_errors30 = require("@fuel-ts/errors");
10580
11476
  function deferPromise() {
10581
11477
  const defer = {};
10582
11478
  defer.promise = new Promise((resolve, reject) => {
@@ -10588,7 +11484,7 @@ function deferPromise() {
10588
11484
  async function withTimeout(promise, timeout = 1050) {
10589
11485
  const timeoutPromise = new Promise((resolve, reject) => {
10590
11486
  setTimeout(() => {
10591
- reject(new import_errors29.FuelError(import_errors29.FuelError.CODES.TIMEOUT_EXCEEDED, "Promise timed out"));
11487
+ reject(new import_errors30.FuelError(import_errors30.FuelError.CODES.TIMEOUT_EXCEEDED, "Promise timed out"));
10592
11488
  }, timeout);
10593
11489
  });
10594
11490
  return Promise.race([timeoutPromise, promise]);
@@ -10622,7 +11518,7 @@ var _Fuel = class extends FuelConnector {
10622
11518
  await this.setDefaultConnector();
10623
11519
  this._targetUnsubscribe = this.setupConnectorListener();
10624
11520
  } catch (error) {
10625
- throw new import_errors30.FuelError(import_errors30.ErrorCode.INVALID_PROVIDER, "Error initializing Fuel Connector");
11521
+ throw new import_errors31.FuelError(import_errors31.ErrorCode.INVALID_PROVIDER, "Error initializing Fuel Connector");
10626
11522
  }
10627
11523
  }
10628
11524
  async init() {
@@ -10688,8 +11584,8 @@ var _Fuel = class extends FuelConnector {
10688
11584
  const hasConnector = await this.hasConnector();
10689
11585
  await this.pingConnector();
10690
11586
  if (!this._currentConnector || !hasConnector) {
10691
- throw new import_errors30.FuelError(
10692
- import_errors30.ErrorCode.MISSING_CONNECTOR,
11587
+ throw new import_errors31.FuelError(
11588
+ import_errors31.ErrorCode.MISSING_CONNECTOR,
10693
11589
  `No connector selected for calling ${method}. Use hasConnector before executing other methods.`
10694
11590
  );
10695
11591
  }
@@ -10753,7 +11649,7 @@ var _Fuel = class extends FuelConnector {
10753
11649
  cacheTime: PING_CACHE_TIME
10754
11650
  })();
10755
11651
  } catch {
10756
- throw new import_errors30.FuelError(import_errors30.ErrorCode.INVALID_PROVIDER, "Current connector is not available.");
11652
+ throw new import_errors31.FuelError(import_errors31.ErrorCode.INVALID_PROVIDER, "Current connector is not available.");
10757
11653
  }
10758
11654
  }
10759
11655
  /**
@@ -10902,7 +11798,7 @@ var _Fuel = class extends FuelConnector {
10902
11798
  const currentNetwork = await this.currentNetwork();
10903
11799
  provider = await Provider.create(currentNetwork.url);
10904
11800
  } else {
10905
- throw new import_errors30.FuelError(import_errors30.ErrorCode.INVALID_PROVIDER, "Provider is not valid.");
11801
+ throw new import_errors31.FuelError(import_errors31.ErrorCode.INVALID_PROVIDER, "Provider is not valid.");
10906
11802
  }
10907
11803
  return provider;
10908
11804
  }
@@ -10979,6 +11875,8 @@ __publicField(Fuel, "defaultConfig", {});
10979
11875
  TransactionStatus,
10980
11876
  TransactionType,
10981
11877
  TransactionTypeName,
11878
+ UpgradeTransactionRequest,
11879
+ UploadTransactionRequest,
10982
11880
  Vault,
10983
11881
  Wallet,
10984
11882
  WalletLocked,
@@ -11000,6 +11898,9 @@ __publicField(Fuel, "defaultConfig", {});
11000
11898
  calculateMetadataGasForTxBlob,
11001
11899
  calculateMetadataGasForTxCreate,
11002
11900
  calculateMetadataGasForTxScript,
11901
+ calculateMetadataGasForTxUpgrade,
11902
+ calculateMetadataGasForTxUpload,
11903
+ calculateMinGasForTxUpload,
11003
11904
  calculateTXFeeForSummary,
11004
11905
  coinQuantityfy,
11005
11906
  deferPromise,
@@ -11070,6 +11971,8 @@ __publicField(Fuel, "defaultConfig", {});
11070
11971
  isTransactionTypeBlob,
11071
11972
  isTransactionTypeCreate,
11072
11973
  isTransactionTypeScript,
11974
+ isTransactionTypeUpgrade,
11975
+ isTransactionTypeUpload,
11073
11976
  isType,
11074
11977
  isTypeBlob,
11075
11978
  isTypeCreate,