@fuel-ts/account 0.83.0 → 0.85.0

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 (69) hide show
  1. package/README.md +15 -12
  2. package/dist/account.d.ts +6 -6
  3. package/dist/account.d.ts.map +1 -1
  4. package/dist/index.global.js +1800 -1753
  5. package/dist/index.global.js.map +1 -1
  6. package/dist/index.js +619 -414
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +520 -319
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/providers/__generated__/operations.d.ts +532 -615
  11. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  12. package/dist/providers/assets/assets.d.ts +9 -0
  13. package/dist/providers/assets/assets.d.ts.map +1 -0
  14. package/dist/providers/assets/index.d.ts +1 -2
  15. package/dist/providers/assets/index.d.ts.map +1 -1
  16. package/dist/providers/assets/utils/fuelAssetsBaseUrl.d.ts +2 -0
  17. package/dist/providers/assets/utils/fuelAssetsBaseUrl.d.ts.map +1 -0
  18. package/dist/providers/assets/utils/index.d.ts +1 -0
  19. package/dist/providers/assets/utils/index.d.ts.map +1 -1
  20. package/dist/providers/assets/utils/resolveIconPaths.d.ts.map +1 -1
  21. package/dist/providers/message.d.ts +2 -2
  22. package/dist/providers/message.d.ts.map +1 -1
  23. package/dist/providers/provider.d.ts +28 -31
  24. package/dist/providers/provider.d.ts.map +1 -1
  25. package/dist/providers/resource.d.ts +0 -1
  26. package/dist/providers/resource.d.ts.map +1 -1
  27. package/dist/providers/transaction-request/helpers.d.ts +8 -0
  28. package/dist/providers/transaction-request/helpers.d.ts.map +1 -0
  29. package/dist/providers/transaction-request/script-transaction-request.d.ts +2 -3
  30. package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
  31. package/dist/providers/transaction-request/transaction-request.d.ts +5 -6
  32. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  33. package/dist/providers/transaction-request/utils.d.ts +2 -1
  34. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  35. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +2 -2
  36. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
  37. package/dist/providers/transaction-summary/calculate-tx-fee-for-summary.d.ts +20 -0
  38. package/dist/providers/transaction-summary/calculate-tx-fee-for-summary.d.ts.map +1 -0
  39. package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
  40. package/dist/providers/transaction-summary/index.d.ts +1 -1
  41. package/dist/providers/transaction-summary/index.d.ts.map +1 -1
  42. package/dist/providers/transaction-summary/operations.d.ts +4 -0
  43. package/dist/providers/transaction-summary/operations.d.ts.map +1 -1
  44. package/dist/providers/transaction-summary/receipt.d.ts +2 -2
  45. package/dist/providers/transaction-summary/receipt.d.ts.map +1 -1
  46. package/dist/providers/transaction-summary/status.d.ts +5 -1
  47. package/dist/providers/transaction-summary/status.d.ts.map +1 -1
  48. package/dist/providers/transaction-summary/types.d.ts +11 -14
  49. package/dist/providers/transaction-summary/types.d.ts.map +1 -1
  50. package/dist/providers/utils/extract-tx-error.d.ts +2 -2
  51. package/dist/providers/utils/extract-tx-error.d.ts.map +1 -1
  52. package/dist/providers/utils/gas.d.ts +7 -6
  53. package/dist/providers/utils/gas.d.ts.map +1 -1
  54. package/dist/providers/utils/receipts.d.ts +2 -2
  55. package/dist/providers/utils/receipts.d.ts.map +1 -1
  56. package/dist/test-utils/launchNode.d.ts.map +1 -1
  57. package/dist/test-utils/resources.d.ts +4 -0
  58. package/dist/test-utils/resources.d.ts.map +1 -0
  59. package/dist/test-utils/transactionRequest.d.ts +5 -0
  60. package/dist/test-utils/transactionRequest.d.ts.map +1 -0
  61. package/dist/test-utils.global.js +1826 -1756
  62. package/dist/test-utils.global.js.map +1 -1
  63. package/dist/test-utils.js +609 -398
  64. package/dist/test-utils.js.map +1 -1
  65. package/dist/test-utils.mjs +521 -310
  66. package/dist/test-utils.mjs.map +1 -1
  67. package/package.json +17 -17
  68. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +0 -22
  69. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +0 -1
