@fuel-ts/account 0.0.0-rc-2021-20240424175107 → 0.0.0-rc-2037-20240424175231

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 (66) hide show
  1. package/README.md +1 -1
  2. package/dist/account.d.ts +6 -7
  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 +622 -814
  12. package/dist/index.global.js.map +1 -1
  13. package/dist/index.js +659 -837
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +478 -661
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/predicate/predicate.d.ts +39 -12
  18. package/dist/predicate/predicate.d.ts.map +1 -1
  19. package/dist/providers/__generated__/operations.d.ts +359 -810
  20. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  21. package/dist/providers/coin-quantity.d.ts +1 -1
  22. package/dist/providers/coin-quantity.d.ts.map +1 -1
  23. package/dist/providers/coin.d.ts +1 -2
  24. package/dist/providers/coin.d.ts.map +1 -1
  25. package/dist/providers/message.d.ts +1 -6
  26. package/dist/providers/message.d.ts.map +1 -1
  27. package/dist/providers/provider.d.ts +27 -37
  28. package/dist/providers/provider.d.ts.map +1 -1
  29. package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
  30. package/dist/providers/transaction-request/helpers.d.ts +10 -0
  31. package/dist/providers/transaction-request/helpers.d.ts.map +1 -0
  32. package/dist/providers/transaction-request/index.d.ts +1 -0
  33. package/dist/providers/transaction-request/index.d.ts.map +1 -1
  34. package/dist/providers/transaction-request/input.d.ts +2 -2
  35. package/dist/providers/transaction-request/input.d.ts.map +1 -1
  36. package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
  37. package/dist/providers/transaction-request/transaction-request.d.ts +11 -6
  38. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  39. package/dist/providers/transaction-request/utils.d.ts +0 -3
  40. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  41. package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
  42. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +0 -2
  43. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
  44. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +2 -3
  45. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +1 -1
  46. package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
  47. package/dist/providers/utils/gas.d.ts +2 -8
  48. package/dist/providers/utils/gas.d.ts.map +1 -1
  49. package/dist/test-utils/index.d.ts +1 -0
  50. package/dist/test-utils/index.d.ts.map +1 -1
  51. package/dist/test-utils/launchNode.d.ts.map +1 -1
  52. package/dist/test-utils/resources.d.ts +4 -0
  53. package/dist/test-utils/resources.d.ts.map +1 -0
  54. package/dist/test-utils/seedTestWallet.d.ts +1 -1
  55. package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
  56. package/dist/test-utils/transactionRequest.d.ts +5 -0
  57. package/dist/test-utils/transactionRequest.d.ts.map +1 -0
  58. package/dist/test-utils.global.js +1089 -1533
  59. package/dist/test-utils.global.js.map +1 -1
  60. package/dist/test-utils.js +624 -820
  61. package/dist/test-utils.js.map +1 -1
  62. package/dist/test-utils.mjs +457 -656
  63. package/dist/test-utils.mjs.map +1 -1
  64. package/dist/wallet/base-wallet-unlocked.d.ts +2 -2
  65. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  66. package/package.json +16 -16
package/dist/index.mjs CHANGED
@@ -32,9 +32,8 @@ import { Address as Address3 } from "@fuel-ts/address";
32
32
  import { BaseAssetId as BaseAssetId3 } from "@fuel-ts/address/configs";
33
33
  import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
34
34
  import { AbstractAccount } from "@fuel-ts/interfaces";
35
- import { bn as bn18 } from "@fuel-ts/math";
36
- import { arrayify as arrayify14, isDefined } from "@fuel-ts/utils";
37
- import { clone as clone4 } from "ramda";
35
+ import { bn as bn17 } from "@fuel-ts/math";
36
+ import { arrayify as arrayify14 } from "@fuel-ts/utils";
38
37
 
39
38
  // src/providers/coin-quantity.ts
40
39
  import { BaseAssetId } from "@fuel-ts/address/configs";
@@ -43,24 +42,24 @@ import { hexlify } from "@fuel-ts/utils";
43
42
  var coinQuantityfy = (coinQuantityLike) => {
44
43
  let assetId;
45
44
  let amount;
46
- let max;
45
+ let max2;
47
46
  if (Array.isArray(coinQuantityLike)) {
48
47
  amount = coinQuantityLike[0];
49
48
  assetId = coinQuantityLike[1] ?? BaseAssetId;
50
- max = coinQuantityLike[2] ?? void 0;
49
+ max2 = coinQuantityLike[2] ?? void 0;
51
50
  } else {
52
51
  amount = coinQuantityLike.amount;
53
52
  assetId = coinQuantityLike.assetId ?? BaseAssetId;
54
- max = coinQuantityLike.max ?? void 0;
53
+ max2 = coinQuantityLike.max ?? void 0;
55
54
  }
56
55
  const bnAmount = bn(amount);
57
56
  return {
58
57
  assetId: hexlify(assetId),
59
58
  amount: bnAmount.lt(1) ? bn(1) : bnAmount,
60
- max: max ? bn(max) : void 0
59
+ max: max2 ? bn(max2) : void 0
61
60
  };
62
61
  };
63
- var addAmountToCoinQuantities = (params) => {
62
+ var addAmountToAsset = (params) => {
64
63
  const { amount, assetId } = params;
65
64
  const coinQuantities = [...params.coinQuantities];
66
65
  const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
@@ -75,7 +74,7 @@ var addAmountToCoinQuantities = (params) => {
75
74
  // src/providers/provider.ts
76
75
  import { Address as Address2 } from "@fuel-ts/address";
77
76
  import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
78
- import { BN, bn as bn16 } from "@fuel-ts/math";
77
+ import { BN, bn as bn15, max } from "@fuel-ts/math";
79
78
  import {
80
79
  InputType as InputType7,
81
80
  TransactionType as TransactionType8,
@@ -91,20 +90,16 @@ import { clone as clone3 } from "ramda";
91
90
 
92
91
  // src/providers/__generated__/operations.ts
93
92
  import gql from "graphql-tag";
94
- var TransactionStatusSubscriptionFragmentFragmentDoc = gql`
95
- fragment transactionStatusSubscriptionFragment on TransactionStatus {
96
- type: __typename
97
- ... on SqueezedOutStatus {
98
- reason
99
- }
100
- }
101
- `;
102
93
  var ReceiptFragmentFragmentDoc = gql`
103
94
  fragment receiptFragment on Receipt {
104
- id
95
+ contract {
96
+ id
97
+ }
105
98
  pc
106
99
  is
107
- to
100
+ to {
101
+ id
102
+ }
108
103
  toAddress
109
104
  amount
110
105
  assetId
@@ -142,16 +137,10 @@ var TransactionStatusFragmentFragmentDoc = gql`
142
137
  id
143
138
  }
144
139
  time
145
- receipts {
146
- ...receiptFragment
147
- }
148
140
  programState {
149
141
  returnType
150
142
  data
151
143
  }
152
- receipts {
153
- ...receiptFragment
154
- }
155
144
  }
156
145
  ... on FailureStatus {
157
146
  block {
@@ -159,24 +148,26 @@ var TransactionStatusFragmentFragmentDoc = gql`
159
148
  }
160
149
  time
161
150
  reason
162
- receipts {
163
- ...receiptFragment
164
- }
165
151
  }
166
152
  ... on SqueezedOutStatus {
167
153
  reason
168
154
  }
169
155
  }
170
- ${ReceiptFragmentFragmentDoc}`;
156
+ `;
171
157
  var TransactionFragmentFragmentDoc = gql`
172
158
  fragment transactionFragment on Transaction {
173
159
  id
174
160
  rawPayload
161
+ gasPrice
162
+ receipts {
163
+ ...receiptFragment
164
+ }
175
165
  status {
176
166
  ...transactionStatusFragment
177
167
  }
178
168
  }
179
- ${TransactionStatusFragmentFragmentDoc}`;
169
+ ${ReceiptFragmentFragmentDoc}
170
+ ${TransactionStatusFragmentFragmentDoc}`;
180
171
  var InputEstimatePredicatesFragmentFragmentDoc = gql`
181
172
  fragment inputEstimatePredicatesFragment on Input {
182
173
  ... on InputCoin {
@@ -194,46 +185,6 @@ var TransactionEstimatePredicatesFragmentFragmentDoc = gql`
194
185
  }
195
186
  }
196
187
  ${InputEstimatePredicatesFragmentFragmentDoc}`;
197
- var DryRunFailureStatusFragmentFragmentDoc = gql`
198
- fragment dryRunFailureStatusFragment on DryRunFailureStatus {
199
- reason
200
- programState {
201
- returnType
202
- data
203
- }
204
- }
205
- `;
206
- var DryRunSuccessStatusFragmentFragmentDoc = gql`
207
- fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
208
- programState {
209
- returnType
210
- data
211
- }
212
- }
213
- `;
214
- var DryRunTransactionStatusFragmentFragmentDoc = gql`
215
- fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
216
- ... on DryRunFailureStatus {
217
- ...dryRunFailureStatusFragment
218
- }
219
- ... on DryRunSuccessStatus {
220
- ...dryRunSuccessStatusFragment
221
- }
222
- }
223
- ${DryRunFailureStatusFragmentFragmentDoc}
224
- ${DryRunSuccessStatusFragmentFragmentDoc}`;
225
- var DryRunTransactionExecutionStatusFragmentFragmentDoc = gql`
226
- fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
227
- id
228
- status {
229
- ...dryRunTransactionStatusFragment
230
- }
231
- receipts {
232
- ...receiptFragment
233
- }
234
- }
235
- ${DryRunTransactionStatusFragmentFragmentDoc}
236
- ${ReceiptFragmentFragmentDoc}`;
237
188
  var CoinFragmentFragmentDoc = gql`
