@fuel-ts/account 0.0.0-pr-1699-20240214162434 → 0.0.0-pr-1788-20240222085506

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 (109) hide show
  1. package/dist/account.d.ts +8 -6
  2. package/dist/account.d.ts.map +1 -1
  3. package/dist/connectors/fuel.d.ts +5 -6
  4. package/dist/connectors/fuel.d.ts.map +1 -1
  5. package/dist/connectors/index.d.ts +0 -2
  6. package/dist/connectors/index.d.ts.map +1 -1
  7. package/dist/connectors/types/asset.d.ts +0 -14
  8. package/dist/connectors/types/asset.d.ts.map +1 -1
  9. package/dist/connectors/types/data-type.d.ts +0 -4
  10. package/dist/connectors/types/data-type.d.ts.map +1 -1
  11. package/dist/connectors/types/events.d.ts +0 -5
  12. package/dist/connectors/types/events.d.ts.map +1 -1
  13. package/dist/connectors/types/index.d.ts +0 -2
  14. package/dist/connectors/types/index.d.ts.map +1 -1
  15. package/dist/connectors/utils/cache.d.ts.map +1 -1
  16. package/dist/connectors/utils/index.d.ts +0 -1
  17. package/dist/connectors/utils/index.d.ts.map +1 -1
  18. package/dist/hdwallet/hdwallet.d.ts +1 -1
  19. package/dist/hdwallet/hdwallet.d.ts.map +1 -1
  20. package/dist/index.global.js +898 -785
  21. package/dist/index.global.js.map +1 -1
  22. package/dist/index.js +460 -344
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +388 -284
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/mnemonic/mnemonic.d.ts +1 -1
  27. package/dist/mnemonic/mnemonic.d.ts.map +1 -1
  28. package/dist/mnemonic/utils.d.ts +1 -1
  29. package/dist/mnemonic/utils.d.ts.map +1 -1
  30. package/dist/predicate/predicate.d.ts.map +1 -1
  31. package/dist/predicate/utils/getPredicateRoot.d.ts +1 -1
  32. package/dist/predicate/utils/getPredicateRoot.d.ts.map +1 -1
  33. package/dist/providers/assets/index.d.ts +4 -0
  34. package/dist/providers/assets/index.d.ts.map +1 -0
  35. package/dist/providers/assets/types.d.ts +36 -0
  36. package/dist/providers/assets/types.d.ts.map +1 -0
  37. package/dist/providers/assets/utils/index.d.ts +4 -0
  38. package/dist/providers/assets/utils/index.d.ts.map +1 -0
  39. package/dist/providers/assets/utils/network.d.ts +33 -0
  40. package/dist/providers/assets/utils/network.d.ts.map +1 -0
  41. package/dist/providers/assets/utils/resolveIconPaths.d.ts +14 -0
  42. package/dist/providers/assets/utils/resolveIconPaths.d.ts.map +1 -0
  43. package/dist/providers/assets/utils/url.d.ts +2 -0
  44. package/dist/providers/assets/utils/url.d.ts.map +1 -0
  45. package/dist/providers/chains.d.ts +11 -0
  46. package/dist/providers/chains.d.ts.map +1 -0
  47. package/dist/providers/coin-quantity.d.ts +1 -1
  48. package/dist/providers/coin-quantity.d.ts.map +1 -1
  49. package/dist/providers/index.d.ts +2 -0
  50. package/dist/providers/index.d.ts.map +1 -1
  51. package/dist/providers/memory-cache.d.ts +1 -1
  52. package/dist/providers/memory-cache.d.ts.map +1 -1
  53. package/dist/providers/message.d.ts +1 -2
  54. package/dist/providers/message.d.ts.map +1 -1
  55. package/dist/providers/provider.d.ts +14 -7
  56. package/dist/providers/provider.d.ts.map +1 -1
  57. package/dist/providers/resource.d.ts +1 -1
  58. package/dist/providers/resource.d.ts.map +1 -1
  59. package/dist/providers/transaction-request/create-transaction-request.d.ts +1 -1
  60. package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
  61. package/dist/providers/transaction-request/hash-transaction.d.ts.map +1 -1
  62. package/dist/providers/transaction-request/input.d.ts +1 -1
  63. package/dist/providers/transaction-request/input.d.ts.map +1 -1
  64. package/dist/providers/transaction-request/output.d.ts +1 -1
  65. package/dist/providers/transaction-request/output.d.ts.map +1 -1
  66. package/dist/providers/transaction-request/script-transaction-request.d.ts +1 -2
  67. package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
  68. package/dist/providers/transaction-request/storage-slot.d.ts +1 -1
  69. package/dist/providers/transaction-request/storage-slot.d.ts.map +1 -1
  70. package/dist/providers/transaction-request/transaction-request.d.ts +3 -11
  71. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  72. package/dist/providers/transaction-request/witness.d.ts +1 -1
  73. package/dist/providers/transaction-request/witness.d.ts.map +1 -1
  74. package/dist/providers/utils/gas.d.ts.map +1 -1
  75. package/dist/providers/utils/json.d.ts.map +1 -1
  76. package/dist/signer/signer.d.ts +1 -1
  77. package/dist/signer/signer.d.ts.map +1 -1
  78. package/dist/test-utils/launchNode.d.ts.map +1 -1
  79. package/dist/test-utils.global.js +3319 -3222
  80. package/dist/test-utils.global.js.map +1 -1
  81. package/dist/test-utils.js +349 -252
  82. package/dist/test-utils.js.map +1 -1
  83. package/dist/test-utils.mjs +283 -198
  84. package/dist/test-utils.mjs.map +1 -1
  85. package/dist/utils/formatTransferToContractScriptData.d.ts +1 -2
  86. package/dist/utils/formatTransferToContractScriptData.d.ts.map +1 -1
  87. package/dist/wallet/base-wallet-unlocked.d.ts +4 -4
  88. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  89. package/dist/wallet/wallet.d.ts +1 -2
  90. package/dist/wallet/wallet.d.ts.map +1 -1
  91. package/dist/wallet/wallets.d.ts +1 -1
  92. package/dist/wallet/wallets.d.ts.map +1 -1
  93. package/package.json +17 -17
  94. package/dist/connectors/fixtures/generate-accounts.d.ts +0 -2
  95. package/dist/connectors/fixtures/generate-accounts.d.ts.map +0 -1
  96. package/dist/connectors/fixtures/mocked-connector.d.ts +0 -45
  97. package/dist/connectors/fixtures/mocked-connector.d.ts.map +0 -1
  98. package/dist/connectors/fixtures/promise-callback.d.ts +0 -7
  99. package/dist/connectors/fixtures/promise-callback.d.ts.map +0 -1
  100. package/dist/connectors/fuel-wallet-locked.d.ts +0 -13
  101. package/dist/connectors/fuel-wallet-locked.d.ts.map +0 -1
  102. package/dist/connectors/fuel-wallet-provider.d.ts +0 -14
  103. package/dist/connectors/fuel-wallet-provider.d.ts.map +0 -1
  104. package/dist/connectors/types/connection.d.ts +0 -7
  105. package/dist/connectors/types/connection.d.ts.map +0 -1
  106. package/dist/connectors/types/nertwork-data.d.ts +0 -7
  107. package/dist/connectors/types/nertwork-data.d.ts.map +0 -1
  108. package/dist/connectors/utils/get-asset-by-chain.d.ts +0 -3
  109. package/dist/connectors/utils/get-asset-by-chain.d.ts.map +0 -1
@@ -58,6 +58,7 @@ module.exports = __toCommonJS(test_utils_exports);
58
58
 
59
59
  // src/wallet/base-wallet-unlocked.ts
60
60
  var import_hasher3 = require("@fuel-ts/hasher");
61
+ var import_utils30 = require("@fuel-ts/utils");
61
62
 
62
63
  // src/account.ts
63
64
  var import_address4 = require("@fuel-ts/address");
@@ -65,12 +66,12 @@ var import_configs10 = require("@fuel-ts/address/configs");
65
66
  var import_errors15 = require("@fuel-ts/errors");
66
67
  var import_interfaces = require("@fuel-ts/interfaces");
67
68
  var import_math17 = require("@fuel-ts/math");
68
- var import_ethers21 = require("ethers");
69
+ var import_utils27 = require("@fuel-ts/utils");
69
70
 
70
71
  // src/providers/coin-quantity.ts
71
72
  var import_configs = require("@fuel-ts/address/configs");
72
73
  var import_math = require("@fuel-ts/math");