package/dist/index.mjs CHANGED
@@ -31,8 +31,8 @@ var __privateMethod = (obj, member, method) => {
31
31
  import { Address as Address3 } from "@fuel-ts/address";
32
32
  import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
33
33
  import { AbstractAccount } from "@fuel-ts/interfaces";
34
- import { bn as bn18 } from "@fuel-ts/math";
35
- import { arrayify as arrayify14, isDefined } from "@fuel-ts/utils";
34
+ import { bn as bn20 } from "@fuel-ts/math";
35
+ import { arrayify as arrayify14, isDefined as isDefined2 } from "@fuel-ts/utils";
36
36
  import { clone as clone4 } from "ramda";
37
37
 
38
38
  // src/providers/coin-quantity.ts
@@ -73,7 +73,7 @@ var addAmountToCoinQuantities = (params) => {
73
73
  // src/providers/provider.ts
74
74
  import { Address as Address2 } from "@fuel-ts/address";
75
75
  import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
76
- import { BN, bn as bn16 } from "@fuel-ts/math";
76
+ import { BN, bn as bn17 } from "@fuel-ts/math";
77
77
  import {
78
78
  InputType as InputType7,
79
79
  TransactionType as TransactionType8,
@@ -83,13 +83,12 @@ import {
83
83
  import { arrayify as arrayify11, hexlify as hexlify12, DateTime as DateTime2 } from "@fuel-ts/utils";
84
84
  import { checkFuelCoreVersionCompatibility } from "@fuel-ts/versions";
85
85
  import { equalBytes } from "@noble/curves/abstract/utils";
86
- import { Network } from "ethers";
87
86
  import { GraphQLClient } from "graphql-request";
88
87
  import { clone as clone3 } from "ramda";
89
88
 
90
89
  // src/providers/__generated__/operations.ts
91
90
  import gql from "graphql-tag";
92
- var TransactionStatusSubscriptionFragmentFragmentDoc = gql`
91
+ var TransactionStatusSubscriptionFragmentDoc = gql`
93
92
  fragment transactionStatusSubscriptionFragment on TransactionStatus {
94
93
  type: __typename
95
94
  ... on SqueezedOutStatus {
@@ -97,7 +96,13 @@ var TransactionStatusSubscriptionFragmentFragmentDoc = gql`
97
96
  }
98
97
  }
99
98
  `;
100
- var ReceiptFragmentFragmentDoc = gql`
99
+ var SubmittedStatusFragmentDoc = gql`
100
+ fragment SubmittedStatusFragment on SubmittedStatus {
101
+ type: __typename
102
+ time
103
+ }
104
+ `;
105
+ var ReceiptFragmentDoc = gql`
101
106
  fragment receiptFragment on Receipt {
102
107
  id
103
108
  pc
@@ -129,44 +134,65 @@ var ReceiptFragmentFragmentDoc = gql`
129
134
  subId
130
135
  }
131
136
  `;
132
- var TransactionStatusFragmentFragmentDoc = gql`
133
- fragment transactionStatusFragment on TransactionStatus {
137
+ var SuccessStatusFragmentDoc = gql`
138
+ fragment SuccessStatusFragment on SuccessStatus {
139
+ type: __typename
140
+ block {
141
+ id
142
+ }
143
+ time
144
+ programState {
145
+ returnType
146
+ data
147
+ }
148
+ receipts {
149
+ ...receiptFragment
150
+ }
151
+ totalGas
152
+ totalFee
153
+ }
154
+ ${ReceiptFragmentDoc}`;
155
+ var FailureStatusFragmentDoc = gql`
156
+ fragment FailureStatusFragment on FailureStatus {
134
157
  type: __typename
158
+ block {
159
+ id
160
+ }
161
+ totalGas
162
+ totalFee
163
+ time
164
+ reason
165
+ receipts {
166
+ ...receiptFragment
167
+ }
168
+ }
169
+ ${ReceiptFragmentDoc}`;
170
+ var SqueezedOutStatusFragmentDoc = gql`
171
+ fragment SqueezedOutStatusFragment on SqueezedOutStatus {
172
+ type: __typename
173
+ reason
174
+ }
175
+ `;
176
+ var TransactionStatusFragmentDoc = gql`
177
+ fragment transactionStatusFragment on TransactionStatus {
135
178
  ... on SubmittedStatus {
136
- time
179
+ ...SubmittedStatusFragment
137
180
  }
138
181
  ... on SuccessStatus {
139
- block {
140
- id
141
- }
142
- time
143
- receipts {
144
- ...receiptFragment
145
- }
146
- programState {
147
- returnType
148
- data
149
- }
150
- receipts {
151
- ...receiptFragment
152
- }
182
+ ...SuccessStatusFragment
153
183
  }
154
184
  ... on FailureStatus {
155
- block {
156
- id
157
- }
158
- time
159
- reason
160
- receipts {
161
- ...receiptFragment
162
- }
185
+ ...FailureStatusFragment
163
186
  }
164
187
  ... on SqueezedOutStatus {
165
- reason
188
+ ...SqueezedOutStatusFragment
166
189
  }
167
190
  }
168
- ${ReceiptFragmentFragmentDoc}`;
169
- var TransactionFragmentFragmentDoc = gql`
191
+ ${SubmittedStatusFragmentDoc}
192
+ ${SuccessStatusFragmentDoc}
193
+ ${FailureStatusFragmentDoc}
194
+ ${SqueezedOutStatusFragmentDoc}`;
195
+ var TransactionFragmentDoc = gql`
170
196
  fragment transactionFragment on Transaction {
171
197
  id
172
198
  rawPayload
@@ -174,8 +200,8 @@ var TransactionFragmentFragmentDoc = gql`
174
200
  ...transactionStatusFragment
175
201
  }
176
202
  }
177
- ${TransactionStatusFragmentFragmentDoc}`;
178
- var InputEstimatePredicatesFragmentFragmentDoc = gql`
203
+ ${TransactionStatusFragmentDoc}`;
204
+ var InputEstimatePredicatesFragmentDoc = gql`
179
205
  fragment inputEstimatePredicatesFragment on Input {
180
206
  ... on InputCoin {
181
207
  predicateGasUsed
@@ -185,15 +211,17 @@ var InputEstimatePredicatesFragmentFragmentDoc = gql`
185
211
  }
186
212
  }
187
213
  `;
188
- var TransactionEstimatePredicatesFragmentFragmentDoc = gql`
214
+ var TransactionEstimatePredicatesFragmentDoc = gql`
189
215
  fragment transactionEstimatePredicatesFragment on Transaction {
190
216
  inputs {
191
217
  ...inputEstimatePredicatesFragment
192
218
  }
193
219
  }
194
- ${InputEstimatePredicatesFragmentFragmentDoc}`;
195
- var DryRunFailureStatusFragmentFragmentDoc = gql`
220
+ ${InputEstimatePredicatesFragmentDoc}`;
221
+ var DryRunFailureStatusFragmentDoc = gql`
196
222
  fragment dryRunFailureStatusFragment on DryRunFailureStatus {
223
+ totalGas
224
+ totalFee
197
225
  reason
198
226
  programState {
199
227
  returnType
@@ -201,15 +229,17 @@ var DryRunFailureStatusFragmentFragmentDoc = gql`
201
229
  }
202
230
  }
203
231
  `;
204
- var DryRunSuccessStatusFragmentFragmentDoc = gql`
232
+ var DryRunSuccessStatusFragmentDoc = gql`
205
233
  fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
234
+ totalGas
235
+ totalFee
206
236
  programState {
207
237
  returnType
208
238
  data
209
239
  }
210
240
  }
211
241
  `;
212
- var DryRunTransactionStatusFragmentFragmentDoc = gql`
242
+ var DryRunTransactionStatusFragmentDoc = gql`
213
243
  fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
214
244
  ... on DryRunFailureStatus {
215
245
  ...dryRunFailureStatusFragment
@@ -218,9 +248,9 @@ var DryRunTransactionStatusFragmentFragmentDoc = gql`
218
248
  ...dryRunSuccessStatusFragment
219
249
  }
220
250
  }
221
- ${DryRunFailureStatusFragmentFragmentDoc}
222
- ${DryRunSuccessStatusFragmentFragmentDoc}`;
223
- var DryRunTransactionExecutionStatusFragmentFragmentDoc = gql`
251
+ ${DryRunFailureStatusFragmentDoc}
252
+ ${DryRunSuccessStatusFragmentDoc}`;
253
+ var DryRunTransactionExecutionStatusFragmentDoc = gql`
224
254
  fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
225
255
  id
226
256
  status {
@@ -230,11 +260,11 @@ var DryRunTransactionExecutionStatusFragmentFragmentDoc = gql`
230
260
  ...receiptFragment
231
261
  }
232
262
  }
233
- ${DryRunTransactionStatusFragmentFragmentDoc}
234
- ${ReceiptFragmentFragmentDoc}`;
235
- var CoinFragmentFragmentDoc = gql`
263
+ ${DryRunTransactionStatusFragmentDoc}
264
+ ${ReceiptFragmentDoc}`;
265
+ var CoinFragmentDoc = gql`
236
266
  fragment coinFragment on Coin {
237
- __typename
267
+ type: __typename
238
268
  utxoId
239
269
  owner
240
270
  amount
@@ -243,9 +273,9 @@ var CoinFragmentFragmentDoc = gql`
243
273
  txCreatedIdx
244
274
  }
245
275
  `;
246
- var MessageCoinFragmentFragmentDoc = gql`
276
+ var MessageCoinFragmentDoc = gql`
247
277
  fragment messageCoinFragment on MessageCoin {
248
- __typename
278
+ type: __typename
249
279
  sender
250
280
  recipient
251
281
  nonce
@@ -254,7 +284,7 @@ var MessageCoinFragmentFragmentDoc = gql`
254
284
  daHeight
255
285
  }
256
286
  `;
257
- var MessageFragmentFragmentDoc = gql`
287
+ var MessageFragmentDoc = gql`
258
288
  fragment messageFragment on Message {
259
289
  amount
260
290
  sender
@@ -264,7 +294,7 @@ var MessageFragmentFragmentDoc = gql`
264
294
  daHeight
265
295
  }
266
296
  `;
267
- var MessageProofFragmentFragmentDoc = gql`
297
+ var MessageProofFragmentDoc = gql`
268
298
  fragment messageProofFragment on MessageProof {
269
299
  messageProof {
270
300
  proofSet
@@ -311,14 +341,14 @@ var MessageProofFragmentFragmentDoc = gql`
311
341
  data
312
342
  }
313
343
  `;
314
- var BalanceFragmentFragmentDoc = gql`
344
+ var BalanceFragmentDoc = gql`
315
345
  fragment balanceFragment on Balance {
316
346
  owner
317
347
  amount
318
348
  assetId
319
349
  }
320
350
  `;
321
- var BlockFragmentFragmentDoc = gql`
351
+ var BlockFragmentDoc = gql`
322
352
  fragment blockFragment on Block {
323
353
  id
324
354
  height
@@ -330,7 +360,7 @@ var BlockFragmentFragmentDoc = gql`
330
360
  }
331
361
  }
332
362
  `;
333
- var TxParametersFragmentFragmentDoc = gql`
363
+ var TxParametersFragmentDoc = gql`
334
364
  fragment TxParametersFragment on TxParameters {
335
365
  version
336
366
  maxInputs
@@ -338,9 +368,10 @@ var TxParametersFragmentFragmentDoc = gql`
338
368
  maxWitnesses
339
369
  maxGasPerTx
340
370
  maxSize
371
+ maxBytecodeSubsections
341
372
  }
342
373
  `;
343
- var PredicateParametersFragmentFragmentDoc = gql`
374
+ var PredicateParametersFragmentDoc = gql`
344
375
  fragment PredicateParametersFragment on PredicateParameters {
345
376
  version
346
377
  maxPredicateLength
@@ -349,41 +380,42 @@ var PredicateParametersFragmentFragmentDoc = gql`
349
380
  maxMessageDataLength
350
381
  }
351
382
  `;
352
- var ScriptParametersFragmentFragmentDoc = gql`
383
+ var ScriptParametersFragmentDoc = gql`
353
384
  fragment ScriptParametersFragment on ScriptParameters {
354
385
  version
355
386
  maxScriptLength
356
387
  maxScriptDataLength
357
388
  }
358
389
  `;
359
- var ContractParametersFragmentFragmentDoc = gql`
390
+ var ContractParametersFragmentDoc = gql`
360
391
  fragment ContractParametersFragment on ContractParameters {
361
392
  version
362
393
  contractMaxSize
363
394
  maxStorageSlots
364
395
  }
365
396
  `;
366
- var FeeParametersFragmentFragmentDoc = gql`
397
+ var FeeParametersFragmentDoc = gql`
367
398
  fragment FeeParametersFragment on FeeParameters {
368
399
  version
369
400
  gasPriceFactor
370
401
  gasPerByte
371
402
  }
372
403
  `;
373
- var DependentCostFragmentFragmentDoc = gql`
404
+ var DependentCostFragmentDoc = gql`
374
405
  fragment DependentCostFragment on DependentCost {
375
- __typename
376
406
  ... on LightOperation {
407
+ type: __typename
377
408
  base
378
409
  unitsPerGas
379
410
  }
380
411
  ... on HeavyOperation {
412
+ type: __typename
381
413
  base
382
414
  gasPerUnit
383
415
  }
384
416
  }
385
417
  `;
386
- var GasCostsFragmentFragmentDoc = gql`
418
+ var GasCostsFragmentDoc = gql`
387
419
  fragment GasCostsFragment on GasCosts {
388
420
  version
389
421
  add
@@ -539,8 +571,8 @@ var GasCostsFragmentFragmentDoc = gql`
539
571
  }
540
572
  newStoragePerByte
541
573
  }
542
- ${DependentCostFragmentFragmentDoc}`;
543
- var ConsensusParametersFragmentFragmentDoc = gql`
574
+ ${DependentCostFragmentDoc}`;
575
+ var ConsensusParametersFragmentDoc = gql`
544
576
  fragment consensusParametersFragment on ConsensusParameters {
545
577
  version
546
578
  txParams {
@@ -564,13 +596,13 @@ var ConsensusParametersFragmentFragmentDoc = gql`
564
596
  baseAssetId
565
597
  chainId
566
598
  }
567
- ${TxParametersFragmentFragmentDoc}
568
- ${PredicateParametersFragmentFragmentDoc}
569
- ${ScriptParametersFragmentFragmentDoc}
570
- ${ContractParametersFragmentFragmentDoc}
571
- ${FeeParametersFragmentFragmentDoc}
572
- ${GasCostsFragmentFragmentDoc}`;
573
- var ChainInfoFragmentFragmentDoc = gql`
599
+ ${TxParametersFragmentDoc}
600
+ ${PredicateParametersFragmentDoc}
601
+ ${ScriptParametersFragmentDoc}
602
+ ${ContractParametersFragmentDoc}
603
+ ${FeeParametersFragmentDoc}
604
+ ${GasCostsFragmentDoc}`;
605
+ var ChainInfoFragmentDoc = gql`
574
606
  fragment chainInfoFragment on ChainInfo {
575
607
  name
576
608
  latestBlock {
@@ -581,16 +613,16 @@ var ChainInfoFragmentFragmentDoc = gql`
581
613
  ...consensusParametersFragment
582
614
  }
583
615
  }
584
- ${BlockFragmentFragmentDoc}
585
- ${ConsensusParametersFragmentFragmentDoc}`;
586
- var ContractBalanceFragmentFragmentDoc = gql`
616
+ ${BlockFragmentDoc}
617
+ ${ConsensusParametersFragmentDoc}`;
618
+ var ContractBalanceFragmentDoc = gql`
587
619
  fragment contractBalanceFragment on ContractBalance {
588
620
  contract
589
621
  amount
590
622
  assetId
591
623
  }
592
624
  `;
593
- var PageInfoFragmentFragmentDoc = gql`
625
+ var PageInfoFragmentDoc = gql`
594
626
  fragment pageInfoFragment on PageInfo {
595
627
  hasPreviousPage
596
628
  hasNextPage
@@ -598,7 +630,7 @@ var PageInfoFragmentFragmentDoc = gql`
598
630
  endCursor
599
631
  }
600
632
  `;
601
- var NodeInfoFragmentFragmentDoc = gql`
633
+ var NodeInfoFragmentDoc = gql`
602
634
  fragment nodeInfoFragment on NodeInfo {
603
635
  utxoValidation
604
636
  vmBacktrace
@@ -607,6 +639,14 @@ var NodeInfoFragmentFragmentDoc = gql`
607
639
  nodeVersion
608
640
  }
609
641
  `;
642
+ var RelayedTransactionStatusFragmentDoc = gql`
643
+ fragment relayedTransactionStatusFragment on RelayedTransactionStatus {
644
+ ... on RelayedTransactionFailed {
645
+ blockHeight
646
+ failure
647
+ }
648
+ }
649
+ `;
610
650
  var GetVersionDocument = gql`
611
651
  query getVersion {
612
652
  nodeInfo {
@@ -620,28 +660,28 @@ var GetNodeInfoDocument = gql`
620
660
  ...nodeInfoFragment
621
661
  }
622
662
  }
623
- ${NodeInfoFragmentFragmentDoc}`;
663
+ ${NodeInfoFragmentDoc}`;
624
664
  var GetChainDocument = gql`
625
665
  query getChain {
626
666
  chain {
627
667
  ...chainInfoFragment
628
668
  }
629
669
  }
630
- ${ChainInfoFragmentFragmentDoc}`;
670
+ ${ChainInfoFragmentDoc}`;
631
671
  var GetTransactionDocument = gql`
632
672
  query getTransaction($transactionId: TransactionId!) {
633
673
  transaction(id: $transactionId) {
634
674
  ...transactionFragment
635
675
  }
636
676
  }
637
- ${TransactionFragmentFragmentDoc}`;
677
+ ${TransactionFragmentDoc}`;
638
678
  var GetTransactionWithReceiptsDocument = gql`
639
679
  query getTransactionWithReceipts($transactionId: TransactionId!) {
640
680
  transaction(id: $transactionId) {
641
681
  ...transactionFragment
642
682
  }
643
683
  }
644
- ${TransactionFragmentFragmentDoc}`;
684
+ ${TransactionFragmentDoc}`;
645
685
  var GetTransactionsDocument = gql`
646
686
  query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
647
687
  transactions(after: $after, before: $before, first: $first, last: $last) {
@@ -652,7 +692,7 @@ var GetTransactionsDocument = gql`
652
692
  }
653
693
  }
654
694
  }
655
- ${TransactionFragmentFragmentDoc}`;
695
+ ${TransactionFragmentDoc}`;
656
696
  var GetTransactionsByOwnerDocument = gql`
657
697
  query getTransactionsByOwner($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
658
698
  transactionsByOwner(
@@ -672,22 +712,22 @@ var GetTransactionsByOwnerDocument = gql`
672
712
  }
673
713
  }
674
714
  }
675
- ${PageInfoFragmentFragmentDoc}
676
- ${TransactionFragmentFragmentDoc}`;
715
+ ${PageInfoFragmentDoc}
716
+ ${TransactionFragmentDoc}`;
677
717
  var EstimatePredicatesDocument = gql`
678
718
  query estimatePredicates($encodedTransaction: HexString!) {
679
719
  estimatePredicates(tx: $encodedTransaction) {
680
720
  ...transactionEstimatePredicatesFragment
681
721
  }
682
722
  }
683
- ${TransactionEstimatePredicatesFragmentFragmentDoc}`;
723
+ ${TransactionEstimatePredicatesFragmentDoc}`;
684
724
  var GetBlockDocument = gql`
685
725
  query getBlock($blockId: BlockId, $height: U32) {
686
726
  block(id: $blockId, height: $height) {
687
727
  ...blockFragment
688
728
  }
689
729
  }
690
- ${BlockFragmentFragmentDoc}`;
730
+ ${BlockFragmentDoc}`;
691
731
  var GetBlockWithTransactionsDocument = gql`
692
732
  query getBlockWithTransactions($blockId: BlockId, $blockHeight: U32) {
693
733
  block(id: $blockId, height: $blockHeight) {
@@ -697,8 +737,8 @@ var GetBlockWithTransactionsDocument = gql`
697
737
  }
698
738
  }
699
739
  }
