@fuel-ts/account 0.0.0-rc-2241-20240508114911 → 0.0.0-rc-2037-20240508123129

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 (40) hide show
  1. package/dist/index.global.js +197 -168
  2. package/dist/index.global.js.map +1 -1
  3. package/dist/index.js +430 -387
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +337 -301
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/predicate/predicate.d.ts +9 -2
  8. package/dist/predicate/predicate.d.ts.map +1 -1
  9. package/dist/providers/__generated__/operations.d.ts +552 -346
  10. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  11. package/dist/providers/provider.d.ts +10 -4
  12. package/dist/providers/provider.d.ts.map +1 -1
  13. package/dist/providers/transaction-request/helpers.d.ts +4 -0
  14. package/dist/providers/transaction-request/helpers.d.ts.map +1 -1
  15. package/dist/providers/transaction-request/index.d.ts +1 -0
  16. package/dist/providers/transaction-request/index.d.ts.map +1 -1
  17. package/dist/providers/transaction-request/transaction-request.d.ts +2 -0
  18. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  19. package/dist/providers/transaction-request/utils.d.ts +0 -4
  20. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  21. package/dist/providers/transaction-summary/receipt.d.ts +2 -2
  22. package/dist/providers/transaction-summary/receipt.d.ts.map +1 -1
  23. package/dist/providers/transaction-summary/types.d.ts +13 -5
  24. package/dist/providers/transaction-summary/types.d.ts.map +1 -1
  25. package/dist/providers/utils/extract-tx-error.d.ts +2 -2
  26. package/dist/providers/utils/extract-tx-error.d.ts.map +1 -1
  27. package/dist/providers/utils/gas.d.ts.map +1 -1
  28. package/dist/providers/utils/receipts.d.ts +2 -2
  29. package/dist/providers/utils/receipts.d.ts.map +1 -1
  30. package/dist/test-utils/seedTestWallet.d.ts +1 -1
  31. package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
  32. package/dist/test-utils.global.js +163 -175
  33. package/dist/test-utils.global.js.map +1 -1
  34. package/dist/test-utils.js +373 -385
  35. package/dist/test-utils.js.map +1 -1
  36. package/dist/test-utils.mjs +292 -304
  37. package/dist/test-utils.mjs.map +1 -1
  38. package/dist/wallet/base-wallet-unlocked.d.ts +2 -2
  39. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  40. package/package.json +15 -15
@@ -106,8 +106,8 @@ var addAmountToCoinQuantities = (params) => {
106
106
  // src/providers/provider.ts
107
107
  var import_address3 = require("@fuel-ts/address");
108
108
  var import_errors14 = require("@fuel-ts/errors");
109
- var import_math17 = require("@fuel-ts/math");
110
- var import_transactions19 = require("@fuel-ts/transactions");
109
+ var import_math18 = require("@fuel-ts/math");
110
+ var import_transactions20 = require("@fuel-ts/transactions");
111
111
  var import_utils22 = require("@fuel-ts/utils");
112
112
  var import_versions = require("@fuel-ts/versions");
113
113
  var import_utils23 = require("@noble/curves/abstract/utils");
@@ -116,7 +116,7 @@ var import_ramda3 = require("ramda");
116
116
 
117
117
  // src/providers/__generated__/operations.ts
118
118
  var import_graphql_tag = __toESM(require("graphql-tag"));
119
- var TransactionStatusSubscriptionFragmentDoc = import_graphql_tag.default`
119
+ var TransactionStatusSubscriptionFragmentFragmentDoc = import_graphql_tag.default`
120
120
  fragment transactionStatusSubscriptionFragment on TransactionStatus {
121
121
  type: __typename
122
122
  ... on SqueezedOutStatus {
@@ -124,13 +124,7 @@ var TransactionStatusSubscriptionFragmentDoc = import_graphql_tag.default`
124
124
  }
125
125
  }
126
126
  `;
127
- var SubmittedStatusFragmentDoc = import_graphql_tag.default`
128
- fragment SubmittedStatusFragment on SubmittedStatus {
129
- type: __typename
130
- time
131
- }
132
- `;
133
- var ReceiptFragmentDoc = import_graphql_tag.default`
127
+ var ReceiptFragmentFragmentDoc = import_graphql_tag.default`
134
128
  fragment receiptFragment on Receipt {
135
129
  id
136
130
  pc
@@ -162,65 +156,45 @@ var ReceiptFragmentDoc = import_graphql_tag.default`
162
156
  subId
163
157
  }
164
158
  `;
165
- var SuccessStatusFragmentDoc = import_graphql_tag.default`
166
- fragment SuccessStatusFragment on SuccessStatus {
167
- type: __typename
168
- block {
169
- id
170
- }
171
- time
172
- programState {
173
- returnType
174
- data
175
- }
176
- receipts {
177
- ...receiptFragment
178
- }
179
- totalGas
180
- totalFee
181
- }
182
- ${ReceiptFragmentDoc}`;
183
- var FailureStatusFragmentDoc = import_graphql_tag.default`
184
- fragment FailureStatusFragment on FailureStatus {
185
- type: __typename
186
- block {
187
- id
188
- }
189
- totalGas
190
- totalFee
191
- time
192
- reason
193
- receipts {
194
- ...receiptFragment
195
- }
196
- }
197
- ${ReceiptFragmentDoc}`;
198
- var SqueezedOutStatusFragmentDoc = import_graphql_tag.default`
199
- fragment SqueezedOutStatusFragment on SqueezedOutStatus {
200
- type: __typename
201
- reason
202
- }
203
- `;
204
- var TransactionStatusFragmentDoc = import_graphql_tag.default`
159
+ var TransactionStatusFragmentFragmentDoc = import_graphql_tag.default`
205
160
  fragment transactionStatusFragment on TransactionStatus {
161
+ type: __typename
206
162
  ... on SubmittedStatus {
207
- ...SubmittedStatusFragment
163
+ time
208
164
  }
209
165
  ... on SuccessStatus {
210
- ...SuccessStatusFragment
166
+ block {
167
+ id
168
+ }
169
+ time
170
+ programState {
171
+ returnType
172
+ data
173
+ }
174
+ receipts {
175
+ ...receiptFragment
176
+ }
177
+ totalGas
178
+ totalFee
211
179
  }
212
180
  ... on FailureStatus {
213
- ...FailureStatusFragment
181
+ block {
182
+ id
183
+ }
184
+ totalGas
185
+ totalFee
186
+ time
187
+ reason
188
+ receipts {
189
+ ...receiptFragment
190
+ }
214
191
  }
215
192
  ... on SqueezedOutStatus {
216
- ...SqueezedOutStatusFragment
193
+ reason
217
194
  }
218
195
  }
219
- ${SubmittedStatusFragmentDoc}
220
- ${SuccessStatusFragmentDoc}
221
- ${FailureStatusFragmentDoc}
222
- ${SqueezedOutStatusFragmentDoc}`;
223
- var TransactionFragmentDoc = import_graphql_tag.default`
196
+ ${ReceiptFragmentFragmentDoc}`;
197
+ var TransactionFragmentFragmentDoc = import_graphql_tag.default`
224
198
  fragment transactionFragment on Transaction {
225
199
  id
226
200
  rawPayload
@@ -228,8 +202,8 @@ var TransactionFragmentDoc = import_graphql_tag.default`
228
202
  ...transactionStatusFragment
229
203
  }
230
204
  }
231
- ${TransactionStatusFragmentDoc}`;
232
- var InputEstimatePredicatesFragmentDoc = import_graphql_tag.default`
205
+ ${TransactionStatusFragmentFragmentDoc}`;
206
+ var InputEstimatePredicatesFragmentFragmentDoc = import_graphql_tag.default`
233
207
  fragment inputEstimatePredicatesFragment on Input {
234
208
  ... on InputCoin {
235
209
  predicateGasUsed
@@ -239,14 +213,14 @@ var InputEstimatePredicatesFragmentDoc = import_graphql_tag.default`
239
213
  }
240
214
  }
241
215
  `;
242
- var TransactionEstimatePredicatesFragmentDoc = import_graphql_tag.default`
216
+ var TransactionEstimatePredicatesFragmentFragmentDoc = import_graphql_tag.default`
243
217
  fragment transactionEstimatePredicatesFragment on Transaction {
244
218
  inputs {
245
219
  ...inputEstimatePredicatesFragment
246
220
  }
247
221
  }
248
- ${InputEstimatePredicatesFragmentDoc}`;
249
- var DryRunFailureStatusFragmentDoc = import_graphql_tag.default`
222
+ ${InputEstimatePredicatesFragmentFragmentDoc}`;
223
+ var DryRunFailureStatusFragmentFragmentDoc = import_graphql_tag.default`
250
224
  fragment dryRunFailureStatusFragment on DryRunFailureStatus {
251
225
  totalGas
252
226
  totalFee
@@ -257,7 +231,7 @@ var DryRunFailureStatusFragmentDoc = import_graphql_tag.default`
257
231
  }
258
232
  }
259
233
  `;
260
- var DryRunSuccessStatusFragmentDoc = import_graphql_tag.default`
234
+ var DryRunSuccessStatusFragmentFragmentDoc = import_graphql_tag.default`
261
235
  fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
262
236
  totalGas
263
237
  totalFee
@@ -267,7 +241,7 @@ var DryRunSuccessStatusFragmentDoc = import_graphql_tag.default`
267
241
  }
268
242
  }
269
243
  `;
270
- var DryRunTransactionStatusFragmentDoc = import_graphql_tag.default`
244
+ var DryRunTransactionStatusFragmentFragmentDoc = import_graphql_tag.default`
271
245
  fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
272
246
  ... on DryRunFailureStatus {
273
247
  ...dryRunFailureStatusFragment
@@ -276,9 +250,9 @@ var DryRunTransactionStatusFragmentDoc = import_graphql_tag.default`
276
250
  ...dryRunSuccessStatusFragment
277
251
  }
278
252
  }
279
- ${DryRunFailureStatusFragmentDoc}
280
- ${DryRunSuccessStatusFragmentDoc}`;
281
- var DryRunTransactionExecutionStatusFragmentDoc = import_graphql_tag.default`
253
+ ${DryRunFailureStatusFragmentFragmentDoc}
254
+ ${DryRunSuccessStatusFragmentFragmentDoc}`;
255
+ var DryRunTransactionExecutionStatusFragmentFragmentDoc = import_graphql_tag.default`
282
256
  fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
283
257
  id
284
258
  status {
@@ -288,11 +262,11 @@ var DryRunTransactionExecutionStatusFragmentDoc = import_graphql_tag.default`
288
262
  ...receiptFragment
289
263
  }
290
264
  }
291
- ${DryRunTransactionStatusFragmentDoc}
292
- ${ReceiptFragmentDoc}`;
293
- var CoinFragmentDoc = import_graphql_tag.default`
265
+ ${DryRunTransactionStatusFragmentFragmentDoc}
266
+ ${ReceiptFragmentFragmentDoc}`;
267
+ var CoinFragmentFragmentDoc = import_graphql_tag.default`
294
268
  fragment coinFragment on Coin {
295
- type: __typename
269
+ __typename
296
270
  utxoId
297
271
  owner
298
272
  amount
@@ -301,9 +275,9 @@ var CoinFragmentDoc = import_graphql_tag.default`
301
275
  txCreatedIdx
302
276
  }
303
277
  `;
304
- var MessageCoinFragmentDoc = import_graphql_tag.default`
278
+ var MessageCoinFragmentFragmentDoc = import_graphql_tag.default`
305
279
  fragment messageCoinFragment on MessageCoin {
306
- type: __typename
280
+ __typename
307
281
  sender
308
282
  recipient
309
283
  nonce
@@ -312,7 +286,7 @@ var MessageCoinFragmentDoc = import_graphql_tag.default`
312
286
  daHeight
313
287
  }
314
288
  `;
315
- var MessageFragmentDoc = import_graphql_tag.default`
289
+ var MessageFragmentFragmentDoc = import_graphql_tag.default`
316
290
  fragment messageFragment on Message {
317
291
  amount
318
292
  sender
@@ -322,7 +296,7 @@ var MessageFragmentDoc = import_graphql_tag.default`
322
296
  daHeight
323
297
  }
324
298
  `;
325
- var MessageProofFragmentDoc = import_graphql_tag.default`
299
+ var MessageProofFragmentFragmentDoc = import_graphql_tag.default`
326
300
  fragment messageProofFragment on MessageProof {
327
301
  messageProof {
328
302
  proofSet
@@ -369,14 +343,14 @@ var MessageProofFragmentDoc = import_graphql_tag.default`
369
343
  data
370
344
  }
371
345
  `;
372
- var BalanceFragmentDoc = import_graphql_tag.default`
346
+ var BalanceFragmentFragmentDoc = import_graphql_tag.default`
373
347
  fragment balanceFragment on Balance {
374
348
  owner
375
349
  amount
376
350
  assetId
377
351
  }
378
352
  `;
