@fuel-ts/account 0.94.4 → 0.94.5

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.
@@ -378,8 +378,8 @@ var addAmountToCoinQuantities = (params) => {
378
378
  import { Address as Address3 } from "@fuel-ts/address";
379
379
  import { ErrorCode as ErrorCode14, FuelError as FuelError16 } from "@fuel-ts/errors";
380
380
  import { BN as BN2, bn as bn17 } from "@fuel-ts/math";
381
- import { InputType as InputType7, InputMessageCoder, TransactionCoder as TransactionCoder5 } from "@fuel-ts/transactions";
382
- import { arrayify as arrayify12, hexlify as hexlify14, DateTime as DateTime2, isDefined as isDefined2 } from "@fuel-ts/utils";
381
+ import { InputType as InputType7, InputMessageCoder as InputMessageCoder2, TransactionCoder as TransactionCoder5 } from "@fuel-ts/transactions";
382
+ import { arrayify as arrayify12, hexlify as hexlify15, DateTime as DateTime2, isDefined as isDefined2 } from "@fuel-ts/utils";
383
383
  import { checkFuelCoreVersionCompatibility } from "@fuel-ts/versions";
384
384
  import { equalBytes } from "@noble/curves/abstract/utils";
385
385
  import { GraphQLClient } from "graphql-request";
@@ -1332,6 +1332,13 @@ var SubmitAndAwaitDocument = gql`
1332
1332
  }
1333
1333
  }
1334
1334
  ${TransactionStatusSubscriptionFragmentDoc}`;
1335
+ var SubmitAndAwaitStatusDocument = gql`
1336
+ subscription submitAndAwaitStatus($encodedTransaction: HexString!) {
1337
+ submitAndAwaitStatus(tx: $encodedTransaction) {
1338
+ ...transactionStatusSubscriptionFragment
1339
+ }
1340
+ }
1341
+ ${TransactionStatusSubscriptionFragmentDoc}`;
1335
1342
  var StatusChangeDocument = gql`
1336
1343
  subscription statusChange($transactionId: TransactionId!) {
1337
1344
  statusChange(id: $transactionId) {
@@ -1428,6 +1435,9 @@ function getSdk(requester) {
1428
1435
  submitAndAwait(variables, options) {
1429
1436
  return requester(SubmitAndAwaitDocument, variables, options);
1430
1437
  },
1438
+ submitAndAwaitStatus(variables, options) {
1439
+ return requester(SubmitAndAwaitStatusDocument, variables, options);
1440
+ },
1431
1441
  statusChange(variables, options) {
1432
1442
  return requester(StatusChangeDocument, variables, options);
1433
1443
  }
@@ -1454,7 +1464,9 @@ var _FuelGraphqlSubscriber = class {
1454
1464
  Accept: "text/event-stream"
1455
1465
  }
1456
1466
  });
1457
- return new _FuelGraphqlSubscriber(response.body.getReader());
1467
+ const [errorReader, resultReader] = response.body.tee().map((stream) => stream.getReader());
1468
+ await new _FuelGraphqlSubscriber(errorReader).next();
1469
+ return new _FuelGraphqlSubscriber(resultReader);
1458
1470
  }
1459
1471
  events = [];
1460
1472
  parsingLeftover = "";
@@ -1497,10 +1509,8 @@ var _FuelGraphqlSubscriber = class {
1497
1509
  /**
1498
1510
  * Gets called when `break` is called in a `for-await-of` loop.
1499
1511
  */
1500
- async return() {
1501
- await this.stream.cancel();
1502
- this.stream.releaseLock();
1503
- return { done: true, value: void 0 };
1512
+ return() {
1513
+ return Promise.resolve({ done: true, value: void 0 });
1504
1514
  }
1505
1515
  [Symbol.asyncIterator]() {
1506
1516
  return this;
@@ -1717,7 +1727,7 @@ import {
1717
1727
  OutputType as OutputType2,
1718
1728
  TransactionType
1719
1729
  } from "@fuel-ts/transactions";
1720
- import { concat as concat2, hexlify as hexlify9, isDefined } from "@fuel-ts/utils";
1730
+ import { concat as concat2, hexlify as hexlify10, isDefined } from "@fuel-ts/utils";
1721
1731
 
1722
1732
  // src/providers/message.ts
1723
1733
  var isMessageCoin = (message) => !("data" in message);
@@ -1729,14 +1739,9 @@ var isCoin = (resource) => "id" in resource;
1729
1739
  import { ZeroBytes32 as ZeroBytes323 } from "@fuel-ts/address/configs";
1730
1740
  import { ErrorCode as ErrorCode5, FuelError as FuelError6 } from "@fuel-ts/errors";
1731
1741
  import { bn as bn4 } from "@fuel-ts/math";
1732
- import {
1733
- ReceiptBurnCoder,
1734
- ReceiptMessageOutCoder,
1735
- ReceiptMintCoder,
1736
- ReceiptType
1737
- } from "@fuel-ts/transactions";
1742
+ import { getMintedAssetId, InputMessageCoder, ReceiptType } from "@fuel-ts/transactions";
1738
1743
  import { FAILED_TRANSFER_TO_ADDRESS_SIGNAL } from "@fuel-ts/transactions/configs";
1739
- import { arrayify as arrayify3 } from "@fuel-ts/utils";
1744
+ import { arrayify as arrayify3, hexlify as hexlify7 } from "@fuel-ts/utils";
1740
1745
  var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
1741
1746
  var doesReceiptHaveMissingContractId = (receipt) => receipt.type === ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
1742
1747
  var getReceiptsWithMissingData = (receipts) => receipts.reduce(
@@ -1882,12 +1887,12 @@ function assembleReceiptByType(receipt) {
1882
1887
  const amount = bn4(receipt.amount);
1883
1888
  const data = receipt.data ? arrayify3(receipt.data) : Uint8Array.from([]);
1884
1889
  const digest = hexOrZero(receipt.digest);
1885
- const messageId = ReceiptMessageOutCoder.getMessageId({
1890
+ const messageId = InputMessageCoder.getMessageId({
1886
1891
  sender,
1887
1892
  recipient,
1888
1893
  nonce,
1889
1894
  amount,
1890
- data
1895
+ data: hexlify7(data)
1891
1896
  });
1892
1897
  const receiptMessageOut = {
1893
1898
  type: ReceiptType.MessageOut,
@@ -1904,7 +1909,7 @@ function assembleReceiptByType(receipt) {
1904
1909
  case "MINT" /* Mint */: {
1905
1910
  const contractId = hexOrZero(receipt.id || receipt.contractId);
1906
1911
  const subId = hexOrZero(receipt.subId);
1907
- const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
1912
+ const assetId = getMintedAssetId(contractId, subId);
1908
1913
  const mintReceipt = {
1909
1914
  type: ReceiptType.Mint,
1910
1915
  subId,
@@ -1919,7 +1924,7 @@ function assembleReceiptByType(receipt) {
1919
1924
  case "BURN" /* Burn */: {
1920
1925
  const contractId = hexOrZero(receipt.id || receipt.contractId);
1921
1926
  const subId = hexOrZero(receipt.subId);
1922
- const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
1927
+ const assetId = getMintedAssetId(contractId, subId);
1923
1928
  const burnReceipt = {
1924
1929
  type: ReceiptType.Burn,
1925
1930
  subId,
@@ -2045,13 +2050,13 @@ var calculateGasFee = (params) => {
2045
2050
  };
2046
2051
 
2047
2052
  // src/providers/utils/json.ts
2048
- import { hexlify as hexlify7 } from "@fuel-ts/utils";
2053
+ import { hexlify as hexlify8 } from "@fuel-ts/utils";
2049
2054
  import { clone } from "ramda";
2050
2055
  function normalize(object) {
2051
2056
  Object.keys(object).forEach((key) => {
2052
2057
  switch (object[key]?.constructor.name) {
2053
2058
  case "Uint8Array":
2054
- object[key] = hexlify7(object[key]);
2059
+ object[key] = hexlify8(object[key]);
2055
2060
  break;
2056
2061
  case "Array":
2057
2062
  object[key] = normalize(object[key]);
@@ -2215,11 +2220,11 @@ var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
2215
2220
  );
2216
2221
 
2217
2222
  // src/providers/transaction-request/witness.ts
2218
- import { arrayify as arrayify5, hexlify as hexlify8 } from "@fuel-ts/utils";
2223
+ import { arrayify as arrayify5, hexlify as hexlify9 } from "@fuel-ts/utils";
2219
2224
  var witnessify = (value) => {
2220
2225
  const data = arrayify5(value);
2221
2226
  return {
2222
- data: hexlify8(data),
2227
+ data: hexlify9(data),
2223
2228
  dataLength: data.length
2224
2229
  };
2225
2230
  };
@@ -2436,9 +2441,9 @@ var BaseTransactionRequest = class {
2436
2441
  const found = this.inputs.find((input) => {
2437
2442
  switch (input.type) {
2438
2443
  case InputType3.Coin:
2439
- return hexlify9(input.owner) === ownerAddress.toB256();
2444
+ return hexlify10(input.owner) === ownerAddress.toB256();
2440
2445
  case InputType3.Message:
2441
- return hexlify9(input.recipient) === ownerAddress.toB256();
2446
+ return hexlify10(input.recipient) === ownerAddress.toB256();
2442
2447
  default:
2443
2448
  return false;
2444
2449
  }
@@ -2576,7 +2581,7 @@ var BaseTransactionRequest = class {
2576
2581
  */
2577
2582
  addChangeOutput(to, assetId) {
2578
2583
  const changeOutput = this.getChangeOutputs().find(
2579
- (output) => hexlify9(output.assetId) === assetId
2584
+ (output) => hexlify10(output.assetId) === assetId
2580
2585
  );
2581
2586
  if (!changeOutput) {
2582
2587
  this.pushOutput({
@@ -2656,12 +2661,12 @@ var BaseTransactionRequest = class {
2656
2661
  usedQuantity = bn8("1000000000000000000");
2657
2662
  }
2658
2663
  if (assetInput && "assetId" in assetInput) {
2659
- assetInput.id = hexlify9(randomBytes3(UTXO_ID_LEN2));
2664
+ assetInput.id = hexlify10(randomBytes3(UTXO_ID_LEN2));
2660
2665
  assetInput.amount = usedQuantity;
2661
2666
  } else {
2662
2667
  this.addResources([
2663
2668
  {
2664
- id: hexlify9(randomBytes3(UTXO_ID_LEN2)),
2669
+ id: hexlify10(randomBytes3(UTXO_ID_LEN2)),
2665
2670
  amount: usedQuantity,
2666
2671
  assetId,
2667
2672
  owner: resourcesOwner || Address2.fromRandom(),
@@ -2864,11 +2869,11 @@ var BlobTransactionRequest = class extends BaseTransactionRequest {
2864
2869
  import { ZeroBytes32 as ZeroBytes326 } from "@fuel-ts/address/configs";
2865
2870
  import { bn as bn10 } from "@fuel-ts/math";
2866
2871
  import { TransactionType as TransactionType3, OutputType as OutputType4 } from "@fuel-ts/transactions";
2867
- import { arrayify as arrayify7, hexlify as hexlify11 } from "@fuel-ts/utils";
2872
+ import { arrayify as arrayify7, hexlify as hexlify12 } from "@fuel-ts/utils";
2868
2873
  import { clone as clone4 } from "ramda";
2869
2874
 
2870
2875
  // src/providers/transaction-request/storage-slot.ts
2871
- import { arrayify as arrayify6, hexlify as hexlify10 } from "@fuel-ts/utils";
2876
+ import { arrayify as arrayify6, hexlify as hexlify11 } from "@fuel-ts/utils";
2872
2877
  var getStorageValue = (value) => {
2873
2878
  const v = new Uint8Array(32);
2874
2879
  v.set(arrayify6(value));
@@ -2885,8 +2890,8 @@ var storageSlotify = (storageSlot) => {
2885
2890
  value = storageSlot.value;
2886
2891
  }
2887
2892
  return {
2888
- key: hexlify10(key),
2889
- value: hexlify10(getStorageValue(value))
2893
+ key: hexlify11(key),
2894
+ value: hexlify11(getStorageValue(value))
2890
2895
  };
2891
2896
  };
2892
2897
 
@@ -2911,7 +2916,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2911
2916
  constructor({ bytecodeWitnessIndex, salt, storageSlots, ...rest }) {
2912
2917
  super(rest);
2913
2918
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
2914
- this.salt = hexlify11(salt ?? ZeroBytes326);
2919
+ this.salt = hexlify12(salt ?? ZeroBytes326);
2915
2920
  this.storageSlots = [...storageSlots ?? []];
2916
2921
  }
2917
2922
  /**
@@ -2928,7 +2933,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2928
2933
  ...baseTransaction,
2929
2934
  bytecodeWitnessIndex,
2930
2935
  storageSlotsCount: bn10(storageSlots.length),
2931
- salt: this.salt ? hexlify11(this.salt) : ZeroBytes326,
2936
+ salt: this.salt ? hexlify12(this.salt) : ZeroBytes326,
2932
2937
  storageSlots
2933
2938
  };
2934
2939
  }
@@ -2981,7 +2986,7 @@ import { addressify as addressify2 } from "@fuel-ts/address";
2981
2986
  import { ZeroBytes32 as ZeroBytes327 } from "@fuel-ts/address/configs";
2982
2987
  import { bn as bn11 } from "@fuel-ts/math";
2983
2988
  import { InputType as InputType5, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2984
- import { arrayify as arrayify9, hexlify as hexlify12 } from "@fuel-ts/utils";
2989
+ import { arrayify as arrayify9, hexlify as hexlify13 } from "@fuel-ts/utils";
2985
2990
  import { clone as clone5 } from "ramda";
2986
2991
 
2987
2992
  // src/providers/transaction-request/scripts.ts
@@ -3051,8 +3056,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
3051
3056
  scriptLength: bn11(script.length),
3052
3057
  scriptDataLength: bn11(scriptData.length),
3053
3058
  receiptsRoot: ZeroBytes327,
3054
- script: hexlify12(script),
3055
- scriptData: hexlify12(scriptData)
3059
+ script: hexlify13(script),
3060
+ scriptData: hexlify13(scriptData)
3056
3061
  };
3057
3062
  }
3058
3063
  /**
@@ -3227,7 +3232,7 @@ import { arrayify as arrayify11, assertUnreachable } from "@fuel-ts/utils";
3227
3232
  // src/providers/transaction-summary/assemble-transaction-summary.ts
3228
3233
  import { bn as bn15 } from "@fuel-ts/math";
3229
3234
  import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
3230
- import { DateTime, hexlify as hexlify13 } from "@fuel-ts/utils";
3235
+ import { DateTime, hexlify as hexlify14 } from "@fuel-ts/utils";
3231
3236
 
3232
3237
  // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
3233
3238
  import { bn as bn12 } from "@fuel-ts/math";
@@ -3940,7 +3945,7 @@ function assembleTransactionSummary(params) {
3940
3945
  baseAssetId
3941
3946
  } = params;
3942
3947
  const gasUsed = getGasUsedFromReceipts(receipts);
3943
- const rawPayload = hexlify13(transactionBytes);
3948
+ const rawPayload = hexlify14(transactionBytes);
3944
3949
  const operations = getOperations({
3945
3950
  transactionType: transaction.type,
3946
3951
  inputs: transaction.inputs || [],
@@ -4049,29 +4054,30 @@ function mapGqlOutputsToTxOutputs(outputs) {
4049
4054
  });
4050
4055
  }
4051
4056
  var TransactionResponse = class {
4052
- /** Transaction ID */
4053
- id;
4054
- /** Current provider */
4055
- provider;
4056
- /** Gas used on the transaction */
4057
- gasUsed = bn16(0);
4058
- /** The graphql Transaction with receipts object. */
4059
- gqlTransaction;
4060
- request;
4061
- status;
4062
- abis;
4063
4057
  /**
4064
4058
  * Constructor for `TransactionResponse`.
4065
4059
  *
4066
4060
  * @param tx - The transaction ID or TransactionRequest.
4067
4061
  * @param provider - The provider.
4068
4062
  */
4069
- constructor(tx, provider, abis) {
4063
+ constructor(tx, provider, abis, submitTxSubscription) {
4064
+ this.submitTxSubscription = submitTxSubscription;
4070
4065
  this.id = typeof tx === "string" ? tx : tx.getTransactionId(provider.getChainId());
4071
4066
  this.provider = provider;
4072
4067
  this.abis = abis;
4073
4068
  this.request = typeof tx === "string" ? void 0 : tx;
4074
4069
  }
4070
+ /** Transaction ID */
4071
+ id;
4072
+ /** Current provider */
4073
+ provider;
4074
+ /** Gas used on the transaction */
4075
+ gasUsed = bn16(0);
4076
+ /** The graphql Transaction with receipts object. */
4077
+ gqlTransaction;
4078
+ request;
4079
+ status;
4080
+ abis;
4075
4081
  /**
4076
4082
  * Async constructor for `TransactionResponse`. This method can be used to create
4077
4083
  * an instance of `TransactionResponse` and wait for the transaction to be fetched
@@ -4204,10 +4210,11 @@ var TransactionResponse = class {
4204
4210
  if (status && status !== "SubmittedStatus") {
4205
4211
  return;
4206
4212
  }
4207
- const subscription = await this.provider.operations.statusChange({
4213
+ const subscription = this.submitTxSubscription ?? await this.provider.operations.statusChange({
4208
4214
  transactionId: this.id
4209
4215
  });
4210
- for await (const { statusChange } of subscription) {
4216
+ for await (const sub of subscription) {
4217
+ const statusChange = "statusChange" in sub ? sub.statusChange : sub.submitAndAwaitStatus;
4211
4218
  this.status = statusChange;
4212
4219
  if (statusChange.type === "SqueezedOutStatus") {
4213
4220
  this.unsetResourceCache();
@@ -4485,7 +4492,7 @@ var _Provider = class {
4485
4492
  const provider = new _Provider(urlToUse, {
4486
4493
  ...options,
4487
4494
  requestMiddleware: async (request) => {
4488
- if (auth) {
4495
+ if (auth && request) {
4489
4496
  request.headers ??= {};
4490
4497
  request.headers.Authorization = auth;
4491
4498
  }
@@ -4740,16 +4747,14 @@ Supported fuel-core version: ${supportedVersion}.`
4740
4747
  }