73
- var import_ethers = require("ethers");
74
+ var import_utils = require("@fuel-ts/utils");
74
75
  var coinQuantityfy = (coinQuantityLike) => {
75
76
  let assetId;
76
77
  let amount;
@@ -86,7 +87,7 @@ var coinQuantityfy = (coinQuantityLike) => {
86
87
  }
87
88
  const bnAmount = (0, import_math.bn)(amount);
88
89
  return {
89
- assetId: (0, import_ethers.hexlify)(assetId),
90
+ assetId: (0, import_utils.hexlify)(assetId),
90
91
  amount: bnAmount.lt(1) ? (0, import_math.bn)(1) : bnAmount,
91
92
  max: max2 ? (0, import_math.bn)(max2) : void 0
92
93
  };
@@ -108,8 +109,10 @@ var import_address3 = require("@fuel-ts/address");
108
109
  var import_errors13 = require("@fuel-ts/errors");
109
110
  var import_math14 = require("@fuel-ts/math");
110
111
  var import_transactions17 = require("@fuel-ts/transactions");
112
+ var import_utils22 = require("@fuel-ts/utils");
111
113
  var import_versions = require("@fuel-ts/versions");
112
- var import_ethers18 = require("ethers");
114
+ var import_utils23 = require("@noble/curves/abstract/utils");
115
+ var import_ethers2 = require("ethers");
113
116
  var import_graphql_request = require("graphql-request");
114
117
  var import_ramda3 = require("ramda");
115
118
 
@@ -982,7 +985,7 @@ async function* fuelGraphQLSubscriber({
982
985
 
983
986
  // src/providers/memory-cache.ts
984
987
  var import_errors2 = require("@fuel-ts/errors");
985
- var import_ethers2 = require("ethers");
988
+ var import_utils2 = require("@fuel-ts/utils");
986
989
  var cache = {};
987
990
  var DEFAULT_TTL_IN_MS = 30 * 1e3;
988
991
  var MemoryCache = class {
@@ -997,7 +1000,7 @@ var MemoryCache = class {
997
1000
  }
998
1001
  }
999
1002
  get(value, isAutoExpiring = true) {
1000
- const key = (0, import_ethers2.hexlify)(value);
1003
+ const key = (0, import_utils2.hexlify)(value);
1001
1004
  if (cache[key]) {
1002
1005
  if (!isAutoExpiring || cache[key].expires > Date.now()) {
1003
1006
  return cache[key].value;
@@ -1008,7 +1011,7 @@ var MemoryCache = class {
1008
1011
  }
1009
1012
  set(value) {
1010
1013
  const expiresAt = Date.now() + this.ttl;
1011
- const key = (0, import_ethers2.hexlify)(value);
1014
+ const key = (0, import_utils2.hexlify)(value);
1012
1015
  cache[key] = {
1013
1016
  expires: expiresAt,
1014
1017
  value
@@ -1034,7 +1037,7 @@ var MemoryCache = class {
1034
1037
  }, []);
1035
1038
  }
1036
1039
  del(value) {
1037
- const key = (0, import_ethers2.hexlify)(value);
1040
+ const key = (0, import_utils2.hexlify)(value);
1038
1041
  delete cache[key];
1039
1042
  }
1040
1043
  };
@@ -1044,31 +1047,31 @@ var import_configs2 = require("@fuel-ts/address/configs");
1044
1047
  var import_errors3 = require("@fuel-ts/errors");
1045
1048
  var import_math2 = require("@fuel-ts/math");
1046
1049
  var import_transactions = require("@fuel-ts/transactions");
1047
- var import_ethers3 = require("ethers");
1050
+ var import_utils3 = require("@fuel-ts/utils");
1048
1051
  var inputify = (value) => {
1049
1052
  const { type } = value;
1050
1053
  switch (value.type) {
1051
1054
  case import_transactions.InputType.Coin: {
1052
- const predicate = (0, import_ethers3.getBytesCopy)(value.predicate ?? "0x");
1053
- const predicateData = (0, import_ethers3.getBytesCopy)(value.predicateData ?? "0x");
1055
+ const predicate = (0, import_utils3.arrayify)(value.predicate ?? "0x");
1056
+ const predicateData = (0, import_utils3.arrayify)(value.predicateData ?? "0x");
1054
1057
  return {
1055
1058
  type: import_transactions.InputType.Coin,
1056
- txID: (0, import_ethers3.hexlify)((0, import_ethers3.getBytesCopy)(value.id).slice(0, 32)),
1057
- outputIndex: (0, import_ethers3.getBytesCopy)(value.id)[32],
1058
- owner: (0, import_ethers3.hexlify)(value.owner),
1059
+ txID: (0, import_utils3.hexlify)((0, import_utils3.arrayify)(value.id).slice(0, 32)),
1060
+ outputIndex: (0, import_utils3.arrayify)(value.id)[32],
1061
+ owner: (0, import_utils3.hexlify)(value.owner),
1059
1062
  amount: (0, import_math2.bn)(value.amount),
1060
- assetId: (0, import_ethers3.hexlify)(value.assetId),
1063
+ assetId: (0, import_utils3.hexlify)(value.assetId),
1061
1064
  txPointer: {
1062
- blockHeight: (0, import_math2.toNumber)((0, import_ethers3.getBytesCopy)(value.txPointer).slice(0, 8)),
1063
- txIndex: (0, import_math2.toNumber)((0, import_ethers3.getBytesCopy)(value.txPointer).slice(8, 16))
1065
+ blockHeight: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(0, 8)),
1066
+ txIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(8, 16))
1064
1067
  },
1065
1068
  witnessIndex: value.witnessIndex,
1066
1069
  maturity: value.maturity ?? 0,
1067
1070
  predicateGasUsed: (0, import_math2.bn)(value.predicateGasUsed),
1068
1071
  predicateLength: predicate.length,
1069
1072
  predicateDataLength: predicateData.length,
1070
- predicate: (0, import_ethers3.hexlify)(predicate),
1071
- predicateData: (0, import_ethers3.hexlify)(predicateData)
1073
+ predicate: (0, import_utils3.hexlify)(predicate),
1074
+ predicateData: (0, import_utils3.hexlify)(predicateData)
1072
1075
  };
1073
1076
  }
1074
1077
  case import_transactions.InputType.Contract: {
@@ -1079,29 +1082,29 @@ var inputify = (value) => {
1079
1082
  balanceRoot: import_configs2.ZeroBytes32,
1080
1083
  stateRoot: import_configs2.ZeroBytes32,
1081
1084
  txPointer: {
1082
- blockHeight: (0, import_math2.toNumber)((0, import_ethers3.getBytesCopy)(value.txPointer).slice(0, 8)),
1083
- txIndex: (0, import_math2.toNumber)((0, import_ethers3.getBytesCopy)(value.txPointer).slice(8, 16))
1085
+ blockHeight: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(0, 8)),
1086
+ txIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(8, 16))
1084
1087
  },
1085
- contractID: (0, import_ethers3.hexlify)(value.contractId)
1088
+ contractID: (0, import_utils3.hexlify)(value.contractId)
1086
1089
  };
1087
1090
  }
1088
1091
  case import_transactions.InputType.Message: {
1089
- const predicate = (0, import_ethers3.getBytesCopy)(value.predicate ?? "0x");
1090
- const predicateData = (0, import_ethers3.getBytesCopy)(value.predicateData ?? "0x");
1091
- const data = (0, import_ethers3.getBytesCopy)(value.data ?? "0x");
1092
+ const predicate = (0, import_utils3.arrayify)(value.predicate ?? "0x");
1093
+ const predicateData = (0, import_utils3.arrayify)(value.predicateData ?? "0x");
1094
+ const data = (0, import_utils3.arrayify)(value.data ?? "0x");
1092
1095
  return {
1093
1096
  type: import_transactions.InputType.Message,
1094
- sender: (0, import_ethers3.hexlify)(value.sender),
1095
- recipient: (0, import_ethers3.hexlify)(value.recipient),
1097
+ sender: (0, import_utils3.hexlify)(value.sender),
1098
+ recipient: (0, import_utils3.hexlify)(value.recipient),
1096
1099
  amount: (0, import_math2.bn)(value.amount),
1097
- nonce: (0, import_ethers3.hexlify)(value.nonce),
1100
+ nonce: (0, import_utils3.hexlify)(value.nonce),
1098
1101
  witnessIndex: value.witnessIndex,
1099
1102
  predicateGasUsed: (0, import_math2.bn)(value.predicateGasUsed),
1100
1103
  predicateLength: predicate.length,
1101
1104
  predicateDataLength: predicateData.length,
1102
- predicate: (0, import_ethers3.hexlify)(predicate),
1103
- predicateData: (0, import_ethers3.hexlify)(predicateData),
1104
- data: (0, import_ethers3.hexlify)(data),
1105
+ predicate: (0, import_utils3.hexlify)(predicate),
1106
+ predicateData: (0, import_utils3.hexlify)(predicateData),
1107
+ data: (0, import_utils3.hexlify)(data),
1105
1108
  dataLength: data.length
1106
1109
  };
1107
1110
  }
@@ -1119,16 +1122,16 @@ var import_configs3 = require("@fuel-ts/address/configs");
1119
1122
  var import_errors4 = require("@fuel-ts/errors");
1120
1123
  var import_math3 = require("@fuel-ts/math");
1121
1124
  var import_transactions2 = require("@fuel-ts/transactions");
1122
- var import_ethers4 = require("ethers");
1125
+ var import_utils4 = require("@fuel-ts/utils");
1123
1126
  var outputify = (value) => {
1124
1127
  const { type } = value;
1125
1128
  switch (type) {
1126
1129
  case import_transactions2.OutputType.Coin: {
1127
1130
  return {
1128
1131
  type: import_transactions2.OutputType.Coin,
1129
- to: (0, import_ethers4.hexlify)(value.to),
1132
+ to: (0, import_utils4.hexlify)(value.to),
1130
1133
  amount: (0, import_math3.bn)(value.amount),
1131
- assetId: (0, import_ethers4.hexlify)(value.assetId)
1134
+ assetId: (0, import_utils4.hexlify)(value.assetId)
1132
1135
  };
1133
1136
  }
1134
1137
  case import_transactions2.OutputType.Contract: {
@@ -1142,9 +1145,9 @@ var outputify = (value) => {
1142
1145
  case import_transactions2.OutputType.Change: {
1143
1146
  return {
1144
1147
  type: import_transactions2.OutputType.Change,
1145
- to: (0, import_ethers4.hexlify)(value.to),
1148
+ to: (0, import_utils4.hexlify)(value.to),
1146
1149
  amount: (0, import_math3.bn)(0),
1147
- assetId: (0, import_ethers4.hexlify)(value.assetId)
1150
+ assetId: (0, import_utils4.hexlify)(value.assetId)
1148
1151
  };
1149
1152
  }
1150
1153
  case import_transactions2.OutputType.Variable: {
@@ -1158,8 +1161,8 @@ var outputify = (value) => {
1158
1161
  case import_transactions2.OutputType.ContractCreated: {
1159
1162
  return {
1160
1163
  type: import_transactions2.OutputType.ContractCreated,
1161
- contractId: (0, import_ethers4.hexlify)(value.contractId),
1162
- stateRoot: (0, import_ethers4.hexlify)(value.stateRoot)
1164
+ contractId: (0, import_utils4.hexlify)(value.contractId),
1165
+ stateRoot: (0, import_utils4.hexlify)(value.stateRoot)
1163
1166
  };
1164
1167
  }
1165
1168
  default: {
@@ -1176,7 +1179,7 @@ var import_address = require("@fuel-ts/address");
1176
1179
  var import_configs6 = require("@fuel-ts/address/configs");
1177
1180
  var import_math6 = require("@fuel-ts/math");
1178
1181
  var import_transactions5 = require("@fuel-ts/transactions");
1179
- var import_ethers9 = require("ethers");
1182
+ var import_utils9 = require("@fuel-ts/utils");
1180
1183
 
1181
1184
  // src/providers/resource.ts
1182
1185
  var isCoin = (resource) => "id" in resource;
@@ -1187,7 +1190,7 @@ var import_errors5 = require("@fuel-ts/errors");
1187
1190
  var import_math4 = require("@fuel-ts/math");
1188
1191
  var import_transactions3 = require("@fuel-ts/transactions");
1189
1192
  var import_configs5 = require("@fuel-ts/transactions/configs");
1190
- var import_ethers5 = require("ethers");
1193
+ var import_utils5 = require("@fuel-ts/utils");
1191
1194
  var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === import_transactions3.ReceiptType.Revert && receipt.val.toString("hex") === import_configs5.FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
1192
1195
  var doesReceiptHaveMissingContractId = (receipt) => receipt.type === import_transactions3.ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
1193
1196
  var getReceiptsWithMissingData = (receipts) => receipts.reduce(
@@ -1331,7 +1334,7 @@ function assembleReceiptByType(receipt) {
1331
1334
  const recipient = hexOrZero(receipt.recipient);
1332
1335
  const nonce = hexOrZero(receipt.nonce);
1333
1336
  const amount = (0, import_math4.bn)(receipt.amount);
1334
- const data = receipt.data ? (0, import_ethers5.getBytesCopy)(receipt.data) : Uint8Array.from([]);
1337
+ const data = receipt.data ? (0, import_utils5.arrayify)(receipt.data) : Uint8Array.from([]);
1335
1338
  const digest = hexOrZero(receipt.digest);
1336
1339
  const messageId = import_transactions3.ReceiptMessageOutCoder.getMessageId({
1337
1340
  sender,
@@ -1393,7 +1396,7 @@ var import_errors6 = require("@fuel-ts/errors");
1393
1396
  // src/providers/utils/gas.ts
1394
1397
  var import_math5 = require("@fuel-ts/math");
1395
1398
  var import_transactions4 = require("@fuel-ts/transactions");
1396
- var import_ethers6 = require("ethers");
1399
+ var import_utils6 = require("@fuel-ts/utils");
1397
1400
  var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => (0, import_math5.bn)(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
1398
1401
  var getGasUsedFromReceipts = (receipts) => {
1399
1402
  const scriptResult = receipts.filter(
@@ -1418,9 +1421,7 @@ function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
1418
1421
  const totalGas = inputs.reduce((total, input) => {
1419
1422
  if ("predicate" in input && input.predicate && input.predicate !== "0x") {
1420
1423
  return total.add(
1421
- resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(
1422
- resolveGasDependentCosts((0, import_ethers6.getBytesCopy)(input.predicate).length, gasCosts.contractRoot)
1423
- ).add((0, import_math5.bn)(input.predicateGasUsed))
1424
+ resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts((0, import_utils6.arrayify)(input.predicate).length, gasCosts.contractRoot)).add((0, import_math5.bn)(input.predicateGasUsed))
1424
1425
  );
1425
1426
  }
1426
1427
  if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
@@ -1469,13 +1470,13 @@ function calculateMetadataGasForTxScript({
1469
1470
  }
1470
1471
 
1471
1472
  // src/providers/utils/json.ts
1472
- var import_ethers7 = require("ethers");
1473
+ var import_utils7 = require("@fuel-ts/utils");
1473
1474
  var import_ramda = require("ramda");
1474
1475
  function normalize(object) {
1475
1476
  Object.keys(object).forEach((key) => {
1476
1477
  switch (object[key]?.constructor.name) {
1477
1478
  case "Uint8Array":
1478
- object[key] = (0, import_ethers7.hexlify)(object[key]);
1479
+ object[key] = (0, import_utils7.hexlify)(object[key]);
1479
1480
  break;
1480
1481
  case "Array":
1481
1482
  object[key] = normalize(object[key]);
@@ -1522,11 +1523,11 @@ var NoWitnessAtIndexError = class extends Error {
1522
1523
  };
1523
1524
 
1524
1525
  // src/providers/transaction-request/witness.ts
1525
- var import_ethers8 = require("ethers");
1526
+ var import_utils8 = require("@fuel-ts/utils");
1526
1527
  var witnessify = (value) => {
1527
- const data = (0, import_ethers8.getBytesCopy)(value);
1528
+ const data = (0, import_utils8.arrayify)(value);
1528
1529
  return {
1529
- data: (0, import_ethers8.hexlify)(data),
1530
+ data: (0, import_utils8.hexlify)(data),
1530
1531
  dataLength: data.length
1531
1532
  };
1532
1533
  };
@@ -1646,7 +1647,7 @@ var BaseTransactionRequest = class {
1646
1647
  * Creates an empty witness without any side effects and returns the index
1647
1648
  */
1648
1649
  createWitness() {
1649
- this.witnesses.push((0, import_ethers9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
1650
+ this.witnesses.push((0, import_utils9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
1650
1651
  return this.witnesses.length - 1;
1651
1652
  }
1652
1653
  /**
@@ -1715,9 +1716,9 @@ var BaseTransactionRequest = class {
1715
1716
  const found = this.inputs.find((input) => {
1716
1717
  switch (input.type) {
1717
1718
  case import_transactions5.InputType.Coin:
1718
- return (0, import_ethers9.hexlify)(input.owner) === ownerAddress.toB256();
1719
+ return (0, import_utils9.hexlify)(input.owner) === ownerAddress.toB256();
1719
1720
  case import_transactions5.InputType.Message:
1720
- return (0, import_ethers9.hexlify)(input.recipient) === ownerAddress.toB256();
1721
+ return (0, import_utils9.hexlify)(input.recipient) === ownerAddress.toB256();
1721
1722
  default:
1722
1723
  return false;
1723
1724
  }
@@ -1883,7 +1884,7 @@ var BaseTransactionRequest = class {
1883
1884
  */
1884
1885
  addChangeOutput(to, assetId = import_configs6.BaseAssetId) {
1885
1886
  const changeOutput = this.getChangeOutputs().find(
1886
- (output) => (0, import_ethers9.hexlify)(output.assetId) === assetId
1887
+ (output) => (0, import_utils9.hexlify)(output.assetId) === assetId
1887
1888
  );
1888
1889
  if (!changeOutput) {
1889
1890
  this.pushOutput({
@@ -1939,7 +1940,7 @@ var BaseTransactionRequest = class {
1939
1940
  *
1940
1941
  * @param quantities - CoinQuantity Array.
1941
1942
  */
1942
- fundWithFakeUtxos(quantities) {
1943
+ fundWithFakeUtxos(quantities, resourcesOwner) {
1943
1944
  let idCounter = 0;
1944
1945
  const generateId = () => {
1945
1946
  const counterString = String(idCounter++);
@@ -1963,7 +1964,7 @@ var BaseTransactionRequest = class {
1963
1964
  id: generateId(),
1964
1965
  amount: quantity,
1965
1966
  assetId,
1966
- owner: import_address.Address.fromRandom(),
1967
+ owner: resourcesOwner || import_address.Address.fromRandom(),
1967
1968
  maturity: 0,
1968
1969
  blockCreated: (0, import_math6.bn)(1),
1969
1970
  txCreatedIdx: (0, import_math6.bn)(1)
@@ -1996,19 +1997,29 @@ var BaseTransactionRequest = class {
1996
1997
  toJSON() {
1997
1998
  return normalizeJSON(this);
1998
1999
  }
1999
- /**
2000
- * @hidden
2001
- *
2002
- * Determines whether the transaction has a predicate input.
2003
- *
2004
- * @returns Whether the transaction has a predicate input.
2005
- */
2006
- hasPredicateInput() {
2007
- return Boolean(
2008
- this.inputs.find(
2009
- (input) => "predicate" in input && input.predicate && input.predicate !== (0, import_ethers9.getBytesCopy)("0x")
2010
- )
2011
- );
2000
+ updatePredicateInputs(inputs) {
2001
+ this.inputs.forEach((i) => {
2002
+ let correspondingInput;
2003
+ switch (i.type) {
2004
+ case import_transactions5.InputType.Contract:
2005
+ return;
2006
+ case import_transactions5.InputType.Coin:
2007
+ correspondingInput = inputs.find((x) => x.type === import_transactions5.InputType.Coin && x.owner === i.owner);
2008
+ break;
2009
+ case import_transactions5.InputType.Message:
2010
+ correspondingInput = inputs.find(
2011
+ (x) => x.type === import_transactions5.InputType.Message && x.sender === i.sender
2012
+ );
2013
+ break;
2014
+ default:
2015
+ break;
2016
+ }
2017
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math6.bn)(correspondingInput.predicateGasUsed).gt(0)) {
2018
+ i.predicate = correspondingInput.predicate;
2019
+ i.predicateData = correspondingInput.predicateData;
2020
+ i.predicateGasUsed = correspondingInput.predicateGasUsed;
2021
+ }
2022
+ });
2012
2023
  }
2013
2024
  };
2014
2025
 
@@ -2016,14 +2027,15 @@ var BaseTransactionRequest = class {
2016
2027
  var import_configs8 = require("@fuel-ts/address/configs");
2017
2028
  var import_math8 = require("@fuel-ts/math");
2018
2029
  var import_transactions7 = require("@fuel-ts/transactions");
2019
- var import_ethers12 = require("ethers");
2030
+ var import_utils13 = require("@fuel-ts/utils");
2020
2031
 
2021
2032
  // src/providers/transaction-request/hash-transaction.ts
2022
2033
  var import_configs7 = require("@fuel-ts/address/configs");
2023
2034
  var import_hasher = require("@fuel-ts/hasher");
2024
2035
  var import_math7 = require("@fuel-ts/math");
2025
2036
  var import_transactions6 = require("@fuel-ts/transactions");
2026
- var import_ethers10 = require("ethers");
2037
+ var import_utils11 = require("@fuel-ts/utils");
2038
+ var import_ethers = require("ethers");
2027
2039
  var import_ramda2 = require("ramda");
2028
2040
  function hashTransaction(transactionRequest, chainId) {
2029
2041
  const transaction = transactionRequest.toTransaction();
@@ -2085,15 +2097,15 @@ function hashTransaction(transactionRequest, chainId) {
2085
2097
  transaction.witnessesCount = 0;
2086
2098
  transaction.witnesses = [];
2087
2099
  const chainIdBytes = (0, import_hasher.uint64ToBytesBE)(chainId);
2088
- const concatenatedData = (0, import_ethers10.concat)([chainIdBytes, new import_transactions6.TransactionCoder().encode(transaction)]);
2089
- return (0, import_ethers10.sha256)(concatenatedData);
2100
+ const concatenatedData = (0, import_utils11.concat)([chainIdBytes, new import_transactions6.TransactionCoder().encode(transaction)]);
2101
+ return (0, import_ethers.sha256)(concatenatedData);
2090
2102
  }
2091
2103
 
2092
2104
  // src/providers/transaction-request/storage-slot.ts
2093
- var import_ethers11 = require("ethers");
2105
+ var import_utils12 = require("@fuel-ts/utils");
2094
2106
  var getStorageValue = (value) => {
2095
2107
  const v = new Uint8Array(32);
2096
- v.set((0, import_ethers11.getBytesCopy)(value));
2108
+ v.set((0, import_utils12.arrayify)(value));
2097
2109
  return v;
2098
2110
  };
2099
2111
  var storageSlotify = (storageSlot) => {
@@ -2107,8 +2119,8 @@ var storageSlotify = (storageSlot) => {
2107
2119
  value = storageSlot.value;
2108
2120
  }
2109
2121
  return {
2110
- key: (0, import_ethers11.hexlify)(key),
2111
- value: (0, import_ethers11.hexlify)(getStorageValue(value))
2122
+ key: (0, import_utils12.hexlify)(key),
2123
+ value: (0, import_utils12.hexlify)(getStorageValue(value))
2112
2124
  };
2113
2125
  };
2114
2126
 
@@ -2141,7 +2153,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2141
2153
  } = {}) {
2142
2154
  super(rest);
2143
2155
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
2144
- this.salt = (0, import_ethers12.hexlify)(salt ?? import_configs8.ZeroBytes32);
2156
+ this.salt = (0, import_utils13.hexlify)(salt ?? import_configs8.ZeroBytes32);
2145
2157
  this.storageSlots = [...storageSlots ?? []];
2146
2158
  }
2147
2159
  /**
@@ -2159,7 +2171,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2159
2171
  bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
2160
2172
  bytecodeWitnessIndex,
2161
2173
  storageSlotsCount: storageSlots.length,
2162
- salt: this.salt ? (0, import_ethers12.hexlify)(this.salt) : import_configs8.ZeroBytes32,
2174
+ salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs8.ZeroBytes32,
2163
2175
  storageSlots
2164
2176
  };
2165
2177
  }
@@ -2198,7 +2210,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2198
2210
  }
2199
2211
  metadataGas(gasCosts) {
2200
2212
  return calculateMetadataGasForTxCreate({
2201
- contractBytesSize: (0, import_math8.bn)((0, import_ethers12.getBytesCopy)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2213
+ contractBytesSize: (0, import_math8.bn)((0, import_utils13.arrayify)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2202
2214
  gasCosts,
2203
2215
  stateRootSize: this.storageSlots.length,
2204
2216
  txBytesSize: this.byteSize()
@@ -2212,17 +2224,17 @@ var import_address2 = require("@fuel-ts/address");
2212
2224
  var import_configs9 = require("@fuel-ts/address/configs");
2213
2225
  var import_math9 = require("@fuel-ts/math");
2214
2226
  var import_transactions8 = require("@fuel-ts/transactions");
2215
- var import_ethers14 = require("ethers");
2227
+ var import_utils15 = require("@fuel-ts/utils");
2216
2228
 
2217
2229
  // src/providers/transaction-request/scripts.ts
2218
- var import_ethers13 = require("ethers");
2230
+ var import_utils14 = require("@fuel-ts/utils");
2219
2231
  var returnZeroScript = {
2220
2232
  /*
2221
2233
  Opcode::RET(REG_ZERO)
2222
2234
  Opcode::NOOP
2223
2235
  */
2224
2236
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
2225
- bytes: (0, import_ethers13.getBytesCopy)("0x24000000"),
2237
+ bytes: (0, import_utils14.arrayify)("0x24000000"),
2226
2238
  encodeScriptData: () => new Uint8Array(0)
2227
2239
  };
2228
2240
  var withdrawScript = {
@@ -2236,7 +2248,7 @@ var withdrawScript = {
2236
2248
  00000000 00000000 [amount value]
2237
2249
  */
2238
2250
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
2239
- bytes: (0, import_ethers13.getBytesCopy)("0x5040C0105D44C0064C40001124000000"),
2251
+ bytes: (0, import_utils14.arrayify)("0x5040C0105D44C0064C40001124000000"),
2240
2252
  encodeScriptData: () => new Uint8Array(0)
2241
2253
  };
2242
2254
 
@@ -2264,8 +2276,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2264
2276
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2265
2277
  super(rest);
2266
2278
  this.gasLimit = (0, import_math9.bn)(gasLimit);
2267
- this.script = (0, import_ethers14.getBytesCopy)(script ?? returnZeroScript.bytes);
2268
- this.scriptData = (0, import_ethers14.getBytesCopy)(scriptData ?? returnZeroScript.encodeScriptData());
2279
+ this.script = (0, import_utils15.arrayify)(script ?? returnZeroScript.bytes);
2280
+ this.scriptData = (0, import_utils15.arrayify)(scriptData ?? returnZeroScript.encodeScriptData());
2269
2281
  }
2270
2282
  /**
2271
2283
  * Converts the transaction request to a `TransactionScript`.
@@ -2273,8 +2285,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2273
2285
  * @returns The transaction script object.
2274
2286
  */
2275
2287
  toTransaction() {
2276
- const script = (0, import_ethers14.getBytesCopy)(this.script ?? "0x");
2277
- const scriptData = (0, import_ethers14.getBytesCopy)(this.scriptData ?? "0x");
2288
+ const script = (0, import_utils15.arrayify)(this.script ?? "0x");
2289
+ const scriptData = (0, import_utils15.arrayify)(this.scriptData ?? "0x");
2278
2290
  return {
2279
2291
  type: import_transactions8.TransactionType.Script,
2280
2292
  scriptGasLimit: this.gasLimit,
@@ -2282,8 +2294,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2282
2294
  scriptLength: script.length,
2283
2295
  scriptDataLength: scriptData.length,
2284
2296
  receiptsRoot: import_configs9.ZeroBytes32,
2285
- script: (0, import_ethers14.hexlify)(script),
2286
- scriptData: (0, import_ethers14.hexlify)(scriptData)
2297
+ script: (0, import_utils15.hexlify)(script),
2298
+ scriptData: (0, import_utils15.hexlify)(scriptData)
2287
2299
  };
2288
2300
  }
2289
2301
  /**
@@ -2434,15 +2446,15 @@ var transactionRequestify = (obj) => {
2434
2446
  var import_errors12 = require("@fuel-ts/errors");
2435
2447
  var import_math13 = require("@fuel-ts/math");
2436
2448
  var import_transactions15 = require("@fuel-ts/transactions");
2437
- var import_ethers17 = require("ethers");
2449
+ var import_utils21 = require("@fuel-ts/utils");
2438
2450
 
2439
2451
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2440
- var import_ethers16 = require("ethers");
2452
+ var import_utils19 = require("@fuel-ts/utils");
2441
2453
 
2442
2454
  // src/providers/transaction-summary/calculate-transaction-fee.ts
2443
2455
  var import_math10 = require("@fuel-ts/math");
2444
2456
  var import_transactions10 = require("@fuel-ts/transactions");
2445
- var import_ethers15 = require("ethers");
2457
+ var import_utils16 = require("@fuel-ts/utils");
2446
2458
  var calculateTransactionFee = (params) => {
2447
2459
  const {
2448
2460
  gasUsed,
@@ -2451,7 +2463,7 @@ var calculateTransactionFee = (params) => {
2451
2463
  } = params;
2452
2464
  const gasPerByte = (0, import_math10.bn)(feeParams.gasPerByte);
2453
2465
  const gasPriceFactor = (0, import_math10.bn)(feeParams.gasPriceFactor);
2454
- const transactionBytes = (0, import_ethers15.getBytesCopy)(rawPayload);
2466
+ const transactionBytes = (0, import_utils16.arrayify)(rawPayload);
2455
2467
  const [transaction] = new import_transactions10.TransactionCoder().decode(transactionBytes, 0);
2456
2468
  if (transaction.type === import_transactions10.TransactionType.Mint) {
2457
2469
  return {
@@ -2466,7 +2478,7 @@ var calculateTransactionFee = (params) => {
2466
2478
  let gasLimit = (0, import_math10.bn)(0);
2467
2479
  if (type === import_transactions10.TransactionType.Create) {
2468
2480
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2469
- const contractBytesSize = (0, import_math10.bn)((0, import_ethers15.getBytesCopy)(witnesses[bytecodeWitnessIndex].data).length);
2481
+ const contractBytesSize = (0, import_math10.bn)((0, import_utils16.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
2470
2482
  metadataGas = calculateMetadataGasForTxCreate({
2471
2483
  contractBytesSize,
2472
2484
  gasCosts,
@@ -3108,7 +3120,7 @@ function assembleTransactionSummary(params) {
3108
3120
  gasCosts
3109
3121
  } = params;
3110
3122
  const gasUsed = getGasUsedFromReceipts(receipts);
3111
- const rawPayload = (0, import_ethers16.hexlify)(transactionBytes);
3123
+ const rawPayload = (0, import_utils19.hexlify)(transactionBytes);
3112
3124
  const operations = getOperations({
3113
3125
  transactionType: transaction.type,
3114
3126
  inputs: transaction.inputs || [],
@@ -3225,7 +3237,7 @@ var TransactionResponse = class {
3225
3237
  */
3226
3238
  decodeTransaction(transactionWithReceipts) {
3227
3239
  return new import_transactions15.TransactionCoder().decode(
3228
- (0, import_ethers17.getBytesCopy)(transactionWithReceipts.rawPayload),
3240
+ (0, import_utils21.arrayify)(transactionWithReceipts.rawPayload),
3229
3241
  0
3230
3242
  )?.[0];
3231
3243
  }
@@ -3251,7 +3263,7 @@ var TransactionResponse = class {
3251
3263
  id: this.id,
3252
3264
  receipts,
3253
3265
  transaction: decodedTransaction,
3254
- transactionBytes: (0, import_ethers17.getBytesCopy)(transaction.rawPayload),
3266
+ transactionBytes: (0, import_utils21.arrayify)(transaction.rawPayload),
3255
3267
  gqlTransactionStatus: transaction.status,
3256
3268
  gasPerByte,
3257
3269
  gasPriceFactor,
@@ -3575,7 +3587,7 @@ var _Provider = class {
3575
3587
  name,
3576
3588
  consensusParameters: { chainId }
3577
3589
  } = await this.getChain();
3578
- const network = new import_ethers18.Network(name, chainId.toNumber());
3590
+ const network = new import_ethers2.Network(name, chainId.toNumber());
3579
3591
  return Promise.resolve(network);
3580
3592
  }
3581
3593
  /**
@@ -3643,7 +3655,7 @@ var _Provider = class {
3643
3655
  if (estimateTxDependencies) {
3644
3656
  await this.estimateTxDependencies(transactionRequest);
3645
3657
  }
3646
- const encodedTransaction = (0, import_ethers18.hexlify)(transactionRequest.toTransactionBytes());
3658
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3647
3659
  if (awaitExecution) {
3648
3660
  const subscription = this.operations.submitAndAwait({ encodedTransaction });
3649
3661
  for await (const { submitAndAwait } of subscription) {
@@ -3674,9 +3686,9 @@ var _Provider = class {
3674
3686
  async call(transactionRequestLike, { utxoValidation, estimateTxDependencies = true } = {}) {
3675
3687
  const transactionRequest = transactionRequestify(transactionRequestLike);
3676
3688
  if (estimateTxDependencies) {
3677
- await this.estimateTxDependencies(transactionRequest);
3689
+ return this.estimateTxDependencies(transactionRequest);
3678
3690
  }
3679
- const encodedTransaction = (0, import_ethers18.hexlify)(transactionRequest.toTransactionBytes());
3691
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3680
3692
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
3681
3693
  encodedTransaction,
3682
3694
  utxoValidation: utxoValidation || false
@@ -3693,7 +3705,15 @@ var _Provider = class {
3693
3705
  * @returns A promise that resolves to the estimated transaction request object.
3694
3706
  */
3695
3707
  async estimatePredicates(transactionRequest) {
3696
- const encodedTransaction = (0, import_ethers18.hexlify)(transactionRequest.toTransactionBytes());
3708
+ const shouldEstimatePredicates = Boolean(
3709
+ transactionRequest.inputs.find(
3710
+ (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()
3711
+ )
3712
+ );
3713
+ if (!shouldEstimatePredicates) {
3714
+ return transactionRequest;
3715
+ }
3716
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3697
3717
  const response = await this.operations.estimatePredicates({
3698
3718
  encodedTransaction
3699
3719
  });
@@ -3723,34 +3743,33 @@ var _Provider = class {
3723
3743
  * @returns A promise.
3724
3744
  */
3725
3745
  async estimateTxDependencies(transactionRequest) {
3726
- let missingOutputVariableCount = 0;
3727
- let missingOutputContractIdsCount = 0;
3728
- let tries = 0;
3729
3746
  if (transactionRequest.type === import_transactions17.TransactionType.Create) {
3730
- return;
3731
- }
3732
- let txRequest = transactionRequest;
3733
- if (txRequest.hasPredicateInput()) {
3734
- txRequest = await this.estimatePredicates(txRequest);
3747
+ return {
3748
+ receipts: []
3749
+ };
3735
3750
  }
3736
- while (tries < MAX_RETRIES) {
3751
+ await this.estimatePredicates(transactionRequest);
3752
+ let receipts = [];
3753
+ for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
3737
3754
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
3738
- encodedTransaction: (0, import_ethers18.hexlify)(txRequest.toTransactionBytes()),
3755
+ encodedTransaction: (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes()),
3739
3756
  utxoValidation: false
3740
3757
  });
3741
- const receipts = gqlReceipts.map(processGqlReceipt);
3758
+ receipts = gqlReceipts.map(processGqlReceipt);
3742
3759
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
3743
- missingOutputVariableCount = missingOutputVariables.length;
3744
- missingOutputContractIdsCount = missingOutputContractIds.length;
3745
- if (missingOutputVariableCount === 0 && missingOutputContractIdsCount === 0) {
3746
- return;
3760
+ const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
3761
+ if (hasMissingOutputs) {
3762
+ transactionRequest.addVariableOutputs(missingOutputVariables.length);
3763
+ missingOutputContractIds.forEach(({ contractId }) => {
3764
+ transactionRequest.addContractInputAndOutput(import_address3.Address.fromString(contractId));
3765
+ });
3766
+ } else {
3767
+ break;
3747
3768
  }
3748
- txRequest.addVariableOutputs(missingOutputVariableCount);
3749
- missingOutputContractIds.forEach(
3750
- ({ contractId }) => txRequest.addContractInputAndOutput(import_address3.Address.fromString(contractId))
3751
- );
3752
- tries += 1;
3753
3769
  }
3770
+ return {
3771
+ receipts
3772
+ };
3754
3773
  }
3755
3774
  /**
3756
3775
  * Executes a signed transaction without applying the states changes
@@ -3765,9 +3784,9 @@ var _Provider = class {
3765
3784
  async simulate(transactionRequestLike, { estimateTxDependencies = true } = {}) {
3766
3785
  const transactionRequest = transactionRequestify(transactionRequestLike);
3767
3786
  if (estimateTxDependencies) {
3768
- await this.estimateTxDependencies(transactionRequest);
3787
+ return this.estimateTxDependencies(transactionRequest);
3769
3788
  }
3770
- const encodedTransaction = (0, import_ethers18.hexlify)(transactionRequest.toTransactionBytes());
3789
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3771
3790
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
3772
3791
  encodedTransaction,
3773
3792
  utxoValidation: true
@@ -3792,36 +3811,38 @@ var _Provider = class {
3792
3811
  * @param tolerance - The tolerance to add on top of the gasUsed.
3793
3812
  * @returns A promise that resolves to the transaction cost object.
3794
3813
  */
3795
- async getTransactionCost(transactionRequestLike, forwardingQuantities = [], { estimateTxDependencies = true, estimatePredicates = true } = {}) {
3796
- const transactionRequest = transactionRequestify((0, import_ramda3.clone)(transactionRequestLike));
3814
+ async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
3815
+ estimateTxDependencies = true,
3816
+ estimatePredicates = true,
3817
+ resourcesOwner
3818
+ } = {}) {
3819
+ const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
3797
3820
  const chainInfo = this.getChain();
3798
3821
  const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
3799
- const gasPrice = (0, import_math14.max)(transactionRequest.gasPrice, minGasPrice);
3800
- const isScriptTransaction = transactionRequest.type === import_transactions17.TransactionType.Script;
3801
- if (transactionRequest.hasPredicateInput() && estimatePredicates) {
3822
+ const gasPrice = (0, import_math14.max)(txRequestClone.gasPrice, minGasPrice);
3823
+ const isScriptTransaction = txRequestClone.type === import_transactions17.TransactionType.Script;
3824
+ const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
3825
+ const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
3826
+ txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
3827
+ if (estimatePredicates) {
3802
3828
  if (isScriptTransaction) {
3803
- transactionRequest.gasLimit = (0, import_math14.bn)(0);
3829
+ txRequestClone.gasLimit = (0, import_math14.bn)(0);
3830
+ }
3831
+ if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
3832
+ resourcesOwner.populateTransactionPredicateData(txRequestClone);
3804
3833
  }
3805
- await this.estimatePredicates(transactionRequest);
3834
+ await this.estimatePredicates(txRequestClone);
3806
3835
  }
3807
- const minGas = transactionRequest.calculateMinGas(chainInfo);
3808
- const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
3809
- const coinOutputsQuantities = transactionRequest.getCoinOutputsQuantities();
3810
- const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
3811
- transactionRequest.fundWithFakeUtxos(allQuantities);
3812
- let gasUsed = minGas;
3836
+ const minGas = txRequestClone.calculateMinGas(chainInfo);
3837
+ const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
3813
3838
  let receipts = [];
3814
- if (isScriptTransaction) {
3815
- transactionRequest.gasPrice = (0, import_math14.bn)(0);
3816
- transactionRequest.gasLimit = (0, import_math14.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3817
- const result = await this.call(transactionRequest, {
3818
- estimateTxDependencies
3819
- });
3839
+ if (isScriptTransaction && estimateTxDependencies) {
3840
+ txRequestClone.gasPrice = (0, import_math14.bn)(0);
3841
+ txRequestClone.gasLimit = (0, import_math14.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3842
+ const result = await this.estimateTxDependencies(txRequestClone);
3820
3843
  receipts = result.receipts;
3821
- gasUsed = getGasUsedFromReceipts(receipts);
3822
- } else {
3823
- gasUsed = minGas;
3824
3844
  }
3845
+ const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
3825
3846
  const usedFee = calculatePriceWithFactor(
3826
3847
  gasUsed,
3827
3848
  gasPrice,
@@ -3839,7 +3860,9 @@ var _Provider = class {
3839
3860
  maxGas,
3840
3861
  usedFee,
3841
3862
  minFee,
3842
- maxFee
3863
+ maxFee,
3864
+ estimatedInputs: txRequestClone.inputs,
3865
+ estimatedOutputs: txRequestClone.outputs
3843
3866
  };
3844
3867
  }
3845
3868
  async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
@@ -3868,7 +3891,7 @@ var _Provider = class {
3868
3891
  const result = await this.operations.getCoins({
3869
3892
  first: 10,
3870
3893
  ...paginationArgs,
3871
- filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_ethers18.hexlify)(assetId) }
3894
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils22.hexlify)(assetId) }
3872
3895
  });
3873
3896
  const coins = result.coins.edges.map((edge) => edge.node);
3874
3897
  return coins.map((coin) => ({
@@ -3892,19 +3915,19 @@ var _Provider = class {
3892
3915
  async getResourcesToSpend(owner, quantities, excludedIds) {
3893
3916
  const ownerAddress = import_address3.Address.fromAddressOrString(owner);
3894
3917
  const excludeInput = {
3895
- messages: excludedIds?.messages?.map((nonce) => (0, import_ethers18.hexlify)(nonce)) || [],
3896
- utxos: excludedIds?.utxos?.map((id) => (0, import_ethers18.hexlify)(id)) || []
3918
+ messages: excludedIds?.messages?.map((nonce) => (0, import_utils22.hexlify)(nonce)) || [],
3919
+ utxos: excludedIds?.utxos?.map((id) => (0, import_utils22.hexlify)(id)) || []
3897
3920
  };
3898
3921
  if (this.cache) {
3899
3922
  const uniqueUtxos = new Set(
3900
- excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_ethers18.hexlify)(id)))
3923
+ excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils22.hexlify)(id)))
3901
3924
  );
3902
3925
  excludeInput.utxos = Array.from(uniqueUtxos);
3903
3926
  }
3904
3927
  const coinsQuery = {
3905
3928
  owner: ownerAddress.toB256(),
3906
3929
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
3907
- assetId: (0, import_ethers18.hexlify)(assetId),
3930
+ assetId: (0, import_utils22.hexlify)(assetId),
3908
3931
  amount: amount.toString(10),
3909
3932
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
3910
3933
  })),
@@ -4007,7 +4030,7 @@ var _Provider = class {
4007
4030
  time: block.header.time,
4008
4031
  transactionIds: block.transactions.map((tx) => tx.id),
4009
4032
  transactions: block.transactions.map(
4010
- (tx) => new import_transactions17.TransactionCoder().decode((0, import_ethers18.getBytesCopy)(tx.rawPayload), 0)?.[0]
4033
+ (tx) => new import_transactions17.TransactionCoder().decode((0, import_utils22.arrayify)(tx.rawPayload), 0)?.[0]
4011
4034
  )
4012
4035
  };
4013
4036
  }
@@ -4023,7 +4046,7 @@ var _Provider = class {
4023
4046
  return null;
4024
4047
  }
4025
4048
  return new import_transactions17.TransactionCoder().decode(
4026
- (0, import_ethers18.getBytesCopy)(transaction.rawPayload),
4049
+ (0, import_utils22.arrayify)(transaction.rawPayload),
4027
4050
  0
4028
4051
  )?.[0];
4029
4052
  }
@@ -4050,7 +4073,7 @@ var _Provider = class {
4050
4073
  async getContractBalance(contractId, assetId) {
4051
4074
  const { contractBalance } = await this.operations.getContractBalance({
4052
4075
  contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
4053
- asset: (0, import_ethers18.hexlify)(assetId)
4076
+ asset: (0, import_utils22.hexlify)(assetId)
4054
4077
  });
4055
4078
  return (0, import_math14.bn)(contractBalance.amount, 10);
4056
4079
  }
@@ -4064,7 +4087,7 @@ var _Provider = class {
4064
4087
  async getBalance(owner, assetId) {
4065
4088
  const { balance } = await this.operations.getBalance({
4066
4089
  owner: import_address3.Address.fromAddressOrString(owner).toB256(),
4067
- assetId: (0, import_ethers18.hexlify)(assetId)
4090
+ assetId: (0, import_utils22.hexlify)(assetId)
4068
4091
  });
4069
4092
  return (0, import_math14.bn)(balance.amount, 10);
4070
4093
  }
@@ -4229,6 +4252,10 @@ var _Provider = class {
4229
4252
  });
4230
4253
  return (0, import_math14.bn)(latestBlockHeight);
4231
4254
  }
4255
+ // eslint-disable-next-line @typescript-eslint/require-await
4256
+ async getTransactionResponse(transactionId) {
4257
+ return new TransactionResponse(transactionId, this);
4258
+ }
4232
4259
  };
4233
4260
  var Provider = _Provider;
4234
4261
  _cacheInputs = new WeakSet();
@@ -4249,21 +4276,66 @@ __publicField(Provider, "nodeInfoCache", {});
4249
4276
  var import_errors14 = require("@fuel-ts/errors");
4250
4277
  var import_math15 = require("@fuel-ts/math");
4251
4278
  var import_transactions18 = require("@fuel-ts/transactions");
4252
- var import_ethers19 = require("ethers");
4279
+ var import_utils25 = require("@fuel-ts/utils");
4280
+
4281
+ // src/providers/chains.ts
4282
+ var CHAIN_IDS = {
4283
+ eth: {
4284
+ sepolia: 11155111,
4285
+ foundry: 31337
4286
+ },
4287
+ fuel: {
4288
+ beta5: 0,
4289
+ devnet: 10
4290
+ }
4291
+ };
4292
+
4293
+ // src/providers/assets/index.ts
4294
+ var assets = [
4295
+ {
4296
+ name: "Ethereum",
4297
+ symbol: "ETH",
4298
+ icon: "eth.svg",
4299
+ networks: [
4300
+ {
4301
+ type: "ethereum",
4302
+ chainId: CHAIN_IDS.eth.sepolia,
4303
+ decimals: 18
4304
+ },
4305
+ {
4306
+ type: "ethereum",
4307
+ chainId: CHAIN_IDS.eth.foundry,
4308
+ decimals: 18
4309
+ },
4310
+ {
4311
+ type: "fuel",
4312
+ chainId: CHAIN_IDS.fuel.beta5,
4313
+ decimals: 9,
4314
+ assetId: "0x0000000000000000000000000000000000000000000000000000000000000000"
4315
+ },
4316
+ {
4317
+ type: "fuel",
4318
+ chainId: CHAIN_IDS.fuel.devnet,
4319
+ decimals: 9,
4320
+ assetId: "0x0000000000000000000000000000000000000000000000000000000000000000"
4321
+ }
4322
+ ]
4323
+ }
4324
+ ];
4253
4325
 
4254
4326
  // src/utils/formatTransferToContractScriptData.ts
4255
4327
  var import_abi_coder4 = require("@fuel-ts/abi-coder");
4256
4328
  var import_math16 = require("@fuel-ts/math");
4329
+ var import_utils26 = require("@fuel-ts/utils");
4257
4330
  var asm = __toESM(require("@fuels/vm-asm"));
4258
- var import_ethers20 = require("ethers");
4259
4331
  var formatTransferToContractScriptData = (params) => {
4260
4332
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
4261
4333
  const numberCoder = new import_abi_coder4.U64Coder();
4262
4334
  const encoded = numberCoder.encode(new import_math16.BN(amountToTransfer).toNumber());
4263
4335
  const scriptData = Uint8Array.from([
4264
- ...(0, import_ethers20.getBytesCopy)(hexlifiedContractId),
4336
+ ...(0, import_utils26.arrayify)(hexlifiedContractId),
4265
4337
  ...encoded,
4266
- ...(0, import_ethers20.getBytesCopy)(assetId)
4338
+ ...(0, import_utils26.arrayify)(assetId)
4267
4339
  ]);
4268
4340
  return scriptData;
4269
4341
  };
@@ -4297,15 +4369,17 @@ var Account = class extends import_interfaces.AbstractAccount {
4297
4369
  * The provider used to interact with the network.
4298
4370
  */
4299
4371
  _provider;
4372
+ _connector;
4300
4373
  /**
4301
4374
  * Creates a new Account instance.
4302
4375
  *
4303
4376
  * @param address - The address of the account.
4304
4377
  * @param provider - A Provider instance (optional).
4305
4378
  */
4306
- constructor(address, provider) {
4379
+ constructor(address, provider, connector) {
4307
4380
  super();
4308
4381
  this._provider = provider;
4382
+ this._connector = connector;
4309
4383
  this.address = import_address4.Address.fromDynamicInput(address);
4310
4384
  }
4311
4385
  /**
@@ -4511,7 +4585,10 @@ var Account = class extends import_interfaces.AbstractAccount {
4511
4585
  const params = { gasPrice: minGasPrice, ...txParams };
4512
4586
  const request = new ScriptTransactionRequest(params);
4513
4587
  request.addCoinOutput(import_address4.Address.fromAddressOrString(destination), amount, assetId);
4514
- const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(request);
4588
+ const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
4589
+ estimateTxDependencies: true,
4590
+ resourcesOwner: this
4591
+ });
4515
4592
  request.gasPrice = (0, import_math17.bn)(txParams.gasPrice ?? minGasPrice);
4516
4593
  request.gasLimit = (0, import_math17.bn)(txParams.gasLimit ?? gasUsed);
4517
4594
  this.validateGas({
@@ -4521,6 +4598,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4521
4598
  minGasPrice
4522
4599
  });
4523
4600
  await this.fund(request, requiredQuantities, maxFee);
4601
+ request.updatePredicateInputs(estimatedInputs);
4524
4602
  return request;
4525
4603
  }
4526
4604
  /**
@@ -4534,7 +4612,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4534
4612
  */
4535
4613
  async transfer(destination, amount, assetId = import_configs10.BaseAssetId, txParams = {}) {
4536
4614
  const request = await this.createTransfer(destination, amount, assetId, txParams);
4537
- return this.sendTransaction(request);
4615
+ return this.sendTransaction(request, { estimateTxDependencies: false });
4538
4616
  }
4539
4617
  /**
4540
4618
  * Transfers coins to a contract address.
@@ -4585,14 +4663,14 @@ var Account = class extends import_interfaces.AbstractAccount {
4585
4663
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
4586
4664
  const { minGasPrice } = this.provider.getGasConfig();
4587
4665
  const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
4588
- const recipientDataArray = (0, import_ethers21.getBytesCopy)(
4666
+ const recipientDataArray = (0, import_utils27.arrayify)(
4589
4667
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
4590
4668
  );
4591
- const amountDataArray = (0, import_ethers21.getBytesCopy)(
4669
+ const amountDataArray = (0, import_utils27.arrayify)(
4592
4670
  "0x".concat((0, import_math17.bn)(amount).toHex().substring(2).padStart(16, "0"))
4593
4671
  );
4594
4672
  const script = new Uint8Array([
4595
- ...(0, import_ethers21.getBytesCopy)(withdrawScript.bytes),
4673
+ ...(0, import_utils27.arrayify)(withdrawScript.bytes),
4596
4674
  ...recipientDataArray,
4597
4675
  ...amountDataArray
4598
4676
  ]);
@@ -4613,17 +4691,30 @@ var Account = class extends import_interfaces.AbstractAccount {
4613
4691
  await this.fund(request, requiredQuantities, maxFee);
4614
4692
  return this.sendTransaction(request);
4615
4693
  }
4694
+ async signMessage(message) {
4695
+ if (!this._connector) {
4696
+ throw new import_errors15.FuelError(import_errors15.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
4697
+ }
4698
+ return this._connector.signMessage(this.address.toString(), message);
4699
+ }
4616
4700
  /**
4617
4701
  * Sends a transaction to the network.
4618
4702
  *
4619
4703
  * @param transactionRequestLike - The transaction request to be sent.
4620
4704
  * @returns A promise that resolves to the transaction response.
4621
4705
  */
4622
- async sendTransaction(transactionRequestLike, options) {
4706
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
4707
+ if (this._connector) {
4708
+ return this.provider.getTransactionResponse(
4709
+ await this._connector.sendTransaction(this.address.toString(), transactionRequestLike)
4710
+ );
4711
+ }
4623
4712
  const transactionRequest = transactionRequestify(transactionRequestLike);
4624
- await this.provider.estimateTxDependencies(transactionRequest);
4713
+ if (estimateTxDependencies) {
4714
+ await this.provider.estimateTxDependencies(transactionRequest);
4715
+ }
4625
4716
  return this.provider.sendTransaction(transactionRequest, {
4626
- ...options,
4717
+ awaitExecution,
4627
4718
  estimateTxDependencies: false
4628
4719
  });
4629
4720
  }
@@ -4633,9 +4724,11 @@ var Account = class extends import_interfaces.AbstractAccount {
4633
4724
  * @param transactionRequestLike - The transaction request to be simulated.
4634
4725
  * @returns A promise that resolves to the call result.
4635
4726
  */
4636
- async simulateTransaction(transactionRequestLike) {
4727
+ async simulateTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
4637
4728
  const transactionRequest = transactionRequestify(transactionRequestLike);
4638
- await this.provider.estimateTxDependencies(transactionRequest);
4729
+ if (estimateTxDependencies) {
4730
+ await this.provider.estimateTxDependencies(transactionRequest);
4731
+ }
4639
4732
  return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
4640
4733
  }
4641
4734
  validateGas({
@@ -4664,8 +4757,8 @@ var import_address5 = require("@fuel-ts/address");
4664
4757
  var import_crypto = require("@fuel-ts/crypto");
4665
4758
  var import_hasher2 = require("@fuel-ts/hasher");
4666
4759
  var import_math18 = require("@fuel-ts/math");
4760
+ var import_utils28 = require("@fuel-ts/utils");
4667
4761
  var import_secp256k1 = require("@noble/curves/secp256k1");
4668
- var import_ethers22 = require("ethers");
4669
4762
  var Signer = class {
4670
4763
  address;
4671
4764
  publicKey;
@@ -4684,9 +4777,9 @@ var Signer = class {
4684
4777
  }
4685
4778
  }
4686
4779
  const privateKeyBytes = (0, import_math18.toBytes)(privateKey, 32);
4687
- this.privateKey = (0, import_ethers22.hexlify)(privateKeyBytes);
4688
- this.publicKey = (0, import_ethers22.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
4689
- this.compressedPublicKey = (0, import_ethers22.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
4780
+ this.privateKey = (0, import_utils28.hexlify)(privateKeyBytes);
4781
+ this.publicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
4782
+ this.compressedPublicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
4690
4783
  this.address = import_address5.Address.fromPublicKey(this.publicKey);
4691
4784
  }
4692
4785
  /**
@@ -4700,11 +4793,11 @@ var Signer = class {
4700
4793
  * @returns hashed signature
4701
4794
  */
4702
4795
  sign(data) {
4703
- const signature = import_secp256k1.secp256k1.sign((0, import_ethers22.getBytesCopy)(data), (0, import_ethers22.getBytesCopy)(this.privateKey));
4796
+ const signature = import_secp256k1.secp256k1.sign((0, import_utils28.arrayify)(data), (0, import_utils28.arrayify)(this.privateKey));
4704
4797
  const r = (0, import_math18.toBytes)(`0x${signature.r.toString(16)}`, 32);
4705
4798
  const s = (0, import_math18.toBytes)(`0x${signature.s.toString(16)}`, 32);
4706
4799
  s[0] |= (signature.recovery || 0) << 7;
4707
- return (0, import_ethers22.concat)([r, s]);
4800
+ return (0, import_utils28.hexlify)((0, import_utils28.concat)([r, s]));
4708
4801
  }
4709
4802
  /**
4710
4803
  * Add point on the current elliptic curve
@@ -4713,8 +4806,8 @@ var Signer = class {
4713
4806
  * @returns compressed point on the curve
4714
4807
  */
4715
4808
  addPoint(point) {
4716
- const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_ethers22.getBytesCopy)(this.compressedPublicKey));
4717
- const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_ethers22.getBytesCopy)(point));
4809
+ const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(this.compressedPublicKey));
4810
+ const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(point));
4718
4811
  const result = p0.add(p1);
4719
4812
  return `0x${result.toHex(true)}`;
4720
4813
  }
@@ -4726,16 +4819,16 @@ var Signer = class {
4726
4819
  * @returns public key from signature from the
4727
4820
  */
4728
4821
  static recoverPublicKey(data, signature) {
4729
- const signedMessageBytes = (0, import_ethers22.getBytesCopy)(signature);
4822
+ const signedMessageBytes = (0, import_utils28.arrayify)(signature);
4730
4823
  const r = signedMessageBytes.slice(0, 32);
4731
4824
  const s = signedMessageBytes.slice(32, 64);
4732
4825
  const recoveryParam = (s[0] & 128) >> 7;
4733
4826
  s[0] &= 127;
4734
- const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_ethers22.hexlify)(r)), BigInt((0, import_ethers22.hexlify)(s))).addRecoveryBit(
4827
+ const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils28.hexlify)(r)), BigInt((0, import_utils28.hexlify)(s))).addRecoveryBit(
4735
4828
  recoveryParam
4736
4829
  );
4737
- const publicKey = sig.recoverPublicKey((0, import_ethers22.getBytesCopy)(data)).toRawBytes(false).slice(1);
4738
- return (0, import_ethers22.hexlify)(publicKey);
4830
+ const publicKey = sig.recoverPublicKey((0, import_utils28.arrayify)(data)).toRawBytes(false).slice(1);
4831
+ return (0, import_utils28.hexlify)(publicKey);
4739
4832
  }
4740
4833
  /**
4741
4834
  * Recover the address from a signature performed with [`sign`](#sign).
@@ -4754,7 +4847,7 @@ var Signer = class {
4754
4847
  * @returns random 32-byte hashed
4755
4848
  */
4756
4849
  static generatePrivateKey(entropy) {
4757
- 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);
4850
+ 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);
4758
4851
  }
4759
4852
  /**
4760
4853
  * Extended publicKey from a compact publicKey
@@ -4763,8 +4856,8 @@ var Signer = class {
4763
4856
  * @returns extended publicKey
4764
4857
  */
4765
4858
  static extendPublicKey(publicKey) {
4766
- const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_ethers22.getBytesCopy)(publicKey));
4767
- return (0, import_ethers22.hexlify)(point.toRawBytes(false).slice(1));
4859
+ const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(publicKey));
4860
+ return (0, import_utils28.hexlify)(point.toRawBytes(false).slice(1));
4768
4861
  }
4769
4862
  };
4770
4863
 
@@ -4772,7 +4865,7 @@ var Signer = class {
4772
4865
  var import_address6 = require("@fuel-ts/address");
4773
4866
  var import_crypto2 = require("@fuel-ts/crypto");
4774
4867
  var import_errors16 = require("@fuel-ts/errors");
4775
- var import_ethers23 = require("ethers");
4868
+ var import_utils29 = require("@fuel-ts/utils");
4776
4869
  var import_uuid = require("uuid");
4777
4870
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
4778
4871
  var DEFAULT_KDF_PARAMS_R = 8;
@@ -4855,7 +4948,7 @@ async function decryptKeystoreWallet(jsonWallet, password) {
4855
4948
  );
4856
4949
  }
4857
4950
  const buffer = await (0, import_crypto2.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
4858
- const privateKey = (0, import_ethers23.hexlify)(buffer);
4951
+ const privateKey = (0, import_utils29.hexlify)(buffer);
4859
4952
  return privateKey;
4860
4953
  }
4861
4954
 
@@ -4900,7 +4993,7 @@ var BaseWalletUnlocked = class extends Account {
4900
4993
  */
4901
4994
  async signMessage(message) {
4902
4995
  const signedMessage = await this.signer().sign((0, import_hasher3.hashMessage)(message));
4903
- return signedMessage;
4996
+ return (0, import_utils30.hexlify)(signedMessage);
4904
4997
  }
4905
4998
  /**
4906
4999
  * Signs a transaction with the wallet's private key.
@@ -4913,7 +5006,7 @@ var BaseWalletUnlocked = class extends Account {
4913
5006
  const chainId = this.provider.getChain().consensusParameters.chainId.toNumber();
4914
5007
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
4915
5008
  const signature = await this.signer().sign(hashedTransaction);
4916
- return signature;
5009
+ return (0, import_utils30.hexlify)(signature);
4917
5010
  }
4918
5011
  /**
4919
5012
  * Populates a transaction with the witnesses signature.
@@ -4933,12 +5026,14 @@ var BaseWalletUnlocked = class extends Account {
4933
5026
  * @param transactionRequestLike - The transaction request to send.
4934
5027
  * @returns A promise that resolves to the TransactionResponse object.
4935
5028
  */
4936
- async sendTransaction(transactionRequestLike, options) {
5029
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
4937
5030
  const transactionRequest = transactionRequestify(transactionRequestLike);
4938
- await this.provider.estimateTxDependencies(transactionRequest);
5031
+ if (estimateTxDependencies) {
5032
+ await this.provider.estimateTxDependencies(transactionRequest);
5033
+ }
4939
5034
  return this.provider.sendTransaction(
4940
5035
  await this.populateTransactionWitnessesSignature(transactionRequest),
4941
- { ...options, estimateTxDependencies: false }
5036
+ { awaitExecution, estimateTxDependencies: false }
4942
5037
  );
4943
5038
  }
4944
5039
  /**
@@ -4947,9 +5042,11 @@ var BaseWalletUnlocked = class extends Account {
4947
5042
  * @param transactionRequestLike - The transaction request to simulate.
4948
5043
  * @returns A promise that resolves to the CallResult object.
4949
5044
  */
4950
- async simulateTransaction(transactionRequestLike) {
5045
+ async simulateTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
4951
5046
  const transactionRequest = transactionRequestify(transactionRequestLike);
4952
- await this.provider.estimateTxDependencies(transactionRequest);
5047
+ if (estimateTxDependencies) {
5048
+ await this.provider.estimateTxDependencies(transactionRequest);
5049
+ }
4953
5050
  return this.provider.call(
4954
5051
  await this.populateTransactionWitnessesSignature(transactionRequest),
4955
5052
  {
@@ -4970,12 +5067,14 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
4970
5067
  // src/hdwallet/hdwallet.ts
4971
5068
  var import_errors19 = require("@fuel-ts/errors");
4972
5069
  var import_math19 = require("@fuel-ts/math");
4973
- var import_ethers26 = require("ethers");
5070
+ var import_utils34 = require("@fuel-ts/utils");
5071
+ var import_ethers5 = require("ethers");
4974
5072
 
4975
5073
  // src/mnemonic/mnemonic.ts
4976
5074
  var import_crypto3 = require("@fuel-ts/crypto");
4977
5075
  var import_errors18 = require("@fuel-ts/errors");
4978
- var import_ethers25 = require("ethers");
5076
+ var import_utils32 = require("@fuel-ts/utils");
5077
+ var import_ethers4 = require("ethers");
4979
5078
 
4980
5079
  // src/wordlists/words/english.ts
4981
5080
  var english = [
@@ -7031,7 +7130,8 @@ var english = [
7031
7130
 
7032
7131
  // src/mnemonic/utils.ts
7033
7132
  var import_errors17 = require("@fuel-ts/errors");
7034
- var import_ethers24 = require("ethers");
7133
+ var import_utils31 = require("@fuel-ts/utils");
7134
+ var import_ethers3 = require("ethers");
7035
7135
  function toUtf8Bytes(stri) {
7036
7136
  const str = stri.normalize("NFKD");
7037
7137
  const result = [];
@@ -7098,14 +7198,14 @@ function entropyToMnemonicIndices(entropy) {
7098
7198
  }
7099
7199
  }
7100
7200
  const checksumBits = entropy.length / 4;
7101
- const checksum = (0, import_ethers24.getBytesCopy)((0, import_ethers24.sha256)(entropy))[0] & getUpperMask(checksumBits);
7201
+ const checksum = (0, import_utils31.arrayify)((0, import_ethers3.sha256)(entropy))[0] & getUpperMask(checksumBits);
7102
7202
  indices[indices.length - 1] <<= checksumBits;
7103
7203
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
7104
7204
  return indices;
7105
7205
  }
7106
7206
  function mnemonicWordsToEntropy(words, wordlist) {
7107
7207
  const size = Math.ceil(11 * words.length / 8);
7108
- const entropy = (0, import_ethers24.getBytesCopy)(new Uint8Array(size));
7208
+ const entropy = (0, import_utils31.arrayify)(new Uint8Array(size));
7109
7209
  let offset = 0;
7110
7210
  for (let i = 0; i < words.length; i += 1) {
7111
7211
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
@@ -7125,7 +7225,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
7125
7225
  const entropyBits = 32 * words.length / 3;
7126
7226
  const checksumBits = words.length / 3;
7127
7227
  const checksumMask = getUpperMask(checksumBits);
7128
- const checksum = (0, import_ethers24.getBytesCopy)((0, import_ethers24.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7228
+ const checksum = (0, import_utils31.arrayify)((0, import_ethers3.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7129
7229
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
7130
7230
  throw new import_errors17.FuelError(
7131
7231
  import_errors17.ErrorCode.INVALID_CHECKSUM,
@@ -7200,7 +7300,7 @@ var Mnemonic = class {
7200
7300
  static mnemonicToEntropy(phrase, wordlist = english) {
7201
7301
  const words = getWords(phrase);
7202
7302
  assertMnemonic(words);
7203
- return (0, import_ethers25.hexlify)(mnemonicWordsToEntropy(words, wordlist));
7303
+ return (0, import_utils32.hexlify)(mnemonicWordsToEntropy(words, wordlist));
7204
7304
  }
7205
7305
  /**
7206
7306
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -7208,7 +7308,7 @@ var Mnemonic = class {
7208
7308
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7209
7309
  */
7210
7310
  static entropyToMnemonic(entropy, wordlist = english) {
7211
- const entropyBytes = (0, import_ethers25.getBytesCopy)(entropy);
7311
+ const entropyBytes = (0, import_utils32.arrayify)(entropy);
7212
7312
  assertWordList(wordlist);
7213
7313
  assertEntropy(entropyBytes);
7214
7314
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -7222,7 +7322,7 @@ var Mnemonic = class {
7222
7322
  assertMnemonic(getWords(phrase));
7223
7323
  const phraseBytes = toUtf8Bytes(getPhrase(phrase));
7224
7324
  const salt = toUtf8Bytes(`mnemonic${passphrase}`);
7225
- return (0, import_ethers25.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
7325
+ return (0, import_ethers4.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
7226
7326
  }
7227
7327
  /**
7228
7328
  * @param phrase - Mnemonic phrase composed by words from the provided wordlist
@@ -7277,14 +7377,14 @@ var Mnemonic = class {
7277
7377
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7278
7378
  */
7279
7379
  static masterKeysFromSeed(seed) {
7280
- const seedArray = (0, import_ethers25.getBytesCopy)(seed);
7380
+ const seedArray = (0, import_utils32.arrayify)(seed);
7281
7381
  if (seedArray.length < 16 || seedArray.length > 64) {
7282
7382
  throw new import_errors18.FuelError(
7283
7383
  import_errors18.ErrorCode.INVALID_SEED,
7284
7384
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
7285
7385
  );
7286
7386
  }
7287
- return (0, import_ethers25.getBytesCopy)((0, import_ethers25.computeHmac)("sha512", MasterSecret, seedArray));
7387
+ return (0, import_utils32.arrayify)((0, import_ethers4.computeHmac)("sha512", MasterSecret, seedArray));
7288
7388
  }
7289
7389
  /**
7290
7390
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -7295,22 +7395,22 @@ var Mnemonic = class {
7295
7395
  */
7296
7396
  static seedToExtendedKey(seed, testnet = false) {
7297
7397
  const masterKey = Mnemonic.masterKeysFromSeed(seed);
7298
- const prefix = (0, import_ethers25.getBytesCopy)(testnet ? TestnetPRV : MainnetPRV);
7398
+ const prefix = (0, import_utils32.arrayify)(testnet ? TestnetPRV : MainnetPRV);
7299
7399
  const depth = "0x00";
7300
7400
  const fingerprint = "0x00000000";
7301
7401
  const index = "0x00000000";
7302
7402
  const chainCode = masterKey.slice(32);
7303
7403
  const privateKey = masterKey.slice(0, 32);
7304
- const extendedKey = (0, import_ethers25.concat)([
7404
+ const extendedKey = (0, import_utils32.concat)([
7305
7405
  prefix,
7306
7406
  depth,
7307
7407
  fingerprint,
7308
7408
  index,
7309
7409
  chainCode,
7310
- (0, import_ethers25.concat)(["0x00", privateKey])
7410
+ (0, import_utils32.concat)(["0x00", privateKey])
7311
7411
  ]);
7312
- const checksum = (0, import_ethers25.dataSlice)((0, import_ethers25.sha256)((0, import_ethers25.sha256)(extendedKey)), 0, 4);
7313
- return (0, import_ethers25.encodeBase58)((0, import_ethers25.concat)([extendedKey, checksum]));
7412
+ const checksum = (0, import_ethers4.dataSlice)((0, import_ethers4.sha256)((0, import_ethers4.sha256)(extendedKey)), 0, 4);
7413
+ return (0, import_ethers4.encodeBase58)((0, import_utils32.concat)([extendedKey, checksum]));
7314
7414
  }
7315
7415
  /**
7316
7416
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -7325,7 +7425,7 @@ var Mnemonic = class {
7325
7425
  * @returns A randomly generated mnemonic
7326
7426
  */
7327
7427
  static generate(size = 32, extraEntropy = "") {
7328
- 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);
7428
+ 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);
7329
7429
  return Mnemonic.entropyToMnemonic(entropy);
7330
7430
  }
7331
7431
  };
@@ -7333,12 +7433,12 @@ var mnemonic_default = Mnemonic;
7333
7433
 
7334
7434
  // src/hdwallet/hdwallet.ts
7335
7435
  var HARDENED_INDEX = 2147483648;
7336
- var MainnetPRV2 = (0, import_ethers26.hexlify)("0x0488ade4");
7337
- var MainnetPUB = (0, import_ethers26.hexlify)("0x0488b21e");
7338
- var TestnetPRV2 = (0, import_ethers26.hexlify)("0x04358394");
7339
- var TestnetPUB = (0, import_ethers26.hexlify)("0x043587cf");
7436
+ var MainnetPRV2 = (0, import_utils34.hexlify)("0x0488ade4");
7437
+ var MainnetPUB = (0, import_utils34.hexlify)("0x0488b21e");
7438
+ var TestnetPRV2 = (0, import_utils34.hexlify)("0x04358394");
7439
+ var TestnetPUB = (0, import_utils34.hexlify)("0x043587cf");
7340
7440
  function base58check(data) {
7341
- 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)]));
7441
+ 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)]));
7342
7442
  }
7343
7443
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
7344
7444
  if (isPublic) {
@@ -7347,11 +7447,11 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
7347
7447
  return testnet ? TestnetPRV2 : MainnetPRV2;
7348
7448
  }
7349
7449
  function isPublicExtendedKey(extendedKey) {
7350
- return [MainnetPUB, TestnetPUB].includes((0, import_ethers26.hexlify)(extendedKey.slice(0, 4)));
7450
+ return [MainnetPUB, TestnetPUB].includes((0, import_utils34.hexlify)(extendedKey.slice(0, 4)));
7351
7451
  }
7352
7452
  function isValidExtendedKey(extendedKey) {
7353
7453
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
7354
- (0, import_ethers26.hexlify)(extendedKey.slice(0, 4))
7454
+ (0, import_utils34.hexlify)(extendedKey.slice(0, 4))
7355
7455
  );
7356
7456
  }
7357
7457
  function parsePath(path2, depth = 0) {
@@ -7369,8 +7469,8 @@ function parsePath(path2, depth = 0) {
7369
7469
  var HDWallet = class {
7370
7470
  depth = 0;
7371
7471
  index = 0;
7372
- fingerprint = (0, import_ethers26.hexlify)("0x00000000");
7373
- parentFingerprint = (0, import_ethers26.hexlify)("0x00000000");
7472
+ fingerprint = (0, import_utils34.hexlify)("0x00000000");
7473
+ parentFingerprint = (0, import_utils34.hexlify)("0x00000000");
7374
7474
  privateKey;
7375
7475
  publicKey;
7376
7476
  chainCode;
@@ -7382,8 +7482,8 @@ var HDWallet = class {
7382
7482
  constructor(config) {
7383
7483
  if (config.privateKey) {
7384
7484
  const signer = new Signer(config.privateKey);
7385
- this.publicKey = (0, import_ethers26.hexlify)(signer.compressedPublicKey);
7386
- this.privateKey = (0, import_ethers26.hexlify)(config.privateKey);
7485
+ this.publicKey = (0, import_utils34.hexlify)(signer.compressedPublicKey);
7486
+ this.privateKey = (0, import_utils34.hexlify)(config.privateKey);
7387
7487
  } else {
7388
7488
  if (!config.publicKey) {
7389
7489
  throw new import_errors19.FuelError(
@@ -7391,10 +7491,10 @@ var HDWallet = class {
7391
7491
  "Both public and private Key cannot be missing. At least one should be provided."
7392
7492
  );
7393
7493
  }
7394
- this.publicKey = (0, import_ethers26.hexlify)(config.publicKey);
7494
+ this.publicKey = (0, import_utils34.hexlify)(config.publicKey);
7395
7495
  }
7396
7496
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
7397
- this.fingerprint = (0, import_ethers26.dataSlice)((0, import_ethers26.ripemd160)((0, import_ethers26.sha256)(this.publicKey)), 0, 4);
7497
+ this.fingerprint = (0, import_ethers5.dataSlice)((0, import_ethers5.ripemd160)((0, import_ethers5.sha256)(this.publicKey)), 0, 4);
7398
7498
  this.depth = config.depth || this.depth;
7399
7499
  this.index = config.index || this.index;
7400
7500
  this.chainCode = config.chainCode;
@@ -7410,9 +7510,9 @@ var HDWallet = class {
7410
7510
  * @returns A new instance of HDWallet on the derived index
7411
7511
  */
7412
7512
  deriveIndex(index) {
7413
- const privateKey = this.privateKey && (0, import_ethers26.getBytesCopy)(this.privateKey);
7414
- const publicKey = (0, import_ethers26.getBytesCopy)(this.publicKey);
7415
- const chainCode = (0, import_ethers26.getBytesCopy)(this.chainCode);
7513
+ const privateKey = this.privateKey && (0, import_utils34.arrayify)(this.privateKey);
7514
+ const publicKey = (0, import_utils34.arrayify)(this.publicKey);
7515
+ const chainCode = (0, import_utils34.arrayify)(this.chainCode);
7416
7516
  const data = new Uint8Array(37);
7417
7517
  if (index & HARDENED_INDEX) {
7418
7518
  if (!privateKey) {
@@ -7423,10 +7523,10 @@ var HDWallet = class {
7423
7523
  }
7424
7524
  data.set(privateKey, 1);
7425
7525
  } else {
7426
- data.set((0, import_ethers26.getBytesCopy)(this.publicKey));
7526
+ data.set((0, import_utils34.arrayify)(this.publicKey));
7427
7527
  }
7428
7528
  data.set((0, import_math19.toBytes)(index, 4), 33);
7429
- const bytes = (0, import_ethers26.getBytesCopy)((0, import_ethers26.computeHmac)("sha512", chainCode, data));
7529
+ const bytes = (0, import_utils34.arrayify)((0, import_ethers5.computeHmac)("sha512", chainCode, data));
7430
7530
  const IL = bytes.slice(0, 32);
7431
7531
  const IR = bytes.slice(32);
7432
7532
  if (privateKey) {
@@ -7440,7 +7540,7 @@ var HDWallet = class {
7440
7540
  parentFingerprint: this.fingerprint
7441
7541
  });
7442
7542
  }
7443
- const signer = new Signer((0, import_ethers26.hexlify)(IL));
7543
+ const signer = new Signer((0, import_utils34.hexlify)(IL));
7444
7544
  const Ki = signer.addPoint(publicKey);
7445
7545
  return new HDWallet({
7446
7546
  publicKey: Ki,
@@ -7475,14 +7575,12 @@ var HDWallet = class {
7475
7575
  );
7476
7576
  }
7477
7577
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
7478
- const depth = (0, import_ethers26.hexlify)(Uint8Array.from([this.depth]));
7578
+ const depth = (0, import_utils34.hexlify)(Uint8Array.from([this.depth]));
7479
7579
  const parentFingerprint = this.parentFingerprint;
7480
7580
  const index = (0, import_math19.toHex)(this.index, 4);
7481
7581
  const chainCode = this.chainCode;
7482
- const key = this.privateKey != null && !isPublic ? (0, import_ethers26.concat)(["0x00", this.privateKey]) : this.publicKey;
7483
- const extendedKey = (0, import_ethers26.getBytesCopy)(
7484
- (0, import_ethers26.concat)([prefix, depth, parentFingerprint, index, chainCode, key])
7485
- );
7582
+ const key = this.privateKey != null && !isPublic ? (0, import_utils34.concat)(["0x00", this.privateKey]) : this.publicKey;
7583
+ const extendedKey = (0, import_utils34.arrayify)((0, import_utils34.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
7486
7584
  return base58check(extendedKey);
7487
7585
  }
7488
7586
  /**
@@ -7494,13 +7592,13 @@ var HDWallet = class {
7494
7592
  static fromSeed(seed) {
7495
7593
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
7496
7594
  return new HDWallet({
7497
- chainCode: (0, import_ethers26.getBytesCopy)(masterKey.slice(32)),
7498
- privateKey: (0, import_ethers26.getBytesCopy)(masterKey.slice(0, 32))
7595
+ chainCode: (0, import_utils34.arrayify)(masterKey.slice(32)),
7596
+ privateKey: (0, import_utils34.arrayify)(masterKey.slice(0, 32))
7499
7597
  });
7500
7598
  }
7501
7599
  static fromExtendedKey(extendedKey) {
7502
- const decoded = (0, import_ethers26.toBeHex)((0, import_ethers26.decodeBase58)(extendedKey));
7503
- const bytes = (0, import_ethers26.getBytesCopy)(decoded);
7600
+ const decoded = (0, import_ethers5.toBeHex)((0, import_ethers5.decodeBase58)(extendedKey));
7601
+ const bytes = (0, import_utils34.arrayify)(decoded);
7504
7602
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
7505
7603
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
7506
7604
  throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
@@ -7509,9 +7607,9 @@ var HDWallet = class {
7509
7607
  throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
7510
7608
  }
7511
7609
  const depth = bytes[4];
7512
- const parentFingerprint = (0, import_ethers26.hexlify)(bytes.slice(5, 9));
7513
- const index = parseInt((0, import_ethers26.hexlify)(bytes.slice(9, 13)).substring(2), 16);
7514
- const chainCode = (0, import_ethers26.hexlify)(bytes.slice(13, 45));
7610
+ const parentFingerprint = (0, import_utils34.hexlify)(bytes.slice(5, 9));
7611
+ const index = parseInt((0, import_utils34.hexlify)(bytes.slice(9, 13)).substring(2), 16);
7612
+ const chainCode = (0, import_utils34.hexlify)(bytes.slice(13, 45));
7515
7613
  const key = bytes.slice(45, 78);
7516
7614
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
7517
7615
  throw new import_errors19.FuelError(
@@ -7727,11 +7825,10 @@ var generateTestWallet = async (provider, quantities) => {
7727
7825
  // src/test-utils/launchNode.ts
7728
7826
  var import_configs11 = require("@fuel-ts/address/configs");
7729
7827
  var import_math20 = require("@fuel-ts/math");
7730
- var import_utils7 = require("@fuel-ts/utils");
7828
+ var import_utils35 = require("@fuel-ts/utils");
7731
7829
  var import_cli_utils = require("@fuel-ts/utils/cli-utils");
7732
7830
  var import_child_process = require("child_process");
7733
7831
  var import_crypto5 = require("crypto");
7734
- var import_ethers27 = require("ethers");
7735
7832
  var import_fs = require("fs");
7736
7833
  var import_os = __toESM(require("os"));
7737
7834
  var import_path = __toESM(require("path"));
@@ -7786,7 +7883,7 @@ var launchNode = async ({
7786
7883
  "--poa-instant"
7787
7884
  ]);
7788
7885
  const chainConfigPath = getFlagValueFromArgs(args, "--chain");
7789
- const consensusKey = getFlagValueFromArgs(args, "--consensus-key") || import_utils7.defaultConsensusKey;
7886
+ const consensusKey = getFlagValueFromArgs(args, "--consensus-key") || import_utils35.defaultConsensusKey;
7790
7887
  const dbTypeFlagValue = getFlagValueFromArgs(args, "--db-type");
7791
7888
  const useInMemoryDb = dbTypeFlagValue === "in-memory" || dbTypeFlagValue === void 0;
7792
7889
  const poaInstantFlagValue = getFlagValueFromArgs(args, "--poa-instant");
@@ -7812,17 +7909,17 @@ var launchNode = async ({
7812
7909
  (0, import_fs.mkdirSync)(tempDirPath, { recursive: true });
7813
7910
  }
7814
7911
  const tempChainConfigFilePath = import_path.default.join(tempDirPath, "chainConfig.json");
7815
- let chainConfig = import_utils7.defaultChainConfig;
7912
+ let chainConfig = import_utils35.defaultChainConfig;
7816
7913
  if (!process.env.GENESIS_SECRET) {
7817
7914
  const pk = Signer.generatePrivateKey();
7818
7915
  const signer = new Signer(pk);
7819
- process.env.GENESIS_SECRET = (0, import_ethers27.hexlify)(pk);
7916
+ process.env.GENESIS_SECRET = (0, import_utils35.hexlify)(pk);
7820
7917
  chainConfig = {
7821
- ...import_utils7.defaultChainConfig,
7918
+ ...import_utils35.defaultChainConfig,
7822
7919
  initial_state: {
7823
- ...import_utils7.defaultChainConfig.initial_state,
7920
+ ...import_utils35.defaultChainConfig.initial_state,
7824
7921
  coins: [
7825
- ...import_utils7.defaultChainConfig.initial_state.coins,
7922
+ ...import_utils35.defaultChainConfig.initial_state.coins,
7826
7923
  {
7827
7924
  owner: signer.address.toHexString(),
7828
7925
  amount: (0, import_math20.toHex)(1e9),