700
- ${BlockFragmentFragmentDoc}
701
- ${TransactionFragmentFragmentDoc}`;
740
+ ${BlockFragmentDoc}
741
+ ${TransactionFragmentDoc}`;
702
742
  var GetBlocksDocument = gql`
703
743
  query getBlocks($after: String, $before: String, $first: Int, $last: Int) {
704
744
  blocks(after: $after, before: $before, first: $first, last: $last) {
@@ -709,14 +749,14 @@ var GetBlocksDocument = gql`
709
749
  }
710
750
  }
711
751
  }
712
- ${BlockFragmentFragmentDoc}`;
752
+ ${BlockFragmentDoc}`;
713
753
  var GetCoinDocument = gql`
714
754
  query getCoin($coinId: UtxoId!) {
715
755
  coin(utxoId: $coinId) {
716
756
  ...coinFragment
717
757
  }
718
758
  }
719
- ${CoinFragmentFragmentDoc}`;
759
+ ${CoinFragmentDoc}`;
720
760
  var GetCoinsDocument = gql`
721
761
  query getCoins($filter: CoinFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
722
762
  coins(
@@ -733,7 +773,7 @@ var GetCoinsDocument = gql`
733
773
  }
734
774
  }
735
775
  }
736
- ${CoinFragmentFragmentDoc}`;
776
+ ${CoinFragmentDoc}`;
737
777
  var GetCoinsToSpendDocument = gql`
738
778
  query getCoinsToSpend($owner: Address!, $queryPerAsset: [SpendQueryElementInput!]!, $excludedIds: ExcludeInput) {
739
779
  coinsToSpend(
@@ -745,8 +785,8 @@ var GetCoinsToSpendDocument = gql`
745
785
  ...messageCoinFragment
746
786
  }
747
787
  }
748
- ${CoinFragmentFragmentDoc}
749
- ${MessageCoinFragmentFragmentDoc}`;
788
+ ${CoinFragmentDoc}
789
+ ${MessageCoinFragmentDoc}`;
750
790
  var GetContractDocument = gql`
751
791
  query getContract($contractId: ContractId!) {
752
792
  contract(id: $contractId) {
@@ -761,14 +801,14 @@ var GetContractBalanceDocument = gql`
761
801
  ...contractBalanceFragment
762
802
  }
763
803
  }
764
- ${ContractBalanceFragmentFragmentDoc}`;
804
+ ${ContractBalanceFragmentDoc}`;
765
805
  var GetBalanceDocument = gql`
766
806
  query getBalance($owner: Address!, $assetId: AssetId!) {
767
807
  balance(owner: $owner, assetId: $assetId) {
768
808
  ...balanceFragment
769
809
  }
770
810
  }
771
- ${BalanceFragmentFragmentDoc}`;
811
+ ${BalanceFragmentDoc}`;
772
812
  var GetLatestGasPriceDocument = gql`
773
813
  query getLatestGasPrice {
774
814
  latestGasPrice {
@@ -799,7 +839,7 @@ var GetBalancesDocument = gql`
799
839
  }
800
840
  }
801
841
  }
802
- ${BalanceFragmentFragmentDoc}`;
842
+ ${BalanceFragmentDoc}`;
803
843
  var GetMessagesDocument = gql`
804
844
  query getMessages($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
805
845
  messages(
@@ -816,7 +856,7 @@ var GetMessagesDocument = gql`
816
856
  }
817
857
  }
818
858
  }
819
- ${MessageFragmentFragmentDoc}`;
859
+ ${MessageFragmentDoc}`;
820
860
  var GetMessageProofDocument = gql`
821
861
  query getMessageProof($transactionId: TransactionId!, $nonce: Nonce!, $commitBlockId: BlockId, $commitBlockHeight: U32) {
822
862
  messageProof(
@@ -828,7 +868,7 @@ var GetMessageProofDocument = gql`
828
868
  ...messageProofFragment
829
869
  }
830
870
  }
831
- ${MessageProofFragmentFragmentDoc}`;
871
+ ${MessageProofFragmentDoc}`;
832
872
  var GetMessageStatusDocument = gql`
833
873
  query getMessageStatus($nonce: Nonce!) {
834
874
  messageStatus(nonce: $nonce) {
@@ -836,13 +876,20 @@ var GetMessageStatusDocument = gql`
836
876
  }
837
877
  }
838
878
  `;
879
+ var GetRelayedTransactionStatusDocument = gql`
880
+ query getRelayedTransactionStatus($relayedTransactionId: RelayedTransactionId!) {
881
+ relayedTransactionStatus(id: $relayedTransactionId) {
882
+ ...relayedTransactionStatusFragment
883
+ }
884
+ }
885
+ ${RelayedTransactionStatusFragmentDoc}`;
839
886
  var DryRunDocument = gql`
840
887
  mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
841
888
  dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
842
889
  ...dryRunTransactionExecutionStatusFragment
843
890
  }
844
891
  }
845
- ${DryRunTransactionExecutionStatusFragmentFragmentDoc}`;
892
+ ${DryRunTransactionExecutionStatusFragmentDoc}`;
846
893
  var SubmitDocument = gql`
847
894
  mutation submit($encodedTransaction: HexString!) {
848
895
  submit(tx: $encodedTransaction) {
@@ -858,20 +905,27 @@ var ProduceBlocksDocument = gql`
858
905
  )
859
906
  }
860
907
  `;
908
+ var GetMessageByNonceDocument = gql`
909
+ query getMessageByNonce($nonce: Nonce!) {
910
+ message(nonce: $nonce) {
911
+ ...messageFragment
912
+ }
913
+ }
914
+ ${MessageFragmentDoc}`;
861
915
  var SubmitAndAwaitDocument = gql`
862
916
  subscription submitAndAwait($encodedTransaction: HexString!) {
863
917
  submitAndAwait(tx: $encodedTransaction) {
864
918
  ...transactionStatusSubscriptionFragment
865
919
  }
866
920
  }
