@fuel-ts/account 0.0.0-rc-2224-20240503155836 → 0.0.0-rc-2037-20240504194803

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 (53) hide show
  1. package/dist/index.global.js +1357 -485
  2. package/dist/index.global.js.map +1 -1
  3. package/dist/index.js +497 -334
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +394 -240
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/predicate/predicate.d.ts +9 -2
  8. package/dist/predicate/predicate.d.ts.map +1 -1
  9. package/dist/providers/__generated__/operations.d.ts +186 -80
  10. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  11. package/dist/providers/message.d.ts +2 -2
  12. package/dist/providers/message.d.ts.map +1 -1
  13. package/dist/providers/provider.d.ts +24 -21
  14. package/dist/providers/provider.d.ts.map +1 -1
  15. package/dist/providers/transaction-request/helpers.d.ts +4 -0
  16. package/dist/providers/transaction-request/helpers.d.ts.map +1 -1
  17. package/dist/providers/transaction-request/index.d.ts +1 -0
  18. package/dist/providers/transaction-request/index.d.ts.map +1 -1
  19. package/dist/providers/transaction-request/script-transaction-request.d.ts +2 -3
  20. package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
  21. package/dist/providers/transaction-request/transaction-request.d.ts +4 -3
  22. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  23. package/dist/providers/transaction-request/utils.d.ts +0 -4
  24. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  25. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +2 -2
  26. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
  27. package/dist/providers/transaction-summary/calculate-tx-fee-for-summary.d.ts +20 -0
  28. package/dist/providers/transaction-summary/calculate-tx-fee-for-summary.d.ts.map +1 -0
  29. package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
  30. package/dist/providers/transaction-summary/index.d.ts +1 -1
  31. package/dist/providers/transaction-summary/index.d.ts.map +1 -1
  32. package/dist/providers/transaction-summary/operations.d.ts +4 -0
  33. package/dist/providers/transaction-summary/operations.d.ts.map +1 -1
  34. package/dist/providers/transaction-summary/status.d.ts +5 -1
  35. package/dist/providers/transaction-summary/status.d.ts.map +1 -1
  36. package/dist/providers/transaction-summary/types.d.ts +6 -1
  37. package/dist/providers/transaction-summary/types.d.ts.map +1 -1
  38. package/dist/providers/utils/gas.d.ts +6 -5
  39. package/dist/providers/utils/gas.d.ts.map +1 -1
  40. package/dist/test-utils/launchNode.d.ts.map +1 -1
  41. package/dist/test-utils/seedTestWallet.d.ts +1 -1
  42. package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
  43. package/dist/test-utils.global.js +1320 -496
  44. package/dist/test-utils.global.js.map +1 -1
  45. package/dist/test-utils.js +422 -326
  46. package/dist/test-utils.js.map +1 -1
  47. package/dist/test-utils.mjs +334 -238
  48. package/dist/test-utils.mjs.map +1 -1
  49. package/dist/wallet/base-wallet-unlocked.d.ts +2 -2
  50. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  51. package/package.json +16 -16
  52. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +0 -22
  53. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +0 -1