379
- var BlockFragmentDoc = import_graphql_tag.default`
353
+ var BlockFragmentFragmentDoc = import_graphql_tag.default`
380
354
  fragment blockFragment on Block {
381
355
  id
382
356
  height
@@ -388,7 +362,7 @@ var BlockFragmentDoc = import_graphql_tag.default`
388
362
  }
389
363
  }
390
364
  `;
391
- var TxParametersFragmentDoc = import_graphql_tag.default`
365
+ var TxParametersFragmentFragmentDoc = import_graphql_tag.default`
392
366
  fragment TxParametersFragment on TxParameters {
393
367
  version
394
368
  maxInputs
@@ -399,7 +373,7 @@ var TxParametersFragmentDoc = import_graphql_tag.default`
399
373
  maxBytecodeSubsections
400
374
  }
401
375
  `;
402
- var PredicateParametersFragmentDoc = import_graphql_tag.default`
376
+ var PredicateParametersFragmentFragmentDoc = import_graphql_tag.default`
403
377
  fragment PredicateParametersFragment on PredicateParameters {
404
378
  version
405
379
  maxPredicateLength
@@ -408,42 +382,41 @@ var PredicateParametersFragmentDoc = import_graphql_tag.default`
408
382
  maxMessageDataLength
409
383
  }
410
384
  `;
411
- var ScriptParametersFragmentDoc = import_graphql_tag.default`
385
+ var ScriptParametersFragmentFragmentDoc = import_graphql_tag.default`
412
386
  fragment ScriptParametersFragment on ScriptParameters {
413
387
  version
414
388
  maxScriptLength
415
389
  maxScriptDataLength
416
390
  }
417
391
  `;
418
- var ContractParametersFragmentDoc = import_graphql_tag.default`
392
+ var ContractParametersFragmentFragmentDoc = import_graphql_tag.default`
419
393
  fragment ContractParametersFragment on ContractParameters {
420
394
  version
421
395
  contractMaxSize
422
396
  maxStorageSlots
423
397
  }
424
398
  `;
425
- var FeeParametersFragmentDoc = import_graphql_tag.default`
399
+ var FeeParametersFragmentFragmentDoc = import_graphql_tag.default`
426
400
  fragment FeeParametersFragment on FeeParameters {
427
401
  version
428
402
  gasPriceFactor
429
403
  gasPerByte
430
404
  }
431
405
  `;
432
- var DependentCostFragmentDoc = import_graphql_tag.default`
406
+ var DependentCostFragmentFragmentDoc = import_graphql_tag.default`
433
407
  fragment DependentCostFragment on DependentCost {
408
+ __typename
434
409
  ... on LightOperation {
435
- type: __typename
436
410
  base
437
411
  unitsPerGas
438
412
  }
439
413
  ... on HeavyOperation {
440
- type: __typename
441
414
  base
442
415
  gasPerUnit
443
416
  }
444
417
  }
445
418
  `;
446
- var GasCostsFragmentDoc = import_graphql_tag.default`
419
+ var GasCostsFragmentFragmentDoc = import_graphql_tag.default`
447
420
  fragment GasCostsFragment on GasCosts {
448
421
  version
449
422
  add
@@ -599,8 +572,8 @@ var GasCostsFragmentDoc = import_graphql_tag.default`
599
572
  }
600
573
  newStoragePerByte
601
574
  }
602
- ${DependentCostFragmentDoc}`;
603
- var ConsensusParametersFragmentDoc = import_graphql_tag.default`
575
+ ${DependentCostFragmentFragmentDoc}`;
576
+ var ConsensusParametersFragmentFragmentDoc = import_graphql_tag.default`
604
577
  fragment consensusParametersFragment on ConsensusParameters {
605
578
  version
606
579
  txParams {
@@ -624,13 +597,13 @@ var ConsensusParametersFragmentDoc = import_graphql_tag.default`
624
597
  baseAssetId
625
598
  chainId
626
599
  }
627
- ${TxParametersFragmentDoc}
628
- ${PredicateParametersFragmentDoc}
629
- ${ScriptParametersFragmentDoc}
630
- ${ContractParametersFragmentDoc}
631
- ${FeeParametersFragmentDoc}
632
- ${GasCostsFragmentDoc}`;
633
- var ChainInfoFragmentDoc = import_graphql_tag.default`
600
+ ${TxParametersFragmentFragmentDoc}
601
+ ${PredicateParametersFragmentFragmentDoc}
602
+ ${ScriptParametersFragmentFragmentDoc}
603
+ ${ContractParametersFragmentFragmentDoc}
604
+ ${FeeParametersFragmentFragmentDoc}
605
+ ${GasCostsFragmentFragmentDoc}`;
606
+ var ChainInfoFragmentFragmentDoc = import_graphql_tag.default`
634
607
  fragment chainInfoFragment on ChainInfo {
635
608
  name
636
609
  latestBlock {
@@ -641,16 +614,16 @@ var ChainInfoFragmentDoc = import_graphql_tag.default`
641
614
  ...consensusParametersFragment
642
615
  }
643
616
  }
644
- ${BlockFragmentDoc}
645
- ${ConsensusParametersFragmentDoc}`;
646
- var ContractBalanceFragmentDoc = import_graphql_tag.default`
617
+ ${BlockFragmentFragmentDoc}
618
+ ${ConsensusParametersFragmentFragmentDoc}`;
619
+ var ContractBalanceFragmentFragmentDoc = import_graphql_tag.default`
647
620
  fragment contractBalanceFragment on ContractBalance {
648
621
  contract
649
622
  amount
650
623
  assetId
651
624
  }
652
625
  `;
653
- var PageInfoFragmentDoc = import_graphql_tag.default`
626
+ var PageInfoFragmentFragmentDoc = import_graphql_tag.default`
654
627
  fragment pageInfoFragment on PageInfo {
655
628
  hasPreviousPage
656
629
  hasNextPage
@@ -658,7 +631,7 @@ var PageInfoFragmentDoc = import_graphql_tag.default`
658
631
  endCursor
659
632
  }
660
633
  `;
661
- var NodeInfoFragmentDoc = import_graphql_tag.default`
634
+ var NodeInfoFragmentFragmentDoc = import_graphql_tag.default`
662
635
  fragment nodeInfoFragment on NodeInfo {
663
636
  utxoValidation
664
637
  vmBacktrace
@@ -667,7 +640,7 @@ var NodeInfoFragmentDoc = import_graphql_tag.default`
667
640
  nodeVersion
668
641
  }
669
642
  `;
670
- var RelayedTransactionStatusFragmentDoc = import_graphql_tag.default`
643
+ var RelayedTransactionStatusFragmentFragmentDoc = import_graphql_tag.default`
671
644
  fragment relayedTransactionStatusFragment on RelayedTransactionStatus {
672
645
  ... on RelayedTransactionFailed {
673
646
  blockHeight
@@ -688,28 +661,28 @@ var GetNodeInfoDocument = import_graphql_tag.default`
688
661
  ...nodeInfoFragment
689
662
  }
690
663
  }
691
- ${NodeInfoFragmentDoc}`;
664
+ ${NodeInfoFragmentFragmentDoc}`;
692
665
  var GetChainDocument = import_graphql_tag.default`
693
666
  query getChain {
694
667
  chain {
695
668
  ...chainInfoFragment
696
669
  }
697
670
  }
698
- ${ChainInfoFragmentDoc}`;
671
+ ${ChainInfoFragmentFragmentDoc}`;
699
672
  var GetTransactionDocument = import_graphql_tag.default`
700
673
  query getTransaction($transactionId: TransactionId!) {
701
674
  transaction(id: $transactionId) {
702
675
  ...transactionFragment
703
676
  }
704
677
  }
705
- ${TransactionFragmentDoc}`;
678
+ ${TransactionFragmentFragmentDoc}`;
706
679
  var GetTransactionWithReceiptsDocument = import_graphql_tag.default`
707
680
  query getTransactionWithReceipts($transactionId: TransactionId!) {
708
681
  transaction(id: $transactionId) {
709
682
  ...transactionFragment
710
683
  }
711
684
  }
712
- ${TransactionFragmentDoc}`;
685
+ ${TransactionFragmentFragmentDoc}`;
713
686
  var GetTransactionsDocument = import_graphql_tag.default`
714
687
  query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
715
688
  transactions(after: $after, before: $before, first: $first, last: $last) {
@@ -720,7 +693,7 @@ var GetTransactionsDocument = import_graphql_tag.default`
720
693
  }
721
694
  }
722
695
  }
723
- ${TransactionFragmentDoc}`;
696
+ ${TransactionFragmentFragmentDoc}`;
724
697
  var GetTransactionsByOwnerDocument = import_graphql_tag.default`
725
698
  query getTransactionsByOwner($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
726
699
  transactionsByOwner(
@@ -740,22 +713,22 @@ var GetTransactionsByOwnerDocument = import_graphql_tag.default`
740
713
  }
741
714
  }
742
715
  }
743
- ${PageInfoFragmentDoc}
744
- ${TransactionFragmentDoc}`;
716
+ ${PageInfoFragmentFragmentDoc}
717
+ ${TransactionFragmentFragmentDoc}`;
745
718
  var EstimatePredicatesDocument = import_graphql_tag.default`
746
719
  query estimatePredicates($encodedTransaction: HexString!) {
747
720
  estimatePredicates(tx: $encodedTransaction) {
748
721
  ...transactionEstimatePredicatesFragment
749
722
  }
750
723
  }
751
- ${TransactionEstimatePredicatesFragmentDoc}`;
724
+ ${TransactionEstimatePredicatesFragmentFragmentDoc}`;
752
725
  var GetBlockDocument = import_graphql_tag.default`
753
726
  query getBlock($blockId: BlockId, $height: U32) {
754
727
  block(id: $blockId, height: $height) {
755
728
  ...blockFragment
756
729
  }
757
730
  }
758
- ${BlockFragmentDoc}`;
731
+ ${BlockFragmentFragmentDoc}`;
759
732
  var GetBlockWithTransactionsDocument = import_graphql_tag.default`
760
733
  query getBlockWithTransactions($blockId: BlockId, $blockHeight: U32) {
761
734
  block(id: $blockId, height: $blockHeight) {
@@ -765,8 +738,8 @@ var GetBlockWithTransactionsDocument = import_graphql_tag.default`
765
738
  }
766
739
  }
767
740
  }
768
- ${BlockFragmentDoc}
769
- ${TransactionFragmentDoc}`;
741
+ ${BlockFragmentFragmentDoc}
742
+ ${TransactionFragmentFragmentDoc}`;
770
743
  var GetBlocksDocument = import_graphql_tag.default`
771
744
  query getBlocks($after: String, $before: String, $first: Int, $last: Int) {
772
745
  blocks(after: $after, before: $before, first: $first, last: $last) {
@@ -777,14 +750,14 @@ var GetBlocksDocument = import_graphql_tag.default`
777
750
  }
778
751
  }
779
752
  }
780
- ${BlockFragmentDoc}`;
753
+ ${BlockFragmentFragmentDoc}`;
781
754
  var GetCoinDocument = import_graphql_tag.default`
782
755
  query getCoin($coinId: UtxoId!) {
783
756
  coin(utxoId: $coinId) {
784
757
  ...coinFragment
785
758
  }
786
759
  }
787
- ${CoinFragmentDoc}`;
760
+ ${CoinFragmentFragmentDoc}`;
788
761
  var GetCoinsDocument = import_graphql_tag.default`
789
762
  query getCoins($filter: CoinFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
790
763
  coins(
@@ -801,7 +774,7 @@ var GetCoinsDocument = import_graphql_tag.default`
801
774
  }
802
775
  }
803
776
  }
804
- ${CoinFragmentDoc}`;
777
+ ${CoinFragmentFragmentDoc}`;
805
778
  var GetCoinsToSpendDocument = import_graphql_tag.default`
806
779
  query getCoinsToSpend($owner: Address!, $queryPerAsset: [SpendQueryElementInput!]!, $excludedIds: ExcludeInput) {
807
780
  coinsToSpend(
@@ -813,8 +786,8 @@ var GetCoinsToSpendDocument = import_graphql_tag.default`
813
786
  ...messageCoinFragment
814
787
  }
815
788
  }
816
- ${CoinFragmentDoc}
817
- ${MessageCoinFragmentDoc}`;
789
+ ${CoinFragmentFragmentDoc}
790
+ ${MessageCoinFragmentFragmentDoc}`;
818
791
  var GetContractDocument = import_graphql_tag.default`
819
792
  query getContract($contractId: ContractId!) {
820
793
  contract(id: $contractId) {
@@ -829,14 +802,14 @@ var GetContractBalanceDocument = import_graphql_tag.default`
829
802
  ...contractBalanceFragment
830
803
  }
831
804
  }
832
- ${ContractBalanceFragmentDoc}`;
805
+ ${ContractBalanceFragmentFragmentDoc}`;
833
806
  var GetBalanceDocument = import_graphql_tag.default`
834
807
  query getBalance($owner: Address!, $assetId: AssetId!) {
835
808
  balance(owner: $owner, assetId: $assetId) {
836
809
  ...balanceFragment
837
810
  }
838
811
  }
839
- ${BalanceFragmentDoc}`;
812
+ ${BalanceFragmentFragmentDoc}`;
840
813
  var GetLatestGasPriceDocument = import_graphql_tag.default`
841
814
  query getLatestGasPrice {
842
815
  latestGasPrice {
@@ -867,7 +840,7 @@ var GetBalancesDocument = import_graphql_tag.default`
867
840
  }
868
841
  }
869
842
  }
870
- ${BalanceFragmentDoc}`;
843
+ ${BalanceFragmentFragmentDoc}`;
871
844
  var GetMessagesDocument = import_graphql_tag.default`
872
845
  query getMessages($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
873
846
  messages(
@@ -884,7 +857,7 @@ var GetMessagesDocument = import_graphql_tag.default`
884
857
  }
885
858
  }
886
859
  }
887
- ${MessageFragmentDoc}`;
860
+ ${MessageFragmentFragmentDoc}`;
888
861
  var GetMessageProofDocument = import_graphql_tag.default`
889
862
  query getMessageProof($transactionId: TransactionId!, $nonce: Nonce!, $commitBlockId: BlockId, $commitBlockHeight: U32) {
890
863
  messageProof(
@@ -896,7 +869,7 @@ var GetMessageProofDocument = import_graphql_tag.default`
896
869
  ...messageProofFragment
897
870
  }
898
871
  }