4741
4748
  const { consensusParameters } = this.getChain();
4742
4749
  this.validateTransaction(transactionRequest, consensusParameters);
4743
- const encodedTransaction = hexlify14(transactionRequest.toTransactionBytes());
4750
+ const encodedTransaction = hexlify15(transactionRequest.toTransactionBytes());
4744
4751
  let abis;
4745
4752
  if (isTransactionTypeScript(transactionRequest)) {
4746
4753
  abis = transactionRequest.abis;
4747
4754
  }
4748
- const {
4749
- submit: { id: transactionId }
4750
- } = await this.operations.submit({ encodedTransaction });
4751
- __privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs, transactionId);
4752
- return new TransactionResponse(transactionRequest, this, abis);
4755
+ const subscription = await this.operations.submitAndAwaitStatus({ encodedTransaction });
4756
+ __privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs, transactionRequest.getTransactionId(this.getChainId()));
4757
+ return new TransactionResponse(transactionRequest, this, abis, subscription);
4753
4758
  }
4754
4759
  /**
4755
4760
  * Executes a transaction without actually submitting it to the chain.
@@ -4766,7 +4771,7 @@ Supported fuel-core version: ${supportedVersion}.`
4766
4771
  if (estimateTxDependencies) {
4767
4772
  return this.estimateTxDependencies(transactionRequest);
4768
4773
  }
4769
- const encodedTransaction = hexlify14(transactionRequest.toTransactionBytes());
4774
+ const encodedTransaction = hexlify15(transactionRequest.toTransactionBytes());
4770
4775
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4771
4776
  encodedTransactions: encodedTransaction,
4772
4777
  utxoValidation: utxoValidation || false
@@ -4792,7 +4797,7 @@ Supported fuel-core version: ${supportedVersion}.`
4792
4797
  if (!shouldEstimatePredicates) {
4793
4798
  return transactionRequest;
4794
4799
  }
4795
- const encodedTransaction = hexlify14(transactionRequest.toTransactionBytes());
4800
+ const encodedTransaction = hexlify15(transactionRequest.toTransactionBytes());
4796
4801
  const response = await this.operations.estimatePredicates({
4797
4802
  encodedTransaction
4798
4803
  });
@@ -4833,7 +4838,7 @@ Supported fuel-core version: ${supportedVersion}.`
4833
4838
  const {
4834
4839
  dryRun: [{ receipts: rawReceipts, status }]
4835
4840
  } = await this.operations.dryRun({
4836
- encodedTransactions: [hexlify14(transactionRequest.toTransactionBytes())],
4841
+ encodedTransactions: [hexlify15(transactionRequest.toTransactionBytes())],
4837
4842
  utxoValidation: false
4838
4843
  });
4839
4844
  receipts = rawReceipts.map(processGqlReceipt);
@@ -4883,7 +4888,7 @@ Supported fuel-core version: ${supportedVersion}.`
4883
4888
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
4884
4889
  allRequests.forEach((req, index) => {
4885
4890
  if (isTransactionTypeScript(req)) {
4886
- serializedTransactionsMap.set(index, hexlify14(req.toTransactionBytes()));
4891
+ serializedTransactionsMap.set(index, hexlify15(req.toTransactionBytes()));
4887
4892
  }
4888
4893
  });
4889
4894
  let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
@@ -4919,7 +4924,7 @@ Supported fuel-core version: ${supportedVersion}.`
4919
4924
  transactionRequest: request
4920
4925
  });
4921
4926
  request.maxFee = maxFee;
4922
- serializedTransactionsMap.set(requestIdx, hexlify14(request.toTransactionBytes()));
4927
+ serializedTransactionsMap.set(requestIdx, hexlify15(request.toTransactionBytes()));
4923
4928
  nextRoundTransactions.push(requestIdx);
4924
4929
  }
4925
4930
  }
@@ -4940,7 +4945,7 @@ Supported fuel-core version: ${supportedVersion}.`
4940
4945
  if (estimateTxDependencies) {
4941
4946
  return this.estimateMultipleTxDependencies(transactionRequests);
4942
4947
  }
4943
- const encodedTransactions = transactionRequests.map((tx) => hexlify14(tx.toTransactionBytes()));
4948
+ const encodedTransactions = transactionRequests.map((tx) => hexlify15(tx.toTransactionBytes()));
4944
4949
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4945
4950
  encodedTransactions,
4946
4951
  utxoValidation: utxoValidation || false
@@ -5014,7 +5019,7 @@ Supported fuel-core version: ${supportedVersion}.`
5014
5019
  if (estimateTxDependencies) {
5015
5020
  return this.estimateTxDependencies(transactionRequest);
5016
5021
  }
5017
- const encodedTransactions = [hexlify14(transactionRequest.toTransactionBytes())];
5022
+ const encodedTransactions = [hexlify15(transactionRequest.toTransactionBytes())];
5018
5023
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
5019
5024
  encodedTransactions,
5020
5025
  utxoValidation: true
@@ -5113,7 +5118,7 @@ Supported fuel-core version: ${supportedVersion}.`
5113
5118
  paginationLimit: RESOURCES_PAGE_SIZE_LIMIT,
5114
5119
  inputArgs: paginationArgs
5115
5120
  }),
5116
- filter: { owner: ownerAddress.toB256(), assetId: assetId && hexlify14(assetId) }
5121
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && hexlify15(assetId) }
5117
5122
  });
5118
5123
  const coins = edges.map(({ node }) => ({
5119
5124
  id: node.utxoId,
@@ -5139,8 +5144,8 @@ Supported fuel-core version: ${supportedVersion}.`
5139
5144
  async getResourcesToSpend(owner, quantities, excludedIds) {
5140
5145
  const ownerAddress = Address3.fromAddressOrString(owner);
5141
5146
  const excludeInput = {
5142
- messages: excludedIds?.messages?.map((nonce) => hexlify14(nonce)) || [],
5143
- utxos: excludedIds?.utxos?.map((id) => hexlify14(id)) || []
5147
+ messages: excludedIds?.messages?.map((nonce) => hexlify15(nonce)) || [],
5148
+ utxos: excludedIds?.utxos?.map((id) => hexlify15(id)) || []
5144
5149
  };
5145
5150
  if (this.cache) {
5146
5151
  const cached = this.cache.getActiveData();
@@ -5150,7 +5155,7 @@ Supported fuel-core version: ${supportedVersion}.`
5150
5155
  const coinsQuery = {
5151
5156
  owner: ownerAddress.toB256(),
5152
5157
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
5153
- assetId: hexlify14(assetId),
5158
+ assetId: hexlify15(assetId),
5154
5159
  amount: amount.toString(10),
5155
5160
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
5156
5161
  })),
@@ -5379,7 +5384,7 @@ Supported fuel-core version: ${supportedVersion}.`
5379
5384
  async getContractBalance(contractId, assetId) {
5380
5385
  const { contractBalance } = await this.operations.getContractBalance({
5381
5386
  contract: Address3.fromAddressOrString(contractId).toB256(),
5382
- asset: hexlify14(assetId)
5387
+ asset: hexlify15(assetId)
5383
5388
  });
5384
5389
  return bn17(contractBalance.amount, 10);
5385
5390
  }
@@ -5393,7 +5398,7 @@ Supported fuel-core version: ${supportedVersion}.`
5393
5398
  async getBalance(owner, assetId) {
5394
5399
  const { balance } = await this.operations.getBalance({
5395
5400
  owner: Address3.fromAddressOrString(owner).toB256(),
5396
- assetId: hexlify14(assetId)
5401
+ assetId: hexlify15(assetId)
5397
5402
  });
5398
5403
  return bn17(balance.amount, 10);
5399
5404
  }
@@ -5439,7 +5444,7 @@ Supported fuel-core version: ${supportedVersion}.`
5439
5444
  owner: Address3.fromAddressOrString(address).toB256()
5440
5445
  });
5441
5446
  const messages = edges.map(({ node }) => ({
5442
- messageId: InputMessageCoder.getMessageId({
5447
+ messageId: InputMessageCoder2.getMessageId({
5443
5448
  sender: node.sender,
5444
5449
  recipient: node.recipient,
5445
5450
  nonce: node.nonce,
@@ -5450,7 +5455,7 @@ Supported fuel-core version: ${supportedVersion}.`
5450
5455
  recipient: Address3.fromAddressOrString(node.recipient),
5451
5456
  nonce: node.nonce,
5452
5457
  amount: bn17(node.amount),
5453
- data: InputMessageCoder.decodeData(node.data),
5458
+ data: InputMessageCoder2.decodeData(node.data),
5454
5459
  daHeight: bn17(node.daHeight)
5455
5460
  }));
5456
5461
  return {
@@ -5619,7 +5624,7 @@ Supported fuel-core version: ${supportedVersion}.`
5619
5624
  return null;
5620
5625
  }
5621
5626
  const message = {
5622
- messageId: InputMessageCoder.getMessageId({
5627
+ messageId: InputMessageCoder2.getMessageId({
5623
5628
  sender: rawMessage.sender,
5624
5629
  recipient: rawMessage.recipient,
5625
5630
  nonce: rawMessage.nonce,
@@ -5630,7 +5635,7 @@ Supported fuel-core version: ${supportedVersion}.`
5630
5635
  recipient: Address3.fromAddressOrString(rawMessage.recipient),
5631
5636
  nonce: rawMessage.nonce,
5632
5637
  amount: bn17(rawMessage.amount),
5633
- data: InputMessageCoder.decodeData(rawMessage.data),
5638
+ data: InputMessageCoder2.decodeData(rawMessage.data),
5634
5639
  daHeight: bn17(rawMessage.daHeight)
5635
5640
  };
5636
5641
  return message;
@@ -5808,7 +5813,7 @@ var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
5808
5813
 
5809
5814
  // src/test-utils/test-asset-id.ts
5810
5815
  import { randomBytes as randomBytes4 } from "@fuel-ts/crypto";
5811
- import { hexlify as hexlify15 } from "@fuel-ts/utils";
5816
+ import { hexlify as hexlify16 } from "@fuel-ts/utils";
5812
5817
  var _TestAssetId = class {
5813
5818
  constructor(value) {
5814
5819
  this.value = value;
@@ -5816,7 +5821,7 @@ var _TestAssetId = class {
5816
5821
  static random(count = 1) {
5817
5822
  const assetIds = [];
5818
5823
  for (let i = 0; i < count; i++) {
5819
- assetIds.push(new _TestAssetId(hexlify15(randomBytes4(32))));
5824
+ assetIds.push(new _TestAssetId(hexlify16(randomBytes4(32))));
5820
5825
  }
5821
5826
  return assetIds;
5822
5827
  }
@@ -5832,11 +5837,11 @@ __publicField(TestAssetId, "B", new _TestAssetId(
5832
5837
  // src/test-utils/wallet-config.ts
5833
5838
  import { randomBytes as randomBytes8 } from "@fuel-ts/crypto";
5834
5839
  import { FuelError as FuelError23 } from "@fuel-ts/errors";
5835
- import { defaultSnapshotConfigs as defaultSnapshotConfigs2, hexlify as hexlify21 } from "@fuel-ts/utils";
5840
+ import { defaultSnapshotConfigs as defaultSnapshotConfigs2, hexlify as hexlify22 } from "@fuel-ts/utils";
5836
5841
 
5837
5842
  // src/wallet/base-wallet-unlocked.ts
5838
5843
  import { hashMessage } from "@fuel-ts/hasher";
5839
- import { hexlify as hexlify18 } from "@fuel-ts/utils";
5844
+ import { hexlify as hexlify19 } from "@fuel-ts/utils";
5840
5845
 
5841
5846
  // src/account.ts
5842
5847
  import { UTXO_ID_LEN as UTXO_ID_LEN3 } from "@fuel-ts/abi-coder";
@@ -5846,7 +5851,7 @@ import { ErrorCode as ErrorCode16, FuelError as FuelError18 } from "@fuel-ts/err
5846
5851
  import { AbstractAccount } from "@fuel-ts/interfaces";
5847
5852
  import { bn as bn19 } from "@fuel-ts/math";
5848
5853
  import { InputType as InputType8 } from "@fuel-ts/transactions";
5849
- import { arrayify as arrayify15, hexlify as hexlify16, isDefined as isDefined3 } from "@fuel-ts/utils";
5854
+ import { arrayify as arrayify15, hexlify as hexlify17, isDefined as isDefined3 } from "@fuel-ts/utils";
5850
5855
  import { clone as clone7 } from "ramda";
5851
5856
 
5852
5857
  // src/providers/utils/merge-quantities.ts
@@ -6382,7 +6387,7 @@ var Account = class extends AbstractAccount {
6382
6387
  */
