@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
@@ -20,6 +20,7 @@ var __privateMethod = (obj, member, method) => {
20
20
 
21
21
  // src/wallet/base-wallet-unlocked.ts
22
22
  import { hashMessage } from "@fuel-ts/hasher";
23
+ import { hexlify as hexlify15 } from "@fuel-ts/utils";
23
24
 
24
25
  // src/account.ts
25
26
  import { Address as Address3 } from "@fuel-ts/address";
@@ -27,12 +28,12 @@ import { BaseAssetId as BaseAssetId3 } from "@fuel-ts/address/configs";
27
28
  import { ErrorCode as ErrorCode13, FuelError as FuelError14 } from "@fuel-ts/errors";
28
29
  import { AbstractAccount } from "@fuel-ts/interfaces";
29
30
  import { bn as bn16 } from "@fuel-ts/math";
30
- import { getBytesCopy as getBytesCopy15 } from "ethers";
31
+ import { arrayify as arrayify14 } from "@fuel-ts/utils";
31
32
 
32
33
  // src/providers/coin-quantity.ts
33
34
  import { BaseAssetId } from "@fuel-ts/address/configs";
34
35
  import { bn } from "@fuel-ts/math";
35
- import { hexlify } from "ethers";
36
+ import { hexlify } from "@fuel-ts/utils";
36
37
  var coinQuantityfy = (coinQuantityLike) => {
37
38
  let assetId;
38
39
  let amount;
@@ -68,15 +69,17 @@ var addAmountToAsset = (params) => {
68
69
  // src/providers/provider.ts
69
70
  import { Address as Address2 } from "@fuel-ts/address";
70
71
  import { ErrorCode as ErrorCode11, FuelError as FuelError12 } from "@fuel-ts/errors";
71
- import { bn as bn14, max } from "@fuel-ts/math";
72
+ import { BN, bn as bn14, max } from "@fuel-ts/math";
72
73
  import {
73
74
  InputType as InputType6,
74
75
  TransactionType as TransactionType8,
75
76
  InputMessageCoder,
76
77
  TransactionCoder as TransactionCoder5
77
78
  } from "@fuel-ts/transactions";
79
+ import { arrayify as arrayify11, hexlify as hexlify12 } from "@fuel-ts/utils";
78
80
  import { checkFuelCoreVersionCompatibility } from "@fuel-ts/versions";
79
- import { getBytesCopy as getBytesCopy12, hexlify as hexlify12, Network } from "ethers";
81
+ import { equalBytes } from "@noble/curves/abstract/utils";
82
+ import { Network } from "ethers";
80
83
  import { GraphQLClient } from "graphql-request";
81
84
  import { clone as clone3 } from "ramda";
82
85
 
@@ -949,7 +952,7 @@ async function* fuelGraphQLSubscriber({
949
952
 
950
953
  // src/providers/memory-cache.ts
951
954
  import { ErrorCode, FuelError as FuelError2 } from "@fuel-ts/errors";
952
- import { hexlify as hexlify2 } from "ethers";
955
+ import { hexlify as hexlify2 } from "@fuel-ts/utils";
953
956
  var cache = {};
954
957
  var DEFAULT_TTL_IN_MS = 30 * 1e3;
955
958
  var MemoryCache = class {
@@ -1011,23 +1014,23 @@ import { ZeroBytes32 } from "@fuel-ts/address/configs";
1011
1014
  import { ErrorCode as ErrorCode2, FuelError as FuelError3 } from "@fuel-ts/errors";
1012
1015
  import { bn as bn2, toNumber } from "@fuel-ts/math";
1013
1016
  import { InputType } from "@fuel-ts/transactions";
1014
- import { getBytesCopy, hexlify as hexlify3 } from "ethers";
1017
+ import { arrayify, hexlify as hexlify3 } from "@fuel-ts/utils";
1015
1018
  var inputify = (value) => {
1016
1019
  const { type } = value;
1017
1020
  switch (value.type) {
1018
1021
  case InputType.Coin: {
1019
- const predicate = getBytesCopy(value.predicate ?? "0x");
1020
- const predicateData = getBytesCopy(value.predicateData ?? "0x");
1022
+ const predicate = arrayify(value.predicate ?? "0x");
1023
+ const predicateData = arrayify(value.predicateData ?? "0x");
1021
1024
  return {
1022
1025
  type: InputType.Coin,
1023
- txID: hexlify3(getBytesCopy(value.id).slice(0, 32)),
1024
- outputIndex: getBytesCopy(value.id)[32],
1026
+ txID: hexlify3(arrayify(value.id).slice(0, 32)),
1027
+ outputIndex: arrayify(value.id)[32],
1025
1028
  owner: hexlify3(value.owner),
1026
1029
  amount: bn2(value.amount),
1027
1030
  assetId: hexlify3(value.assetId),
1028
1031
  txPointer: {
1029
- blockHeight: toNumber(getBytesCopy(value.txPointer).slice(0, 8)),
1030
- txIndex: toNumber(getBytesCopy(value.txPointer).slice(8, 16))
1032
+ blockHeight: toNumber(arrayify(value.txPointer).slice(0, 8)),
1033
+ txIndex: toNumber(arrayify(value.txPointer).slice(8, 16))
1031
1034
  },
1032
1035
  witnessIndex: value.witnessIndex,
1033
1036
  maturity: value.maturity ?? 0,
@@ -1046,16 +1049,16 @@ var inputify = (value) => {
1046
1049
  balanceRoot: ZeroBytes32,
1047
1050
  stateRoot: ZeroBytes32,
1048
1051
  txPointer: {
1049
- blockHeight: toNumber(getBytesCopy(value.txPointer).slice(0, 8)),
1050
- txIndex: toNumber(getBytesCopy(value.txPointer).slice(8, 16))
1052
+ blockHeight: toNumber(arrayify(value.txPointer).slice(0, 8)),
1053
+ txIndex: toNumber(arrayify(value.txPointer).slice(8, 16))
1051
1054
  },
1052
1055
  contractID: hexlify3(value.contractId)
1053
1056
  };
1054
1057
  }
1055
1058
  case InputType.Message: {
1056
- const predicate = getBytesCopy(value.predicate ?? "0x");
1057
- const predicateData = getBytesCopy(value.predicateData ?? "0x");
1058
- const data = getBytesCopy(value.data ?? "0x");
1059
+ const predicate = arrayify(value.predicate ?? "0x");
1060
+ const predicateData = arrayify(value.predicateData ?? "0x");
1061
+ const data = arrayify(value.data ?? "0x");
1059
1062
  return {
1060
1063
  type: InputType.Message,
1061
1064
  sender: hexlify3(value.sender),
@@ -1086,7 +1089,7 @@ import { ZeroBytes32 as ZeroBytes322 } from "@fuel-ts/address/configs";
1086
1089
  import { ErrorCode as ErrorCode3, FuelError as FuelError4 } from "@fuel-ts/errors";
1087
1090
  import { bn as bn3 } from "@fuel-ts/math";
1088
1091
  import { OutputType } from "@fuel-ts/transactions";
1089
- import { hexlify as hexlify4 } from "ethers";
1092
+ import { hexlify as hexlify4 } from "@fuel-ts/utils";
1090
1093
  var outputify = (value) => {
1091
1094
  const { type } = value;
1092
1095
  switch (type) {
@@ -1149,7 +1152,7 @@ import {
1149
1152
  OutputType as OutputType2,
1150
1153
  TransactionType
1151
1154
  } from "@fuel-ts/transactions";
1152
- import { concat, getBytesCopy as getBytesCopy5, hexlify as hexlify7 } from "ethers";
1155
+ import { concat, hexlify as hexlify7 } from "@fuel-ts/utils";
1153
1156
 
1154
1157
  // src/providers/resource.ts
1155
1158
  var isCoin = (resource) => "id" in resource;
@@ -1165,7 +1168,7 @@ import {
1165
1168
  ReceiptType
1166
1169
  } from "@fuel-ts/transactions";
1167
1170
  import { FAILED_TRANSFER_TO_ADDRESS_SIGNAL } from "@fuel-ts/transactions/configs";
1168
- import { getBytesCopy as getBytesCopy2 } from "ethers";
1171
+ import { arrayify as arrayify2 } from "@fuel-ts/utils";
1169
1172
  var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
1170
1173
  var doesReceiptHaveMissingContractId = (receipt) => receipt.type === ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
1171
1174
  var getReceiptsWithMissingData = (receipts) => receipts.reduce(
@@ -1309,7 +1312,7 @@ function assembleReceiptByType(receipt) {
1309
1312
  const recipient = hexOrZero(receipt.recipient);
1310
1313
  const nonce = hexOrZero(receipt.nonce);
1311
1314
  const amount = bn4(receipt.amount);
1312
- const data = receipt.data ? getBytesCopy2(receipt.data) : Uint8Array.from([]);
1315
+ const data = receipt.data ? arrayify2(receipt.data) : Uint8Array.from([]);
1313
1316
  const digest = hexOrZero(receipt.digest);
1314
1317
  const messageId = ReceiptMessageOutCoder.getMessageId({
1315
1318
  sender,
@@ -1371,7 +1374,7 @@ import { ErrorCode as ErrorCode5, FuelError as FuelError6 } from "@fuel-ts/error
1371
1374
  // src/providers/utils/gas.ts
1372
1375
  import { bn as bn5 } from "@fuel-ts/math";
1373
1376
  import { ReceiptType as ReceiptType2 } from "@fuel-ts/transactions";
1374
- import { getBytesCopy as getBytesCopy3 } from "ethers";
1377
+ import { arrayify as arrayify3 } from "@fuel-ts/utils";
1375
1378
  var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn5(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
1376
1379
  var getGasUsedFromReceipts = (receipts) => {
1377
1380
  const scriptResult = receipts.filter(
@@ -1396,9 +1399,7 @@ function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
1396
1399
  const totalGas = inputs.reduce((total, input) => {
1397
1400
  if ("predicate" in input && input.predicate && input.predicate !== "0x") {
1398
1401
  return total.add(
1399
- resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(
1400
- resolveGasDependentCosts(getBytesCopy3(input.predicate).length, gasCosts.contractRoot)
1401
- ).add(bn5(input.predicateGasUsed))
1402
+ resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts(arrayify3(input.predicate).length, gasCosts.contractRoot)).add(bn5(input.predicateGasUsed))
1402
1403
  );
1403
1404
  }
1404
1405
  if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
@@ -1447,7 +1448,7 @@ function calculateMetadataGasForTxScript({
1447
1448
  }
1448
1449
 
1449
1450
  // src/providers/utils/json.ts
1450
- import { hexlify as hexlify5 } from "ethers";
1451
+ import { hexlify as hexlify5 } from "@fuel-ts/utils";
1451
1452
  import { clone } from "ramda";
1452
1453
  function normalize(object) {
1453
1454
  Object.keys(object).forEach((key) => {
@@ -1500,9 +1501,9 @@ var NoWitnessAtIndexError = class extends Error {
1500
1501
  };
1501
1502
 
1502
1503
  // src/providers/transaction-request/witness.ts
1503
- import { getBytesCopy as getBytesCopy4, hexlify as hexlify6 } from "ethers";
1504
+ import { arrayify as arrayify4, hexlify as hexlify6 } from "@fuel-ts/utils";
1504
1505
  var witnessify = (value) => {
1505
- const data = getBytesCopy4(value);
1506
+ const data = arrayify4(value);
1506
1507
  return {
1507
1508
  data: hexlify6(data),
1508
1509
  dataLength: data.length
@@ -1917,7 +1918,7 @@ var BaseTransactionRequest = class {
1917
1918
  *
1918
1919
  * @param quantities - CoinQuantity Array.
1919
1920
  */
1920
- fundWithFakeUtxos(quantities) {
1921
+ fundWithFakeUtxos(quantities, resourcesOwner) {
1921
1922
  let idCounter = 0;
1922
1923
  const generateId = () => {
1923
1924
  const counterString = String(idCounter++);
@@ -1941,7 +1942,7 @@ var BaseTransactionRequest = class {
1941
1942
  id: generateId(),
1942
1943
  amount: quantity,
1943
1944
  assetId,
1944
- owner: Address.fromRandom(),
1945
+ owner: resourcesOwner || Address.fromRandom(),
1945
1946
  maturity: 0,
1946
1947
  blockCreated: bn6(1),
1947
1948
  txCreatedIdx: bn6(1)
@@ -1974,19 +1975,29 @@ var BaseTransactionRequest = class {
1974
1975
  toJSON() {
1975
1976
  return normalizeJSON(this);
1976
1977
  }
1977
- /**
1978
- * @hidden
1979
- *
1980
- * Determines whether the transaction has a predicate input.
1981
- *
1982
- * @returns Whether the transaction has a predicate input.
1983
- */
1984
- hasPredicateInput() {
1985
- return Boolean(
1986
- this.inputs.find(
1987
- (input) => "predicate" in input && input.predicate && input.predicate !== getBytesCopy5("0x")
1988
- )
1989
- );
1978
+ updatePredicateInputs(inputs) {
1979
+ this.inputs.forEach((i) => {
1980
+ let correspondingInput;
1981
+ switch (i.type) {
1982
+ case InputType2.Contract:
1983
+ return;
1984
+ case InputType2.Coin:
1985
+ correspondingInput = inputs.find((x) => x.type === InputType2.Coin && x.owner === i.owner);
1986
+ break;
1987
+ case InputType2.Message:
1988
+ correspondingInput = inputs.find(
1989
+ (x) => x.type === InputType2.Message && x.sender === i.sender
1990
+ );
1991
+ break;
1992
+ default:
1993
+ break;
1994
+ }
1995
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && bn6(correspondingInput.predicateGasUsed).gt(0)) {
1996
+ i.predicate = correspondingInput.predicate;
1997
+ i.predicateData = correspondingInput.predicateData;
1998
+ i.predicateGasUsed = correspondingInput.predicateGasUsed;
1999
+ }
2000
+ });
1990
2001
  }
1991
2002
  };
1992
2003
 
@@ -1994,14 +2005,15 @@ var BaseTransactionRequest = class {
1994
2005
  import { ZeroBytes32 as ZeroBytes326 } from "@fuel-ts/address/configs";
1995
2006
  import { bn as bn8 } from "@fuel-ts/math";
1996
2007
  import { TransactionType as TransactionType3, OutputType as OutputType4 } from "@fuel-ts/transactions";
1997
- import { getBytesCopy as getBytesCopy7, hexlify as hexlify9 } from "ethers";
2008
+ import { arrayify as arrayify6, hexlify as hexlify9 } from "@fuel-ts/utils";
1998
2009
 
1999
2010
  // src/providers/transaction-request/hash-transaction.ts
2000
2011
  import { ZeroBytes32 as ZeroBytes325 } from "@fuel-ts/address/configs";
2001
2012
  import { uint64ToBytesBE } from "@fuel-ts/hasher";
2002
2013
  import { bn as bn7 } from "@fuel-ts/math";
2003
2014
  import { TransactionType as TransactionType2, InputType as InputType3, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
2004
- import { concat as concat2, sha256 } from "ethers";
2015
+ import { concat as concat2 } from "@fuel-ts/utils";
2016
+ import { sha256 } from "ethers";
2005
2017
  import { clone as clone2 } from "ramda";
2006
2018
  function hashTransaction(transactionRequest, chainId) {
2007
2019
  const transaction = transactionRequest.toTransaction();
@@ -2068,10 +2080,10 @@ function hashTransaction(transactionRequest, chainId) {
2068
2080
  }
2069
2081
 
2070
2082
  // src/providers/transaction-request/storage-slot.ts
2071
- import { getBytesCopy as getBytesCopy6, hexlify as hexlify8 } from "ethers";
2083
+ import { arrayify as arrayify5, hexlify as hexlify8 } from "@fuel-ts/utils";
2072
2084
  var getStorageValue = (value) => {
2073
2085
  const v = new Uint8Array(32);
2074
- v.set(getBytesCopy6(value));
2086
+ v.set(arrayify5(value));
2075
2087
  return v;
2076
2088
  };
2077
2089
  var storageSlotify = (storageSlot) => {
@@ -2176,7 +2188,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2176
2188
  }
2177
2189
  metadataGas(gasCosts) {
2178
2190
  return calculateMetadataGasForTxCreate({
2179
- contractBytesSize: bn8(getBytesCopy7(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2191
+ contractBytesSize: bn8(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2180
2192
  gasCosts,
2181
2193
  stateRootSize: this.storageSlots.length,
2182
2194
  txBytesSize: this.byteSize()
@@ -2190,17 +2202,17 @@ import { addressify as addressify2 } from "@fuel-ts/address";
2190
2202
  import { ZeroBytes32 as ZeroBytes327 } from "@fuel-ts/address/configs";
2191
2203
  import { bn as bn9 } from "@fuel-ts/math";
2192
2204
  import { InputType as InputType4, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2193
- import { getBytesCopy as getBytesCopy9, hexlify as hexlify10 } from "ethers";
2205
+ import { arrayify as arrayify8, hexlify as hexlify10 } from "@fuel-ts/utils";
2194
2206
 
2195
2207
  // src/providers/transaction-request/scripts.ts
2196
- import { getBytesCopy as getBytesCopy8 } from "ethers";
2208
+ import { arrayify as arrayify7 } from "@fuel-ts/utils";
2197
2209
  var returnZeroScript = {
2198
2210
  /*
2199
2211
  Opcode::RET(REG_ZERO)
2200
2212
  Opcode::NOOP
2201
2213
  */
2202
2214
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
2203
- bytes: getBytesCopy8("0x24000000"),
2215
+ bytes: arrayify7("0x24000000"),
2204
2216
  encodeScriptData: () => new Uint8Array(0)
2205
2217
  };
2206
2218
  var withdrawScript = {
@@ -2214,7 +2226,7 @@ var withdrawScript = {
2214
2226
  00000000 00000000 [amount value]
2215
2227
  */
2216
2228
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
2217
- bytes: getBytesCopy8("0x5040C0105D44C0064C40001124000000"),
2229
+ bytes: arrayify7("0x5040C0105D44C0064C40001124000000"),
2218
2230
  encodeScriptData: () => new Uint8Array(0)
2219
2231
  };
2220
2232
 
@@ -2242,8 +2254,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2242
2254
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2243
2255
  super(rest);
2244
2256
  this.gasLimit = bn9(gasLimit);
2245
- this.script = getBytesCopy9(script ?? returnZeroScript.bytes);
2246
- this.scriptData = getBytesCopy9(scriptData ?? returnZeroScript.encodeScriptData());
2257
+ this.script = arrayify8(script ?? returnZeroScript.bytes);
2258
+ this.scriptData = arrayify8(scriptData ?? returnZeroScript.encodeScriptData());
2247
2259
  }
2248
2260
  /**
2249
2261
  * Converts the transaction request to a `TransactionScript`.
@@ -2251,8 +2263,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2251
2263
  * @returns The transaction script object.
2252
2264
  */
2253
2265
  toTransaction() {
2254
- const script = getBytesCopy9(this.script ?? "0x");
2255
- const scriptData = getBytesCopy9(this.scriptData ?? "0x");
2266
+ const script = arrayify8(this.script ?? "0x");
2267
+ const scriptData = arrayify8(this.scriptData ?? "0x");
2256
2268
  return {
2257
2269
  type: TransactionType4.Script,
2258
2270
  scriptGasLimit: this.gasLimit,
@@ -2412,15 +2424,15 @@ var transactionRequestify = (obj) => {
2412
2424
  import { ErrorCode as ErrorCode10, FuelError as FuelError11 } from "@fuel-ts/errors";
2413
2425
  import { bn as bn13 } from "@fuel-ts/math";
2414
2426
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2415
- import { getBytesCopy as getBytesCopy11 } from "ethers";
2427
+ import { arrayify as arrayify10 } from "@fuel-ts/utils";
2416
2428
 
2417
2429
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2418
- import { hexlify as hexlify11 } from "ethers";
2430
+ import { hexlify as hexlify11 } from "@fuel-ts/utils";
2419
2431
 
2420
2432
  // src/providers/transaction-summary/calculate-transaction-fee.ts
2421
2433
  import { bn as bn10 } from "@fuel-ts/math";
2422
2434
  import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType6 } from "@fuel-ts/transactions";
2423
- import { getBytesCopy as getBytesCopy10 } from "ethers";
2435
+ import { arrayify as arrayify9 } from "@fuel-ts/utils";
2424
2436
  var calculateTransactionFee = (params) => {
2425
2437
  const {
2426
2438
  gasUsed,
@@ -2429,7 +2441,7 @@ var calculateTransactionFee = (params) => {
2429
2441
  } = params;
2430
2442
  const gasPerByte = bn10(feeParams.gasPerByte);
2431
2443
  const gasPriceFactor = bn10(feeParams.gasPriceFactor);
2432
- const transactionBytes = getBytesCopy10(rawPayload);
2444
+ const transactionBytes = arrayify9(rawPayload);
2433
2445
  const [transaction] = new TransactionCoder3().decode(transactionBytes, 0);
2434
2446
  if (transaction.type === TransactionType6.Mint) {
2435
2447
  return {
@@ -2444,7 +2456,7 @@ var calculateTransactionFee = (params) => {
2444
2456
  let gasLimit = bn10(0);
2445
2457
  if (type === TransactionType6.Create) {
2446
2458
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2447
- const contractBytesSize = bn10(getBytesCopy10(witnesses[bytecodeWitnessIndex].data).length);
2459
+ const contractBytesSize = bn10(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2448
2460
  metadataGas = calculateMetadataGasForTxCreate({
2449
2461
  contractBytesSize,
2450
2462
  gasCosts,
@@ -3203,7 +3215,7 @@ var TransactionResponse = class {
3203
3215
  */
3204
3216
  decodeTransaction(transactionWithReceipts) {
3205
3217
  return new TransactionCoder4().decode(
3206
- getBytesCopy11(transactionWithReceipts.rawPayload),
3218
+ arrayify10(transactionWithReceipts.rawPayload),
3207
3219
  0
3208
3220
  )?.[0];
3209
3221
  }
@@ -3229,7 +3241,7 @@ var TransactionResponse = class {
3229
3241
  id: this.id,
3230
3242
  receipts,
3231
3243
  transaction: decodedTransaction,
3232
- transactionBytes: getBytesCopy11(transaction.rawPayload),
3244
+ transactionBytes: arrayify10(transaction.rawPayload),
3233
3245
  gqlTransactionStatus: transaction.status,
3234
3246
  gasPerByte,
3235
3247
  gasPriceFactor,
@@ -3652,7 +3664,7 @@ var _Provider = class {
3652
3664
  async call(transactionRequestLike, { utxoValidation, estimateTxDependencies = true } = {}) {
3653
3665
  const transactionRequest = transactionRequestify(transactionRequestLike);
3654
3666
  if (estimateTxDependencies) {
3655
- await this.estimateTxDependencies(transactionRequest);
3667
+ return this.estimateTxDependencies(transactionRequest);
3656
3668
  }
3657
3669
  const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
3658
3670
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
@@ -3671,6 +3683,14 @@ var _Provider = class {
3671
3683
  * @returns A promise that resolves to the estimated transaction request object.
3672
3684
  */
3673
3685
  async estimatePredicates(transactionRequest) {
3686
+ const shouldEstimatePredicates = Boolean(
3687
+ transactionRequest.inputs.find(
3688
+ (input) => "predicate" in input && input.predicate && !equalBytes(arrayify11(input.predicate), arrayify11("0x")) && new BN(input.predicateGasUsed).isZero()
3689
+ )
3690
+ );
3691
+ if (!shouldEstimatePredicates) {
3692
+ return transactionRequest;
3693
+ }
3674
3694
  const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
3675
3695
  const response = await this.operations.estimatePredicates({
3676
3696
  encodedTransaction
@@ -3701,34 +3721,33 @@ var _Provider = class {
3701
3721
  * @returns A promise.
3702
3722
  */
3703
3723
  async estimateTxDependencies(transactionRequest) {
3704
- let missingOutputVariableCount = 0;
3705
- let missingOutputContractIdsCount = 0;
3706
- let tries = 0;
3707
3724
  if (transactionRequest.type === TransactionType8.Create) {
3708
- return;
3709
- }
3710
- let txRequest = transactionRequest;
3711
- if (txRequest.hasPredicateInput()) {
3712
- txRequest = await this.estimatePredicates(txRequest);
3725
+ return {
3726
+ receipts: []
3727
+ };
3713
3728
  }
3714
- while (tries < MAX_RETRIES) {
3729
+ await this.estimatePredicates(transactionRequest);
3730
+ let receipts = [];
3731
+ for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
3715
3732
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
3716
- encodedTransaction: hexlify12(txRequest.toTransactionBytes()),
3733
+ encodedTransaction: hexlify12(transactionRequest.toTransactionBytes()),
3717
3734
  utxoValidation: false
3718
3735
  });
3719
- const receipts = gqlReceipts.map(processGqlReceipt);
3736
+ receipts = gqlReceipts.map(processGqlReceipt);
3720
3737
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
3721
- missingOutputVariableCount = missingOutputVariables.length;
3722
- missingOutputContractIdsCount = missingOutputContractIds.length;
3723
- if (missingOutputVariableCount === 0 && missingOutputContractIdsCount === 0) {
3724
- return;
3738
+ const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
3739
+ if (hasMissingOutputs) {
3740
+ transactionRequest.addVariableOutputs(missingOutputVariables.length);
3741
+ missingOutputContractIds.forEach(({ contractId }) => {
3742
+ transactionRequest.addContractInputAndOutput(Address2.fromString(contractId));
3743
+ });
3744
+ } else {
3745
+ break;
3725
3746
  }
3726
- txRequest.addVariableOutputs(missingOutputVariableCount);
3727
- missingOutputContractIds.forEach(
3728
- ({ contractId }) => txRequest.addContractInputAndOutput(Address2.fromString(contractId))
3729
- );
3730
- tries += 1;
3731
3747
  }
3748
+ return {
3749
+ receipts
3750
+ };
3732
3751
  }
3733
3752
  /**
3734
3753
  * Executes a signed transaction without applying the states changes
@@ -3743,7 +3762,7 @@ var _Provider = class {
3743
3762
  async simulate(transactionRequestLike, { estimateTxDependencies = true } = {}) {
3744
3763
  const transactionRequest = transactionRequestify(transactionRequestLike);
3745
3764
  if (estimateTxDependencies) {
3746
- await this.estimateTxDependencies(transactionRequest);
3765
+ return this.estimateTxDependencies(transactionRequest);
3747
3766
  }
3748
3767
  const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
3749
3768
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
@@ -3770,36 +3789,38 @@ var _Provider = class {
3770
3789
  * @param tolerance - The tolerance to add on top of the gasUsed.
3771
3790
  * @returns A promise that resolves to the transaction cost object.
3772
3791
  */
3773
- async getTransactionCost(transactionRequestLike, forwardingQuantities = [], { estimateTxDependencies = true, estimatePredicates = true } = {}) {
3774
- const transactionRequest = transactionRequestify(clone3(transactionRequestLike));
3792
+ async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
3793
+ estimateTxDependencies = true,
3794
+ estimatePredicates = true,
3795
+ resourcesOwner
3796
+ } = {}) {
3797
+ const txRequestClone = clone3(transactionRequestify(transactionRequestLike));
3775
3798
  const chainInfo = this.getChain();
3776
3799
  const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
3777
- const gasPrice = max(transactionRequest.gasPrice, minGasPrice);
3778
- const isScriptTransaction = transactionRequest.type === TransactionType8.Script;
3779
- if (transactionRequest.hasPredicateInput() && estimatePredicates) {
3800
+ const gasPrice = max(txRequestClone.gasPrice, minGasPrice);
3801
+ const isScriptTransaction = txRequestClone.type === TransactionType8.Script;
3802
+ const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
3803
+ const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
3804
+ txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
3805
+ if (estimatePredicates) {
3780
3806
  if (isScriptTransaction) {
3781
- transactionRequest.gasLimit = bn14(0);
3807
+ txRequestClone.gasLimit = bn14(0);
3782
3808
  }
3783
- await this.estimatePredicates(transactionRequest);
3809
+ if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
3810
+ resourcesOwner.populateTransactionPredicateData(txRequestClone);
3811
+ }
3812
+ await this.estimatePredicates(txRequestClone);
3784
3813
  }
3785
- const minGas = transactionRequest.calculateMinGas(chainInfo);
3786
- const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
3787
- const coinOutputsQuantities = transactionRequest.getCoinOutputsQuantities();
3788
- const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
3789
- transactionRequest.fundWithFakeUtxos(allQuantities);
3790
- let gasUsed = minGas;
3814
+ const minGas = txRequestClone.calculateMinGas(chainInfo);
3815
+ const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
3791
3816
  let receipts = [];
3792
- if (isScriptTransaction) {
3793
- transactionRequest.gasPrice = bn14(0);
3794
- transactionRequest.gasLimit = bn14(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3795
- const result = await this.call(transactionRequest, {
3796
- estimateTxDependencies
3797
- });
3817
+ if (isScriptTransaction && estimateTxDependencies) {
3818
+ txRequestClone.gasPrice = bn14(0);
3819
+ txRequestClone.gasLimit = bn14(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3820
+ const result = await this.estimateTxDependencies(txRequestClone);
3798
3821
  receipts = result.receipts;
3799
- gasUsed = getGasUsedFromReceipts(receipts);
3800
- } else {
3801
- gasUsed = minGas;
3802
3822
  }
3823
+ const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
3803
3824
  const usedFee = calculatePriceWithFactor(
3804
3825
  gasUsed,
3805
3826
  gasPrice,
@@ -3817,7 +3838,9 @@ var _Provider = class {
3817
3838
  maxGas,
3818
3839
  usedFee,
3819
3840
  minFee,
3820
- maxFee
3841
+ maxFee,
3842
+ estimatedInputs: txRequestClone.inputs,
3843
+ estimatedOutputs: txRequestClone.outputs
3821
3844
  };
3822
3845
  }
3823
3846
  async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
@@ -3985,7 +4008,7 @@ var _Provider = class {
3985
4008
  time: block.header.time,
3986
4009
  transactionIds: block.transactions.map((tx) => tx.id),
3987
4010
  transactions: block.transactions.map(
3988
- (tx) => new TransactionCoder5().decode(getBytesCopy12(tx.rawPayload), 0)?.[0]
4011
+ (tx) => new TransactionCoder5().decode(arrayify11(tx.rawPayload), 0)?.[0]
3989
4012
  )
3990
4013
  };
3991
4014
  }
@@ -4001,7 +4024,7 @@ var _Provider = class {
4001
4024
  return null;
4002
4025
  }
4003
4026
  return new TransactionCoder5().decode(
4004
- getBytesCopy12(transaction.rawPayload),
4027
+ arrayify11(transaction.rawPayload),
4005
4028
  0
4006
4029
  )?.[0];
4007
4030
  }
@@ -4207,6 +4230,10 @@ var _Provider = class {
4207
4230
  });
4208
4231
  return bn14(latestBlockHeight);
4209
4232
  }
4233
+ // eslint-disable-next-line @typescript-eslint/require-await
4234
+ async getTransactionResponse(transactionId) {
4235
+ return new TransactionResponse(transactionId, this);
4236
+ }
4210
4237
  };
4211
4238
  var Provider = _Provider;
4212
4239
  _cacheInputs = new WeakSet();
@@ -4227,21 +4254,66 @@ __publicField(Provider, "nodeInfoCache", {});
4227
4254
  import { ErrorCode as ErrorCode12, FuelError as FuelError13 } from "@fuel-ts/errors";
4228
4255
  import { bn as bn15 } from "@fuel-ts/math";
4229
4256
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4230
- import { getBytesCopy as getBytesCopy13 } from "ethers";
4257
+ import { arrayify as arrayify12 } from "@fuel-ts/utils";
4258
+
4259
+ // src/providers/chains.ts
4260
+ var CHAIN_IDS = {
4261
+ eth: {
4262
+ sepolia: 11155111,
4263
+ foundry: 31337
4264
+ },
4265
+ fuel: {
4266
+ beta5: 0,
4267
+ devnet: 10
4268
+ }
4269
+ };
4270
+
4271
+ // src/providers/assets/index.ts
4272
+ var assets = [
4273
+ {
4274
+ name: "Ethereum",
4275
+ symbol: "ETH",
4276
+ icon: "eth.svg",
4277
+ networks: [
4278
+ {
4279
+ type: "ethereum",
4280
+ chainId: CHAIN_IDS.eth.sepolia,
4281
+ decimals: 18
4282
+ },
4283
+ {
4284
+ type: "ethereum",
4285
+ chainId: CHAIN_IDS.eth.foundry,
4286
+ decimals: 18
4287
+ },
4288
+ {
4289
+ type: "fuel",
4290
+ chainId: CHAIN_IDS.fuel.beta5,
4291
+ decimals: 9,
4292
+ assetId: "0x0000000000000000000000000000000000000000000000000000000000000000"
4293
+ },
4294
+ {
4295
+ type: "fuel",
4296
+ chainId: CHAIN_IDS.fuel.devnet,
4297
+ decimals: 9,
4298
+ assetId: "0x0000000000000000000000000000000000000000000000000000000000000000"
4299
+ }
4300
+ ]
4301
+ }
4302
+ ];
4231
4303
 
4232
4304
  // src/utils/formatTransferToContractScriptData.ts
4233
4305
  import { U64Coder as U64Coder2 } from "@fuel-ts/abi-coder";
4234
- import { BN } from "@fuel-ts/math";
4306
+ import { BN as BN2 } from "@fuel-ts/math";
4307
+ import { arrayify as arrayify13 } from "@fuel-ts/utils";
4235
4308
  import * as asm from "@fuels/vm-asm";
4236
- import { getBytesCopy as getBytesCopy14 } from "ethers";
4237
4309
  var formatTransferToContractScriptData = (params) => {
4238
4310
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
4239
4311
  const numberCoder = new U64Coder2();
4240
- const encoded = numberCoder.encode(new BN(amountToTransfer).toNumber());
4312
+ const encoded = numberCoder.encode(new BN2(amountToTransfer).toNumber());
4241
4313
  const scriptData = Uint8Array.from([
4242
- ...getBytesCopy14(hexlifiedContractId),
4314
+ ...arrayify13(hexlifiedContractId),
4243
4315
  ...encoded,
4244
- ...getBytesCopy14(assetId)
4316
+ ...arrayify13(assetId)
4245
4317
  ]);
4246
4318
  return scriptData;
4247
4319
  };
@@ -4275,15 +4347,17 @@ var Account = class extends AbstractAccount {
4275
4347
  * The provider used to interact with the network.
4276
4348
  */
4277
4349
  _provider;
4350
+ _connector;
4278
4351
  /**
4279
4352
  * Creates a new Account instance.
4280
4353
  *
4281
4354
  * @param address - The address of the account.
4282
4355
  * @param provider - A Provider instance (optional).
4283
4356
  */
4284
- constructor(address, provider) {
4357
+ constructor(address, provider, connector) {
4285
4358
  super();
4286
4359
  this._provider = provider;
4360
+ this._connector = connector;
4287
4361
  this.address = Address3.fromDynamicInput(address);
4288
4362
  }
4289
4363
  /**
@@ -4489,7 +4563,10 @@ var Account = class extends AbstractAccount {
4489
4563
  const params = { gasPrice: minGasPrice, ...txParams };
4490
4564
  const request = new ScriptTransactionRequest(params);
4491
4565
  request.addCoinOutput(Address3.fromAddressOrString(destination), amount, assetId);
4492
- const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(request);
4566
+ const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
4567
+ estimateTxDependencies: true,
4568
+ resourcesOwner: this
4569
+ });
4493
4570
  request.gasPrice = bn16(txParams.gasPrice ?? minGasPrice);
4494
4571
  request.gasLimit = bn16(txParams.gasLimit ?? gasUsed);
4495
4572
  this.validateGas({
@@ -4499,6 +4576,7 @@ var Account = class extends AbstractAccount {
4499
4576
  minGasPrice
4500
4577
  });
4501
4578
  await this.fund(request, requiredQuantities, maxFee);
4579
+ request.updatePredicateInputs(estimatedInputs);
4502
4580
  return request;
4503
4581
  }
4504
4582
  /**
@@ -4512,7 +4590,7 @@ var Account = class extends AbstractAccount {
4512
4590
  */
4513
4591
  async transfer(destination, amount, assetId = BaseAssetId3, txParams = {}) {
4514
4592
  const request = await this.createTransfer(destination, amount, assetId, txParams);
4515
- return this.sendTransaction(request);
4593
+ return this.sendTransaction(request, { estimateTxDependencies: false });
4516
4594
  }
4517
4595
  /**
4518
4596
  * Transfers coins to a contract address.
@@ -4563,14 +4641,14 @@ var Account = class extends AbstractAccount {
4563
4641
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
4564
4642
  const { minGasPrice } = this.provider.getGasConfig();
4565
4643
  const recipientAddress = Address3.fromAddressOrString(recipient);
4566
- const recipientDataArray = getBytesCopy15(
4644
+ const recipientDataArray = arrayify14(
4567
4645
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
4568
4646
  );
4569
- const amountDataArray = getBytesCopy15(
4647
+ const amountDataArray = arrayify14(
4570
4648
  "0x".concat(bn16(amount).toHex().substring(2).padStart(16, "0"))
4571
4649
  );
4572
4650
  const script = new Uint8Array([
4573
- ...getBytesCopy15(withdrawScript.bytes),
4651
+ ...arrayify14(withdrawScript.bytes),
4574
4652
  ...recipientDataArray,
4575
4653
  ...amountDataArray
4576
4654
  ]);
@@ -4591,17 +4669,30 @@ var Account = class extends AbstractAccount {
4591
4669
  await this.fund(request, requiredQuantities, maxFee);
4592
4670
  return this.sendTransaction(request);
4593
4671
  }
4672
+ async signMessage(message) {
4673
+ if (!this._connector) {
4674
+ throw new FuelError14(ErrorCode13.MISSING_CONNECTOR, "A connector is required to sign messages.");
4675
+ }
4676
+ return this._connector.signMessage(this.address.toString(), message);
4677
+ }
4594
4678
  /**
4595
4679
  * Sends a transaction to the network.
4596
4680
  *
4597
4681
  * @param transactionRequestLike - The transaction request to be sent.
4598
4682
  * @returns A promise that resolves to the transaction response.
4599
4683
  */
4600
- async sendTransaction(transactionRequestLike, options) {
4684
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
4685
+ if (this._connector) {
4686
+ return this.provider.getTransactionResponse(
4687
+ await this._connector.sendTransaction(this.address.toString(), transactionRequestLike)
4688
+ );
4689
+ }
4601
4690
  const transactionRequest = transactionRequestify(transactionRequestLike);
4602
- await this.provider.estimateTxDependencies(transactionRequest);
4691
+ if (estimateTxDependencies) {
4692
+ await this.provider.estimateTxDependencies(transactionRequest);
4693
+ }
4603
4694
  return this.provider.sendTransaction(transactionRequest, {
4604
- ...options,
4695
+ awaitExecution,
4605
4696
  estimateTxDependencies: false
4606
4697
  });
4607
4698
  }
@@ -4611,9 +4702,11 @@ var Account = class extends AbstractAccount {
4611
4702
  * @param transactionRequestLike - The transaction request to be simulated.
4612
4703
  * @returns A promise that resolves to the call result.
4613
4704
  */
4614
- async simulateTransaction(transactionRequestLike) {
4705
+ async simulateTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
4615
4706
  const transactionRequest = transactionRequestify(transactionRequestLike);
4616
- await this.provider.estimateTxDependencies(transactionRequest);
4707
+ if (estimateTxDependencies) {
4708
+ await this.provider.estimateTxDependencies(transactionRequest);
4709
+ }
4617
4710
  return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
4618
4711
  }
4619
4712
  validateGas({
@@ -4642,8 +4735,8 @@ import { Address as Address4 } from "@fuel-ts/address";
4642
4735
  import { randomBytes } from "@fuel-ts/crypto";
4643
4736
  import { hash } from "@fuel-ts/hasher";
4644
4737
  import { toBytes } from "@fuel-ts/math";
4738
+ import { hexlify as hexlify13, concat as concat3, arrayify as arrayify15 } from "@fuel-ts/utils";
4645
4739
  import { secp256k1 } from "@noble/curves/secp256k1";
4646
- import { hexlify as hexlify13, concat as concat3, getBytesCopy as getBytesCopy16 } from "ethers";
4647
4740
  var Signer = class {
4648
4741
  address;
4649
4742
  publicKey;
@@ -4678,11 +4771,11 @@ var Signer = class {
4678
4771
  * @returns hashed signature
4679
4772
  */
4680
4773
  sign(data) {
4681
- const signature = secp256k1.sign(getBytesCopy16(data), getBytesCopy16(this.privateKey));
4774
+ const signature = secp256k1.sign(arrayify15(data), arrayify15(this.privateKey));
4682
4775
  const r = toBytes(`0x${signature.r.toString(16)}`, 32);
4683
4776
  const s = toBytes(`0x${signature.s.toString(16)}`, 32);
4684
4777
  s[0] |= (signature.recovery || 0) << 7;
4685
- return concat3([r, s]);
4778
+ return hexlify13(concat3([r, s]));
4686
4779
  }
4687
4780
  /**
4688
4781
  * Add point on the current elliptic curve
@@ -4691,8 +4784,8 @@ var Signer = class {
4691
4784
  * @returns compressed point on the curve
4692
4785
  */
4693
4786
  addPoint(point) {
4694
- const p0 = secp256k1.ProjectivePoint.fromHex(getBytesCopy16(this.compressedPublicKey));
4695
- const p1 = secp256k1.ProjectivePoint.fromHex(getBytesCopy16(point));
4787
+ const p0 = secp256k1.ProjectivePoint.fromHex(arrayify15(this.compressedPublicKey));
4788
+ const p1 = secp256k1.ProjectivePoint.fromHex(arrayify15(point));
4696
4789
  const result = p0.add(p1);
4697
4790
  return `0x${result.toHex(true)}`;
4698
4791
  }
@@ -4704,7 +4797,7 @@ var Signer = class {
4704
4797
  * @returns public key from signature from the
4705
4798
  */
4706
4799
  static recoverPublicKey(data, signature) {
4707
- const signedMessageBytes = getBytesCopy16(signature);
4800
+ const signedMessageBytes = arrayify15(signature);
4708
4801
  const r = signedMessageBytes.slice(0, 32);
4709
4802
  const s = signedMessageBytes.slice(32, 64);
4710
4803
  const recoveryParam = (s[0] & 128) >> 7;
@@ -4712,7 +4805,7 @@ var Signer = class {
4712
4805
  const sig = new secp256k1.Signature(BigInt(hexlify13(r)), BigInt(hexlify13(s))).addRecoveryBit(
4713
4806
  recoveryParam
4714
4807
  );
4715
- const publicKey = sig.recoverPublicKey(getBytesCopy16(data)).toRawBytes(false).slice(1);
4808
+ const publicKey = sig.recoverPublicKey(arrayify15(data)).toRawBytes(false).slice(1);
4716
4809
  return hexlify13(publicKey);
4717
4810
  }
4718
4811
  /**
@@ -4732,7 +4825,7 @@ var Signer = class {
4732
4825
  * @returns random 32-byte hashed
4733
4826
  */
4734
4827
  static generatePrivateKey(entropy) {
4735
- return entropy ? hash(concat3([randomBytes(32), getBytesCopy16(entropy)])) : randomBytes(32);
4828
+ return entropy ? hash(concat3([randomBytes(32), arrayify15(entropy)])) : randomBytes(32);
4736
4829
  }
4737
4830
  /**
4738
4831
  * Extended publicKey from a compact publicKey
@@ -4741,7 +4834,7 @@ var Signer = class {
4741
4834
  * @returns extended publicKey
4742
4835
  */
4743
4836
  static extendPublicKey(publicKey) {
4744
- const point = secp256k1.ProjectivePoint.fromHex(getBytesCopy16(publicKey));
4837
+ const point = secp256k1.ProjectivePoint.fromHex(arrayify15(publicKey));
4745
4838
  return hexlify13(point.toRawBytes(false).slice(1));
4746
4839
  }
4747
4840
  };
@@ -4758,7 +4851,7 @@ import {
4758
4851
  encryptJsonWalletData
4759
4852
  } from "@fuel-ts/crypto";
4760
4853
  import { ErrorCode as ErrorCode14, FuelError as FuelError15 } from "@fuel-ts/errors";
4761
- import { hexlify as hexlify14 } from "ethers";
4854
+ import { hexlify as hexlify14 } from "@fuel-ts/utils";
4762
4855
  import { v4 as uuidv4 } from "uuid";
4763
4856
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
4764
4857
  var DEFAULT_KDF_PARAMS_R = 8;
@@ -4886,7 +4979,7 @@ var BaseWalletUnlocked = class extends Account {
4886
4979
  */
4887
4980
  async signMessage(message) {
4888
4981
  const signedMessage = await this.signer().sign(hashMessage(message));
4889
- return signedMessage;
4982
+ return hexlify15(signedMessage);
4890
4983
  }
4891
4984
  /**
4892
4985
  * Signs a transaction with the wallet's private key.
@@ -4899,7 +4992,7 @@ var BaseWalletUnlocked = class extends Account {
4899
4992
  const chainId = this.provider.getChain().consensusParameters.chainId.toNumber();
4900
4993
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
4901
4994
  const signature = await this.signer().sign(hashedTransaction);
4902
- return signature;
4995
+ return hexlify15(signature);
4903
4996
  }
4904
4997
  /**
4905
4998
  * Populates a transaction with the witnesses signature.
@@ -4919,12 +5012,14 @@ var BaseWalletUnlocked = class extends Account {
4919
5012
  * @param transactionRequestLike - The transaction request to send.
4920
5013
  * @returns A promise that resolves to the TransactionResponse object.
4921
5014
  */
4922
- async sendTransaction(transactionRequestLike, options) {
5015
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
4923
5016
  const transactionRequest = transactionRequestify(transactionRequestLike);
4924
- await this.provider.estimateTxDependencies(transactionRequest);
5017
+ if (estimateTxDependencies) {
5018
+ await this.provider.estimateTxDependencies(transactionRequest);
5019
+ }
4925
5020
  return this.provider.sendTransaction(
4926
5021
  await this.populateTransactionWitnessesSignature(transactionRequest),
4927
- { ...options, estimateTxDependencies: false }
5022
+ { awaitExecution, estimateTxDependencies: false }
4928
5023
  );
4929
5024
  }
4930
5025
  /**
@@ -4933,9 +5028,11 @@ var BaseWalletUnlocked = class extends Account {
4933
5028
  * @param transactionRequestLike - The transaction request to simulate.
4934
5029
  * @returns A promise that resolves to the CallResult object.
4935
5030
  */
4936
- async simulateTransaction(transactionRequestLike) {
5031
+ async simulateTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
4937
5032
  const transactionRequest = transactionRequestify(transactionRequestLike);
4938
- await this.provider.estimateTxDependencies(transactionRequest);
5033
+ if (estimateTxDependencies) {
5034
+ await this.provider.estimateTxDependencies(transactionRequest);
5035
+ }
4939
5036
  return this.provider.call(
4940
5037
  await this.populateTransactionWitnessesSignature(transactionRequest),
4941
5038
  {
@@ -4956,32 +5053,22 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
4956
5053
  // src/hdwallet/hdwallet.ts
4957
5054
  import { ErrorCode as ErrorCode17, FuelError as FuelError18 } from "@fuel-ts/errors";
4958
5055
  import { bn as bn17, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5056
+ import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
4959
5057
  import {
4960
5058
  toBeHex,
4961
5059
  dataSlice as dataSlice2,
4962
- hexlify as hexlify16,
4963
5060
  encodeBase58 as encodeBase582,
4964
5061
  decodeBase58,
4965
5062
  sha256 as sha2564,
4966
5063
  computeHmac as computeHmac2,
4967
- ripemd160,
4968
- getBytesCopy as getBytesCopy19,
4969
- concat as concat5
5064
+ ripemd160
4970
5065
  } from "ethers";
4971
5066
 
4972
5067
  // src/mnemonic/mnemonic.ts
4973
5068
  import { randomBytes as randomBytes3 } from "@fuel-ts/crypto";
4974
5069
  import { ErrorCode as ErrorCode16, FuelError as FuelError17 } from "@fuel-ts/errors";
4975
- import {
4976
- concat as concat4,
4977
- hexlify as hexlify15,
4978
- dataSlice,
4979
- pbkdf2,
4980
- sha256 as sha2563,
4981
- computeHmac,
4982
- encodeBase58,
4983
- getBytesCopy as getBytesCopy18
4984
- } from "ethers";
5070
+ import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4 } from "@fuel-ts/utils";
5071
+ import { dataSlice, pbkdf2, sha256 as sha2563, computeHmac, encodeBase58 } from "ethers";
4985
5072
 
4986
5073
  // src/wordlists/words/english.ts
4987
5074
  var english = [
@@ -7037,7 +7124,8 @@ var english = [
7037
7124
 
7038
7125
  // src/mnemonic/utils.ts
7039
7126
  import { ErrorCode as ErrorCode15, FuelError as FuelError16 } from "@fuel-ts/errors";
7040
- import { getBytesCopy as getBytesCopy17, sha256 as sha2562 } from "ethers";
7127
+ import { arrayify as arrayify16 } from "@fuel-ts/utils";
7128
+ import { sha256 as sha2562 } from "ethers";
7041
7129
  function toUtf8Bytes(stri) {
7042
7130
  const str = stri.normalize("NFKD");
7043
7131
  const result = [];
@@ -7104,14 +7192,14 @@ function entropyToMnemonicIndices(entropy) {
7104
7192
  }
7105
7193
  }
7106
7194
  const checksumBits = entropy.length / 4;
7107
- const checksum = getBytesCopy17(sha2562(entropy))[0] & getUpperMask(checksumBits);
7195
+ const checksum = arrayify16(sha2562(entropy))[0] & getUpperMask(checksumBits);
7108
7196
  indices[indices.length - 1] <<= checksumBits;
7109
7197
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
7110
7198
  return indices;
7111
7199
  }
7112
7200
  function mnemonicWordsToEntropy(words, wordlist) {
7113
7201
  const size = Math.ceil(11 * words.length / 8);
7114
- const entropy = getBytesCopy17(new Uint8Array(size));
7202
+ const entropy = arrayify16(new Uint8Array(size));
7115
7203
  let offset = 0;
7116
7204
  for (let i = 0; i < words.length; i += 1) {
7117
7205
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
@@ -7131,7 +7219,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
7131
7219
  const entropyBits = 32 * words.length / 3;
7132
7220
  const checksumBits = words.length / 3;
7133
7221
  const checksumMask = getUpperMask(checksumBits);
7134
- const checksum = getBytesCopy17(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7222
+ const checksum = arrayify16(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7135
7223
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
7136
7224
  throw new FuelError16(
7137
7225
  ErrorCode15.INVALID_CHECKSUM,
@@ -7206,7 +7294,7 @@ var Mnemonic = class {
7206
7294
  static mnemonicToEntropy(phrase, wordlist = english) {
7207
7295
  const words = getWords(phrase);
7208
7296
  assertMnemonic(words);
7209
- return hexlify15(mnemonicWordsToEntropy(words, wordlist));
7297
+ return hexlify16(mnemonicWordsToEntropy(words, wordlist));
7210
7298
  }
7211
7299
  /**
7212
7300
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -7214,7 +7302,7 @@ var Mnemonic = class {
7214
7302
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7215
7303
  */
7216
7304
  static entropyToMnemonic(entropy, wordlist = english) {
7217
- const entropyBytes = getBytesCopy18(entropy);
7305
+ const entropyBytes = arrayify17(entropy);
7218
7306
  assertWordList(wordlist);
7219
7307
  assertEntropy(entropyBytes);
7220
7308
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -7283,14 +7371,14 @@ var Mnemonic = class {
7283
7371
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7284
7372
  */
7285
7373
  static masterKeysFromSeed(seed) {
7286
- const seedArray = getBytesCopy18(seed);
7374
+ const seedArray = arrayify17(seed);
7287
7375
  if (seedArray.length < 16 || seedArray.length > 64) {
7288
7376
  throw new FuelError17(
7289
7377
  ErrorCode16.INVALID_SEED,
7290
7378
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
7291
7379
  );
7292
7380
  }
7293
- return getBytesCopy18(computeHmac("sha512", MasterSecret, seedArray));
7381
+ return arrayify17(computeHmac("sha512", MasterSecret, seedArray));
7294
7382
  }
7295
7383
  /**
7296
7384
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -7301,7 +7389,7 @@ var Mnemonic = class {
7301
7389
  */
7302
7390
  static seedToExtendedKey(seed, testnet = false) {
7303
7391
  const masterKey = Mnemonic.masterKeysFromSeed(seed);
7304
- const prefix = getBytesCopy18(testnet ? TestnetPRV : MainnetPRV);
7392
+ const prefix = arrayify17(testnet ? TestnetPRV : MainnetPRV);
7305
7393
  const depth = "0x00";
7306
7394
  const fingerprint = "0x00000000";
7307
7395
  const index = "0x00000000";
@@ -7331,7 +7419,7 @@ var Mnemonic = class {
7331
7419
  * @returns A randomly generated mnemonic
7332
7420
  */
7333
7421
  static generate(size = 32, extraEntropy = "") {
7334
- const entropy = extraEntropy ? sha2563(concat4([randomBytes3(size), getBytesCopy18(extraEntropy)])) : randomBytes3(size);
7422
+ const entropy = extraEntropy ? sha2563(concat4([randomBytes3(size), arrayify17(extraEntropy)])) : randomBytes3(size);
7335
7423
  return Mnemonic.entropyToMnemonic(entropy);
7336
7424
  }
7337
7425
  };
@@ -7339,10 +7427,10 @@ var mnemonic_default = Mnemonic;
7339
7427
 
7340
7428
  // src/hdwallet/hdwallet.ts
7341
7429
  var HARDENED_INDEX = 2147483648;
7342
- var MainnetPRV2 = hexlify16("0x0488ade4");
7343
- var MainnetPUB = hexlify16("0x0488b21e");
7344
- var TestnetPRV2 = hexlify16("0x04358394");
7345
- var TestnetPUB = hexlify16("0x043587cf");
7430
+ var MainnetPRV2 = hexlify17("0x0488ade4");
7431
+ var MainnetPUB = hexlify17("0x0488b21e");
7432
+ var TestnetPRV2 = hexlify17("0x04358394");
7433
+ var TestnetPUB = hexlify17("0x043587cf");
7346
7434
  function base58check(data) {
7347
7435
  return encodeBase582(concat5([data, dataSlice2(sha2564(sha2564(data)), 0, 4)]));
7348
7436
  }
@@ -7353,11 +7441,11 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
7353
7441
  return testnet ? TestnetPRV2 : MainnetPRV2;
7354
7442
  }
7355
7443
  function isPublicExtendedKey(extendedKey) {
7356
- return [MainnetPUB, TestnetPUB].includes(hexlify16(extendedKey.slice(0, 4)));
7444
+ return [MainnetPUB, TestnetPUB].includes(hexlify17(extendedKey.slice(0, 4)));
7357
7445
  }
7358
7446
  function isValidExtendedKey(extendedKey) {
7359
7447
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
7360
- hexlify16(extendedKey.slice(0, 4))
7448
+ hexlify17(extendedKey.slice(0, 4))
7361
7449
  );
7362
7450
  }
7363
7451
  function parsePath(path2, depth = 0) {
@@ -7375,8 +7463,8 @@ function parsePath(path2, depth = 0) {
7375
7463
  var HDWallet = class {
7376
7464
  depth = 0;
7377
7465
  index = 0;
7378
- fingerprint = hexlify16("0x00000000");
7379
- parentFingerprint = hexlify16("0x00000000");
7466
+ fingerprint = hexlify17("0x00000000");
7467
+ parentFingerprint = hexlify17("0x00000000");
7380
7468
  privateKey;
7381
7469
  publicKey;
7382
7470
  chainCode;
@@ -7388,8 +7476,8 @@ var HDWallet = class {
7388
7476
  constructor(config) {
7389
7477
  if (config.privateKey) {
7390
7478
  const signer = new Signer(config.privateKey);
7391
- this.publicKey = hexlify16(signer.compressedPublicKey);
7392
- this.privateKey = hexlify16(config.privateKey);
7479
+ this.publicKey = hexlify17(signer.compressedPublicKey);
7480
+ this.privateKey = hexlify17(config.privateKey);
7393
7481
  } else {
7394
7482
  if (!config.publicKey) {
7395
7483
  throw new FuelError18(
@@ -7397,7 +7485,7 @@ var HDWallet = class {
7397
7485
  "Both public and private Key cannot be missing. At least one should be provided."
7398
7486
  );
7399
7487
  }
7400
- this.publicKey = hexlify16(config.publicKey);
7488
+ this.publicKey = hexlify17(config.publicKey);
7401
7489
  }
7402
7490
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
7403
7491
  this.fingerprint = dataSlice2(ripemd160(sha2564(this.publicKey)), 0, 4);
@@ -7416,9 +7504,9 @@ var HDWallet = class {
7416
7504
  * @returns A new instance of HDWallet on the derived index
7417
7505
  */
7418
7506
  deriveIndex(index) {
7419
- const privateKey = this.privateKey && getBytesCopy19(this.privateKey);
7420
- const publicKey = getBytesCopy19(this.publicKey);
7421
- const chainCode = getBytesCopy19(this.chainCode);
7507
+ const privateKey = this.privateKey && arrayify18(this.privateKey);
7508
+ const publicKey = arrayify18(this.publicKey);
7509
+ const chainCode = arrayify18(this.chainCode);
7422
7510
  const data = new Uint8Array(37);
7423
7511
  if (index & HARDENED_INDEX) {
7424
7512
  if (!privateKey) {
@@ -7429,10 +7517,10 @@ var HDWallet = class {
7429
7517
  }
7430
7518
  data.set(privateKey, 1);
7431
7519
  } else {
7432
- data.set(getBytesCopy19(this.publicKey));
7520
+ data.set(arrayify18(this.publicKey));
7433
7521
  }
7434
7522
  data.set(toBytes2(index, 4), 33);
7435
- const bytes = getBytesCopy19(computeHmac2("sha512", chainCode, data));
7523
+ const bytes = arrayify18(computeHmac2("sha512", chainCode, data));
7436
7524
  const IL = bytes.slice(0, 32);
7437
7525
  const IR = bytes.slice(32);
7438
7526
  if (privateKey) {
@@ -7446,7 +7534,7 @@ var HDWallet = class {
7446
7534
  parentFingerprint: this.fingerprint
7447
7535
  });
7448
7536
  }
7449
- const signer = new Signer(hexlify16(IL));
7537
+ const signer = new Signer(hexlify17(IL));
7450
7538
  const Ki = signer.addPoint(publicKey);
7451
7539
  return new HDWallet({
7452
7540
  publicKey: Ki,
@@ -7481,14 +7569,12 @@ var HDWallet = class {
7481
7569
  );
7482
7570
  }
7483
7571
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
7484
- const depth = hexlify16(Uint8Array.from([this.depth]));
7572
+ const depth = hexlify17(Uint8Array.from([this.depth]));
7485
7573
  const parentFingerprint = this.parentFingerprint;
7486
7574
  const index = toHex(this.index, 4);
7487
7575
  const chainCode = this.chainCode;
7488
7576
  const key = this.privateKey != null && !isPublic ? concat5(["0x00", this.privateKey]) : this.publicKey;
7489
- const extendedKey = getBytesCopy19(
7490
- concat5([prefix, depth, parentFingerprint, index, chainCode, key])
7491
- );
7577
+ const extendedKey = arrayify18(concat5([prefix, depth, parentFingerprint, index, chainCode, key]));
7492
7578
  return base58check(extendedKey);
7493
7579
  }
7494
7580
  /**
@@ -7500,13 +7586,13 @@ var HDWallet = class {
7500
7586
  static fromSeed(seed) {
7501
7587
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
7502
7588
  return new HDWallet({
7503
- chainCode: getBytesCopy19(masterKey.slice(32)),
7504
- privateKey: getBytesCopy19(masterKey.slice(0, 32))
7589
+ chainCode: arrayify18(masterKey.slice(32)),
7590
+ privateKey: arrayify18(masterKey.slice(0, 32))
7505
7591
  });
7506
7592
  }
7507
7593
  static fromExtendedKey(extendedKey) {
7508
7594
  const decoded = toBeHex(decodeBase58(extendedKey));
7509
- const bytes = getBytesCopy19(decoded);
7595
+ const bytes = arrayify18(decoded);
7510
7596
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
7511
7597
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
7512
7598
  throw new FuelError18(ErrorCode17.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
@@ -7515,9 +7601,9 @@ var HDWallet = class {
7515
7601
  throw new FuelError18(ErrorCode17.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
7516
7602
  }
7517
7603
  const depth = bytes[4];
7518
- const parentFingerprint = hexlify16(bytes.slice(5, 9));
7519
- const index = parseInt(hexlify16(bytes.slice(9, 13)).substring(2), 16);
7520
- const chainCode = hexlify16(bytes.slice(13, 45));
7604
+ const parentFingerprint = hexlify17(bytes.slice(5, 9));
7605
+ const index = parseInt(hexlify17(bytes.slice(9, 13)).substring(2), 16);
7606
+ const chainCode = hexlify17(bytes.slice(13, 45));
7521
7607
  const key = bytes.slice(45, 78);
7522
7608
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
7523
7609
  throw new FuelError18(
@@ -7733,11 +7819,10 @@ var generateTestWallet = async (provider, quantities) => {
7733
7819
  // src/test-utils/launchNode.ts
7734
7820
  import { BaseAssetId as BaseAssetId4 } from "@fuel-ts/address/configs";
7735
7821
  import { toHex as toHex2 } from "@fuel-ts/math";
7736
- import { defaultChainConfig, defaultConsensusKey } from "@fuel-ts/utils";
7822
+ import { defaultChainConfig, defaultConsensusKey, hexlify as hexlify18 } from "@fuel-ts/utils";
7737
7823
  import { findBinPath } from "@fuel-ts/utils/cli-utils";
7738
7824
  import { spawn } from "child_process";
7739
7825
  import { randomUUID } from "crypto";
7740
- import { hexlify as hexlify17 } from "ethers";
7741
7826
  import { existsSync, mkdirSync, rmSync, writeFileSync } from "fs";
7742
7827
  import os from "os";
7743
7828
  import path from "path";
@@ -7822,7 +7907,7 @@ var launchNode = async ({
7822
7907
  if (!process.env.GENESIS_SECRET) {
7823
7908
  const pk = Signer.generatePrivateKey();
7824
7909
  const signer = new Signer(pk);
7825
- process.env.GENESIS_SECRET = hexlify17(pk);
7910
+ process.env.GENESIS_SECRET = hexlify18(pk);
7826
7911
  chainConfig = {
7827
7912
  ...defaultChainConfig,
7828
7913
  initial_state: {