867
- ${TransactionStatusSubscriptionFragmentFragmentDoc}`;
921
+ ${TransactionStatusSubscriptionFragmentDoc}`;
868
922
  var StatusChangeDocument = gql`
869
923
  subscription statusChange($transactionId: TransactionId!) {
870
924
  statusChange(id: $transactionId) {
871
925
  ...transactionStatusSubscriptionFragment
872
926
  }
873
927
  }
874
- ${TransactionStatusSubscriptionFragmentFragmentDoc}`;
928
+ ${TransactionStatusSubscriptionFragmentDoc}`;
875
929
  function getSdk(requester) {
876
930
  return {
877
931
  getVersion(variables, options) {
@@ -943,6 +997,9 @@ function getSdk(requester) {
943
997
  getMessageStatus(variables, options) {
944
998
  return requester(GetMessageStatusDocument, variables, options);
945
999
  },
1000
+ getRelayedTransactionStatus(variables, options) {
1001
+ return requester(GetRelayedTransactionStatusDocument, variables, options);
1002
+ },
946
1003
  dryRun(variables, options) {
947
1004
  return requester(DryRunDocument, variables, options);
948
1005
  },
@@ -952,6 +1009,9 @@ function getSdk(requester) {
952
1009
  produceBlocks(variables, options) {
953
1010
  return requester(ProduceBlocksDocument, variables, options);
954
1011
  },
1012
+ getMessageByNonce(variables, options) {
1013
+ return requester(GetMessageByNonceDocument, variables, options);
1014
+ },
955
1015
  submitAndAwait(variables, options) {
956
1016
  return requester(SubmitAndAwaitDocument, variables, options);
957
1017
  },
@@ -1244,7 +1304,7 @@ import {
1244
1304
  OutputType as OutputType2,
1245
1305
  TransactionType
1246
1306
  } from "@fuel-ts/transactions";
1247
- import { concat, hexlify as hexlify7 } from "@fuel-ts/utils";
1307
+ import { concat, hexlify as hexlify7, isDefined } from "@fuel-ts/utils";
1248
1308
 
1249
1309
  // src/providers/resource.ts
1250
1310
  var isRawCoin = (resource) => "utxoId" in resource;
@@ -1539,10 +1599,9 @@ var getGasUsedFromReceipts = (receipts) => {
1539
1599
  function resolveGasDependentCosts(byteSize, gasDependentCost) {
1540
1600
  const base = bn5(gasDependentCost.base);
1541
1601
  let dependentValue = bn5(0);
1542
- if (gasDependentCost.__typename === "LightOperation") {
1602
+ if ("unitsPerGas" in gasDependentCost) {
1543
1603
  dependentValue = bn5(byteSize).div(bn5(gasDependentCost.unitsPerGas));
1544
- }
1545
- if (gasDependentCost.__typename === "HeavyOperation") {
1604
+ } else {
1546
1605
  dependentValue = bn5(byteSize).mul(bn5(gasDependentCost.gasPerUnit));
1547
1606
  }
1548
1607
  return base.add(dependentValue);
@@ -1619,7 +1678,7 @@ function calculateMetadataGasForTxScript({
1619
1678
  }
1620
1679
  var calculateGasFee = (params) => {
1621
1680
  const { gas, gasPrice, priceFactor, tip } = params;
1622
- return gas.mul(gasPrice).div(priceFactor).add(tip);
1681
+ return gas.mul(gasPrice).div(priceFactor).add(bn5(tip));
1623
1682
  };
1624
1683
 
1625
1684
  // src/providers/utils/json.ts
@@ -1804,10 +1863,10 @@ var BaseTransactionRequest = class {
1804
1863
  outputs,
1805
1864
  witnesses
1806
1865
  } = {}) {
1807
- this.tip = bn7(tip);
1808
- this.maturity = maturity ?? 0;
1809
- this.witnessLimit = witnessLimit ? bn7(witnessLimit) : void 0;
1810
- this.maxFee = maxFee ? bn7(maxFee) : void 0;
1866
+ this.tip = tip ? bn7(tip) : void 0;
1867
+ this.maturity = maturity && maturity > 0 ? maturity : void 0;
1868
+ this.witnessLimit = isDefined(witnessLimit) ? bn7(witnessLimit) : void 0;
1869
+ this.maxFee = bn7(maxFee);
1811
1870
  this.inputs = inputs ?? [];
1812
1871
  this.outputs = outputs ?? [];
1813
1872
  this.witnesses = witnesses ?? [];
@@ -1815,22 +1874,21 @@ var BaseTransactionRequest = class {
1815
1874
  static getPolicyMeta(req) {
1816
1875
  let policyTypes = 0;
1817
1876
  const policies = [];
1818
- if (req.tip) {
1877
+ const { tip, witnessLimit, maturity } = req;
1878
+ if (bn7(tip).gt(0)) {
1819
1879
  policyTypes += PolicyType.Tip;
1820
- policies.push({ data: req.tip, type: PolicyType.Tip });
1880
+ policies.push({ data: bn7(tip), type: PolicyType.Tip });
1821
1881
  }
1822
- if (req.witnessLimit) {
1882
+ if (isDefined(witnessLimit) && bn7(witnessLimit).gte(0)) {
1823
1883
  policyTypes += PolicyType.WitnessLimit;
1824
- policies.push({ data: req.witnessLimit, type: PolicyType.WitnessLimit });
1884
+ policies.push({ data: bn7(witnessLimit), type: PolicyType.WitnessLimit });
1825
1885
  }
1826
- if (req.maturity > 0) {
1886
+ if (maturity && maturity > 0) {
1827
1887
  policyTypes += PolicyType.Maturity;
1828
- policies.push({ data: req.maturity, type: PolicyType.Maturity });
1829
- }
1830
- if (req.maxFee) {
1831
- policyTypes += PolicyType.MaxFee;
1832
- policies.push({ data: req.maxFee, type: PolicyType.MaxFee });
1888
+ policies.push({ data: maturity, type: PolicyType.Maturity });
1833
1889
  }
1890
+ policyTypes += PolicyType.MaxFee;
1891
+ policies.push({ data: req.maxFee, type: PolicyType.MaxFee });
1834
1892
  return {
1835
1893
  policyTypes,
1836
1894
  policies
@@ -2146,8 +2204,11 @@ var BaseTransactionRequest = class {
2146
2204
  * @hidden
2147
2205
  */
2148
2206
  calculateMinGas(chainInfo) {
2149
- const { gasCosts, consensusParameters } = chainInfo;
2150
- const { gasPerByte } = consensusParameters;
2207
+ const { consensusParameters } = chainInfo;
2208
+ const {
2209
+ gasCosts,
2210
+ feeParameters: { gasPerByte }
2211
+ } = consensusParameters;
2151
2212
  return getMinGas({
2152
2213
  gasPerByte,
2153
2214
  gasCosts,
@@ -2158,7 +2219,10 @@ var BaseTransactionRequest = class {
2158
2219
  }
2159
2220
  calculateMaxGas(chainInfo, minGas) {
2160
2221
  const { consensusParameters } = chainInfo;
2161
- const { gasPerByte, maxGasPerTx } = consensusParameters;
2222
+ const {
2223
+ feeParameters: { gasPerByte },
2224
+ txParameters: { maxGasPerTx }
2225
+ } = consensusParameters;
2162
2226
  const witnessesLength = this.toTransaction().witnesses.reduce(
2163
2227
  (acc, wit) => acc + wit.dataLength,
2164
2228
  0
@@ -2593,7 +2657,10 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2593
2657
  }
2594
2658
  calculateMaxGas(chainInfo, minGas) {
2595
2659
  const { consensusParameters } = chainInfo;
2596
- const { gasPerByte, maxGasPerTx } = consensusParameters;
2660
+ const {
2661
+ feeParameters: { gasPerByte },
2662
+ txParameters: { maxGasPerTx }
2663
+ } = consensusParameters;
2597
2664
  const witnessesLength = this.toTransaction().witnesses.reduce(
2598
2665
  (acc, wit) => acc + wit.dataLength,
2599
2666
  0
@@ -2681,10 +2748,10 @@ var transactionRequestify = (obj) => {
2681
2748
  };
2682
2749
  var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
2683
2750
  (acc, input) => {
2684
- if (input.type === InputType5.Coin && input.owner === owner) {
2751
+ if (input.type === InputType5.Coin && input.owner === owner.toB256()) {
2685
2752
  acc.utxos.push(input.id);
2686
2753
  }
2687
- if (input.type === InputType5.Message && input.recipient === owner) {
2754
+ if (input.type === InputType5.Message && input.recipient === owner.toB256()) {
2688
2755
  acc.messages.push(input.nonce);
2689
2756
  }
2690
2757
  return acc;
@@ -2697,40 +2764,40 @@ var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
2697
2764
 
2698
2765
  // src/providers/transaction-response/transaction-response.ts
2699
2766
  import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
2700
- import { bn as bn15 } from "@fuel-ts/math";
2767
+ import { bn as bn16 } from "@fuel-ts/math";
2701
2768
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2702
2769
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
2703
2770
 
2704
2771
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2705
- import { bn as bn14 } from "@fuel-ts/math";
2772
+ import { bn as bn15 } from "@fuel-ts/math";
2706
2773
  import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
2707
2774
  import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2708
2775
 
2709
- // src/providers/transaction-summary/calculate-transaction-fee.ts
2776
+ // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
2710
2777
  import { bn as bn11 } from "@fuel-ts/math";
2711
2778
  import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType6 } from "@fuel-ts/transactions";
2712
2779
  import { arrayify as arrayify9 } from "@fuel-ts/utils";
2713
- var calculateTransactionFee = (params) => {
2780
+ var calculateTXFeeForSummary = (params) => {
2714
2781
  const {
2715
2782
  gasPrice,
2716
2783
  rawPayload,
2717
2784
  tip,
2785
+ totalFee,
2718
2786
  consensusParameters: { gasCosts, feeParams, maxGasPerTx }
2719
2787
  } = params;
2788
+ if (totalFee) {
2789
+ return totalFee;
2790
+ }
2720
2791
  const gasPerByte = bn11(feeParams.gasPerByte);
2721
2792
  const gasPriceFactor = bn11(feeParams.gasPriceFactor);
2722
2793
  const transactionBytes = arrayify9(rawPayload);
2723
2794
  const [transaction] = new TransactionCoder3().decode(transactionBytes, 0);
2724
- if (transaction.type === TransactionType6.Mint) {
2725
- return {
2726
- fee: bn11(0),
2727
- minFee: bn11(0),
2728
- maxFee: bn11(0)
2729
- };
2730
- }
2731
2795
  const { type, witnesses, inputs, policies } = transaction;
2732
2796
  let metadataGas = bn11(0);
2733
2797
  let gasLimit = bn11(0);
2798
+ if (type !== TransactionType6.Create && type !== TransactionType6.Script) {
2799
+ return bn11(0);
2800
+ }
2734
2801
  if (type === TransactionType6.Create) {
2735
2802
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2736
2803
  const contractBytesSize = bn11(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
@@ -2767,23 +2834,13 @@ var calculateTransactionFee = (params) => {
2767
2834
  witnessLimit,
2768
2835
  maxGasPerTx
2769
2836
  });
2770
- const minFee = calculateGasFee({
2771
- gasPrice,
2772
- gas: minGas,
2773
- priceFactor: gasPriceFactor,
2774
- tip
2775
- });
2776
2837
  const maxFee = calculateGasFee({
2777
2838
  gasPrice,
2778
2839
  gas: maxGas,
2779
2840
  priceFactor: gasPriceFactor,
2780
2841
  tip
2781
2842
  });
2782
- return {
2783
- minFee,
2784
- maxFee,
2785
- fee: maxFee
2786
- };
2843
+ return maxFee;
2787
2844
  };
2788
2845
 
2789
2846
  // src/providers/transaction-summary/operations.ts
@@ -2918,6 +2975,8 @@ var TransactionTypeName = /* @__PURE__ */ ((TransactionTypeName2) => {
2918
2975
  TransactionTypeName2["Create"] = "Create";
2919
2976
  TransactionTypeName2["Mint"] = "Mint";
2920
2977
  TransactionTypeName2["Script"] = "Script";
2978
+ TransactionTypeName2["Upgrade"] = "Upgrade";
2979
+ TransactionTypeName2["Upload"] = "Upload";
2921
2980
  return TransactionTypeName2;
2922
2981
  })(TransactionTypeName || {});
2923
2982
  var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
@@ -2983,6 +3042,12 @@ function isTypeCreate(transactionType) {
2983
3042
  function isTypeScript(transactionType) {
2984
3043
  return isType(transactionType, "Script" /* Script */);
2985
3044
  }
3045
+ function isTypeUpgrade(transactionType) {
3046
+ return isType(transactionType, "Upgrade" /* Upgrade */);
3047
+ }
3048
+ function isTypeUpload(transactionType) {
3049
+ return isType(transactionType, "Upload" /* Upload */);
3050
+ }
2986
3051
  function hasSameAssetId(a) {
2987
3052
  return (b) => a.assetId === b.assetId;
2988
3053
  }
@@ -3329,6 +3394,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3329
3394
 
3330
3395
  // src/providers/transaction-summary/status.ts
3331
3396
  import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
3397
+ import { bn as bn14 } from "@fuel-ts/math";
3332
3398
  var getTransactionStatusName = (gqlStatus) => {
3333
3399
  switch (gqlStatus) {
3334
3400
  case "FailureStatus":
@@ -3350,6 +3416,8 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3350
3416
  let time;
3351
3417
  let blockId;
3352
3418
  let status;
3419
+ let totalFee;
3420
+ let totalGas;
3353
3421
  let isStatusFailure = false;
3354
3422
  let isStatusSuccess = false;
3355
3423
  let isStatusPending = false;
@@ -3360,11 +3428,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3360
3428
  time = gqlTransactionStatus.time;
3361
3429
  blockId = gqlTransactionStatus.block.id;
3362
3430
  isStatusSuccess = true;
3431
+ totalFee = bn14(gqlTransactionStatus.totalFee);
3432
+ totalGas = bn14(gqlTransactionStatus.totalGas);
3363
3433
  break;
3364
3434
  case "FailureStatus":
3365
3435
  time = gqlTransactionStatus.time;
3366
3436
  blockId = gqlTransactionStatus.block.id;
3367
3437
  isStatusFailure = true;
3438
+ totalFee = bn14(gqlTransactionStatus.totalFee);
3439
+ totalGas = bn14(gqlTransactionStatus.totalGas);
3368
3440
  break;
3369
3441
  case "SubmittedStatus":
3370
3442
  time = gqlTransactionStatus.time;
@@ -3377,6 +3449,8 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3377
3449
  time,
3378
3450
  blockId,
3379
3451
  status,
3452
+ totalFee,
3453
+ totalGas,
3380
3454
  isStatusFailure,
3381
3455
  isStatusSuccess,
3382
3456
  isStatusPending
@@ -3412,8 +3486,10 @@ function assembleTransactionSummary(params) {
3412
3486
  maxInputs
3413
3487
  });
3414
3488
  const typeName = getTransactionTypeName(transaction.type);
3415
- const tip = bn14(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3416
- const { fee } = calculateTransactionFee({
3489
+ const tip = bn15(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3490
+ const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3491
+ const fee = calculateTXFeeForSummary({
3492
+ totalFee,
3417
3493
  gasPrice,
3418
3494
  rawPayload,
3419
3495
  tip,
@@ -3426,7 +3502,6 @@ function assembleTransactionSummary(params) {
3426
3502
  }
3427
3503
  }
3428
3504
  });
3429
- const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time } = processGraphqlStatus(gqlTransactionStatus);
3430
3505
  const mintedAssets = extractMintedAssetsFromReceipts(receipts);
3431
3506
  const burnedAssets = extractBurnedAssetsFromReceipts(receipts);
3432
3507
  let date;
@@ -3435,6 +3510,7 @@ function assembleTransactionSummary(params) {
3435
3510
  }
3436
3511
  const transactionSummary = {
3437
3512
  id,
3513
+ tip,
3438
3514
  fee,
3439
3515
  gasUsed,
3440
3516
  operations,
@@ -3448,6 +3524,8 @@ function assembleTransactionSummary(params) {
3448
3524
  isTypeMint: isTypeMint(transaction.type),
3449
3525
  isTypeCreate: isTypeCreate(transaction.type),
3450
3526
  isTypeScript: isTypeScript(transaction.type),
3527
+ isTypeUpgrade: isTypeUpgrade(transaction.type),
3528
+ isTypeUpload: isTypeUpload(transaction.type),
3451
3529
  isStatusFailure,
3452
3530
  isStatusSuccess,
3453
3531
  isStatusPending,
@@ -3479,7 +3557,7 @@ var TransactionResponse = class {
3479
3557
  /** Current provider */
3480
3558
  provider;
3481
3559
  /** Gas used on the transaction */
3482
- gasUsed = bn15(0);
3560
+ gasUsed = bn16(0);
3483
3561
  /** The graphql Transaction with receipts object. */
3484
3562
  gqlTransaction;
3485
3563
  abis;
@@ -3564,7 +3642,7 @@ var TransactionResponse = class {
3564
3642
  const receipts = txReceipts.map(processGqlReceipt) || [];
3565
3643
  const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
3566
3644
  const gasPrice = await this.provider.getLatestGasPrice();
3567
- const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
3645
+ const maxInputs = this.provider.getChain().consensusParameters.txParameters.maxInputs;
3568
3646
  const transactionSummary = assembleTransactionSummary({
3569
3647
  id: this.id,
3570
3648
  receipts,
@@ -3700,33 +3778,60 @@ var mergeQuantities = (...coinQuantities) => {
3700
3778
  var MAX_RETRIES = 10;
3701
3779
  var processGqlChain = (chain) => {
3702
3780
  const { name, daHeight, consensusParameters, latestBlock } = chain;
3703
- const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } = consensusParameters;
3781
+ const {
3782
+ contractParams,
3783
+ feeParams,
3784
+ predicateParams,
3785
+ scriptParams,
3786
+ txParams,
3787
+ gasCosts,
3788
+ baseAssetId,
3789
+ chainId,
3790
+ version
3791
+ } = consensusParameters;
3704
3792
  return {
3705
3793
  name,
3706
- baseChainHeight: bn16(daHeight),
3794
+ baseChainHeight: bn17(daHeight),
3707
3795
  consensusParameters: {
3708
- contractMaxSize: bn16(contractParams.contractMaxSize),
3709
- maxInputs: bn16(txParams.maxInputs),
3710
- maxOutputs: bn16(txParams.maxOutputs),
3711
- maxWitnesses: bn16(txParams.maxWitnesses),
3712
- maxGasPerTx: bn16(txParams.maxGasPerTx),
3713
- maxScriptLength: bn16(scriptParams.maxScriptLength),
3714
- maxScriptDataLength: bn16(scriptParams.maxScriptDataLength),
3715
- maxStorageSlots: bn16(contractParams.maxStorageSlots),
3716
- maxPredicateLength: bn16(predicateParams.maxPredicateLength),
3717
- maxPredicateDataLength: bn16(predicateParams.maxPredicateDataLength),
3718
- maxGasPerPredicate: bn16(predicateParams.maxGasPerPredicate),
3719
- gasPriceFactor: bn16(feeParams.gasPriceFactor),
3720
- gasPerByte: bn16(feeParams.gasPerByte),
3721
- maxMessageDataLength: bn16(predicateParams.maxMessageDataLength),
3722
- chainId: bn16(consensusParameters.chainId),
3723
- baseAssetId: consensusParameters.baseAssetId,
3796
+ version,
3797
+ chainId: bn17(chainId),
3798
+ baseAssetId,
3799
+ feeParameters: {
3800
+ version: feeParams.version,
3801
+ gasPerByte: bn17(feeParams.gasPerByte),
3802
+ gasPriceFactor: bn17(feeParams.gasPriceFactor)
3803
+ },
3804
+ contractParameters: {
3805
+ version: contractParams.version,
3806
+ contractMaxSize: bn17(contractParams.contractMaxSize),
3807
+ maxStorageSlots: bn17(contractParams.maxStorageSlots)
3808
+ },
3809
+ txParameters: {
3810
+ version: txParams.version,
3811
+ maxInputs: bn17(txParams.maxInputs),
3812
+ maxOutputs: bn17(txParams.maxOutputs),
3813
+ maxWitnesses: bn17(txParams.maxWitnesses),
3814
+ maxGasPerTx: bn17(txParams.maxGasPerTx),
3815
+ maxSize: bn17(txParams.maxSize),
3816
+ maxBytecodeSubsections: bn17(txParams.maxBytecodeSubsections)
3817
+ },
3818
+ predicateParameters: {
3819
+ version: predicateParams.version,
3820
+ maxPredicateLength: bn17(predicateParams.maxPredicateLength),
3821
+ maxPredicateDataLength: bn17(predicateParams.maxPredicateDataLength),
3822
+ maxGasPerPredicate: bn17(predicateParams.maxGasPerPredicate),
3823
+ maxMessageDataLength: bn17(predicateParams.maxMessageDataLength)
3824
+ },
3825
+ scriptParameters: {
3826
+ version: scriptParams.version,
3827
+ maxScriptLength: bn17(scriptParams.maxScriptLength),
3828
+ maxScriptDataLength: bn17(scriptParams.maxScriptDataLength)
3829
+ },
3724
3830
  gasCosts
3725
3831
  },
3726
- gasCosts,
3727
3832
  latestBlock: {
3728
3833
  id: latestBlock.id,
3729
- height: bn16(latestBlock.height),
3834
+ height: bn17(latestBlock.height),
3730
3835
  time: latestBlock.header.time,
3731
3836
  transactions: latestBlock.transactions.map((i) => ({
3732
3837
  id: i.id
@@ -3820,7 +3925,12 @@ var _Provider = class {
3820
3925
  * Returns some helpful parameters related to gas fees.
3821
3926
  */
3822
3927
  getGasConfig() {
3823
- const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
3928
+ const {
3929
+ txParameters: { maxGasPerTx },
3930
+ predicateParameters: { maxGasPerPredicate },
3931
+ feeParameters: { gasPriceFactor, gasPerByte },
3932
+ gasCosts
3933
+ } = this.getChain().consensusParameters;
3824
3934
  return {
3825
3935
  maxGasPerTx,
3826
3936
  maxGasPerPredicate,
@@ -3855,9 +3965,11 @@ var _Provider = class {
3855
3965
  static ensureClientVersionIsSupported(nodeInfo) {
3856
3966
  const { isMajorSupported, isMinorSupported, supportedVersion } = checkFuelCoreVersionCompatibility(nodeInfo.nodeVersion);
3857
3967
  if (!isMajorSupported || !isMinorSupported) {
3858
- throw new FuelError13(
3859
- FuelError13.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3860
- `Fuel client version: ${nodeInfo.nodeVersion}, Supported version: ${supportedVersion}`
3968
+ console.warn(
3969
+ `The Fuel Node that you are trying to connect to is using fuel-core version ${nodeInfo.nodeVersion},
3970
+ which is not supported by the version of the TS SDK that you are using.
3971
+ Things may not work as expected.
3972
+ Supported fuel-core version: ${supportedVersion}.`
3861
3973
  );
3862
3974
  }
3863
3975
  }
@@ -3869,7 +3981,18 @@ var _Provider = class {
3869
3981
  createOperations() {
3870
3982
  const fetchFn = _Provider.getFetchFn(this.options);
3871
3983
  const gqlClient = new GraphQLClient(this.url, {
3872
- fetch: (url, requestInit) => fetchFn(url, requestInit, this.options)
3984
+ fetch: (url, requestInit) => fetchFn(url, requestInit, this.options),
3985
+ responseMiddleware: (response) => {
3986
+ if ("response" in response) {
3987
+ const graphQlResponse = response.response;
3988
+ if (Array.isArray(graphQlResponse?.errors)) {
3989
+ throw new FuelError13(
3990
+ FuelError13.CODES.INVALID_REQUEST,
3991
+ graphQlResponse.errors.map((err) => err.message).join("\n\n")
3992
+ );
3993
+ }
3994
+ }
3995
+ }
3873
3996
  });
3874
3997
  const executeQuery = (query, vars) => {
3875
3998
  const opDefinition = query.definitions.find((x) => x.kind === "OperationDefinition");
@@ -3897,21 +4020,6 @@ var _Provider = class {
3897
4020
  } = await this.operations.getVersion();
3898
4021
  return nodeVersion;
3899
4022
  }
3900
- /**
3901
- * @hidden
3902
- *
3903
- * Returns the network configuration of the connected Fuel node.
3904
- *
3905
- * @returns A promise that resolves to the network configuration object
3906
- */
3907
- async getNetwork() {
3908
- const {
3909
- name,
3910
- consensusParameters: { chainId }
3911
- } = await this.getChain();
3912
- const network = new Network(name, chainId.toNumber());
3913
- return Promise.resolve(network);
3914
- }
3915
4023
  /**
3916
4024
  * Returns the block number.
3917
4025
  *
@@ -3919,7 +4027,7 @@ var _Provider = class {
3919
4027
  */
3920
4028
  async getBlockNumber() {
3921
4029
  const { chain } = await this.operations.getChain();
3922
- return bn16(chain.latestBlock.height, 10);
4030
+ return bn17(chain.latestBlock.height, 10);
3923
4031
  }
3924
4032
  /**
3925
4033
  * Returns the chain information.
@@ -3929,8 +4037,8 @@ var _Provider = class {
3929
4037
  async fetchNode() {
3930
4038
  const { nodeInfo } = await this.operations.getNodeInfo();
3931
4039
  const processedNodeInfo = {
3932
- maxDepth: bn16(nodeInfo.maxDepth),
3933
- maxTx: bn16(nodeInfo.maxTx),
4040
+ maxDepth: bn17(nodeInfo.maxDepth),
4041
+ maxTx: bn17(nodeInfo.maxTx),
3934
4042
  nodeVersion: nodeInfo.nodeVersion,
3935
4043
  utxoValidation: nodeInfo.utxoValidation,
3936
4044
  vmBacktrace: nodeInfo.vmBacktrace
@@ -4034,9 +4142,9 @@ var _Provider = class {
4034
4142
  encodedTransactions: encodedTransaction,
4035
4143
  utxoValidation: utxoValidation || false
4036
4144
  });
4037
- const [{ receipts: rawReceipts, status }] = dryRunStatuses;
4145
+ const [{ receipts: rawReceipts, status: dryRunStatus }] = dryRunStatuses;
4038
4146
  const receipts = rawReceipts.map(processGqlReceipt);
4039
- return { receipts, dryrunStatus: status };
4147
+ return { receipts, dryRunStatus };
4040
4148
  }
4041
4149
  /**
4042
4150
  * Verifies whether enough gas is available to complete transaction.
@@ -4062,7 +4170,7 @@ var _Provider = class {
4062
4170
  } = response;
4063
4171
  if (inputs) {
4064
4172
  inputs.forEach((input, index) => {
4065
- if ("predicateGasUsed" in input && bn16(input.predicateGasUsed).gt(0)) {
4173
+ if ("predicateGasUsed" in input && bn17(input.predicateGasUsed).gt(0)) {
4066
4174
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
4067
4175
  }
4068
4176
  });
@@ -4090,7 +4198,7 @@ var _Provider = class {
4090
4198
  let receipts = [];
4091
4199
  const missingContractIds = [];
4092
4200
  let outputVariables = 0;
4093
- let dryrunStatus;
4201
+ let dryRunStatus;
4094
4202
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
4095
4203
  const {
4096
4204
  dryRun: [{ receipts: rawReceipts, status }]
@@ -4099,7 +4207,7 @@ var _Provider = class {
4099
4207
  utxoValidation: false
4100
4208
  });
4101
4209
  receipts = rawReceipts.map(processGqlReceipt);
4102
- dryrunStatus = status;
4210
+ dryRunStatus = status;
4103
4211
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
4104
4212
  const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
4105
4213
  if (hasMissingOutputs) {
@@ -4121,7 +4229,7 @@ var _Provider = class {
4121
4229
  receipts,
4122
4230
  outputVariables,
4123
4231
  missingContractIds,
4124
- dryrunStatus
4232
+ dryRunStatus
4125
4233
  };
4126
4234
  }
4127
4235
  /**
@@ -4139,7 +4247,7 @@ var _Provider = class {
4139
4247
  receipts: [],
4140
4248
  outputVariables: 0,
4141
4249
  missingContractIds: [],
4142
- dryrunStatus: void 0
4250
+ dryRunStatus: void 0
4143
4251
  }));
4144
4252
  const allRequests = clone3(transactionRequests);
4145
4253
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
@@ -4164,7 +4272,7 @@ var _Provider = class {
4164
4272
  const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
4165
4273
  const result = results[requestIdx];
4166
4274
  result.receipts = rawReceipts.map(processGqlReceipt);
4167
- result.dryrunStatus = status;
4275
+ result.dryRunStatus = status;
4168
4276
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
4169
4277
  result.receipts
4170
4278
  );
@@ -4201,7 +4309,7 @@ var _Provider = class {
4201
4309
  });
4202
4310
  const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
4203
4311
  const receipts = rawReceipts.map(processGqlReceipt);
4204
- return { receipts, dryrunStatus: status };
4312
+ return { receipts, dryRunStatus: status };
4205
4313
  });
4206
4314
  return results;
4207
4315
  }
@@ -4220,12 +4328,12 @@ var _Provider = class {
4220
4328
  gasPrice = await this.estimateGasPrice(10);
4221
4329
  }
4222
4330
  const minFee = calculateGasFee({
4223
- gasPrice: bn16(gasPrice),
4331
+ gasPrice: bn17(gasPrice),
4224
4332
  gas: minGas,
4225
4333
  priceFactor: gasPriceFactor,
4226
4334
  tip: transactionRequest.tip
4227
4335
  }).add(1);
4228
- let gasLimit = bn16(0);
4336
+ let gasLimit = bn17(0);
4229
4337
  if (transactionRequest.type === TransactionType8.Script) {
4230
4338
  gasLimit = transactionRequest.gasLimit;
4231
4339
  if (transactionRequest.gasLimit.eq(0)) {
@@ -4238,7 +4346,7 @@ var _Provider = class {
4238
4346
  }
4239
4347
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4240
4348
  const maxFee = calculateGasFee({
4241
- gasPrice: bn16(gasPrice),
4349
+ gasPrice: bn17(gasPrice),
4242
4350
  gas: maxGas,
4243
4351
  priceFactor: gasPriceFactor,
4244
4352
  tip: transactionRequest.tip
@@ -4298,12 +4406,12 @@ var _Provider = class {
4298
4406
  const txRequestClone = clone3(transactionRequestify(transactionRequestLike));
4299
4407
  const isScriptTransaction = txRequestClone.type === TransactionType8.Script;
4300
4408
  const baseAssetId = this.getBaseAssetId();
4409
+ const updateMaxFee = txRequestClone.maxFee.eq(0);
4301
4410
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
4302
4411
  const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
4303
4412
  txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
4304
- txRequestClone.maxFee = bn16(0);
4305
4413
  if (isScriptTransaction) {
4306
- txRequestClone.gasLimit = bn16(0);
4414
+ txRequestClone.gasLimit = bn17(0);
4307
4415
  }
4308
4416
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4309
4417
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -4316,24 +4424,22 @@ var _Provider = class {
4316
4424
  addedSignatures = signedRequest.witnesses.length - lengthBefore;
4317
4425
  }
4318
4426
  await this.estimatePredicates(signedRequest);
4427
+ txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
4319
4428
  let { maxFee, maxGas, minFee, minGas, gasPrice, gasLimit } = await this.estimateTxGasAndFee({
4320
4429
  transactionRequest: signedRequest
4321
4430
  });
4322
4431
  let receipts = [];
4432
+ let dryRunStatus;
4323
4433
  let missingContractIds = [];
4324
4434
  let outputVariables = 0;
4325
- let gasUsed = bn16(0);
4326
- txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
4435
+ let gasUsed = bn17(0);
4327
4436
  txRequestClone.maxFee = maxFee;
4328
4437
  if (isScriptTransaction) {
4329
4438
  txRequestClone.gasLimit = gasLimit;
4330
4439
  if (signatureCallback) {
4331
4440
  await signatureCallback(txRequestClone);
4332
4441
  }
4333
- const result = await this.estimateTxDependencies(txRequestClone);
4334
- receipts = result.receipts;
4335
- outputVariables = result.outputVariables;
4336
- missingContractIds = result.missingContractIds;
4442
+ ({ receipts, missingContractIds, outputVariables, dryRunStatus } = await this.estimateTxDependencies(txRequestClone));
4337
4443
  gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
4338
4444
  txRequestClone.gasLimit = gasUsed;
4339
4445
  ({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
@@ -4353,7 +4459,9 @@ var _Provider = class {
4353
4459
  outputVariables,
4354
4460
  missingContractIds,
4355
4461
  addedSignatures,
4356
- estimatedPredicates: txRequestClone.inputs
4462
+ estimatedPredicates: txRequestClone.inputs,
4463
+ dryRunStatus,
4464
+ updateMaxFee
4357
4465
  };
4358
4466
  }
4359
4467
  async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
@@ -4389,10 +4497,10 @@ var _Provider = class {
4389
4497
  return coins.map((coin) => ({
4390
4498
  id: coin.utxoId,
4391
4499
  assetId: coin.assetId,
4392
- amount: bn16(coin.amount),
4500
+ amount: bn17(coin.amount),
4393
4501
  owner: Address2.fromAddressOrString(coin.owner),
4394
- blockCreated: bn16(coin.blockCreated),
4395
- txCreatedIdx: bn16(coin.txCreatedIdx)
4502
+ blockCreated: bn17(coin.blockCreated),
4503
+ txCreatedIdx: bn17(coin.txCreatedIdx)
4396
4504
  }));
4397
4505
  }
4398
4506
  /**
@@ -4426,12 +4534,12 @@ var _Provider = class {
4426
4534
  };
4427
4535
  const result = await this.operations.getCoinsToSpend(coinsQuery);
4428
4536
  const coins = result.coinsToSpend.flat().map((coin) => {
4429
- switch (coin.__typename) {
4537
+ switch (coin.type) {
4430
4538
  case "MessageCoin":
4431
4539
  return {
4432
- amount: bn16(coin.amount),
4540
+ amount: bn17(coin.amount),
4433
4541
  assetId: coin.assetId,
4434
- daHeight: bn16(coin.daHeight),
4542
+ daHeight: bn17(coin.daHeight),
4435
4543
  sender: Address2.fromAddressOrString(coin.sender),
4436
4544
  recipient: Address2.fromAddressOrString(coin.recipient),
4437
4545
  nonce: coin.nonce
@@ -4439,11 +4547,11 @@ var _Provider = class {
4439
4547
  case "Coin":
4440
4548
  return {
4441
4549
  id: coin.utxoId,
4442
- amount: bn16(coin.amount),
4550
+ amount: bn17(coin.amount),
4443
4551
  assetId: coin.assetId,
4444
4552
  owner: Address2.fromAddressOrString(coin.owner),
4445
- blockCreated: bn16(coin.blockCreated),
4446
- txCreatedIdx: bn16(coin.txCreatedIdx)
4553
+ blockCreated: bn17(coin.blockCreated),
4554
+ txCreatedIdx: bn17(coin.txCreatedIdx)
4447
4555
  };
4448
4556
  default:
4449
4557
  return null;
@@ -4460,13 +4568,13 @@ var _Provider = class {
4460
4568
  async getBlock(idOrHeight) {
4461
4569
  let variables;
4462
4570
  if (typeof idOrHeight === "number") {
4463
- variables = { height: bn16(idOrHeight).toString(10) };
4571
+ variables = { height: bn17(idOrHeight).toString(10) };
4464
4572
  } else if (idOrHeight === "latest") {
4465
4573
  variables = { height: (await this.getBlockNumber()).toString(10) };
4466
4574
  } else if (idOrHeight.length === 66) {
4467
4575
  variables = { blockId: idOrHeight };
4468
4576
  } else {
4469
- variables = { blockId: bn16(idOrHeight).toString(10) };
4577
+ variables = { blockId: bn17(idOrHeight).toString(10) };
4470
4578
  }
4471
4579
  const { block } = await this.operations.getBlock(variables);
4472
4580
  if (!block) {
@@ -4474,7 +4582,7 @@ var _Provider = class {
4474
4582
  }
4475
4583
  return {
4476
4584
  id: block.id,
4477
- height: bn16(block.height),
4585
+ height: bn17(block.height),
4478
4586
  time: block.header.time,
4479
4587
  transactionIds: block.transactions.map((tx) => tx.id)
4480
4588
  };
@@ -4489,7 +4597,7 @@ var _Provider = class {
4489
4597
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4490
4598
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4491
4599
  id: block.id,
4492
- height: bn16(block.height),
4600
+ height: bn17(block.height),
4493
4601
  time: block.header.time,
4494
4602
  transactionIds: block.transactions.map((tx) => tx.id)
4495
4603
  }));
@@ -4504,7 +4612,7 @@ var _Provider = class {
4504
4612
  async getBlockWithTransactions(idOrHeight) {
4505
4613
  let variables;
4506
4614
  if (typeof idOrHeight === "number") {
4507
- variables = { blockHeight: bn16(idOrHeight).toString(10) };
4615
+ variables = { blockHeight: bn17(idOrHeight).toString(10) };
4508
4616
  } else if (idOrHeight === "latest") {
4509
4617
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4510
4618
  } else {
@@ -4516,7 +4624,7 @@ var _Provider = class {
4516
4624
  }
4517
4625
  return {
4518
4626
  id: block.id,
4519
- height: bn16(block.height, 10),
4627
+ height: bn17(block.height, 10),
4520
4628
  time: block.header.time,
4521
4629
  transactionIds: block.transactions.map((tx) => tx.id),
4522
4630
  transactions: block.transactions.map(
@@ -4565,7 +4673,7 @@ var _Provider = class {
4565
4673
  contract: Address2.fromAddressOrString(contractId).toB256(),
4566
4674
  asset: hexlify12(assetId)
4567
4675
  });
4568
- return bn16(contractBalance.amount, 10);
4676
+ return bn17(contractBalance.amount, 10);
4569
4677
  }
4570
4678
  /**
4571
4679
  * Returns the balance for the given owner for the given asset ID.
@@ -4579,7 +4687,7 @@ var _Provider = class {
4579
4687
  owner: Address2.fromAddressOrString(owner).toB256(),
4580
4688
  assetId: hexlify12(assetId)
4581
4689
  });
4582
- return bn16(balance.amount, 10);
4690
+ return bn17(balance.amount, 10);
4583
4691
  }
4584
4692
  /**
4585
4693
  * Returns balances for the given owner.
@@ -4597,7 +4705,7 @@ var _Provider = class {
4597
4705
  const balances = result.balances.edges.map((edge) => edge.node);
4598
4706
  return balances.map((balance) => ({
4599
4707
  assetId: balance.assetId,
4600
- amount: bn16(balance.amount)
4708
+ amount: bn17(balance.amount)
4601
4709
  }));
4602
4710
  }
4603
4711
  /**
@@ -4619,15 +4727,15 @@ var _Provider = class {
4619
4727
  sender: message.sender,
4620
4728
  recipient: message.recipient,
4621
4729
  nonce: message.nonce,
4622
- amount: bn16(message.amount),
4730
+ amount: bn17(message.amount),
4623
4731
  data: message.data
4624
4732
  }),
4625
4733
  sender: Address2.fromAddressOrString(message.sender),
4626
4734
  recipient: Address2.fromAddressOrString(message.recipient),
4627
4735
  nonce: message.nonce,
4628
- amount: bn16(message.amount),
4736
+ amount: bn17(message.amount),
4629
4737
  data: InputMessageCoder.decodeData(message.data),
4630
- daHeight: bn16(message.daHeight)
4738
+ daHeight: bn17(message.daHeight)
4631
4739
  }));
4632
4740
  }
4633
4741
  /**
@@ -4680,59 +4788,59 @@ var _Provider = class {
4680
4788
  } = result.messageProof;
4681
4789
  return {
4682
4790
  messageProof: {
4683
- proofIndex: bn16(messageProof.proofIndex),
4791
+ proofIndex: bn17(messageProof.proofIndex),
4684
4792
  proofSet: messageProof.proofSet
4685
4793
  },
4686
4794
  blockProof: {
4687
- proofIndex: bn16(blockProof.proofIndex),
4795
+ proofIndex: bn17(blockProof.proofIndex),
4688
4796
  proofSet: blockProof.proofSet
4689
4797
  },
4690
4798
  messageBlockHeader: {
4691
4799
  id: messageBlockHeader.id,
4692
- daHeight: bn16(messageBlockHeader.daHeight),
4693
- transactionsCount: bn16(messageBlockHeader.transactionsCount),
4800
+ daHeight: bn17(messageBlockHeader.daHeight),
4801
+ transactionsCount: Number(messageBlockHeader.transactionsCount),
4694
4802
  transactionsRoot: messageBlockHeader.transactionsRoot,
4695
- height: bn16(messageBlockHeader.height),
4803
+ height: bn17(messageBlockHeader.height),
4696
4804
  prevRoot: messageBlockHeader.prevRoot,
4697
4805
  time: messageBlockHeader.time,
4698
4806
  applicationHash: messageBlockHeader.applicationHash,
4699
- messageReceiptCount: bn16(messageBlockHeader.messageReceiptCount),
4807
+ messageReceiptCount: Number(messageBlockHeader.messageReceiptCount),
4700
4808
  messageOutboxRoot: messageBlockHeader.messageOutboxRoot,
4701
- consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
4809
+ consensusParametersVersion: Number(messageBlockHeader.consensusParametersVersion),
4702
4810
  eventInboxRoot: messageBlockHeader.eventInboxRoot,
4703
- stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
4811
+ stateTransitionBytecodeVersion: Number(messageBlockHeader.stateTransitionBytecodeVersion)
4704
4812
  },
4705
4813
  commitBlockHeader: {
4706
4814
  id: commitBlockHeader.id,
4707
- daHeight: bn16(commitBlockHeader.daHeight),
4708
- transactionsCount: bn16(commitBlockHeader.transactionsCount),
4815
+ daHeight: bn17(commitBlockHeader.daHeight),
4816
+ transactionsCount: Number(commitBlockHeader.transactionsCount),
4709
4817
  transactionsRoot: commitBlockHeader.transactionsRoot,
4710
- height: bn16(commitBlockHeader.height),
4818
+ height: bn17(commitBlockHeader.height),
4711
4819
  prevRoot: commitBlockHeader.prevRoot,
4712
4820
  time: commitBlockHeader.time,
4713
4821
  applicationHash: commitBlockHeader.applicationHash,
4714
- messageReceiptCount: bn16(commitBlockHeader.messageReceiptCount),
4822
+ messageReceiptCount: Number(commitBlockHeader.messageReceiptCount),
4715
4823
  messageOutboxRoot: commitBlockHeader.messageOutboxRoot,
4716
- consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
4824
+ consensusParametersVersion: Number(commitBlockHeader.consensusParametersVersion),
4717
4825
  eventInboxRoot: commitBlockHeader.eventInboxRoot,
4718
- stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
4826
+ stateTransitionBytecodeVersion: Number(commitBlockHeader.stateTransitionBytecodeVersion)
4719
4827
  },
4720
4828
  sender: Address2.fromAddressOrString(sender),
4721
4829
  recipient: Address2.fromAddressOrString(recipient),
4722
4830
  nonce,
4723
- amount: bn16(amount),
4831
+ amount: bn17(amount),
4724
4832
  data
4725
4833
  };
4726
4834
  }
4727
4835
  async getLatestGasPrice() {
4728
4836
  const { latestGasPrice } = await this.operations.getLatestGasPrice();
4729
- return bn16(latestGasPrice.gasPrice);
4837
+ return bn17(latestGasPrice.gasPrice);
4730
4838
  }
4731
4839
  async estimateGasPrice(blockHorizon) {
4732
4840
  const { estimateGasPrice } = await this.operations.estimateGasPrice({
4733
4841
  blockHorizon: String(blockHorizon)
4734
4842
  });
4735
- return bn16(estimateGasPrice.gasPrice);
4843
+ return bn17(estimateGasPrice.gasPrice);
4736
4844
  }
4737
4845
  /**
4738
4846
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
@@ -4753,15 +4861,37 @@ var _Provider = class {
4753
4861
  */
4754
4862
  async produceBlocks(amount, startTime) {
4755
4863
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4756
- blocksToProduce: bn16(amount).toString(10),
4864
+ blocksToProduce: bn17(amount).toString(10),
4757
4865
  startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4758
4866
  });
4759
- return bn16(latestBlockHeight);
4867
+ return bn17(latestBlockHeight);
4760
4868
  }
4761
4869
  // eslint-disable-next-line @typescript-eslint/require-await
4762
4870
  async getTransactionResponse(transactionId) {
4763
4871
  return new TransactionResponse(transactionId, this);
4764
4872
  }
4873
+ /**
4874
+ * Returns Message for given nonce.
4875
+ *
4876
+ * @param nonce - The nonce of the message to retrieve.
4877
+ * @returns A promise that resolves to the Message object.
4878
+ */
4879
+ async getMessageByNonce(nonce) {
4880
+ const { message } = await this.operations.getMessageByNonce({ nonce });
4881
+ if (!message) {
4882
+ return null;
4883
+ }
4884
+ return message;
4885
+ }
4886
+ async getRelayedTransactionStatus(relayedTransactionId) {
4887
+ const { relayedTransactionStatus } = await this.operations.getRelayedTransactionStatus({
4888
+ relayedTransactionId
4889
+ });
4890
+ if (!relayedTransactionStatus) {
4891
+ return null;
4892
+ }
4893
+ return relayedTransactionStatus;
4894
+ }
4765
4895
  };
4766
4896
  var Provider = _Provider;
4767
4897
  _cacheInputs = new WeakSet();
@@ -4780,7 +4910,7 @@ __publicField(Provider, "nodeInfoCache", {});
4780
4910
 
4781
4911
  // src/providers/transaction-summary/get-transaction-summary.ts
4782
4912
  import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
4783
- import { bn as bn17 } from "@fuel-ts/math";
4913
+ import { bn as bn18 } from "@fuel-ts/math";
4784
4914
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4785
4915
  import { arrayify as arrayify12 } from "@fuel-ts/utils";
4786
4916
  async function getTransactionSummary(params) {
@@ -4804,7 +4934,11 @@ async function getTransactionSummary(params) {
4804
4934
  }
4805
4935
  const receipts = txReceipts.map(processGqlReceipt);
4806
4936
  const {
4807
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
4937
+ consensusParameters: {
4938
+ feeParameters: { gasPerByte, gasPriceFactor },
4939
+ txParameters: { maxInputs, maxGasPerTx },
4940
+ gasCosts
4941
+ }
4808
4942
  } = provider.getChain();
4809
4943
  const gasPrice = await provider.getLatestGasPrice();
4810
4944
  const transactionInfo = assembleTransactionSummary({
@@ -4813,8 +4947,8 @@ async function getTransactionSummary(params) {
4813
4947
  transaction: decodedTransaction,
4814
4948
  transactionBytes: arrayify12(gqlTransaction.rawPayload),
4815
4949
  gqlTransactionStatus: gqlTransaction.status,
4816
- gasPerByte: bn17(gasPerByte),
4817
- gasPriceFactor: bn17(gasPriceFactor),
4950
+ gasPerByte: bn18(gasPerByte),
4951
+ gasPriceFactor: bn18(gasPriceFactor),
4818
4952
  abiMap,
4819
4953
  maxInputs,
4820
4954
  gasCosts,
@@ -4830,7 +4964,7 @@ async function getTransactionSummaryFromRequest(params) {
4830
4964
  const { provider, transactionRequest, abiMap } = params;
4831
4965
  const { receipts } = await provider.call(transactionRequest);
4832
4966
  const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
4833
- const maxInputs = provider.getChain().consensusParameters.maxInputs;
4967
+ const maxInputs = provider.getChain().consensusParameters.txParameters.maxInputs;
4834
4968
  const transaction = transactionRequest.toTransaction();
4835
4969
  const transactionBytes = transactionRequest.toTransactionBytes();
4836
4970
  const gasPrice = await provider.getLatestGasPrice();
@@ -4853,7 +4987,11 @@ async function getTransactionsSummaries(params) {
4853
4987
  const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
4854
4988
  const { edges, pageInfo } = transactionsByOwner;
4855
4989
  const {
4856
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
4990
+ consensusParameters: {
4991
+ feeParameters: { gasPerByte, gasPriceFactor },
4992
+ txParameters: { maxInputs, maxGasPerTx },
4993
+ gasCosts
4994
+ }
4857
4995
  } = provider.getChain();
4858
4996
  const gasPrice = await provider.getLatestGasPrice();
4859
4997
  const transactions = edges.map((edge) => {
@@ -4979,8 +5117,11 @@ function resolveIconPaths(assets2, basePath = "./") {
4979
5117
  }));
4980
5118
  }
4981
5119
 
4982
- // src/providers/assets/index.ts
4983
- var assets = [
5120
+ // src/providers/assets/utils/fuelAssetsBaseUrl.ts
5121
+ var fuelAssetsBaseUrl = "https://cdn.fuel.network/assets/";
5122
+
5123
+ // src/providers/assets/assets.ts
5124
+ var rawAssets = [
4984
5125
  {
4985
5126
  name: "Ethereum",
4986
5127
  symbol: "ETH",
@@ -5011,6 +5152,23 @@ var assets = [
5011
5152
  ]
5012
5153
  }
5013
5154
  ];
5155
+ var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
5156
+
5157
+ // src/providers/transaction-request/helpers.ts
5158
+ import { bn as bn19 } from "@fuel-ts/math";
5159
+ import { InputType as InputType8 } from "@fuel-ts/transactions";
5160
+ var isRequestInputCoin = (input) => input.type === InputType8.Coin;
5161
+ var isRequestInputMessage = (input) => input.type === InputType8.Message;
5162
+ var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
5163
+ var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
5164
+ if (isRequestInputCoin(input) && input.assetId === assetId) {
5165
+ return acc.add(input.amount);
5166
+ }
5167
+ if (isRequestInputMessage(input) && assetId === baseAsset) {
5168
+ return acc.add(input.amount);
5169
+ }
5170
+ return acc;
5171
+ }, bn19(0));
5014
5172
 
5015
5173
  // src/utils/formatTransferToContractScriptData.ts
5016
5174
  import { BigNumberCoder as BigNumberCoder2 } from "@fuel-ts/abi-coder";
@@ -5049,6 +5207,7 @@ var assembleTransferToContractScript = async (params) => {
5049
5207
  };
5050
5208
 
5051
5209
  // src/account.ts
5210
+ var MAX_FUNDING_ATTEMPTS = 2;
5052
5211
  var Account = class extends AbstractAccount {
5053
5212
  /**
5054
5213
  * The address associated with the account.
@@ -5203,19 +5362,20 @@ var Account = class extends AbstractAccount {
5203
5362
  return balances;
5204
5363
  }
5205
5364
  /**
5206
- * Adds resources to the transaction enough to fund it.
5365
+ * Funds a transaction request by adding the necessary resources.
5207
5366
  *
5208
- * @param request - The transaction request.
5209
- * @param coinQuantities - The coin quantities required to execute the transaction.
5210
- * @param fee - The estimated transaction fee.
5211
- * @returns A promise that resolves when the resources are added to the transaction.
5367
+ * @typeParam T - The type of the TransactionRequest.
5368
+ * @param request - The transaction request to fund.
5369
+ * @param params - The estimated transaction parameters.
5370
+ * @returns The funded transaction request.
5212
5371
  */
5213
5372
  async fund(request, params) {
5214
- const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
5373
+ const { addedSignatures, estimatedPredicates, requiredQuantities, updateMaxFee } = params;
5374
+ const fee = request.maxFee;
5215
5375
  const baseAssetId = this.provider.getBaseAssetId();
5216
- const txRequest = request;
5376
+ const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || bn20(0);
5217
5377
  const requiredQuantitiesWithFee = addAmountToCoinQuantities({
5218
- amount: bn18(fee),
5378
+ amount: bn20(fee),
5219
5379
  assetId: baseAssetId,
5220
5380
  coinQuantities: requiredQuantities
5221
5381
  });
@@ -5223,21 +5383,17 @@ var Account = class extends AbstractAccount {
5223
5383
  requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
5224
5384
  quantitiesDict[assetId] = {
5225
5385
  required: amount,
5226
- owned: bn18(0)
5386
+ owned: bn20(0)
5227
5387
  };
5228
5388
  });
5229
- txRequest.inputs.forEach((input) => {
5230
- const isResource = "amount" in input;
5231
- if (!isResource) {
5232
- return;
5233
- }
5234
- const isCoin2 = "owner" in input;
5389
+ request.inputs.filter(isRequestInputResource).forEach((input) => {
5390
+ const isCoin2 = isRequestInputCoin(input);
5235
5391
  const assetId = isCoin2 ? String(input.assetId) : baseAssetId;
5236
5392
  if (quantitiesDict[assetId]) {
5237
5393
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(input.amount);
5238
5394
  }
5239
5395
  });
5240
- const missingQuantities = [];
5396
+ let missingQuantities = [];
5241
5397
  Object.entries(quantitiesDict).forEach(([assetId, { owned, required }]) => {
5242
5398
  if (owned.lt(required)) {
5243
5399
  missingQuantities.push({
@@ -5246,23 +5402,60 @@ var Account = class extends AbstractAccount {
5246
5402
  });
5247
5403
  }
5248
5404
  });
5249
- const needsToBeFunded = missingQuantities.length;
5250
- if (needsToBeFunded) {
5251
- const excludedIds = cacheTxInputsFromOwner(txRequest.inputs, this.address.toB256());
5252
- const resources = await this.getResourcesToSpend(missingQuantities, excludedIds);
5253
- txRequest.addResources(resources);
5254
- }
5255
- txRequest.shiftPredicateData();
5256
- txRequest.updatePredicateGasUsed(estimatedPredicates);
5257
- const requestToReestimate = clone4(txRequest);
5405
+ let needsToBeFunded = missingQuantities.length > 0;
5406
+ let fundingAttempts = 0;
5407
+ while (needsToBeFunded && fundingAttempts < MAX_FUNDING_ATTEMPTS) {
5408
+ const resources = await this.getResourcesToSpend(
5409
+ missingQuantities,
5410
+ cacheTxInputsFromOwner(request.inputs, this.address)
5411
+ );
5412
+ request.addResources(resources);
5413
+ request.shiftPredicateData();
5414
+ request.updatePredicateGasUsed(estimatedPredicates);
5415
+ const requestToReestimate2 = clone4(request);
5416
+ if (addedSignatures) {
5417
+ Array.from({ length: addedSignatures }).forEach(
5418
+ () => requestToReestimate2.addEmptyWitness()
5419
+ );
5420
+ }
5421
+ if (!updateMaxFee) {
5422
+ break;
5423
+ }
5424
+ const { maxFee: newFee } = await this.provider.estimateTxGasAndFee({
5425
+ transactionRequest: requestToReestimate2
5426
+ });
5427
+ const totalBaseAssetOnInputs = getAssetAmountInRequestInputs(
5428
+ request.inputs,
5429
+ baseAssetId,
5430
+ baseAssetId
5431
+ );
5432
+ const totalBaseAssetRequiredWithFee = requiredInBaseAsset.add(newFee);
5433
+ if (totalBaseAssetOnInputs.gt(totalBaseAssetRequiredWithFee)) {
5434
+ needsToBeFunded = false;
5435
+ } else {
5436
+ missingQuantities = [
5437
+ {
5438
+ amount: totalBaseAssetRequiredWithFee.sub(totalBaseAssetOnInputs),
5439
+ assetId: baseAssetId
5440
+ }
5441
+ ];
5442
+ }
5443
+ fundingAttempts += 1;
5444
+ }
5445
+ request.shiftPredicateData();
5446
+ request.updatePredicateGasUsed(estimatedPredicates);
5447
+ const requestToReestimate = clone4(request);
5258
5448
  if (addedSignatures) {
5259
5449
  Array.from({ length: addedSignatures }).forEach(() => requestToReestimate.addEmptyWitness());
5260
5450
  }
5451
+ if (!updateMaxFee) {
5452
+ return request;
5453
+ }
5261
5454
  const { maxFee } = await this.provider.estimateTxGasAndFee({
5262
5455
  transactionRequest: requestToReestimate
5263
5456
  });
5264
- txRequest.maxFee = maxFee;
5265
- return txRequest;
5457
+ request.maxFee = maxFee;
5458
+ return request;
5266
5459
  }
5267
5460
  /**
5268
5461
  * A helper that creates a transfer transaction request and returns it.
@@ -5274,20 +5467,19 @@ var Account = class extends AbstractAccount {
5274
5467
  * @returns A promise that resolves to the prepared transaction request.
5275
5468
  */
5276
5469
  async createTransfer(destination, amount, assetId, txParams = {}) {
5277
- const request = new ScriptTransactionRequest(txParams);
5470
+ let request = new ScriptTransactionRequest(txParams);
5278
5471
  const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5279
5472
  request.addCoinOutput(Address3.fromAddressOrString(destination), amount, assetIdToTransfer);
5280
5473
  const txCost = await this.provider.getTransactionCost(request, {
5281
5474
  estimateTxDependencies: true,
5282
5475
  resourcesOwner: this
5283
5476
  });
5284
- this.validateGasLimitAndMaxFee({
5477
+ request = this.validateGasLimitAndMaxFee({
5478
+ transactionRequest: request,
5285
5479
  gasUsed: txCost.gasUsed,
5286
5480
  maxFee: txCost.maxFee,
5287
5481
  txParams
5288
5482
  });
5289
- request.gasLimit = txCost.gasUsed;
5290
- request.maxFee = txCost.maxFee;
5291
5483
  await this.fund(request, txCost);
5292
5484
  return request;
5293
5485
  }
@@ -5301,7 +5493,7 @@ var Account = class extends AbstractAccount {
5301
5493
  * @returns A promise that resolves to the transaction response.
5302
5494
  */
5303
5495
  async transfer(destination, amount, assetId, txParams = {}) {
5304
- if (bn18(amount).lte(0)) {
5496
+ if (bn20(amount).lte(0)) {
5305
5497
  throw new FuelError15(
5306
5498
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5307
5499
  "Transfer amount must be a positive number."
@@ -5321,7 +5513,7 @@ var Account = class extends AbstractAccount {
5321
5513
  * @returns A promise that resolves to the transaction response.
5322
5514
  */
5323
5515
  async transferToContract(contractId, amount, assetId, txParams = {}) {
5324
- if (bn18(amount).lte(0)) {
5516
+ if (bn20(amount).lte(0)) {
5325
5517
  throw new FuelError15(
5326
5518
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5327
5519
  "Transfer amount must be a positive number."
@@ -5331,10 +5523,10 @@ var Account = class extends AbstractAccount {
5331
5523
  const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5332
5524
  const { script, scriptData } = await assembleTransferToContractScript({
5333
5525
  hexlifiedContractId: contractAddress.toB256(),
5334
- amountToTransfer: bn18(amount),
5526
+ amountToTransfer: bn20(amount),
5335
5527
  assetId: assetIdToTransfer
5336
5528
  });
5337
- const request = new ScriptTransactionRequest({
5529
+ let request = new ScriptTransactionRequest({
5338
5530
  ...txParams,
5339
5531
  script,
5340
5532
  scriptData
@@ -5342,15 +5534,14 @@ var Account = class extends AbstractAccount {
5342
5534
  request.addContractInputAndOutput(contractAddress);
5343
5535
  const txCost = await this.provider.getTransactionCost(request, {
5344
5536
  resourcesOwner: this,
5345
- quantitiesToContract: [{ amount: bn18(amount), assetId: String(assetIdToTransfer) }]
5537
+ quantitiesToContract: [{ amount: bn20(amount), assetId: String(assetIdToTransfer) }]
5346
5538
  });
5347
- this.validateGasLimitAndMaxFee({
5539
+ request = this.validateGasLimitAndMaxFee({
5540
+ transactionRequest: request,
5348
5541
  gasUsed: txCost.gasUsed,
5349
5542
  maxFee: txCost.maxFee,
5350
5543
  txParams
5351
5544
  });
5352
- request.gasLimit = txCost.gasUsed;
5353
- request.maxFee = txCost.maxFee;
5354
5545
  await this.fund(request, txCost);
5355
5546
  return this.sendTransaction(request);
5356
5547
  }
@@ -5368,7 +5559,7 @@ var Account = class extends AbstractAccount {
5368
5559
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5369
5560
  );
5370
5561
  const amountDataArray = arrayify14(
5371
- "0x".concat(bn18(amount).toHex().substring(2).padStart(16, "0"))
5562
+ "0x".concat(bn20(amount).toHex().substring(2).padStart(16, "0"))
5372
5563
  );
5373
5564
  const script = new Uint8Array([
5374
5565
  ...arrayify14(withdrawScript.bytes),
@@ -5377,16 +5568,15 @@ var Account = class extends AbstractAccount {
5377
5568
  ]);
5378
5569
  const params = { script, ...txParams };
5379
5570
  const baseAssetId = this.provider.getBaseAssetId();
5380
- const request = new ScriptTransactionRequest(params);
5381
- const quantitiesToContract = [{ amount: bn18(amount), assetId: baseAssetId }];
5571
+ let request = new ScriptTransactionRequest(params);
5572
+ const quantitiesToContract = [{ amount: bn20(amount), assetId: baseAssetId }];
5382
5573
  const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
5383
- this.validateGasLimitAndMaxFee({
5574
+ request = this.validateGasLimitAndMaxFee({
5575
+ transactionRequest: request,
5384
5576
  gasUsed: txCost.gasUsed,
5385
5577
  maxFee: txCost.maxFee,
5386
5578
  txParams
5387
5579
  });
5388
- request.maxFee = txCost.maxFee;
5389
- request.gasLimit = txCost.gasUsed;
5390
5580
  await this.fund(request, txCost);
5391
5581
  return this.sendTransaction(request);
5392
5582
  }
@@ -5446,22 +5636,29 @@ var Account = class extends AbstractAccount {
5446
5636
  return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
5447
5637
  }
5448
5638
  validateGasLimitAndMaxFee({
5449
- txParams: { gasLimit: setGasLimit, maxFee: setMaxFee },
5450
5639
  gasUsed,
5451
- maxFee
5640
+ maxFee,
5641
+ transactionRequest,
5642
+ txParams: { gasLimit: setGasLimit, maxFee: setMaxFee }
5452
5643
  }) {
5453
- if (isDefined(setGasLimit) && gasUsed.gt(setGasLimit)) {
5644
+ const request = transactionRequestify(transactionRequest);
5645
+ if (!isDefined2(setGasLimit)) {
5646
+ request.gasLimit = gasUsed;
5647
+ } else if (gasUsed.gt(setGasLimit)) {
5454
5648
  throw new FuelError15(
5455
5649
  ErrorCode15.GAS_LIMIT_TOO_LOW,
5456
5650
  `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
