@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.
package/dist/index.mjs CHANGED
@@ -35,7 +35,7 @@ import { ErrorCode as ErrorCode16, FuelError as FuelError17 } from "@fuel-ts/err
35
35
  import { AbstractAccount } from "@fuel-ts/interfaces";
36
36
  import { bn as bn19 } from "@fuel-ts/math";
37
37
  import { InputType as InputType8 } from "@fuel-ts/transactions";
38
- import { arrayify as arrayify14, hexlify as hexlify13, isDefined as isDefined3 } from "@fuel-ts/utils";
38
+ import { arrayify as arrayify14, hexlify as hexlify14, isDefined as isDefined3 } from "@fuel-ts/utils";
39
39
  import { clone as clone7 } from "ramda";
40
40
 
41
41
  // src/providers/coin-quantity.ts
@@ -77,8 +77,8 @@ var addAmountToCoinQuantities = (params) => {
77
77
  import { Address as Address2 } from "@fuel-ts/address";
78
78
  import { ErrorCode as ErrorCode14, FuelError as FuelError15 } from "@fuel-ts/errors";
79
79
  import { BN as BN2, bn as bn17 } from "@fuel-ts/math";
80
- import { InputType as InputType7, InputMessageCoder, TransactionCoder as TransactionCoder5 } from "@fuel-ts/transactions";
81
- import { arrayify as arrayify11, hexlify as hexlify12, DateTime as DateTime2, isDefined as isDefined2 } from "@fuel-ts/utils";
80
+ import { InputType as InputType7, InputMessageCoder as InputMessageCoder2, TransactionCoder as TransactionCoder5 } from "@fuel-ts/transactions";
81
+ import { arrayify as arrayify11, hexlify as hexlify13, DateTime as DateTime2, isDefined as isDefined2 } from "@fuel-ts/utils";
82
82
  import { checkFuelCoreVersionCompatibility } from "@fuel-ts/versions";
83
83
  import { equalBytes } from "@noble/curves/abstract/utils";
84
84
  import { GraphQLClient } from "graphql-request";
@@ -1031,6 +1031,13 @@ var SubmitAndAwaitDocument = gql`
1031
1031
  }
1032
1032
  }
1033
1033
  ${TransactionStatusSubscriptionFragmentDoc}`;
1034
+ var SubmitAndAwaitStatusDocument = gql`
1035
+ subscription submitAndAwaitStatus($encodedTransaction: HexString!) {
1036
+ submitAndAwaitStatus(tx: $encodedTransaction) {
1037
+ ...transactionStatusSubscriptionFragment
1038
+ }
1039
+ }
1040
+ ${TransactionStatusSubscriptionFragmentDoc}`;
1034
1041
  var StatusChangeDocument = gql`
1035
1042
  subscription statusChange($transactionId: TransactionId!) {
1036
1043
  statusChange(id: $transactionId) {
@@ -1127,6 +1134,9 @@ function getSdk(requester) {
1127
1134
  submitAndAwait(variables, options) {
1128
1135
  return requester(SubmitAndAwaitDocument, variables, options);
1129
1136
  },
1137
+ submitAndAwaitStatus(variables, options) {
1138
+ return requester(SubmitAndAwaitStatusDocument, variables, options);
1139
+ },
1130
1140
  statusChange(variables, options) {
1131
1141
  return requester(StatusChangeDocument, variables, options);
1132
1142
  }
@@ -1153,7 +1163,9 @@ var _FuelGraphqlSubscriber = class {
1153
1163
  Accept: "text/event-stream"
1154
1164
  }
1155
1165
  });
1156
- return new _FuelGraphqlSubscriber(response.body.getReader());
1166
+ const [errorReader, resultReader] = response.body.tee().map((stream) => stream.getReader());
1167
+ await new _FuelGraphqlSubscriber(errorReader).next();
1168
+ return new _FuelGraphqlSubscriber(resultReader);
1157
1169
  }
1158
1170
  events = [];
1159
1171
  parsingLeftover = "";
@@ -1196,10 +1208,8 @@ var _FuelGraphqlSubscriber = class {
1196
1208
  /**
1197
1209
  * Gets called when `break` is called in a `for-await-of` loop.
1198
1210
  */
1199
- async return() {
1200
- await this.stream.cancel();
1201
- this.stream.releaseLock();
1202
- return { done: true, value: void 0 };
1211
+ return() {
1212
+ return Promise.resolve({ done: true, value: void 0 });
1203
1213
  }
1204
1214
  [Symbol.asyncIterator]() {
1205
1215
  return this;
@@ -1416,7 +1426,7 @@ import {
1416
1426
  OutputType as OutputType2,
1417
1427
  TransactionType
1418
1428
  } from "@fuel-ts/transactions";
1419
- import { concat, hexlify as hexlify7, isDefined } from "@fuel-ts/utils";
1429
+ import { concat, hexlify as hexlify8, isDefined } from "@fuel-ts/utils";
1420
1430
 
1421
1431
  // src/providers/message.ts
1422
1432
  var isMessageCoin = (message) => !("data" in message);
@@ -1431,14 +1441,9 @@ var isMessage = (resource) => "recipient" in resource;
1431
1441
  import { ZeroBytes32 as ZeroBytes323 } from "@fuel-ts/address/configs";
1432
1442
  import { ErrorCode as ErrorCode5, FuelError as FuelError5 } from "@fuel-ts/errors";
1433
1443
  import { bn as bn4 } from "@fuel-ts/math";
1434
- import {
1435
- ReceiptBurnCoder,
1436
- ReceiptMessageOutCoder,
1437
- ReceiptMintCoder,
1438
- ReceiptType
1439
- } from "@fuel-ts/transactions";
1444
+ import { getMintedAssetId, InputMessageCoder, ReceiptType } from "@fuel-ts/transactions";
1440
1445
  import { FAILED_TRANSFER_TO_ADDRESS_SIGNAL } from "@fuel-ts/transactions/configs";
1441
- import { arrayify as arrayify2 } from "@fuel-ts/utils";
1446
+ import { arrayify as arrayify2, hexlify as hexlify5 } from "@fuel-ts/utils";
1442
1447
  var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
1443
1448
  var doesReceiptHaveMissingContractId = (receipt) => receipt.type === ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
1444
1449
  var getReceiptsWithMissingData = (receipts) => receipts.reduce(
@@ -1584,12 +1589,12 @@ function assembleReceiptByType(receipt) {
1584
1589
  const amount = bn4(receipt.amount);
1585
1590
  const data = receipt.data ? arrayify2(receipt.data) : Uint8Array.from([]);
1586
1591
  const digest = hexOrZero(receipt.digest);
1587
- const messageId = ReceiptMessageOutCoder.getMessageId({
1592
+ const messageId = InputMessageCoder.getMessageId({
1588
1593
  sender,
1589
1594
  recipient,
1590
1595
  nonce,
1591
1596
  amount,
1592
- data
1597
+ data: hexlify5(data)
1593
1598
  });
1594
1599
  const receiptMessageOut = {
1595
1600
  type: ReceiptType.MessageOut,
@@ -1606,7 +1611,7 @@ function assembleReceiptByType(receipt) {
1606
1611
  case "MINT" /* Mint */: {
1607
1612
  const contractId = hexOrZero(receipt.id || receipt.contractId);
1608
1613
  const subId = hexOrZero(receipt.subId);
1609
- const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
1614
+ const assetId = getMintedAssetId(contractId, subId);
1610
1615
  const mintReceipt = {
1611
1616
  type: ReceiptType.Mint,
1612
1617
  subId,
@@ -1621,7 +1626,7 @@ function assembleReceiptByType(receipt) {
1621
1626
  case "BURN" /* Burn */: {
1622
1627
  const contractId = hexOrZero(receipt.id || receipt.contractId);
1623
1628
  const subId = hexOrZero(receipt.subId);
1624
- const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
1629
+ const assetId = getMintedAssetId(contractId, subId);
1625
1630
  const burnReceipt = {
1626
1631
  type: ReceiptType.Burn,
1627
1632
  subId,
@@ -1806,13 +1811,13 @@ var calculateGasFee = (params) => {
1806
1811
  };
1807
1812
 
1808
1813
  // src/providers/utils/json.ts
1809
- import { hexlify as hexlify5 } from "@fuel-ts/utils";
1814
+ import { hexlify as hexlify6 } from "@fuel-ts/utils";
1810
1815
  import { clone } from "ramda";
1811
1816
  function normalize(object) {
1812
1817
  Object.keys(object).forEach((key) => {
1813
1818
  switch (object[key]?.constructor.name) {
1814
1819
  case "Uint8Array":
1815
- object[key] = hexlify5(object[key]);
1820
+ object[key] = hexlify6(object[key]);
1816
1821
  break;
1817
1822
  case "Array":
1818
1823
  object[key] = normalize(object[key]);
@@ -2002,11 +2007,11 @@ var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
2002
2007
  );
2003
2008
 
2004
2009
  // src/providers/transaction-request/witness.ts
2005
- import { arrayify as arrayify4, hexlify as hexlify6 } from "@fuel-ts/utils";
2010
+ import { arrayify as arrayify4, hexlify as hexlify7 } from "@fuel-ts/utils";
2006
2011
  var witnessify = (value) => {
2007
2012
  const data = arrayify4(value);
2008
2013
  return {
2009
- data: hexlify6(data),
2014
+ data: hexlify7(data),
2010
2015
  dataLength: data.length
2011
2016
  };
2012
2017
  };
@@ -2223,9 +2228,9 @@ var BaseTransactionRequest = class {
2223
2228
  const found = this.inputs.find((input) => {
2224
2229
  switch (input.type) {
2225
2230
  case InputType3.Coin:
2226
- return hexlify7(input.owner) === ownerAddress.toB256();
2231
+ return hexlify8(input.owner) === ownerAddress.toB256();
2227
2232
  case InputType3.Message:
2228
- return hexlify7(input.recipient) === ownerAddress.toB256();
2233
+ return hexlify8(input.recipient) === ownerAddress.toB256();
2229
2234
  default:
2230
2235
  return false;
2231
2236
  }
@@ -2363,7 +2368,7 @@ var BaseTransactionRequest = class {
2363
2368
  */
2364
2369
  addChangeOutput(to, assetId) {
2365
2370
  const changeOutput = this.getChangeOutputs().find(
2366
- (output) => hexlify7(output.assetId) === assetId
2371
+ (output) => hexlify8(output.assetId) === assetId
2367
2372
  );
2368
2373
  if (!changeOutput) {
2369
2374
  this.pushOutput({
@@ -2443,12 +2448,12 @@ var BaseTransactionRequest = class {
2443
2448
  usedQuantity = bn8("1000000000000000000");
2444
2449
  }
2445
2450
  if (assetInput && "assetId" in assetInput) {
2446
- assetInput.id = hexlify7(randomBytes(UTXO_ID_LEN2));
2451
+ assetInput.id = hexlify8(randomBytes(UTXO_ID_LEN2));
2447
2452
  assetInput.amount = usedQuantity;
2448
2453
  } else {
2449
2454
  this.addResources([
2450
2455
  {
2451
- id: hexlify7(randomBytes(UTXO_ID_LEN2)),
2456
+ id: hexlify8(randomBytes(UTXO_ID_LEN2)),
2452
2457
  amount: usedQuantity,
2453
2458
  assetId,
2454
2459
  owner: resourcesOwner || Address.fromRandom(),
@@ -2651,11 +2656,11 @@ var BlobTransactionRequest = class extends BaseTransactionRequest {
2651
2656
  import { ZeroBytes32 as ZeroBytes326 } from "@fuel-ts/address/configs";
2652
2657
  import { bn as bn10 } from "@fuel-ts/math";
2653
2658
  import { TransactionType as TransactionType3, OutputType as OutputType4 } from "@fuel-ts/transactions";
2654
- import { arrayify as arrayify6, hexlify as hexlify9 } from "@fuel-ts/utils";
2659
+ import { arrayify as arrayify6, hexlify as hexlify10 } from "@fuel-ts/utils";
2655
2660
  import { clone as clone4 } from "ramda";
2656
2661
 
2657
2662
  // src/providers/transaction-request/storage-slot.ts
2658
- import { arrayify as arrayify5, hexlify as hexlify8 } from "@fuel-ts/utils";
2663
+ import { arrayify as arrayify5, hexlify as hexlify9 } from "@fuel-ts/utils";
2659
2664
  var getStorageValue = (value) => {
2660
2665
  const v = new Uint8Array(32);
2661
2666
  v.set(arrayify5(value));
@@ -2672,8 +2677,8 @@ var storageSlotify = (storageSlot) => {
2672
2677
  value = storageSlot.value;
2673
2678
  }
2674
2679
  return {
2675
- key: hexlify8(key),
2676
- value: hexlify8(getStorageValue(value))
2680
+ key: hexlify9(key),
2681
+ value: hexlify9(getStorageValue(value))
2677
2682
  };
2678
2683
  };
2679
2684
 
@@ -2698,7 +2703,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2698
2703
  constructor({ bytecodeWitnessIndex, salt, storageSlots, ...rest }) {
2699
2704
  super(rest);
2700
2705
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
2701
- this.salt = hexlify9(salt ?? ZeroBytes326);
2706
+ this.salt = hexlify10(salt ?? ZeroBytes326);
2702
2707
  this.storageSlots = [...storageSlots ?? []];
2703
2708
  }
2704
2709
  /**
@@ -2715,7 +2720,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2715
2720
  ...baseTransaction,
2716
2721
  bytecodeWitnessIndex,
2717
2722
  storageSlotsCount: bn10(storageSlots.length),
2718
- salt: this.salt ? hexlify9(this.salt) : ZeroBytes326,
2723
+ salt: this.salt ? hexlify10(this.salt) : ZeroBytes326,
2719
2724
  storageSlots
2720
2725
  };
2721
2726
  }
@@ -2768,7 +2773,7 @@ import { addressify as addressify2 } from "@fuel-ts/address";
2768
2773
  import { ZeroBytes32 as ZeroBytes327 } from "@fuel-ts/address/configs";
2769
2774
  import { bn as bn11 } from "@fuel-ts/math";
2770
2775
  import { InputType as InputType5, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2771
- import { arrayify as arrayify8, hexlify as hexlify10 } from "@fuel-ts/utils";
2776
+ import { arrayify as arrayify8, hexlify as hexlify11 } from "@fuel-ts/utils";
2772
2777
  import { clone as clone5 } from "ramda";
2773
2778
 
2774
2779
  // src/providers/transaction-request/scripts.ts
@@ -2838,8 +2843,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2838
2843
  scriptLength: bn11(script.length),
2839
2844
  scriptDataLength: bn11(scriptData.length),
2840
2845
  receiptsRoot: ZeroBytes327,
2841
- script: hexlify10(script),
2842
- scriptData: hexlify10(scriptData)
2846
+ script: hexlify11(script),
2847
+ scriptData: hexlify11(scriptData)
2843
2848
  };
2844
2849
  }
2845
2850
  /**
@@ -3015,7 +3020,7 @@ import { arrayify as arrayify10, assertUnreachable } from "@fuel-ts/utils";
3015
3020
  // src/providers/transaction-summary/assemble-transaction-summary.ts
3016
3021
  import { bn as bn15 } from "@fuel-ts/math";
3017
3022
  import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
3018
- import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
3023
+ import { DateTime, hexlify as hexlify12 } from "@fuel-ts/utils";
3019
3024
 
3020
3025
  // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
3021
3026
  import { bn as bn12 } from "@fuel-ts/math";
@@ -3778,7 +3783,7 @@ function assembleTransactionSummary(params) {
3778
3783
  baseAssetId
3779
3784
  } = params;
3780
3785
  const gasUsed = getGasUsedFromReceipts(receipts);
3781
- const rawPayload = hexlify11(transactionBytes);
3786
+ const rawPayload = hexlify12(transactionBytes);
3782
3787
  const operations = getOperations({
3783
3788
  transactionType: transaction.type,
3784
3789
  inputs: transaction.inputs || [],
@@ -3887,29 +3892,30 @@ function mapGqlOutputsToTxOutputs(outputs) {
3887
3892
  });
3888
3893
  }
3889
3894
  var TransactionResponse = class {
3890
- /** Transaction ID */
3891
- id;
3892
- /** Current provider */
3893
- provider;
3894
- /** Gas used on the transaction */
3895
- gasUsed = bn16(0);
3896
- /** The graphql Transaction with receipts object. */
3897
- gqlTransaction;
3898
- request;
3899
- status;
3900
- abis;
3901
3895
  /**
3902
3896
  * Constructor for `TransactionResponse`.
3903
3897
  *
3904
3898
  * @param tx - The transaction ID or TransactionRequest.
3905
3899
  * @param provider - The provider.
3906
3900
  */
3907
- constructor(tx, provider, abis) {
3901
+ constructor(tx, provider, abis, submitTxSubscription) {
3902
+ this.submitTxSubscription = submitTxSubscription;
3908
3903
  this.id = typeof tx === "string" ? tx : tx.getTransactionId(provider.getChainId());
3909
3904
  this.provider = provider;
3910
3905
  this.abis = abis;
3911
3906
  this.request = typeof tx === "string" ? void 0 : tx;
3912
3907
  }
3908
+ /** Transaction ID */
3909
+ id;
3910
+ /** Current provider */
3911
+ provider;
3912
+ /** Gas used on the transaction */
3913
+ gasUsed = bn16(0);
3914
+ /** The graphql Transaction with receipts object. */
3915
+ gqlTransaction;
3916
+ request;
3917
+ status;
3918
+ abis;
3913
3919
  /**
3914
3920
  * Async constructor for `TransactionResponse`. This method can be used to create
3915
3921
  * an instance of `TransactionResponse` and wait for the transaction to be fetched
@@ -4042,10 +4048,11 @@ var TransactionResponse = class {
4042
4048
  if (status && status !== "SubmittedStatus") {
4043
4049
  return;
4044
4050
  }
4045
- const subscription = await this.provider.operations.statusChange({
4051
+ const subscription = this.submitTxSubscription ?? await this.provider.operations.statusChange({
4046
4052
  transactionId: this.id
4047
4053
  });
4048
- for await (const { statusChange } of subscription) {
4054
+ for await (const sub of subscription) {
4055
+ const statusChange = "statusChange" in sub ? sub.statusChange : sub.submitAndAwaitStatus;
4049
4056
  this.status = statusChange;
4050
4057
  if (statusChange.type === "SqueezedOutStatus") {
4051
4058
  this.unsetResourceCache();
@@ -4323,7 +4330,7 @@ var _Provider = class {
4323
4330
  const provider = new _Provider(urlToUse, {
4324
4331
  ...options,
4325
4332
  requestMiddleware: async (request) => {
4326
- if (auth) {
4333
+ if (auth && request) {
4327
4334
  request.headers ??= {};
4328
4335
  request.headers.Authorization = auth;
4329
4336
  }
@@ -4578,16 +4585,14 @@ Supported fuel-core version: ${supportedVersion}.`
4578
4585
  }
