@fuel-ts/account 0.94.5 → 0.94.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/configs.d.ts +6 -0
  2. package/dist/configs.d.ts.map +1 -1
  3. package/dist/configs.global.js.map +1 -1
  4. package/dist/configs.js.map +1 -1
  5. package/dist/configs.mjs.map +1 -1
  6. package/dist/connectors/fuel-connector.d.ts +4 -4
  7. package/dist/connectors/fuel-connector.d.ts.map +1 -1
  8. package/dist/connectors/types/data-type.d.ts +7 -0
  9. package/dist/connectors/types/data-type.d.ts.map +1 -1
  10. package/dist/connectors/types/local-storage.d.ts +0 -1
  11. package/dist/connectors/types/local-storage.d.ts.map +1 -1
  12. package/dist/index.global.js +2008 -1286
  13. package/dist/index.global.js.map +1 -1
  14. package/dist/index.js +1264 -413
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +1137 -290
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/providers/__generated__/operations.d.ts +1 -0
  19. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  20. package/dist/providers/assets/assets.d.ts +1 -1
  21. package/dist/providers/assets/assets.d.ts.map +1 -1
  22. package/dist/providers/assets/utils/network.d.ts.map +1 -1
  23. package/dist/providers/assets/utils/resolveIconPaths.d.ts +1 -1
  24. package/dist/providers/chains.d.ts +2 -0
  25. package/dist/providers/chains.d.ts.map +1 -1
  26. package/dist/providers/fuel-graphql-subscriber.d.ts +0 -2
  27. package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
  28. package/dist/providers/message.d.ts.map +1 -1
  29. package/dist/providers/provider.d.ts +8 -3
  30. package/dist/providers/provider.d.ts.map +1 -1
  31. package/dist/providers/resource.d.ts.map +1 -1
  32. package/dist/providers/transaction-request/helpers.d.ts.map +1 -1
  33. package/dist/providers/transaction-request/index.d.ts +2 -0
  34. package/dist/providers/transaction-request/index.d.ts.map +1 -1
  35. package/dist/providers/transaction-request/transaction-request.d.ts +2 -2
  36. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  37. package/dist/providers/transaction-request/types.d.ts +8 -2
  38. package/dist/providers/transaction-request/types.d.ts.map +1 -1
  39. package/dist/providers/transaction-request/upgrade-transaction-request.d.ts +87 -0
  40. package/dist/providers/transaction-request/upgrade-transaction-request.d.ts.map +1 -0
  41. package/dist/providers/transaction-request/upload-transaction-request.d.ts +82 -0
  42. package/dist/providers/transaction-request/upload-transaction-request.d.ts.map +1 -0
  43. package/dist/providers/transaction-request/utils.d.ts +6 -0
  44. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  45. package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
  46. package/dist/providers/transaction-summary/input.d.ts.map +1 -1
  47. package/dist/providers/transaction-summary/operations.d.ts.map +1 -1
  48. package/dist/providers/transaction-summary/output.d.ts.map +1 -1
  49. package/dist/providers/transaction-summary/receipt.d.ts.map +1 -1
  50. package/dist/providers/utils/extract-tx-error.d.ts.map +1 -1
  51. package/dist/providers/utils/gas.d.ts +16 -0
  52. package/dist/providers/utils/gas.d.ts.map +1 -1
  53. package/dist/providers/utils/receipts.d.ts.map +1 -1
  54. package/dist/test-utils/launchNode.d.ts.map +1 -1
  55. package/dist/test-utils/resources.d.ts.map +1 -1
  56. package/dist/test-utils/transactionRequest.d.ts.map +1 -1
  57. package/dist/test-utils.global.js +2001 -1282
  58. package/dist/test-utils.global.js.map +1 -1
  59. package/dist/test-utils.js +1174 -340
  60. package/dist/test-utils.js.map +1 -1
  61. package/dist/test-utils.mjs +1059 -222
  62. package/dist/test-utils.mjs.map +1 -1
  63. package/dist/wallet-manager/wallet-manager.d.ts +0 -1
  64. package/dist/wallet-manager/wallet-manager.d.ts.map +1 -1
  65. package/package.json +25 -24
package/dist/index.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";
@@ -1498,6 +1498,7 @@ function assembleReceiptByType(receipt) {
1498
1498
  len: bn4(receipt.len),
1499
1499
  digest: hexOrZero(receipt.digest),
1500
1500
  pc: bn4(receipt.pc),
1501
+ data: hexOrZero(receipt.data),
1501
1502
  is: bn4(receipt.is)
1502
1503
  };
1503
1504
  return returnDataReceipt;
@@ -1546,6 +1547,7 @@ function assembleReceiptByType(receipt) {
1546
1547
  len: bn4(receipt.len),
1547
1548
  digest: hexOrZero(receipt.digest),
1548
1549
  pc: bn4(receipt.pc),
1550
+ data: hexOrZero(receipt.data),
1549
1551
  is: bn4(receipt.is)
1550
1552
  };
1551
1553
  return logDataReceipt;