5457
5651
  );
5458
5652
  }
5459
- if (isDefined(setMaxFee) && maxFee.gt(setMaxFee)) {
5653
+ if (!isDefined2(setMaxFee)) {
5654
+ request.maxFee = maxFee;
5655
+ } else if (maxFee.gt(setMaxFee)) {
5460
5656
  throw new FuelError15(
5461
5657
  ErrorCode15.MAX_FEE_TOO_LOW,
5462
5658
  `Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
5463
5659
  );
5464
5660
  }
5661
+ return request;
5465
5662
  }
5466
5663
  };
5467
5664
 
@@ -5792,7 +5989,7 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5792
5989
  // src/hdwallet/hdwallet.ts
5793
5990
  import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
5794
5991
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
5795
- import { bn as bn19, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5992
+ import { bn as bn21, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5796
5993
  import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
5797
5994
  import { toBeHex, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58, computeHmac as computeHmac2, ripemd160 } from "ethers";
5798
5995
 
@@ -8264,7 +8461,7 @@ var HDWallet = class {
8264
8461
  const IR = bytes.slice(32);
8265
8462
  if (privateKey) {
8266
8463
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
8267
- const ki = bn19(IL).add(privateKey).mod(N).toBytes(32);
8464
+ const ki = bn21(IL).add(privateKey).mod(N).toBytes(32);
8268
8465
  return new HDWallet({
8269
8466
  privateKey: ki,
8270
8467
  chainCode: IR,
@@ -8952,7 +9149,7 @@ import {
8952
9149
  } from "@fuel-ts/abi-coder";
8953
9150
  import { Address as Address9 } from "@fuel-ts/address";
8954
9151
  import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
8955
- import { ByteArrayCoder, InputType as InputType8 } from "@fuel-ts/transactions";
9152
+ import { ByteArrayCoder, InputType as InputType9 } from "@fuel-ts/transactions";
8956
9153
  import { arrayify as arrayify20, hexlify as hexlify19 } from "@fuel-ts/utils";
8957
9154
 
8958
9155
  // src/predicate/utils/getPredicateRoot.ts
@@ -9012,7 +9209,7 @@ var Predicate = class extends Account {
9012
9209
  const request = transactionRequestify(transactionRequestLike);
9013
9210
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
9014
9211
  request.inputs?.forEach((input) => {
9015
- if (input.type === InputType8.Coin && hexlify19(input.owner) === this.address.toB256()) {
9212
+ if (input.type === InputType9.Coin && hexlify19(input.owner) === this.address.toB256()) {
9016
9213
  input.predicate = hexlify19(this.bytes);
9017
9214
  input.predicateData = hexlify19(this.getPredicateData(policies.length));
9018
9215
  }
@@ -9046,7 +9243,7 @@ var Predicate = class extends Account {
9046
9243
  const mainFn = this.interface?.functions.main;
9047
9244
  const paddedCode = new ByteArrayCoder(this.bytes.length).encode(this.bytes);
9048
9245
  const VM_TX_MEMORY = calculateVmTxMemory2({
9049
- maxInputs: this.provider.getChain().consensusParameters.maxInputs.toNumber()
9246
+ maxInputs: this.provider.getChain().consensusParameters.txParameters.maxInputs.toNumber()
9050
9247
  });
9051
9248
  const OFFSET = VM_TX_MEMORY + SCRIPT_FIXED_SIZE + INPUT_COIN_FIXED_SIZE + WORD_SIZE + paddedCode.byteLength + policiesLength * WORD_SIZE;
9052
9249
  return mainFn?.encodeArguments(this.predicateData, OFFSET) || new Uint8Array();
@@ -9863,7 +10060,7 @@ export {
9863
10060
  calculateGasFee,
9864
10061
  calculateMetadataGasForTxCreate,
9865
10062
  calculateMetadataGasForTxScript,
9866
- calculateTransactionFee,
10063
+ calculateTXFeeForSummary,
9867
10064
  coinQuantityfy,
9868
10065
  deferPromise,
9869
10066
  dispatchFuelConnectorEvent,
@@ -9871,6 +10068,7 @@ export {
9871
10068
  extractBurnedAssetsFromReceipts,
9872
10069
  extractMintedAssetsFromReceipts,
9873
10070
  extractTxError,
10071
+ fuelAssetsBaseUrl,
9874
10072
  gasUsedByInputs,
9875
10073
  getAssetEth,
9876
10074
  getAssetFuel,
@@ -9923,10 +10121,13 @@ export {
9923
10121
  isTypeCreate,
9924
10122
  isTypeMint,
9925
10123
  isTypeScript,
10124
+ isTypeUpgrade,
10125
+ isTypeUpload,
9926
10126
  normalizeJSON,
9927
10127
  outputify,
9928
10128
  processGqlReceipt,
9929
10129
  processGraphqlStatus,
10130
+ rawAssets,
9930
10131
  resolveGasDependentCosts,
9931
10132
  resolveIconPaths,
9932
10133
  returnZeroScript,