package/dist/index.mjs CHANGED
@@ -31,7 +31,7 @@ var __privateMethod = (obj, member, method) => {
31
31
  import { Address as Address3 } from "@fuel-ts/address";
32
32
  import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
33
33
  import { AbstractAccount } from "@fuel-ts/interfaces";
34
- import { bn as bn19 } from "@fuel-ts/math";
34
+ import { bn as bn20 } from "@fuel-ts/math";
35
35
  import { arrayify as arrayify14, isDefined as isDefined2 } from "@fuel-ts/utils";
36
36
  import { clone as clone4 } from "ramda";
37
37
 
@@ -73,7 +73,7 @@ var addAmountToCoinQuantities = (params) => {
73
73
  // src/providers/provider.ts
74
74
  import { Address as Address2 } from "@fuel-ts/address";
75
75
  import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
76
- import { BN, bn as bn16 } from "@fuel-ts/math";
76
+ import { BN, bn as bn18 } from "@fuel-ts/math";
77
77
  import {
78
78
  InputType as InputType7,
79
79
  TransactionType as TransactionType8,
@@ -139,9 +139,6 @@ var TransactionStatusFragmentFragmentDoc = gql`
139
139
  id
140
140
  }
141
141
  time
142
- receipts {
143
- ...receiptFragment
144
- }
145
142
  programState {
146
143
  returnType
147
144
  data
@@ -149,11 +146,15 @@ var TransactionStatusFragmentFragmentDoc = gql`
149
146
  receipts {
150
147
  ...receiptFragment
151
148
  }
149
+ totalGas
150
+ totalFee
152
151
  }
153
152
  ... on FailureStatus {
154
153
  block {
155
154
  id
156
155
  }
156
+ totalGas
157
+ totalFee
157
158
  time
158
159
  reason
159
160
  receipts {
@@ -193,6 +194,8 @@ var TransactionEstimatePredicatesFragmentFragmentDoc = gql`
193
194
  ${InputEstimatePredicatesFragmentFragmentDoc}`;
194
195
  var DryRunFailureStatusFragmentFragmentDoc = gql`
195
196
  fragment dryRunFailureStatusFragment on DryRunFailureStatus {
197
+ totalGas
198
+ totalFee
196
199
  reason
197
200
  programState {
198
201
  returnType
@@ -202,6 +205,8 @@ var DryRunFailureStatusFragmentFragmentDoc = gql`
202
205
  `;
203
206
  var DryRunSuccessStatusFragmentFragmentDoc = gql`
204
207
  fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
208
+ totalGas
209
+ totalFee
205
210
  programState {
206
211
  returnType
207
212
  data
@@ -337,6 +342,7 @@ var TxParametersFragmentFragmentDoc = gql`
337
342
  maxWitnesses
338
343
  maxGasPerTx
339
344
  maxSize
345
+ maxBytecodeSubsections
340
346
  }
341
347
  `;
342
348
  var PredicateParametersFragmentFragmentDoc = gql`
@@ -606,6 +612,14 @@ var NodeInfoFragmentFragmentDoc = gql`
606
612
  nodeVersion
607
613
  }
608
614
  `;
615
+ var RelayedTransactionStatusFragmentFragmentDoc = gql`
616
+ fragment relayedTransactionStatusFragment on RelayedTransactionStatus {
617
+ ... on RelayedTransactionFailed {
618
+ blockHeight
619
+ failure
620
+ }
621
+ }
622
+ `;
609
623
  var GetVersionDocument = gql`
610
624
  query getVersion {
611
625
  nodeInfo {
@@ -835,6 +849,13 @@ var GetMessageStatusDocument = gql`
835
849
  }
836
850
  }
837
851
  `;
852
+ var GetRelayedTransactionStatusDocument = gql`
853
+ query getRelayedTransactionStatus($relayedTransactionId: RelayedTransactionId!) {
854
+ relayedTransactionStatus(id: $relayedTransactionId) {
855
+ ...relayedTransactionStatusFragment
856
+ }
857
+ }
858
+ ${RelayedTransactionStatusFragmentFragmentDoc}`;
838
859
  var DryRunDocument = gql`
839
860
  mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
840
861
  dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
@@ -949,6 +970,9 @@ function getSdk(requester) {
949
970
  getMessageStatus(variables, options) {
950
971
  return requester(GetMessageStatusDocument, variables, options);
951
972
  },
973
+ getRelayedTransactionStatus(variables, options) {
974
+ return requester(GetRelayedTransactionStatusDocument, variables, options);
975
+ },
952
976
  dryRun(variables, options) {
953
977
  return requester(DryRunDocument, variables, options);
954
978
  },
@@ -1245,11 +1269,11 @@ import { UTXO_ID_LEN as UTXO_ID_LEN2 } from "@fuel-ts/abi-coder";
1245
1269
  import { Address, addressify } from "@fuel-ts/address";
1246
1270
  import { ZeroBytes32 as ZeroBytes324 } from "@fuel-ts/address/configs";
1247
1271
  import { randomBytes } from "@fuel-ts/crypto";
1248
- import { bn as bn7 } from "@fuel-ts/math";
1272
+ import { bn as bn8 } from "@fuel-ts/math";
1249
1273
  import {
1250
1274
  PolicyType,
1251
1275
  TransactionCoder,
1252
- InputType as InputType2,
1276
+ InputType as InputType3,
1253
1277
  OutputType as OutputType2,
1254
1278
  TransactionType
1255
1279
  } from "@fuel-ts/transactions";
@@ -1773,6 +1797,52 @@ var NoWitnessByOwnerError = class extends Error {
1773
1797
  name = "NoWitnessByOwnerError";
1774
1798
  };
1775
1799
 
1800
+ // src/providers/transaction-request/helpers.ts
1801
+ import { bn as bn7 } from "@fuel-ts/math";
1802
+ import { InputType as InputType2 } from "@fuel-ts/transactions";
1803
+ var isRequestInputCoin = (input) => input.type === InputType2.Coin;
1804
+ var isRequestInputMessage = (input) => input.type === InputType2.Message;
1805
+ var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
1806
+ var getRequestInputResourceOwner = (input) => isRequestInputCoin(input) ? input.owner : input.recipient;
1807
+ var isRequestInputResourceFromOwner = (input, owner) => getRequestInputResourceOwner(input) === owner.toB256();
1808
+ var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
1809
+ if (isRequestInputCoin(input) && input.assetId === assetId) {
1810
+ return acc.add(input.amount);
1811
+ }
1812
+ if (isRequestInputMessage(input) && assetId === baseAsset) {
1813
+ return acc.add(input.amount);
1814
+ }
1815
+ return acc;
1816
+ }, bn7(0));
1817
+ var cacheRequestInputsResources = (inputs) => inputs.filter(isRequestInputResource).reduce(
1818
+ (cache2, input) => {
1819
+ if (isRequestInputCoin(input)) {
1820
+ cache2.utxos.push(input.id);
1821
+ } else {
1822
+ cache2.messages.push(input.nonce);
1823
+ }
1824
+ return cache2;
1825
+ },
1826
+ {
1827
+ utxos: [],
1828
+ messages: []
1829
+ }
1830
+ );
1831
+ var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
1832
+ (acc, input) => {
1833
+ if (isRequestInputCoin(input) && input.owner === owner.toB256()) {
1834
+ acc.utxos.push(input.id);
1835
+ } else if (isRequestInputMessage(input) && input.recipient === owner.toB256()) {
1836
+ acc.messages.push(input.nonce);
1837
+ }
1838
+ return acc;
1839
+ },
1840
+ {
1841
+ utxos: [],
1842
+ messages: []
1843
+ }
1844
+ );
1845
+
1776
1846
  // src/providers/transaction-request/witness.ts
1777
1847
  import { arrayify as arrayify4, hexlify as hexlify6 } from "@fuel-ts/utils";
1778
1848
  var witnessify = (value) => {
@@ -1813,10 +1883,10 @@ var BaseTransactionRequest = class {
1813
1883
  outputs,
1814
1884
  witnesses
1815
1885
  } = {}) {
1816
- this.tip = tip ? bn7(tip) : void 0;
1886
+ this.tip = tip ? bn8(tip) : void 0;
1817
1887
  this.maturity = maturity && maturity > 0 ? maturity : void 0;
1818
- this.witnessLimit = isDefined(witnessLimit) ? bn7(witnessLimit) : void 0;
1819
- this.maxFee = bn7(maxFee);
1888
+ this.witnessLimit = isDefined(witnessLimit) ? bn8(witnessLimit) : void 0;
1889
+ this.maxFee = bn8(maxFee);
1820
1890
  this.inputs = inputs ?? [];
1821
1891
  this.outputs = outputs ?? [];
1822
1892
  this.witnesses = witnesses ?? [];
@@ -1825,13 +1895,13 @@ var BaseTransactionRequest = class {
1825
1895
  let policyTypes = 0;
1826
1896
  const policies = [];
1827
1897
  const { tip, witnessLimit, maturity } = req;
1828
- if (bn7(tip).gt(0)) {
1898
+ if (bn8(tip).gt(0)) {
1829
1899
  policyTypes += PolicyType.Tip;
1830
- policies.push({ data: bn7(tip), type: PolicyType.Tip });
1900
+ policies.push({ data: bn8(tip), type: PolicyType.Tip });
1831
1901
  }
1832
- if (isDefined(witnessLimit) && bn7(witnessLimit).gte(0)) {
1902
+ if (isDefined(witnessLimit) && bn8(witnessLimit).gte(0)) {
1833
1903
  policyTypes += PolicyType.WitnessLimit;
1834
- policies.push({ data: bn7(witnessLimit), type: PolicyType.WitnessLimit });
1904
+ policies.push({ data: bn8(witnessLimit), type: PolicyType.WitnessLimit });
1835
1905
  }
1836
1906
  if (maturity && maturity > 0) {
1837
1907
  policyTypes += PolicyType.Maturity;
@@ -1962,7 +2032,7 @@ var BaseTransactionRequest = class {
1962
2032
  */
1963
2033
  getCoinInputs() {
1964
2034
  return this.inputs.filter(
1965
- (input) => input.type === InputType2.Coin
2035
+ (input) => input.type === InputType3.Coin
1966
2036
  );
1967
2037
  }
1968
2038
  /**
@@ -1994,9 +2064,9 @@ var BaseTransactionRequest = class {
1994
2064
  const ownerAddress = addressify(owner);
1995
2065
  const found = this.inputs.find((input) => {
1996
2066
  switch (input.type) {
1997
- case InputType2.Coin:
2067
+ case InputType3.Coin:
1998
2068
  return hexlify7(input.owner) === ownerAddress.toB256();
1999
- case InputType2.Message:
2069
+ case InputType3.Message:
2000
2070
  return hexlify7(input.recipient) === ownerAddress.toB256();
2001
2071
  default:
2002
2072
  return false;
@@ -2011,7 +2081,7 @@ var BaseTransactionRequest = class {
2011
2081
  * @param coin - Coin resource.
2012
2082
  */
2013
2083
  addCoinInput(coin) {
2014
- const { assetId, owner, amount } = coin;
2084
+ const { assetId, owner, amount, id, predicate } = coin;
2015
2085
  let witnessIndex;
2016
2086
  if (coin.predicate) {
2017
2087
  witnessIndex = 0;
@@ -2022,13 +2092,14 @@ var BaseTransactionRequest = class {
2022
2092
  }
2023
2093
  }
2024
2094
  const input = {
2025
- ...coin,
2026
- type: InputType2.Coin,
2095
+ id,
2096
+ type: InputType3.Coin,
2027
2097
  owner: owner.toB256(),
2028
2098
  amount,
2029
2099
  assetId,
2030
2100
  txPointer: "0x00000000000000000000000000000000",
2031
- witnessIndex
2101
+ witnessIndex,
2102
+ predicate
2032
2103
  };
2033
2104
  this.pushInput(input);
2034
2105
  this.addChangeOutput(owner, assetId);
@@ -2040,7 +2111,7 @@ var BaseTransactionRequest = class {
2040
2111
  * @param message - Message resource.
2041
2112
  */
2042
2113
  addMessageInput(message) {
2043
- const { recipient, sender, amount, assetId } = message;
2114
+ const { recipient, sender, amount, predicate, nonce, assetId } = message;
2044
2115
  let witnessIndex;
2045
2116
  if (message.predicate) {
2046
2117
  witnessIndex = 0;
@@ -2051,12 +2122,13 @@ var BaseTransactionRequest = class {
2051
2122
  }
2052
2123
  }
2053
2124
  const input = {
2054
- ...message,
2055
- type: InputType2.Message,
2125
+ nonce,
2126
+ type: InputType3.Message,
2056
2127
  sender: sender.toB256(),
2057
2128
  recipient: recipient.toB256(),
2058
2129
  amount,
2059
- witnessIndex
2130
+ witnessIndex,
2131
+ predicate
2060
2132
  };
2061
2133
  this.pushInput(input);
2062
2134
  this.addChangeOutput(recipient, assetId);
@@ -2154,8 +2226,11 @@ var BaseTransactionRequest = class {
2154
2226
  * @hidden
2155
2227
  */
2156
2228
  calculateMinGas(chainInfo) {
2157
- const { gasCosts, consensusParameters } = chainInfo;
2158
- const { gasPerByte } = consensusParameters;
2229
+ const { consensusParameters } = chainInfo;
2230
+ const {
2231
+ gasCosts,
2232
+ feeParameters: { gasPerByte }
2233
+ } = consensusParameters;
2159
2234
  return getMinGas({
2160
2235
  gasPerByte,
2161
2236
  gasCosts,
@@ -2166,7 +2241,10 @@ var BaseTransactionRequest = class {
2166
2241
  }
2167
2242
  calculateMaxGas(chainInfo, minGas) {
2168
2243
  const { consensusParameters } = chainInfo;
2169
- const { gasPerByte, maxGasPerTx } = consensusParameters;
2244
+ const {
2245
+ feeParameters: { gasPerByte },
2246
+ txParameters: { maxGasPerTx }
2247
+ } = consensusParameters;
2170
2248
  const witnessesLength = this.toTransaction().witnesses.reduce(
2171
2249
  (acc, wit) => acc + wit.dataLength,
2172
2250
  0
@@ -2197,7 +2275,7 @@ var BaseTransactionRequest = class {
2197
2275
  const assetInput = findAssetInput(assetId);
2198
2276
  let usedQuantity = quantity;
2199
2277
  if (assetId === baseAssetId) {
2200
- usedQuantity = bn7("1000000000000000000");
2278
+ usedQuantity = bn8("1000000000000000000");
2201
2279
  }
2202
2280
  if (assetInput && "assetId" in assetInput) {
2203
2281
  assetInput.id = hexlify7(randomBytes(UTXO_ID_LEN2));
@@ -2209,13 +2287,13 @@ var BaseTransactionRequest = class {
2209
2287
  amount: usedQuantity,
2210
2288
  assetId,
2211
2289
  owner: resourcesOwner || Address.fromRandom(),
2212
- blockCreated: bn7(1),
2213
- txCreatedIdx: bn7(1)
2290
+ blockCreated: bn8(1),
2291
+ txCreatedIdx: bn8(1)
2214
2292
  }
2215
2293
  ]);
2216
2294
  }
2217
2295
  };
2218
- updateAssetInput(baseAssetId, bn7(1e11));
2296
+ updateAssetInput(baseAssetId, bn8(1e11));
2219
2297
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2220
2298
  }
2221
2299
  /**
@@ -2226,7 +2304,7 @@ var BaseTransactionRequest = class {
2226
2304
  */
2227
2305
  getCoinOutputsQuantities() {
2228
2306
  const coinsQuantities = this.getCoinOutputs().map(({ amount, assetId }) => ({
2229
- amount: bn7(amount),
2307
+ amount: bn8(amount),
2230
2308
  assetId: assetId.toString()
2231
2309
  }));
2232
2310
  return coinsQuantities;
@@ -2240,22 +2318,33 @@ var BaseTransactionRequest = class {
2240
2318
  toJSON() {
2241
2319
  return normalizeJSON(this);
2242
2320
  }
2321
+ removeWitness(index) {
2322
+ this.witnesses.splice(index, 1);
2323
+ this.adjustWitnessIndexes(index);
2324
+ }
2325
+ adjustWitnessIndexes(removedIndex) {
2326
+ this.inputs.filter(isRequestInputResource).forEach((input) => {
2327
+ if (input.witnessIndex > removedIndex) {
2328
+ input.witnessIndex -= 1;
2329
+ }
2330
+ });
2331
+ }
2243
2332
  updatePredicateGasUsed(inputs) {
2244
2333
  this.inputs.forEach((i) => {
2245
2334
  let correspondingInput;
2246
2335
  switch (i.type) {
2247
- case InputType2.Coin:
2248
- correspondingInput = inputs.find((x) => x.type === InputType2.Coin && x.owner === i.owner);
2336
+ case InputType3.Coin:
2337
+ correspondingInput = inputs.find((x) => x.type === InputType3.Coin && x.owner === i.owner);
2249
2338
  break;
2250
- case InputType2.Message:
2339
+ case InputType3.Message:
2251
2340
  correspondingInput = inputs.find(
2252
- (x) => x.type === InputType2.Message && x.sender === i.sender
2341
+ (x) => x.type === InputType3.Message && x.sender === i.sender
2253
2342
  );
2254
2343
  break;
2255
2344
  default:
2256
2345
  return;
2257
2346
  }
2258
- if (correspondingInput && "predicateGasUsed" in correspondingInput && bn7(correspondingInput.predicateGasUsed).gt(0)) {
2347
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && bn8(correspondingInput.predicateGasUsed).gt(0)) {
2259
2348
  i.predicate = correspondingInput.predicate;
2260
2349
  i.predicateData = correspondingInput.predicateData;
2261
2350
  i.predicateGasUsed = correspondingInput.predicateGasUsed;
@@ -2275,15 +2364,15 @@ var BaseTransactionRequest = class {
2275
2364
 
2276
2365
  // src/providers/transaction-request/create-transaction-request.ts
2277
2366
  import { ZeroBytes32 as ZeroBytes326 } from "@fuel-ts/address/configs";
2278
- import { bn as bn9 } from "@fuel-ts/math";
2367
+ import { bn as bn10 } from "@fuel-ts/math";
2279
2368
  import { TransactionType as TransactionType3, OutputType as OutputType4 } from "@fuel-ts/transactions";
2280
2369
  import { arrayify as arrayify6, hexlify as hexlify9 } from "@fuel-ts/utils";
2281
2370
 
2282
2371
  // src/providers/transaction-request/hash-transaction.ts
2283
2372
  import { ZeroBytes32 as ZeroBytes325 } from "@fuel-ts/address/configs";
2284
2373
  import { uint64ToBytesBE, sha256 } from "@fuel-ts/hasher";
2285
- import { bn as bn8 } from "@fuel-ts/math";
2286
- import { TransactionType as TransactionType2, InputType as InputType3, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
2374
+ import { bn as bn9 } from "@fuel-ts/math";
2375
+ import { TransactionType as TransactionType2, InputType as InputType4, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
2287
2376
  import { concat as concat2 } from "@fuel-ts/utils";
2288
2377
  import { clone as clone2 } from "ramda";
2289
2378
  function hashTransaction(transactionRequest, chainId) {
@@ -2294,19 +2383,19 @@ function hashTransaction(transactionRequest, chainId) {
2294
2383
  transaction.inputs = transaction.inputs.map((input) => {
2295
2384
  const inputClone = clone2(input);
2296
2385
  switch (inputClone.type) {
2297
- case InputType3.Coin: {
2386
+ case InputType4.Coin: {
2298
2387
  inputClone.txPointer = {
2299
2388
  blockHeight: 0,
2300
2389
  txIndex: 0
2301
2390
  };
2302
- inputClone.predicateGasUsed = bn8(0);
2391
+ inputClone.predicateGasUsed = bn9(0);
2303
2392
  return inputClone;
2304
2393
  }
2305
- case InputType3.Message: {
2306
- inputClone.predicateGasUsed = bn8(0);
2394
+ case InputType4.Message: {
2395
+ inputClone.predicateGasUsed = bn9(0);
2307
2396
  return inputClone;
2308
2397
  }
2309
- case InputType3.Contract: {
2398
+ case InputType4.Contract: {
2310
2399
  inputClone.txPointer = {
2311
2400
  blockHeight: 0,
2312
2401
  txIndex: 0
@@ -2330,12 +2419,12 @@ function hashTransaction(transactionRequest, chainId) {
2330
2419
  return outputClone;
2331
2420
  }
2332
2421
  case OutputType3.Change: {
2333
- outputClone.amount = bn8(0);
2422
+ outputClone.amount = bn9(0);
2334
2423
  return outputClone;
2335
2424
  }
2336
2425
  case OutputType3.Variable: {
2337
2426
  outputClone.to = ZeroBytes325;
2338
- outputClone.amount = bn8(0);
2427
+ outputClone.amount = bn9(0);
2339
2428
  outputClone.assetId = ZeroBytes325;
2340
2429
  return outputClone;
2341
2430
  }
@@ -2413,7 +2502,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2413
2502
  type: TransactionType3.Create,
2414
2503
  ...baseTransaction,
2415
2504
  bytecodeWitnessIndex,
2416
- storageSlotsCount: bn9(storageSlots.length),
2505
+ storageSlotsCount: bn10(storageSlots.length),
2417
2506
  salt: this.salt ? hexlify9(this.salt) : ZeroBytes326,
2418
2507
  storageSlots
2419
2508
  };
@@ -2453,7 +2542,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2453
2542
  }
2454
2543
  metadataGas(gasCosts) {
2455
2544
  return calculateMetadataGasForTxCreate({
2456
- contractBytesSize: bn9(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2545
+ contractBytesSize: bn10(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2457
2546
  gasCosts,
2458
2547
  stateRootSize: this.storageSlots.length,
2459
2548
  txBytesSize: this.byteSize()
@@ -2465,8 +2554,8 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2465
2554
  import { Interface } from "@fuel-ts/abi-coder";
2466
2555
  import { addressify as addressify2 } from "@fuel-ts/address";
2467
2556
  import { ZeroBytes32 as ZeroBytes327 } from "@fuel-ts/address/configs";
2468
- import { bn as bn10 } from "@fuel-ts/math";
2469
- import { InputType as InputType4, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2557
+ import { bn as bn11 } from "@fuel-ts/math";
2558
+ import { InputType as InputType5, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2470
2559
  import { arrayify as arrayify8, hexlify as hexlify10 } from "@fuel-ts/utils";
2471
2560
 
2472
2561
  // src/providers/transaction-request/scripts.ts
@@ -2519,7 +2608,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2519
2608
  */
2520
2609
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2521
2610
  super(rest);
2522
- this.gasLimit = bn10(gasLimit);
2611
+ this.gasLimit = bn11(gasLimit);
2523
2612
  this.script = arrayify8(script ?? returnZeroScript.bytes);
2524
2613
  this.scriptData = arrayify8(scriptData ?? returnZeroScript.encodeScriptData());
2525
2614
  this.abis = rest.abis;
@@ -2536,8 +2625,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2536
2625
  type: TransactionType4.Script,
2537
2626
  scriptGasLimit: this.gasLimit,
2538
2627
  ...super.getBaseTransaction(),
2539
- scriptLength: bn10(script.length),
2540
- scriptDataLength: bn10(scriptData.length),
2628
+ scriptLength: bn11(script.length),
2629
+ scriptDataLength: bn11(scriptData.length),
2541
2630
  receiptsRoot: ZeroBytes327,
2542
2631
  script: hexlify10(script),
2543
2632
  scriptData: hexlify10(scriptData)
@@ -2550,7 +2639,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2550
2639
  */
2551
2640
  getContractInputs() {
2552
2641
  return this.inputs.filter(
2553
- (input) => input.type === InputType4.Contract
2642
+ (input) => input.type === InputType5.Contract
2554
2643
  );
2555
2644
  }
2556
2645
  /**
@@ -2601,7 +2690,10 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2601
2690
  }
2602
2691
  calculateMaxGas(chainInfo, minGas) {
2603
2692
  const { consensusParameters } = chainInfo;
2604
- const { gasPerByte, maxGasPerTx } = consensusParameters;
2693
+ const {
2694
+ feeParameters: { gasPerByte },
2695
+ txParameters: { maxGasPerTx }
2696
+ } = consensusParameters;
2605
2697
  const witnessesLength = this.toTransaction().witnesses.reduce(
2606
2698
  (acc, wit) => acc + wit.dataLength,
2607
2699
  0
@@ -2627,7 +2719,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2627
2719
  return this;
2628
2720
  }
2629
2721
  const inputIndex = super.pushInput({
2630
- type: InputType4.Contract,
2722
+ type: InputType5.Contract,
2631
2723
  contractId: contractAddress.toB256(),
2632
2724
  txPointer: "0x00000000000000000000000000000000"
2633
2725
  });
@@ -2669,7 +2761,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2669
2761
 
2670
2762
  // src/providers/transaction-request/utils.ts
2671
2763
  import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
2672
- import { TransactionType as TransactionType5, InputType as InputType5 } from "@fuel-ts/transactions";
2764
+ import { TransactionType as TransactionType5 } from "@fuel-ts/transactions";
2673
2765
  var transactionRequestify = (obj) => {
2674
2766
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
2675
2767
  return obj;
@@ -2687,61 +2779,46 @@ var transactionRequestify = (obj) => {
2687
2779
  }
2688
2780
  }
2689
2781
  };
2690
- var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
2691
- (acc, input) => {
2692
- if (input.type === InputType5.Coin && input.owner === owner.toB256()) {
2693
- acc.utxos.push(input.id);
2694
- }
2695
- if (input.type === InputType5.Message && input.recipient === owner.toB256()) {
2696
- acc.messages.push(input.nonce);
2697
- }
2698
- return acc;
2699
- },
2700
- {
2701
- utxos: [],
2702
- messages: []
2703
- }
2704
- );
2705
2782
 
2706
2783
  // src/providers/transaction-response/transaction-response.ts
2707
2784
  import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
2708
- import { bn as bn15 } from "@fuel-ts/math";
2785
+ import { bn as bn17 } from "@fuel-ts/math";
2709
2786
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2710
2787
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
2711
2788
 
2712
2789
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2713
- import { bn as bn14 } from "@fuel-ts/math";
2790
+ import { bn as bn16 } from "@fuel-ts/math";
2714
2791
  import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
2715
2792
  import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2716
2793
 
2717
- // src/providers/transaction-summary/calculate-transaction-fee.ts
2718
- import { bn as bn11 } from "@fuel-ts/math";
2794
+ // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
2795
+ import { bn as bn12 } from "@fuel-ts/math";
2719
2796
  import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType6 } from "@fuel-ts/transactions";
2720
2797
  import { arrayify as arrayify9 } from "@fuel-ts/utils";
2721
- var calculateTransactionFee = (params) => {
2798
+ var calculateTXFeeForSummary = (params) => {
2722
2799
  const {
2723
2800
  gasPrice,
2724
2801
  rawPayload,
2725
2802
  tip,
2803
+ totalFee,
2726
2804
  consensusParameters: { gasCosts, feeParams, maxGasPerTx }
2727
2805
  } = params;
2728
- const gasPerByte = bn11(feeParams.gasPerByte);
2729
- const gasPriceFactor = bn11(feeParams.gasPriceFactor);
2806
+ if (totalFee) {
2807
+ return totalFee;
2808
+ }
2809
+ const gasPerByte = bn12(feeParams.gasPerByte);
2810
+ const gasPriceFactor = bn12(feeParams.gasPriceFactor);
2730
2811
  const transactionBytes = arrayify9(rawPayload);
2731
2812
  const [transaction] = new TransactionCoder3().decode(transactionBytes, 0);
2732
- if (transaction.type === TransactionType6.Mint) {
2733
- return {
2734
- fee: bn11(0),
2735
- minFee: bn11(0),
2736
- maxFee: bn11(0)
2737
- };
2738
- }
2739
2813
  const { type, witnesses, inputs, policies } = transaction;
2740
- let metadataGas = bn11(0);
2741
- let gasLimit = bn11(0);
2814
+ let metadataGas = bn12(0);
2815
+ let gasLimit = bn12(0);
2816
+ if (type !== TransactionType6.Create && type !== TransactionType6.Script) {
2817
+ return bn12(0);
2818
+ }
2742
2819
  if (type === TransactionType6.Create) {
2743
2820
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2744
- const contractBytesSize = bn11(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2821
+ const contractBytesSize = bn12(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2745
2822
  metadataGas = calculateMetadataGasForTxCreate({
2746
2823
  contractBytesSize,
2747
2824
  gasCosts,
@@ -2760,7 +2837,7 @@ var calculateTransactionFee = (params) => {
2760
2837
  }
2761
2838
  const minGas = getMinGas({
2762
2839
  gasCosts,
2763
- gasPerByte: bn11(gasPerByte),
2840
+ gasPerByte: bn12(gasPerByte),
2764
2841
  inputs,
2765
2842
  metadataGas,
2766
2843
  txBytesSize: transactionBytes.length
@@ -2775,34 +2852,24 @@ var calculateTransactionFee = (params) => {
2775
2852
  witnessLimit,
2776
2853
  maxGasPerTx
2777
2854
  });
2778
- const minFee = calculateGasFee({
2779
- gasPrice,
2780
- gas: minGas,
2781
- priceFactor: gasPriceFactor,
2782
- tip
2783
- });
2784
2855
  const maxFee = calculateGasFee({
2785
2856
  gasPrice,
2786
2857
  gas: maxGas,
2787
2858
  priceFactor: gasPriceFactor,
2788
2859
  tip
2789
2860
  });
2790
- return {
2791
- minFee,
2792
- maxFee,
2793
- fee: maxFee
2794
- };
2861
+ return maxFee;
2795
2862
  };
2796
2863
 
2797
2864
  // src/providers/transaction-summary/operations.ts
2798
2865
  import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
2799
2866
  import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
2800
- import { bn as bn13 } from "@fuel-ts/math";
2867
+ import { bn as bn14 } from "@fuel-ts/math";
2801
2868
  import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
2802
2869
 
2803
2870
  // src/providers/transaction-summary/call.ts
2804
2871
  import { Interface as Interface2, calculateVmTxMemory } from "@fuel-ts/abi-coder";
2805
- import { bn as bn12 } from "@fuel-ts/math";
2872
+ import { bn as bn13 } from "@fuel-ts/math";
2806
2873
  var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2807
2874
  const abiInterface = new Interface2(abi);
2808
2875
  const callFunctionSelector = receipt.param1.toHex(8);
@@ -2811,7 +2878,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2811
2878
  let encodedArgs;
2812
2879
  if (functionFragment.isInputDataPointer) {
2813
2880
  if (rawPayload) {
2814
- const argsOffset = bn12(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2881
+ const argsOffset = bn13(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2815
2882
  encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2816
2883
  }
2817
2884
  } else {
@@ -2926,6 +2993,8 @@ var TransactionTypeName = /* @__PURE__ */ ((TransactionTypeName2) => {
2926
2993
  TransactionTypeName2["Create"] = "Create";
2927
2994
  TransactionTypeName2["Mint"] = "Mint";
2928
2995
  TransactionTypeName2["Script"] = "Script";
2996
+ TransactionTypeName2["Upgrade"] = "Upgrade";
2997
+ TransactionTypeName2["Upload"] = "Upload";
2929
2998
  return TransactionTypeName2;
2930
2999
  })(TransactionTypeName || {});
2931
3000
  var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
@@ -2991,6 +3060,12 @@ function isTypeCreate(transactionType) {
2991
3060
  function isTypeScript(transactionType) {
2992
3061
  return isType(transactionType, "Script" /* Script */);
2993
3062
  }
3063
+ function isTypeUpgrade(transactionType) {
3064
+ return isType(transactionType, "Upgrade" /* Upgrade */);
3065
+ }
3066
+ function isTypeUpload(transactionType) {
3067
+ return isType(transactionType, "Upload" /* Upload */);
3068
+ }
2994
3069
  function hasSameAssetId(a) {
2995
3070
  return (b) => a.assetId === b.assetId;
2996
3071
  }
@@ -3011,7 +3086,7 @@ var mergeAssets = (op1, op2) => {
3011
3086
  if (!matchingAsset) {
3012
3087
  return asset1;
3013
3088
  }
3014
- const mergedAmount = bn13(asset1.amount).add(matchingAsset.amount);
3089
+ const mergedAmount = bn14(asset1.amount).add(matchingAsset.amount);
3015
3090
  return { ...asset1, amount: mergedAmount };
3016
3091
  });
3017
3092
  return mergedAssets.concat(filteredAssets);
@@ -3337,6 +3412,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3337
3412
 
3338
3413
  // src/providers/transaction-summary/status.ts
3339
3414
  import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
3415
+ import { bn as bn15 } from "@fuel-ts/math";
3340
3416
  var getTransactionStatusName = (gqlStatus) => {
3341
3417
  switch (gqlStatus) {
3342
3418
  case "FailureStatus":
@@ -3358,6 +3434,8 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3358
3434
  let time;
3359
3435
  let blockId;
3360
3436
  let status;
3437
+ let totalFee;
3438
+ let totalGas;
3361
3439
  let isStatusFailure = false;
3362
3440
  let isStatusSuccess = false;
3363
3441
  let isStatusPending = false;
@@ -3368,11 +3446,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3368
3446
  time = gqlTransactionStatus.time;
3369
3447
  blockId = gqlTransactionStatus.block.id;
3370
3448
  isStatusSuccess = true;
3449
+ totalFee = bn15(gqlTransactionStatus.totalFee);
3450
+ totalGas = bn15(gqlTransactionStatus.totalGas);
3371
3451
  break;
3372
3452
  case "FailureStatus":
3373
3453
  time = gqlTransactionStatus.time;
3374
3454
  blockId = gqlTransactionStatus.block.id;
3375
3455
  isStatusFailure = true;
3456
+ totalFee = bn15(gqlTransactionStatus.totalFee);
3457
+ totalGas = bn15(gqlTransactionStatus.totalGas);
3376
3458
  break;
3377
3459
  case "SubmittedStatus":
3378
3460
  time = gqlTransactionStatus.time;
@@ -3385,6 +3467,8 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3385
3467
  time,
3386
3468
  blockId,
3387
3469
  status,
3470
+ totalFee,
3471
+ totalGas,
3388
3472
  isStatusFailure,
3389
3473
  isStatusSuccess,
3390
3474
  isStatusPending
@@ -3420,8 +3504,10 @@ function assembleTransactionSummary(params) {
3420
3504
  maxInputs
3421
3505
  });
3422
3506
  const typeName = getTransactionTypeName(transaction.type);
3423
- const tip = bn14(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3424
- const { fee } = calculateTransactionFee({
3507
+ const tip = bn16(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3508
+ const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3509
+ const fee = calculateTXFeeForSummary({
3510
+ totalFee,
3425
3511
  gasPrice,
3426
3512
  rawPayload,
3427
3513
  tip,
@@ -3434,7 +3520,6 @@ function assembleTransactionSummary(params) {
3434
3520
  }
3435
3521
  }
3436
3522
  });
3437
- const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time } = processGraphqlStatus(gqlTransactionStatus);
3438
3523
  const mintedAssets = extractMintedAssetsFromReceipts(receipts);
3439
3524
  const burnedAssets = extractBurnedAssetsFromReceipts(receipts);
3440
3525
  let date;
@@ -3443,6 +3528,7 @@ function assembleTransactionSummary(params) {
3443
3528
  }
3444
3529
  const transactionSummary = {
3445
3530
  id,
3531
+ tip,
3446
3532
  fee,
3447
3533
  gasUsed,
3448
3534
  operations,
@@ -3456,6 +3542,8 @@ function assembleTransactionSummary(params) {
3456
3542
  isTypeMint: isTypeMint(transaction.type),
3457
3543
  isTypeCreate: isTypeCreate(transaction.type),
3458
3544
  isTypeScript: isTypeScript(transaction.type),
3545
+ isTypeUpgrade: isTypeUpgrade(transaction.type),
3546
+ isTypeUpload: isTypeUpload(transaction.type),
3459
3547
  isStatusFailure,
3460
3548
  isStatusSuccess,
3461
3549
  isStatusPending,
@@ -3487,7 +3575,7 @@ var TransactionResponse = class {
3487
3575
  /** Current provider */
3488
3576
  provider;
3489
3577
  /** Gas used on the transaction */
3490
- gasUsed = bn15(0);
3578
+ gasUsed = bn17(0);
3491
3579
  /** The graphql Transaction with receipts object. */
3492
3580
  gqlTransaction;
3493
3581
  abis;
@@ -3572,7 +3660,7 @@ var TransactionResponse = class {
3572
3660
  const receipts = txReceipts.map(processGqlReceipt) || [];
3573
3661
  const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
3574
3662
  const gasPrice = await this.provider.getLatestGasPrice();
3575
- const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
3663
+ const maxInputs = this.provider.getChain().consensusParameters.txParameters.maxInputs;
3576
3664
  const transactionSummary = assembleTransactionSummary({
3577
3665
  id: this.id,
3578
3666
  receipts,
@@ -3708,33 +3796,60 @@ var mergeQuantities = (...coinQuantities) => {
3708
3796
  var MAX_RETRIES = 10;
3709
3797
  var processGqlChain = (chain) => {
3710
3798
  const { name, daHeight, consensusParameters, latestBlock } = chain;
3711
- const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } = consensusParameters;
3799
+ const {
3800
+ contractParams,
3801
+ feeParams,
3802
+ predicateParams,
3803
+ scriptParams,
3804
+ txParams,
3805
+ gasCosts,
3806
+ baseAssetId,
3807
+ chainId,
3808
+ version
3809
+ } = consensusParameters;
3712
3810
  return {
3713
3811
  name,
3714
- baseChainHeight: bn16(daHeight),
3812
+ baseChainHeight: bn18(daHeight),
3715
3813
  consensusParameters: {
3716
- contractMaxSize: bn16(contractParams.contractMaxSize),
3717
- maxInputs: bn16(txParams.maxInputs),
3718
- maxOutputs: bn16(txParams.maxOutputs),
3719
- maxWitnesses: bn16(txParams.maxWitnesses),
3720
- maxGasPerTx: bn16(txParams.maxGasPerTx),
3721
- maxScriptLength: bn16(scriptParams.maxScriptLength),
3722
- maxScriptDataLength: bn16(scriptParams.maxScriptDataLength),
3723
- maxStorageSlots: bn16(contractParams.maxStorageSlots),
3724
- maxPredicateLength: bn16(predicateParams.maxPredicateLength),
3725
- maxPredicateDataLength: bn16(predicateParams.maxPredicateDataLength),
3726
- maxGasPerPredicate: bn16(predicateParams.maxGasPerPredicate),
3727
- gasPriceFactor: bn16(feeParams.gasPriceFactor),
3728
- gasPerByte: bn16(feeParams.gasPerByte),
3729
- maxMessageDataLength: bn16(predicateParams.maxMessageDataLength),
3730
- chainId: bn16(consensusParameters.chainId),
3731
- baseAssetId: consensusParameters.baseAssetId,
3814
+ version,
3815
+ chainId: bn18(chainId),
3816
+ baseAssetId,
3817
+ feeParameters: {
3818
+ version: feeParams.version,
3819
+ gasPerByte: bn18(feeParams.gasPerByte),
3820
+ gasPriceFactor: bn18(feeParams.gasPriceFactor)
3821
+ },
3822
+ contractParameters: {
3823
+ version: contractParams.version,
3824
+ contractMaxSize: bn18(contractParams.contractMaxSize),
3825
+ maxStorageSlots: bn18(contractParams.maxStorageSlots)
3826
+ },
3827
+ txParameters: {
3828
+ version: txParams.version,
3829
+ maxInputs: bn18(txParams.maxInputs),
3830
+ maxOutputs: bn18(txParams.maxOutputs),
3831
+ maxWitnesses: bn18(txParams.maxWitnesses),
3832
+ maxGasPerTx: bn18(txParams.maxGasPerTx),
3833
+ maxSize: bn18(txParams.maxSize),
3834
+ maxBytecodeSubsections: bn18(txParams.maxBytecodeSubsections)
3835
+ },
3836
+ predicateParameters: {
3837
+ version: predicateParams.version,
3838
+ maxPredicateLength: bn18(predicateParams.maxPredicateLength),
3839
+ maxPredicateDataLength: bn18(predicateParams.maxPredicateDataLength),
3840
+ maxGasPerPredicate: bn18(predicateParams.maxGasPerPredicate),
3841
+ maxMessageDataLength: bn18(predicateParams.maxMessageDataLength)
3842
+ },
3843
+ scriptParameters: {
3844
+ version: scriptParams.version,
3845
+ maxScriptLength: bn18(scriptParams.maxScriptLength),
3846
+ maxScriptDataLength: bn18(scriptParams.maxScriptDataLength)
3847
+ },
3732
3848
  gasCosts
3733
3849
  },
3734
- gasCosts,
3735
3850
  latestBlock: {
3736
3851
  id: latestBlock.id,
3737
- height: bn16(latestBlock.height),
3852
+ height: bn18(latestBlock.height),
3738
3853
  time: latestBlock.header.time,
3739
3854
  transactions: latestBlock.transactions.map((i) => ({
3740
3855
  id: i.id
@@ -3828,7 +3943,12 @@ var _Provider = class {
3828
3943
  * Returns some helpful parameters related to gas fees.
3829
3944
  */
3830
3945
  getGasConfig() {
3831
- const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
3946
+ const {
3947
+ txParameters: { maxGasPerTx },
3948
+ predicateParameters: { maxGasPerPredicate },
3949
+ feeParameters: { gasPriceFactor, gasPerByte },
3950
+ gasCosts
3951
+ } = this.getChain().consensusParameters;
3832
3952
  return {
3833
3953
  maxGasPerTx,
3834
3954
  maxGasPerPredicate,
@@ -3863,11 +3983,9 @@ var _Provider = class {
3863
3983
  static ensureClientVersionIsSupported(nodeInfo) {
3864
3984
  const { isMajorSupported, isMinorSupported, supportedVersion } = checkFuelCoreVersionCompatibility(nodeInfo.nodeVersion);
3865
3985
  if (!isMajorSupported || !isMinorSupported) {
3866
- console.warn(
3867
- `The Fuel Node that you are trying to connect to is using fuel-core version ${nodeInfo.nodeVersion},
3868
- which is not supported by the version of the TS SDK that you are using.
3869
- Things might or might not work as expected.
3870
- Supported fuel-core version: ${supportedVersion}.`
3986
+ throw new FuelError13(
3987
+ FuelError13.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3988
+ `Fuel client version: ${nodeInfo.nodeVersion}, Supported version: ${supportedVersion}`
3871
3989
  );
3872
3990
  }
3873
3991
  }
@@ -3925,7 +4043,7 @@ Supported fuel-core version: ${supportedVersion}.`
3925
4043
  */
3926
4044
  async getBlockNumber() {
3927
4045
  const { chain } = await this.operations.getChain();
3928
- return bn16(chain.latestBlock.height, 10);
4046
+ return bn18(chain.latestBlock.height, 10);
3929
4047
  }
3930
4048
  /**
3931
4049
  * Returns the chain information.
@@ -3935,8 +4053,8 @@ Supported fuel-core version: ${supportedVersion}.`
3935
4053
  async fetchNode() {
3936
4054
  const { nodeInfo } = await this.operations.getNodeInfo();
3937
4055
  const processedNodeInfo = {
3938
- maxDepth: bn16(nodeInfo.maxDepth),
3939
- maxTx: bn16(nodeInfo.maxTx),
4056
+ maxDepth: bn18(nodeInfo.maxDepth),
4057
+ maxTx: bn18(nodeInfo.maxTx),
3940
4058
  nodeVersion: nodeInfo.nodeVersion,
3941
4059
  utxoValidation: nodeInfo.utxoValidation,
3942
4060
  vmBacktrace: nodeInfo.vmBacktrace
@@ -4040,9 +4158,9 @@ Supported fuel-core version: ${supportedVersion}.`
4040
4158
  encodedTransactions: encodedTransaction,
4041
4159
  utxoValidation: utxoValidation || false
4042
4160
  });
4043
- const [{ receipts: rawReceipts, status }] = dryRunStatuses;
4161
+ const [{ receipts: rawReceipts, status: dryRunStatus }] = dryRunStatuses;
4044
4162
  const receipts = rawReceipts.map(processGqlReceipt);
4045
- return { receipts, dryrunStatus: status };
4163
+ return { receipts, dryRunStatus };
4046
4164
  }
4047
4165
  /**
4048
4166
  * Verifies whether enough gas is available to complete transaction.
@@ -4068,7 +4186,7 @@ Supported fuel-core version: ${supportedVersion}.`
4068
4186
  } = response;
4069
4187
  if (inputs) {
4070
4188
  inputs.forEach((input, index) => {
4071
- if ("predicateGasUsed" in input && bn16(input.predicateGasUsed).gt(0)) {
4189
+ if ("predicateGasUsed" in input && bn18(input.predicateGasUsed).gt(0)) {
4072
4190
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
4073
4191
  }
4074
4192
  });
@@ -4096,7 +4214,7 @@ Supported fuel-core version: ${supportedVersion}.`
4096
4214
  let receipts = [];
4097
4215
  const missingContractIds = [];
4098
4216
  let outputVariables = 0;
4099
- let dryrunStatus;
4217
+ let dryRunStatus;
4100
4218
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
4101
4219
  const {
4102
4220
  dryRun: [{ receipts: rawReceipts, status }]
@@ -4105,7 +4223,7 @@ Supported fuel-core version: ${supportedVersion}.`
4105
4223
  utxoValidation: false
4106
4224
  });
4107
4225
  receipts = rawReceipts.map(processGqlReceipt);
4108
- dryrunStatus = status;
4226
+ dryRunStatus = status;
4109
4227
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
4110
4228
  const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
4111
4229
  if (hasMissingOutputs) {
@@ -4127,7 +4245,7 @@ Supported fuel-core version: ${supportedVersion}.`
4127
4245
  receipts,
4128
4246
  outputVariables,
4129
4247
  missingContractIds,
4130
- dryrunStatus
4248
+ dryRunStatus
4131
4249
  };
4132
4250
  }
4133
4251
  /**
@@ -4145,7 +4263,7 @@ Supported fuel-core version: ${supportedVersion}.`
4145
4263
  receipts: [],
4146
4264
  outputVariables: 0,
4147
4265
  missingContractIds: [],
4148
- dryrunStatus: void 0
4266
+ dryRunStatus: void 0
4149
4267
  }));
4150
4268
  const allRequests = clone3(transactionRequests);
4151
4269
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
@@ -4170,7 +4288,7 @@ Supported fuel-core version: ${supportedVersion}.`
4170
4288
  const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
4171
4289
  const result = results[requestIdx];
4172
4290
  result.receipts = rawReceipts.map(processGqlReceipt);
4173
- result.dryrunStatus = status;
4291
+ result.dryRunStatus = status;
4174
4292
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
4175
4293
  result.receipts
4176
4294
  );
@@ -4207,7 +4325,7 @@ Supported fuel-core version: ${supportedVersion}.`
4207
4325
  });
4208
4326
  const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
4209
4327
  const receipts = rawReceipts.map(processGqlReceipt);
4210
- return { receipts, dryrunStatus: status };
4328
+ return { receipts, dryRunStatus: status };
4211
4329
  });
4212
4330
  return results;
4213
4331
  }
@@ -4226,12 +4344,12 @@ Supported fuel-core version: ${supportedVersion}.`
4226
4344
  gasPrice = await this.estimateGasPrice(10);
4227
4345
  }
4228
4346
  const minFee = calculateGasFee({
4229
- gasPrice: bn16(gasPrice),
4347
+ gasPrice: bn18(gasPrice),
4230
4348
  gas: minGas,
4231
4349
  priceFactor: gasPriceFactor,
4232
4350
  tip: transactionRequest.tip
4233
4351
  }).add(1);
4234
- let gasLimit = bn16(0);
4352
+ let gasLimit = bn18(0);
4235
4353
  if (transactionRequest.type === TransactionType8.Script) {
4236
4354
  gasLimit = transactionRequest.gasLimit;
4237
4355
  if (transactionRequest.gasLimit.eq(0)) {
@@ -4244,7 +4362,7 @@ Supported fuel-core version: ${supportedVersion}.`
4244
4362
  }
4245
4363
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4246
4364
  const maxFee = calculateGasFee({
4247
- gasPrice: bn16(gasPrice),
4365
+ gasPrice: bn18(gasPrice),
4248
4366
  gas: maxGas,
4249
4367
  priceFactor: gasPriceFactor,
4250
4368
  tip: transactionRequest.tip
@@ -4307,9 +4425,9 @@ Supported fuel-core version: ${supportedVersion}.`
4307
4425
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
4308
4426
  const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
4309
4427
  txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
4310
- txRequestClone.maxFee = bn16(0);
4428
+ txRequestClone.maxFee = bn18(0);
4311
4429
  if (isScriptTransaction) {
4312
- txRequestClone.gasLimit = bn16(0);
4430
+ txRequestClone.gasLimit = bn18(0);
4313
4431
  }
4314
4432
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4315
4433
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -4326,9 +4444,10 @@ Supported fuel-core version: ${supportedVersion}.`
4326
4444
  transactionRequest: signedRequest
4327
4445
  });
4328
4446
  let receipts = [];
4447
+ let dryRunStatus;
4329
4448
  let missingContractIds = [];
4330
4449
  let outputVariables = 0;
4331
- let gasUsed = bn16(0);
4450
+ let gasUsed = bn18(0);
4332
4451
  txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
4333
4452
  txRequestClone.maxFee = maxFee;
4334
4453
  if (isScriptTransaction) {
@@ -4336,10 +4455,7 @@ Supported fuel-core version: ${supportedVersion}.`
4336
4455
  if (signatureCallback) {
4337
4456
  await signatureCallback(txRequestClone);
4338
4457
  }
4339
- const result = await this.estimateTxDependencies(txRequestClone);
4340
- receipts = result.receipts;
4341
- outputVariables = result.outputVariables;
4342
- missingContractIds = result.missingContractIds;
4458
+ ({ receipts, missingContractIds, outputVariables, dryRunStatus } = await this.estimateTxDependencies(txRequestClone));
4343
4459
  gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
4344
4460
  txRequestClone.gasLimit = gasUsed;
4345
4461
  ({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
@@ -4359,7 +4475,8 @@ Supported fuel-core version: ${supportedVersion}.`
4359
4475
  outputVariables,
4360
4476
  missingContractIds,
4361
4477
  addedSignatures,
4362
- estimatedPredicates: txRequestClone.inputs
4478
+ estimatedPredicates: txRequestClone.inputs,
4479
+ dryRunStatus
4363
4480
  };
4364
4481
  }
4365
4482
  async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
@@ -4395,10 +4512,10 @@ Supported fuel-core version: ${supportedVersion}.`
4395
4512
  return coins.map((coin) => ({
4396
4513
  id: coin.utxoId,
4397
4514
  assetId: coin.assetId,
4398
- amount: bn16(coin.amount),
4515
+ amount: bn18(coin.amount),
4399
4516
  owner: Address2.fromAddressOrString(coin.owner),
4400
- blockCreated: bn16(coin.blockCreated),
4401
- txCreatedIdx: bn16(coin.txCreatedIdx)
4517
+ blockCreated: bn18(coin.blockCreated),
4518
+ txCreatedIdx: bn18(coin.txCreatedIdx)
4402
4519
  }));
4403
4520
  }
4404
4521
  /**
@@ -4435,9 +4552,9 @@ Supported fuel-core version: ${supportedVersion}.`
4435
4552
  switch (coin.__typename) {
4436
4553
  case "MessageCoin":
4437
4554
  return {
4438
- amount: bn16(coin.amount),
4555
+ amount: bn18(coin.amount),
4439
4556
  assetId: coin.assetId,
4440
- daHeight: bn16(coin.daHeight),
4557
+ daHeight: bn18(coin.daHeight),
4441
4558
  sender: Address2.fromAddressOrString(coin.sender),
4442
4559
  recipient: Address2.fromAddressOrString(coin.recipient),
4443
4560
  nonce: coin.nonce
@@ -4445,11 +4562,11 @@ Supported fuel-core version: ${supportedVersion}.`
4445
4562
  case "Coin":
4446
4563
  return {
4447
4564
  id: coin.utxoId,
4448
- amount: bn16(coin.amount),
4565
+ amount: bn18(coin.amount),
4449
4566
  assetId: coin.assetId,
4450
4567
  owner: Address2.fromAddressOrString(coin.owner),
4451
- blockCreated: bn16(coin.blockCreated),
4452
- txCreatedIdx: bn16(coin.txCreatedIdx)
4568
+ blockCreated: bn18(coin.blockCreated),
4569
+ txCreatedIdx: bn18(coin.txCreatedIdx)
4453
4570
  };
4454
4571
  default:
4455
4572
  return null;
@@ -4466,13 +4583,13 @@ Supported fuel-core version: ${supportedVersion}.`
4466
4583
  async getBlock(idOrHeight) {
4467
4584
  let variables;
4468
4585
  if (typeof idOrHeight === "number") {
4469
- variables = { height: bn16(idOrHeight).toString(10) };
4586
+ variables = { height: bn18(idOrHeight).toString(10) };
4470
4587
  } else if (idOrHeight === "latest") {
4471
4588
  variables = { height: (await this.getBlockNumber()).toString(10) };
4472
4589
  } else if (idOrHeight.length === 66) {
4473
4590
  variables = { blockId: idOrHeight };
4474
4591
  } else {
4475
- variables = { blockId: bn16(idOrHeight).toString(10) };
4592
+ variables = { blockId: bn18(idOrHeight).toString(10) };
4476
4593
  }
4477
4594
  const { block } = await this.operations.getBlock(variables);
4478
4595
  if (!block) {
@@ -4480,7 +4597,7 @@ Supported fuel-core version: ${supportedVersion}.`
4480
4597
  }
4481
4598
  return {
4482
4599
  id: block.id,
4483
- height: bn16(block.height),
4600
+ height: bn18(block.height),
4484
4601
  time: block.header.time,
4485
4602
  transactionIds: block.transactions.map((tx) => tx.id)
4486
4603
  };
@@ -4495,7 +4612,7 @@ Supported fuel-core version: ${supportedVersion}.`
4495
4612
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4496
4613
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4497
4614
  id: block.id,
4498
- height: bn16(block.height),
4615
+ height: bn18(block.height),
4499
4616
  time: block.header.time,
4500
4617
  transactionIds: block.transactions.map((tx) => tx.id)
4501
4618
  }));
@@ -4510,7 +4627,7 @@ Supported fuel-core version: ${supportedVersion}.`
4510
4627
  async getBlockWithTransactions(idOrHeight) {
4511
4628
  let variables;
4512
4629
  if (typeof idOrHeight === "number") {
4513
- variables = { blockHeight: bn16(idOrHeight).toString(10) };
4630
+ variables = { blockHeight: bn18(idOrHeight).toString(10) };
4514
4631
  } else if (idOrHeight === "latest") {
4515
4632
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4516
4633
  } else {
@@ -4522,7 +4639,7 @@ Supported fuel-core version: ${supportedVersion}.`
4522
4639
  }
4523
4640
  return {
4524
4641
  id: block.id,
4525
- height: bn16(block.height, 10),
4642
+ height: bn18(block.height, 10),
4526
4643
  time: block.header.time,
4527
4644
  transactionIds: block.transactions.map((tx) => tx.id),
4528
4645
  transactions: block.transactions.map(
@@ -4571,7 +4688,7 @@ Supported fuel-core version: ${supportedVersion}.`
4571
4688
  contract: Address2.fromAddressOrString(contractId).toB256(),
4572
4689
  asset: hexlify12(assetId)
4573
4690
  });
4574
- return bn16(contractBalance.amount, 10);
4691
+ return bn18(contractBalance.amount, 10);
4575
4692
  }
4576
4693
  /**
4577
4694
  * Returns the balance for the given owner for the given asset ID.
@@ -4585,7 +4702,7 @@ Supported fuel-core version: ${supportedVersion}.`
4585
4702
  owner: Address2.fromAddressOrString(owner).toB256(),
4586
4703
  assetId: hexlify12(assetId)
4587
4704
  });
4588
- return bn16(balance.amount, 10);
4705
+ return bn18(balance.amount, 10);
4589
4706
  }
4590
4707
  /**
4591
4708
  * Returns balances for the given owner.
@@ -4603,7 +4720,7 @@ Supported fuel-core version: ${supportedVersion}.`
4603
4720
  const balances = result.balances.edges.map((edge) => edge.node);
4604
4721
  return balances.map((balance) => ({
4605
4722
  assetId: balance.assetId,
4606
- amount: bn16(balance.amount)
4723
+ amount: bn18(balance.amount)
4607
4724
  }));
4608
4725
  }
4609
4726
  /**
@@ -4625,15 +4742,15 @@ Supported fuel-core version: ${supportedVersion}.`
4625
4742
  sender: message.sender,
4626
4743
  recipient: message.recipient,
4627
4744
  nonce: message.nonce,
4628
- amount: bn16(message.amount),
4745
+ amount: bn18(message.amount),
4629
4746
  data: message.data
4630
4747
  }),
4631
4748
  sender: Address2.fromAddressOrString(message.sender),
4632
4749
  recipient: Address2.fromAddressOrString(message.recipient),
4633
4750
  nonce: message.nonce,
4634
- amount: bn16(message.amount),
4751
+ amount: bn18(message.amount),
4635
4752
  data: InputMessageCoder.decodeData(message.data),
4636
- daHeight: bn16(message.daHeight)
4753
+ daHeight: bn18(message.daHeight)
4637
4754
  }));
4638
4755
  }
4639
4756
  /**
@@ -4686,59 +4803,59 @@ Supported fuel-core version: ${supportedVersion}.`
4686
4803
  } = result.messageProof;
4687
4804
  return {
4688
4805
  messageProof: {
4689
- proofIndex: bn16(messageProof.proofIndex),
4806
+ proofIndex: bn18(messageProof.proofIndex),
4690
4807
  proofSet: messageProof.proofSet
4691
4808
  },
4692
4809
  blockProof: {
4693
- proofIndex: bn16(blockProof.proofIndex),
4810
+ proofIndex: bn18(blockProof.proofIndex),
4694
4811
  proofSet: blockProof.proofSet
4695
4812
  },
4696
4813
  messageBlockHeader: {
4697
4814
  id: messageBlockHeader.id,
4698
- daHeight: bn16(messageBlockHeader.daHeight),
4699
- transactionsCount: bn16(messageBlockHeader.transactionsCount),
4815
+ daHeight: bn18(messageBlockHeader.daHeight),
4816
+ transactionsCount: Number(messageBlockHeader.transactionsCount),
4700
4817
  transactionsRoot: messageBlockHeader.transactionsRoot,
4701
- height: bn16(messageBlockHeader.height),
4818
+ height: bn18(messageBlockHeader.height),
4702
4819
  prevRoot: messageBlockHeader.prevRoot,
4703
4820
  time: messageBlockHeader.time,
4704
4821
  applicationHash: messageBlockHeader.applicationHash,
4705
- messageReceiptCount: bn16(messageBlockHeader.messageReceiptCount),
4822
+ messageReceiptCount: Number(messageBlockHeader.messageReceiptCount),
4706
4823
  messageOutboxRoot: messageBlockHeader.messageOutboxRoot,
4707
- consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
4824
+ consensusParametersVersion: Number(messageBlockHeader.consensusParametersVersion),
4708
4825
  eventInboxRoot: messageBlockHeader.eventInboxRoot,
4709
- stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
4826
+ stateTransitionBytecodeVersion: Number(messageBlockHeader.stateTransitionBytecodeVersion)
4710
4827
  },
4711
4828
  commitBlockHeader: {
4712
4829
  id: commitBlockHeader.id,
4713
- daHeight: bn16(commitBlockHeader.daHeight),
4714
- transactionsCount: bn16(commitBlockHeader.transactionsCount),
4830
+ daHeight: bn18(commitBlockHeader.daHeight),
4831
+ transactionsCount: Number(commitBlockHeader.transactionsCount),
4715
4832
  transactionsRoot: commitBlockHeader.transactionsRoot,
4716
- height: bn16(commitBlockHeader.height),
4833
+ height: bn18(commitBlockHeader.height),
4717
4834
  prevRoot: commitBlockHeader.prevRoot,
4718
4835
  time: commitBlockHeader.time,
4719
4836
  applicationHash: commitBlockHeader.applicationHash,
4720
- messageReceiptCount: bn16(commitBlockHeader.messageReceiptCount),
4837
+ messageReceiptCount: Number(commitBlockHeader.messageReceiptCount),
4721
4838
  messageOutboxRoot: commitBlockHeader.messageOutboxRoot,
4722
- consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
4839
+ consensusParametersVersion: Number(commitBlockHeader.consensusParametersVersion),
4723
4840
  eventInboxRoot: commitBlockHeader.eventInboxRoot,
4724
- stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
4841
+ stateTransitionBytecodeVersion: Number(commitBlockHeader.stateTransitionBytecodeVersion)
4725
4842
  },
4726
4843
  sender: Address2.fromAddressOrString(sender),
4727
4844
  recipient: Address2.fromAddressOrString(recipient),
4728
4845
  nonce,
4729
- amount: bn16(amount),
4846
+ amount: bn18(amount),
4730
4847
  data
4731
4848
  };
4732
4849
  }
4733
4850
  async getLatestGasPrice() {
4734
4851
  const { latestGasPrice } = await this.operations.getLatestGasPrice();
4735
- return bn16(latestGasPrice.gasPrice);
4852
+ return bn18(latestGasPrice.gasPrice);
4736
4853
  }
4737
4854
  async estimateGasPrice(blockHorizon) {
4738
4855
  const { estimateGasPrice } = await this.operations.estimateGasPrice({
4739
4856
  blockHorizon: String(blockHorizon)
4740
4857
  });
4741
- return bn16(estimateGasPrice.gasPrice);
4858
+ return bn18(estimateGasPrice.gasPrice);
4742
4859
  }
4743
4860
  /**
4744
4861
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
@@ -4759,10 +4876,10 @@ Supported fuel-core version: ${supportedVersion}.`
4759
4876
  */
4760
4877
  async produceBlocks(amount, startTime) {
4761
4878
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4762
- blocksToProduce: bn16(amount).toString(10),
4879
+ blocksToProduce: bn18(amount).toString(10),
4763
4880
  startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4764
4881
  });
4765
- return bn16(latestBlockHeight);
4882
+ return bn18(latestBlockHeight);
4766
4883
  }
4767
4884
  // eslint-disable-next-line @typescript-eslint/require-await
4768
4885
  async getTransactionResponse(transactionId) {
@@ -4781,6 +4898,15 @@ Supported fuel-core version: ${supportedVersion}.`
4781
4898
  }
4782
4899
  return message;
4783
4900
  }
4901
+ async getRelayedTransactionStatus(relayedTransactionId) {
4902
+ const { relayedTransactionStatus } = await this.operations.getRelayedTransactionStatus({
4903
+ relayedTransactionId
4904
+ });
4905
+ if (!relayedTransactionStatus) {
4906
+ return null;
4907
+ }
4908
+ return relayedTransactionStatus;
4909
+ }
4784
4910
  };
4785
4911
  var Provider = _Provider;
4786
4912
  _cacheInputs = new WeakSet();
@@ -4799,7 +4925,7 @@ __publicField(Provider, "nodeInfoCache", {});
4799
4925
 
4800
4926
  // src/providers/transaction-summary/get-transaction-summary.ts
4801
4927
  import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
4802
- import { bn as bn17 } from "@fuel-ts/math";
4928
+ import { bn as bn19 } from "@fuel-ts/math";
4803
4929
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4804
4930
  import { arrayify as arrayify12 } from "@fuel-ts/utils";
4805
4931
  async function getTransactionSummary(params) {
@@ -4823,7 +4949,11 @@ async function getTransactionSummary(params) {
4823
4949
  }
4824
4950
  const receipts = txReceipts.map(processGqlReceipt);
4825
4951
  const {
4826
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
4952
+ consensusParameters: {
4953
+ feeParameters: { gasPerByte, gasPriceFactor },
4954
+ txParameters: { maxInputs, maxGasPerTx },
4955
+ gasCosts
4956
+ }
4827
4957
  } = provider.getChain();
4828
4958
  const gasPrice = await provider.getLatestGasPrice();
4829
4959
  const transactionInfo = assembleTransactionSummary({
@@ -4832,8 +4962,8 @@ async function getTransactionSummary(params) {
4832
4962
  transaction: decodedTransaction,
4833
4963
  transactionBytes: arrayify12(gqlTransaction.rawPayload),
4834
4964
  gqlTransactionStatus: gqlTransaction.status,
4835
- gasPerByte: bn17(gasPerByte),
4836
- gasPriceFactor: bn17(gasPriceFactor),
4965
+ gasPerByte: bn19(gasPerByte),
4966
+ gasPriceFactor: bn19(gasPriceFactor),
4837
4967
  abiMap,
4838
4968
  maxInputs,
4839
4969
  gasCosts,
@@ -4849,7 +4979,7 @@ async function getTransactionSummaryFromRequest(params) {
4849
4979
  const { provider, transactionRequest, abiMap } = params;
4850
4980
  const { receipts } = await provider.call(transactionRequest);
4851
4981
  const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
4852
- const maxInputs = provider.getChain().consensusParameters.maxInputs;
4982
+ const maxInputs = provider.getChain().consensusParameters.txParameters.maxInputs;
4853
4983
  const transaction = transactionRequest.toTransaction();
4854
4984
  const transactionBytes = transactionRequest.toTransactionBytes();
4855
4985
  const gasPrice = await provider.getLatestGasPrice();
@@ -4872,7 +5002,11 @@ async function getTransactionsSummaries(params) {
4872
5002
  const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
4873
5003
  const { edges, pageInfo } = transactionsByOwner;
4874
5004
  const {
4875
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
5005
+ consensusParameters: {
5006
+ feeParameters: { gasPerByte, gasPriceFactor },
5007
+ txParameters: { maxInputs, maxGasPerTx },
5008
+ gasCosts
5009
+ }
4876
5010
  } = provider.getChain();
4877
5011
  const gasPrice = await provider.getLatestGasPrice();
4878
5012
  const transactions = edges.map((edge) => {
@@ -5031,22 +5165,6 @@ var assets = [
5031
5165
  }
5032
5166
  ];
5033
5167
 
5034
- // src/providers/transaction-request/helpers.ts
5035
- import { bn as bn18 } from "@fuel-ts/math";
5036
- import { InputType as InputType8 } from "@fuel-ts/transactions";
5037
- var isRequestInputCoin = (input) => input.type === InputType8.Coin;
5038
- var isRequestInputMessage = (input) => input.type === InputType8.Message;
5039
- var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
5040
- var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
5041
- if (isRequestInputCoin(input) && input.assetId === assetId) {
5042
- return acc.add(input.amount);
5043
- }
5044
- if (isRequestInputMessage(input) && assetId === baseAsset) {
5045
- return acc.add(input.amount);
5046
- }
5047
- return acc;
5048
- }, bn18(0));
5049
-
5050
5168
  // src/utils/formatTransferToContractScriptData.ts
5051
5169
  import { BigNumberCoder as BigNumberCoder2 } from "@fuel-ts/abi-coder";
5052
5170
  import { BN as BN2 } from "@fuel-ts/math";
@@ -5249,10 +5367,10 @@ var Account = class extends AbstractAccount {
5249
5367
  async fund(request, params) {
5250
5368
  const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
5251
5369
  const baseAssetId = this.provider.getBaseAssetId();
5252
- const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || bn19(0);
5370
+ const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || bn20(0);
5253
5371
  const txRequest = request;
5254
5372
  const requiredQuantitiesWithFee = addAmountToCoinQuantities({
5255
- amount: bn19(fee),
5373
+ amount: bn20(fee),
5256
5374
  assetId: baseAssetId,
5257
5375
  coinQuantities: requiredQuantities
5258
5376
  });
@@ -5260,7 +5378,7 @@ var Account = class extends AbstractAccount {
5260
5378
  requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
5261
5379
  quantitiesDict[assetId] = {
5262
5380
  required: amount,
5263
- owned: bn19(0)
5381
+ owned: bn20(0)
5264
5382
  };
5265
5383
  });
5266
5384
  request.inputs.filter(isRequestInputResource).forEach((input) => {
@@ -5284,7 +5402,7 @@ var Account = class extends AbstractAccount {
5284
5402
  while (needsToBeFunded && fundingAttempts < MAX_FUNDING_ATTEMPTS) {
5285
5403
  const resources = await this.getResourcesToSpend(
5286
5404
  missingQuantities,
5287
- cacheTxInputsFromOwner(request.inputs, this.address)
5405
+ cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
5288
5406
  );
5289
5407
  request.addResources(resources);
5290
5408
  txRequest.shiftPredicateData();
@@ -5365,7 +5483,7 @@ var Account = class extends AbstractAccount {
5365
5483
  * @returns A promise that resolves to the transaction response.
5366
5484
  */
5367
5485
  async transfer(destination, amount, assetId, txParams = {}) {
5368
- if (bn19(amount).lte(0)) {
5486
+ if (bn20(amount).lte(0)) {
5369
5487
  throw new FuelError15(
5370
5488
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5371
5489
  "Transfer amount must be a positive number."
@@ -5385,7 +5503,7 @@ var Account = class extends AbstractAccount {
5385
5503
  * @returns A promise that resolves to the transaction response.
5386
5504
  */
5387
5505
  async transferToContract(contractId, amount, assetId, txParams = {}) {
5388
- if (bn19(amount).lte(0)) {
5506
+ if (bn20(amount).lte(0)) {
5389
5507
  throw new FuelError15(
5390
5508
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5391
5509
  "Transfer amount must be a positive number."
@@ -5395,7 +5513,7 @@ var Account = class extends AbstractAccount {
5395
5513
  const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5396
5514
  const { script, scriptData } = await assembleTransferToContractScript({
5397
5515
  hexlifiedContractId: contractAddress.toB256(),
5398
- amountToTransfer: bn19(amount),
5516
+ amountToTransfer: bn20(amount),
5399
5517
  assetId: assetIdToTransfer
5400
5518
  });
5401
5519
  const request = new ScriptTransactionRequest({
@@ -5406,7 +5524,7 @@ var Account = class extends AbstractAccount {
5406
5524
  request.addContractInputAndOutput(contractAddress);
5407
5525
  const txCost = await this.provider.getTransactionCost(request, {
5408
5526
  resourcesOwner: this,
5409
- quantitiesToContract: [{ amount: bn19(amount), assetId: String(assetIdToTransfer) }]
5527
+ quantitiesToContract: [{ amount: bn20(amount), assetId: String(assetIdToTransfer) }]
5410
5528
  });
5411
5529
  this.validateGasLimitAndMaxFee({
5412
5530
  gasUsed: txCost.gasUsed,
@@ -5432,7 +5550,7 @@ var Account = class extends AbstractAccount {
5432
5550
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5433
5551
  );
5434
5552
  const amountDataArray = arrayify14(
5435
- "0x".concat(bn19(amount).toHex().substring(2).padStart(16, "0"))
5553
+ "0x".concat(bn20(amount).toHex().substring(2).padStart(16, "0"))
5436
5554
  );
5437
5555
  const script = new Uint8Array([
5438
5556
  ...arrayify14(withdrawScript.bytes),
@@ -5442,7 +5560,7 @@ var Account = class extends AbstractAccount {
5442
5560
  const params = { script, ...txParams };
5443
5561
  const baseAssetId = this.provider.getBaseAssetId();
5444
5562
  const request = new ScriptTransactionRequest(params);
5445
- const quantitiesToContract = [{ amount: bn19(amount), assetId: baseAssetId }];
5563
+ const quantitiesToContract = [{ amount: bn20(amount), assetId: baseAssetId }];
5446
5564
  const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
5447
5565
  this.validateGasLimitAndMaxFee({
5448
5566
  gasUsed: txCost.gasUsed,
@@ -5856,7 +5974,7 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5856
5974
  // src/hdwallet/hdwallet.ts
5857
5975
  import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
5858
5976
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
5859
- import { bn as bn20, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5977
+ import { bn as bn21, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5860
5978
  import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
5861
5979
  import { toBeHex, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58, computeHmac as computeHmac2, ripemd160 } from "ethers";
5862
5980
 
@@ -8328,7 +8446,7 @@ var HDWallet = class {
8328
8446
  const IR = bytes.slice(32);
8329
8447
  if (privateKey) {
8330
8448
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
8331
- const ki = bn20(IL).add(privateKey).mod(N).toBytes(32);
8449
+ const ki = bn21(IL).add(privateKey).mod(N).toBytes(32);
8332
8450
  return new HDWallet({
8333
8451
  privateKey: ki,
8334
8452
  chainCode: IR,
@@ -9016,7 +9134,7 @@ import {
9016
9134
  } from "@fuel-ts/abi-coder";
9017
9135
  import { Address as Address9 } from "@fuel-ts/address";
9018
9136
  import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
9019
- import { ByteArrayCoder, InputType as InputType9 } from "@fuel-ts/transactions";
9137
+ import { ByteArrayCoder } from "@fuel-ts/transactions";
9020
9138
  import { arrayify as arrayify20, hexlify as hexlify19 } from "@fuel-ts/utils";
9021
9139
 
9022
9140
  // src/predicate/utils/getPredicateRoot.ts
@@ -9075,10 +9193,15 @@ var Predicate = class extends Account {
9075
9193
  populateTransactionPredicateData(transactionRequestLike) {
9076
9194
  const request = transactionRequestify(transactionRequestLike);
9077
9195
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
9078
- request.inputs?.forEach((input) => {
9079
- if (input.type === InputType9.Coin && hexlify19(input.owner) === this.address.toB256()) {
9196
+ const placeholderIndex = this.getIndexFromPlaceholderWitness(request);
9197
+ if (placeholderIndex !== -1) {
9198
+ request.removeWitness(placeholderIndex);
9199
+ }
9200
+ request.inputs.filter(isRequestInputResource).forEach((input) => {
9201
+ if (isRequestInputResourceFromOwner(input, this.address)) {
9080
9202
  input.predicate = hexlify19(this.bytes);
9081
9203
  input.predicateData = hexlify19(this.getPredicateData(policies.length));
9204
+ input.witnessIndex = 0;
9082
9205
  }
9083
9206
  });
9084
9207
  return request;
@@ -9110,7 +9233,7 @@ var Predicate = class extends Account {
9110
9233
  const mainFn = this.interface?.functions.main;
9111
9234
  const paddedCode = new ByteArrayCoder(this.bytes.length).encode(this.bytes);
9112
9235
  const VM_TX_MEMORY = calculateVmTxMemory2({
9113
- maxInputs: this.provider.getChain().consensusParameters.maxInputs.toNumber()
9236
+ maxInputs: this.provider.getChain().consensusParameters.txParameters.maxInputs.toNumber()
9114
9237
  });
9115
9238
  const OFFSET = VM_TX_MEMORY + SCRIPT_FIXED_SIZE + INPUT_COIN_FIXED_SIZE + WORD_SIZE + paddedCode.byteLength + policiesLength * WORD_SIZE;
9116
9239
  return mainFn?.encodeArguments(this.predicateData, OFFSET) || new Uint8Array();
@@ -9201,6 +9324,28 @@ var Predicate = class extends Account {
9201
9324
  }
9202
9325
  return mutatedBytes;
9203
9326
  }
9327
+ /**
9328
+ * Returns the index of the witness placeholder that was added to this predicate.
9329
+ * If no witness placeholder was added, it returns -1.
9330
+ * @param request - The transaction request.
9331
+ * @returns The index of the witness placeholder, or -1 if there is no witness placeholder.
9332
+ */
9333
+ getIndexFromPlaceholderWitness(request) {
9334
+ const predicateInputs = request.inputs.filter(isRequestInputResource).filter((input) => isRequestInputResourceFromOwner(input, this.address));
9335
+ let index = -1;
9336
+ const hasEmptyPredicateInputs = predicateInputs.find((input) => !input.predicate);
9337
+ if (hasEmptyPredicateInputs) {
9338
+ index = hasEmptyPredicateInputs.witnessIndex;
9339
+ const allInputsAreEmpty = predicateInputs.every((input) => !input.predicate);
9340
+ if (!allInputsAreEmpty) {
9341
+ const wasFilledInputAddedFirst = !!predicateInputs[0]?.predicate;
9342
+ if (wasFilledInputAddedFirst) {
9343
+ index = -1;
9344
+ }
9345
+ }
9346
+ }
9347
+ return index;
9348
+ }
9204
9349
  };
9205
9350
 
9206
9351
  // src/connectors/fuel.ts
@@ -9923,11 +10068,12 @@ export {
9923
10068
  assets,
9924
10069
  buildBlockExplorerUrl,
9925
10070
  cacheFor,
9926
- cacheTxInputsFromOwner,
10071
+ cacheRequestInputsResources,
10072
+ cacheRequestInputsResourcesFromOwner,
9927
10073
  calculateGasFee,
9928
10074
  calculateMetadataGasForTxCreate,
9929
10075
  calculateMetadataGasForTxScript,
9930
- calculateTransactionFee,
10076
+ calculateTXFeeForSummary,
9931
10077
  coinQuantityfy,
9932
10078
  deferPromise,
9933
10079
  dispatchFuelConnectorEvent,
@@ -9936,6 +10082,7 @@ export {
9936
10082
  extractMintedAssetsFromReceipts,
9937
10083
  extractTxError,
9938
10084
  gasUsedByInputs,
10085
+ getAssetAmountInRequestInputs,
9939
10086
  getAssetEth,
9940
10087
  getAssetFuel,
9941
10088
  getAssetNetwork,
@@ -9970,6 +10117,7 @@ export {
9970
10117
  getReceiptsMessageOut,
9971
10118
  getReceiptsTransferOut,
9972
10119
  getReceiptsWithMissingData,
10120
+ getRequestInputResourceOwner,
9973
10121
  getTransactionStatusName,
9974
10122
  getTransactionSummary,
9975
10123
  getTransactionSummaryFromRequest,
@@ -9983,10 +10131,16 @@ export {
9983
10131
  isMessage,
9984
10132
  isRawCoin,
9985
10133
  isRawMessage,
10134
+ isRequestInputCoin,
10135
+ isRequestInputMessage,
10136
+ isRequestInputResource,
10137
+ isRequestInputResourceFromOwner,
9986
10138
  isType,
9987
10139
  isTypeCreate,
9988
10140
  isTypeMint,
9989
10141
  isTypeScript,
10142
+ isTypeUpgrade,
10143
+ isTypeUpload,
9990
10144
  normalizeJSON,
9991
10145
  outputify,
9992
10146
  processGqlReceipt,