6383
6388
  generateFakeResources(coins) {
6384
6389
  return coins.map((coin) => ({
6385
- id: hexlify16(randomBytes5(UTXO_ID_LEN3)),
6390
+ id: hexlify17(randomBytes5(UTXO_ID_LEN3)),
6386
6391
  owner: this.address,
6387
6392
  blockCreated: bn19(1),
6388
6393
  txCreatedIdx: bn19(1),
@@ -6452,7 +6457,7 @@ import {
6452
6457
  randomUUID as randomUUID2
6453
6458
  } from "@fuel-ts/crypto";
6454
6459
  import { ErrorCode as ErrorCode17, FuelError as FuelError19 } from "@fuel-ts/errors";
6455
- import { hexlify as hexlify17 } from "@fuel-ts/utils";
6460
+ import { hexlify as hexlify18 } from "@fuel-ts/utils";
6456
6461
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
6457
6462
  var DEFAULT_KDF_PARAMS_R = 8;
6458
6463
  var DEFAULT_KDF_PARAMS_P = 1;
@@ -6534,7 +6539,7 @@ async function decryptKeystoreWallet(jsonWallet, password) {
6534
6539
  );
6535
6540
  }
6536
6541
  const buffer = await decryptJsonWalletData(ciphertextBuffer, key, ivBuffer);
6537
- const privateKey = hexlify17(buffer);
6542
+ const privateKey = hexlify18(buffer);
6538
6543
  return privateKey;
6539
6544
  }
6540
6545
 
@@ -6579,7 +6584,7 @@ var BaseWalletUnlocked = class extends Account {
6579
6584
  */
6580
6585
  async signMessage(message) {
6581
6586
  const signedMessage = await this.signer().sign(hashMessage(message));
6582
- return hexlify18(signedMessage);
6587
+ return hexlify19(signedMessage);
6583
6588
  }
6584
6589
  /**
6585
6590
  * Signs a transaction with the wallet's private key.
@@ -6592,7 +6597,7 @@ var BaseWalletUnlocked = class extends Account {
6592
6597
  const chainId = this.provider.getChainId();
6593
6598
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
6594
6599
  const signature = await this.signer().sign(hashedTransaction);
6595
- return hexlify18(signature);
6600
+ return hexlify19(signature);
6596
6601
  }
6597
6602
  /**
6598
6603
  * Populates a transaction with the witnesses signature.
@@ -6662,13 +6667,13 @@ import { computeHmac as computeHmac2, ripemd160 } from "@fuel-ts/crypto";
6662
6667
  import { ErrorCode as ErrorCode20, FuelError as FuelError22 } from "@fuel-ts/errors";
6663
6668
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
6664
6669
  import { bn as bn20, toBytes as toBytes2, toHex } from "@fuel-ts/math";
6665
- import { arrayify as arrayify18, hexlify as hexlify20, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
6670
+ import { arrayify as arrayify18, hexlify as hexlify21, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
6666
6671
 
6667
6672
  // src/mnemonic/mnemonic.ts
6668
6673
  import { randomBytes as randomBytes7, pbkdf2, computeHmac } from "@fuel-ts/crypto";
6669
6674
  import { ErrorCode as ErrorCode19, FuelError as FuelError21 } from "@fuel-ts/errors";
6670
6675
  import { sha256 as sha2563 } from "@fuel-ts/hasher";
6671
- import { arrayify as arrayify17, hexlify as hexlify19, concat as concat4, dataSlice, encodeBase58, toUtf8Bytes } from "@fuel-ts/utils";
6676
+ import { arrayify as arrayify17, hexlify as hexlify20, concat as concat4, dataSlice, encodeBase58, toUtf8Bytes } from "@fuel-ts/utils";
6672
6677
 
6673
6678
  // src/wordlists/words/english.ts
6674
6679
  var english = [
@@ -8862,7 +8867,7 @@ var Mnemonic = class {
8862
8867
  static mnemonicToEntropy(phrase, wordlist = english) {
8863
8868
  const words = getWords(phrase);
8864
8869
  assertMnemonic(words);
8865
- return hexlify19(mnemonicWordsToEntropy(words, wordlist));
8870
+ return hexlify20(mnemonicWordsToEntropy(words, wordlist));
8866
8871
  }
8867
8872
  /**
8868
8873
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -8995,10 +9000,10 @@ var mnemonic_default = Mnemonic;
8995
9000
 
8996
9001
  // src/hdwallet/hdwallet.ts
8997
9002
  var HARDENED_INDEX = 2147483648;
8998
- var MainnetPRV2 = hexlify20("0x0488ade4");
8999
- var MainnetPUB = hexlify20("0x0488b21e");
9000
- var TestnetPRV2 = hexlify20("0x04358394");
9001
- var TestnetPUB = hexlify20("0x043587cf");
9003
+ var MainnetPRV2 = hexlify21("0x0488ade4");
9004
+ var MainnetPUB = hexlify21("0x0488b21e");
9005
+ var TestnetPRV2 = hexlify21("0x04358394");
9006
+ var TestnetPUB = hexlify21("0x043587cf");
9002
9007
  function base58check(data) {
9003
9008
  return encodeBase582(concat5([data, dataSlice2(sha2564(sha2564(data)), 0, 4)]));
9004
9009
  }
@@ -9009,11 +9014,11 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
9009
9014
  return testnet ? TestnetPRV2 : MainnetPRV2;
9010
9015
  }
9011
9016
  function isPublicExtendedKey(extendedKey) {
9012
- return [MainnetPUB, TestnetPUB].includes(hexlify20(extendedKey.slice(0, 4)));
9017
+ return [MainnetPUB, TestnetPUB].includes(hexlify21(extendedKey.slice(0, 4)));
9013
9018
  }
9014
9019
  function isValidExtendedKey(extendedKey) {
9015
9020
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
9016
- hexlify20(extendedKey.slice(0, 4))
9021
+ hexlify21(extendedKey.slice(0, 4))
9017
9022
  );
9018
9023
  }
9019
9024
  function parsePath(path2, depth = 0) {
@@ -9031,8 +9036,8 @@ function parsePath(path2, depth = 0) {
9031
9036
  var HDWallet = class {
9032
9037
  depth = 0;
9033
9038
  index = 0;
9034
- fingerprint = hexlify20("0x00000000");
9035
- parentFingerprint = hexlify20("0x00000000");
9039
+ fingerprint = hexlify21("0x00000000");
9040
+ parentFingerprint = hexlify21("0x00000000");
9036
9041
  privateKey;
9037
9042
  publicKey;
9038
9043
  chainCode;
@@ -9044,8 +9049,8 @@ var HDWallet = class {
9044
9049
  constructor(config) {
9045
9050
  if (config.privateKey) {
9046
9051
  const signer = new Signer(config.privateKey);
9047
- this.publicKey = hexlify20(signer.compressedPublicKey);
9048
- this.privateKey = hexlify20(config.privateKey);
9052
+ this.publicKey = hexlify21(signer.compressedPublicKey);
9053
+ this.privateKey = hexlify21(config.privateKey);
9049
9054
  } else {
9050
9055
  if (!config.publicKey) {
9051
9056
  throw new FuelError22(
@@ -9053,7 +9058,7 @@ var HDWallet = class {
9053
9058
  "Both public and private Key cannot be missing. At least one should be provided."
9054
9059
  );
9055
9060
  }
9056
- this.publicKey = hexlify20(config.publicKey);
9061
+ this.publicKey = hexlify21(config.publicKey);
9057
9062
  }
9058
9063
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
9059
9064
  this.fingerprint = dataSlice2(ripemd160(sha2564(this.publicKey)), 0, 4);
@@ -9102,7 +9107,7 @@ var HDWallet = class {
9102
9107
  parentFingerprint: this.fingerprint
9103
9108
  });
9104
9109
  }
9105
- const signer = new Signer(hexlify20(IL));
9110
+ const signer = new Signer(hexlify21(IL));
9106
9111
  const Ki = signer.addPoint(publicKey);
9107
9112
  return new HDWallet({
9108
9113
  publicKey: Ki,
@@ -9137,7 +9142,7 @@ var HDWallet = class {
9137
9142
  );
9138
9143
  }
9139
9144
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
9140
- const depth = hexlify20(Uint8Array.from([this.depth]));
9145
+ const depth = hexlify21(Uint8Array.from([this.depth]));
9141
9146
  const parentFingerprint = this.parentFingerprint;
9142
9147
  const index = toHex(this.index, 4);
9143
9148
  const chainCode = this.chainCode;
@@ -9159,7 +9164,7 @@ var HDWallet = class {
9159
9164
  });
9160
9165
  }
9161
9166
  static fromExtendedKey(extendedKey) {
9162
- const decoded = hexlify20(toBytes2(decodeBase58(extendedKey)));
9167
+ const decoded = hexlify21(toBytes2(decodeBase58(extendedKey)));
9163
9168
  const bytes = arrayify18(decoded);
9164
9169
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
9165
9170
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
@@ -9169,9 +9174,9 @@ var HDWallet = class {
9169
9174
  throw new FuelError22(ErrorCode20.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
9170
9175
  }
9171
9176
  const depth = bytes[4];
9172
- const parentFingerprint = hexlify20(bytes.slice(5, 9));
9173
- const index = parseInt(hexlify20(bytes.slice(9, 13)).substring(2), 16);
9174
- const chainCode = hexlify20(bytes.slice(13, 45));
9177
+ const parentFingerprint = hexlify21(bytes.slice(5, 9));
9178
+ const index = parseInt(hexlify21(bytes.slice(9, 13)).substring(2), 16);
9179
+ const chainCode = hexlify21(bytes.slice(13, 45));
9175
9180
  const key = bytes.slice(45, 78);
9176
9181
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
9177
9182
  throw new FuelError22(
@@ -9422,7 +9427,7 @@ var WalletsConfig = class {
9422
9427
  tx_pointer_block_height: 0,
9423
9428
  tx_pointer_tx_idx: 0,
9424
9429
  output_index: 0,
9425
- tx_id: hexlify21(randomBytes8(32))
9430
+ tx_id: hexlify22(randomBytes8(32))
9426
9431
  });
9427
9432
  }
9428
9433
  });
@@ -9529,7 +9534,7 @@ async function setupTestProviderAndWallets({
9529
9534
  import { Address as Address6 } from "@fuel-ts/address";
9530
9535
  import { randomBytes as randomBytes9 } from "@fuel-ts/crypto";
9531
9536
  import { bn as bn21 } from "@fuel-ts/math";
9532
- import { hexlify as hexlify22 } from "@fuel-ts/utils";
9537
+ import { hexlify as hexlify23 } from "@fuel-ts/utils";
9533
9538
  var TestMessage = class {
9534
9539
  sender;
9535
9540
  recipient;
@@ -9546,7 +9551,7 @@ var TestMessage = class {
9546
9551
  constructor({
9547
9552
  sender = Address6.fromRandom(),
9548
9553
  recipient = Address6.fromRandom(),
9549
- nonce = hexlify22(randomBytes9(32)),
9554
+ nonce = hexlify23(randomBytes9(32)),
9550
9555
  amount = 1e6,
9551
9556
  data = "",
9552
9557
  // Will default to empty data in order to be a spendable message