@fuel-ts/account 0.74.0 → 0.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (112) hide show
  1. package/dist/account.d.ts +4 -5
  2. package/dist/account.d.ts.map +1 -1
  3. package/dist/connectors/fuel-connector.d.ts +2 -1
  4. package/dist/connectors/fuel-connector.d.ts.map +1 -1
  5. package/dist/connectors/fuel.d.ts +1 -2
  6. package/dist/connectors/fuel.d.ts.map +1 -1
  7. package/dist/connectors/types/data-type.d.ts +0 -8
  8. package/dist/connectors/types/data-type.d.ts.map +1 -1
  9. package/dist/connectors/types/events.d.ts +2 -36
  10. package/dist/connectors/types/events.d.ts.map +1 -1
  11. package/dist/connectors/types/index.d.ts +0 -2
  12. package/dist/connectors/types/index.d.ts.map +1 -1
  13. package/dist/hdwallet/hdwallet.d.ts +1 -1
  14. package/dist/hdwallet/hdwallet.d.ts.map +1 -1
  15. package/dist/index.global.js +1554 -2272
  16. package/dist/index.global.js.map +1 -1
  17. package/dist/index.js +576 -451
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +495 -385
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/mnemonic/mnemonic.d.ts +1 -1
  22. package/dist/mnemonic/mnemonic.d.ts.map +1 -1
  23. package/dist/mnemonic/utils.d.ts +1 -1
  24. package/dist/mnemonic/utils.d.ts.map +1 -1
  25. package/dist/predicate/utils/getPredicateRoot.d.ts +1 -1
  26. package/dist/predicate/utils/getPredicateRoot.d.ts.map +1 -1
  27. package/dist/providers/__generated__/operations.d.ts +38 -38
  28. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  29. package/dist/providers/assets/index.d.ts +4 -0
  30. package/dist/providers/assets/index.d.ts.map +1 -0
  31. package/dist/providers/assets/types.d.ts +36 -0
  32. package/dist/providers/assets/types.d.ts.map +1 -0
  33. package/dist/providers/assets/utils/index.d.ts +4 -0
  34. package/dist/providers/assets/utils/index.d.ts.map +1 -0
  35. package/dist/providers/assets/utils/network.d.ts +33 -0
  36. package/dist/providers/assets/utils/network.d.ts.map +1 -0
  37. package/dist/providers/assets/utils/resolveIconPaths.d.ts +14 -0
  38. package/dist/providers/assets/utils/resolveIconPaths.d.ts.map +1 -0
  39. package/dist/providers/assets/utils/url.d.ts +2 -0
  40. package/dist/providers/assets/utils/url.d.ts.map +1 -0
  41. package/dist/providers/chains.d.ts +11 -0
  42. package/dist/providers/chains.d.ts.map +1 -0
  43. package/dist/providers/coin-quantity.d.ts +1 -1
  44. package/dist/providers/coin-quantity.d.ts.map +1 -1
  45. package/dist/providers/fuel-graphql-subscriber.d.ts +13 -3
  46. package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
  47. package/dist/providers/index.d.ts +2 -0
  48. package/dist/providers/index.d.ts.map +1 -1
  49. package/dist/providers/memory-cache.d.ts +1 -1
  50. package/dist/providers/memory-cache.d.ts.map +1 -1
  51. package/dist/providers/message.d.ts +1 -2
  52. package/dist/providers/message.d.ts.map +1 -1
  53. package/dist/providers/provider.d.ts +18 -8
  54. package/dist/providers/provider.d.ts.map +1 -1
  55. package/dist/providers/resource.d.ts +1 -1
  56. package/dist/providers/resource.d.ts.map +1 -1
  57. package/dist/providers/transaction-request/create-transaction-request.d.ts +1 -1
  58. package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
  59. package/dist/providers/transaction-request/hash-transaction.d.ts.map +1 -1
  60. package/dist/providers/transaction-request/input.d.ts +1 -1
  61. package/dist/providers/transaction-request/input.d.ts.map +1 -1
  62. package/dist/providers/transaction-request/output.d.ts +1 -1
  63. package/dist/providers/transaction-request/output.d.ts.map +1 -1
  64. package/dist/providers/transaction-request/script-transaction-request.d.ts +1 -2
  65. package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
  66. package/dist/providers/transaction-request/storage-slot.d.ts +1 -1
  67. package/dist/providers/transaction-request/storage-slot.d.ts.map +1 -1
  68. package/dist/providers/transaction-request/transaction-request.d.ts +2 -10
  69. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  70. package/dist/providers/transaction-request/witness.d.ts +1 -1
  71. package/dist/providers/transaction-request/witness.d.ts.map +1 -1
  72. package/dist/providers/transaction-response/getDecodedLogs.d.ts.map +1 -1
  73. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
  74. package/dist/providers/transaction-summary/index.d.ts +0 -1
  75. package/dist/providers/transaction-summary/index.d.ts.map +1 -1
  76. package/dist/providers/transaction-summary/operations.d.ts +0 -2
  77. package/dist/providers/transaction-summary/operations.d.ts.map +1 -1
  78. package/dist/providers/transaction-summary/output.d.ts +2 -2
  79. package/dist/providers/transaction-summary/output.d.ts.map +1 -1
  80. package/dist/providers/transaction-summary/types.d.ts +0 -1
  81. package/dist/providers/transaction-summary/types.d.ts.map +1 -1
  82. package/dist/providers/utils/gas.d.ts.map +1 -1
  83. package/dist/providers/utils/index.d.ts +0 -1
  84. package/dist/providers/utils/index.d.ts.map +1 -1
  85. package/dist/signer/signer.d.ts +1 -1
  86. package/dist/signer/signer.d.ts.map +1 -1
  87. package/dist/test-utils/launchNode.d.ts.map +1 -1
  88. package/dist/test-utils.global.js +4098 -4882
  89. package/dist/test-utils.global.js.map +1 -1
  90. package/dist/test-utils.js +466 -416
  91. package/dist/test-utils.js.map +1 -1
  92. package/dist/test-utils.mjs +390 -352
  93. package/dist/test-utils.mjs.map +1 -1
  94. package/dist/utils/formatTransferToContractScriptData.d.ts +1 -2
  95. package/dist/utils/formatTransferToContractScriptData.d.ts.map +1 -1
  96. package/dist/wallet/base-wallet-unlocked.d.ts +4 -4
  97. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  98. package/dist/wallet/wallet.d.ts +1 -2
  99. package/dist/wallet/wallet.d.ts.map +1 -1
  100. package/dist/wallet/wallets.d.ts +1 -1
  101. package/dist/wallet/wallets.d.ts.map +1 -1
  102. package/package.json +16 -16
  103. package/dist/connectors/types/asset.d.ts +0 -2
  104. package/dist/connectors/types/asset.d.ts.map +0 -1
  105. package/dist/connectors/types/constants.d.ts +0 -7
  106. package/dist/connectors/types/constants.d.ts.map +0 -1
  107. package/dist/connectors/types/message.d.ts +0 -15
  108. package/dist/connectors/types/message.d.ts.map +0 -1
  109. package/dist/providers/transaction-summary/date.d.ts +0 -3
  110. package/dist/providers/transaction-summary/date.d.ts.map +0 -1
  111. package/dist/providers/utils/time.d.ts +0 -40
  112. package/dist/providers/utils/time.d.ts.map +0 -1
package/dist/index.mjs CHANGED
@@ -33,12 +33,12 @@ import { BaseAssetId as BaseAssetId3 } from "@fuel-ts/address/configs";
33
33
  import { ErrorCode as ErrorCode13, FuelError as FuelError14 } from "@fuel-ts/errors";
34
34
  import { AbstractAccount } from "@fuel-ts/interfaces";
35
35
  import { bn as bn16 } from "@fuel-ts/math";
36
- import { getBytesCopy as getBytesCopy15 } from "ethers";
36
+ import { arrayify as arrayify14 } from "@fuel-ts/utils";
37
37
 
38
38
  // src/providers/coin-quantity.ts
39
39
  import { BaseAssetId } from "@fuel-ts/address/configs";
40
40
  import { bn } from "@fuel-ts/math";
