@fuel-ts/account 0.0.0-rc-1976-20240424110729 → 0.0.0-rc-2021-20240424121206

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 (56) hide show
  1. package/README.md +1 -1
  2. package/dist/account.d.ts +5 -4
  3. package/dist/account.d.ts.map +1 -1
  4. package/dist/configs.d.ts.map +1 -1
  5. package/dist/configs.global.js +1 -1
  6. package/dist/configs.global.js.map +1 -1
  7. package/dist/configs.js +1 -1
  8. package/dist/configs.js.map +1 -1
  9. package/dist/configs.mjs +1 -1
  10. package/dist/configs.mjs.map +1 -1
  11. package/dist/index.global.js +861 -611
  12. package/dist/index.global.js.map +1 -1
  13. package/dist/index.js +864 -608
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +706 -451
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/predicate/predicate.d.ts +10 -2
  18. package/dist/predicate/predicate.d.ts.map +1 -1
  19. package/dist/providers/__generated__/operations.d.ts +822 -328
  20. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  21. package/dist/providers/coin-quantity.d.ts +3 -3
  22. package/dist/providers/coin-quantity.d.ts.map +1 -1
  23. package/dist/providers/coin.d.ts +4 -2
  24. package/dist/providers/coin.d.ts.map +1 -1
  25. package/dist/providers/message.d.ts +7 -1
  26. package/dist/providers/message.d.ts.map +1 -1
  27. package/dist/providers/provider.d.ts +37 -34
  28. package/dist/providers/provider.d.ts.map +1 -1
  29. package/dist/providers/transaction-request/create-transaction-request.d.ts +1 -1
  30. package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
  31. package/dist/providers/transaction-request/input.d.ts +2 -2
  32. package/dist/providers/transaction-request/input.d.ts.map +1 -1
  33. package/dist/providers/transaction-request/script-transaction-request.d.ts +1 -1
  34. package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
  35. package/dist/providers/transaction-request/transaction-request.d.ts +8 -32
  36. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  37. package/dist/providers/transaction-request/utils.d.ts +3 -0
  38. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  39. package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
  40. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +2 -0
  41. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
  42. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +3 -2
  43. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +1 -1
  44. package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
  45. package/dist/providers/utils/gas.d.ts +8 -2
  46. package/dist/providers/utils/gas.d.ts.map +1 -1
  47. package/dist/test-utils/launchNode.d.ts.map +1 -1
  48. package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
  49. package/dist/test-utils.global.js +1578 -1114
  50. package/dist/test-utils.global.js.map +1 -1
  51. package/dist/test-utils.js +845 -609
  52. package/dist/test-utils.js.map +1 -1
  53. package/dist/test-utils.mjs +699 -463
  54. package/dist/test-utils.mjs.map +1 -1
  55. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  56. package/package.json +16 -16
package/dist/index.mjs CHANGED
@@ -29,35 +29,38 @@ var __privateMethod = (obj, member, method) => {
29
29
 
30
30
  // src/account.ts
31
31
  import { Address as Address3 } from "@fuel-ts/address";
32
+ import { BaseAssetId as BaseAssetId3 } from "@fuel-ts/address/configs";
32
33
  import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
33
34
  import { AbstractAccount } from "@fuel-ts/interfaces";
34
- import { bn as bn17 } from "@fuel-ts/math";
35
+ import { bn as bn18 } from "@fuel-ts/math";
35
36
  import { arrayify as arrayify14 } from "@fuel-ts/utils";
37
+ import { clone as clone4 } from "ramda";
36
38
 
37
39
  // src/providers/coin-quantity.ts
40
+ import { BaseAssetId } from "@fuel-ts/address/configs";
38
41
  import { bn } from "@fuel-ts/math";
39
42
  import { hexlify } from "@fuel-ts/utils";
40
43
  var coinQuantityfy = (coinQuantityLike) => {
41
44
  let assetId;
42
45
  let amount;
43
- let max2;
46
+ let max;
44
47
  if (Array.isArray(coinQuantityLike)) {
45
48
  amount = coinQuantityLike[0];
46
- assetId = coinQuantityLike[1];
47
- max2 = coinQuantityLike[2];
49
+ assetId = coinQuantityLike[1] ?? BaseAssetId;
50
+ max = coinQuantityLike[2] ?? void 0;
48
51
  } else {
49
52
  amount = coinQuantityLike.amount;
50
- assetId = coinQuantityLike.assetId;
51
- max2 = coinQuantityLike.max ?? void 0;
53
+ assetId = coinQuantityLike.assetId ?? BaseAssetId;
54
+ max = coinQuantityLike.max ?? void 0;
52
55
  }
53
56
  const bnAmount = bn(amount);
54
57
  return {
55
58
  assetId: hexlify(assetId),
56
59
  amount: bnAmount.lt(1) ? bn(1) : bnAmount,
57
- max: max2 ? bn(max2) : void 0
60
+ max: max ? bn(max) : void 0
58
61
  };
59
62
  };
60
- var addAmountToAsset = (params) => {
63
+ var addAmountToCoinQuantities = (params) => {
61
64
  const { amount, assetId } = params;
62
65
  const coinQuantities = [...params.coinQuantities];
63
66
  const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
@@ -72,9 +75,9 @@ var addAmountToAsset = (params) => {
72
75
  // src/providers/provider.ts
73
76
  import { Address as Address2 } from "@fuel-ts/address";
74
77
  import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
75
- import { BN, bn as bn15, max } from "@fuel-ts/math";
78
+ import { BN, bn as bn16 } from "@fuel-ts/math";
76
79
  import {
77
- InputType as InputType6,
80
+ InputType as InputType7,
78
81
  TransactionType as TransactionType8,
79
82
  InputMessageCoder,
80
83
  TransactionCoder as TransactionCoder5
@@ -88,16 +91,40 @@ import { clone as clone3 } from "ramda";
88
91
 
89
92
  // src/providers/__generated__/operations.ts
90
93
  import gql from "graphql-tag";
94
+ var TransactionStatusSubscriptionFragmentFragmentDoc = gql`
95
+ fragment transactionStatusSubscriptionFragment on TransactionStatus {
96
+ type: __typename
97
+ ... on SubmittedStatus {
98
+ time
99
+ }
100
+ ... on SuccessStatus {
101
+ block {
102
+ id
103
+ }
104
+ time
105
+ programState {
106
+ returnType
107
+ data
108
+ }
109
+ }
110
+ ... on FailureStatus {
111
+ block {
112
+ id
113
+ }
114
+ time
115
+ reason
116
+ }
117
+ ... on SqueezedOutStatus {
118
+ reason
119
+ }
120
+ }
121
+ `;
91
122
  var ReceiptFragmentFragmentDoc = gql`
92
123
  fragment receiptFragment on Receipt {
93
- contract {
94
- id
95
- }
124
+ id
96
125
  pc
97
126
  is
98
- to {
99
- id
100
- }
127
+ to
101
128
  toAddress
102
129
  amount
103
130
  assetId
@@ -135,10 +162,16 @@ var TransactionStatusFragmentFragmentDoc = gql`
135
162
  id
136
163
  }
137
164
  time
165
+ receipts {
166
+ ...receiptFragment
167
+ }
138
168
  programState {
139
169
  returnType
140
170
  data
141
171
  }
172
+ receipts {
173
+ ...receiptFragment
174
+ }
142
175
  }
143
176
  ... on FailureStatus {
144
177
  block {
@@ -146,26 +179,24 @@ var TransactionStatusFragmentFragmentDoc = gql`
146
179
  }
147
180
  time
148
181
  reason
182
+ receipts {
183
+ ...receiptFragment
184
+ }
149
185
  }
150
186
  ... on SqueezedOutStatus {
151
187
  reason
152
188
  }
153
189
  }
154
- `;
190
+ ${ReceiptFragmentFragmentDoc}`;
155
191
  var TransactionFragmentFragmentDoc = gql`
156
192
  fragment transactionFragment on Transaction {
157
193
  id
158
194
  rawPayload
159
- gasPrice
160
- receipts {
161
- ...receiptFragment
162
- }
163
195
  status {
164
196
  ...transactionStatusFragment
165
197
  }
166
198
  }
167
- ${ReceiptFragmentFragmentDoc}
168
- ${TransactionStatusFragmentFragmentDoc}`;
199
+ ${TransactionStatusFragmentFragmentDoc}`;
169
200
  var InputEstimatePredicatesFragmentFragmentDoc = gql`
170
201
  fragment inputEstimatePredicatesFragment on Input {
171
202
  ... on InputCoin {
@@ -183,6 +214,46 @@ var TransactionEstimatePredicatesFragmentFragmentDoc = gql`
183
214
  }
184
215
  }
185
216
  ${InputEstimatePredicatesFragmentFragmentDoc}`;
217
+ var DryRunFailureStatusFragmentFragmentDoc = gql`
218
+ fragment dryRunFailureStatusFragment on DryRunFailureStatus {
219
+ reason
220
+ programState {
221
+ returnType
222
+ data
223
+ }
224
+ }
225
+ `;
226
+ var DryRunSuccessStatusFragmentFragmentDoc = gql`
227
+ fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
228
+ programState {
229
+ returnType
230
+ data
231
+ }
232
+ }
233
+ `;
234
+ var DryRunTransactionStatusFragmentFragmentDoc = gql`
235
+ fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
236
+ ... on DryRunFailureStatus {
237
+ ...dryRunFailureStatusFragment
238
+ }
239
+ ... on DryRunSuccessStatus {
240
+ ...dryRunSuccessStatusFragment
241
+ }
242
+ }
243
+ ${DryRunFailureStatusFragmentFragmentDoc}
244
+ ${DryRunSuccessStatusFragmentFragmentDoc}`;
245
+ var DryRunTransactionExecutionStatusFragmentFragmentDoc = gql`
246
+ fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
247
+ id
248
+ status {
249
+ ...dryRunTransactionStatusFragment
250
+ }
251
+ receipts {
252
+ ...receiptFragment
253
+ }
254
+ }
255
+ ${DryRunTransactionStatusFragmentFragmentDoc}
256
+ ${ReceiptFragmentFragmentDoc}`;
186
257
  var CoinFragmentFragmentDoc = gql`