899
- ${MessageProofFragmentDoc}`;
872
+ ${MessageProofFragmentFragmentDoc}`;
900
873
  var GetMessageStatusDocument = import_graphql_tag.default`
901
874
  query getMessageStatus($nonce: Nonce!) {
902
875
  messageStatus(nonce: $nonce) {
@@ -910,14 +883,14 @@ var GetRelayedTransactionStatusDocument = import_graphql_tag.default`
910
883
  ...relayedTransactionStatusFragment
911
884
  }
912
885
  }
913
- ${RelayedTransactionStatusFragmentDoc}`;
886
+ ${RelayedTransactionStatusFragmentFragmentDoc}`;
914
887
  var DryRunDocument = import_graphql_tag.default`
915
888
  mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
916
889
  dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
917
890
  ...dryRunTransactionExecutionStatusFragment
918
891
  }
919
892
  }
920
- ${DryRunTransactionExecutionStatusFragmentDoc}`;
893
+ ${DryRunTransactionExecutionStatusFragmentFragmentDoc}`;
921
894
  var SubmitDocument = import_graphql_tag.default`
922
895
  mutation submit($encodedTransaction: HexString!) {
923
896
  submit(tx: $encodedTransaction) {
@@ -939,21 +912,21 @@ var GetMessageByNonceDocument = import_graphql_tag.default`
939
912
  ...messageFragment
940
913
  }
941
914
  }
942
- ${MessageFragmentDoc}`;
915
+ ${MessageFragmentFragmentDoc}`;
943
916
  var SubmitAndAwaitDocument = import_graphql_tag.default`
944
917
  subscription submitAndAwait($encodedTransaction: HexString!) {
945
918
  submitAndAwait(tx: $encodedTransaction) {
946
919
  ...transactionStatusSubscriptionFragment
947
920
  }
948
921
  }
949
- ${TransactionStatusSubscriptionFragmentDoc}`;
922
+ ${TransactionStatusSubscriptionFragmentFragmentDoc}`;
950
923
  var StatusChangeDocument = import_graphql_tag.default`
951
924
  subscription statusChange($transactionId: TransactionId!) {
952
925
  statusChange(id: $transactionId) {
953
926
  ...transactionStatusSubscriptionFragment
954
927
  }
955
928
  }
956
- ${TransactionStatusSubscriptionFragmentDoc}`;
929
+ ${TransactionStatusSubscriptionFragmentFragmentDoc}`;
957
930
  function getSdk(requester) {
958
931
  return {
959
932
  getVersion(variables, options) {
@@ -1324,8 +1297,8 @@ var import_abi_coder2 = require("@fuel-ts/abi-coder");
1324
1297
  var import_address = require("@fuel-ts/address");
1325
1298
  var import_configs6 = require("@fuel-ts/address/configs");
1326
1299
  var import_crypto = require("@fuel-ts/crypto");
1327
- var import_math7 = require("@fuel-ts/math");
1328
- var import_transactions6 = require("@fuel-ts/transactions");
1300
+ var import_math8 = require("@fuel-ts/math");
1301
+ var import_transactions7 = require("@fuel-ts/transactions");
1329
1302
  var import_utils9 = require("@fuel-ts/utils");
1330
1303
 
1331
1304
  // src/providers/resource.ts
@@ -1554,9 +1527,10 @@ var getGasUsedFromReceipts = (receipts) => {
1554
1527
  function resolveGasDependentCosts(byteSize, gasDependentCost) {
1555
1528
  const base = (0, import_math5.bn)(gasDependentCost.base);
1556
1529
  let dependentValue = (0, import_math5.bn)(0);
1557
- if ("unitsPerGas" in gasDependentCost) {
1530
+ if (gasDependentCost.__typename === "LightOperation") {
1558
1531
  dependentValue = (0, import_math5.bn)(byteSize).div((0, import_math5.bn)(gasDependentCost.unitsPerGas));
1559
- } else {
1532
+ }
1533
+ if (gasDependentCost.__typename === "HeavyOperation") {
1560
1534
  dependentValue = (0, import_math5.bn)(byteSize).mul((0, import_math5.bn)(gasDependentCost.gasPerUnit));
1561
1535
  }
1562
1536
  return base.add(dependentValue);
@@ -1758,6 +1732,36 @@ var NoWitnessAtIndexError = class extends Error {
1758
1732
  name = "NoWitnessAtIndexError";
1759
1733
  };
1760
1734
 
1735
+ // src/providers/transaction-request/helpers.ts
1736
+ var import_math7 = require("@fuel-ts/math");
1737
+ var import_transactions6 = require("@fuel-ts/transactions");
1738
+ var isRequestInputCoin = (input) => input.type === import_transactions6.InputType.Coin;
1739
+ var isRequestInputMessage = (input) => input.type === import_transactions6.InputType.Message;
1740
+ var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
1741
+ var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
1742
+ if (isRequestInputCoin(input) && input.assetId === assetId) {
1743
+ return acc.add(input.amount);
1744
+ }
1745
+ if (isRequestInputMessage(input) && assetId === baseAsset) {
1746
+ return acc.add(input.amount);
1747
+ }
1748
+ return acc;
1749
+ }, (0, import_math7.bn)(0));
1750
+ var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
1751
+ (acc, input) => {
1752
+ if (isRequestInputCoin(input) && input.owner === owner.toB256()) {
1753
+ acc.utxos.push(input.id);
1754
+ } else if (isRequestInputMessage(input) && input.recipient === owner.toB256()) {
1755
+ acc.messages.push(input.nonce);
1756
+ }
1757
+ return acc;
1758
+ },
1759
+ {
1760
+ utxos: [],
1761
+ messages: []
1762
+ }
1763
+ );
1764
+
1761
1765
  // src/providers/transaction-request/witness.ts
1762
1766
  var import_utils8 = require("@fuel-ts/utils");
1763
1767
  var witnessify = (value) => {
@@ -1798,10 +1802,10 @@ var BaseTransactionRequest = class {
1798
1802
  outputs,
1799
1803
  witnesses
1800
1804
  } = {}) {
1801
- this.tip = tip ? (0, import_math7.bn)(tip) : void 0;
1805
+ this.tip = tip ? (0, import_math8.bn)(tip) : void 0;
1802
1806
  this.maturity = maturity && maturity > 0 ? maturity : void 0;
1803
- this.witnessLimit = (0, import_utils9.isDefined)(witnessLimit) ? (0, import_math7.bn)(witnessLimit) : void 0;
1804
- this.maxFee = (0, import_math7.bn)(maxFee);
1807
+ this.witnessLimit = (0, import_utils9.isDefined)(witnessLimit) ? (0, import_math8.bn)(witnessLimit) : void 0;
1808
+ this.maxFee = (0, import_math8.bn)(maxFee);
1805
1809
  this.inputs = inputs ?? [];
1806
1810
  this.outputs = outputs ?? [];
1807
1811
  this.witnesses = witnesses ?? [];
@@ -1810,20 +1814,20 @@ var BaseTransactionRequest = class {
1810
1814
  let policyTypes = 0;
1811
1815
  const policies = [];
1812
1816
  const { tip, witnessLimit, maturity } = req;
1813
- if ((0, import_math7.bn)(tip).gt(0)) {
1814
- policyTypes += import_transactions6.PolicyType.Tip;
1815
- policies.push({ data: (0, import_math7.bn)(tip), type: import_transactions6.PolicyType.Tip });
1817
+ if ((0, import_math8.bn)(tip).gt(0)) {
1818
+ policyTypes += import_transactions7.PolicyType.Tip;
1819
+ policies.push({ data: (0, import_math8.bn)(tip), type: import_transactions7.PolicyType.Tip });
1816
1820
  }
1817
- if ((0, import_utils9.isDefined)(witnessLimit) && (0, import_math7.bn)(witnessLimit).gte(0)) {
1818
- policyTypes += import_transactions6.PolicyType.WitnessLimit;
1819
- policies.push({ data: (0, import_math7.bn)(witnessLimit), type: import_transactions6.PolicyType.WitnessLimit });
1821
+ if ((0, import_utils9.isDefined)(witnessLimit) && (0, import_math8.bn)(witnessLimit).gte(0)) {
1822
+ policyTypes += import_transactions7.PolicyType.WitnessLimit;
1823
+ policies.push({ data: (0, import_math8.bn)(witnessLimit), type: import_transactions7.PolicyType.WitnessLimit });
1820
1824
  }
1821
1825
  if (maturity && maturity > 0) {
1822
- policyTypes += import_transactions6.PolicyType.Maturity;
1823
- policies.push({ data: maturity, type: import_transactions6.PolicyType.Maturity });
1826
+ policyTypes += import_transactions7.PolicyType.Maturity;
1827
+ policies.push({ data: maturity, type: import_transactions7.PolicyType.Maturity });
1824
1828
  }
1825
- policyTypes += import_transactions6.PolicyType.MaxFee;
1826
- policies.push({ data: req.maxFee, type: import_transactions6.PolicyType.MaxFee });
1829
+ policyTypes += import_transactions7.PolicyType.MaxFee;
1830
+ policies.push({ data: req.maxFee, type: import_transactions7.PolicyType.MaxFee });
1827
1831
  return {
1828
1832
  policyTypes,
1829
1833
  policies
@@ -1856,7 +1860,7 @@ var BaseTransactionRequest = class {
1856
1860
  * @returns The transaction bytes.
1857
1861
  */
1858
1862
  toTransactionBytes() {
1859
- return new import_transactions6.TransactionCoder().encode(this.toTransaction());
1863
+ return new import_transactions7.TransactionCoder().encode(this.toTransaction());
1860
1864
  }
1861
1865
  /**
1862
1866
  * @hidden
@@ -1947,7 +1951,7 @@ var BaseTransactionRequest = class {
1947
1951
  */
1948
1952
  getCoinInputs() {
1949
1953
  return this.inputs.filter(
1950
- (input) => input.type === import_transactions6.InputType.Coin
1954
+ (input) => input.type === import_transactions7.InputType.Coin
1951
1955
  );
1952
1956
  }
1953
1957
  /**
@@ -1957,7 +1961,7 @@ var BaseTransactionRequest = class {
1957
1961
  */
1958
1962
  getCoinOutputs() {
1959
1963
  return this.outputs.filter(
1960
- (output) => output.type === import_transactions6.OutputType.Coin
1964
+ (output) => output.type === import_transactions7.OutputType.Coin
1961
1965
  );
1962
1966
  }
1963
1967
  /**
@@ -1967,7 +1971,7 @@ var BaseTransactionRequest = class {
1967
1971
  */
1968
1972
  getChangeOutputs() {
1969
1973
  return this.outputs.filter(
1970
- (output) => output.type === import_transactions6.OutputType.Change
1974
+ (output) => output.type === import_transactions7.OutputType.Change
1971
1975
  );
1972
1976
  }
1973
1977
  /**
@@ -1979,9 +1983,9 @@ var BaseTransactionRequest = class {
1979
1983
  const ownerAddress = (0, import_address.addressify)(owner);
1980
1984
  const found = this.inputs.find((input) => {
1981
1985
  switch (input.type) {
1982
- case import_transactions6.InputType.Coin:
1986
+ case import_transactions7.InputType.Coin:
1983
1987
  return (0, import_utils9.hexlify)(input.owner) === ownerAddress.toB256();
1984
- case import_transactions6.InputType.Message:
1988
+ case import_transactions7.InputType.Message:
1985
1989
  return (0, import_utils9.hexlify)(input.recipient) === ownerAddress.toB256();
1986
1990
  default:
1987
1991
  return false;
@@ -1996,7 +2000,7 @@ var BaseTransactionRequest = class {
1996
2000
  * @param coin - Coin resource.
1997
2001
  */
1998
2002
  addCoinInput(coin) {
1999
- const { assetId, owner, amount } = coin;
2003
+ const { assetId, owner, amount, id, predicate } = coin;
2000
2004
  let witnessIndex;
2001
2005
  if (coin.predicate) {
2002
2006
  witnessIndex = 0;
@@ -2007,13 +2011,14 @@ var BaseTransactionRequest = class {
2007
2011
  }
2008
2012
  }
2009
2013
  const input = {
2010
- ...coin,
2011
- type: import_transactions6.InputType.Coin,
2014
+ id,
2015
+ type: import_transactions7.InputType.Coin,
2012
2016
  owner: owner.toB256(),
2013
2017
  amount,
2014
2018
  assetId,
2015
2019
  txPointer: "0x00000000000000000000000000000000",
2016
- witnessIndex
2020
+ witnessIndex,
2021
+ predicate
2017
2022
  };
2018
2023
  this.pushInput(input);
2019
2024
  this.addChangeOutput(owner, assetId);
@@ -2025,7 +2030,7 @@ var BaseTransactionRequest = class {
2025
2030
  * @param message - Message resource.
2026
2031
  */
2027
2032
  addMessageInput(message) {
2028
- const { recipient, sender, amount, assetId } = message;
2033
+ const { recipient, sender, amount, predicate, nonce, assetId } = message;
2029
2034
  let witnessIndex;
2030
2035
  if (message.predicate) {
2031
2036
  witnessIndex = 0;
@@ -2036,12 +2041,13 @@ var BaseTransactionRequest = class {
2036
2041
  }
2037
2042
  }
2038
2043
  const input = {
2039
- ...message,
2040
- type: import_transactions6.InputType.Message,
2044
+ nonce,
2045
+ type: import_transactions7.InputType.Message,
2041
2046
  sender: sender.toB256(),
2042
2047
  recipient: recipient.toB256(),
2043
2048
  amount,
2044
- witnessIndex
2049
+ witnessIndex,
2050
+ predicate
2045
2051
  };
2046
2052
  this.pushInput(input);
2047
2053
  this.addChangeOutput(recipient, assetId);
@@ -2081,7 +2087,7 @@ var BaseTransactionRequest = class {
2081
2087
  */
2082
2088
  addCoinOutput(to, amount, assetId) {
2083
2089
  this.pushOutput({
2084
- type: import_transactions6.OutputType.Coin,
2090
+ type: import_transactions7.OutputType.Coin,
2085
2091
  to: (0, import_address.addressify)(to).toB256(),
2086
2092
  amount,
2087
2093
  assetId
@@ -2097,7 +2103,7 @@ var BaseTransactionRequest = class {
2097
2103
  addCoinOutputs(to, quantities) {
2098
2104
  quantities.map(coinQuantityfy).forEach((quantity) => {
2099
2105
  this.pushOutput({
2100
- type: import_transactions6.OutputType.Coin,
2106
+ type: import_transactions7.OutputType.Coin,
2101
2107
  to: (0, import_address.addressify)(to).toB256(),
2102
2108
  amount: quantity.amount,
2103
2109
  assetId: quantity.assetId
@@ -2117,7 +2123,7 @@ var BaseTransactionRequest = class {
2117
2123
  );
2118
2124
  if (!changeOutput) {
2119
2125
  this.pushOutput({
2120
- type: import_transactions6.OutputType.Change,
2126
+ type: import_transactions7.OutputType.Change,
2121
2127
  to: (0, import_address.addressify)(to).toB256(),
2122
2128
  assetId
2123
2129
  });
@@ -2188,7 +2194,7 @@ var BaseTransactionRequest = class {
2188
2194
  const assetInput = findAssetInput(assetId);
2189
2195
  let usedQuantity = quantity;
2190
2196
  if (assetId === baseAssetId) {
2191
- usedQuantity = (0, import_math7.bn)("1000000000000000000");
2197
+ usedQuantity = (0, import_math8.bn)("1000000000000000000");
2192
2198
  }
2193
2199
  if (assetInput && "assetId" in assetInput) {
2194
2200
  assetInput.id = (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(import_abi_coder2.UTXO_ID_LEN));
@@ -2200,13 +2206,13 @@ var BaseTransactionRequest = class {
2200
2206
  amount: usedQuantity,
2201
2207
  assetId,
2202
2208
  owner: resourcesOwner || import_address.Address.fromRandom(),
2203
- blockCreated: (0, import_math7.bn)(1),
2204
- txCreatedIdx: (0, import_math7.bn)(1)
2209
+ blockCreated: (0, import_math8.bn)(1),
2210
+ txCreatedIdx: (0, import_math8.bn)(1)
2205
2211
  }
2206
2212
  ]);
2207
2213
  }
2208
2214
  };
2209
- updateAssetInput(baseAssetId, (0, import_math7.bn)(1e11));
2215
+ updateAssetInput(baseAssetId, (0, import_math8.bn)(1e11));
2210
2216
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2211
2217
  }
2212
2218
  /**
@@ -2217,7 +2223,7 @@ var BaseTransactionRequest = class {
2217
2223
  */
2218
2224
  getCoinOutputsQuantities() {
2219
2225
  const coinsQuantities = this.getCoinOutputs().map(({ amount, assetId }) => ({
2220
- amount: (0, import_math7.bn)(amount),
2226
+ amount: (0, import_math8.bn)(amount),
2221
2227
  assetId: assetId.toString()
2222
2228
  }));
2223
2229
  return coinsQuantities;
@@ -2231,22 +2237,33 @@ var BaseTransactionRequest = class {
2231
2237
  toJSON() {
2232
2238
  return normalizeJSON(this);
2233
2239
  }
2240
+ removeWitness(index) {
2241
+ this.witnesses.splice(index, 1);
2242
+ this.adjustWitnessIndexes(index);
2243
+ }
2244
+ adjustWitnessIndexes(removedIndex) {
2245
+ this.inputs.filter(isRequestInputResource).forEach((input) => {
2246
+ if (input.witnessIndex > removedIndex) {
2247
+ input.witnessIndex -= 1;
2248
+ }
2249
+ });
2250
+ }
2234
2251
  updatePredicateGasUsed(inputs) {
2235
2252
  this.inputs.forEach((i) => {
2236
2253
  let correspondingInput;
2237
2254
  switch (i.type) {
2238
- case import_transactions6.InputType.Coin:
2239
- correspondingInput = inputs.find((x) => x.type === import_transactions6.InputType.Coin && x.owner === i.owner);
2255
+ case import_transactions7.InputType.Coin:
2256
+ correspondingInput = inputs.find((x) => x.type === import_transactions7.InputType.Coin && x.owner === i.owner);
2240
2257
  break;
2241
- case import_transactions6.InputType.Message:
2258
+ case import_transactions7.InputType.Message:
2242
2259
  correspondingInput = inputs.find(
2243
- (x) => x.type === import_transactions6.InputType.Message && x.sender === i.sender
2260
+ (x) => x.type === import_transactions7.InputType.Message && x.sender === i.sender
2244
2261
  );
2245
2262
  break;
2246
2263
  default:
2247
2264
  return;
2248
2265
  }
2249
- if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math7.bn)(correspondingInput.predicateGasUsed).gt(0)) {
2266
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math8.bn)(correspondingInput.predicateGasUsed).gt(0)) {
2250
2267
  i.predicate = correspondingInput.predicate;
2251
2268
  i.predicateData = correspondingInput.predicateData;
2252
2269
  i.predicateGasUsed = correspondingInput.predicateGasUsed;
@@ -2266,38 +2283,38 @@ var BaseTransactionRequest = class {
2266
2283
 
2267
2284
  // src/providers/transaction-request/create-transaction-request.ts
2268
2285
  var import_configs8 = require("@fuel-ts/address/configs");
2269
- var import_math9 = require("@fuel-ts/math");
2270
- var import_transactions8 = require("@fuel-ts/transactions");
2286
+ var import_math10 = require("@fuel-ts/math");
2287
+ var import_transactions9 = require("@fuel-ts/transactions");
2271
2288
  var import_utils13 = require("@fuel-ts/utils");
2272
2289
 
2273
2290
  // src/providers/transaction-request/hash-transaction.ts
2274
2291
  var import_configs7 = require("@fuel-ts/address/configs");
2275
2292
  var import_hasher = require("@fuel-ts/hasher");
2276
- var import_math8 = require("@fuel-ts/math");
2277
- var import_transactions7 = require("@fuel-ts/transactions");
2293
+ var import_math9 = require("@fuel-ts/math");
2294
+ var import_transactions8 = require("@fuel-ts/transactions");
2278
2295
  var import_utils11 = require("@fuel-ts/utils");
2279
2296
  var import_ramda2 = require("ramda");
2280
2297
  function hashTransaction(transactionRequest, chainId) {
2281
2298
  const transaction = transactionRequest.toTransaction();
2282
- if (transaction.type === import_transactions7.TransactionType.Script) {
2299
+ if (transaction.type === import_transactions8.TransactionType.Script) {
2283
2300
  transaction.receiptsRoot = import_configs7.ZeroBytes32;
2284
2301
  }
2285
2302
  transaction.inputs = transaction.inputs.map((input) => {
2286
2303
  const inputClone = (0, import_ramda2.clone)(input);
2287
2304
  switch (inputClone.type) {
2288
- case import_transactions7.InputType.Coin: {
2305
+ case import_transactions8.InputType.Coin: {
2289
2306
  inputClone.txPointer = {
2290
2307
  blockHeight: 0,
2291
2308
  txIndex: 0
2292
2309
  };
2293
- inputClone.predicateGasUsed = (0, import_math8.bn)(0);
2310
+ inputClone.predicateGasUsed = (0, import_math9.bn)(0);
2294
2311
  return inputClone;
2295
2312
  }
2296
- case import_transactions7.InputType.Message: {
2297
- inputClone.predicateGasUsed = (0, import_math8.bn)(0);
2313
+ case import_transactions8.InputType.Message: {
2314
+ inputClone.predicateGasUsed = (0, import_math9.bn)(0);
2298
2315
  return inputClone;
2299
2316
  }
2300
- case import_transactions7.InputType.Contract: {
2317
+ case import_transactions8.InputType.Contract: {
2301
2318
  inputClone.txPointer = {
2302
2319
  blockHeight: 0,
2303
2320
  txIndex: 0
@@ -2315,18 +2332,18 @@ function hashTransaction(transactionRequest, chainId) {
2315
2332
  transaction.outputs = transaction.outputs.map((output) => {
2316
2333
  const outputClone = (0, import_ramda2.clone)(output);
2317
2334
  switch (outputClone.type) {
2318
- case import_transactions7.OutputType.Contract: {
2335
+ case import_transactions8.OutputType.Contract: {
2319
2336
  outputClone.balanceRoot = import_configs7.ZeroBytes32;
2320
2337
  outputClone.stateRoot = import_configs7.ZeroBytes32;
2321
2338
  return outputClone;
2322
2339
  }
2323
- case import_transactions7.OutputType.Change: {
2324
- outputClone.amount = (0, import_math8.bn)(0);
2340
+ case import_transactions8.OutputType.Change: {
2341
+ outputClone.amount = (0, import_math9.bn)(0);
2325
2342
  return outputClone;
2326
2343
  }
2327
- case import_transactions7.OutputType.Variable: {
2344
+ case import_transactions8.OutputType.Variable: {
2328
2345
  outputClone.to = import_configs7.ZeroBytes32;
2329
- outputClone.amount = (0, import_math8.bn)(0);
2346
+ outputClone.amount = (0, import_math9.bn)(0);
2330
2347
  outputClone.assetId = import_configs7.ZeroBytes32;
2331
2348
  return outputClone;
2332
2349
  }
@@ -2337,7 +2354,7 @@ function hashTransaction(transactionRequest, chainId) {
2337
2354
  transaction.witnessesCount = 0;
2338
2355
  transaction.witnesses = [];
2339
2356
  const chainIdBytes = (0, import_hasher.uint64ToBytesBE)(chainId);
2340
- const concatenatedData = (0, import_utils11.concat)([chainIdBytes, new import_transactions7.TransactionCoder().encode(transaction)]);
2357
+ const concatenatedData = (0, import_utils11.concat)([chainIdBytes, new import_transactions8.TransactionCoder().encode(transaction)]);
2341
2358
  return (0, import_hasher.sha256)(concatenatedData);
2342
2359
  }
2343
2360
 
@@ -2373,7 +2390,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2373
2390
  return new this(obj);
2374
2391
  }
2375
2392
  /** Type of the transaction */
2376
- type = import_transactions8.TransactionType.Create;
2393
+ type = import_transactions9.TransactionType.Create;
2377
2394
  /** Witness index of contract bytecode to create */
2378
2395
  bytecodeWitnessIndex;
2379
2396
  /** Salt */
@@ -2401,10 +2418,10 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2401
2418
  const bytecodeWitnessIndex = this.bytecodeWitnessIndex;
2402
2419
  const storageSlots = this.storageSlots?.map(storageSlotify) ?? [];
2403
2420
  return {
2404
- type: import_transactions8.TransactionType.Create,
2421
+ type: import_transactions9.TransactionType.Create,
2405
2422
  ...baseTransaction,
2406
2423
  bytecodeWitnessIndex,
2407
- storageSlotsCount: (0, import_math9.bn)(storageSlots.length),
2424
+ storageSlotsCount: (0, import_math10.bn)(storageSlots.length),
2408
2425
  salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs8.ZeroBytes32,
2409
2426
  storageSlots
2410
2427
  };
@@ -2416,7 +2433,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2416
2433
  */
2417
2434
  getContractCreatedOutputs() {
2418
2435
  return this.outputs.filter(
2419
- (output) => output.type === import_transactions8.OutputType.ContractCreated
2436
+ (output) => output.type === import_transactions9.OutputType.ContractCreated
2420
2437
  );
2421
2438
  }
2422
2439
  /**
@@ -2437,14 +2454,14 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2437
2454
  */
2438
2455
  addContractCreatedOutput(contractId, stateRoot) {
2439
2456
  this.pushOutput({
2440
- type: import_transactions8.OutputType.ContractCreated,
2457
+ type: import_transactions9.OutputType.ContractCreated,
2441
2458
  contractId,
2442
2459
  stateRoot
2443
2460
  });
2444
2461
  }
2445
2462
  metadataGas(gasCosts) {
2446
2463
  return calculateMetadataGasForTxCreate({
2447
- contractBytesSize: (0, import_math9.bn)((0, import_utils13.arrayify)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2464
+ contractBytesSize: (0, import_math10.bn)((0, import_utils13.arrayify)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2448
2465
  gasCosts,
2449
2466
  stateRootSize: this.storageSlots.length,
2450
2467
  txBytesSize: this.byteSize()
@@ -2456,8 +2473,8 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2456
2473
  var import_abi_coder3 = require("@fuel-ts/abi-coder");
2457
2474
  var import_address2 = require("@fuel-ts/address");
2458
2475
  var import_configs9 = require("@fuel-ts/address/configs");
2459
- var import_math10 = require("@fuel-ts/math");
2460
- var import_transactions9 = require("@fuel-ts/transactions");
2476
+ var import_math11 = require("@fuel-ts/math");
2477
+ var import_transactions10 = require("@fuel-ts/transactions");
2461
2478
  var import_utils15 = require("@fuel-ts/utils");
2462
2479
 
2463
2480
  // src/providers/transaction-request/scripts.ts
@@ -2495,7 +2512,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2495
2512
  return new this(obj);
2496
2513
  }
2497
2514
  /** Type of the transaction */
2498
- type = import_transactions9.TransactionType.Script;
2515
+ type = import_transactions10.TransactionType.Script;
2499
2516
  /** Gas limit for transaction */
2500
2517
  gasLimit;
2501
2518
  /** Script to execute */
@@ -2510,7 +2527,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2510
2527
  */
2511
2528
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2512
2529
  super(rest);
2513
- this.gasLimit = (0, import_math10.bn)(gasLimit);
2530
+ this.gasLimit = (0, import_math11.bn)(gasLimit);
2514
2531
  this.script = (0, import_utils15.arrayify)(script ?? returnZeroScript.bytes);
2515
2532
  this.scriptData = (0, import_utils15.arrayify)(scriptData ?? returnZeroScript.encodeScriptData());
2516
2533
  this.abis = rest.abis;
@@ -2524,11 +2541,11 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2524
2541
  const script = (0, import_utils15.arrayify)(this.script ?? "0x");
2525
2542
  const scriptData = (0, import_utils15.arrayify)(this.scriptData ?? "0x");
2526
2543
  return {
2527
- type: import_transactions9.TransactionType.Script,
2544
+ type: import_transactions10.TransactionType.Script,
2528
2545
  scriptGasLimit: this.gasLimit,
2529
2546
  ...super.getBaseTransaction(),
2530
- scriptLength: (0, import_math10.bn)(script.length),
2531
- scriptDataLength: (0, import_math10.bn)(scriptData.length),
2547
+ scriptLength: (0, import_math11.bn)(script.length),
2548
+ scriptDataLength: (0, import_math11.bn)(scriptData.length),
2532
2549
  receiptsRoot: import_configs9.ZeroBytes32,
2533
2550
  script: (0, import_utils15.hexlify)(script),
2534
2551
  scriptData: (0, import_utils15.hexlify)(scriptData)
@@ -2541,7 +2558,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2541
2558
  */
2542
2559
  getContractInputs() {
2543
2560
  return this.inputs.filter(
2544
- (input) => input.type === import_transactions9.InputType.Contract
2561
+ (input) => input.type === import_transactions10.InputType.Contract
2545
2562
  );
2546
2563
  }
2547
2564
  /**
@@ -2551,7 +2568,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2551
2568
  */
2552
2569
  getContractOutputs() {
2553
2570
  return this.outputs.filter(
2554
- (output) => output.type === import_transactions9.OutputType.Contract
2571
+ (output) => output.type === import_transactions10.OutputType.Contract
2555
2572
  );
2556
2573
  }
2557
2574
  /**
@@ -2561,7 +2578,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2561
2578
  */
2562
2579
  getVariableOutputs() {
2563
2580
  return this.outputs.filter(
2564
- (output) => output.type === import_transactions9.OutputType.Variable
2581
+ (output) => output.type === import_transactions10.OutputType.Variable
2565
2582
  );
2566
2583
  }
2567
2584
  /**
@@ -2584,7 +2601,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2584
2601
  let outputsNumber = numberOfVariables;
2585
2602
  while (outputsNumber) {
2586
2603
  this.pushOutput({
2587
- type: import_transactions9.OutputType.Variable
2604
+ type: import_transactions10.OutputType.Variable
2588
2605
  });
2589
2606
  outputsNumber -= 1;
2590
2607
  }
@@ -2621,12 +2638,12 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2621
2638
  return this;
2622
2639
  }
2623
2640
  const inputIndex = super.pushInput({
2624
- type: import_transactions9.InputType.Contract,
2641
+ type: import_transactions10.InputType.Contract,
2625
2642
  contractId: contractAddress.toB256(),
2626
2643
  txPointer: "0x00000000000000000000000000000000"
2627
2644
  });
2628
2645
  this.pushOutput({
2629
- type: import_transactions9.OutputType.Contract,
2646
+ type: import_transactions10.OutputType.Contract,
2630
2647
  inputIndex
2631
2648
  });
2632
2649
  return this;
@@ -2663,17 +2680,17 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2663
2680
 
2664
2681
  // src/providers/transaction-request/utils.ts
2665
2682
  var import_errors9 = require("@fuel-ts/errors");
2666
- var import_transactions10 = require("@fuel-ts/transactions");
2683
+ var import_transactions11 = require("@fuel-ts/transactions");
2667
2684
  var transactionRequestify = (obj) => {
2668
2685
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
2669
2686
  return obj;
2670
2687
  }
2671
2688
  const { type } = obj;
2672
2689
  switch (obj.type) {
2673
- case import_transactions10.TransactionType.Script: {
2690
+ case import_transactions11.TransactionType.Script: {
2674
2691
  return ScriptTransactionRequest.from(obj);
2675
2692
  }
2676
- case import_transactions10.TransactionType.Create: {
2693
+ case import_transactions11.TransactionType.Create: {
2677
2694
  return CreateTransactionRequest.from(obj);
2678
2695
  }
2679
2696
  default: {
@@ -2681,36 +2698,21 @@ var transactionRequestify = (obj) => {
2681
2698
  }
2682
2699
  }
2683
2700
  };
2684
- var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
2685
- (acc, input) => {
2686
- if (input.type === import_transactions10.InputType.Coin && input.owner === owner.toB256()) {
2687
- acc.utxos.push(input.id);
2688
- }
2689
- if (input.type === import_transactions10.InputType.Message && input.recipient === owner.toB256()) {
2690
- acc.messages.push(input.nonce);
2691
- }
2692
- return acc;
2693
- },
2694
- {
2695
- utxos: [],
2696
- messages: []
2697
- }
2698
- );
2699
2701
 
2700
2702
  // src/providers/transaction-response/transaction-response.ts
2701
2703
  var import_errors13 = require("@fuel-ts/errors");
2702
- var import_math16 = require("@fuel-ts/math");
2703
- var import_transactions18 = require("@fuel-ts/transactions");
2704
+ var import_math17 = require("@fuel-ts/math");
2705
+ var import_transactions19 = require("@fuel-ts/transactions");
2704
2706
  var import_utils20 = require("@fuel-ts/utils");
2705
2707
 
2706
2708
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2707
- var import_math15 = require("@fuel-ts/math");
2708
- var import_transactions16 = require("@fuel-ts/transactions");
2709
+ var import_math16 = require("@fuel-ts/math");
2710
+ var import_transactions17 = require("@fuel-ts/transactions");
2709
2711
  var import_utils18 = require("@fuel-ts/utils");
2710
2712
 
2711
2713
  // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
2712
- var import_math11 = require("@fuel-ts/math");
2713
- var import_transactions11 = require("@fuel-ts/transactions");
2714
+ var import_math12 = require("@fuel-ts/math");
2715
+ var import_transactions12 = require("@fuel-ts/transactions");
2714
2716
  var import_utils16 = require("@fuel-ts/utils");
2715
2717
  var calculateTXFeeForSummary = (params) => {
2716
2718
  const {
@@ -2723,19 +2725,19 @@ var calculateTXFeeForSummary = (params) => {
2723
2725
  if (totalFee) {
2724
2726
  return totalFee;
2725
2727
  }
2726
- const gasPerByte = (0, import_math11.bn)(feeParams.gasPerByte);
2727
- const gasPriceFactor = (0, import_math11.bn)(feeParams.gasPriceFactor);
2728
+ const gasPerByte = (0, import_math12.bn)(feeParams.gasPerByte);
2729
+ const gasPriceFactor = (0, import_math12.bn)(feeParams.gasPriceFactor);
2728
2730
  const transactionBytes = (0, import_utils16.arrayify)(rawPayload);
2729
- const [transaction] = new import_transactions11.TransactionCoder().decode(transactionBytes, 0);
2731
+ const [transaction] = new import_transactions12.TransactionCoder().decode(transactionBytes, 0);
2730
2732
  const { type, witnesses, inputs, policies } = transaction;
2731
- let metadataGas = (0, import_math11.bn)(0);
2732
- let gasLimit = (0, import_math11.bn)(0);
2733
- if (type !== import_transactions11.TransactionType.Create && type !== import_transactions11.TransactionType.Script) {
2734
- return (0, import_math11.bn)(0);
2733
+ let metadataGas = (0, import_math12.bn)(0);
2734
+ let gasLimit = (0, import_math12.bn)(0);
2735
+ if (type !== import_transactions12.TransactionType.Create && type !== import_transactions12.TransactionType.Script) {
2736
+ return (0, import_math12.bn)(0);
2735
2737
  }
2736
- if (type === import_transactions11.TransactionType.Create) {
2738
+ if (type === import_transactions12.TransactionType.Create) {
2737
2739
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2738
- const contractBytesSize = (0, import_math11.bn)((0, import_utils16.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
2740
+ const contractBytesSize = (0, import_math12.bn)((0, import_utils16.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
2739
2741
  metadataGas = calculateMetadataGasForTxCreate({
2740
2742
  contractBytesSize,
2741
2743
  gasCosts,
@@ -2754,12 +2756,12 @@ var calculateTXFeeForSummary = (params) => {
2754
2756
  }
2755
2757
  const minGas = getMinGas({
2756
2758
  gasCosts,
2757
- gasPerByte: (0, import_math11.bn)(gasPerByte),
2759
+ gasPerByte: (0, import_math12.bn)(gasPerByte),
2758
2760
  inputs,
2759
2761
  metadataGas,
2760
2762
  txBytesSize: transactionBytes.length
2761
2763
  });
2762
- const witnessLimit = policies.find((policy) => policy.type === import_transactions11.PolicyType.WitnessLimit)?.data;
2764
+ const witnessLimit = policies.find((policy) => policy.type === import_transactions12.PolicyType.WitnessLimit)?.data;
2763
2765
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
2764
2766
  const maxGas = getMaxGas({
2765
2767
  gasPerByte,
@@ -2781,12 +2783,12 @@ var calculateTXFeeForSummary = (params) => {
2781
2783
  // src/providers/transaction-summary/operations.ts
2782
2784
  var import_configs10 = require("@fuel-ts/address/configs");
2783
2785
  var import_errors11 = require("@fuel-ts/errors");
2784
- var import_math13 = require("@fuel-ts/math");
2785
- var import_transactions14 = require("@fuel-ts/transactions");
2786
+ var import_math14 = require("@fuel-ts/math");
2787
+ var import_transactions15 = require("@fuel-ts/transactions");
2786
2788
 
2787
2789
  // src/providers/transaction-summary/call.ts
2788
2790
  var import_abi_coder4 = require("@fuel-ts/abi-coder");
2789
- var import_math12 = require("@fuel-ts/math");
2791
+ var import_math13 = require("@fuel-ts/math");
2790
2792
  var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2791
2793
  const abiInterface = new import_abi_coder4.Interface(abi);
2792
2794
  const callFunctionSelector = receipt.param1.toHex(8);
@@ -2795,7 +2797,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2795
2797
  let encodedArgs;
2796
2798
  if (functionFragment.isInputDataPointer) {
2797
2799
  if (rawPayload) {
2798
- const argsOffset = (0, import_math12.bn)(receipt.param2).sub((0, import_abi_coder4.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
2800
+ const argsOffset = (0, import_math13.bn)(receipt.param2).sub((0, import_abi_coder4.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
2799
2801
  encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2800
2802
  }
2801
2803
  } else {
@@ -2830,7 +2832,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2830
2832
 
2831
2833
  // src/providers/transaction-summary/input.ts
2832
2834
  var import_errors10 = require("@fuel-ts/errors");
2833
- var import_transactions12 = require("@fuel-ts/transactions");
2835
+ var import_transactions13 = require("@fuel-ts/transactions");
2834
2836
  function getInputsByTypes(inputs, types) {
2835
2837
  return inputs.filter((i) => types.includes(i.type));
2836
2838
  }
@@ -2838,16 +2840,16 @@ function getInputsByType(inputs, type) {
2838
2840
  return inputs.filter((i) => i.type === type);
2839
2841
  }
2840
2842
  function getInputsCoin(inputs) {
2841
- return getInputsByType(inputs, import_transactions12.InputType.Coin);
2843
+ return getInputsByType(inputs, import_transactions13.InputType.Coin);
2842
2844
  }
2843
2845
  function getInputsMessage(inputs) {
2844
- return getInputsByType(inputs, import_transactions12.InputType.Message);
2846
+ return getInputsByType(inputs, import_transactions13.InputType.Message);
2845
2847
  }
2846
2848
  function getInputsCoinAndMessage(inputs) {
2847
- return getInputsByTypes(inputs, [import_transactions12.InputType.Coin, import_transactions12.InputType.Message]);
2849
+ return getInputsByTypes(inputs, [import_transactions13.InputType.Coin, import_transactions13.InputType.Message]);
2848
2850
  }
2849
2851
  function getInputsContract(inputs) {
2850
- return getInputsByType(inputs, import_transactions12.InputType.Contract);
2852
+ return getInputsByType(inputs, import_transactions13.InputType.Contract);
2851
2853
  }
2852
2854
  function getInputFromAssetId(inputs, assetId) {
2853
2855
  const coinInputs = getInputsCoin(inputs);
@@ -2866,7 +2868,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
2866
2868
  if (!contractInput) {
2867
2869
  return void 0;
2868
2870
  }
2869
- if (contractInput.type !== import_transactions12.InputType.Contract) {
2871
+ if (contractInput.type !== import_transactions13.InputType.Contract) {
2870
2872
  throw new import_errors10.FuelError(
2871
2873
  import_errors10.ErrorCode.INVALID_TRANSACTION_INPUT,
2872
2874
  `Contract input should be of type 'contract'.`
@@ -2875,31 +2877,31 @@ function getInputContractFromIndex(inputs, inputIndex) {
2875
2877
  return contractInput;
2876
2878
  }
2877
2879
  function getInputAccountAddress(input) {
2878
- if (input.type === import_transactions12.InputType.Coin) {
2880
+ if (input.type === import_transactions13.InputType.Coin) {
2879
2881
  return input.owner.toString();
2880
2882
  }
2881
- if (input.type === import_transactions12.InputType.Message) {
2883
+ if (input.type === import_transactions13.InputType.Message) {
2882
2884
  return input.recipient.toString();
2883
2885
  }
2884
2886
  return "";
2885
2887
  }
2886
2888
 
2887
2889
  // src/providers/transaction-summary/output.ts
2888
- var import_transactions13 = require("@fuel-ts/transactions");
2890
+ var import_transactions14 = require("@fuel-ts/transactions");
2889
2891
  function getOutputsByType(outputs, type) {
2890
2892
  return outputs.filter((o) => o.type === type);
2891
2893
  }
2892
2894
  function getOutputsContractCreated(outputs) {
2893
- return getOutputsByType(outputs, import_transactions13.OutputType.ContractCreated);
2895
+ return getOutputsByType(outputs, import_transactions14.OutputType.ContractCreated);
2894
2896
  }
2895
2897
  function getOutputsCoin(outputs) {
2896
- return getOutputsByType(outputs, import_transactions13.OutputType.Coin);
2898
+ return getOutputsByType(outputs, import_transactions14.OutputType.Coin);
2897
2899
  }
2898
2900
  function getOutputsChange(outputs) {
2899
- return getOutputsByType(outputs, import_transactions13.OutputType.Change);
2901
+ return getOutputsByType(outputs, import_transactions14.OutputType.Change);
2900
2902
  }
2901
2903
  function getOutputsContract(outputs) {
2902
- return getOutputsByType(outputs, import_transactions13.OutputType.Contract);
2904
+ return getOutputsByType(outputs, import_transactions14.OutputType.Contract);
2903
2905
  }
2904
2906
 
2905
2907
  // src/providers/transaction-summary/operations.ts
@@ -2908,11 +2910,11 @@ function getReceiptsByType(receipts, type) {
2908
2910
  }
2909
2911
  function getTransactionTypeName(transactionType) {
2910
2912
  switch (transactionType) {
2911
- case import_transactions14.TransactionType.Mint:
2913
+ case import_transactions15.TransactionType.Mint:
2912
2914
  return "Mint" /* Mint */;
2913
- case import_transactions14.TransactionType.Create:
2915
+ case import_transactions15.TransactionType.Create:
2914
2916
  return "Create" /* Create */;
2915
- case import_transactions14.TransactionType.Script:
2917
+ case import_transactions15.TransactionType.Script:
2916
2918
  return "Script" /* Script */;
2917
2919
  default:
2918
2920
  throw new import_errors11.FuelError(
@@ -2941,10 +2943,10 @@ function isTypeUpload(transactionType) {
2941
2943
  return isType(transactionType, "Upload" /* Upload */);
2942
2944
  }
2943
2945
  function getReceiptsCall(receipts) {
2944
- return getReceiptsByType(receipts, import_transactions14.ReceiptType.Call);
2946
+ return getReceiptsByType(receipts, import_transactions15.ReceiptType.Call);
2945
2947
  }
2946
2948
  function getReceiptsMessageOut(receipts) {
2947
- return getReceiptsByType(receipts, import_transactions14.ReceiptType.MessageOut);
2949
+ return getReceiptsByType(receipts, import_transactions15.ReceiptType.MessageOut);
2948
2950
  }
2949
2951
  var mergeAssets = (op1, op2) => {
2950
2952
  const assets1 = op1.assetsSent || [];
@@ -2957,7 +2959,7 @@ var mergeAssets = (op1, op2) => {
2957
2959
  if (!matchingAsset) {
2958
2960
  return asset1;
2959
2961
  }
2960
- const mergedAmount = (0, import_math13.bn)(asset1.amount).add(matchingAsset.amount);
2962
+ const mergedAmount = (0, import_math14.bn)(asset1.amount).add(matchingAsset.amount);
2961
2963
  return { ...asset1, amount: mergedAmount };
2962
2964
  });
2963
2965
  return mergedAssets.concat(filteredAssets);
@@ -3140,11 +3142,11 @@ function getTransferOperations({
3140
3142
  });
3141
3143
  const transferReceipts = getReceiptsByType(
3142
3144
  receipts,
3143
- import_transactions14.ReceiptType.Transfer
3145
+ import_transactions15.ReceiptType.Transfer
3144
3146
  );
3145
3147
  const transferOutReceipts = getReceiptsByType(
3146
3148
  receipts,
3147
- import_transactions14.ReceiptType.TransferOut
3149
+ import_transactions15.ReceiptType.TransferOut
3148
3150
  );
3149
3151
  [...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
3150
3152
  const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
@@ -3229,17 +3231,17 @@ function getOperations({
3229
3231
  }
3230
3232
 
3231
3233
  // src/providers/transaction-summary/receipt.ts
3232
- var import_transactions15 = require("@fuel-ts/transactions");
3234
+ var import_transactions16 = require("@fuel-ts/transactions");
3233
3235
  var processGqlReceipt = (gqlReceipt) => {
3234
3236
  const receipt = assembleReceiptByType(gqlReceipt);
3235
3237
  switch (receipt.type) {
3236
- case import_transactions15.ReceiptType.ReturnData: {
3238
+ case import_transactions16.ReceiptType.ReturnData: {
3237
3239
  return {
3238
3240
  ...receipt,
3239
3241
  data: gqlReceipt.data || "0x"
3240
3242
  };
3241
3243
  }
3242
- case import_transactions15.ReceiptType.LogData: {
3244
+ case import_transactions16.ReceiptType.LogData: {
3243
3245
  return {
3244
3246
  ...receipt,
3245
3247
  data: gqlReceipt.data || "0x"
@@ -3252,7 +3254,7 @@ var processGqlReceipt = (gqlReceipt) => {
3252
3254
  var extractMintedAssetsFromReceipts = (receipts) => {
3253
3255
  const mintedAssets = [];
3254
3256
  receipts.forEach((receipt) => {
3255
- if (receipt.type === import_transactions15.ReceiptType.Mint) {
3257
+ if (receipt.type === import_transactions16.ReceiptType.Mint) {
3256
3258
  mintedAssets.push({
3257
3259
  subId: receipt.subId,
3258
3260
  contractId: receipt.contractId,
@@ -3266,7 +3268,7 @@ var extractMintedAssetsFromReceipts = (receipts) => {
3266
3268
  var extractBurnedAssetsFromReceipts = (receipts) => {
3267
3269
  const burnedAssets = [];
3268
3270
  receipts.forEach((receipt) => {
3269
- if (receipt.type === import_transactions15.ReceiptType.Burn) {
3271
+ if (receipt.type === import_transactions16.ReceiptType.Burn) {
3270
3272
  burnedAssets.push({
3271
3273
  subId: receipt.subId,
3272
3274
  contractId: receipt.contractId,
@@ -3280,7 +3282,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3280
3282
 
3281
3283
  // src/providers/transaction-summary/status.ts
3282
3284
  var import_errors12 = require("@fuel-ts/errors");
3283
- var import_math14 = require("@fuel-ts/math");
3285
+ var import_math15 = require("@fuel-ts/math");
3284
3286
  var getTransactionStatusName = (gqlStatus) => {
3285
3287
  switch (gqlStatus) {
3286
3288
  case "FailureStatus":
@@ -3314,15 +3316,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3314
3316
  time = gqlTransactionStatus.time;
3315
3317
  blockId = gqlTransactionStatus.block.id;
3316
3318
  isStatusSuccess = true;
3317
- totalFee = (0, import_math14.bn)(gqlTransactionStatus.totalFee);
3318
- totalGas = (0, import_math14.bn)(gqlTransactionStatus.totalGas);
3319
+ totalFee = (0, import_math15.bn)(gqlTransactionStatus.totalFee);
3320
+ totalGas = (0, import_math15.bn)(gqlTransactionStatus.totalGas);
3319
3321
  break;
3320
3322
  case "FailureStatus":
3321
3323
  time = gqlTransactionStatus.time;
3322
3324
  blockId = gqlTransactionStatus.block.id;
3323
3325
  isStatusFailure = true;
3324
- totalFee = (0, import_math14.bn)(gqlTransactionStatus.totalFee);
3325
- totalGas = (0, import_math14.bn)(gqlTransactionStatus.totalGas);
3326
+ totalFee = (0, import_math15.bn)(gqlTransactionStatus.totalFee);
3327
+ totalGas = (0, import_math15.bn)(gqlTransactionStatus.totalGas);
3326
3328
  break;
3327
3329
  case "SubmittedStatus":
3328
3330
  time = gqlTransactionStatus.time;
@@ -3372,7 +3374,7 @@ function assembleTransactionSummary(params) {
3372
3374
  maxInputs
3373
3375
  });
3374
3376
  const typeName = getTransactionTypeName(transaction.type);
3375
- const tip = (0, import_math15.bn)(transaction.policies?.find((policy) => policy.type === import_transactions16.PolicyType.Tip)?.data);
3377
+ const tip = (0, import_math16.bn)(transaction.policies?.find((policy) => policy.type === import_transactions17.PolicyType.Tip)?.data);
3376
3378
  const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3377
3379
  const fee = calculateTXFeeForSummary({
3378
3380
  totalFee,
@@ -3423,12 +3425,12 @@ function assembleTransactionSummary(params) {
3423
3425
 
3424
3426
  // src/providers/transaction-response/getDecodedLogs.ts
3425
3427
  var import_abi_coder5 = require("@fuel-ts/abi-coder");
3426
- var import_transactions17 = require("@fuel-ts/transactions");
3428
+ var import_transactions18 = require("@fuel-ts/transactions");
3427
3429
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
3428
3430
  return receipts.reduce((logs, receipt) => {
3429
- if (receipt.type === import_transactions17.ReceiptType.LogData || receipt.type === import_transactions17.ReceiptType.Log) {
3431
+ if (receipt.type === import_transactions18.ReceiptType.LogData || receipt.type === import_transactions18.ReceiptType.Log) {
3430
3432
  const interfaceToUse = new import_abi_coder5.Interface(externalAbis[receipt.id] || mainAbi);
3431
- const data = receipt.type === import_transactions17.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3433
+ const data = receipt.type === import_transactions18.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3432
3434
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
3433
3435
  logs.push(decodedLog);
3434
3436
  }
@@ -3443,7 +3445,7 @@ var TransactionResponse = class {
3443
3445
  /** Current provider */
3444
3446
  provider;
3445
3447
  /** Gas used on the transaction */
3446
- gasUsed = (0, import_math16.bn)(0);
3448
+ gasUsed = (0, import_math17.bn)(0);
3447
3449
  /** The graphql Transaction with receipts object. */
3448
3450
  gqlTransaction;
3449
3451
  abis;
@@ -3501,7 +3503,7 @@ var TransactionResponse = class {
3501
3503
  * @returns The decoded transaction.
3502
3504
  */
3503
3505
  decodeTransaction(transactionWithReceipts) {
3504
- return new import_transactions18.TransactionCoder().decode(
3506
+ return new import_transactions19.TransactionCoder().decode(
3505
3507
  (0, import_utils20.arrayify)(transactionWithReceipts.rawPayload),
3506
3508
  0
3507
3509
  )?.[0];
@@ -3677,47 +3679,47 @@ var processGqlChain = (chain) => {
3677
3679
  } = consensusParameters;
3678
3680
  return {
3679
3681
  name,
3680
- baseChainHeight: (0, import_math17.bn)(daHeight),
3682
+ baseChainHeight: (0, import_math18.bn)(daHeight),
3681
3683
  consensusParameters: {
3682
3684
  version,
3683
- chainId: (0, import_math17.bn)(chainId),
3685
+ chainId: (0, import_math18.bn)(chainId),
3684
3686
  baseAssetId,
3685
3687
  feeParameters: {
3686
3688
  version: feeParams.version,
3687
- gasPerByte: (0, import_math17.bn)(feeParams.gasPerByte),
3688
- gasPriceFactor: (0, import_math17.bn)(feeParams.gasPriceFactor)
3689
+ gasPerByte: (0, import_math18.bn)(feeParams.gasPerByte),
3690
+ gasPriceFactor: (0, import_math18.bn)(feeParams.gasPriceFactor)
3689
3691
  },
3690
3692
  contractParameters: {
3691
3693
  version: contractParams.version,
3692
- contractMaxSize: (0, import_math17.bn)(contractParams.contractMaxSize),
3693
- maxStorageSlots: (0, import_math17.bn)(contractParams.maxStorageSlots)
3694
+ contractMaxSize: (0, import_math18.bn)(contractParams.contractMaxSize),
3695
+ maxStorageSlots: (0, import_math18.bn)(contractParams.maxStorageSlots)
3694
3696
  },
3695
3697
  txParameters: {
3696
3698
  version: txParams.version,
3697
- maxInputs: (0, import_math17.bn)(txParams.maxInputs),
3698
- maxOutputs: (0, import_math17.bn)(txParams.maxOutputs),
3699
- maxWitnesses: (0, import_math17.bn)(txParams.maxWitnesses),
3700
- maxGasPerTx: (0, import_math17.bn)(txParams.maxGasPerTx),
3701
- maxSize: (0, import_math17.bn)(txParams.maxSize),
3702
- maxBytecodeSubsections: (0, import_math17.bn)(txParams.maxBytecodeSubsections)
3699
+ maxInputs: (0, import_math18.bn)(txParams.maxInputs),
3700
+ maxOutputs: (0, import_math18.bn)(txParams.maxOutputs),
3701
+ maxWitnesses: (0, import_math18.bn)(txParams.maxWitnesses),
3702
+ maxGasPerTx: (0, import_math18.bn)(txParams.maxGasPerTx),
3703
+ maxSize: (0, import_math18.bn)(txParams.maxSize),
3704
+ maxBytecodeSubsections: (0, import_math18.bn)(txParams.maxBytecodeSubsections)
3703
3705
  },
3704
3706
  predicateParameters: {
3705
3707
  version: predicateParams.version,
3706
- maxPredicateLength: (0, import_math17.bn)(predicateParams.maxPredicateLength),
3707
- maxPredicateDataLength: (0, import_math17.bn)(predicateParams.maxPredicateDataLength),
3708
- maxGasPerPredicate: (0, import_math17.bn)(predicateParams.maxGasPerPredicate),
3709
- maxMessageDataLength: (0, import_math17.bn)(predicateParams.maxMessageDataLength)
3708
+ maxPredicateLength: (0, import_math18.bn)(predicateParams.maxPredicateLength),
3709
+ maxPredicateDataLength: (0, import_math18.bn)(predicateParams.maxPredicateDataLength),
3710
+ maxGasPerPredicate: (0, import_math18.bn)(predicateParams.maxGasPerPredicate),
3711
+ maxMessageDataLength: (0, import_math18.bn)(predicateParams.maxMessageDataLength)
3710
3712
  },
3711
3713
  scriptParameters: {
3712
3714
  version: scriptParams.version,
3713
- maxScriptLength: (0, import_math17.bn)(scriptParams.maxScriptLength),
3714
- maxScriptDataLength: (0, import_math17.bn)(scriptParams.maxScriptDataLength)
3715
+ maxScriptLength: (0, import_math18.bn)(scriptParams.maxScriptLength),
3716
+ maxScriptDataLength: (0, import_math18.bn)(scriptParams.maxScriptDataLength)
3715
3717
  },
3716
3718
  gasCosts
3717
3719
  },
3718
3720
  latestBlock: {
3719
3721
  id: latestBlock.id,
3720
- height: (0, import_math17.bn)(latestBlock.height),
3722
+ height: (0, import_math18.bn)(latestBlock.height),
3721
3723
  time: latestBlock.header.time,
3722
3724
  transactions: latestBlock.transactions.map((i) => ({
3723
3725
  id: i.id
@@ -3913,7 +3915,7 @@ Supported fuel-core version: ${supportedVersion}.`
3913
3915
  */
3914
3916
  async getBlockNumber() {
3915
3917
  const { chain } = await this.operations.getChain();
3916
- return (0, import_math17.bn)(chain.latestBlock.height, 10);
3918
+ return (0, import_math18.bn)(chain.latestBlock.height, 10);
3917
3919
  }
3918
3920
  /**
3919
3921
  * Returns the chain information.
@@ -3923,8 +3925,8 @@ Supported fuel-core version: ${supportedVersion}.`
3923
3925
  async fetchNode() {
3924
3926
  const { nodeInfo } = await this.operations.getNodeInfo();
3925
3927
  const processedNodeInfo = {
3926
- maxDepth: (0, import_math17.bn)(nodeInfo.maxDepth),
3927
- maxTx: (0, import_math17.bn)(nodeInfo.maxTx),
3928
+ maxDepth: (0, import_math18.bn)(nodeInfo.maxDepth),
3929
+ maxTx: (0, import_math18.bn)(nodeInfo.maxTx),
3928
3930
  nodeVersion: nodeInfo.nodeVersion,
3929
3931
  utxoValidation: nodeInfo.utxoValidation,
3930
3932
  vmBacktrace: nodeInfo.vmBacktrace
@@ -3982,7 +3984,7 @@ Supported fuel-core version: ${supportedVersion}.`
3982
3984
  }
3983
3985
  const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3984
3986
  let abis;
3985
- if (transactionRequest.type === import_transactions19.TransactionType.Script) {
3987
+ if (transactionRequest.type === import_transactions20.TransactionType.Script) {
3986
3988
  abis = transactionRequest.abis;
3987
3989
  }
3988
3990
  if (awaitExecution) {
@@ -4041,7 +4043,7 @@ Supported fuel-core version: ${supportedVersion}.`
4041
4043
  async estimatePredicates(transactionRequest) {
4042
4044
  const shouldEstimatePredicates = Boolean(
4043
4045
  transactionRequest.inputs.find(
4044
- (input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new import_math17.BN(input.predicateGasUsed).isZero()
4046
+ (input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new import_math18.BN(input.predicateGasUsed).isZero()
4045
4047
  )
4046
4048
  );
4047
4049
  if (!shouldEstimatePredicates) {
@@ -4056,7 +4058,7 @@ Supported fuel-core version: ${supportedVersion}.`
4056
4058
  } = response;
4057
4059
  if (inputs) {
4058
4060
  inputs.forEach((input, index) => {
4059
- if ("predicateGasUsed" in input && (0, import_math17.bn)(input.predicateGasUsed).gt(0)) {
4061
+ if ("predicateGasUsed" in input && (0, import_math18.bn)(input.predicateGasUsed).gt(0)) {
4060
4062
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
4061
4063
  }
4062
4064
  });
@@ -4074,7 +4076,7 @@ Supported fuel-core version: ${supportedVersion}.`
4074
4076
  * @returns A promise.
4075
4077
  */
4076
4078
  async estimateTxDependencies(transactionRequest) {
4077
- if (transactionRequest.type === import_transactions19.TransactionType.Create) {
4079
+ if (transactionRequest.type === import_transactions20.TransactionType.Create) {
4078
4080
  return {
4079
4081
  receipts: [],
4080
4082
  outputVariables: 0,
@@ -4138,7 +4140,7 @@ Supported fuel-core version: ${supportedVersion}.`
4138
4140
  const allRequests = (0, import_ramda3.clone)(transactionRequests);
4139
4141
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
4140
4142
  allRequests.forEach((req, index) => {
4141
- if (req.type === import_transactions19.TransactionType.Script) {
4143
+ if (req.type === import_transactions20.TransactionType.Script) {
4142
4144
  serializedTransactionsMap.set(index, (0, import_utils22.hexlify)(req.toTransactionBytes()));
4143
4145
  }
4144
4146
  });
@@ -4164,7 +4166,7 @@ Supported fuel-core version: ${supportedVersion}.`
4164
4166
  );
4165
4167
  const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
4166
4168
  const request = allRequests[requestIdx];
4167
- if (hasMissingOutputs && request?.type === import_transactions19.TransactionType.Script) {
4169
+ if (hasMissingOutputs && request?.type === import_transactions20.TransactionType.Script) {
4168
4170
  result.outputVariables += missingOutputVariables.length;
4169
4171
  request.addVariableOutputs(missingOutputVariables.length);
4170
4172
  missingOutputContractIds.forEach(({ contractId }) => {
@@ -4214,13 +4216,13 @@ Supported fuel-core version: ${supportedVersion}.`
4214
4216
  gasPrice = await this.estimateGasPrice(10);
4215
4217
  }
4216
4218
  const minFee = calculateGasFee({
4217
- gasPrice: (0, import_math17.bn)(gasPrice),
4219
+ gasPrice: (0, import_math18.bn)(gasPrice),
4218
4220
  gas: minGas,
4219
4221
  priceFactor: gasPriceFactor,
4220
4222
  tip: transactionRequest.tip
4221
4223
  }).add(1);
4222
- let gasLimit = (0, import_math17.bn)(0);
4223
- if (transactionRequest.type === import_transactions19.TransactionType.Script) {
4224
+ let gasLimit = (0, import_math18.bn)(0);
4225
+ if (transactionRequest.type === import_transactions20.TransactionType.Script) {
4224
4226
  gasLimit = transactionRequest.gasLimit;
4225
4227
  if (transactionRequest.gasLimit.eq(0)) {
4226
4228
  transactionRequest.gasLimit = minGas;
@@ -4232,7 +4234,7 @@ Supported fuel-core version: ${supportedVersion}.`
4232
4234
  }
4233
4235
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4234
4236
  const maxFee = calculateGasFee({
4235
- gasPrice: (0, import_math17.bn)(gasPrice),
4237
+ gasPrice: (0, import_math18.bn)(gasPrice),
4236
4238
  gas: maxGas,
4237
4239
  priceFactor: gasPriceFactor,
4238
4240
  tip: transactionRequest.tip
@@ -4290,14 +4292,14 @@ Supported fuel-core version: ${supportedVersion}.`
4290
4292
  */
4291
4293
  async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
4292
4294
  const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
4293
- const isScriptTransaction = txRequestClone.type === import_transactions19.TransactionType.Script;
4295
+ const isScriptTransaction = txRequestClone.type === import_transactions20.TransactionType.Script;
4294
4296
  const baseAssetId = this.getBaseAssetId();
4295
4297
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
4296
4298
  const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
4297
4299
  txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
4298
- txRequestClone.maxFee = (0, import_math17.bn)(0);
4300
+ txRequestClone.maxFee = (0, import_math18.bn)(0);
4299
4301
  if (isScriptTransaction) {
4300
- txRequestClone.gasLimit = (0, import_math17.bn)(0);
4302
+ txRequestClone.gasLimit = (0, import_math18.bn)(0);
4301
4303
  }
4302
4304
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4303
4305
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -4317,7 +4319,7 @@ Supported fuel-core version: ${supportedVersion}.`
4317
4319
  let dryRunStatus;
4318
4320
  let missingContractIds = [];
4319
4321
  let outputVariables = 0;
4320
- let gasUsed = (0, import_math17.bn)(0);
4322
+ let gasUsed = (0, import_math18.bn)(0);
4321
4323
  txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
4322
4324
  txRequestClone.maxFee = maxFee;
4323
4325
  if (isScriptTransaction) {
@@ -4382,10 +4384,10 @@ Supported fuel-core version: ${supportedVersion}.`
4382
4384
  return coins.map((coin) => ({
4383
4385
  id: coin.utxoId,
4384
4386
  assetId: coin.assetId,
4385
- amount: (0, import_math17.bn)(coin.amount),
4387
+ amount: (0, import_math18.bn)(coin.amount),
4386
4388
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4387
- blockCreated: (0, import_math17.bn)(coin.blockCreated),
4388
- txCreatedIdx: (0, import_math17.bn)(coin.txCreatedIdx)
4389
+ blockCreated: (0, import_math18.bn)(coin.blockCreated),
4390
+ txCreatedIdx: (0, import_math18.bn)(coin.txCreatedIdx)
4389
4391
  }));
4390
4392
  }
4391
4393
  /**
@@ -4419,12 +4421,12 @@ Supported fuel-core version: ${supportedVersion}.`
4419
4421
  };
4420
4422
  const result = await this.operations.getCoinsToSpend(coinsQuery);
4421
4423
  const coins = result.coinsToSpend.flat().map((coin) => {
4422
- switch (coin.type) {
4424
+ switch (coin.__typename) {
4423
4425
  case "MessageCoin":
4424
4426
  return {
4425
- amount: (0, import_math17.bn)(coin.amount),
4427
+ amount: (0, import_math18.bn)(coin.amount),
4426
4428
  assetId: coin.assetId,
4427
- daHeight: (0, import_math17.bn)(coin.daHeight),
4429
+ daHeight: (0, import_math18.bn)(coin.daHeight),
4428
4430
  sender: import_address3.Address.fromAddressOrString(coin.sender),
4429
4431
  recipient: import_address3.Address.fromAddressOrString(coin.recipient),
4430
4432
  nonce: coin.nonce
@@ -4432,11 +4434,11 @@ Supported fuel-core version: ${supportedVersion}.`
4432
4434
  case "Coin":
4433
4435
  return {
4434
4436
  id: coin.utxoId,
4435
- amount: (0, import_math17.bn)(coin.amount),
4437
+ amount: (0, import_math18.bn)(coin.amount),
4436
4438
  assetId: coin.assetId,
4437
4439
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4438
- blockCreated: (0, import_math17.bn)(coin.blockCreated),
4439
- txCreatedIdx: (0, import_math17.bn)(coin.txCreatedIdx)
4440
+ blockCreated: (0, import_math18.bn)(coin.blockCreated),
4441
+ txCreatedIdx: (0, import_math18.bn)(coin.txCreatedIdx)
4440
4442
  };
4441
4443
  default:
4442
4444
  return null;
@@ -4453,13 +4455,13 @@ Supported fuel-core version: ${supportedVersion}.`
4453
4455
  async getBlock(idOrHeight) {
4454
4456
  let variables;
4455
4457
  if (typeof idOrHeight === "number") {
4456
- variables = { height: (0, import_math17.bn)(idOrHeight).toString(10) };
4458
+ variables = { height: (0, import_math18.bn)(idOrHeight).toString(10) };
4457
4459
  } else if (idOrHeight === "latest") {
4458
4460
  variables = { height: (await this.getBlockNumber()).toString(10) };
4459
4461
  } else if (idOrHeight.length === 66) {
4460
4462
  variables = { blockId: idOrHeight };
4461
4463
  } else {
4462
- variables = { blockId: (0, import_math17.bn)(idOrHeight).toString(10) };
4464
+ variables = { blockId: (0, import_math18.bn)(idOrHeight).toString(10) };
4463
4465
  }
4464
4466
  const { block } = await this.operations.getBlock(variables);
4465
4467
  if (!block) {
@@ -4467,7 +4469,7 @@ Supported fuel-core version: ${supportedVersion}.`
4467
4469
  }
4468
4470
  return {
4469
4471
  id: block.id,
4470
- height: (0, import_math17.bn)(block.height),
4472
+ height: (0, import_math18.bn)(block.height),
4471
4473
  time: block.header.time,
4472
4474
  transactionIds: block.transactions.map((tx) => tx.id)
4473
4475
  };
@@ -4482,7 +4484,7 @@ Supported fuel-core version: ${supportedVersion}.`
4482
4484
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4483
4485
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4484
4486
  id: block.id,
4485
- height: (0, import_math17.bn)(block.height),
4487
+ height: (0, import_math18.bn)(block.height),
4486
4488
  time: block.header.time,
4487
4489
  transactionIds: block.transactions.map((tx) => tx.id)
4488
4490
  }));
@@ -4497,7 +4499,7 @@ Supported fuel-core version: ${supportedVersion}.`
4497
4499
  async getBlockWithTransactions(idOrHeight) {
4498
4500
  let variables;
4499
4501
  if (typeof idOrHeight === "number") {
4500
- variables = { blockHeight: (0, import_math17.bn)(idOrHeight).toString(10) };
4502
+ variables = { blockHeight: (0, import_math18.bn)(idOrHeight).toString(10) };
4501
4503
  } else if (idOrHeight === "latest") {
4502
4504
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4503
4505
  } else {
@@ -4509,11 +4511,11 @@ Supported fuel-core version: ${supportedVersion}.`
4509
4511
  }
4510
4512
  return {
4511
4513
  id: block.id,
4512
- height: (0, import_math17.bn)(block.height, 10),
4514
+ height: (0, import_math18.bn)(block.height, 10),
4513
4515
  time: block.header.time,
4514
4516
  transactionIds: block.transactions.map((tx) => tx.id),
4515
4517
  transactions: block.transactions.map(
4516
- (tx) => new import_transactions19.TransactionCoder().decode((0, import_utils22.arrayify)(tx.rawPayload), 0)?.[0]
4518
+ (tx) => new import_transactions20.TransactionCoder().decode((0, import_utils22.arrayify)(tx.rawPayload), 0)?.[0]
4517
4519
  )
4518
4520
  };
4519
4521
  }
@@ -4528,7 +4530,7 @@ Supported fuel-core version: ${supportedVersion}.`
4528
4530
  if (!transaction) {
4529
4531
  return null;
4530
4532
  }
4531
- return new import_transactions19.TransactionCoder().decode(
4533
+ return new import_transactions20.TransactionCoder().decode(
4532
4534
  (0, import_utils22.arrayify)(transaction.rawPayload),
4533
4535
  0
4534
4536
  )?.[0];
@@ -4558,7 +4560,7 @@ Supported fuel-core version: ${supportedVersion}.`
4558
4560
  contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
4559
4561
  asset: (0, import_utils22.hexlify)(assetId)
4560
4562
  });
4561
- return (0, import_math17.bn)(contractBalance.amount, 10);
4563
+ return (0, import_math18.bn)(contractBalance.amount, 10);
4562
4564
  }
4563
4565
  /**
4564
4566
  * Returns the balance for the given owner for the given asset ID.
@@ -4572,7 +4574,7 @@ Supported fuel-core version: ${supportedVersion}.`
4572
4574
  owner: import_address3.Address.fromAddressOrString(owner).toB256(),
4573
4575
  assetId: (0, import_utils22.hexlify)(assetId)
4574
4576
  });
4575
- return (0, import_math17.bn)(balance.amount, 10);
4577
+ return (0, import_math18.bn)(balance.amount, 10);
4576
4578
  }
4577
4579
  /**
4578
4580
  * Returns balances for the given owner.
@@ -4590,7 +4592,7 @@ Supported fuel-core version: ${supportedVersion}.`
4590
4592
  const balances = result.balances.edges.map((edge) => edge.node);
4591
4593
  return balances.map((balance) => ({
4592
4594
  assetId: balance.assetId,
4593
- amount: (0, import_math17.bn)(balance.amount)
4595
+ amount: (0, import_math18.bn)(balance.amount)
4594
4596
  }));
4595
4597
  }
4596
4598
  /**
@@ -4608,19 +4610,19 @@ Supported fuel-core version: ${supportedVersion}.`
4608
4610
  });
4609
4611
  const messages = result.messages.edges.map((edge) => edge.node);
4610
4612
  return messages.map((message) => ({
4611
- messageId: import_transactions19.InputMessageCoder.getMessageId({
4613
+ messageId: import_transactions20.InputMessageCoder.getMessageId({
4612
4614
  sender: message.sender,
4613
4615
  recipient: message.recipient,
4614
4616
  nonce: message.nonce,
4615
- amount: (0, import_math17.bn)(message.amount),
4617
+ amount: (0, import_math18.bn)(message.amount),
4616
4618
  data: message.data
4617
4619
  }),
4618
4620
  sender: import_address3.Address.fromAddressOrString(message.sender),
4619
4621
  recipient: import_address3.Address.fromAddressOrString(message.recipient),
4620
4622
  nonce: message.nonce,
4621
- amount: (0, import_math17.bn)(message.amount),
4622
- data: import_transactions19.InputMessageCoder.decodeData(message.data),
4623
- daHeight: (0, import_math17.bn)(message.daHeight)
4623
+ amount: (0, import_math18.bn)(message.amount),
4624
+ data: import_transactions20.InputMessageCoder.decodeData(message.data),
4625
+ daHeight: (0, import_math18.bn)(message.daHeight)
4624
4626
  }));
4625
4627
  }
4626
4628
  /**
@@ -4673,19 +4675,19 @@ Supported fuel-core version: ${supportedVersion}.`
4673
4675
  } = result.messageProof;
4674
4676
  return {
4675
4677
  messageProof: {
4676
- proofIndex: (0, import_math17.bn)(messageProof.proofIndex),
4678
+ proofIndex: (0, import_math18.bn)(messageProof.proofIndex),
4677
4679
  proofSet: messageProof.proofSet
4678
4680
  },
4679
4681
  blockProof: {
4680
- proofIndex: (0, import_math17.bn)(blockProof.proofIndex),
4682
+ proofIndex: (0, import_math18.bn)(blockProof.proofIndex),
4681
4683
  proofSet: blockProof.proofSet
4682
4684
  },
4683
4685
  messageBlockHeader: {
4684
4686
  id: messageBlockHeader.id,
4685
- daHeight: (0, import_math17.bn)(messageBlockHeader.daHeight),
4687
+ daHeight: (0, import_math18.bn)(messageBlockHeader.daHeight),
4686
4688
  transactionsCount: Number(messageBlockHeader.transactionsCount),
4687
4689
  transactionsRoot: messageBlockHeader.transactionsRoot,
4688
- height: (0, import_math17.bn)(messageBlockHeader.height),
4690
+ height: (0, import_math18.bn)(messageBlockHeader.height),
4689
4691
  prevRoot: messageBlockHeader.prevRoot,
4690
4692
  time: messageBlockHeader.time,
4691
4693
  applicationHash: messageBlockHeader.applicationHash,
@@ -4697,10 +4699,10 @@ Supported fuel-core version: ${supportedVersion}.`
4697
4699
  },
4698
4700
  commitBlockHeader: {
4699
4701
  id: commitBlockHeader.id,
4700
- daHeight: (0, import_math17.bn)(commitBlockHeader.daHeight),
4702
+ daHeight: (0, import_math18.bn)(commitBlockHeader.daHeight),
4701
4703
  transactionsCount: Number(commitBlockHeader.transactionsCount),
4702
4704
  transactionsRoot: commitBlockHeader.transactionsRoot,
4703
- height: (0, import_math17.bn)(commitBlockHeader.height),
4705
+ height: (0, import_math18.bn)(commitBlockHeader.height),
4704
4706
  prevRoot: commitBlockHeader.prevRoot,
4705
4707
  time: commitBlockHeader.time,
4706
4708
  applicationHash: commitBlockHeader.applicationHash,
@@ -4713,19 +4715,19 @@ Supported fuel-core version: ${supportedVersion}.`
4713
4715
  sender: import_address3.Address.fromAddressOrString(sender),
4714
4716
  recipient: import_address3.Address.fromAddressOrString(recipient),
4715
4717
  nonce,
4716
- amount: (0, import_math17.bn)(amount),
4718
+ amount: (0, import_math18.bn)(amount),
4717
4719
  data
4718
4720
  };
4719
4721
  }
4720
4722
  async getLatestGasPrice() {
4721
4723
  const { latestGasPrice } = await this.operations.getLatestGasPrice();
4722
- return (0, import_math17.bn)(latestGasPrice.gasPrice);
4724
+ return (0, import_math18.bn)(latestGasPrice.gasPrice);
4723
4725
  }
4724
4726
  async estimateGasPrice(blockHorizon) {
4725
4727
  const { estimateGasPrice } = await this.operations.estimateGasPrice({
4726
4728
  blockHorizon: String(blockHorizon)
4727
4729
  });
4728
- return (0, import_math17.bn)(estimateGasPrice.gasPrice);
4730
+ return (0, import_math18.bn)(estimateGasPrice.gasPrice);
4729
4731
  }
4730
4732
  /**
4731
4733
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
@@ -4746,10 +4748,10 @@ Supported fuel-core version: ${supportedVersion}.`
4746
4748
  */
4747
4749
  async produceBlocks(amount, startTime) {
4748
4750
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4749
- blocksToProduce: (0, import_math17.bn)(amount).toString(10),
4751
+ blocksToProduce: (0, import_math18.bn)(amount).toString(10),
4750
4752
  startTimestamp: startTime ? import_utils22.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
4751
4753
  });
4752
- return (0, import_math17.bn)(latestBlockHeight);
4754
+ return (0, import_math18.bn)(latestBlockHeight);
4753
4755
  }
4754
4756
  // eslint-disable-next-line @typescript-eslint/require-await
4755
4757
  async getTransactionResponse(transactionId) {
@@ -4785,7 +4787,7 @@ cacheInputs_fn = function(inputs) {
4785
4787
  return;
4786
4788
  }
4787
4789
  inputs.forEach((input) => {
4788
- if (input.type === import_transactions19.InputType.Coin) {
4790
+ if (input.type === import_transactions20.InputType.Coin) {
4789
4791
  this.cache?.set(input.id);
4790
4792
  }
4791
4793
  });
@@ -4795,8 +4797,8 @@ __publicField(Provider, "nodeInfoCache", {});
4795
4797
 
4796
4798
  // src/providers/transaction-summary/get-transaction-summary.ts
4797
4799
  var import_errors15 = require("@fuel-ts/errors");
4798
- var import_math18 = require("@fuel-ts/math");
4799
- var import_transactions20 = require("@fuel-ts/transactions");
4800
+ var import_math19 = require("@fuel-ts/math");
4801
+ var import_transactions21 = require("@fuel-ts/transactions");
4800
4802
  var import_utils25 = require("@fuel-ts/utils");
4801
4803
 
4802
4804
  // src/providers/chains.ts
@@ -4844,22 +4846,6 @@ var assets = [
4844
4846
  }
4845
4847
  ];
4846
4848
 
4847
- // src/providers/transaction-request/helpers.ts
4848
- var import_math19 = require("@fuel-ts/math");
4849
- var import_transactions21 = require("@fuel-ts/transactions");
4850
- var isRequestInputCoin = (input) => input.type === import_transactions21.InputType.Coin;
4851
- var isRequestInputMessage = (input) => input.type === import_transactions21.InputType.Message;
4852
- var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
4853
- var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
4854
- if (isRequestInputCoin(input) && input.assetId === assetId) {
4855
- return acc.add(input.amount);
4856
- }
4857
- if (isRequestInputMessage(input) && assetId === baseAsset) {
4858
- return acc.add(input.amount);
4859
- }
4860
- return acc;
4861
- }, (0, import_math19.bn)(0));
4862
-
4863
4849
  // src/utils/formatTransferToContractScriptData.ts
4864
4850
  var import_abi_coder6 = require("@fuel-ts/abi-coder");
4865
4851
  var import_math20 = require("@fuel-ts/math");
@@ -5097,7 +5083,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5097
5083
  while (needsToBeFunded && fundingAttempts < MAX_FUNDING_ATTEMPTS) {
5098
5084
  const resources = await this.getResourcesToSpend(
5099
5085
  missingQuantities,
5100
- cacheTxInputsFromOwner(request.inputs, this.address)
5086
+ cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
5101
5087
  );
5102
5088
  request.addResources(resources);
5103
5089
  txRequest.shiftPredicateData();
@@ -8389,16 +8375,18 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
8389
8375
 
8390
8376
  // src/test-utils/seedTestWallet.ts
8391
8377
  var import_crypto5 = require("@fuel-ts/crypto");
8392
- var seedTestWallet = async (wallet, quantities) => {
8393
- const genesisWallet = new WalletUnlocked(
8394
- process.env.GENESIS_SECRET || (0, import_crypto5.randomBytes)(32),
8395
- wallet.provider
8396
- );
8378
+ var seedTestWallet = async (wallet, quantities, utxosAmount = 1) => {
8379
+ const accountsToBeFunded = Array.isArray(wallet) ? wallet : [wallet];
8380
+ const [{ provider }] = accountsToBeFunded;
8381
+ const genesisWallet = new WalletUnlocked(process.env.GENESIS_SECRET || (0, import_crypto5.randomBytes)(32), provider);
8397
8382
  const request = new ScriptTransactionRequest();
8398
- quantities.forEach((quantity) => {
8399
- const { amount, assetId } = coinQuantityfy(quantity);
8400
- request.addCoinOutput(wallet.address, amount, assetId);
8401
- });
8383
+ quantities.map(coinQuantityfy).forEach(
8384
+ ({ amount, assetId }) => accountsToBeFunded.forEach(({ address }) => {
8385
+ for (let i = 0; i < utxosAmount; i++) {
8386
+ request.addCoinOutput(address, amount.div(utxosAmount), assetId);
8387
+ }
8388
+ })
8389
+ );
8402
8390
  const txCost = await genesisWallet.provider.getTransactionCost(request);
8403
8391
  request.gasLimit = txCost.gasUsed;
8404
8392
  request.maxFee = txCost.maxFee;