41
- import { hexlify } from "ethers";
41
+ import { hexlify } from "@fuel-ts/utils";
42
42
  var coinQuantityfy = (coinQuantityLike) => {
43
43
  let assetId;
44
44
  let amount;
@@ -74,15 +74,17 @@ var addAmountToAsset = (params) => {
74
74
  // src/providers/provider.ts
75
75
  import { Address as Address2 } from "@fuel-ts/address";
76
76
  import { ErrorCode as ErrorCode11, FuelError as FuelError12 } from "@fuel-ts/errors";
77
- import { bn as bn14, max } from "@fuel-ts/math";
77
+ import { BN, bn as bn14, max } from "@fuel-ts/math";
78
78
  import {
79
79
  InputType as InputType6,
80
80
  TransactionType as TransactionType8,
81
81
  InputMessageCoder,
82
82
  TransactionCoder as TransactionCoder5
83
83
  } from "@fuel-ts/transactions";
84
+ import { arrayify as arrayify11, hexlify as hexlify12, DateTime as DateTime2 } from "@fuel-ts/utils";
84
85
  import { checkFuelCoreVersionCompatibility } from "@fuel-ts/versions";
85
- import { getBytesCopy as getBytesCopy12, hexlify as hexlify12, Network } from "ethers";
86
+ import { equalBytes } from "@noble/curves/abstract/utils";
87
+ import { Network } from "ethers";
86
88
  import { GraphQLClient } from "graphql-request";
87
89
  import { clone as clone3 } from "ramda";
88
90
 
@@ -891,71 +893,67 @@ function getSdk(requester) {
891
893
  // src/providers/fuel-graphql-subscriber.ts
892
894
  import { FuelError } from "@fuel-ts/errors";
893
895
  import { print } from "graphql";
894
- var _FuelSubscriptionStream = class {
895
- readable;
896
- writable;
897
- readableStreamController;
898
- constructor() {
899
- this.readable = new ReadableStream({
900
- start: (controller) => {
901
- this.readableStreamController = controller;
902
- }
903
- });
904
- this.writable = new WritableStream({
905
- write: (bytes) => {
906
- const text = _FuelSubscriptionStream.textDecoder.decode(bytes);
907
- if (text.startsWith("data:")) {
908
- const { data, errors } = JSON.parse(text.split("data:")[1]);
909
- if (Array.isArray(errors)) {
910
- this.readableStreamController.enqueue(
911
- new FuelError(
912
- FuelError.CODES.INVALID_REQUEST,
913
- errors.map((err) => err.message).join("\n\n")
914
- )
915
- );
916
- } else {
917
- this.readableStreamController.enqueue(data);
918
- }
919
- }
896
+ var _FuelGraphqlSubscriber = class {
897
+ constructor(options) {
898
+ this.options = options;
899
+ }
900
+ stream;
901
+ async setStream() {
902
+ const { url, query, variables, fetchFn } = this.options;
903
+ const response = await fetchFn(`${url}-sub`, {
904
+ method: "POST",
905
+ body: JSON.stringify({
906
+ query: print(query),
907
+ variables
908
+ }),
909
+ headers: {
910
+ "Content-Type": "application/json",
911
+ Accept: "text/event-stream"
920
912
  }
921
913
  });
914
+ this.stream = response.body.getReader();
922
915
  }
923
- };
924
- var FuelSubscriptionStream = _FuelSubscriptionStream;
925
- __publicField(FuelSubscriptionStream, "textDecoder", new TextDecoder());
926
- async function* fuelGraphQLSubscriber({
927
- url,
928
- variables,
929
- query,
930
- fetchFn
931
- }) {
932
- const response = await fetchFn(`${url}-sub`, {
933
- method: "POST",
934
- body: JSON.stringify({
935
- query: print(query),
936
- variables
937
- }),
938
- headers: {
939
- "Content-Type": "application/json",
940
- Accept: "text/event-stream"
941
- }
942
- });
943
- const subscriptionStreamReader = response.body.pipeThrough(new FuelSubscriptionStream()).getReader();
944
- while (true) {
945
- const { value, done } = await subscriptionStreamReader.read();
946
- if (value instanceof FuelError) {
947
- throw value;
916
+ async next() {
917
+ if (!this.stream) {
918
+ await this.setStream();
948
919
  }
949
- yield value;
950
- if (done) {
951
- break;
920
+ while (true) {
921
+ const { value, done } = await this.stream.read();
922
+ if (done) {
923
+ return { value, done };
924
+ }
925
+ const text = _FuelGraphqlSubscriber.textDecoder.decode(value);
926
+ if (!text.startsWith("data:")) {
927
+ continue;
928
+ }
929
+ const { data, errors } = JSON.parse(text.split("data:")[1]);
930
+ if (Array.isArray(errors)) {
931
+ throw new FuelError(
932
+ FuelError.CODES.INVALID_REQUEST,
933
+ errors.map((err) => err.message).join("\n\n")
934
+ );
935
+ }
936
+ return { value: data, done: false };
952
937
  }
953
938
  }
954
- }
939
+ /**
940
+ * Gets called when `break` is called in a `for-await-of` loop.
941
+ */
942
+ async return() {
943
+ await this.stream.cancel();
944
+ this.stream.releaseLock();
945
+ return { done: true, value: void 0 };
946
+ }
947
+ [Symbol.asyncIterator]() {
948
+ return this;
949
+ }
950
+ };
951
+ var FuelGraphqlSubscriber = _FuelGraphqlSubscriber;
952
+ __publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
955
953
 
956
954
  // src/providers/memory-cache.ts
957
955
  import { ErrorCode, FuelError as FuelError2 } from "@fuel-ts/errors";
958
- import { hexlify as hexlify2 } from "ethers";
956
+ import { hexlify as hexlify2 } from "@fuel-ts/utils";
959
957
  var cache = {};
960
958
  var DEFAULT_TTL_IN_MS = 30 * 1e3;
961
959
  var MemoryCache = class {
@@ -1017,23 +1015,23 @@ import { ZeroBytes32 } from "@fuel-ts/address/configs";
1017
1015
  import { ErrorCode as ErrorCode2, FuelError as FuelError3 } from "@fuel-ts/errors";
1018
1016
  import { bn as bn2, toNumber } from "@fuel-ts/math";
1019
1017
  import { InputType } from "@fuel-ts/transactions";
1020
- import { getBytesCopy, hexlify as hexlify3 } from "ethers";
1018
+ import { arrayify, hexlify as hexlify3 } from "@fuel-ts/utils";
1021
1019
  var inputify = (value) => {
1022
1020
  const { type } = value;
1023
1021
  switch (value.type) {
1024
1022
  case InputType.Coin: {
1025
- const predicate = getBytesCopy(value.predicate ?? "0x");
1026
- const predicateData = getBytesCopy(value.predicateData ?? "0x");
1023
+ const predicate = arrayify(value.predicate ?? "0x");
1024
+ const predicateData = arrayify(value.predicateData ?? "0x");
1027
1025
  return {
1028
1026
  type: InputType.Coin,
1029
- txID: hexlify3(getBytesCopy(value.id).slice(0, 32)),
1030
- outputIndex: getBytesCopy(value.id)[32],
1027
+ txID: hexlify3(arrayify(value.id).slice(0, 32)),
1028
+ outputIndex: arrayify(value.id)[32],
1031
1029
  owner: hexlify3(value.owner),
1032
1030
  amount: bn2(value.amount),
1033
1031
  assetId: hexlify3(value.assetId),
1034
1032
  txPointer: {
1035
- blockHeight: toNumber(getBytesCopy(value.txPointer).slice(0, 8)),
1036
- txIndex: toNumber(getBytesCopy(value.txPointer).slice(8, 16))
1033
+ blockHeight: toNumber(arrayify(value.txPointer).slice(0, 8)),
1034
+ txIndex: toNumber(arrayify(value.txPointer).slice(8, 16))
1037
1035
  },
1038
1036
  witnessIndex: value.witnessIndex,
1039
1037
  maturity: value.maturity ?? 0,
@@ -1052,16 +1050,16 @@ var inputify = (value) => {
1052
1050
  balanceRoot: ZeroBytes32,
1053
1051
  stateRoot: ZeroBytes32,
1054
1052
  txPointer: {
1055
- blockHeight: toNumber(getBytesCopy(value.txPointer).slice(0, 8)),
1056
- txIndex: toNumber(getBytesCopy(value.txPointer).slice(8, 16))
1053
+ blockHeight: toNumber(arrayify(value.txPointer).slice(0, 8)),
1054
+ txIndex: toNumber(arrayify(value.txPointer).slice(8, 16))
1057
1055
  },
1058
1056
  contractID: hexlify3(value.contractId)
1059
1057
  };
1060
1058
  }
1061
1059
  case InputType.Message: {
1062
- const predicate = getBytesCopy(value.predicate ?? "0x");
1063
- const predicateData = getBytesCopy(value.predicateData ?? "0x");
1064
- const data = getBytesCopy(value.data ?? "0x");
1060
+ const predicate = arrayify(value.predicate ?? "0x");
1061
+ const predicateData = arrayify(value.predicateData ?? "0x");
1062
+ const data = arrayify(value.data ?? "0x");
1065
1063
  return {
1066
1064
  type: InputType.Message,
1067
1065
  sender: hexlify3(value.sender),
@@ -1092,7 +1090,7 @@ import { ZeroBytes32 as ZeroBytes322 } from "@fuel-ts/address/configs";
1092
1090
  import { ErrorCode as ErrorCode3, FuelError as FuelError4 } from "@fuel-ts/errors";
1093
1091
  import { bn as bn3 } from "@fuel-ts/math";
1094
1092
  import { OutputType } from "@fuel-ts/transactions";
1095
- import { hexlify as hexlify4 } from "ethers";
1093
+ import { hexlify as hexlify4 } from "@fuel-ts/utils";
1096
1094
  var outputify = (value) => {
1097
1095
  const { type } = value;
1098
1096
  switch (type) {
@@ -1155,7 +1153,7 @@ import {
1155
1153
  OutputType as OutputType2,
1156
1154
  TransactionType
1157
1155
  } from "@fuel-ts/transactions";
1158
- import { concat, getBytesCopy as getBytesCopy5, hexlify as hexlify7 } from "ethers";
1156
+ import { concat, hexlify as hexlify7 } from "@fuel-ts/utils";
1159
1157
 
1160
1158
  // src/providers/resource.ts
1161
1159
  var isRawCoin = (resource) => "utxoId" in resource;
@@ -1174,7 +1172,7 @@ import {
1174
1172
  ReceiptType
1175
1173
  } from "@fuel-ts/transactions";
1176
1174
  import { FAILED_TRANSFER_TO_ADDRESS_SIGNAL } from "@fuel-ts/transactions/configs";
1177
- import { getBytesCopy as getBytesCopy2 } from "ethers";
1175
+ import { arrayify as arrayify2 } from "@fuel-ts/utils";
1178
1176
  var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
1179
1177
  var doesReceiptHaveMissingContractId = (receipt) => receipt.type === ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
1180
1178
  var getReceiptsWithMissingData = (receipts) => receipts.reduce(
@@ -1318,7 +1316,7 @@ function assembleReceiptByType(receipt) {
1318
1316
  const recipient = hexOrZero(receipt.recipient);
1319
1317
  const nonce = hexOrZero(receipt.nonce);
1320
1318
  const amount = bn4(receipt.amount);
1321
- const data = receipt.data ? getBytesCopy2(receipt.data) : Uint8Array.from([]);
1319
+ const data = receipt.data ? arrayify2(receipt.data) : Uint8Array.from([]);
1322
1320
  const digest = hexOrZero(receipt.digest);
1323
1321
  const messageId = ReceiptMessageOutCoder.getMessageId({
1324
1322
  sender,
@@ -1439,7 +1437,7 @@ var buildBlockExplorerUrl = (options = {}) => {
1439
1437
  // src/providers/utils/gas.ts
1440
1438
  import { bn as bn5 } from "@fuel-ts/math";
1441
1439
  import { ReceiptType as ReceiptType2 } from "@fuel-ts/transactions";
1442
- import { getBytesCopy as getBytesCopy3 } from "ethers";
1440
+ import { arrayify as arrayify3 } from "@fuel-ts/utils";
1443
1441
  var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn5(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
1444
1442
  var getGasUsedFromReceipts = (receipts) => {
1445
1443
  const scriptResult = receipts.filter(
@@ -1464,9 +1462,7 @@ function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
1464
1462
  const totalGas = inputs.reduce((total, input) => {
1465
1463
  if ("predicate" in input && input.predicate && input.predicate !== "0x") {
1466
1464
  return total.add(
1467
- resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(
1468
- resolveGasDependentCosts(getBytesCopy3(input.predicate).length, gasCosts.contractRoot)
1469
- ).add(bn5(input.predicateGasUsed))
1465
+ resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts(arrayify3(input.predicate).length, gasCosts.contractRoot)).add(bn5(input.predicateGasUsed))
1470
1466
  );
1471
1467
  }
1472
1468
  if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
@@ -1515,7 +1511,7 @@ function calculateMetadataGasForTxScript({
1515
1511
  }
1516
1512
 
1517
1513
  // src/providers/utils/json.ts
1518
- import { hexlify as hexlify5 } from "ethers";
1514
+ import { hexlify as hexlify5 } from "@fuel-ts/utils";
1519
1515
  import { clone } from "ramda";
1520
1516
  function normalize(object) {
1521
1517
  Object.keys(object).forEach((key) => {
@@ -1554,10 +1550,6 @@ function sleep(time) {
1554
1550
  });
1555
1551
  }
1556
1552
 
1557
- // src/providers/utils/time.ts
1558
- var fromTai64ToUnix = (tai64Timestamp) => Number(BigInt(tai64Timestamp) - BigInt(2 ** 62) - BigInt(10));
1559
- var fromUnixToTai64 = (unixTimestampMs) => (BigInt(unixTimestampMs) + BigInt(2 ** 62) + BigInt(10)).toString();
1560
-
1561
1553
  // src/providers/transaction-request/errors.ts
1562
1554
  var ChangeOutputCollisionError = class extends Error {
1563
1555
  name = "ChangeOutputCollisionError";
@@ -1581,9 +1573,9 @@ var NoWitnessByOwnerError = class extends Error {
1581
1573
  };
1582
1574
 
1583
1575
  // src/providers/transaction-request/witness.ts
1584
- import { getBytesCopy as getBytesCopy4, hexlify as hexlify6 } from "ethers";
1576
+ import { arrayify as arrayify4, hexlify as hexlify6 } from "@fuel-ts/utils";
1585
1577
  var witnessify = (value) => {
1586
- const data = getBytesCopy4(value);
1578
+ const data = arrayify4(value);
1587
1579
  return {
1588
1580
  data: hexlify6(data),
1589
1581
  dataLength: data.length
@@ -2055,19 +2047,27 @@ var BaseTransactionRequest = class {
2055
2047
  toJSON() {
2056
2048
  return normalizeJSON(this);
2057
2049
  }
2058
- /**
2059
- * @hidden
2060
- *
2061
- * Determines whether the transaction has a predicate input.
2062
- *
2063
- * @returns Whether the transaction has a predicate input.
2064
- */
2065
- hasPredicateInput() {
2066
- return Boolean(
2067
- this.inputs.find(
2068
- (input) => "predicate" in input && input.predicate && input.predicate !== getBytesCopy5("0x")
2069
- )
2070
- );
2050
+ updatePredicateInputs(inputs) {
2051
+ this.inputs.forEach((i) => {
2052
+ let correspondingInput;
2053
+ switch (i.type) {
2054
+ case InputType2.Coin:
2055
+ correspondingInput = inputs.find((x) => x.type === InputType2.Coin && x.owner === i.owner);
2056
+ break;
2057
+ case InputType2.Message:
2058
+ correspondingInput = inputs.find(
2059
+ (x) => x.type === InputType2.Message && x.sender === i.sender
2060
+ );
2061
+ break;
2062
+ default:
2063
+ return;
2064
+ }
2065
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && bn6(correspondingInput.predicateGasUsed).gt(0)) {
2066
+ i.predicate = correspondingInput.predicate;
2067
+ i.predicateData = correspondingInput.predicateData;
2068
+ i.predicateGasUsed = correspondingInput.predicateGasUsed;
2069
+ }
2070
+ });
2071
2071
  }
2072
2072
  };
2073
2073
 
@@ -2075,14 +2075,15 @@ var BaseTransactionRequest = class {
2075
2075
  import { ZeroBytes32 as ZeroBytes326 } from "@fuel-ts/address/configs";
2076
2076
  import { bn as bn8 } from "@fuel-ts/math";
2077
2077
  import { TransactionType as TransactionType3, OutputType as OutputType4 } from "@fuel-ts/transactions";
2078
- import { getBytesCopy as getBytesCopy7, hexlify as hexlify9 } from "ethers";
2078
+ import { arrayify as arrayify6, hexlify as hexlify9 } from "@fuel-ts/utils";
2079
2079
 
2080
2080
  // src/providers/transaction-request/hash-transaction.ts
2081
2081
  import { ZeroBytes32 as ZeroBytes325 } from "@fuel-ts/address/configs";
2082
2082
  import { uint64ToBytesBE } from "@fuel-ts/hasher";
2083
2083
  import { bn as bn7 } from "@fuel-ts/math";
2084
2084
  import { TransactionType as TransactionType2, InputType as InputType3, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
2085
- import { concat as concat2, sha256 } from "ethers";
2085
+ import { concat as concat2 } from "@fuel-ts/utils";
2086
+ import { sha256 } from "ethers";
2086
2087
  import { clone as clone2 } from "ramda";
2087
2088
  function hashTransaction(transactionRequest, chainId) {
2088
2089
  const transaction = transactionRequest.toTransaction();
@@ -2149,10 +2150,10 @@ function hashTransaction(transactionRequest, chainId) {
2149
2150
  }
2150
2151
 
2151
2152
  // src/providers/transaction-request/storage-slot.ts
2152
- import { getBytesCopy as getBytesCopy6, hexlify as hexlify8 } from "ethers";
2153
+ import { arrayify as arrayify5, hexlify as hexlify8 } from "@fuel-ts/utils";
2153
2154
  var getStorageValue = (value) => {
2154
2155
  const v = new Uint8Array(32);
2155
- v.set(getBytesCopy6(value));
2156
+ v.set(arrayify5(value));
2156
2157
  return v;
2157
2158
  };
2158
2159
  var storageSlotify = (storageSlot) => {
@@ -2257,7 +2258,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2257
2258
  }
2258
2259
  metadataGas(gasCosts) {
2259
2260
  return calculateMetadataGasForTxCreate({
2260
- contractBytesSize: bn8(getBytesCopy7(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2261
+ contractBytesSize: bn8(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2261
2262
  gasCosts,
2262
2263
  stateRootSize: this.storageSlots.length,
2263
2264
  txBytesSize: this.byteSize()
@@ -2271,17 +2272,17 @@ import { addressify as addressify2 } from "@fuel-ts/address";
2271
2272
  import { ZeroBytes32 as ZeroBytes327 } from "@fuel-ts/address/configs";
2272
2273
  import { bn as bn9 } from "@fuel-ts/math";
2273
2274
  import { InputType as InputType4, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2274
- import { getBytesCopy as getBytesCopy9, hexlify as hexlify10 } from "ethers";
2275
+ import { arrayify as arrayify8, hexlify as hexlify10 } from "@fuel-ts/utils";
2275
2276
 
2276
2277
  // src/providers/transaction-request/scripts.ts
2277
- import { getBytesCopy as getBytesCopy8 } from "ethers";
2278
+ import { arrayify as arrayify7 } from "@fuel-ts/utils";
2278
2279
  var returnZeroScript = {
2279
2280
  /*
2280
2281
  Opcode::RET(REG_ZERO)
2281
2282
  Opcode::NOOP
2282
2283
  */
2283
2284
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
2284
- bytes: getBytesCopy8("0x24000000"),
2285
+ bytes: arrayify7("0x24000000"),
2285
2286
  encodeScriptData: () => new Uint8Array(0)
2286
2287
  };
2287
2288
  var withdrawScript = {
@@ -2295,7 +2296,7 @@ var withdrawScript = {
2295
2296
  00000000 00000000 [amount value]
2296
2297
  */
2297
2298
  // TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
2298
- bytes: getBytesCopy8("0x5040C0105D44C0064C40001124000000"),
2299
+ bytes: arrayify7("0x5040C0105D44C0064C40001124000000"),
2299
2300
  encodeScriptData: () => new Uint8Array(0)
2300
2301
  };
2301
2302
 
@@ -2323,8 +2324,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2323
2324
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2324
2325
  super(rest);
2325
2326
  this.gasLimit = bn9(gasLimit);
2326
- this.script = getBytesCopy9(script ?? returnZeroScript.bytes);
2327
- this.scriptData = getBytesCopy9(scriptData ?? returnZeroScript.encodeScriptData());
2327
+ this.script = arrayify8(script ?? returnZeroScript.bytes);
2328
+ this.scriptData = arrayify8(scriptData ?? returnZeroScript.encodeScriptData());
2328
2329
  }
2329
2330
  /**
2330
2331
  * Converts the transaction request to a `TransactionScript`.
@@ -2332,8 +2333,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2332
2333
  * @returns The transaction script object.
2333
2334
  */
2334
2335
  toTransaction() {
2335
- const script = getBytesCopy9(this.script ?? "0x");
2336
- const scriptData = getBytesCopy9(this.scriptData ?? "0x");
2336
+ const script = arrayify8(this.script ?? "0x");
2337
+ const scriptData = arrayify8(this.scriptData ?? "0x");
2337
2338
  return {
2338
2339
  type: TransactionType4.Script,
2339
2340
  scriptGasLimit: this.gasLimit,
@@ -2493,15 +2494,15 @@ var transactionRequestify = (obj) => {
2493
2494
  import { ErrorCode as ErrorCode10, FuelError as FuelError11 } from "@fuel-ts/errors";
2494
2495
  import { bn as bn13 } from "@fuel-ts/math";
2495
2496
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2496
- import { getBytesCopy as getBytesCopy11 } from "ethers";
2497
+ import { arrayify as arrayify10 } from "@fuel-ts/utils";
2497
2498
 
2498
2499
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2499
- import { hexlify as hexlify11 } from "ethers";
2500
+ import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2500
2501
 
2501
2502
  // src/providers/transaction-summary/calculate-transaction-fee.ts
2502
2503
  import { bn as bn10 } from "@fuel-ts/math";
2503
2504
  import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType6 } from "@fuel-ts/transactions";
2504
- import { getBytesCopy as getBytesCopy10 } from "ethers";
2505
+ import { arrayify as arrayify9 } from "@fuel-ts/utils";
2505
2506
  var calculateTransactionFee = (params) => {
2506
2507
  const {
2507
2508
  gasUsed,
@@ -2510,7 +2511,7 @@ var calculateTransactionFee = (params) => {
2510
2511
  } = params;
2511
2512
  const gasPerByte = bn10(feeParams.gasPerByte);
2512
2513
  const gasPriceFactor = bn10(feeParams.gasPriceFactor);
2513
- const transactionBytes = getBytesCopy10(rawPayload);
2514
+ const transactionBytes = arrayify9(rawPayload);
2514
2515
  const [transaction] = new TransactionCoder3().decode(transactionBytes, 0);
2515
2516
  if (transaction.type === TransactionType6.Mint) {
2516
2517
  return {
@@ -2525,7 +2526,7 @@ var calculateTransactionFee = (params) => {
2525
2526
  let gasLimit = bn10(0);
2526
2527
  if (type === TransactionType6.Create) {
2527
2528
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2528
- const contractBytesSize = bn10(getBytesCopy10(witnesses[bytecodeWitnessIndex].data).length);
2529
+ const contractBytesSize = bn10(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2529
2530
  metadataGas = calculateMetadataGasForTxCreate({
2530
2531
  contractBytesSize,
2531
2532
  gasCosts,
@@ -2571,15 +2572,8 @@ var calculateTransactionFee = (params) => {
2571
2572
  };
2572
2573
  };
2573
2574
 
2574
- // src/providers/transaction-summary/date.ts
2575
- import { TAI64 } from "tai64";
2576
- var fromTai64ToDate = (tai64Timestamp) => {
2577
- const timestamp = TAI64.fromString(tai64Timestamp, 10).toUnix();
2578
- return new Date(timestamp * 1e3);
2579
- };
2580
- var fromDateToTai64 = (date) => TAI64.fromUnix(Math.floor(date.getTime() / 1e3)).toString(10);
2581
-
2582
2575
  // src/providers/transaction-summary/operations.ts
2576
+ import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
2583
2577
  import { ErrorCode as ErrorCode8, FuelError as FuelError9 } from "@fuel-ts/errors";
2584
2578
  import { bn as bn12 } from "@fuel-ts/math";
2585
2579
  import { ReceiptType as ReceiptType3, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
@@ -2724,7 +2718,6 @@ var OperationName = /* @__PURE__ */ ((OperationName2) => {
2724
2718
  OperationName2["contractCreated"] = "Contract created";
2725
2719
  OperationName2["transfer"] = "Transfer asset";
2726
2720
  OperationName2["contractCall"] = "Contract call";
2727
- OperationName2["contractTransfer"] = "Contract transfer";
2728
2721
  OperationName2["receive"] = "Receive asset";
2729
2722
  OperationName2["mint"] = "Mint asset";
2730
2723
  OperationName2["predicatecall"] = "Predicate call";
@@ -2824,33 +2817,6 @@ function addOperation(operations, toAdd) {
2824
2817
  function getReceiptsTransferOut(receipts) {
2825
2818
  return getReceiptsByType(receipts, ReceiptType3.TransferOut);
2826
2819
  }
2827
- function getContractTransferOperations({ receipts }) {
2828
- const transferOutReceipts = getReceiptsTransferOut(receipts);
2829
- const contractTransferOperations = transferOutReceipts.reduce(
2830
- (prevContractTransferOps, receipt) => {
2831
- const newContractTransferOps = addOperation(prevContractTransferOps, {
2832
- name: "Contract transfer" /* contractTransfer */,
2833
- from: {
2834
- type: 0 /* contract */,
2835
- address: receipt.from
2836
- },
2837
- to: {
2838
- type: 1 /* account */,
2839
- address: receipt.to
2840
- },
2841
- assetsSent: [
2842
- {
2843
- amount: receipt.amount,
2844
- assetId: receipt.assetId
2845
- }
2846
- ]
2847
- });
2848
- return newContractTransferOps;
2849
- },
2850
- []
2851
- );
2852
- return contractTransferOperations;
2853
- }
2854
2820
  function getWithdrawFromFuelOperations({
2855
2821
  inputs,
2856
2822
  receipts
@@ -2948,70 +2914,77 @@ function getContractCallOperations({
2948
2914
  }, []);
2949
2915
  return contractCallOperations;
2950
2916
  }
2917
+ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs) {
2918
+ const { to: toAddress, assetId, amount } = receipt;
2919
+ let { from: fromAddress } = receipt;
2920
+ const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
2921
+ if (ZeroBytes328 === fromAddress) {
2922
+ const change = changeOutputs.find((output) => output.assetId === assetId);
2923
+ fromAddress = change?.to || fromAddress;
2924
+ }
2925
+ const fromType = contractInputs.some((input) => input.contractID === fromAddress) ? 0 /* contract */ : 1 /* account */;
2926
+ return {
2927
+ name: "Transfer asset" /* transfer */,
2928
+ from: {
2929
+ type: fromType,
2930
+ address: fromAddress
2931
+ },
2932
+ to: {
2933
+ type: toType,
2934
+ address: toAddress
2935
+ },
2936
+ assetsSent: [
2937
+ {
2938
+ assetId: assetId.toString(),
2939
+ amount
2940
+ }
2941
+ ]
2942
+ };
2943
+ }
2951
2944
  function getTransferOperations({
2952
2945
  inputs,
2953
2946
  outputs,
2954
2947
  receipts
2955
2948
  }) {
2949
+ let operations = [];
2956
2950
  const coinOutputs = getOutputsCoin(outputs);
2957
- const [transferReceipt] = getReceiptsByType(
2951
+ const contractInputs = getInputsContract(inputs);
2952
+ const changeOutputs = getOutputsChange(outputs);
2953
+ coinOutputs.forEach((output) => {
2954
+ const { amount, assetId, to } = output;
2955
+ const changeOutput = changeOutputs.find((change) => change.assetId === assetId);
2956
+ if (changeOutput) {
2957
+ operations = addOperation(operations, {
2958
+ name: "Transfer asset" /* transfer */,
2959
+ from: {
2960
+ type: 1 /* account */,
2961
+ address: changeOutput.to
2962
+ },
2963
+ to: {
2964
+ type: 1 /* account */,
2965
+ address: to
2966
+ },
2967
+ assetsSent: [
2968
+ {
2969
+ assetId,
2970
+ amount
2971
+ }
2972
+ ]
2973
+ });
2974
+ }
2975
+ });
2976
+ const transferReceipts = getReceiptsByType(
2958
2977
  receipts,
2959
2978
  ReceiptType3.Transfer
2960
2979
  );
2961
- let operations = [];
2962
- if (transferReceipt) {
2963
- const changeOutputs = getOutputsChange(outputs);
2964
- changeOutputs.forEach((output) => {
2965
- const { assetId } = output;
2966
- const [contractInput] = getInputsContract(inputs);
2967
- const utxo = getInputFromAssetId(inputs, assetId);
2968
- if (utxo && contractInput) {
2969
- const inputAddress = getInputAccountAddress(utxo);
2970
- operations = addOperation(operations, {
2971
- name: "Transfer asset" /* transfer */,
2972
- from: {
2973
- type: 1 /* account */,
2974
- address: inputAddress
2975
- },
2976
- to: {
2977
- type: 0 /* contract */,
2978
- address: contractInput.contractID
2979
- },
2980
- assetsSent: [
2981
- {
2982
- assetId: assetId.toString(),
2983
- amount: transferReceipt.amount
2984
- }
2985
- ]
2986
- });
2987
- }
2988
- });
2989
- } else {
2990
- coinOutputs.forEach((output) => {
2991
- const input = getInputFromAssetId(inputs, output.assetId);
2992
- if (input) {
2993
- const inputAddress = getInputAccountAddress(input);
2994
- const operationToAdd = {
2995
- name: "Transfer asset" /* transfer */,
2996
- from: {
2997
- type: 1 /* account */,
2998
- address: inputAddress
2999
- },
3000
- to: {
3001
- type: 1 /* account */,
3002
- address: output.to.toString()
3003
- },
3004
- assetsSent: [
3005
- {
3006
- assetId: output.assetId.toString(),
3007
- amount: output.amount
3008
- }
3009
- ]
3010
- };
3011
- operations = addOperation(operations, operationToAdd);
3012
- }
3013
- });
3014
- }
2980
+ const transferOutReceipts = getReceiptsByType(
2981
+ receipts,
2982
+ ReceiptType3.TransferOut
2983
+ );
2984
+ [...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
2985
+ const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
2986
+ operations = addOperation(operations, operation);
2987
+ });
3015
2988
  return operations;
3016
2989
  }
3017
2990
  function getPayProducerOperations(outputs) {
@@ -3084,7 +3057,6 @@ function getOperations({
3084
3057
  rawPayload,
3085
3058
  maxInputs
3086
3059
  }),
3087
- ...getContractTransferOperations({ receipts }),
3088
3060
  ...getWithdrawFromFuelOperations({ inputs, receipts })
3089
3061
  ];
3090
3062
  }
@@ -3240,7 +3212,7 @@ function assembleTransactionSummary(params) {
3240
3212
  const burnedAssets = extractBurnedAssetsFromReceipts(receipts);
3241
3213
  let date;
3242
3214
  if (time) {
3243
- date = fromTai64ToDate(time);
3215
+ date = DateTime.fromTai64(time);
3244
3216
  }
3245
3217
  const transactionSummary = {
3246
3218
  id,
@@ -3330,7 +3302,7 @@ var TransactionResponse = class {
3330
3302
  */
3331
3303
  decodeTransaction(transactionWithReceipts) {
3332
3304
  return new TransactionCoder4().decode(
3333
- getBytesCopy11(transactionWithReceipts.rawPayload),
3305
+ arrayify10(transactionWithReceipts.rawPayload),
3334
3306
  0
3335
3307
  )?.[0];
3336
3308
  }
@@ -3356,7 +3328,7 @@ var TransactionResponse = class {
3356
3328
  id: this.id,
3357
3329
  receipts,
3358
3330
  transaction: decodedTransaction,
3359
- transactionBytes: getBytesCopy11(transaction.rawPayload),
3331
+ transactionBytes: arrayify10(transaction.rawPayload),
3360
3332
  gqlTransactionStatus: transaction.status,
3361
3333
  gasPerByte,
3362
3334
  gasPriceFactor,
@@ -3413,7 +3385,7 @@ var TransactionResponse = class {
3413
3385
  };
3414
3386
 
3415
3387
  // src/providers/transaction-response/getDecodedLogs.ts
3416
- import { U64Coder } from "@fuel-ts/abi-coder";
3388
+ import { BigNumberCoder } from "@fuel-ts/abi-coder";
3417
3389
  import { ReceiptType as ReceiptType5 } from "@fuel-ts/transactions";
3418
3390
  function getDecodedLogs(receipts, abiInterface) {
3419
3391
  return receipts.reduce((logs, r) => {
@@ -3421,7 +3393,9 @@ function getDecodedLogs(receipts, abiInterface) {
3421
3393
  logs.push(abiInterface.decodeLog(r.data, r.val1.toNumber(), r.id)[0]);
3422
3394
  }
3423
3395
  if (r.type === ReceiptType5.Log) {
3424
- logs.push(abiInterface.decodeLog(new U64Coder().encode(r.val0), r.val1.toNumber(), r.id)[0]);
3396
+ logs.push(
3397
+ abiInterface.decodeLog(new BigNumberCoder("u64").encode(r.val0), r.val1.toNumber(), r.id)[0]
3398
+ );
3425
3399
  }
3426
3400
  return logs;
3427
3401
  }, []);
@@ -3657,7 +3631,7 @@ var _Provider = class {
3657
3631
  const opDefinition = query.definitions.find((x) => x.kind === "OperationDefinition");
3658
3632
  const isSubscription = opDefinition?.operation === "subscription";
3659
3633
  if (isSubscription) {
3660
- return fuelGraphQLSubscriber({
3634
+ return new FuelGraphqlSubscriber({
3661
3635
  url: this.url,
3662
3636
  query,
3663
3637
  fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
@@ -3790,7 +3764,7 @@ var _Provider = class {
3790
3764
  async call(transactionRequestLike, { utxoValidation, estimateTxDependencies = true } = {}) {
3791
3765
  const transactionRequest = transactionRequestify(transactionRequestLike);
3792
3766
  if (estimateTxDependencies) {
3793
- await this.estimateTxDependencies(transactionRequest);
3767
+ return this.estimateTxDependencies(transactionRequest);
3794
3768
  }
3795
3769
  const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
3796
3770
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
@@ -3809,6 +3783,14 @@ var _Provider = class {
3809
3783
  * @returns A promise that resolves to the estimated transaction request object.
3810
3784
  */
3811
3785
  async estimatePredicates(transactionRequest) {
3786
+ const shouldEstimatePredicates = Boolean(
3787
+ transactionRequest.inputs.find(
3788
+ (input) => "predicate" in input && input.predicate && !equalBytes(arrayify11(input.predicate), arrayify11("0x")) && new BN(input.predicateGasUsed).isZero()
3789
+ )
3790
+ );
3791
+ if (!shouldEstimatePredicates) {
3792
+ return transactionRequest;
3793
+ }
3812
3794
  const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
3813
3795
  const response = await this.operations.estimatePredicates({
3814
3796
  encodedTransaction
@@ -3839,34 +3821,41 @@ var _Provider = class {
3839
3821
  * @returns A promise.
3840
3822
  */
3841
3823
  async estimateTxDependencies(transactionRequest) {
3842
- let missingOutputVariableCount = 0;
3843
- let missingOutputContractIdsCount = 0;
3844
- let tries = 0;
3845
3824
  if (transactionRequest.type === TransactionType8.Create) {
3846
- return;
3847
- }
3848
- let txRequest = transactionRequest;
3849
- if (txRequest.hasPredicateInput()) {
3850
- txRequest = await this.estimatePredicates(txRequest);
3825
+ return {
3826
+ receipts: [],
3827
+ outputVariables: 0,
3828
+ missingContractIds: []
3829
+ };
3851
3830
  }
3852
- while (tries < MAX_RETRIES) {
3831
+ await this.estimatePredicates(transactionRequest);
3832
+ let receipts = [];
3833
+ const missingContractIds = [];
3834
+ let outputVariables = 0;
3835
+ for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
3853
3836
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
3854
- encodedTransaction: hexlify12(txRequest.toTransactionBytes()),
3837
+ encodedTransaction: hexlify12(transactionRequest.toTransactionBytes()),
3855
3838
  utxoValidation: false
3856
3839
  });
3857
- const receipts = gqlReceipts.map(processGqlReceipt);
3840
+ receipts = gqlReceipts.map(processGqlReceipt);
3858
3841
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
3859
- missingOutputVariableCount = missingOutputVariables.length;
3860
- missingOutputContractIdsCount = missingOutputContractIds.length;
3861
- if (missingOutputVariableCount === 0 && missingOutputContractIdsCount === 0) {
3862
- return;
3842
+ const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
3843
+ if (hasMissingOutputs) {
3844
+ outputVariables += missingOutputVariables.length;
3845
+ transactionRequest.addVariableOutputs(missingOutputVariables.length);
3846
+ missingOutputContractIds.forEach(({ contractId }) => {
3847
+ transactionRequest.addContractInputAndOutput(Address2.fromString(contractId));
3848
+ missingContractIds.push(contractId);
3849
+ });
3850
+ } else {
3851
+ break;
3863
3852
  }
3864
- txRequest.addVariableOutputs(missingOutputVariableCount);
3865
- missingOutputContractIds.forEach(
3866
- ({ contractId }) => txRequest.addContractInputAndOutput(Address2.fromString(contractId))
3867
- );
3868
- tries += 1;
3869
3853
  }
3854
+ return {
3855
+ receipts,
3856
+ outputVariables,
3857
+ missingContractIds
3858
+ };
3870
3859
  }
3871
3860
  /**
3872
3861
  * Executes a signed transaction without applying the states changes
@@ -3881,7 +3870,7 @@ var _Provider = class {
3881
3870
  async simulate(transactionRequestLike, { estimateTxDependencies = true } = {}) {
3882
3871
  const transactionRequest = transactionRequestify(transactionRequestLike);
3883
3872
  if (estimateTxDependencies) {
3884
- await this.estimateTxDependencies(transactionRequest);
3873
+ return this.estimateTxDependencies(transactionRequest);
3885
3874
  }
3886
3875
  const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
3887
3876
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
@@ -3913,35 +3902,37 @@ var _Provider = class {
3913
3902
  estimatePredicates = true,
3914
3903
  resourcesOwner
3915
3904
  } = {}) {
3916
- const transactionRequest = transactionRequestify(clone3(transactionRequestLike));
3905
+ const txRequestClone = clone3(transactionRequestify(transactionRequestLike));
3917
3906
  const chainInfo = this.getChain();
3918
3907
  const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
3919
- const gasPrice = max(transactionRequest.gasPrice, minGasPrice);
3920
- const isScriptTransaction = transactionRequest.type === TransactionType8.Script;
3921
- if (transactionRequest.hasPredicateInput() && estimatePredicates) {
3908
+ const gasPrice = max(txRequestClone.gasPrice, minGasPrice);
3909
+ const isScriptTransaction = txRequestClone.type === TransactionType8.Script;
3910
+ const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
3911
+ const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
3912
+ txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
3913
+ if (estimatePredicates) {
3922
3914
  if (isScriptTransaction) {
3923
- transactionRequest.gasLimit = bn14(0);
3915
+ txRequestClone.gasLimit = bn14(0);
3916
+ }
3917
+ if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
3918
+ resourcesOwner.populateTransactionPredicateData(txRequestClone);
3924
3919
  }
3925
- await this.estimatePredicates(transactionRequest);
3920
+ await this.estimatePredicates(txRequestClone);
3926
3921
  }
3927
- const minGas = transactionRequest.calculateMinGas(chainInfo);
3928
- const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
3929
- const coinOutputsQuantities = transactionRequest.getCoinOutputsQuantities();
3930
- const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
3931
- transactionRequest.fundWithFakeUtxos(allQuantities, resourcesOwner);
3932
- let gasUsed = minGas;
3922
+ const minGas = txRequestClone.calculateMinGas(chainInfo);
3923
+ const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
3933
3924
  let receipts = [];
3934
- if (isScriptTransaction) {
3935
- transactionRequest.gasPrice = bn14(0);
3936
- transactionRequest.gasLimit = bn14(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3937
- const result = await this.call(transactionRequest, {
3938
- estimateTxDependencies
3939
- });
3925
+ let missingContractIds = [];
3926
+ let outputVariables = 0;
3927
+ if (isScriptTransaction && estimateTxDependencies) {
3928
+ txRequestClone.gasPrice = bn14(0);
3929
+ txRequestClone.gasLimit = bn14(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3930
+ const result = await this.estimateTxDependencies(txRequestClone);
3940
3931
  receipts = result.receipts;
3941
- gasUsed = getGasUsedFromReceipts(receipts);
3942
- } else {
3943
- gasUsed = minGas;
3932
+ outputVariables = result.outputVariables;
3933
+ missingContractIds = result.missingContractIds;
3944
3934
  }
3935
+ const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
3945
3936
  const usedFee = calculatePriceWithFactor(
3946
3937
  gasUsed,
3947
3938
  gasPrice,
@@ -3959,7 +3950,10 @@ var _Provider = class {
3959
3950
  maxGas,
3960
3951
  usedFee,
3961
3952
  minFee,
3962
- maxFee
3953
+ maxFee,
3954
+ estimatedInputs: txRequestClone.inputs,
3955
+ outputVariables,
3956
+ missingContractIds
3963
3957
  };
3964
3958
  }
3965
3959
  async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
@@ -4127,7 +4121,7 @@ var _Provider = class {
4127
4121
  time: block.header.time,
4128
4122
  transactionIds: block.transactions.map((tx) => tx.id),
4129
4123
  transactions: block.transactions.map(
4130
- (tx) => new TransactionCoder5().decode(getBytesCopy12(tx.rawPayload), 0)?.[0]
4124
+ (tx) => new TransactionCoder5().decode(arrayify11(tx.rawPayload), 0)?.[0]
4131
4125
  )
4132
4126
  };
4133
4127
  }
@@ -4143,7 +4137,7 @@ var _Provider = class {
4143
4137
  return null;
4144
4138
  }
4145
4139
  return new TransactionCoder5().decode(
4146
- getBytesCopy12(transaction.rawPayload),
4140
+ arrayify11(transaction.rawPayload),
4147
4141
  0
4148
4142
  )?.[0];
4149
4143
  }
@@ -4339,13 +4333,13 @@ var _Provider = class {
4339
4333
  * Lets you produce blocks with custom timestamps and the block number of the last block produced.
4340
4334
  *
4341
4335
  * @param amount - The amount of blocks to produce
4342
- * @param startTime - The UNIX timestamp to set for the first produced block
4336
+ * @param startTime - The UNIX timestamp (milliseconds) to set for the first produced block
4343
4337
  * @returns A promise that resolves to the block number of the last produced block.
4344
4338
  */
4345
4339
  async produceBlocks(amount, startTime) {
4346
4340
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4347
4341
  blocksToProduce: bn14(amount).toString(10),
4348
- startTimestamp: startTime ? fromUnixToTai64(startTime) : void 0
4342
+ startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4349
4343
  });
4350
4344
  return bn14(latestBlockHeight);
4351
4345
  }
@@ -4373,7 +4367,7 @@ __publicField(Provider, "nodeInfoCache", {});
4373
4367
  import { ErrorCode as ErrorCode12, FuelError as FuelError13 } from "@fuel-ts/errors";
4374
4368
  import { bn as bn15 } from "@fuel-ts/math";
4375
4369
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4376
- import { getBytesCopy as getBytesCopy13 } from "ethers";
4370
+ import { arrayify as arrayify12 } from "@fuel-ts/utils";
4377
4371
  async function getTransactionSummary(params) {
4378
4372
  const { id, provider, abiMap } = params;
4379
4373
  const { transaction: gqlTransaction } = await provider.operations.getTransactionWithReceipts({
@@ -4386,7 +4380,7 @@ async function getTransactionSummary(params) {
4386
4380
  );
4387
4381
  }
4388
4382
  const [decodedTransaction] = new TransactionCoder6().decode(
4389
- getBytesCopy13(gqlTransaction.rawPayload),
4383
+ arrayify12(gqlTransaction.rawPayload),
4390
4384
  0
4391
4385
  );
4392
4386
  const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
@@ -4397,7 +4391,7 @@ async function getTransactionSummary(params) {
4397
4391
  id: gqlTransaction.id,
4398
4392
  receipts,
4399
4393
  transaction: decodedTransaction,
4400
- transactionBytes: getBytesCopy13(gqlTransaction.rawPayload),
4394
+ transactionBytes: arrayify12(gqlTransaction.rawPayload),
4401
4395
  gqlTransactionStatus: gqlTransaction.status,
4402
4396
  gasPerByte: bn15(gasPerByte),
4403
4397
  gasPriceFactor: bn15(gasPriceFactor),
@@ -4439,13 +4433,13 @@ async function getTransactionsSummaries(params) {
4439
4433
  const transactions = edges.map((edge) => {
4440
4434
  const { node: gqlTransaction } = edge;
4441
4435
  const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
4442
- const [decodedTransaction] = new TransactionCoder6().decode(getBytesCopy13(rawPayload), 0);
4436
+ const [decodedTransaction] = new TransactionCoder6().decode(arrayify12(rawPayload), 0);
4443
4437
  const receipts = gqlReceipts?.map(processGqlReceipt) || [];
4444
4438
  const transactionSummary = assembleTransactionSummary({
4445
4439
  id,
4446
4440
  receipts,
4447
4441
  transaction: decodedTransaction,
4448
- transactionBytes: getBytesCopy13(rawPayload),
4442
+ transactionBytes: arrayify12(rawPayload),
4449
4443
  gqlTransactionStatus: status,
4450
4444
  abiMap,
4451
4445
  gasPerByte,
@@ -4465,19 +4459,140 @@ async function getTransactionsSummaries(params) {
4465
4459
  };
4466
4460
  }
4467
4461
 
4462
+ // src/providers/chains.ts
4463
+ var CHAIN_IDS = {
4464
+ eth: {
4465
+ sepolia: 11155111,
4466
+ foundry: 31337
4467
+ },
4468
+ fuel: {
4469
+ beta5: 0,
4470
+ devnet: 10
4471
+ }
4472
+ };
4473
+
4474
+ // src/providers/assets/utils/network.ts
4475
+ var getDefaultChainId = (networkType) => {
4476
+ if (networkType === "ethereum") {
4477
+ return CHAIN_IDS.eth.sepolia;
4478
+ }
4479
+ if (networkType === "fuel") {
4480
+ return CHAIN_IDS.fuel.beta5;
4481
+ }
4482
+ return void 0;
4483
+ };
4484
+ var getAssetNetwork = ({
4485
+ asset,
4486
+ chainId,
4487
+ networkType
4488
+ }) => {
4489
+ const network = asset.networks.find(
4490
+ (item) => item.chainId === chainId && item.type === networkType
4491
+ );
4492
+ return network;
4493
+ };
4494
+ var getAssetWithNetwork = ({
4495
+ asset,
4496
+ chainId,
4497
+ networkType
4498
+ }) => {
4499
+ const { networks: _, ...assetRest } = asset;
4500
+ const chainIdToUse = chainId ?? getDefaultChainId(networkType);
4501
+ if (chainIdToUse === void 0) {
4502
+ return void 0;
4503
+ }
4504
+ const assetNetwork = getAssetNetwork({
4505
+ asset,
4506
+ chainId: chainIdToUse,
4507
+ networkType
4508
+ });
4509
+ if (!assetNetwork) {
4510
+ return void 0;
4511
+ }
4512
+ return {
4513
+ ...assetRest,
4514
+ ...assetNetwork
4515
+ };
4516
+ };
4517
+ var getAssetEth = (asset, chainId) => getAssetWithNetwork({
4518
+ asset,
4519
+ networkType: "ethereum",
4520
+ chainId
4521
+ });
4522
+ var getAssetFuel = (asset, chainId) => getAssetWithNetwork({
4523
+ asset,
4524
+ networkType: "fuel",
4525
+ chainId
4526
+ });
4527
+
4528
+ // src/providers/assets/utils/url.ts
4529
+ var DELIMITER_PATH = "/";
4530
+ var trimRegex = /^\/|\/$/g;
4531
+ var trimPath = (path = "") => path.replace(trimRegex, "");
4532
+ function urlJoin(baseUrl, ...paths) {
4533
+ const hasBaseUrl = baseUrl !== null && baseUrl !== void 0;
4534
+ const rootPath = baseUrl?.[0] === "/" && baseUrl.length > 1;
4535
+ const allPaths = [baseUrl, ...paths].filter(Boolean).map(trimPath);
4536
+ if (rootPath && hasBaseUrl) {
4537
+ allPaths.unshift("");
4538
+ }
4539
+ return allPaths.join(DELIMITER_PATH);
4540
+ }
4541
+
4542
+ // src/providers/assets/utils/resolveIconPaths.ts
4543
+ function resolveIconPaths(assets2, basePath = "./") {
4544
+ return assets2.map((asset) => ({
4545
+ ...asset,
4546
+ icon: urlJoin(basePath, asset.icon)
4547
+ }));
4548
+ }
4549
+
4550
+ // src/providers/assets/index.ts
4551
+ var assets = [
4552
+ {
4553
+ name: "Ethereum",
4554
+ symbol: "ETH",
4555
+ icon: "eth.svg",
4556
+ networks: [
4557
+ {
4558
+ type: "ethereum",
4559
+ chainId: CHAIN_IDS.eth.sepolia,
4560
+ decimals: 18
4561
+ },
4562
+ {
4563
+ type: "ethereum",
4564
+ chainId: CHAIN_IDS.eth.foundry,
4565
+ decimals: 18
4566
+ },
4567
+ {
4568
+ type: "fuel",
4569
+ chainId: CHAIN_IDS.fuel.beta5,
4570
+ decimals: 9,
4571
+ assetId: "0x0000000000000000000000000000000000000000000000000000000000000000"
4572
+ },
4573
+ {
4574
+ type: "fuel",
4575
+ chainId: CHAIN_IDS.fuel.devnet,
4576
+ decimals: 9,
4577
+ assetId: "0x0000000000000000000000000000000000000000000000000000000000000000"
4578
+ }
4579
+ ]
4580
+ }
4581
+ ];
4582
+
4468
4583
  // src/utils/formatTransferToContractScriptData.ts
4469
- import { U64Coder as U64Coder2 } from "@fuel-ts/abi-coder";
4470
- import { BN } from "@fuel-ts/math";
4584
+ import { BigNumberCoder as BigNumberCoder2 } from "@fuel-ts/abi-coder";
4585
+ import { BN as BN2 } from "@fuel-ts/math";
4586
+ import { arrayify as arrayify13 } from "@fuel-ts/utils";
4471
4587
  import * as asm from "@fuels/vm-asm";
4472
- import { getBytesCopy as getBytesCopy14 } from "ethers";
4473
4588
  var formatTransferToContractScriptData = (params) => {
4474
4589
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
4475
- const numberCoder = new U64Coder2();
4476
- const encoded = numberCoder.encode(new BN(amountToTransfer).toNumber());
4590
+ const numberCoder = new BigNumberCoder2("u64");
4591
+ const encoded = numberCoder.encode(new BN2(amountToTransfer).toNumber());
4477
4592
  const scriptData = Uint8Array.from([
4478
- ...getBytesCopy14(hexlifiedContractId),
4593
+ ...arrayify13(hexlifiedContractId),
4479
4594
  ...encoded,
4480
- ...getBytesCopy14(assetId)
4595
+ ...arrayify13(assetId)
4481
4596
  ]);
4482
4597
  return scriptData;
4483
4598
  };
@@ -4727,7 +4842,10 @@ var Account = class extends AbstractAccount {
4727
4842
  const params = { gasPrice: minGasPrice, ...txParams };
4728
4843
  const request = new ScriptTransactionRequest(params);
4729
4844
  request.addCoinOutput(Address3.fromAddressOrString(destination), amount, assetId);
4730
- const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(request);
4845
+ const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
4846
+ estimateTxDependencies: true,
4847
+ resourcesOwner: this
4848
+ });
4731
4849
  request.gasPrice = bn16(txParams.gasPrice ?? minGasPrice);
4732
4850
  request.gasLimit = bn16(txParams.gasLimit ?? gasUsed);
4733
4851
  this.validateGas({
@@ -4737,6 +4855,7 @@ var Account = class extends AbstractAccount {
4737
4855
  minGasPrice
4738
4856
  });
4739
4857
  await this.fund(request, requiredQuantities, maxFee);
4858
+ request.updatePredicateInputs(estimatedInputs);
4740
4859
  return request;
4741
4860
  }
4742
4861
  /**
@@ -4750,7 +4869,7 @@ var Account = class extends AbstractAccount {
4750
4869
  */
4751
4870
  async transfer(destination, amount, assetId = BaseAssetId3, txParams = {}) {
4752
4871
  const request = await this.createTransfer(destination, amount, assetId, txParams);
4753
- return this.sendTransaction(request);
4872
+ return this.sendTransaction(request, { estimateTxDependencies: false });
4754
4873
  }
4755
4874
  /**
4756
4875
  * Transfers coins to a contract address.
@@ -4801,14 +4920,14 @@ var Account = class extends AbstractAccount {
4801
4920
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
4802
4921
  const { minGasPrice } = this.provider.getGasConfig();
4803
4922
  const recipientAddress = Address3.fromAddressOrString(recipient);
4804
- const recipientDataArray = getBytesCopy15(
4923
+ const recipientDataArray = arrayify14(
4805
4924
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
4806
4925
  );
4807
- const amountDataArray = getBytesCopy15(
4926
+ const amountDataArray = arrayify14(
4808
4927
  "0x".concat(bn16(amount).toHex().substring(2).padStart(16, "0"))
4809
4928
  );
4810
4929
  const script = new Uint8Array([
4811
- ...getBytesCopy15(withdrawScript.bytes),
4930
+ ...arrayify14(withdrawScript.bytes),
4812
4931
  ...recipientDataArray,
4813
4932
  ...amountDataArray
4814
4933
  ]);
@@ -4841,16 +4960,18 @@ var Account = class extends AbstractAccount {
4841
4960
  * @param transactionRequestLike - The transaction request to be sent.
4842
4961
  * @returns A promise that resolves to the transaction response.
4843
4962
  */
4844
- async sendTransaction(transactionRequestLike, options) {
4963
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
4845
4964
  if (this._connector) {
4846
4965
  return this.provider.getTransactionResponse(
4847
4966
  await this._connector.sendTransaction(this.address.toString(), transactionRequestLike)
4848
4967
  );
4849
4968
  }
4850
4969
  const transactionRequest = transactionRequestify(transactionRequestLike);
4851
- await this.provider.estimateTxDependencies(transactionRequest);
4970
+ if (estimateTxDependencies) {
4971
+ await this.provider.estimateTxDependencies(transactionRequest);
4972
+ }
4852
4973
  return this.provider.sendTransaction(transactionRequest, {
4853
- ...options,
4974
+ awaitExecution,
4854
4975
  estimateTxDependencies: false
4855
4976
  });
4856
4977
  }
@@ -4860,9 +4981,11 @@ var Account = class extends AbstractAccount {
4860
4981
  * @param transactionRequestLike - The transaction request to be simulated.
4861
4982
  * @returns A promise that resolves to the call result.
4862
4983
  */
4863
- async simulateTransaction(transactionRequestLike) {
4984
+ async simulateTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
4864
4985
  const transactionRequest = transactionRequestify(transactionRequestLike);
4865
- await this.provider.estimateTxDependencies(transactionRequest);
4986
+ if (estimateTxDependencies) {
4987
+ await this.provider.estimateTxDependencies(transactionRequest);
4988
+ }
4866
4989
  return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
4867
4990
  }
4868
4991
  validateGas({
@@ -4888,14 +5011,15 @@ var Account = class extends AbstractAccount {
4888
5011
 
4889
5012
  // src/wallet/base-wallet-unlocked.ts
4890
5013
  import { hashMessage } from "@fuel-ts/hasher";
5014
+ import { hexlify as hexlify15 } from "@fuel-ts/utils";
4891
5015
 
4892
5016
  // src/signer/signer.ts
4893
5017
  import { Address as Address4 } from "@fuel-ts/address";
4894
5018
  import { randomBytes } from "@fuel-ts/crypto";
4895
5019
  import { hash } from "@fuel-ts/hasher";
4896
5020
  import { toBytes } from "@fuel-ts/math";
5021
+ import { hexlify as hexlify13, concat as concat3, arrayify as arrayify15 } from "@fuel-ts/utils";
4897
5022
  import { secp256k1 } from "@noble/curves/secp256k1";
4898
- import { hexlify as hexlify13, concat as concat3, getBytesCopy as getBytesCopy16 } from "ethers";
4899
5023
  var Signer = class {
4900
5024
  address;
4901
5025
  publicKey;
@@ -4930,11 +5054,11 @@ var Signer = class {
4930
5054
  * @returns hashed signature
4931
5055
  */
4932
5056
  sign(data) {
4933
- const signature = secp256k1.sign(getBytesCopy16(data), getBytesCopy16(this.privateKey));
5057
+ const signature = secp256k1.sign(arrayify15(data), arrayify15(this.privateKey));
4934
5058
  const r = toBytes(`0x${signature.r.toString(16)}`, 32);
4935
5059
  const s = toBytes(`0x${signature.s.toString(16)}`, 32);
4936
5060
  s[0] |= (signature.recovery || 0) << 7;
4937
- return concat3([r, s]);
5061
+ return hexlify13(concat3([r, s]));
4938
5062
  }
4939
5063
  /**
4940
5064
  * Add point on the current elliptic curve
@@ -4943,8 +5067,8 @@ var Signer = class {
4943
5067
  * @returns compressed point on the curve
4944
5068
  */
4945
5069
  addPoint(point) {
4946
- const p0 = secp256k1.ProjectivePoint.fromHex(getBytesCopy16(this.compressedPublicKey));
4947
- const p1 = secp256k1.ProjectivePoint.fromHex(getBytesCopy16(point));
5070
+ const p0 = secp256k1.ProjectivePoint.fromHex(arrayify15(this.compressedPublicKey));
5071
+ const p1 = secp256k1.ProjectivePoint.fromHex(arrayify15(point));
4948
5072
  const result = p0.add(p1);
4949
5073
  return `0x${result.toHex(true)}`;
4950
5074
  }
@@ -4956,7 +5080,7 @@ var Signer = class {
4956
5080
  * @returns public key from signature from the
4957
5081
  */
4958
5082
  static recoverPublicKey(data, signature) {
4959
- const signedMessageBytes = getBytesCopy16(signature);
5083
+ const signedMessageBytes = arrayify15(signature);
4960
5084
  const r = signedMessageBytes.slice(0, 32);
4961
5085
  const s = signedMessageBytes.slice(32, 64);
4962
5086
  const recoveryParam = (s[0] & 128) >> 7;
@@ -4964,7 +5088,7 @@ var Signer = class {
4964
5088
  const sig = new secp256k1.Signature(BigInt(hexlify13(r)), BigInt(hexlify13(s))).addRecoveryBit(
4965
5089
  recoveryParam
4966
5090
  );
4967
- const publicKey = sig.recoverPublicKey(getBytesCopy16(data)).toRawBytes(false).slice(1);
5091
+ const publicKey = sig.recoverPublicKey(arrayify15(data)).toRawBytes(false).slice(1);
4968
5092
  return hexlify13(publicKey);
4969
5093
  }
4970
5094
  /**
@@ -4984,7 +5108,7 @@ var Signer = class {
4984
5108
  * @returns random 32-byte hashed
4985
5109
  */
4986
5110
  static generatePrivateKey(entropy) {
4987
- return entropy ? hash(concat3([randomBytes(32), getBytesCopy16(entropy)])) : randomBytes(32);
5111
+ return entropy ? hash(concat3([randomBytes(32), arrayify15(entropy)])) : randomBytes(32);
4988
5112
  }
4989
5113
  /**
4990
5114
  * Extended publicKey from a compact publicKey
@@ -4993,7 +5117,7 @@ var Signer = class {
4993
5117
  * @returns extended publicKey
4994
5118
  */
4995
5119
  static extendPublicKey(publicKey) {
4996
- const point = secp256k1.ProjectivePoint.fromHex(getBytesCopy16(publicKey));
5120
+ const point = secp256k1.ProjectivePoint.fromHex(arrayify15(publicKey));
4997
5121
  return hexlify13(point.toRawBytes(false).slice(1));
4998
5122
  }
4999
5123
  };
@@ -5010,7 +5134,7 @@ import {
5010
5134
  encryptJsonWalletData
5011
5135
  } from "@fuel-ts/crypto";
5012
5136
  import { ErrorCode as ErrorCode14, FuelError as FuelError15 } from "@fuel-ts/errors";
5013
- import { hexlify as hexlify14 } from "ethers";
5137
+ import { hexlify as hexlify14 } from "@fuel-ts/utils";
5014
5138
  import { v4 as uuidv4 } from "uuid";
5015
5139
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
5016
5140
  var DEFAULT_KDF_PARAMS_R = 8;
@@ -5138,7 +5262,7 @@ var BaseWalletUnlocked = class extends Account {
5138
5262
  */
5139
5263
  async signMessage(message) {
5140
5264
  const signedMessage = await this.signer().sign(hashMessage(message));
5141
- return signedMessage;
5265
+ return hexlify15(signedMessage);
5142
5266
  }
5143
5267
  /**
5144
5268
  * Signs a transaction with the wallet's private key.
@@ -5151,7 +5275,7 @@ var BaseWalletUnlocked = class extends Account {
5151
5275
  const chainId = this.provider.getChain().consensusParameters.chainId.toNumber();
5152
5276
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
5153
5277
  const signature = await this.signer().sign(hashedTransaction);
5154
- return signature;
5278
+ return hexlify15(signature);
5155
5279
  }
5156
5280
  /**
5157
5281
  * Populates a transaction with the witnesses signature.
@@ -5171,12 +5295,14 @@ var BaseWalletUnlocked = class extends Account {
5171
5295
  * @param transactionRequestLike - The transaction request to send.
5172
5296
  * @returns A promise that resolves to the TransactionResponse object.
5173
5297
  */
5174
- async sendTransaction(transactionRequestLike, options) {
5298
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
5175
5299
  const transactionRequest = transactionRequestify(transactionRequestLike);
5176
- await this.provider.estimateTxDependencies(transactionRequest);
5300
+ if (estimateTxDependencies) {
5301
+ await this.provider.estimateTxDependencies(transactionRequest);
5302
+ }
5177
5303
  return this.provider.sendTransaction(
5178
5304
  await this.populateTransactionWitnessesSignature(transactionRequest),
5179
- { ...options, estimateTxDependencies: false }
5305
+ { awaitExecution, estimateTxDependencies: false }
5180
5306
  );
5181
5307
  }
5182
5308
  /**
@@ -5185,9 +5311,11 @@ var BaseWalletUnlocked = class extends Account {
5185
5311
  * @param transactionRequestLike - The transaction request to simulate.
5186
5312
  * @returns A promise that resolves to the CallResult object.
5187
5313
  */
5188
- async simulateTransaction(transactionRequestLike) {
5314
+ async simulateTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
5189
5315
  const transactionRequest = transactionRequestify(transactionRequestLike);
5190
- await this.provider.estimateTxDependencies(transactionRequest);
5316
+ if (estimateTxDependencies) {
5317
+ await this.provider.estimateTxDependencies(transactionRequest);
5318
+ }
5191
5319
  return this.provider.call(
5192
5320
  await this.populateTransactionWitnessesSignature(transactionRequest),
5193
5321
  {
@@ -5208,32 +5336,22 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5208
5336
  // src/hdwallet/hdwallet.ts
5209
5337
  import { ErrorCode as ErrorCode17, FuelError as FuelError18 } from "@fuel-ts/errors";
5210
5338
  import { bn as bn17, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5339
+ import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
5211
5340
  import {
5212
5341
  toBeHex,
5213
5342
  dataSlice as dataSlice2,
5214
- hexlify as hexlify16,
5215
5343
  encodeBase58 as encodeBase582,
5216
5344
  decodeBase58,
5217
5345
  sha256 as sha2564,
5218
5346
  computeHmac as computeHmac2,
5219
- ripemd160,
5220
- getBytesCopy as getBytesCopy19,
5221
- concat as concat5
5347
+ ripemd160
5222
5348
  } from "ethers";
5223
5349
 
5224
5350
  // src/mnemonic/mnemonic.ts
5225
5351
  import { randomBytes as randomBytes3 } from "@fuel-ts/crypto";
5226
5352
  import { ErrorCode as ErrorCode16, FuelError as FuelError17 } from "@fuel-ts/errors";
5227
- import {
5228
- concat as concat4,
5229
- hexlify as hexlify15,
5230
- dataSlice,
5231
- pbkdf2,
5232
- sha256 as sha2563,
5233
- computeHmac,
5234
- encodeBase58,
5235
- getBytesCopy as getBytesCopy18
5236
- } from "ethers";
5353
+ import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4 } from "@fuel-ts/utils";
5354
+ import { dataSlice, pbkdf2, sha256 as sha2563, computeHmac, encodeBase58 } from "ethers";
5237
5355
 
5238
5356
  // src/wordlists/words/english.ts
5239
5357
  var english = [
@@ -7295,7 +7413,8 @@ var Language = /* @__PURE__ */ ((Language2) => {
7295
7413
 
7296
7414
  // src/mnemonic/utils.ts
7297
7415
  import { ErrorCode as ErrorCode15, FuelError as FuelError16 } from "@fuel-ts/errors";
7298
- import { getBytesCopy as getBytesCopy17, sha256 as sha2562 } from "ethers";
7416
+ import { arrayify as arrayify16 } from "@fuel-ts/utils";
7417
+ import { sha256 as sha2562 } from "ethers";
7299
7418
  function toUtf8Bytes(stri) {
7300
7419
  const str = stri.normalize("NFKD");
7301
7420
  const result = [];
@@ -7362,14 +7481,14 @@ function entropyToMnemonicIndices(entropy) {
7362
7481
  }
7363
7482
  }
7364
7483
  const checksumBits = entropy.length / 4;
7365
- const checksum = getBytesCopy17(sha2562(entropy))[0] & getUpperMask(checksumBits);
7484
+ const checksum = arrayify16(sha2562(entropy))[0] & getUpperMask(checksumBits);
7366
7485
  indices[indices.length - 1] <<= checksumBits;
7367
7486
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
7368
7487
  return indices;
7369
7488
  }
7370
7489
  function mnemonicWordsToEntropy(words, wordlist) {
7371
7490
  const size = Math.ceil(11 * words.length / 8);
7372
- const entropy = getBytesCopy17(new Uint8Array(size));
7491
+ const entropy = arrayify16(new Uint8Array(size));
7373
7492
  let offset = 0;
7374
7493
  for (let i = 0; i < words.length; i += 1) {
7375
7494
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
@@ -7389,7 +7508,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
7389
7508
  const entropyBits = 32 * words.length / 3;
7390
7509
  const checksumBits = words.length / 3;
7391
7510
  const checksumMask = getUpperMask(checksumBits);
7392
- const checksum = getBytesCopy17(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7511
+ const checksum = arrayify16(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7393
7512
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
7394
7513
  throw new FuelError16(
7395
7514
  ErrorCode15.INVALID_CHECKSUM,
@@ -7464,7 +7583,7 @@ var Mnemonic = class {
7464
7583
  static mnemonicToEntropy(phrase, wordlist = english) {
7465
7584
  const words = getWords(phrase);
7466
7585
  assertMnemonic(words);
7467
- return hexlify15(mnemonicWordsToEntropy(words, wordlist));
7586
+ return hexlify16(mnemonicWordsToEntropy(words, wordlist));
7468
7587
  }
7469
7588
  /**
7470
7589
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -7472,7 +7591,7 @@ var Mnemonic = class {
7472
7591
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7473
7592
  */
7474
7593
  static entropyToMnemonic(entropy, wordlist = english) {
7475
- const entropyBytes = getBytesCopy18(entropy);
7594
+ const entropyBytes = arrayify17(entropy);
7476
7595
  assertWordList(wordlist);
7477
7596
  assertEntropy(entropyBytes);
7478
7597
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -7541,14 +7660,14 @@ var Mnemonic = class {
7541
7660
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7542
7661
  */
7543
7662
  static masterKeysFromSeed(seed) {
7544
- const seedArray = getBytesCopy18(seed);
7663
+ const seedArray = arrayify17(seed);
7545
7664
  if (seedArray.length < 16 || seedArray.length > 64) {
7546
7665
  throw new FuelError17(
7547
7666
  ErrorCode16.INVALID_SEED,
7548
7667
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
7549
7668
  );
7550
7669
  }
7551
- return getBytesCopy18(computeHmac("sha512", MasterSecret, seedArray));
7670
+ return arrayify17(computeHmac("sha512", MasterSecret, seedArray));
7552
7671
  }
7553
7672
  /**
7554
7673
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -7559,7 +7678,7 @@ var Mnemonic = class {
7559
7678
  */
7560
7679
  static seedToExtendedKey(seed, testnet = false) {
7561
7680
  const masterKey = Mnemonic.masterKeysFromSeed(seed);
7562
- const prefix = getBytesCopy18(testnet ? TestnetPRV : MainnetPRV);
7681
+ const prefix = arrayify17(testnet ? TestnetPRV : MainnetPRV);
7563
7682
  const depth = "0x00";
7564
7683
  const fingerprint = "0x00000000";
7565
7684
  const index = "0x00000000";
@@ -7589,7 +7708,7 @@ var Mnemonic = class {
7589
7708
  * @returns A randomly generated mnemonic
7590
7709
  */
7591
7710
  static generate(size = 32, extraEntropy = "") {
7592
- const entropy = extraEntropy ? sha2563(concat4([randomBytes3(size), getBytesCopy18(extraEntropy)])) : randomBytes3(size);
7711
+ const entropy = extraEntropy ? sha2563(concat4([randomBytes3(size), arrayify17(extraEntropy)])) : randomBytes3(size);
7593
7712
  return Mnemonic.entropyToMnemonic(entropy);
7594
7713
  }
7595
7714
  };
@@ -7597,10 +7716,10 @@ var mnemonic_default = Mnemonic;
7597
7716
 
7598
7717
  // src/hdwallet/hdwallet.ts
7599
7718
  var HARDENED_INDEX = 2147483648;
7600
- var MainnetPRV2 = hexlify16("0x0488ade4");
7601
- var MainnetPUB = hexlify16("0x0488b21e");
7602
- var TestnetPRV2 = hexlify16("0x04358394");
7603
- var TestnetPUB = hexlify16("0x043587cf");
7719
+ var MainnetPRV2 = hexlify17("0x0488ade4");
7720
+ var MainnetPUB = hexlify17("0x0488b21e");
7721
+ var TestnetPRV2 = hexlify17("0x04358394");
7722
+ var TestnetPUB = hexlify17("0x043587cf");
7604
7723
  function base58check(data) {
7605
7724
  return encodeBase582(concat5([data, dataSlice2(sha2564(sha2564(data)), 0, 4)]));
7606
7725
  }
@@ -7611,11 +7730,11 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
7611
7730
  return testnet ? TestnetPRV2 : MainnetPRV2;
7612
7731
  }
7613
7732
  function isPublicExtendedKey(extendedKey) {
7614
- return [MainnetPUB, TestnetPUB].includes(hexlify16(extendedKey.slice(0, 4)));
7733
+ return [MainnetPUB, TestnetPUB].includes(hexlify17(extendedKey.slice(0, 4)));
7615
7734
  }
7616
7735
  function isValidExtendedKey(extendedKey) {
7617
7736
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
7618
- hexlify16(extendedKey.slice(0, 4))
7737
+ hexlify17(extendedKey.slice(0, 4))
7619
7738
  );
7620
7739
  }
7621
7740
  function parsePath(path, depth = 0) {
@@ -7633,8 +7752,8 @@ function parsePath(path, depth = 0) {
7633
7752
  var HDWallet = class {
7634
7753
  depth = 0;
7635
7754
  index = 0;
7636
- fingerprint = hexlify16("0x00000000");
7637
- parentFingerprint = hexlify16("0x00000000");
7755
+ fingerprint = hexlify17("0x00000000");
7756
+ parentFingerprint = hexlify17("0x00000000");
7638
7757
  privateKey;
7639
7758
  publicKey;
7640
7759
  chainCode;
@@ -7646,8 +7765,8 @@ var HDWallet = class {
7646
7765
  constructor(config) {
7647
7766
  if (config.privateKey) {
7648
7767
  const signer = new Signer(config.privateKey);
7649
- this.publicKey = hexlify16(signer.compressedPublicKey);
7650
- this.privateKey = hexlify16(config.privateKey);
7768
+ this.publicKey = hexlify17(signer.compressedPublicKey);
7769
+ this.privateKey = hexlify17(config.privateKey);
7651
7770
  } else {
7652
7771
  if (!config.publicKey) {
7653
7772
  throw new FuelError18(
@@ -7655,7 +7774,7 @@ var HDWallet = class {
7655
7774
  "Both public and private Key cannot be missing. At least one should be provided."
7656
7775
  );
7657
7776
  }
7658
- this.publicKey = hexlify16(config.publicKey);
7777
+ this.publicKey = hexlify17(config.publicKey);
7659
7778
  }
7660
7779
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
7661
7780
  this.fingerprint = dataSlice2(ripemd160(sha2564(this.publicKey)), 0, 4);
@@ -7674,9 +7793,9 @@ var HDWallet = class {
7674
7793
  * @returns A new instance of HDWallet on the derived index
7675
7794
  */
7676
7795
  deriveIndex(index) {
7677
- const privateKey = this.privateKey && getBytesCopy19(this.privateKey);
7678
- const publicKey = getBytesCopy19(this.publicKey);
7679
- const chainCode = getBytesCopy19(this.chainCode);
7796
+ const privateKey = this.privateKey && arrayify18(this.privateKey);
7797
+ const publicKey = arrayify18(this.publicKey);
7798
+ const chainCode = arrayify18(this.chainCode);
7680
7799
  const data = new Uint8Array(37);
7681
7800
  if (index & HARDENED_INDEX) {
7682
7801
  if (!privateKey) {
@@ -7687,10 +7806,10 @@ var HDWallet = class {
7687
7806
  }
7688
7807
  data.set(privateKey, 1);
7689
7808
  } else {
7690
- data.set(getBytesCopy19(this.publicKey));
7809
+ data.set(arrayify18(this.publicKey));
7691
7810
  }
7692
7811
  data.set(toBytes2(index, 4), 33);
7693
- const bytes = getBytesCopy19(computeHmac2("sha512", chainCode, data));
7812
+ const bytes = arrayify18(computeHmac2("sha512", chainCode, data));
7694
7813
  const IL = bytes.slice(0, 32);
7695
7814
  const IR = bytes.slice(32);
7696
7815
  if (privateKey) {
@@ -7704,7 +7823,7 @@ var HDWallet = class {
7704
7823
  parentFingerprint: this.fingerprint
7705
7824
  });
7706
7825
  }
7707
- const signer = new Signer(hexlify16(IL));
7826
+ const signer = new Signer(hexlify17(IL));
7708
7827
  const Ki = signer.addPoint(publicKey);
7709
7828
  return new HDWallet({
7710
7829
  publicKey: Ki,
@@ -7739,14 +7858,12 @@ var HDWallet = class {
7739
7858
  );
7740
7859
  }
7741
7860
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
7742
- const depth = hexlify16(Uint8Array.from([this.depth]));
7861
+ const depth = hexlify17(Uint8Array.from([this.depth]));
7743
7862
  const parentFingerprint = this.parentFingerprint;
7744
7863
  const index = toHex(this.index, 4);
7745
7864
  const chainCode = this.chainCode;
7746
7865
  const key = this.privateKey != null && !isPublic ? concat5(["0x00", this.privateKey]) : this.publicKey;
7747
- const extendedKey = getBytesCopy19(
7748
- concat5([prefix, depth, parentFingerprint, index, chainCode, key])
7749
- );
7866
+ const extendedKey = arrayify18(concat5([prefix, depth, parentFingerprint, index, chainCode, key]));
7750
7867
  return base58check(extendedKey);
7751
7868
  }
7752
7869
  /**
@@ -7758,13 +7875,13 @@ var HDWallet = class {
7758
7875
  static fromSeed(seed) {
7759
7876
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
7760
7877
  return new HDWallet({
7761
- chainCode: getBytesCopy19(masterKey.slice(32)),
7762
- privateKey: getBytesCopy19(masterKey.slice(0, 32))
7878
+ chainCode: arrayify18(masterKey.slice(32)),
7879
+ privateKey: arrayify18(masterKey.slice(0, 32))
7763
7880
  });
7764
7881
  }
7765
7882
  static fromExtendedKey(extendedKey) {
7766
7883
  const decoded = toBeHex(decodeBase58(extendedKey));
7767
- const bytes = getBytesCopy19(decoded);
7884
+ const bytes = arrayify18(decoded);
7768
7885
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
7769
7886
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
7770
7887
  throw new FuelError18(ErrorCode17.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
@@ -7773,9 +7890,9 @@ var HDWallet = class {
7773
7890
  throw new FuelError18(ErrorCode17.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
7774
7891
  }
7775
7892
  const depth = bytes[4];
7776
- const parentFingerprint = hexlify16(bytes.slice(5, 9));
7777
- const index = parseInt(hexlify16(bytes.slice(9, 13)).substring(2), 16);
7778
- const chainCode = hexlify16(bytes.slice(13, 45));
7893
+ const parentFingerprint = hexlify17(bytes.slice(5, 9));
7894
+ const index = parseInt(hexlify17(bytes.slice(9, 13)).substring(2), 16);
7895
+ const chainCode = hexlify17(bytes.slice(13, 45));
7779
7896
  const key = bytes.slice(45, 78);
7780
7897
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
7781
7898
  throw new FuelError18(
@@ -8387,18 +8504,17 @@ import { Address as Address9 } from "@fuel-ts/address";
8387
8504
  import { BaseAssetId as BaseAssetId4 } from "@fuel-ts/address/configs";
8388
8505
  import { ErrorCode as ErrorCode22, FuelError as FuelError23 } from "@fuel-ts/errors";
8389
8506
  import { ByteArrayCoder, InputType as InputType7 } from "@fuel-ts/transactions";
8390
- import { getBytesCopy as getBytesCopy21, hexlify as hexlify18 } from "ethers";
8507
+ import { arrayify as arrayify20, hexlify as hexlify19 } from "@fuel-ts/utils";
8391
8508
 
8392
8509
  // src/predicate/utils/getPredicateRoot.ts
8393
8510
  import { hash as hash2 } from "@fuel-ts/hasher";
8394
8511
  import { calcRoot } from "@fuel-ts/merkle";
8395
- import { chunkAndPadBytes } from "@fuel-ts/utils";
8396
- import { hexlify as hexlify17, concat as concat6, getBytesCopy as getBytesCopy20 } from "ethers";
8512
+ import { chunkAndPadBytes, hexlify as hexlify18, concat as concat6, arrayify as arrayify19 } from "@fuel-ts/utils";
8397
8513
  var getPredicateRoot = (bytecode) => {
8398
8514
  const chunkSize = 16 * 1024;
8399
- const bytes = getBytesCopy20(bytecode);
8515
+ const bytes = arrayify19(bytecode);
8400
8516
  const chunks = chunkAndPadBytes(bytes, chunkSize);
8401
- const codeRoot = calcRoot(chunks.map((c) => hexlify17(c)));
8517
+ const codeRoot = calcRoot(chunks.map((c) => hexlify18(c)));
8402
8518
  const predicateRoot = hash2(concat6(["0x4655454C", codeRoot]));
8403
8519
  return predicateRoot;
8404
8520
  };
@@ -8438,7 +8554,7 @@ var Predicate = class extends Account {
8438
8554
  const request = transactionRequestify(transactionRequestLike);
8439
8555
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
8440
8556
  request.inputs?.forEach((input) => {
8441
- if (input.type === InputType7.Coin && hexlify18(input.owner) === this.address.toB256()) {
8557
+ if (input.type === InputType7.Coin && hexlify19(input.owner) === this.address.toB256()) {
8442
8558
  input.predicate = this.bytes;
8443
8559
  input.predicateData = this.getPredicateData(policies.length);
8444
8560
  }
@@ -8509,7 +8625,7 @@ var Predicate = class extends Account {
8509
8625
  * @returns An object containing the new predicate bytes and interface.
8510
8626
  */
8511
8627
  static processPredicateData(bytes, jsonAbi, configurableConstants) {
8512
- let predicateBytes = getBytesCopy21(bytes);
8628
+ let predicateBytes = arrayify20(bytes);
8513
8629
  let abiInterface;
8514
8630
  if (jsonAbi) {
8515
8631
  abiInterface = new Interface3(jsonAbi);
@@ -8569,6 +8685,9 @@ var Predicate = class extends Account {
8569
8685
  }
8570
8686
  };
8571
8687
 
8688
+ // src/connectors/fuel.ts
8689
+ import { ErrorCode as ErrorCode23, FuelError as FuelError24 } from "@fuel-ts/errors";
8690
+
8572
8691
  // src/connectors/fuel-connector.ts
8573
8692
  import { EventEmitter as EventEmitter2 } from "events";
8574
8693
 
@@ -8609,17 +8728,6 @@ var FuelConnectorEventTypes = /* @__PURE__ */ ((FuelConnectorEventTypes2) => {
8609
8728
  })(FuelConnectorEventTypes || {});
8610
8729
  var FuelConnectorEventType = "FuelConnector";
8611
8730
 
8612
- // src/connectors/types/data-type.ts
8613
- var MessageTypes = /* @__PURE__ */ ((MessageTypes2) => {
8614
- MessageTypes2["ping"] = "ping";
8615
- MessageTypes2["uiEvent"] = "uiEvent";
8616
- MessageTypes2["event"] = "event";
8617
- MessageTypes2["request"] = "request";
8618
- MessageTypes2["response"] = "response";
8619
- MessageTypes2["removeConnection"] = "removeConnection";
8620
- return MessageTypes2;
8621
- })(MessageTypes || {});
8622
-
8623
8731
  // src/connectors/types/local-storage.ts
8624
8732
  var LocalStorage = class {
8625
8733
  storage;
@@ -8908,6 +9016,7 @@ async function withTimeout(promise, timeout = 1050) {
8908
9016
  // src/connectors/fuel.ts
8909
9017
  var HAS_CONNECTOR_TIMEOUT = 2e3;
8910
9018
  var PING_CACHE_TIME = 5e3;
9019
+ var { warn } = console;
8911
9020
  var _Fuel = class extends FuelConnector {
8912
9021
  _storage = null;
8913
9022
  _connectors = [];
@@ -9176,14 +9285,12 @@ var _Fuel = class extends FuelConnector {
9176
9285
  * Return a Fuel Provider instance with extends features to work with
9177
9286
  * connectors.
9178
9287
  *
9179
- * @deprecated Provider is going to be deprecated in the future.
9288
+ * @deprecated getProvider is deprecated and is going to be removed in the future, use getWallet instead.
9180
9289
  */
9181
9290
  async getProvider(providerOrNetwork) {
9182
- if (process.env.NODE_ENV !== "production") {
9183
- console.warn(
9184
- "Get provider is deprecated, use getWallet instead. Provider is going to be removed in the future."
9185
- );
9186
- }
9291
+ warn(
9292
+ "getProvider is deprecated and is going to be removed in the future, use getWallet instead."
9293
+ );
9187
9294
  return this._getProvider(providerOrNetwork);
9188
9295
  }
9189
9296
  /**
@@ -9200,7 +9307,7 @@ var _Fuel = class extends FuelConnector {
9200
9307
  const currentNetwork = await this.currentNetwork();
9201
9308
  provider = await Provider.create(currentNetwork.url);
9202
9309
  } else {
9203
- throw new Error("Provider is not valid.");
9310
+ throw new FuelError24(ErrorCode23.INVALID_PROVIDER, "Provider is not valid.");
9204
9311
  }
9205
9312
  return provider;
9206
9313
  }
@@ -9243,6 +9350,7 @@ export {
9243
9350
  AddressType,
9244
9351
  BaseTransactionRequest,
9245
9352
  BaseWalletUnlocked,
9353
+ CHAIN_IDS,
9246
9354
  ChainName,
9247
9355
  ChangeOutputCollisionError,
9248
9356
  CreateTransactionRequest,
@@ -9256,7 +9364,6 @@ export {
9256
9364
  LocalStorage,
9257
9365
  MNEMONIC_SIZES,
9258
9366
  MemoryStorage,
9259
- MessageTypes,
9260
9367
  mnemonic_default as Mnemonic,
9261
9368
  MnemonicVault,
9262
9369
  NoWitnessAtIndexError,
@@ -9281,6 +9388,7 @@ export {
9281
9388
  addOperation,
9282
9389
  assembleReceiptByType,
9283
9390
  assembleTransactionSummary,
9391
+ assets,
9284
9392
  buildBlockExplorerUrl,
9285
9393
  cacheFor,
9286
9394
  calculateMetadataGasForTxCreate,
@@ -9293,15 +9401,15 @@ export {
9293
9401
  english,
9294
9402
  extractBurnedAssetsFromReceipts,
9295
9403
  extractMintedAssetsFromReceipts,
9296
- fromDateToTai64,
9297
- fromTai64ToDate,
9298
- fromTai64ToUnix,
9299
- fromUnixToTai64,
9300
9404
  gasUsedByInputs,
9405
+ getAssetEth,
9406
+ getAssetFuel,
9407
+ getAssetNetwork,
9408
+ getAssetWithNetwork,
9301
9409
  getContractCallOperations,
9302
9410
  getContractCreatedOperations,
9303
- getContractTransferOperations,
9304
9411
  getDecodedLogs,
9412
+ getDefaultChainId,
9305
9413
  getGasUsedFromReceipts,
9306
9414
  getInputAccountAddress,
9307
9415
  getInputContractFromIndex,
@@ -9350,9 +9458,11 @@ export {
9350
9458
  processGqlReceipt,
9351
9459
  processGraphqlStatus,
9352
9460
  resolveGasDependentCosts,
9461
+ resolveIconPaths,
9353
9462
  returnZeroScript,
9354
9463
  sleep,
9355
9464
  transactionRequestify,
9465
+ urlJoin,
9356
9466
  withTimeout,
9357
9467
  withdrawScript
9358
9468
  };