4579
4586
  const { consensusParameters } = this.getChain();
4580
4587
  this.validateTransaction(transactionRequest, consensusParameters);
4581
- const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
4588
+ const encodedTransaction = hexlify13(transactionRequest.toTransactionBytes());
4582
4589
  let abis;
4583
4590
  if (isTransactionTypeScript(transactionRequest)) {
4584
4591
  abis = transactionRequest.abis;
4585
4592
  }
4586
- const {
4587
- submit: { id: transactionId }
4588
- } = await this.operations.submit({ encodedTransaction });
4589
- __privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs, transactionId);
4590
- return new TransactionResponse(transactionRequest, this, abis);
4593
+ const subscription = await this.operations.submitAndAwaitStatus({ encodedTransaction });
4594
+ __privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs, transactionRequest.getTransactionId(this.getChainId()));
4595
+ return new TransactionResponse(transactionRequest, this, abis, subscription);
4591
4596
  }
4592
4597
  /**
4593
4598
  * Executes a transaction without actually submitting it to the chain.
@@ -4604,7 +4609,7 @@ Supported fuel-core version: ${supportedVersion}.`
4604
4609
  if (estimateTxDependencies) {
4605
4610
  return this.estimateTxDependencies(transactionRequest);
4606
4611
  }
4607
- const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
4612
+ const encodedTransaction = hexlify13(transactionRequest.toTransactionBytes());
4608
4613
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4609
4614
  encodedTransactions: encodedTransaction,
4610
4615
  utxoValidation: utxoValidation || false
@@ -4630,7 +4635,7 @@ Supported fuel-core version: ${supportedVersion}.`
4630
4635
  if (!shouldEstimatePredicates) {
4631
4636
  return transactionRequest;
4632
4637
  }
4633
- const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
4638
+ const encodedTransaction = hexlify13(transactionRequest.toTransactionBytes());
4634
4639
  const response = await this.operations.estimatePredicates({
4635
4640
  encodedTransaction
4636
4641
  });
@@ -4671,7 +4676,7 @@ Supported fuel-core version: ${supportedVersion}.`
4671
4676
  const {
4672
4677
  dryRun: [{ receipts: rawReceipts, status }]
4673
4678
  } = await this.operations.dryRun({
4674
- encodedTransactions: [hexlify12(transactionRequest.toTransactionBytes())],
4679
+ encodedTransactions: [hexlify13(transactionRequest.toTransactionBytes())],
4675
4680
  utxoValidation: false
4676
4681
  });
4677
4682
  receipts = rawReceipts.map(processGqlReceipt);
@@ -4721,7 +4726,7 @@ Supported fuel-core version: ${supportedVersion}.`
4721
4726
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
4722
4727
  allRequests.forEach((req, index) => {
4723
4728
  if (isTransactionTypeScript(req)) {
4724
- serializedTransactionsMap.set(index, hexlify12(req.toTransactionBytes()));
4729
+ serializedTransactionsMap.set(index, hexlify13(req.toTransactionBytes()));
4725
4730
  }
4726
4731
  });
4727
4732
  let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
@@ -4757,7 +4762,7 @@ Supported fuel-core version: ${supportedVersion}.`
4757
4762
  transactionRequest: request
4758
4763
  });
4759
4764
  request.maxFee = maxFee;
4760
- serializedTransactionsMap.set(requestIdx, hexlify12(request.toTransactionBytes()));
4765
+ serializedTransactionsMap.set(requestIdx, hexlify13(request.toTransactionBytes()));
4761
4766
  nextRoundTransactions.push(requestIdx);
4762
4767
  }
4763
4768
  }
@@ -4778,7 +4783,7 @@ Supported fuel-core version: ${supportedVersion}.`
4778
4783
  if (estimateTxDependencies) {
4779
4784
  return this.estimateMultipleTxDependencies(transactionRequests);
4780
4785
  }
4781
- const encodedTransactions = transactionRequests.map((tx) => hexlify12(tx.toTransactionBytes()));
4786
+ const encodedTransactions = transactionRequests.map((tx) => hexlify13(tx.toTransactionBytes()));
4782
4787
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4783
4788
  encodedTransactions,
4784
4789
  utxoValidation: utxoValidation || false
@@ -4852,7 +4857,7 @@ Supported fuel-core version: ${supportedVersion}.`
4852
4857
  if (estimateTxDependencies) {
4853
4858
  return this.estimateTxDependencies(transactionRequest);
4854
4859
  }
4855
- const encodedTransactions = [hexlify12(transactionRequest.toTransactionBytes())];
4860
+ const encodedTransactions = [hexlify13(transactionRequest.toTransactionBytes())];
4856
4861
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4857
4862
  encodedTransactions,
4858
4863
  utxoValidation: true
@@ -4951,7 +4956,7 @@ Supported fuel-core version: ${supportedVersion}.`
4951
4956
  paginationLimit: RESOURCES_PAGE_SIZE_LIMIT,
4952
4957
  inputArgs: paginationArgs
4953
4958
  }),
4954
- filter: { owner: ownerAddress.toB256(), assetId: assetId && hexlify12(assetId) }
4959
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && hexlify13(assetId) }
4955
4960
  });
4956
4961
  const coins = edges.map(({ node }) => ({
4957
4962
  id: node.utxoId,
@@ -4977,8 +4982,8 @@ Supported fuel-core version: ${supportedVersion}.`
4977
4982
  async getResourcesToSpend(owner, quantities, excludedIds) {
4978
4983
  const ownerAddress = Address2.fromAddressOrString(owner);
4979
4984
  const excludeInput = {
4980
- messages: excludedIds?.messages?.map((nonce) => hexlify12(nonce)) || [],
4981
- utxos: excludedIds?.utxos?.map((id) => hexlify12(id)) || []
4985
+ messages: excludedIds?.messages?.map((nonce) => hexlify13(nonce)) || [],
4986
+ utxos: excludedIds?.utxos?.map((id) => hexlify13(id)) || []
4982
4987
  };
4983
4988
  if (this.cache) {
4984
4989
  const cached = this.cache.getActiveData();
@@ -4988,7 +4993,7 @@ Supported fuel-core version: ${supportedVersion}.`
4988
4993
  const coinsQuery = {
4989
4994
  owner: ownerAddress.toB256(),
4990
4995
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
4991
- assetId: hexlify12(assetId),
4996
+ assetId: hexlify13(assetId),
4992
4997
  amount: amount.toString(10),
4993
4998
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
4994
4999
  })),
@@ -5217,7 +5222,7 @@ Supported fuel-core version: ${supportedVersion}.`
5217
5222
  async getContractBalance(contractId, assetId) {
5218
5223
  const { contractBalance } = await this.operations.getContractBalance({
5219
5224
  contract: Address2.fromAddressOrString(contractId).toB256(),
5220
- asset: hexlify12(assetId)
5225
+ asset: hexlify13(assetId)
5221
5226
  });
5222
5227
  return bn17(contractBalance.amount, 10);
5223
5228
  }
@@ -5231,7 +5236,7 @@ Supported fuel-core version: ${supportedVersion}.`
5231
5236
  async getBalance(owner, assetId) {
5232
5237
  const { balance } = await this.operations.getBalance({
5233
5238
  owner: Address2.fromAddressOrString(owner).toB256(),
5234
- assetId: hexlify12(assetId)
5239
+ assetId: hexlify13(assetId)
5235
5240
  });
5236
5241
  return bn17(balance.amount, 10);
5237
5242
  }
@@ -5277,7 +5282,7 @@ Supported fuel-core version: ${supportedVersion}.`
5277
5282
  owner: Address2.fromAddressOrString(address).toB256()
5278
5283
  });
5279
5284
  const messages = edges.map(({ node }) => ({
5280
- messageId: InputMessageCoder.getMessageId({
5285
+ messageId: InputMessageCoder2.getMessageId({
5281
5286
  sender: node.sender,
5282
5287
  recipient: node.recipient,
5283
5288
  nonce: node.nonce,
@@ -5288,7 +5293,7 @@ Supported fuel-core version: ${supportedVersion}.`
5288
5293
  recipient: Address2.fromAddressOrString(node.recipient),
5289
5294
  nonce: node.nonce,
5290
5295
  amount: bn17(node.amount),
5291
- data: InputMessageCoder.decodeData(node.data),
5296
+ data: InputMessageCoder2.decodeData(node.data),
5292
5297
  daHeight: bn17(node.daHeight)
5293
5298
  }));
5294
5299
  return {
@@ -5457,7 +5462,7 @@ Supported fuel-core version: ${supportedVersion}.`
5457
5462
  return null;
5458
5463
  }
5459
5464
  const message = {
5460
- messageId: InputMessageCoder.getMessageId({
5465
+ messageId: InputMessageCoder2.getMessageId({
5461
5466
  sender: rawMessage.sender,
5462
5467
  recipient: rawMessage.recipient,
5463
5468
  nonce: rawMessage.nonce,
@@ -5468,7 +5473,7 @@ Supported fuel-core version: ${supportedVersion}.`
5468
5473
  recipient: Address2.fromAddressOrString(rawMessage.recipient),
5469
5474
  nonce: rawMessage.nonce,
5470
5475
  amount: bn17(rawMessage.amount),
5471
- data: InputMessageCoder.decodeData(rawMessage.data),
5476
+ data: InputMessageCoder2.decodeData(rawMessage.data),
5472
5477
  daHeight: bn17(rawMessage.daHeight)
5473
5478
  };
5474
5479
  return message;
@@ -6351,7 +6356,7 @@ var Account = class extends AbstractAccount {
6351
6356
  */