187
258
  fragment coinFragment on Coin {
188
259
  __typename
@@ -190,7 +261,6 @@ var CoinFragmentFragmentDoc = gql`
190
261
  owner
191
262
  amount
192
263
  assetId
193
- maturity
194
264
  blockCreated
195
265
  txCreatedIdx
196
266
  }
@@ -229,26 +299,32 @@ var MessageProofFragmentFragmentDoc = gql`
229
299
  messageBlockHeader {
230
300
  id
231
301
  daHeight
302
+ consensusParametersVersion
303
+ stateTransitionBytecodeVersion
232
304
  transactionsCount
305
+ messageReceiptCount
233
306
  transactionsRoot
307
+ messageOutboxRoot
308
+ eventInboxRoot
234
309
  height
235
310
  prevRoot
236
311
  time
237
312
  applicationHash
238
- messageReceiptRoot
239
- messageReceiptCount
240
313
  }
241
314
  commitBlockHeader {
242
315
  id
243
316
  daHeight
317
+ consensusParametersVersion
318
+ stateTransitionBytecodeVersion
244
319
  transactionsCount
320
+ messageReceiptCount
245
321
  transactionsRoot
322
+ messageOutboxRoot
323
+ eventInboxRoot
246
324
  height
247
325
  prevRoot
248
326
  time
249
327
  applicationHash
250
- messageReceiptRoot
251
- messageReceiptCount
252
328
  }
253
329
  sender
254
330
  recipient
@@ -267,8 +343,8 @@ var BalanceFragmentFragmentDoc = gql`
267
343
  var BlockFragmentFragmentDoc = gql`
268
344
  fragment blockFragment on Block {
269
345
  id
346
+ height
270
347
  header {
271
- height
272
348
  time
273
349
  }
274
350
  transactions {
@@ -326,6 +402,11 @@ var DependentCostFragmentFragmentDoc = gql`
326
402
  `;
327
403
  var GasCostsFragmentFragmentDoc = gql`
328
404
  fragment GasCostsFragment on GasCosts {
405
+ version {
406
+ ... on Version {
407
+ value
408
+ }
409
+ }
329
410
  add
330
411
  addi
331
412
  aloc
@@ -338,7 +419,6 @@ var GasCostsFragmentFragmentDoc = gql`
338
419
  cb
339
420
  cfei
340
421
  cfsi
341
- croo
342
422
  div
343
423
  divi
344
424
  ecr1
@@ -421,6 +501,9 @@ var GasCostsFragmentFragmentDoc = gql`
421
501
  ccp {
422
502
  ...DependentCostFragment
423
503
  }
504
+ croo {
505
+ ...DependentCostFragment
506
+ }
424
507
  csiz {
425
508
  ...DependentCostFragment
426
509
  }
@@ -480,6 +563,11 @@ var GasCostsFragmentFragmentDoc = gql`
480
563
  ${DependentCostFragmentFragmentDoc}`;
481
564
  var ConsensusParametersFragmentFragmentDoc = gql`
482
565
  fragment consensusParametersFragment on ConsensusParameters {
566
+ version {
567
+ ... on Version {
568
+ value
569
+ }
570
+ }
483
571
  txParams {
484
572
  ...TxParametersFragment
485
573
  }
@@ -539,18 +627,9 @@ var NodeInfoFragmentFragmentDoc = gql`
539
627
  fragment nodeInfoFragment on NodeInfo {
540
628
  utxoValidation
541
629
  vmBacktrace
542
- minGasPrice
543
630
  maxTx
544
631
  maxDepth
545
632
  nodeVersion
546
- peers {
547
- id
548
- addresses
549
- clientVersion
550
- blockHeight
551
- lastHeartbeatMs
552
- appScore
553
- }
554
633
  }
555
634
  `;
556
635
  var GetVersionDocument = gql`
@@ -585,13 +664,9 @@ var GetTransactionWithReceiptsDocument = gql`
585
664
  query getTransactionWithReceipts($transactionId: TransactionId!) {
586
665
  transaction(id: $transactionId) {
587
666
  ...transactionFragment
588
- receipts {
589
- ...receiptFragment
590
- }
591
667
  }
592
668
  }
593
- ${TransactionFragmentFragmentDoc}
594
- ${ReceiptFragmentFragmentDoc}`;
669
+ ${TransactionFragmentFragmentDoc}`;
595
670
  var GetTransactionsDocument = gql`
596
671
  query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
597
672
  transactions(after: $after, before: $before, first: $first, last: $last) {
@@ -719,6 +794,20 @@ var GetBalanceDocument = gql`
719
794
  }
720
795
  }
721
796
  ${BalanceFragmentFragmentDoc}`;
797
+ var GetLatestGasPriceDocument = gql`
798
+ query getLatestGasPrice {
799
+ latestGasPrice {
800
+ gasPrice
801
+ }
802
+ }
803
+ `;
804
+ var EstimateGasPriceDocument = gql`
805
+ query estimateGasPrice($blockHorizon: U32!) {
806
+ estimateGasPrice(blockHorizon: $blockHorizon) {
807
+ gasPrice
808
+ }
809
+ }
810
+ `;
722
811
  var GetBalancesDocument = gql`
723
812
  query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
724
813
  balances(
@@ -773,12 +862,12 @@ var GetMessageStatusDocument = gql`
773
862
  }
774
863
  `;
775
864
  var DryRunDocument = gql`
776
- mutation dryRun($encodedTransaction: HexString!, $utxoValidation: Boolean) {
777
- dryRun(tx: $encodedTransaction, utxoValidation: $utxoValidation) {
778
- ...receiptFragment
865
+ mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
866
+ dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
867
+ ...dryRunTransactionExecutionStatusFragment
779
868
  }
780
869
  }
781
- ${ReceiptFragmentFragmentDoc}`;
870
+ ${DryRunTransactionExecutionStatusFragmentFragmentDoc}`;
782
871
  var SubmitDocument = gql`
783
872
  mutation submit($encodedTransaction: HexString!) {
784
873
  submit(tx: $encodedTransaction) {
@@ -797,17 +886,17 @@ var ProduceBlocksDocument = gql`
797
886
  var SubmitAndAwaitDocument = gql`
798
887
  subscription submitAndAwait($encodedTransaction: HexString!) {
799
888
  submitAndAwait(tx: $encodedTransaction) {
800
- ...transactionStatusFragment
889
+ ...transactionStatusSubscriptionFragment
801
890
  }
802
891
  }
803
- ${TransactionStatusFragmentFragmentDoc}`;
892
+ ${TransactionStatusSubscriptionFragmentFragmentDoc}`;
804
893
  var StatusChangeDocument = gql`
805
894
  subscription statusChange($transactionId: TransactionId!) {
806
895
  statusChange(id: $transactionId) {
807
- ...transactionStatusFragment
896
+ ...transactionStatusSubscriptionFragment
808
897
  }
809
898
  }
810
- ${TransactionStatusFragmentFragmentDoc}`;
899
+ ${TransactionStatusSubscriptionFragmentFragmentDoc}`;
811
900
  function getSdk(requester) {
812
901
  return {
813
902
  getVersion(variables, options) {
@@ -861,6 +950,12 @@ function getSdk(requester) {
861
950
  getBalance(variables, options) {
862
951
  return requester(GetBalanceDocument, variables, options);
863
952
  },
953
+ getLatestGasPrice(variables, options) {
954
+ return requester(GetLatestGasPriceDocument, variables, options);
955
+ },
956
+ estimateGasPrice(variables, options) {
957
+ return requester(EstimateGasPriceDocument, variables, options);
958
+ },
864
959
  getBalances(variables, options) {
865
960
  return requester(GetBalancesDocument, variables, options);
866
961
  },
@@ -1054,10 +1149,9 @@ var inputify = (value) => {
1054
1149
  txIndex: toNumber(arrayify(value.txPointer).slice(8, 16))
1055
1150
  },
1056
1151
  witnessIndex: value.witnessIndex,
1057
- maturity: value.maturity ?? 0,
1058
1152
  predicateGasUsed: bn2(value.predicateGasUsed),
1059
- predicateLength: predicate.length,
1060
- predicateDataLength: predicateData.length,
1153
+ predicateLength: bn2(predicate.length),
1154
+ predicateDataLength: bn2(predicateData.length),
1061
1155
  predicate: hexlify3(predicate),
1062
1156
  predicateData: hexlify3(predicateData)
1063
1157
  };
@@ -1088,8 +1182,8 @@ var inputify = (value) => {
1088
1182
  nonce: hexlify3(value.nonce),
1089
1183
  witnessIndex: value.witnessIndex,
1090
1184
  predicateGasUsed: bn2(value.predicateGasUsed),
1091
- predicateLength: predicate.length,
1092
- predicateDataLength: predicateData.length,
1185
+ predicateLength: bn2(predicate.length),
1186
+ predicateDataLength: bn2(predicateData.length),
1093
1187
  predicate: hexlify3(predicate),
1094
1188
  predicateData: hexlify3(predicateData),
1095
1189
  data: hexlify3(data),
@@ -1165,7 +1259,7 @@ var outputify = (value) => {
1165
1259
  // src/providers/transaction-request/transaction-request.ts
1166
1260
  import { UTXO_ID_LEN as UTXO_ID_LEN2 } from "@fuel-ts/abi-coder";
1167
1261
  import { Address, addressify } from "@fuel-ts/address";
1168
- import { ZeroBytes32 as ZeroBytes324 } from "@fuel-ts/address/configs";
1262
+ import { BaseAssetId as BaseAssetId2, ZeroBytes32 as ZeroBytes324 } from "@fuel-ts/address/configs";
1169
1263
  import { randomBytes } from "@fuel-ts/crypto";
1170
1264
  import { bn as bn7 } from "@fuel-ts/math";
1171
1265
  import {
@@ -1219,8 +1313,8 @@ function assembleReceiptByType(receipt) {
1219
1313
  case "CALL" /* Call */: {
1220
1314
  const callReceipt = {
1221
1315
  type: ReceiptType.Call,
1222
- from: hexOrZero(receipt.contract?.id),
1223
- to: hexOrZero(receipt?.to?.id),
1316
+ from: hexOrZero(receipt.id || receipt.contractId),
1317
+ to: hexOrZero(receipt?.to),
1224
1318
  amount: bn4(receipt.amount),
1225
1319
  assetId: hexOrZero(receipt.assetId),
1226
1320
  gas: bn4(receipt.gas),
@@ -1234,7 +1328,7 @@ function assembleReceiptByType(receipt) {
1234
1328
  case "RETURN" /* Return */: {
1235
1329
  const returnReceipt = {
1236
1330
  type: ReceiptType.Return,
1237
- id: hexOrZero(receipt.contract?.id),
1331
+ id: hexOrZero(receipt.id || receipt.contractId),
1238
1332
  val: bn4(receipt.val),
1239
1333
  pc: bn4(receipt.pc),
1240
1334
  is: bn4(receipt.is)
@@ -1244,7 +1338,7 @@ function assembleReceiptByType(receipt) {
1244
1338
  case "RETURN_DATA" /* ReturnData */: {
1245
1339
  const returnDataReceipt = {
1246
1340
  type: ReceiptType.ReturnData,
1247
- id: hexOrZero(receipt.contract?.id),
1341
+ id: hexOrZero(receipt.id || receipt.contractId),
1248
1342
  ptr: bn4(receipt.ptr),
1249
1343
  len: bn4(receipt.len),
1250
1344
  digest: hexOrZero(receipt.digest),
@@ -1256,7 +1350,7 @@ function assembleReceiptByType(receipt) {
1256
1350
  case "PANIC" /* Panic */: {
1257
1351
  const panicReceipt = {
1258
1352
  type: ReceiptType.Panic,
1259
- id: hexOrZero(receipt.contract?.id),
1353
+ id: hexOrZero(receipt.id),
1260
1354
  reason: bn4(receipt.reason),
1261
1355
  pc: bn4(receipt.pc),
1262
1356
  is: bn4(receipt.is),
@@ -1267,7 +1361,7 @@ function assembleReceiptByType(receipt) {
1267
1361
  case "REVERT" /* Revert */: {
1268
1362
  const revertReceipt = {
1269
1363
  type: ReceiptType.Revert,
1270
- id: hexOrZero(receipt.contract?.id),
1364
+ id: hexOrZero(receipt.id || receipt.contractId),
1271
1365
  val: bn4(receipt.ra),
1272
1366
  pc: bn4(receipt.pc),
1273
1367
  is: bn4(receipt.is)
@@ -1277,7 +1371,7 @@ function assembleReceiptByType(receipt) {
1277
1371
  case "LOG" /* Log */: {
1278
1372
  const logReceipt = {
1279
1373
  type: ReceiptType.Log,
1280
- id: hexOrZero(receipt.contract?.id),
1374
+ id: hexOrZero(receipt.id || receipt.contractId),
1281
1375
  val0: bn4(receipt.ra),
1282
1376
  val1: bn4(receipt.rb),
1283
1377
  val2: bn4(receipt.rc),
@@ -1290,7 +1384,7 @@ function assembleReceiptByType(receipt) {
1290
1384
  case "LOG_DATA" /* LogData */: {
1291
1385
  const logDataReceipt = {
1292
1386
  type: ReceiptType.LogData,
1293
- id: hexOrZero(receipt.contract?.id),
1387
+ id: hexOrZero(receipt.id || receipt.contractId),
1294
1388
  val0: bn4(receipt.ra),
1295
1389
  val1: bn4(receipt.rb),
1296
1390
  ptr: bn4(receipt.ptr),
@@ -1304,8 +1398,8 @@ function assembleReceiptByType(receipt) {
1304
1398
  case "TRANSFER" /* Transfer */: {
1305
1399
  const transferReceipt = {
1306
1400
  type: ReceiptType.Transfer,
1307
- from: hexOrZero(receipt.contract?.id),
1308
- to: hexOrZero(receipt.toAddress || receipt?.to?.id),
1401
+ from: hexOrZero(receipt.id || receipt.contractId),
1402
+ to: hexOrZero(receipt.toAddress || receipt?.to),
1309
1403
  amount: bn4(receipt.amount),
1310
1404
  assetId: hexOrZero(receipt.assetId),
1311
1405
  pc: bn4(receipt.pc),
@@ -1316,8 +1410,8 @@ function assembleReceiptByType(receipt) {
1316
1410
  case "TRANSFER_OUT" /* TransferOut */: {
1317
1411
  const transferOutReceipt = {
1318
1412
  type: ReceiptType.TransferOut,
1319
- from: hexOrZero(receipt.contract?.id),
1320
- to: hexOrZero(receipt.toAddress || receipt.to?.id),
1413
+ from: hexOrZero(receipt.id || receipt.contractId),
1414
+ to: hexOrZero(receipt.toAddress || receipt.to),
1321
1415
  amount: bn4(receipt.amount),
1322
1416
  assetId: hexOrZero(receipt.assetId),
1323
1417
  pc: bn4(receipt.pc),
@@ -1360,7 +1454,7 @@ function assembleReceiptByType(receipt) {
1360
1454
  return receiptMessageOut;
1361
1455
  }
1362
1456
  case "MINT" /* Mint */: {
1363
- const contractId = hexOrZero(receipt.contract?.id);
1457
+ const contractId = hexOrZero(receipt.id || receipt.contractId);
1364
1458
  const subId = hexOrZero(receipt.subId);
1365
1459
  const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
1366
1460
  const mintReceipt = {
@@ -1375,7 +1469,7 @@ function assembleReceiptByType(receipt) {
1375
1469
  return mintReceipt;
1376
1470
  }
1377
1471
  case "BURN" /* Burn */: {
1378
- const contractId = hexOrZero(receipt.contract?.id);
1472
+ const contractId = hexOrZero(receipt.id || receipt.contractId);
1379
1473
  const subId = hexOrZero(receipt.subId);
1380
1474
  const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
1381
1475
  const burnReceipt = {
@@ -1460,7 +1554,6 @@ var buildBlockExplorerUrl = (options = {}) => {
1460
1554
  import { bn as bn5 } from "@fuel-ts/math";
1461
1555
  import { ReceiptType as ReceiptType2 } from "@fuel-ts/transactions";
1462
1556
  import { arrayify as arrayify3 } from "@fuel-ts/utils";
1463
- var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn5(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
1464
1557
  var getGasUsedFromReceipts = (receipts) => {
1465
1558
  const scriptResult = receipts.filter(
1466
1559
  (receipt) => receipt.type === ReceiptType2.ScriptResult
@@ -1481,18 +1574,28 @@ function resolveGasDependentCosts(byteSize, gasDependentCost) {
1481
1574
  }
1482
1575
  function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
1483
1576
  const witnessCache = [];
1484
- const totalGas = inputs.reduce((total, input) => {
1577
+ const chargeableInputs = inputs.filter((input) => {
1578
+ const isCoinOrMessage = "owner" in input || "sender" in input;
1579
+ if (isCoinOrMessage) {
1580
+ if ("predicate" in input && input.predicate && input.predicate !== "0x") {
1581
+ return true;
1582
+ }
1583
+ if (!witnessCache.includes(input.witnessIndex)) {
1584
+ witnessCache.push(input.witnessIndex);
1585
+ return true;
1586
+ }
1587
+ }
1588
+ return false;
1589
+ });
1590
+ const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
1591
+ const totalGas = chargeableInputs.reduce((total, input) => {
1485
1592
  if ("predicate" in input && input.predicate && input.predicate !== "0x") {
1486
1593
  return total.add(
1487
- resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts(arrayify3(input.predicate).length, gasCosts.contractRoot)).add(bn5(input.predicateGasUsed))
1594
+ vmInitializationCost.add(resolveGasDependentCosts(arrayify3(input.predicate).length, gasCosts.contractRoot)).add(bn5(input.predicateGasUsed))
1488
1595
  );
1489
1596
  }
1490
- if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
1491
- witnessCache.push(input.witnessIndex);
1492
- return total.add(gasCosts.ecr1);
1493
- }
1494
- return total;
1495
- }, bn5());
1597
+ return total.add(gasCosts.ecr1);
1598
+ }, bn5(0));
1496
1599
  return totalGas;
1497
1600
  }
1498
1601
  function getMinGas(params) {
@@ -1504,12 +1607,20 @@ function getMinGas(params) {
1504
1607
  return minGas;
1505
1608
  }
1506
1609
  function getMaxGas(params) {
1507
- const { gasPerByte, witnessesLength, witnessLimit, minGas, gasLimit = bn5(0) } = params;
1610
+ const {
1611
+ gasPerByte,
1612
+ witnessesLength,
1613
+ witnessLimit,
1614
+ minGas,
1615
+ gasLimit = bn5(0),
1616
+ maxGasPerTx
1617
+ } = params;
1508
1618
  let remainingAllowedWitnessGas = bn5(0);
1509
1619
  if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
1510
1620
  remainingAllowedWitnessGas = bn5(witnessLimit).sub(witnessesLength).mul(gasPerByte);
1511
1621
  }
1512
- return remainingAllowedWitnessGas.add(minGas).add(gasLimit);
1622
+ const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
1623
+ return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
1513
1624
  }
1514
1625
  function calculateMetadataGasForTxCreate({
1515
1626
  gasCosts,
@@ -1531,6 +1642,10 @@ function calculateMetadataGasForTxScript({
1531
1642
  }) {
1532
1643
  return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
1533
1644
  }
1645
+ var calculateGasFee = (params) => {
1646
+ const { gas, gasPrice, priceFactor, tip } = params;
1647
+ return gas.mul(gasPrice).div(priceFactor).add(tip);
1648
+ };
1534
1649
 
1535
1650
  // src/providers/utils/json.ts
1536
1651
  import { hexlify as hexlify5 } from "@fuel-ts/utils";
@@ -1687,7 +1802,7 @@ var witnessify = (value) => {
1687
1802
  // src/providers/transaction-request/transaction-request.ts
1688
1803
  var BaseTransactionRequest = class {
1689
1804
  /** Gas price for transaction */
1690
- gasPrice;
1805
+ tip;
1691
1806
  /** Block until which tx cannot be included */
1692
1807
  maturity;
1693
1808
  /** The maximum fee payable by this transaction using BASE_ASSET. */
@@ -1700,38 +1815,34 @@ var BaseTransactionRequest = class {
1700
1815
  outputs = [];
1701
1816
  /** List of witnesses */
1702
1817
  witnesses = [];
1703
- /** Base asset ID - should be fetched from the chain */
1704
- baseAssetId;
1705
1818
  /**
1706
1819
  * Constructor for initializing a base transaction request.
1707
1820
  *
1708
1821
  * @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
1709
1822
  */
1710
1823
  constructor({
1711
- gasPrice,
1824
+ tip,
1712
1825
  maturity,
1713
1826
  maxFee,
1714
1827
  witnessLimit,
1715
1828
  inputs,
1716
1829
  outputs,
1717
- witnesses,
1718
- baseAssetId
1719
- }) {
1720
- this.gasPrice = bn7(gasPrice);
1830
+ witnesses
1831
+ } = {}) {
1832
+ this.tip = bn7(tip);
1721
1833
  this.maturity = maturity ?? 0;
1722
1834
  this.witnessLimit = witnessLimit ? bn7(witnessLimit) : void 0;
1723
1835
  this.maxFee = maxFee ? bn7(maxFee) : void 0;
1724
1836
  this.inputs = inputs ?? [];
1725
1837
  this.outputs = outputs ?? [];
1726
1838
  this.witnesses = witnesses ?? [];
1727
- this.baseAssetId = baseAssetId;
1728
1839
  }
1729
1840
  static getPolicyMeta(req) {
1730
1841
  let policyTypes = 0;
1731
1842
  const policies = [];
1732
- if (req.gasPrice) {
1733
- policyTypes += PolicyType.GasPrice;
1734
- policies.push({ data: req.gasPrice, type: PolicyType.GasPrice });
1843
+ if (req.tip) {
1844
+ policyTypes += PolicyType.Tip;
1845
+ policies.push({ data: req.tip, type: PolicyType.Tip });
1735
1846
  }
1736
1847
  if (req.witnessLimit) {
1737
1848
  policyTypes += PolicyType.WitnessLimit;
@@ -1915,13 +2026,11 @@ var BaseTransactionRequest = class {
1915
2026
  * assetId, if one it was not added yet.
1916
2027
  *
1917
2028
  * @param coin - Coin resource.
1918
- * @param predicate - Predicate bytes.
1919
- * @param predicateData - Predicate data bytes.
1920
2029
  */
1921
- addCoinInput(coin, predicate) {
2030
+ addCoinInput(coin) {
1922
2031
  const { assetId, owner, amount } = coin;
1923
2032
  let witnessIndex;
1924
- if (predicate) {
2033
+ if (coin.predicate) {
1925
2034
  witnessIndex = 0;
1926
2035
  } else {
1927
2036
  witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
@@ -1936,8 +2045,7 @@ var BaseTransactionRequest = class {
1936
2045
  amount,
1937
2046
  assetId,
1938
2047
  txPointer: "0x00000000000000000000000000000000",
1939
- witnessIndex,
1940
- predicate: predicate?.bytes
2048
+ witnessIndex
1941
2049
  };
1942
2050
  this.pushInput(input);
1943
2051
  this.addChangeOutput(owner, assetId);
@@ -1947,12 +2055,12 @@ var BaseTransactionRequest = class {
1947
2055
  * baseAssetId, if one it was not added yet.
1948
2056
  *
1949
2057
  * @param message - Message resource.
1950
- * @param predicate - Predicate bytes.
1951
2058
  */
1952
- addMessageInput(message, predicate) {
2059
+ addMessageInput(message) {
1953
2060
  const { recipient, sender, amount } = message;
2061
+ const assetId = BaseAssetId2;
1954
2062
  let witnessIndex;
1955
- if (predicate) {
2063
+ if (message.predicate) {
1956
2064
  witnessIndex = 0;
1957
2065
  } else {
1958
2066
  witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
@@ -1966,11 +2074,10 @@ var BaseTransactionRequest = class {
1966
2074
  sender: sender.toB256(),
1967
2075
  recipient: recipient.toB256(),
1968
2076
  amount,
1969
- witnessIndex,
1970
- predicate: predicate?.bytes
2077
+ witnessIndex
1971
2078
  };
1972
2079
  this.pushInput(input);
1973
- this.addChangeOutput(recipient, this.baseAssetId);
2080
+ this.addChangeOutput(recipient, assetId);
1974
2081
  }
1975
2082
  /**
1976
2083
  * Adds a single resource to the transaction by adding a coin/message input and a
@@ -1998,32 +2105,6 @@ var BaseTransactionRequest = class {
1998
2105
  resources.forEach((resource) => this.addResource(resource));
1999
2106
  return this;
2000
2107
  }
2001
- /**
2002
- * Adds multiple resources to the transaction by adding coin/message inputs and change
2003
- * outputs from the related assetIds.
2004
- *
2005
- * @param resources - The resources to add.
2006
- * @returns This transaction.
2007
- */
2008
- addPredicateResource(resource, predicate) {
2009
- if (isCoin(resource)) {
2010
- this.addCoinInput(resource, predicate);
2011
- } else {
2012
- this.addMessageInput(resource, predicate);
2013
- }
2014
- return this;
2015
- }
2016
- /**
2017
- * Adds multiple predicate coin/message inputs to the transaction and change outputs
2018
- * from the related assetIds.
2019
- *
2020
- * @param resources - The resources to add.
2021
- * @returns This transaction.
2022
- */
2023
- addPredicateResources(resources, predicate) {
2024
- resources.forEach((resource) => this.addPredicateResource(resource, predicate));
2025
- return this;
2026
- }
2027
2108
  /**
2028
2109
  * Adds a coin output to the transaction.
2029
2110
  *
@@ -2031,12 +2112,12 @@ var BaseTransactionRequest = class {
2031
2112
  * @param amount - Amount of coin.
2032
2113
  * @param assetId - Asset ID of coin.
2033
2114
  */
2034
- addCoinOutput(to, amount, assetId) {
2115
+ addCoinOutput(to, amount, assetId = BaseAssetId2) {
2035
2116
  this.pushOutput({
2036
2117
  type: OutputType2.Coin,
2037
2118
  to: addressify(to).toB256(),
2038
2119
  amount,
2039
- assetId: assetId ?? this.baseAssetId
2120
+ assetId
2040
2121
  });
2041
2122
  return this;
2042
2123
  }
@@ -2063,7 +2144,7 @@ var BaseTransactionRequest = class {
2063
2144
  * @param to - Address of the owner.
2064
2145
  * @param assetId - Asset ID of coin.
2065
2146
  */
2066
- addChangeOutput(to, assetId) {
2147
+ addChangeOutput(to, assetId = BaseAssetId2) {
2067
2148
  const changeOutput = this.getChangeOutputs().find(
2068
2149
  (output) => hexlify7(output.assetId) === assetId
2069
2150
  );
@@ -2071,7 +2152,7 @@ var BaseTransactionRequest = class {
2071
2152
  this.pushOutput({
2072
2153
  type: OutputType2.Change,
2073
2154
  to: addressify(to).toB256(),
2074
- assetId: assetId ?? this.baseAssetId
2155
+ assetId
2075
2156
  });
2076
2157
  }
2077
2158
  }
@@ -2103,7 +2184,7 @@ var BaseTransactionRequest = class {
2103
2184
  }
2104
2185
  calculateMaxGas(chainInfo, minGas) {
2105
2186
  const { consensusParameters } = chainInfo;
2106
- const { gasPerByte } = consensusParameters;
2187
+ const { gasPerByte, maxGasPerTx } = consensusParameters;
2107
2188
  const witnessesLength = this.toTransaction().witnesses.reduce(
2108
2189
  (acc, wit) => acc + wit.dataLength,
2109
2190
  0
@@ -2112,7 +2193,8 @@ var BaseTransactionRequest = class {
2112
2193
  gasPerByte,
2113
2194
  minGas,
2114
2195
  witnessesLength,
2115
- witnessLimit: this.witnessLimit
2196
+ witnessLimit: this.witnessLimit,
2197
+ maxGasPerTx
2116
2198
  });
2117
2199
  }
2118
2200
  /**
@@ -2130,24 +2212,27 @@ var BaseTransactionRequest = class {
2130
2212
  });
2131
2213
  const updateAssetInput = (assetId, quantity) => {
2132
2214
  const assetInput = findAssetInput(assetId);
2215
+ let usedQuantity = quantity;
2216
+ if (assetId === BaseAssetId2) {
2217
+ usedQuantity = bn7("1000000000000000000");
2218
+ }
2133
2219
  if (assetInput && "assetId" in assetInput) {
2134
2220
  assetInput.id = hexlify7(randomBytes(UTXO_ID_LEN2));
2135
- assetInput.amount = quantity;
2221
+ assetInput.amount = usedQuantity;
2136
2222
  } else {
2137
2223
  this.addResources([
2138
2224
  {
2139
2225
  id: hexlify7(randomBytes(UTXO_ID_LEN2)),
2140
- amount: quantity,
2226
+ amount: usedQuantity,
2141
2227
  assetId,
2142
2228
  owner: resourcesOwner || Address.fromRandom(),
2143
- maturity: 0,
2144
2229
  blockCreated: bn7(1),
2145
2230
  txCreatedIdx: bn7(1)
2146
2231
  }
2147
2232
  ]);
2148
2233
  }
2149
2234
  };
2150
- updateAssetInput(this.baseAssetId, bn7(1e11));
2235
+ updateAssetInput(BaseAssetId2, bn7(1e11));
2151
2236
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2152
2237
  }
2153
2238
  /**
@@ -2172,7 +2257,7 @@ var BaseTransactionRequest = class {
2172
2257
  toJSON() {
2173
2258
  return normalizeJSON(this);
2174
2259
  }
2175
- updatePredicateInputs(inputs) {
2260
+ updatePredicateGasUsed(inputs) {
2176
2261
  this.inputs.forEach((i) => {
2177
2262
  let correspondingInput;
2178
2263
  switch (i.type) {
@@ -2194,6 +2279,15 @@ var BaseTransactionRequest = class {
2194
2279
  }
2195
2280
  });
2196
2281
  }
2282
+ shiftPredicateData() {
2283
+ this.inputs.forEach((input) => {
2284
+ if ("predicateData" in input && "paddPredicateData" in input && typeof input.paddPredicateData === "function") {
2285
+ input.predicateData = input.paddPredicateData(
2286
+ BaseTransactionRequest.getPolicyMeta(this).policies.length
2287
+ );
2288
+ }
2289
+ });
2290
+ }
2197
2291
  };
2198
2292
 
2199
2293
  // src/providers/transaction-request/create-transaction-request.ts
@@ -2317,7 +2411,12 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2317
2411
  *
2318
2412
  * @param createTransactionRequestLike - The initial values for the instance
2319
2413
  */
2320
- constructor({ bytecodeWitnessIndex, salt, storageSlots, ...rest }) {
2414
+ constructor({
2415
+ bytecodeWitnessIndex,
2416
+ salt,
2417
+ storageSlots,
2418
+ ...rest
2419
+ } = {}) {
2321
2420
  super(rest);
2322
2421
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
2323
2422
  this.salt = hexlify9(salt ?? ZeroBytes326);
@@ -2335,9 +2434,8 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2335
2434
  return {
2336
2435
  type: TransactionType3.Create,
2337
2436
  ...baseTransaction,
2338
- bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
2339
2437
  bytecodeWitnessIndex,
2340
- storageSlotsCount: storageSlots.length,
2438
+ storageSlotsCount: bn9(storageSlots.length),
2341
2439
  salt: this.salt ? hexlify9(this.salt) : ZeroBytes326,
2342
2440
  storageSlots
2343
2441
  };
@@ -2441,7 +2539,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2441
2539
  *
2442
2540
  * @param scriptTransactionRequestLike - The initial values for the instance.
2443
2541
  */
2444
- constructor({ script, scriptData, gasLimit, ...rest }) {
2542
+ constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2445
2543
  super(rest);
2446
2544
  this.gasLimit = bn10(gasLimit);
2447
2545
  this.script = arrayify8(script ?? returnZeroScript.bytes);
@@ -2460,8 +2558,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2460
2558
  type: TransactionType4.Script,
2461
2559
  scriptGasLimit: this.gasLimit,
2462
2560
  ...super.getBaseTransaction(),
2463
- scriptLength: script.length,
2464
- scriptDataLength: scriptData.length,
2561
+ scriptLength: bn10(script.length),
2562
+ scriptDataLength: bn10(scriptData.length),
2465
2563
  receiptsRoot: ZeroBytes327,
2466
2564
  script: hexlify10(script),
2467
2565
  scriptData: hexlify10(scriptData)
@@ -2525,7 +2623,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2525
2623
  }
2526
2624
  calculateMaxGas(chainInfo, minGas) {
2527
2625
  const { consensusParameters } = chainInfo;
2528
- const { gasPerByte } = consensusParameters;
2626
+ const { gasPerByte, maxGasPerTx } = consensusParameters;
2529
2627
  const witnessesLength = this.toTransaction().witnesses.reduce(
2530
2628
  (acc, wit) => acc + wit.dataLength,
2531
2629
  0
@@ -2535,7 +2633,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2535
2633
  minGas,
2536
2634
  witnessesLength,
2537
2635
  witnessLimit: this.witnessLimit,
2538
- gasLimit: this.gasLimit
2636
+ gasLimit: this.gasLimit,
2637
+ maxGasPerTx
2539
2638
  });
2540
2639
  }
2541
2640
  /**
@@ -2592,7 +2691,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2592
2691
 
2593
2692
  // src/providers/transaction-request/utils.ts
2594
2693
  import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
2595
- import { TransactionType as TransactionType5 } from "@fuel-ts/transactions";
2694
+ import { TransactionType as TransactionType5, InputType as InputType5 } from "@fuel-ts/transactions";
2596
2695
  var transactionRequestify = (obj) => {
2597
2696
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
2598
2697
  return obj;
@@ -2610,14 +2709,31 @@ var transactionRequestify = (obj) => {
2610
2709
  }
2611
2710
  }
2612
2711
  };
2712
+ var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
2713
+ (acc, input) => {
2714
+ if (input.type === InputType5.Coin && input.owner === owner) {
2715
+ acc.utxos.push(input.id);
2716
+ }
2717
+ if (input.type === InputType5.Message && input.recipient === owner) {
2718
+ acc.messages.push(input.nonce);
2719
+ }
2720
+ return acc;
2721
+ },
2722
+ {
2723
+ utxos: [],
2724
+ messages: []
2725
+ }
2726
+ );
2613
2727
 
2614
2728
  // src/providers/transaction-response/transaction-response.ts
2615
2729
  import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
2616
- import { bn as bn14 } from "@fuel-ts/math";
2730
+ import { bn as bn15 } from "@fuel-ts/math";
2617
2731
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2618
2732
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
2619
2733
 
2620
2734
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2735
+ import { bn as bn14 } from "@fuel-ts/math";
2736
+ import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
2621
2737
  import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2622
2738
 
2623
2739
  // src/providers/transaction-summary/calculate-transaction-fee.ts
@@ -2626,9 +2742,10 @@ import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, Trans
2626
2742
  import { arrayify as arrayify9 } from "@fuel-ts/utils";
2627
2743
  var calculateTransactionFee = (params) => {
2628
2744
  const {
2629
- gasUsed,
2745
+ gasPrice,
2630
2746
  rawPayload,
2631
- consensusParameters: { gasCosts, feeParams }
2747
+ tip,
2748
+ consensusParameters: { gasCosts, feeParams, maxGasPerTx }
2632
2749
  } = params;
2633
2750
  const gasPerByte = bn11(feeParams.gasPerByte);
2634
2751
  const gasPriceFactor = bn11(feeParams.gasPriceFactor);
@@ -2638,8 +2755,7 @@ var calculateTransactionFee = (params) => {
2638
2755
  return {
2639
2756
  fee: bn11(0),
2640
2757
  minFee: bn11(0),
2641
- maxFee: bn11(0),
2642
- feeFromGasUsed: bn11(0)
2758
+ maxFee: bn11(0)
2643
2759
  };
2644
2760
  }
2645
2761
  const { type, witnesses, inputs, policies } = transaction;
@@ -2671,7 +2787,6 @@ var calculateTransactionFee = (params) => {
2671
2787
  metadataGas,
2672
2788
  txBytesSize: transactionBytes.length
2673
2789
  });
2674
- const gasPrice = bn11(policies.find((policy) => policy.type === PolicyType2.GasPrice)?.data);
2675
2790
  const witnessLimit = policies.find((policy) => policy.type === PolicyType2.WitnessLimit)?.data;
2676
2791
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
2677
2792
  const maxGas = getMaxGas({
@@ -2679,17 +2794,25 @@ var calculateTransactionFee = (params) => {
2679
2794
  minGas,
2680
2795
  witnessesLength,
2681
2796
  gasLimit,
2682
- witnessLimit
2797
+ witnessLimit,
2798
+ maxGasPerTx
2799
+ });
2800
+ const minFee = calculateGasFee({
2801
+ gasPrice,
2802
+ gas: minGas,
2803
+ priceFactor: gasPriceFactor,
2804
+ tip
2805
+ });
2806
+ const maxFee = calculateGasFee({
2807
+ gasPrice,
2808
+ gas: maxGas,
2809
+ priceFactor: gasPriceFactor,
2810
+ tip
2683
2811
  });
2684
- const feeFromGasUsed = calculatePriceWithFactor(gasUsed, gasPrice, gasPriceFactor);
2685
- const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor);
2686
- const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor);
2687
- const fee = minFee.add(feeFromGasUsed);
2688
2812
  return {
2689
- fee,
2690
2813
  minFee,
2691
2814
  maxFee,
2692
- feeFromGasUsed
2815
+ fee: maxFee
2693
2816
  };
2694
2817
  };
2695
2818
 
@@ -2745,7 +2868,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2745
2868
 
2746
2869
  // src/providers/transaction-summary/input.ts
2747
2870
  import { ErrorCode as ErrorCode9, FuelError as FuelError9 } from "@fuel-ts/errors";
2748
- import { InputType as InputType5 } from "@fuel-ts/transactions";
2871
+ import { InputType as InputType6 } from "@fuel-ts/transactions";
2749
2872
  function getInputsByTypes(inputs, types) {
2750
2873
  return inputs.filter((i) => types.includes(i.type));
2751
2874
  }
@@ -2753,16 +2876,16 @@ function getInputsByType(inputs, type) {
2753
2876
  return inputs.filter((i) => i.type === type);
2754
2877
  }
2755
2878
  function getInputsCoin(inputs) {
2756
- return getInputsByType(inputs, InputType5.Coin);
2879
+ return getInputsByType(inputs, InputType6.Coin);
2757
2880
  }
2758
2881
  function getInputsMessage(inputs) {
2759
- return getInputsByType(inputs, InputType5.Message);
2882
+ return getInputsByType(inputs, InputType6.Message);
2760
2883
  }
2761
2884
  function getInputsCoinAndMessage(inputs) {
2762
- return getInputsByTypes(inputs, [InputType5.Coin, InputType5.Message]);
2885
+ return getInputsByTypes(inputs, [InputType6.Coin, InputType6.Message]);
2763
2886
  }
2764
2887
  function getInputsContract(inputs) {
2765
- return getInputsByType(inputs, InputType5.Contract);
2888
+ return getInputsByType(inputs, InputType6.Contract);
2766
2889
  }
2767
2890
  function getInputFromAssetId(inputs, assetId) {
2768
2891
  const coinInputs = getInputsCoin(inputs);
@@ -2781,7 +2904,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
2781
2904
  if (!contractInput) {
2782
2905
  return void 0;
2783
2906
  }
2784
- if (contractInput.type !== InputType5.Contract) {
2907
+ if (contractInput.type !== InputType6.Contract) {
2785
2908
  throw new FuelError9(
2786
2909
  ErrorCode9.INVALID_TRANSACTION_INPUT,
2787
2910
  `Contract input should be of type 'contract'.`
@@ -2790,10 +2913,10 @@ function getInputContractFromIndex(inputs, inputIndex) {
2790
2913
  return contractInput;
2791
2914
  }
2792
2915
  function getInputAccountAddress(input) {
2793
- if (input.type === InputType5.Coin) {
2916
+ if (input.type === InputType6.Coin) {
2794
2917
  return input.owner.toString();
2795
2918
  }
2796
- if (input.type === InputType5.Message) {
2919
+ if (input.type === InputType6.Message) {
2797
2920
  return input.recipient.toString();
2798
2921
  }
2799
2922
  return "";
@@ -3303,7 +3426,9 @@ function assembleTransactionSummary(params) {
3303
3426
  gqlTransactionStatus,
3304
3427
  abiMap = {},
3305
3428
  maxInputs,
3306
- gasCosts
3429
+ gasCosts,
3430
+ maxGasPerTx,
3431
+ gasPrice
3307
3432
  } = params;
3308
3433
  const gasUsed = getGasUsedFromReceipts(receipts);
3309
3434
  const rawPayload = hexlify11(transactionBytes);
@@ -3317,11 +3442,14 @@ function assembleTransactionSummary(params) {
3317
3442
  maxInputs
3318
3443
  });
3319
3444
  const typeName = getTransactionTypeName(transaction.type);
3445
+ const tip = bn14(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3320
3446
  const { fee } = calculateTransactionFee({
3321
- gasUsed,
3447
+ gasPrice,
3322
3448
  rawPayload,
3449
+ tip,
3323
3450
  consensusParameters: {
3324
3451
  gasCosts,
3452
+ maxGasPerTx,
3325
3453
  feeParams: {
3326
3454
  gasPerByte,
3327
3455
  gasPriceFactor
@@ -3381,7 +3509,7 @@ var TransactionResponse = class {
3381
3509
  /** Current provider */
3382
3510
  provider;
3383
3511
  /** Gas used on the transaction */
3384
- gasUsed = bn14(0);
3512
+ gasUsed = bn15(0);
3385
3513
  /** The graphql Transaction with receipts object. */
3386
3514
  gqlTransaction;
3387
3515
  abis;
@@ -3459,8 +3587,13 @@ var TransactionResponse = class {
3459
3587
  const decodedTransaction = this.decodeTransaction(
3460
3588
  transaction
3461
3589
  );
3462
- const receipts = transaction.receipts?.map(processGqlReceipt) || [];
3463
- const { gasPerByte, gasPriceFactor, gasCosts } = this.provider.getGasConfig();
3590
+ let txReceipts = [];
3591
+ if (transaction?.status && "receipts" in transaction.status) {
3592
+ txReceipts = transaction.status.receipts;
3593
+ }
3594
+ const receipts = txReceipts.map(processGqlReceipt) || [];
3595
+ const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
3596
+ const gasPrice = await this.provider.getLatestGasPrice();
3464
3597
  const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
3465
3598
  const transactionSummary = assembleTransactionSummary({
3466
3599
  id: this.id,
@@ -3472,7 +3605,9 @@ var TransactionResponse = class {
3472
3605
  gasPriceFactor,
3473
3606
  abiMap: contractsAbiMap,
3474
3607
  maxInputs,
3475
- gasCosts
3608
+ gasCosts,
3609
+ maxGasPerTx,
3610
+ gasPrice
3476
3611
  });
3477
3612
  return transactionSummary;
3478
3613
  }
@@ -3599,30 +3734,29 @@ var processGqlChain = (chain) => {
3599
3734
  const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } = consensusParameters;
3600
3735
  return {
3601
3736
  name,
3602
- baseChainHeight: bn15(daHeight),
3737
+ baseChainHeight: bn16(daHeight),
3603
3738
  consensusParameters: {
3604
- contractMaxSize: bn15(contractParams.contractMaxSize),
3605
- maxInputs: bn15(txParams.maxInputs),
3606
- maxOutputs: bn15(txParams.maxOutputs),
3607
- maxWitnesses: bn15(txParams.maxWitnesses),
3608
- maxGasPerTx: bn15(txParams.maxGasPerTx),
3609
- maxScriptLength: bn15(scriptParams.maxScriptLength),
3610
- maxScriptDataLength: bn15(scriptParams.maxScriptDataLength),
3611
- maxStorageSlots: bn15(contractParams.maxStorageSlots),
3612
- maxPredicateLength: bn15(predicateParams.maxPredicateLength),
3613
- maxPredicateDataLength: bn15(predicateParams.maxPredicateDataLength),
3614
- maxGasPerPredicate: bn15(predicateParams.maxGasPerPredicate),
3615
- gasPriceFactor: bn15(feeParams.gasPriceFactor),
3616
- gasPerByte: bn15(feeParams.gasPerByte),
3617
- maxMessageDataLength: bn15(predicateParams.maxMessageDataLength),
3618
- chainId: bn15(consensusParameters.chainId),
3619
- baseAssetId: consensusParameters.baseAssetId,
3739
+ contractMaxSize: bn16(contractParams.contractMaxSize),
3740
+ maxInputs: bn16(txParams.maxInputs),
3741
+ maxOutputs: bn16(txParams.maxOutputs),
3742
+ maxWitnesses: bn16(txParams.maxWitnesses),
3743
+ maxGasPerTx: bn16(txParams.maxGasPerTx),
3744
+ maxScriptLength: bn16(scriptParams.maxScriptLength),
3745
+ maxScriptDataLength: bn16(scriptParams.maxScriptDataLength),
3746
+ maxStorageSlots: bn16(contractParams.maxStorageSlots),
3747
+ maxPredicateLength: bn16(predicateParams.maxPredicateLength),
3748
+ maxPredicateDataLength: bn16(predicateParams.maxPredicateDataLength),
3749
+ maxGasPerPredicate: bn16(predicateParams.maxGasPerPredicate),
3750
+ gasPriceFactor: bn16(feeParams.gasPriceFactor),
3751
+ gasPerByte: bn16(feeParams.gasPerByte),
3752
+ maxMessageDataLength: bn16(predicateParams.maxMessageDataLength),
3753
+ chainId: bn16(consensusParameters.chainId),
3620
3754
  gasCosts
3621
3755
  },
3622
3756
  gasCosts,
3623
3757
  latestBlock: {
3624
3758
  id: latestBlock.id,
3625
- height: bn15(latestBlock.header.height),
3759
+ height: bn16(latestBlock.height),
3626
3760
  time: latestBlock.header.time,
3627
3761
  transactions: latestBlock.transactions.map((i) => ({
3628
3762
  id: i.id
@@ -3716,10 +3850,8 @@ var _Provider = class {
3716
3850
  * Returns some helpful parameters related to gas fees.
3717
3851
  */
3718
3852
  getGasConfig() {
3719
- const { minGasPrice } = this.getNode();
3720
3853
  const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
3721
3854
  return {
3722
- minGasPrice,
3723
3855
  maxGasPerTx,
3724
3856
  maxGasPerPredicate,
3725
3857
  gasPriceFactor,
@@ -3817,7 +3949,7 @@ var _Provider = class {
3817
3949
  */
3818
3950
  async getBlockNumber() {
3819
3951
  const { chain } = await this.operations.getChain();
3820
- return bn15(chain.latestBlock.header.height, 10);
3952
+ return bn16(chain.latestBlock.height, 10);
3821
3953
  }
3822
3954
  /**
3823
3955
  * Returns the chain information.
@@ -3827,13 +3959,11 @@ var _Provider = class {
3827
3959
  async fetchNode() {
3828
3960
  const { nodeInfo } = await this.operations.getNodeInfo();
3829
3961
  const processedNodeInfo = {
3830
- maxDepth: bn15(nodeInfo.maxDepth),
3831
- maxTx: bn15(nodeInfo.maxTx),
3832
- minGasPrice: bn15(nodeInfo.minGasPrice),
3962
+ maxDepth: bn16(nodeInfo.maxDepth),
3963
+ maxTx: bn16(nodeInfo.maxTx),
3833
3964
  nodeVersion: nodeInfo.nodeVersion,
3834
3965
  utxoValidation: nodeInfo.utxoValidation,
3835
- vmBacktrace: nodeInfo.vmBacktrace,
3836
- peers: nodeInfo.peers
3966
+ vmBacktrace: nodeInfo.vmBacktrace
3837
3967
  };
3838
3968
  _Provider.nodeInfoCache[this.url] = processedNodeInfo;
3839
3969
  return processedNodeInfo;
@@ -3859,17 +3989,6 @@ var _Provider = class {
3859
3989
  } = this.getChain();
3860
3990
  return chainId.toNumber();
3861
3991
  }
3862
- /**
3863
- * Returns the base asset ID
3864
- *
3865
- * @returns A promise that resolves to the base asset ID
3866
- */
3867
- getBaseAssetId() {
3868
- const {
3869
- consensusParameters: { baseAssetId }
3870
- } = this.getChain();
3871
- return baseAssetId;
3872
- }
3873
3992
  /**
3874
3993
  * Submits a transaction to the chain to be executed.
3875
3994
  *
@@ -3930,14 +4049,13 @@ var _Provider = class {
3930
4049
  return this.estimateTxDependencies(transactionRequest);
3931
4050
  }
3932
4051
  const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
3933
- const { dryRun: gqlReceipts } = await this.operations.dryRun({
3934
- encodedTransaction,
4052
+ const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4053
+ encodedTransactions: encodedTransaction,
3935
4054
  utxoValidation: utxoValidation || false
3936
4055
  });
3937
- const receipts = gqlReceipts.map(processGqlReceipt);
3938
- return {
3939
- receipts
3940
- };
4056
+ const [{ receipts: rawReceipts, status }] = dryRunStatuses;
4057
+ const receipts = rawReceipts.map(processGqlReceipt);
4058
+ return { receipts, dryrunStatus: status };
3941
4059
  }
3942
4060
  /**
3943
4061
  * Verifies whether enough gas is available to complete transaction.
@@ -3963,7 +4081,7 @@ var _Provider = class {
3963
4081
  } = response;
3964
4082
  if (inputs) {
3965
4083
  inputs.forEach((input, index) => {
3966
- if ("predicateGasUsed" in input && bn15(input.predicateGasUsed).gt(0)) {
4084
+ if ("predicateGasUsed" in input && bn16(input.predicateGasUsed).gt(0)) {
3967
4085
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
3968
4086
  }
3969
4087
  });
@@ -3976,9 +4094,6 @@ var _Provider = class {
3976
4094
  * If there are missing variable outputs,
3977
4095
  * `addVariableOutputs` is called on the transaction.
3978
4096
  *
3979
- * @privateRemarks
3980
- * TODO: Investigate support for missing contract IDs
3981
- * TODO: Add support for missing output messages
3982
4097
  *
3983
4098
  * @param transactionRequest - The transaction request object.
3984
4099
  * @returns A promise.
@@ -3991,16 +4106,19 @@ var _Provider = class {
3991
4106
  missingContractIds: []
3992
4107
  };
3993
4108
  }
3994
- await this.estimatePredicates(transactionRequest);
3995
4109
  let receipts = [];
3996
4110
  const missingContractIds = [];
3997
4111
  let outputVariables = 0;
4112
+ let dryrunStatus;
3998
4113
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
3999
- const { dryRun: gqlReceipts } = await this.operations.dryRun({
4000
- encodedTransaction: hexlify12(transactionRequest.toTransactionBytes()),
4114
+ const {
4115
+ dryRun: [{ receipts: rawReceipts, status }]
4116
+ } = await this.operations.dryRun({
4117
+ encodedTransactions: [hexlify12(transactionRequest.toTransactionBytes())],
4001
4118
  utxoValidation: false
4002
4119
  });
4003
- receipts = gqlReceipts.map(processGqlReceipt);
4120
+ receipts = rawReceipts.map(processGqlReceipt);
4121
+ dryrunStatus = status;
4004
4122
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
4005
4123
  const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
4006
4124
  if (hasMissingOutputs) {
@@ -4010,6 +4128,10 @@ var _Provider = class {
4010
4128
  transactionRequest.addContractInputAndOutput(Address2.fromString(contractId));
4011
4129
  missingContractIds.push(contractId);
4012
4130
  });
4131
+ const { maxFee } = await this.estimateTxGasAndFee({
4132
+ transactionRequest
4133
+ });
4134
+ transactionRequest.maxFee = maxFee;
4013
4135
  } else {
4014
4136
  break;
4015
4137
  }
@@ -4017,37 +4139,139 @@ var _Provider = class {
4017
4139
  return {
4018
4140
  receipts,
4019
4141
  outputVariables,
4020
- missingContractIds
4142
+ missingContractIds,
4143
+ dryrunStatus
4021
4144
  };
4022
4145
  }
4146
+ /**
4147
+ * Dry runs multiple transactions and checks for missing dependencies in batches.
4148
+ *
4149
+ * Transactions are dry run in batches. After each dry run, transactions requiring
4150
+ * further modifications are identified. The method iteratively updates these transactions
4151
+ * and performs subsequent dry runs until all dependencies for each transaction are satisfied.
4152
+ *
4153
+ * @param transactionRequests - Array of transaction request objects.
4154
+ * @returns A promise that resolves to an array of results for each transaction.
4155
+ */
4156
+ async estimateMultipleTxDependencies(transactionRequests) {
4157
+ const results = transactionRequests.map(() => ({
4158
+ receipts: [],
4159
+ outputVariables: 0,
4160
+ missingContractIds: [],
4161
+ dryrunStatus: void 0
4162
+ }));
4163
+ const allRequests = clone3(transactionRequests);
4164
+ const serializedTransactionsMap = /* @__PURE__ */ new Map();
4165
+ allRequests.forEach((req, index) => {
4166
+ if (req.type === TransactionType8.Script) {
4167
+ serializedTransactionsMap.set(index, hexlify12(req.toTransactionBytes()));
4168
+ }
4169
+ });
4170
+ let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
4171
+ let attempt = 0;
4172
+ while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
4173
+ const encodedTransactions = transactionsToProcess.map(
4174
+ (index) => serializedTransactionsMap.get(index)
4175
+ );
4176
+ const dryRunResults = await this.operations.dryRun({
4177
+ encodedTransactions,
4178
+ utxoValidation: false
4179
+ });
4180
+ const nextRoundTransactions = [];
4181
+ for (let i = 0; i < dryRunResults.dryRun.length; i++) {
4182
+ const currentResultIndex = transactionsToProcess[i];
4183
+ const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
4184
+ results[currentResultIndex].receipts = rawReceipts.map(processGqlReceipt);
4185
+ results[currentResultIndex].dryrunStatus = status;
4186
+ const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
4187
+ results[currentResultIndex].receipts
4188
+ );
4189
+ const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
4190
+ const requestToProcess = allRequests[currentResultIndex];
4191
+ if (hasMissingOutputs && requestToProcess?.type === TransactionType8.Script) {
4192
+ results[currentResultIndex].outputVariables += missingOutputVariables.length;
4193
+ requestToProcess.addVariableOutputs(missingOutputVariables.length);
4194
+ missingOutputContractIds.forEach(({ contractId }) => {
4195
+ requestToProcess.addContractInputAndOutput(Address2.fromString(contractId));
4196
+ results[currentResultIndex].missingContractIds.push(contractId);
4197
+ });
4198
+ const { maxFee } = await this.estimateTxGasAndFee({
4199
+ transactionRequest: requestToProcess
4200
+ });
4201
+ requestToProcess.maxFee = maxFee;
4202
+ serializedTransactionsMap.set(
4203
+ currentResultIndex,
4204
+ hexlify12(requestToProcess.toTransactionBytes())
4205
+ );
4206
+ nextRoundTransactions.push(currentResultIndex);
4207
+ allRequests[currentResultIndex] = requestToProcess;
4208
+ }
4209
+ }
4210
+ transactionsToProcess = nextRoundTransactions;
4211
+ attempt += 1;
4212
+ }
4213
+ return results;
4214
+ }
4215
+ async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
4216
+ if (estimateTxDependencies) {
4217
+ return this.estimateMultipleTxDependencies(transactionRequests);
4218
+ }
4219
+ const encodedTransactions = transactionRequests.map((tx) => hexlify12(tx.toTransactionBytes()));
4220
+ const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4221
+ encodedTransactions,
4222
+ utxoValidation: utxoValidation || false
4223
+ });
4224
+ const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
4225
+ const receipts = rawReceipts.map(processGqlReceipt);
4226
+ return { receipts, dryrunStatus: status };
4227
+ });
4228
+ return results;
4229
+ }
4023
4230
  /**
4024
4231
  * Estimates the transaction gas and fee based on the provided transaction request.
4025
4232
  * @param transactionRequest - The transaction request object.
4026
4233
  * @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
4027
4234
  */
4028
- estimateTxGasAndFee(params) {
4235
+ async estimateTxGasAndFee(params) {
4029
4236
  const { transactionRequest } = params;
4030
- const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
4237
+ let { gasPrice } = params;
4031
4238
  const chainInfo = this.getChain();
4032
- const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
4033
- transactionRequest.gasPrice = gasPrice;
4239
+ const { gasPriceFactor, maxGasPerTx } = this.getGasConfig();
4034
4240
  const minGas = transactionRequest.calculateMinGas(chainInfo);
4035
- const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4241
+ if (!gasPrice) {
4242
+ gasPrice = await this.estimateGasPrice(10);
4243
+ }
4244
+ const minFee = calculateGasFee({
4245
+ gasPrice: bn16(gasPrice),
4246
+ gas: minGas,
4247
+ priceFactor: gasPriceFactor,
4248
+ tip: transactionRequest.tip
4249
+ }).add(1);
4250
+ let gasLimit = bn16(0);
4036
4251
  if (transactionRequest.type === TransactionType8.Script) {
4252
+ gasLimit = transactionRequest.gasLimit;
4037
4253
  if (transactionRequest.gasLimit.eq(0)) {
4038
4254
  transactionRequest.gasLimit = minGas;
4039
4255
  transactionRequest.gasLimit = maxGasPerTx.sub(
4040
4256
  transactionRequest.calculateMaxGas(chainInfo, minGas)
4041
4257
  );
4258
+ gasLimit = transactionRequest.gasLimit;
4042
4259
  }
4043
4260
  }
4044
4261
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4045
- const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4262
+ const maxFee = calculateGasFee({
4263
+ gasPrice: bn16(gasPrice),
4264
+ gas: maxGas,
4265
+ priceFactor: gasPriceFactor,
4266
+ tip: transactionRequest.tip
4267
+ }).add(1);
4046
4268
  return {
4047
4269
  minGas,
4048
4270
  minFee,
4049
4271
  maxGas,
4050
- maxFee
4272
+ maxFee,
4273
+ gasPrice,
4274
+ gasLimit
4051
4275
  };
4052
4276
  }
4053
4277
  /**
@@ -4065,15 +4289,17 @@ var _Provider = class {
4065
4289
  if (estimateTxDependencies) {
4066
4290
  return this.estimateTxDependencies(transactionRequest);
4067
4291
  }
4068
- const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
4069
- const { dryRun: gqlReceipts } = await this.operations.dryRun({
4070
- encodedTransaction,
4292
+ const encodedTransactions = [hexlify12(transactionRequest.toTransactionBytes())];
4293
+ const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4294
+ encodedTransactions,
4071
4295
  utxoValidation: true
4072
4296
  });
4073
- const receipts = gqlReceipts.map(processGqlReceipt);
4074
- return {
4075
- receipts
4076
- };
4297
+ const callResult = dryRunStatuses.map((dryRunStatus) => {
4298
+ const { id, receipts, status } = dryRunStatus;
4299
+ const processedReceipts = receipts.map(processGqlReceipt);
4300
+ return { id, receipts: processedReceipts, status };
4301
+ });
4302
+ return { receipts: callResult[0].receipts };
4077
4303
  }
4078
4304
  /**
4079
4305
  * Returns a transaction cost to enable user
@@ -4090,77 +4316,79 @@ var _Provider = class {
4090
4316
  * @param tolerance - The tolerance to add on top of the gasUsed.
4091
4317
  * @returns A promise that resolves to the transaction cost object.
4092
4318
  */
4093
- async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
4094
- estimateTxDependencies = true,
4095
- estimatePredicates = true,
4096
- resourcesOwner,
4097
- signatureCallback
4098
- } = {}) {
4319
+ async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
4099
4320
  const txRequestClone = clone3(transactionRequestify(transactionRequestLike));
4100
- const { minGasPrice } = this.getGasConfig();
4101
- const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
4102
4321
  const isScriptTransaction = txRequestClone.type === TransactionType8.Script;
4103
4322
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
4104
- const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
4323
+ const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
4105
4324
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
4325
+ txRequestClone.maxFee = bn16(0);
4106
4326
  if (isScriptTransaction) {
4107
- txRequestClone.gasLimit = bn15(0);
4327
+ txRequestClone.gasLimit = bn16(0);
4108
4328
  }
4109
- if (estimatePredicates) {
4110
- if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4111
- resourcesOwner.populateTransactionPredicateData(txRequestClone);
4112
- }
4113
- await this.estimatePredicates(txRequestClone);
4329
+ if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4330
+ resourcesOwner.populateTransactionPredicateData(txRequestClone);
4114
4331
  }
4332
+ const signedRequest = clone3(txRequestClone);
4333
+ let addedSignatures = 0;
4115
4334
  if (signatureCallback && isScriptTransaction) {
4116
- await signatureCallback(txRequestClone);
4335
+ const lengthBefore = signedRequest.witnesses.length;
4336
+ await signatureCallback(signedRequest);
4337
+ addedSignatures = signedRequest.witnesses.length - lengthBefore;
4117
4338
  }
4118
- let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
4119
- transactionRequest: txRequestClone
4339
+ await this.estimatePredicates(signedRequest);
4340
+ let { maxFee, maxGas, minFee, minGas, gasPrice, gasLimit } = await this.estimateTxGasAndFee({
4341
+ transactionRequest: signedRequest
4120
4342
  });
4121
4343
  let receipts = [];
4122
4344
  let missingContractIds = [];
4123
4345
  let outputVariables = 0;
4124
- let gasUsed = bn15(0);
4125
- if (isScriptTransaction && estimateTxDependencies) {
4126
- txRequestClone.gasPrice = bn15(0);
4346
+ let gasUsed = bn16(0);
4347
+ txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
4348
+ txRequestClone.maxFee = maxFee;
4349
+ if (isScriptTransaction) {
4350
+ txRequestClone.gasLimit = gasLimit;
4351
+ if (signatureCallback) {
4352
+ await signatureCallback(txRequestClone);
4353
+ }
4127
4354
  const result = await this.estimateTxDependencies(txRequestClone);
4128
4355
  receipts = result.receipts;
4129
4356
  outputVariables = result.outputVariables;
4130
4357
  missingContractIds = result.missingContractIds;
4131
4358
  gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
4132
4359
  txRequestClone.gasLimit = gasUsed;
4133
- txRequestClone.gasPrice = setGasPrice;
4134
- ({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
4135
- transactionRequest: txRequestClone
4360
+ ({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
4361
+ transactionRequest: txRequestClone,
4362
+ gasPrice
4136
4363
  }));
4137
4364
  }
4138
4365
  return {
4139
4366
  requiredQuantities: allQuantities,
4140
4367
  receipts,
4141
4368
  gasUsed,
4142
- minGasPrice,
4143
- gasPrice: setGasPrice,
4369
+ gasPrice,
4144
4370
  minGas,
4145
4371
  maxGas,
4146
4372
  minFee,
4147
4373
  maxFee,
4148
- estimatedInputs: txRequestClone.inputs,
4149
4374
  outputVariables,
4150
- missingContractIds
4375
+ missingContractIds,
4376
+ addedSignatures,
4377
+ estimatedPredicates: txRequestClone.inputs
4151
4378
  };
4152
4379
  }
4153
- async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
4380
+ async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
4154
4381
  const ownerAddress = Address2.fromAddressOrString(owner);
4155
4382
  const transactionRequest = transactionRequestify(clone3(transactionRequestLike));
4156
- const transactionCost = await this.getTransactionCost(transactionRequest, forwardingQuantities);
4383
+ const transactionCost = await this.getTransactionCost(transactionRequest, {
4384
+ quantitiesToContract
4385
+ });
4157
4386
  transactionRequest.addResources(
4158
4387
  await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
4159
4388
  );
4160
- const { requiredQuantities, ...txCost } = await this.getTransactionCost(
4161
- transactionRequest,
4162
- forwardingQuantities
4163
- );
4389
+ const { requiredQuantities, ...txCost } = await this.getTransactionCost(transactionRequest, {
4390
+ quantitiesToContract
4391
+ });
4164
4392
  const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
4165
4393
  return {
4166
4394
  resources,
@@ -4182,11 +4410,10 @@ var _Provider = class {
4182
4410
  return coins.map((coin) => ({
4183
4411
  id: coin.utxoId,
4184
4412
  assetId: coin.assetId,
4185
- amount: bn15(coin.amount),
4413
+ amount: bn16(coin.amount),
4186
4414
  owner: Address2.fromAddressOrString(coin.owner),
4187
- maturity: bn15(coin.maturity).toNumber(),
4188
- blockCreated: bn15(coin.blockCreated),
4189
- txCreatedIdx: bn15(coin.txCreatedIdx)
4415
+ blockCreated: bn16(coin.blockCreated),
4416
+ txCreatedIdx: bn16(coin.txCreatedIdx)
4190
4417
  }));
4191
4418
  }
4192
4419
  /**
@@ -4223,9 +4450,9 @@ var _Provider = class {
4223
4450
  switch (coin.__typename) {
4224
4451
  case "MessageCoin":
4225
4452
  return {
4226
- amount: bn15(coin.amount),
4453
+ amount: bn16(coin.amount),
4227
4454
  assetId: coin.assetId,
4228
- daHeight: bn15(coin.daHeight),
4455
+ daHeight: bn16(coin.daHeight),
4229
4456
  sender: Address2.fromAddressOrString(coin.sender),
4230
4457
  recipient: Address2.fromAddressOrString(coin.recipient),
4231
4458
  nonce: coin.nonce
@@ -4233,12 +4460,11 @@ var _Provider = class {
4233
4460
  case "Coin":
4234
4461
  return {
4235
4462
  id: coin.utxoId,
4236
- amount: bn15(coin.amount),
4463
+ amount: bn16(coin.amount),
4237
4464
  assetId: coin.assetId,
4238
4465
  owner: Address2.fromAddressOrString(coin.owner),
4239
- maturity: bn15(coin.maturity).toNumber(),
4240
- blockCreated: bn15(coin.blockCreated),
4241
- txCreatedIdx: bn15(coin.txCreatedIdx)
4466
+ blockCreated: bn16(coin.blockCreated),
4467
+ txCreatedIdx: bn16(coin.txCreatedIdx)
4242
4468
  };
4243
4469
  default:
4244
4470
  return null;
@@ -4255,13 +4481,13 @@ var _Provider = class {
4255
4481
  async getBlock(idOrHeight) {
4256
4482
  let variables;
4257
4483
  if (typeof idOrHeight === "number") {
4258
- variables = { height: bn15(idOrHeight).toString(10) };
4484
+ variables = { height: bn16(idOrHeight).toString(10) };
4259
4485
  } else if (idOrHeight === "latest") {
4260
4486
  variables = { height: (await this.getBlockNumber()).toString(10) };
4261
4487
  } else if (idOrHeight.length === 66) {
4262
4488
  variables = { blockId: idOrHeight };
4263
4489
  } else {
4264
- variables = { blockId: bn15(idOrHeight).toString(10) };
4490
+ variables = { blockId: bn16(idOrHeight).toString(10) };
4265
4491
  }
4266
4492
  const { block } = await this.operations.getBlock(variables);
4267
4493
  if (!block) {
@@ -4269,7 +4495,7 @@ var _Provider = class {
4269
4495
  }
4270
4496
  return {
4271
4497
  id: block.id,
4272
- height: bn15(block.header.height),
4498
+ height: bn16(block.height),
4273
4499
  time: block.header.time,
4274
4500
  transactionIds: block.transactions.map((tx) => tx.id)
4275
4501
  };
@@ -4284,7 +4510,7 @@ var _Provider = class {
4284
4510
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4285
4511
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4286
4512
  id: block.id,
4287
- height: bn15(block.header.height),
4513
+ height: bn16(block.height),
4288
4514
  time: block.header.time,
4289
4515
  transactionIds: block.transactions.map((tx) => tx.id)
4290
4516
  }));
@@ -4299,7 +4525,7 @@ var _Provider = class {
4299
4525
  async getBlockWithTransactions(idOrHeight) {
4300
4526
  let variables;
4301
4527
  if (typeof idOrHeight === "number") {
4302
- variables = { blockHeight: bn15(idOrHeight).toString(10) };
4528
+ variables = { blockHeight: bn16(idOrHeight).toString(10) };
4303
4529
  } else if (idOrHeight === "latest") {
4304
4530
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4305
4531
  } else {
@@ -4311,7 +4537,7 @@ var _Provider = class {
4311
4537
  }
4312
4538
  return {
4313
4539
  id: block.id,
4314
- height: bn15(block.header.height, 10),
4540
+ height: bn16(block.height, 10),
4315
4541
  time: block.header.time,
4316
4542
  transactionIds: block.transactions.map((tx) => tx.id),
4317
4543
  transactions: block.transactions.map(
@@ -4360,7 +4586,7 @@ var _Provider = class {
4360
4586
  contract: Address2.fromAddressOrString(contractId).toB256(),
4361
4587
  asset: hexlify12(assetId)
4362
4588
  });
4363
- return bn15(contractBalance.amount, 10);
4589
+ return bn16(contractBalance.amount, 10);
4364
4590
  }
4365
4591
  /**
4366
4592
  * Returns the balance for the given owner for the given asset ID.
@@ -4374,7 +4600,7 @@ var _Provider = class {
4374
4600
  owner: Address2.fromAddressOrString(owner).toB256(),
4375
4601
  assetId: hexlify12(assetId)
4376
4602
  });
4377
- return bn15(balance.amount, 10);
4603
+ return bn16(balance.amount, 10);
4378
4604
  }
4379
4605
  /**
4380
4606
  * Returns balances for the given owner.
@@ -4392,7 +4618,7 @@ var _Provider = class {
4392
4618
  const balances = result.balances.edges.map((edge) => edge.node);
4393
4619
  return balances.map((balance) => ({
4394
4620
  assetId: balance.assetId,
4395
- amount: bn15(balance.amount)
4621
+ amount: bn16(balance.amount)
4396
4622
  }));
4397
4623
  }
4398
4624
  /**
@@ -4414,15 +4640,15 @@ var _Provider = class {
4414
4640
  sender: message.sender,
4415
4641
  recipient: message.recipient,
4416
4642
  nonce: message.nonce,
4417
- amount: bn15(message.amount),
4643
+ amount: bn16(message.amount),
4418
4644
  data: message.data
4419
4645
  }),
4420
4646
  sender: Address2.fromAddressOrString(message.sender),
4421
4647
  recipient: Address2.fromAddressOrString(message.recipient),
4422
4648
  nonce: message.nonce,
4423
- amount: bn15(message.amount),
4649
+ amount: bn16(message.amount),
4424
4650
  data: InputMessageCoder.decodeData(message.data),
4425
- daHeight: bn15(message.daHeight)
4651
+ daHeight: bn16(message.daHeight)
4426
4652
  }));
4427
4653
  }
4428
4654
  /**
@@ -4475,44 +4701,60 @@ var _Provider = class {
4475
4701
  } = result.messageProof;
4476
4702
  return {
4477
4703
  messageProof: {
4478
- proofIndex: bn15(messageProof.proofIndex),
4704
+ proofIndex: bn16(messageProof.proofIndex),
4479
4705
  proofSet: messageProof.proofSet
4480
4706
  },
4481
4707
  blockProof: {
4482
- proofIndex: bn15(blockProof.proofIndex),
4708
+ proofIndex: bn16(blockProof.proofIndex),
4483
4709
  proofSet: blockProof.proofSet
4484
4710
  },
4485
4711
  messageBlockHeader: {
4486
4712
  id: messageBlockHeader.id,
4487
- daHeight: bn15(messageBlockHeader.daHeight),
4488
- transactionsCount: bn15(messageBlockHeader.transactionsCount),
4713
+ daHeight: bn16(messageBlockHeader.daHeight),
4714
+ transactionsCount: bn16(messageBlockHeader.transactionsCount),
4489
4715
  transactionsRoot: messageBlockHeader.transactionsRoot,
4490
- height: bn15(messageBlockHeader.height),
4716
+ height: bn16(messageBlockHeader.height),
4491
4717
  prevRoot: messageBlockHeader.prevRoot,
4492
4718
  time: messageBlockHeader.time,
4493
4719
  applicationHash: messageBlockHeader.applicationHash,
4494
- messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
4495
- messageReceiptCount: bn15(messageBlockHeader.messageReceiptCount)
4720
+ messageReceiptCount: bn16(messageBlockHeader.messageReceiptCount),
4721
+ messageOutboxRoot: messageBlockHeader.messageOutboxRoot,
4722
+ consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
4723
+ eventInboxRoot: messageBlockHeader.eventInboxRoot,
4724
+ stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
4496
4725
  },
4497
4726
  commitBlockHeader: {
4498
4727
  id: commitBlockHeader.id,
4499
- daHeight: bn15(commitBlockHeader.daHeight),
4500
- transactionsCount: bn15(commitBlockHeader.transactionsCount),
4728
+ daHeight: bn16(commitBlockHeader.daHeight),
4729
+ transactionsCount: bn16(commitBlockHeader.transactionsCount),
4501
4730
  transactionsRoot: commitBlockHeader.transactionsRoot,
4502
- height: bn15(commitBlockHeader.height),
4731
+ height: bn16(commitBlockHeader.height),
4503
4732
  prevRoot: commitBlockHeader.prevRoot,
4504
4733
  time: commitBlockHeader.time,
4505
4734
  applicationHash: commitBlockHeader.applicationHash,
4506
- messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
4507
- messageReceiptCount: bn15(commitBlockHeader.messageReceiptCount)
4735
+ messageReceiptCount: bn16(commitBlockHeader.messageReceiptCount),
4736
+ messageOutboxRoot: commitBlockHeader.messageOutboxRoot,
4737
+ consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
4738
+ eventInboxRoot: commitBlockHeader.eventInboxRoot,
4739
+ stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
4508
4740
  },
4509
4741
  sender: Address2.fromAddressOrString(sender),
4510
4742
  recipient: Address2.fromAddressOrString(recipient),
4511
4743
  nonce,
4512
- amount: bn15(amount),
4744
+ amount: bn16(amount),
4513
4745
  data
4514
4746
  };
4515
4747
  }
4748
+ async getLatestGasPrice() {
4749
+ const { latestGasPrice } = await this.operations.getLatestGasPrice();
4750
+ return bn16(latestGasPrice.gasPrice);
4751
+ }
4752
+ async estimateGasPrice(blockHorizon) {
4753
+ const { estimateGasPrice } = await this.operations.estimateGasPrice({
4754
+ blockHorizon: String(blockHorizon)
4755
+ });
4756
+ return bn16(estimateGasPrice.gasPrice);
4757
+ }
4516
4758
  /**
4517
4759
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
4518
4760
  *
@@ -4532,10 +4774,10 @@ var _Provider = class {
4532
4774
  */
4533
4775
  async produceBlocks(amount, startTime) {
4534
4776
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4535
- blocksToProduce: bn15(amount).toString(10),
4777
+ blocksToProduce: bn16(amount).toString(10),
4536
4778
  startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4537
4779
  });
4538
- return bn15(latestBlockHeight);
4780
+ return bn16(latestBlockHeight);
4539
4781
  }
4540
4782
  // eslint-disable-next-line @typescript-eslint/require-await
4541
4783
  async getTransactionResponse(transactionId) {
@@ -4549,7 +4791,7 @@ cacheInputs_fn = function(inputs) {
4549
4791
  return;
4550
4792
  }
4551
4793
  inputs.forEach((input) => {
4552
- if (input.type === InputType6.Coin) {
4794
+ if (input.type === InputType7.Coin) {
4553
4795
  this.cache?.set(input.id);
4554
4796
  }
4555
4797
  });
@@ -4559,7 +4801,7 @@ __publicField(Provider, "nodeInfoCache", {});
4559
4801
 
4560
4802
  // src/providers/transaction-summary/get-transaction-summary.ts
4561
4803
  import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
4562
- import { bn as bn16 } from "@fuel-ts/math";
4804
+ import { bn as bn17 } from "@fuel-ts/math";
4563
4805
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4564
4806
  import { arrayify as arrayify12 } from "@fuel-ts/utils";
4565
4807
  async function getTransactionSummary(params) {
@@ -4577,21 +4819,28 @@ async function getTransactionSummary(params) {
4577
4819
  arrayify12(gqlTransaction.rawPayload),
4578
4820
  0
4579
4821
  );
4580
- const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
4822
+ let txReceipts = [];
4823
+ if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
4824
+ txReceipts = gqlTransaction.status.receipts;
4825
+ }
4826
+ const receipts = txReceipts.map(processGqlReceipt);
4581
4827
  const {
4582
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
4828
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
4583
4829
  } = provider.getChain();
4830
+ const gasPrice = await provider.getLatestGasPrice();
4584
4831
  const transactionInfo = assembleTransactionSummary({
4585
4832
  id: gqlTransaction.id,
4586
4833
  receipts,
4587
4834
  transaction: decodedTransaction,
4588
4835
  transactionBytes: arrayify12(gqlTransaction.rawPayload),
4589
4836
  gqlTransactionStatus: gqlTransaction.status,
4590
- gasPerByte: bn16(gasPerByte),
4591
- gasPriceFactor: bn16(gasPriceFactor),
4837
+ gasPerByte: bn17(gasPerByte),
4838
+ gasPriceFactor: bn17(gasPriceFactor),
4592
4839
  abiMap,
4593
4840
  maxInputs,
4594
- gasCosts
4841
+ gasCosts,
4842
+ maxGasPerTx,
4843
+ gasPrice
4595
4844
  });
4596
4845
  return {
4597
4846
  gqlTransaction,
@@ -4601,10 +4850,11 @@ async function getTransactionSummary(params) {
4601
4850
  async function getTransactionSummaryFromRequest(params) {
4602
4851
  const { provider, transactionRequest, abiMap } = params;
4603
4852
  const { receipts } = await provider.call(transactionRequest);
4604
- const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
4853
+ const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
4605
4854
  const maxInputs = provider.getChain().consensusParameters.maxInputs;
4606
4855
  const transaction = transactionRequest.toTransaction();
4607
4856
  const transactionBytes = transactionRequest.toTransactionBytes();
4857
+ const gasPrice = await provider.getLatestGasPrice();
4608
4858
  const transactionSummary = assembleTransactionSummary({
4609
4859
  receipts,
4610
4860
  transaction,
@@ -4613,7 +4863,9 @@ async function getTransactionSummaryFromRequest(params) {
4613
4863
  gasPerByte,
4614
4864
  gasPriceFactor,
4615
4865
  maxInputs,
4616
- gasCosts
4866
+ gasCosts,
4867
+ maxGasPerTx,
4868
+ gasPrice
4617
4869
  });
4618
4870
  return transactionSummary;
4619
4871
  }
@@ -4622,13 +4874,18 @@ async function getTransactionsSummaries(params) {
4622
4874
  const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
4623
4875
  const { edges, pageInfo } = transactionsByOwner;
4624
4876
  const {
4625
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
4877
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
4626
4878
  } = provider.getChain();
4879
+ const gasPrice = await provider.getLatestGasPrice();
4627
4880
  const transactions = edges.map((edge) => {
4628
4881
  const { node: gqlTransaction } = edge;
4629
- const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
4882
+ const { id, rawPayload, status } = gqlTransaction;
4630
4883
  const [decodedTransaction] = new TransactionCoder6().decode(arrayify12(rawPayload), 0);
4631
- const receipts = gqlReceipts?.map(processGqlReceipt) || [];
4884
+ let txReceipts = [];
4885
+ if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
4886
+ txReceipts = gqlTransaction.status.receipts;
4887
+ }
4888
+ const receipts = txReceipts.map(processGqlReceipt);
4632
4889
  const transactionSummary = assembleTransactionSummary({
4633
4890
  id,
4634
4891
  receipts,
@@ -4639,7 +4896,9 @@ async function getTransactionsSummaries(params) {
4639
4896
  gasPerByte,
4640
4897
  gasPriceFactor,
4641
4898
  maxInputs,
4642
- gasCosts
4899
+ gasCosts,
4900
+ maxGasPerTx,
4901
+ gasPrice
4643
4902
  });
4644
4903
  const output = {
4645
4904
  gqlTransaction,
@@ -4933,9 +5192,8 @@ var Account = class extends AbstractAccount {
4933
5192
  * @param assetId - The asset ID to check the balance for.
4934
5193
  * @returns A promise that resolves to the balance amount.
4935
5194
  */
4936
- async getBalance(assetId) {
4937
- const assetIdToFetch = assetId ?? this.provider.getBaseAssetId();
4938
- const amount = await this.provider.getBalance(this.address, assetIdToFetch);
5195
+ async getBalance(assetId = BaseAssetId3) {
5196
+ const amount = await this.provider.getBalance(this.address, assetId);
4939
5197
  return amount;
4940
5198
  }
4941
5199
  /**
@@ -4972,37 +5230,33 @@ var Account = class extends AbstractAccount {
4972
5230
  * @param fee - The estimated transaction fee.
4973
5231
  * @returns A promise that resolves when the resources are added to the transaction.
4974
5232
  */
4975
- async fund(request, coinQuantities, fee) {
4976
- const baseAssetId = this.provider.getBaseAssetId();
4977
- const updatedQuantities = addAmountToAsset({
4978
- amount: bn17(fee),
4979
- assetId: baseAssetId,
4980
- coinQuantities
5233
+ async fund(request, params) {
5234
+ const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
5235
+ const txRequest = request;
5236
+ const requiredQuantitiesWithFee = addAmountToCoinQuantities({
5237
+ amount: bn18(fee),
5238
+ assetId: BaseAssetId3,
5239
+ coinQuantities: requiredQuantities
4981
5240
  });
4982
5241
  const quantitiesDict = {};
4983
- updatedQuantities.forEach(({ amount, assetId }) => {
5242
+ requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
4984
5243
  quantitiesDict[assetId] = {
4985
5244
  required: amount,
4986
- owned: bn17(0)
5245
+ owned: bn18(0)
4987
5246
  };
4988
5247
  });
4989
- const cachedUtxos = [];
4990
- const cachedMessages = [];
4991
- const owner = this.address.toB256();
4992
- request.inputs.forEach((input) => {
5248
+ txRequest.inputs.forEach((input) => {
4993
5249
  const isResource = "amount" in input;
4994
5250
  if (isResource) {
4995
5251
  const isCoin2 = "owner" in input;
4996
5252
  if (isCoin2) {
4997
5253
  const assetId = String(input.assetId);
4998
- if (input.owner === owner && quantitiesDict[assetId]) {
4999
- const amount = bn17(input.amount);
5254
+ if (quantitiesDict[assetId]) {
5255
+ const amount = bn18(input.amount);
5000
5256
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
5001
- cachedUtxos.push(input.id);
5002
5257
  }
5003
- } else if (input.recipient === owner && input.amount && quantitiesDict[baseAssetId]) {
5004
- quantitiesDict[baseAssetId].owned = quantitiesDict[baseAssetId].owned.add(input.amount);
5005
- cachedMessages.push(input.nonce);
5258
+ } else if (input.amount && quantitiesDict[BaseAssetId3]) {
5259
+ quantitiesDict[BaseAssetId3].owned = quantitiesDict[BaseAssetId3].owned.add(input.amount);
5006
5260
  }
5007
5261
  }
5008
5262
  });
@@ -5017,12 +5271,23 @@ var Account = class extends AbstractAccount {
5017
5271
  });
5018
5272
  const needsToBeFunded = missingQuantities.length;
5019
5273
  if (needsToBeFunded) {
5020
- const resources = await this.getResourcesToSpend(missingQuantities, {
5021
- messages: cachedMessages,
5022
- utxos: cachedUtxos
5023
- });
5024
- request.addResources(resources);
5274
+ const excludedIds = cacheTxInputsFromOwner(txRequest.inputs, this.address.toB256());
5275
+ const resources = await this.getResourcesToSpend(missingQuantities, excludedIds);
5276
+ txRequest.addResources(resources);
5277
+ }
5278
+ txRequest.shiftPredicateData();
5279
+ txRequest.updatePredicateGasUsed(estimatedPredicates);
5280
+ const requestToBeReEstimate = clone4(txRequest);
5281
+ if (addedSignatures) {
5282
+ Array.from({ length: addedSignatures }).forEach(
5283
+ () => requestToBeReEstimate.addEmptyWitness()
5284
+ );
5025
5285
  }
5286
+ const { maxFee } = await this.provider.estimateTxGasAndFee({
5287
+ transactionRequest: requestToBeReEstimate
5288
+ });
5289
+ txRequest.maxFee = maxFee;
5290
+ return txRequest;
5026
5291
  }
5027
5292
  /**
5028
5293
  * A helper that creates a transfer transaction request and returns it.
@@ -5030,30 +5295,25 @@ var Account = class extends AbstractAccount {
5030
5295
  * @param destination - The address of the destination.
5031
5296
  * @param amount - The amount of coins to transfer.
5032
5297
  * @param assetId - The asset ID of the coins to transfer.
5033
- * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
5298
+ * @param txParams - The transaction parameters (gasLimit, tip, maturity, maxFee, witnessLimit).
5034
5299
  * @returns A promise that resolves to the prepared transaction request.
5035
5300
  */
5036
- async createTransfer(destination, amount, assetId, txParams = {}) {
5037
- const { minGasPrice } = this.provider.getGasConfig();
5038
- const baseAssetId = this.provider.getBaseAssetId();
5039
- const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5040
- const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
5041
- const request = new ScriptTransactionRequest(params);
5042
- request.addCoinOutput(Address3.fromAddressOrString(destination), amount, assetIdToTransfer);
5043
- const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
5301
+ async createTransfer(destination, amount, assetId = BaseAssetId3, txParams = {}) {
5302
+ const request = new ScriptTransactionRequest(txParams);
5303
+ request.addCoinOutput(Address3.fromAddressOrString(destination), amount, assetId);
5304
+ const txCost = await this.provider.getTransactionCost(request, {
5044
5305
  estimateTxDependencies: true,
5045
5306
  resourcesOwner: this
5046
5307
  });
5047
- request.gasPrice = bn17(txParams.gasPrice ?? minGasPrice);
5048
- request.gasLimit = bn17(txParams.gasLimit ?? gasUsed);
5049
- this.validateGas({
5050
- gasUsed,
5051
- gasPrice: request.gasPrice,
5052
- gasLimit: request.gasLimit,
5053
- minGasPrice
5054
- });
5055
- await this.fund(request, requiredQuantities, maxFee);
5056
- request.updatePredicateInputs(estimatedInputs);
5308
+ if ("gasLimit" in txParams) {
5309
+ this.validateGas({
5310
+ gasUsed: txCost.gasUsed,
5311
+ gasLimit: request.gasLimit
5312
+ });
5313
+ }
5314
+ request.gasLimit = txCost.gasUsed;
5315
+ request.maxFee = txCost.maxFee;
5316
+ await this.fund(request, txCost);
5057
5317
  return request;
5058
5318
  }
5059
5319
  /**
@@ -5065,15 +5325,14 @@ var Account = class extends AbstractAccount {
5065
5325
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
5066
5326
  * @returns A promise that resolves to the transaction response.
5067
5327
  */
5068
- async transfer(destination, amount, assetId, txParams = {}) {
5069
- if (bn17(amount).lte(0)) {
5328
+ async transfer(destination, amount, assetId = BaseAssetId3, txParams = {}) {
5329
+ if (bn18(amount).lte(0)) {
5070
5330
  throw new FuelError15(
5071
5331
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5072
5332
  "Transfer amount must be a positive number."
5073
5333
  );
5074
5334
  }
5075
- const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5076
- const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
5335
+ const request = await this.createTransfer(destination, amount, assetId, txParams);
5077
5336
  return this.sendTransaction(request, { estimateTxDependencies: false });
5078
5337
  }
5079
5338
  /**
@@ -5085,41 +5344,38 @@ var Account = class extends AbstractAccount {
5085
5344
  * @param txParams - The optional transaction parameters.
5086
5345
  * @returns A promise that resolves to the transaction response.
5087
5346
  */
5088
- async transferToContract(contractId, amount, assetId, txParams = {}) {
5089
- if (bn17(amount).lte(0)) {
5347
+ async transferToContract(contractId, amount, assetId = BaseAssetId3, txParams = {}) {
5348
+ if (bn18(amount).lte(0)) {
5090
5349
  throw new FuelError15(
5091
5350
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5092
5351
  "Transfer amount must be a positive number."
5093
5352
  );
5094
5353
  }
5095
5354
  const contractAddress = Address3.fromAddressOrString(contractId);
5096
- const { minGasPrice } = this.provider.getGasConfig();
5097
- const baseAssetId = this.provider.getBaseAssetId();
5098
- const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5099
- const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
5100
5355
  const { script, scriptData } = await assembleTransferToContractScript({
5101
5356
  hexlifiedContractId: contractAddress.toB256(),
5102
- amountToTransfer: bn17(amount),
5103
- assetId: assetIdToTransfer
5357
+ amountToTransfer: bn18(amount),
5358
+ assetId
5104
5359
  });
5105
5360
  const request = new ScriptTransactionRequest({
5106
- ...params,
5361
+ ...txParams,
5107
5362
  script,
5108
5363
  scriptData
5109
5364
  });
5110
5365
  request.addContractInputAndOutput(contractAddress);
5111
- const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
5112
- request,
5113
- [{ amount: bn17(amount), assetId: String(assetIdToTransfer) }]
5114
- );
5115
- request.gasLimit = bn17(params.gasLimit ?? gasUsed);
5116
- this.validateGas({
5117
- gasUsed,
5118
- gasPrice: request.gasPrice,
5119
- gasLimit: request.gasLimit,
5120
- minGasPrice
5366
+ const txCost = await this.provider.getTransactionCost(request, {
5367
+ resourcesOwner: this,
5368
+ quantitiesToContract: [{ amount: bn18(amount), assetId: String(assetId) }]
5121
5369
  });
5122
- await this.fund(request, requiredQuantities, maxFee);
5370
+ if (txParams.gasLimit) {
5371
+ this.validateGas({
5372
+ gasUsed: txCost.gasUsed,
5373
+ gasLimit: request.gasLimit
5374
+ });
5375
+ }
5376
+ request.gasLimit = txCost.gasUsed;
5377
+ request.maxFee = txCost.maxFee;
5378
+ await this.fund(request, txCost);
5123
5379
  return this.sendTransaction(request);
5124
5380
  }
5125
5381
  /**
@@ -5131,40 +5387,31 @@ var Account = class extends AbstractAccount {
5131
5387
  * @returns A promise that resolves to the transaction response.
5132
5388
  */
5133
5389
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
5134
- const { minGasPrice } = this.provider.getGasConfig();
5135
- const baseAssetId = this.provider.getBaseAssetId();
5136
5390
  const recipientAddress = Address3.fromAddressOrString(recipient);
5137
5391
  const recipientDataArray = arrayify14(
5138
5392
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5139
5393
  );
5140
5394
  const amountDataArray = arrayify14(
5141
- "0x".concat(bn17(amount).toHex().substring(2).padStart(16, "0"))
5395
+ "0x".concat(bn18(amount).toHex().substring(2).padStart(16, "0"))
5142
5396
  );
5143
5397
  const script = new Uint8Array([
5144
5398
  ...arrayify14(withdrawScript.bytes),
5145
5399
  ...recipientDataArray,
5146
5400
  ...amountDataArray
5147
5401
  ]);
5148
- const params = {
5149
- script,
5150
- gasPrice: minGasPrice,
5151
- baseAssetId,
5152
- ...txParams
5153
- };
5402
+ const params = { script, ...txParams };
5154
5403
  const request = new ScriptTransactionRequest(params);
5155
- const forwardingQuantities = [{ amount: bn17(amount), assetId: baseAssetId }];
5156
- const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
5157
- request,
5158
- forwardingQuantities
5159
- );
5160
- request.gasLimit = bn17(params.gasLimit ?? gasUsed);
5161
- this.validateGas({
5162
- gasUsed,
5163
- gasPrice: request.gasPrice,
5164
- gasLimit: request.gasLimit,
5165
- minGasPrice
5166
- });
5167
- await this.fund(request, requiredQuantities, maxFee);
5404
+ const quantitiesToContract = [{ amount: bn18(amount), assetId: BaseAssetId3 }];
5405
+ const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
5406
+ if (txParams.gasLimit) {
5407
+ this.validateGas({
5408
+ gasUsed: txCost.gasUsed,
5409
+ gasLimit: request.gasLimit
5410
+ });
5411
+ }
5412
+ request.maxFee = txCost.maxFee;
5413
+ request.gasLimit = txCost.gasUsed;
5414
+ await this.fund(request, txCost);
5168
5415
  return this.sendTransaction(request);
5169
5416
  }
5170
5417
  async signMessage(message) {
@@ -5222,18 +5469,7 @@ var Account = class extends AbstractAccount {
5222
5469
  }
5223
5470
  return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
5224
5471
  }
5225
- validateGas({
5226
- gasUsed,
5227
- gasPrice,
5228
- gasLimit,
5229
- minGasPrice
5230
- }) {
5231
- if (minGasPrice.gt(gasPrice)) {
5232
- throw new FuelError15(
5233
- ErrorCode15.GAS_PRICE_TOO_LOW,
5234
- `Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
5235
- );
5236
- }
5472
+ validateGas({ gasUsed, gasLimit }) {
5237
5473
  if (gasUsed.gt(gasLimit)) {
5238
5474
  throw new FuelError15(
5239
5475
  ErrorCode15.GAS_LIMIT_TOO_LOW,
@@ -5529,7 +5765,7 @@ var BaseWalletUnlocked = class extends Account {
5529
5765
  * @param transactionRequestLike - The transaction request to send.
5530
5766
  * @returns A promise that resolves to the TransactionResponse object.
5531
5767
  */
5532
- async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
5768
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
5533
5769
  const transactionRequest = transactionRequestify(transactionRequestLike);
5534
5770
  if (estimateTxDependencies) {
5535
5771
  await this.provider.estimateTxDependencies(transactionRequest);
@@ -5570,7 +5806,7 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5570
5806
  // src/hdwallet/hdwallet.ts
5571
5807
  import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
5572
5808
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
5573
- import { bn as bn18, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5809
+ import { bn as bn19, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5574
5810
  import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
5575
5811
  import { toBeHex, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58, computeHmac as computeHmac2, ripemd160 } from "ethers";
5576
5812
 
@@ -8042,7 +8278,7 @@ var HDWallet = class {
8042
8278
  const IR = bytes.slice(32);
8043
8279
  if (privateKey) {
8044
8280
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
8045
- const ki = bn18(IL).add(privateKey).mod(N).toBytes(32);
8281
+ const ki = bn19(IL).add(privateKey).mod(N).toBytes(32);
8046
8282
  return new HDWallet({
8047
8283
  privateKey: ki,
8048
8284
  chainCode: IR,
@@ -8729,8 +8965,9 @@ import {
8729
8965
  SCRIPT_FIXED_SIZE
8730
8966
  } from "@fuel-ts/abi-coder";
8731
8967
  import { Address as Address9 } from "@fuel-ts/address";
8968
+ import { BaseAssetId as BaseAssetId4 } from "@fuel-ts/address/configs";
8732
8969
  import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
8733
- import { ByteArrayCoder, InputType as InputType7 } from "@fuel-ts/transactions";
8970
+ import { ByteArrayCoder, InputType as InputType8 } from "@fuel-ts/transactions";
8734
8971
  import { arrayify as arrayify20, hexlify as hexlify19 } from "@fuel-ts/utils";
8735
8972
 
8736
8973
  // src/predicate/utils/getPredicateRoot.ts
@@ -8790,9 +9027,9 @@ var Predicate = class extends Account {
8790
9027
  const request = transactionRequestify(transactionRequestLike);
8791
9028
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
8792
9029
  request.inputs?.forEach((input) => {
8793
- if (input.type === InputType7.Coin && hexlify19(input.owner) === this.address.toB256()) {
8794
- input.predicate = this.bytes;
8795
- input.predicateData = this.getPredicateData(policies.length);
9030
+ if (input.type === InputType8.Coin && hexlify19(input.owner) === this.address.toB256()) {
9031
+ input.predicate = hexlify19(this.bytes);
9032
+ input.predicateData = hexlify19(this.getPredicateData(policies.length));
8796
9033
  }
8797
9034
  });
8798
9035
  return request;
@@ -8806,10 +9043,8 @@ var Predicate = class extends Account {
8806
9043
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
8807
9044
  * @returns A promise that resolves to the prepared transaction request.
8808
9045
  */
8809
- async createTransfer(destination, amount, assetId, txParams = {}) {
8810
- const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
8811
- const request = await super.createTransfer(destination, amount, assetIdToTransfer, txParams);
8812
- return this.populateTransactionPredicateData(request);
9046
+ async createTransfer(destination, amount, assetId = BaseAssetId4, txParams = {}) {
9047
+ return super.createTransfer(destination, amount, assetId, txParams);
8813
9048
  }
8814
9049
  /**
8815
9050
  * Sends a transaction with the populated predicate data.
@@ -8817,9 +9052,9 @@ var Predicate = class extends Account {
8817
9052
  * @param transactionRequestLike - The transaction request-like object.
8818
9053
  * @returns A promise that resolves to the transaction response.
8819
9054
  */
8820
- sendTransaction(transactionRequestLike, options) {
8821
- const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
8822
- return super.sendTransaction(transactionRequest, options);
9055
+ sendTransaction(transactionRequestLike) {
9056
+ const transactionRequest = transactionRequestify(transactionRequestLike);
9057
+ return super.sendTransaction(transactionRequest, { estimateTxDependencies: false });
8823
9058
  }
8824
9059
  /**
8825
9060
  * Simulates a transaction with the populated predicate data.
@@ -8828,8 +9063,8 @@ var Predicate = class extends Account {
8828
9063
  * @returns A promise that resolves to the call result.
8829
9064
  */
8830
9065
  simulateTransaction(transactionRequestLike) {
8831
- const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
8832
- return super.simulateTransaction(transactionRequest);
9066
+ const transactionRequest = transactionRequestify(transactionRequestLike);
9067
+ return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
8833
9068
  }
8834
9069
  getPredicateData(policiesLength) {
8835
9070
  if (!this.predicateData.length) {
@@ -8875,6 +9110,25 @@ var Predicate = class extends Account {
8875
9110
  predicateInterface: abiInterface
8876
9111
  };
8877
9112
  }
9113
+ /**
9114
+ * Retrieves resources satisfying the spend query for the account.
9115
+ *
9116
+ * @param quantities - IDs of coins to exclude.
9117
+ * @param excludedIds - IDs of resources to be excluded from the query.
9118
+ * @returns A promise that resolves to an array of Resources.
9119
+ */
9120
+ async getResourcesToSpend(quantities, excludedIds) {
9121
+ const resources = await this.provider.getResourcesToSpend(
9122
+ this.address,
9123
+ quantities,
9124
+ excludedIds
9125
+ );
9126
+ return resources.map((resource) => ({
9127
+ ...resource,
9128
+ predicate: hexlify19(this.bytes),
9129
+ paddPredicateData: (policiesLength) => hexlify19(this.getPredicateData(policiesLength))
9130
+ }));
9131
+ }
8878
9132
  /**
8879
9133
  * Sets the configurable constants for the predicate.
8880
9134
  *
@@ -9623,7 +9877,7 @@ export {
9623
9877
  WalletLocked,
9624
9878
  WalletManager,
9625
9879
  WalletUnlocked,
9626
- addAmountToAsset,
9880
+ addAmountToCoinQuantities,
9627
9881
  addOperation,
9628
9882
  assemblePanicError,
9629
9883
  assembleReceiptByType,
@@ -9632,9 +9886,10 @@ export {
9632
9886
  assets,
9633
9887
  buildBlockExplorerUrl,
9634
9888
  cacheFor,
9889
+ cacheTxInputsFromOwner,
9890
+ calculateGasFee,
9635
9891
  calculateMetadataGasForTxCreate,
9636
9892
  calculateMetadataGasForTxScript,
9637
- calculatePriceWithFactor,
9638
9893
  calculateTransactionFee,
9639
9894
  coinQuantityfy,
9640
9895
  deferPromise,