@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.
- package/dist/index.global.js +197 -168
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +430 -387
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +337 -301
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +9 -2
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +552 -346
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +10 -4
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/helpers.d.ts +4 -0
- package/dist/providers/transaction-request/helpers.d.ts.map +1 -1
- package/dist/providers/transaction-request/index.d.ts +1 -0
- package/dist/providers/transaction-request/index.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +2 -0
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/utils.d.ts +0 -4
- package/dist/providers/transaction-request/utils.d.ts.map +1 -1
- package/dist/providers/transaction-summary/receipt.d.ts +2 -2
- package/dist/providers/transaction-summary/receipt.d.ts.map +1 -1
- package/dist/providers/transaction-summary/types.d.ts +13 -5
- package/dist/providers/transaction-summary/types.d.ts.map +1 -1
- package/dist/providers/utils/extract-tx-error.d.ts +2 -2
- package/dist/providers/utils/extract-tx-error.d.ts.map +1 -1
- package/dist/providers/utils/gas.d.ts.map +1 -1
- package/dist/providers/utils/receipts.d.ts +2 -2
- package/dist/providers/utils/receipts.d.ts.map +1 -1
- package/dist/test-utils/seedTestWallet.d.ts +1 -1
- package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
- package/dist/test-utils.global.js +163 -175
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +373 -385
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +292 -304
- package/dist/test-utils.mjs.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts +2 -2
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/package.json +15 -15
package/dist/test-utils.mjs
CHANGED
@@ -68,7 +68,7 @@ var addAmountToCoinQuantities = (params) => {
|
|
68
68
|
// src/providers/provider.ts
|
69
69
|
import { Address as Address2 } from "@fuel-ts/address";
|
70
70
|
import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
|
71
|
-
import { BN, bn as
|
71
|
+
import { BN, bn as bn18 } from "@fuel-ts/math";
|
72
72
|
import {
|
73
73
|
InputType as InputType7,
|
74
74
|
TransactionType as TransactionType8,
|
@@ -83,7 +83,7 @@ import { clone as clone3 } from "ramda";
|
|
83
83
|
|
84
84
|
// src/providers/__generated__/operations.ts
|
85
85
|
import gql from "graphql-tag";
|
86
|
-
var
|
86
|
+
var TransactionStatusSubscriptionFragmentFragmentDoc = gql`
|
87
87
|
fragment transactionStatusSubscriptionFragment on TransactionStatus {
|
88
88
|
type: __typename
|
89
89
|
... on SqueezedOutStatus {
|
@@ -91,13 +91,7 @@ var TransactionStatusSubscriptionFragmentDoc = gql`
|
|
91
91
|
}
|
92
92
|
}
|
93
93
|
`;
|
94
|
-
var
|
95
|
-
fragment SubmittedStatusFragment on SubmittedStatus {
|
96
|
-
type: __typename
|
97
|
-
time
|
98
|
-
}
|
99
|
-
`;
|
100
|
-
var ReceiptFragmentDoc = gql`
|
94
|
+
var ReceiptFragmentFragmentDoc = gql`
|
101
95
|
fragment receiptFragment on Receipt {
|
102
96
|
id
|
103
97
|
pc
|
@@ -129,65 +123,45 @@ var ReceiptFragmentDoc = gql`
|
|
129
123
|
subId
|
130
124
|
}
|
131
125
|
`;
|
132
|
-
var
|
133
|
-
fragment SuccessStatusFragment on SuccessStatus {
|
134
|
-
type: __typename
|
135
|
-
block {
|
136
|
-
id
|
137
|
-
}
|
138
|
-
time
|
139
|
-
programState {
|
140
|
-
returnType
|
141
|
-
data
|
142
|
-
}
|
143
|
-
receipts {
|
144
|
-
...receiptFragment
|
145
|
-
}
|
146
|
-
totalGas
|
147
|
-
totalFee
|
148
|
-
}
|
149
|
-
${ReceiptFragmentDoc}`;
|
150
|
-
var FailureStatusFragmentDoc = gql`
|
151
|
-
fragment FailureStatusFragment on FailureStatus {
|
152
|
-
type: __typename
|
153
|
-
block {
|
154
|
-
id
|
155
|
-
}
|
156
|
-
totalGas
|
157
|
-
totalFee
|
158
|
-
time
|
159
|
-
reason
|
160
|
-
receipts {
|
161
|
-
...receiptFragment
|
162
|
-
}
|
163
|
-
}
|
164
|
-
${ReceiptFragmentDoc}`;
|
165
|
-
var SqueezedOutStatusFragmentDoc = gql`
|
166
|
-
fragment SqueezedOutStatusFragment on SqueezedOutStatus {
|
167
|
-
type: __typename
|
168
|
-
reason
|
169
|
-
}
|
170
|
-
`;
|
171
|
-
var TransactionStatusFragmentDoc = gql`
|
126
|
+
var TransactionStatusFragmentFragmentDoc = gql`
|
172
127
|
fragment transactionStatusFragment on TransactionStatus {
|
128
|
+
type: __typename
|
173
129
|
... on SubmittedStatus {
|
174
|
-
|
130
|
+
time
|
175
131
|
}
|
176
132
|
... on SuccessStatus {
|
177
|
-
|
133
|
+
block {
|
134
|
+
id
|
135
|
+
}
|
136
|
+
time
|
137
|
+
programState {
|
138
|
+
returnType
|
139
|
+
data
|
140
|
+
}
|
141
|
+
receipts {
|
142
|
+
...receiptFragment
|
143
|
+
}
|
144
|
+
totalGas
|
145
|
+
totalFee
|
178
146
|
}
|
179
147
|
... on FailureStatus {
|
180
|
-
|
148
|
+
block {
|
149
|
+
id
|
150
|
+
}
|
151
|
+
totalGas
|
152
|
+
totalFee
|
153
|
+
time
|
154
|
+
reason
|
155
|
+
receipts {
|
156
|
+
...receiptFragment
|
157
|
+
}
|
181
158
|
}
|
182
159
|
... on SqueezedOutStatus {
|
183
|
-
|
160
|
+
reason
|
184
161
|
}
|
185
162
|
}
|
186
|
-
${
|
187
|
-
|
188
|
-
${FailureStatusFragmentDoc}
|
189
|
-
${SqueezedOutStatusFragmentDoc}`;
|
190
|
-
var TransactionFragmentDoc = gql`
|
163
|
+
${ReceiptFragmentFragmentDoc}`;
|
164
|
+
var TransactionFragmentFragmentDoc = gql`
|
191
165
|
fragment transactionFragment on Transaction {
|
192
166
|
id
|
193
167
|
rawPayload
|
@@ -195,8 +169,8 @@ var TransactionFragmentDoc = gql`
|
|
195
169
|
...transactionStatusFragment
|
196
170
|
}
|
197
171
|
}
|
198
|
-
${
|
199
|
-
var
|
172
|
+
${TransactionStatusFragmentFragmentDoc}`;
|
173
|
+
var InputEstimatePredicatesFragmentFragmentDoc = gql`
|
200
174
|
fragment inputEstimatePredicatesFragment on Input {
|
201
175
|
... on InputCoin {
|
202
176
|
predicateGasUsed
|
@@ -206,14 +180,14 @@ var InputEstimatePredicatesFragmentDoc = gql`
|
|
206
180
|
}
|
207
181
|
}
|
208
182
|
`;
|
209
|
-
var
|
183
|
+
var TransactionEstimatePredicatesFragmentFragmentDoc = gql`
|
210
184
|
fragment transactionEstimatePredicatesFragment on Transaction {
|
211
185
|
inputs {
|
212
186
|
...inputEstimatePredicatesFragment
|
213
187
|
}
|
214
188
|
}
|
215
|
-
${
|
216
|
-
var
|
189
|
+
${InputEstimatePredicatesFragmentFragmentDoc}`;
|
190
|
+
var DryRunFailureStatusFragmentFragmentDoc = gql`
|
217
191
|
fragment dryRunFailureStatusFragment on DryRunFailureStatus {
|
218
192
|
totalGas
|
219
193
|
totalFee
|
@@ -224,7 +198,7 @@ var DryRunFailureStatusFragmentDoc = gql`
|
|
224
198
|
}
|
225
199
|
}
|
226
200
|
`;
|
227
|
-
var
|
201
|
+
var DryRunSuccessStatusFragmentFragmentDoc = gql`
|
228
202
|
fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
|
229
203
|
totalGas
|
230
204
|
totalFee
|
@@ -234,7 +208,7 @@ var DryRunSuccessStatusFragmentDoc = gql`
|
|
234
208
|
}
|
235
209
|
}
|
236
210
|
`;
|
237
|
-
var
|
211
|
+
var DryRunTransactionStatusFragmentFragmentDoc = gql`
|
238
212
|
fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
|
239
213
|
... on DryRunFailureStatus {
|
240
214
|
...dryRunFailureStatusFragment
|
@@ -243,9 +217,9 @@ var DryRunTransactionStatusFragmentDoc = gql`
|
|
243
217
|
...dryRunSuccessStatusFragment
|
244
218
|
}
|
245
219
|
}
|
246
|
-
${
|
247
|
-
${
|
248
|
-
var
|
220
|
+
${DryRunFailureStatusFragmentFragmentDoc}
|
221
|
+
${DryRunSuccessStatusFragmentFragmentDoc}`;
|
222
|
+
var DryRunTransactionExecutionStatusFragmentFragmentDoc = gql`
|
249
223
|
fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
|
250
224
|
id
|
251
225
|
status {
|
@@ -255,11 +229,11 @@ var DryRunTransactionExecutionStatusFragmentDoc = gql`
|
|
255
229
|
...receiptFragment
|
256
230
|
}
|
257
231
|
}
|
258
|
-
${
|
259
|
-
${
|
260
|
-
var
|
232
|
+
${DryRunTransactionStatusFragmentFragmentDoc}
|
233
|
+
${ReceiptFragmentFragmentDoc}`;
|
234
|
+
var CoinFragmentFragmentDoc = gql`
|
261
235
|
fragment coinFragment on Coin {
|
262
|
-
|
236
|
+
__typename
|
263
237
|
utxoId
|
264
238
|
owner
|
265
239
|
amount
|
@@ -268,9 +242,9 @@ var CoinFragmentDoc = gql`
|
|
268
242
|
txCreatedIdx
|
269
243
|
}
|
270
244
|
`;
|
271
|
-
var
|
245
|
+
var MessageCoinFragmentFragmentDoc = gql`
|
272
246
|
fragment messageCoinFragment on MessageCoin {
|
273
|
-
|
247
|
+
__typename
|
274
248
|
sender
|
275
249
|
recipient
|
276
250
|
nonce
|
@@ -279,7 +253,7 @@ var MessageCoinFragmentDoc = gql`
|
|
279
253
|
daHeight
|
280
254
|
}
|
281
255
|
`;
|
282
|
-
var
|
256
|
+
var MessageFragmentFragmentDoc = gql`
|
283
257
|
fragment messageFragment on Message {
|
284
258
|
amount
|
285
259
|
sender
|
@@ -289,7 +263,7 @@ var MessageFragmentDoc = gql`
|
|
289
263
|
daHeight
|
290
264
|
}
|
291
265
|
`;
|
292
|
-
var
|
266
|
+
var MessageProofFragmentFragmentDoc = gql`
|
293
267
|
fragment messageProofFragment on MessageProof {
|
294
268
|
messageProof {
|
295
269
|
proofSet
|
@@ -336,14 +310,14 @@ var MessageProofFragmentDoc = gql`
|
|
336
310
|
data
|
337
311
|
}
|
338
312
|
`;
|
339
|
-
var
|
313
|
+
var BalanceFragmentFragmentDoc = gql`
|
340
314
|
fragment balanceFragment on Balance {
|
341
315
|
owner
|
342
316
|
amount
|
343
317
|
assetId
|
344
318
|
}
|
345
319
|
`;
|
346
|
-
var
|
320
|
+
var BlockFragmentFragmentDoc = gql`
|
347
321
|
fragment blockFragment on Block {
|
348
322
|
id
|
349
323
|
height
|
@@ -355,7 +329,7 @@ var BlockFragmentDoc = gql`
|
|
355
329
|
}
|
356
330
|
}
|
357
331
|
`;
|
358
|
-
var
|
332
|
+
var TxParametersFragmentFragmentDoc = gql`
|
359
333
|
fragment TxParametersFragment on TxParameters {
|
360
334
|
version
|
361
335
|
maxInputs
|
@@ -366,7 +340,7 @@ var TxParametersFragmentDoc = gql`
|
|
366
340
|
maxBytecodeSubsections
|
367
341
|
}
|
368
342
|
`;
|
369
|
-
var
|
343
|
+
var PredicateParametersFragmentFragmentDoc = gql`
|
370
344
|
fragment PredicateParametersFragment on PredicateParameters {
|
371
345
|
version
|
372
346
|
maxPredicateLength
|
@@ -375,42 +349,41 @@ var PredicateParametersFragmentDoc = gql`
|
|
375
349
|
maxMessageDataLength
|
376
350
|
}
|
377
351
|
`;
|
378
|
-
var
|
352
|
+
var ScriptParametersFragmentFragmentDoc = gql`
|
379
353
|
fragment ScriptParametersFragment on ScriptParameters {
|
380
354
|
version
|
381
355
|
maxScriptLength
|
382
356
|
maxScriptDataLength
|
383
357
|
}
|
384
358
|
`;
|
385
|
-
var
|
359
|
+
var ContractParametersFragmentFragmentDoc = gql`
|
386
360
|
fragment ContractParametersFragment on ContractParameters {
|
387
361
|
version
|
388
362
|
contractMaxSize
|
389
363
|
maxStorageSlots
|
390
364
|
}
|
391
365
|
`;
|
392
|
-
var
|
366
|
+
var FeeParametersFragmentFragmentDoc = gql`
|
393
367
|
fragment FeeParametersFragment on FeeParameters {
|
394
368
|
version
|
395
369
|
gasPriceFactor
|
396
370
|
gasPerByte
|
397
371
|
}
|
398
372
|
`;
|
399
|
-
var
|
373
|
+
var DependentCostFragmentFragmentDoc = gql`
|
400
374
|
fragment DependentCostFragment on DependentCost {
|
375
|
+
__typename
|
401
376
|
... on LightOperation {
|
402
|
-
type: __typename
|
403
377
|
base
|
404
378
|
unitsPerGas
|
405
379
|
}
|
406
380
|
... on HeavyOperation {
|
407
|
-
type: __typename
|
408
381
|
base
|
409
382
|
gasPerUnit
|
410
383
|
}
|
411
384
|
}
|
412
385
|
`;
|
413
|
-
var
|
386
|
+
var GasCostsFragmentFragmentDoc = gql`
|
414
387
|
fragment GasCostsFragment on GasCosts {
|
415
388
|
version
|
416
389
|
add
|
@@ -566,8 +539,8 @@ var GasCostsFragmentDoc = gql`
|
|
566
539
|
}
|
567
540
|
newStoragePerByte
|
568
541
|
}
|
569
|
-
${
|
570
|
-
var
|
542
|
+
${DependentCostFragmentFragmentDoc}`;
|
543
|
+
var ConsensusParametersFragmentFragmentDoc = gql`
|
571
544
|
fragment consensusParametersFragment on ConsensusParameters {
|
572
545
|
version
|
573
546
|
txParams {
|
@@ -591,13 +564,13 @@ var ConsensusParametersFragmentDoc = gql`
|
|
591
564
|
baseAssetId
|
592
565
|
chainId
|
593
566
|
}
|
594
|
-
${
|
595
|
-
${
|
596
|
-
${
|
597
|
-
${
|
598
|
-
${
|
599
|
-
${
|
600
|
-
var
|
567
|
+
${TxParametersFragmentFragmentDoc}
|
568
|
+
${PredicateParametersFragmentFragmentDoc}
|
569
|
+
${ScriptParametersFragmentFragmentDoc}
|
570
|
+
${ContractParametersFragmentFragmentDoc}
|
571
|
+
${FeeParametersFragmentFragmentDoc}
|
572
|
+
${GasCostsFragmentFragmentDoc}`;
|
573
|
+
var ChainInfoFragmentFragmentDoc = gql`
|
601
574
|
fragment chainInfoFragment on ChainInfo {
|
602
575
|
name
|
603
576
|
latestBlock {
|
@@ -608,16 +581,16 @@ var ChainInfoFragmentDoc = gql`
|
|
608
581
|
...consensusParametersFragment
|
609
582
|
}
|
610
583
|
}
|
611
|
-
${
|
612
|
-
${
|
613
|
-
var
|
584
|
+
${BlockFragmentFragmentDoc}
|
585
|
+
${ConsensusParametersFragmentFragmentDoc}`;
|
586
|
+
var ContractBalanceFragmentFragmentDoc = gql`
|
614
587
|
fragment contractBalanceFragment on ContractBalance {
|
615
588
|
contract
|
616
589
|
amount
|
617
590
|
assetId
|
618
591
|
}
|
619
592
|
`;
|
620
|
-
var
|
593
|
+
var PageInfoFragmentFragmentDoc = gql`
|
621
594
|
fragment pageInfoFragment on PageInfo {
|
622
595
|
hasPreviousPage
|
623
596
|
hasNextPage
|
@@ -625,7 +598,7 @@ var PageInfoFragmentDoc = gql`
|
|
625
598
|
endCursor
|
626
599
|
}
|
627
600
|
`;
|
628
|
-
var
|
601
|
+
var NodeInfoFragmentFragmentDoc = gql`
|
629
602
|
fragment nodeInfoFragment on NodeInfo {
|
630
603
|
utxoValidation
|
631
604
|
vmBacktrace
|
@@ -634,7 +607,7 @@ var NodeInfoFragmentDoc = gql`
|
|
634
607
|
nodeVersion
|
635
608
|
}
|
636
609
|
`;
|
637
|
-
var
|
610
|
+
var RelayedTransactionStatusFragmentFragmentDoc = gql`
|
638
611
|
fragment relayedTransactionStatusFragment on RelayedTransactionStatus {
|
639
612
|
... on RelayedTransactionFailed {
|
640
613
|
blockHeight
|
@@ -655,28 +628,28 @@ var GetNodeInfoDocument = gql`
|
|
655
628
|
...nodeInfoFragment
|
656
629
|
}
|
657
630
|
}
|
658
|
-
${
|
631
|
+
${NodeInfoFragmentFragmentDoc}`;
|
659
632
|
var GetChainDocument = gql`
|
660
633
|
query getChain {
|
661
634
|
chain {
|
662
635
|
...chainInfoFragment
|
663
636
|
}
|
664
637
|
}
|
665
|
-
${
|
638
|
+
${ChainInfoFragmentFragmentDoc}`;
|
666
639
|
var GetTransactionDocument = gql`
|
667
640
|
query getTransaction($transactionId: TransactionId!) {
|
668
641
|
transaction(id: $transactionId) {
|
669
642
|
...transactionFragment
|
670
643
|
}
|
671
644
|
}
|
672
|
-
${
|
645
|
+
${TransactionFragmentFragmentDoc}`;
|
673
646
|
var GetTransactionWithReceiptsDocument = gql`
|
674
647
|
query getTransactionWithReceipts($transactionId: TransactionId!) {
|
675
648
|
transaction(id: $transactionId) {
|
676
649
|
...transactionFragment
|
677
650
|
}
|
678
651
|
}
|
679
|
-
${
|
652
|
+
${TransactionFragmentFragmentDoc}`;
|
680
653
|
var GetTransactionsDocument = gql`
|
681
654
|
query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
|
682
655
|
transactions(after: $after, before: $before, first: $first, last: $last) {
|
@@ -687,7 +660,7 @@ var GetTransactionsDocument = gql`
|
|
687
660
|
}
|
688
661
|
}
|
689
662
|
}
|
690
|
-
${
|
663
|
+
${TransactionFragmentFragmentDoc}`;
|
691
664
|
var GetTransactionsByOwnerDocument = gql`
|
692
665
|
query getTransactionsByOwner($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
|
693
666
|
transactionsByOwner(
|
@@ -707,22 +680,22 @@ var GetTransactionsByOwnerDocument = gql`
|
|
707
680
|
}
|
708
681
|
}
|
709
682
|
}
|
710
|
-
${
|
711
|
-
${
|
683
|
+
${PageInfoFragmentFragmentDoc}
|
684
|
+
${TransactionFragmentFragmentDoc}`;
|
712
685
|
var EstimatePredicatesDocument = gql`
|
713
686
|
query estimatePredicates($encodedTransaction: HexString!) {
|
714
687
|
estimatePredicates(tx: $encodedTransaction) {
|
715
688
|
...transactionEstimatePredicatesFragment
|
716
689
|
}
|
717
690
|
}
|
718
|
-
${
|
691
|
+
${TransactionEstimatePredicatesFragmentFragmentDoc}`;
|
719
692
|
var GetBlockDocument = gql`
|
720
693
|
query getBlock($blockId: BlockId, $height: U32) {
|
721
694
|
block(id: $blockId, height: $height) {
|
722
695
|
...blockFragment
|
723
696
|
}
|
724
697
|
}
|
725
|
-
${
|
698
|
+
${BlockFragmentFragmentDoc}`;
|
726
699
|
var GetBlockWithTransactionsDocument = gql`
|
727
700
|
query getBlockWithTransactions($blockId: BlockId, $blockHeight: U32) {
|
728
701
|
block(id: $blockId, height: $blockHeight) {
|
@@ -732,8 +705,8 @@ var GetBlockWithTransactionsDocument = gql`
|
|
732
705
|
}
|
733
706
|
}
|
734
707
|
}
|
735
|
-
${
|
736
|
-
${
|
708
|
+
${BlockFragmentFragmentDoc}
|
709
|
+
${TransactionFragmentFragmentDoc}`;
|
737
710
|
var GetBlocksDocument = gql`
|
738
711
|
query getBlocks($after: String, $before: String, $first: Int, $last: Int) {
|
739
712
|
blocks(after: $after, before: $before, first: $first, last: $last) {
|
@@ -744,14 +717,14 @@ var GetBlocksDocument = gql`
|
|
744
717
|
}
|
745
718
|
}
|
746
719
|
}
|
747
|
-
${
|
720
|
+
${BlockFragmentFragmentDoc}`;
|
748
721
|
var GetCoinDocument = gql`
|
749
722
|
query getCoin($coinId: UtxoId!) {
|
750
723
|
coin(utxoId: $coinId) {
|
751
724
|
...coinFragment
|
752
725
|
}
|
753
726
|
}
|
754
|
-
${
|
727
|
+
${CoinFragmentFragmentDoc}`;
|
755
728
|
var GetCoinsDocument = gql`
|
756
729
|
query getCoins($filter: CoinFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
|
757
730
|
coins(
|
@@ -768,7 +741,7 @@ var GetCoinsDocument = gql`
|
|
768
741
|
}
|
769
742
|
}
|
770
743
|
}
|
771
|
-
${
|
744
|
+
${CoinFragmentFragmentDoc}`;
|
772
745
|
var GetCoinsToSpendDocument = gql`
|
773
746
|
query getCoinsToSpend($owner: Address!, $queryPerAsset: [SpendQueryElementInput!]!, $excludedIds: ExcludeInput) {
|
774
747
|
coinsToSpend(
|
@@ -780,8 +753,8 @@ var GetCoinsToSpendDocument = gql`
|
|
780
753
|
...messageCoinFragment
|
781
754
|
}
|
782
755
|
}
|
783
|
-
${
|
784
|
-
${
|
756
|
+
${CoinFragmentFragmentDoc}
|
757
|
+
${MessageCoinFragmentFragmentDoc}`;
|
785
758
|
var GetContractDocument = gql`
|
786
759
|
query getContract($contractId: ContractId!) {
|
787
760
|
contract(id: $contractId) {
|
@@ -796,14 +769,14 @@ var GetContractBalanceDocument = gql`
|
|
796
769
|
...contractBalanceFragment
|
797
770
|
}
|
798
771
|
}
|
799
|
-
${
|
772
|
+
${ContractBalanceFragmentFragmentDoc}`;
|
800
773
|
var GetBalanceDocument = gql`
|
801
774
|
query getBalance($owner: Address!, $assetId: AssetId!) {
|
802
775
|
balance(owner: $owner, assetId: $assetId) {
|
803
776
|
...balanceFragment
|
804
777
|
}
|
805
778
|
}
|
806
|
-
${
|
779
|
+
${BalanceFragmentFragmentDoc}`;
|
807
780
|
var GetLatestGasPriceDocument = gql`
|
808
781
|
query getLatestGasPrice {
|
809
782
|
latestGasPrice {
|
@@ -834,7 +807,7 @@ var GetBalancesDocument = gql`
|
|
834
807
|
}
|
835
808
|
}
|
836
809
|
}
|
837
|
-
${
|
810
|
+
${BalanceFragmentFragmentDoc}`;
|
838
811
|
var GetMessagesDocument = gql`
|
839
812
|
query getMessages($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
|
840
813
|
messages(
|
@@ -851,7 +824,7 @@ var GetMessagesDocument = gql`
|
|
851
824
|
}
|
852
825
|
}
|
853
826
|
}
|
854
|
-
${
|
827
|
+
${MessageFragmentFragmentDoc}`;
|
855
828
|
var GetMessageProofDocument = gql`
|
856
829
|
query getMessageProof($transactionId: TransactionId!, $nonce: Nonce!, $commitBlockId: BlockId, $commitBlockHeight: U32) {
|
857
830
|
messageProof(
|
@@ -863,7 +836,7 @@ var GetMessageProofDocument = gql`
|
|
863
836
|
...messageProofFragment
|
864
837
|
}
|
865
838
|
}
|
866
|
-
${
|
839
|
+
${MessageProofFragmentFragmentDoc}`;
|
867
840
|
var GetMessageStatusDocument = gql`
|
868
841
|
query getMessageStatus($nonce: Nonce!) {
|
869
842
|
messageStatus(nonce: $nonce) {
|
@@ -877,14 +850,14 @@ var GetRelayedTransactionStatusDocument = gql`
|
|
877
850
|
...relayedTransactionStatusFragment
|
878
851
|
}
|
879
852
|
}
|
880
|
-
${
|
853
|
+
${RelayedTransactionStatusFragmentFragmentDoc}`;
|
881
854
|
var DryRunDocument = gql`
|
882
855
|
mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
|
883
856
|
dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
|
884
857
|
...dryRunTransactionExecutionStatusFragment
|
885
858
|
}
|
886
859
|
}
|
887
|
-
${
|
860
|
+
${DryRunTransactionExecutionStatusFragmentFragmentDoc}`;
|
888
861
|
var SubmitDocument = gql`
|
889
862
|
mutation submit($encodedTransaction: HexString!) {
|
890
863
|
submit(tx: $encodedTransaction) {
|
@@ -906,21 +879,21 @@ var GetMessageByNonceDocument = gql`
|
|
906
879
|
...messageFragment
|
907
880
|
}
|
908
881
|
}
|
909
|
-
${
|
882
|
+
${MessageFragmentFragmentDoc}`;
|
910
883
|
var SubmitAndAwaitDocument = gql`
|
911
884
|
subscription submitAndAwait($encodedTransaction: HexString!) {
|
912
885
|
submitAndAwait(tx: $encodedTransaction) {
|
913
886
|
...transactionStatusSubscriptionFragment
|
914
887
|
}
|
915
888
|
}
|
916
|
-
${
|
889
|
+
${TransactionStatusSubscriptionFragmentFragmentDoc}`;
|
917
890
|
var StatusChangeDocument = gql`
|
918
891
|
subscription statusChange($transactionId: TransactionId!) {
|
919
892
|
statusChange(id: $transactionId) {
|
920
893
|
...transactionStatusSubscriptionFragment
|
921
894
|
}
|
922
895
|
}
|
923
|
-
${
|
896
|
+
${TransactionStatusSubscriptionFragmentFragmentDoc}`;
|
924
897
|
function getSdk(requester) {
|
925
898
|
return {
|
926
899
|
getVersion(variables, options) {
|
@@ -1291,11 +1264,11 @@ import { UTXO_ID_LEN as UTXO_ID_LEN2 } from "@fuel-ts/abi-coder";
|
|
1291
1264
|
import { Address, addressify } from "@fuel-ts/address";
|
1292
1265
|
import { ZeroBytes32 as ZeroBytes324 } from "@fuel-ts/address/configs";
|
1293
1266
|
import { randomBytes } from "@fuel-ts/crypto";
|
1294
|
-
import { bn as
|
1267
|
+
import { bn as bn8 } from "@fuel-ts/math";
|
1295
1268
|
import {
|
1296
1269
|
PolicyType,
|
1297
1270
|
TransactionCoder,
|
1298
|
-
InputType as
|
1271
|
+
InputType as InputType3,
|
1299
1272
|
OutputType as OutputType2,
|
1300
1273
|
TransactionType
|
1301
1274
|
} from "@fuel-ts/transactions";
|
@@ -1532,9 +1505,10 @@ var getGasUsedFromReceipts = (receipts) => {
|
|
1532
1505
|
function resolveGasDependentCosts(byteSize, gasDependentCost) {
|
1533
1506
|
const base = bn5(gasDependentCost.base);
|
1534
1507
|
let dependentValue = bn5(0);
|
1535
|
-
if ("
|
1508
|
+
if (gasDependentCost.__typename === "LightOperation") {
|
1536
1509
|
dependentValue = bn5(byteSize).div(bn5(gasDependentCost.unitsPerGas));
|
1537
|
-
}
|
1510
|
+
}
|
1511
|
+
if (gasDependentCost.__typename === "HeavyOperation") {
|
1538
1512
|
dependentValue = bn5(byteSize).mul(bn5(gasDependentCost.gasPerUnit));
|
1539
1513
|
}
|
1540
1514
|
return base.add(dependentValue);
|
@@ -1744,6 +1718,36 @@ var NoWitnessAtIndexError = class extends Error {
|
|
1744
1718
|
name = "NoWitnessAtIndexError";
|
1745
1719
|
};
|
1746
1720
|
|
1721
|
+
// src/providers/transaction-request/helpers.ts
|
1722
|
+
import { bn as bn7 } from "@fuel-ts/math";
|
1723
|
+
import { InputType as InputType2 } from "@fuel-ts/transactions";
|
1724
|
+
var isRequestInputCoin = (input) => input.type === InputType2.Coin;
|
1725
|
+
var isRequestInputMessage = (input) => input.type === InputType2.Message;
|
1726
|
+
var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
|
1727
|
+
var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
|
1728
|
+
if (isRequestInputCoin(input) && input.assetId === assetId) {
|
1729
|
+
return acc.add(input.amount);
|
1730
|
+
}
|
1731
|
+
if (isRequestInputMessage(input) && assetId === baseAsset) {
|
1732
|
+
return acc.add(input.amount);
|
1733
|
+
}
|
1734
|
+
return acc;
|
1735
|
+
}, bn7(0));
|
1736
|
+
var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
|
1737
|
+
(acc, input) => {
|
1738
|
+
if (isRequestInputCoin(input) && input.owner === owner.toB256()) {
|
1739
|
+
acc.utxos.push(input.id);
|
1740
|
+
} else if (isRequestInputMessage(input) && input.recipient === owner.toB256()) {
|
1741
|
+
acc.messages.push(input.nonce);
|
1742
|
+
}
|
1743
|
+
return acc;
|
1744
|
+
},
|
1745
|
+
{
|
1746
|
+
utxos: [],
|
1747
|
+
messages: []
|
1748
|
+
}
|
1749
|
+
);
|
1750
|
+
|
1747
1751
|
// src/providers/transaction-request/witness.ts
|
1748
1752
|
import { arrayify as arrayify4, hexlify as hexlify6 } from "@fuel-ts/utils";
|
1749
1753
|
var witnessify = (value) => {
|
@@ -1784,10 +1788,10 @@ var BaseTransactionRequest = class {
|
|
1784
1788
|
outputs,
|
1785
1789
|
witnesses
|
1786
1790
|
} = {}) {
|
1787
|
-
this.tip = tip ?
|
1791
|
+
this.tip = tip ? bn8(tip) : void 0;
|
1788
1792
|
this.maturity = maturity && maturity > 0 ? maturity : void 0;
|
1789
|
-
this.witnessLimit = isDefined(witnessLimit) ?
|
1790
|
-
this.maxFee =
|
1793
|
+
this.witnessLimit = isDefined(witnessLimit) ? bn8(witnessLimit) : void 0;
|
1794
|
+
this.maxFee = bn8(maxFee);
|
1791
1795
|
this.inputs = inputs ?? [];
|
1792
1796
|
this.outputs = outputs ?? [];
|
1793
1797
|
this.witnesses = witnesses ?? [];
|
@@ -1796,13 +1800,13 @@ var BaseTransactionRequest = class {
|
|
1796
1800
|
let policyTypes = 0;
|
1797
1801
|
const policies = [];
|
1798
1802
|
const { tip, witnessLimit, maturity } = req;
|
1799
|
-
if (
|
1803
|
+
if (bn8(tip).gt(0)) {
|
1800
1804
|
policyTypes += PolicyType.Tip;
|
1801
|
-
policies.push({ data:
|
1805
|
+
policies.push({ data: bn8(tip), type: PolicyType.Tip });
|
1802
1806
|
}
|
1803
|
-
if (isDefined(witnessLimit) &&
|
1807
|
+
if (isDefined(witnessLimit) && bn8(witnessLimit).gte(0)) {
|
1804
1808
|
policyTypes += PolicyType.WitnessLimit;
|
1805
|
-
policies.push({ data:
|
1809
|
+
policies.push({ data: bn8(witnessLimit), type: PolicyType.WitnessLimit });
|
1806
1810
|
}
|
1807
1811
|
if (maturity && maturity > 0) {
|
1808
1812
|
policyTypes += PolicyType.Maturity;
|
@@ -1933,7 +1937,7 @@ var BaseTransactionRequest = class {
|
|
1933
1937
|
*/
|
1934
1938
|
getCoinInputs() {
|
1935
1939
|
return this.inputs.filter(
|
1936
|
-
(input) => input.type ===
|
1940
|
+
(input) => input.type === InputType3.Coin
|
1937
1941
|
);
|
1938
1942
|
}
|
1939
1943
|
/**
|
@@ -1965,9 +1969,9 @@ var BaseTransactionRequest = class {
|
|
1965
1969
|
const ownerAddress = addressify(owner);
|
1966
1970
|
const found = this.inputs.find((input) => {
|
1967
1971
|
switch (input.type) {
|
1968
|
-
case
|
1972
|
+
case InputType3.Coin:
|
1969
1973
|
return hexlify7(input.owner) === ownerAddress.toB256();
|
1970
|
-
case
|
1974
|
+
case InputType3.Message:
|
1971
1975
|
return hexlify7(input.recipient) === ownerAddress.toB256();
|
1972
1976
|
default:
|
1973
1977
|
return false;
|
@@ -1982,7 +1986,7 @@ var BaseTransactionRequest = class {
|
|
1982
1986
|
* @param coin - Coin resource.
|
1983
1987
|
*/
|
1984
1988
|
addCoinInput(coin) {
|
1985
|
-
const { assetId, owner, amount } = coin;
|
1989
|
+
const { assetId, owner, amount, id, predicate } = coin;
|
1986
1990
|
let witnessIndex;
|
1987
1991
|
if (coin.predicate) {
|
1988
1992
|
witnessIndex = 0;
|
@@ -1993,13 +1997,14 @@ var BaseTransactionRequest = class {
|
|
1993
1997
|
}
|
1994
1998
|
}
|
1995
1999
|
const input = {
|
1996
|
-
|
1997
|
-
type:
|
2000
|
+
id,
|
2001
|
+
type: InputType3.Coin,
|
1998
2002
|
owner: owner.toB256(),
|
1999
2003
|
amount,
|
2000
2004
|
assetId,
|
2001
2005
|
txPointer: "0x00000000000000000000000000000000",
|
2002
|
-
witnessIndex
|
2006
|
+
witnessIndex,
|
2007
|
+
predicate
|
2003
2008
|
};
|
2004
2009
|
this.pushInput(input);
|
2005
2010
|
this.addChangeOutput(owner, assetId);
|
@@ -2011,7 +2016,7 @@ var BaseTransactionRequest = class {
|
|
2011
2016
|
* @param message - Message resource.
|
2012
2017
|
*/
|
2013
2018
|
addMessageInput(message) {
|
2014
|
-
const { recipient, sender, amount, assetId } = message;
|
2019
|
+
const { recipient, sender, amount, predicate, nonce, assetId } = message;
|
2015
2020
|
let witnessIndex;
|
2016
2021
|
if (message.predicate) {
|
2017
2022
|
witnessIndex = 0;
|
@@ -2022,12 +2027,13 @@ var BaseTransactionRequest = class {
|
|
2022
2027
|
}
|
2023
2028
|
}
|
2024
2029
|
const input = {
|
2025
|
-
|
2026
|
-
type:
|
2030
|
+
nonce,
|
2031
|
+
type: InputType3.Message,
|
2027
2032
|
sender: sender.toB256(),
|
2028
2033
|
recipient: recipient.toB256(),
|
2029
2034
|
amount,
|
2030
|
-
witnessIndex
|
2035
|
+
witnessIndex,
|
2036
|
+
predicate
|
2031
2037
|
};
|
2032
2038
|
this.pushInput(input);
|
2033
2039
|
this.addChangeOutput(recipient, assetId);
|
@@ -2174,7 +2180,7 @@ var BaseTransactionRequest = class {
|
|
2174
2180
|
const assetInput = findAssetInput(assetId);
|
2175
2181
|
let usedQuantity = quantity;
|
2176
2182
|
if (assetId === baseAssetId) {
|
2177
|
-
usedQuantity =
|
2183
|
+
usedQuantity = bn8("1000000000000000000");
|
2178
2184
|
}
|
2179
2185
|
if (assetInput && "assetId" in assetInput) {
|
2180
2186
|
assetInput.id = hexlify7(randomBytes(UTXO_ID_LEN2));
|
@@ -2186,13 +2192,13 @@ var BaseTransactionRequest = class {
|
|
2186
2192
|
amount: usedQuantity,
|
2187
2193
|
assetId,
|
2188
2194
|
owner: resourcesOwner || Address.fromRandom(),
|
2189
|
-
blockCreated:
|
2190
|
-
txCreatedIdx:
|
2195
|
+
blockCreated: bn8(1),
|
2196
|
+
txCreatedIdx: bn8(1)
|
2191
2197
|
}
|
2192
2198
|
]);
|
2193
2199
|
}
|
2194
2200
|
};
|
2195
|
-
updateAssetInput(baseAssetId,
|
2201
|
+
updateAssetInput(baseAssetId, bn8(1e11));
|
2196
2202
|
quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
|
2197
2203
|
}
|
2198
2204
|
/**
|
@@ -2203,7 +2209,7 @@ var BaseTransactionRequest = class {
|
|
2203
2209
|
*/
|
2204
2210
|
getCoinOutputsQuantities() {
|
2205
2211
|
const coinsQuantities = this.getCoinOutputs().map(({ amount, assetId }) => ({
|
2206
|
-
amount:
|
2212
|
+
amount: bn8(amount),
|
2207
2213
|
assetId: assetId.toString()
|
2208
2214
|
}));
|
2209
2215
|
return coinsQuantities;
|
@@ -2217,22 +2223,33 @@ var BaseTransactionRequest = class {
|
|
2217
2223
|
toJSON() {
|
2218
2224
|
return normalizeJSON(this);
|
2219
2225
|
}
|
2226
|
+
removeWitness(index) {
|
2227
|
+
this.witnesses.splice(index, 1);
|
2228
|
+
this.adjustWitnessIndexes(index);
|
2229
|
+
}
|
2230
|
+
adjustWitnessIndexes(removedIndex) {
|
2231
|
+
this.inputs.filter(isRequestInputResource).forEach((input) => {
|
2232
|
+
if (input.witnessIndex > removedIndex) {
|
2233
|
+
input.witnessIndex -= 1;
|
2234
|
+
}
|
2235
|
+
});
|
2236
|
+
}
|
2220
2237
|
updatePredicateGasUsed(inputs) {
|
2221
2238
|
this.inputs.forEach((i) => {
|
2222
2239
|
let correspondingInput;
|
2223
2240
|
switch (i.type) {
|
2224
|
-
case
|
2225
|
-
correspondingInput = inputs.find((x) => x.type ===
|
2241
|
+
case InputType3.Coin:
|
2242
|
+
correspondingInput = inputs.find((x) => x.type === InputType3.Coin && x.owner === i.owner);
|
2226
2243
|
break;
|
2227
|
-
case
|
2244
|
+
case InputType3.Message:
|
2228
2245
|
correspondingInput = inputs.find(
|
2229
|
-
(x) => x.type ===
|
2246
|
+
(x) => x.type === InputType3.Message && x.sender === i.sender
|
2230
2247
|
);
|
2231
2248
|
break;
|
2232
2249
|
default:
|
2233
2250
|
return;
|
2234
2251
|
}
|
2235
|
-
if (correspondingInput && "predicateGasUsed" in correspondingInput &&
|
2252
|
+
if (correspondingInput && "predicateGasUsed" in correspondingInput && bn8(correspondingInput.predicateGasUsed).gt(0)) {
|
2236
2253
|
i.predicate = correspondingInput.predicate;
|
2237
2254
|
i.predicateData = correspondingInput.predicateData;
|
2238
2255
|
i.predicateGasUsed = correspondingInput.predicateGasUsed;
|
@@ -2252,15 +2269,15 @@ var BaseTransactionRequest = class {
|
|
2252
2269
|
|
2253
2270
|
// src/providers/transaction-request/create-transaction-request.ts
|
2254
2271
|
import { ZeroBytes32 as ZeroBytes326 } from "@fuel-ts/address/configs";
|
2255
|
-
import { bn as
|
2272
|
+
import { bn as bn10 } from "@fuel-ts/math";
|
2256
2273
|
import { TransactionType as TransactionType3, OutputType as OutputType4 } from "@fuel-ts/transactions";
|
2257
2274
|
import { arrayify as arrayify6, hexlify as hexlify9 } from "@fuel-ts/utils";
|
2258
2275
|
|
2259
2276
|
// src/providers/transaction-request/hash-transaction.ts
|
2260
2277
|
import { ZeroBytes32 as ZeroBytes325 } from "@fuel-ts/address/configs";
|
2261
2278
|
import { uint64ToBytesBE, sha256 } from "@fuel-ts/hasher";
|
2262
|
-
import { bn as
|
2263
|
-
import { TransactionType as TransactionType2, InputType as
|
2279
|
+
import { bn as bn9 } from "@fuel-ts/math";
|
2280
|
+
import { TransactionType as TransactionType2, InputType as InputType4, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
|
2264
2281
|
import { concat as concat2 } from "@fuel-ts/utils";
|
2265
2282
|
import { clone as clone2 } from "ramda";
|
2266
2283
|
function hashTransaction(transactionRequest, chainId) {
|
@@ -2271,19 +2288,19 @@ function hashTransaction(transactionRequest, chainId) {
|
|
2271
2288
|
transaction.inputs = transaction.inputs.map((input) => {
|
2272
2289
|
const inputClone = clone2(input);
|
2273
2290
|
switch (inputClone.type) {
|
2274
|
-
case
|
2291
|
+
case InputType4.Coin: {
|
2275
2292
|
inputClone.txPointer = {
|
2276
2293
|
blockHeight: 0,
|
2277
2294
|
txIndex: 0
|
2278
2295
|
};
|
2279
|
-
inputClone.predicateGasUsed =
|
2296
|
+
inputClone.predicateGasUsed = bn9(0);
|
2280
2297
|
return inputClone;
|
2281
2298
|
}
|
2282
|
-
case
|
2283
|
-
inputClone.predicateGasUsed =
|
2299
|
+
case InputType4.Message: {
|
2300
|
+
inputClone.predicateGasUsed = bn9(0);
|
2284
2301
|
return inputClone;
|
2285
2302
|
}
|
2286
|
-
case
|
2303
|
+
case InputType4.Contract: {
|
2287
2304
|
inputClone.txPointer = {
|
2288
2305
|
blockHeight: 0,
|
2289
2306
|
txIndex: 0
|
@@ -2307,12 +2324,12 @@ function hashTransaction(transactionRequest, chainId) {
|
|
2307
2324
|
return outputClone;
|
2308
2325
|
}
|
2309
2326
|
case OutputType3.Change: {
|
2310
|
-
outputClone.amount =
|
2327
|
+
outputClone.amount = bn9(0);
|
2311
2328
|
return outputClone;
|
2312
2329
|
}
|
2313
2330
|
case OutputType3.Variable: {
|
2314
2331
|
outputClone.to = ZeroBytes325;
|
2315
|
-
outputClone.amount =
|
2332
|
+
outputClone.amount = bn9(0);
|
2316
2333
|
outputClone.assetId = ZeroBytes325;
|
2317
2334
|
return outputClone;
|
2318
2335
|
}
|
@@ -2390,7 +2407,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
2390
2407
|
type: TransactionType3.Create,
|
2391
2408
|
...baseTransaction,
|
2392
2409
|
bytecodeWitnessIndex,
|
2393
|
-
storageSlotsCount:
|
2410
|
+
storageSlotsCount: bn10(storageSlots.length),
|
2394
2411
|
salt: this.salt ? hexlify9(this.salt) : ZeroBytes326,
|
2395
2412
|
storageSlots
|
2396
2413
|
};
|
@@ -2430,7 +2447,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
2430
2447
|
}
|
2431
2448
|
metadataGas(gasCosts) {
|
2432
2449
|
return calculateMetadataGasForTxCreate({
|
2433
|
-
contractBytesSize:
|
2450
|
+
contractBytesSize: bn10(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
|
2434
2451
|
gasCosts,
|
2435
2452
|
stateRootSize: this.storageSlots.length,
|
2436
2453
|
txBytesSize: this.byteSize()
|
@@ -2442,8 +2459,8 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
2442
2459
|
import { Interface } from "@fuel-ts/abi-coder";
|
2443
2460
|
import { addressify as addressify2 } from "@fuel-ts/address";
|
2444
2461
|
import { ZeroBytes32 as ZeroBytes327 } from "@fuel-ts/address/configs";
|
2445
|
-
import { bn as
|
2446
|
-
import { InputType as
|
2462
|
+
import { bn as bn11 } from "@fuel-ts/math";
|
2463
|
+
import { InputType as InputType5, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
|
2447
2464
|
import { arrayify as arrayify8, hexlify as hexlify10 } from "@fuel-ts/utils";
|
2448
2465
|
|
2449
2466
|
// src/providers/transaction-request/scripts.ts
|
@@ -2496,7 +2513,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2496
2513
|
*/
|
2497
2514
|
constructor({ script, scriptData, gasLimit, ...rest } = {}) {
|
2498
2515
|
super(rest);
|
2499
|
-
this.gasLimit =
|
2516
|
+
this.gasLimit = bn11(gasLimit);
|
2500
2517
|
this.script = arrayify8(script ?? returnZeroScript.bytes);
|
2501
2518
|
this.scriptData = arrayify8(scriptData ?? returnZeroScript.encodeScriptData());
|
2502
2519
|
this.abis = rest.abis;
|
@@ -2513,8 +2530,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2513
2530
|
type: TransactionType4.Script,
|
2514
2531
|
scriptGasLimit: this.gasLimit,
|
2515
2532
|
...super.getBaseTransaction(),
|
2516
|
-
scriptLength:
|
2517
|
-
scriptDataLength:
|
2533
|
+
scriptLength: bn11(script.length),
|
2534
|
+
scriptDataLength: bn11(scriptData.length),
|
2518
2535
|
receiptsRoot: ZeroBytes327,
|
2519
2536
|
script: hexlify10(script),
|
2520
2537
|
scriptData: hexlify10(scriptData)
|
@@ -2527,7 +2544,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2527
2544
|
*/
|
2528
2545
|
getContractInputs() {
|
2529
2546
|
return this.inputs.filter(
|
2530
|
-
(input) => input.type ===
|
2547
|
+
(input) => input.type === InputType5.Contract
|
2531
2548
|
);
|
2532
2549
|
}
|
2533
2550
|
/**
|
@@ -2607,7 +2624,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2607
2624
|
return this;
|
2608
2625
|
}
|
2609
2626
|
const inputIndex = super.pushInput({
|
2610
|
-
type:
|
2627
|
+
type: InputType5.Contract,
|
2611
2628
|
contractId: contractAddress.toB256(),
|
2612
2629
|
txPointer: "0x00000000000000000000000000000000"
|
2613
2630
|
});
|
@@ -2649,7 +2666,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2649
2666
|
|
2650
2667
|
// src/providers/transaction-request/utils.ts
|
2651
2668
|
import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
|
2652
|
-
import { TransactionType as TransactionType5
|
2669
|
+
import { TransactionType as TransactionType5 } from "@fuel-ts/transactions";
|
2653
2670
|
var transactionRequestify = (obj) => {
|
2654
2671
|
if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
|
2655
2672
|
return obj;
|
@@ -2667,35 +2684,20 @@ var transactionRequestify = (obj) => {
|
|
2667
2684
|
}
|
2668
2685
|
}
|
2669
2686
|
};
|
2670
|
-
var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
|
2671
|
-
(acc, input) => {
|
2672
|
-
if (input.type === InputType5.Coin && input.owner === owner.toB256()) {
|
2673
|
-
acc.utxos.push(input.id);
|
2674
|
-
}
|
2675
|
-
if (input.type === InputType5.Message && input.recipient === owner.toB256()) {
|
2676
|
-
acc.messages.push(input.nonce);
|
2677
|
-
}
|
2678
|
-
return acc;
|
2679
|
-
},
|
2680
|
-
{
|
2681
|
-
utxos: [],
|
2682
|
-
messages: []
|
2683
|
-
}
|
2684
|
-
);
|
2685
2687
|
|
2686
2688
|
// src/providers/transaction-response/transaction-response.ts
|
2687
2689
|
import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
|
2688
|
-
import { bn as
|
2690
|
+
import { bn as bn17 } from "@fuel-ts/math";
|
2689
2691
|
import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
|
2690
2692
|
import { arrayify as arrayify10 } from "@fuel-ts/utils";
|
2691
2693
|
|
2692
2694
|
// src/providers/transaction-summary/assemble-transaction-summary.ts
|
2693
|
-
import { bn as
|
2695
|
+
import { bn as bn16 } from "@fuel-ts/math";
|
2694
2696
|
import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
|
2695
2697
|
import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
|
2696
2698
|
|
2697
2699
|
// src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
|
2698
|
-
import { bn as
|
2700
|
+
import { bn as bn12 } from "@fuel-ts/math";
|
2699
2701
|
import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType6 } from "@fuel-ts/transactions";
|
2700
2702
|
import { arrayify as arrayify9 } from "@fuel-ts/utils";
|
2701
2703
|
var calculateTXFeeForSummary = (params) => {
|
@@ -2709,19 +2711,19 @@ var calculateTXFeeForSummary = (params) => {
|
|
2709
2711
|
if (totalFee) {
|
2710
2712
|
return totalFee;
|
2711
2713
|
}
|
2712
|
-
const gasPerByte =
|
2713
|
-
const gasPriceFactor =
|
2714
|
+
const gasPerByte = bn12(feeParams.gasPerByte);
|
2715
|
+
const gasPriceFactor = bn12(feeParams.gasPriceFactor);
|
2714
2716
|
const transactionBytes = arrayify9(rawPayload);
|
2715
2717
|
const [transaction] = new TransactionCoder3().decode(transactionBytes, 0);
|
2716
2718
|
const { type, witnesses, inputs, policies } = transaction;
|
2717
|
-
let metadataGas =
|
2718
|
-
let gasLimit =
|
2719
|
+
let metadataGas = bn12(0);
|
2720
|
+
let gasLimit = bn12(0);
|
2719
2721
|
if (type !== TransactionType6.Create && type !== TransactionType6.Script) {
|
2720
|
-
return
|
2722
|
+
return bn12(0);
|
2721
2723
|
}
|
2722
2724
|
if (type === TransactionType6.Create) {
|
2723
2725
|
const { bytecodeWitnessIndex, storageSlots } = transaction;
|
2724
|
-
const contractBytesSize =
|
2726
|
+
const contractBytesSize = bn12(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
|
2725
2727
|
metadataGas = calculateMetadataGasForTxCreate({
|
2726
2728
|
contractBytesSize,
|
2727
2729
|
gasCosts,
|
@@ -2740,7 +2742,7 @@ var calculateTXFeeForSummary = (params) => {
|
|
2740
2742
|
}
|
2741
2743
|
const minGas = getMinGas({
|
2742
2744
|
gasCosts,
|
2743
|
-
gasPerByte:
|
2745
|
+
gasPerByte: bn12(gasPerByte),
|
2744
2746
|
inputs,
|
2745
2747
|
metadataGas,
|
2746
2748
|
txBytesSize: transactionBytes.length
|
@@ -2767,12 +2769,12 @@ var calculateTXFeeForSummary = (params) => {
|
|
2767
2769
|
// src/providers/transaction-summary/operations.ts
|
2768
2770
|
import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
|
2769
2771
|
import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
|
2770
|
-
import { bn as
|
2772
|
+
import { bn as bn14 } from "@fuel-ts/math";
|
2771
2773
|
import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
|
2772
2774
|
|
2773
2775
|
// src/providers/transaction-summary/call.ts
|
2774
2776
|
import { Interface as Interface2, calculateVmTxMemory } from "@fuel-ts/abi-coder";
|
2775
|
-
import { bn as
|
2777
|
+
import { bn as bn13 } from "@fuel-ts/math";
|
2776
2778
|
var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
|
2777
2779
|
const abiInterface = new Interface2(abi);
|
2778
2780
|
const callFunctionSelector = receipt.param1.toHex(8);
|
@@ -2781,7 +2783,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
|
|
2781
2783
|
let encodedArgs;
|
2782
2784
|
if (functionFragment.isInputDataPointer) {
|
2783
2785
|
if (rawPayload) {
|
2784
|
-
const argsOffset =
|
2786
|
+
const argsOffset = bn13(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
|
2785
2787
|
encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
|
2786
2788
|
}
|
2787
2789
|
} else {
|
@@ -2943,7 +2945,7 @@ var mergeAssets = (op1, op2) => {
|
|
2943
2945
|
if (!matchingAsset) {
|
2944
2946
|
return asset1;
|
2945
2947
|
}
|
2946
|
-
const mergedAmount =
|
2948
|
+
const mergedAmount = bn14(asset1.amount).add(matchingAsset.amount);
|
2947
2949
|
return { ...asset1, amount: mergedAmount };
|
2948
2950
|
});
|
2949
2951
|
return mergedAssets.concat(filteredAssets);
|
@@ -3266,7 +3268,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
|
|
3266
3268
|
|
3267
3269
|
// src/providers/transaction-summary/status.ts
|
3268
3270
|
import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
|
3269
|
-
import { bn as
|
3271
|
+
import { bn as bn15 } from "@fuel-ts/math";
|
3270
3272
|
var getTransactionStatusName = (gqlStatus) => {
|
3271
3273
|
switch (gqlStatus) {
|
3272
3274
|
case "FailureStatus":
|
@@ -3300,15 +3302,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
|
|
3300
3302
|
time = gqlTransactionStatus.time;
|
3301
3303
|
blockId = gqlTransactionStatus.block.id;
|
3302
3304
|
isStatusSuccess = true;
|
3303
|
-
totalFee =
|
3304
|
-
totalGas =
|
3305
|
+
totalFee = bn15(gqlTransactionStatus.totalFee);
|
3306
|
+
totalGas = bn15(gqlTransactionStatus.totalGas);
|
3305
3307
|
break;
|
3306
3308
|
case "FailureStatus":
|
3307
3309
|
time = gqlTransactionStatus.time;
|
3308
3310
|
blockId = gqlTransactionStatus.block.id;
|
3309
3311
|
isStatusFailure = true;
|
3310
|
-
totalFee =
|
3311
|
-
totalGas =
|
3312
|
+
totalFee = bn15(gqlTransactionStatus.totalFee);
|
3313
|
+
totalGas = bn15(gqlTransactionStatus.totalGas);
|
3312
3314
|
break;
|
3313
3315
|
case "SubmittedStatus":
|
3314
3316
|
time = gqlTransactionStatus.time;
|
@@ -3358,7 +3360,7 @@ function assembleTransactionSummary(params) {
|
|
3358
3360
|
maxInputs
|
3359
3361
|
});
|
3360
3362
|
const typeName = getTransactionTypeName(transaction.type);
|
3361
|
-
const tip =
|
3363
|
+
const tip = bn16(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
|
3362
3364
|
const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
|
3363
3365
|
const fee = calculateTXFeeForSummary({
|
3364
3366
|
totalFee,
|
@@ -3429,7 +3431,7 @@ var TransactionResponse = class {
|
|
3429
3431
|
/** Current provider */
|
3430
3432
|
provider;
|
3431
3433
|
/** Gas used on the transaction */
|
3432
|
-
gasUsed =
|
3434
|
+
gasUsed = bn17(0);
|
3433
3435
|
/** The graphql Transaction with receipts object. */
|
3434
3436
|
gqlTransaction;
|
3435
3437
|
abis;
|
@@ -3663,47 +3665,47 @@ var processGqlChain = (chain) => {
|
|
3663
3665
|
} = consensusParameters;
|
3664
3666
|
return {
|
3665
3667
|
name,
|
3666
|
-
baseChainHeight:
|
3668
|
+
baseChainHeight: bn18(daHeight),
|
3667
3669
|
consensusParameters: {
|
3668
3670
|
version,
|
3669
|
-
chainId:
|
3671
|
+
chainId: bn18(chainId),
|
3670
3672
|
baseAssetId,
|
3671
3673
|
feeParameters: {
|
3672
3674
|
version: feeParams.version,
|
3673
|
-
gasPerByte:
|
3674
|
-
gasPriceFactor:
|
3675
|
+
gasPerByte: bn18(feeParams.gasPerByte),
|
3676
|
+
gasPriceFactor: bn18(feeParams.gasPriceFactor)
|
3675
3677
|
},
|
3676
3678
|
contractParameters: {
|
3677
3679
|
version: contractParams.version,
|
3678
|
-
contractMaxSize:
|
3679
|
-
maxStorageSlots:
|
3680
|
+
contractMaxSize: bn18(contractParams.contractMaxSize),
|
3681
|
+
maxStorageSlots: bn18(contractParams.maxStorageSlots)
|
3680
3682
|
},
|
3681
3683
|
txParameters: {
|
3682
3684
|
version: txParams.version,
|
3683
|
-
maxInputs:
|
3684
|
-
maxOutputs:
|
3685
|
-
maxWitnesses:
|
3686
|
-
maxGasPerTx:
|
3687
|
-
maxSize:
|
3688
|
-
maxBytecodeSubsections:
|
3685
|
+
maxInputs: bn18(txParams.maxInputs),
|
3686
|
+
maxOutputs: bn18(txParams.maxOutputs),
|
3687
|
+
maxWitnesses: bn18(txParams.maxWitnesses),
|
3688
|
+
maxGasPerTx: bn18(txParams.maxGasPerTx),
|
3689
|
+
maxSize: bn18(txParams.maxSize),
|
3690
|
+
maxBytecodeSubsections: bn18(txParams.maxBytecodeSubsections)
|
3689
3691
|
},
|
3690
3692
|
predicateParameters: {
|
3691
3693
|
version: predicateParams.version,
|
3692
|
-
maxPredicateLength:
|
3693
|
-
maxPredicateDataLength:
|
3694
|
-
maxGasPerPredicate:
|
3695
|
-
maxMessageDataLength:
|
3694
|
+
maxPredicateLength: bn18(predicateParams.maxPredicateLength),
|
3695
|
+
maxPredicateDataLength: bn18(predicateParams.maxPredicateDataLength),
|
3696
|
+
maxGasPerPredicate: bn18(predicateParams.maxGasPerPredicate),
|
3697
|
+
maxMessageDataLength: bn18(predicateParams.maxMessageDataLength)
|
3696
3698
|
},
|
3697
3699
|
scriptParameters: {
|
3698
3700
|
version: scriptParams.version,
|
3699
|
-
maxScriptLength:
|
3700
|
-
maxScriptDataLength:
|
3701
|
+
maxScriptLength: bn18(scriptParams.maxScriptLength),
|
3702
|
+
maxScriptDataLength: bn18(scriptParams.maxScriptDataLength)
|
3701
3703
|
},
|
3702
3704
|
gasCosts
|
3703
3705
|
},
|
3704
3706
|
latestBlock: {
|
3705
3707
|
id: latestBlock.id,
|
3706
|
-
height:
|
3708
|
+
height: bn18(latestBlock.height),
|
3707
3709
|
time: latestBlock.header.time,
|
3708
3710
|
transactions: latestBlock.transactions.map((i) => ({
|
3709
3711
|
id: i.id
|
@@ -3899,7 +3901,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3899
3901
|
*/
|
3900
3902
|
async getBlockNumber() {
|
3901
3903
|
const { chain } = await this.operations.getChain();
|
3902
|
-
return
|
3904
|
+
return bn18(chain.latestBlock.height, 10);
|
3903
3905
|
}
|
3904
3906
|
/**
|
3905
3907
|
* Returns the chain information.
|
@@ -3909,8 +3911,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3909
3911
|
async fetchNode() {
|
3910
3912
|
const { nodeInfo } = await this.operations.getNodeInfo();
|
3911
3913
|
const processedNodeInfo = {
|
3912
|
-
maxDepth:
|
3913
|
-
maxTx:
|
3914
|
+
maxDepth: bn18(nodeInfo.maxDepth),
|
3915
|
+
maxTx: bn18(nodeInfo.maxTx),
|
3914
3916
|
nodeVersion: nodeInfo.nodeVersion,
|
3915
3917
|
utxoValidation: nodeInfo.utxoValidation,
|
3916
3918
|
vmBacktrace: nodeInfo.vmBacktrace
|
@@ -4042,7 +4044,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4042
4044
|
} = response;
|
4043
4045
|
if (inputs) {
|
4044
4046
|
inputs.forEach((input, index) => {
|
4045
|
-
if ("predicateGasUsed" in input &&
|
4047
|
+
if ("predicateGasUsed" in input && bn18(input.predicateGasUsed).gt(0)) {
|
4046
4048
|
transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
|
4047
4049
|
}
|
4048
4050
|
});
|
@@ -4200,12 +4202,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4200
4202
|
gasPrice = await this.estimateGasPrice(10);
|
4201
4203
|
}
|
4202
4204
|
const minFee = calculateGasFee({
|
4203
|
-
gasPrice:
|
4205
|
+
gasPrice: bn18(gasPrice),
|
4204
4206
|
gas: minGas,
|
4205
4207
|
priceFactor: gasPriceFactor,
|
4206
4208
|
tip: transactionRequest.tip
|
4207
4209
|
}).add(1);
|
4208
|
-
let gasLimit =
|
4210
|
+
let gasLimit = bn18(0);
|
4209
4211
|
if (transactionRequest.type === TransactionType8.Script) {
|
4210
4212
|
gasLimit = transactionRequest.gasLimit;
|
4211
4213
|
if (transactionRequest.gasLimit.eq(0)) {
|
@@ -4218,7 +4220,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4218
4220
|
}
|
4219
4221
|
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
4220
4222
|
const maxFee = calculateGasFee({
|
4221
|
-
gasPrice:
|
4223
|
+
gasPrice: bn18(gasPrice),
|
4222
4224
|
gas: maxGas,
|
4223
4225
|
priceFactor: gasPriceFactor,
|
4224
4226
|
tip: transactionRequest.tip
|
@@ -4281,9 +4283,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4281
4283
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
4282
4284
|
const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
|
4283
4285
|
txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
|
4284
|
-
txRequestClone.maxFee =
|
4286
|
+
txRequestClone.maxFee = bn18(0);
|
4285
4287
|
if (isScriptTransaction) {
|
4286
|
-
txRequestClone.gasLimit =
|
4288
|
+
txRequestClone.gasLimit = bn18(0);
|
4287
4289
|
}
|
4288
4290
|
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
4289
4291
|
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
@@ -4303,7 +4305,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4303
4305
|
let dryRunStatus;
|
4304
4306
|
let missingContractIds = [];
|
4305
4307
|
let outputVariables = 0;
|
4306
|
-
let gasUsed =
|
4308
|
+
let gasUsed = bn18(0);
|
4307
4309
|
txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
|
4308
4310
|
txRequestClone.maxFee = maxFee;
|
4309
4311
|
if (isScriptTransaction) {
|
@@ -4368,10 +4370,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4368
4370
|
return coins.map((coin) => ({
|
4369
4371
|
id: coin.utxoId,
|
4370
4372
|
assetId: coin.assetId,
|
4371
|
-
amount:
|
4373
|
+
amount: bn18(coin.amount),
|
4372
4374
|
owner: Address2.fromAddressOrString(coin.owner),
|
4373
|
-
blockCreated:
|
4374
|
-
txCreatedIdx:
|
4375
|
+
blockCreated: bn18(coin.blockCreated),
|
4376
|
+
txCreatedIdx: bn18(coin.txCreatedIdx)
|
4375
4377
|
}));
|
4376
4378
|
}
|
4377
4379
|
/**
|
@@ -4405,12 +4407,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4405
4407
|
};
|
4406
4408
|
const result = await this.operations.getCoinsToSpend(coinsQuery);
|
4407
4409
|
const coins = result.coinsToSpend.flat().map((coin) => {
|
4408
|
-
switch (coin.
|
4410
|
+
switch (coin.__typename) {
|
4409
4411
|
case "MessageCoin":
|
4410
4412
|
return {
|
4411
|
-
amount:
|
4413
|
+
amount: bn18(coin.amount),
|
4412
4414
|
assetId: coin.assetId,
|
4413
|
-
daHeight:
|
4415
|
+
daHeight: bn18(coin.daHeight),
|
4414
4416
|
sender: Address2.fromAddressOrString(coin.sender),
|
4415
4417
|
recipient: Address2.fromAddressOrString(coin.recipient),
|
4416
4418
|
nonce: coin.nonce
|
@@ -4418,11 +4420,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4418
4420
|
case "Coin":
|
4419
4421
|
return {
|
4420
4422
|
id: coin.utxoId,
|
4421
|
-
amount:
|
4423
|
+
amount: bn18(coin.amount),
|
4422
4424
|
assetId: coin.assetId,
|
4423
4425
|
owner: Address2.fromAddressOrString(coin.owner),
|
4424
|
-
blockCreated:
|
4425
|
-
txCreatedIdx:
|
4426
|
+
blockCreated: bn18(coin.blockCreated),
|
4427
|
+
txCreatedIdx: bn18(coin.txCreatedIdx)
|
4426
4428
|
};
|
4427
4429
|
default:
|
4428
4430
|
return null;
|
@@ -4439,13 +4441,13 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4439
4441
|
async getBlock(idOrHeight) {
|
4440
4442
|
let variables;
|
4441
4443
|
if (typeof idOrHeight === "number") {
|
4442
|
-
variables = { height:
|
4444
|
+
variables = { height: bn18(idOrHeight).toString(10) };
|
4443
4445
|
} else if (idOrHeight === "latest") {
|
4444
4446
|
variables = { height: (await this.getBlockNumber()).toString(10) };
|
4445
4447
|
} else if (idOrHeight.length === 66) {
|
4446
4448
|
variables = { blockId: idOrHeight };
|
4447
4449
|
} else {
|
4448
|
-
variables = { blockId:
|
4450
|
+
variables = { blockId: bn18(idOrHeight).toString(10) };
|
4449
4451
|
}
|
4450
4452
|
const { block } = await this.operations.getBlock(variables);
|
4451
4453
|
if (!block) {
|
@@ -4453,7 +4455,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4453
4455
|
}
|
4454
4456
|
return {
|
4455
4457
|
id: block.id,
|
4456
|
-
height:
|
4458
|
+
height: bn18(block.height),
|
4457
4459
|
time: block.header.time,
|
4458
4460
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4459
4461
|
};
|
@@ -4468,7 +4470,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4468
4470
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
4469
4471
|
const blocks = fetchedData.edges.map(({ node: block }) => ({
|
4470
4472
|
id: block.id,
|
4471
|
-
height:
|
4473
|
+
height: bn18(block.height),
|
4472
4474
|
time: block.header.time,
|
4473
4475
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4474
4476
|
}));
|
@@ -4483,7 +4485,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4483
4485
|
async getBlockWithTransactions(idOrHeight) {
|
4484
4486
|
let variables;
|
4485
4487
|
if (typeof idOrHeight === "number") {
|
4486
|
-
variables = { blockHeight:
|
4488
|
+
variables = { blockHeight: bn18(idOrHeight).toString(10) };
|
4487
4489
|
} else if (idOrHeight === "latest") {
|
4488
4490
|
variables = { blockHeight: (await this.getBlockNumber()).toString() };
|
4489
4491
|
} else {
|
@@ -4495,7 +4497,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4495
4497
|
}
|
4496
4498
|
return {
|
4497
4499
|
id: block.id,
|
4498
|
-
height:
|
4500
|
+
height: bn18(block.height, 10),
|
4499
4501
|
time: block.header.time,
|
4500
4502
|
transactionIds: block.transactions.map((tx) => tx.id),
|
4501
4503
|
transactions: block.transactions.map(
|
@@ -4544,7 +4546,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4544
4546
|
contract: Address2.fromAddressOrString(contractId).toB256(),
|
4545
4547
|
asset: hexlify12(assetId)
|
4546
4548
|
});
|
4547
|
-
return
|
4549
|
+
return bn18(contractBalance.amount, 10);
|
4548
4550
|
}
|
4549
4551
|
/**
|
4550
4552
|
* Returns the balance for the given owner for the given asset ID.
|
@@ -4558,7 +4560,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4558
4560
|
owner: Address2.fromAddressOrString(owner).toB256(),
|
4559
4561
|
assetId: hexlify12(assetId)
|
4560
4562
|
});
|
4561
|
-
return
|
4563
|
+
return bn18(balance.amount, 10);
|
4562
4564
|
}
|
4563
4565
|
/**
|
4564
4566
|
* Returns balances for the given owner.
|
@@ -4576,7 +4578,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4576
4578
|
const balances = result.balances.edges.map((edge) => edge.node);
|
4577
4579
|
return balances.map((balance) => ({
|
4578
4580
|
assetId: balance.assetId,
|
4579
|
-
amount:
|
4581
|
+
amount: bn18(balance.amount)
|
4580
4582
|
}));
|
4581
4583
|
}
|
4582
4584
|
/**
|
@@ -4598,15 +4600,15 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4598
4600
|
sender: message.sender,
|
4599
4601
|
recipient: message.recipient,
|
4600
4602
|
nonce: message.nonce,
|
4601
|
-
amount:
|
4603
|
+
amount: bn18(message.amount),
|
4602
4604
|
data: message.data
|
4603
4605
|
}),
|
4604
4606
|
sender: Address2.fromAddressOrString(message.sender),
|
4605
4607
|
recipient: Address2.fromAddressOrString(message.recipient),
|
4606
4608
|
nonce: message.nonce,
|
4607
|
-
amount:
|
4609
|
+
amount: bn18(message.amount),
|
4608
4610
|
data: InputMessageCoder.decodeData(message.data),
|
4609
|
-
daHeight:
|
4611
|
+
daHeight: bn18(message.daHeight)
|
4610
4612
|
}));
|
4611
4613
|
}
|
4612
4614
|
/**
|
@@ -4659,19 +4661,19 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4659
4661
|
} = result.messageProof;
|
4660
4662
|
return {
|
4661
4663
|
messageProof: {
|
4662
|
-
proofIndex:
|
4664
|
+
proofIndex: bn18(messageProof.proofIndex),
|
4663
4665
|
proofSet: messageProof.proofSet
|
4664
4666
|
},
|
4665
4667
|
blockProof: {
|
4666
|
-
proofIndex:
|
4668
|
+
proofIndex: bn18(blockProof.proofIndex),
|
4667
4669
|
proofSet: blockProof.proofSet
|
4668
4670
|
},
|
4669
4671
|
messageBlockHeader: {
|
4670
4672
|
id: messageBlockHeader.id,
|
4671
|
-
daHeight:
|
4673
|
+
daHeight: bn18(messageBlockHeader.daHeight),
|
4672
4674
|
transactionsCount: Number(messageBlockHeader.transactionsCount),
|
4673
4675
|
transactionsRoot: messageBlockHeader.transactionsRoot,
|
4674
|
-
height:
|
4676
|
+
height: bn18(messageBlockHeader.height),
|
4675
4677
|
prevRoot: messageBlockHeader.prevRoot,
|
4676
4678
|
time: messageBlockHeader.time,
|
4677
4679
|
applicationHash: messageBlockHeader.applicationHash,
|
@@ -4683,10 +4685,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4683
4685
|
},
|
4684
4686
|
commitBlockHeader: {
|
4685
4687
|
id: commitBlockHeader.id,
|
4686
|
-
daHeight:
|
4688
|
+
daHeight: bn18(commitBlockHeader.daHeight),
|
4687
4689
|
transactionsCount: Number(commitBlockHeader.transactionsCount),
|
4688
4690
|
transactionsRoot: commitBlockHeader.transactionsRoot,
|
4689
|
-
height:
|
4691
|
+
height: bn18(commitBlockHeader.height),
|
4690
4692
|
prevRoot: commitBlockHeader.prevRoot,
|
4691
4693
|
time: commitBlockHeader.time,
|
4692
4694
|
applicationHash: commitBlockHeader.applicationHash,
|
@@ -4699,19 +4701,19 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4699
4701
|
sender: Address2.fromAddressOrString(sender),
|
4700
4702
|
recipient: Address2.fromAddressOrString(recipient),
|
4701
4703
|
nonce,
|
4702
|
-
amount:
|
4704
|
+
amount: bn18(amount),
|
4703
4705
|
data
|
4704
4706
|
};
|
4705
4707
|
}
|
4706
4708
|
async getLatestGasPrice() {
|
4707
4709
|
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
4708
|
-
return
|
4710
|
+
return bn18(latestGasPrice.gasPrice);
|
4709
4711
|
}
|
4710
4712
|
async estimateGasPrice(blockHorizon) {
|
4711
4713
|
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
4712
4714
|
blockHorizon: String(blockHorizon)
|
4713
4715
|
});
|
4714
|
-
return
|
4716
|
+
return bn18(estimateGasPrice.gasPrice);
|
4715
4717
|
}
|
4716
4718
|
/**
|
4717
4719
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
@@ -4732,10 +4734,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4732
4734
|
*/
|
4733
4735
|
async produceBlocks(amount, startTime) {
|
4734
4736
|
const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
|
4735
|
-
blocksToProduce:
|
4737
|
+
blocksToProduce: bn18(amount).toString(10),
|
4736
4738
|
startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
|
4737
4739
|
});
|
4738
|
-
return
|
4740
|
+
return bn18(latestBlockHeight);
|
4739
4741
|
}
|
4740
4742
|
// eslint-disable-next-line @typescript-eslint/require-await
|
4741
4743
|
async getTransactionResponse(transactionId) {
|
@@ -4781,7 +4783,7 @@ __publicField(Provider, "nodeInfoCache", {});
|
|
4781
4783
|
|
4782
4784
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
4783
4785
|
import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
|
4784
|
-
import { bn as
|
4786
|
+
import { bn as bn19 } from "@fuel-ts/math";
|
4785
4787
|
import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
|
4786
4788
|
import { arrayify as arrayify12 } from "@fuel-ts/utils";
|
4787
4789
|
|
@@ -4830,22 +4832,6 @@ var assets = [
|
|
4830
4832
|
}
|
4831
4833
|
];
|
4832
4834
|
|
4833
|
-
// src/providers/transaction-request/helpers.ts
|
4834
|
-
import { bn as bn19 } from "@fuel-ts/math";
|
4835
|
-
import { InputType as InputType8 } from "@fuel-ts/transactions";
|
4836
|
-
var isRequestInputCoin = (input) => input.type === InputType8.Coin;
|
4837
|
-
var isRequestInputMessage = (input) => input.type === InputType8.Message;
|
4838
|
-
var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
|
4839
|
-
var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
|
4840
|
-
if (isRequestInputCoin(input) && input.assetId === assetId) {
|
4841
|
-
return acc.add(input.amount);
|
4842
|
-
}
|
4843
|
-
if (isRequestInputMessage(input) && assetId === baseAsset) {
|
4844
|
-
return acc.add(input.amount);
|
4845
|
-
}
|
4846
|
-
return acc;
|
4847
|
-
}, bn19(0));
|
4848
|
-
|
4849
4835
|
// src/utils/formatTransferToContractScriptData.ts
|
4850
4836
|
import { BigNumberCoder as BigNumberCoder2 } from "@fuel-ts/abi-coder";
|
4851
4837
|
import { BN as BN2 } from "@fuel-ts/math";
|
@@ -5083,7 +5069,7 @@ var Account = class extends AbstractAccount {
|
|
5083
5069
|
while (needsToBeFunded && fundingAttempts < MAX_FUNDING_ATTEMPTS) {
|
5084
5070
|
const resources = await this.getResourcesToSpend(
|
5085
5071
|
missingQuantities,
|
5086
|
-
|
5072
|
+
cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
|
5087
5073
|
);
|
5088
5074
|
request.addResources(resources);
|
5089
5075
|
txRequest.shiftPredicateData();
|
@@ -8383,16 +8369,18 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
|
|
8383
8369
|
|
8384
8370
|
// src/test-utils/seedTestWallet.ts
|
8385
8371
|
import { randomBytes as randomBytes5 } from "@fuel-ts/crypto";
|
8386
|
-
var seedTestWallet = async (wallet, quantities) => {
|
8387
|
-
const
|
8388
|
-
|
8389
|
-
|
8390
|
-
);
|
8372
|
+
var seedTestWallet = async (wallet, quantities, utxosAmount = 1) => {
|
8373
|
+
const accountsToBeFunded = Array.isArray(wallet) ? wallet : [wallet];
|
8374
|
+
const [{ provider }] = accountsToBeFunded;
|
8375
|
+
const genesisWallet = new WalletUnlocked(process.env.GENESIS_SECRET || randomBytes5(32), provider);
|
8391
8376
|
const request = new ScriptTransactionRequest();
|
8392
|
-
quantities.forEach(
|
8393
|
-
|
8394
|
-
|
8395
|
-
|
8377
|
+
quantities.map(coinQuantityfy).forEach(
|
8378
|
+
({ amount, assetId }) => accountsToBeFunded.forEach(({ address }) => {
|
8379
|
+
for (let i = 0; i < utxosAmount; i++) {
|
8380
|
+
request.addCoinOutput(address, amount.div(utxosAmount), assetId);
|
8381
|
+
}
|
8382
|
+
})
|
8383
|
+
);
|
8396
8384
|
const txCost = await genesisWallet.provider.getTransactionCost(request);
|
8397
8385
|
request.gasLimit = txCost.gasUsed;
|
8398
8386
|
request.maxFee = txCost.maxFee;
|