6352
6357
  generateFakeResources(coins) {
6353
6358
  return coins.map((coin) => ({
6354
- id: hexlify13(randomBytes2(UTXO_ID_LEN3)),
6359
+ id: hexlify14(randomBytes2(UTXO_ID_LEN3)),
6355
6360
  owner: this.address,
6356
6361
  blockCreated: bn19(1),
6357
6362
  txCreatedIdx: bn19(1),
@@ -6410,14 +6415,14 @@ var Account = class extends AbstractAccount {
6410
6415
 
6411
6416
  // src/wallet/base-wallet-unlocked.ts
6412
6417
  import { hashMessage } from "@fuel-ts/hasher";
6413
- import { hexlify as hexlify16 } from "@fuel-ts/utils";
6418
+ import { hexlify as hexlify17 } from "@fuel-ts/utils";
6414
6419
 
6415
6420
  // src/signer/signer.ts
6416
6421
  import { Address as Address4 } from "@fuel-ts/address";
6417
6422
  import { randomBytes as randomBytes3 } from "@fuel-ts/crypto";
6418
6423
  import { hash } from "@fuel-ts/hasher";
6419
6424
  import { toBytes } from "@fuel-ts/math";
6420
- import { hexlify as hexlify14, concat as concat3, arrayify as arrayify15 } from "@fuel-ts/utils";
6425
+ import { hexlify as hexlify15, concat as concat3, arrayify as arrayify15 } from "@fuel-ts/utils";
6421
6426
  import { secp256k1 } from "@noble/curves/secp256k1";
6422
6427
  var Signer = class {
6423
6428
  address;
@@ -6437,9 +6442,9 @@ var Signer = class {
6437
6442
  }
6438
6443
  }
6439
6444
  const privateKeyBytes = toBytes(privateKey, 32);
6440
- this.privateKey = hexlify14(privateKeyBytes);
6441
- this.publicKey = hexlify14(secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
6442
- this.compressedPublicKey = hexlify14(secp256k1.getPublicKey(privateKeyBytes, true));
6445
+ this.privateKey = hexlify15(privateKeyBytes);
6446
+ this.publicKey = hexlify15(secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
6447
+ this.compressedPublicKey = hexlify15(secp256k1.getPublicKey(privateKeyBytes, true));
6443
6448
  this.address = Address4.fromPublicKey(this.publicKey);
6444
6449
  }
6445
6450
  /**
@@ -6457,7 +6462,7 @@ var Signer = class {
6457
6462
  const r = toBytes(`0x${signature.r.toString(16)}`, 32);
6458
6463
  const s = toBytes(`0x${signature.s.toString(16)}`, 32);
6459
6464
  s[0] |= (signature.recovery || 0) << 7;
6460
- return hexlify14(concat3([r, s]));
6465
+ return hexlify15(concat3([r, s]));
6461
6466
  }
6462
6467
  /**
6463
6468
  * Add point on the current elliptic curve
@@ -6484,11 +6489,11 @@ var Signer = class {
6484
6489
  const s = signedMessageBytes.slice(32, 64);
6485
6490
  const recoveryParam = (s[0] & 128) >> 7;
6486
6491
  s[0] &= 127;
6487
- const sig = new secp256k1.Signature(BigInt(hexlify14(r)), BigInt(hexlify14(s))).addRecoveryBit(
6492
+ const sig = new secp256k1.Signature(BigInt(hexlify15(r)), BigInt(hexlify15(s))).addRecoveryBit(
6488
6493
  recoveryParam
6489
6494
  );
6490
6495
  const publicKey = sig.recoverPublicKey(arrayify15(data)).toRawBytes(false).slice(1);
6491
- return hexlify14(publicKey);
6496
+ return hexlify15(publicKey);
6492
6497
  }
6493
6498
  /**
6494
6499
  * Recover the address from a signature performed with [`sign`](#sign).
@@ -6517,7 +6522,7 @@ var Signer = class {
6517
6522
  */
6518
6523
  static extendPublicKey(publicKey) {
6519
6524
  const point = secp256k1.ProjectivePoint.fromHex(arrayify15(publicKey));
6520
- return hexlify14(point.toRawBytes(false).slice(1));
6525
+ return hexlify15(point.toRawBytes(false).slice(1));
6521
6526
  }
6522
6527
  };
6523
6528
 
@@ -6534,7 +6539,7 @@ import {
6534
6539
  randomUUID
6535
6540
  } from "@fuel-ts/crypto";
6536
6541
  import { ErrorCode as ErrorCode17, FuelError as FuelError18 } from "@fuel-ts/errors";
6537
- import { hexlify as hexlify15 } from "@fuel-ts/utils";
6542
+ import { hexlify as hexlify16 } from "@fuel-ts/utils";
6538
6543
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
6539
6544
  var DEFAULT_KDF_PARAMS_R = 8;
6540
6545
  var DEFAULT_KDF_PARAMS_P = 1;
@@ -6616,7 +6621,7 @@ async function decryptKeystoreWallet(jsonWallet, password) {
6616
6621
  );
6617
6622
  }
6618
6623
  const buffer = await decryptJsonWalletData(ciphertextBuffer, key, ivBuffer);
6619
- const privateKey = hexlify15(buffer);
6624
+ const privateKey = hexlify16(buffer);
6620
6625
  return privateKey;
6621
6626
  }
6622
6627
 
@@ -6661,7 +6666,7 @@ var BaseWalletUnlocked = class extends Account {
6661
6666
  */
6662
6667
  async signMessage(message) {
6663
6668
  const signedMessage = await this.signer().sign(hashMessage(message));
6664
- return hexlify16(signedMessage);
6669
+ return hexlify17(signedMessage);
6665
6670
  }
6666
6671
  /**
6667
6672
  * Signs a transaction with the wallet's private key.
@@ -6674,7 +6679,7 @@ var BaseWalletUnlocked = class extends Account {
6674
6679
  const chainId = this.provider.getChainId();
6675
6680
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
6676
6681
  const signature = await this.signer().sign(hashedTransaction);
6677
- return hexlify16(signature);
6682
+ return hexlify17(signature);
6678
6683
  }
6679
6684
  /**
6680
6685
  * Populates a transaction with the witnesses signature.
@@ -6744,13 +6749,13 @@ import { computeHmac as computeHmac2, ripemd160 } from "@fuel-ts/crypto";
6744
6749
  import { ErrorCode as ErrorCode20, FuelError as FuelError21 } from "@fuel-ts/errors";
6745
6750
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
6746
6751
  import { bn as bn20, toBytes as toBytes2, toHex } from "@fuel-ts/math";
6747
- import { arrayify as arrayify18, hexlify as hexlify18, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
6752
+ import { arrayify as arrayify18, hexlify as hexlify19, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
6748
6753
 
6749
6754
  // src/mnemonic/mnemonic.ts
6750
6755
  import { randomBytes as randomBytes5, pbkdf2, computeHmac } from "@fuel-ts/crypto";
6751
6756
  import { ErrorCode as ErrorCode19, FuelError as FuelError20 } from "@fuel-ts/errors";
6752
6757
  import { sha256 as sha2563 } from "@fuel-ts/hasher";
6753
- import { arrayify as arrayify17, hexlify as hexlify17, concat as concat4, dataSlice, encodeBase58, toUtf8Bytes } from "@fuel-ts/utils";
6758
+ import { arrayify as arrayify17, hexlify as hexlify18, concat as concat4, dataSlice, encodeBase58, toUtf8Bytes } from "@fuel-ts/utils";
6754
6759
 
6755
6760
  // src/wordlists/words/english.ts
6756
6761
  var english = [
@@ -8950,7 +8955,7 @@ var Mnemonic = class {
8950
8955
  static mnemonicToEntropy(phrase, wordlist = english) {
8951
8956
  const words = getWords(phrase);
8952
8957
  assertMnemonic(words);
8953
- return hexlify17(mnemonicWordsToEntropy(words, wordlist));
8958
+ return hexlify18(mnemonicWordsToEntropy(words, wordlist));
8954
8959
  }
8955
8960
  /**
8956
8961
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -9083,10 +9088,10 @@ var mnemonic_default = Mnemonic;
9083
9088
 
9084
9089
  // src/hdwallet/hdwallet.ts
9085
9090
  var HARDENED_INDEX = 2147483648;
9086
- var MainnetPRV2 = hexlify18("0x0488ade4");
9087
- var MainnetPUB = hexlify18("0x0488b21e");
9088
- var TestnetPRV2 = hexlify18("0x04358394");
9089
- var TestnetPUB = hexlify18("0x043587cf");
9091
+ var MainnetPRV2 = hexlify19("0x0488ade4");
9092
+ var MainnetPUB = hexlify19("0x0488b21e");
9093
+ var TestnetPRV2 = hexlify19("0x04358394");
9094
+ var TestnetPUB = hexlify19("0x043587cf");
9090
9095
  function base58check(data) {
9091
9096
  return encodeBase582(concat5([data, dataSlice2(sha2564(sha2564(data)), 0, 4)]));
9092
9097
  }
@@ -9097,11 +9102,11 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
9097
9102
  return testnet ? TestnetPRV2 : MainnetPRV2;
9098
9103
  }
9099
9104
  function isPublicExtendedKey(extendedKey) {
9100
- return [MainnetPUB, TestnetPUB].includes(hexlify18(extendedKey.slice(0, 4)));
9105
+ return [MainnetPUB, TestnetPUB].includes(hexlify19(extendedKey.slice(0, 4)));
9101
9106
  }
9102
9107
  function isValidExtendedKey(extendedKey) {
9103
9108
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
9104
- hexlify18(extendedKey.slice(0, 4))
9109
+ hexlify19(extendedKey.slice(0, 4))
9105
9110
  );
9106
9111
  }
9107
9112
  function parsePath(path, depth = 0) {
@@ -9119,8 +9124,8 @@ function parsePath(path, depth = 0) {
9119
9124
  var HDWallet = class {
9120
9125
  depth = 0;
9121
9126
  index = 0;
9122
- fingerprint = hexlify18("0x00000000");
9123
- parentFingerprint = hexlify18("0x00000000");
9127
+ fingerprint = hexlify19("0x00000000");
9128
+ parentFingerprint = hexlify19("0x00000000");
9124
9129
  privateKey;
9125
9130
  publicKey;
9126
9131
  chainCode;
@@ -9132,8 +9137,8 @@ var HDWallet = class {
9132
9137
  constructor(config) {
9133
9138
  if (config.privateKey) {
9134
9139
  const signer = new Signer(config.privateKey);
9135
- this.publicKey = hexlify18(signer.compressedPublicKey);
9136
- this.privateKey = hexlify18(config.privateKey);
9140
+ this.publicKey = hexlify19(signer.compressedPublicKey);
9141
+ this.privateKey = hexlify19(config.privateKey);
9137
9142
  } else {
9138
9143
  if (!config.publicKey) {
9139
9144
  throw new FuelError21(
@@ -9141,7 +9146,7 @@ var HDWallet = class {
9141
9146
  "Both public and private Key cannot be missing. At least one should be provided."
9142
9147
  );
9143
9148
  }
9144
- this.publicKey = hexlify18(config.publicKey);
9149
+ this.publicKey = hexlify19(config.publicKey);
9145
9150
  }
9146
9151
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
9147
9152
  this.fingerprint = dataSlice2(ripemd160(sha2564(this.publicKey)), 0, 4);
@@ -9190,7 +9195,7 @@ var HDWallet = class {
9190
9195
  parentFingerprint: this.fingerprint
9191
9196
  });
9192
9197
  }
9193
- const signer = new Signer(hexlify18(IL));
9198
+ const signer = new Signer(hexlify19(IL));
9194
9199
  const Ki = signer.addPoint(publicKey);
9195
9200
  return new HDWallet({
9196
9201
  publicKey: Ki,
@@ -9225,7 +9230,7 @@ var HDWallet = class {
9225
9230
  );
9226
9231
  }
9227
9232
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
9228
- const depth = hexlify18(Uint8Array.from([this.depth]));
9233
+ const depth = hexlify19(Uint8Array.from([this.depth]));
9229
9234
  const parentFingerprint = this.parentFingerprint;
9230
9235
  const index = toHex(this.index, 4);
9231
9236
  const chainCode = this.chainCode;
@@ -9247,7 +9252,7 @@ var HDWallet = class {
9247
9252
  });
9248
9253
  }
9249
9254
  static fromExtendedKey(extendedKey) {
9250
- const decoded = hexlify18(toBytes2(decodeBase58(extendedKey)));
9255
+ const decoded = hexlify19(toBytes2(decodeBase58(extendedKey)));
9251
9256
  const bytes = arrayify18(decoded);
9252
9257
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
9253
9258
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
@@ -9257,9 +9262,9 @@ var HDWallet = class {
9257
9262
  throw new FuelError21(ErrorCode20.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
9258
9263
  }
9259
9264
  const depth = bytes[4];
9260
- const parentFingerprint = hexlify18(bytes.slice(5, 9));
9261
- const index = parseInt(hexlify18(bytes.slice(9, 13)).substring(2), 16);
9262
- const chainCode = hexlify18(bytes.slice(13, 45));
9265
+ const parentFingerprint = hexlify19(bytes.slice(5, 9));
9266
+ const index = parseInt(hexlify19(bytes.slice(9, 13)).substring(2), 16);
9267
+ const chainCode = hexlify19(bytes.slice(13, 45));
9263
9268
  const key = bytes.slice(45, 78);
9264
9269
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
9265
9270
  throw new FuelError21(
@@ -9863,17 +9868,17 @@ var StorageAbstract = class {
9863
9868
  import { Interface as Interface4 } from "@fuel-ts/abi-coder";
9864
9869
  import { Address as Address9 } from "@fuel-ts/address";
9865
9870
  import { ErrorCode as ErrorCode25, FuelError as FuelError26 } from "@fuel-ts/errors";
9866
- import { arrayify as arrayify20, hexlify as hexlify20 } from "@fuel-ts/utils";
9871
+ import { arrayify as arrayify20, hexlify as hexlify21 } from "@fuel-ts/utils";
9867
9872
 
9868
9873
  // src/predicate/utils/getPredicateRoot.ts
9869
9874
  import { hash as hash2 } from "@fuel-ts/hasher";
9870
9875
  import { calcRoot } from "@fuel-ts/merkle";
9871
- import { chunkAndPadBytes, hexlify as hexlify19, concat as concat6, arrayify as arrayify19 } from "@fuel-ts/utils";
9876
+ import { chunkAndPadBytes, hexlify as hexlify20, concat as concat6, arrayify as arrayify19 } from "@fuel-ts/utils";
9872
9877
  var getPredicateRoot = (bytecode) => {
9873
9878
  const chunkSize = 16 * 1024;
9874
9879
  const bytes = arrayify19(bytecode);
9875
9880
  const chunks = chunkAndPadBytes(bytes, chunkSize);
9876
- const codeRoot = calcRoot(chunks.map((c) => hexlify19(c)));
9881
+ const codeRoot = calcRoot(chunks.map((c) => hexlify20(c)));
9877
9882
  const predicateRoot = hash2(concat6(["0x4655454C", codeRoot]));
9878
9883
  return predicateRoot;
9879
9884
  };
@@ -9926,8 +9931,8 @@ var Predicate = class extends Account {
9926
9931
  }
9927
9932
  request.inputs.filter(isRequestInputCoinOrMessage).forEach((input) => {
9928
9933
  if (isRequestInputResourceFromOwner(input, this.address)) {
9929
- input.predicate = hexlify20(this.bytes);
9930
- input.predicateData = hexlify20(this.getPredicateData());
9934
+ input.predicate = hexlify21(this.bytes);
9935
+ input.predicateData = hexlify21(this.getPredicateData());
9931
9936
  input.witnessIndex = 0;
9932
9937
  }
9933
9938
  });
@@ -10007,8 +10012,8 @@ var Predicate = class extends Account {
10007
10012
  );
10008
10013
  return resources.map((resource) => ({
10009
10014
  ...resource,
10010
- predicate: hexlify20(this.bytes),
10011
- predicateData: hexlify20(this.getPredicateData())
10015
+ predicate: hexlify21(this.bytes),
10016
+ predicateData: hexlify21(this.getPredicateData())
10012
10017
  }));
10013
10018
  }
10014
10019
  /**
@@ -10020,8 +10025,8 @@ var Predicate = class extends Account {
10020
10025
  generateFakeResources(coins) {
10021
10026
  return super.generateFakeResources(coins).map((coin) => ({
10022
10027
  ...coin,
10023
- predicate: hexlify20(this.bytes),
10024
- predicateData: hexlify20(this.getPredicateData())
10028
+ predicate: hexlify21(this.bytes),
10029
+ predicateData: hexlify21(this.getPredicateData())
10025
10030
  }));
10026
10031
  }
10027
10032
  /**