238
189
  fragment coinFragment on Coin {
239
190
  __typename
@@ -241,6 +192,7 @@ var CoinFragmentFragmentDoc = gql`
241
192
  owner
242
193
  amount
243
194
  assetId
195
+ maturity
244
196
  blockCreated
245
197
  txCreatedIdx
246
198
  }
@@ -279,32 +231,26 @@ var MessageProofFragmentFragmentDoc = gql`
279
231
  messageBlockHeader {
280
232
  id
281
233
  daHeight
282
- consensusParametersVersion
283
- stateTransitionBytecodeVersion
284
234
  transactionsCount
285
- messageReceiptCount
286
235
  transactionsRoot
287
- messageOutboxRoot
288
- eventInboxRoot
289
236
  height
290
237
  prevRoot
291
238
  time
292
239
  applicationHash
240
+ messageReceiptRoot
241
+ messageReceiptCount
293
242
  }
294
243
  commitBlockHeader {
295
244
  id
296
245
  daHeight
297
- consensusParametersVersion
298
- stateTransitionBytecodeVersion
299
246
  transactionsCount
300
- messageReceiptCount
301
247
  transactionsRoot
302
- messageOutboxRoot
303
- eventInboxRoot
304
248
  height
305
249
  prevRoot
306
250
  time
307
251
  applicationHash
252
+ messageReceiptRoot
253
+ messageReceiptCount
308
254
  }
309
255
  sender
310
256
  recipient
@@ -323,8 +269,8 @@ var BalanceFragmentFragmentDoc = gql`
323
269
  var BlockFragmentFragmentDoc = gql`
324
270
  fragment blockFragment on Block {
325
271
  id
326
- height
327
272
  header {
273
+ height
328
274
  time
329
275
  }
330
276
  transactions {
@@ -334,7 +280,6 @@ var BlockFragmentFragmentDoc = gql`
334
280
  `;
335
281
  var TxParametersFragmentFragmentDoc = gql`
336
282
  fragment TxParametersFragment on TxParameters {
337
- version
338
283
  maxInputs
339
284
  maxOutputs
340
285
  maxWitnesses
@@ -344,7 +289,6 @@ var TxParametersFragmentFragmentDoc = gql`
344
289
  `;
345
290
  var PredicateParametersFragmentFragmentDoc = gql`
346
291
  fragment PredicateParametersFragment on PredicateParameters {
347
- version
348
292
  maxPredicateLength
349
293
  maxPredicateDataLength
350
294
  maxGasPerPredicate
@@ -353,21 +297,18 @@ var PredicateParametersFragmentFragmentDoc = gql`
353
297
  `;
354
298
  var ScriptParametersFragmentFragmentDoc = gql`
355
299
  fragment ScriptParametersFragment on ScriptParameters {
356
- version
357
300
  maxScriptLength
358
301
  maxScriptDataLength
359
302
  }
360
303
  `;
361
304
  var ContractParametersFragmentFragmentDoc = gql`
362
305
  fragment ContractParametersFragment on ContractParameters {
363
- version
364
306
  contractMaxSize
365
307
  maxStorageSlots
366
308
  }
367
309
  `;
368
310
  var FeeParametersFragmentFragmentDoc = gql`
369
311
  fragment FeeParametersFragment on FeeParameters {
370
- version
371
312
  gasPriceFactor
372
313
  gasPerByte
373
314
  }
@@ -387,7 +328,6 @@ var DependentCostFragmentFragmentDoc = gql`
387
328
  `;
388
329
  var GasCostsFragmentFragmentDoc = gql`
389
330
  fragment GasCostsFragment on GasCosts {
390
- version
391
331
  add
392
332
  addi
393
333
  aloc
@@ -400,6 +340,7 @@ var GasCostsFragmentFragmentDoc = gql`
400
340
  cb
401
341
  cfei
402
342
  cfsi
343
+ croo
403
344
  div
404
345
  divi
405
346
  ecr1
@@ -482,9 +423,6 @@ var GasCostsFragmentFragmentDoc = gql`
482
423
  ccp {
483
424
  ...DependentCostFragment
484
425
  }
485
- croo {
486
- ...DependentCostFragment
487
- }
488
426
  csiz {
489
427
  ...DependentCostFragment
490
428
  }
@@ -544,7 +482,6 @@ var GasCostsFragmentFragmentDoc = gql`
544
482
  ${DependentCostFragmentFragmentDoc}`;
545
483
  var ConsensusParametersFragmentFragmentDoc = gql`
546
484
  fragment consensusParametersFragment on ConsensusParameters {
547
- version
548
485
  txParams {
549
486
  ...TxParametersFragment
550
487
  }
@@ -604,9 +541,18 @@ var NodeInfoFragmentFragmentDoc = gql`
604
541
  fragment nodeInfoFragment on NodeInfo {
605
542
  utxoValidation
606
543
  vmBacktrace
544
+ minGasPrice
607
545
  maxTx
608
546
  maxDepth
609
547
  nodeVersion
548
+ peers {
549
+ id
550
+ addresses
551
+ clientVersion
552
+ blockHeight
553
+ lastHeartbeatMs
554
+ appScore
555
+ }
610
556
  }
611
557
  `;
612
558
  var GetVersionDocument = gql`
@@ -641,9 +587,13 @@ var GetTransactionWithReceiptsDocument = gql`
641
587
  query getTransactionWithReceipts($transactionId: TransactionId!) {
642
588
  transaction(id: $transactionId) {
643
589
  ...transactionFragment
590
+ receipts {
591
+ ...receiptFragment
592
+ }
644
593
  }
645
594
  }
646
- ${TransactionFragmentFragmentDoc}`;
595
+ ${TransactionFragmentFragmentDoc}
596
+ ${ReceiptFragmentFragmentDoc}`;
647
597
  var GetTransactionsDocument = gql`
648
598
  query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
649
599
  transactions(after: $after, before: $before, first: $first, last: $last) {
@@ -771,20 +721,6 @@ var GetBalanceDocument = gql`
771
721
  }
772
722
  }
773
723
  ${BalanceFragmentFragmentDoc}`;
774
- var GetLatestGasPriceDocument = gql`
775
- query getLatestGasPrice {
776
- latestGasPrice {
777
- gasPrice
778
- }
779
- }
780
- `;
781
- var EstimateGasPriceDocument = gql`
782
- query estimateGasPrice($blockHorizon: U32!) {
783
- estimateGasPrice(blockHorizon: $blockHorizon) {
784
- gasPrice
785
- }
786
- }
787
- `;
788
724
  var GetBalancesDocument = gql`
789
725
  query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
790
726
  balances(
@@ -839,12 +775,12 @@ var GetMessageStatusDocument = gql`
839
775
  }
840
776
  `;
841
777
  var DryRunDocument = gql`
842
- mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
843
- dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
844
- ...dryRunTransactionExecutionStatusFragment
778
+ mutation dryRun($encodedTransaction: HexString!, $utxoValidation: Boolean) {
779
+ dryRun(tx: $encodedTransaction, utxoValidation: $utxoValidation) {
780
+ ...receiptFragment
845
781
  }
846
782
  }
847
- ${DryRunTransactionExecutionStatusFragmentFragmentDoc}`;
783
+ ${ReceiptFragmentFragmentDoc}`;
848
784
  var SubmitDocument = gql`
849
785
  mutation submit($encodedTransaction: HexString!) {
850
786
  submit(tx: $encodedTransaction) {
@@ -863,17 +799,17 @@ var ProduceBlocksDocument = gql`
863
799
  var SubmitAndAwaitDocument = gql`
864
800
  subscription submitAndAwait($encodedTransaction: HexString!) {
865
801
  submitAndAwait(tx: $encodedTransaction) {
866
- ...transactionStatusSubscriptionFragment
802
+ ...transactionStatusFragment
867
803
  }
868
804
  }
869
- ${TransactionStatusSubscriptionFragmentFragmentDoc}`;
805
+ ${TransactionStatusFragmentFragmentDoc}`;
870
806
  var StatusChangeDocument = gql`
871
807
  subscription statusChange($transactionId: TransactionId!) {
872
808
  statusChange(id: $transactionId) {
873
- ...transactionStatusSubscriptionFragment
809
+ ...transactionStatusFragment
874
810
  }
875
811
  }
876
- ${TransactionStatusSubscriptionFragmentFragmentDoc}`;
812
+ ${TransactionStatusFragmentFragmentDoc}`;
877
813
  function getSdk(requester) {
878
814
  return {
879
815
  getVersion(variables, options) {
@@ -927,12 +863,6 @@ function getSdk(requester) {
927
863
  getBalance(variables, options) {
928
864
  return requester(GetBalanceDocument, variables, options);
929
865
  },
930
- getLatestGasPrice(variables, options) {
931
- return requester(GetLatestGasPriceDocument, variables, options);
932
- },
933
- estimateGasPrice(variables, options) {
934
- return requester(EstimateGasPriceDocument, variables, options);
935
- },
936
866
  getBalances(variables, options) {
937
867
  return requester(GetBalancesDocument, variables, options);
938
868
  },
@@ -1126,9 +1056,10 @@ var inputify = (value) => {
1126
1056
  txIndex: toNumber(arrayify(value.txPointer).slice(8, 16))
1127
1057
  },
1128
1058
  witnessIndex: value.witnessIndex,
1059
+ maturity: value.maturity ?? 0,
1129
1060
  predicateGasUsed: bn2(value.predicateGasUsed),
1130
- predicateLength: bn2(predicate.length),
1131
- predicateDataLength: bn2(predicateData.length),
1061
+ predicateLength: predicate.length,
1062
+ predicateDataLength: predicateData.length,
1132
1063
  predicate: hexlify3(predicate),
1133
1064
  predicateData: hexlify3(predicateData)
1134
1065
  };
@@ -1159,8 +1090,8 @@ var inputify = (value) => {
1159
1090
  nonce: hexlify3(value.nonce),
1160
1091
  witnessIndex: value.witnessIndex,
1161
1092
  predicateGasUsed: bn2(value.predicateGasUsed),
1162
- predicateLength: bn2(predicate.length),
1163
- predicateDataLength: bn2(predicateData.length),
1093
+ predicateLength: predicate.length,
1094
+ predicateDataLength: predicateData.length,
1164
1095
  predicate: hexlify3(predicate),
1165
1096
  predicateData: hexlify3(predicateData),
1166
1097
  data: hexlify3(data),
@@ -1242,7 +1173,7 @@ import { bn as bn7 } from "@fuel-ts/math";
1242
1173
  import {
1243
1174
  PolicyType,
1244
1175
  TransactionCoder,
1245
- InputType as InputType2,
1176
+ InputType as InputType3,
1246
1177
  OutputType as OutputType2,
1247
1178
  TransactionType
1248
1179
  } from "@fuel-ts/transactions";
@@ -1290,8 +1221,8 @@ function assembleReceiptByType(receipt) {
1290
1221
  case "CALL" /* Call */: {
1291
1222
  const callReceipt = {
1292
1223
  type: ReceiptType.Call,
1293
- from: hexOrZero(receipt.id || receipt.contractId),
1294
- to: hexOrZero(receipt?.to),
1224
+ from: hexOrZero(receipt.contract?.id),
1225
+ to: hexOrZero(receipt?.to?.id),
1295
1226
  amount: bn4(receipt.amount),
1296
1227
  assetId: hexOrZero(receipt.assetId),
1297
1228
  gas: bn4(receipt.gas),
@@ -1305,7 +1236,7 @@ function assembleReceiptByType(receipt) {
1305
1236
  case "RETURN" /* Return */: {
1306
1237
  const returnReceipt = {
1307
1238
  type: ReceiptType.Return,
1308
- id: hexOrZero(receipt.id || receipt.contractId),
1239
+ id: hexOrZero(receipt.contract?.id),
1309
1240
  val: bn4(receipt.val),
1310
1241
  pc: bn4(receipt.pc),
1311
1242
  is: bn4(receipt.is)
@@ -1315,7 +1246,7 @@ function assembleReceiptByType(receipt) {
1315
1246
  case "RETURN_DATA" /* ReturnData */: {
1316
1247
  const returnDataReceipt = {
1317
1248
  type: ReceiptType.ReturnData,
1318
- id: hexOrZero(receipt.id || receipt.contractId),
1249
+ id: hexOrZero(receipt.contract?.id),
1319
1250
  ptr: bn4(receipt.ptr),
1320
1251
  len: bn4(receipt.len),
1321
1252
  digest: hexOrZero(receipt.digest),
@@ -1327,7 +1258,7 @@ function assembleReceiptByType(receipt) {
1327
1258
  case "PANIC" /* Panic */: {
1328
1259
  const panicReceipt = {
1329
1260
  type: ReceiptType.Panic,
1330
- id: hexOrZero(receipt.id),
1261
+ id: hexOrZero(receipt.contract?.id),
1331
1262
  reason: bn4(receipt.reason),
1332
1263
  pc: bn4(receipt.pc),
1333
1264
  is: bn4(receipt.is),
@@ -1338,7 +1269,7 @@ function assembleReceiptByType(receipt) {
1338
1269
  case "REVERT" /* Revert */: {
1339
1270
  const revertReceipt = {
1340
1271
  type: ReceiptType.Revert,
1341
- id: hexOrZero(receipt.id || receipt.contractId),
1272
+ id: hexOrZero(receipt.contract?.id),
1342
1273
  val: bn4(receipt.ra),
1343
1274
  pc: bn4(receipt.pc),
1344
1275
  is: bn4(receipt.is)
@@ -1348,7 +1279,7 @@ function assembleReceiptByType(receipt) {
1348
1279
  case "LOG" /* Log */: {
1349
1280
  const logReceipt = {
1350
1281
  type: ReceiptType.Log,
1351
- id: hexOrZero(receipt.id || receipt.contractId),
1282
+ id: hexOrZero(receipt.contract?.id),
1352
1283
  val0: bn4(receipt.ra),
1353
1284
  val1: bn4(receipt.rb),
1354
1285
  val2: bn4(receipt.rc),
@@ -1361,7 +1292,7 @@ function assembleReceiptByType(receipt) {
1361
1292
  case "LOG_DATA" /* LogData */: {
1362
1293
  const logDataReceipt = {
1363
1294
  type: ReceiptType.LogData,
1364
- id: hexOrZero(receipt.id || receipt.contractId),
1295
+ id: hexOrZero(receipt.contract?.id),
1365
1296
  val0: bn4(receipt.ra),
1366
1297
  val1: bn4(receipt.rb),
1367
1298
  ptr: bn4(receipt.ptr),
@@ -1375,8 +1306,8 @@ function assembleReceiptByType(receipt) {
1375
1306
  case "TRANSFER" /* Transfer */: {
1376
1307
  const transferReceipt = {
1377
1308
  type: ReceiptType.Transfer,
1378
- from: hexOrZero(receipt.id || receipt.contractId),
1379
- to: hexOrZero(receipt.toAddress || receipt?.to),
1309
+ from: hexOrZero(receipt.contract?.id),
1310
+ to: hexOrZero(receipt.toAddress || receipt?.to?.id),
1380
1311
  amount: bn4(receipt.amount),
1381
1312
  assetId: hexOrZero(receipt.assetId),
1382
1313
  pc: bn4(receipt.pc),
@@ -1387,8 +1318,8 @@ function assembleReceiptByType(receipt) {
1387
1318
  case "TRANSFER_OUT" /* TransferOut */: {
1388
1319
  const transferOutReceipt = {
1389
1320
  type: ReceiptType.TransferOut,
1390
- from: hexOrZero(receipt.id || receipt.contractId),
1391
- to: hexOrZero(receipt.toAddress || receipt.to),
1321
+ from: hexOrZero(receipt.contract?.id),
1322
+ to: hexOrZero(receipt.toAddress || receipt.to?.id),
1392
1323
  amount: bn4(receipt.amount),
1393
1324
  assetId: hexOrZero(receipt.assetId),
1394
1325
  pc: bn4(receipt.pc),
@@ -1431,7 +1362,7 @@ function assembleReceiptByType(receipt) {
1431
1362
  return receiptMessageOut;
1432
1363
  }
1433
1364
  case "MINT" /* Mint */: {
1434
- const contractId = hexOrZero(receipt.id || receipt.contractId);
1365
+ const contractId = hexOrZero(receipt.contract?.id);
1435
1366
  const subId = hexOrZero(receipt.subId);
1436
1367
  const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
1437
1368
  const mintReceipt = {
@@ -1446,7 +1377,7 @@ function assembleReceiptByType(receipt) {
1446
1377
  return mintReceipt;
1447
1378
  }
1448
1379
  case "BURN" /* Burn */: {
1449
- const contractId = hexOrZero(receipt.id || receipt.contractId);
1380
+ const contractId = hexOrZero(receipt.contract?.id);
1450
1381
  const subId = hexOrZero(receipt.subId);
1451
1382
  const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
1452
1383
  const burnReceipt = {
@@ -1531,6 +1462,7 @@ var buildBlockExplorerUrl = (options = {}) => {
1531
1462
  import { bn as bn5 } from "@fuel-ts/math";
1532
1463
  import { ReceiptType as ReceiptType2 } from "@fuel-ts/transactions";
1533
1464
  import { arrayify as arrayify3 } from "@fuel-ts/utils";
1465
+ var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn5(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
1534
1466
  var getGasUsedFromReceipts = (receipts) => {
1535
1467
  const scriptResult = receipts.filter(
1536
1468
  (receipt) => receipt.type === ReceiptType2.ScriptResult
@@ -1551,28 +1483,18 @@ function resolveGasDependentCosts(byteSize, gasDependentCost) {
1551
1483
  }
1552
1484
  function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
1553
1485
  const witnessCache = [];
1554
- const chargeableInputs = inputs.filter((input) => {
1555
- const isCoinOrMessage = "owner" in input || "sender" in input;
1556
- if (isCoinOrMessage) {
1557
- if ("predicate" in input && input.predicate && input.predicate !== "0x") {
1558
- return true;
1559
- }
1560
- if (!witnessCache.includes(input.witnessIndex)) {
1561
- witnessCache.push(input.witnessIndex);
1562
- return true;
1563
- }
1564
- }
1565
- return false;
1566
- });
1567
- const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
1568
- const totalGas = chargeableInputs.reduce((total, input) => {
1486
+ const totalGas = inputs.reduce((total, input) => {
1569
1487
  if ("predicate" in input && input.predicate && input.predicate !== "0x") {
1570
1488
  return total.add(
1571
- vmInitializationCost.add(resolveGasDependentCosts(arrayify3(input.predicate).length, gasCosts.contractRoot)).add(bn5(input.predicateGasUsed))
1489
+ resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts(arrayify3(input.predicate).length, gasCosts.contractRoot)).add(bn5(input.predicateGasUsed))
1572
1490
  );
1573
1491
  }
1574
- return total.add(gasCosts.ecr1);
1575
- }, bn5(0));
1492
+ if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
1493
+ witnessCache.push(input.witnessIndex);
1494
+ return total.add(gasCosts.ecr1);
1495
+ }
1496
+ return total;
1497
+ }, bn5());
1576
1498
  return totalGas;
1577
1499
  }
1578
1500
  function getMinGas(params) {
@@ -1584,20 +1506,12 @@ function getMinGas(params) {
1584
1506
  return minGas;
1585
1507
  }
1586
1508
  function getMaxGas(params) {
1587
- const {
1588
- gasPerByte,
1589
- witnessesLength,
1590
- witnessLimit,
1591
- minGas,
1592
- gasLimit = bn5(0),
1593
- maxGasPerTx
1594
- } = params;
1509
+ const { gasPerByte, witnessesLength, witnessLimit, minGas, gasLimit = bn5(0) } = params;
1595
1510
  let remainingAllowedWitnessGas = bn5(0);
1596
1511
  if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
1597
1512
  remainingAllowedWitnessGas = bn5(witnessLimit).sub(witnessesLength).mul(gasPerByte);
1598
1513
  }
1599
- const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
1600
- return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
1514
+ return remainingAllowedWitnessGas.add(minGas).add(gasLimit);
1601
1515
  }
1602
1516
  function calculateMetadataGasForTxCreate({
1603
1517
  gasCosts,
@@ -1619,10 +1533,6 @@ function calculateMetadataGasForTxScript({
1619
1533
  }) {
1620
1534
  return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
1621
1535
  }
1622
- var calculateGasFee = (params) => {
1623
- const { gas, gasPrice, priceFactor, tip } = params;
1624
- return gas.mul(gasPrice).div(priceFactor).add(tip);
1625
- };
1626
1536
 
1627
1537
  // src/providers/utils/json.ts
1628
1538
  import { hexlify as hexlify5 } from "@fuel-ts/utils";
@@ -1766,6 +1676,28 @@ var NoWitnessByOwnerError = class extends Error {
1766
1676
  name = "NoWitnessByOwnerError";
1767
1677
  };
1768
1678
 
1679
+ // src/providers/transaction-request/helpers.ts
1680
+ import { InputType as InputType2 } from "@fuel-ts/transactions";
1681
+ var isRequestInputCoin = (input) => input.type === InputType2.Coin;
1682
+ var isRequestInputMessage = (input) => input.type === InputType2.Message;
1683
+ var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
1684
+ var getRequestInputResourceOwner = (input) => isRequestInputCoin(input) ? input.owner : input.recipient;
1685
+ var isRequestInputResourceFromOwner = (input, owner) => getRequestInputResourceOwner(input) === owner.toB256();
1686
+ var cacheResources = (resources) => resources.reduce(
1687
+ (cache2, resource) => {
1688
+ if (isCoin(resource)) {
1689
+ cache2.utxos.push(resource.id);
1690
+ } else {
1691
+ cache2.messages.push(resource.nonce);
1692
+ }
1693
+ return cache2;
1694
+ },
1695
+ {
1696
+ utxos: [],
1697
+ messages: []
1698
+ }
1699
+ );
1700
+
1769
1701
  // src/providers/transaction-request/witness.ts
1770
1702
  import { arrayify as arrayify4, hexlify as hexlify6 } from "@fuel-ts/utils";
1771
1703
  var witnessify = (value) => {
@@ -1779,7 +1711,7 @@ var witnessify = (value) => {
1779
1711
  // src/providers/transaction-request/transaction-request.ts
1780
1712
  var BaseTransactionRequest = class {
1781
1713
  /** Gas price for transaction */
1782
- tip;
1714
+ gasPrice;
1783
1715
  /** Block until which tx cannot be included */
1784
1716
  maturity;
1785
1717
  /** The maximum fee payable by this transaction using BASE_ASSET. */
@@ -1798,7 +1730,7 @@ var BaseTransactionRequest = class {
1798
1730
  * @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
1799
1731
  */
1800
1732
  constructor({
1801
- tip,
1733
+ gasPrice,
1802
1734
  maturity,
1803
1735
  maxFee,
1804
1736
  witnessLimit,
@@ -1806,7 +1738,7 @@ var BaseTransactionRequest = class {
1806
1738
  outputs,
1807
1739
  witnesses
1808
1740
  } = {}) {
1809
- this.tip = bn7(tip);
1741
+ this.gasPrice = bn7(gasPrice);
1810
1742
  this.maturity = maturity ?? 0;
1811
1743
  this.witnessLimit = witnessLimit ? bn7(witnessLimit) : void 0;
1812
1744
  this.maxFee = maxFee ? bn7(maxFee) : void 0;
@@ -1817,9 +1749,9 @@ var BaseTransactionRequest = class {
1817
1749
  static getPolicyMeta(req) {
1818
1750
  let policyTypes = 0;
1819
1751
  const policies = [];
1820
- if (req.tip) {
1821
- policyTypes += PolicyType.Tip;
1822
- policies.push({ data: req.tip, type: PolicyType.Tip });
1752
+ if (req.gasPrice) {
1753
+ policyTypes += PolicyType.GasPrice;
1754
+ policies.push({ data: req.gasPrice, type: PolicyType.GasPrice });
1823
1755
  }
1824
1756
  if (req.witnessLimit) {
1825
1757
  policyTypes += PolicyType.WitnessLimit;
@@ -1956,7 +1888,7 @@ var BaseTransactionRequest = class {
1956
1888
  */
1957
1889
  getCoinInputs() {
1958
1890
  return this.inputs.filter(
1959
- (input) => input.type === InputType2.Coin
1891
+ (input) => input.type === InputType3.Coin
1960
1892
  );
1961
1893
  }
1962
1894
  /**
@@ -1988,9 +1920,9 @@ var BaseTransactionRequest = class {
1988
1920
  const ownerAddress = addressify(owner);
1989
1921
  const found = this.inputs.find((input) => {
1990
1922
  switch (input.type) {
1991
- case InputType2.Coin:
1923
+ case InputType3.Coin:
1992
1924
  return hexlify7(input.owner) === ownerAddress.toB256();
1993
- case InputType2.Message:
1925
+ case InputType3.Message:
1994
1926
  return hexlify7(input.recipient) === ownerAddress.toB256();
1995
1927
  default:
1996
1928
  return false;
@@ -2003,11 +1935,13 @@ var BaseTransactionRequest = class {
2003
1935
  * assetId, if one it was not added yet.
2004
1936
  *
2005
1937
  * @param coin - Coin resource.
1938
+ * @param predicate - Predicate bytes.
1939
+ * @param predicateData - Predicate data bytes.
2006
1940
  */
2007
1941
  addCoinInput(coin) {
2008
- const { assetId, owner, amount } = coin;
1942
+ const { assetId, owner, amount, id, predicate } = coin;
2009
1943
  let witnessIndex;
2010
- if (coin.predicate) {
1944
+ if (predicate) {
2011
1945
  witnessIndex = 0;
2012
1946
  } else {
2013
1947
  witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
@@ -2016,13 +1950,14 @@ var BaseTransactionRequest = class {
2016
1950
  }
2017
1951
  }
2018
1952
  const input = {
2019
- ...coin,
2020
- type: InputType2.Coin,
1953
+ id,
1954
+ type: InputType3.Coin,
2021
1955
  owner: owner.toB256(),
2022
1956
  amount,
2023
1957
  assetId,
2024
1958
  txPointer: "0x00000000000000000000000000000000",
2025
- witnessIndex
1959
+ witnessIndex,
1960
+ predicate
2026
1961
  };
2027
1962
  this.pushInput(input);
2028
1963
  this.addChangeOutput(owner, assetId);
@@ -2032,12 +1967,14 @@ var BaseTransactionRequest = class {
2032
1967
  * baseAssetId, if one it was not added yet.
2033
1968
  *
2034
1969
  * @param message - Message resource.
1970
+ * @param predicate - Predicate bytes.
1971
+ * @param predicateData - Predicate data bytes.
2035
1972
  */
2036
1973
  addMessageInput(message) {
2037
- const { recipient, sender, amount } = message;
1974
+ const { recipient, sender, amount, predicate, nonce } = message;
2038
1975
  const assetId = BaseAssetId2;
2039
1976
  let witnessIndex;
2040
- if (message.predicate) {
1977
+ if (predicate) {
2041
1978
  witnessIndex = 0;
2042
1979
  } else {
2043
1980
  witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
@@ -2046,12 +1983,13 @@ var BaseTransactionRequest = class {
2046
1983
  }
2047
1984
  }
2048
1985
  const input = {
2049
- ...message,
2050
- type: InputType2.Message,
1986
+ nonce,
1987
+ type: InputType3.Message,
2051
1988
  sender: sender.toB256(),
2052
1989
  recipient: recipient.toB256(),
2053
1990
  amount,
2054
- witnessIndex
1991
+ witnessIndex,
1992
+ predicate
2055
1993
  };
2056
1994
  this.pushInput(input);
2057
1995
  this.addChangeOutput(recipient, assetId);
@@ -2161,7 +2099,7 @@ var BaseTransactionRequest = class {
2161
2099
  }
2162
2100
  calculateMaxGas(chainInfo, minGas) {
2163
2101
  const { consensusParameters } = chainInfo;
2164
- const { gasPerByte, maxGasPerTx } = consensusParameters;
2102
+ const { gasPerByte } = consensusParameters;
2165
2103
  const witnessesLength = this.toTransaction().witnesses.reduce(
2166
2104
  (acc, wit) => acc + wit.dataLength,
2167
2105
  0
@@ -2170,8 +2108,7 @@ var BaseTransactionRequest = class {
2170
2108
  gasPerByte,
2171
2109
  minGas,
2172
2110
  witnessesLength,
2173
- witnessLimit: this.witnessLimit,
2174
- maxGasPerTx
2111
+ witnessLimit: this.witnessLimit
2175
2112
  });
2176
2113
  }
2177
2114
  /**
@@ -2189,20 +2126,17 @@ var BaseTransactionRequest = class {
2189
2126
  });
2190
2127
  const updateAssetInput = (assetId, quantity) => {
2191
2128
  const assetInput = findAssetInput(assetId);
2192
- let usedQuantity = quantity;
2193
- if (assetId === BaseAssetId2) {
2194
- usedQuantity = bn7("1000000000000000000");
2195
- }
2196
2129
  if (assetInput && "assetId" in assetInput) {
2197
2130
  assetInput.id = hexlify7(randomBytes(UTXO_ID_LEN2));
2198
- assetInput.amount = usedQuantity;
2131
+ assetInput.amount = quantity;
2199
2132
  } else {
2200
2133
  this.addResources([
2201
2134
  {
2202
2135
  id: hexlify7(randomBytes(UTXO_ID_LEN2)),
2203
- amount: usedQuantity,
2136
+ amount: quantity,
2204
2137
  assetId,
2205
2138
  owner: resourcesOwner || Address.fromRandom(),
2139
+ maturity: 0,
2206
2140
  blockCreated: bn7(1),
2207
2141
  txCreatedIdx: bn7(1)
2208
2142
  }
@@ -2234,16 +2168,20 @@ var BaseTransactionRequest = class {
2234
2168
  toJSON() {
2235
2169
  return normalizeJSON(this);
2236
2170
  }
2237
- updatePredicateGasUsed(inputs) {
2171
+ removeWitness(index) {
2172
+ this.witnesses.splice(index, 1);
2173
+ this.adjustWitnessIndexes(index);
2174
+ }
2175
+ updatePredicateInputs(inputs) {
2238
2176
  this.inputs.forEach((i) => {
2239
2177
  let correspondingInput;
2240
2178
  switch (i.type) {
2241
- case InputType2.Coin:
2242
- correspondingInput = inputs.find((x) => x.type === InputType2.Coin && x.owner === i.owner);
2179
+ case InputType3.Coin:
2180
+ correspondingInput = inputs.find((x) => x.type === InputType3.Coin && x.owner === i.owner);
2243
2181
  break;
2244
- case InputType2.Message:
2182
+ case InputType3.Message:
2245
2183
  correspondingInput = inputs.find(
2246
- (x) => x.type === InputType2.Message && x.sender === i.sender
2184
+ (x) => x.type === InputType3.Message && x.sender === i.sender
2247
2185
  );
2248
2186
  break;
2249
2187
  default:
@@ -2256,12 +2194,10 @@ var BaseTransactionRequest = class {
2256
2194
  }
2257
2195
  });
2258
2196
  }
2259
- shiftPredicateData() {
2260
- this.inputs.forEach((input) => {
2261
- if ("predicateData" in input && "padPredicateData" in input && typeof input.padPredicateData === "function") {
2262
- input.predicateData = input.padPredicateData(
2263
- BaseTransactionRequest.getPolicyMeta(this).policies.length
2264
- );
2197
+ adjustWitnessIndexes(removedIndex) {
2198
+ this.inputs.filter(isRequestInputResource).forEach((input) => {
2199
+ if (input.witnessIndex > removedIndex) {
2200
+ input.witnessIndex -= 1;
2265
2201
  }
2266
2202
  });
2267
2203
  }
@@ -2277,7 +2213,7 @@ import { arrayify as arrayify6, hexlify as hexlify9 } from "@fuel-ts/utils";
2277
2213
  import { ZeroBytes32 as ZeroBytes325 } from "@fuel-ts/address/configs";
2278
2214
  import { uint64ToBytesBE, sha256 } from "@fuel-ts/hasher";
2279
2215
  import { bn as bn8 } from "@fuel-ts/math";
2280
- import { TransactionType as TransactionType2, InputType as InputType3, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
2216
+ import { TransactionType as TransactionType2, InputType as InputType4, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
2281
2217
  import { concat as concat2 } from "@fuel-ts/utils";
2282
2218
  import { clone as clone2 } from "ramda";
2283
2219
  function hashTransaction(transactionRequest, chainId) {
@@ -2288,7 +2224,7 @@ function hashTransaction(transactionRequest, chainId) {
2288
2224
  transaction.inputs = transaction.inputs.map((input) => {
2289
2225
  const inputClone = clone2(input);
2290
2226
  switch (inputClone.type) {
2291
- case InputType3.Coin: {
2227
+ case InputType4.Coin: {
2292
2228
  inputClone.txPointer = {
2293
2229
  blockHeight: 0,
2294
2230
  txIndex: 0
@@ -2296,11 +2232,11 @@ function hashTransaction(transactionRequest, chainId) {
2296
2232
  inputClone.predicateGasUsed = bn8(0);
2297
2233
  return inputClone;
2298
2234
  }
2299
- case InputType3.Message: {
2235
+ case InputType4.Message: {
2300
2236
  inputClone.predicateGasUsed = bn8(0);
2301
2237
  return inputClone;
2302
2238
  }
2303
- case InputType3.Contract: {
2239
+ case InputType4.Contract: {
2304
2240
  inputClone.txPointer = {
2305
2241
  blockHeight: 0,
2306
2242
  txIndex: 0
@@ -2411,8 +2347,9 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2411
2347
  return {
2412
2348
  type: TransactionType3.Create,
2413
2349
  ...baseTransaction,
2350
+ bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
2414
2351
  bytecodeWitnessIndex,
2415
- storageSlotsCount: bn9(storageSlots.length),
2352
+ storageSlotsCount: storageSlots.length,
2416
2353
  salt: this.salt ? hexlify9(this.salt) : ZeroBytes326,
2417
2354
  storageSlots
2418
2355
  };
@@ -2465,7 +2402,7 @@ import { Interface } from "@fuel-ts/abi-coder";
2465
2402
  import { addressify as addressify2 } from "@fuel-ts/address";
2466
2403
  import { ZeroBytes32 as ZeroBytes327 } from "@fuel-ts/address/configs";
2467
2404
  import { bn as bn10 } from "@fuel-ts/math";
2468
- import { InputType as InputType4, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2405
+ import { InputType as InputType5, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2469
2406
  import { arrayify as arrayify8, hexlify as hexlify10 } from "@fuel-ts/utils";
2470
2407
 
2471
2408
  // src/providers/transaction-request/scripts.ts
@@ -2535,8 +2472,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2535
2472
  type: TransactionType4.Script,
2536
2473
  scriptGasLimit: this.gasLimit,
2537
2474
  ...super.getBaseTransaction(),
2538
- scriptLength: bn10(script.length),
2539
- scriptDataLength: bn10(scriptData.length),
2475
+ scriptLength: script.length,
2476
+ scriptDataLength: scriptData.length,
2540
2477
  receiptsRoot: ZeroBytes327,
2541
2478
  script: hexlify10(script),
2542
2479
  scriptData: hexlify10(scriptData)
@@ -2549,7 +2486,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2549
2486
  */
2550
2487
  getContractInputs() {
2551
2488
  return this.inputs.filter(
2552
- (input) => input.type === InputType4.Contract
2489
+ (input) => input.type === InputType5.Contract
2553
2490
  );
2554
2491
  }
2555
2492
  /**
@@ -2600,7 +2537,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2600
2537
  }
2601
2538
  calculateMaxGas(chainInfo, minGas) {
2602
2539
  const { consensusParameters } = chainInfo;
2603
- const { gasPerByte, maxGasPerTx } = consensusParameters;
2540
+ const { gasPerByte } = consensusParameters;
2604
2541
  const witnessesLength = this.toTransaction().witnesses.reduce(
2605
2542
  (acc, wit) => acc + wit.dataLength,
2606
2543
  0
@@ -2610,8 +2547,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2610
2547
  minGas,
2611
2548
  witnessesLength,
2612
2549
  witnessLimit: this.witnessLimit,
2613
- gasLimit: this.gasLimit,
2614
- maxGasPerTx
2550
+ gasLimit: this.gasLimit
2615
2551
  });
2616
2552
  }
2617
2553
  /**
@@ -2626,7 +2562,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2626
2562
  return this;
2627
2563
  }
2628
2564
  const inputIndex = super.pushInput({
2629
- type: InputType4.Contract,
2565
+ type: InputType5.Contract,
2630
2566
  contractId: contractAddress.toB256(),
2631
2567
  txPointer: "0x00000000000000000000000000000000"
2632
2568
  });
@@ -2668,7 +2604,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2668
2604
 
2669
2605
  // src/providers/transaction-request/utils.ts
2670
2606
  import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
2671
- import { TransactionType as TransactionType5, InputType as InputType5 } from "@fuel-ts/transactions";
2607
+ import { TransactionType as TransactionType5 } from "@fuel-ts/transactions";
2672
2608
  var transactionRequestify = (obj) => {
2673
2609
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
2674
2610
  return obj;
@@ -2686,31 +2622,14 @@ var transactionRequestify = (obj) => {
2686
2622
  }
2687
2623
  }
2688
2624
  };
2689
- var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
2690
- (acc, input) => {
2691
- if (input.type === InputType5.Coin && input.owner === owner) {
2692
- acc.utxos.push(input.id);
2693
- }
2694
- if (input.type === InputType5.Message && input.recipient === owner) {
2695
- acc.messages.push(input.nonce);
2696
- }
2697
- return acc;
2698
- },
2699
- {
2700
- utxos: [],
2701
- messages: []
2702
- }
2703
- );
2704
2625
 
2705
2626
  // src/providers/transaction-response/transaction-response.ts
2706
2627
  import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
2707
- import { bn as bn15 } from "@fuel-ts/math";
2628
+ import { bn as bn14 } from "@fuel-ts/math";
2708
2629
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2709
2630
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
2710
2631
 
2711
2632
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2712
- import { bn as bn14 } from "@fuel-ts/math";
2713
- import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
2714
2633
  import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2715
2634
 
2716
2635
  // src/providers/transaction-summary/calculate-transaction-fee.ts
@@ -2719,10 +2638,9 @@ import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, Trans
2719
2638
  import { arrayify as arrayify9 } from "@fuel-ts/utils";
2720
2639
  var calculateTransactionFee = (params) => {
2721
2640
  const {
2722
- gasPrice,
2641
+ gasUsed,
2723
2642
  rawPayload,
2724
- tip,
2725
- consensusParameters: { gasCosts, feeParams, maxGasPerTx }
2643
+ consensusParameters: { gasCosts, feeParams }
2726
2644
  } = params;
2727
2645
  const gasPerByte = bn11(feeParams.gasPerByte);
2728
2646
  const gasPriceFactor = bn11(feeParams.gasPriceFactor);
@@ -2732,7 +2650,8 @@ var calculateTransactionFee = (params) => {
2732
2650
  return {
2733
2651
  fee: bn11(0),
2734
2652
  minFee: bn11(0),
2735
- maxFee: bn11(0)
2653
+ maxFee: bn11(0),
2654
+ feeFromGasUsed: bn11(0)
2736
2655
  };
2737
2656
  }
2738
2657
  const { type, witnesses, inputs, policies } = transaction;
@@ -2764,6 +2683,7 @@ var calculateTransactionFee = (params) => {
2764
2683
  metadataGas,
2765
2684
  txBytesSize: transactionBytes.length
2766
2685
  });
2686
+ const gasPrice = bn11(policies.find((policy) => policy.type === PolicyType2.GasPrice)?.data);
2767
2687
  const witnessLimit = policies.find((policy) => policy.type === PolicyType2.WitnessLimit)?.data;
2768
2688
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
2769
2689
  const maxGas = getMaxGas({
@@ -2771,25 +2691,17 @@ var calculateTransactionFee = (params) => {
2771
2691
  minGas,
2772
2692
  witnessesLength,
2773
2693
  gasLimit,
2774
- witnessLimit,
2775
- maxGasPerTx
2776
- });
2777
- const minFee = calculateGasFee({
2778
- gasPrice,
2779
- gas: minGas,
2780
- priceFactor: gasPriceFactor,
2781
- tip
2782
- });
2783
- const maxFee = calculateGasFee({
2784
- gasPrice,
2785
- gas: maxGas,
2786
- priceFactor: gasPriceFactor,
2787
- tip
2694
+ witnessLimit
2788
2695
  });
2696
+ const feeFromGasUsed = calculatePriceWithFactor(gasUsed, gasPrice, gasPriceFactor);
2697
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor);
2698
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor);
2699
+ const fee = minFee.add(feeFromGasUsed);
2789
2700
  return {
2701
+ fee,
2790
2702
  minFee,
2791
2703
  maxFee,
2792
- fee: maxFee
2704
+ feeFromGasUsed
2793
2705
  };
2794
2706
  };
2795
2707
 
@@ -3403,9 +3315,7 @@ function assembleTransactionSummary(params) {
3403
3315
  gqlTransactionStatus,
3404
3316
  abiMap = {},
3405
3317
  maxInputs,
3406
- gasCosts,
3407
- maxGasPerTx,
3408
- gasPrice
3318
+ gasCosts
3409
3319
  } = params;
3410
3320
  const gasUsed = getGasUsedFromReceipts(receipts);
3411
3321
  const rawPayload = hexlify11(transactionBytes);
@@ -3419,14 +3329,11 @@ function assembleTransactionSummary(params) {
3419
3329
  maxInputs
3420
3330
  });
3421
3331
  const typeName = getTransactionTypeName(transaction.type);
3422
- const tip = bn14(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3423
3332
  const { fee } = calculateTransactionFee({
3424
- gasPrice,
3333
+ gasUsed,
3425
3334
  rawPayload,
3426
- tip,
3427
3335
  consensusParameters: {
3428
3336
  gasCosts,
3429
- maxGasPerTx,
3430
3337
  feeParams: {
3431
3338
  gasPerByte,
3432
3339
  gasPriceFactor
@@ -3486,7 +3393,7 @@ var TransactionResponse = class {
3486
3393
  /** Current provider */
3487
3394
  provider;
3488
3395
  /** Gas used on the transaction */
3489
- gasUsed = bn15(0);
3396
+ gasUsed = bn14(0);
3490
3397
  /** The graphql Transaction with receipts object. */
3491
3398
  gqlTransaction;
3492
3399
  abis;
@@ -3564,13 +3471,8 @@ var TransactionResponse = class {
3564
3471
  const decodedTransaction = this.decodeTransaction(
3565
3472
  transaction
3566
3473
  );
3567
- let txReceipts = [];
3568
- if (transaction?.status && "receipts" in transaction.status) {
3569
- txReceipts = transaction.status.receipts;
3570
- }
3571
- const receipts = txReceipts.map(processGqlReceipt) || [];
3572
- const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
3573
- const gasPrice = await this.provider.getLatestGasPrice();
3474
+ const receipts = transaction.receipts?.map(processGqlReceipt) || [];
3475
+ const { gasPerByte, gasPriceFactor, gasCosts } = this.provider.getGasConfig();
3574
3476
  const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
3575
3477
  const transactionSummary = assembleTransactionSummary({
3576
3478
  id: this.id,
@@ -3582,9 +3484,7 @@ var TransactionResponse = class {
3582
3484
  gasPriceFactor,
3583
3485
  abiMap: contractsAbiMap,
3584
3486
  maxInputs,
3585
- gasCosts,
3586
- maxGasPerTx,
3587
- gasPrice
3487
+ gasCosts
3588
3488
  });
3589
3489
  return transactionSummary;
3590
3490
  }
@@ -3711,29 +3611,29 @@ var processGqlChain = (chain) => {
3711
3611
  const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } = consensusParameters;
3712
3612
  return {
3713
3613
  name,
3714
- baseChainHeight: bn16(daHeight),
3614
+ baseChainHeight: bn15(daHeight),
3715
3615
  consensusParameters: {
3716
- contractMaxSize: bn16(contractParams.contractMaxSize),
3717
- maxInputs: bn16(txParams.maxInputs),
3718
- maxOutputs: bn16(txParams.maxOutputs),
3719
- maxWitnesses: bn16(txParams.maxWitnesses),
3720
- maxGasPerTx: bn16(txParams.maxGasPerTx),
3721
- maxScriptLength: bn16(scriptParams.maxScriptLength),
3722
- maxScriptDataLength: bn16(scriptParams.maxScriptDataLength),
3723
- maxStorageSlots: bn16(contractParams.maxStorageSlots),
3724
- maxPredicateLength: bn16(predicateParams.maxPredicateLength),
3725
- maxPredicateDataLength: bn16(predicateParams.maxPredicateDataLength),
3726
- maxGasPerPredicate: bn16(predicateParams.maxGasPerPredicate),
3727
- gasPriceFactor: bn16(feeParams.gasPriceFactor),
3728
- gasPerByte: bn16(feeParams.gasPerByte),
3729
- maxMessageDataLength: bn16(predicateParams.maxMessageDataLength),
3730
- chainId: bn16(consensusParameters.chainId),
3616
+ contractMaxSize: bn15(contractParams.contractMaxSize),
3617
+ maxInputs: bn15(txParams.maxInputs),
3618
+ maxOutputs: bn15(txParams.maxOutputs),
3619
+ maxWitnesses: bn15(txParams.maxWitnesses),
3620
+ maxGasPerTx: bn15(txParams.maxGasPerTx),
3621
+ maxScriptLength: bn15(scriptParams.maxScriptLength),
3622
+ maxScriptDataLength: bn15(scriptParams.maxScriptDataLength),
3623
+ maxStorageSlots: bn15(contractParams.maxStorageSlots),
3624
+ maxPredicateLength: bn15(predicateParams.maxPredicateLength),
3625
+ maxPredicateDataLength: bn15(predicateParams.maxPredicateDataLength),
3626
+ maxGasPerPredicate: bn15(predicateParams.maxGasPerPredicate),
3627
+ gasPriceFactor: bn15(feeParams.gasPriceFactor),
3628
+ gasPerByte: bn15(feeParams.gasPerByte),
3629
+ maxMessageDataLength: bn15(predicateParams.maxMessageDataLength),
3630
+ chainId: bn15(consensusParameters.chainId),
3731
3631
  gasCosts
3732
3632
  },
3733
3633
  gasCosts,
3734
3634
  latestBlock: {
3735
3635
  id: latestBlock.id,
3736
- height: bn16(latestBlock.height),
3636
+ height: bn15(latestBlock.header.height),
3737
3637
  time: latestBlock.header.time,
3738
3638
  transactions: latestBlock.transactions.map((i) => ({
3739
3639
  id: i.id
@@ -3827,8 +3727,10 @@ var _Provider = class {
3827
3727
  * Returns some helpful parameters related to gas fees.
3828
3728
  */
3829
3729
  getGasConfig() {
3730
+ const { minGasPrice } = this.getNode();
3830
3731
  const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
3831
3732
  return {
3733
+ minGasPrice,
3832
3734
  maxGasPerTx,
3833
3735
  maxGasPerPredicate,
3834
3736
  gasPriceFactor,
@@ -3926,7 +3828,7 @@ var _Provider = class {
3926
3828
  */
3927
3829
  async getBlockNumber() {
3928
3830
  const { chain } = await this.operations.getChain();
3929
- return bn16(chain.latestBlock.height, 10);
3831
+ return bn15(chain.latestBlock.header.height, 10);
3930
3832
  }
3931
3833
  /**
3932
3834
  * Returns the chain information.
@@ -3936,11 +3838,13 @@ var _Provider = class {
3936
3838
  async fetchNode() {
3937
3839
  const { nodeInfo } = await this.operations.getNodeInfo();
3938
3840
  const processedNodeInfo = {
3939
- maxDepth: bn16(nodeInfo.maxDepth),
3940
- maxTx: bn16(nodeInfo.maxTx),
3841
+ maxDepth: bn15(nodeInfo.maxDepth),
3842
+ maxTx: bn15(nodeInfo.maxTx),
3843
+ minGasPrice: bn15(nodeInfo.minGasPrice),
3941
3844
  nodeVersion: nodeInfo.nodeVersion,
3942
3845
  utxoValidation: nodeInfo.utxoValidation,
3943
- vmBacktrace: nodeInfo.vmBacktrace
3846
+ vmBacktrace: nodeInfo.vmBacktrace,
3847
+ peers: nodeInfo.peers
3944
3848
  };
3945
3849
  _Provider.nodeInfoCache[this.url] = processedNodeInfo;
3946
3850
  return processedNodeInfo;
@@ -4026,13 +3930,14 @@ var _Provider = class {
4026
3930
  return this.estimateTxDependencies(transactionRequest);
4027
3931
  }
4028
3932
  const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
4029
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4030
- encodedTransactions: encodedTransaction,
3933
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
3934
+ encodedTransaction,
4031
3935
  utxoValidation: utxoValidation || false
4032
3936
  });
4033
- const [{ receipts: rawReceipts, status }] = dryRunStatuses;
4034
- const receipts = rawReceipts.map(processGqlReceipt);
4035
- return { receipts, dryrunStatus: status };
3937
+ const receipts = gqlReceipts.map(processGqlReceipt);
3938
+ return {
3939
+ receipts
3940
+ };
4036
3941
  }
4037
3942
  /**
4038
3943
  * Verifies whether enough gas is available to complete transaction.
@@ -4058,7 +3963,7 @@ var _Provider = class {
4058
3963
  } = response;
4059
3964
  if (inputs) {
4060
3965
  inputs.forEach((input, index) => {
4061
- if ("predicateGasUsed" in input && bn16(input.predicateGasUsed).gt(0)) {
3966
+ if ("predicateGasUsed" in input && bn15(input.predicateGasUsed).gt(0)) {
4062
3967
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
4063
3968
  }
4064
3969
  });
@@ -4071,6 +3976,9 @@ var _Provider = class {
4071
3976
  * If there are missing variable outputs,
4072
3977
  * `addVariableOutputs` is called on the transaction.
4073
3978
  *
3979
+ * @privateRemarks
3980
+ * TODO: Investigate support for missing contract IDs
3981
+ * TODO: Add support for missing output messages
4074
3982
  *
4075
3983
  * @param transactionRequest - The transaction request object.
4076
3984
  * @returns A promise.
@@ -4083,19 +3991,16 @@ var _Provider = class {
4083
3991
  missingContractIds: []
4084
3992
  };
4085
3993
  }
3994
+ await this.estimatePredicates(transactionRequest);
4086
3995
  let receipts = [];
4087
3996
  const missingContractIds = [];
4088
3997
  let outputVariables = 0;
4089
- let dryrunStatus;
4090
3998
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
4091
- const {
4092
- dryRun: [{ receipts: rawReceipts, status }]
4093
- } = await this.operations.dryRun({
4094
- encodedTransactions: [hexlify12(transactionRequest.toTransactionBytes())],
3999
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
4000
+ encodedTransaction: hexlify12(transactionRequest.toTransactionBytes()),
4095
4001
  utxoValidation: false
4096
4002
  });
4097
- receipts = rawReceipts.map(processGqlReceipt);
4098
- dryrunStatus = status;
4003
+ receipts = gqlReceipts.map(processGqlReceipt);
4099
4004
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
4100
4005
  const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
4101
4006
  if (hasMissingOutputs) {
@@ -4105,10 +4010,6 @@ var _Provider = class {
4105
4010
  transactionRequest.addContractInputAndOutput(Address2.fromString(contractId));
4106
4011
  missingContractIds.push(contractId);
4107
4012
  });
4108
- const { maxFee } = await this.estimateTxGasAndFee({
4109
- transactionRequest
4110
- });
4111
- transactionRequest.maxFee = maxFee;
4112
4013
  } else {
4113
4014
  break;
4114
4015
  }
@@ -4116,136 +4017,37 @@ var _Provider = class {
4116
4017
  return {
4117
4018
  receipts,
4118
4019
  outputVariables,
4119
- missingContractIds,
4120
- dryrunStatus
4020
+ missingContractIds
4121
4021
  };
4122
4022
  }
4123
- /**
4124
- * Dry runs multiple transactions and checks for missing dependencies in batches.
4125
- *
4126
- * Transactions are dry run in batches. After each dry run, transactions requiring
4127
- * further modifications are identified. The method iteratively updates these transactions
4128
- * and performs subsequent dry runs until all dependencies for each transaction are satisfied.
4129
- *
4130
- * @param transactionRequests - Array of transaction request objects.
4131
- * @returns A promise that resolves to an array of results for each transaction.
4132
- */
4133
- async estimateMultipleTxDependencies(transactionRequests) {
4134
- const results = transactionRequests.map(() => ({
4135
- receipts: [],
4136
- outputVariables: 0,
4137
- missingContractIds: [],
4138
- dryrunStatus: void 0
4139
- }));
4140
- const allRequests = clone3(transactionRequests);
4141
- const serializedTransactionsMap = /* @__PURE__ */ new Map();
4142
- allRequests.forEach((req, index) => {
4143
- if (req.type === TransactionType8.Script) {
4144
- serializedTransactionsMap.set(index, hexlify12(req.toTransactionBytes()));
4145
- }
4146
- });
4147
- let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
4148
- let attempt = 0;
4149
- while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
4150
- const encodedTransactions = transactionsToProcess.map(
4151
- (index) => serializedTransactionsMap.get(index)
4152
- );
4153
- const dryRunResults = await this.operations.dryRun({
4154
- encodedTransactions,
4155
- utxoValidation: false
4156
- });
4157
- const nextRoundTransactions = [];
4158
- for (let i = 0; i < dryRunResults.dryRun.length; i++) {
4159
- const requestIdx = transactionsToProcess[i];
4160
- const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
4161
- const result = results[requestIdx];
4162
- result.receipts = rawReceipts.map(processGqlReceipt);
4163
- result.dryrunStatus = status;
4164
- const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
4165
- result.receipts
4166
- );
4167
- const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
4168
- const request = allRequests[requestIdx];
4169
- if (hasMissingOutputs && request?.type === TransactionType8.Script) {
4170
- result.outputVariables += missingOutputVariables.length;
4171
- request.addVariableOutputs(missingOutputVariables.length);
4172
- missingOutputContractIds.forEach(({ contractId }) => {
4173
- request.addContractInputAndOutput(Address2.fromString(contractId));
4174
- result.missingContractIds.push(contractId);
4175
- });
4176
- const { maxFee } = await this.estimateTxGasAndFee({
4177
- transactionRequest: request
4178
- });
4179
- request.maxFee = maxFee;
4180
- serializedTransactionsMap.set(requestIdx, hexlify12(request.toTransactionBytes()));
4181
- nextRoundTransactions.push(requestIdx);
4182
- }
4183
- }
4184
- transactionsToProcess = nextRoundTransactions;
4185
- attempt += 1;
4186
- }
4187
- return results;
4188
- }
4189
- async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
4190
- if (estimateTxDependencies) {
4191
- return this.estimateMultipleTxDependencies(transactionRequests);
4192
- }
4193
- const encodedTransactions = transactionRequests.map((tx) => hexlify12(tx.toTransactionBytes()));
4194
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4195
- encodedTransactions,
4196
- utxoValidation: utxoValidation || false
4197
- });
4198
- const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
4199
- const receipts = rawReceipts.map(processGqlReceipt);
4200
- return { receipts, dryrunStatus: status };
4201
- });
4202
- return results;
4203
- }
4204
4023
  /**
4205
4024
  * Estimates the transaction gas and fee based on the provided transaction request.
4206
4025
  * @param transactionRequest - The transaction request object.
4207
4026
  * @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
4208
4027
  */
4209
- async estimateTxGasAndFee(params) {
4028
+ estimateTxGasAndFee(params) {
4210
4029
  const { transactionRequest } = params;
4211
- let { gasPrice } = params;
4030
+ const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
4212
4031
  const chainInfo = this.getChain();
4213
- const { gasPriceFactor, maxGasPerTx } = this.getGasConfig();
4032
+ const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
4033
+ transactionRequest.gasPrice = gasPrice;
4214
4034
  const minGas = transactionRequest.calculateMinGas(chainInfo);
4215
- if (!gasPrice) {
4216
- gasPrice = await this.estimateGasPrice(10);
4217
- }
4218
- const minFee = calculateGasFee({
4219
- gasPrice: bn16(gasPrice),
4220
- gas: minGas,
4221
- priceFactor: gasPriceFactor,
4222
- tip: transactionRequest.tip
4223
- }).add(1);
4224
- let gasLimit = bn16(0);
4035
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4225
4036
  if (transactionRequest.type === TransactionType8.Script) {
4226
- gasLimit = transactionRequest.gasLimit;
4227
4037
  if (transactionRequest.gasLimit.eq(0)) {
4228
4038
  transactionRequest.gasLimit = minGas;
4229
4039
  transactionRequest.gasLimit = maxGasPerTx.sub(
4230
4040
  transactionRequest.calculateMaxGas(chainInfo, minGas)
4231
4041
  );
4232
- gasLimit = transactionRequest.gasLimit;
4233
4042
  }
4234
4043
  }
4235
4044
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4236
- const maxFee = calculateGasFee({
4237
- gasPrice: bn16(gasPrice),
4238
- gas: maxGas,
4239
- priceFactor: gasPriceFactor,
4240
- tip: transactionRequest.tip
4241
- }).add(1);
4045
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4242
4046
  return {
4243
4047
  minGas,
4244
4048
  minFee,
4245
4049
  maxGas,
4246
- maxFee,
4247
- gasPrice,
4248
- gasLimit
4050
+ maxFee
4249
4051
  };
4250
4052
  }
4251
4053
  /**
@@ -4263,17 +4065,15 @@ var _Provider = class {
4263
4065
  if (estimateTxDependencies) {
4264
4066
  return this.estimateTxDependencies(transactionRequest);
4265
4067
  }
4266
- const encodedTransactions = [hexlify12(transactionRequest.toTransactionBytes())];
4267
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4268
- encodedTransactions,
4068
+ const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
4069
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
4070
+ encodedTransaction,
4269
4071
  utxoValidation: true
4270
4072
  });
4271
- const callResult = dryRunStatuses.map((dryRunStatus) => {
4272
- const { id, receipts, status } = dryRunStatus;
4273
- const processedReceipts = receipts.map(processGqlReceipt);
4274
- return { id, receipts: processedReceipts, status };
4275
- });
4276
- return { receipts: callResult[0].receipts };
4073
+ const receipts = gqlReceipts.map(processGqlReceipt);
4074
+ return {
4075
+ receipts
4076
+ };
4277
4077
  }
4278
4078
  /**
4279
4079
  * Returns a transaction cost to enable user
@@ -4290,79 +4090,77 @@ var _Provider = class {
4290
4090
  * @param tolerance - The tolerance to add on top of the gasUsed.
4291
4091
  * @returns A promise that resolves to the transaction cost object.
4292
4092
  */
4293
- async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
4093
+ async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
4094
+ estimateTxDependencies = true,
4095
+ estimatePredicates = true,
4096
+ resourcesOwner,
4097
+ signatureCallback
4098
+ } = {}) {
4294
4099
  const txRequestClone = clone3(transactionRequestify(transactionRequestLike));
4100
+ const { minGasPrice } = this.getGasConfig();
4101
+ const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
4295
4102
  const isScriptTransaction = txRequestClone.type === TransactionType8.Script;
4296
4103
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
4297
- const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
4104
+ const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
4298
4105
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
4299
- txRequestClone.maxFee = bn16(0);
4300
4106
  if (isScriptTransaction) {
4301
- txRequestClone.gasLimit = bn16(0);
4107
+ txRequestClone.gasLimit = bn15(0);
4302
4108
  }
4303
- if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4304
- resourcesOwner.populateTransactionPredicateData(txRequestClone);
4109
+ if (estimatePredicates) {
4110
+ if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4111
+ resourcesOwner.populateTransactionPredicateData(txRequestClone);
4112
+ }
4113
+ await this.estimatePredicates(txRequestClone);
4305
4114
  }
4306
- const signedRequest = clone3(txRequestClone);
4307
- let addedSignatures = 0;
4308
4115
  if (signatureCallback && isScriptTransaction) {
4309
- const lengthBefore = signedRequest.witnesses.length;
4310
- await signatureCallback(signedRequest);
4311
- addedSignatures = signedRequest.witnesses.length - lengthBefore;
4116
+ await signatureCallback(txRequestClone);
4312
4117
  }
4313
- await this.estimatePredicates(signedRequest);
4314
- let { maxFee, maxGas, minFee, minGas, gasPrice, gasLimit } = await this.estimateTxGasAndFee({
4315
- transactionRequest: signedRequest
4118
+ let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
4119
+ transactionRequest: txRequestClone
4316
4120
  });
4317
4121
  let receipts = [];
4318
4122
  let missingContractIds = [];
4319
4123
  let outputVariables = 0;
4320
- let gasUsed = bn16(0);
4321
- txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
4322
- txRequestClone.maxFee = maxFee;
4323
- if (isScriptTransaction) {
4324
- txRequestClone.gasLimit = gasLimit;
4325
- if (signatureCallback) {
4326
- await signatureCallback(txRequestClone);
4327
- }
4124
+ let gasUsed = bn15(0);
4125
+ if (isScriptTransaction && estimateTxDependencies) {
4126
+ txRequestClone.gasPrice = bn15(0);
4328
4127
  const result = await this.estimateTxDependencies(txRequestClone);
4329
4128
  receipts = result.receipts;
4330
4129
  outputVariables = result.outputVariables;
4331
4130
  missingContractIds = result.missingContractIds;
4332
4131
  gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
4333
4132
  txRequestClone.gasLimit = gasUsed;
4334
- ({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
4335
- transactionRequest: txRequestClone,
4336
- gasPrice
4133
+ txRequestClone.gasPrice = setGasPrice;
4134
+ ({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
4135
+ transactionRequest: txRequestClone
4337
4136
  }));
4338
4137
  }
4339
4138
  return {
4340
4139
  requiredQuantities: allQuantities,
4341
4140
  receipts,
4342
4141
  gasUsed,
4343
- gasPrice,
4142
+ minGasPrice,
4143
+ gasPrice: setGasPrice,
4344
4144
  minGas,
4345
4145
  maxGas,
4346
4146
  minFee,
4347
4147
  maxFee,
4148
+ estimatedInputs: txRequestClone.inputs,
4348
4149
  outputVariables,
4349
- missingContractIds,
4350
- addedSignatures,
4351
- estimatedPredicates: txRequestClone.inputs
4150
+ missingContractIds
4352
4151
  };
4353
4152
  }
4354
- async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
4153
+ async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
4355
4154
  const ownerAddress = Address2.fromAddressOrString(owner);
4356
4155
  const transactionRequest = transactionRequestify(clone3(transactionRequestLike));
4357
- const transactionCost = await this.getTransactionCost(transactionRequest, {
4358
- quantitiesToContract
4359
- });
4156
+ const transactionCost = await this.getTransactionCost(transactionRequest, forwardingQuantities);
4360
4157
  transactionRequest.addResources(
4361
4158
  await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
4362
4159
  );
4363
- const { requiredQuantities, ...txCost } = await this.getTransactionCost(transactionRequest, {
4364
- quantitiesToContract
4365
- });
4160
+ const { requiredQuantities, ...txCost } = await this.getTransactionCost(
4161
+ transactionRequest,
4162
+ forwardingQuantities
4163
+ );
4366
4164
  const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
4367
4165
  return {
4368
4166
  resources,
@@ -4384,10 +4182,11 @@ var _Provider = class {
4384
4182
  return coins.map((coin) => ({
4385
4183
  id: coin.utxoId,
4386
4184
  assetId: coin.assetId,
4387
- amount: bn16(coin.amount),
4185
+ amount: bn15(coin.amount),
4388
4186
  owner: Address2.fromAddressOrString(coin.owner),
4389
- blockCreated: bn16(coin.blockCreated),
4390
- txCreatedIdx: bn16(coin.txCreatedIdx)
4187
+ maturity: bn15(coin.maturity).toNumber(),
4188
+ blockCreated: bn15(coin.blockCreated),
4189
+ txCreatedIdx: bn15(coin.txCreatedIdx)
4391
4190
  }));
4392
4191
  }
4393
4192
  /**
@@ -4424,9 +4223,9 @@ var _Provider = class {
4424
4223
  switch (coin.__typename) {
4425
4224
  case "MessageCoin":
4426
4225
  return {
4427
- amount: bn16(coin.amount),
4226
+ amount: bn15(coin.amount),
4428
4227
  assetId: coin.assetId,
4429
- daHeight: bn16(coin.daHeight),
4228
+ daHeight: bn15(coin.daHeight),
4430
4229
  sender: Address2.fromAddressOrString(coin.sender),
4431
4230
  recipient: Address2.fromAddressOrString(coin.recipient),
4432
4231
  nonce: coin.nonce
@@ -4434,11 +4233,12 @@ var _Provider = class {
4434
4233
  case "Coin":
4435
4234
  return {
4436
4235
  id: coin.utxoId,
4437
- amount: bn16(coin.amount),
4236
+ amount: bn15(coin.amount),
4438
4237
  assetId: coin.assetId,
4439
4238
  owner: Address2.fromAddressOrString(coin.owner),
4440
- blockCreated: bn16(coin.blockCreated),
4441
- txCreatedIdx: bn16(coin.txCreatedIdx)
4239
+ maturity: bn15(coin.maturity).toNumber(),
4240
+ blockCreated: bn15(coin.blockCreated),
4241
+ txCreatedIdx: bn15(coin.txCreatedIdx)
4442
4242
  };
4443
4243
  default:
4444
4244
  return null;
@@ -4455,13 +4255,13 @@ var _Provider = class {
4455
4255
  async getBlock(idOrHeight) {
4456
4256
  let variables;
4457
4257
  if (typeof idOrHeight === "number") {
4458
- variables = { height: bn16(idOrHeight).toString(10) };
4258
+ variables = { height: bn15(idOrHeight).toString(10) };
4459
4259
  } else if (idOrHeight === "latest") {
4460
4260
  variables = { height: (await this.getBlockNumber()).toString(10) };
4461
4261
  } else if (idOrHeight.length === 66) {
4462
4262
  variables = { blockId: idOrHeight };
4463
4263
  } else {
4464
- variables = { blockId: bn16(idOrHeight).toString(10) };
4264
+ variables = { blockId: bn15(idOrHeight).toString(10) };
4465
4265
  }
4466
4266
  const { block } = await this.operations.getBlock(variables);
4467
4267
  if (!block) {
@@ -4469,7 +4269,7 @@ var _Provider = class {
4469
4269
  }
4470
4270
  return {
4471
4271
  id: block.id,
4472
- height: bn16(block.height),
4272
+ height: bn15(block.header.height),
4473
4273
  time: block.header.time,
4474
4274
  transactionIds: block.transactions.map((tx) => tx.id)
4475
4275
  };
@@ -4484,7 +4284,7 @@ var _Provider = class {
4484
4284
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4485
4285
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4486
4286
  id: block.id,
4487
- height: bn16(block.height),
4287
+ height: bn15(block.header.height),
4488
4288
  time: block.header.time,
4489
4289
  transactionIds: block.transactions.map((tx) => tx.id)
4490
4290
  }));
@@ -4499,7 +4299,7 @@ var _Provider = class {
4499
4299
  async getBlockWithTransactions(idOrHeight) {
4500
4300
  let variables;
4501
4301
  if (typeof idOrHeight === "number") {
4502
- variables = { blockHeight: bn16(idOrHeight).toString(10) };
4302
+ variables = { blockHeight: bn15(idOrHeight).toString(10) };
4503
4303
  } else if (idOrHeight === "latest") {
4504
4304
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4505
4305
  } else {
@@ -4511,7 +4311,7 @@ var _Provider = class {
4511
4311
  }
4512
4312
  return {
4513
4313
  id: block.id,
4514
- height: bn16(block.height, 10),
4314
+ height: bn15(block.header.height, 10),
4515
4315
  time: block.header.time,
4516
4316
  transactionIds: block.transactions.map((tx) => tx.id),
4517
4317
  transactions: block.transactions.map(
@@ -4560,7 +4360,7 @@ var _Provider = class {
4560
4360
  contract: Address2.fromAddressOrString(contractId).toB256(),
4561
4361
  asset: hexlify12(assetId)
4562
4362
  });
4563
- return bn16(contractBalance.amount, 10);
4363
+ return bn15(contractBalance.amount, 10);
4564
4364
  }
4565
4365
  /**
4566
4366
  * Returns the balance for the given owner for the given asset ID.
@@ -4574,7 +4374,7 @@ var _Provider = class {
4574
4374
  owner: Address2.fromAddressOrString(owner).toB256(),
4575
4375
  assetId: hexlify12(assetId)
4576
4376
  });
4577
- return bn16(balance.amount, 10);
4377
+ return bn15(balance.amount, 10);
4578
4378
  }
4579
4379
  /**
4580
4380
  * Returns balances for the given owner.
@@ -4592,7 +4392,7 @@ var _Provider = class {
4592
4392
  const balances = result.balances.edges.map((edge) => edge.node);
4593
4393
  return balances.map((balance) => ({
4594
4394
  assetId: balance.assetId,
4595
- amount: bn16(balance.amount)
4395
+ amount: bn15(balance.amount)
4596
4396
  }));
4597
4397
  }
4598
4398
  /**
@@ -4614,15 +4414,15 @@ var _Provider = class {
4614
4414
  sender: message.sender,
4615
4415
  recipient: message.recipient,
4616
4416
  nonce: message.nonce,
4617
- amount: bn16(message.amount),
4417
+ amount: bn15(message.amount),
4618
4418
  data: message.data
4619
4419
  }),
4620
4420
  sender: Address2.fromAddressOrString(message.sender),
4621
4421
  recipient: Address2.fromAddressOrString(message.recipient),
4622
4422
  nonce: message.nonce,
4623
- amount: bn16(message.amount),
4423
+ amount: bn15(message.amount),
4624
4424
  data: InputMessageCoder.decodeData(message.data),
4625
- daHeight: bn16(message.daHeight)
4425
+ daHeight: bn15(message.daHeight)
4626
4426
  }));
4627
4427
  }
4628
4428
  /**
@@ -4675,60 +4475,44 @@ var _Provider = class {
4675
4475
  } = result.messageProof;
4676
4476
  return {
4677
4477
  messageProof: {
4678
- proofIndex: bn16(messageProof.proofIndex),
4478
+ proofIndex: bn15(messageProof.proofIndex),
4679
4479
  proofSet: messageProof.proofSet
4680
4480
  },
4681
4481
  blockProof: {
4682
- proofIndex: bn16(blockProof.proofIndex),
4482
+ proofIndex: bn15(blockProof.proofIndex),
4683
4483
  proofSet: blockProof.proofSet
4684
4484
  },
4685
4485
  messageBlockHeader: {
4686
4486
  id: messageBlockHeader.id,
4687
- daHeight: bn16(messageBlockHeader.daHeight),
4688
- transactionsCount: bn16(messageBlockHeader.transactionsCount),
4487
+ daHeight: bn15(messageBlockHeader.daHeight),
4488
+ transactionsCount: bn15(messageBlockHeader.transactionsCount),
4689
4489
  transactionsRoot: messageBlockHeader.transactionsRoot,
4690
- height: bn16(messageBlockHeader.height),
4490
+ height: bn15(messageBlockHeader.height),
4691
4491
  prevRoot: messageBlockHeader.prevRoot,
4692
4492
  time: messageBlockHeader.time,
4693
4493
  applicationHash: messageBlockHeader.applicationHash,
4694
- messageReceiptCount: bn16(messageBlockHeader.messageReceiptCount),
4695
- messageOutboxRoot: messageBlockHeader.messageOutboxRoot,
4696
- consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
4697
- eventInboxRoot: messageBlockHeader.eventInboxRoot,
4698
- stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
4494
+ messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
4495
+ messageReceiptCount: bn15(messageBlockHeader.messageReceiptCount)
4699
4496
  },
4700
4497
  commitBlockHeader: {
4701
4498
  id: commitBlockHeader.id,
4702
- daHeight: bn16(commitBlockHeader.daHeight),
4703
- transactionsCount: bn16(commitBlockHeader.transactionsCount),
4499
+ daHeight: bn15(commitBlockHeader.daHeight),
4500
+ transactionsCount: bn15(commitBlockHeader.transactionsCount),
4704
4501
  transactionsRoot: commitBlockHeader.transactionsRoot,
4705
- height: bn16(commitBlockHeader.height),
4502
+ height: bn15(commitBlockHeader.height),
4706
4503
  prevRoot: commitBlockHeader.prevRoot,
4707
4504
  time: commitBlockHeader.time,
4708
4505
  applicationHash: commitBlockHeader.applicationHash,
4709
- messageReceiptCount: bn16(commitBlockHeader.messageReceiptCount),
4710
- messageOutboxRoot: commitBlockHeader.messageOutboxRoot,
4711
- consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
4712
- eventInboxRoot: commitBlockHeader.eventInboxRoot,
4713
- stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
4506
+ messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
4507
+ messageReceiptCount: bn15(commitBlockHeader.messageReceiptCount)
4714
4508
  },
4715
4509
  sender: Address2.fromAddressOrString(sender),
4716
4510
  recipient: Address2.fromAddressOrString(recipient),
4717
4511
  nonce,
4718
- amount: bn16(amount),
4512
+ amount: bn15(amount),
4719
4513
  data
4720
4514
  };
4721
4515
  }
4722
- async getLatestGasPrice() {
4723
- const { latestGasPrice } = await this.operations.getLatestGasPrice();
4724
- return bn16(latestGasPrice.gasPrice);
4725
- }
4726
- async estimateGasPrice(blockHorizon) {
4727
- const { estimateGasPrice } = await this.operations.estimateGasPrice({
4728
- blockHorizon: String(blockHorizon)
4729
- });
4730
- return bn16(estimateGasPrice.gasPrice);
4731
- }
4732
4516
  /**
4733
4517
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
4734
4518
  *
@@ -4748,10 +4532,10 @@ var _Provider = class {
4748
4532
  */
4749
4533
  async produceBlocks(amount, startTime) {
4750
4534
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4751
- blocksToProduce: bn16(amount).toString(10),
4535
+ blocksToProduce: bn15(amount).toString(10),
4752
4536
  startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4753
4537
  });
4754
- return bn16(latestBlockHeight);
4538
+ return bn15(latestBlockHeight);
4755
4539
  }
4756
4540
  // eslint-disable-next-line @typescript-eslint/require-await
4757
4541
  async getTransactionResponse(transactionId) {
@@ -4775,7 +4559,7 @@ __publicField(Provider, "nodeInfoCache", {});
4775
4559
 
4776
4560
  // src/providers/transaction-summary/get-transaction-summary.ts
4777
4561
  import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
4778
- import { bn as bn17 } from "@fuel-ts/math";
4562
+ import { bn as bn16 } from "@fuel-ts/math";
4779
4563
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4780
4564
  import { arrayify as arrayify12 } from "@fuel-ts/utils";
4781
4565
  async function getTransactionSummary(params) {
@@ -4793,28 +4577,21 @@ async function getTransactionSummary(params) {
4793
4577
  arrayify12(gqlTransaction.rawPayload),
4794
4578
  0
4795
4579
  );
4796
- let txReceipts = [];
4797
- if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
4798
- txReceipts = gqlTransaction.status.receipts;
4799
- }
4800
- const receipts = txReceipts.map(processGqlReceipt);
4580
+ const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
4801
4581
  const {
4802
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
4582
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
4803
4583
  } = provider.getChain();
4804
- const gasPrice = await provider.getLatestGasPrice();
4805
4584
  const transactionInfo = assembleTransactionSummary({
4806
4585
  id: gqlTransaction.id,
4807
4586
  receipts,
4808
4587
  transaction: decodedTransaction,
4809
4588
  transactionBytes: arrayify12(gqlTransaction.rawPayload),
4810
4589
  gqlTransactionStatus: gqlTransaction.status,
4811
- gasPerByte: bn17(gasPerByte),
4812
- gasPriceFactor: bn17(gasPriceFactor),
4590
+ gasPerByte: bn16(gasPerByte),
4591
+ gasPriceFactor: bn16(gasPriceFactor),
4813
4592
  abiMap,
4814
4593
  maxInputs,
4815
- gasCosts,
4816
- maxGasPerTx,
4817
- gasPrice
4594
+ gasCosts
4818
4595
  });
4819
4596
  return {
4820
4597
  gqlTransaction,
@@ -4824,11 +4601,10 @@ async function getTransactionSummary(params) {
4824
4601
  async function getTransactionSummaryFromRequest(params) {
4825
4602
  const { provider, transactionRequest, abiMap } = params;
4826
4603
  const { receipts } = await provider.call(transactionRequest);
4827
- const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
4604
+ const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
4828
4605
  const maxInputs = provider.getChain().consensusParameters.maxInputs;
4829
4606
  const transaction = transactionRequest.toTransaction();
4830
4607
  const transactionBytes = transactionRequest.toTransactionBytes();
4831
- const gasPrice = await provider.getLatestGasPrice();
4832
4608
  const transactionSummary = assembleTransactionSummary({
4833
4609
  receipts,
4834
4610
  transaction,
@@ -4837,9 +4613,7 @@ async function getTransactionSummaryFromRequest(params) {
4837
4613
  gasPerByte,
4838
4614
  gasPriceFactor,
4839
4615
  maxInputs,
4840
- gasCosts,
4841
- maxGasPerTx,
4842
- gasPrice
4616
+ gasCosts
4843
4617
  });
4844
4618
  return transactionSummary;
4845
4619
  }
@@ -4848,18 +4622,13 @@ async function getTransactionsSummaries(params) {
4848
4622
  const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
4849
4623
  const { edges, pageInfo } = transactionsByOwner;
4850
4624
  const {
4851
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
4625
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
4852
4626
  } = provider.getChain();
4853
- const gasPrice = await provider.getLatestGasPrice();
4854
4627
  const transactions = edges.map((edge) => {
4855
4628
  const { node: gqlTransaction } = edge;
4856
- const { id, rawPayload, status } = gqlTransaction;
4629
+ const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
4857
4630
  const [decodedTransaction] = new TransactionCoder6().decode(arrayify12(rawPayload), 0);
4858
- let txReceipts = [];
4859
- if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
4860
- txReceipts = gqlTransaction.status.receipts;
4861
- }
4862
- const receipts = txReceipts.map(processGqlReceipt);
4631
+ const receipts = gqlReceipts?.map(processGqlReceipt) || [];
4863
4632
  const transactionSummary = assembleTransactionSummary({
4864
4633
  id,
4865
4634
  receipts,
@@ -4870,9 +4639,7 @@ async function getTransactionsSummaries(params) {
4870
4639
  gasPerByte,
4871
4640
  gasPriceFactor,
4872
4641
  maxInputs,
4873
- gasCosts,
4874
- maxGasPerTx,
4875
- gasPrice
4642
+ gasCosts
4876
4643
  });
4877
4644
  const output = {
4878
4645
  gqlTransaction,
@@ -5204,30 +4971,37 @@ var Account = class extends AbstractAccount {
5204
4971
  * @param fee - The estimated transaction fee.
5205
4972
  * @returns A promise that resolves when the resources are added to the transaction.
5206
4973
  */
5207
- async fund(request, params) {
5208
- const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
5209
- const txRequest = request;
5210
- const requiredQuantitiesWithFee = addAmountToCoinQuantities({
5211
- amount: bn18(fee),
4974
+ async fund(request, coinQuantities, fee) {
4975
+ const updatedQuantities = addAmountToAsset({
4976
+ amount: bn17(fee),
5212
4977
  assetId: BaseAssetId3,
5213
- coinQuantities: requiredQuantities
4978
+ coinQuantities
5214
4979
  });
5215
4980
  const quantitiesDict = {};
5216
- requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
4981
+ updatedQuantities.forEach(({ amount, assetId }) => {
5217
4982
  quantitiesDict[assetId] = {
5218
4983
  required: amount,
5219
- owned: bn18(0)
4984
+ owned: bn17(0)
5220
4985
  };
5221
4986
  });
5222
- txRequest.inputs.forEach((input) => {
4987
+ const cachedUtxos = [];
4988
+ const cachedMessages = [];
4989
+ const owner = this.address.toB256();
4990
+ request.inputs.forEach((input) => {
5223
4991
  const isResource = "amount" in input;
5224
- if (!isResource) {
5225
- return;
5226
- }
5227
- const isCoin2 = "owner" in input;
5228
- const assetId = isCoin2 ? String(input.assetId) : BaseAssetId3;
5229
- if (quantitiesDict[assetId]) {
5230
- quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(input.amount);
4992
+ if (isResource) {
4993
+ const isCoin2 = "owner" in input;
4994
+ if (isCoin2) {
4995
+ const assetId = String(input.assetId);
4996
+ if (input.owner === owner && quantitiesDict[assetId]) {
4997
+ const amount = bn17(input.amount);
4998
+ quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
4999
+ cachedUtxos.push(input.id);
5000
+ }
5001
+ } else if (input.recipient === owner && input.amount && quantitiesDict[BaseAssetId3]) {
5002
+ quantitiesDict[BaseAssetId3].owned = quantitiesDict[BaseAssetId3].owned.add(input.amount);
5003
+ cachedMessages.push(input.nonce);
5004
+ }
5231
5005
  }
5232
5006
  });
5233
5007
  const missingQuantities = [];
@@ -5241,21 +5015,12 @@ var Account = class extends AbstractAccount {
5241
5015
  });
5242
5016
  const needsToBeFunded = missingQuantities.length;
5243
5017
  if (needsToBeFunded) {
5244
- const excludedIds = cacheTxInputsFromOwner(txRequest.inputs, this.address.toB256());
5245
- const resources = await this.getResourcesToSpend(missingQuantities, excludedIds);
5246
- txRequest.addResources(resources);
5247
- }
5248
- txRequest.shiftPredicateData();
5249
- txRequest.updatePredicateGasUsed(estimatedPredicates);
5250
- const requestToReestimate = clone4(txRequest);
5251
- if (addedSignatures) {
5252
- Array.from({ length: addedSignatures }).forEach(() => requestToReestimate.addEmptyWitness());
5253
- }
5254
- const { maxFee } = await this.provider.estimateTxGasAndFee({
5255
- transactionRequest: requestToReestimate
5256
- });
5257
- txRequest.maxFee = maxFee;
5258
- return txRequest;
5018
+ const resources = await this.getResourcesToSpend(missingQuantities, {
5019
+ messages: cachedMessages,
5020
+ utxos: cachedUtxos
5021
+ });
5022
+ request.addResources(resources);
5023
+ }
5259
5024
  }
5260
5025
  /**
5261
5026
  * A helper that creates a transfer transaction request and returns it.
@@ -5263,24 +5028,28 @@ var Account = class extends AbstractAccount {
5263
5028
  * @param destination - The address of the destination.
5264
5029
  * @param amount - The amount of coins to transfer.
5265
5030
  * @param assetId - The asset ID of the coins to transfer.
5266
- * @param txParams - The transaction parameters (gasLimit, tip, maturity, maxFee, witnessLimit).
5031
+ * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
5267
5032
  * @returns A promise that resolves to the prepared transaction request.
5268
5033
  */
5269
5034
  async createTransfer(destination, amount, assetId = BaseAssetId3, txParams = {}) {
5270
- const request = new ScriptTransactionRequest(txParams);
5035
+ const { minGasPrice } = this.provider.getGasConfig();
5036
+ const params = { gasPrice: minGasPrice, ...txParams };
5037
+ const request = new ScriptTransactionRequest(params);
5271
5038
  request.addCoinOutput(Address3.fromAddressOrString(destination), amount, assetId);
5272
- const txCost = await this.provider.getTransactionCost(request, {
5039
+ const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
5273
5040
  estimateTxDependencies: true,
5274
5041
  resourcesOwner: this
5275
5042
  });
5276
- this.validateGasLimitAndMaxFee({
5277
- gasUsed: txCost.gasUsed,
5278
- maxFee: txCost.maxFee,
5279
- txParams
5043
+ request.gasPrice = bn17(txParams.gasPrice ?? minGasPrice);
5044
+ request.gasLimit = bn17(txParams.gasLimit ?? gasUsed);
5045
+ this.validateGas({
5046
+ gasUsed,
5047
+ gasPrice: request.gasPrice,
5048
+ gasLimit: request.gasLimit,
5049
+ minGasPrice
5280
5050
  });
5281
- request.gasLimit = txCost.gasUsed;
5282
- request.maxFee = txCost.maxFee;
5283
- await this.fund(request, txCost);
5051
+ await this.fund(request, requiredQuantities, maxFee);
5052
+ request.updatePredicateInputs(estimatedInputs);
5284
5053
  return request;
5285
5054
  }
5286
5055
  /**
@@ -5289,11 +5058,11 @@ var Account = class extends AbstractAccount {
5289
5058
  * @param destination - The address of the destination.
5290
5059
  * @param amount - The amount of coins to transfer.
5291
5060
  * @param assetId - The asset ID of the coins to transfer.
5292
- * @param txParams - The transaction parameters (gasLimit, maturity).
5061
+ * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
5293
5062
  * @returns A promise that resolves to the transaction response.
5294
5063
  */
5295
5064
  async transfer(destination, amount, assetId = BaseAssetId3, txParams = {}) {
5296
- if (bn18(amount).lte(0)) {
5065
+ if (bn17(amount).lte(0)) {
5297
5066
  throw new FuelError15(
5298
5067
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5299
5068
  "Transfer amount must be a positive number."
@@ -5312,36 +5081,38 @@ var Account = class extends AbstractAccount {
5312
5081
  * @returns A promise that resolves to the transaction response.
5313
5082
  */
5314
5083
  async transferToContract(contractId, amount, assetId = BaseAssetId3, txParams = {}) {
5315
- if (bn18(amount).lte(0)) {
5084
+ if (bn17(amount).lte(0)) {
5316
5085
  throw new FuelError15(
5317
5086
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5318
5087
  "Transfer amount must be a positive number."
5319
5088
  );
5320
5089
  }
5321
5090
  const contractAddress = Address3.fromAddressOrString(contractId);
5091
+ const { minGasPrice } = this.provider.getGasConfig();
5092
+ const params = { gasPrice: minGasPrice, ...txParams };
5322
5093
  const { script, scriptData } = await assembleTransferToContractScript({
5323
5094
  hexlifiedContractId: contractAddress.toB256(),
5324
- amountToTransfer: bn18(amount),
5095
+ amountToTransfer: bn17(amount),
5325
5096
  assetId
5326
5097
  });
5327
5098
  const request = new ScriptTransactionRequest({
5328
- ...txParams,
5099
+ ...params,
5329
5100
  script,
5330
5101
  scriptData
5331
5102
  });
5332
5103
  request.addContractInputAndOutput(contractAddress);
5333
- const txCost = await this.provider.getTransactionCost(request, {
5334
- resourcesOwner: this,
5335
- quantitiesToContract: [{ amount: bn18(amount), assetId: String(assetId) }]
5336
- });
5337
- this.validateGasLimitAndMaxFee({
5338
- gasUsed: txCost.gasUsed,
5339
- maxFee: txCost.maxFee,
5340
- txParams
5104
+ const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
5105
+ request,
5106
+ [{ amount: bn17(amount), assetId: String(assetId) }]
5107
+ );
5108
+ request.gasLimit = bn17(params.gasLimit ?? gasUsed);
5109
+ this.validateGas({
5110
+ gasUsed,
5111
+ gasPrice: request.gasPrice,
5112
+ gasLimit: request.gasLimit,
5113
+ minGasPrice
5341
5114
  });
5342
- request.gasLimit = txCost.gasUsed;
5343
- request.maxFee = txCost.maxFee;
5344
- await this.fund(request, txCost);
5115
+ await this.fund(request, requiredQuantities, maxFee);
5345
5116
  return this.sendTransaction(request);
5346
5117
  }
5347
5118
  /**
@@ -5353,30 +5124,34 @@ var Account = class extends AbstractAccount {
5353
5124
  * @returns A promise that resolves to the transaction response.
5354
5125
  */
5355
5126
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
5127
+ const { minGasPrice } = this.provider.getGasConfig();
5356
5128
  const recipientAddress = Address3.fromAddressOrString(recipient);
5357
5129
  const recipientDataArray = arrayify14(
5358
5130
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5359
5131
  );
5360
5132
  const amountDataArray = arrayify14(
5361
- "0x".concat(bn18(amount).toHex().substring(2).padStart(16, "0"))
5133
+ "0x".concat(bn17(amount).toHex().substring(2).padStart(16, "0"))
5362
5134
  );
5363
5135
  const script = new Uint8Array([
5364
5136
  ...arrayify14(withdrawScript.bytes),
5365
5137
  ...recipientDataArray,
5366
5138
  ...amountDataArray
5367
5139
  ]);
5368
- const params = { script, ...txParams };
5140
+ const params = { script, gasPrice: minGasPrice, ...txParams };
5369
5141
  const request = new ScriptTransactionRequest(params);
5370
- const quantitiesToContract = [{ amount: bn18(amount), assetId: BaseAssetId3 }];
5371
- const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
5372
- this.validateGasLimitAndMaxFee({
5373
- gasUsed: txCost.gasUsed,
5374
- maxFee: txCost.maxFee,
5375
- txParams
5142
+ const forwardingQuantities = [{ amount: bn17(amount), assetId: BaseAssetId3 }];
5143
+ const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
5144
+ request,
5145
+ forwardingQuantities
5146
+ );
5147
+ request.gasLimit = bn17(params.gasLimit ?? gasUsed);
5148
+ this.validateGas({
5149
+ gasUsed,
5150
+ gasPrice: request.gasPrice,
5151
+ gasLimit: request.gasLimit,
5152
+ minGasPrice
5376
5153
  });
5377
- request.maxFee = txCost.maxFee;
5378
- request.gasLimit = txCost.gasUsed;
5379
- await this.fund(request, txCost);
5154
+ await this.fund(request, requiredQuantities, maxFee);
5380
5155
  return this.sendTransaction(request);
5381
5156
  }
5382
5157
  async signMessage(message) {
@@ -5434,21 +5209,22 @@ var Account = class extends AbstractAccount {
5434
5209
  }
5435
5210
  return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
5436
5211
  }
5437
- validateGasLimitAndMaxFee({
5438
- txParams: { gasLimit: setGasLimit, maxFee: setMaxFee },
5212
+ validateGas({
5439
5213
  gasUsed,
5440
- maxFee
5214
+ gasPrice,
5215
+ gasLimit,
5216
+ minGasPrice
5441
5217
  }) {
5442
- if (isDefined(setGasLimit) && gasUsed.gt(setGasLimit)) {
5218
+ if (minGasPrice.gt(gasPrice)) {
5443
5219
  throw new FuelError15(
5444
- ErrorCode15.GAS_LIMIT_TOO_LOW,
5445
- `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
5220
+ ErrorCode15.GAS_PRICE_TOO_LOW,
5221
+ `Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
5446
5222
  );
5447
5223
  }
5448
- if (isDefined(setMaxFee) && maxFee.gt(setMaxFee)) {
5224
+ if (gasUsed.gt(gasLimit)) {
5449
5225
  throw new FuelError15(
5450
- ErrorCode15.MAX_FEE_TOO_LOW,
5451
- `Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
5226
+ ErrorCode15.GAS_LIMIT_TOO_LOW,
5227
+ `Gas limit '${gasLimit}' is lower than the required: '${gasUsed}'.`
5452
5228
  );
5453
5229
  }
5454
5230
  }
@@ -5740,7 +5516,7 @@ var BaseWalletUnlocked = class extends Account {
5740
5516
  * @param transactionRequestLike - The transaction request to send.
5741
5517
  * @returns A promise that resolves to the TransactionResponse object.
5742
5518
  */
5743
- async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
5519
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
5744
5520
  const transactionRequest = transactionRequestify(transactionRequestLike);
5745
5521
  if (estimateTxDependencies) {
5746
5522
  await this.provider.estimateTxDependencies(transactionRequest);
@@ -5781,7 +5557,7 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5781
5557
  // src/hdwallet/hdwallet.ts
5782
5558
  import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
5783
5559
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
5784
- import { bn as bn19, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5560
+ import { bn as bn18, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5785
5561
  import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
5786
5562
  import { toBeHex, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58, computeHmac as computeHmac2, ripemd160 } from "ethers";
5787
5563
 
@@ -8253,7 +8029,7 @@ var HDWallet = class {
8253
8029
  const IR = bytes.slice(32);
8254
8030
  if (privateKey) {
8255
8031
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
8256
- const ki = bn19(IL).add(privateKey).mod(N).toBytes(32);
8032
+ const ki = bn18(IL).add(privateKey).mod(N).toBytes(32);
8257
8033
  return new HDWallet({
8258
8034
  privateKey: ki,
8259
8035
  chainCode: IR,
@@ -8940,8 +8716,9 @@ import {
8940
8716
  SCRIPT_FIXED_SIZE
8941
8717
  } from "@fuel-ts/abi-coder";
8942
8718
  import { Address as Address9 } from "@fuel-ts/address";
8719
+ import { BaseAssetId as BaseAssetId4 } from "@fuel-ts/address/configs";
8943
8720
  import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
8944
- import { ByteArrayCoder, InputType as InputType8 } from "@fuel-ts/transactions";
8721
+ import { ByteArrayCoder } from "@fuel-ts/transactions";
8945
8722
  import { arrayify as arrayify20, hexlify as hexlify19 } from "@fuel-ts/utils";
8946
8723
 
8947
8724
  // src/predicate/utils/getPredicateRoot.ts
@@ -9000,23 +8777,41 @@ var Predicate = class extends Account {
9000
8777
  populateTransactionPredicateData(transactionRequestLike) {
9001
8778
  const request = transactionRequestify(transactionRequestLike);
9002
8779
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
9003
- request.inputs?.forEach((input) => {
9004
- if (input.type === InputType8.Coin && hexlify19(input.owner) === this.address.toB256()) {
9005
- input.predicate = hexlify19(this.bytes);
9006
- input.predicateData = hexlify19(this.getPredicateData(policies.length));
8780
+ const placeholderIndex = this.getIndexFromPlaceholderWitness(request);
8781
+ if (placeholderIndex !== -1) {
8782
+ request.removeWitness(placeholderIndex);
8783
+ }
8784
+ request.inputs.filter(isRequestInputResource).forEach((input) => {
8785
+ if (isRequestInputResourceFromOwner(input, this.address)) {
8786
+ input.predicate = this.bytes;
8787
+ input.predicateData = this.getPredicateData(policies.length);
8788
+ input.witnessIndex = 0;
9007
8789
  }
9008
8790
  });
9009
8791
  return request;
9010
8792
  }
8793
+ /**
8794
+ * A helper that creates a transfer transaction request and returns it.
8795
+ *
8796
+ * @param destination - The address of the destination.
8797
+ * @param amount - The amount of coins to transfer.
8798
+ * @param assetId - The asset ID of the coins to transfer.
8799
+ * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
8800
+ * @returns A promise that resolves to the prepared transaction request.
8801
+ */
8802
+ async createTransfer(destination, amount, assetId = BaseAssetId4, txParams = {}) {
8803
+ const request = await super.createTransfer(destination, amount, assetId, txParams);
8804
+ return this.populateTransactionPredicateData(request);
8805
+ }
9011
8806
  /**
9012
8807
  * Sends a transaction with the populated predicate data.
9013
8808
  *
9014
8809
  * @param transactionRequestLike - The transaction request-like object.
9015
8810
  * @returns A promise that resolves to the transaction response.
9016
8811
  */
9017
- sendTransaction(transactionRequestLike) {
9018
- const transactionRequest = transactionRequestify(transactionRequestLike);
9019
- return super.sendTransaction(transactionRequest, { estimateTxDependencies: false });
8812
+ sendTransaction(transactionRequestLike, options) {
8813
+ const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
8814
+ return super.sendTransaction(transactionRequest, options);
9020
8815
  }
9021
8816
  /**
9022
8817
  * Simulates a transaction with the populated predicate data.
@@ -9025,8 +8820,22 @@ var Predicate = class extends Account {
9025
8820
  * @returns A promise that resolves to the call result.
9026
8821
  */
9027
8822
  simulateTransaction(transactionRequestLike) {
9028
- const transactionRequest = transactionRequestify(transactionRequestLike);
9029
- return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
8823
+ const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
8824
+ return super.simulateTransaction(transactionRequest);
8825
+ }
8826
+ /**
8827
+ * Retrieves resources satisfying the spend query for the account.
8828
+ *
8829
+ * @param quantities - Coins to retrieve.
8830
+ * @param excludedIds - IDs of resources to be excluded from the query.
8831
+ * @returns A promise that resolves to an array of Resources.
8832
+ */
8833
+ async getResourcesToSpend(quantities, excludedIds) {
8834
+ const resources = await super.getResourcesToSpend(quantities, excludedIds);
8835
+ return resources.map((resource) => ({
8836
+ ...resource,
8837
+ predicate: hexlify19(this.bytes)
8838
+ }));
9030
8839
  }
9031
8840
  getPredicateData(policiesLength) {
9032
8841
  if (!this.predicateData.length) {
@@ -9072,25 +8881,6 @@ var Predicate = class extends Account {
9072
8881
  predicateInterface: abiInterface
9073
8882
  };
9074
8883
  }
9075
- /**
9076
- * Retrieves resources satisfying the spend query for the account.
9077
- *
9078
- * @param quantities - IDs of coins to exclude.
9079
- * @param excludedIds - IDs of resources to be excluded from the query.
9080
- * @returns A promise that resolves to an array of Resources.
9081
- */
9082
- async getResourcesToSpend(quantities, excludedIds) {
9083
- const resources = await this.provider.getResourcesToSpend(
9084
- this.address,
9085
- quantities,
9086
- excludedIds
9087
- );
9088
- return resources.map((resource) => ({
9089
- ...resource,
9090
- predicate: hexlify19(this.bytes),
9091
- padPredicateData: (policiesLength) => hexlify19(this.getPredicateData(policiesLength))
9092
- }));
9093
- }
9094
8884
  /**
9095
8885
  * Sets the configurable constants for the predicate.
9096
8886
  *
@@ -9126,6 +8916,28 @@ var Predicate = class extends Account {
9126
8916
  }
9127
8917
  return mutatedBytes;
9128
8918
  }
8919
+ /**
8920
+ * Returns the index of the witness placeholder that was added to this predicate.
8921
+ * If no witness placeholder was added, it returns -1.
8922
+ * @param request - The transaction request.
8923
+ * @returns The index of the witness placeholder, or -1 if there is no witness placeholder.
8924
+ */
8925
+ getIndexFromPlaceholderWitness(request) {
8926
+ const predicateInputs = request.inputs.filter(isRequestInputResource).filter((input) => isRequestInputResourceFromOwner(input, this.address));
8927
+ let index = -1;
8928
+ const hasEmptyPredicateInputs = predicateInputs.find((input) => !input.predicate);
8929
+ if (hasEmptyPredicateInputs) {
8930
+ index = hasEmptyPredicateInputs.witnessIndex;
8931
+ const allInputsAreEmpty = predicateInputs.every((input) => !input.predicate);
8932
+ if (!allInputsAreEmpty) {
8933
+ const wasFilledInputAddedFirst = !!predicateInputs[0]?.predicate;
8934
+ if (wasFilledInputAddedFirst) {
8935
+ index = -1;
8936
+ }
8937
+ }
8938
+ }
8939
+ return index;
8940
+ }
9129
8941
  };
9130
8942
 
9131
8943
  // src/connectors/fuel.ts
@@ -9839,7 +9651,7 @@ export {
9839
9651
  WalletLocked,
9840
9652
  WalletManager,
9841
9653
  WalletUnlocked,
9842
- addAmountToCoinQuantities,
9654
+ addAmountToAsset,
9843
9655
  addOperation,
9844
9656
  assemblePanicError,
9845
9657
  assembleReceiptByType,
@@ -9848,10 +9660,10 @@ export {
9848
9660
  assets,
9849
9661
  buildBlockExplorerUrl,
9850
9662
  cacheFor,
9851
- cacheTxInputsFromOwner,
9852
- calculateGasFee,
9663
+ cacheResources,
9853
9664
  calculateMetadataGasForTxCreate,
9854
9665
  calculateMetadataGasForTxScript,
9666
+ calculatePriceWithFactor,
9855
9667
  calculateTransactionFee,
9856
9668
  coinQuantityfy,
9857
9669
  deferPromise,
@@ -9895,6 +9707,7 @@ export {
9895
9707
  getReceiptsMessageOut,
9896
9708
  getReceiptsTransferOut,
9897
9709
  getReceiptsWithMissingData,
9710
+ getRequestInputResourceOwner,
9898
9711
  getTransactionStatusName,
9899
9712
  getTransactionSummary,
9900
9713
  getTransactionSummaryFromRequest,
@@ -9908,6 +9721,10 @@ export {
9908
9721
  isMessage,
9909
9722
  isRawCoin,
9910
9723
  isRawMessage,
9724
+ isRequestInputCoin,
9725
+ isRequestInputMessage,
9726
+ isRequestInputResource,
9727
+ isRequestInputResourceFromOwner,
9911
9728
  isType,
9912
9729
  isTypeCreate,
9913
9730
  isTypeMint,