@fuel-ts/account 0.74.0 → 0.75.0

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.

Potentially problematic release.


This version of @fuel-ts/account might be problematic. Click here for more details.

Files changed (100) hide show
  1. package/dist/account.d.ts +4 -5
  2. package/dist/account.d.ts.map +1 -1
  3. package/dist/connectors/fuel-connector.d.ts +2 -1
  4. package/dist/connectors/fuel-connector.d.ts.map +1 -1
  5. package/dist/connectors/fuel.d.ts +1 -2
  6. package/dist/connectors/fuel.d.ts.map +1 -1
  7. package/dist/connectors/types/data-type.d.ts +0 -8
  8. package/dist/connectors/types/data-type.d.ts.map +1 -1
  9. package/dist/connectors/types/events.d.ts +2 -36
  10. package/dist/connectors/types/events.d.ts.map +1 -1
  11. package/dist/connectors/types/index.d.ts +0 -2
  12. package/dist/connectors/types/index.d.ts.map +1 -1
  13. package/dist/hdwallet/hdwallet.d.ts +1 -1
  14. package/dist/hdwallet/hdwallet.d.ts.map +1 -1
  15. package/dist/index.global.js +1358 -1074
  16. package/dist/index.global.js.map +1 -1
  17. package/dist/index.js +569 -426
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +486 -362
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/mnemonic/mnemonic.d.ts +1 -1
  22. package/dist/mnemonic/mnemonic.d.ts.map +1 -1
  23. package/dist/mnemonic/utils.d.ts +1 -1
  24. package/dist/mnemonic/utils.d.ts.map +1 -1
  25. package/dist/predicate/utils/getPredicateRoot.d.ts +1 -1
  26. package/dist/predicate/utils/getPredicateRoot.d.ts.map +1 -1
  27. package/dist/providers/assets/index.d.ts +4 -0
  28. package/dist/providers/assets/index.d.ts.map +1 -0
  29. package/dist/providers/assets/types.d.ts +36 -0
  30. package/dist/providers/assets/types.d.ts.map +1 -0
  31. package/dist/providers/assets/utils/index.d.ts +4 -0
  32. package/dist/providers/assets/utils/index.d.ts.map +1 -0
  33. package/dist/providers/assets/utils/network.d.ts +33 -0
  34. package/dist/providers/assets/utils/network.d.ts.map +1 -0
  35. package/dist/providers/assets/utils/resolveIconPaths.d.ts +14 -0
  36. package/dist/providers/assets/utils/resolveIconPaths.d.ts.map +1 -0
  37. package/dist/providers/assets/utils/url.d.ts +2 -0
  38. package/dist/providers/assets/utils/url.d.ts.map +1 -0
  39. package/dist/providers/chains.d.ts +11 -0
  40. package/dist/providers/chains.d.ts.map +1 -0
  41. package/dist/providers/coin-quantity.d.ts +1 -1
  42. package/dist/providers/coin-quantity.d.ts.map +1 -1
  43. package/dist/providers/fuel-graphql-subscriber.d.ts +13 -3
  44. package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
  45. package/dist/providers/index.d.ts +2 -0
  46. package/dist/providers/index.d.ts.map +1 -1
  47. package/dist/providers/memory-cache.d.ts +1 -1
  48. package/dist/providers/memory-cache.d.ts.map +1 -1
  49. package/dist/providers/message.d.ts +1 -2
  50. package/dist/providers/message.d.ts.map +1 -1
  51. package/dist/providers/provider.d.ts +17 -7
  52. package/dist/providers/provider.d.ts.map +1 -1
  53. package/dist/providers/resource.d.ts +1 -1
  54. package/dist/providers/resource.d.ts.map +1 -1
  55. package/dist/providers/transaction-request/create-transaction-request.d.ts +1 -1
  56. package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
  57. package/dist/providers/transaction-request/hash-transaction.d.ts.map +1 -1
  58. package/dist/providers/transaction-request/input.d.ts +1 -1
  59. package/dist/providers/transaction-request/input.d.ts.map +1 -1
  60. package/dist/providers/transaction-request/output.d.ts +1 -1
  61. package/dist/providers/transaction-request/output.d.ts.map +1 -1
  62. package/dist/providers/transaction-request/script-transaction-request.d.ts +1 -2
  63. package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
  64. package/dist/providers/transaction-request/storage-slot.d.ts +1 -1
  65. package/dist/providers/transaction-request/storage-slot.d.ts.map +1 -1
  66. package/dist/providers/transaction-request/transaction-request.d.ts +2 -10
  67. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  68. package/dist/providers/transaction-request/witness.d.ts +1 -1
  69. package/dist/providers/transaction-request/witness.d.ts.map +1 -1
  70. package/dist/providers/transaction-summary/operations.d.ts +0 -2
  71. package/dist/providers/transaction-summary/operations.d.ts.map +1 -1
  72. package/dist/providers/transaction-summary/output.d.ts +2 -2
  73. package/dist/providers/transaction-summary/output.d.ts.map +1 -1
  74. package/dist/providers/transaction-summary/types.d.ts +0 -1
  75. package/dist/providers/transaction-summary/types.d.ts.map +1 -1
  76. package/dist/providers/utils/gas.d.ts.map +1 -1
  77. package/dist/signer/signer.d.ts +1 -1
  78. package/dist/signer/signer.d.ts.map +1 -1
  79. package/dist/test-utils/launchNode.d.ts.map +1 -1
  80. package/dist/test-utils.global.js +4010 -3792
  81. package/dist/test-utils.global.js.map +1 -1
  82. package/dist/test-utils.js +462 -402
  83. package/dist/test-utils.js.map +1 -1
  84. package/dist/test-utils.mjs +384 -336
  85. package/dist/test-utils.mjs.map +1 -1
  86. package/dist/utils/formatTransferToContractScriptData.d.ts +1 -2
  87. package/dist/utils/formatTransferToContractScriptData.d.ts.map +1 -1
  88. package/dist/wallet/base-wallet-unlocked.d.ts +4 -4
  89. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  90. package/dist/wallet/wallet.d.ts +1 -2
  91. package/dist/wallet/wallet.d.ts.map +1 -1
  92. package/dist/wallet/wallets.d.ts +1 -1
  93. package/dist/wallet/wallets.d.ts.map +1 -1
  94. package/package.json +16 -16
  95. package/dist/connectors/types/asset.d.ts +0 -2
  96. package/dist/connectors/types/asset.d.ts.map +0 -1
  97. package/dist/connectors/types/constants.d.ts +0 -7
  98. package/dist/connectors/types/constants.d.ts.map +0 -1
  99. package/dist/connectors/types/message.d.ts +0 -15
  100. package/dist/connectors/types/message.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -61,6 +61,7 @@ __export(src_exports, {
61
61
  AddressType: () => AddressType,
62
62
  BaseTransactionRequest: () => BaseTransactionRequest,
63
63
  BaseWalletUnlocked: () => BaseWalletUnlocked,
64
+ CHAIN_IDS: () => CHAIN_IDS,
64
65
  ChainName: () => ChainName,
65
66
  ChangeOutputCollisionError: () => ChangeOutputCollisionError,
66
67
  CreateTransactionRequest: () => CreateTransactionRequest,
@@ -74,7 +75,6 @@ __export(src_exports, {
74
75
  LocalStorage: () => LocalStorage,
75
76
  MNEMONIC_SIZES: () => MNEMONIC_SIZES,
76
77
  MemoryStorage: () => MemoryStorage,
77
- MessageTypes: () => MessageTypes,
78
78
  Mnemonic: () => mnemonic_default,
79
79
  MnemonicVault: () => MnemonicVault,
80
80
  NoWitnessAtIndexError: () => NoWitnessAtIndexError,
@@ -99,6 +99,7 @@ __export(src_exports, {
99
99
  addOperation: () => addOperation,
100
100
  assembleReceiptByType: () => assembleReceiptByType,
101
101
  assembleTransactionSummary: () => assembleTransactionSummary,
102
+ assets: () => assets,
102
103
  buildBlockExplorerUrl: () => buildBlockExplorerUrl,
103
104
  cacheFor: () => cacheFor,
104
105
  calculateMetadataGasForTxCreate: () => calculateMetadataGasForTxCreate,
@@ -116,10 +117,14 @@ __export(src_exports, {
116
117
  fromTai64ToUnix: () => fromTai64ToUnix,
117
118
  fromUnixToTai64: () => fromUnixToTai64,
118
119
  gasUsedByInputs: () => gasUsedByInputs,
120
+ getAssetEth: () => getAssetEth,
121
+ getAssetFuel: () => getAssetFuel,
122
+ getAssetNetwork: () => getAssetNetwork,
123
+ getAssetWithNetwork: () => getAssetWithNetwork,
119
124
  getContractCallOperations: () => getContractCallOperations,
120
125
  getContractCreatedOperations: () => getContractCreatedOperations,
121
- getContractTransferOperations: () => getContractTransferOperations,
122
126
  getDecodedLogs: () => getDecodedLogs,
127
+ getDefaultChainId: () => getDefaultChainId,
123
128
  getGasUsedFromReceipts: () => getGasUsedFromReceipts,
124
129
  getInputAccountAddress: () => getInputAccountAddress,
125
130
  getInputContractFromIndex: () => getInputContractFromIndex,
@@ -168,9 +173,11 @@ __export(src_exports, {
168
173
  processGqlReceipt: () => processGqlReceipt,
169
174
  processGraphqlStatus: () => processGraphqlStatus,
170
175
  resolveGasDependentCosts: () => resolveGasDependentCosts,
176
+ resolveIconPaths: () => resolveIconPaths,
171
177
  returnZeroScript: () => returnZeroScript,
172
178
  sleep: () => sleep,
173
179
  transactionRequestify: () => transactionRequestify,
180
+ urlJoin: () => urlJoin,
174
181
  withTimeout: () => withTimeout,
175
182
  withdrawScript: () => withdrawScript
176
183
  });
@@ -178,16 +185,16 @@ module.exports = __toCommonJS(src_exports);
178
185
 
179
186
  // src/account.ts
180
187
  var import_address4 = require("@fuel-ts/address");
181
- var import_configs10 = require("@fuel-ts/address/configs");
188
+ var import_configs11 = require("@fuel-ts/address/configs");
182
189
  var import_errors15 = require("@fuel-ts/errors");
183
190
  var import_interfaces = require("@fuel-ts/interfaces");
184
191
  var import_math17 = require("@fuel-ts/math");
185
- var import_ethers21 = require("ethers");
192
+ var import_utils27 = require("@fuel-ts/utils");
186
193
 
187
194
  // src/providers/coin-quantity.ts
188
195
  var import_configs = require("@fuel-ts/address/configs");
189
196
  var import_math = require("@fuel-ts/math");
190
- var import_ethers = require("ethers");
197
+ var import_utils = require("@fuel-ts/utils");
191
198
  var coinQuantityfy = (coinQuantityLike) => {
192
199
  let assetId;
193
200
  let amount;
@@ -203,7 +210,7 @@ var coinQuantityfy = (coinQuantityLike) => {
203
210
  }
204
211
  const bnAmount = (0, import_math.bn)(amount);
205
212
  return {
206
- assetId: (0, import_ethers.hexlify)(assetId),
213
+ assetId: (0, import_utils.hexlify)(assetId),
207
214
  amount: bnAmount.lt(1) ? (0, import_math.bn)(1) : bnAmount,
208
215
  max: max2 ? (0, import_math.bn)(max2) : void 0
209
216
  };
@@ -225,8 +232,10 @@ var import_address3 = require("@fuel-ts/address");
225
232
  var import_errors13 = require("@fuel-ts/errors");
226
233
  var import_math14 = require("@fuel-ts/math");
227
234
  var import_transactions17 = require("@fuel-ts/transactions");
235
+ var import_utils22 = require("@fuel-ts/utils");
228
236
  var import_versions = require("@fuel-ts/versions");
229
- var import_ethers18 = require("ethers");
237
+ var import_utils23 = require("@noble/curves/abstract/utils");
238
+ var import_ethers2 = require("ethers");
230
239
  var import_graphql_request = require("graphql-request");
231
240
  var import_ramda3 = require("ramda");
232
241
 
@@ -1035,71 +1044,67 @@ function getSdk(requester) {
1035
1044
  // src/providers/fuel-graphql-subscriber.ts
1036
1045
  var import_errors = require("@fuel-ts/errors");
1037
1046
  var import_graphql = require("graphql");
1038
- var _FuelSubscriptionStream = class {
1039
- readable;
1040
- writable;
1041
- readableStreamController;
1042
- constructor() {
1043
- this.readable = new ReadableStream({
1044
- start: (controller) => {
1045
- this.readableStreamController = controller;
1046
- }
1047
- });
1048
- this.writable = new WritableStream({
1049
- write: (bytes) => {
1050
- const text = _FuelSubscriptionStream.textDecoder.decode(bytes);
1051
- if (text.startsWith("data:")) {
1052
- const { data, errors } = JSON.parse(text.split("data:")[1]);
1053
- if (Array.isArray(errors)) {
1054
- this.readableStreamController.enqueue(
1055
- new import_errors.FuelError(
1056
- import_errors.FuelError.CODES.INVALID_REQUEST,
1057
- errors.map((err) => err.message).join("\n\n")
1058
- )
1059
- );
1060
- } else {
1061
- this.readableStreamController.enqueue(data);
1062
- }
1063
- }
1047
+ var _FuelGraphqlSubscriber = class {
1048
+ constructor(options) {
1049
+ this.options = options;
1050
+ }
1051
+ stream;
1052
+ async setStream() {
1053
+ const { url, query, variables, fetchFn } = this.options;
1054
+ const response = await fetchFn(`${url}-sub`, {
1055
+ method: "POST",
1056
+ body: JSON.stringify({
1057
+ query: (0, import_graphql.print)(query),
1058
+ variables
1059
+ }),
1060
+ headers: {
1061
+ "Content-Type": "application/json",
1062
+ Accept: "text/event-stream"
1064
1063
  }
1065
1064
  });
1065
+ this.stream = response.body.getReader();
1066
1066
  }
1067
- };
1068
- var FuelSubscriptionStream = _FuelSubscriptionStream;
1069
- __publicField(FuelSubscriptionStream, "textDecoder", new TextDecoder());
1070
- async function* fuelGraphQLSubscriber({
1071
- url,
1072
- variables,
1073
- query,
1074
- fetchFn
1075
- }) {
1076
- const response = await fetchFn(`${url}-sub`, {
1077
- method: "POST",
1078
- body: JSON.stringify({
1079
- query: (0, import_graphql.print)(query),
1080
- variables
1081
- }),
1082
- headers: {
1083
- "Content-Type": "application/json",
1084
- Accept: "text/event-stream"
1085
- }
1086
- });
1087
- const subscriptionStreamReader = response.body.pipeThrough(new FuelSubscriptionStream()).getReader();
1088
- while (true) {
1089
- const { value, done } = await subscriptionStreamReader.read();
1090
- if (value instanceof import_errors.FuelError) {
1091
- throw value;
1067
+ async next() {
1068
+ if (!this.stream) {
1069
+ await this.setStream();
1092
1070
  }
1093
- yield value;
1094
- if (done) {
1095
- break;
1071
+ while (true) {
1072
+ const { value, done } = await this.stream.read();
1073
+ if (done) {
1074
+ return { value, done };
1075
+ }
1076
+ const text = _FuelGraphqlSubscriber.textDecoder.decode(value);
1077
+ if (!text.startsWith("data:")) {
1078
+ continue;
1079
+ }
1080
+ const { data, errors } = JSON.parse(text.split("data:")[1]);
1081
+ if (Array.isArray(errors)) {
1082
+ throw new import_errors.FuelError(
1083
+ import_errors.FuelError.CODES.INVALID_REQUEST,
1084
+ errors.map((err) => err.message).join("\n\n")
1085
+ );
1086
+ }
1087
+ return { value: data, done: false };
1096
1088
  }
1097
1089
  }
1098
- }
1090
+ /**
1091
+ * Gets called when `break` is called in a `for-await-of` loop.
1092
+ */
1093
+ async return() {
1094
+ await this.stream.cancel();
1095
+ this.stream.releaseLock();
1096
+ return { done: true, value: void 0 };
1097
+ }
1098
+ [Symbol.asyncIterator]() {
1099
+ return this;
1100
+ }
1101
+ };
1102
+ var FuelGraphqlSubscriber = _FuelGraphqlSubscriber;
1103
+ __publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
1099
1104
 
1100
1105
  // src/providers/memory-cache.ts
1101
1106
  var import_errors2 = require("@fuel-ts/errors");
1102
- var import_ethers2 = require("ethers");
1107
+ var import_utils2 = require("@fuel-ts/utils");
1103
1108
  var cache = {};
1104
1109
  var DEFAULT_TTL_IN_MS = 30 * 1e3;
1105
1110
  var MemoryCache = class {
@@ -1114,7 +1119,7 @@ var MemoryCache = class {
1114
1119
  }
1115
1120
  }
1116
1121
  get(value, isAutoExpiring = true) {
1117
- const key = (0, import_ethers2.hexlify)(value);
1122
+ const key = (0, import_utils2.hexlify)(value);
1118
1123
  if (cache[key]) {
1119
1124
  if (!isAutoExpiring || cache[key].expires > Date.now()) {
1120
1125
  return cache[key].value;
@@ -1125,7 +1130,7 @@ var MemoryCache = class {
1125
1130
  }
1126
1131
  set(value) {
1127
1132
  const expiresAt = Date.now() + this.ttl;
1128
- const key = (0, import_ethers2.hexlify)(value);
1133
+ const key = (0, import_utils2.hexlify)(value);
1129
1134
  cache[key] = {
1130
1135
  expires: expiresAt,
1131
1136
  value
@@ -1151,7 +1156,7 @@ var MemoryCache = class {
1151
1156
  }, []);
1152
1157
  }
1153
1158
  del(value) {
1154
- const key = (0, import_ethers2.hexlify)(value);
1159
+ const key = (0, import_utils2.hexlify)(value);
1155
1160
  delete cache[key];
1156
1161
  }
1157
1162
  };
@@ -1161,31 +1166,31 @@ var import_configs2 = require("@fuel-ts/address/configs");
1161
1166
  var import_errors3 = require("@fuel-ts/errors");
1162
1167
  var import_math2 = require("@fuel-ts/math");
1163
1168
  var import_transactions = require("@fuel-ts/transactions");
1164
- var import_ethers3 = require("ethers");
1169
+ var import_utils3 = require("@fuel-ts/utils");
1165
1170
  var inputify = (value) => {
1166
1171
  const { type } = value;
1167
1172
  switch (value.type) {
1168
1173
  case import_transactions.InputType.Coin: {
1169
- const predicate = (0, import_ethers3.getBytesCopy)(value.predicate ?? "0x");
1170
- const predicateData = (0, import_ethers3.getBytesCopy)(value.predicateData ?? "0x");
1174
+ const predicate = (0, import_utils3.arrayify)(value.predicate ?? "0x");
1175
+ const predicateData = (0, import_utils3.arrayify)(value.predicateData ?? "0x");
1171
1176
  return {
1172
1177
  type: import_transactions.InputType.Coin,
1173
- txID: (0, import_ethers3.hexlify)((0, import_ethers3.getBytesCopy)(value.id).slice(0, 32)),
1174
- outputIndex: (0, import_ethers3.getBytesCopy)(value.id)[32],
1175
- owner: (0, import_ethers3.hexlify)(value.owner),
1178
+ txID: (0, import_utils3.hexlify)((0, import_utils3.arrayify)(value.id).slice(0, 32)),
1179
+ outputIndex: (0, import_utils3.arrayify)(value.id)[32],
1180
+ owner: (0, import_utils3.hexlify)(value.owner),
1176
1181
  amount: (0, import_math2.bn)(value.amount),
1177
- assetId: (0, import_ethers3.hexlify)(value.assetId),
1182
+ assetId: (0, import_utils3.hexlify)(value.assetId),
1178
1183
  txPointer: {
1179
- blockHeight: (0, import_math2.toNumber)((0, import_ethers3.getBytesCopy)(value.txPointer).slice(0, 8)),
1180
- txIndex: (0, import_math2.toNumber)((0, import_ethers3.getBytesCopy)(value.txPointer).slice(8, 16))
1184
+ blockHeight: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(0, 8)),
1185
+ txIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(8, 16))
1181
1186
  },
1182
1187
  witnessIndex: value.witnessIndex,
1183
1188
  maturity: value.maturity ?? 0,
1184
1189
  predicateGasUsed: (0, import_math2.bn)(value.predicateGasUsed),
1185
1190
  predicateLength: predicate.length,
1186
1191
  predicateDataLength: predicateData.length,
1187
- predicate: (0, import_ethers3.hexlify)(predicate),
1188
- predicateData: (0, import_ethers3.hexlify)(predicateData)
1192
+ predicate: (0, import_utils3.hexlify)(predicate),
1193
+ predicateData: (0, import_utils3.hexlify)(predicateData)
1189
1194
  };
1190
1195
  }
1191
1196
  case import_transactions.InputType.Contract: {
@@ -1196,29 +1201,29 @@ var inputify = (value) => {
1196
1201
  balanceRoot: import_configs2.ZeroBytes32,
1197
1202
  stateRoot: import_configs2.ZeroBytes32,
1198
1203
  txPointer: {
1199
- blockHeight: (0, import_math2.toNumber)((0, import_ethers3.getBytesCopy)(value.txPointer).slice(0, 8)),
1200
- txIndex: (0, import_math2.toNumber)((0, import_ethers3.getBytesCopy)(value.txPointer).slice(8, 16))
1204
+ blockHeight: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(0, 8)),
1205
+ txIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(8, 16))
1201
1206
  },
1202
- contractID: (0, import_ethers3.hexlify)(value.contractId)
1207
+ contractID: (0, import_utils3.hexlify)(value.contractId)
1203
1208
  };
1204
1209
  }
1205
1210
  case import_transactions.InputType.Message: {
1206
- const predicate = (0, import_ethers3.getBytesCopy)(value.predicate ?? "0x");
1207
- const predicateData = (0, import_ethers3.getBytesCopy)(value.predicateData ?? "0x");
1208
- const data = (0, import_ethers3.getBytesCopy)(value.data ?? "0x");
1211
+ const predicate = (0, import_utils3.arrayify)(value.predicate ?? "0x");
1212
+ const predicateData = (0, import_utils3.arrayify)(value.predicateData ?? "0x");
1213
+ const data = (0, import_utils3.arrayify)(value.data ?? "0x");
1209
1214
  return {
1210
1215
  type: import_transactions.InputType.Message,
1211
- sender: (0, import_ethers3.hexlify)(value.sender),
1212
- recipient: (0, import_ethers3.hexlify)(value.recipient),
1216
+ sender: (0, import_utils3.hexlify)(value.sender),
1217
+ recipient: (0, import_utils3.hexlify)(value.recipient),
1213
1218
  amount: (0, import_math2.bn)(value.amount),
1214
- nonce: (0, import_ethers3.hexlify)(value.nonce),
1219
+ nonce: (0, import_utils3.hexlify)(value.nonce),
1215
1220
  witnessIndex: value.witnessIndex,
1216
1221
  predicateGasUsed: (0, import_math2.bn)(value.predicateGasUsed),
1217
1222
  predicateLength: predicate.length,
1218
1223
  predicateDataLength: predicateData.length,
1219
- predicate: (0, import_ethers3.hexlify)(predicate),
1220
- predicateData: (0, import_ethers3.hexlify)(predicateData),
1221
- data: (0, import_ethers3.hexlify)(data),
1224
+ predicate: (0, import_utils3.hexlify)(predicate),
1225
+ predicateData: (0, import_utils3.hexlify)(predicateData),
1226
+ data: (0, import_utils3.hexlify)(data),
1222
1227
  dataLength: data.length
1223
1228
  };
1224
1229
  }
@@ -1236,16 +1241,16 @@ var import_configs3 = require("@fuel-ts/address/configs");
1236
1241
  var import_errors4 = require("@fuel-ts/errors");
1237
1242
  var import_math3 = require("@fuel-ts/math");
1238
1243
  var import_transactions2 = require("@fuel-ts/transactions");
1239
- var import_ethers4 = require("ethers");
1244
+ var import_utils4 = require("@fuel-ts/utils");
1240
1245
  var outputify = (value) => {
1241
1246
  const { type } = value;
1242
1247
  switch (type) {
1243
1248
  case import_transactions2.OutputType.Coin: {
1244
1249
  return {
1245
1250
  type: import_transactions2.OutputType.Coin,
1246
- to: (0, import_ethers4.hexlify)(value.to),
1251
+ to: (0, import_utils4.hexlify)(value.to),
1247
1252
  amount: (0, import_math3.bn)(value.amount),
1248
- assetId: (0, import_ethers4.hexlify)(value.assetId)
1253
+ assetId: (0, import_utils4.hexlify)(value.assetId)
1249
1254
  };
1250
1255
  }
1251
1256
  case import_transactions2.OutputType.Contract: {
@@ -1259,9 +1264,9 @@ var outputify = (value) => {
1259
1264
  case import_transactions2.OutputType.Change: {
1260
1265
  return {
1261
1266
  type: import_transactions2.OutputType.Change,
1262
- to: (0, import_ethers4.hexlify)(value.to),
1267
+ to: (0, import_utils4.hexlify)(value.to),
1263
1268
  amount: (0, import_math3.bn)(0),
1264
- assetId: (0, import_ethers4.hexlify)(value.assetId)
1269
+ assetId: (0, import_utils4.hexlify)(value.assetId)
1265
1270
  };
1266
1271
  }
1267
1272
  case import_transactions2.OutputType.Variable: {
@@ -1275,8 +1280,8 @@ var outputify = (value) => {
1275
1280
  case import_transactions2.OutputType.ContractCreated: {
1276
1281
  return {
1277
1282
  type: import_transactions2.OutputType.ContractCreated,
1278
- contractId: (0, import_ethers4.hexlify)(value.contractId),
1279
- stateRoot: (0, import_ethers4.hexlify)(value.stateRoot)
1283
+ contractId: (0, import_utils4.hexlify)(value.contractId),
1284
+ stateRoot: (0, import_utils4.hexlify)(value.stateRoot)
1280
1285
  };
1281
1286
  }
1282
1287
  default: {
@@ -1293,7 +1298,7 @@ var import_address = require("@fuel-ts/address");
1293
1298
  var import_configs6 = require("@fuel-ts/address/configs");
1294
1299
  var import_math6 = require("@fuel-ts/math");
1295
1300
  var import_transactions5 = require("@fuel-ts/transactions");
1296
- var import_ethers9 = require("ethers");
1301
+ var import_utils9 = require("@fuel-ts/utils");
1297
1302
 
1298
1303
  // src/providers/resource.ts
1299
1304
  var isRawCoin = (resource) => "utxoId" in resource;
@@ -1307,7 +1312,7 @@ var import_errors5 = require("@fuel-ts/errors");
1307
1312
  var import_math4 = require("@fuel-ts/math");
1308
1313
  var import_transactions3 = require("@fuel-ts/transactions");
1309
1314
  var import_configs5 = require("@fuel-ts/transactions/configs");
1310
- var import_ethers5 = require("ethers");
1315
+ var import_utils5 = require("@fuel-ts/utils");
1311
1316
  var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === import_transactions3.ReceiptType.Revert && receipt.val.toString("hex") === import_configs5.FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
1312
1317
  var doesReceiptHaveMissingContractId = (receipt) => receipt.type === import_transactions3.ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
1313
1318
  var getReceiptsWithMissingData = (receipts) => receipts.reduce(
@@ -1451,7 +1456,7 @@ function assembleReceiptByType(receipt) {
1451
1456
  const recipient = hexOrZero(receipt.recipient);
1452
1457
  const nonce = hexOrZero(receipt.nonce);
1453
1458
  const amount = (0, import_math4.bn)(receipt.amount);
1454
- const data = receipt.data ? (0, import_ethers5.getBytesCopy)(receipt.data) : Uint8Array.from([]);
1459
+ const data = receipt.data ? (0, import_utils5.arrayify)(receipt.data) : Uint8Array.from([]);
1455
1460
  const digest = hexOrZero(receipt.digest);
1456
1461
  const messageId = import_transactions3.ReceiptMessageOutCoder.getMessageId({
1457
1462
  sender,
@@ -1572,7 +1577,7 @@ var buildBlockExplorerUrl = (options = {}) => {
1572
1577
  // src/providers/utils/gas.ts
1573
1578
  var import_math5 = require("@fuel-ts/math");
1574
1579
  var import_transactions4 = require("@fuel-ts/transactions");
1575
- var import_ethers6 = require("ethers");
1580
+ var import_utils6 = require("@fuel-ts/utils");
1576
1581
  var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => (0, import_math5.bn)(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
1577
1582
  var getGasUsedFromReceipts = (receipts) => {
1578
1583
  const scriptResult = receipts.filter(
@@ -1597,9 +1602,7 @@ function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
1597
1602
  const totalGas = inputs.reduce((total, input) => {
1598
1603
  if ("predicate" in input && input.predicate && input.predicate !== "0x") {
1599
1604
  return total.add(
1600
- resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(
1601
- resolveGasDependentCosts((0, import_ethers6.getBytesCopy)(input.predicate).length, gasCosts.contractRoot)
1602
- ).add((0, import_math5.bn)(input.predicateGasUsed))
1605
+ resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts((0, import_utils6.arrayify)(input.predicate).length, gasCosts.contractRoot)).add((0, import_math5.bn)(input.predicateGasUsed))
1603
1606
  );
1604
1607
  }
1605
1608
  if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
@@ -1648,13 +1651,13 @@ function calculateMetadataGasForTxScript({
1648
1651
  }
1649
1652
 
1650
1653
  // src/providers/utils/json.ts
1651
- var import_ethers7 = require("ethers");
1654
+ var import_utils7 = require("@fuel-ts/utils");
1652
1655
  var import_ramda = require("ramda");
1653
1656
  function normalize(object) {
1654
1657
  Object.keys(object).forEach((key) => {
1655
1658
  switch (object[key]?.constructor.name) {
1656
1659
  case "Uint8Array":
1657
- object[key] = (0, import_ethers7.hexlify)(object[key]);
1660
+ object[key] = (0, import_utils7.hexlify)(object[key]);
1658
1661
  break;
1659
1662
  case "Array":
1660
1663
  object[key] = normalize(object[key]);
@@ -1714,11 +1717,11 @@ var NoWitnessByOwnerError = class extends Error {
1714
1717
  };
1715
1718
 
1716
1719
  // src/providers/transaction-request/witness.ts
1717
- var import_ethers8 = require("ethers");
1720
+ var import_utils8 = require("@fuel-ts/utils");
1718
1721
  var witnessify = (value) => {
1719
- const data = (0, import_ethers8.getBytesCopy)(value);
1722
+ const data = (0, import_utils8.arrayify)(value);
1720
1723
  return {
1721
- data: (0, import_ethers8.hexlify)(data),
1724
+ data: (0, import_utils8.hexlify)(data),
1722
1725
  dataLength: data.length
1723
1726
  };
1724
1727
  };
@@ -1838,7 +1841,7 @@ var BaseTransactionRequest = class {
1838
1841
  * Creates an empty witness without any side effects and returns the index
1839
1842
  */
1840
1843
  createWitness() {
1841
- this.witnesses.push((0, import_ethers9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
1844
+ this.witnesses.push((0, import_utils9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
1842
1845
  return this.witnesses.length - 1;
1843
1846
  }
1844
1847
  /**
@@ -1907,9 +1910,9 @@ var BaseTransactionRequest = class {
1907
1910
  const found = this.inputs.find((input) => {
1908
1911
  switch (input.type) {
1909
1912
  case import_transactions5.InputType.Coin:
1910
- return (0, import_ethers9.hexlify)(input.owner) === ownerAddress.toB256();
1913
+ return (0, import_utils9.hexlify)(input.owner) === ownerAddress.toB256();
1911
1914
  case import_transactions5.InputType.Message:
1912
- return (0, import_ethers9.hexlify)(input.recipient) === ownerAddress.toB256();
1915
+ return (0, import_utils9.hexlify)(input.recipient) === ownerAddress.toB256();
1913
1916
  default:
1914
1917
  return false;
1915
1918
  }
@@ -2075,7 +2078,7 @@ var BaseTransactionRequest = class {
2075
2078
  */
2076
2079
  addChangeOutput(to, assetId = import_configs6.BaseAssetId) {
2077
2080
  const changeOutput = this.getChangeOutputs().find(
2078
- (output) => (0, import_ethers9.hexlify)(output.assetId) === assetId
2081
+ (output) => (0, import_utils9.hexlify)(output.assetId) === assetId
2079
2082
  );
2080
2083
  if (!changeOutput) {
2081
2084
  this.pushOutput({
@@ -2188,19 +2191,27 @@ var BaseTransactionRequest = class {
2188
2191
  toJSON() {
2189
2192
  return normalizeJSON(this);
2190
2193
  }
2191
- /**
2192
- * @hidden
2193
- *
2194
- * Determines whether the transaction has a predicate input.
2195
- *
2196
- * @returns Whether the transaction has a predicate input.
2197
- */
2198
- hasPredicateInput() {
2199
- return Boolean(
2200
- this.inputs.find(
2201
- (input) => "predicate" in input && input.predicate && input.predicate !== (0, import_ethers9.getBytesCopy)("0x")
2202
- )
2203
- );
2194
+ updatePredicateInputs(inputs) {
2195
+ this.inputs.forEach((i) => {
2196
+ let correspondingInput;
2197
+ switch (i.type) {
2198
+ case import_transactions5.InputType.Coin:
2199
+ correspondingInput = inputs.find((x) => x.type === import_transactions5.InputType.Coin && x.owner === i.owner);
2200
+ break;
2201
+ case import_transactions5.InputType.Message:
2202
+ correspondingInput = inputs.find(
2203
+ (x) => x.type === import_transactions5.InputType.Message && x.sender === i.sender
2204
+ );
2205
+ break;
2206
+ default:
2207
+ return;
2208
+ }
2209
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math6.bn)(correspondingInput.predicateGasUsed).gt(0)) {
2210
+ i.predicate = correspondingInput.predicate;
2211
+ i.predicateData = correspondingInput.predicateData;
2212
+ i.predicateGasUsed = correspondingInput.predicateGasUsed;
2213
+ }
2214
+ });
2204
2215
  }
2205
2216
  };
2206
2217
 
@@ -2208,14 +2219,15 @@ var BaseTransactionRequest = class {
2208
2219
  var import_configs8 = require("@fuel-ts/address/configs");
2209
2220
  var import_math8 = require("@fuel-ts/math");
2210
2221
  var import_transactions7 = require("@fuel-ts/transactions");
2211
- var import_ethers12 = require("ethers");
2222
+ var import_utils13 = require("@fuel-ts/utils");
2212
2223
 
2213
2224
  // src/providers/transaction-request/hash-transaction.ts
2214
2225
  var import_configs7 = require("@fuel-ts/address/configs");
2215
2226
  var import_hasher = require("@fuel-ts/hasher");
2216
2227
  var import_math7 = require("@fuel-ts/math");
2217
2228
  var import_transactions6 = require("@fuel-ts/transactions");
2218
- var import_ethers10 = require("ethers");
2229
+ var import_utils11 = require("@fuel-ts/utils");
2230
+ var import_ethers = require("ethers");
2219
2231
  var import_ramda2 = require("ramda");
2220
2232
  function hashTransaction(transactionRequest, chainId) {
2221
2233
  const transaction = transactionRequest.toTransaction();
@@ -2277,15 +2289,15 @@ function hashTransaction(transactionRequest, chainId) {
2277
2289
  transaction.witnessesCount = 0;
2278
2290
  transaction.witnesses = [];
2279
2291
  const chainIdBytes = (0, import_hasher.uint64ToBytesBE)(chainId);
2280
- const concatenatedData = (0, import_ethers10.concat)([chainIdBytes, new import_transactions6.TransactionCoder().encode(transaction)]);
2281
- return (0, import_ethers10.sha256)(concatenatedData);
2292
+ const concatenatedData = (0, import_utils11.concat)([chainIdBytes, new import_transactions6.TransactionCoder().encode(transaction)]);
2293
+ return (0, import_ethers.sha256)(concatenatedData);
2282
2294
  }
2283
2295
 
2284
2296
  // src/providers/transaction-request/storage-slot.ts
2285
- var import_ethers11 = require("ethers");
2297
+ var import_utils12 = require("@fuel-ts/utils");
2286
2298
  var getStorageValue = (value) => {
2287
2299
  const v = new Uint8Array(32);
2288
- v.set((0, import_ethers11.getBytesCopy)(value));
2300
+ v.set((0, import_utils12.arrayify)(value));
2289
2301
  return v;
2290
2302
  };
2291
2303
  var storageSlotify = (storageSlot) => {
@@ -2299,8 +2311,8 @@ var storageSlotify = (storageSlot) => {
2299
2311
  value = storageSlot.value;
2300
2312
  }
2301
2313
  return {
2302
- key: (0, import_ethers11.hexlify)(key),
2303
- value: (0, import_ethers11.hexlify)(getStorageValue(value))
2314
+ key: (0, import_utils12.hexlify)(key),
2315
+ value: (0, import_utils12.hexlify)(getStorageValue(value))
2304
2316
  };
2305
2317
  };
2306
2318
 
@@ -2333,7 +2345,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2333
2345
  } = {}) {
2334
2346
  super(rest);
2335
2347
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
2336
- this.salt = (0, import_ethers12.hexlify)(salt ?? import_configs8.ZeroBytes32);
2348
+ this.salt = (0, import_utils13.hexlify)(salt ?? import_configs8.ZeroBytes32);
2337
2349
  this.storageSlots = [...storageSlots ?? []];
2338
2350
  }
2339
2351
  /**
@@ -2351,7 +2363,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2351
2363
  bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
2352
2364
  bytecodeWitnessIndex,
2353
2365
  storageSlotsCount: storageSlots.length,
2354
- salt: this.salt ? (0, import_ethers12.hexlify)(this.salt) : import_configs8.ZeroBytes32,
2366
+ salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs8.ZeroBytes32,
2355
2367
  storageSlots
2356
2368
  };
2357
2369
  }
@@ -2390,7 +2402,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2390
2402
  }
2391
2403
  metadataGas(gasCosts) {
2392
2404
  return calculateMetadataGasForTxCreate({
2393
- contractBytesSize: (0, import_math8.bn)((0, import_ethers12.getBytesCopy)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2405
+ contractBytesSize: (0, import_math8.bn)((0, import_utils13.arrayify)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2394
2406
  gasCosts,
2395
2407
  stateRootSize: this.storageSlots.length,
2396
2408
  txBytesSize: this.byteSize()
@@ -2404,17 +2416,17 @@ var import_address2 = require("@fuel-ts/address");
2404
2416
  var import_configs9 = require("@fuel-ts/address/configs");
2405
2417
  var import_math9 = require("@fuel-ts/math");
2406
2418
  var import_transactions8 = require("@fuel-ts/transactions");
2407
- var import_ethers14 = require("ethers");
2419
+ var import_utils15 = require("@fuel-ts/utils");
2408
2420
 
2409
2421
  // src/providers/transaction-request/scripts.ts
2410
- var import_ethers13 = require("ethers");
2422
+ var import_utils14 = require("@fuel-ts/utils");
2411
2423
  var returnZeroScript = {
2412
2424
  /*
2413
2425
  Opcode::RET(REG_ZERO)
2414
2426
  Opcode::NOOP
2415
2427
  */
2416
2428
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
2417
- bytes: (0, import_ethers13.getBytesCopy)("0x24000000"),
2429
+ bytes: (0, import_utils14.arrayify)("0x24000000"),
2418
2430
  encodeScriptData: () => new Uint8Array(0)
2419
2431
  };
2420
2432
  var withdrawScript = {
@@ -2428,7 +2440,7 @@ var withdrawScript = {
2428
2440
  00000000 00000000 [amount value]
2429
2441
  */
2430
2442
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
2431
- bytes: (0, import_ethers13.getBytesCopy)("0x5040C0105D44C0064C40001124000000"),
2443
+ bytes: (0, import_utils14.arrayify)("0x5040C0105D44C0064C40001124000000"),
2432
2444
  encodeScriptData: () => new Uint8Array(0)
2433
2445
  };
2434
2446
 
@@ -2456,8 +2468,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2456
2468
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2457
2469
  super(rest);
2458
2470
  this.gasLimit = (0, import_math9.bn)(gasLimit);
2459
- this.script = (0, import_ethers14.getBytesCopy)(script ?? returnZeroScript.bytes);
2460
- this.scriptData = (0, import_ethers14.getBytesCopy)(scriptData ?? returnZeroScript.encodeScriptData());
2471
+ this.script = (0, import_utils15.arrayify)(script ?? returnZeroScript.bytes);
2472
+ this.scriptData = (0, import_utils15.arrayify)(scriptData ?? returnZeroScript.encodeScriptData());
2461
2473
  }
2462
2474
  /**
2463
2475
  * Converts the transaction request to a `TransactionScript`.
@@ -2465,8 +2477,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2465
2477
  * @returns The transaction script object.
2466
2478
  */
2467
2479
  toTransaction() {
2468
- const script = (0, import_ethers14.getBytesCopy)(this.script ?? "0x");
2469
- const scriptData = (0, import_ethers14.getBytesCopy)(this.scriptData ?? "0x");
2480
+ const script = (0, import_utils15.arrayify)(this.script ?? "0x");
2481
+ const scriptData = (0, import_utils15.arrayify)(this.scriptData ?? "0x");
2470
2482
  return {
2471
2483
  type: import_transactions8.TransactionType.Script,
2472
2484
  scriptGasLimit: this.gasLimit,
@@ -2474,8 +2486,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2474
2486
  scriptLength: script.length,
2475
2487
  scriptDataLength: scriptData.length,
2476
2488
  receiptsRoot: import_configs9.ZeroBytes32,
2477
- script: (0, import_ethers14.hexlify)(script),
2478
- scriptData: (0, import_ethers14.hexlify)(scriptData)
2489
+ script: (0, import_utils15.hexlify)(script),
2490
+ scriptData: (0, import_utils15.hexlify)(scriptData)
2479
2491
  };
2480
2492
  }
2481
2493
  /**
@@ -2626,15 +2638,15 @@ var transactionRequestify = (obj) => {
2626
2638
  var import_errors12 = require("@fuel-ts/errors");
2627
2639
  var import_math13 = require("@fuel-ts/math");
2628
2640
  var import_transactions15 = require("@fuel-ts/transactions");
2629
- var import_ethers17 = require("ethers");
2641
+ var import_utils21 = require("@fuel-ts/utils");
2630
2642
 
2631
2643
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2632
- var import_ethers16 = require("ethers");
2644
+ var import_utils19 = require("@fuel-ts/utils");
2633
2645
 
2634
2646
  // src/providers/transaction-summary/calculate-transaction-fee.ts
2635
2647
  var import_math10 = require("@fuel-ts/math");
2636
2648
  var import_transactions10 = require("@fuel-ts/transactions");
2637
- var import_ethers15 = require("ethers");
2649
+ var import_utils16 = require("@fuel-ts/utils");
2638
2650
  var calculateTransactionFee = (params) => {
2639
2651
  const {
2640
2652
  gasUsed,
@@ -2643,7 +2655,7 @@ var calculateTransactionFee = (params) => {
2643
2655
  } = params;
2644
2656
  const gasPerByte = (0, import_math10.bn)(feeParams.gasPerByte);
2645
2657
  const gasPriceFactor = (0, import_math10.bn)(feeParams.gasPriceFactor);
2646
- const transactionBytes = (0, import_ethers15.getBytesCopy)(rawPayload);
2658
+ const transactionBytes = (0, import_utils16.arrayify)(rawPayload);
2647
2659
  const [transaction] = new import_transactions10.TransactionCoder().decode(transactionBytes, 0);
2648
2660
  if (transaction.type === import_transactions10.TransactionType.Mint) {
2649
2661
  return {
@@ -2658,7 +2670,7 @@ var calculateTransactionFee = (params) => {
2658
2670
  let gasLimit = (0, import_math10.bn)(0);
2659
2671
  if (type === import_transactions10.TransactionType.Create) {
2660
2672
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2661
- const contractBytesSize = (0, import_math10.bn)((0, import_ethers15.getBytesCopy)(witnesses[bytecodeWitnessIndex].data).length);
2673
+ const contractBytesSize = (0, import_math10.bn)((0, import_utils16.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
2662
2674
  metadataGas = calculateMetadataGasForTxCreate({
2663
2675
  contractBytesSize,
2664
2676
  gasCosts,
@@ -2713,6 +2725,7 @@ var fromTai64ToDate = (tai64Timestamp) => {
2713
2725
  var fromDateToTai64 = (date) => import_tai64.TAI64.fromUnix(Math.floor(date.getTime() / 1e3)).toString(10);
2714
2726
 
2715
2727
  // src/providers/transaction-summary/operations.ts
2728
+ var import_configs10 = require("@fuel-ts/address/configs");
2716
2729
  var import_errors10 = require("@fuel-ts/errors");
2717
2730
  var import_math12 = require("@fuel-ts/math");
2718
2731
  var import_transactions13 = require("@fuel-ts/transactions");
@@ -2857,7 +2870,6 @@ var OperationName = /* @__PURE__ */ ((OperationName2) => {
2857
2870
  OperationName2["contractCreated"] = "Contract created";
2858
2871
  OperationName2["transfer"] = "Transfer asset";
2859
2872
  OperationName2["contractCall"] = "Contract call";
2860
- OperationName2["contractTransfer"] = "Contract transfer";
2861
2873
  OperationName2["receive"] = "Receive asset";
2862
2874
  OperationName2["mint"] = "Mint asset";
2863
2875
  OperationName2["predicatecall"] = "Predicate call";
@@ -2957,33 +2969,6 @@ function addOperation(operations, toAdd) {
2957
2969
  function getReceiptsTransferOut(receipts) {
2958
2970
  return getReceiptsByType(receipts, import_transactions13.ReceiptType.TransferOut);
2959
2971
  }
2960
- function getContractTransferOperations({ receipts }) {
2961
- const transferOutReceipts = getReceiptsTransferOut(receipts);
2962
- const contractTransferOperations = transferOutReceipts.reduce(
2963
- (prevContractTransferOps, receipt) => {
2964
- const newContractTransferOps = addOperation(prevContractTransferOps, {
2965
- name: "Contract transfer" /* contractTransfer */,
2966
- from: {
2967
- type: 0 /* contract */,
2968
- address: receipt.from
2969
- },
2970
- to: {
2971
- type: 1 /* account */,
2972
- address: receipt.to
2973
- },
2974
- assetsSent: [
2975
- {
2976
- amount: receipt.amount,
2977
- assetId: receipt.assetId
2978
- }
2979
- ]
2980
- });
2981
- return newContractTransferOps;
2982
- },
2983
- []
2984
- );
2985
- return contractTransferOperations;
2986
- }
2987
2972
  function getWithdrawFromFuelOperations({
2988
2973
  inputs,
2989
2974
  receipts
@@ -3081,70 +3066,77 @@ function getContractCallOperations({
3081
3066
  }, []);
3082
3067
  return contractCallOperations;
3083
3068
  }
3069
+ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs) {
3070
+ const { to: toAddress, assetId, amount } = receipt;
3071
+ let { from: fromAddress } = receipt;
3072
+ const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
3073
+ if (import_configs10.ZeroBytes32 === fromAddress) {
3074
+ const change = changeOutputs.find((output) => output.assetId === assetId);
3075
+ fromAddress = change?.to || fromAddress;
3076
+ }
3077
+ const fromType = contractInputs.some((input) => input.contractID === fromAddress) ? 0 /* contract */ : 1 /* account */;
3078
+ return {
3079
+ name: "Transfer asset" /* transfer */,
3080
+ from: {
3081
+ type: fromType,
3082
+ address: fromAddress
3083
+ },
3084
+ to: {
3085
+ type: toType,
3086
+ address: toAddress
3087
+ },
3088
+ assetsSent: [
3089
+ {
3090
+ assetId: assetId.toString(),
3091
+ amount
3092
+ }
3093
+ ]
3094
+ };
3095
+ }
3084
3096
  function getTransferOperations({
3085
3097
  inputs,
3086
3098
  outputs,
3087
3099
  receipts
3088
3100
  }) {
3101
+ let operations = [];
3089
3102
  const coinOutputs = getOutputsCoin(outputs);
3090
- const [transferReceipt] = getReceiptsByType(
3103
+ const contractInputs = getInputsContract(inputs);
3104
+ const changeOutputs = getOutputsChange(outputs);
3105
+ coinOutputs.forEach((output) => {
3106
+ const { amount, assetId, to } = output;
3107
+ const changeOutput = changeOutputs.find((change) => change.assetId === assetId);
3108
+ if (changeOutput) {
3109
+ operations = addOperation(operations, {
3110
+ name: "Transfer asset" /* transfer */,
3111
+ from: {
3112
+ type: 1 /* account */,
3113
+ address: changeOutput.to
3114
+ },
3115
+ to: {
3116
+ type: 1 /* account */,
3117
+ address: to
3118
+ },
3119
+ assetsSent: [
3120
+ {
3121
+ assetId,
3122
+ amount
3123
+ }
3124
+ ]
3125
+ });
3126
+ }
3127
+ });
3128
+ const transferReceipts = getReceiptsByType(
3091
3129
  receipts,
3092
3130
  import_transactions13.ReceiptType.Transfer
3093
3131
  );
3094
- let operations = [];
3095
- if (transferReceipt) {
3096
- const changeOutputs = getOutputsChange(outputs);
3097
- changeOutputs.forEach((output) => {
3098
- const { assetId } = output;
3099
- const [contractInput] = getInputsContract(inputs);
3100
- const utxo = getInputFromAssetId(inputs, assetId);
3101
- if (utxo && contractInput) {
3102
- const inputAddress = getInputAccountAddress(utxo);
3103
- operations = addOperation(operations, {
3104
- name: "Transfer asset" /* transfer */,
3105
- from: {
3106
- type: 1 /* account */,
3107
- address: inputAddress
3108
- },
3109
- to: {
3110
- type: 0 /* contract */,
3111
- address: contractInput.contractID
3112
- },
3113
- assetsSent: [
3114
- {
3115
- assetId: assetId.toString(),
3116
- amount: transferReceipt.amount
3117
- }
3118
- ]
3119
- });
3120
- }
3121
- });
3122
- } else {
3123
- coinOutputs.forEach((output) => {
3124
- const input = getInputFromAssetId(inputs, output.assetId);
3125
- if (input) {
3126
- const inputAddress = getInputAccountAddress(input);
3127
- const operationToAdd = {
3128
- name: "Transfer asset" /* transfer */,
3129
- from: {
3130
- type: 1 /* account */,
3131
- address: inputAddress
3132
- },
3133
- to: {
3134
- type: 1 /* account */,
3135
- address: output.to.toString()
3136
- },
3137
- assetsSent: [
3138
- {
3139
- assetId: output.assetId.toString(),
3140
- amount: output.amount
3141
- }
3142
- ]
3143
- };
3144
- operations = addOperation(operations, operationToAdd);
3145
- }
3146
- });
3147
- }
3132
+ const transferOutReceipts = getReceiptsByType(
3133
+ receipts,
3134
+ import_transactions13.ReceiptType.TransferOut
3135
+ );
3136
+ [...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
3137
+ const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
3138
+ operations = addOperation(operations, operation);
3139
+ });
3148
3140
  return operations;
3149
3141
  }
3150
3142
  function getPayProducerOperations(outputs) {
@@ -3217,7 +3209,6 @@ function getOperations({
3217
3209
  rawPayload,
3218
3210
  maxInputs
3219
3211
  }),
3220
- ...getContractTransferOperations({ receipts }),
3221
3212
  ...getWithdrawFromFuelOperations({ inputs, receipts })
3222
3213
  ];
3223
3214
  }
@@ -3346,7 +3337,7 @@ function assembleTransactionSummary(params) {
3346
3337
  gasCosts
3347
3338
  } = params;
3348
3339
  const gasUsed = getGasUsedFromReceipts(receipts);
3349
- const rawPayload = (0, import_ethers16.hexlify)(transactionBytes);
3340
+ const rawPayload = (0, import_utils19.hexlify)(transactionBytes);
3350
3341
  const operations = getOperations({
3351
3342
  transactionType: transaction.type,
3352
3343
  inputs: transaction.inputs || [],
@@ -3463,7 +3454,7 @@ var TransactionResponse = class {
3463
3454
  */
3464
3455
  decodeTransaction(transactionWithReceipts) {
3465
3456
  return new import_transactions15.TransactionCoder().decode(
3466
- (0, import_ethers17.getBytesCopy)(transactionWithReceipts.rawPayload),
3457
+ (0, import_utils21.arrayify)(transactionWithReceipts.rawPayload),
3467
3458
  0
3468
3459
  )?.[0];
3469
3460
  }
@@ -3489,7 +3480,7 @@ var TransactionResponse = class {
3489
3480
  id: this.id,
3490
3481
  receipts,
3491
3482
  transaction: decodedTransaction,
3492
- transactionBytes: (0, import_ethers17.getBytesCopy)(transaction.rawPayload),
3483
+ transactionBytes: (0, import_utils21.arrayify)(transaction.rawPayload),
3493
3484
  gqlTransactionStatus: transaction.status,
3494
3485
  gasPerByte,
3495
3486
  gasPriceFactor,
@@ -3790,7 +3781,7 @@ var _Provider = class {
3790
3781
  const opDefinition = query.definitions.find((x) => x.kind === "OperationDefinition");
3791
3782
  const isSubscription = opDefinition?.operation === "subscription";
3792
3783
  if (isSubscription) {
3793
- return fuelGraphQLSubscriber({
3784
+ return new FuelGraphqlSubscriber({
3794
3785
  url: this.url,
3795
3786
  query,
3796
3787
  fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
@@ -3824,7 +3815,7 @@ var _Provider = class {
3824
3815
  name,
3825
3816
  consensusParameters: { chainId }
3826
3817
  } = await this.getChain();
3827
- const network = new import_ethers18.Network(name, chainId.toNumber());
3818
+ const network = new import_ethers2.Network(name, chainId.toNumber());
3828
3819
  return Promise.resolve(network);
3829
3820
  }
3830
3821
  /**
@@ -3892,7 +3883,7 @@ var _Provider = class {
3892
3883
  if (estimateTxDependencies) {
3893
3884
  await this.estimateTxDependencies(transactionRequest);
3894
3885
  }
3895
- const encodedTransaction = (0, import_ethers18.hexlify)(transactionRequest.toTransactionBytes());
3886
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3896
3887
  if (awaitExecution) {
3897
3888
  const subscription = this.operations.submitAndAwait({ encodedTransaction });
3898
3889
  for await (const { submitAndAwait } of subscription) {
@@ -3923,9 +3914,9 @@ var _Provider = class {
3923
3914
  async call(transactionRequestLike, { utxoValidation, estimateTxDependencies = true } = {}) {
3924
3915
  const transactionRequest = transactionRequestify(transactionRequestLike);
3925
3916
  if (estimateTxDependencies) {
3926
- await this.estimateTxDependencies(transactionRequest);
3917
+ return this.estimateTxDependencies(transactionRequest);
3927
3918
  }
3928
- const encodedTransaction = (0, import_ethers18.hexlify)(transactionRequest.toTransactionBytes());
3919
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3929
3920
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
3930
3921
  encodedTransaction,
3931
3922
  utxoValidation: utxoValidation || false
@@ -3942,7 +3933,15 @@ var _Provider = class {
3942
3933
  * @returns A promise that resolves to the estimated transaction request object.
3943
3934
  */
3944
3935
  async estimatePredicates(transactionRequest) {
3945
- const encodedTransaction = (0, import_ethers18.hexlify)(transactionRequest.toTransactionBytes());
3936
+ const shouldEstimatePredicates = Boolean(
3937
+ transactionRequest.inputs.find(
3938
+ (input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new import_math14.BN(input.predicateGasUsed).isZero()
3939
+ )
3940
+ );
3941
+ if (!shouldEstimatePredicates) {
3942
+ return transactionRequest;
3943
+ }
3944
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3946
3945
  const response = await this.operations.estimatePredicates({
3947
3946
  encodedTransaction
3948
3947
  });
@@ -3972,34 +3971,41 @@ var _Provider = class {
3972
3971
  * @returns A promise.
3973
3972
  */
3974
3973
  async estimateTxDependencies(transactionRequest) {
3975
- let missingOutputVariableCount = 0;
3976
- let missingOutputContractIdsCount = 0;
3977
- let tries = 0;
3978
3974
  if (transactionRequest.type === import_transactions17.TransactionType.Create) {
3979
- return;
3980
- }
3981
- let txRequest = transactionRequest;
3982
- if (txRequest.hasPredicateInput()) {
3983
- txRequest = await this.estimatePredicates(txRequest);
3975
+ return {
3976
+ receipts: [],
3977
+ outputVariables: 0,
3978
+ missingContractIds: []
3979
+ };
3984
3980
  }
3985
- while (tries < MAX_RETRIES) {
3981
+ await this.estimatePredicates(transactionRequest);
3982
+ let receipts = [];
3983
+ const missingContractIds = [];
3984
+ let outputVariables = 0;
3985
+ for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
3986
3986
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
3987
- encodedTransaction: (0, import_ethers18.hexlify)(txRequest.toTransactionBytes()),
3987
+ encodedTransaction: (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes()),
3988
3988
  utxoValidation: false
3989
3989
  });
3990
- const receipts = gqlReceipts.map(processGqlReceipt);
3990
+ receipts = gqlReceipts.map(processGqlReceipt);
3991
3991
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
3992
- missingOutputVariableCount = missingOutputVariables.length;
3993
- missingOutputContractIdsCount = missingOutputContractIds.length;
3994
- if (missingOutputVariableCount === 0 && missingOutputContractIdsCount === 0) {
3995
- return;
3992
+ const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
3993
+ if (hasMissingOutputs) {
3994
+ outputVariables += missingOutputVariables.length;
3995
+ transactionRequest.addVariableOutputs(missingOutputVariables.length);
3996
+ missingOutputContractIds.forEach(({ contractId }) => {
3997
+ transactionRequest.addContractInputAndOutput(import_address3.Address.fromString(contractId));
3998
+ missingContractIds.push(contractId);
3999
+ });
4000
+ } else {
4001
+ break;
3996
4002
  }
3997
- txRequest.addVariableOutputs(missingOutputVariableCount);
3998
- missingOutputContractIds.forEach(
3999
- ({ contractId }) => txRequest.addContractInputAndOutput(import_address3.Address.fromString(contractId))
4000
- );
4001
- tries += 1;
4002
4003
  }
4004
+ return {
4005
+ receipts,
4006
+ outputVariables,
4007
+ missingContractIds
4008
+ };
4003
4009
  }
4004
4010
  /**
4005
4011
  * Executes a signed transaction without applying the states changes
@@ -4014,9 +4020,9 @@ var _Provider = class {
4014
4020
  async simulate(transactionRequestLike, { estimateTxDependencies = true } = {}) {
4015
4021
  const transactionRequest = transactionRequestify(transactionRequestLike);
4016
4022
  if (estimateTxDependencies) {
4017
- await this.estimateTxDependencies(transactionRequest);
4023
+ return this.estimateTxDependencies(transactionRequest);
4018
4024
  }
4019
- const encodedTransaction = (0, import_ethers18.hexlify)(transactionRequest.toTransactionBytes());
4025
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
4020
4026
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
4021
4027
  encodedTransaction,
4022
4028
  utxoValidation: true
@@ -4046,35 +4052,37 @@ var _Provider = class {
4046
4052
  estimatePredicates = true,
4047
4053
  resourcesOwner
4048
4054
  } = {}) {
4049
- const transactionRequest = transactionRequestify((0, import_ramda3.clone)(transactionRequestLike));
4055
+ const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
4050
4056
  const chainInfo = this.getChain();
4051
4057
  const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
4052
- const gasPrice = (0, import_math14.max)(transactionRequest.gasPrice, minGasPrice);
4053
- const isScriptTransaction = transactionRequest.type === import_transactions17.TransactionType.Script;
4054
- if (transactionRequest.hasPredicateInput() && estimatePredicates) {
4058
+ const gasPrice = (0, import_math14.max)(txRequestClone.gasPrice, minGasPrice);
4059
+ const isScriptTransaction = txRequestClone.type === import_transactions17.TransactionType.Script;
4060
+ const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
4061
+ const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
4062
+ txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
4063
+ if (estimatePredicates) {
4055
4064
  if (isScriptTransaction) {
4056
- transactionRequest.gasLimit = (0, import_math14.bn)(0);
4065
+ txRequestClone.gasLimit = (0, import_math14.bn)(0);
4066
+ }
4067
+ if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4068
+ resourcesOwner.populateTransactionPredicateData(txRequestClone);
4057
4069
  }
4058
- await this.estimatePredicates(transactionRequest);
4070
+ await this.estimatePredicates(txRequestClone);
4059
4071
  }
4060
- const minGas = transactionRequest.calculateMinGas(chainInfo);
4061
- const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4062
- const coinOutputsQuantities = transactionRequest.getCoinOutputsQuantities();
4063
- const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
4064
- transactionRequest.fundWithFakeUtxos(allQuantities, resourcesOwner);
4065
- let gasUsed = minGas;
4072
+ const minGas = txRequestClone.calculateMinGas(chainInfo);
4073
+ const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
4066
4074
  let receipts = [];
4067
- if (isScriptTransaction) {
4068
- transactionRequest.gasPrice = (0, import_math14.bn)(0);
4069
- transactionRequest.gasLimit = (0, import_math14.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
4070
- const result = await this.call(transactionRequest, {
4071
- estimateTxDependencies
4072
- });
4075
+ let missingContractIds = [];
4076
+ let outputVariables = 0;
4077
+ if (isScriptTransaction && estimateTxDependencies) {
4078
+ txRequestClone.gasPrice = (0, import_math14.bn)(0);
4079
+ txRequestClone.gasLimit = (0, import_math14.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
4080
+ const result = await this.estimateTxDependencies(txRequestClone);
4073
4081
  receipts = result.receipts;
4074
- gasUsed = getGasUsedFromReceipts(receipts);
4075
- } else {
4076
- gasUsed = minGas;
4082
+ outputVariables = result.outputVariables;
4083
+ missingContractIds = result.missingContractIds;
4077
4084
  }
4085
+ const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
4078
4086
  const usedFee = calculatePriceWithFactor(
4079
4087
  gasUsed,
4080
4088
  gasPrice,
@@ -4092,7 +4100,10 @@ var _Provider = class {
4092
4100
  maxGas,
4093
4101
  usedFee,
4094
4102
  minFee,
4095
- maxFee
4103
+ maxFee,
4104
+ estimatedInputs: txRequestClone.inputs,
4105
+ outputVariables,
4106
+ missingContractIds
4096
4107
  };
4097
4108
  }
4098
4109
  async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
@@ -4121,7 +4132,7 @@ var _Provider = class {
4121
4132
  const result = await this.operations.getCoins({
4122
4133
  first: 10,
4123
4134
  ...paginationArgs,
4124
- filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_ethers18.hexlify)(assetId) }
4135
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils22.hexlify)(assetId) }
4125
4136
  });
4126
4137
  const coins = result.coins.edges.map((edge) => edge.node);
4127
4138
  return coins.map((coin) => ({
@@ -4145,19 +4156,19 @@ var _Provider = class {
4145
4156
  async getResourcesToSpend(owner, quantities, excludedIds) {
4146
4157
  const ownerAddress = import_address3.Address.fromAddressOrString(owner);
4147
4158
  const excludeInput = {
4148
- messages: excludedIds?.messages?.map((nonce) => (0, import_ethers18.hexlify)(nonce)) || [],
4149
- utxos: excludedIds?.utxos?.map((id) => (0, import_ethers18.hexlify)(id)) || []
4159
+ messages: excludedIds?.messages?.map((nonce) => (0, import_utils22.hexlify)(nonce)) || [],
4160
+ utxos: excludedIds?.utxos?.map((id) => (0, import_utils22.hexlify)(id)) || []
4150
4161
  };
4151
4162
  if (this.cache) {
4152
4163
  const uniqueUtxos = new Set(
4153
- excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_ethers18.hexlify)(id)))
4164
+ excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils22.hexlify)(id)))
4154
4165
  );
4155
4166
  excludeInput.utxos = Array.from(uniqueUtxos);
4156
4167
  }
4157
4168
  const coinsQuery = {
4158
4169
  owner: ownerAddress.toB256(),
4159
4170
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
4160
- assetId: (0, import_ethers18.hexlify)(assetId),
4171
+ assetId: (0, import_utils22.hexlify)(assetId),
4161
4172
  amount: amount.toString(10),
4162
4173
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
4163
4174
  })),
@@ -4260,7 +4271,7 @@ var _Provider = class {
4260
4271
  time: block.header.time,
4261
4272
  transactionIds: block.transactions.map((tx) => tx.id),
4262
4273
  transactions: block.transactions.map(
4263
- (tx) => new import_transactions17.TransactionCoder().decode((0, import_ethers18.getBytesCopy)(tx.rawPayload), 0)?.[0]
4274
+ (tx) => new import_transactions17.TransactionCoder().decode((0, import_utils22.arrayify)(tx.rawPayload), 0)?.[0]
4264
4275
  )
4265
4276
  };
4266
4277
  }
@@ -4276,7 +4287,7 @@ var _Provider = class {
4276
4287
  return null;
4277
4288
  }
4278
4289
  return new import_transactions17.TransactionCoder().decode(
4279
- (0, import_ethers18.getBytesCopy)(transaction.rawPayload),
4290
+ (0, import_utils22.arrayify)(transaction.rawPayload),
4280
4291
  0
4281
4292
  )?.[0];
4282
4293
  }
@@ -4303,7 +4314,7 @@ var _Provider = class {
4303
4314
  async getContractBalance(contractId, assetId) {
4304
4315
  const { contractBalance } = await this.operations.getContractBalance({
4305
4316
  contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
4306
- asset: (0, import_ethers18.hexlify)(assetId)
4317
+ asset: (0, import_utils22.hexlify)(assetId)
4307
4318
  });
4308
4319
  return (0, import_math14.bn)(contractBalance.amount, 10);
4309
4320
  }
@@ -4317,7 +4328,7 @@ var _Provider = class {
4317
4328
  async getBalance(owner, assetId) {
4318
4329
  const { balance } = await this.operations.getBalance({
4319
4330
  owner: import_address3.Address.fromAddressOrString(owner).toB256(),
4320
- assetId: (0, import_ethers18.hexlify)(assetId)
4331
+ assetId: (0, import_utils22.hexlify)(assetId)
4321
4332
  });
4322
4333
  return (0, import_math14.bn)(balance.amount, 10);
4323
4334
  }
@@ -4506,7 +4517,7 @@ __publicField(Provider, "nodeInfoCache", {});
4506
4517
  var import_errors14 = require("@fuel-ts/errors");
4507
4518
  var import_math15 = require("@fuel-ts/math");
4508
4519
  var import_transactions18 = require("@fuel-ts/transactions");
4509
- var import_ethers19 = require("ethers");
4520
+ var import_utils25 = require("@fuel-ts/utils");
4510
4521
  async function getTransactionSummary(params) {
4511
4522
  const { id, provider, abiMap } = params;
4512
4523
  const { transaction: gqlTransaction } = await provider.operations.getTransactionWithReceipts({
@@ -4519,7 +4530,7 @@ async function getTransactionSummary(params) {
4519
4530
  );
4520
4531
  }
4521
4532
  const [decodedTransaction] = new import_transactions18.TransactionCoder().decode(
4522
- (0, import_ethers19.getBytesCopy)(gqlTransaction.rawPayload),
4533
+ (0, import_utils25.arrayify)(gqlTransaction.rawPayload),
4523
4534
  0
4524
4535
  );
4525
4536
  const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
@@ -4530,7 +4541,7 @@ async function getTransactionSummary(params) {
4530
4541
  id: gqlTransaction.id,
4531
4542
  receipts,
4532
4543
  transaction: decodedTransaction,
4533
- transactionBytes: (0, import_ethers19.getBytesCopy)(gqlTransaction.rawPayload),
4544
+ transactionBytes: (0, import_utils25.arrayify)(gqlTransaction.rawPayload),
4534
4545
  gqlTransactionStatus: gqlTransaction.status,
4535
4546
  gasPerByte: (0, import_math15.bn)(gasPerByte),
4536
4547
  gasPriceFactor: (0, import_math15.bn)(gasPriceFactor),
@@ -4572,13 +4583,13 @@ async function getTransactionsSummaries(params) {
4572
4583
  const transactions = edges.map((edge) => {
4573
4584
  const { node: gqlTransaction } = edge;
4574
4585
  const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
4575
- const [decodedTransaction] = new import_transactions18.TransactionCoder().decode((0, import_ethers19.getBytesCopy)(rawPayload), 0);
4586
+ const [decodedTransaction] = new import_transactions18.TransactionCoder().decode((0, import_utils25.arrayify)(rawPayload), 0);
4576
4587
  const receipts = gqlReceipts?.map(processGqlReceipt) || [];
4577
4588
  const transactionSummary = assembleTransactionSummary({
4578
4589
  id,
4579
4590
  receipts,
4580
4591
  transaction: decodedTransaction,
4581
- transactionBytes: (0, import_ethers19.getBytesCopy)(rawPayload),
4592
+ transactionBytes: (0, import_utils25.arrayify)(rawPayload),
4582
4593
  gqlTransactionStatus: status,
4583
4594
  abiMap,
4584
4595
  gasPerByte,
@@ -4598,19 +4609,140 @@ async function getTransactionsSummaries(params) {
4598
4609
  };
4599
4610
  }
4600
4611
 
4612
+ // src/providers/chains.ts
4613
+ var CHAIN_IDS = {
4614
+ eth: {
4615
+ sepolia: 11155111,
4616
+ foundry: 31337
4617
+ },
4618
+ fuel: {
4619
+ beta5: 0,
4620
+ devnet: 10
4621
+ }
4622
+ };
4623
+
4624
+ // src/providers/assets/utils/network.ts
4625
+ var getDefaultChainId = (networkType) => {
4626
+ if (networkType === "ethereum") {
4627
+ return CHAIN_IDS.eth.sepolia;
4628
+ }
4629
+ if (networkType === "fuel") {
4630
+ return CHAIN_IDS.fuel.beta5;
4631
+ }
4632
+ return void 0;
4633
+ };
4634
+ var getAssetNetwork = ({
4635
+ asset,
4636
+ chainId,
4637
+ networkType
4638
+ }) => {
4639
+ const network = asset.networks.find(
4640
+ (item) => item.chainId === chainId && item.type === networkType
4641
+ );
4642
+ return network;
4643
+ };
4644
+ var getAssetWithNetwork = ({
4645
+ asset,
4646
+ chainId,
4647
+ networkType
4648
+ }) => {
4649
+ const { networks: _, ...assetRest } = asset;
4650
+ const chainIdToUse = chainId ?? getDefaultChainId(networkType);
4651
+ if (chainIdToUse === void 0) {
4652
+ return void 0;
4653
+ }
4654
+ const assetNetwork = getAssetNetwork({
4655
+ asset,
4656
+ chainId: chainIdToUse,
4657
+ networkType
4658
+ });
4659
+ if (!assetNetwork) {
4660
+ return void 0;
4661
+ }
4662
+ return {
4663
+ ...assetRest,
4664
+ ...assetNetwork
4665
+ };
4666
+ };
4667
+ var getAssetEth = (asset, chainId) => getAssetWithNetwork({
4668
+ asset,
4669
+ networkType: "ethereum",
4670
+ chainId
4671
+ });
4672
+ var getAssetFuel = (asset, chainId) => getAssetWithNetwork({
4673
+ asset,
4674
+ networkType: "fuel",
4675
+ chainId
4676
+ });
4677
+
4678
+ // src/providers/assets/utils/url.ts
4679
+ var DELIMITER_PATH = "/";
4680
+ var trimRegex = /^\/|\/$/g;
4681
+ var trimPath = (path = "") => path.replace(trimRegex, "");
4682
+ function urlJoin(baseUrl, ...paths) {
4683
+ const hasBaseUrl = baseUrl !== null && baseUrl !== void 0;
4684
+ const rootPath = baseUrl?.[0] === "/" && baseUrl.length > 1;
4685
+ const allPaths = [baseUrl, ...paths].filter(Boolean).map(trimPath);
4686
+ if (rootPath && hasBaseUrl) {
4687
+ allPaths.unshift("");
4688
+ }
4689
+ return allPaths.join(DELIMITER_PATH);
4690
+ }
4691
+
4692
+ // src/providers/assets/utils/resolveIconPaths.ts
4693
+ function resolveIconPaths(assets2, basePath = "./") {
4694
+ return assets2.map((asset) => ({
4695
+ ...asset,
4696
+ icon: urlJoin(basePath, asset.icon)
4697
+ }));
4698
+ }
4699
+
4700
+ // src/providers/assets/index.ts
4701
+ var assets = [
4702
+ {
4703
+ name: "Ethereum",
4704
+ symbol: "ETH",
4705
+ icon: "eth.svg",
4706
+ networks: [
4707
+ {
4708
+ type: "ethereum",
4709
+ chainId: CHAIN_IDS.eth.sepolia,
4710
+ decimals: 18
4711
+ },
4712
+ {
4713
+ type: "ethereum",
4714
+ chainId: CHAIN_IDS.eth.foundry,
4715
+ decimals: 18
4716
+ },
4717
+ {
4718
+ type: "fuel",
4719
+ chainId: CHAIN_IDS.fuel.beta5,
4720
+ decimals: 9,
4721
+ assetId: "0x0000000000000000000000000000000000000000000000000000000000000000"
4722
+ },
4723
+ {
4724
+ type: "fuel",
4725
+ chainId: CHAIN_IDS.fuel.devnet,
4726
+ decimals: 9,
4727
+ assetId: "0x0000000000000000000000000000000000000000000000000000000000000000"
4728
+ }
4729
+ ]
4730
+ }
4731
+ ];
4732
+
4601
4733
  // src/utils/formatTransferToContractScriptData.ts
4602
4734
  var import_abi_coder4 = require("@fuel-ts/abi-coder");
4603
4735
  var import_math16 = require("@fuel-ts/math");
4736
+ var import_utils26 = require("@fuel-ts/utils");
4604
4737
  var asm = __toESM(require("@fuels/vm-asm"));
4605
- var import_ethers20 = require("ethers");
4606
4738
  var formatTransferToContractScriptData = (params) => {
4607
4739
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
4608
4740
  const numberCoder = new import_abi_coder4.U64Coder();
4609
4741
  const encoded = numberCoder.encode(new import_math16.BN(amountToTransfer).toNumber());
4610
4742
  const scriptData = Uint8Array.from([
4611
- ...(0, import_ethers20.getBytesCopy)(hexlifiedContractId),
4743
+ ...(0, import_utils26.arrayify)(hexlifiedContractId),
4612
4744
  ...encoded,
4613
- ...(0, import_ethers20.getBytesCopy)(assetId)
4745
+ ...(0, import_utils26.arrayify)(assetId)
4614
4746
  ]);
4615
4747
  return scriptData;
4616
4748
  };
@@ -4757,7 +4889,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4757
4889
  * @param assetId - The asset ID to check the balance for.
4758
4890
  * @returns A promise that resolves to the balance amount.
4759
4891
  */
4760
- async getBalance(assetId = import_configs10.BaseAssetId) {
4892
+ async getBalance(assetId = import_configs11.BaseAssetId) {
4761
4893
  const amount = await this.provider.getBalance(this.address, assetId);
4762
4894
  return amount;
4763
4895
  }
@@ -4798,7 +4930,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4798
4930
  async fund(request, coinQuantities, fee) {
4799
4931
  const updatedQuantities = addAmountToAsset({
4800
4932
  amount: (0, import_math17.bn)(fee),
4801
- assetId: import_configs10.BaseAssetId,
4933
+ assetId: import_configs11.BaseAssetId,
4802
4934
  coinQuantities
4803
4935
  });
4804
4936
  const quantitiesDict = {};
@@ -4822,8 +4954,8 @@ var Account = class extends import_interfaces.AbstractAccount {
4822
4954
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
4823
4955
  cachedUtxos.push(input.id);
4824
4956
  }
4825
- } else if (input.recipient === owner && input.amount && quantitiesDict[import_configs10.BaseAssetId]) {
4826
- quantitiesDict[import_configs10.BaseAssetId].owned = quantitiesDict[import_configs10.BaseAssetId].owned.add(input.amount);
4957
+ } else if (input.recipient === owner && input.amount && quantitiesDict[import_configs11.BaseAssetId]) {
4958
+ quantitiesDict[import_configs11.BaseAssetId].owned = quantitiesDict[import_configs11.BaseAssetId].owned.add(input.amount);
4827
4959
  cachedMessages.push(input.nonce);
4828
4960
  }
4829
4961
  }
@@ -4855,12 +4987,15 @@ var Account = class extends import_interfaces.AbstractAccount {
4855
4987
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
4856
4988
  * @returns A promise that resolves to the prepared transaction request.
4857
4989
  */
4858
- async createTransfer(destination, amount, assetId = import_configs10.BaseAssetId, txParams = {}) {
4990
+ async createTransfer(destination, amount, assetId = import_configs11.BaseAssetId, txParams = {}) {
4859
4991
  const { minGasPrice } = this.provider.getGasConfig();
4860
4992
  const params = { gasPrice: minGasPrice, ...txParams };
4861
4993
  const request = new ScriptTransactionRequest(params);
4862
4994
  request.addCoinOutput(import_address4.Address.fromAddressOrString(destination), amount, assetId);
4863
- const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(request);
4995
+ const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
4996
+ estimateTxDependencies: true,
4997
+ resourcesOwner: this
4998
+ });
4864
4999
  request.gasPrice = (0, import_math17.bn)(txParams.gasPrice ?? minGasPrice);
4865
5000
  request.gasLimit = (0, import_math17.bn)(txParams.gasLimit ?? gasUsed);
4866
5001
  this.validateGas({
@@ -4870,6 +5005,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4870
5005
  minGasPrice
4871
5006
  });
4872
5007
  await this.fund(request, requiredQuantities, maxFee);
5008
+ request.updatePredicateInputs(estimatedInputs);
4873
5009
  return request;
4874
5010
  }
4875
5011
  /**
@@ -4881,9 +5017,9 @@ var Account = class extends import_interfaces.AbstractAccount {
4881
5017
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
4882
5018
  * @returns A promise that resolves to the transaction response.
4883
5019
  */
4884
- async transfer(destination, amount, assetId = import_configs10.BaseAssetId, txParams = {}) {
5020
+ async transfer(destination, amount, assetId = import_configs11.BaseAssetId, txParams = {}) {
4885
5021
  const request = await this.createTransfer(destination, amount, assetId, txParams);
4886
- return this.sendTransaction(request);
5022
+ return this.sendTransaction(request, { estimateTxDependencies: false });
4887
5023
  }
4888
5024
  /**
4889
5025
  * Transfers coins to a contract address.
@@ -4894,7 +5030,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4894
5030
  * @param txParams - The optional transaction parameters.
4895
5031
  * @returns A promise that resolves to the transaction response.
4896
5032
  */
4897
- async transferToContract(contractId, amount, assetId = import_configs10.BaseAssetId, txParams = {}) {
5033
+ async transferToContract(contractId, amount, assetId = import_configs11.BaseAssetId, txParams = {}) {
4898
5034
  const contractAddress = import_address4.Address.fromAddressOrString(contractId);
4899
5035
  const { minGasPrice } = this.provider.getGasConfig();
4900
5036
  const params = { gasPrice: minGasPrice, ...txParams };
@@ -4934,20 +5070,20 @@ var Account = class extends import_interfaces.AbstractAccount {
4934
5070
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
4935
5071
  const { minGasPrice } = this.provider.getGasConfig();
4936
5072
  const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
4937
- const recipientDataArray = (0, import_ethers21.getBytesCopy)(
5073
+ const recipientDataArray = (0, import_utils27.arrayify)(
4938
5074
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
4939
5075
  );
4940
- const amountDataArray = (0, import_ethers21.getBytesCopy)(
5076
+ const amountDataArray = (0, import_utils27.arrayify)(
4941
5077
  "0x".concat((0, import_math17.bn)(amount).toHex().substring(2).padStart(16, "0"))
4942
5078
  );
4943
5079
  const script = new Uint8Array([
4944
- ...(0, import_ethers21.getBytesCopy)(withdrawScript.bytes),
5080
+ ...(0, import_utils27.arrayify)(withdrawScript.bytes),
4945
5081
  ...recipientDataArray,
4946
5082
  ...amountDataArray
4947
5083
  ]);
4948
5084
  const params = { script, gasPrice: minGasPrice, ...txParams };
4949
5085
  const request = new ScriptTransactionRequest(params);
4950
- const forwardingQuantities = [{ amount: (0, import_math17.bn)(amount), assetId: import_configs10.BaseAssetId }];
5086
+ const forwardingQuantities = [{ amount: (0, import_math17.bn)(amount), assetId: import_configs11.BaseAssetId }];
4951
5087
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
4952
5088
  request,
4953
5089
  forwardingQuantities
@@ -4974,16 +5110,18 @@ var Account = class extends import_interfaces.AbstractAccount {
4974
5110
  * @param transactionRequestLike - The transaction request to be sent.
4975
5111
  * @returns A promise that resolves to the transaction response.
4976
5112
  */
4977
- async sendTransaction(transactionRequestLike, options) {
5113
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
4978
5114
  if (this._connector) {
4979
5115
  return this.provider.getTransactionResponse(
4980
5116
  await this._connector.sendTransaction(this.address.toString(), transactionRequestLike)
4981
5117
  );
4982
5118
  }
4983
5119
  const transactionRequest = transactionRequestify(transactionRequestLike);
4984
- await this.provider.estimateTxDependencies(transactionRequest);
5120
+ if (estimateTxDependencies) {
5121
+ await this.provider.estimateTxDependencies(transactionRequest);
5122
+ }
4985
5123
  return this.provider.sendTransaction(transactionRequest, {
4986
- ...options,
5124
+ awaitExecution,
4987
5125
  estimateTxDependencies: false
4988
5126
  });
4989
5127
  }
@@ -4993,9 +5131,11 @@ var Account = class extends import_interfaces.AbstractAccount {
4993
5131
  * @param transactionRequestLike - The transaction request to be simulated.
4994
5132
  * @returns A promise that resolves to the call result.
4995
5133
  */
4996
- async simulateTransaction(transactionRequestLike) {
5134
+ async simulateTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
4997
5135
  const transactionRequest = transactionRequestify(transactionRequestLike);
4998
- await this.provider.estimateTxDependencies(transactionRequest);
5136
+ if (estimateTxDependencies) {
5137
+ await this.provider.estimateTxDependencies(transactionRequest);
5138
+ }
4999
5139
  return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
5000
5140
  }
5001
5141
  validateGas({
@@ -5021,14 +5161,15 @@ var Account = class extends import_interfaces.AbstractAccount {
5021
5161
 
5022
5162
  // src/wallet/base-wallet-unlocked.ts
5023
5163
  var import_hasher3 = require("@fuel-ts/hasher");
5164
+ var import_utils30 = require("@fuel-ts/utils");
5024
5165
 
5025
5166
  // src/signer/signer.ts
5026
5167
  var import_address5 = require("@fuel-ts/address");
5027
5168
  var import_crypto = require("@fuel-ts/crypto");
5028
5169
  var import_hasher2 = require("@fuel-ts/hasher");
5029
5170
  var import_math18 = require("@fuel-ts/math");
5171
+ var import_utils28 = require("@fuel-ts/utils");
5030
5172
  var import_secp256k1 = require("@noble/curves/secp256k1");
5031
- var import_ethers22 = require("ethers");
5032
5173
  var Signer = class {
5033
5174
  address;
5034
5175
  publicKey;
@@ -5047,9 +5188,9 @@ var Signer = class {
5047
5188
  }
5048
5189
  }
5049
5190
  const privateKeyBytes = (0, import_math18.toBytes)(privateKey, 32);
5050
- this.privateKey = (0, import_ethers22.hexlify)(privateKeyBytes);
5051
- this.publicKey = (0, import_ethers22.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
5052
- this.compressedPublicKey = (0, import_ethers22.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
5191
+ this.privateKey = (0, import_utils28.hexlify)(privateKeyBytes);
5192
+ this.publicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
5193
+ this.compressedPublicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
5053
5194
  this.address = import_address5.Address.fromPublicKey(this.publicKey);
5054
5195
  }
5055
5196
  /**
@@ -5063,11 +5204,11 @@ var Signer = class {
5063
5204
  * @returns hashed signature
5064
5205
  */
5065
5206
  sign(data) {
5066
- const signature = import_secp256k1.secp256k1.sign((0, import_ethers22.getBytesCopy)(data), (0, import_ethers22.getBytesCopy)(this.privateKey));
5207
+ const signature = import_secp256k1.secp256k1.sign((0, import_utils28.arrayify)(data), (0, import_utils28.arrayify)(this.privateKey));
5067
5208
  const r = (0, import_math18.toBytes)(`0x${signature.r.toString(16)}`, 32);
5068
5209
  const s = (0, import_math18.toBytes)(`0x${signature.s.toString(16)}`, 32);
5069
5210
  s[0] |= (signature.recovery || 0) << 7;
5070
- return (0, import_ethers22.concat)([r, s]);
5211
+ return (0, import_utils28.hexlify)((0, import_utils28.concat)([r, s]));
5071
5212
  }
5072
5213
  /**
5073
5214
  * Add point on the current elliptic curve
@@ -5076,8 +5217,8 @@ var Signer = class {
5076
5217
  * @returns compressed point on the curve
5077
5218
  */
5078
5219
  addPoint(point) {
5079
- const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_ethers22.getBytesCopy)(this.compressedPublicKey));
5080
- const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_ethers22.getBytesCopy)(point));
5220
+ const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(this.compressedPublicKey));
5221
+ const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(point));
5081
5222
  const result = p0.add(p1);
5082
5223
  return `0x${result.toHex(true)}`;
5083
5224
  }
@@ -5089,16 +5230,16 @@ var Signer = class {
5089
5230
  * @returns public key from signature from the
5090
5231
  */
5091
5232
  static recoverPublicKey(data, signature) {
5092
- const signedMessageBytes = (0, import_ethers22.getBytesCopy)(signature);
5233
+ const signedMessageBytes = (0, import_utils28.arrayify)(signature);
5093
5234
  const r = signedMessageBytes.slice(0, 32);
5094
5235
  const s = signedMessageBytes.slice(32, 64);
5095
5236
  const recoveryParam = (s[0] & 128) >> 7;
5096
5237
  s[0] &= 127;
5097
- const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_ethers22.hexlify)(r)), BigInt((0, import_ethers22.hexlify)(s))).addRecoveryBit(
5238
+ const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils28.hexlify)(r)), BigInt((0, import_utils28.hexlify)(s))).addRecoveryBit(
5098
5239
  recoveryParam
5099
5240
  );
5100
- const publicKey = sig.recoverPublicKey((0, import_ethers22.getBytesCopy)(data)).toRawBytes(false).slice(1);
5101
- return (0, import_ethers22.hexlify)(publicKey);
5241
+ const publicKey = sig.recoverPublicKey((0, import_utils28.arrayify)(data)).toRawBytes(false).slice(1);
5242
+ return (0, import_utils28.hexlify)(publicKey);
5102
5243
  }
5103
5244
  /**
5104
5245
  * Recover the address from a signature performed with [`sign`](#sign).
@@ -5117,7 +5258,7 @@ var Signer = class {
5117
5258
  * @returns random 32-byte hashed
5118
5259
  */
5119
5260
  static generatePrivateKey(entropy) {
5120
- return entropy ? (0, import_hasher2.hash)((0, import_ethers22.concat)([(0, import_crypto.randomBytes)(32), (0, import_ethers22.getBytesCopy)(entropy)])) : (0, import_crypto.randomBytes)(32);
5261
+ return entropy ? (0, import_hasher2.hash)((0, import_utils28.concat)([(0, import_crypto.randomBytes)(32), (0, import_utils28.arrayify)(entropy)])) : (0, import_crypto.randomBytes)(32);
5121
5262
  }
5122
5263
  /**
5123
5264
  * Extended publicKey from a compact publicKey
@@ -5126,8 +5267,8 @@ var Signer = class {
5126
5267
  * @returns extended publicKey
5127
5268
  */
5128
5269
  static extendPublicKey(publicKey) {
5129
- const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_ethers22.getBytesCopy)(publicKey));
5130
- return (0, import_ethers22.hexlify)(point.toRawBytes(false).slice(1));
5270
+ const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(publicKey));
5271
+ return (0, import_utils28.hexlify)(point.toRawBytes(false).slice(1));
5131
5272
  }
5132
5273
  };
5133
5274
 
@@ -5135,7 +5276,7 @@ var Signer = class {
5135
5276
  var import_address6 = require("@fuel-ts/address");
5136
5277
  var import_crypto2 = require("@fuel-ts/crypto");
5137
5278
  var import_errors16 = require("@fuel-ts/errors");
5138
- var import_ethers23 = require("ethers");
5279
+ var import_utils29 = require("@fuel-ts/utils");
5139
5280
  var import_uuid = require("uuid");
5140
5281
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
5141
5282
  var DEFAULT_KDF_PARAMS_R = 8;
@@ -5218,7 +5359,7 @@ async function decryptKeystoreWallet(jsonWallet, password) {
5218
5359
  );
5219
5360
  }
5220
5361
  const buffer = await (0, import_crypto2.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
5221
- const privateKey = (0, import_ethers23.hexlify)(buffer);
5362
+ const privateKey = (0, import_utils29.hexlify)(buffer);
5222
5363
  return privateKey;
5223
5364
  }
5224
5365
 
@@ -5263,7 +5404,7 @@ var BaseWalletUnlocked = class extends Account {
5263
5404
  */
5264
5405
  async signMessage(message) {
5265
5406
  const signedMessage = await this.signer().sign((0, import_hasher3.hashMessage)(message));
5266
- return signedMessage;
5407
+ return (0, import_utils30.hexlify)(signedMessage);
5267
5408
  }
5268
5409
  /**
5269
5410
  * Signs a transaction with the wallet's private key.
@@ -5276,7 +5417,7 @@ var BaseWalletUnlocked = class extends Account {
5276
5417
  const chainId = this.provider.getChain().consensusParameters.chainId.toNumber();
5277
5418
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
5278
5419
  const signature = await this.signer().sign(hashedTransaction);
5279
- return signature;
5420
+ return (0, import_utils30.hexlify)(signature);
5280
5421
  }
5281
5422
  /**
5282
5423
  * Populates a transaction with the witnesses signature.
@@ -5296,12 +5437,14 @@ var BaseWalletUnlocked = class extends Account {
5296
5437
  * @param transactionRequestLike - The transaction request to send.
5297
5438
  * @returns A promise that resolves to the TransactionResponse object.
5298
5439
  */
5299
- async sendTransaction(transactionRequestLike, options) {
5440
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
5300
5441
  const transactionRequest = transactionRequestify(transactionRequestLike);
5301
- await this.provider.estimateTxDependencies(transactionRequest);
5442
+ if (estimateTxDependencies) {
5443
+ await this.provider.estimateTxDependencies(transactionRequest);
5444
+ }
5302
5445
  return this.provider.sendTransaction(
5303
5446
  await this.populateTransactionWitnessesSignature(transactionRequest),
5304
- { ...options, estimateTxDependencies: false }
5447
+ { awaitExecution, estimateTxDependencies: false }
5305
5448
  );
5306
5449
  }
5307
5450
  /**
@@ -5310,9 +5453,11 @@ var BaseWalletUnlocked = class extends Account {
5310
5453
  * @param transactionRequestLike - The transaction request to simulate.
5311
5454
  * @returns A promise that resolves to the CallResult object.
5312
5455
  */
5313
- async simulateTransaction(transactionRequestLike) {
5456
+ async simulateTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
5314
5457
  const transactionRequest = transactionRequestify(transactionRequestLike);
5315
- await this.provider.estimateTxDependencies(transactionRequest);
5458
+ if (estimateTxDependencies) {
5459
+ await this.provider.estimateTxDependencies(transactionRequest);
5460
+ }
5316
5461
  return this.provider.call(
5317
5462
  await this.populateTransactionWitnessesSignature(transactionRequest),
5318
5463
  {
@@ -5333,12 +5478,14 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5333
5478
  // src/hdwallet/hdwallet.ts
5334
5479
  var import_errors19 = require("@fuel-ts/errors");
5335
5480
  var import_math19 = require("@fuel-ts/math");
5336
- var import_ethers26 = require("ethers");
5481
+ var import_utils34 = require("@fuel-ts/utils");
5482
+ var import_ethers5 = require("ethers");
5337
5483
 
5338
5484
  // src/mnemonic/mnemonic.ts
5339
5485
  var import_crypto3 = require("@fuel-ts/crypto");
5340
5486
  var import_errors18 = require("@fuel-ts/errors");
5341
- var import_ethers25 = require("ethers");
5487
+ var import_utils32 = require("@fuel-ts/utils");
5488
+ var import_ethers4 = require("ethers");
5342
5489
 
5343
5490
  // src/wordlists/words/english.ts
5344
5491
  var english = [
@@ -7400,7 +7547,8 @@ var Language = /* @__PURE__ */ ((Language2) => {
7400
7547
 
7401
7548
  // src/mnemonic/utils.ts
7402
7549
  var import_errors17 = require("@fuel-ts/errors");
7403
- var import_ethers24 = require("ethers");
7550
+ var import_utils31 = require("@fuel-ts/utils");
7551
+ var import_ethers3 = require("ethers");
7404
7552
  function toUtf8Bytes(stri) {
7405
7553
  const str = stri.normalize("NFKD");
7406
7554
  const result = [];
@@ -7467,14 +7615,14 @@ function entropyToMnemonicIndices(entropy) {
7467
7615
  }
7468
7616
  }
7469
7617
  const checksumBits = entropy.length / 4;
7470
- const checksum = (0, import_ethers24.getBytesCopy)((0, import_ethers24.sha256)(entropy))[0] & getUpperMask(checksumBits);
7618
+ const checksum = (0, import_utils31.arrayify)((0, import_ethers3.sha256)(entropy))[0] & getUpperMask(checksumBits);
7471
7619
  indices[indices.length - 1] <<= checksumBits;
7472
7620
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
7473
7621
  return indices;
7474
7622
  }
7475
7623
  function mnemonicWordsToEntropy(words, wordlist) {
7476
7624
  const size = Math.ceil(11 * words.length / 8);
7477
- const entropy = (0, import_ethers24.getBytesCopy)(new Uint8Array(size));
7625
+ const entropy = (0, import_utils31.arrayify)(new Uint8Array(size));
7478
7626
  let offset = 0;
7479
7627
  for (let i = 0; i < words.length; i += 1) {
7480
7628
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
@@ -7494,7 +7642,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
7494
7642
  const entropyBits = 32 * words.length / 3;
7495
7643
  const checksumBits = words.length / 3;
7496
7644
  const checksumMask = getUpperMask(checksumBits);
7497
- const checksum = (0, import_ethers24.getBytesCopy)((0, import_ethers24.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7645
+ const checksum = (0, import_utils31.arrayify)((0, import_ethers3.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7498
7646
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
7499
7647
  throw new import_errors17.FuelError(
7500
7648
  import_errors17.ErrorCode.INVALID_CHECKSUM,
@@ -7569,7 +7717,7 @@ var Mnemonic = class {
7569
7717
  static mnemonicToEntropy(phrase, wordlist = english) {
7570
7718
  const words = getWords(phrase);
7571
7719
  assertMnemonic(words);
7572
- return (0, import_ethers25.hexlify)(mnemonicWordsToEntropy(words, wordlist));
7720
+ return (0, import_utils32.hexlify)(mnemonicWordsToEntropy(words, wordlist));
7573
7721
  }
7574
7722
  /**
7575
7723
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -7577,7 +7725,7 @@ var Mnemonic = class {
7577
7725
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7578
7726
  */
7579
7727
  static entropyToMnemonic(entropy, wordlist = english) {
7580
- const entropyBytes = (0, import_ethers25.getBytesCopy)(entropy);
7728
+ const entropyBytes = (0, import_utils32.arrayify)(entropy);
7581
7729
  assertWordList(wordlist);
7582
7730
  assertEntropy(entropyBytes);
7583
7731
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -7591,7 +7739,7 @@ var Mnemonic = class {
7591
7739
  assertMnemonic(getWords(phrase));
7592
7740
  const phraseBytes = toUtf8Bytes(getPhrase(phrase));
7593
7741
  const salt = toUtf8Bytes(`mnemonic${passphrase}`);
7594
- return (0, import_ethers25.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
7742
+ return (0, import_ethers4.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
7595
7743
  }
7596
7744
  /**
7597
7745
  * @param phrase - Mnemonic phrase composed by words from the provided wordlist
@@ -7646,14 +7794,14 @@ var Mnemonic = class {
7646
7794
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7647
7795
  */
7648
7796
  static masterKeysFromSeed(seed) {
7649
- const seedArray = (0, import_ethers25.getBytesCopy)(seed);
7797
+ const seedArray = (0, import_utils32.arrayify)(seed);
7650
7798
  if (seedArray.length < 16 || seedArray.length > 64) {
7651
7799
  throw new import_errors18.FuelError(
7652
7800
  import_errors18.ErrorCode.INVALID_SEED,
7653
7801
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
7654
7802
  );
7655
7803
  }
7656
- return (0, import_ethers25.getBytesCopy)((0, import_ethers25.computeHmac)("sha512", MasterSecret, seedArray));
7804
+ return (0, import_utils32.arrayify)((0, import_ethers4.computeHmac)("sha512", MasterSecret, seedArray));
7657
7805
  }
7658
7806
  /**
7659
7807
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -7664,22 +7812,22 @@ var Mnemonic = class {
7664
7812
  */
7665
7813
  static seedToExtendedKey(seed, testnet = false) {
7666
7814
  const masterKey = Mnemonic.masterKeysFromSeed(seed);
7667
- const prefix = (0, import_ethers25.getBytesCopy)(testnet ? TestnetPRV : MainnetPRV);
7815
+ const prefix = (0, import_utils32.arrayify)(testnet ? TestnetPRV : MainnetPRV);
7668
7816
  const depth = "0x00";
7669
7817
  const fingerprint = "0x00000000";
7670
7818
  const index = "0x00000000";
7671
7819
  const chainCode = masterKey.slice(32);
7672
7820
  const privateKey = masterKey.slice(0, 32);
7673
- const extendedKey = (0, import_ethers25.concat)([
7821
+ const extendedKey = (0, import_utils32.concat)([
7674
7822
  prefix,
7675
7823
  depth,
7676
7824
  fingerprint,
7677
7825
  index,
7678
7826
  chainCode,
7679
- (0, import_ethers25.concat)(["0x00", privateKey])
7827
+ (0, import_utils32.concat)(["0x00", privateKey])
7680
7828
  ]);
7681
- const checksum = (0, import_ethers25.dataSlice)((0, import_ethers25.sha256)((0, import_ethers25.sha256)(extendedKey)), 0, 4);
7682
- return (0, import_ethers25.encodeBase58)((0, import_ethers25.concat)([extendedKey, checksum]));
7829
+ const checksum = (0, import_ethers4.dataSlice)((0, import_ethers4.sha256)((0, import_ethers4.sha256)(extendedKey)), 0, 4);
7830
+ return (0, import_ethers4.encodeBase58)((0, import_utils32.concat)([extendedKey, checksum]));
7683
7831
  }
7684
7832
  /**
7685
7833
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -7694,7 +7842,7 @@ var Mnemonic = class {
7694
7842
  * @returns A randomly generated mnemonic
7695
7843
  */
7696
7844
  static generate(size = 32, extraEntropy = "") {
7697
- const entropy = extraEntropy ? (0, import_ethers25.sha256)((0, import_ethers25.concat)([(0, import_crypto3.randomBytes)(size), (0, import_ethers25.getBytesCopy)(extraEntropy)])) : (0, import_crypto3.randomBytes)(size);
7845
+ const entropy = extraEntropy ? (0, import_ethers4.sha256)((0, import_utils32.concat)([(0, import_crypto3.randomBytes)(size), (0, import_utils32.arrayify)(extraEntropy)])) : (0, import_crypto3.randomBytes)(size);
7698
7846
  return Mnemonic.entropyToMnemonic(entropy);
7699
7847
  }
7700
7848
  };
@@ -7702,12 +7850,12 @@ var mnemonic_default = Mnemonic;
7702
7850
 
7703
7851
  // src/hdwallet/hdwallet.ts
7704
7852
  var HARDENED_INDEX = 2147483648;
7705
- var MainnetPRV2 = (0, import_ethers26.hexlify)("0x0488ade4");
7706
- var MainnetPUB = (0, import_ethers26.hexlify)("0x0488b21e");
7707
- var TestnetPRV2 = (0, import_ethers26.hexlify)("0x04358394");
7708
- var TestnetPUB = (0, import_ethers26.hexlify)("0x043587cf");
7853
+ var MainnetPRV2 = (0, import_utils34.hexlify)("0x0488ade4");
7854
+ var MainnetPUB = (0, import_utils34.hexlify)("0x0488b21e");
7855
+ var TestnetPRV2 = (0, import_utils34.hexlify)("0x04358394");
7856
+ var TestnetPUB = (0, import_utils34.hexlify)("0x043587cf");
7709
7857
  function base58check(data) {
7710
- return (0, import_ethers26.encodeBase58)((0, import_ethers26.concat)([data, (0, import_ethers26.dataSlice)((0, import_ethers26.sha256)((0, import_ethers26.sha256)(data)), 0, 4)]));
7858
+ return (0, import_ethers5.encodeBase58)((0, import_utils34.concat)([data, (0, import_ethers5.dataSlice)((0, import_ethers5.sha256)((0, import_ethers5.sha256)(data)), 0, 4)]));
7711
7859
  }
7712
7860
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
7713
7861
  if (isPublic) {
@@ -7716,11 +7864,11 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
7716
7864
  return testnet ? TestnetPRV2 : MainnetPRV2;
7717
7865
  }
7718
7866
  function isPublicExtendedKey(extendedKey) {
7719
- return [MainnetPUB, TestnetPUB].includes((0, import_ethers26.hexlify)(extendedKey.slice(0, 4)));
7867
+ return [MainnetPUB, TestnetPUB].includes((0, import_utils34.hexlify)(extendedKey.slice(0, 4)));
7720
7868
  }
7721
7869
  function isValidExtendedKey(extendedKey) {
7722
7870
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
7723
- (0, import_ethers26.hexlify)(extendedKey.slice(0, 4))
7871
+ (0, import_utils34.hexlify)(extendedKey.slice(0, 4))
7724
7872
  );
7725
7873
  }
7726
7874
  function parsePath(path, depth = 0) {
@@ -7738,8 +7886,8 @@ function parsePath(path, depth = 0) {
7738
7886
  var HDWallet = class {
7739
7887
  depth = 0;
7740
7888
  index = 0;
7741
- fingerprint = (0, import_ethers26.hexlify)("0x00000000");
7742
- parentFingerprint = (0, import_ethers26.hexlify)("0x00000000");
7889
+ fingerprint = (0, import_utils34.hexlify)("0x00000000");
7890
+ parentFingerprint = (0, import_utils34.hexlify)("0x00000000");
7743
7891
  privateKey;
7744
7892
  publicKey;
7745
7893
  chainCode;
@@ -7751,8 +7899,8 @@ var HDWallet = class {
7751
7899
  constructor(config) {
7752
7900
  if (config.privateKey) {
7753
7901
  const signer = new Signer(config.privateKey);
7754
- this.publicKey = (0, import_ethers26.hexlify)(signer.compressedPublicKey);
7755
- this.privateKey = (0, import_ethers26.hexlify)(config.privateKey);
7902
+ this.publicKey = (0, import_utils34.hexlify)(signer.compressedPublicKey);
7903
+ this.privateKey = (0, import_utils34.hexlify)(config.privateKey);
7756
7904
  } else {
7757
7905
  if (!config.publicKey) {
7758
7906
  throw new import_errors19.FuelError(
@@ -7760,10 +7908,10 @@ var HDWallet = class {
7760
7908
  "Both public and private Key cannot be missing. At least one should be provided."
7761
7909
  );
7762
7910
  }
7763
- this.publicKey = (0, import_ethers26.hexlify)(config.publicKey);
7911
+ this.publicKey = (0, import_utils34.hexlify)(config.publicKey);
7764
7912
  }
7765
7913
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
7766
- this.fingerprint = (0, import_ethers26.dataSlice)((0, import_ethers26.ripemd160)((0, import_ethers26.sha256)(this.publicKey)), 0, 4);
7914
+ this.fingerprint = (0, import_ethers5.dataSlice)((0, import_ethers5.ripemd160)((0, import_ethers5.sha256)(this.publicKey)), 0, 4);
7767
7915
  this.depth = config.depth || this.depth;
7768
7916
  this.index = config.index || this.index;
7769
7917
  this.chainCode = config.chainCode;
@@ -7779,9 +7927,9 @@ var HDWallet = class {
7779
7927
  * @returns A new instance of HDWallet on the derived index
7780
7928
  */
7781
7929
  deriveIndex(index) {
7782
- const privateKey = this.privateKey && (0, import_ethers26.getBytesCopy)(this.privateKey);
7783
- const publicKey = (0, import_ethers26.getBytesCopy)(this.publicKey);
7784
- const chainCode = (0, import_ethers26.getBytesCopy)(this.chainCode);
7930
+ const privateKey = this.privateKey && (0, import_utils34.arrayify)(this.privateKey);
7931
+ const publicKey = (0, import_utils34.arrayify)(this.publicKey);
7932
+ const chainCode = (0, import_utils34.arrayify)(this.chainCode);
7785
7933
  const data = new Uint8Array(37);
7786
7934
  if (index & HARDENED_INDEX) {
7787
7935
  if (!privateKey) {
@@ -7792,10 +7940,10 @@ var HDWallet = class {
7792
7940
  }
7793
7941
  data.set(privateKey, 1);
7794
7942
  } else {
7795
- data.set((0, import_ethers26.getBytesCopy)(this.publicKey));
7943
+ data.set((0, import_utils34.arrayify)(this.publicKey));
7796
7944
  }
7797
7945
  data.set((0, import_math19.toBytes)(index, 4), 33);
7798
- const bytes = (0, import_ethers26.getBytesCopy)((0, import_ethers26.computeHmac)("sha512", chainCode, data));
7946
+ const bytes = (0, import_utils34.arrayify)((0, import_ethers5.computeHmac)("sha512", chainCode, data));
7799
7947
  const IL = bytes.slice(0, 32);
7800
7948
  const IR = bytes.slice(32);
7801
7949
  if (privateKey) {
@@ -7809,7 +7957,7 @@ var HDWallet = class {
7809
7957
  parentFingerprint: this.fingerprint
7810
7958
  });
7811
7959
  }
7812
- const signer = new Signer((0, import_ethers26.hexlify)(IL));
7960
+ const signer = new Signer((0, import_utils34.hexlify)(IL));
7813
7961
  const Ki = signer.addPoint(publicKey);
7814
7962
  return new HDWallet({
7815
7963
  publicKey: Ki,
@@ -7844,14 +7992,12 @@ var HDWallet = class {
7844
7992
  );
7845
7993
  }
7846
7994
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
7847
- const depth = (0, import_ethers26.hexlify)(Uint8Array.from([this.depth]));
7995
+ const depth = (0, import_utils34.hexlify)(Uint8Array.from([this.depth]));
7848
7996
  const parentFingerprint = this.parentFingerprint;
7849
7997
  const index = (0, import_math19.toHex)(this.index, 4);
7850
7998
  const chainCode = this.chainCode;
7851
- const key = this.privateKey != null && !isPublic ? (0, import_ethers26.concat)(["0x00", this.privateKey]) : this.publicKey;
7852
- const extendedKey = (0, import_ethers26.getBytesCopy)(
7853
- (0, import_ethers26.concat)([prefix, depth, parentFingerprint, index, chainCode, key])
7854
- );
7999
+ const key = this.privateKey != null && !isPublic ? (0, import_utils34.concat)(["0x00", this.privateKey]) : this.publicKey;
8000
+ const extendedKey = (0, import_utils34.arrayify)((0, import_utils34.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
7855
8001
  return base58check(extendedKey);
7856
8002
  }
7857
8003
  /**
@@ -7863,13 +8009,13 @@ var HDWallet = class {
7863
8009
  static fromSeed(seed) {
7864
8010
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
7865
8011
  return new HDWallet({
7866
- chainCode: (0, import_ethers26.getBytesCopy)(masterKey.slice(32)),
7867
- privateKey: (0, import_ethers26.getBytesCopy)(masterKey.slice(0, 32))
8012
+ chainCode: (0, import_utils34.arrayify)(masterKey.slice(32)),
8013
+ privateKey: (0, import_utils34.arrayify)(masterKey.slice(0, 32))
7868
8014
  });
7869
8015
  }
7870
8016
  static fromExtendedKey(extendedKey) {
7871
- const decoded = (0, import_ethers26.toBeHex)((0, import_ethers26.decodeBase58)(extendedKey));
7872
- const bytes = (0, import_ethers26.getBytesCopy)(decoded);
8017
+ const decoded = (0, import_ethers5.toBeHex)((0, import_ethers5.decodeBase58)(extendedKey));
8018
+ const bytes = (0, import_utils34.arrayify)(decoded);
7873
8019
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
7874
8020
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
7875
8021
  throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
@@ -7878,9 +8024,9 @@ var HDWallet = class {
7878
8024
  throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
7879
8025
  }
7880
8026
  const depth = bytes[4];
7881
- const parentFingerprint = (0, import_ethers26.hexlify)(bytes.slice(5, 9));
7882
- const index = parseInt((0, import_ethers26.hexlify)(bytes.slice(9, 13)).substring(2), 16);
7883
- const chainCode = (0, import_ethers26.hexlify)(bytes.slice(13, 45));
8027
+ const parentFingerprint = (0, import_utils34.hexlify)(bytes.slice(5, 9));
8028
+ const index = parseInt((0, import_utils34.hexlify)(bytes.slice(9, 13)).substring(2), 16);
8029
+ const chainCode = (0, import_utils34.hexlify)(bytes.slice(13, 45));
7884
8030
  const key = bytes.slice(45, 78);
7885
8031
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
7886
8032
  throw new import_errors19.FuelError(
@@ -8483,22 +8629,21 @@ var StorageAbstract = class {
8483
8629
  // src/predicate/predicate.ts
8484
8630
  var import_abi_coder5 = require("@fuel-ts/abi-coder");
8485
8631
  var import_address10 = require("@fuel-ts/address");
8486
- var import_configs11 = require("@fuel-ts/address/configs");
8632
+ var import_configs12 = require("@fuel-ts/address/configs");
8487
8633
  var import_errors24 = require("@fuel-ts/errors");
8488
8634
  var import_transactions19 = require("@fuel-ts/transactions");
8489
- var import_ethers28 = require("ethers");
8635
+ var import_utils36 = require("@fuel-ts/utils");
8490
8636
 
8491
8637
  // src/predicate/utils/getPredicateRoot.ts
8492
8638
  var import_hasher4 = require("@fuel-ts/hasher");
8493
8639
  var import_merkle = require("@fuel-ts/merkle");
8494
- var import_utils7 = require("@fuel-ts/utils");
8495
- var import_ethers27 = require("ethers");
8640
+ var import_utils35 = require("@fuel-ts/utils");
8496
8641
  var getPredicateRoot = (bytecode) => {
8497
8642
  const chunkSize = 16 * 1024;
8498
- const bytes = (0, import_ethers27.getBytesCopy)(bytecode);
8499
- const chunks = (0, import_utils7.chunkAndPadBytes)(bytes, chunkSize);
8500
- const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0, import_ethers27.hexlify)(c)));
8501
- const predicateRoot = (0, import_hasher4.hash)((0, import_ethers27.concat)(["0x4655454C", codeRoot]));
8643
+ const bytes = (0, import_utils35.arrayify)(bytecode);
8644
+ const chunks = (0, import_utils35.chunkAndPadBytes)(bytes, chunkSize);
8645
+ const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0, import_utils35.hexlify)(c)));
8646
+ const predicateRoot = (0, import_hasher4.hash)((0, import_utils35.concat)(["0x4655454C", codeRoot]));
8502
8647
  return predicateRoot;
8503
8648
  };
8504
8649
 
@@ -8537,7 +8682,7 @@ var Predicate = class extends Account {
8537
8682
  const request = transactionRequestify(transactionRequestLike);
8538
8683
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
8539
8684
  request.inputs?.forEach((input) => {
8540
- if (input.type === import_transactions19.InputType.Coin && (0, import_ethers28.hexlify)(input.owner) === this.address.toB256()) {
8685
+ if (input.type === import_transactions19.InputType.Coin && (0, import_utils36.hexlify)(input.owner) === this.address.toB256()) {
8541
8686
  input.predicate = this.bytes;
8542
8687
  input.predicateData = this.getPredicateData(policies.length);
8543
8688
  }
@@ -8553,7 +8698,7 @@ var Predicate = class extends Account {
8553
8698
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
8554
8699
  * @returns A promise that resolves to the prepared transaction request.
8555
8700
  */
8556
- async createTransfer(destination, amount, assetId = import_configs11.BaseAssetId, txParams = {}) {
8701
+ async createTransfer(destination, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
8557
8702
  const request = await super.createTransfer(destination, amount, assetId, txParams);
8558
8703
  return this.populateTransactionPredicateData(request);
8559
8704
  }
@@ -8608,7 +8753,7 @@ var Predicate = class extends Account {
8608
8753
  * @returns An object containing the new predicate bytes and interface.
8609
8754
  */
8610
8755
  static processPredicateData(bytes, jsonAbi, configurableConstants) {
8611
- let predicateBytes = (0, import_ethers28.getBytesCopy)(bytes);
8756
+ let predicateBytes = (0, import_utils36.arrayify)(bytes);
8612
8757
  let abiInterface;
8613
8758
  if (jsonAbi) {
8614
8759
  abiInterface = new import_abi_coder5.Interface(jsonAbi);
@@ -8668,6 +8813,9 @@ var Predicate = class extends Account {
8668
8813
  }
8669
8814
  };
8670
8815
 
8816
+ // src/connectors/fuel.ts
8817
+ var import_errors25 = require("@fuel-ts/errors");
8818
+
8671
8819
  // src/connectors/fuel-connector.ts
8672
8820
  var import_events2 = require("events");
8673
8821
 
@@ -8708,17 +8856,6 @@ var FuelConnectorEventTypes = /* @__PURE__ */ ((FuelConnectorEventTypes2) => {
8708
8856
  })(FuelConnectorEventTypes || {});
8709
8857
  var FuelConnectorEventType = "FuelConnector";
8710
8858
 
8711
- // src/connectors/types/data-type.ts
8712
- var MessageTypes = /* @__PURE__ */ ((MessageTypes2) => {
8713
- MessageTypes2["ping"] = "ping";
8714
- MessageTypes2["uiEvent"] = "uiEvent";
8715
- MessageTypes2["event"] = "event";
8716
- MessageTypes2["request"] = "request";
8717
- MessageTypes2["response"] = "response";
8718
- MessageTypes2["removeConnection"] = "removeConnection";
8719
- return MessageTypes2;
8720
- })(MessageTypes || {});
8721
-
8722
8859
  // src/connectors/types/local-storage.ts
8723
8860
  var LocalStorage = class {
8724
8861
  storage;
@@ -9007,6 +9144,7 @@ async function withTimeout(promise, timeout = 1050) {
9007
9144
  // src/connectors/fuel.ts
9008
9145
  var HAS_CONNECTOR_TIMEOUT = 2e3;
9009
9146
  var PING_CACHE_TIME = 5e3;
9147
+ var { warn } = console;
9010
9148
  var _Fuel = class extends FuelConnector {
9011
9149
  _storage = null;
9012
9150
  _connectors = [];
@@ -9275,14 +9413,12 @@ var _Fuel = class extends FuelConnector {
9275
9413
  * Return a Fuel Provider instance with extends features to work with
9276
9414
  * connectors.
9277
9415
  *
9278
- * @deprecated Provider is going to be deprecated in the future.
9416
+ * @deprecated getProvider is deprecated and is going to be removed in the future, use getWallet instead.
9279
9417
  */
9280
9418
  async getProvider(providerOrNetwork) {
9281
- if (process.env.NODE_ENV !== "production") {
9282
- console.warn(
9283
- "Get provider is deprecated, use getWallet instead. Provider is going to be removed in the future."
9284
- );
9285
- }
9419
+ warn(
9420
+ "getProvider is deprecated and is going to be removed in the future, use getWallet instead."
9421
+ );
9286
9422
  return this._getProvider(providerOrNetwork);
9287
9423
  }
9288
9424
  /**
@@ -9299,7 +9435,7 @@ var _Fuel = class extends FuelConnector {
9299
9435
  const currentNetwork = await this.currentNetwork();
9300
9436
  provider = await Provider.create(currentNetwork.url);
9301
9437
  } else {
9302
- throw new Error("Provider is not valid.");
9438
+ throw new import_errors25.FuelError(import_errors25.ErrorCode.INVALID_PROVIDER, "Provider is not valid.");
9303
9439
  }
9304
9440
  return provider;
9305
9441
  }
@@ -9343,6 +9479,7 @@ __publicField(Fuel, "defaultConfig", {});
9343
9479
  AddressType,
9344
9480
  BaseTransactionRequest,
9345
9481
  BaseWalletUnlocked,
9482
+ CHAIN_IDS,
9346
9483
  ChainName,
9347
9484
  ChangeOutputCollisionError,
9348
9485
  CreateTransactionRequest,
@@ -9356,7 +9493,6 @@ __publicField(Fuel, "defaultConfig", {});
9356
9493
  LocalStorage,
9357
9494
  MNEMONIC_SIZES,
9358
9495
  MemoryStorage,
9359
- MessageTypes,
9360
9496
  Mnemonic,
9361
9497
  MnemonicVault,
9362
9498
  NoWitnessAtIndexError,
@@ -9381,6 +9517,7 @@ __publicField(Fuel, "defaultConfig", {});
9381
9517
  addOperation,
9382
9518
  assembleReceiptByType,
9383
9519
  assembleTransactionSummary,
9520
+ assets,
9384
9521
  buildBlockExplorerUrl,
9385
9522
  cacheFor,
9386
9523
  calculateMetadataGasForTxCreate,
@@ -9398,10 +9535,14 @@ __publicField(Fuel, "defaultConfig", {});
9398
9535
  fromTai64ToUnix,
9399
9536
  fromUnixToTai64,
9400
9537
  gasUsedByInputs,
9538
+ getAssetEth,
9539
+ getAssetFuel,
9540
+ getAssetNetwork,
9541
+ getAssetWithNetwork,
9401
9542
  getContractCallOperations,
9402
9543
  getContractCreatedOperations,
9403
- getContractTransferOperations,
9404
9544
  getDecodedLogs,
9545
+ getDefaultChainId,
9405
9546
  getGasUsedFromReceipts,
9406
9547
  getInputAccountAddress,
9407
9548
  getInputContractFromIndex,
@@ -9450,9 +9591,11 @@ __publicField(Fuel, "defaultConfig", {});
9450
9591
  processGqlReceipt,
9451
9592
  processGraphqlStatus,
9452
9593
  resolveGasDependentCosts,
9594
+ resolveIconPaths,
9453
9595
  returnZeroScript,
9454
9596
  sleep,
9455
9597
  transactionRequestify,
9598
+ urlJoin,
9456
9599
  withTimeout,
9457
9600
  withdrawScript
9458
9601
  });