@@ -1589,6 +1591,7 @@ function assembleReceiptByType(receipt) {
1589
1591
  const amount = bn4(receipt.amount);
1590
1592
  const data = receipt.data ? arrayify2(receipt.data) : Uint8Array.from([]);
1591
1593
  const digest = hexOrZero(receipt.digest);
1594
+ const len = bn4(receipt.len).toNumber();
1592
1595
  const messageId = InputMessageCoder.getMessageId({
1593
1596
  sender,
1594
1597
  recipient,
@@ -1602,6 +1605,7 @@ function assembleReceiptByType(receipt) {
1602
1605
  recipient,
1603
1606
  amount,
1604
1607
  nonce,
1608
+ len,
1605
1609
  data,
1606
1610
  digest,
1607
1611
  messageId
@@ -1645,7 +1649,7 @@ function assembleReceiptByType(receipt) {
1645
1649
 
1646
1650
  // src/providers/utils/block-explorer.ts
1647
1651
  import { ErrorCode as ErrorCode6, FuelError as FuelError6 } from "@fuel-ts/errors";
1648
- var DEFAULT_BLOCK_EXPLORER_URL = "https://fuellabs.github.io/block-explorer-v2";
1652
+ var DEFAULT_BLOCK_EXPLORER_URL = "https://app.fuel.network";
1649
1653
  var getPathFromInput = (key, value) => {
1650
1654
  const pathMap = {
1651
1655
  address: `address`,
@@ -1805,6 +1809,39 @@ function calculateMetadataGasForTxBlob({
1805
1809
  const blobLen = resolveGasDependentCosts(witnessBytesSize, gasCosts.s256);
1806
1810
  return txId.add(blobLen);
1807
1811
  }
1812
+ function calculateMetadataGasForTxUpgrade({
1813
+ gasCosts,
1814
+ txBytesSize,
1815
+ consensusSize
1816
+ }) {
1817
+ const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
1818
+ if (consensusSize) {
1819
+ const consensusLen = resolveGasDependentCosts(consensusSize, gasCosts.s256);
1820
+ txId.add(consensusLen);
1821
+ }
1822
+ return txId;
1823
+ }
1824
+ function calculateMetadataGasForTxUpload({
1825
+ gasCosts,
1826
+ txBytesSize,
1827
+ subsectionSize,
1828
+ subsectionsSize
1829
+ }) {
1830
+ const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
1831
+ const subsectionLen = resolveGasDependentCosts(subsectionSize, gasCosts.s256);
1832
+ txId.add(subsectionLen);
1833
+ const subsectionsLen = resolveGasDependentCosts(subsectionsSize, gasCosts.stateRoot);
1834
+ txId.add(subsectionsLen);
1835
+ return txId;
1836
+ }
1837
+ function calculateMinGasForTxUpload({
1838
+ gasCosts,
1839
+ baseMinGas,
1840
+ subsectionSize
1841
+ }) {
1842
+ const additionalStoragePerByte = bn5(gasCosts.newStoragePerByte).mul(subsectionSize);
1843
+ return bn5(baseMinGas).add(additionalStoragePerByte);
1844
+ }
1808
1845
  var calculateGasFee = (params) => {
1809
1846
  const { gas, gasPrice, priceFactor, tip } = params;
1810
1847
  return gas.mul(gasPrice).div(priceFactor).add(bn5(tip));
@@ -2981,51 +3018,319 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2981
3018
  }
2982
3019
  };
2983
3020
 
3021
+ // src/providers/transaction-request/upgrade-transaction-request.ts
3022
+ import { FuelError as FuelError9 } from "@fuel-ts/errors";
3023
+ import { hash } from "@fuel-ts/hasher";
3024
+ import {
3025
+ TransactionType as TransactionType5,
3026
+ UpgradePurposeTypeEnum
3027
+ } from "@fuel-ts/transactions";
3028
+ import { hexlify as hexlify12 } from "@fuel-ts/utils";
3029
+ import { clone as clone6 } from "ramda";
3030
+ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3031
+ static from(obj) {
3032
+ if (obj instanceof UpgradeTransactionRequest) {
3033
+ return obj;
3034
+ }
3035
+ return new this(clone6(obj));
3036
+ }
3037
+ /** The type of transaction */
3038
+ type = TransactionType5.Upgrade;
3039
+ /** The upgrade purpose */
3040
+ upgradePurpose;
3041
+ /** Witness index of consensus */
3042
+ bytecodeWitnessIndex;
3043
+ /**
3044
+ * Creates an instance `UpgradeTransactionRequest`.
3045
+ *
3046
+ * @param upgradeTransactionRequestLike - The initial values for the instance
3047
+ */
3048
+ constructor({
3049
+ upgradePurpose,
3050
+ bytecodeWitnessIndex,
3051
+ ...rest
3052
+ } = {}) {
3053
+ super(rest);
3054
+ this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
3055
+ this.upgradePurpose = upgradePurpose ?? {
3056
+ type: UpgradePurposeTypeEnum.ConsensusParameters,
3057
+ checksum: "0x"
3058
+ };
3059
+ }
3060
+ /**
3061
+ * Adds a consensus parameters upgrade purpose.
3062
+ *
3063
+ * @param consensus - The consensus bytecode.
3064
+ *
3065
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3066
+ */
3067
+ addConsensusParametersUpgradePurpose(consensus) {
3068
+ this.bytecodeWitnessIndex = this.addWitness(consensus);
3069
+ this.upgradePurpose = {
3070
+ type: UpgradePurposeTypeEnum.ConsensusParameters,
3071
+ checksum: hash(consensus)
3072
+ };
3073
+ return this;
3074
+ }
3075
+ /**
3076
+ * Adds a state transition upgrade purpose.
3077
+ *
3078
+ * @param bytecodeRoot - The Merkle root of the state transition.
3079
+ *
3080
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3081
+ */
3082
+ addStateTransitionUpgradePurpose(bytecodeRoot) {
3083
+ this.upgradePurpose = {
3084
+ type: UpgradePurposeTypeEnum.StateTransition,
3085
+ data: hexlify12(bytecodeRoot)
3086
+ };
3087
+ return this;
3088
+ }
3089
+ /**
3090
+ * Adds an upgrade purpose.
3091
+ *
3092
+ * @param type - The upgrade purpose type.
3093
+ * @param data - The bytecode or merkle root of upgrade purpose
3094
+ *
3095
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3096
+ */
3097
+ addUpgradePurpose(type, data) {
3098
+ if (type === UpgradePurposeTypeEnum.ConsensusParameters) {
3099
+ this.addConsensusParametersUpgradePurpose(data);
3100
+ }
3101
+ if (type === UpgradePurposeTypeEnum.StateTransition) {
3102
+ this.addStateTransitionUpgradePurpose(data);
3103
+ }
3104
+ return this;
3105
+ }
3106
+ /**
3107
+ * Converts the transaction request to a `TransactionUpgrade`.
3108
+ *
3109
+ * @returns The transaction create object.
3110
+ */
3111
+ toTransaction() {
3112
+ let upgradePurpose;
3113
+ if (this.upgradePurpose.type === UpgradePurposeTypeEnum.ConsensusParameters) {
3114
+ upgradePurpose = {
3115
+ type: UpgradePurposeTypeEnum.ConsensusParameters,
3116
+ data: {
3117
+ witnessIndex: this.bytecodeWitnessIndex,
3118
+ checksum: this.upgradePurpose.checksum
3119
+ }
3120
+ };
3121
+ } else if (this.upgradePurpose.type === UpgradePurposeTypeEnum.StateTransition) {
3122
+ upgradePurpose = {
3123
+ type: UpgradePurposeTypeEnum.StateTransition,
3124
+ data: {
3125
+ bytecodeRoot: hexlify12(this.upgradePurpose.data)
3126
+ }
3127
+ };
3128
+ } else {
3129
+ throw new FuelError9(FuelError9.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3130
+ }
3131
+ return {
3132
+ type: TransactionType5.Upgrade,
3133
+ ...super.getBaseTransaction(),
3134
+ upgradePurpose
3135
+ };
3136
+ }
3137
+ /**
3138
+ * Gets the Transaction ID by hashing the transaction
3139
+ *
3140
+ * @param chainId - The chain ID.
3141
+ *
3142
+ * @returns - A hash of the transaction, which is the transaction ID.
3143
+ */
3144
+ getTransactionId(chainId) {
3145
+ return hashTransaction(this, chainId);
3146
+ }
3147
+ /**
3148
+ * Calculates the metadata gas cost for an upgrade transaction.
3149
+ *
3150
+ * @param gasCosts - gas costs passed from the chain.
3151
+ *
3152
+ * @returns metadata gas cost for the upgrade transaction.
3153
+ */
3154
+ metadataGas(gasCosts) {
3155
+ const txBytesSize = this.byteSize();
3156
+ if (this.upgradePurpose.type === UpgradePurposeTypeEnum.ConsensusParameters) {
3157
+ const witnessIndex = this.bytecodeWitnessIndex;
3158
+ const consensusSize = this.witnesses[witnessIndex].length;
3159
+ return calculateMetadataGasForTxUpgrade({
3160
+ gasCosts,
3161
+ txBytesSize,
3162
+ consensusSize
3163
+ });
3164
+ }
3165
+ if (this.upgradePurpose.type === UpgradePurposeTypeEnum.StateTransition) {
3166
+ return calculateMetadataGasForTxUpgrade({
3167
+ gasCosts,
3168
+ txBytesSize
3169
+ });
3170
+ }
3171
+ throw new FuelError9(FuelError9.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3172
+ }
3173
+ };
3174
+
3175
+ // src/providers/transaction-request/upload-transaction-request.ts
3176
+ import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
3177
+ import { TransactionType as TransactionType6 } from "@fuel-ts/transactions";
3178
+ import { arrayify as arrayify9, hexlify as hexlify13 } from "@fuel-ts/utils";
3179
+ import { clone as clone7 } from "ramda";
3180
+ var UploadTransactionRequest = class extends BaseTransactionRequest {
3181
+ static from(obj) {
3182
+ if (obj instanceof UploadTransactionRequest) {
3183
+ return obj;
3184
+ }
3185
+ return new this(clone7(obj));
3186
+ }
3187
+ /** Type of the transaction */
3188
+ type = TransactionType6.Upload;
3189
+ /** The witness index of the subsection of the bytecode. */
3190
+ witnessIndex;
3191
+ /** The subsection data. */
3192
+ subsection;
3193
+ /**
3194
+ * Creates an instance `UploadTransactionRequest`.
3195
+ *
3196
+ * @param uploadTransactionRequestLike - The initial values for the instance
3197
+ */
3198
+ constructor({ witnessIndex, subsection, ...rest } = {}) {
3199
+ super(rest);
3200
+ this.witnessIndex = witnessIndex ?? 0;
3201
+ this.subsection = subsection ?? {
3202
+ proofSet: [],
3203
+ root: ZeroBytes328,
3204
+ subsectionIndex: 0,
3205
+ subsectionsNumber: 0
3206
+ };
3207
+ }
3208
+ /**
3209
+ * Adds the subsection.
3210
+ *
3211
+ * @param subsection - The subsection data.
3212
+ */
3213
+ addSubsection(subsection) {
3214
+ const { subsection: subsectionBytecode, ...rest } = subsection;
3215
+ this.subsection = rest;
3216
+ this.witnessIndex = this.addWitness(subsectionBytecode);
3217
+ }
3218
+ /**
3219
+ * Gets the Transaction Request by hashing the transaction.
3220
+ *
3221
+ * @param chainId - The chain ID.
3222
+ *
3223
+ * @returns - A hash of the transaction, which is the transaction ID.
3224
+ */
3225
+ getTransactionId(chainId) {
3226
+ return hashTransaction(this, chainId);
3227
+ }
3228
+ /**
3229
+ * Converts the transaction request to a `TransactionUpload`.
3230
+ *
3231
+ * @returns The transaction create object.
3232
+ */
3233
+ toTransaction() {
3234
+ const baseTransaction = this.getBaseTransaction();
3235
+ const { subsectionIndex, subsectionsNumber, root, proofSet } = this.subsection;
3236
+ return {
3237
+ type: TransactionType6.Upload,
3238
+ ...baseTransaction,
3239
+ subsectionIndex,
3240
+ subsectionsNumber,
3241
+ root: hexlify13(root),
3242
+ proofSet: proofSet.map(hexlify13),
3243
+ witnessIndex: this.witnessIndex,
3244
+ proofSetCount: proofSet.length
3245
+ };
3246
+ }
3247
+ /**
3248
+ * Calculates the metadata gas cost for an upload transaction.
3249
+ *
3250
+ * @param gasCosts - gas costs passed from the chain.
3251
+ *
3252
+ * @returns metadata gas cost for the upload transaction.
3253
+ */
3254
+ metadataGas(gasCosts) {
3255
+ return calculateMetadataGasForTxUpload({
3256
+ gasCosts,
3257
+ txBytesSize: this.byteSize(),
3258
+ subsectionSize: arrayify9(this.witnesses[this.witnessIndex]).length,
3259
+ subsectionsSize: this.subsection.subsectionsNumber
3260
+ });
3261
+ }
3262
+ /**
3263
+ * Calculates the minimum gas for an upload transaction.
3264
+ *
3265
+ * @param chainInfo - The chain information.
3266
+ *
3267
+ * @returns the minimum gas for the upload transaction
3268
+ */
3269
+ calculateMinGas(chainInfo) {
3270
+ const minGas = super.calculateMinGas(chainInfo);
3271
+ const { gasCosts } = chainInfo.consensusParameters;
3272
+ const bytecode = this.witnesses[this.witnessIndex] ?? ZeroBytes328;
3273
+ return calculateMinGasForTxUpload({
3274
+ gasCosts,
3275
+ baseMinGas: minGas.toNumber(),
3276
+ subsectionSize: arrayify9(bytecode).length
3277
+ });
3278
+ }
3279
+ };
3280
+
2984
3281
  // 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";
3282
+ import { ErrorCode as ErrorCode8, FuelError as FuelError10 } from "@fuel-ts/errors";
3283
+ import { TransactionType as TransactionType7 } from "@fuel-ts/transactions";
2987
3284
  var transactionRequestify = (obj) => {
2988
- if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest) {
3285
+ if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
2989
3286
  return obj;
2990
3287
  }
2991
3288
  const { type } = obj;
2992
3289
  switch (obj.type) {
2993
- case TransactionType5.Script: {
3290
+ case TransactionType7.Script: {
2994
3291
  return ScriptTransactionRequest.from(obj);
2995
3292
  }
2996
- case TransactionType5.Create: {
3293
+ case TransactionType7.Create: {
2997
3294
  return CreateTransactionRequest.from(obj);
2998
3295
  }
2999
- case TransactionType5.Blob: {
3296
+ case TransactionType7.Blob: {
3000
3297
  return BlobTransactionRequest.from(obj);
3001
3298
  }
3299
+ case TransactionType7.Upgrade: {
3300
+ return UpgradeTransactionRequest.from(obj);
3301
+ }
3302
+ case TransactionType7.Upload: {
3303
+ return UploadTransactionRequest.from(obj);
3304
+ }
3002
3305
  default: {
3003
- throw new FuelError9(
3306
+ throw new FuelError10(
3004
3307
  ErrorCode8.UNSUPPORTED_TRANSACTION_TYPE,
3005
3308
  `Unsupported transaction type: ${type}.`
3006
3309
  );
3007
3310
  }
3008
3311
  }
3009
3312
  };
3010
- var isTransactionTypeScript = (request) => request.type === TransactionType5.Script;
3011
- var isTransactionTypeCreate = (request) => request.type === TransactionType5.Create;
3012
- var isTransactionTypeBlob = (request) => request.type === TransactionType5.Blob;
3313
+ var isTransactionTypeScript = (request) => request.type === TransactionType7.Script;
3314
+ var isTransactionTypeCreate = (request) => request.type === TransactionType7.Create;
3315
+ var isTransactionTypeBlob = (request) => request.type === TransactionType7.Blob;
3316
+ var isTransactionTypeUpgrade = (request) => request.type === TransactionType7.Upgrade;
3317
+ var isTransactionTypeUpload = (request) => request.type === TransactionType7.Upload;
3013
3318
 
3014
3319
  // src/providers/transaction-response/transaction-response.ts
3015
- import { ErrorCode as ErrorCode12, FuelError as FuelError13 } from "@fuel-ts/errors";
3320
+ import { ErrorCode as ErrorCode12, FuelError as FuelError14 } from "@fuel-ts/errors";
3016
3321
  import { bn as bn16 } from "@fuel-ts/math";
3017
3322
  import { OutputType as OutputType7, TransactionCoder as TransactionCoder4, TxPointerCoder } from "@fuel-ts/transactions";
3018
- import { arrayify as arrayify10, assertUnreachable } from "@fuel-ts/utils";
3323
+ import { arrayify as arrayify11, assertUnreachable } from "@fuel-ts/utils";
3019
3324
 
3020
3325
  // src/providers/transaction-summary/assemble-transaction-summary.ts
3021
3326
  import { bn as bn15 } from "@fuel-ts/math";
3022
3327
  import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
3023
- import { DateTime, hexlify as hexlify12 } from "@fuel-ts/utils";
3328
+ import { DateTime, hexlify as hexlify14 } from "@fuel-ts/utils";
3024
3329
 
3025
3330
  // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
3026
3331
  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";
3332
+ import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType8 } from "@fuel-ts/transactions";
3333
+ import { arrayify as arrayify10 } from "@fuel-ts/utils";
3029
3334
  var calculateTXFeeForSummary = (params) => {
3030
3335
  const {
3031
3336
  gasPrice,
@@ -3039,17 +3344,17 @@ var calculateTXFeeForSummary = (params) => {
3039
3344
  }
3040
3345
  const gasPerByte = bn12(feeParams.gasPerByte);
3041
3346
  const gasPriceFactor = bn12(feeParams.gasPriceFactor);
3042
- const transactionBytes = arrayify9(rawPayload);
3347
+ const transactionBytes = arrayify10(rawPayload);
3043
3348
  const [transaction] = new TransactionCoder3().decode(transactionBytes, 0);
3044
3349
  const { type, witnesses, inputs, policies } = transaction;
3045
3350
  let metadataGas = bn12(0);
3046
3351
  let gasLimit = bn12(0);
3047
- if (type !== TransactionType6.Create && type !== TransactionType6.Script) {
3352
+ if (type !== TransactionType8.Create && type !== TransactionType8.Script) {
3048
3353
  return bn12(0);
3049
3354
  }
3050
- if (type === TransactionType6.Create) {
3355
+ if (type === TransactionType8.Create) {
3051
3356
  const { bytecodeWitnessIndex, storageSlots } = transaction;
3052
- const contractBytesSize = bn12(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
3357
+ const contractBytesSize = bn12(arrayify10(witnesses[bytecodeWitnessIndex].data).length);
3053
3358
  metadataGas = calculateMetadataGasForTxCreate({
3054
3359
  contractBytesSize,
3055
3360
  gasCosts,
@@ -3093,10 +3398,10 @@ var calculateTXFeeForSummary = (params) => {
3093
3398
  };
3094
3399
 
3095
3400
  // 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";
3401
+ import { ZeroBytes32 as ZeroBytes329 } from "@fuel-ts/address/configs";
3402
+ import { ErrorCode as ErrorCode10, FuelError as FuelError12 } from "@fuel-ts/errors";
3098
3403
  import { bn as bn13 } from "@fuel-ts/math";
3099
- import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
3404
+ import { ReceiptType as ReceiptType4, TransactionType as TransactionType9 } from "@fuel-ts/transactions";
3100
3405
 
3101
3406
  // src/providers/transaction-summary/call.ts
3102
3407
  import { Interface as Interface2 } from "@fuel-ts/abi-coder";
@@ -3132,7 +3437,7 @@ var getFunctionCall = ({ abi, receipt }) => {
3132
3437
  };
3133
3438
 
3134
3439
  // src/providers/transaction-summary/input.ts
3135
- import { ErrorCode as ErrorCode9, FuelError as FuelError10 } from "@fuel-ts/errors";
3440
+ import { ErrorCode as ErrorCode9, FuelError as FuelError11 } from "@fuel-ts/errors";
3136
3441
  import { BN } from "@fuel-ts/math";
3137
3442
  import { InputType as InputType6 } from "@fuel-ts/transactions";
3138
3443
  function getInputsByTypes(inputs, types) {
@@ -3201,7 +3506,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
3201
3506
  return void 0;
3202
3507
  }
3203
3508
  if (contractInput.type !== InputType6.Contract) {
3204
- throw new FuelError10(
3509
+ throw new FuelError11(
3205
3510
  ErrorCode9.INVALID_TRANSACTION_INPUT,
3206
3511
  `Contract input should be of type 'contract'.`
3207
3512
  );
@@ -3286,16 +3591,20 @@ function getReceiptsByType(receipts, type) {
3286
3591
  }
3287
3592
  function getTransactionTypeName(transactionType) {
3288
3593
  switch (transactionType) {
3289
- case TransactionType7.Mint:
3594
+ case TransactionType9.Mint:
3290
3595
  return "Mint" /* Mint */;
3291
- case TransactionType7.Create:
3596
+ case TransactionType9.Create:
3292
3597
  return "Create" /* Create */;
3293
- case TransactionType7.Script:
3598
+ case TransactionType9.Script:
3294
3599
  return "Script" /* Script */;
3295
- case TransactionType7.Blob:
3600
+ case TransactionType9.Blob:
3296
3601
  return "Blob" /* Blob */;
3602
+ case TransactionType9.Upgrade:
3603
+ return "Upgrade" /* Upgrade */;
3604
+ case TransactionType9.Upload:
3605
+ return "Upload" /* Upload */;
3297
3606
  default:
3298
- throw new FuelError11(
3607
+ throw new FuelError12(
3299
3608
  ErrorCode10.UNSUPPORTED_TRANSACTION_TYPE,
3300
3609
  `Unsupported transaction type: ${transactionType}.`
3301
3610
  );
@@ -3441,7 +3750,7 @@ function getAssetsSent(receipt) {
3441
3750
  ];
3442
3751
  }
3443
3752
  function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload, maxInputs, baseAssetId) {
3444
- const assetId = receipt.assetId === ZeroBytes328 ? baseAssetId : receipt.assetId;
3753
+ const assetId = receipt.assetId === ZeroBytes329 ? baseAssetId : receipt.assetId;
3445
3754
  const input = getInputFromAssetId(inputs, assetId, assetId === baseAssetId);
3446
3755
  if (!input) {
3447
3756
  return [];
@@ -3497,7 +3806,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
3497
3806
  const { to: toAddress, assetId, amount } = receipt;
3498
3807
  let { from: fromAddress } = receipt;
3499
3808
  const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
3500
- if (ZeroBytes328 === fromAddress) {
3809
+ if (ZeroBytes329 === fromAddress) {
3501
3810
  const change = changeOutputs.find((output) => output.assetId === assetId);
3502
3811
  fromAddress = change?.to || fromAddress;
3503
3812
  }
@@ -3651,25 +3960,7 @@ function getOperations({
3651
3960
 
3652
3961
  // src/providers/transaction-summary/receipt.ts
3653
3962
  import { ReceiptType as ReceiptType5 } from "@fuel-ts/transactions";
3654
- var processGqlReceipt = (gqlReceipt) => {
3655
- const receipt = assembleReceiptByType(gqlReceipt);
3656
- switch (receipt.type) {
3657
- case ReceiptType5.ReturnData: {
3658
- return {
3659
- ...receipt,
3660
- data: gqlReceipt.data || "0x"
3661
- };
3662
- }
3663
- case ReceiptType5.LogData: {
3664
- return {
3665
- ...receipt,
3666
- data: gqlReceipt.data || "0x"
3667
- };
3668
- }
3669
- default:
3670
- return receipt;
3671
- }
3672
- };
3963
+ var processGqlReceipt = (gqlReceipt) => assembleReceiptByType(gqlReceipt);
3673
3964
  var extractMintedAssetsFromReceipts = (receipts) => {
3674
3965
  const mintedAssets = [];
3675
3966
  receipts.forEach((receipt) => {
@@ -3700,7 +3991,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3700
3991
  };
3701
3992
 
3702
3993
  // src/providers/transaction-summary/status.ts
3703
- import { ErrorCode as ErrorCode11, FuelError as FuelError12 } from "@fuel-ts/errors";
3994
+ import { ErrorCode as ErrorCode11, FuelError as FuelError13 } from "@fuel-ts/errors";
3704
3995
  import { bn as bn14 } from "@fuel-ts/math";
3705
3996
  var getTransactionStatusName = (gqlStatus) => {
3706
3997
  switch (gqlStatus) {
@@ -3713,7 +4004,7 @@ var getTransactionStatusName = (gqlStatus) => {
3713
4004
  case "SqueezedOutStatus":
3714
4005
  return "squeezedout" /* squeezedout */;
3715
4006
  default:
3716
- throw new FuelError12(
4007
+ throw new FuelError13(
3717
4008
  ErrorCode11.INVALID_TRANSACTION_STATUS,
3718
4009
  `Invalid transaction status: ${gqlStatus}.`
3719
4010
  );
@@ -3783,7 +4074,7 @@ function assembleTransactionSummary(params) {
3783
4074
  baseAssetId
3784
4075
  } = params;
3785
4076
  const gasUsed = getGasUsedFromReceipts(receipts);
3786
- const rawPayload = hexlify12(transactionBytes);
4077
+ const rawPayload = hexlify14(transactionBytes);
3787
4078
  const operations = getOperations({
3788
4079
  transactionType: transaction.type,
3789
4080
  inputs: transaction.inputs || [],
@@ -3964,7 +4255,7 @@ var TransactionResponse = class {
3964
4255
  const gqlTransaction = this.gqlTransaction ?? await this.fetch();
3965
4256
  return {
3966
4257
  tx: this.decodeTransaction(gqlTransaction),
3967
- bytes: arrayify10(gqlTransaction.rawPayload)
4258
+ bytes: arrayify11(gqlTransaction.rawPayload)
3968
4259
  };
3969
4260
  }
3970
4261
  getReceipts() {
@@ -4009,7 +4300,7 @@ var TransactionResponse = class {
4009
4300
  */
4010
4301
  decodeTransaction(transactionWithReceipts) {
4011
4302
  return new TransactionCoder4().decode(
4012
- arrayify10(transactionWithReceipts.rawPayload),
4303
+ arrayify11(transactionWithReceipts.rawPayload),
4013
4304
  0
4014
4305
  )?.[0];
4015
4306
  }
@@ -4056,7 +4347,7 @@ var TransactionResponse = class {
4056
4347
  this.status = statusChange;
4057
4348
  if (statusChange.type === "SqueezedOutStatus") {
4058
4349
  this.unsetResourceCache();
4059
- throw new FuelError13(
4350
+ throw new FuelError14(
4060
4351
  ErrorCode12.TRANSACTION_SQUEEZED_OUT,
4061
4352
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
4062
4353
  );
@@ -4165,18 +4456,18 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
4165
4456
  }
4166
4457
 
4167
4458
  // src/providers/utils/handle-gql-error-message.ts
4168
- import { ErrorCode as ErrorCode13, FuelError as FuelError14 } from "@fuel-ts/errors";
4459
+ import { ErrorCode as ErrorCode13, FuelError as FuelError15 } from "@fuel-ts/errors";
4169
4460
  var handleGqlErrorMessage = (errorMessage, rawError) => {
4170
4461
  switch (errorMessage) {
4171
4462
  case "not enough coins to fit the target" /* NOT_ENOUGH_COINS */:
4172
- throw new FuelError14(
4463
+ throw new FuelError15(
4173
4464
  ErrorCode13.NOT_ENOUGH_FUNDS,
4174
4465
  `The account(s) sending the transaction don't have enough funds to cover the transaction.`,
4175
4466
  {},
4176
4467
  rawError
4177
4468
  );
4178
4469
  default:
4179
- throw new FuelError14(ErrorCode13.INVALID_REQUEST, errorMessage);
4470
+ throw new FuelError15(ErrorCode13.INVALID_REQUEST, errorMessage);
4180
4471
  }
4181
4472
  };
4182
4473
 
@@ -4258,21 +4549,31 @@ var _Provider = class {
4258
4549
  * @hidden
4259
4550
  */
4260
4551
  constructor(url, options = {}) {
4261
- this.url = url;
4262
4552
  /**
4263
4553
  * @hidden
4264
4554
  */
4265
4555
  __privateAdd(this, _cacheInputs);
4266
4556
  __publicField(this, "operations");
4267
4557
  __publicField(this, "cache");
4558
+ /** @hidden */
4559
+ __publicField(this, "url");
4560
+ /** @hidden */
4561
+ __publicField(this, "urlWithoutAuth");
4268
4562
  __publicField(this, "options", {
4269
4563
  timeout: void 0,
4270
4564
  resourceCacheTTL: void 0,
4271
4565
  fetch: void 0,
4272
- retryOptions: void 0
4566
+ retryOptions: void 0,
4567
+ headers: void 0
4273
4568
  });
4569
+ const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
4570
+ this.url = rawUrl;
4571
+ this.urlWithoutAuth = urlWithoutAuth;
4274
4572
  this.options = { ...this.options, ...options };
4275
4573
  this.url = url;
4574
+ if (headers) {
4575
+ this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
4576
+ }
4276
4577
  this.operations = this.createOperations();
4277
4578
  const { resourceCacheTTL } = this.options;
4278
4579
  if (isDefined2(resourceCacheTTL)) {
@@ -4294,12 +4595,16 @@ var _Provider = class {
4294
4595
  * @hidden
4295
4596
  */
4296
4597
  static getFetchFn(options) {
4297
- const { retryOptions, timeout } = options;
4598
+ const { retryOptions, timeout, headers } = options;
4298
4599
  return autoRetryFetch(async (...args) => {
4299
4600
  const url = args[0];
4300
4601
  const request = args[1];
4301
4602
  const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
4302
- let fullRequest = { ...request, signal };
4603
+ let fullRequest = {
4604
+ ...request,
4605
+ signal,
4606
+ headers: { ...request?.headers, ...headers }
4607
+ };
4303
4608
  if (options.requestMiddleware) {
4304
4609
  fullRequest = await options.requestMiddleware(fullRequest);
4305
4610
  }
@@ -4307,15 +4612,23 @@ var _Provider = class {
4307
4612
  }, retryOptions);
4308
4613
  }
4309
4614
  static extractBasicAuth(url) {
4310
- const parsedUrl = new URL(url);
4615
+ let parsedUrl;
4616
+ try {
4617
+ parsedUrl = new URL(url);
4618
+ } catch (error) {
4619
+ throw new FuelError16(FuelError16.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
4620
+ }
4311
4621
  const username = parsedUrl.username;
4312
4622
  const password = parsedUrl.password;
4313
- const urlNoBasicAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
4623
+ const urlWithoutAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
4314
4624
  if (!(username && password)) {
4315
- return { url, auth: void 0 };
4625
+ return { url, urlWithoutAuth: url, headers: void 0 };
4316
4626
  }
4317
- const auth = `Basic ${btoa(`${username}:${password}`)}`;
4318
- return { url: urlNoBasicAuth, auth };
4627
+ return {
4628
+ url,
4629
+ urlWithoutAuth,
4630
+ headers: { Authorization: `Basic ${btoa(`${username}:${password}`)}` }
4631
+ };
4319
4632
  }
4320
4633
  /**
4321
4634
  * Creates a new instance of the Provider class. This is the recommended way to initialize a Provider.
@@ -4326,17 +4639,7 @@ var _Provider = class {
4326
4639
  * @returns A promise that resolves to a Provider instance.
4327
4640
  */
4328
4641
  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
- });
4642
+ const provider = new _Provider(url, options);
4340
4643
  await provider.fetchChainAndNodeInfo();
4341
4644
  return provider;
4342
4645
  }
@@ -4346,9 +4649,9 @@ var _Provider = class {
4346
4649
  * @returns the chain information configuration.
4347
4650
  */
4348
4651
  getChain() {
4349
- const chain = _Provider.chainInfoCache[this.url];
4652
+ const chain = _Provider.chainInfoCache[this.urlWithoutAuth];
4350
4653
  if (!chain) {
4351
- throw new FuelError15(
4654
+ throw new FuelError16(
4352
4655
  ErrorCode14.CHAIN_INFO_CACHE_EMPTY,
4353
4656
  "Chain info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
4354
4657
  );
@@ -4361,9 +4664,9 @@ var _Provider = class {
4361
4664
  * @returns the node information configuration.
4362
4665
  */
4363
4666
  getNode() {
4364
- const node = _Provider.nodeInfoCache[this.url];
4667
+ const node = _Provider.nodeInfoCache[this.urlWithoutAuth];
4365
4668
  if (!node) {
4366
- throw new FuelError15(
4669
+ throw new FuelError16(
4367
4670
  ErrorCode14.NODE_INFO_CACHE_EMPTY,
4368
4671
  "Node info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
4369
4672
  );
@@ -4395,8 +4698,11 @@ var _Provider = class {
4395
4698
  * @param options - Additional options for the provider.
4396
4699
  */
4397
4700
  async connect(url, options) {
4398
- this.url = url;
4701
+ const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
4702
+ this.url = rawUrl;
4703
+ this.urlWithoutAuth = urlWithoutAuth;
4399
4704
  this.options = options ?? this.options;
4705
+ this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
4400
4706
  this.operations = this.createOperations();
4401
4707
  await this.fetchChainAndNodeInfo();
4402
4708
  }
@@ -4436,7 +4742,7 @@ Supported fuel-core version: ${supportedVersion}.`
4436
4742
  */
4437
4743
  createOperations() {
4438
4744
  const fetchFn = _Provider.getFetchFn(this.options);
4439
- const gqlClient = new GraphQLClient(this.url, {
4745
+ const gqlClient = new GraphQLClient(this.urlWithoutAuth, {
4440
4746
  fetch: (url, requestInit) => fetchFn(url, requestInit, this.options),
4441
4747
  responseMiddleware: (response) => {
4442
4748
  if ("response" in response) {
@@ -4454,7 +4760,7 @@ Supported fuel-core version: ${supportedVersion}.`
4454
4760
  const isSubscription = opDefinition?.operation === "subscription";
4455
4761
  if (isSubscription) {
4456
4762
  return FuelGraphqlSubscriber.create({
4457
- url: this.url,
4763
+ url: this.urlWithoutAuth,
4458
4764
  query,
4459
4765
  fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
4460
4766
  variables: vars
@@ -4517,7 +4823,7 @@ Supported fuel-core version: ${supportedVersion}.`
4517
4823
  utxoValidation: nodeInfo.utxoValidation,
4518
4824
  vmBacktrace: nodeInfo.vmBacktrace
4519
4825
  };
4520
- _Provider.nodeInfoCache[this.url] = processedNodeInfo;
4826
+ _Provider.nodeInfoCache[this.urlWithoutAuth] = processedNodeInfo;
4521
4827
  return processedNodeInfo;
4522
4828
  }
4523
4829
  /**
@@ -4528,7 +4834,7 @@ Supported fuel-core version: ${supportedVersion}.`
4528
4834
  async fetchChain() {
4529
4835
  const { chain } = await this.operations.getChain();
4530
4836
  const processedChain = processGqlChain(chain);
4531
- _Provider.chainInfoCache[this.url] = processedChain;
4837
+ _Provider.chainInfoCache[this.urlWithoutAuth] = processedChain;
4532
4838
  return processedChain;
4533
4839
  }
4534
4840
  /**
@@ -4556,13 +4862,13 @@ Supported fuel-core version: ${supportedVersion}.`
4556
4862
  validateTransaction(tx, consensusParameters) {
4557
4863
  const { maxOutputs, maxInputs } = consensusParameters.txParameters;
4558
4864
  if (bn17(tx.inputs.length).gt(maxInputs)) {
4559
- throw new FuelError15(
4865
+ throw new FuelError16(
4560
4866
  ErrorCode14.MAX_INPUTS_EXCEEDED,
4561
4867
  "The transaction exceeds the maximum allowed number of inputs."
4562
4868
  );
4563
4869
  }
4564
4870
  if (bn17(tx.outputs.length).gt(maxOutputs)) {
4565
- throw new FuelError15(
4871
+ throw new FuelError16(
4566
4872
  ErrorCode14.MAX_OUTPUTS_EXCEEDED,
4567
4873
  "The transaction exceeds the maximum allowed number of outputs."
4568
4874
  );
@@ -4585,7 +4891,7 @@ Supported fuel-core version: ${supportedVersion}.`
4585
4891
  }
4586
4892
  const { consensusParameters } = this.getChain();
4587
4893
  this.validateTransaction(transactionRequest, consensusParameters);
4588
- const encodedTransaction = hexlify13(transactionRequest.toTransactionBytes());
4894
+ const encodedTransaction = hexlify15(transactionRequest.toTransactionBytes());
4589
4895
  let abis;
4590
4896
  if (isTransactionTypeScript(transactionRequest)) {
4591
4897
  abis = transactionRequest.abis;
@@ -4609,7 +4915,7 @@ Supported fuel-core version: ${supportedVersion}.`
4609
4915
  if (estimateTxDependencies) {
4610
4916
  return this.estimateTxDependencies(transactionRequest);
4611
4917
  }
4612
- const encodedTransaction = hexlify13(transactionRequest.toTransactionBytes());
4918
+ const encodedTransaction = hexlify15(transactionRequest.toTransactionBytes());
4613
4919
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4614
4920
  encodedTransactions: encodedTransaction,
4615
4921
  utxoValidation: utxoValidation || false
@@ -4629,13 +4935,13 @@ Supported fuel-core version: ${supportedVersion}.`
4629
4935
  async estimatePredicates(transactionRequest) {
4630
4936
  const shouldEstimatePredicates = Boolean(
4631
4937
  transactionRequest.inputs.find(
4632
- (input) => "predicate" in input && input.predicate && !equalBytes(arrayify11(input.predicate), arrayify11("0x")) && new BN2(input.predicateGasUsed).isZero()
4938
+ (input) => "predicate" in input && input.predicate && !equalBytes(arrayify12(input.predicate), arrayify12("0x")) && new BN2(input.predicateGasUsed).isZero()
4633
4939
  )
4634
4940
  );
4635
4941
  if (!shouldEstimatePredicates) {
4636
4942
  return transactionRequest;
4637
4943
  }
4638
- const encodedTransaction = hexlify13(transactionRequest.toTransactionBytes());
4944
+ const encodedTransaction = hexlify15(transactionRequest.toTransactionBytes());
4639
4945
  const response = await this.operations.estimatePredicates({
4640
4946
  encodedTransaction
4641
4947
  });
@@ -4676,7 +4982,7 @@ Supported fuel-core version: ${supportedVersion}.`
4676
4982
  const {
4677
4983
  dryRun: [{ receipts: rawReceipts, status }]
4678
4984
  } = await this.operations.dryRun({
4679
- encodedTransactions: [hexlify13(transactionRequest.toTransactionBytes())],
4985
+ encodedTransactions: [hexlify15(transactionRequest.toTransactionBytes())],
4680
4986
  utxoValidation: false
4681
4987
  });
4682
4988
  receipts = rawReceipts.map(processGqlReceipt);
@@ -4722,11 +5028,11 @@ Supported fuel-core version: ${supportedVersion}.`
4722
5028
  missingContractIds: [],
4723
5029
  dryRunStatus: void 0
4724
5030
  }));
4725
- const allRequests = clone6(transactionRequests);
5031
+ const allRequests = clone8(transactionRequests);
4726
5032
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
4727
5033
  allRequests.forEach((req, index) => {
4728
5034
  if (isTransactionTypeScript(req)) {
4729
- serializedTransactionsMap.set(index, hexlify13(req.toTransactionBytes()));
5035
+ serializedTransactionsMap.set(index, hexlify15(req.toTransactionBytes()));
4730
5036
  }
4731
5037
  });
4732
5038
  let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
@@ -4762,7 +5068,7 @@ Supported fuel-core version: ${supportedVersion}.`
4762
5068
  transactionRequest: request
4763
5069
  });
4764
5070
  request.maxFee = maxFee;
4765
- serializedTransactionsMap.set(requestIdx, hexlify13(request.toTransactionBytes()));
5071
+ serializedTransactionsMap.set(requestIdx, hexlify15(request.toTransactionBytes()));
4766
5072
  nextRoundTransactions.push(requestIdx);
4767
5073
  }
4768
5074
  }
@@ -4783,7 +5089,7 @@ Supported fuel-core version: ${supportedVersion}.`
4783
5089
  if (estimateTxDependencies) {
4784
5090
  return this.estimateMultipleTxDependencies(transactionRequests);
4785
5091
  }
4786
- const encodedTransactions = transactionRequests.map((tx) => hexlify13(tx.toTransactionBytes()));
5092
+ const encodedTransactions = transactionRequests.map((tx) => hexlify15(tx.toTransactionBytes()));
4787
5093
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4788
5094
  encodedTransactions,
4789
5095
  utxoValidation: utxoValidation || false
@@ -4857,7 +5163,7 @@ Supported fuel-core version: ${supportedVersion}.`
4857
5163
  if (estimateTxDependencies) {
4858
5164
  return this.estimateTxDependencies(transactionRequest);
4859
5165
  }
4860
- const encodedTransactions = [hexlify13(transactionRequest.toTransactionBytes())];
5166
+ const encodedTransactions = [hexlify15(transactionRequest.toTransactionBytes())];
4861
5167
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4862
5168
  encodedTransactions,
4863
5169
  utxoValidation: true
@@ -4882,13 +5188,13 @@ Supported fuel-core version: ${supportedVersion}.`
4882
5188
  * @returns A promise that resolves to the transaction cost object.
4883
5189
  */
4884
5190
  async getTransactionCost(transactionRequestLike, { signatureCallback } = {}) {
4885
- const txRequestClone = clone6(transactionRequestify(transactionRequestLike));
5191
+ const txRequestClone = clone8(transactionRequestify(transactionRequestLike));
4886
5192
  const updateMaxFee = txRequestClone.maxFee.eq(0);
4887
5193
  const isScriptTransaction = isTransactionTypeScript(txRequestClone);
4888
5194
  if (isScriptTransaction) {
4889
5195
  txRequestClone.gasLimit = bn17(0);
4890
5196
  }
4891
- const signedRequest = clone6(txRequestClone);
5197
+ const signedRequest = clone8(txRequestClone);
4892
5198
  let addedSignatures = 0;
4893
5199
  if (signatureCallback && isTransactionTypeScript(signedRequest)) {
4894
5200
  const lengthBefore = signedRequest.witnesses.length;
@@ -4956,7 +5262,7 @@ Supported fuel-core version: ${supportedVersion}.`
4956
5262
  paginationLimit: RESOURCES_PAGE_SIZE_LIMIT,
4957
5263
  inputArgs: paginationArgs
4958
5264
  }),
4959
- filter: { owner: ownerAddress.toB256(), assetId: assetId && hexlify13(assetId) }
5265
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && hexlify15(assetId) }
4960
5266
  });
4961
5267
  const coins = edges.map(({ node }) => ({
4962
5268
  id: node.utxoId,
@@ -4982,8 +5288,8 @@ Supported fuel-core version: ${supportedVersion}.`
4982
5288
  async getResourcesToSpend(owner, quantities, excludedIds) {
4983
5289
  const ownerAddress = Address2.fromAddressOrString(owner);
4984
5290
  const excludeInput = {
4985
- messages: excludedIds?.messages?.map((nonce) => hexlify13(nonce)) || [],
4986
- utxos: excludedIds?.utxos?.map((id) => hexlify13(id)) || []
5291
+ messages: excludedIds?.messages?.map((nonce) => hexlify15(nonce)) || [],
5292
+ utxos: excludedIds?.utxos?.map((id) => hexlify15(id)) || []
4987
5293
  };
4988
5294
  if (this.cache) {
4989
5295
  const cached = this.cache.getActiveData();
@@ -4993,7 +5299,7 @@ Supported fuel-core version: ${supportedVersion}.`
4993
5299
  const coinsQuery = {
4994
5300
  owner: ownerAddress.toB256(),
4995
5301
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
4996
- assetId: hexlify13(assetId),
5302
+ assetId: hexlify15(assetId),
4997
5303
  amount: amount.toString(10),
4998
5304
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
4999
5305
  })),
@@ -5148,7 +5454,7 @@ Supported fuel-core version: ${supportedVersion}.`
5148
5454
  },
5149
5455
  transactionIds: block.transactions.map((tx) => tx.id),
5150
5456
  transactions: block.transactions.map(
5151
- (tx) => new TransactionCoder5().decode(arrayify11(tx.rawPayload), 0)?.[0]
5457
+ (tx) => new TransactionCoder5().decode(arrayify12(tx.rawPayload), 0)?.[0]
5152
5458
  )
5153
5459
  };
5154
5460
  }
@@ -5165,11 +5471,11 @@ Supported fuel-core version: ${supportedVersion}.`
5165
5471
  }
5166
5472
  try {
5167
5473
  return new TransactionCoder5().decode(
5168
- arrayify11(transaction.rawPayload),
5474
+ arrayify12(transaction.rawPayload),
5169
5475
  0
5170
5476
  )?.[0];
5171
5477
  } catch (error) {
5172
- if (error instanceof FuelError15 && error.code === ErrorCode14.UNSUPPORTED_TRANSACTION_TYPE) {
5478
+ if (error instanceof FuelError16 && error.code === ErrorCode14.UNSUPPORTED_TRANSACTION_TYPE) {
5173
5479
  console.warn("Unsupported transaction type encountered");
5174
5480
  return null;
5175
5481
  }
@@ -5188,9 +5494,9 @@ Supported fuel-core version: ${supportedVersion}.`
5188
5494
  const coder = new TransactionCoder5();
5189
5495
  const transactions = edges.map(({ node: { rawPayload } }) => {
5190
5496
  try {
5191
- return coder.decode(arrayify11(rawPayload), 0)[0];
5497
+ return coder.decode(arrayify12(rawPayload), 0)[0];
5192
5498
  } catch (error) {
5193
- if (error instanceof FuelError15 && error.code === ErrorCode14.UNSUPPORTED_TRANSACTION_TYPE) {
5499
+ if (error instanceof FuelError16 && error.code === ErrorCode14.UNSUPPORTED_TRANSACTION_TYPE) {
5194
5500
  console.warn("Unsupported transaction type encountered");
5195
5501
  return null;
5196
5502
  }
@@ -5222,7 +5528,7 @@ Supported fuel-core version: ${supportedVersion}.`
5222
5528
  async getContractBalance(contractId, assetId) {
5223
5529
  const { contractBalance } = await this.operations.getContractBalance({
5224
5530
  contract: Address2.fromAddressOrString(contractId).toB256(),
5225
- asset: hexlify13(assetId)
5531
+ asset: hexlify15(assetId)
5226
5532
  });
5227
5533
  return bn17(contractBalance.amount, 10);
5228
5534
  }
@@ -5236,7 +5542,7 @@ Supported fuel-core version: ${supportedVersion}.`
5236
5542
  async getBalance(owner, assetId) {
5237
5543
  const { balance } = await this.operations.getBalance({
5238
5544
  owner: Address2.fromAddressOrString(owner).toB256(),
5239
- assetId: hexlify13(assetId)
5545
+ assetId: hexlify15(assetId)
5240
5546
  });
5241
5547
  return bn17(balance.amount, 10);
5242
5548
  }
@@ -5316,7 +5622,7 @@ Supported fuel-core version: ${supportedVersion}.`
5316
5622
  nonce
5317
5623
  };
5318
5624
  if (commitBlockId && commitBlockHeight) {
5319
- throw new FuelError15(
5625
+ throw new FuelError16(
5320
5626
  ErrorCode14.INVALID_INPUT_PARAMETERS,
5321
5627
  "commitBlockId and commitBlockHeight cannot be used together"
5322
5628
  );
@@ -5500,25 +5806,25 @@ Supported fuel-core version: ${supportedVersion}.`
5500
5806
  const { paginationLimit, inputArgs = {} } = params;
5501
5807
  const { first, last, after, before } = inputArgs;
5502
5808
  if (after && before) {
5503
- throw new FuelError15(
5809
+ throw new FuelError16(
5504
5810
  ErrorCode14.INVALID_INPUT_PARAMETERS,
5505
5811
  'Pagination arguments "after" and "before" cannot be used together'
5506
5812
  );
5507
5813
  }
5508
5814
  if ((first || 0) > paginationLimit || (last || 0) > paginationLimit) {
5509
- throw new FuelError15(
5815
+ throw new FuelError16(
5510
5816
  ErrorCode14.INVALID_INPUT_PARAMETERS,
5511
5817
  `Pagination limit for this query cannot exceed ${paginationLimit} items`
5512
5818
  );
5513
5819
  }
5514
5820
  if (first && before) {
5515
- throw new FuelError15(
5821
+ throw new FuelError16(
5516
5822
  ErrorCode14.INVALID_INPUT_PARAMETERS,
5517
5823
  'The use of pagination argument "first" with "before" is not supported'
5518
5824
  );
5519
5825
  }
5520
5826
  if (last && after) {
5521
- throw new FuelError15(
5827
+ throw new FuelError16(
5522
5828
  ErrorCode14.INVALID_INPUT_PARAMETERS,
5523
5829
  'The use of pagination argument "last" with "after" is not supported'
5524
5830
  );
@@ -5573,23 +5879,23 @@ __publicField(Provider, "chainInfoCache", {});
5573
5879
  __publicField(Provider, "nodeInfoCache", {});
5574
5880
 
5575
5881
  // src/providers/transaction-summary/get-transaction-summary.ts
5576
- import { ErrorCode as ErrorCode15, FuelError as FuelError16 } from "@fuel-ts/errors";
5882
+ import { ErrorCode as ErrorCode15, FuelError as FuelError17 } from "@fuel-ts/errors";
5577
5883
  import { bn as bn18 } from "@fuel-ts/math";
5578
5884
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
5579
- import { arrayify as arrayify12 } from "@fuel-ts/utils";
5885
+ import { arrayify as arrayify13 } from "@fuel-ts/utils";
5580
5886
  async function getTransactionSummary(params) {
5581
5887
  const { id, provider, abiMap } = params;
5582
5888
  const { transaction: gqlTransaction } = await provider.operations.getTransactionWithReceipts({
5583
5889
  transactionId: id
5584
5890
  });
5585
5891
  if (!gqlTransaction) {
5586
- throw new FuelError16(
5892
+ throw new FuelError17(
5587
5893
  ErrorCode15.TRANSACTION_NOT_FOUND,
5588
5894
  `Transaction not found for given id: ${id}.`
5589
5895
  );
5590
5896
  }
5591
5897
  const [decodedTransaction] = new TransactionCoder6().decode(
5592
- arrayify12(gqlTransaction.rawPayload),
5898
+ arrayify13(gqlTransaction.rawPayload),
5593
5899
  0
5594
5900
  );
5595
5901
  let txReceipts = [];
@@ -5610,7 +5916,7 @@ async function getTransactionSummary(params) {
5610
5916
  id: gqlTransaction.id,
5611
5917
  receipts,
5612
5918
  transaction: decodedTransaction,
5613
- transactionBytes: arrayify12(gqlTransaction.rawPayload),
5919
+ transactionBytes: arrayify13(gqlTransaction.rawPayload),
5614
5920
  gqlTransactionStatus: gqlTransaction.status,
5615
5921
  gasPerByte: bn18(gasPerByte),
5616
5922
  gasPriceFactor: bn18(gasPriceFactor),
@@ -5666,7 +5972,7 @@ async function getTransactionsSummaries(params) {
5666
5972
  const transactions = edges.map((edge) => {
5667
5973
  const { node: gqlTransaction } = edge;
5668
5974
  const { id, rawPayload, status } = gqlTransaction;
5669
- const [decodedTransaction] = new TransactionCoder6().decode(arrayify12(rawPayload), 0);
5975
+ const [decodedTransaction] = new TransactionCoder6().decode(arrayify13(rawPayload), 0);
5670
5976
  let txReceipts = [];
5671
5977
  if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
5672
5978
  txReceipts = gqlTransaction.status.receipts;
@@ -5676,7 +5982,7 @@ async function getTransactionsSummaries(params) {
5676
5982
  id,
5677
5983
  receipts,
5678
5984
  transaction: decodedTransaction,
5679
- transactionBytes: arrayify12(rawPayload),
5985
+ transactionBytes: arrayify13(rawPayload),
5680
5986
  gqlTransactionStatus: status,
5681
5987
  abiMap,
5682
5988
  gasPerByte,
@@ -5701,12 +6007,14 @@ async function getTransactionsSummaries(params) {
5701
6007
  // src/providers/chains.ts
5702
6008
  var CHAIN_IDS = {
5703
6009
  eth: {
6010
+ mainnet: 1,
5704
6011
  sepolia: 11155111,
5705
6012
  foundry: 31337
5706
6013
  },
5707
6014
  fuel: {
5708
6015
  devnet: 0,
5709
- testnet: 0
6016
+ testnet: 0,
6017
+ mainnet: 9889
5710
6018
  }
5711
6019
  };
5712
6020
 
@@ -5806,6 +6114,11 @@ var rawAssets = [
5806
6114
  chainId: CHAIN_IDS.eth.foundry,
5807
6115
  decimals: 18
5808
6116
  },
6117
+ {
6118
+ type: "ethereum",
6119
+ chainId: CHAIN_IDS.eth.mainnet,
6120
+ decimals: 18
6121
+ },
5809
6122
  {
5810
6123
  type: "fuel",
5811
6124
  chainId: CHAIN_IDS.fuel.devnet,
@@ -5817,6 +6130,532 @@ var rawAssets = [
5817
6130
  chainId: CHAIN_IDS.fuel.testnet,
5818
6131
  decimals: 9,
5819
6132
  assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
6133
+ },
6134
+ {
6135
+ type: "fuel",
6136
+ chainId: CHAIN_IDS.fuel.mainnet,
6137
+ decimals: 9,
6138
+ assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
6139
+ }
6140
+ ]
6141
+ },
6142
+ {
6143
+ name: "WETH",
6144
+ symbol: "WETH",
6145
+ icon: "weth.svg",
6146
+ networks: [
6147
+ {
6148
+ type: "ethereum",
6149
+ chainId: CHAIN_IDS.eth.mainnet,
6150
+ address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
6151
+ decimals: 18
6152
+ },
6153
+ {
6154
+ type: "fuel",
6155
+ chainId: CHAIN_IDS.fuel.mainnet,
6156
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6157
+ assetId: "0xa38a5a8beeb08d95744bc7f58528073f4052b254def59eba20c99c202b5acaa3",
6158
+ decimals: 9
6159
+ }
6160
+ ]
6161
+ },
6162
+ {
6163
+ name: "weETH",
6164
+ symbol: "weETH",
6165
+ icon: "weETH.webp",
6166
+ networks: [
6167
+ {
6168
+ type: "ethereum",
6169
+ chainId: CHAIN_IDS.eth.mainnet,
6170
+ address: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
6171
+ decimals: 18
6172
+ },
6173
+ {
6174
+ type: "fuel",
6175
+ chainId: CHAIN_IDS.fuel.mainnet,
6176
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6177
+ assetId: "0x239ed6e12b7ce4089ee245244e3bf906999a6429c2a9a445a1e1faf56914a4ab",
6178
+ decimals: 9
6179
+ }
6180
+ ]
6181
+ },
6182
+ {
6183
+ name: "rsETH",
6184
+ symbol: "rsETH",
6185
+ icon: "rsETH.webp",
6186
+ networks: [
6187
+ {
6188
+ type: "ethereum",
6189
+ chainId: CHAIN_IDS.eth.mainnet,
6190
+ address: "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7",
6191
+ decimals: 18
6192
+ },
6193
+ {
6194
+ type: "fuel",
6195
+ chainId: CHAIN_IDS.fuel.mainnet,
6196
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6197
+ assetId: "0xbae80f7fb8aa6b90d9b01ef726ec847cc4f59419c4d5f2ea88fec785d1b0e849",
6198
+ decimals: 9
6199
+ }
6200
+ ]
6201
+ },
6202
+ {
6203
+ name: "rETH",
6204
+ symbol: "rETH",
6205
+ icon: "reth.svg",
6206
+ networks: [
6207
+ {
6208
+ type: "ethereum",
6209
+ chainId: CHAIN_IDS.eth.mainnet,
6210
+ address: "0xae78736cd615f374d3085123a210448e74fc6393",
6211
+ decimals: 18
6212
+ },
6213
+ {
6214
+ type: "fuel",
6215
+ chainId: CHAIN_IDS.fuel.mainnet,
6216
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6217
+ assetId: "0xf3f9a0ed0ce8eac5f89d6b83e41b3848212d5b5f56108c54a205bb228ca30c16",
6218
+ decimals: 9
6219
+ }
6220
+ ]
6221
+ },
6222
+ {
6223
+ name: "wbETH",
6224
+ symbol: "wbETH",
6225
+ icon: "wbeth.png",
6226
+ networks: [
6227
+ {
6228
+ type: "ethereum",
6229
+ chainId: CHAIN_IDS.eth.mainnet,
6230
+ address: "0xa2E3356610840701BDf5611a53974510Ae27E2e1",
6231
+ decimals: 18
6232
+ },
6233
+ {
6234
+ type: "fuel",
6235
+ chainId: CHAIN_IDS.fuel.mainnet,
6236
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6237
+ assetId: "0x7843c74bef935e837f2bcf67b5d64ecb46dd53ff86375530b0caf3699e8ffafe",
6238
+ decimals: 9
6239
+ }
6240
+ ]
6241
+ },
6242
+ {
6243
+ name: "rstETH",
6244
+ symbol: "rstETH",
6245
+ icon: "rstETH.webp",
6246
+ networks: [
6247
+ {
6248
+ type: "ethereum",
6249
+ chainId: CHAIN_IDS.eth.mainnet,
6250
+ address: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
6251
+ decimals: 18
6252
+ },
6253
+ {
6254
+ type: "fuel",
6255
+ chainId: CHAIN_IDS.fuel.mainnet,
6256
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6257
+ assetId: "0x962792286fbc9b1d5860b4551362a12249362c21594c77abf4b3fe2bbe8d977a",
6258
+ decimals: 9
6259
+ }
6260
+ ]
6261
+ },
6262
+ {
6263
+ name: "amphrETH",
6264
+ symbol: "amphrETH",
6265
+ icon: "amphrETH.png",
6266
+ networks: [
6267
+ {
6268
+ type: "ethereum",
6269
+ chainId: CHAIN_IDS.eth.mainnet,
6270
+ address: "0x5fD13359Ba15A84B76f7F87568309040176167cd",
6271
+ decimals: 18
6272
+ },
6273
+ {
6274
+ type: "fuel",
6275
+ chainId: CHAIN_IDS.fuel.mainnet,
6276
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6277
+ assetId: "0x05fc623e57bd7bc1258efa8e4f62b05af5471d73df6f2c2dc11ecc81134c4f36",
6278
+ decimals: 9
6279
+ }
6280
+ ]
6281
+ },
6282
+ {
6283
+ name: "Manta mBTC",
6284
+ symbol: "Manta mBTC",
6285
+ icon: "manta-mbtc.svg",
6286
+ networks: [
6287
+ {
6288
+ type: "ethereum",
6289
+ chainId: CHAIN_IDS.eth.mainnet,
6290
+ address: "0x4041381e947CFD3D483d67a25C6aa9Dc924250c5",
6291
+ decimals: 18
6292
+ },
6293
+ {
6294
+ type: "fuel",
6295
+ chainId: CHAIN_IDS.fuel.mainnet,
6296
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6297
+ assetId: "0xaf3111a248ff7a3238cdeea845bb2d43cf3835f1f6b8c9d28360728b55b9ce5b",
6298
+ decimals: 9
6299
+ }
6300
+ ]
6301
+ },
6302
+ {
6303
+ name: "Manta mETH",
6304
+ symbol: "Manta mETH",
6305
+ icon: "manta-meth.svg",
6306
+ networks: [
6307
+ {
6308
+ type: "ethereum",
6309
+ chainId: CHAIN_IDS.eth.mainnet,
6310
+ address: "0x8CdF550C04Bc9B9F10938368349C9c8051A772b6",
6311
+ decimals: 18
6312
+ },
6313
+ {
6314
+ type: "fuel",
6315
+ chainId: CHAIN_IDS.fuel.mainnet,
6316
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6317
+ assetId: "0xafd219f513317b1750783c6581f55530d6cf189a5863fd18bd1b3ffcec1714b4",
6318
+ decimals: 9
6319
+ }
6320
+ ]
6321
+ },
6322
+ {
6323
+ name: "Manta mUSD",
6324
+ symbol: "Manta mUSD",
6325
+ icon: "manta-musd.svg",
6326
+ networks: [
6327
+ {
6328
+ type: "ethereum",
6329
+ chainId: CHAIN_IDS.eth.mainnet,
6330
+ address: "0x3f24E1d7a973867fC2A03fE199E5502514E0e11E",
6331
+ decimals: 18
6332
+ },
6333
+ {
6334
+ type: "fuel",
6335
+ chainId: CHAIN_IDS.fuel.mainnet,
6336
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6337
+ assetId: "0x89cb9401e55d49c3269654dd1cdfb0e80e57823a4a7db98ba8fc5953b120fef4",
6338
+ decimals: 9
6339
+ }
6340
+ ]
6341
+ },
6342
+ {
6343
+ name: "pumpBTC",
6344
+ symbol: "pumpBTC",
6345
+ icon: "pumpbtc.webp",
6346
+ networks: [
6347
+ {
6348
+ type: "ethereum",
6349
+ chainId: CHAIN_IDS.eth.mainnet,
6350
+ address: "0xf469fbd2abcd6b9de8e169d128226c0fc90a012e",
6351
+ decimals: 8
6352
+ },
6353
+ {
6354
+ type: "fuel",
6355
+ chainId: CHAIN_IDS.fuel.mainnet,
6356
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6357
+ assetId: "0x0aa5eb2bb97ca915288b653a2529355d4dc66de2b37533213f0e4aeee3d3421f",
6358
+ decimals: 8
6359
+ }
6360
+ ]
6361
+ },
6362
+ {
6363
+ name: "FBTC",
6364
+ symbol: "FBTC",
6365
+ icon: "fbtc.svg",
6366
+ networks: [
6367
+ {
6368
+ type: "ethereum",
6369
+ chainId: CHAIN_IDS.eth.mainnet,
6370
+ address: "0xc96de26018a54d51c097160568752c4e3bd6c364",
6371
+ decimals: 8
6372
+ },
6373
+ {
6374
+ type: "fuel",
6375
+ chainId: CHAIN_IDS.fuel.mainnet,
6376
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6377
+ assetId: "0xb5ecb0a1e08e2abbabf624ffea089df933376855f468ade35c6375b00c33996a",
6378
+ decimals: 8
6379
+ }
6380
+ ]
6381
+ },
6382
+ {
6383
+ name: "SolvBTC",
6384
+ symbol: "SolvBTC",
6385
+ icon: "solvBTC.webp",
6386
+ networks: [
6387
+ {
6388
+ type: "ethereum",
6389
+ chainId: CHAIN_IDS.eth.mainnet,
6390
+ address: "0x7a56e1c57c7475ccf742a1832b028f0456652f97",
6391
+ decimals: 18
6392
+ },
6393
+ {
6394
+ type: "fuel",
6395
+ chainId: CHAIN_IDS.fuel.mainnet,
6396
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6397
+ assetId: "0x1186afea9affb88809c210e13e2330b5258c2cef04bb8fff5eff372b7bd3f40f",
6398
+ decimals: 9
6399
+ }
6400
+ ]
6401
+ },
6402
+ {
6403
+ name: "SolvBTC.BBN",
6404
+ symbol: "SolvBTC.BBN",
6405
+ icon: "SolvBTC.BBN.png",
6406
+ networks: [
6407
+ {
6408
+ type: "ethereum",
6409
+ chainId: CHAIN_IDS.eth.mainnet,
6410
+ address: "0xd9d920aa40f578ab794426f5c90f6c731d159def",
6411
+ decimals: 18
6412
+ },
6413
+ {
6414
+ type: "fuel",
6415
+ chainId: CHAIN_IDS.fuel.mainnet,
6416
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6417
+ assetId: "0x7a4f087c957d30218223c2baaaa365355c9ca81b6ea49004cfb1590a5399216f",
6418
+ decimals: 9
6419
+ }
6420
+ ]
6421
+ },
6422
+ {
6423
+ name: "Mantle mETH",
6424
+ symbol: "Mantle mETH",
6425
+ icon: "mantle-meth.svg",
6426
+ networks: [
6427
+ {
6428
+ type: "ethereum",
6429
+ chainId: CHAIN_IDS.eth.mainnet,
6430
+ address: "0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa",
6431
+ decimals: 18
6432
+ },
6433
+ {
6434
+ type: "fuel",
6435
+ chainId: CHAIN_IDS.fuel.mainnet,
6436
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6437
+ assetId: "0x642a5db59ec323c2f846d4d4cf3e58d78aff64accf4f8f6455ba0aa3ef000a3b",
6438
+ decimals: 9
6439
+ }
6440
+ ]
6441
+ },
6442
+ {
6443
+ name: "sDAI",
6444
+ symbol: "sDAI",
6445
+ icon: "sdai.svg",
6446
+ networks: [
6447
+ {
6448
+ type: "ethereum",
6449
+ chainId: CHAIN_IDS.eth.mainnet,
6450
+ address: "0x83f20f44975d03b1b09e64809b757c47f942beea",
6451
+ decimals: 18
6452
+ },
6453
+ {
6454
+ type: "fuel",
6455
+ chainId: CHAIN_IDS.fuel.mainnet,
6456
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6457
+ assetId: "0x9e46f919fbf978f3cad7cd34cca982d5613af63ff8aab6c379e4faa179552958",
6458
+ decimals: 9
6459
+ }
6460
+ ]
6461
+ },
6462
+ {
6463
+ name: "USDT",
6464
+ symbol: "USDT",
6465
+ icon: "usdt.svg",
6466
+ networks: [
6467
+ {
6468
+ type: "ethereum",
6469
+ chainId: CHAIN_IDS.eth.mainnet,
6470
+ address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
6471
+ decimals: 6
6472
+ },
6473
+ {
6474
+ type: "fuel",
6475
+ chainId: CHAIN_IDS.fuel.mainnet,
6476
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6477
+ assetId: "0xa0265fb5c32f6e8db3197af3c7eb05c48ae373605b8165b6f4a51c5b0ba4812e",
6478
+ decimals: 6
6479
+ }
6480
+ ]
6481
+ },
6482
+ {
6483
+ name: "USDC",
6484
+ symbol: "USDC",
6485
+ icon: "usdc.svg",
6486
+ networks: [
6487
+ {
6488
+ type: "ethereum",
6489
+ chainId: CHAIN_IDS.eth.mainnet,
6490
+ address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
6491
+ decimals: 6
6492
+ },
6493
+ {
6494
+ type: "fuel",
6495
+ chainId: CHAIN_IDS.fuel.mainnet,
6496
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6497
+ assetId: "0x286c479da40dc953bddc3bb4c453b608bba2e0ac483b077bd475174115395e6b",
6498
+ decimals: 6
6499
+ }
6500
+ ]
6501
+ },
6502
+ {
6503
+ name: "USDe",
6504
+ symbol: "USDe",
6505
+ icon: "USDe.svg",
6506
+ networks: [
6507
+ {
6508
+ type: "ethereum",
6509
+ chainId: CHAIN_IDS.eth.mainnet,
6510
+ address: "0x4c9edd5852cd905f086c759e8383e09bff1e68b3",
6511
+ decimals: 18
6512
+ },
6513
+ {
6514
+ type: "fuel",
6515
+ chainId: CHAIN_IDS.fuel.mainnet,
6516
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6517
+ assetId: "0xb6133b2ef9f6153eb869125d23dcf20d1e735331b5e41b15a6a7a6cec70e8651",
6518
+ decimals: 9
6519
+ }
6520
+ ]
6521
+ },
6522
+ {
6523
+ name: "sUSDe",
6524
+ symbol: "sUSDe",
6525
+ icon: "sUSDe.webp",
6526
+ networks: [
6527
+ {
6528
+ type: "ethereum",
6529
+ chainId: CHAIN_IDS.eth.mainnet,
6530
+ address: "0x9d39a5de30e57443bff2a8307a4256c8797a3497",
6531
+ decimals: 18
6532
+ },
6533
+ {
6534
+ type: "fuel",
6535
+ chainId: CHAIN_IDS.fuel.mainnet,
6536
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6537
+ assetId: "0xd05563025104fc36496c15c7021ad6b31034b0e89a356f4f818045d1f48808bc",
6538
+ decimals: 9
6539
+ }
6540
+ ]
6541
+ },
6542
+ {
6543
+ name: "rsUSDe",
6544
+ symbol: "rsUSDe",
6545
+ icon: "rsUSDe.svg",
6546
+ networks: [
6547
+ {
6548
+ type: "ethereum",
6549
+ chainId: CHAIN_IDS.eth.mainnet,
6550
+ address: "0x82f5104b23FF2FA54C2345F821dAc9369e9E0B26",
6551
+ decimals: 18
6552
+ },
6553
+ {
6554
+ type: "fuel",
6555
+ chainId: CHAIN_IDS.fuel.mainnet,
6556
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6557
+ assetId: "0x78d4522ec607f6e8efb66ea49439d1ee48623cf763f9688a8eada025def033d9",
6558
+ decimals: 9
6559
+ }
6560
+ ]
6561
+ },
6562
+ {
6563
+ name: "wstETH",
6564
+ symbol: "wstETH",
6565
+ icon: "wsteth.svg",
6566
+ networks: [
6567
+ {
6568
+ type: "ethereum",
6569
+ chainId: CHAIN_IDS.eth.mainnet,
6570
+ address: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
6571
+ decimals: 18
6572
+ },
6573
+ {
6574
+ type: "fuel",
6575
+ chainId: CHAIN_IDS.fuel.mainnet,
6576
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6577
+ assetId: "0x1a7815cc9f75db5c24a5b0814bfb706bb9fe485333e98254015de8f48f84c67b",
6578
+ decimals: 9
6579
+ }
6580
+ ]
6581
+ },
6582
+ {
6583
+ name: "ezETH",
6584
+ symbol: "ezETH",
6585
+ icon: "ezeth.webp",
6586
+ networks: [
6587
+ {
6588
+ type: "ethereum",
6589
+ chainId: CHAIN_IDS.eth.mainnet,
6590
+ address: "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110",
6591
+ decimals: 18
6592
+ },
6593
+ {
6594
+ type: "fuel",
6595
+ chainId: CHAIN_IDS.fuel.mainnet,
6596
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6597
+ assetId: "0x91b3559edb2619cde8ffb2aa7b3c3be97efd794ea46700db7092abeee62281b0",
6598
+ decimals: 9
6599
+ }
6600
+ ]
6601
+ },
6602
+ {
6603
+ name: "pzETH",
6604
+ symbol: "pzETH",
6605
+ icon: "pzETH.webp",
6606
+ networks: [
6607
+ {
6608
+ type: "ethereum",
6609
+ chainId: CHAIN_IDS.eth.mainnet,
6610
+ address: "0x8c9532a60e0e7c6bbd2b2c1303f63ace1c3e9811",
6611
+ decimals: 18
6612
+ },
6613
+ {
6614
+ type: "fuel",
6615
+ chainId: CHAIN_IDS.fuel.mainnet,
6616
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6617
+ assetId: "0x1493d4ec82124de8f9b625682de69dcccda79e882b89a55a8c737b12de67bd68",
6618
+ decimals: 9
6619
+ }
6620
+ ]
6621
+ },
6622
+ {
6623
+ name: "Re7LRT",
6624
+ symbol: "Re7LRT",
6625
+ icon: "Re7LRT.png",
6626
+ networks: [
6627
+ {
6628
+ type: "ethereum",
6629
+ chainId: CHAIN_IDS.eth.mainnet,
6630
+ address: "0x84631c0d0081FDe56DeB72F6DE77abBbF6A9f93a",
6631
+ decimals: 18
6632
+ },
6633
+ {
6634
+ type: "fuel",
6635
+ chainId: CHAIN_IDS.fuel.mainnet,
6636
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6637
+ assetId: "0xf2fc648c23a5db24610a1cf696acc4f0f6d9a7d6028dd9944964ab23f6e35995",
6638
+ decimals: 9
6639
+ }
6640
+ ]
6641
+ },
6642
+ {
6643
+ name: "steakLRT",
6644
+ symbol: "steakLRT",
6645
+ icon: "steakLRT.png",
6646
+ networks: [
6647
+ {
6648
+ type: "ethereum",
6649
+ chainId: CHAIN_IDS.eth.mainnet,
6650
+ address: "0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc",
6651
+ decimals: 18
6652
+ },
6653
+ {
6654
+ type: "fuel",
6655
+ chainId: CHAIN_IDS.fuel.mainnet,
6656
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6657
+ assetId: "0x4fc8ac9f101df07e2c2dec4a53c8c42c439bdbe5e36ea2d863a61ff60afafc30",
6658
+ decimals: 9
5820
6659
  }
5821
6660
  ]
5822
6661
  }
@@ -5840,16 +6679,16 @@ var mergeQuantities = (...coinQuantities) => {
5840
6679
  // src/utils/formatTransferToContractScriptData.ts
5841
6680
  import { BigNumberCoder as BigNumberCoder2 } from "@fuel-ts/abi-coder";
5842
6681
  import { BN as BN3 } from "@fuel-ts/math";
5843
- import { arrayify as arrayify13 } from "@fuel-ts/utils";
6682
+ import { arrayify as arrayify14 } from "@fuel-ts/utils";
5844
6683
  import * as asm from "@fuels/vm-asm";
5845
6684
  var formatTransferToContractScriptData = (params) => {
5846
6685
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
5847
6686
  const numberCoder = new BigNumberCoder2("u64");
5848
6687
  const encoded = numberCoder.encode(new BN3(amountToTransfer).toNumber());
5849
6688
  const scriptData = Uint8Array.from([
5850
- ...arrayify13(hexlifiedContractId),
6689
+ ...arrayify14(hexlifiedContractId),
5851
6690
  ...encoded,
5852
- ...arrayify13(assetId)
6691
+ ...arrayify14(assetId)
5853
6692
  ]);
5854
6693
  return scriptData;
5855
6694
  };
@@ -5910,7 +6749,7 @@ var Account = class extends AbstractAccount {
5910
6749
  */
5911
6750
  get provider() {
5912
6751
  if (!this._provider) {
5913
- throw new FuelError17(ErrorCode16.MISSING_PROVIDER, "Provider not set");
6752
+ throw new FuelError18(ErrorCode16.MISSING_PROVIDER, "Provider not set");
5914
6753
  }
5915
6754
  return this._provider;
5916
6755
  }
@@ -6028,7 +6867,7 @@ var Account = class extends AbstractAccount {
6028
6867
  );
6029
6868
  request.addResources(resources);
6030
6869
  request.updatePredicateGasUsed(estimatedPredicates);
6031
- const requestToReestimate2 = clone7(request);
6870
+ const requestToReestimate2 = clone9(request);
6032
6871
  if (addedSignatures) {
6033
6872
  Array.from({ length: addedSignatures }).forEach(
6034
6873
  () => requestToReestimate2.addEmptyWitness()
@@ -6061,13 +6900,13 @@ var Account = class extends AbstractAccount {
6061
6900
  fundingAttempts += 1;
6062
6901
  }
6063
6902
  if (needsToBeFunded) {
6064
- throw new FuelError17(
6903
+ throw new FuelError18(
6065
6904
  ErrorCode16.NOT_ENOUGH_FUNDS,
6066
6905
  `The account ${this.address} does not have enough base asset funds to cover the transaction execution.`
6067
6906
  );
6068
6907
  }
6069
6908
  request.updatePredicateGasUsed(estimatedPredicates);
6070
- const requestToReestimate = clone7(request);
6909
+ const requestToReestimate = clone9(request);
6071
6910
  if (addedSignatures) {
6072
6911
  Array.from({ length: addedSignatures }).forEach(() => requestToReestimate.addEmptyWitness());
6073
6912
  }
@@ -6167,7 +7006,7 @@ var Account = class extends AbstractAccount {
6167
7006
  */
6168
7007
  async transferToContract(contractId, amount, assetId, txParams = {}) {
6169
7008
  if (bn19(amount).lte(0)) {
6170
- throw new FuelError17(
7009
+ throw new FuelError18(
6171
7010
  ErrorCode16.INVALID_TRANSFER_AMOUNT,
6172
7011
  "Transfer amount must be a positive number."
6173
7012
  );
@@ -6207,14 +7046,14 @@ var Account = class extends AbstractAccount {
6207
7046
  */
6208
7047
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
6209
7048
  const recipientAddress = Address3.fromAddressOrString(recipient);
6210
- const recipientDataArray = arrayify14(
7049
+ const recipientDataArray = arrayify15(
6211
7050
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
6212
7051
  );
6213
- const amountDataArray = arrayify14(
7052
+ const amountDataArray = arrayify15(
6214
7053
  "0x".concat(bn19(amount).toHex().substring(2).padStart(16, "0"))
6215
7054
  );
6216
7055
  const script = new Uint8Array([
6217
- ...arrayify14(withdrawScript.bytes),
7056
+ ...arrayify15(withdrawScript.bytes),
6218
7057
  ...recipientDataArray,
6219
7058
  ...amountDataArray
6220
7059
  ]);
@@ -6243,7 +7082,7 @@ var Account = class extends AbstractAccount {
6243
7082
  * @returns A promise that resolves to the transaction cost object.
6244
7083
  */
6245
7084
  async getTransactionCost(transactionRequestLike, { signatureCallback, quantities = [] } = {}) {
6246
- const txRequestClone = clone7(transactionRequestify(transactionRequestLike));
7085
+ const txRequestClone = clone9(transactionRequestify(transactionRequestLike));
6247
7086
  const baseAssetId = this.provider.getBaseAssetId();
6248
7087
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
6249
7088
  const requiredQuantities = mergeQuantities(coinOutputsQuantities, quantities);
@@ -6294,7 +7133,7 @@ var Account = class extends AbstractAccount {
6294
7133
  */
6295
7134
  async signMessage(message) {
6296
7135
  if (!this._connector) {
6297
- throw new FuelError17(ErrorCode16.MISSING_CONNECTOR, "A connector is required to sign messages.");
7136
+ throw new FuelError18(ErrorCode16.MISSING_CONNECTOR, "A connector is required to sign messages.");
6298
7137
  }
6299
7138
  return this._connector.signMessage(this.address.toString(), message);
6300
7139
  }
@@ -6306,7 +7145,7 @@ var Account = class extends AbstractAccount {
6306
7145
  */
6307
7146
  async signTransaction(transactionRequestLike) {
6308
7147
  if (!this._connector) {
6309
- throw new FuelError17(
7148
+ throw new FuelError18(
6310
7149
  ErrorCode16.MISSING_CONNECTOR,
6311
7150
  "A connector is required to sign transactions."
6312
7151
  );
@@ -6356,7 +7195,7 @@ var Account = class extends AbstractAccount {
6356
7195
  */
6357
7196
  generateFakeResources(coins) {
6358
7197
  return coins.map((coin) => ({
6359
- id: hexlify14(randomBytes2(UTXO_ID_LEN3)),
7198
+ id: hexlify16(randomBytes2(UTXO_ID_LEN3)),
6360
7199
  owner: this.address,
6361
7200
  blockCreated: bn19(1),
6362
7201
  txCreatedIdx: bn19(1),
@@ -6366,7 +7205,7 @@ var Account = class extends AbstractAccount {
6366
7205
  /** @hidden * */
6367
7206
  validateTransferAmount(amount) {
6368
7207
  if (bn19(amount).lte(0)) {
6369
- throw new FuelError17(
7208
+ throw new FuelError18(
6370
7209
  ErrorCode16.INVALID_TRANSFER_AMOUNT,
6371
7210
  "Transfer amount must be a positive number."
6372
7211
  );
@@ -6396,7 +7235,7 @@ var Account = class extends AbstractAccount {
6396
7235
  if (!isDefined3(setGasLimit)) {
6397
7236
  request.gasLimit = gasUsed;
6398
7237
  } else if (gasUsed.gt(setGasLimit)) {
6399
- throw new FuelError17(
7238
+ throw new FuelError18(
6400
7239
  ErrorCode16.GAS_LIMIT_TOO_LOW,
6401
7240
  `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
6402
7241
  );
@@ -6404,7 +7243,7 @@ var Account = class extends AbstractAccount {
6404
7243
  if (!isDefined3(setMaxFee)) {
6405
7244
  request.maxFee = maxFee;
6406
7245
  } else if (maxFee.gt(setMaxFee)) {
6407
- throw new FuelError17(
7246
+ throw new FuelError18(
6408
7247
  ErrorCode16.MAX_FEE_TOO_LOW,
6409
7248
  `Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
6410
7249
  );
@@ -6415,14 +7254,14 @@ var Account = class extends AbstractAccount {
6415
7254
 
6416
7255
  // src/wallet/base-wallet-unlocked.ts
6417
7256
  import { hashMessage } from "@fuel-ts/hasher";
6418
- import { hexlify as hexlify17 } from "@fuel-ts/utils";
7257
+ import { hexlify as hexlify19 } from "@fuel-ts/utils";
6419
7258
 
6420
7259
  // src/signer/signer.ts
6421
7260
  import { Address as Address4 } from "@fuel-ts/address";
6422
7261
  import { randomBytes as randomBytes3 } from "@fuel-ts/crypto";
6423
- import { hash } from "@fuel-ts/hasher";
7262
+ import { hash as hash2 } from "@fuel-ts/hasher";
6424
7263
  import { toBytes } from "@fuel-ts/math";
6425
- import { hexlify as hexlify15, concat as concat3, arrayify as arrayify15 } from "@fuel-ts/utils";
7264
+ import { hexlify as hexlify17, concat as concat3, arrayify as arrayify16 } from "@fuel-ts/utils";
6426
7265
  import { secp256k1 } from "@noble/curves/secp256k1";
6427
7266
  var Signer = class {
6428
7267
  address;
@@ -6442,9 +7281,9 @@ var Signer = class {
6442
7281
  }
6443
7282
  }
6444
7283
  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));
7284
+ this.privateKey = hexlify17(privateKeyBytes);
7285
+ this.publicKey = hexlify17(secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
7286
+ this.compressedPublicKey = hexlify17(secp256k1.getPublicKey(privateKeyBytes, true));
6448
7287
  this.address = Address4.fromPublicKey(this.publicKey);
6449
7288
  }
6450
7289
  /**
@@ -6458,11 +7297,11 @@ var Signer = class {
6458
7297
  * @returns hashed signature
6459
7298
  */
6460
7299
  sign(data) {
6461
- const signature = secp256k1.sign(arrayify15(data), arrayify15(this.privateKey));
7300
+ const signature = secp256k1.sign(arrayify16(data), arrayify16(this.privateKey));
6462
7301
  const r = toBytes(`0x${signature.r.toString(16)}`, 32);
6463
7302
  const s = toBytes(`0x${signature.s.toString(16)}`, 32);
6464
7303
  s[0] |= (signature.recovery || 0) << 7;
6465
- return hexlify15(concat3([r, s]));
7304
+ return hexlify17(concat3([r, s]));
6466
7305
  }
6467
7306
  /**
6468
7307
  * Add point on the current elliptic curve
@@ -6471,8 +7310,8 @@ var Signer = class {
6471
7310
  * @returns compressed point on the curve
6472
7311
  */
6473
7312
  addPoint(point) {
6474
- const p0 = secp256k1.ProjectivePoint.fromHex(arrayify15(this.compressedPublicKey));
6475
- const p1 = secp256k1.ProjectivePoint.fromHex(arrayify15(point));
7313
+ const p0 = secp256k1.ProjectivePoint.fromHex(arrayify16(this.compressedPublicKey));
7314
+ const p1 = secp256k1.ProjectivePoint.fromHex(arrayify16(point));
6476
7315
  const result = p0.add(p1);
6477
7316
  return `0x${result.toHex(true)}`;
6478
7317
  }
@@ -6484,16 +7323,16 @@ var Signer = class {
6484
7323
  * @returns public key from signature from the
6485
7324
  */
6486
7325
  static recoverPublicKey(data, signature) {
6487
- const signedMessageBytes = arrayify15(signature);
7326
+ const signedMessageBytes = arrayify16(signature);
6488
7327
  const r = signedMessageBytes.slice(0, 32);
6489
7328
  const s = signedMessageBytes.slice(32, 64);
6490
7329
  const recoveryParam = (s[0] & 128) >> 7;
6491
7330
  s[0] &= 127;
6492
- const sig = new secp256k1.Signature(BigInt(hexlify15(r)), BigInt(hexlify15(s))).addRecoveryBit(
7331
+ const sig = new secp256k1.Signature(BigInt(hexlify17(r)), BigInt(hexlify17(s))).addRecoveryBit(
6493
7332
  recoveryParam
6494
7333
  );
6495
- const publicKey = sig.recoverPublicKey(arrayify15(data)).toRawBytes(false).slice(1);
6496
- return hexlify15(publicKey);
7334
+ const publicKey = sig.recoverPublicKey(arrayify16(data)).toRawBytes(false).slice(1);
7335
+ return hexlify17(publicKey);
6497
7336
  }
6498
7337
  /**
6499
7338
  * Recover the address from a signature performed with [`sign`](#sign).
@@ -6512,7 +7351,7 @@ var Signer = class {
6512
7351
  * @returns random 32-byte hashed
6513
7352
  */
6514
7353
  static generatePrivateKey(entropy) {
6515
- return entropy ? hash(concat3([randomBytes3(32), arrayify15(entropy)])) : randomBytes3(32);
7354
+ return entropy ? hash2(concat3([randomBytes3(32), arrayify16(entropy)])) : randomBytes3(32);
6516
7355
  }
6517
7356
  /**
6518
7357
  * Extended publicKey from a compact publicKey
@@ -6521,8 +7360,8 @@ var Signer = class {
6521
7360
  * @returns extended publicKey
6522
7361
  */
6523
7362
  static extendPublicKey(publicKey) {
6524
- const point = secp256k1.ProjectivePoint.fromHex(arrayify15(publicKey));
6525
- return hexlify15(point.toRawBytes(false).slice(1));
7363
+ const point = secp256k1.ProjectivePoint.fromHex(arrayify16(publicKey));
7364
+ return hexlify17(point.toRawBytes(false).slice(1));
6526
7365
  }
6527
7366
  };
6528
7367
 
@@ -6538,8 +7377,8 @@ import {
6538
7377
  encryptJsonWalletData,
6539
7378
  randomUUID
6540
7379
  } 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";
7380
+ import { ErrorCode as ErrorCode17, FuelError as FuelError19 } from "@fuel-ts/errors";
7381
+ import { hexlify as hexlify18 } from "@fuel-ts/utils";
6543
7382
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
6544
7383
  var DEFAULT_KDF_PARAMS_R = 8;
6545
7384
  var DEFAULT_KDF_PARAMS_P = 1;
@@ -6615,13 +7454,13 @@ async function decryptKeystoreWallet(jsonWallet, password) {
6615
7454
  const macHashUint8Array = keccak256(data);
6616
7455
  const macHash = stringFromBuffer(macHashUint8Array, "hex");
6617
7456
  if (mac !== macHash) {
6618
- throw new FuelError18(
7457
+ throw new FuelError19(
6619
7458
  ErrorCode17.INVALID_PASSWORD,
6620
7459
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
6621
7460
  );
6622
7461
  }
6623
7462
  const buffer = await decryptJsonWalletData(ciphertextBuffer, key, ivBuffer);
6624
- const privateKey = hexlify16(buffer);
7463
+ const privateKey = hexlify18(buffer);
6625
7464
  return privateKey;
6626
7465
  }
6627
7466
 
@@ -6666,7 +7505,7 @@ var BaseWalletUnlocked = class extends Account {
6666
7505
  */
6667
7506
  async signMessage(message) {
6668
7507
  const signedMessage = await this.signer().sign(hashMessage(message));
6669
- return hexlify17(signedMessage);
7508
+ return hexlify19(signedMessage);
6670
7509
  }
6671
7510
  /**
6672
7511
  * Signs a transaction with the wallet's private key.
@@ -6679,7 +7518,7 @@ var BaseWalletUnlocked = class extends Account {
6679
7518
  const chainId = this.provider.getChainId();
6680
7519
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
6681
7520
  const signature = await this.signer().sign(hashedTransaction);
6682
- return hexlify17(signature);
7521
+ return hexlify19(signature);
6683
7522
  }
6684
7523
  /**
6685
7524
  * Populates a transaction with the witnesses signature.
@@ -6746,16 +7585,16 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
6746
7585
 
6747
7586
  // src/hdwallet/hdwallet.ts
6748
7587
  import { computeHmac as computeHmac2, ripemd160 } from "@fuel-ts/crypto";
6749
- import { ErrorCode as ErrorCode20, FuelError as FuelError21 } from "@fuel-ts/errors";
7588
+ import { ErrorCode as ErrorCode20, FuelError as FuelError22 } from "@fuel-ts/errors";
6750
7589
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
6751
7590
  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";
7591
+ import { arrayify as arrayify19, hexlify as hexlify21, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
6753
7592
 
6754
7593
  // src/mnemonic/mnemonic.ts
6755
7594
  import { randomBytes as randomBytes5, pbkdf2, computeHmac } from "@fuel-ts/crypto";
6756
- import { ErrorCode as ErrorCode19, FuelError as FuelError20 } from "@fuel-ts/errors";
7595
+ import { ErrorCode as ErrorCode19, FuelError as FuelError21 } from "@fuel-ts/errors";
6757
7596
  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";
7597
+ import { arrayify as arrayify18, hexlify as hexlify20, concat as concat4, dataSlice, encodeBase58, toUtf8Bytes } from "@fuel-ts/utils";
6759
7598
 
6760
7599
  // src/wordlists/words/english.ts
6761
7600
  var english = [
@@ -8816,9 +9655,9 @@ var Language = /* @__PURE__ */ ((Language2) => {
8816
9655
  })(Language || {});
8817
9656
 
8818
9657
  // src/mnemonic/utils.ts
8819
- import { ErrorCode as ErrorCode18, FuelError as FuelError19 } from "@fuel-ts/errors";
9658
+ import { ErrorCode as ErrorCode18, FuelError as FuelError20 } from "@fuel-ts/errors";
8820
9659
  import { sha256 as sha2562 } from "@fuel-ts/hasher";
8821
- import { arrayify as arrayify16 } from "@fuel-ts/utils";
9660
+ import { arrayify as arrayify17 } from "@fuel-ts/utils";
8822
9661
  function getLowerMask(bits) {
8823
9662
  return (1 << bits) - 1;
8824
9663
  }
@@ -8853,19 +9692,19 @@ function entropyToMnemonicIndices(entropy) {
8853
9692
  }
8854
9693
  }
8855
9694
  const checksumBits = entropy.length / 4;
8856
- const checksum = arrayify16(sha2562(entropy))[0] & getUpperMask(checksumBits);
9695
+ const checksum = arrayify17(sha2562(entropy))[0] & getUpperMask(checksumBits);
8857
9696
  indices[indices.length - 1] <<= checksumBits;
8858
9697
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
8859
9698
  return indices;
8860
9699
  }
8861
9700
  function mnemonicWordsToEntropy(words, wordlist) {
8862
9701
  const size = Math.ceil(11 * words.length / 8);
8863
- const entropy = arrayify16(new Uint8Array(size));
9702
+ const entropy = arrayify17(new Uint8Array(size));
8864
9703
  let offset = 0;
8865
9704
  for (let i = 0; i < words.length; i += 1) {
8866
9705
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
8867
9706
  if (index === -1) {
8868
- throw new FuelError19(
9707
+ throw new FuelError20(
8869
9708
  ErrorCode18.INVALID_MNEMONIC,
8870
9709
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
8871
9710
  );
@@ -8880,9 +9719,9 @@ function mnemonicWordsToEntropy(words, wordlist) {
8880
9719
  const entropyBits = 32 * words.length / 3;
8881
9720
  const checksumBits = words.length / 3;
8882
9721
  const checksumMask = getUpperMask(checksumBits);
8883
- const checksum = arrayify16(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
9722
+ const checksum = arrayify17(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
8884
9723
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
8885
- throw new FuelError19(
9724
+ throw new FuelError20(
8886
9725
  ErrorCode18.INVALID_CHECKSUM,
8887
9726
  "Checksum validation failed for the provided mnemonic."
8888
9727
  );
@@ -8897,7 +9736,7 @@ var TestnetPRV = "0x04358394";
8897
9736
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
8898
9737
  function assertWordList(wordlist) {
8899
9738
  if (wordlist.length !== 2048) {
8900
- throw new FuelError20(
9739
+ throw new FuelError21(
8901
9740
  ErrorCode19.INVALID_WORD_LIST,
8902
9741
  `Expected word list length of 2048, but got ${wordlist.length}.`
8903
9742
  );
@@ -8905,7 +9744,7 @@ function assertWordList(wordlist) {
8905
9744
  }
8906
9745
  function assertEntropy(entropy) {
8907
9746
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
8908
- throw new FuelError20(
9747
+ throw new FuelError21(
8909
9748
  ErrorCode19.INVALID_ENTROPY,
8910
9749
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
8911
9750
  );
@@ -8916,7 +9755,7 @@ function assertMnemonic(words) {
8916
9755
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
8917
9756
  ", "
8918
9757
  )}] words, but got ${words.length}.`;
8919
- throw new FuelError20(ErrorCode19.INVALID_MNEMONIC, errorMsg);
9758
+ throw new FuelError21(ErrorCode19.INVALID_MNEMONIC, errorMsg);
8920
9759
  }
8921
9760
  }
8922
9761
  var Mnemonic = class {
@@ -8955,7 +9794,7 @@ var Mnemonic = class {
8955
9794
  static mnemonicToEntropy(phrase, wordlist = english) {
8956
9795
  const words = getWords(phrase);
8957
9796
  assertMnemonic(words);
8958
- return hexlify18(mnemonicWordsToEntropy(words, wordlist));
9797
+ return hexlify20(mnemonicWordsToEntropy(words, wordlist));
8959
9798
  }
8960
9799
  /**
8961
9800
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -8963,7 +9802,7 @@ var Mnemonic = class {
8963
9802
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
8964
9803
  */
8965
9804
  static entropyToMnemonic(entropy, wordlist = english) {
8966
- const entropyBytes = arrayify17(entropy);
9805
+ const entropyBytes = arrayify18(entropy);
8967
9806
  assertWordList(wordlist);
8968
9807
  assertEntropy(entropyBytes);
8969
9808
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -9032,14 +9871,14 @@ var Mnemonic = class {
9032
9871
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
9033
9872
  */
9034
9873
  static masterKeysFromSeed(seed) {
9035
- const seedArray = arrayify17(seed);
9874
+ const seedArray = arrayify18(seed);
9036
9875
  if (seedArray.length < 16 || seedArray.length > 64) {
9037
- throw new FuelError20(
9876
+ throw new FuelError21(
9038
9877
  ErrorCode19.INVALID_SEED,
9039
9878
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
9040
9879
  );
9041
9880
  }
9042
- return arrayify17(computeHmac("sha512", MasterSecret, seedArray));
9881
+ return arrayify18(computeHmac("sha512", MasterSecret, seedArray));
9043
9882
  }
9044
9883
  /**
9045
9884
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -9050,7 +9889,7 @@ var Mnemonic = class {
9050
9889
  */
9051
9890
  static seedToExtendedKey(seed, testnet = false) {
9052
9891
  const masterKey = Mnemonic.masterKeysFromSeed(seed);
9053
- const prefix = arrayify17(testnet ? TestnetPRV : MainnetPRV);
9892
+ const prefix = arrayify18(testnet ? TestnetPRV : MainnetPRV);
9054
9893
  const depth = "0x00";
9055
9894
  const fingerprint = "0x00000000";
9056
9895
  const index = "0x00000000";
@@ -9080,7 +9919,7 @@ var Mnemonic = class {
9080
9919
  * @returns A randomly generated mnemonic
9081
9920
  */
9082
9921
  static generate(size = 32, extraEntropy = "") {
9083
- const entropy = extraEntropy ? sha2563(concat4([randomBytes5(size), arrayify17(extraEntropy)])) : randomBytes5(size);
9922
+ const entropy = extraEntropy ? sha2563(concat4([randomBytes5(size), arrayify18(extraEntropy)])) : randomBytes5(size);
9084
9923
  return Mnemonic.entropyToMnemonic(entropy);
9085
9924
  }
9086
9925
  };
@@ -9088,10 +9927,10 @@ var mnemonic_default = Mnemonic;
9088
9927
 
9089
9928
  // src/hdwallet/hdwallet.ts
9090
9929
  var HARDENED_INDEX = 2147483648;
9091
- var MainnetPRV2 = hexlify19("0x0488ade4");
9092
- var MainnetPUB = hexlify19("0x0488b21e");
9093
- var TestnetPRV2 = hexlify19("0x04358394");
9094
- var TestnetPUB = hexlify19("0x043587cf");
9930
+ var MainnetPRV2 = hexlify21("0x0488ade4");
9931
+ var MainnetPUB = hexlify21("0x0488b21e");
9932
+ var TestnetPRV2 = hexlify21("0x04358394");
9933
+ var TestnetPUB = hexlify21("0x043587cf");
9095
9934
  function base58check(data) {
9096
9935
  return encodeBase582(concat5([data, dataSlice2(sha2564(sha2564(data)), 0, 4)]));
9097
9936
  }
@@ -9102,17 +9941,17 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
9102
9941
  return testnet ? TestnetPRV2 : MainnetPRV2;
9103
9942
  }
9104
9943
  function isPublicExtendedKey(extendedKey) {
9105
- return [MainnetPUB, TestnetPUB].includes(hexlify19(extendedKey.slice(0, 4)));
9944
+ return [MainnetPUB, TestnetPUB].includes(hexlify21(extendedKey.slice(0, 4)));
9106
9945
  }
9107
9946
  function isValidExtendedKey(extendedKey) {
9108
9947
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
9109
- hexlify19(extendedKey.slice(0, 4))
9948
+ hexlify21(extendedKey.slice(0, 4))
9110
9949
  );
9111
9950
  }
9112
9951
  function parsePath(path, depth = 0) {
9113
9952
  const components = path.split("/");
9114
9953
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
9115
- throw new FuelError21(ErrorCode20.HD_WALLET_ERROR, `invalid path - ${path}`);
9954
+ throw new FuelError22(ErrorCode20.HD_WALLET_ERROR, `invalid path - ${path}`);
9116
9955
  }
9117
9956
  if (components[0] === "m") {
9118
9957
  components.shift();
@@ -9124,8 +9963,8 @@ function parsePath(path, depth = 0) {
9124
9963
  var HDWallet = class {
9125
9964
  depth = 0;
9126
9965
  index = 0;
9127
- fingerprint = hexlify19("0x00000000");
9128
- parentFingerprint = hexlify19("0x00000000");
9966
+ fingerprint = hexlify21("0x00000000");
9967
+ parentFingerprint = hexlify21("0x00000000");
9129
9968
  privateKey;
9130
9969
  publicKey;
9131
9970
  chainCode;
@@ -9137,16 +9976,16 @@ var HDWallet = class {
9137
9976
  constructor(config) {
9138
9977
  if (config.privateKey) {
9139
9978
  const signer = new Signer(config.privateKey);
9140
- this.publicKey = hexlify19(signer.compressedPublicKey);
9141
- this.privateKey = hexlify19(config.privateKey);
9979
+ this.publicKey = hexlify21(signer.compressedPublicKey);
9980
+ this.privateKey = hexlify21(config.privateKey);
9142
9981
  } else {
9143
9982
  if (!config.publicKey) {
9144
- throw new FuelError21(
9983
+ throw new FuelError22(
9145
9984
  ErrorCode20.HD_WALLET_ERROR,
9146
9985
  "Both public and private Key cannot be missing. At least one should be provided."
9147
9986
  );
9148
9987
  }
9149
- this.publicKey = hexlify19(config.publicKey);
9988
+ this.publicKey = hexlify21(config.publicKey);
9150
9989
  }
9151
9990
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
9152
9991
  this.fingerprint = dataSlice2(ripemd160(sha2564(this.publicKey)), 0, 4);
@@ -9165,23 +10004,23 @@ var HDWallet = class {
9165
10004
  * @returns A new instance of HDWallet on the derived index
9166
10005
  */
9167
10006
  deriveIndex(index) {
9168
- const privateKey = this.privateKey && arrayify18(this.privateKey);
9169
- const publicKey = arrayify18(this.publicKey);
9170
- const chainCode = arrayify18(this.chainCode);
10007
+ const privateKey = this.privateKey && arrayify19(this.privateKey);
10008
+ const publicKey = arrayify19(this.publicKey);
10009
+ const chainCode = arrayify19(this.chainCode);
9171
10010
  const data = new Uint8Array(37);
9172
10011
  if (index & HARDENED_INDEX) {
9173
10012
  if (!privateKey) {
9174
- throw new FuelError21(
10013
+ throw new FuelError22(
9175
10014
  ErrorCode20.HD_WALLET_ERROR,
9176
10015
  "Cannot derive a hardened index without a private Key."
9177
10016
  );
9178
10017
  }
9179
10018
  data.set(privateKey, 1);
9180
10019
  } else {
9181
- data.set(arrayify18(this.publicKey));
10020
+ data.set(arrayify19(this.publicKey));
9182
10021
  }
9183
10022
  data.set(toBytes2(index, 4), 33);
9184
- const bytes = arrayify18(computeHmac2("sha512", chainCode, data));
10023
+ const bytes = arrayify19(computeHmac2("sha512", chainCode, data));
9185
10024
  const IL = bytes.slice(0, 32);
9186
10025
  const IR = bytes.slice(32);
9187
10026
  if (privateKey) {
@@ -9195,7 +10034,7 @@ var HDWallet = class {
9195
10034
  parentFingerprint: this.fingerprint
9196
10035
  });
9197
10036
  }
9198
- const signer = new Signer(hexlify19(IL));
10037
+ const signer = new Signer(hexlify21(IL));
9199
10038
  const Ki = signer.addPoint(publicKey);
9200
10039
  return new HDWallet({
9201
10040
  publicKey: Ki,
@@ -9224,18 +10063,18 @@ var HDWallet = class {
9224
10063
  */
9225
10064
  toExtendedKey(isPublic = false, testnet = false) {
9226
10065
  if (this.depth >= 256) {
9227
- throw new FuelError21(
10066
+ throw new FuelError22(
9228
10067
  ErrorCode20.HD_WALLET_ERROR,
9229
10068
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
9230
10069
  );
9231
10070
  }
9232
10071
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
9233
- const depth = hexlify19(Uint8Array.from([this.depth]));
10072
+ const depth = hexlify21(Uint8Array.from([this.depth]));
9234
10073
  const parentFingerprint = this.parentFingerprint;
9235
10074
  const index = toHex(this.index, 4);
9236
10075
  const chainCode = this.chainCode;
9237
10076
  const key = this.privateKey != null && !isPublic ? concat5(["0x00", this.privateKey]) : this.publicKey;
9238
- const extendedKey = arrayify18(concat5([prefix, depth, parentFingerprint, index, chainCode, key]));
10077
+ const extendedKey = arrayify19(concat5([prefix, depth, parentFingerprint, index, chainCode, key]));
9239
10078
  return base58check(extendedKey);
9240
10079
  }
9241
10080
  /**
@@ -9247,34 +10086,34 @@ var HDWallet = class {
9247
10086
  static fromSeed(seed) {
9248
10087
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
9249
10088
  return new HDWallet({
9250
- chainCode: arrayify18(masterKey.slice(32)),
9251
- privateKey: arrayify18(masterKey.slice(0, 32))
10089
+ chainCode: arrayify19(masterKey.slice(32)),
10090
+ privateKey: arrayify19(masterKey.slice(0, 32))
9252
10091
  });
9253
10092
  }
9254
10093
  static fromExtendedKey(extendedKey) {
9255
- const decoded = hexlify19(toBytes2(decodeBase58(extendedKey)));
9256
- const bytes = arrayify18(decoded);
10094
+ const decoded = hexlify21(toBytes2(decodeBase58(extendedKey)));
10095
+ const bytes = arrayify19(decoded);
9257
10096
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
9258
10097
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
9259
- throw new FuelError21(ErrorCode20.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
10098
+ throw new FuelError22(ErrorCode20.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
9260
10099
  }
9261
10100
  if (!validChecksum) {
9262
- throw new FuelError21(ErrorCode20.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
10101
+ throw new FuelError22(ErrorCode20.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
9263
10102
  }
9264
10103
  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));
10104
+ const parentFingerprint = hexlify21(bytes.slice(5, 9));
10105
+ const index = parseInt(hexlify21(bytes.slice(9, 13)).substring(2), 16);
10106
+ const chainCode = hexlify21(bytes.slice(13, 45));
9268
10107
  const key = bytes.slice(45, 78);
9269
10108
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
9270
- throw new FuelError21(
10109
+ throw new FuelError22(
9271
10110
  ErrorCode20.HD_WALLET_ERROR,
9272
10111
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
9273
10112
  );
9274
10113
  }
9275
10114
  if (isPublicExtendedKey(bytes)) {
9276
10115
  if (key[0] !== 3) {
9277
- throw new FuelError21(ErrorCode20.HD_WALLET_ERROR, "Invalid public extended key.");
10116
+ throw new FuelError22(ErrorCode20.HD_WALLET_ERROR, "Invalid public extended key.");
9278
10117
  }
9279
10118
  return new HDWallet({
9280
10119
  publicKey: key,
@@ -9285,7 +10124,7 @@ var HDWallet = class {
9285
10124
  });
9286
10125
  }
9287
10126
  if (key[0] !== 0) {
9288
- throw new FuelError21(ErrorCode20.HD_WALLET_ERROR, "Invalid private extended key.");
10127
+ throw new FuelError22(ErrorCode20.HD_WALLET_ERROR, "Invalid private extended key.");
9289
10128
  }
9290
10129
  return new HDWallet({
9291
10130
  privateKey: key.slice(1),
@@ -9453,7 +10292,7 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
9453
10292
  // src/wallet-manager/wallet-manager.ts
9454
10293
  import { Address as Address8 } from "@fuel-ts/address";
9455
10294
  import { encrypt, decrypt } from "@fuel-ts/crypto";
9456
- import { ErrorCode as ErrorCode23, FuelError as FuelError24 } from "@fuel-ts/errors";
10295
+ import { ErrorCode as ErrorCode23, FuelError as FuelError25 } from "@fuel-ts/errors";
9457
10296
  import { EventEmitter } from "events";
9458
10297
 
9459
10298
  // src/wallet-manager/storages/memory-storage.ts
@@ -9476,7 +10315,7 @@ var MemoryStorage = class {
9476
10315
 
9477
10316
  // src/wallet-manager/vaults/mnemonic-vault.ts
9478
10317
  import { Address as Address6 } from "@fuel-ts/address";
9479
- import { ErrorCode as ErrorCode21, FuelError as FuelError22 } from "@fuel-ts/errors";
10318
+ import { ErrorCode as ErrorCode21, FuelError as FuelError23 } from "@fuel-ts/errors";
9480
10319
  var _secret;
9481
10320
  var MnemonicVault = class {
9482
10321
  constructor(options) {
@@ -9532,7 +10371,7 @@ var MnemonicVault = class {
9532
10371
  }
9533
10372
  numberOfAccounts += 1;
9534
10373
  } while (numberOfAccounts < this.numberOfAccounts);
9535
- throw new FuelError22(
10374
+ throw new FuelError23(
9536
10375
  ErrorCode21.WALLET_MANAGER_ERROR,
9537
10376
  `Account with address '${address}' not found in derived wallets.`
9538
10377
  );
@@ -9547,7 +10386,7 @@ __publicField(MnemonicVault, "type", "mnemonic");
9547
10386
 
9548
10387
  // src/wallet-manager/vaults/privatekey-vault.ts
9549
10388
  import { Address as Address7 } from "@fuel-ts/address";
9550
- import { ErrorCode as ErrorCode22, FuelError as FuelError23 } from "@fuel-ts/errors";
10389
+ import { ErrorCode as ErrorCode22, FuelError as FuelError24 } from "@fuel-ts/errors";
9551
10390
  var _privateKeys;
9552
10391
  var PrivateKeyVault = class {
9553
10392
  /**
@@ -9588,7 +10427,7 @@ var PrivateKeyVault = class {
9588
10427
  (pk) => Wallet.fromPrivateKey(pk).address.equals(ownerAddress)
9589
10428
  );
9590
10429
  if (!privateKey) {
9591
- throw new FuelError23(
10430
+ throw new FuelError24(
9592
10431
  ErrorCode22.WALLET_MANAGER_ERROR,
9593
10432
  `No private key found for address '${address}'.`
9594
10433
  );
@@ -9613,7 +10452,7 @@ var ERROR_MESSAGES = {
9613
10452
  };
9614
10453
  function assert(condition, message) {
9615
10454
  if (!condition) {
9616
- throw new FuelError24(ErrorCode23.WALLET_MANAGER_ERROR, message);
10455
+ throw new FuelError25(ErrorCode23.WALLET_MANAGER_ERROR, message);
9617
10456
  }
9618
10457
  }
9619
10458
  var _vaults, _passphrase, _isLocked, _serializeVaults, serializeVaults_fn, _deserializeVaults, deserializeVaults_fn;
@@ -9839,25 +10678,25 @@ deserializeVaults_fn = function(vaults) {
9839
10678
  __publicField(WalletManager, "Vaults", [MnemonicVault, PrivateKeyVault]);
9840
10679
 
9841
10680
  // src/wallet-manager/types.ts
9842
- import { ErrorCode as ErrorCode24, FuelError as FuelError25 } from "@fuel-ts/errors";
10681
+ import { ErrorCode as ErrorCode24, FuelError as FuelError26 } from "@fuel-ts/errors";
9843
10682
  var Vault = class {
9844
10683
  constructor(_options) {
9845
- throw new FuelError25(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
10684
+ throw new FuelError26(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
9846
10685
  }
9847
10686
  serialize() {
9848
- throw new FuelError25(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
10687
+ throw new FuelError26(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
9849
10688
  }
9850
10689
  getAccounts() {
9851
- throw new FuelError25(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
10690
+ throw new FuelError26(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
9852
10691
  }
9853
10692
  addAccount() {
9854
- throw new FuelError25(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
10693
+ throw new FuelError26(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
9855
10694
  }
9856
10695
  exportAccount(_address) {
9857
- throw new FuelError25(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
10696
+ throw new FuelError26(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
9858
10697
  }
9859
10698
  getWallet(_address) {
9860
- throw new FuelError25(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
10699
+ throw new FuelError26(ErrorCode24.NOT_IMPLEMENTED, "Not implemented.");
9861
10700
  }
9862
10701
  };
9863
10702
  __publicField(Vault, "type");
@@ -9867,19 +10706,19 @@ var StorageAbstract = class {
9867
10706
  // src/predicate/predicate.ts
9868
10707
  import { Interface as Interface4 } from "@fuel-ts/abi-coder";
9869
10708
  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";
10709
+ import { ErrorCode as ErrorCode25, FuelError as FuelError27 } from "@fuel-ts/errors";
10710
+ import { arrayify as arrayify21, hexlify as hexlify23 } from "@fuel-ts/utils";
9872
10711
 
9873
10712
  // src/predicate/utils/getPredicateRoot.ts
9874
- import { hash as hash2 } from "@fuel-ts/hasher";
10713
+ import { hash as hash3 } from "@fuel-ts/hasher";
9875
10714
  import { calcRoot } from "@fuel-ts/merkle";
9876
- import { chunkAndPadBytes, hexlify as hexlify20, concat as concat6, arrayify as arrayify19 } from "@fuel-ts/utils";
10715
+ import { chunkAndPadBytes, hexlify as hexlify22, concat as concat6, arrayify as arrayify20 } from "@fuel-ts/utils";
9877
10716
  var getPredicateRoot = (bytecode) => {
9878
10717
  const chunkSize = 16 * 1024;
9879
- const bytes = arrayify19(bytecode);
10718
+ const bytes = arrayify20(bytecode);
9880
10719
  const chunks = chunkAndPadBytes(bytes, chunkSize);
9881
- const codeRoot = calcRoot(chunks.map((c) => hexlify20(c)));
9882
- const predicateRoot = hash2(concat6(["0x4655454C", codeRoot]));
10720
+ const codeRoot = calcRoot(chunks.map((c) => hexlify22(c)));
10721
+ const predicateRoot = hash3(concat6(["0x4655454C", codeRoot]));
9883
10722
  return predicateRoot;
9884
10723
  };
9885
10724
 
@@ -9931,8 +10770,8 @@ var Predicate = class extends Account {
9931
10770
  }
9932
10771
  request.inputs.filter(isRequestInputCoinOrMessage).forEach((input) => {
9933
10772
  if (isRequestInputResourceFromOwner(input, this.address)) {
9934
- input.predicate = hexlify21(this.bytes);
9935
- input.predicateData = hexlify21(this.getPredicateData());
10773
+ input.predicate = hexlify23(this.bytes);
10774
+ input.predicateData = hexlify23(this.getPredicateData());
9936
10775
  input.witnessIndex = 0;
9937
10776
  }
9938
10777
  });
@@ -9974,12 +10813,12 @@ var Predicate = class extends Account {
9974
10813
  * @returns An object containing the new predicate bytes and interface.
9975
10814
  */
9976
10815
  static processPredicateData(bytes, jsonAbi, configurableConstants) {
9977
- let predicateBytes = arrayify20(bytes);
10816
+ let predicateBytes = arrayify21(bytes);
9978
10817
  let abiInterface;
9979
10818
  if (jsonAbi) {
9980
10819
  abiInterface = new Interface4(jsonAbi);
9981
10820
  if (abiInterface.functions.main === void 0) {
9982
- throw new FuelError26(
10821
+ throw new FuelError27(
9983
10822
  ErrorCode25.ABI_MAIN_METHOD_MISSING,
9984
10823
  'Cannot use ABI without "main" function.'
9985
10824
  );
@@ -10012,8 +10851,8 @@ var Predicate = class extends Account {
10012
10851
  );
10013
10852
  return resources.map((resource) => ({
10014
10853
  ...resource,
10015
- predicate: hexlify21(this.bytes),
10016
- predicateData: hexlify21(this.getPredicateData())
10854
+ predicate: hexlify23(this.bytes),
10855
+ predicateData: hexlify23(this.getPredicateData())
10017
10856
  }));
10018
10857
  }
10019
10858
  /**
@@ -10025,8 +10864,8 @@ var Predicate = class extends Account {
10025
10864
  generateFakeResources(coins) {
10026
10865
  return super.generateFakeResources(coins).map((coin) => ({
10027
10866
  ...coin,
10028
- predicate: hexlify21(this.bytes),
10029
- predicateData: hexlify21(this.getPredicateData())
10867
+ predicate: hexlify23(this.bytes),
10868
+ predicateData: hexlify23(this.getPredicateData())
10030
10869
  }));
10031
10870
  }
10032
10871
  /**
@@ -10041,20 +10880,20 @@ var Predicate = class extends Account {
10041
10880
  const mutatedBytes = bytes;
10042
10881
  try {
10043
10882
  if (!abiInterface) {
10044
- throw new FuelError26(
10883
+ throw new FuelError27(
10045
10884
  ErrorCode25.INVALID_CONFIGURABLE_CONSTANTS,
10046
10885
  "Cannot validate configurable constants because the Predicate was instantiated without a JSON ABI"
10047
10886
  );
10048
10887
  }
10049
10888
  if (Object.keys(abiInterface.configurables).length === 0) {
10050
- throw new FuelError26(
10889
+ throw new FuelError27(
10051
10890
  ErrorCode25.INVALID_CONFIGURABLE_CONSTANTS,
10052
10891
  "Predicate has no configurable constants to be set"
10053
10892
  );
10054
10893
  }
10055
10894
  Object.entries(configurableConstants).forEach(([key, value]) => {
10056
10895
  if (!abiInterface?.configurables[key]) {
10057
- throw new FuelError26(
10896
+ throw new FuelError27(
10058
10897
  ErrorCode25.CONFIGURABLE_NOT_FOUND,
10059
10898
  `No configurable constant named '${key}' found in the Predicate`
10060
10899
  );
@@ -10064,7 +10903,7 @@ var Predicate = class extends Account {
10064
10903
  mutatedBytes.set(encoded, offset);
10065
10904
  });
10066
10905
  } catch (err) {
10067
- throw new FuelError26(
10906
+ throw new FuelError27(
10068
10907
  ErrorCode25.INVALID_CONFIGURABLE_CONSTANTS,
10069
10908
  `Error setting configurable constants: ${err.message}.`
10070
10909
  );
@@ -10096,10 +10935,10 @@ var Predicate = class extends Account {
10096
10935
  };
10097
10936
 
10098
10937
  // src/connectors/fuel.ts
10099
- import { ErrorCode as ErrorCode26, FuelError as FuelError29 } from "@fuel-ts/errors";
10938
+ import { ErrorCode as ErrorCode26, FuelError as FuelError30 } from "@fuel-ts/errors";
10100
10939
 
10101
10940
  // src/connectors/fuel-connector.ts
10102
- import { FuelError as FuelError27 } from "@fuel-ts/errors";
10941
+ import { FuelError as FuelError28 } from "@fuel-ts/errors";
10103
10942
  import { EventEmitter as EventEmitter2 } from "events";
10104
10943
 
10105
10944
  // src/connectors/types/connector-types.ts
@@ -10165,6 +11004,7 @@ var FuelConnector = class extends EventEmitter2 {
10165
11004
  metadata = {};
10166
11005
  connected = false;
10167
11006
  installed = false;
11007
+ external = true;
10168
11008
  events = FuelConnectorEventTypes;
10169
11009
  /**
10170
11010
  * Should return true if the connector is loaded
@@ -10173,7 +11013,7 @@ var FuelConnector = class extends EventEmitter2 {
10173
11013
  * @returns Always true.
10174
11014
  */
10175
11015
  async ping() {
10176
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11016
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10177
11017
  }
10178
11018
  /**
10179
11019
  * Should return the current version of the connector
@@ -10182,7 +11022,7 @@ var FuelConnector = class extends EventEmitter2 {
10182
11022
  * @returns boolean - connection status.
10183
11023
  */
10184
11024
  async version() {
10185
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11025
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10186
11026
  }
10187
11027
  /**
10188
11028
  * Should return true if the connector is connected
@@ -10191,7 +11031,7 @@ var FuelConnector = class extends EventEmitter2 {
10191
11031
  * @returns The connection status.
10192
11032
  */
10193
11033
  async isConnected() {
10194
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11034
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10195
11035
  }
10196
11036
  /**
10197
11037
  * Should return all the accounts authorized for the
@@ -10200,7 +11040,7 @@ var FuelConnector = class extends EventEmitter2 {
10200
11040
  * @returns The accounts addresses strings
10201
11041
  */
10202
11042
  async accounts() {
10203
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11043
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10204
11044
  }
10205
11045
  /**
10206
11046
  * Should start the connection process and return
@@ -10212,7 +11052,7 @@ var FuelConnector = class extends EventEmitter2 {
10212
11052
  * @returns boolean - connection status.
10213
11053
  */
10214
11054
  async connect() {
10215
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11055
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10216
11056
  }
10217
11057
  /**
10218
11058
  * Should disconnect the current connection and
@@ -10222,7 +11062,7 @@ var FuelConnector = class extends EventEmitter2 {
10222
11062
  * @returns The connection status.
10223
11063
  */
10224
11064
  async disconnect() {
10225
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11065
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10226
11066
  }
10227
11067
  /**
10228
11068
  * Should start the sign message process and return
@@ -10234,7 +11074,7 @@ var FuelConnector = class extends EventEmitter2 {
10234
11074
  * @returns Message signature
10235
11075
  */
10236
11076
  async signMessage(_address, _message) {
10237
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11077
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10238
11078
  }
10239
11079
  /**
10240
11080
  * Should start the sign transaction process and return
@@ -10246,7 +11086,7 @@ var FuelConnector = class extends EventEmitter2 {
10246
11086
  * @returns Transaction signature
10247
11087
  */
10248
11088
  async signTransaction(_address, _transaction) {
10249
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11089
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10250
11090
  }
10251
11091
  /**
10252
11092
  * Should start the send transaction process and return
@@ -10262,7 +11102,7 @@ var FuelConnector = class extends EventEmitter2 {
10262
11102
  * @returns The transaction id
10263
11103
  */
10264
11104
  async sendTransaction(_address, _transaction) {
10265
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11105
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10266
11106
  }
10267
11107
  /**
10268
11108
  * Should return the current account selected inside the connector, if the account
@@ -10273,7 +11113,7 @@ var FuelConnector = class extends EventEmitter2 {
10273
11113
  * @returns The current account selected otherwise null.
10274
11114
  */
10275
11115
  async currentAccount() {
10276
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11116
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10277
11117
  }
10278
11118
  /**
10279
11119
  * Should add the assets metadata to the connector and return true if the asset
@@ -10287,7 +11127,7 @@ var FuelConnector = class extends EventEmitter2 {
10287
11127
  * @returns True if the asset was added successfully
10288
11128
  */
10289
11129
  async addAssets(_assets) {
10290
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11130
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10291
11131
  }
10292
11132
  /**
10293
11133
  * Should add the asset metadata to the connector and return true if the asset
@@ -10301,7 +11141,7 @@ var FuelConnector = class extends EventEmitter2 {
10301
11141
  * @returns True if the asset was added successfully
10302
11142
  */
10303
11143
  async addAsset(_asset) {
10304
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11144
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10305
11145
  }
10306
11146
  /**
10307
11147
  * Should return all the assets added to the connector. If a connection is already established.
@@ -10309,7 +11149,7 @@ var FuelConnector = class extends EventEmitter2 {
10309
11149
  * @returns Array of assets metadata from the connector vinculated to the all accounts from a specific Wallet.
10310
11150
  */
10311
11151
  async assets() {
10312
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11152
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10313
11153
  }
10314
11154
  /**
10315
11155
  * Should start the add network process and return true if the network was added successfully.
@@ -10320,7 +11160,7 @@ var FuelConnector = class extends EventEmitter2 {
10320
11160
  * @returns Return true if the network was added successfully
10321
11161
  */
10322
11162
  async addNetwork(_networkUrl) {
10323
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11163
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10324
11164
  }
10325
11165
  /**
10326
11166
  * Should start the select network process and return true if the network has change successfully.
@@ -10331,7 +11171,7 @@ var FuelConnector = class extends EventEmitter2 {
10331
11171
  * @returns Return true if the network was added successfully
10332
11172
  */
10333
11173
  async selectNetwork(_network) {
10334
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11174
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10335
11175
  }
10336
11176
  /**
10337
11177
  * Should return all the networks available from the connector. If the connection is already established.
@@ -10339,7 +11179,7 @@ var FuelConnector = class extends EventEmitter2 {
10339
11179
  * @returns Return all the networks added to the connector.
10340
11180
  */
10341
11181
  async networks() {
10342
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11182
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10343
11183
  }
10344
11184
  /**
10345
11185
  * Should return the current network selected inside the connector. Even if the connection is not established.
@@ -10347,7 +11187,7 @@ var FuelConnector = class extends EventEmitter2 {
10347
11187
  * @returns Return the current network selected inside the connector.
10348
11188
  */
10349
11189
  async currentNetwork() {
10350
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11190
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10351
11191
  }
10352
11192
  /**
10353
11193
  * Should add the ABI to the connector and return true if the ABI was added successfully.
@@ -10357,7 +11197,7 @@ var FuelConnector = class extends EventEmitter2 {
10357
11197
  * @returns Return true if the ABI was added successfully.
10358
11198
  */
10359
11199
  async addABI(_contractId, _abi) {
10360
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11200
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10361
11201
  }
10362
11202
  /**
10363
11203
  * Should return the ABI from the connector vinculated to the all accounts from a specific Wallet.
@@ -10366,7 +11206,7 @@ var FuelConnector = class extends EventEmitter2 {
10366
11206
  * @returns The ABI if it exists, otherwise return null.
10367
11207
  */
10368
11208
  async getABI(_id) {
10369
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11209
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10370
11210
  }
10371
11211
  /**
10372
11212
  * Should return true if the abi exists in the connector vinculated to the all accounts from a specific Wallet.
@@ -10375,7 +11215,7 @@ var FuelConnector = class extends EventEmitter2 {
10375
11215
  * @returns Returns true if the abi exists or false if not.
10376
11216
  */
10377
11217
  async hasABI(_id) {
10378
- throw new FuelError27(FuelError27.CODES.NOT_IMPLEMENTED, "Method not implemented.");
11218
+ throw new FuelError28(FuelError28.CODES.NOT_IMPLEMENTED, "Method not implemented.");
10379
11219
  }
10380
11220
  /**
10381
11221
  * Event listener for the connector.
@@ -10419,7 +11259,7 @@ function dispatchFuelConnectorEvent(connector) {
10419
11259
  }
10420
11260
 
10421
11261
  // src/connectors/utils/promises.ts
10422
- import { FuelError as FuelError28 } from "@fuel-ts/errors";
11262
+ import { FuelError as FuelError29 } from "@fuel-ts/errors";
10423
11263
  function deferPromise() {
10424
11264
  const defer = {};
10425
11265
  defer.promise = new Promise((resolve, reject) => {
@@ -10431,7 +11271,7 @@ function deferPromise() {
10431
11271
  async function withTimeout(promise, timeout = 1050) {
10432
11272
  const timeoutPromise = new Promise((resolve, reject) => {
10433
11273
  setTimeout(() => {
10434
- reject(new FuelError28(FuelError28.CODES.TIMEOUT_EXCEEDED, "Promise timed out"));
11274
+ reject(new FuelError29(FuelError29.CODES.TIMEOUT_EXCEEDED, "Promise timed out"));
10435
11275
  }, timeout);
10436
11276
  });
10437
11277
  return Promise.race([timeoutPromise, promise]);
@@ -10465,7 +11305,7 @@ var _Fuel = class extends FuelConnector {
10465
11305
  await this.setDefaultConnector();
10466
11306
  this._targetUnsubscribe = this.setupConnectorListener();
10467
11307
  } catch (error) {
10468
- throw new FuelError29(ErrorCode26.INVALID_PROVIDER, "Error initializing Fuel Connector");
11308
+ throw new FuelError30(ErrorCode26.INVALID_PROVIDER, "Error initializing Fuel Connector");
10469
11309
  }
10470
11310
  }
10471
11311
  async init() {
@@ -10531,7 +11371,7 @@ var _Fuel = class extends FuelConnector {
10531
11371
  const hasConnector = await this.hasConnector();
10532
11372
  await this.pingConnector();
10533
11373
  if (!this._currentConnector || !hasConnector) {
10534
- throw new FuelError29(
11374
+ throw new FuelError30(
10535
11375
  ErrorCode26.MISSING_CONNECTOR,
10536
11376
  `No connector selected for calling ${method}. Use hasConnector before executing other methods.`
10537
11377
  );
@@ -10596,7 +11436,7 @@ var _Fuel = class extends FuelConnector {
10596
11436
  cacheTime: PING_CACHE_TIME
10597
11437
  })();
10598
11438
  } catch {
10599
- throw new FuelError29(ErrorCode26.INVALID_PROVIDER, "Current connector is not available.");
11439
+ throw new FuelError30(ErrorCode26.INVALID_PROVIDER, "Current connector is not available.");
10600
11440
  }
10601
11441
  }
10602
11442
  /**
@@ -10745,7 +11585,7 @@ var _Fuel = class extends FuelConnector {
10745
11585
  const currentNetwork = await this.currentNetwork();
10746
11586
  provider = await Provider.create(currentNetwork.url);
10747
11587
  } else {
10748
- throw new FuelError29(ErrorCode26.INVALID_PROVIDER, "Provider is not valid.");
11588
+ throw new FuelError30(ErrorCode26.INVALID_PROVIDER, "Provider is not valid.");
10749
11589
  }
10750
11590
  return provider;
10751
11591
  }
@@ -10821,6 +11661,8 @@ export {
10821
11661
  TransactionStatus,
10822
11662
  TransactionType,
10823
11663
  TransactionTypeName,
11664
+ UpgradeTransactionRequest,
11665
+ UploadTransactionRequest,
10824
11666
  Vault,
10825
11667
  Wallet,
10826
11668
  WalletLocked,
@@ -10842,6 +11684,9 @@ export {
10842
11684
  calculateMetadataGasForTxBlob,
10843
11685
  calculateMetadataGasForTxCreate,
10844
11686
  calculateMetadataGasForTxScript,
11687
+ calculateMetadataGasForTxUpgrade,
11688
+ calculateMetadataGasForTxUpload,
11689
+ calculateMinGasForTxUpload,
10845
11690
  calculateTXFeeForSummary,
10846
11691
  coinQuantityfy,
10847
11692
  deferPromise,
@@ -10912,6 +11757,8 @@ export {
10912
11757
  isTransactionTypeBlob,
10913
11758
  isTransactionTypeCreate,
10914
11759
  isTransactionTypeScript,
11760
+ isTransactionTypeUpgrade,
11761
+ isTransactionTypeUpload,
10915
11762
  isType,
10916
11763
  isTypeBlob,
10917
11764
  isTypeCreate,