@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.mjs CHANGED
@@ -31,12 +31,12 @@ var __privateMethod = (obj, member, method) => {
31
31
  import { UTXO_ID_LEN as UTXO_ID_LEN3 } from "@fuel-ts/abi-coder";
32
32
  import { Address as Address3 } from "@fuel-ts/address";
33
33
  import { randomBytes as randomBytes2 } from "@fuel-ts/crypto";
34
- import { ErrorCode as ErrorCode16, FuelError as FuelError17 } from "@fuel-ts/errors";
34
+ import { ErrorCode as ErrorCode16, FuelError as FuelError18 } from "@fuel-ts/errors";
35
35
  import { AbstractAccount } from "@fuel-ts/interfaces";
36
36
  import { bn as bn19 } from "@fuel-ts/math";
37
37
  import { InputType as InputType8 } from "@fuel-ts/transactions";
38
- import { arrayify as arrayify14, hexlify as hexlify14, isDefined as isDefined3 } from "@fuel-ts/utils";
39
- import { clone as clone7 } from "ramda";
38
+ import { arrayify as arrayify15, hexlify as hexlify16, isDefined as isDefined3 } from "@fuel-ts/utils";
39
+ import { clone as clone9 } from "ramda";
40
40
 
41
41
  // src/providers/coin-quantity.ts
42
42
  import { bn } from "@fuel-ts/math";
@@ -75,15 +75,15 @@ var addAmountToCoinQuantities = (params) => {
75
75
 
76
76
  // src/providers/provider.ts
77
77
  import { Address as Address2 } from "@fuel-ts/address";
78
- import { ErrorCode as ErrorCode14, FuelError as FuelError15 } from "@fuel-ts/errors";
78
+ import { ErrorCode as ErrorCode14, FuelError as FuelError16 } from "@fuel-ts/errors";
79
79
  import { BN as BN2, bn as bn17 } from "@fuel-ts/math";
80
80
  import { InputType as InputType7, InputMessageCoder as InputMessageCoder2, TransactionCoder as TransactionCoder5 } from "@fuel-ts/transactions";
81
- import { arrayify as arrayify11, hexlify as hexlify13, DateTime as DateTime2, isDefined as isDefined2 } from "@fuel-ts/utils";
81
+ import { arrayify as arrayify12, hexlify as hexlify15, DateTime as DateTime2, isDefined as isDefined2 } from "@fuel-ts/utils";
82
82
  import { checkFuelCoreVersionCompatibility } from "@fuel-ts/versions";
83
83
  import { equalBytes } from "@noble/curves/abstract/utils";
84
84
  import { GraphQLClient } from "graphql-request";
85
85
  import gql2 from "graphql-tag";
86
- import { clone as clone6 } from "ramda";
86
+ import { clone as clone8 } from "ramda";
87
87
 
88
88
  // src/providers/__generated__/operations.ts
89
89
  import gql from "graphql-tag";
@@ -1645,7 +1645,7 @@ function assembleReceiptByType(receipt) {
1645
1645
 
1646
1646
  // src/providers/utils/block-explorer.ts
1647
1647
  import { ErrorCode as ErrorCode6, FuelError as FuelError6 } from "@fuel-ts/errors";
1648
- var DEFAULT_BLOCK_EXPLORER_URL = "https://fuellabs.github.io/block-explorer-v2";
1648
+ var DEFAULT_BLOCK_EXPLORER_URL = "https://app.fuel.network";
1649
1649
  var getPathFromInput = (key, value) => {
1650
1650
  const pathMap = {
1651
1651
  address: `address`,
@@ -1805,6 +1805,39 @@ function calculateMetadataGasForTxBlob({
1805
1805
  const blobLen = resolveGasDependentCosts(witnessBytesSize, gasCosts.s256);
1806
1806
  return txId.add(blobLen);
1807
1807
  }
1808
+ function calculateMetadataGasForTxUpgrade({
1809
+ gasCosts,
1810
+ txBytesSize,
1811
+ consensusSize
1812
+ }) {
1813
+ const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
1814
+ if (consensusSize) {
1815
+ const consensusLen = resolveGasDependentCosts(consensusSize, gasCosts.s256);
1816
+ txId.add(consensusLen);
1817
+ }
1818
+ return txId;
1819
+ }
1820
+ function calculateMetadataGasForTxUpload({
1821
+ gasCosts,
1822
+ txBytesSize,
1823
+ subsectionSize,
1824
+ subsectionsSize
1825
+ }) {
1826
+ const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
1827
+ const subsectionLen = resolveGasDependentCosts(subsectionSize, gasCosts.s256);
1828
+ txId.add(subsectionLen);
1829
+ const subsectionsLen = resolveGasDependentCosts(subsectionsSize, gasCosts.stateRoot);
1830
+ txId.add(subsectionsLen);
1831
+ return txId;
1832
+ }
1833
+ function calculateMinGasForTxUpload({
1834
+ gasCosts,
1835
+ baseMinGas,
1836
+ subsectionSize
1837
+ }) {
1838
+ const additionalStoragePerByte = bn5(gasCosts.newStoragePerByte).mul(subsectionSize);
1839
+ return bn5(baseMinGas).add(additionalStoragePerByte);
1840
+ }
1808
1841
  var calculateGasFee = (params) => {
1809
1842
  const { gas, gasPrice, priceFactor, tip } = params;
1810
1843
  return gas.mul(gasPrice).div(priceFactor).add(bn5(tip));
@@ -2981,51 +3014,319 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2981
3014
  }
2982
3015
  };
2983
3016
 
3017
+ // src/providers/transaction-request/upgrade-transaction-request.ts
3018
+ import { FuelError as FuelError9 } from "@fuel-ts/errors";
3019
+ import { hash } from "@fuel-ts/hasher";
3020
+ import {
3021
+ TransactionType as TransactionType5,
3022
+ UpgradePurposeTypeEnum
3023
+ } from "@fuel-ts/transactions";
3024
+ import { hexlify as hexlify12 } from "@fuel-ts/utils";
3025
+ import { clone as clone6 } from "ramda";
3026
+ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3027
+ static from(obj) {
3028
+ if (obj instanceof UpgradeTransactionRequest) {
3029
+ return obj;
3030
+ }
3031
+ return new this(clone6(obj));
3032
+ }
3033
+ /** The type of transaction */
3034
+ type = TransactionType5.Upgrade;
3035
+ /** The upgrade purpose */
3036
+ upgradePurpose;
3037
+ /** Witness index of consensus */
3038
+ bytecodeWitnessIndex;
3039
+ /**
3040
+ * Creates an instance `UpgradeTransactionRequest`.
3041
+ *
3042
+ * @param upgradeTransactionRequestLike - The initial values for the instance
3043
+ */
3044
+ constructor({
3045
+ upgradePurpose,
3046
+ bytecodeWitnessIndex,
3047
+ ...rest
3048
+ } = {}) {
3049
+ super(rest);
3050
+ this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
3051
+ this.upgradePurpose = upgradePurpose ?? {
3052
+ type: UpgradePurposeTypeEnum.ConsensusParameters,
3053
+ checksum: "0x"
3054
+ };
3055
+ }
3056
+ /**
3057
+ * Adds a consensus parameters upgrade purpose.
3058
+ *
3059
+ * @param consensus - The consensus bytecode.
3060
+ *
3061
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3062
+ */
3063
+ addConsensusParametersUpgradePurpose(consensus) {
3064
+ this.bytecodeWitnessIndex = this.addWitness(consensus);
3065
+ this.upgradePurpose = {
3066
+ type: UpgradePurposeTypeEnum.ConsensusParameters,
3067
+ checksum: hash(consensus)
3068
+ };
3069
+ return this;
3070
+ }
3071
+ /**
3072
+ * Adds a state transition upgrade purpose.
3073
+ *
3074
+ * @param bytecodeRoot - The Merkle root of the state transition.
3075
+ *
3076
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3077
+ */
3078
+ addStateTransitionUpgradePurpose(bytecodeRoot) {
3079
+ this.upgradePurpose = {
3080
+ type: UpgradePurposeTypeEnum.StateTransition,
3081
+ data: hexlify12(bytecodeRoot)
3082
+ };
3083
+ return this;
3084
+ }
3085
+ /**
3086
+ * Adds an upgrade purpose.
3087
+ *
3088
+ * @param type - The upgrade purpose type.
3089
+ * @param data - The bytecode or merkle root of upgrade purpose
3090
+ *
3091
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3092
+ */
3093
+ addUpgradePurpose(type, data) {
3094
+ if (type === UpgradePurposeTypeEnum.ConsensusParameters) {
3095
+ this.addConsensusParametersUpgradePurpose(data);
3096
+ }
3097
+ if (type === UpgradePurposeTypeEnum.StateTransition) {
3098
+ this.addStateTransitionUpgradePurpose(data);
3099
+ }
3100
+ return this;
3101
+ }
3102
+ /**
3103
+ * Converts the transaction request to a `TransactionUpgrade`.
3104
+ *
3105
+ * @returns The transaction create object.
3106
+ */
3107
+ toTransaction() {
3108
+ let upgradePurpose;
3109
+ if (this.upgradePurpose.type === UpgradePurposeTypeEnum.ConsensusParameters) {
3110
+ upgradePurpose = {
3111
+ type: UpgradePurposeTypeEnum.ConsensusParameters,
3112
+ data: {
3113
+ witnessIndex: this.bytecodeWitnessIndex,
3114
+ checksum: this.upgradePurpose.checksum
3115
+ }
3116
+ };
3117
+ } else if (this.upgradePurpose.type === UpgradePurposeTypeEnum.StateTransition) {
3118
+ upgradePurpose = {
3119
+ type: UpgradePurposeTypeEnum.StateTransition,
3120
+ data: {
3121
+ bytecodeRoot: hexlify12(this.upgradePurpose.data)
3122
+ }
3123
+ };
3124
+ } else {
3125
+ throw new FuelError9(FuelError9.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3126
+ }
3127
+ return {
3128
+ type: TransactionType5.Upgrade,
3129
+ ...super.getBaseTransaction(),
3130
+ upgradePurpose
3131
+ };
3132
+ }
3133
+ /**
3134
+ * Gets the Transaction ID by hashing the transaction
3135
+ *
3136
+ * @param chainId - The chain ID.
3137
+ *
3138
+ * @returns - A hash of the transaction, which is the transaction ID.
3139
+ */
3140
+ getTransactionId(chainId) {
3141
+ return hashTransaction(this, chainId);
3142
+ }
3143
+ /**
3144
+ * Calculates the metadata gas cost for an upgrade transaction.
3145
+ *
3146
+ * @param gasCosts - gas costs passed from the chain.
3147
+ *
3148
+ * @returns metadata gas cost for the upgrade transaction.
3149
+ */
3150
+ metadataGas(gasCosts) {
3151
+ const txBytesSize = this.byteSize();
3152
+ if (this.upgradePurpose.type === UpgradePurposeTypeEnum.ConsensusParameters) {
3153
+ const witnessIndex = this.bytecodeWitnessIndex;
3154
+ const consensusSize = this.witnesses[witnessIndex].length;
3155
+ return calculateMetadataGasForTxUpgrade({
3156
+ gasCosts,
3157
+ txBytesSize,
3158
+ consensusSize
3159
+ });
3160
+ }
3161
+ if (this.upgradePurpose.type === UpgradePurposeTypeEnum.StateTransition) {
3162
+ return calculateMetadataGasForTxUpgrade({
3163
+ gasCosts,
3164
+ txBytesSize
3165
+ });
3166
+ }
3167
+ throw new FuelError9(FuelError9.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3168
+ }
3169
+ };
3170
+
3171
+ // src/providers/transaction-request/upload-transaction-request.ts
3172
+ import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
3173
+ import { TransactionType as TransactionType6 } from "@fuel-ts/transactions";
3174
+ import { arrayify as arrayify9, hexlify as hexlify13 } from "@fuel-ts/utils";
3175
+ import { clone as clone7 } from "ramda";
3176
+ var UploadTransactionRequest = class extends BaseTransactionRequest {
3177
+ static from(obj) {
3178
+ if (obj instanceof UploadTransactionRequest) {
3179
+ return obj;
3180
+ }
3181
+ return new this(clone7(obj));
3182
+ }
3183
+ /** Type of the transaction */
3184
+ type = TransactionType6.Upload;
3185
+ /** The witness index of the subsection of the bytecode. */
3186
+ witnessIndex;
3187
+ /** The subsection data. */
3188
+ subsection;
3189
+ /**
3190
+ * Creates an instance `UploadTransactionRequest`.
3191
+ *
3192
+ * @param uploadTransactionRequestLike - The initial values for the instance
3193
+ */
3194
+ constructor({ witnessIndex, subsection, ...rest } = {}) {
3195
+ super(rest);
3196
+ this.witnessIndex = witnessIndex ?? 0;
3197
+ this.subsection = subsection ?? {
3198
+ proofSet: [],
3199
+ root: ZeroBytes328,
3200
+ subsectionIndex: 0,
3201
+ subsectionsNumber: 0
3202
+ };
3203
+ }
3204
+ /**
3205
+ * Adds the subsection.
3206
+ *
3207
+ * @param subsection - The subsection data.
3208
+ */
3209
+ addSubsection(subsection) {
3210
+ const { subsection: subsectionBytecode, ...rest } = subsection;
3211
+ this.subsection = rest;
3212
+ this.witnessIndex = this.addWitness(subsectionBytecode);
3213
+ }
3214
+ /**
3215
+ * Gets the Transaction Request by hashing the transaction.
3216
+ *
3217
+ * @param chainId - The chain ID.
3218
+ *
3219
+ * @returns - A hash of the transaction, which is the transaction ID.
3220
+ */
3221
+ getTransactionId(chainId) {
3222
+ return hashTransaction(this, chainId);
3223
+ }
3224
+ /**
3225
+ * Converts the transaction request to a `TransactionUpload`.
3226
+ *
3227
+ * @returns The transaction create object.
3228
+ */
3229
+ toTransaction() {
3230
+ const baseTransaction = this.getBaseTransaction();
3231
+ const { subsectionIndex, subsectionsNumber, root, proofSet } = this.subsection;
3232
+ return {
3233
+ type: TransactionType6.Upload,
3234
+ ...baseTransaction,
3235
+ subsectionIndex,
3236
+ subsectionsNumber,
3237
+ root: hexlify13(root),
3238
+ proofSet: proofSet.map(hexlify13),
3239
+ witnessIndex: this.witnessIndex,
3240
+ proofSetCount: proofSet.length
3241
+ };
3242
+ }
3243
+ /**
3244
+ * Calculates the metadata gas cost for an upload transaction.
3245
+ *
3246
+ * @param gasCosts - gas costs passed from the chain.
3247
+ *
3248
+ * @returns metadata gas cost for the upload transaction.
3249
+ */
3250
+ metadataGas(gasCosts) {
3251
+ return calculateMetadataGasForTxUpload({
3252
+ gasCosts,
3253
+ txBytesSize: this.byteSize(),
3254
+ subsectionSize: arrayify9(this.witnesses[this.witnessIndex]).length,
3255
+ subsectionsSize: this.subsection.subsectionsNumber
3256
+ });
3257
+ }
3258
+ /**
3259
+ * Calculates the minimum gas for an upload transaction.
3260
+ *
3261
+ * @param chainInfo - The chain information.
3262
+ *
3263
+ * @returns the minimum gas for the upload transaction
3264
+ */
3265
+ calculateMinGas(chainInfo) {
3266
+ const minGas = super.calculateMinGas(chainInfo);
3267
+ const { gasCosts } = chainInfo.consensusParameters;
3268
+ const bytecode = this.witnesses[this.witnessIndex] ?? ZeroBytes328;
3269
+ return calculateMinGasForTxUpload({
3270
+ gasCosts,
3271
+ baseMinGas: minGas.toNumber(),
3272
+ subsectionSize: arrayify9(bytecode).length
3273
+ });
3274
+ }
3275
+ };
3276
+
2984
3277
  // src/providers/transaction-request/utils.ts
2985
- import { ErrorCode as ErrorCode8, FuelError as FuelError9 } from "@fuel-ts/errors";
2986
- import { TransactionType as TransactionType5 } from "@fuel-ts/transactions";
3278
+ import { ErrorCode as ErrorCode8, FuelError as FuelError10 } from "@fuel-ts/errors";
3279
+ import { TransactionType as TransactionType7 } from "@fuel-ts/transactions";
2987
3280
  var transactionRequestify = (obj) => {
2988
- if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest) {
3281
+ if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
2989
3282
  return obj;
2990
3283
  }
2991
3284
  const { type } = obj;
2992
3285
  switch (obj.type) {
2993
- case TransactionType5.Script: {
3286
+ case TransactionType7.Script: {
2994
3287
  return ScriptTransactionRequest.from(obj);
2995
3288
  }
2996
- case TransactionType5.Create: {
3289
+ case TransactionType7.Create: {
2997
3290
  return CreateTransactionRequest.from(obj);
2998
3291
  }
2999
- case TransactionType5.Blob: {
3292
+ case TransactionType7.Blob: {
3000
3293
  return BlobTransactionRequest.from(obj);
3001
3294
  }
3295
+ case TransactionType7.Upgrade: {
3296
+ return UpgradeTransactionRequest.from(obj);
3297
+ }
3298
+ case TransactionType7.Upload: {
3299
+ return UploadTransactionRequest.from(obj);
3300
+ }
3002
3301
  default: {
3003
- throw new FuelError9(
3302
+ throw new FuelError10(
3004
3303
  ErrorCode8.UNSUPPORTED_TRANSACTION_TYPE,
3005
3304
  `Unsupported transaction type: ${type}.`
3006
3305
  );
3007
3306
  }
3008
3307
  }
3009
3308
  };
3010
- var isTransactionTypeScript = (request) => request.type === TransactionType5.Script;
3011
- var isTransactionTypeCreate = (request) => request.type === TransactionType5.Create;
3012
- var isTransactionTypeBlob = (request) => request.type === TransactionType5.Blob;
3309
+ var isTransactionTypeScript = (request) => request.type === TransactionType7.Script;
3310
+ var isTransactionTypeCreate = (request) => request.type === TransactionType7.Create;
3311
+ var isTransactionTypeBlob = (request) => request.type === TransactionType7.Blob;
3312
+ var isTransactionTypeUpgrade = (request) => request.type === TransactionType7.Upgrade;
3313
+ var isTransactionTypeUpload = (request) => request.type === TransactionType7.Upload;
3013
3314
 
3014
3315
  // src/providers/transaction-response/transaction-response.ts
3015
- import { ErrorCode as ErrorCode12, FuelError as FuelError13 } from "@fuel-ts/errors";
3316
+ import { ErrorCode as ErrorCode12, FuelError as FuelError14 } from "@fuel-ts/errors";
3016
3317
  import { bn as bn16 } from "@fuel-ts/math";
3017
3318
  import { OutputType as OutputType7, TransactionCoder as TransactionCoder4, TxPointerCoder } from "@fuel-ts/transactions";
3018
- import { arrayify as arrayify10, assertUnreachable } from "@fuel-ts/utils";
3319
+ import { arrayify as arrayify11, assertUnreachable } from "@fuel-ts/utils";
3019
3320
 
3020
3321
  // src/providers/transaction-summary/assemble-transaction-summary.ts
3021
3322
  import { bn as bn15 } from "@fuel-ts/math";
3022
3323
  import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
3023
- import { DateTime, hexlify as hexlify12 } from "@fuel-ts/utils";
3324
+ import { DateTime, hexlify as hexlify14 } from "@fuel-ts/utils";
3024
3325
 
3025
3326
  // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
3026
3327
  import { bn as bn12 } from "@fuel-ts/math";
3027
- import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType6 } from "@fuel-ts/transactions";
3028
- import { arrayify as arrayify9 } from "@fuel-ts/utils";
3328
+ import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType8 } from "@fuel-ts/transactions";
3329
+ import { arrayify as arrayify10 } from "@fuel-ts/utils";
3029
3330
  var calculateTXFeeForSummary = (params) => {
3030
3331
  const {
3031
3332
  gasPrice,
@@ -3039,17 +3340,17 @@ var calculateTXFeeForSummary = (params) => {
3039
3340
  }
3040
3341
  const gasPerByte = bn12(feeParams.gasPerByte);
3041
3342
  const gasPriceFactor = bn12(feeParams.gasPriceFactor);
3042
- const transactionBytes = arrayify9(rawPayload);
3343
+ const transactionBytes = arrayify10(rawPayload);
3043
3344
  const [transaction] = new TransactionCoder3().decode(transactionBytes, 0);
3044
3345
  const { type, witnesses, inputs, policies } = transaction;
3045
3346
  let metadataGas = bn12(0);
3046
3347
  let gasLimit = bn12(0);
3047
- if (type !== TransactionType6.Create && type !== TransactionType6.Script) {
3348
+ if (type !== TransactionType8.Create && type !== TransactionType8.Script) {
3048
3349
  return bn12(0);
3049
3350
  }
3050
- if (type === TransactionType6.Create) {
3351
+ if (type === TransactionType8.Create) {
3051
3352
  const { bytecodeWitnessIndex, storageSlots } = transaction;
3052
- const contractBytesSize = bn12(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
3353
+ const contractBytesSize = bn12(arrayify10(witnesses[bytecodeWitnessIndex].data).length);
3053
3354
  metadataGas = calculateMetadataGasForTxCreate({
3054
3355
  contractBytesSize,
3055
3356
  gasCosts,
@@ -3093,10 +3394,10 @@ var calculateTXFeeForSummary = (params) => {
3093
3394
  };
3094
3395
 
3095
3396
  // src/providers/transaction-summary/operations.ts
3096
- import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
3097
- import { ErrorCode as ErrorCode10, FuelError as FuelError11 } from "@fuel-ts/errors";
3397
+ import { ZeroBytes32 as ZeroBytes329 } from "@fuel-ts/address/configs";
3398
+ import { ErrorCode as ErrorCode10, FuelError as FuelError12 } from "@fuel-ts/errors";
3098
3399
  import { bn as bn13 } from "@fuel-ts/math";
3099
- import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
3400
+ import { ReceiptType as ReceiptType4, TransactionType as TransactionType9 } from "@fuel-ts/transactions";
3100
3401
 
3101
3402
  // src/providers/transaction-summary/call.ts
3102
3403
  import { Interface as Interface2 } from "@fuel-ts/abi-coder";
@@ -3132,7 +3433,7 @@ var getFunctionCall = ({ abi, receipt }) => {
3132
3433
  };
3133
3434
 
3134
3435
  // src/providers/transaction-summary/input.ts
3135
- import { ErrorCode as ErrorCode9, FuelError as FuelError10 } from "@fuel-ts/errors";
3436
+ import { ErrorCode as ErrorCode9, FuelError as FuelError11 } from "@fuel-ts/errors";
3136
3437
  import { BN } from "@fuel-ts/math";
3137
3438
  import { InputType as InputType6 } from "@fuel-ts/transactions";
3138
3439
  function getInputsByTypes(inputs, types) {
@@ -3201,7 +3502,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
3201
3502
  return void 0;
3202
3503
  }
3203
3504
  if (contractInput.type !== InputType6.Contract) {
3204
- throw new FuelError10(
3505
+ throw new FuelError11(
3205
3506
  ErrorCode9.INVALID_TRANSACTION_INPUT,
3206
3507
  `Contract input should be of type 'contract'.`
3207
3508
  );
@@ -3286,16 +3587,20 @@ function getReceiptsByType(receipts, type) {
3286
3587
  }
3287
3588
  function getTransactionTypeName(transactionType) {
3288
3589
  switch (transactionType) {
3289
- case TransactionType7.Mint:
3590
+ case TransactionType9.Mint:
3290
3591
  return "Mint" /* Mint */;
3291
- case TransactionType7.Create:
3592
+ case TransactionType9.Create:
3292
3593
  return "Create" /* Create */;
3293
- case TransactionType7.Script:
3594
+ case TransactionType9.Script:
3294
3595
  return "Script" /* Script */;
3295
- case TransactionType7.Blob:
3596
+ case TransactionType9.Blob:
3296
3597
  return "Blob" /* Blob */;
3598
+ case TransactionType9.Upgrade:
3599
+ return "Upgrade" /* Upgrade */;
3600
+ case TransactionType9.Upload:
3601
+ return "Upload" /* Upload */;
3297
3602
  default:
3298
- throw new FuelError11(
3603
+ throw new FuelError12(
3299
3604
  ErrorCode10.UNSUPPORTED_TRANSACTION_TYPE,
3300
3605
  `Unsupported transaction type: ${transactionType}.`
3301
3606
  );
@@ -3441,7 +3746,7 @@ function getAssetsSent(receipt) {
3441
3746
  ];
3442
3747
  }
3443
3748
  function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload, maxInputs, baseAssetId) {
3444
- const assetId = receipt.assetId === ZeroBytes328 ? baseAssetId : receipt.assetId;
3749
+ const assetId = receipt.assetId === ZeroBytes329 ? baseAssetId : receipt.assetId;
3445
3750
  const input = getInputFromAssetId(inputs, assetId, assetId === baseAssetId);
3446
3751
  if (!input) {
3447
3752
  return [];
@@ -3497,7 +3802,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
3497
3802
  const { to: toAddress, assetId, amount } = receipt;
3498
3803
  let { from: fromAddress } = receipt;
3499
3804
  const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
3500
- if (ZeroBytes328 === fromAddress) {
3805
+ if (ZeroBytes329 === fromAddress) {
3501
3806
  const change = changeOutputs.find((output) => output.assetId === assetId);
3502
3807
  fromAddress = change?.to || fromAddress;
3503
3808
  }
@@ -3700,7 +4005,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3700
4005
  };
3701
4006
 
3702
4007
  // src/providers/transaction-summary/status.ts
3703
- import { ErrorCode as ErrorCode11, FuelError as FuelError12 } from "@fuel-ts/errors";
4008
+ import { ErrorCode as ErrorCode11, FuelError as FuelError13 } from "@fuel-ts/errors";
3704
4009
  import { bn as bn14 } from "@fuel-ts/math";
3705
4010
  var getTransactionStatusName = (gqlStatus) => {
3706
4011
  switch (gqlStatus) {
@@ -3713,7 +4018,7 @@ var getTransactionStatusName = (gqlStatus) => {
3713
4018
  case "SqueezedOutStatus":
3714
4019
  return "squeezedout" /* squeezedout */;
3715
4020
  default:
3716
- throw new FuelError12(
4021
+ throw new FuelError13(
3717
4022
  ErrorCode11.INVALID_TRANSACTION_STATUS,
3718
4023
  `Invalid transaction status: ${gqlStatus}.`
3719
4024
  );
@@ -3783,7 +4088,7 @@ function assembleTransactionSummary(params) {
3783
4088
  baseAssetId
3784
4089
  } = params;
3785
4090
  const gasUsed = getGasUsedFromReceipts(receipts);
3786
- const rawPayload = hexlify12(transactionBytes);
4091
+ const rawPayload = hexlify14(transactionBytes);
3787
4092
  const operations = getOperations({
3788
4093
  transactionType: transaction.type,
3789
4094
  inputs: transaction.inputs || [],
@@ -3964,7 +4269,7 @@ var TransactionResponse = class {
3964
4269
  const gqlTransaction = this.gqlTransaction ?? await this.fetch();
3965
4270
  return {
3966
4271
  tx: this.decodeTransaction(gqlTransaction),
3967
- bytes: arrayify10(gqlTransaction.rawPayload)
4272
+ bytes: arrayify11(gqlTransaction.rawPayload)
3968
4273
  };
3969
4274
  }
3970
4275
  getReceipts() {
@@ -4009,7 +4314,7 @@ var TransactionResponse = class {
4009
4314
  */
4010
4315
  decodeTransaction(transactionWithReceipts) {
4011
4316
  return new TransactionCoder4().decode(
4012
- arrayify10(transactionWithReceipts.rawPayload),
4317
+ arrayify11(transactionWithReceipts.rawPayload),
4013
4318
  0
4014
4319
  )?.[0];
4015
4320
  }
@@ -4056,7 +4361,7 @@ var TransactionResponse = class {
4056
4361
  this.status = statusChange;
4057
4362
  if (statusChange.type === "SqueezedOutStatus") {
4058
4363
  this.unsetResourceCache();
4059
- throw new FuelError13(
4364
+ throw new FuelError14(
4060
4365
  ErrorCode12.TRANSACTION_SQUEEZED_OUT,
4061
4366
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
4062
4367
  );
@@ -4165,18 +4470,18 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
4165
4470
  }
4166
4471
 
4167
4472
  // src/providers/utils/handle-gql-error-message.ts
4168
- import { ErrorCode as ErrorCode13, FuelError as FuelError14 } from "@fuel-ts/errors";
4473
+ import { ErrorCode as ErrorCode13, FuelError as FuelError15 } from "@fuel-ts/errors";
4169
4474
  var handleGqlErrorMessage = (errorMessage, rawError) => {
4170
4475
  switch (errorMessage) {
4171
4476
  case "not enough coins to fit the target" /* NOT_ENOUGH_COINS */:
4172
- throw new FuelError14(
4477
+ throw new FuelError15(
4173
4478
  ErrorCode13.NOT_ENOUGH_FUNDS,
4174
4479
  `The account(s) sending the transaction don't have enough funds to cover the transaction.`,
4175
4480
  {},
4176
4481
  rawError
4177
4482
  );
4178
4483
  default:
4179
- throw new FuelError14(ErrorCode13.INVALID_REQUEST, errorMessage);
4484
+ throw new FuelError15(ErrorCode13.INVALID_REQUEST, errorMessage);
4180
4485
  }
4181
4486
  };
4182
4487
 
@@ -4258,21 +4563,31 @@ var _Provider = class {
4258
4563
  * @hidden
4259
4564
  */
4260
4565
  constructor(url, options = {}) {
4261
- this.url = url;
4262
4566
  /**
4263
4567
  * @hidden
4264
4568
  */
4265
4569
  __privateAdd(this, _cacheInputs);
4266
4570
  __publicField(this, "operations");
4267
4571
  __publicField(this, "cache");
4572
+ /** @hidden */
4573
+ __publicField(this, "url");
4574
+ /** @hidden */
4575
+ __publicField(this, "urlWithoutAuth");
4268
4576
  __publicField(this, "options", {
4269
4577
  timeout: void 0,
4270
4578
  resourceCacheTTL: void 0,
4271
4579
  fetch: void 0,
4272
- retryOptions: void 0
4580
+ retryOptions: void 0,
4581
+ headers: void 0
4273
4582
  });
4583
+ const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
4584
+ this.url = rawUrl;
4585
+ this.urlWithoutAuth = urlWithoutAuth;
4274
4586
  this.options = { ...this.options, ...options };
4275
4587
  this.url = url;
4588
+ if (headers) {
4589
+ this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
4590
+ }
4276
4591
  this.operations = this.createOperations();
4277
4592
  const { resourceCacheTTL } = this.options;
4278
4593
  if (isDefined2(resourceCacheTTL)) {
@@ -4294,12 +4609,16 @@ var _Provider = class {
4294
4609
  * @hidden
4295
4610
  */
4296
4611
  static getFetchFn(options) {
4297
- const { retryOptions, timeout } = options;
4612
+ const { retryOptions, timeout, headers } = options;
4298
4613
  return autoRetryFetch(async (...args) => {
4299
4614
  const url = args[0];
4300
4615
  const request = args[1];
4301
4616
  const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
4302
- let fullRequest = { ...request, signal };
4617
+ let fullRequest = {
4618
+ ...request,
4619
+ signal,
4620
+ headers: { ...request?.headers, ...headers }
4621
+ };
4303
4622
  if (options.requestMiddleware) {
4304
4623
  fullRequest = await options.requestMiddleware(fullRequest);
4305
4624
  }
@@ -4307,15 +4626,23 @@ var _Provider = class {
4307
4626
  }, retryOptions);
4308
4627
  }
4309
4628
  static extractBasicAuth(url) {
4310
- const parsedUrl = new URL(url);
4629
+ let parsedUrl;
4630
+ try {
4631
+ parsedUrl = new URL(url);
4632
+ } catch (error) {
4633
+ throw new FuelError16(FuelError16.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
4634
+ }
4311
4635
  const username = parsedUrl.username;
4312
4636
  const password = parsedUrl.password;
4313
- const urlNoBasicAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
4637
+ const urlWithoutAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
4314
4638
  if (!(username && password)) {
4315
- return { url, auth: void 0 };
4639
+ return { url, urlWithoutAuth: url, headers: void 0 };
4316
4640
  }
4317
- const auth = `Basic ${btoa(`${username}:${password}`)}`;
4318
- return { url: urlNoBasicAuth, auth };
4641
+ return {
4642
+ url,
4643
+ urlWithoutAuth,
4644
+ headers: { Authorization: `Basic ${btoa(`${username}:${password}`)}` }
4645
+ };
4319
4646
  }
4320
4647
  /**
4321
4648
  * Creates a new instance of the Provider class. This is the recommended way to initialize a Provider.
@@ -4326,17 +4653,7 @@ var _Provider = class {
4326
4653
  * @returns A promise that resolves to a Provider instance.
4327
4654
  */
4328
4655
  static async create(url, options = {}) {
4329
- const { url: urlToUse, auth } = this.extractBasicAuth(url);
4330
- const provider = new _Provider(urlToUse, {
4331
- ...options,
4332
- requestMiddleware: async (request) => {
4333
- if (auth && request) {
4334
- request.headers ??= {};
4335
- request.headers.Authorization = auth;
4336
- }
4337
- return options.requestMiddleware?.(request) ?? request;
4338
- }
4339
- });
4656
+ const provider = new _Provider(url, options);
4340
4657
  await provider.fetchChainAndNodeInfo();
4341
4658
  return provider;
4342
4659
  }
@@ -4346,9 +4663,9 @@ var _Provider = class {
4346
4663
  * @returns the chain information configuration.
4347
4664
  */
4348
4665
  getChain() {
4349
- const chain = _Provider.chainInfoCache[this.url];
4666
+ const chain = _Provider.chainInfoCache[this.urlWithoutAuth];
4350
4667
  if (!chain) {
4351
- throw new FuelError15(
4668
+ throw new FuelError16(
4352
4669
  ErrorCode14.CHAIN_INFO_CACHE_EMPTY,
4353
4670
  "Chain info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
4354
4671
  );
@@ -4361,9 +4678,9 @@ var _Provider = class {
4361
4678
  * @returns the node information configuration.
4362
4679
  */
4363
4680
  getNode() {
4364
- const node = _Provider.nodeInfoCache[this.url];
4681
+ const node = _Provider.nodeInfoCache[this.urlWithoutAuth];
4365
4682
  if (!node) {
4366
- throw new FuelError15(
4683
+ throw new FuelError16(
4367
4684
  ErrorCode14.NODE_INFO_CACHE_EMPTY,
4368
4685
  "Node info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
4369
4686
  );
@@ -4395,8 +4712,11 @@ var _Provider = class {
4395
4712
  * @param options - Additional options for the provider.
4396
4713
  */
4397
4714
  async connect(url, options) {
4398
- this.url = url;
4715
+ const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
4716
+ this.url = rawUrl;
4717
+ this.urlWithoutAuth = urlWithoutAuth;
4399
4718
  this.options = options ?? this.options;
4719
+ this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
4400
4720
  this.operations = this.createOperations();
4401
4721
  await this.fetchChainAndNodeInfo();
4402
4722
  }
@@ -4436,7 +4756,7 @@ Supported fuel-core version: ${supportedVersion}.`
4436
4756
  */
4437
4757
  createOperations() {
4438
4758
  const fetchFn = _Provider.getFetchFn(this.options);
4439
- const gqlClient = new GraphQLClient(this.url, {
4759
+ const gqlClient = new GraphQLClient(this.urlWithoutAuth, {
4440
4760
  fetch: (url, requestInit) => fetchFn(url, requestInit, this.options),
4441
4761
  responseMiddleware: (response) => {
4442
4762
  if ("response" in response) {
@@ -4454,7 +4774,7 @@ Supported fuel-core version: ${supportedVersion}.`
4454
4774
  const isSubscription = opDefinition?.operation === "subscription";
4455
4775
  if (isSubscription) {
4456
4776
  return FuelGraphqlSubscriber.create({
4457
- url: this.url,
4777
+ url: this.urlWithoutAuth,
4458
4778
  query,
4459
4779
  fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
4460
4780
  variables: vars
@@ -4517,7 +4837,7 @@ Supported fuel-core version: ${supportedVersion}.`
4517
4837
  utxoValidation: nodeInfo.utxoValidation,
4518
4838
  vmBacktrace: nodeInfo.vmBacktrace
4519
4839
  };
4520
- _Provider.nodeInfoCache[this.url] = processedNodeInfo;
4840
+ _Provider.nodeInfoCache[this.urlWithoutAuth] = processedNodeInfo;
4521
4841
  return processedNodeInfo;
4522
4842
  }
4523
4843
  /**
@@ -4528,7 +4848,7 @@ Supported fuel-core version: ${supportedVersion}.`
4528
4848
  async fetchChain() {
4529
4849
  const { chain } = await this.operations.getChain();
4530
4850
  const processedChain = processGqlChain(chain);
4531
- _Provider.chainInfoCache[this.url] = processedChain;
4851
+ _Provider.chainInfoCache[this.urlWithoutAuth] = processedChain;
4532
4852
  return processedChain;
4533
4853
  }
4534
4854
  /**
@@ -4556,13 +4876,13 @@ Supported fuel-core version: ${supportedVersion}.`
4556
4876
  validateTransaction(tx, consensusParameters) {
4557
4877
  const { maxOutputs, maxInputs } = consensusParameters.txParameters;
4558
4878
  if (bn17(tx.inputs.length).gt(maxInputs)) {
4559
- throw new FuelError15(
4879
+ throw new FuelError16(
4560
4880
  ErrorCode14.MAX_INPUTS_EXCEEDED,
4561
4881
  "The transaction exceeds the maximum allowed number of inputs."
4562
4882
  );
4563
4883
  }
4564
4884
  if (bn17(tx.outputs.length).gt(maxOutputs)) {
4565
- throw new FuelError15(
4885
+ throw new FuelError16(
4566
4886
  ErrorCode14.MAX_OUTPUTS_EXCEEDED,
4567
4887
  "The transaction exceeds the maximum allowed number of outputs."
4568
4888
  );
@@ -4585,7 +4905,7 @@ Supported fuel-core version: ${supportedVersion}.`
4585
4905
  }
4586
4906
  const { consensusParameters } = this.getChain();
4587
4907
  this.validateTransaction(transactionRequest, consensusParameters);
4588
- const encodedTransaction = hexlify13(transactionRequest.toTransactionBytes());
4908
+ const encodedTransaction = hexlify15(transactionRequest.toTransactionBytes());
4589
4909
  let abis;
4590
4910
  if (isTransactionTypeScript(transactionRequest)) {
4591
4911
  abis = transactionRequest.abis;
@@ -4609,7 +4929,7 @@ Supported fuel-core version: ${supportedVersion}.`
4609
4929
  if (estimateTxDependencies) {
4610
4930
  return this.estimateTxDependencies(transactionRequest);
4611
4931
  }
4612
- const encodedTransaction = hexlify13(transactionRequest.toTransactionBytes());
4932
+ const encodedTransaction = hexlify15(transactionRequest.toTransactionBytes());
4613
4933
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4614
4934
  encodedTransactions: encodedTransaction,
4615
4935
  utxoValidation: utxoValidation || false
@@ -4629,13 +4949,13 @@ Supported fuel-core version: ${supportedVersion}.`
4629
4949
  async estimatePredicates(transactionRequest) {
4630
4950
  const shouldEstimatePredicates = Boolean(
4631
4951
  transactionRequest.inputs.find(
4632
- (input) => "predicate" in input && input.predicate && !equalBytes(arrayify11(input.predicate), arrayify11("0x")) && new BN2(input.predicateGasUsed).isZero()
4952
+ (input) => "predicate" in input && input.predicate && !equalBytes(arrayify12(input.predicate), arrayify12("0x")) && new BN2(input.predicateGasUsed).isZero()
4633
4953
  )
4634
4954
  );
4635
4955
  if (!shouldEstimatePredicates) {
4636
4956
  return transactionRequest;
4637
4957
  }
4638
- const encodedTransaction = hexlify13(transactionRequest.toTransactionBytes());
4958
+ const encodedTransaction = hexlify15(transactionRequest.toTransactionBytes());
4639
4959
  const response = await this.operations.estimatePredicates({
4640
4960
  encodedTransaction
4641
4961
  });
@@ -4676,7 +4996,7 @@ Supported fuel-core version: ${supportedVersion}.`
4676
4996
  const {
4677
4997
  dryRun: [{ receipts: rawReceipts, status }]
4678
4998
  } = await this.operations.dryRun({
4679
- encodedTransactions: [hexlify13(transactionRequest.toTransactionBytes())],
4999
+ encodedTransactions: [hexlify15(transactionRequest.toTransactionBytes())],
4680
5000
  utxoValidation: false
4681
5001
  });
4682
5002
  receipts = rawReceipts.map(processGqlReceipt);
@@ -4722,11 +5042,11 @@ Supported fuel-core version: ${supportedVersion}.`
4722
5042
  missingContractIds: [],
4723
5043
  dryRunStatus: void 0
4724
5044
  }));
4725
- const allRequests = clone6(transactionRequests);
5045
+ const allRequests = clone8(transactionRequests);
4726
5046
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
4727
5047
  allRequests.forEach((req, index) => {
4728
5048
  if (isTransactionTypeScript(req)) {
4729
- serializedTransactionsMap.set(index, hexlify13(req.toTransactionBytes()));
5049
+ serializedTransactionsMap.set(index, hexlify15(req.toTransactionBytes()));
4730
5050
  }
4731
5051
  });
4732
5052
  let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
@@ -4762,7 +5082,7 @@ Supported fuel-core version: ${supportedVersion}.`
4762
5082
  transactionRequest: request
4763
5083
  });
4764
5084
  request.maxFee = maxFee;
4765
- serializedTransactionsMap.set(requestIdx, hexlify13(request.toTransactionBytes()));
5085
+ serializedTransactionsMap.set(requestIdx, hexlify15(request.toTransactionBytes()));
4766
5086
  nextRoundTransactions.push(requestIdx);
4767
5087
  }
4768
5088
  }
@@ -4783,7 +5103,7 @@ Supported fuel-core version: ${supportedVersion}.`
4783
5103
  if (estimateTxDependencies) {
4784
5104
  return this.estimateMultipleTxDependencies(transactionRequests);
4785
5105
  }
4786
- const encodedTransactions = transactionRequests.map((tx) => hexlify13(tx.toTransactionBytes()));
5106
+ const encodedTransactions = transactionRequests.map((tx) => hexlify15(tx.toTransactionBytes()));
4787
5107
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4788
5108
  encodedTransactions,
4789
5109
  utxoValidation: utxoValidation || false
@@ -4857,7 +5177,7 @@ Supported fuel-core version: ${supportedVersion}.`
4857
5177
  if (estimateTxDependencies) {
4858
5178
  return this.estimateTxDependencies(transactionRequest);
4859
5179
  }
4860
- const encodedTransactions = [hexlify13(transactionRequest.toTransactionBytes())];
5180
+ const encodedTransactions = [hexlify15(transactionRequest.toTransactionBytes())];
4861
5181
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4862
5182
  encodedTransactions,
4863
5183
  utxoValidation: true
@@ -4882,13 +5202,13 @@ Supported fuel-core version: ${supportedVersion}.`
4882
5202
  * @returns A promise that resolves to the transaction cost object.
4883
5203
  */
4884
5204
  async getTransactionCost(transactionRequestLike, { signatureCallback } = {}) {
4885
- const txRequestClone = clone6(transactionRequestify(transactionRequestLike));
5205
+ const txRequestClone = clone8(transactionRequestify(transactionRequestLike));
4886
5206
  const updateMaxFee = txRequestClone.maxFee.eq(0);
4887
5207
  const isScriptTransaction = isTransactionTypeScript(txRequestClone);
4888
5208
  if (isScriptTransaction) {
4889
5209
  txRequestClone.gasLimit = bn17(0);
4890
5210
  }
4891
- const signedRequest = clone6(txRequestClone);
5211
+ const signedRequest = clone8(txRequestClone);
4892
5212
  let addedSignatures = 0;
4893
5213
  if (signatureCallback && isTransactionTypeScript(signedRequest)) {
4894
5214
  const lengthBefore = signedRequest.witnesses.length;
@@ -4956,7 +5276,7 @@ Supported fuel-core version: ${supportedVersion}.`
4956
5276
  paginationLimit: RESOURCES_PAGE_SIZE_LIMIT,
4957
5277
  inputArgs: paginationArgs
4958
5278
  }),
4959
- filter: { owner: ownerAddress.toB256(), assetId: assetId && hexlify13(assetId) }
5279
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && hexlify15(assetId) }
4960
5280
  });
4961
5281
  const coins = edges.map(({ node }) => ({
4962
5282
  id: node.utxoId,
@@ -4982,8 +5302,8 @@ Supported fuel-core version: ${supportedVersion}.`
4982
5302
  async getResourcesToSpend(owner, quantities, excludedIds) {
4983
5303
  const ownerAddress = Address2.fromAddressOrString(owner);
4984
5304
  const excludeInput = {
4985
- messages: excludedIds?.messages?.map((nonce) => hexlify13(nonce)) || [],
4986
- utxos: excludedIds?.utxos?.map((id) => hexlify13(id)) || []
5305
+ messages: excludedIds?.messages?.map((nonce) => hexlify15(nonce)) || [],
5306
+ utxos: excludedIds?.utxos?.map((id) => hexlify15(id)) || []
4987
5307
  };
4988
5308
  if (this.cache) {
4989
5309
  const cached = this.cache.getActiveData();
@@ -4993,7 +5313,7 @@ Supported fuel-core version: ${supportedVersion}.`
4993
5313
  const coinsQuery = {
4994
5314
  owner: ownerAddress.toB256(),
4995
5315
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
4996
- assetId: hexlify13(assetId),
5316
+ assetId: hexlify15(assetId),
4997
5317
  amount: amount.toString(10),
4998
5318
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
4999
5319
  })),
@@ -5148,7 +5468,7 @@ Supported fuel-core version: ${supportedVersion}.`
5148
5468
  },
5149
5469
  transactionIds: block.transactions.map((tx) => tx.id),
5150
5470
  transactions: block.transactions.map(
5151
- (tx) => new TransactionCoder5().decode(arrayify11(tx.rawPayload), 0)?.[0]
5471
+ (tx) => new TransactionCoder5().decode(arrayify12(tx.rawPayload), 0)?.[0]
5152
5472
  )
5153
5473
  };
5154
5474
  }
@@ -5165,11 +5485,11 @@ Supported fuel-core version: ${supportedVersion}.`
5165
5485
  }
5166
5486
  try {
5167
5487
  return new TransactionCoder5().decode(
5168
- arrayify11(transaction.rawPayload),
5488
+ arrayify12(transaction.rawPayload),
5169
5489
  0
5170
5490
  )?.[0];
5171
5491
  } catch (error) {
5172
- if (error instanceof FuelError15 && error.code === ErrorCode14.UNSUPPORTED_TRANSACTION_TYPE) {
5492
+ if (error instanceof FuelError16 && error.code === ErrorCode14.UNSUPPORTED_TRANSACTION_TYPE) {
5173
5493
  console.warn("Unsupported transaction type encountered");
5174
5494
  return null;
5175
5495
  }
@@ -5188,9 +5508,9 @@ Supported fuel-core version: ${supportedVersion}.`
5188
5508
  const coder = new TransactionCoder5();
5189
5509
  const transactions = edges.map(({ node: { rawPayload } }) => {
5190
5510
  try {
5191
- return coder.decode(arrayify11(rawPayload), 0)[0];
5511
+ return coder.decode(arrayify12(rawPayload), 0)[0];
5192
5512
  } catch (error) {
5193
- if (error instanceof FuelError15 && error.code === ErrorCode14.UNSUPPORTED_TRANSACTION_TYPE) {
5513
+ if (error instanceof FuelError16 && error.code === ErrorCode14.UNSUPPORTED_TRANSACTION_TYPE) {
5194
5514
  console.warn("Unsupported transaction type encountered");
5195
5515
  return null;
5196
5516
  }
@@ -5222,7 +5542,7 @@ Supported fuel-core version: ${supportedVersion}.`
5222
5542
  async getContractBalance(contractId, assetId) {
5223
5543
  const { contractBalance } = await this.operations.getContractBalance({
5224
5544
  contract: Address2.fromAddressOrString(contractId).toB256(),
5225
- asset: hexlify13(assetId)
5545
+ asset: hexlify15(assetId)
5226
5546
  });
5227
5547
  return bn17(contractBalance.amount, 10);
5228
5548
  }
@@ -5236,7 +5556,7 @@ Supported fuel-core version: ${supportedVersion}.`
5236
5556
  async getBalance(owner, assetId) {
5237
5557
  const { balance } = await this.operations.getBalance({
5238
5558
  owner: Address2.fromAddressOrString(owner).toB256(),
5239
- assetId: hexlify13(assetId)
5559
+ assetId: hexlify15(assetId)
5240
5560
  });
5241
5561
  return bn17(balance.amount, 10);
5242
5562
  }
@@ -5316,7 +5636,7 @@ Supported fuel-core version: ${supportedVersion}.`
5316
5636
  nonce
5317
5637
  };
5318
5638
  if (commitBlockId && commitBlockHeight) {
5319
- throw new FuelError15(
5639
+ throw new FuelError16(
5320
5640
  ErrorCode14.INVALID_INPUT_PARAMETERS,
5321
5641
  "commitBlockId and commitBlockHeight cannot be used together"
5322
5642
  );
@@ -5500,25 +5820,25 @@ Supported fuel-core version: ${supportedVersion}.`
5500
5820
  const { paginationLimit, inputArgs = {} } = params;
5501
5821
  const { first, last, after, before } = inputArgs;
5502
5822
  if (after && before) {
5503
- throw new FuelError15(
5823
+ throw new FuelError16(
5504
5824
  ErrorCode14.INVALID_INPUT_PARAMETERS,
5505
5825
  'Pagination arguments "after" and "before" cannot be used together'
5506
5826
  );
5507
5827
  }
5508
5828
  if ((first || 0) > paginationLimit || (last || 0) > paginationLimit) {
5509
- throw new FuelError15(
5829
+ throw new FuelError16(
5510
5830
  ErrorCode14.INVALID_INPUT_PARAMETERS,
5511
5831
  `Pagination limit for this query cannot exceed ${paginationLimit} items`
5512
5832
  );
5513
5833
  }
5514
5834
  if (first && before) {
5515
- throw new FuelError15(
5835
+ throw new FuelError16(
5516
5836
  ErrorCode14.INVALID_INPUT_PARAMETERS,
5517
5837
  'The use of pagination argument "first" with "before" is not supported'
5518
5838
  );
5519
5839
  }
5520
5840
  if (last && after) {
5521
- throw new FuelError15(
5841
+ throw new FuelError16(
5522
5842
  ErrorCode14.INVALID_INPUT_PARAMETERS,
5523
5843
  'The use of pagination argument "last" with "after" is not supported'
5524
5844
  );
@@ -5573,23 +5893,23 @@ __publicField(Provider, "chainInfoCache", {});
5573
5893
  __publicField(Provider, "nodeInfoCache", {});
5574
5894
 
5575
5895
  // src/providers/transaction-summary/get-transaction-summary.ts
5576
- import { ErrorCode as ErrorCode15, FuelError as FuelError16 } from "@fuel-ts/errors";
5896
+ import { ErrorCode as ErrorCode15, FuelError as FuelError17 } from "@fuel-ts/errors";
5577
5897
  import { bn as bn18 } from "@fuel-ts/math";
5578
5898
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
5579
- import { arrayify as arrayify12 } from "@fuel-ts/utils";
5899
+ import { arrayify as arrayify13 } from "@fuel-ts/utils";
5580
5900
  async function getTransactionSummary(params) {
5581
5901
  const { id, provider, abiMap } = params;
5582
5902
  const { transaction: gqlTransaction } = await provider.operations.getTransactionWithReceipts({
5583
5903
  transactionId: id
5584
5904
  });
5585
5905
  if (!gqlTransaction) {
5586
- throw new FuelError16(
5906
+ throw new FuelError17(
5587
5907
  ErrorCode15.TRANSACTION_NOT_FOUND,
5588
5908
  `Transaction not found for given id: ${id}.`
5589
5909
  );
5590
5910
  }
5591
5911
  const [decodedTransaction] = new TransactionCoder6().decode(
5592
- arrayify12(gqlTransaction.rawPayload),
5912
+ arrayify13(gqlTransaction.rawPayload),
5593
5913
  0
5594
5914
  );
5595
5915
  let txReceipts = [];
@@ -5610,7 +5930,7 @@ async function getTransactionSummary(params) {
5610
5930
  id: gqlTransaction.id,
5611
5931
  receipts,
5612
5932
  transaction: decodedTransaction,
5613
- transactionBytes: arrayify12(gqlTransaction.rawPayload),
5933
+ transactionBytes: arrayify13(gqlTransaction.rawPayload),
5614
5934
  gqlTransactionStatus: gqlTransaction.status,
5615
5935
  gasPerByte: bn18(gasPerByte),
5616
5936
  gasPriceFactor: bn18(gasPriceFactor),
@@ -5666,7 +5986,7 @@ async function getTransactionsSummaries(params) {
5666
5986
  const transactions = edges.map((edge) => {
5667
5987
  const { node: gqlTransaction } = edge;
5668
5988
  const { id, rawPayload, status } = gqlTransaction;
5669
- const [decodedTransaction] = new TransactionCoder6().decode(arrayify12(rawPayload), 0);
5989
+ const [decodedTransaction] = new TransactionCoder6().decode(arrayify13(rawPayload), 0);
5670
5990
  let txReceipts = [];
5671
5991
  if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
5672
5992
  txReceipts = gqlTransaction.status.receipts;
@@ -5676,7 +5996,7 @@ async function getTransactionsSummaries(params) {
5676
5996
  id,
5677
5997
  receipts,
5678
5998
  transaction: decodedTransaction,
5679
- transactionBytes: arrayify12(rawPayload),
5999
+ transactionBytes: arrayify13(rawPayload),
5680
6000
  gqlTransactionStatus: status,
5681
6001
  abiMap,
5682
6002
  gasPerByte,
@@ -5701,12 +6021,14 @@ async function getTransactionsSummaries(params) {
5701
6021
  // src/providers/chains.ts
5702
6022
  var CHAIN_IDS = {
5703
6023
  eth: {
6024
+ mainnet: 1,
5704
6025
  sepolia: 11155111,
5705
6026
  foundry: 31337
5706
6027
  },
5707
6028
  fuel: {
5708
6029
  devnet: 0,
5709
- testnet: 0
6030
+ testnet: 0,
6031
+ mainnet: 9889
5710
6032
  }
5711
6033
  };
5712
6034
 
@@ -5806,6 +6128,11 @@ var rawAssets = [
5806
6128
  chainId: CHAIN_IDS.eth.foundry,
5807
6129
  decimals: 18
5808
6130
  },
6131
+ {
6132
+ type: "ethereum",
6133
+ chainId: CHAIN_IDS.eth.mainnet,
6134
+ decimals: 18
6135
+ },
5809
6136
  {
5810
6137
  type: "fuel",
5811
6138
  chainId: CHAIN_IDS.fuel.devnet,
@@ -5817,78 +6144,643 @@ var rawAssets = [
5817
6144
  chainId: CHAIN_IDS.fuel.testnet,
5818
6145
  decimals: 9,
5819
6146
  assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
6147
+ },
6148
+ {
6149
+ type: "fuel",
6150
+ chainId: CHAIN_IDS.fuel.mainnet,
6151
+ decimals: 9,
6152
+ assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
5820
6153
  }
5821
6154
  ]
5822
- }
5823
- ];
5824
- var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
5825
-
5826
- // src/providers/utils/merge-quantities.ts
5827
- var mergeQuantities = (...coinQuantities) => {
5828
- const resultMap = {};
5829
- function addToMap({ amount, assetId }) {
5830
- if (resultMap[assetId]) {
5831
- resultMap[assetId] = resultMap[assetId].add(amount);
5832
- } else {
5833
- resultMap[assetId] = amount;
5834
- }
5835
- }
5836
- coinQuantities.forEach((arr) => arr.forEach(addToMap));
5837
- return Object.entries(resultMap).map(([assetId, amount]) => ({ assetId, amount }));
5838
- };
5839
-
5840
- // src/utils/formatTransferToContractScriptData.ts
5841
- import { BigNumberCoder as BigNumberCoder2 } from "@fuel-ts/abi-coder";
5842
- import { BN as BN3 } from "@fuel-ts/math";
5843
- import { arrayify as arrayify13 } from "@fuel-ts/utils";
5844
- import * as asm from "@fuels/vm-asm";
5845
- var formatTransferToContractScriptData = (params) => {
5846
- const { assetId, amountToTransfer, hexlifiedContractId } = params;
5847
- const numberCoder = new BigNumberCoder2("u64");
5848
- const encoded = numberCoder.encode(new BN3(amountToTransfer).toNumber());
5849
- const scriptData = Uint8Array.from([
5850
- ...arrayify13(hexlifiedContractId),
5851
- ...encoded,
5852
- ...arrayify13(assetId)
5853
- ]);
5854
- return scriptData;
5855
- };
5856
- var assembleTransferToContractScript = async (params) => {
5857
- const scriptData = formatTransferToContractScriptData(params);
5858
- await asm.initWasm();
5859
- const gtf2 = asm.gtf(16, 0, asm.GTFArgs.ScriptData);
5860
- const addi2 = asm.addi(17, 16, 32);
5861
- const lw2 = asm.lw(18, 17, 0);
5862
- const addi22 = asm.addi(19, 17, 8);
5863
- const tr2 = asm.tr(16, 18, 19);
5864
- const ret2 = asm.ret(1);
5865
- const script = Uint8Array.from([
5866
- ...gtf2.to_bytes(),
5867
- ...addi2.to_bytes(),
5868
- ...lw2.to_bytes(),
5869
- ...addi22.to_bytes(),
5870
- ...tr2.to_bytes(),
5871
- ...ret2.to_bytes()
5872
- ]);
5873
- return { script, scriptData };
5874
- };
5875
-
5876
- // src/account.ts
5877
- var MAX_FUNDING_ATTEMPTS = 5;
5878
- var Account = class extends AbstractAccount {
5879
- /**
5880
- * The address associated with the account.
5881
- */
5882
- address;
5883
- /**
5884
- * The provider used to interact with the network.
5885
- */
5886
- _provider;
5887
- /**
5888
- * The connector for use with external wallets
5889
- */
5890
- _connector;
5891
- /**
6155
+ },
6156
+ {
6157
+ name: "WETH",
6158
+ symbol: "WETH",
6159
+ icon: "weth.svg",
6160
+ networks: [
6161
+ {
6162
+ type: "ethereum",
6163
+ chainId: CHAIN_IDS.eth.mainnet,
6164
+ address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
6165
+ decimals: 18
6166
+ },
6167
+ {
6168
+ type: "fuel",
6169
+ chainId: CHAIN_IDS.fuel.mainnet,
6170
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6171
+ assetId: "0xa38a5a8beeb08d95744bc7f58528073f4052b254def59eba20c99c202b5acaa3",
6172
+ decimals: 18
6173
+ }
6174
+ ]
6175
+ },
6176
+ {
6177
+ name: "weETH",
6178
+ symbol: "weETH",
6179
+ icon: "weETH.webp",
6180
+ networks: [
6181
+ {
6182
+ type: "ethereum",
6183
+ chainId: CHAIN_IDS.eth.mainnet,
6184
+ address: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
6185
+ decimals: 18
6186
+ },
6187
+ {
6188
+ type: "fuel",
6189
+ chainId: CHAIN_IDS.fuel.mainnet,
6190
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6191
+ assetId: "0x239ed6e12b7ce4089ee245244e3bf906999a6429c2a9a445a1e1faf56914a4ab",
6192
+ decimals: 18
6193
+ }
6194
+ ]
6195
+ },
6196
+ {
6197
+ name: "rsETH",
6198
+ symbol: "rsETH",
6199
+ icon: "rsETH.webp",
6200
+ networks: [
6201
+ {
6202
+ type: "ethereum",
6203
+ chainId: CHAIN_IDS.eth.mainnet,
6204
+ address: "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7",
6205
+ decimals: 18
6206
+ },
6207
+ {
6208
+ type: "fuel",
6209
+ chainId: CHAIN_IDS.fuel.mainnet,
6210
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6211
+ assetId: "0xbae80f7fb8aa6b90d9b01ef726ec847cc4f59419c4d5f2ea88fec785d1b0e849",
6212
+ decimals: 18
6213
+ }
6214
+ ]
6215
+ },
6216
+ {
6217
+ name: "rETH",
6218
+ symbol: "rETH",
6219
+ icon: "reth.svg",
6220
+ networks: [
6221
+ {
6222
+ type: "ethereum",
6223
+ chainId: CHAIN_IDS.eth.mainnet,
6224
+ address: "0xae78736cd615f374d3085123a210448e74fc6393",
6225
+ decimals: 18
6226
+ },
6227
+ {
6228
+ type: "fuel",
6229
+ chainId: CHAIN_IDS.fuel.mainnet,
6230
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6231
+ assetId: "0xf3f9a0ed0ce8eac5f89d6b83e41b3848212d5b5f56108c54a205bb228ca30c16",
6232
+ decimals: 18
6233
+ }
6234
+ ]
6235
+ },
6236
+ {
6237
+ name: "wbETH",
6238
+ symbol: "wbETH",
6239
+ icon: "wbeth.png",
6240
+ networks: [
6241
+ {
6242
+ type: "ethereum",
6243
+ chainId: CHAIN_IDS.eth.mainnet,
6244
+ address: "0xa2E3356610840701BDf5611a53974510Ae27E2e1",
6245
+ decimals: 18
6246
+ },
6247
+ {
6248
+ type: "fuel",
6249
+ chainId: CHAIN_IDS.fuel.mainnet,
6250
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6251
+ assetId: "0x7843c74bef935e837f2bcf67b5d64ecb46dd53ff86375530b0caf3699e8ffafe",
6252
+ decimals: 18
6253
+ }
6254
+ ]
6255
+ },
6256
+ {
6257
+ name: "rstETH",
6258
+ symbol: "rstETH",
6259
+ icon: "rstETH.webp",
6260
+ networks: [
6261
+ {
6262
+ type: "ethereum",
6263
+ chainId: CHAIN_IDS.eth.mainnet,
6264
+ address: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
6265
+ decimals: 18
6266
+ },
6267
+ {
6268
+ type: "fuel",
6269
+ chainId: CHAIN_IDS.fuel.mainnet,
6270
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6271
+ assetId: "0x962792286fbc9b1d5860b4551362a12249362c21594c77abf4b3fe2bbe8d977a",
6272
+ decimals: 18
6273
+ }
6274
+ ]
6275
+ },
6276
+ {
6277
+ name: "amphrETH",
6278
+ symbol: "amphrETH",
6279
+ icon: "amphrETH.png",
6280
+ networks: [
6281
+ {
6282
+ type: "ethereum",
6283
+ chainId: CHAIN_IDS.eth.mainnet,
6284
+ address: "0x5fD13359Ba15A84B76f7F87568309040176167cd",
6285
+ decimals: 18
6286
+ },
6287
+ {
6288
+ type: "fuel",
6289
+ chainId: CHAIN_IDS.fuel.mainnet,
6290
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6291
+ assetId: "0x05fc623e57bd7bc1258efa8e4f62b05af5471d73df6f2c2dc11ecc81134c4f36",
6292
+ decimals: 18
6293
+ }
6294
+ ]
6295
+ },
6296
+ {
6297
+ name: "Manta mBTC",
6298
+ symbol: "Manta mBTC",
6299
+ icon: "manta-mbtc.svg",
6300
+ networks: [
6301
+ {
6302
+ type: "ethereum",
6303
+ chainId: CHAIN_IDS.eth.mainnet,
6304
+ address: "0x4041381e947CFD3D483d67a25C6aa9Dc924250c5",
6305
+ decimals: 18
6306
+ },
6307
+ {
6308
+ type: "fuel",
6309
+ chainId: CHAIN_IDS.fuel.mainnet,
6310
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6311
+ assetId: "0xaf3111a248ff7a3238cdeea845bb2d43cf3835f1f6b8c9d28360728b55b9ce5b",
6312
+ decimals: 18
6313
+ }
6314
+ ]
6315
+ },
6316
+ {
6317
+ name: "Manta mETH",
6318
+ symbol: "Manta mETH",
6319
+ icon: "manta-meth.svg",
6320
+ networks: [
6321
+ {
6322
+ type: "ethereum",
6323
+ chainId: CHAIN_IDS.eth.mainnet,
6324
+ address: "0x8CdF550C04Bc9B9F10938368349C9c8051A772b6",
6325
+ decimals: 18
6326
+ },
6327
+ {
6328
+ type: "fuel",
6329
+ chainId: CHAIN_IDS.fuel.mainnet,
6330
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6331
+ assetId: "0xafd219f513317b1750783c6581f55530d6cf189a5863fd18bd1b3ffcec1714b4",
6332
+ decimals: 18
6333
+ }
6334
+ ]
6335
+ },
6336
+ {
6337
+ name: "Manta mUSD",
6338
+ symbol: "Manta mUSD",
6339
+ icon: "manta-musd.svg",
6340
+ networks: [
6341
+ {
6342
+ type: "ethereum",
6343
+ chainId: CHAIN_IDS.eth.mainnet,
6344
+ address: "0x3f24E1d7a973867fC2A03fE199E5502514E0e11E",
6345
+ decimals: 18
6346
+ },
6347
+ {
6348
+ type: "fuel",
6349
+ chainId: CHAIN_IDS.fuel.mainnet,
6350
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6351
+ assetId: "0x89cb9401e55d49c3269654dd1cdfb0e80e57823a4a7db98ba8fc5953b120fef4",
6352
+ decimals: 18
6353
+ }
6354
+ ]
6355
+ },
6356
+ {
6357
+ name: "pumpBTC",
6358
+ symbol: "pumpBTC",
6359
+ icon: "pumpbtc.webp",
6360
+ networks: [
6361
+ {
6362
+ type: "ethereum",
6363
+ chainId: CHAIN_IDS.eth.mainnet,
6364
+ address: "0xf469fbd2abcd6b9de8e169d128226c0fc90a012e",
6365
+ decimals: 8
6366
+ },
6367
+ {
6368
+ type: "fuel",
6369
+ chainId: CHAIN_IDS.fuel.mainnet,
6370
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6371
+ assetId: "0x0aa5eb2bb97ca915288b653a2529355d4dc66de2b37533213f0e4aeee3d3421f",
6372
+ decimals: 8
6373
+ }
6374
+ ]
6375
+ },
6376
+ {
6377
+ name: "FBTC",
6378
+ symbol: "FBTC",
6379
+ icon: "fbtc.svg",
6380
+ networks: [
6381
+ {
6382
+ type: "ethereum",
6383
+ chainId: CHAIN_IDS.eth.mainnet,
6384
+ address: "0xc96de26018a54d51c097160568752c4e3bd6c364",
6385
+ decimals: 8
6386
+ },
6387
+ {
6388
+ type: "fuel",
6389
+ chainId: CHAIN_IDS.fuel.mainnet,
6390
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6391
+ assetId: "0xb5ecb0a1e08e2abbabf624ffea089df933376855f468ade35c6375b00c33996a",
6392
+ decimals: 8
6393
+ }
6394
+ ]
6395
+ },
6396
+ {
6397
+ name: "SolvBTC",
6398
+ symbol: "SolvBTC",
6399
+ icon: "solvBTC.webp",
6400
+ networks: [
6401
+ {
6402
+ type: "ethereum",
6403
+ chainId: CHAIN_IDS.eth.mainnet,
6404
+ address: "0x7a56e1c57c7475ccf742a1832b028f0456652f97",
6405
+ decimals: 18
6406
+ },
6407
+ {
6408
+ type: "fuel",
6409
+ chainId: CHAIN_IDS.fuel.mainnet,
6410
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6411
+ assetId: "0x1186afea9affb88809c210e13e2330b5258c2cef04bb8fff5eff372b7bd3f40f",
6412
+ decimals: 18
6413
+ }
6414
+ ]
6415
+ },
6416
+ {
6417
+ name: "SolvBTC.BBN",
6418
+ symbol: "SolvBTC.BBN",
6419
+ icon: "SolvBTC.BBN.png",
6420
+ networks: [
6421
+ {
6422
+ type: "ethereum",
6423
+ chainId: CHAIN_IDS.eth.mainnet,
6424
+ address: "0xd9d920aa40f578ab794426f5c90f6c731d159def",
6425
+ decimals: 18
6426
+ },
6427
+ {
6428
+ type: "fuel",
6429
+ chainId: CHAIN_IDS.fuel.mainnet,
6430
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6431
+ assetId: "0x7a4f087c957d30218223c2baaaa365355c9ca81b6ea49004cfb1590a5399216f",
6432
+ decimals: 18
6433
+ }
6434
+ ]
6435
+ },
6436
+ {
6437
+ name: "Mantle mETH",
6438
+ symbol: "Mantle mETH",
6439
+ icon: "mantle-meth.svg",
6440
+ networks: [
6441
+ {
6442
+ type: "ethereum",
6443
+ chainId: CHAIN_IDS.eth.mainnet,
6444
+ address: "0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa",
6445
+ decimals: 18
6446
+ },
6447
+ {
6448
+ type: "fuel",
6449
+ chainId: CHAIN_IDS.fuel.mainnet,
6450
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6451
+ assetId: "0x642a5db59ec323c2f846d4d4cf3e58d78aff64accf4f8f6455ba0aa3ef000a3b",
6452
+ decimals: 18
6453
+ }
6454
+ ]
6455
+ },
6456
+ {
6457
+ name: "sDAI",
6458
+ symbol: "sDAI",
6459
+ icon: "sdai.svg",
6460
+ networks: [
6461
+ {
6462
+ type: "ethereum",
6463
+ chainId: CHAIN_IDS.eth.mainnet,
6464
+ address: "0x83f20f44975d03b1b09e64809b757c47f942beea",
6465
+ decimals: 18
6466
+ },
6467
+ {
6468
+ type: "fuel",
6469
+ chainId: CHAIN_IDS.fuel.mainnet,
6470
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6471
+ assetId: "0x9e46f919fbf978f3cad7cd34cca982d5613af63ff8aab6c379e4faa179552958",
6472
+ decimals: 18
6473
+ }
6474
+ ]
6475
+ },
6476
+ {
6477
+ name: "USDT",
6478
+ symbol: "USDT",
6479
+ icon: "usdt.svg",
6480
+ networks: [
6481
+ {
6482
+ type: "ethereum",
6483
+ chainId: CHAIN_IDS.eth.mainnet,
6484
+ address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
6485
+ decimals: 6
6486
+ },
6487
+ {
6488
+ type: "fuel",
6489
+ chainId: CHAIN_IDS.fuel.mainnet,
6490
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6491
+ assetId: "0xa0265fb5c32f6e8db3197af3c7eb05c48ae373605b8165b6f4a51c5b0ba4812e",
6492
+ decimals: 6
6493
+ }
6494
+ ]
6495
+ },
6496
+ {
6497
+ name: "USDC",
6498
+ symbol: "USDC",
6499
+ icon: "usdc.svg",
6500
+ networks: [
6501
+ {
6502
+ type: "ethereum",
6503
+ chainId: CHAIN_IDS.eth.mainnet,
6504
+ address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
6505
+ decimals: 6
6506
+ },
6507
+ {
6508
+ type: "fuel",
6509
+ chainId: CHAIN_IDS.fuel.mainnet,
6510
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6511
+ assetId: "0x286c479da40dc953bddc3bb4c453b608bba2e0ac483b077bd475174115395e6b",
6512
+ decimals: 6
6513
+ }
6514
+ ]
6515
+ },
6516
+ {
6517
+ name: "USDe",
6518
+ symbol: "USDe",
6519
+ icon: "USDe.svg",
6520
+ networks: [
6521
+ {
6522
+ type: "ethereum",
6523
+ chainId: CHAIN_IDS.eth.mainnet,
6524
+ address: "0x4c9edd5852cd905f086c759e8383e09bff1e68b3",
6525
+ decimals: 18
6526
+ },
6527
+ {
6528
+ type: "ethereum",
6529
+ chainId: CHAIN_IDS.eth.sepolia,
6530
+ address: "0xc6387efad0f184a90b34f397c3d6fd63135ef790",
6531
+ decimals: 18
6532
+ },
6533
+ {
6534
+ type: "fuel",
6535
+ chainId: CHAIN_IDS.fuel.mainnet,
6536
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6537
+ assetId: "0xb6133b2ef9f6153eb869125d23dcf20d1e735331b5e41b15a6a7a6cec70e8651",
6538
+ decimals: 18
6539
+ },
6540
+ {
6541
+ type: "fuel",
6542
+ chainId: CHAIN_IDS.fuel.testnet,
6543
+ contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
6544
+ assetId: "0xf5c6d72d0f2c782fa47d8e228c198a08654e9fc66ca60ad85902b1d09046a7ab",
6545
+ decimals: 18
6546
+ }
6547
+ ]
6548
+ },
6549
+ {
6550
+ name: "sUSDe",
6551
+ symbol: "sUSDe",
6552
+ icon: "sUSDe.webp",
6553
+ networks: [
6554
+ {
6555
+ type: "ethereum",
6556
+ chainId: CHAIN_IDS.eth.mainnet,
6557
+ address: "0x9d39a5de30e57443bff2a8307a4256c8797a3497",
6558
+ decimals: 18
6559
+ },
6560
+ {
6561
+ type: "ethereum",
6562
+ chainId: CHAIN_IDS.eth.sepolia,
6563
+ address: "0xb8f4f4eafc1d2a3c0a4d519bbf1114c311cc9b1b",
6564
+ decimals: 18
6565
+ },
6566
+ {
6567
+ type: "fuel",
6568
+ chainId: CHAIN_IDS.fuel.mainnet,
6569
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6570
+ assetId: "0xd05563025104fc36496c15c7021ad6b31034b0e89a356f4f818045d1f48808bc",
6571
+ decimals: 18
6572
+ },
6573
+ {
6574
+ type: "fuel",
6575
+ chainId: CHAIN_IDS.fuel.testnet,
6576
+ contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
6577
+ assetId: "0xa86e37d385c08beddbb02c8260f9ec535d484c8ea908fc19d4e6dc8d5141fb2e",
6578
+ decimals: 18
6579
+ }
6580
+ ]
6581
+ },
6582
+ {
6583
+ name: "rsUSDe",
6584
+ symbol: "rsUSDe",
6585
+ icon: "rsUSDe.svg",
6586
+ networks: [
6587
+ {
6588
+ type: "ethereum",
6589
+ chainId: CHAIN_IDS.eth.mainnet,
6590
+ address: "0x82f5104b23FF2FA54C2345F821dAc9369e9E0B26",
6591
+ decimals: 18
6592
+ },
6593
+ {
6594
+ type: "fuel",
6595
+ chainId: CHAIN_IDS.fuel.mainnet,
6596
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6597
+ assetId: "0x78d4522ec607f6e8efb66ea49439d1ee48623cf763f9688a8eada025def033d9",
6598
+ decimals: 18
6599
+ }
6600
+ ]
6601
+ },
6602
+ {
6603
+ name: "wstETH",
6604
+ symbol: "wstETH",
6605
+ icon: "wsteth.svg",
6606
+ networks: [
6607
+ {
6608
+ type: "ethereum",
6609
+ chainId: CHAIN_IDS.eth.mainnet,
6610
+ address: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
6611
+ decimals: 18
6612
+ },
6613
+ {
6614
+ type: "ethereum",
6615
+ chainId: CHAIN_IDS.eth.sepolia,
6616
+ address: "0xB82381A3fBD3FaFA77B3a7bE693342618240067b",
6617
+ decimals: 18
6618
+ },
6619
+ {
6620
+ type: "fuel",
6621
+ chainId: CHAIN_IDS.fuel.mainnet,
6622
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6623
+ assetId: "0x1a7815cc9f75db5c24a5b0814bfb706bb9fe485333e98254015de8f48f84c67b",
6624
+ decimals: 18
6625
+ },
6626
+ {
6627
+ type: "fuel",
6628
+ chainId: CHAIN_IDS.fuel.testnet,
6629
+ contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
6630
+ assetId: "0x4c467e3fd4f32179e1aad3b92ebbdaa6ff6aeda5b8da5f8e64e96405eb52a7f5",
6631
+ decimals: 18
6632
+ }
6633
+ ]
6634
+ },
6635
+ {
6636
+ name: "ezETH",
6637
+ symbol: "ezETH",
6638
+ icon: "ezeth.webp",
6639
+ networks: [
6640
+ {
6641
+ type: "ethereum",
6642
+ chainId: CHAIN_IDS.eth.mainnet,
6643
+ address: "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110",
6644
+ decimals: 18
6645
+ },
6646
+ {
6647
+ type: "fuel",
6648
+ chainId: CHAIN_IDS.fuel.mainnet,
6649
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6650
+ assetId: "0x91b3559edb2619cde8ffb2aa7b3c3be97efd794ea46700db7092abeee62281b0",
6651
+ decimals: 18
6652
+ }
6653
+ ]
6654
+ },
6655
+ {
6656
+ name: "pzETH",
6657
+ symbol: "pzETH",
6658
+ icon: "pzETH.webp",
6659
+ networks: [
6660
+ {
6661
+ type: "ethereum",
6662
+ chainId: CHAIN_IDS.eth.mainnet,
6663
+ address: "0x8c9532a60e0e7c6bbd2b2c1303f63ace1c3e9811",
6664
+ decimals: 18
6665
+ },
6666
+ {
6667
+ type: "fuel",
6668
+ chainId: CHAIN_IDS.fuel.mainnet,
6669
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6670
+ assetId: "0x1493d4ec82124de8f9b625682de69dcccda79e882b89a55a8c737b12de67bd68",
6671
+ decimals: 18
6672
+ }
6673
+ ]
6674
+ },
6675
+ {
6676
+ name: "Re7LRT",
6677
+ symbol: "Re7LRT",
6678
+ icon: "Re7LRT.png",
6679
+ networks: [
6680
+ {
6681
+ type: "ethereum",
6682
+ chainId: CHAIN_IDS.eth.mainnet,
6683
+ address: "0x84631c0d0081FDe56DeB72F6DE77abBbF6A9f93a",
6684
+ decimals: 18
6685
+ },
6686
+ {
6687
+ type: "fuel",
6688
+ chainId: CHAIN_IDS.fuel.mainnet,
6689
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6690
+ assetId: "0xf2fc648c23a5db24610a1cf696acc4f0f6d9a7d6028dd9944964ab23f6e35995",
6691
+ decimals: 18
6692
+ }
6693
+ ]
6694
+ },
6695
+ {
6696
+ name: "steakLRT",
6697
+ symbol: "steakLRT",
6698
+ icon: "steakLRT.png",
6699
+ networks: [
6700
+ {
6701
+ type: "ethereum",
6702
+ chainId: CHAIN_IDS.eth.mainnet,
6703
+ address: "0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc",
6704
+ decimals: 18
6705
+ },
6706
+ {
6707
+ type: "fuel",
6708
+ chainId: CHAIN_IDS.fuel.mainnet,
6709
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6710
+ assetId: "0x4fc8ac9f101df07e2c2dec4a53c8c42c439bdbe5e36ea2d863a61ff60afafc30",
6711
+ decimals: 18
6712
+ }
6713
+ ]
6714
+ }
6715
+ ];
6716
+ var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
6717
+
6718
+ // src/providers/utils/merge-quantities.ts
6719
+ var mergeQuantities = (...coinQuantities) => {
6720
+ const resultMap = {};
6721
+ function addToMap({ amount, assetId }) {
6722
+ if (resultMap[assetId]) {
6723
+ resultMap[assetId] = resultMap[assetId].add(amount);
6724
+ } else {
6725
+ resultMap[assetId] = amount;
6726
+ }
6727
+ }
6728
+ coinQuantities.forEach((arr) => arr.forEach(addToMap));
6729
+ return Object.entries(resultMap).map(([assetId, amount]) => ({ assetId, amount }));
6730
+ };
6731
+
6732
+ // src/utils/formatTransferToContractScriptData.ts
6733
+ import { BigNumberCoder as BigNumberCoder2 } from "@fuel-ts/abi-coder";
6734
+ import { BN as BN3 } from "@fuel-ts/math";
6735
+ import { arrayify as arrayify14 } from "@fuel-ts/utils";
6736
+ import * as asm from "@fuels/vm-asm";
6737
+ var formatTransferToContractScriptData = (params) => {
6738
+ const { assetId, amountToTransfer, hexlifiedContractId } = params;
6739
+ const numberCoder = new BigNumberCoder2("u64");
6740
+ const encoded = numberCoder.encode(new BN3(amountToTransfer).toNumber());
6741
+ const scriptData = Uint8Array.from([
6742
+ ...arrayify14(hexlifiedContractId),
6743
+ ...encoded,
6744
+ ...arrayify14(assetId)
6745
+ ]);
6746
+ return scriptData;
6747
+ };
6748
+ var assembleTransferToContractScript = async (params) => {
6749
+ const scriptData = formatTransferToContractScriptData(params);
6750
+ await asm.initWasm();
6751
+ const gtf2 = asm.gtf(16, 0, asm.GTFArgs.ScriptData);
6752
+ const addi2 = asm.addi(17, 16, 32);
6753
+ const lw2 = asm.lw(18, 17, 0);
6754
+ const addi22 = asm.addi(19, 17, 8);
6755
+ const tr2 = asm.tr(16, 18, 19);
6756
+ const ret2 = asm.ret(1);
6757
+ const script = Uint8Array.from([
6758
+ ...gtf2.to_bytes(),
6759
+ ...addi2.to_bytes(),
6760
+ ...lw2.to_bytes(),
6761
+ ...addi22.to_bytes(),
6762
+ ...tr2.to_bytes(),
6763
+ ...ret2.to_bytes()
6764
+ ]);
6765
+ return { script, scriptData };
6766
+ };
6767
+
6768
+ // src/account.ts
6769
+ var MAX_FUNDING_ATTEMPTS = 5;
6770
+ var Account = class extends AbstractAccount {
6771
+ /**
6772
+ * The address associated with the account.
6773
+ */
6774
+ address;
6775
+ /**
6776
+ * The provider used to interact with the network.
6777
+ */
6778
+ _provider;
6779
+ /**
6780
+ * The connector for use with external wallets
6781
+ */
6782
+ _connector;
6783
+ /**
5892
6784
  * Creates a new Account instance.
5893
6785
  *
5894
6786
  * @param address - The address of the account.
@@ -5910,7 +6802,7 @@ var Account = class extends AbstractAccount {
5910
6802
  */
5911
6803
  get provider() {
5912
6804
  if (!this._provider) {
5913
- throw new FuelError17(ErrorCode16.MISSING_PROVIDER, "Provider not set");
6805
+ throw new FuelError18(ErrorCode16.MISSING_PROVIDER, "Provider not set");
5914
6806
  }
5915
6807
  return this._provider;
5916
6808
  }
@@ -6028,7 +6920,7 @@ var Account = class extends AbstractAccount {
6028
6920
  );
6029
6921
  request.addResources(resources);
6030
6922
  request.updatePredicateGasUsed(estimatedPredicates);
6031
- const requestToReestimate2 = clone7(request);
6923
+ const requestToReestimate2 = clone9(request);
6032
6924
  if (addedSignatures) {
6033
6925
  Array.from({ length: addedSignatures }).forEach(
6034
6926
  () => requestToReestimate2.addEmptyWitness()
@@ -6061,13 +6953,13 @@ var Account = class extends AbstractAccount {
6061
6953
  fundingAttempts += 1;
6062
6954
  }
6063
6955
  if (needsToBeFunded) {
6064
- throw new FuelError17(
6956
+ throw new FuelError18(
6065
6957
  ErrorCode16.NOT_ENOUGH_FUNDS,
6066
6958
  `The account ${this.address} does not have enough base asset funds to cover the transaction execution.`
6067
6959
  );
6068
6960
  }
6069
6961
  request.updatePredicateGasUsed(estimatedPredicates);
6070
- const requestToReestimate = clone7(request);
6962
+ const requestToReestimate = clone9(request);
6071
6963
  if (addedSignatures) {
6072
6964
  Array.from({ length: addedSignatures }).forEach(() => requestToReestimate.addEmptyWitness());
6073
6965
  }
@@ -6167,7 +7059,7 @@ var Account = class extends AbstractAccount {
6167
7059
  */
6168
7060
  async transferToContract(contractId, amount, assetId, txParams = {}) {
6169
7061
  if (bn19(amount).lte(0)) {
6170
- throw new FuelError17(
7062
+ throw new FuelError18(
6171
7063
  ErrorCode16.INVALID_TRANSFER_AMOUNT,
6172
7064
  "Transfer amount must be a positive number."
6173
7065
  );
@@ -6207,14 +7099,14 @@ var Account = class extends AbstractAccount {
6207
7099
  */
6208
7100
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
6209
7101
  const recipientAddress = Address3.fromAddressOrString(recipient);
6210
- const recipientDataArray = arrayify14(
7102
+ const recipientDataArray = arrayify15(
6211
7103
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
6212
7104
  );
6213
- const amountDataArray = arrayify14(
7105
+ const amountDataArray = arrayify15(
6214
7106
  "0x".concat(bn19(amount).toHex().substring(2).padStart(16, "0"))
6215
7107
  );
6216
7108
  const script = new Uint8Array([
6217
- ...arrayify14(withdrawScript.bytes),
7109
+ ...arrayify15(withdrawScript.bytes),
6218
7110
  ...recipientDataArray,
6219
7111
  ...amountDataArray
6220
7112
  ]);
@@ -6243,7 +7135,7 @@ var Account = class extends AbstractAccount {
6243
7135
  * @returns A promise that resolves to the transaction cost object.
6244
7136
  */
6245
7137
  async getTransactionCost(transactionRequestLike, { signatureCallback, quantities = [] } = {}) {
6246
- const txRequestClone = clone7(transactionRequestify(transactionRequestLike));
7138
+ const txRequestClone = clone9(transactionRequestify(transactionRequestLike));
6247
7139
  const baseAssetId = this.provider.getBaseAssetId();
6248
7140
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
6249
7141
  const requiredQuantities = mergeQuantities(coinOutputsQuantities, quantities);
@@ -6294,7 +7186,7 @@ var Account = class extends AbstractAccount {
6294
7186
  */
6295
7187
  async signMessage(message) {
6296
7188
  if (!this._connector) {
6297
- throw new FuelError17(ErrorCode16.MISSING_CONNECTOR, "A connector is required to sign messages.");
7189
+ throw new FuelError18(ErrorCode16.MISSING_CONNECTOR, "A connector is required to sign messages.");
6298
7190
  }
6299
7191
  return this._connector.signMessage(this.address.toString(), message);
6300
7192
  }
@@ -6306,7 +7198,7 @@ var Account = class extends AbstractAccount {
6306
7198
  */
6307
7199
  async signTransaction(transactionRequestLike) {
6308
7200
  if (!this._connector) {
6309
- throw new FuelError17(
7201
+ throw new FuelError18(
6310
7202
  ErrorCode16.MISSING_CONNECTOR,
6311
7203
  "A connector is required to sign transactions."
6312
7204
  );
@@ -6356,7 +7248,7 @@ var Account = class extends AbstractAccount {
6356
7248
  */
6357
7249
  generateFakeResources(coins) {
6358
7250
  return coins.map((coin) => ({
6359
- id: hexlify14(randomBytes2(UTXO_ID_LEN3)),
7251
+ id: hexlify16(randomBytes2(UTXO_ID_LEN3)),
6360
7252
  owner: this.address,
6361
7253
  blockCreated: bn19(1),
6362
7254
  txCreatedIdx: bn19(1),
@@ -6366,7 +7258,7 @@ var Account = class extends AbstractAccount {
6366
7258
  /** @hidden * */
6367
7259
  validateTransferAmount(amount) {
6368
7260
  if (bn19(amount).lte(0)) {
6369
- throw new FuelError17(
7261
+ throw new FuelError18(
6370
7262
  ErrorCode16.INVALID_TRANSFER_AMOUNT,
6371
7263
  "Transfer amount must be a positive number."
6372
7264
  );
@@ -6396,7 +7288,7 @@ var Account = class extends AbstractAccount {
6396
7288
  if (!isDefined3(setGasLimit)) {
6397
7289
  request.gasLimit = gasUsed;
6398
7290
  } else if (gasUsed.gt(setGasLimit)) {
6399
- throw new FuelError17(
7291
+ throw new FuelError18(
6400
7292
  ErrorCode16.GAS_LIMIT_TOO_LOW,
6401
7293
  `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
6402
7294
  );
@@ -6404,7 +7296,7 @@ var Account = class extends AbstractAccount {
6404
7296
  if (!isDefined3(setMaxFee)) {
6405
7297
  request.maxFee = maxFee;
6406
7298
  } else if (maxFee.gt(setMaxFee)) {
6407
- throw new FuelError17(
7299
+ throw new FuelError18(
6408
7300
  ErrorCode16.MAX_FEE_TOO_LOW,
6409
7301
  `Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
6410
7302
  );
@@ -6415,14 +7307,14 @@ var Account = class extends AbstractAccount {
6415
7307
 
6416
7308
  // src/wallet/base-wallet-unlocked.ts
6417
7309
  import { hashMessage } from "@fuel-ts/hasher";
6418
- import { hexlify as hexlify17 } from "@fuel-ts/utils";
7310
+ import { hexlify as hexlify19 } from "@fuel-ts/utils";
6419
7311
 
6420
7312
  // src/signer/signer.ts
6421
7313
  import { Address as Address4 } from "@fuel-ts/address";
6422
7314
  import { randomBytes as randomBytes3 } from "@fuel-ts/crypto";
6423
- import { hash } from "@fuel-ts/hasher";
7315
+ import { hash as hash2 } from "@fuel-ts/hasher";
6424
7316
  import { toBytes } from "@fuel-ts/math";
6425
- import { hexlify as hexlify15, concat as concat3, arrayify as arrayify15 } from "@fuel-ts/utils";
7317
+ import { hexlify as hexlify17, concat as concat3, arrayify as arrayify16 } from "@fuel-ts/utils";
6426
7318
  import { secp256k1 } from "@noble/curves/secp256k1";
6427
7319
  var Signer = class {
6428
7320
  address;
@@ -6442,9 +7334,9 @@ var Signer = class {
6442
7334
  }
6443
7335
  }
6444
7336
  const privateKeyBytes = toBytes(privateKey, 32);
6445
- this.privateKey = hexlify15(privateKeyBytes);
6446
- this.publicKey = hexlify15(secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
6447
- this.compressedPublicKey = hexlify15(secp256k1.getPublicKey(privateKeyBytes, true));
7337
+ this.privateKey = hexlify17(privateKeyBytes);
7338
+ this.publicKey = hexlify17(secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
7339
+ this.compressedPublicKey = hexlify17(secp256k1.getPublicKey(privateKeyBytes, true));
6448
7340
  this.address = Address4.fromPublicKey(this.publicKey);
6449
7341
  }
6450
7342
  /**
@@ -6458,11 +7350,11 @@ var Signer = class {
6458
7350
  * @returns hashed signature
6459
7351
  */
6460
7352
  sign(data) {
6461
- const signature = secp256k1.sign(arrayify15(data), arrayify15(this.privateKey));
7353
+ const signature = secp256k1.sign(arrayify16(data), arrayify16(this.privateKey));
6462
7354
  const r = toBytes(`0x${signature.r.toString(16)}`, 32);
6463
7355
  const s = toBytes(`0x${signature.s.toString(16)}`, 32);
6464
7356
  s[0] |= (signature.recovery || 0) << 7;
6465
- return hexlify15(concat3([r, s]));
7357
+ return hexlify17(concat3([r, s]));
6466
7358
  }
6467
7359
  /**
6468
7360
  * Add point on the current elliptic curve
@@ -6471,8 +7363,8 @@ var Signer = class {
6471
7363
  * @returns compressed point on the curve
6472
7364
  */
6473
7365
  addPoint(point) {
6474
- const p0 = secp256k1.ProjectivePoint.fromHex(arrayify15(this.compressedPublicKey));
6475
- const p1 = secp256k1.ProjectivePoint.fromHex(arrayify15(point));
7366
+ const p0 = secp256k1.ProjectivePoint.fromHex(arrayify16(this.compressedPublicKey));
7367
+ const p1 = secp256k1.ProjectivePoint.fromHex(arrayify16(point));
6476
7368
  const result = p0.add(p1);
6477
7369
  return `0x${result.toHex(true)}`;
6478
7370
  }
@@ -6484,16 +7376,16 @@ var Signer = class {
6484
7376
  * @returns public key from signature from the
6485
7377
  */
6486
7378
  static recoverPublicKey(data, signature) {
6487
- const signedMessageBytes = arrayify15(signature);
7379
+ const signedMessageBytes = arrayify16(signature);
6488
7380
  const r = signedMessageBytes.slice(0, 32);
6489
7381
  const s = signedMessageBytes.slice(32, 64);
6490
7382
  const recoveryParam = (s[0] & 128) >> 7;
6491
7383
  s[0] &= 127;
6492
- const sig = new secp256k1.Signature(BigInt(hexlify15(r)), BigInt(hexlify15(s))).addRecoveryBit(
7384
+ const sig = new secp256k1.Signature(BigInt(hexlify17(r)), BigInt(hexlify17(s))).addRecoveryBit(
6493
7385
  recoveryParam
6494
7386
  );
6495
- const publicKey = sig.recoverPublicKey(arrayify15(data)).toRawBytes(false).slice(1);
6496
- return hexlify15(publicKey);
7387
+ const publicKey = sig.recoverPublicKey(arrayify16(data)).toRawBytes(false).slice(1);
7388
+ return hexlify17(publicKey);
6497
7389
  }
6498
7390
  /**
6499
7391
  * Recover the address from a signature performed with [`sign`](#sign).
@@ -6512,7 +7404,7 @@ var Signer = class {
6512
7404
  * @returns random 32-byte hashed
6513
7405
  */
6514
7406
  static generatePrivateKey(entropy) {
6515
- return entropy ? hash(concat3([randomBytes3(32), arrayify15(entropy)])) : randomBytes3(32);
7407
+ return entropy ? hash2(concat3([randomBytes3(32), arrayify16(entropy)])) : randomBytes3(32);
6516
7408
  }
6517
7409
  /**
6518
7410
  * Extended publicKey from a compact publicKey
@@ -6521,8 +7413,8 @@ var Signer = class {
6521
7413
  * @returns extended publicKey
6522
7414
  */
6523
7415
  static extendPublicKey(publicKey) {
6524
- const point = secp256k1.ProjectivePoint.fromHex(arrayify15(publicKey));
6525
- return hexlify15(point.toRawBytes(false).slice(1));
7416
+ const point = secp256k1.ProjectivePoint.fromHex(arrayify16(publicKey));
7417
+ return hexlify17(point.toRawBytes(false).slice(1));
6526
7418
  }
6527
7419
  };
6528
7420
 
@@ -6538,8 +7430,8 @@ import {
6538
7430
  encryptJsonWalletData,
6539
7431
  randomUUID
6540
7432
  } from "@fuel-ts/crypto";
6541
- import { ErrorCode as ErrorCode17, FuelError as FuelError18 } from "@fuel-ts/errors";
6542
- import { hexlify as hexlify16 } from "@fuel-ts/utils";
7433
+ import { ErrorCode as ErrorCode17, FuelError as FuelError19 } from "@fuel-ts/errors";
7434
+ import { hexlify as hexlify18 } from "@fuel-ts/utils";
6543
7435
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
6544
7436
  var DEFAULT_KDF_PARAMS_R = 8;
6545
7437
  var DEFAULT_KDF_PARAMS_P = 1;
@@ -6615,13 +7507,13 @@ async function decryptKeystoreWallet(jsonWallet, password) {
6615
7507
  const macHashUint8Array = keccak256(data);
6616
7508
  const macHash = stringFromBuffer(macHashUint8Array, "hex");
6617
7509
  if (mac !== macHash) {
6618
- throw new FuelError18(
7510
+ throw new FuelError19(
6619
7511
  ErrorCode17.INVALID_PASSWORD,
6620
7512
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
6621
7513
  );
6622
7514
  }
6623
7515
  const buffer = await decryptJsonWalletData(ciphertextBuffer, key, ivBuffer);
6624
- const privateKey = hexlify16(buffer);
7516
+ const privateKey = hexlify18(buffer);
6625
7517
  return privateKey;
6626
7518
  }
6627
7519
 
@@ -6666,7 +7558,7 @@ var BaseWalletUnlocked = class extends Account {
6666
7558
  */
6667
7559
  async signMessage(message) {
6668
7560
  const signedMessage = await this.signer().sign(hashMessage(message));
6669
- return hexlify17(signedMessage);
7561
+ return hexlify19(signedMessage);
6670
7562
  }
6671
7563
  /**
6672
7564
  * Signs a transaction with the wallet's private key.
@@ -6679,7 +7571,7 @@ var BaseWalletUnlocked = class extends Account {
6679
7571
  const chainId = this.provider.getChainId();
6680
7572
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
6681
7573
  const signature = await this.signer().sign(hashedTransaction);
6682
- return hexlify17(signature);
7574
+ return hexlify19(signature);
6683
7575
  }
6684
7576
  /**
6685
7577
  * Populates a transaction with the witnesses signature.
@@ -6746,16 +7638,16 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
6746
7638
 
6747
7639
  // src/hdwallet/hdwallet.ts
6748
7640
  import { computeHmac as computeHmac2, ripemd160 } from "@fuel-ts/crypto";
6749
- import { ErrorCode as ErrorCode20, FuelError as FuelError21 } from "@fuel-ts/errors";
7641
+ import { ErrorCode as ErrorCode20, FuelError as FuelError22 } from "@fuel-ts/errors";
6750
7642
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
6751
7643
  import { bn as bn20, toBytes as toBytes2, toHex } from "@fuel-ts/math";
6752
- import { arrayify as arrayify18, hexlify as hexlify19, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
7644
+ import { arrayify as arrayify19, hexlify as hexlify21, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
6753
7645
 
6754
7646
  // src/mnemonic/mnemonic.ts
6755
7647
  import { randomBytes as randomBytes5, pbkdf2, computeHmac } from "@fuel-ts/crypto";
6756
- import { ErrorCode as ErrorCode19, FuelError as FuelError20 } from "@fuel-ts/errors";
7648
+ import { ErrorCode as ErrorCode19, FuelError as FuelError21 } from "@fuel-ts/errors";
6757
7649
  import { sha256 as sha2563 } from "@fuel-ts/hasher";
6758
- import { arrayify as arrayify17, hexlify as hexlify18, concat as concat4, dataSlice, encodeBase58, toUtf8Bytes } from "@fuel-ts/utils";
7650
+ import { arrayify as arrayify18, hexlify as hexlify20, concat as concat4, dataSlice, encodeBase58, toUtf8Bytes } from "@fuel-ts/utils";
6759
7651
 
6760
7652
  // src/wordlists/words/english.ts
6761
7653
  var english = [
@@ -8816,9 +9708,9 @@ var Language = /* @__PURE__ */ ((Language2) => {
8816
9708
  })(Language || {});
8817
9709
 
8818
9710
  // src/mnemonic/utils.ts
8819
- import { ErrorCode as ErrorCode18, FuelError as FuelError19 } from "@fuel-ts/errors";
9711
+ import { ErrorCode as ErrorCode18, FuelError as FuelError20 } from "@fuel-ts/errors";
8820
9712
  import { sha256 as sha2562 } from "@fuel-ts/hasher";
8821
- import { arrayify as arrayify16 } from "@fuel-ts/utils";
9713
+ import { arrayify as arrayify17 } from "@fuel-ts/utils";
8822
9714
  function getLowerMask(bits) {
8823
9715
  return (1 << bits) - 1;
8824
9716
  }
@@ -8853,19 +9745,19 @@ function entropyToMnemonicIndices(entropy) {
8853
9745
  }
8854
9746
  }
8855
9747
  const checksumBits = entropy.length / 4;
8856
- const checksum = arrayify16(sha2562(entropy))[0] & getUpperMask(checksumBits);
9748
+ const checksum = arrayify17(sha2562(entropy))[0] & getUpperMask(checksumBits);
8857
9749
  indices[indices.length - 1] <<= checksumBits;
8858
9750
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
8859
9751
  return indices;
8860
9752
  }
8861
9753
  function mnemonicWordsToEntropy(words, wordlist) {
8862
9754
  const size = Math.ceil(11 * words.length / 8);
8863
- const entropy = arrayify16(new Uint8Array(size));
9755
+ const entropy = arrayify17(new Uint8Array(size));
8864
9756
  let offset = 0;
8865
9757
  for (let i = 0; i < words.length; i += 1) {
8866
9758
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
8867
9759
  if (index === -1) {
8868
- throw new FuelError19(
9760
+ throw new FuelError20(
8869
9761
  ErrorCode18.INVALID_MNEMONIC,
8870
9762
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
8871
9763
  );
@@ -8880,9 +9772,9 @@ function mnemonicWordsToEntropy(words, wordlist) {
8880
9772
  const entropyBits = 32 * words.length / 3;
8881
9773
  const checksumBits = words.length / 3;
8882
9774
  const checksumMask = getUpperMask(checksumBits);
8883
- const checksum = arrayify16(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
9775
+ const checksum = arrayify17(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
8884
9776
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
8885
- throw new FuelError19(
9777
+ throw new FuelError20(
8886
9778
  ErrorCode18.INVALID_CHECKSUM,
8887
9779
  "Checksum validation failed for the provided mnemonic."
8888
9780
  );
@@ -8897,7 +9789,7 @@ var TestnetPRV = "0x04358394";
8897
9789
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
8898
9790
  function assertWordList(wordlist) {
8899
9791
  if (wordlist.length !== 2048) {
8900
- throw new FuelError20(
9792
+ throw new FuelError21(
8901
9793
  ErrorCode19.INVALID_WORD_LIST,
8902
9794
  `Expected word list length of 2048, but got ${wordlist.length}.`
8903
9795
  );
@@ -8905,7 +9797,7 @@ function assertWordList(wordlist) {
8905
9797
  }
8906
9798
  function assertEntropy(entropy) {
8907
9799
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
8908
- throw new FuelError20(
9800
+ throw new FuelError21(
8909
9801
  ErrorCode19.INVALID_ENTROPY,
8910
9802
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
8911
9803
  );
@@ -8916,7 +9808,7 @@ function assertMnemonic(words) {
8916
9808
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
8917
9809
  ", "
8918
9810
  )}] words, but got ${words.length}.`;
8919
- throw new FuelError20(ErrorCode19.INVALID_MNEMONIC, errorMsg);
9811
+ throw new FuelError21(ErrorCode19.INVALID_MNEMONIC, errorMsg);
8920
9812
  }
8921
9813
  }
8922
9814
  var Mnemonic = class {
@@ -8955,7 +9847,7 @@ var Mnemonic = class {
8955
9847
  static mnemonicToEntropy(phrase, wordlist = english) {
8956
9848
  const words = getWords(phrase);
8957
9849
  assertMnemonic(words);
8958
- return hexlify18(mnemonicWordsToEntropy(words, wordlist));
9850
+ return hexlify20(mnemonicWordsToEntropy(words, wordlist));
8959
9851
  }
8960
9852
  /**
8961
9853
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -8963,7 +9855,7 @@ var Mnemonic = class {
8963
9855
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
8964
9856
  */
8965
9857
  static entropyToMnemonic(entropy, wordlist = english) {
8966
- const entropyBytes = arrayify17(entropy);
9858
+ const entropyBytes = arrayify18(entropy);
8967
9859
  assertWordList(wordlist);
8968
9860
  assertEntropy(entropyBytes);
8969
9861
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -9032,14 +9924,14 @@ var Mnemonic = class {
9032
9924
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
9033
9925
  */
9034
9926
  static masterKeysFromSeed(seed) {
9035
- const seedArray = arrayify17(seed);
9927
+ const seedArray = arrayify18(seed);
9036
9928
  if (seedArray.length < 16 || seedArray.length > 64) {
9037
- throw new FuelError20(
9929
+ throw new FuelError21(
9038
9930
  ErrorCode19.INVALID_SEED,
9039
9931
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
9040
9932
  );
9041
9933
  }
9042
- return arrayify17(computeHmac("sha512", MasterSecret, seedArray));
9934
+ return arrayify18(computeHmac("sha512", MasterSecret, seedArray));
9043
9935
  }
9044
9936
  /**
9045
9937
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -9050,7 +9942,7 @@ var Mnemonic = class {
9050
9942
  */
9051
9943
  static seedToExtendedKey(seed, testnet = false) {
9052
9944
  const masterKey = Mnemonic.masterKeysFromSeed(seed);
9053
- const prefix = arrayify17(testnet ? TestnetPRV : MainnetPRV);
9945
+ const prefix = arrayify18(testnet ? TestnetPRV : MainnetPRV);
9054
9946
  const depth = "0x00";
9055
9947
  const fingerprint = "0x00000000";
9056
9948
  const index = "0x00000000";
@@ -9080,7 +9972,7 @@ var Mnemonic = class {
9080
9972
  * @returns A randomly generated mnemonic
9081
9973
  */
9082
9974
  static generate(size = 32, extraEntropy = "") {
9083
- const entropy = extraEntropy ? sha2563(concat4([randomBytes5(size), arrayify17(extraEntropy)])) : randomBytes5(size);
9975
+ const entropy = extraEntropy ? sha2563(concat4([randomBytes5(size), arrayify18(extraEntropy)])) : randomBytes5(size);
9084
9976
  return Mnemonic.entropyToMnemonic(entropy);
9085
9977
  }
9086
9978
  };
@@ -9088,10 +9980,10 @@ var mnemonic_default = Mnemonic;
9088
9980
 
9089
9981
  // src/hdwallet/hdwallet.ts
9090
9982
  var HARDENED_INDEX = 2147483648;
9091
- var MainnetPRV2 = hexlify19("0x0488ade4");
9092
- var MainnetPUB = hexlify19("0x0488b21e");
9093
- var TestnetPRV2 = hexlify19("0x04358394");
9094
- var TestnetPUB = hexlify19("0x043587cf");
9983
+ var MainnetPRV2 = hexlify21("0x0488ade4");
9984
+ var MainnetPUB = hexlify21("0x0488b21e");
9985
+ var TestnetPRV2 = hexlify21("0x04358394");
9986
+ var TestnetPUB = hexlify21("0x043587cf");
9095
9987
  function base58check(data) {
9096
9988
  return encodeBase582(concat5([data, dataSlice2(sha2564(sha2564(data)), 0, 4)]));
9097
9989
  }
@@ -9102,17 +9994,17 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
9102
9994
  return testnet ? TestnetPRV2 : MainnetPRV2;
9103
9995
  }
9104
9996
  function isPublicExtendedKey(extendedKey) {
9105
- return [MainnetPUB, TestnetPUB].includes(hexlify19(extendedKey.slice(0, 4)));
9997
+ return [MainnetPUB, TestnetPUB].includes(hexlify21(extendedKey.slice(0, 4)));
9106
9998
  }
9107
9999
  function isValidExtendedKey(extendedKey) {
9108
10000
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
9109
- hexlify19(extendedKey.slice(0, 4))
10001
+ hexlify21(extendedKey.slice(0, 4))
9110
10002
  );
9111
10003
  }
9112
10004
  function parsePath(path, depth = 0) {
9113
10005
  const components = path.split("/");
9114
10006
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
9115
- throw new FuelError21(ErrorCode20.HD_WALLET_ERROR, `invalid path - ${path}`);
10007
+ throw new FuelError22(ErrorCode20.HD_WALLET_ERROR, `invalid path - ${path}`);
9116
10008
  }
9117
10009
  if (components[0] === "m") {
9118
10010
  components.shift();
@@ -9124,8 +10016,8 @@ function parsePath(path, depth = 0) {
9124
10016
  var HDWallet = class {
9125
10017
  depth = 0;
9126
10018
  index = 0;
9127
- fingerprint = hexlify19("0x00000000");
9128
- parentFingerprint = hexlify19("0x00000000");
10019
+ fingerprint = hexlify21("0x00000000");
10020
+ parentFingerprint = hexlify21("0x00000000");
9129
10021
  privateKey;
9130
10022
  publicKey;
9131
10023
  chainCode;
@@ -9137,16 +10029,16 @@ var HDWallet = class {
9137
10029
  constructor(config) {
9138
10030
  if (config.privateKey) {
9139
10031
  const signer = new Signer(config.privateKey);
9140
- this.publicKey = hexlify19(signer.compressedPublicKey);
9141
- this.privateKey = hexlify19(config.privateKey);
10032
+ this.publicKey = hexlify21(signer.compressedPublicKey);
10033
+ this.privateKey = hexlify21(config.privateKey);
9142
10034
  } else {
9143
10035
  if (!config.publicKey) {
9144
- throw new FuelError21(
10036
+ throw new FuelError22(
9145
10037
  ErrorCode20.HD_WALLET_ERROR,
9146
10038
  "Both public and private Key cannot be missing. At least one should be provided."
9147
10039
  );
9148
10040
  }
9149
- this.publicKey = hexlify19(config.publicKey);
10041
+ this.publicKey = hexlify21(config.publicKey);
9150
10042
  }
9151
10043
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
9152
10044
  this.fingerprint = dataSlice2(ripemd160(sha2564(this.publicKey)), 0, 4);
@@ -9165,23 +10057,23 @@ var HDWallet = class {
9165
10057
  * @returns A new instance of HDWallet on the derived index
9166
10058
  */
9167
10059
  deriveIndex(index) {
9168
- const privateKey = this.privateKey && arrayify18(this.privateKey);
9169
- const publicKey = arrayify18(this.publicKey);
9170
- const chainCode = arrayify18(this.chainCode);
10060
+ const privateKey = this.privateKey && arrayify19(this.privateKey);
10061
+ const publicKey = arrayify19(this.publicKey);
10062
+ const chainCode = arrayify19(this.chainCode);
9171
10063
  const data = new Uint8Array(37);
9172
10064
  if (index & HARDENED_INDEX) {
9173
10065
  if (!privateKey) {
9174
- throw new FuelError21(
10066
+ throw new FuelError22(
9175
10067
  ErrorCode20.HD_WALLET_ERROR,
9176
10068
  "Cannot derive a hardened index without a private Key."
9177
10069
  );
9178
10070
  }
9179
10071
  data.set(privateKey, 1);
9180
10072
  } else {
9181
- data.set(arrayify18(this.publicKey));
10073
+ data.set(arrayify19(this.publicKey));
9182
10074
  }
9183
10075
  data.set(toBytes2(index, 4), 33);
9184
- const bytes = arrayify18(computeHmac2("sha512", chainCode, data));
10076
+ const bytes = arrayify19(computeHmac2("sha512", chainCode, data));
9185
10077
  const IL = bytes.slice(0, 32);
9186
10078
  const IR = bytes.slice(32);
9187
10079
  if (privateKey) {
@@ -9195,7 +10087,7 @@ var HDWallet = class {
9195
10087
  parentFingerprint: this.fingerprint
9196
10088
  });
9197
10089
  }
9198
- const signer = new Signer(hexlify19(IL));
10090
+ const signer = new Signer(hexlify21(IL));
9199
10091
  const Ki = signer.addPoint(publicKey);
9200
10092
  return new HDWallet({
9201
10093
  publicKey: Ki,
@@ -9224,18 +10116,18 @@ var HDWallet = class {
9224
10116
  */
9225
10117
  toExtendedKey(isPublic = false, testnet = false) {
9226
10118
  if (this.depth >= 256) {
9227
- throw new FuelError21(
10119
+ throw new FuelError22(
9228
10120
  ErrorCode20.HD_WALLET_ERROR,
9229
10121
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
9230
10122
  );
9231
10123
  }
9232
10124
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
9233
- const depth = hexlify19(Uint8Array.from([this.depth]));
10125
+ const depth = hexlify21(Uint8Array.from([this.depth]));
9234
10126
  const parentFingerprint = this.parentFingerprint;
9235
10127
  const index = toHex(this.index, 4);
9236
10128
  const chainCode = this.chainCode;
9237
10129
  const key = this.privateKey != null && !isPublic ? concat5(["0x00", this.privateKey]) : this.publicKey;
9238
- const extendedKey = arrayify18(concat5([prefix, depth, parentFingerprint, index, chainCode, key]));
10130
+ const extendedKey = arrayify19(concat5([prefix, depth, parentFingerprint, index, chainCode, key]));
9239
10131
  return base58check(extendedKey);
9240
10132
  }
9241
10133
  /**
@@ -9247,34 +10139,34 @@ var HDWallet = class {
9247
10139
  static fromSeed(seed) {
9248
10140
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
9249
10141
  return new HDWallet({
9250
- chainCode: arrayify18(masterKey.slice(32)),
9251
- privateKey: arrayify18(masterKey.slice(0, 32))
10142
+ chainCode: arrayify19(masterKey.slice(32)),
10143
+ privateKey: arrayify19(masterKey.slice(0, 32))
9252
10144
  });
9253
10145
  }
9254
10146
  static fromExtendedKey(extendedKey) {
9255
- const decoded = hexlify19(toBytes2(decodeBase58(extendedKey)));
9256
- const bytes = arrayify18(decoded);
10147
+ const decoded = hexlify21(toBytes2(decodeBase58(extendedKey)));
10148
+ const bytes = arrayify19(decoded);
9257
10149
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
9258
10150
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
9259
- throw new FuelError21(ErrorCode20.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
10151
+ throw new FuelError22(ErrorCode20.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
9260
10152
  }
9261
10153
  if (!validChecksum) {
9262
- throw new FuelError21(ErrorCode20.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
10154
+ throw new FuelError22(ErrorCode20.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
9263
10155
  }
9264
10156
  const depth = bytes[4];
9265
- const parentFingerprint = hexlify19(bytes.slice(5, 9));
9266
- const index = parseInt(hexlify19(bytes.slice(9, 13)).substring(2), 16);
9267
- const chainCode = hexlify19(bytes.slice(13, 45));
10157
+ const parentFingerprint = hexlify21(bytes.slice(5, 9));
10158
+ const index = parseInt(hexlify21(bytes.slice(9, 13)).substring(2), 16);
10159
+ const chainCode = hexlify21(bytes.slice(13, 45));
9268
10160
  const key = bytes.slice(45, 78);
9269
10161
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
9270
- throw new FuelError21(
10162
+ throw new FuelError22(
9271
10163
  ErrorCode20.HD_WALLET_ERROR,
9272
10164
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
9273
10165
  );
9274
10166
  }
9275
10167
  if (isPublicExtendedKey(bytes)) {
9276
10168
  if (key[0] !== 3) {
9277
- throw new FuelError21(ErrorCode20.HD_WALLET_ERROR, "Invalid public extended key.");
10169
+ throw new FuelError22(ErrorCode20.HD_WALLET_ERROR, "Invalid public extended key.");
9278
10170
  }
9279
10171
  return new HDWallet({
9280
10172
  publicKey: key,
@@ -9285,7 +10177,7 @@ var HDWallet = class {
9285
10177
  });
9286
10178
  }
9287
10179
  if (key[0] !== 0) {
9288
- throw new FuelError21(ErrorCode20.HD_WALLET_ERROR, "Invalid private extended key.");
10180
+ throw new FuelError22(ErrorCode20.HD_WALLET_ERROR, "Invalid private extended key.");
9289
10181
  }
9290
10182
  return new HDWallet({
9291
10183
  privateKey: key.slice(1),
@@ -9453,7 +10345,7 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
9453
10345
  // src/wallet-manager/wallet-manager.ts
9454
10346
  import { Address as Address8 } from "@fuel-ts/address";
9455
10347
  import { encrypt, decrypt } from "@fuel-ts/crypto";
9456
- import { ErrorCode as ErrorCode23, FuelError as FuelError24 } from "@fuel-ts/errors";
10348
+ import { ErrorCode as ErrorCode23, FuelError as FuelError25 } from "@fuel-ts/errors";
9457
10349
  import { EventEmitter } from "events";
9458
10350
 
9459
10351
  // src/wallet-manager/storages/memory-storage.ts
@@ -9476,7 +10368,7 @@ var MemoryStorage = class {
9476
10368
 
9477
10369
  // src/wallet-manager/vaults/mnemonic-vault.ts
9478
10370
  import { Address as Address6 } from "@fuel-ts/address";
9479
- import { ErrorCode as ErrorCode21, FuelError as FuelError22 } from "@fuel-ts/errors";
10371
+ import { ErrorCode as ErrorCode21, FuelError as FuelError23 } from "@fuel-ts/errors";
9480
10372
  var _secret;
9481
10373
  var MnemonicVault = class {
9482
10374
  constructor(options) {
@@ -9532,7 +10424,7 @@ var MnemonicVault = class {
9532
10424
  }
9533
10425
  numberOfAccounts += 1;
9534
10426
  } while (numberOfAccounts < this.numberOfAccounts);
9535
- throw new FuelError22(
10427
+ throw new FuelError23(
9536
10428
  ErrorCode21.WALLET_MANAGER_ERROR,
9537
10429
  `Account with address '${address}' not found in derived wallets.`
9538
10430
  );
@@ -9547,7 +10439,7 @@ __publicField(MnemonicVault, "type", "mnemonic");
9547
10439
 
9548
10440
  // src/wallet-manager/vaults/privatekey-vault.ts
9549
10441
  import { Address as Address7 } from "@fuel-ts/address";
9550
- import { ErrorCode as ErrorCode22, FuelError as FuelError23 } from "@fuel-ts/errors";
10442
+ import { ErrorCode as ErrorCode22, FuelError as FuelError24 } from "@fuel-ts/errors";
9551
10443
  var _privateKeys;
9552
10444
  var PrivateKeyVault = class {
9553
10445
  /**
@@ -9588,7 +10480,7 @@ var PrivateKeyVault = class {
9588
10480
  (pk) => Wallet.fromPrivateKey(pk).address.equals(ownerAddress)
9589
10481
  );
9590
10482
  if (!privateKey) {
9591
- throw new FuelError23(
10483
+ throw new FuelError24(
9592
10484
  ErrorCode22.WALLET_MANAGER_ERROR,
9593
10485
  `No private key found for address '${address}'.`
9594
10486
  );
@@ -9613,7 +10505,7 @@ var ERROR_MESSAGES = {
9613
10505
  };
9614
10506
  function assert(condition, message) {
9615
10507
  if (!condition) {
9616
- throw new FuelError24(ErrorCode23.WALLET_MANAGER_ERROR, message);
10508
+ throw new FuelError25(ErrorCode23.WALLET_MANAGER_ERROR, message);
9617
10509
  }
9618
10510
  }
9619
10511
  var _vaults, _passphrase, _isLocked, _serializeVaults, serializeVaults_fn, _deserializeVaults, deserializeVaults_fn;
@@ -9839,25 +10731,25 @@ deserializeVaults_fn = function(vaults) {
9839
10731
  __publicField(WalletManager, "Vaults", [MnemonicVault, PrivateKeyVault]);
9840
10732
 
9841
10733
  // src/wallet-manager/types.ts
9842
- import { ErrorCode as ErrorCode24, FuelError as FuelError25 } from "@fuel-ts/errors";
10734
+ import { ErrorCode as ErrorCode24, FuelError as FuelError26 } from "@fuel-ts/errors";
9843
10735
  var Vault = class {
9844
10736
  constructor(_options) {
9845
- throw new FuelError25(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
10737
+ throw new FuelError26(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
9846
10738
  }
9847
10739
  serialize() {
9848
- throw new FuelError25(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
10740
+ throw new FuelError26(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
9849
10741
  }
9850
10742
  getAccounts() {
9851
- throw new FuelError25(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
10743
+ throw new FuelError26(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
9852
10744
  }
9853
10745
  addAccount() {
9854
- throw new FuelError25(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
10746
+ throw new FuelError26(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
9855
10747
  }
9856
10748
  exportAccount(_address) {
9857
- throw new FuelError25(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
10749
+ throw new FuelError26(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
9858
10750
  }
9859
10751
  getWallet(_address) {
9860
- throw new FuelError25(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
10752
+ throw new FuelError26(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
9861
10753
  }
9862
10754
  };
9863
10755
  __publicField(Vault, "type");
@@ -9867,19 +10759,19 @@ var StorageAbstract = class {
9867
10759
  // src/predicate/predicate.ts
9868
10760
  import { Interface as Interface4 } from "@fuel-ts/abi-coder";
9869
10761
  import { Address as Address9 } from "@fuel-ts/address";
9870
- import { ErrorCode as ErrorCode25, FuelError as FuelError26 } from "@fuel-ts/errors";
9871
- import { arrayify as arrayify20, hexlify as hexlify21 } from "@fuel-ts/utils";
10762
+ import { ErrorCode as ErrorCode25, FuelError as FuelError27 } from "@fuel-ts/errors";
10763
+ import { arrayify as arrayify21, hexlify as hexlify23 } from "@fuel-ts/utils";
9872
10764
 
9873
10765
  // src/predicate/utils/getPredicateRoot.ts
9874
- import { hash as hash2 } from "@fuel-ts/hasher";
10766
+ import { hash as hash3 } from "@fuel-ts/hasher";
9875
10767
  import { calcRoot } from "@fuel-ts/merkle";
9876
- import { chunkAndPadBytes, hexlify as hexlify20, concat as concat6, arrayify as arrayify19 } from "@fuel-ts/utils";
10768
+ import { chunkAndPadBytes, hexlify as hexlify22, concat as concat6, arrayify as arrayify20 } from "@fuel-ts/utils";
9877
10769
  var getPredicateRoot = (bytecode) => {
9878
10770
  const chunkSize = 16 * 1024;
9879
- const bytes = arrayify19(bytecode);
10771
+ const bytes = arrayify20(bytecode);
9880
10772
  const chunks = chunkAndPadBytes(bytes, chunkSize);
9881
- const codeRoot = calcRoot(chunks.map((c) => hexlify20(c)));
9882
- const predicateRoot = hash2(concat6(["0x4655454C", codeRoot]));
10773
+ const codeRoot = calcRoot(chunks.map((c) => hexlify22(c)));
10774
+ const predicateRoot = hash3(concat6(["0x4655454C", codeRoot]));
9883
10775
  return predicateRoot;
9884
10776
  };
9885
10777
 
@@ -9931,8 +10823,8 @@ var Predicate = class extends Account {
9931
10823
  }
9932
10824
  request.inputs.filter(isRequestInputCoinOrMessage).forEach((input) => {
9933
10825
  if (isRequestInputResourceFromOwner(input, this.address)) {
9934
- input.predicate = hexlify21(this.bytes);
9935
- input.predicateData = hexlify21(this.getPredicateData());
10826
+ input.predicate = hexlify23(this.bytes);
10827
+ input.predicateData = hexlify23(this.getPredicateData());
9936
10828
  input.witnessIndex = 0;
9937
10829
  }
9938
10830
  });
@@ -9974,12 +10866,12 @@ var Predicate = class extends Account {
9974
10866
  * @returns An object containing the new predicate bytes and interface.
9975
10867
  */
9976
10868
  static processPredicateData(bytes, jsonAbi, configurableConstants) {
9977
- let predicateBytes = arrayify20(bytes);
10869
+ let predicateBytes = arrayify21(bytes);
9978
10870
  let abiInterface;
9979
10871
  if (jsonAbi) {
9980
10872
  abiInterface = new Interface4(jsonAbi);
9981
10873
  if (abiInterface.functions.main === void 0) {
9982
- throw new FuelError26(
10874
+ throw new FuelError27(
9983
10875
  ErrorCode25.ABI_MAIN_METHOD_MISSING,
9984
10876
  'Cannot use ABI without "main" function.'
9985
10877
  );
@@ -10012,8 +10904,8 @@ var Predicate = class extends Account {
10012
10904
  );
10013
10905
  return resources.map((resource) => ({
10014
10906
  ...resource,
10015
- predicate: hexlify21(this.bytes),
10016
- predicateData: hexlify21(this.getPredicateData())
10907
+ predicate: hexlify23(this.bytes),
10908
+ predicateData: hexlify23(this.getPredicateData())
10017
10909
  }));
10018
10910
  }
10019
10911
  /**
@@ -10025,8 +10917,8 @@ var Predicate = class extends Account {
10025
10917
  generateFakeResources(coins) {
10026
10918
  return super.generateFakeResources(coins).map((coin) => ({
10027
10919
  ...coin,
10028
- predicate: hexlify21(this.bytes),
10029
- predicateData: hexlify21(this.getPredicateData())
10920
+ predicate: hexlify23(this.bytes),
10921
+ predicateData: hexlify23(this.getPredicateData())
10030
10922
  }));
10031
10923
  }
10032
10924
  /**
@@ -10041,20 +10933,20 @@ var Predicate = class extends Account {
10041
10933
  const mutatedBytes = bytes;
10042
10934
  try {
10043
10935
  if (!abiInterface) {
10044
- throw new FuelError26(
10936
+ throw new FuelError27(
10045
10937
  ErrorCode25.INVALID_CONFIGURABLE_CONSTANTS,
10046
10938
  "Cannot validate configurable constants because the Predicate was instantiated without a JSON ABI"
10047
10939
  );
10048
10940
  }
10049
10941
  if (Object.keys(abiInterface.configurables).length === 0) {
10050
- throw new FuelError26(
10942
+ throw new FuelError27(
10051
10943
  ErrorCode25.INVALID_CONFIGURABLE_CONSTANTS,
10052
10944
  "Predicate has no configurable constants to be set"
10053
10945
  );
10054
10946
  }
10055
10947
  Object.entries(configurableConstants).forEach(([key, value]) => {
10056
10948
  if (!abiInterface?.configurables[key]) {
10057
- throw new FuelError26(
10949
+ throw new FuelError27(
10058
10950
  ErrorCode25.CONFIGURABLE_NOT_FOUND,
10059
10951
  `No configurable constant named '${key}' found in the Predicate`
10060
10952
  );
@@ -10064,7 +10956,7 @@ var Predicate = class extends Account {
10064
10956
  mutatedBytes.set(encoded, offset);
10065
10957
  });
10066
10958
  } catch (err) {
10067
- throw new FuelError26(
10959
+ throw new FuelError27(
10068
10960
  ErrorCode25.INVALID_CONFIGURABLE_CONSTANTS,
10069
10961
  `Error setting configurable constants: ${err.message}.`
10070
10962
  );
@@ -10096,10 +10988,10 @@ var Predicate = class extends Account {
10096
10988
  };
10097
10989
 
10098
10990
  // src/connectors/fuel.ts
10099
- import { ErrorCode as ErrorCode26, FuelError as FuelError29 } from "@fuel-ts/errors";
10991
+ import { ErrorCode as ErrorCode26, FuelError as FuelError30 } from "@fuel-ts/errors";
10100
10992
 
10101
10993
  // src/connectors/fuel-connector.ts
10102
- import { FuelError as FuelError27 } from "@fuel-ts/errors";
10994
+ import { FuelError as FuelError28 } from "@fuel-ts/errors";
10103
10995
  import { EventEmitter as EventEmitter2 } from "events";
10104
10996
 
10105
10997
  // src/connectors/types/connector-types.ts
@@ -10173,7 +11065,7 @@ var FuelConnector = class extends EventEmitter2 {
10173
11065
  * @returns Always true.
10174
11066
  */
10175
11067
  async ping() {
10176
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11068
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10177
11069
  }
10178
11070
  /**
10179
11071
  * Should return the current version of the connector
@@ -10182,7 +11074,7 @@ var FuelConnector = class extends EventEmitter2 {
10182
11074
  * @returns boolean - connection status.
10183
11075
  */
10184
11076
  async version() {
10185
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11077
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10186
11078
  }
10187
11079
  /**
10188
11080
  * Should return true if the connector is connected
@@ -10191,7 +11083,7 @@ var FuelConnector = class extends EventEmitter2 {
10191
11083
  * @returns The connection status.
10192
11084
  */
10193
11085
  async isConnected() {
10194
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11086
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10195
11087
  }
10196
11088
  /**
10197
11089
  * Should return all the accounts authorized for the
@@ -10200,7 +11092,7 @@ var FuelConnector = class extends EventEmitter2 {
10200
11092
  * @returns The accounts addresses strings
10201
11093
  */
10202
11094
  async accounts() {
10203
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11095
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10204
11096
  }
10205
11097
  /**
10206
11098
  * Should start the connection process and return
@@ -10212,7 +11104,7 @@ var FuelConnector = class extends EventEmitter2 {
10212
11104
  * @returns boolean - connection status.
10213
11105
  */
10214
11106
  async connect() {
10215
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11107
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10216
11108
  }
10217
11109
  /**
10218
11110
  * Should disconnect the current connection and
@@ -10222,7 +11114,7 @@ var FuelConnector = class extends EventEmitter2 {
10222
11114
  * @returns The connection status.
10223
11115
  */
10224
11116
  async disconnect() {
10225
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11117
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10226
11118
  }
10227
11119
  /**
10228
11120
  * Should start the sign message process and return
@@ -10234,7 +11126,7 @@ var FuelConnector = class extends EventEmitter2 {
10234
11126
  * @returns Message signature
10235
11127
  */
10236
11128
  async signMessage(_address, _message) {
10237
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11129
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10238
11130
  }
10239
11131
  /**
10240
11132
  * Should start the sign transaction process and return
@@ -10246,7 +11138,7 @@ var FuelConnector = class extends EventEmitter2 {
10246
11138
  * @returns Transaction signature
10247
11139
  */
10248
11140
  async signTransaction(_address, _transaction) {
10249
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11141
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10250
11142
  }
10251
11143
  /**
10252
11144
  * Should start the send transaction process and return
@@ -10262,7 +11154,7 @@ var FuelConnector = class extends EventEmitter2 {
10262
11154
  * @returns The transaction id
10263
11155
  */
10264
11156
  async sendTransaction(_address, _transaction) {
10265
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11157
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10266
11158
  }
10267
11159
  /**
10268
11160
  * Should return the current account selected inside the connector, if the account
@@ -10273,7 +11165,7 @@ var FuelConnector = class extends EventEmitter2 {
10273
11165
  * @returns The current account selected otherwise null.
10274
11166
  */
10275
11167
  async currentAccount() {
10276
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11168
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10277
11169
  }
10278
11170
  /**
10279
11171
  * Should add the assets metadata to the connector and return true if the asset
@@ -10287,7 +11179,7 @@ var FuelConnector = class extends EventEmitter2 {
10287
11179
  * @returns True if the asset was added successfully
10288
11180
  */
10289
11181
  async addAssets(_assets) {
10290
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11182
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10291
11183
  }
10292
11184
  /**
10293
11185
  * Should add the asset metadata to the connector and return true if the asset
@@ -10301,7 +11193,7 @@ var FuelConnector = class extends EventEmitter2 {
10301
11193
  * @returns True if the asset was added successfully
10302
11194
  */
10303
11195
  async addAsset(_asset) {
10304
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11196
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10305
11197
  }
10306
11198
  /**
10307
11199
  * Should return all the assets added to the connector. If a connection is already established.
@@ -10309,7 +11201,7 @@ var FuelConnector = class extends EventEmitter2 {
10309
11201
  * @returns Array of assets metadata from the connector vinculated to the all accounts from a specific Wallet.
10310
11202
  */
10311
11203
  async assets() {
10312
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11204
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10313
11205
  }
10314
11206
  /**
10315
11207
  * Should start the add network process and return true if the network was added successfully.
@@ -10320,7 +11212,7 @@ var FuelConnector = class extends EventEmitter2 {
10320
11212
  * @returns Return true if the network was added successfully
10321
11213
  */
10322
11214
  async addNetwork(_networkUrl) {
10323
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11215
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10324
11216
  }
10325
11217
  /**
10326
11218
  * Should start the select network process and return true if the network has change successfully.
@@ -10331,7 +11223,7 @@ var FuelConnector = class extends EventEmitter2 {
10331
11223
  * @returns Return true if the network was added successfully
10332
11224
  */
10333
11225
  async selectNetwork(_network) {
10334
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11226
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10335
11227
  }
10336
11228
  /**
10337
11229
  * Should return all the networks available from the connector. If the connection is already established.
@@ -10339,7 +11231,7 @@ var FuelConnector = class extends EventEmitter2 {
10339
11231
  * @returns Return all the networks added to the connector.
10340
11232
  */
10341
11233
  async networks() {
10342
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11234
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10343
11235
  }
10344
11236
  /**
10345
11237
  * Should return the current network selected inside the connector. Even if the connection is not established.
@@ -10347,7 +11239,7 @@ var FuelConnector = class extends EventEmitter2 {
10347
11239
  * @returns Return the current network selected inside the connector.
10348
11240
  */
10349
11241
  async currentNetwork() {
10350
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11242
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10351
11243
  }
10352
11244
  /**
10353
11245
  * Should add the ABI to the connector and return true if the ABI was added successfully.
@@ -10357,7 +11249,7 @@ var FuelConnector = class extends EventEmitter2 {
10357
11249
  * @returns Return true if the ABI was added successfully.
10358
11250
  */
10359
11251
  async addABI(_contractId, _abi) {
10360
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11252
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10361
11253
  }
10362
11254
  /**
10363
11255
  * Should return the ABI from the connector vinculated to the all accounts from a specific Wallet.
@@ -10366,7 +11258,7 @@ var FuelConnector = class extends EventEmitter2 {
10366
11258
  * @returns The ABI if it exists, otherwise return null.
10367
11259
  */
10368
11260
  async getABI(_id) {
10369
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11261
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10370
11262
  }
10371
11263
  /**
10372
11264
  * Should return true if the abi exists in the connector vinculated to the all accounts from a specific Wallet.
@@ -10375,7 +11267,7 @@ var FuelConnector = class extends EventEmitter2 {
10375
11267
  * @returns Returns true if the abi exists or false if not.
10376
11268
  */
10377
11269
  async hasABI(_id) {
10378
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11270
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10379
11271
  }
10380
11272
  /**
10381
11273
  * Event listener for the connector.
@@ -10419,7 +11311,7 @@ function dispatchFuelConnectorEvent(connector) {
10419
11311
  }
10420
11312
 
10421
11313
  // src/connectors/utils/promises.ts
10422
- import { FuelError as FuelError28 } from "@fuel-ts/errors";
11314
+ import { FuelError as FuelError29 } from "@fuel-ts/errors";
10423
11315
  function deferPromise() {
10424
11316
  const defer = {};
10425
11317
  defer.promise = new Promise((resolve, reject) => {
@@ -10431,7 +11323,7 @@ function deferPromise() {
10431
11323
  async function withTimeout(promise, timeout = 1050) {
10432
11324
  const timeoutPromise = new Promise((resolve, reject) => {
10433
11325
  setTimeout(() => {
10434
- reject(new FuelError28(FuelError28.CODES.TIMEOUT_EXCEEDED, "Promise timed out"));
11326
+ reject(new FuelError29(FuelError29.CODES.TIMEOUT_EXCEEDED, "Promise timed out"));
10435
11327
  }, timeout);
10436
11328
  });
10437
11329
  return Promise.race([timeoutPromise, promise]);
@@ -10465,7 +11357,7 @@ var _Fuel = class extends FuelConnector {
10465
11357
  await this.setDefaultConnector();
10466
11358
  this._targetUnsubscribe = this.setupConnectorListener();
10467
11359
  } catch (error) {
10468
- throw new FuelError29(ErrorCode26.INVALID_PROVIDER, "Error initializing Fuel Connector");
11360
+ throw new FuelError30(ErrorCode26.INVALID_PROVIDER, "Error initializing Fuel Connector");
10469
11361
  }
10470
11362
  }
10471
11363
  async init() {
@@ -10531,7 +11423,7 @@ var _Fuel = class extends FuelConnector {
10531
11423
  const hasConnector = await this.hasConnector();
10532
11424
  await this.pingConnector();
10533
11425
  if (!this._currentConnector || !hasConnector) {
10534
- throw new FuelError29(
11426
+ throw new FuelError30(
10535
11427
  ErrorCode26.MISSING_CONNECTOR,
10536
11428
  `No connector selected for calling ${method}. Use hasConnector before executing other methods.`
10537
11429
  );
@@ -10596,7 +11488,7 @@ var _Fuel = class extends FuelConnector {
10596
11488
  cacheTime: PING_CACHE_TIME
10597
11489
  })();
10598
11490
  } catch {
10599
- throw new FuelError29(ErrorCode26.INVALID_PROVIDER, "Current connector is not available.");
11491
+ throw new FuelError30(ErrorCode26.INVALID_PROVIDER, "Current connector is not available.");
10600
11492
  }
10601
11493
  }
10602
11494
  /**
@@ -10745,7 +11637,7 @@ var _Fuel = class extends FuelConnector {
10745
11637
  const currentNetwork = await this.currentNetwork();
10746
11638
  provider = await Provider.create(currentNetwork.url);
10747
11639
  } else {
10748
- throw new FuelError29(ErrorCode26.INVALID_PROVIDER, "Provider is not valid.");
11640
+ throw new FuelError30(ErrorCode26.INVALID_PROVIDER, "Provider is not valid.");
10749
11641
  }
10750
11642
  return provider;
10751
11643
  }
@@ -10821,6 +11713,8 @@ export {
10821
11713
  TransactionStatus,
10822
11714
  TransactionType,
10823
11715
  TransactionTypeName,
11716
+ UpgradeTransactionRequest,
11717
+ UploadTransactionRequest,
10824
11718
  Vault,
10825
11719
  Wallet,
10826
11720
  WalletLocked,
@@ -10842,6 +11736,9 @@ export {
10842
11736
  calculateMetadataGasForTxBlob,
10843
11737
  calculateMetadataGasForTxCreate,
10844
11738
  calculateMetadataGasForTxScript,
11739
+ calculateMetadataGasForTxUpgrade,
11740
+ calculateMetadataGasForTxUpload,
11741
+ calculateMinGasForTxUpload,
10845
11742
  calculateTXFeeForSummary,
10846
11743
  coinQuantityfy,
10847
11744
  deferPromise,
@@ -10912,6 +11809,8 @@ export {
10912
11809
  isTransactionTypeBlob,
10913
11810
  isTransactionTypeCreate,
10914
11811
  isTransactionTypeScript,
11812
+ isTransactionTypeUpgrade,
11813
+ isTransactionTypeUpload,
10915
11814
  isType,
10916
11815
  isTypeBlob,
10917
11816
  isTypeCreate,