@fuel-ts/account 0.84.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.
- package/dist/account.d.ts +6 -6
- package/dist/account.d.ts.map +1 -1
- package/dist/index.global.js +188 -146
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +271 -224
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +188 -143
- package/dist/index.mjs.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +346 -552
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/assets/assets.d.ts +9 -0
- package/dist/providers/assets/assets.d.ts.map +1 -0
- package/dist/providers/assets/index.d.ts +1 -2
- package/dist/providers/assets/index.d.ts.map +1 -1
- package/dist/providers/assets/utils/fuelAssetsBaseUrl.d.ts +2 -0
- package/dist/providers/assets/utils/fuelAssetsBaseUrl.d.ts.map +1 -0
- package/dist/providers/assets/utils/index.d.ts +1 -0
- package/dist/providers/assets/utils/index.d.ts.map +1 -1
- package/dist/providers/assets/utils/resolveIconPaths.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +5 -9
- package/dist/providers/provider.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 +5 -13
- 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.global.js +210 -146
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +283 -218
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +208 -143
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +15 -15
package/dist/index.js
CHANGED
@@ -116,6 +116,7 @@ __export(src_exports, {
|
|
116
116
|
extractBurnedAssetsFromReceipts: () => extractBurnedAssetsFromReceipts,
|
117
117
|
extractMintedAssetsFromReceipts: () => extractMintedAssetsFromReceipts,
|
118
118
|
extractTxError: () => extractTxError,
|
119
|
+
fuelAssetsBaseUrl: () => fuelAssetsBaseUrl,
|
119
120
|
gasUsedByInputs: () => gasUsedByInputs,
|
120
121
|
getAssetEth: () => getAssetEth,
|
121
122
|
getAssetFuel: () => getAssetFuel,
|
@@ -174,6 +175,7 @@ __export(src_exports, {
|
|
174
175
|
outputify: () => outputify,
|
175
176
|
processGqlReceipt: () => processGqlReceipt,
|
176
177
|
processGraphqlStatus: () => processGraphqlStatus,
|
178
|
+
rawAssets: () => rawAssets,
|
177
179
|
resolveGasDependentCosts: () => resolveGasDependentCosts,
|
178
180
|
resolveIconPaths: () => resolveIconPaths,
|
179
181
|
returnZeroScript: () => returnZeroScript,
|
@@ -190,7 +192,7 @@ var import_address4 = require("@fuel-ts/address");
|
|
190
192
|
var import_errors16 = require("@fuel-ts/errors");
|
191
193
|
var import_interfaces = require("@fuel-ts/interfaces");
|
192
194
|
var import_math21 = require("@fuel-ts/math");
|
193
|
-
var
|
195
|
+
var import_utils28 = require("@fuel-ts/utils");
|
194
196
|
var import_ramda4 = require("ramda");
|
195
197
|
|
196
198
|
// src/providers/coin-quantity.ts
|
@@ -241,7 +243,7 @@ var import_ramda3 = require("ramda");
|
|
241
243
|
|
242
244
|
// src/providers/__generated__/operations.ts
|
243
245
|
var import_graphql_tag = __toESM(require("graphql-tag"));
|
244
|
-
var
|
246
|
+
var TransactionStatusSubscriptionFragmentDoc = import_graphql_tag.default`
|
245
247
|
fragment transactionStatusSubscriptionFragment on TransactionStatus {
|
246
248
|
type: __typename
|
247
249
|
... on SqueezedOutStatus {
|
@@ -249,7 +251,13 @@ var TransactionStatusSubscriptionFragmentFragmentDoc = import_graphql_tag.defaul
|
|
249
251
|
}
|
250
252
|
}
|
251
253
|
`;
|
252
|
-
var
|
254
|
+
var SubmittedStatusFragmentDoc = import_graphql_tag.default`
|
255
|
+
fragment SubmittedStatusFragment on SubmittedStatus {
|
256
|
+
type: __typename
|
257
|
+
time
|
258
|
+
}
|
259
|
+
`;
|
260
|
+
var ReceiptFragmentDoc = import_graphql_tag.default`
|
253
261
|
fragment receiptFragment on Receipt {
|
254
262
|
id
|
255
263
|
pc
|
@@ -281,45 +289,65 @@ var ReceiptFragmentFragmentDoc = import_graphql_tag.default`
|
|
281
289
|
subId
|
282
290
|
}
|
283
291
|
`;
|
284
|
-
var
|
285
|
-
fragment
|
292
|
+
var SuccessStatusFragmentDoc = import_graphql_tag.default`
|
293
|
+
fragment SuccessStatusFragment on SuccessStatus {
|
294
|
+
type: __typename
|
295
|
+
block {
|
296
|
+
id
|
297
|
+
}
|
298
|
+
time
|
299
|
+
programState {
|
300
|
+
returnType
|
301
|
+
data
|
302
|
+
}
|
303
|
+
receipts {
|
304
|
+
...receiptFragment
|
305
|
+
}
|
306
|
+
totalGas
|
307
|
+
totalFee
|
308
|
+
}
|
309
|
+
${ReceiptFragmentDoc}`;
|
310
|
+
var FailureStatusFragmentDoc = import_graphql_tag.default`
|
311
|
+
fragment FailureStatusFragment on FailureStatus {
|
286
312
|
type: __typename
|
313
|
+
block {
|
314
|
+
id
|
315
|
+
}
|
316
|
+
totalGas
|
317
|
+
totalFee
|
318
|
+
time
|
319
|
+
reason
|
320
|
+
receipts {
|
321
|
+
...receiptFragment
|
322
|
+
}
|
323
|
+
}
|
324
|
+
${ReceiptFragmentDoc}`;
|
325
|
+
var SqueezedOutStatusFragmentDoc = import_graphql_tag.default`
|
326
|
+
fragment SqueezedOutStatusFragment on SqueezedOutStatus {
|
327
|
+
type: __typename
|
328
|
+
reason
|
329
|
+
}
|
330
|
+
`;
|
331
|
+
var TransactionStatusFragmentDoc = import_graphql_tag.default`
|
332
|
+
fragment transactionStatusFragment on TransactionStatus {
|
287
333
|
... on SubmittedStatus {
|
288
|
-
|
334
|
+
...SubmittedStatusFragment
|
289
335
|
}
|
290
336
|
... on SuccessStatus {
|
291
|
-
|
292
|
-
id
|
293
|
-
}
|
294
|
-
time
|
295
|
-
programState {
|
296
|
-
returnType
|
297
|
-
data
|
298
|
-
}
|
299
|
-
receipts {
|
300
|
-
...receiptFragment
|
301
|
-
}
|
302
|
-
totalGas
|
303
|
-
totalFee
|
337
|
+
...SuccessStatusFragment
|
304
338
|
}
|
305
339
|
... on FailureStatus {
|
306
|
-
|
307
|
-
id
|
308
|
-
}
|
309
|
-
totalGas
|
310
|
-
totalFee
|
311
|
-
time
|
312
|
-
reason
|
313
|
-
receipts {
|
314
|
-
...receiptFragment
|
315
|
-
}
|
340
|
+
...FailureStatusFragment
|
316
341
|
}
|
317
342
|
... on SqueezedOutStatus {
|
318
|
-
|
343
|
+
...SqueezedOutStatusFragment
|
319
344
|
}
|
320
345
|
}
|
321
|
-
${
|
322
|
-
|
346
|
+
${SubmittedStatusFragmentDoc}
|
347
|
+
${SuccessStatusFragmentDoc}
|
348
|
+
${FailureStatusFragmentDoc}
|
349
|
+
${SqueezedOutStatusFragmentDoc}`;
|
350
|
+
var TransactionFragmentDoc = import_graphql_tag.default`
|
323
351
|
fragment transactionFragment on Transaction {
|
324
352
|
id
|
325
353
|
rawPayload
|
@@ -327,8 +355,8 @@ var TransactionFragmentFragmentDoc = import_graphql_tag.default`
|
|
327
355
|
...transactionStatusFragment
|
328
356
|
}
|
329
357
|
}
|
330
|
-
${
|
331
|
-
var
|
358
|
+
${TransactionStatusFragmentDoc}`;
|
359
|
+
var InputEstimatePredicatesFragmentDoc = import_graphql_tag.default`
|
332
360
|
fragment inputEstimatePredicatesFragment on Input {
|
333
361
|
... on InputCoin {
|
334
362
|
predicateGasUsed
|
@@ -338,14 +366,14 @@ var InputEstimatePredicatesFragmentFragmentDoc = import_graphql_tag.default`
|
|
338
366
|
}
|
339
367
|
}
|
340
368
|
`;
|
341
|
-
var
|
369
|
+
var TransactionEstimatePredicatesFragmentDoc = import_graphql_tag.default`
|
342
370
|
fragment transactionEstimatePredicatesFragment on Transaction {
|
343
371
|
inputs {
|
344
372
|
...inputEstimatePredicatesFragment
|
345
373
|
}
|
346
374
|
}
|
347
|
-
${
|
348
|
-
var
|
375
|
+
${InputEstimatePredicatesFragmentDoc}`;
|
376
|
+
var DryRunFailureStatusFragmentDoc = import_graphql_tag.default`
|
349
377
|
fragment dryRunFailureStatusFragment on DryRunFailureStatus {
|
350
378
|
totalGas
|
351
379
|
totalFee
|
@@ -356,7 +384,7 @@ var DryRunFailureStatusFragmentFragmentDoc = import_graphql_tag.default`
|
|
356
384
|
}
|
357
385
|
}
|
358
386
|
`;
|
359
|
-
var
|
387
|
+
var DryRunSuccessStatusFragmentDoc = import_graphql_tag.default`
|
360
388
|
fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
|
361
389
|
totalGas
|
362
390
|
totalFee
|
@@ -366,7 +394,7 @@ var DryRunSuccessStatusFragmentFragmentDoc = import_graphql_tag.default`
|
|
366
394
|
}
|
367
395
|
}
|
368
396
|
`;
|
369
|
-
var
|
397
|
+
var DryRunTransactionStatusFragmentDoc = import_graphql_tag.default`
|
370
398
|
fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
|
371
399
|
... on DryRunFailureStatus {
|
372
400
|
...dryRunFailureStatusFragment
|
@@ -375,9 +403,9 @@ var DryRunTransactionStatusFragmentFragmentDoc = import_graphql_tag.default`
|
|
375
403
|
...dryRunSuccessStatusFragment
|
376
404
|
}
|
377
405
|
}
|
378
|
-
${
|
379
|
-
${
|
380
|
-
var
|
406
|
+
${DryRunFailureStatusFragmentDoc}
|
407
|
+
${DryRunSuccessStatusFragmentDoc}`;
|
408
|
+
var DryRunTransactionExecutionStatusFragmentDoc = import_graphql_tag.default`
|
381
409
|
fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
|
382
410
|
id
|
383
411
|
status {
|
@@ -387,11 +415,11 @@ var DryRunTransactionExecutionStatusFragmentFragmentDoc = import_graphql_tag.def
|
|
387
415
|
...receiptFragment
|
388
416
|
}
|
389
417
|
}
|
390
|
-
${
|
391
|
-
${
|
392
|
-
var
|
418
|
+
${DryRunTransactionStatusFragmentDoc}
|
419
|
+
${ReceiptFragmentDoc}`;
|
420
|
+
var CoinFragmentDoc = import_graphql_tag.default`
|
393
421
|
fragment coinFragment on Coin {
|
394
|
-
__typename
|
422
|
+
type: __typename
|
395
423
|
utxoId
|
396
424
|
owner
|
397
425
|
amount
|
@@ -400,9 +428,9 @@ var CoinFragmentFragmentDoc = import_graphql_tag.default`
|
|
400
428
|
txCreatedIdx
|
401
429
|
}
|
402
430
|
`;
|
403
|
-
var
|
431
|
+
var MessageCoinFragmentDoc = import_graphql_tag.default`
|
404
432
|
fragment messageCoinFragment on MessageCoin {
|
405
|
-
__typename
|
433
|
+
type: __typename
|
406
434
|
sender
|
407
435
|
recipient
|
408
436
|
nonce
|
@@ -411,7 +439,7 @@ var MessageCoinFragmentFragmentDoc = import_graphql_tag.default`
|
|
411
439
|
daHeight
|
412
440
|
}
|
413
441
|
`;
|
414
|
-
var
|
442
|
+
var MessageFragmentDoc = import_graphql_tag.default`
|
415
443
|
fragment messageFragment on Message {
|
416
444
|
amount
|
417
445
|
sender
|
@@ -421,7 +449,7 @@ var MessageFragmentFragmentDoc = import_graphql_tag.default`
|
|
421
449
|
daHeight
|
422
450
|
}
|
423
451
|
`;
|
424
|
-
var
|
452
|
+
var MessageProofFragmentDoc = import_graphql_tag.default`
|
425
453
|
fragment messageProofFragment on MessageProof {
|
426
454
|
messageProof {
|
427
455
|
proofSet
|
@@ -468,14 +496,14 @@ var MessageProofFragmentFragmentDoc = import_graphql_tag.default`
|
|
468
496
|
data
|
469
497
|
}
|
470
498
|
`;
|
471
|
-
var
|
499
|
+
var BalanceFragmentDoc = import_graphql_tag.default`
|
472
500
|
fragment balanceFragment on Balance {
|
473
501
|
owner
|
474
502
|
amount
|
475
503
|
assetId
|
476
504
|
}
|
477
505
|
`;
|
478
|
-
var
|
506
|
+
var BlockFragmentDoc = import_graphql_tag.default`
|
479
507
|
fragment blockFragment on Block {
|
480
508
|
id
|
481
509
|
height
|
@@ -487,7 +515,7 @@ var BlockFragmentFragmentDoc = import_graphql_tag.default`
|
|
487
515
|
}
|
488
516
|
}
|
489
517
|
`;
|
490
|
-
var
|
518
|
+
var TxParametersFragmentDoc = import_graphql_tag.default`
|
491
519
|
fragment TxParametersFragment on TxParameters {
|
492
520
|
version
|
493
521
|
maxInputs
|
@@ -498,7 +526,7 @@ var TxParametersFragmentFragmentDoc = import_graphql_tag.default`
|
|
498
526
|
maxBytecodeSubsections
|
499
527
|
}
|
500
528
|
`;
|
501
|
-
var
|
529
|
+
var PredicateParametersFragmentDoc = import_graphql_tag.default`
|
502
530
|
fragment PredicateParametersFragment on PredicateParameters {
|
503
531
|
version
|
504
532
|
maxPredicateLength
|
@@ -507,41 +535,42 @@ var PredicateParametersFragmentFragmentDoc = import_graphql_tag.default`
|
|
507
535
|
maxMessageDataLength
|
508
536
|
}
|
509
537
|
`;
|
510
|
-
var
|
538
|
+
var ScriptParametersFragmentDoc = import_graphql_tag.default`
|
511
539
|
fragment ScriptParametersFragment on ScriptParameters {
|
512
540
|
version
|
513
541
|
maxScriptLength
|
514
542
|
maxScriptDataLength
|
515
543
|
}
|
516
544
|
`;
|
517
|
-
var
|
545
|
+
var ContractParametersFragmentDoc = import_graphql_tag.default`
|
518
546
|
fragment ContractParametersFragment on ContractParameters {
|
519
547
|
version
|
520
548
|
contractMaxSize
|
521
549
|
maxStorageSlots
|
522
550
|
}
|
523
551
|
`;
|
524
|
-
var
|
552
|
+
var FeeParametersFragmentDoc = import_graphql_tag.default`
|
525
553
|
fragment FeeParametersFragment on FeeParameters {
|
526
554
|
version
|
527
555
|
gasPriceFactor
|
528
556
|
gasPerByte
|
529
557
|
}
|
530
558
|
`;
|
531
|
-
var
|
559
|
+
var DependentCostFragmentDoc = import_graphql_tag.default`
|
532
560
|
fragment DependentCostFragment on DependentCost {
|
533
|
-
__typename
|
534
561
|
... on LightOperation {
|
562
|
+
type: __typename
|
535
563
|
base
|
536
564
|
unitsPerGas
|
537
565
|
}
|
538
566
|
... on HeavyOperation {
|
567
|
+
type: __typename
|
539
568
|
base
|
540
569
|
gasPerUnit
|
541
570
|
}
|
542
571
|
}
|
543
572
|
`;
|
544
|
-
var
|
573
|
+
var GasCostsFragmentDoc = import_graphql_tag.default`
|
545
574
|
fragment GasCostsFragment on GasCosts {
|
546
575
|
version
|
547
576
|
add
|
@@ -697,8 +726,8 @@ var GasCostsFragmentFragmentDoc = import_graphql_tag.default`
|
|
697
726
|
}
|
698
727
|
newStoragePerByte
|
699
728
|
}
|
700
|
-
${
|
701
|
-
var
|
729
|
+
${DependentCostFragmentDoc}`;
|
730
|
+
var ConsensusParametersFragmentDoc = import_graphql_tag.default`
|
702
731
|
fragment consensusParametersFragment on ConsensusParameters {
|
703
732
|
version
|
704
733
|
txParams {
|
@@ -722,13 +751,13 @@ var ConsensusParametersFragmentFragmentDoc = import_graphql_tag.default`
|
|
722
751
|
baseAssetId
|
723
752
|
chainId
|
724
753
|
}
|
725
|
-
${
|
726
|
-
${
|
727
|
-
${
|
728
|
-
${
|
729
|
-
${
|
730
|
-
${
|
731
|
-
var
|
754
|
+
${TxParametersFragmentDoc}
|
755
|
+
${PredicateParametersFragmentDoc}
|
756
|
+
${ScriptParametersFragmentDoc}
|
757
|
+
${ContractParametersFragmentDoc}
|
758
|
+
${FeeParametersFragmentDoc}
|
759
|
+
${GasCostsFragmentDoc}`;
|
760
|
+
var ChainInfoFragmentDoc = import_graphql_tag.default`
|
732
761
|
fragment chainInfoFragment on ChainInfo {
|
733
762
|
name
|
734
763
|
latestBlock {
|
@@ -739,16 +768,16 @@ var ChainInfoFragmentFragmentDoc = import_graphql_tag.default`
|
|
739
768
|
...consensusParametersFragment
|
740
769
|
}
|
741
770
|
}
|
742
|
-
${
|
743
|
-
${
|
744
|
-
var
|
771
|
+
${BlockFragmentDoc}
|
772
|
+
${ConsensusParametersFragmentDoc}`;
|
773
|
+
var ContractBalanceFragmentDoc = import_graphql_tag.default`
|
745
774
|
fragment contractBalanceFragment on ContractBalance {
|
746
775
|
contract
|
747
776
|
amount
|
748
777
|
assetId
|
749
778
|
}
|
750
779
|
`;
|
751
|
-
var
|
780
|
+
var PageInfoFragmentDoc = import_graphql_tag.default`
|
752
781
|
fragment pageInfoFragment on PageInfo {
|
753
782
|
hasPreviousPage
|
754
783
|
hasNextPage
|
@@ -756,7 +785,7 @@ var PageInfoFragmentFragmentDoc = import_graphql_tag.default`
|
|
756
785
|
endCursor
|
757
786
|
}
|
758
787
|
`;
|
759
|
-
var
|
788
|
+
var NodeInfoFragmentDoc = import_graphql_tag.default`
|
760
789
|
fragment nodeInfoFragment on NodeInfo {
|
761
790
|
utxoValidation
|
762
791
|
vmBacktrace
|
@@ -765,7 +794,7 @@ var NodeInfoFragmentFragmentDoc = import_graphql_tag.default`
|
|
765
794
|
nodeVersion
|
766
795
|
}
|
767
796
|
`;
|
768
|
-
var
|
797
|
+
var RelayedTransactionStatusFragmentDoc = import_graphql_tag.default`
|
769
798
|
fragment relayedTransactionStatusFragment on RelayedTransactionStatus {
|
770
799
|
... on RelayedTransactionFailed {
|
771
800
|
blockHeight
|
@@ -786,28 +815,28 @@ var GetNodeInfoDocument = import_graphql_tag.default`
|
|
786
815
|
...nodeInfoFragment
|
787
816
|
}
|
788
817
|
}
|
789
|
-
${
|
818
|
+
${NodeInfoFragmentDoc}`;
|
790
819
|
var GetChainDocument = import_graphql_tag.default`
|
791
820
|
query getChain {
|
792
821
|
chain {
|
793
822
|
...chainInfoFragment
|
794
823
|
}
|
795
824
|
}
|
796
|
-
${
|
825
|
+
${ChainInfoFragmentDoc}`;
|
797
826
|
var GetTransactionDocument = import_graphql_tag.default`
|
798
827
|
query getTransaction($transactionId: TransactionId!) {
|
799
828
|
transaction(id: $transactionId) {
|
800
829
|
...transactionFragment
|
801
830
|
}
|
802
831
|
}
|
803
|
-
${
|
832
|
+
${TransactionFragmentDoc}`;
|
804
833
|
var GetTransactionWithReceiptsDocument = import_graphql_tag.default`
|
805
834
|
query getTransactionWithReceipts($transactionId: TransactionId!) {
|
806
835
|
transaction(id: $transactionId) {
|
807
836
|
...transactionFragment
|
808
837
|
}
|
809
838
|
}
|
810
|
-
${
|
839
|
+
${TransactionFragmentDoc}`;
|
811
840
|
var GetTransactionsDocument = import_graphql_tag.default`
|
812
841
|
query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
|
813
842
|
transactions(after: $after, before: $before, first: $first, last: $last) {
|
@@ -818,7 +847,7 @@ var GetTransactionsDocument = import_graphql_tag.default`
|
|
818
847
|
}
|
819
848
|
}
|
820
849
|
}
|
821
|
-
${
|
850
|
+
${TransactionFragmentDoc}`;
|
822
851
|
var GetTransactionsByOwnerDocument = import_graphql_tag.default`
|
823
852
|
query getTransactionsByOwner($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
|
824
853
|
transactionsByOwner(
|
@@ -838,22 +867,22 @@ var GetTransactionsByOwnerDocument = import_graphql_tag.default`
|
|
838
867
|
}
|
839
868
|
}
|
840
869
|
}
|
841
|
-
${
|
842
|
-
${
|
870
|
+
${PageInfoFragmentDoc}
|
871
|
+
${TransactionFragmentDoc}`;
|
843
872
|
var EstimatePredicatesDocument = import_graphql_tag.default`
|
844
873
|
query estimatePredicates($encodedTransaction: HexString!) {
|
845
874
|
estimatePredicates(tx: $encodedTransaction) {
|
846
875
|
...transactionEstimatePredicatesFragment
|
847
876
|
}
|
848
877
|
}
|
849
|
-
${
|
878
|
+
${TransactionEstimatePredicatesFragmentDoc}`;
|
850
879
|
var GetBlockDocument = import_graphql_tag.default`
|
851
880
|
query getBlock($blockId: BlockId, $height: U32) {
|
852
881
|
block(id: $blockId, height: $height) {
|
853
882
|
...blockFragment
|
854
883
|
}
|
855
884
|
}
|
856
|
-
${
|
885
|
+
${BlockFragmentDoc}`;
|
857
886
|
var GetBlockWithTransactionsDocument = import_graphql_tag.default`
|
858
887
|
query getBlockWithTransactions($blockId: BlockId, $blockHeight: U32) {
|
859
888
|
block(id: $blockId, height: $blockHeight) {
|
@@ -863,8 +892,8 @@ var GetBlockWithTransactionsDocument = import_graphql_tag.default`
|
|
863
892
|
}
|
864
893
|
}
|
865
894
|
}
|
866
|
-
${
|
867
|
-
${
|
895
|
+
${BlockFragmentDoc}
|
896
|
+
${TransactionFragmentDoc}`;
|
868
897
|
var GetBlocksDocument = import_graphql_tag.default`
|
869
898
|
query getBlocks($after: String, $before: String, $first: Int, $last: Int) {
|
870
899
|
blocks(after: $after, before: $before, first: $first, last: $last) {
|
@@ -875,14 +904,14 @@ var GetBlocksDocument = import_graphql_tag.default`
|
|
875
904
|
}
|
876
905
|
}
|
877
906
|
}
|
878
|
-
${
|
907
|
+
${BlockFragmentDoc}`;
|
879
908
|
var GetCoinDocument = import_graphql_tag.default`
|
880
909
|
query getCoin($coinId: UtxoId!) {
|
881
910
|
coin(utxoId: $coinId) {
|
882
911
|
...coinFragment
|
883
912
|
}
|
884
913
|
}
|
885
|
-
${
|
914
|
+
${CoinFragmentDoc}`;
|
886
915
|
var GetCoinsDocument = import_graphql_tag.default`
|
887
916
|
query getCoins($filter: CoinFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
|
888
917
|
coins(
|
@@ -899,7 +928,7 @@ var GetCoinsDocument = import_graphql_tag.default`
|
|
899
928
|
}
|
900
929
|
}
|
901
930
|
}
|
902
|
-
${
|
931
|
+
${CoinFragmentDoc}`;
|
903
932
|
var GetCoinsToSpendDocument = import_graphql_tag.default`
|
904
933
|
query getCoinsToSpend($owner: Address!, $queryPerAsset: [SpendQueryElementInput!]!, $excludedIds: ExcludeInput) {
|
905
934
|
coinsToSpend(
|
@@ -911,8 +940,8 @@ var GetCoinsToSpendDocument = import_graphql_tag.default`
|
|
911
940
|
...messageCoinFragment
|
912
941
|
}
|
913
942
|
}
|
914
|
-
${
|
915
|
-
${
|
943
|
+
${CoinFragmentDoc}
|
944
|
+
${MessageCoinFragmentDoc}`;
|
916
945
|
var GetContractDocument = import_graphql_tag.default`
|
917
946
|
query getContract($contractId: ContractId!) {
|
918
947
|
contract(id: $contractId) {
|
@@ -927,14 +956,14 @@ var GetContractBalanceDocument = import_graphql_tag.default`
|
|
927
956
|
...contractBalanceFragment
|
928
957
|
}
|
929
958
|
}
|
930
|
-
${
|
959
|
+
${ContractBalanceFragmentDoc}`;
|
931
960
|
var GetBalanceDocument = import_graphql_tag.default`
|
932
961
|
query getBalance($owner: Address!, $assetId: AssetId!) {
|
933
962
|
balance(owner: $owner, assetId: $assetId) {
|
934
963
|
...balanceFragment
|
935
964
|
}
|
936
965
|
}
|
937
|
-
${
|
966
|
+
${BalanceFragmentDoc}`;
|
938
967
|
var GetLatestGasPriceDocument = import_graphql_tag.default`
|
939
968
|
query getLatestGasPrice {
|
940
969
|
latestGasPrice {
|
@@ -965,7 +994,7 @@ var GetBalancesDocument = import_graphql_tag.default`
|
|
965
994
|
}
|
966
995
|
}
|
967
996
|
}
|
968
|
-
${
|
997
|
+
${BalanceFragmentDoc}`;
|
969
998
|
var GetMessagesDocument = import_graphql_tag.default`
|
970
999
|
query getMessages($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
|
971
1000
|
messages(
|
@@ -982,7 +1011,7 @@ var GetMessagesDocument = import_graphql_tag.default`
|
|
982
1011
|
}
|
983
1012
|
}
|
984
1013
|
}
|
985
|
-
${
|
1014
|
+
${MessageFragmentDoc}`;
|
986
1015
|
var GetMessageProofDocument = import_graphql_tag.default`
|
987
1016
|
query getMessageProof($transactionId: TransactionId!, $nonce: Nonce!, $commitBlockId: BlockId, $commitBlockHeight: U32) {
|
988
1017
|
messageProof(
|
@@ -994,7 +1023,7 @@ var GetMessageProofDocument = import_graphql_tag.default`
|
|
994
1023
|
...messageProofFragment
|
995
1024
|
}
|
996
1025
|
}
|
997
|
-
${
|
1026
|
+
${MessageProofFragmentDoc}`;
|
998
1027
|
var GetMessageStatusDocument = import_graphql_tag.default`
|
999
1028
|
query getMessageStatus($nonce: Nonce!) {
|
1000
1029
|
messageStatus(nonce: $nonce) {
|
@@ -1008,14 +1037,14 @@ var GetRelayedTransactionStatusDocument = import_graphql_tag.default`
|
|
1008
1037
|
...relayedTransactionStatusFragment
|
1009
1038
|
}
|
1010
1039
|
}
|
1011
|
-
${
|
1040
|
+
${RelayedTransactionStatusFragmentDoc}`;
|
1012
1041
|
var DryRunDocument = import_graphql_tag.default`
|
1013
1042
|
mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
|
1014
1043
|
dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
|
1015
1044
|
...dryRunTransactionExecutionStatusFragment
|
1016
1045
|
}
|
1017
1046
|
}
|
1018
|
-
${
|
1047
|
+
${DryRunTransactionExecutionStatusFragmentDoc}`;
|
1019
1048
|
var SubmitDocument = import_graphql_tag.default`
|
1020
1049
|
mutation submit($encodedTransaction: HexString!) {
|
1021
1050
|
submit(tx: $encodedTransaction) {
|
@@ -1037,21 +1066,21 @@ var GetMessageByNonceDocument = import_graphql_tag.default`
|
|
1037
1066
|
...messageFragment
|
1038
1067
|
}
|
1039
1068
|
}
|
1040
|
-
${
|
1069
|
+
${MessageFragmentDoc}`;
|
1041
1070
|
var SubmitAndAwaitDocument = import_graphql_tag.default`
|
1042
1071
|
subscription submitAndAwait($encodedTransaction: HexString!) {
|
1043
1072
|
submitAndAwait(tx: $encodedTransaction) {
|
1044
1073
|
...transactionStatusSubscriptionFragment
|
1045
1074
|
}
|
1046
1075
|
}
|
1047
|
-
${
|
1076
|
+
${TransactionStatusSubscriptionFragmentDoc}`;
|
1048
1077
|
var StatusChangeDocument = import_graphql_tag.default`
|
1049
1078
|
subscription statusChange($transactionId: TransactionId!) {
|
1050
1079
|
statusChange(id: $transactionId) {
|
1051
1080
|
...transactionStatusSubscriptionFragment
|
1052
1081
|
}
|
1053
1082
|
}
|
1054
|
-
${
|
1083
|
+
${TransactionStatusSubscriptionFragmentDoc}`;
|
1055
1084
|
function getSdk(requester) {
|
1056
1085
|
return {
|
1057
1086
|
getVersion(variables, options) {
|
@@ -1714,10 +1743,9 @@ var getGasUsedFromReceipts = (receipts) => {
|
|
1714
1743
|
function resolveGasDependentCosts(byteSize, gasDependentCost) {
|
1715
1744
|
const base = (0, import_math5.bn)(gasDependentCost.base);
|
1716
1745
|
let dependentValue = (0, import_math5.bn)(0);
|
1717
|
-
if (
|
1746
|
+
if ("unitsPerGas" in gasDependentCost) {
|
1718
1747
|
dependentValue = (0, import_math5.bn)(byteSize).div((0, import_math5.bn)(gasDependentCost.unitsPerGas));
|
1719
|
-
}
|
1720
|
-
if (gasDependentCost.__typename === "HeavyOperation") {
|
1748
|
+
} else {
|
1721
1749
|
dependentValue = (0, import_math5.bn)(byteSize).mul((0, import_math5.bn)(gasDependentCost.gasPerUnit));
|
1722
1750
|
}
|
1723
1751
|
return base.add(dependentValue);
|
@@ -4073,9 +4101,11 @@ var _Provider = class {
|
|
4073
4101
|
static ensureClientVersionIsSupported(nodeInfo) {
|
4074
4102
|
const { isMajorSupported, isMinorSupported, supportedVersion } = (0, import_versions.checkFuelCoreVersionCompatibility)(nodeInfo.nodeVersion);
|
4075
4103
|
if (!isMajorSupported || !isMinorSupported) {
|
4076
|
-
|
4077
|
-
|
4078
|
-
|
4104
|
+
console.warn(
|
4105
|
+
`The Fuel Node that you are trying to connect to is using fuel-core version ${nodeInfo.nodeVersion},
|
4106
|
+
which is not supported by the version of the TS SDK that you are using.
|
4107
|
+
Things may not work as expected.
|
4108
|
+
Supported fuel-core version: ${supportedVersion}.`
|
4079
4109
|
);
|
4080
4110
|
}
|
4081
4111
|
}
|
@@ -4512,10 +4542,10 @@ var _Provider = class {
|
|
4512
4542
|
const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
|
4513
4543
|
const isScriptTransaction = txRequestClone.type === import_transactions19.TransactionType.Script;
|
4514
4544
|
const baseAssetId = this.getBaseAssetId();
|
4545
|
+
const updateMaxFee = txRequestClone.maxFee.eq(0);
|
4515
4546
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
4516
4547
|
const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
|
4517
4548
|
txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
|
4518
|
-
txRequestClone.maxFee = (0, import_math17.bn)(0);
|
4519
4549
|
if (isScriptTransaction) {
|
4520
4550
|
txRequestClone.gasLimit = (0, import_math17.bn)(0);
|
4521
4551
|
}
|
@@ -4530,6 +4560,7 @@ var _Provider = class {
|
|
4530
4560
|
addedSignatures = signedRequest.witnesses.length - lengthBefore;
|
4531
4561
|
}
|
4532
4562
|
await this.estimatePredicates(signedRequest);
|
4563
|
+
txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
|
4533
4564
|
let { maxFee, maxGas, minFee, minGas, gasPrice, gasLimit } = await this.estimateTxGasAndFee({
|
4534
4565
|
transactionRequest: signedRequest
|
4535
4566
|
});
|
@@ -4538,7 +4569,6 @@ var _Provider = class {
|
|
4538
4569
|
let missingContractIds = [];
|
4539
4570
|
let outputVariables = 0;
|
4540
4571
|
let gasUsed = (0, import_math17.bn)(0);
|
4541
|
-
txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
|
4542
4572
|
txRequestClone.maxFee = maxFee;
|
4543
4573
|
if (isScriptTransaction) {
|
4544
4574
|
txRequestClone.gasLimit = gasLimit;
|
@@ -4566,7 +4596,8 @@ var _Provider = class {
|
|
4566
4596
|
missingContractIds,
|
4567
4597
|
addedSignatures,
|
4568
4598
|
estimatedPredicates: txRequestClone.inputs,
|
4569
|
-
dryRunStatus
|
4599
|
+
dryRunStatus,
|
4600
|
+
updateMaxFee
|
4570
4601
|
};
|
4571
4602
|
}
|
4572
4603
|
async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
|
@@ -4639,7 +4670,7 @@ var _Provider = class {
|
|
4639
4670
|
};
|
4640
4671
|
const result = await this.operations.getCoinsToSpend(coinsQuery);
|
4641
4672
|
const coins = result.coinsToSpend.flat().map((coin) => {
|
4642
|
-
switch (coin.
|
4673
|
+
switch (coin.type) {
|
4643
4674
|
case "MessageCoin":
|
4644
4675
|
return {
|
4645
4676
|
amount: (0, import_math17.bn)(coin.amount),
|
@@ -5222,8 +5253,11 @@ function resolveIconPaths(assets2, basePath = "./") {
|
|
5222
5253
|
}));
|
5223
5254
|
}
|
5224
5255
|
|
5225
|
-
// src/providers/assets/
|
5226
|
-
var
|
5256
|
+
// src/providers/assets/utils/fuelAssetsBaseUrl.ts
|
5257
|
+
var fuelAssetsBaseUrl = "https://cdn.fuel.network/assets/";
|
5258
|
+
|
5259
|
+
// src/providers/assets/assets.ts
|
5260
|
+
var rawAssets = [
|
5227
5261
|
{
|
5228
5262
|
name: "Ethereum",
|
5229
5263
|
symbol: "ETH",
|
@@ -5254,6 +5288,7 @@ var assets = [
|
|
5254
5288
|
]
|
5255
5289
|
}
|
5256
5290
|
];
|
5291
|
+
var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
|
5257
5292
|
|
5258
5293
|
// src/providers/transaction-request/helpers.ts
|
5259
5294
|
var import_math19 = require("@fuel-ts/math");
|
@@ -5274,16 +5309,16 @@ var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filte
|
|
5274
5309
|
// src/utils/formatTransferToContractScriptData.ts
|
5275
5310
|
var import_abi_coder6 = require("@fuel-ts/abi-coder");
|
5276
5311
|
var import_math20 = require("@fuel-ts/math");
|
5277
|
-
var
|
5312
|
+
var import_utils27 = require("@fuel-ts/utils");
|
5278
5313
|
var asm = __toESM(require("@fuels/vm-asm"));
|
5279
5314
|
var formatTransferToContractScriptData = (params) => {
|
5280
5315
|
const { assetId, amountToTransfer, hexlifiedContractId } = params;
|
5281
5316
|
const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
|
5282
5317
|
const encoded = numberCoder.encode(new import_math20.BN(amountToTransfer).toNumber());
|
5283
5318
|
const scriptData = Uint8Array.from([
|
5284
|
-
...(0,
|
5319
|
+
...(0, import_utils27.arrayify)(hexlifiedContractId),
|
5285
5320
|
...encoded,
|
5286
|
-
...(0,
|
5321
|
+
...(0, import_utils27.arrayify)(assetId)
|
5287
5322
|
]);
|
5288
5323
|
return scriptData;
|
5289
5324
|
};
|
@@ -5463,18 +5498,18 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5463
5498
|
return balances;
|
5464
5499
|
}
|
5465
5500
|
/**
|
5466
|
-
*
|
5501
|
+
* Funds a transaction request by adding the necessary resources.
|
5467
5502
|
*
|
5468
|
-
* @
|
5469
|
-
* @param
|
5470
|
-
* @param
|
5471
|
-
* @returns
|
5503
|
+
* @typeParam T - The type of the TransactionRequest.
|
5504
|
+
* @param request - The transaction request to fund.
|
5505
|
+
* @param params - The estimated transaction parameters.
|
5506
|
+
* @returns The funded transaction request.
|
5472
5507
|
*/
|
5473
5508
|
async fund(request, params) {
|
5474
|
-
const { addedSignatures, estimatedPredicates,
|
5509
|
+
const { addedSignatures, estimatedPredicates, requiredQuantities, updateMaxFee } = params;
|
5510
|
+
const fee = request.maxFee;
|
5475
5511
|
const baseAssetId = this.provider.getBaseAssetId();
|
5476
5512
|
const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || (0, import_math21.bn)(0);
|
5477
|
-
const txRequest = request;
|
5478
5513
|
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
5479
5514
|
amount: (0, import_math21.bn)(fee),
|
5480
5515
|
assetId: baseAssetId,
|
@@ -5511,14 +5546,17 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5511
5546
|
cacheTxInputsFromOwner(request.inputs, this.address)
|
5512
5547
|
);
|
5513
5548
|
request.addResources(resources);
|
5514
|
-
|
5515
|
-
|
5516
|
-
const requestToReestimate2 = (0, import_ramda4.clone)(
|
5549
|
+
request.shiftPredicateData();
|
5550
|
+
request.updatePredicateGasUsed(estimatedPredicates);
|
5551
|
+
const requestToReestimate2 = (0, import_ramda4.clone)(request);
|
5517
5552
|
if (addedSignatures) {
|
5518
5553
|
Array.from({ length: addedSignatures }).forEach(
|
5519
5554
|
() => requestToReestimate2.addEmptyWitness()
|
5520
5555
|
);
|
5521
5556
|
}
|
5557
|
+
if (!updateMaxFee) {
|
5558
|
+
break;
|
5559
|
+
}
|
5522
5560
|
const { maxFee: newFee } = await this.provider.estimateTxGasAndFee({
|
5523
5561
|
transactionRequest: requestToReestimate2
|
5524
5562
|
});
|
@@ -5540,17 +5578,20 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5540
5578
|
}
|
5541
5579
|
fundingAttempts += 1;
|
5542
5580
|
}
|
5543
|
-
|
5544
|
-
|
5545
|
-
const requestToReestimate = (0, import_ramda4.clone)(
|
5581
|
+
request.shiftPredicateData();
|
5582
|
+
request.updatePredicateGasUsed(estimatedPredicates);
|
5583
|
+
const requestToReestimate = (0, import_ramda4.clone)(request);
|
5546
5584
|
if (addedSignatures) {
|
5547
5585
|
Array.from({ length: addedSignatures }).forEach(() => requestToReestimate.addEmptyWitness());
|
5548
5586
|
}
|
5587
|
+
if (!updateMaxFee) {
|
5588
|
+
return request;
|
5589
|
+
}
|
5549
5590
|
const { maxFee } = await this.provider.estimateTxGasAndFee({
|
5550
5591
|
transactionRequest: requestToReestimate
|
5551
5592
|
});
|
5552
|
-
|
5553
|
-
return
|
5593
|
+
request.maxFee = maxFee;
|
5594
|
+
return request;
|
5554
5595
|
}
|
5555
5596
|
/**
|
5556
5597
|
* A helper that creates a transfer transaction request and returns it.
|
@@ -5562,20 +5603,19 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5562
5603
|
* @returns A promise that resolves to the prepared transaction request.
|
5563
5604
|
*/
|
5564
5605
|
async createTransfer(destination, amount, assetId, txParams = {}) {
|
5565
|
-
|
5606
|
+
let request = new ScriptTransactionRequest(txParams);
|
5566
5607
|
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
5567
5608
|
request.addCoinOutput(import_address4.Address.fromAddressOrString(destination), amount, assetIdToTransfer);
|
5568
5609
|
const txCost = await this.provider.getTransactionCost(request, {
|
5569
5610
|
estimateTxDependencies: true,
|
5570
5611
|
resourcesOwner: this
|
5571
5612
|
});
|
5572
|
-
this.validateGasLimitAndMaxFee({
|
5613
|
+
request = this.validateGasLimitAndMaxFee({
|
5614
|
+
transactionRequest: request,
|
5573
5615
|
gasUsed: txCost.gasUsed,
|
5574
5616
|
maxFee: txCost.maxFee,
|
5575
5617
|
txParams
|
5576
5618
|
});
|
5577
|
-
request.gasLimit = txCost.gasUsed;
|
5578
|
-
request.maxFee = txCost.maxFee;
|
5579
5619
|
await this.fund(request, txCost);
|
5580
5620
|
return request;
|
5581
5621
|
}
|
@@ -5622,7 +5662,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5622
5662
|
amountToTransfer: (0, import_math21.bn)(amount),
|
5623
5663
|
assetId: assetIdToTransfer
|
5624
5664
|
});
|
5625
|
-
|
5665
|
+
let request = new ScriptTransactionRequest({
|
5626
5666
|
...txParams,
|
5627
5667
|
script,
|
5628
5668
|
scriptData
|
@@ -5632,13 +5672,12 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5632
5672
|
resourcesOwner: this,
|
5633
5673
|
quantitiesToContract: [{ amount: (0, import_math21.bn)(amount), assetId: String(assetIdToTransfer) }]
|
5634
5674
|
});
|
5635
|
-
this.validateGasLimitAndMaxFee({
|
5675
|
+
request = this.validateGasLimitAndMaxFee({
|
5676
|
+
transactionRequest: request,
|
5636
5677
|
gasUsed: txCost.gasUsed,
|
5637
5678
|
maxFee: txCost.maxFee,
|
5638
5679
|
txParams
|
5639
5680
|
});
|
5640
|
-
request.gasLimit = txCost.gasUsed;
|
5641
|
-
request.maxFee = txCost.maxFee;
|
5642
5681
|
await this.fund(request, txCost);
|
5643
5682
|
return this.sendTransaction(request);
|
5644
5683
|
}
|
@@ -5652,29 +5691,28 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5652
5691
|
*/
|
5653
5692
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
5654
5693
|
const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
|
5655
|
-
const recipientDataArray = (0,
|
5694
|
+
const recipientDataArray = (0, import_utils28.arrayify)(
|
5656
5695
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
5657
5696
|
);
|
5658
|
-
const amountDataArray = (0,
|
5697
|
+
const amountDataArray = (0, import_utils28.arrayify)(
|
5659
5698
|
"0x".concat((0, import_math21.bn)(amount).toHex().substring(2).padStart(16, "0"))
|
5660
5699
|
);
|
5661
5700
|
const script = new Uint8Array([
|
5662
|
-
...(0,
|
5701
|
+
...(0, import_utils28.arrayify)(withdrawScript.bytes),
|
5663
5702
|
...recipientDataArray,
|
5664
5703
|
...amountDataArray
|
5665
5704
|
]);
|
5666
5705
|
const params = { script, ...txParams };
|
5667
5706
|
const baseAssetId = this.provider.getBaseAssetId();
|
5668
|
-
|
5707
|
+
let request = new ScriptTransactionRequest(params);
|
5669
5708
|
const quantitiesToContract = [{ amount: (0, import_math21.bn)(amount), assetId: baseAssetId }];
|
5670
5709
|
const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
|
5671
|
-
this.validateGasLimitAndMaxFee({
|
5710
|
+
request = this.validateGasLimitAndMaxFee({
|
5711
|
+
transactionRequest: request,
|
5672
5712
|
gasUsed: txCost.gasUsed,
|
5673
5713
|
maxFee: txCost.maxFee,
|
5674
5714
|
txParams
|
5675
5715
|
});
|
5676
|
-
request.maxFee = txCost.maxFee;
|
5677
|
-
request.gasLimit = txCost.gasUsed;
|
5678
5716
|
await this.fund(request, txCost);
|
5679
5717
|
return this.sendTransaction(request);
|
5680
5718
|
}
|
@@ -5734,35 +5772,42 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5734
5772
|
return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
|
5735
5773
|
}
|
5736
5774
|
validateGasLimitAndMaxFee({
|
5737
|
-
txParams: { gasLimit: setGasLimit, maxFee: setMaxFee },
|
5738
5775
|
gasUsed,
|
5739
|
-
maxFee
|
5776
|
+
maxFee,
|
5777
|
+
transactionRequest,
|
5778
|
+
txParams: { gasLimit: setGasLimit, maxFee: setMaxFee }
|
5740
5779
|
}) {
|
5741
|
-
|
5780
|
+
const request = transactionRequestify(transactionRequest);
|
5781
|
+
if (!(0, import_utils28.isDefined)(setGasLimit)) {
|
5782
|
+
request.gasLimit = gasUsed;
|
5783
|
+
} else if (gasUsed.gt(setGasLimit)) {
|
5742
5784
|
throw new import_errors16.FuelError(
|
5743
5785
|
import_errors16.ErrorCode.GAS_LIMIT_TOO_LOW,
|
5744
5786
|
`Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
|
5745
5787
|
);
|
5746
5788
|
}
|
5747
|
-
if ((0,
|
5789
|
+
if (!(0, import_utils28.isDefined)(setMaxFee)) {
|
5790
|
+
request.maxFee = maxFee;
|
5791
|
+
} else if (maxFee.gt(setMaxFee)) {
|
5748
5792
|
throw new import_errors16.FuelError(
|
5749
5793
|
import_errors16.ErrorCode.MAX_FEE_TOO_LOW,
|
5750
5794
|
`Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
|
5751
5795
|
);
|
5752
5796
|
}
|
5797
|
+
return request;
|
5753
5798
|
}
|
5754
5799
|
};
|
5755
5800
|
|
5756
5801
|
// src/wallet/base-wallet-unlocked.ts
|
5757
5802
|
var import_hasher3 = require("@fuel-ts/hasher");
|
5758
|
-
var
|
5803
|
+
var import_utils31 = require("@fuel-ts/utils");
|
5759
5804
|
|
5760
5805
|
// src/signer/signer.ts
|
5761
5806
|
var import_address5 = require("@fuel-ts/address");
|
5762
5807
|
var import_crypto2 = require("@fuel-ts/crypto");
|
5763
5808
|
var import_hasher2 = require("@fuel-ts/hasher");
|
5764
5809
|
var import_math22 = require("@fuel-ts/math");
|
5765
|
-
var
|
5810
|
+
var import_utils29 = require("@fuel-ts/utils");
|
5766
5811
|
var import_secp256k1 = require("@noble/curves/secp256k1");
|
5767
5812
|
var Signer = class {
|
5768
5813
|
address;
|
@@ -5782,9 +5827,9 @@ var Signer = class {
|
|
5782
5827
|
}
|
5783
5828
|
}
|
5784
5829
|
const privateKeyBytes = (0, import_math22.toBytes)(privateKey, 32);
|
5785
|
-
this.privateKey = (0,
|
5786
|
-
this.publicKey = (0,
|
5787
|
-
this.compressedPublicKey = (0,
|
5830
|
+
this.privateKey = (0, import_utils29.hexlify)(privateKeyBytes);
|
5831
|
+
this.publicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
|
5832
|
+
this.compressedPublicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
|
5788
5833
|
this.address = import_address5.Address.fromPublicKey(this.publicKey);
|
5789
5834
|
}
|
5790
5835
|
/**
|
@@ -5798,11 +5843,11 @@ var Signer = class {
|
|
5798
5843
|
* @returns hashed signature
|
5799
5844
|
*/
|
5800
5845
|
sign(data) {
|
5801
|
-
const signature = import_secp256k1.secp256k1.sign((0,
|
5846
|
+
const signature = import_secp256k1.secp256k1.sign((0, import_utils29.arrayify)(data), (0, import_utils29.arrayify)(this.privateKey));
|
5802
5847
|
const r = (0, import_math22.toBytes)(`0x${signature.r.toString(16)}`, 32);
|
5803
5848
|
const s = (0, import_math22.toBytes)(`0x${signature.s.toString(16)}`, 32);
|
5804
5849
|
s[0] |= (signature.recovery || 0) << 7;
|
5805
|
-
return (0,
|
5850
|
+
return (0, import_utils29.hexlify)((0, import_utils29.concat)([r, s]));
|
5806
5851
|
}
|
5807
5852
|
/**
|
5808
5853
|
* Add point on the current elliptic curve
|
@@ -5811,8 +5856,8 @@ var Signer = class {
|
|
5811
5856
|
* @returns compressed point on the curve
|
5812
5857
|
*/
|
5813
5858
|
addPoint(point) {
|
5814
|
-
const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0,
|
5815
|
-
const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0,
|
5859
|
+
const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(this.compressedPublicKey));
|
5860
|
+
const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(point));
|
5816
5861
|
const result = p0.add(p1);
|
5817
5862
|
return `0x${result.toHex(true)}`;
|
5818
5863
|
}
|
@@ -5824,16 +5869,16 @@ var Signer = class {
|
|
5824
5869
|
* @returns public key from signature from the
|
5825
5870
|
*/
|
5826
5871
|
static recoverPublicKey(data, signature) {
|
5827
|
-
const signedMessageBytes = (0,
|
5872
|
+
const signedMessageBytes = (0, import_utils29.arrayify)(signature);
|
5828
5873
|
const r = signedMessageBytes.slice(0, 32);
|
5829
5874
|
const s = signedMessageBytes.slice(32, 64);
|
5830
5875
|
const recoveryParam = (s[0] & 128) >> 7;
|
5831
5876
|
s[0] &= 127;
|
5832
|
-
const sig = new import_secp256k1.secp256k1.Signature(BigInt((0,
|
5877
|
+
const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils29.hexlify)(r)), BigInt((0, import_utils29.hexlify)(s))).addRecoveryBit(
|
5833
5878
|
recoveryParam
|
5834
5879
|
);
|
5835
|
-
const publicKey = sig.recoverPublicKey((0,
|
5836
|
-
return (0,
|
5880
|
+
const publicKey = sig.recoverPublicKey((0, import_utils29.arrayify)(data)).toRawBytes(false).slice(1);
|
5881
|
+
return (0, import_utils29.hexlify)(publicKey);
|
5837
5882
|
}
|
5838
5883
|
/**
|
5839
5884
|
* Recover the address from a signature performed with [`sign`](#sign).
|
@@ -5852,7 +5897,7 @@ var Signer = class {
|
|
5852
5897
|
* @returns random 32-byte hashed
|
5853
5898
|
*/
|
5854
5899
|
static generatePrivateKey(entropy) {
|
5855
|
-
return entropy ? (0, import_hasher2.hash)((0,
|
5900
|
+
return entropy ? (0, import_hasher2.hash)((0, import_utils29.concat)([(0, import_crypto2.randomBytes)(32), (0, import_utils29.arrayify)(entropy)])) : (0, import_crypto2.randomBytes)(32);
|
5856
5901
|
}
|
5857
5902
|
/**
|
5858
5903
|
* Extended publicKey from a compact publicKey
|
@@ -5861,8 +5906,8 @@ var Signer = class {
|
|
5861
5906
|
* @returns extended publicKey
|
5862
5907
|
*/
|
5863
5908
|
static extendPublicKey(publicKey) {
|
5864
|
-
const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0,
|
5865
|
-
return (0,
|
5909
|
+
const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(publicKey));
|
5910
|
+
return (0, import_utils29.hexlify)(point.toRawBytes(false).slice(1));
|
5866
5911
|
}
|
5867
5912
|
};
|
5868
5913
|
|
@@ -5870,7 +5915,7 @@ var Signer = class {
|
|
5870
5915
|
var import_address6 = require("@fuel-ts/address");
|
5871
5916
|
var import_crypto3 = require("@fuel-ts/crypto");
|
5872
5917
|
var import_errors17 = require("@fuel-ts/errors");
|
5873
|
-
var
|
5918
|
+
var import_utils30 = require("@fuel-ts/utils");
|
5874
5919
|
var import_uuid = require("uuid");
|
5875
5920
|
var DEFAULT_KDF_PARAMS_LOG_N = 13;
|
5876
5921
|
var DEFAULT_KDF_PARAMS_R = 8;
|
@@ -5953,7 +5998,7 @@ async function decryptKeystoreWallet(jsonWallet, password) {
|
|
5953
5998
|
);
|
5954
5999
|
}
|
5955
6000
|
const buffer = await (0, import_crypto3.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
|
5956
|
-
const privateKey = (0,
|
6001
|
+
const privateKey = (0, import_utils30.hexlify)(buffer);
|
5957
6002
|
return privateKey;
|
5958
6003
|
}
|
5959
6004
|
|
@@ -5998,7 +6043,7 @@ var BaseWalletUnlocked = class extends Account {
|
|
5998
6043
|
*/
|
5999
6044
|
async signMessage(message) {
|
6000
6045
|
const signedMessage = await this.signer().sign((0, import_hasher3.hashMessage)(message));
|
6001
|
-
return (0,
|
6046
|
+
return (0, import_utils31.hexlify)(signedMessage);
|
6002
6047
|
}
|
6003
6048
|
/**
|
6004
6049
|
* Signs a transaction with the wallet's private key.
|
@@ -6011,7 +6056,7 @@ var BaseWalletUnlocked = class extends Account {
|
|
6011
6056
|
const chainId = this.provider.getChainId();
|
6012
6057
|
const hashedTransaction = transactionRequest.getTransactionId(chainId);
|
6013
6058
|
const signature = await this.signer().sign(hashedTransaction);
|
6014
|
-
return (0,
|
6059
|
+
return (0, import_utils31.hexlify)(signature);
|
6015
6060
|
}
|
6016
6061
|
/**
|
6017
6062
|
* Populates a transaction with the witnesses signature.
|
@@ -6073,14 +6118,14 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
|
|
6073
6118
|
var import_errors20 = require("@fuel-ts/errors");
|
6074
6119
|
var import_hasher6 = require("@fuel-ts/hasher");
|
6075
6120
|
var import_math23 = require("@fuel-ts/math");
|
6076
|
-
var
|
6121
|
+
var import_utils35 = require("@fuel-ts/utils");
|
6077
6122
|
var import_ethers2 = require("ethers");
|
6078
6123
|
|
6079
6124
|
// src/mnemonic/mnemonic.ts
|
6080
6125
|
var import_crypto4 = require("@fuel-ts/crypto");
|
6081
6126
|
var import_errors19 = require("@fuel-ts/errors");
|
6082
6127
|
var import_hasher5 = require("@fuel-ts/hasher");
|
6083
|
-
var
|
6128
|
+
var import_utils33 = require("@fuel-ts/utils");
|
6084
6129
|
var import_ethers = require("ethers");
|
6085
6130
|
|
6086
6131
|
// src/wordlists/words/english.ts
|
@@ -8144,7 +8189,7 @@ var Language = /* @__PURE__ */ ((Language2) => {
|
|
8144
8189
|
// src/mnemonic/utils.ts
|
8145
8190
|
var import_errors18 = require("@fuel-ts/errors");
|
8146
8191
|
var import_hasher4 = require("@fuel-ts/hasher");
|
8147
|
-
var
|
8192
|
+
var import_utils32 = require("@fuel-ts/utils");
|
8148
8193
|
function toUtf8Bytes(stri) {
|
8149
8194
|
const str = stri.normalize("NFKD");
|
8150
8195
|
const result = [];
|
@@ -8211,14 +8256,14 @@ function entropyToMnemonicIndices(entropy) {
|
|
8211
8256
|
}
|
8212
8257
|
}
|
8213
8258
|
const checksumBits = entropy.length / 4;
|
8214
|
-
const checksum = (0,
|
8259
|
+
const checksum = (0, import_utils32.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
|
8215
8260
|
indices[indices.length - 1] <<= checksumBits;
|
8216
8261
|
indices[indices.length - 1] |= checksum >> 8 - checksumBits;
|
8217
8262
|
return indices;
|
8218
8263
|
}
|
8219
8264
|
function mnemonicWordsToEntropy(words, wordlist) {
|
8220
8265
|
const size = Math.ceil(11 * words.length / 8);
|
8221
|
-
const entropy = (0,
|
8266
|
+
const entropy = (0, import_utils32.arrayify)(new Uint8Array(size));
|
8222
8267
|
let offset = 0;
|
8223
8268
|
for (let i = 0; i < words.length; i += 1) {
|
8224
8269
|
const index = wordlist.indexOf(words[i].normalize("NFKD"));
|
@@ -8238,7 +8283,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
|
|
8238
8283
|
const entropyBits = 32 * words.length / 3;
|
8239
8284
|
const checksumBits = words.length / 3;
|
8240
8285
|
const checksumMask = getUpperMask(checksumBits);
|
8241
|
-
const checksum = (0,
|
8286
|
+
const checksum = (0, import_utils32.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
|
8242
8287
|
if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
|
8243
8288
|
throw new import_errors18.FuelError(
|
8244
8289
|
import_errors18.ErrorCode.INVALID_CHECKSUM,
|
@@ -8313,7 +8358,7 @@ var Mnemonic = class {
|
|
8313
8358
|
static mnemonicToEntropy(phrase, wordlist = english) {
|
8314
8359
|
const words = getWords(phrase);
|
8315
8360
|
assertMnemonic(words);
|
8316
|
-
return (0,
|
8361
|
+
return (0, import_utils33.hexlify)(mnemonicWordsToEntropy(words, wordlist));
|
8317
8362
|
}
|
8318
8363
|
/**
|
8319
8364
|
* @param entropy - Entropy source to the mnemonic phrase.
|
@@ -8321,7 +8366,7 @@ var Mnemonic = class {
|
|
8321
8366
|
* @returns 64-byte array contains privateKey and chainCode as described on BIP39
|
8322
8367
|
*/
|
8323
8368
|
static entropyToMnemonic(entropy, wordlist = english) {
|
8324
|
-
const entropyBytes = (0,
|
8369
|
+
const entropyBytes = (0, import_utils33.arrayify)(entropy);
|
8325
8370
|
assertWordList(wordlist);
|
8326
8371
|
assertEntropy(entropyBytes);
|
8327
8372
|
return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
|
@@ -8390,14 +8435,14 @@ var Mnemonic = class {
|
|
8390
8435
|
* @returns 64-byte array contains privateKey and chainCode as described on BIP39
|
8391
8436
|
*/
|
8392
8437
|
static masterKeysFromSeed(seed) {
|
8393
|
-
const seedArray = (0,
|
8438
|
+
const seedArray = (0, import_utils33.arrayify)(seed);
|
8394
8439
|
if (seedArray.length < 16 || seedArray.length > 64) {
|
8395
8440
|
throw new import_errors19.FuelError(
|
8396
8441
|
import_errors19.ErrorCode.INVALID_SEED,
|
8397
8442
|
`Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
|
8398
8443
|
);
|
8399
8444
|
}
|
8400
|
-
return (0,
|
8445
|
+
return (0, import_utils33.arrayify)((0, import_ethers.computeHmac)("sha512", MasterSecret, seedArray));
|
8401
8446
|
}
|
8402
8447
|
/**
|
8403
8448
|
* Get the extendKey as defined on BIP-32 from the provided seed
|
@@ -8408,22 +8453,22 @@ var Mnemonic = class {
|
|
8408
8453
|
*/
|
8409
8454
|
static seedToExtendedKey(seed, testnet = false) {
|
8410
8455
|
const masterKey = Mnemonic.masterKeysFromSeed(seed);
|
8411
|
-
const prefix = (0,
|
8456
|
+
const prefix = (0, import_utils33.arrayify)(testnet ? TestnetPRV : MainnetPRV);
|
8412
8457
|
const depth = "0x00";
|
8413
8458
|
const fingerprint = "0x00000000";
|
8414
8459
|
const index = "0x00000000";
|
8415
8460
|
const chainCode = masterKey.slice(32);
|
8416
8461
|
const privateKey = masterKey.slice(0, 32);
|
8417
|
-
const extendedKey = (0,
|
8462
|
+
const extendedKey = (0, import_utils33.concat)([
|
8418
8463
|
prefix,
|
8419
8464
|
depth,
|
8420
8465
|
fingerprint,
|
8421
8466
|
index,
|
8422
8467
|
chainCode,
|
8423
|
-
(0,
|
8468
|
+
(0, import_utils33.concat)(["0x00", privateKey])
|
8424
8469
|
]);
|
8425
8470
|
const checksum = (0, import_ethers.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
|
8426
|
-
return (0, import_ethers.encodeBase58)((0,
|
8471
|
+
return (0, import_ethers.encodeBase58)((0, import_utils33.concat)([extendedKey, checksum]));
|
8427
8472
|
}
|
8428
8473
|
/**
|
8429
8474
|
* Create a new mnemonic using a randomly generated number as entropy.
|
@@ -8438,7 +8483,7 @@ var Mnemonic = class {
|
|
8438
8483
|
* @returns A randomly generated mnemonic
|
8439
8484
|
*/
|
8440
8485
|
static generate(size = 32, extraEntropy = "") {
|
8441
|
-
const entropy = extraEntropy ? (0, import_hasher5.sha256)((0,
|
8486
|
+
const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils33.concat)([(0, import_crypto4.randomBytes)(size), (0, import_utils33.arrayify)(extraEntropy)])) : (0, import_crypto4.randomBytes)(size);
|
8442
8487
|
return Mnemonic.entropyToMnemonic(entropy);
|
8443
8488
|
}
|
8444
8489
|
};
|
@@ -8446,12 +8491,12 @@ var mnemonic_default = Mnemonic;
|
|
8446
8491
|
|
8447
8492
|
// src/hdwallet/hdwallet.ts
|
8448
8493
|
var HARDENED_INDEX = 2147483648;
|
8449
|
-
var MainnetPRV2 = (0,
|
8450
|
-
var MainnetPUB = (0,
|
8451
|
-
var TestnetPRV2 = (0,
|
8452
|
-
var TestnetPUB = (0,
|
8494
|
+
var MainnetPRV2 = (0, import_utils35.hexlify)("0x0488ade4");
|
8495
|
+
var MainnetPUB = (0, import_utils35.hexlify)("0x0488b21e");
|
8496
|
+
var TestnetPRV2 = (0, import_utils35.hexlify)("0x04358394");
|
8497
|
+
var TestnetPUB = (0, import_utils35.hexlify)("0x043587cf");
|
8453
8498
|
function base58check(data) {
|
8454
|
-
return (0, import_ethers2.encodeBase58)((0,
|
8499
|
+
return (0, import_ethers2.encodeBase58)((0, import_utils35.concat)([data, (0, import_ethers2.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
|
8455
8500
|
}
|
8456
8501
|
function getExtendedKeyPrefix(isPublic = false, testnet = false) {
|
8457
8502
|
if (isPublic) {
|
@@ -8460,11 +8505,11 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
|
|
8460
8505
|
return testnet ? TestnetPRV2 : MainnetPRV2;
|
8461
8506
|
}
|
8462
8507
|
function isPublicExtendedKey(extendedKey) {
|
8463
|
-
return [MainnetPUB, TestnetPUB].includes((0,
|
8508
|
+
return [MainnetPUB, TestnetPUB].includes((0, import_utils35.hexlify)(extendedKey.slice(0, 4)));
|
8464
8509
|
}
|
8465
8510
|
function isValidExtendedKey(extendedKey) {
|
8466
8511
|
return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
|
8467
|
-
(0,
|
8512
|
+
(0, import_utils35.hexlify)(extendedKey.slice(0, 4))
|
8468
8513
|
);
|
8469
8514
|
}
|
8470
8515
|
function parsePath(path, depth = 0) {
|
@@ -8482,8 +8527,8 @@ function parsePath(path, depth = 0) {
|
|
8482
8527
|
var HDWallet = class {
|
8483
8528
|
depth = 0;
|
8484
8529
|
index = 0;
|
8485
|
-
fingerprint = (0,
|
8486
|
-
parentFingerprint = (0,
|
8530
|
+
fingerprint = (0, import_utils35.hexlify)("0x00000000");
|
8531
|
+
parentFingerprint = (0, import_utils35.hexlify)("0x00000000");
|
8487
8532
|
privateKey;
|
8488
8533
|
publicKey;
|
8489
8534
|
chainCode;
|
@@ -8495,8 +8540,8 @@ var HDWallet = class {
|
|
8495
8540
|
constructor(config) {
|
8496
8541
|
if (config.privateKey) {
|
8497
8542
|
const signer = new Signer(config.privateKey);
|
8498
|
-
this.publicKey = (0,
|
8499
|
-
this.privateKey = (0,
|
8543
|
+
this.publicKey = (0, import_utils35.hexlify)(signer.compressedPublicKey);
|
8544
|
+
this.privateKey = (0, import_utils35.hexlify)(config.privateKey);
|
8500
8545
|
} else {
|
8501
8546
|
if (!config.publicKey) {
|
8502
8547
|
throw new import_errors20.FuelError(
|
@@ -8504,7 +8549,7 @@ var HDWallet = class {
|
|
8504
8549
|
"Both public and private Key cannot be missing. At least one should be provided."
|
8505
8550
|
);
|
8506
8551
|
}
|
8507
|
-
this.publicKey = (0,
|
8552
|
+
this.publicKey = (0, import_utils35.hexlify)(config.publicKey);
|
8508
8553
|
}
|
8509
8554
|
this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
|
8510
8555
|
this.fingerprint = (0, import_ethers2.dataSlice)((0, import_ethers2.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
|
@@ -8523,9 +8568,9 @@ var HDWallet = class {
|
|
8523
8568
|
* @returns A new instance of HDWallet on the derived index
|
8524
8569
|
*/
|
8525
8570
|
deriveIndex(index) {
|
8526
|
-
const privateKey = this.privateKey && (0,
|
8527
|
-
const publicKey = (0,
|
8528
|
-
const chainCode = (0,
|
8571
|
+
const privateKey = this.privateKey && (0, import_utils35.arrayify)(this.privateKey);
|
8572
|
+
const publicKey = (0, import_utils35.arrayify)(this.publicKey);
|
8573
|
+
const chainCode = (0, import_utils35.arrayify)(this.chainCode);
|
8529
8574
|
const data = new Uint8Array(37);
|
8530
8575
|
if (index & HARDENED_INDEX) {
|
8531
8576
|
if (!privateKey) {
|
@@ -8536,10 +8581,10 @@ var HDWallet = class {
|
|
8536
8581
|
}
|
8537
8582
|
data.set(privateKey, 1);
|
8538
8583
|
} else {
|
8539
|
-
data.set((0,
|
8584
|
+
data.set((0, import_utils35.arrayify)(this.publicKey));
|
8540
8585
|
}
|
8541
8586
|
data.set((0, import_math23.toBytes)(index, 4), 33);
|
8542
|
-
const bytes = (0,
|
8587
|
+
const bytes = (0, import_utils35.arrayify)((0, import_ethers2.computeHmac)("sha512", chainCode, data));
|
8543
8588
|
const IL = bytes.slice(0, 32);
|
8544
8589
|
const IR = bytes.slice(32);
|
8545
8590
|
if (privateKey) {
|
@@ -8553,7 +8598,7 @@ var HDWallet = class {
|
|
8553
8598
|
parentFingerprint: this.fingerprint
|
8554
8599
|
});
|
8555
8600
|
}
|
8556
|
-
const signer = new Signer((0,
|
8601
|
+
const signer = new Signer((0, import_utils35.hexlify)(IL));
|
8557
8602
|
const Ki = signer.addPoint(publicKey);
|
8558
8603
|
return new HDWallet({
|
8559
8604
|
publicKey: Ki,
|
@@ -8588,12 +8633,12 @@ var HDWallet = class {
|
|
8588
8633
|
);
|
8589
8634
|
}
|
8590
8635
|
const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
|
8591
|
-
const depth = (0,
|
8636
|
+
const depth = (0, import_utils35.hexlify)(Uint8Array.from([this.depth]));
|
8592
8637
|
const parentFingerprint = this.parentFingerprint;
|
8593
8638
|
const index = (0, import_math23.toHex)(this.index, 4);
|
8594
8639
|
const chainCode = this.chainCode;
|
8595
|
-
const key = this.privateKey != null && !isPublic ? (0,
|
8596
|
-
const extendedKey = (0,
|
8640
|
+
const key = this.privateKey != null && !isPublic ? (0, import_utils35.concat)(["0x00", this.privateKey]) : this.publicKey;
|
8641
|
+
const extendedKey = (0, import_utils35.arrayify)((0, import_utils35.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
|
8597
8642
|
return base58check(extendedKey);
|
8598
8643
|
}
|
8599
8644
|
/**
|
@@ -8605,13 +8650,13 @@ var HDWallet = class {
|
|
8605
8650
|
static fromSeed(seed) {
|
8606
8651
|
const masterKey = mnemonic_default.masterKeysFromSeed(seed);
|
8607
8652
|
return new HDWallet({
|
8608
|
-
chainCode: (0,
|
8609
|
-
privateKey: (0,
|
8653
|
+
chainCode: (0, import_utils35.arrayify)(masterKey.slice(32)),
|
8654
|
+
privateKey: (0, import_utils35.arrayify)(masterKey.slice(0, 32))
|
8610
8655
|
});
|
8611
8656
|
}
|
8612
8657
|
static fromExtendedKey(extendedKey) {
|
8613
8658
|
const decoded = (0, import_ethers2.toBeHex)((0, import_ethers2.decodeBase58)(extendedKey));
|
8614
|
-
const bytes = (0,
|
8659
|
+
const bytes = (0, import_utils35.arrayify)(decoded);
|
8615
8660
|
const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
|
8616
8661
|
if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
|
8617
8662
|
throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
|
@@ -8620,9 +8665,9 @@ var HDWallet = class {
|
|
8620
8665
|
throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
|
8621
8666
|
}
|
8622
8667
|
const depth = bytes[4];
|
8623
|
-
const parentFingerprint = (0,
|
8624
|
-
const index = parseInt((0,
|
8625
|
-
const chainCode = (0,
|
8668
|
+
const parentFingerprint = (0, import_utils35.hexlify)(bytes.slice(5, 9));
|
8669
|
+
const index = parseInt((0, import_utils35.hexlify)(bytes.slice(9, 13)).substring(2), 16);
|
8670
|
+
const chainCode = (0, import_utils35.hexlify)(bytes.slice(13, 45));
|
8626
8671
|
const key = bytes.slice(45, 78);
|
8627
8672
|
if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
|
8628
8673
|
throw new import_errors20.FuelError(
|
@@ -9227,18 +9272,18 @@ var import_abi_coder7 = require("@fuel-ts/abi-coder");
|
|
9227
9272
|
var import_address10 = require("@fuel-ts/address");
|
9228
9273
|
var import_errors25 = require("@fuel-ts/errors");
|
9229
9274
|
var import_transactions22 = require("@fuel-ts/transactions");
|
9230
|
-
var
|
9275
|
+
var import_utils37 = require("@fuel-ts/utils");
|
9231
9276
|
|
9232
9277
|
// src/predicate/utils/getPredicateRoot.ts
|
9233
9278
|
var import_hasher7 = require("@fuel-ts/hasher");
|
9234
9279
|
var import_merkle = require("@fuel-ts/merkle");
|
9235
|
-
var
|
9280
|
+
var import_utils36 = require("@fuel-ts/utils");
|
9236
9281
|
var getPredicateRoot = (bytecode) => {
|
9237
9282
|
const chunkSize = 16 * 1024;
|
9238
|
-
const bytes = (0,
|
9239
|
-
const chunks = (0,
|
9240
|
-
const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0,
|
9241
|
-
const predicateRoot = (0, import_hasher7.hash)((0,
|
9283
|
+
const bytes = (0, import_utils36.arrayify)(bytecode);
|
9284
|
+
const chunks = (0, import_utils36.chunkAndPadBytes)(bytes, chunkSize);
|
9285
|
+
const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0, import_utils36.hexlify)(c)));
|
9286
|
+
const predicateRoot = (0, import_hasher7.hash)((0, import_utils36.concat)(["0x4655454C", codeRoot]));
|
9242
9287
|
return predicateRoot;
|
9243
9288
|
};
|
9244
9289
|
|
@@ -9286,9 +9331,9 @@ var Predicate = class extends Account {
|
|
9286
9331
|
const request = transactionRequestify(transactionRequestLike);
|
9287
9332
|
const { policies } = BaseTransactionRequest.getPolicyMeta(request);
|
9288
9333
|
request.inputs?.forEach((input) => {
|
9289
|
-
if (input.type === import_transactions22.InputType.Coin && (0,
|
9290
|
-
input.predicate = (0,
|
9291
|
-
input.predicateData = (0,
|
9334
|
+
if (input.type === import_transactions22.InputType.Coin && (0, import_utils37.hexlify)(input.owner) === this.address.toB256()) {
|
9335
|
+
input.predicate = (0, import_utils37.hexlify)(this.bytes);
|
9336
|
+
input.predicateData = (0, import_utils37.hexlify)(this.getPredicateData(policies.length));
|
9292
9337
|
}
|
9293
9338
|
});
|
9294
9339
|
return request;
|
@@ -9334,7 +9379,7 @@ var Predicate = class extends Account {
|
|
9334
9379
|
* @returns An object containing the new predicate bytes and interface.
|
9335
9380
|
*/
|
9336
9381
|
static processPredicateData(bytes, jsonAbi, configurableConstants) {
|
9337
|
-
let predicateBytes = (0,
|
9382
|
+
let predicateBytes = (0, import_utils37.arrayify)(bytes);
|
9338
9383
|
let abiInterface;
|
9339
9384
|
if (jsonAbi) {
|
9340
9385
|
abiInterface = new import_abi_coder7.Interface(jsonAbi);
|
@@ -9372,8 +9417,8 @@ var Predicate = class extends Account {
|
|
9372
9417
|
);
|
9373
9418
|
return resources.map((resource) => ({
|
9374
9419
|
...resource,
|
9375
|
-
predicate: (0,
|
9376
|
-
padPredicateData: (policiesLength) => (0,
|
9420
|
+
predicate: (0, import_utils37.hexlify)(this.bytes),
|
9421
|
+
padPredicateData: (policiesLength) => (0, import_utils37.hexlify)(this.getPredicateData(policiesLength))
|
9377
9422
|
}));
|
9378
9423
|
}
|
9379
9424
|
/**
|
@@ -10146,6 +10191,7 @@ __publicField(Fuel, "defaultConfig", {});
|
|
10146
10191
|
extractBurnedAssetsFromReceipts,
|
10147
10192
|
extractMintedAssetsFromReceipts,
|
10148
10193
|
extractTxError,
|
10194
|
+
fuelAssetsBaseUrl,
|
10149
10195
|
gasUsedByInputs,
|
10150
10196
|
getAssetEth,
|
10151
10197
|
getAssetFuel,
|
@@ -10204,6 +10250,7 @@ __publicField(Fuel, "defaultConfig", {});
|
|
10204
10250
|
outputify,
|
10205
10251
|
processGqlReceipt,
|
10206
10252
|
processGraphqlStatus,
|
10253
|
+
rawAssets,
|
10207
10254
|
resolveGasDependentCosts,
|
10208
10255
|
resolveIconPaths,
|
10209
10256
|
returnZeroScript,
|