@fuel-ts/account 0.94.8 → 0.95.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.
- package/dist/index.global.js +721 -702
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +204 -231
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +205 -233
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +9 -1
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +264 -1421
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +10 -9
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts +2 -2
- package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/upload-transaction-request.d.ts +2 -3
- package/dist/providers/transaction-request/upload-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-summary/types.d.ts +16 -0
- package/dist/providers/transaction-summary/types.d.ts.map +1 -1
- package/dist/test-utils.global.js +696 -700
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +177 -229
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +178 -230
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -16
package/dist/index.mjs
CHANGED
@@ -79,7 +79,7 @@ import { ErrorCode as ErrorCode14, FuelError as FuelError16 } from "@fuel-ts/err
|
|
79
79
|
import { BN as BN2, bn as bn17 } from "@fuel-ts/math";
|
80
80
|
import { InputType as InputType7, InputMessageCoder as InputMessageCoder2, TransactionCoder as TransactionCoder5 } from "@fuel-ts/transactions";
|
81
81
|
import { arrayify as arrayify12, hexlify as hexlify15, DateTime as DateTime2, isDefined as isDefined2 } from "@fuel-ts/utils";
|
82
|
-
import { checkFuelCoreVersionCompatibility } from "@fuel-ts/versions";
|
82
|
+
import { checkFuelCoreVersionCompatibility, versions } from "@fuel-ts/versions";
|
83
83
|
import { equalBytes } from "@noble/curves/abstract/utils";
|
84
84
|
import { GraphQLClient } from "graphql-request";
|
85
85
|
import gql2 from "graphql-tag";
|
@@ -322,6 +322,26 @@ var DryRunTransactionExecutionStatusFragmentDoc = gql`
|
|
322
322
|
}
|
323
323
|
${DryRunTransactionStatusFragmentDoc}
|
324
324
|
${ReceiptFragmentDoc}`;
|
325
|
+
var BlockFragmentDoc = gql`
|
326
|
+
fragment blockFragment on Block {
|
327
|
+
id
|
328
|
+
height
|
329
|
+
header {
|
330
|
+
time
|
331
|
+
daHeight
|
332
|
+
stateTransitionBytecodeVersion
|
333
|
+
transactionsCount
|
334
|
+
transactionsRoot
|
335
|
+
messageOutboxRoot
|
336
|
+
eventInboxRoot
|
337
|
+
prevRoot
|
338
|
+
applicationHash
|
339
|
+
}
|
340
|
+
transactions {
|
341
|
+
id
|
342
|
+
}
|
343
|
+
}
|
344
|
+
`;
|
325
345
|
var CoinFragmentDoc = gql`
|
326
346
|
fragment coinFragment on Coin {
|
327
347
|
type: __typename
|
@@ -403,33 +423,6 @@ var MessageProofFragmentDoc = gql`
|
|
403
423
|
data
|
404
424
|
}
|
405
425
|
`;
|
406
|
-
var BalanceFragmentDoc = gql`
|
407
|
-
fragment balanceFragment on Balance {
|
408
|
-
owner
|
409
|
-
amount
|
410
|
-
assetId
|
411
|
-
}
|
412
|
-
`;
|
413
|
-
var BlockFragmentDoc = gql`
|
414
|
-
fragment blockFragment on Block {
|
415
|
-
id
|
416
|
-
height
|
417
|
-
header {
|
418
|
-
time
|
419
|
-
daHeight
|
420
|
-
stateTransitionBytecodeVersion
|
421
|
-
transactionsCount
|
422
|
-
transactionsRoot
|
423
|
-
messageOutboxRoot
|
424
|
-
eventInboxRoot
|
425
|
-
prevRoot
|
426
|
-
applicationHash
|
427
|
-
}
|
428
|
-
transactions {
|
429
|
-
id
|
430
|
-
}
|
431
|
-
}
|
432
|
-
`;
|
433
426
|
var TxParametersFragmentDoc = gql`
|
434
427
|
fragment TxParametersFragment on TxParameters {
|
435
428
|
version
|
@@ -487,167 +480,6 @@ var DependentCostFragmentDoc = gql`
|
|
487
480
|
`;
|
488
481
|
var GasCostsFragmentDoc = gql`
|
489
482
|
fragment GasCostsFragment on GasCosts {
|
490
|
-
version
|
491
|
-
add
|
492
|
-
addi
|
493
|
-
aloc
|
494
|
-
and
|
495
|
-
andi
|
496
|
-
bal
|
497
|
-
bhei
|
498
|
-
bhsh
|
499
|
-
burn
|
500
|
-
cb
|
501
|
-
cfei
|
502
|
-
cfsi
|
503
|
-
div
|
504
|
-
divi
|
505
|
-
ecr1
|
506
|
-
eck1
|
507
|
-
ed19
|
508
|
-
eq
|
509
|
-
exp
|
510
|
-
expi
|
511
|
-
flag
|
512
|
-
gm
|
513
|
-
gt
|
514
|
-
gtf
|
515
|
-
ji
|
516
|
-
jmp
|
517
|
-
jne
|
518
|
-
jnei
|
519
|
-
jnzi
|
520
|
-
jmpf
|
521
|
-
jmpb
|
522
|
-
jnzf
|
523
|
-
jnzb
|
524
|
-
jnef
|
525
|
-
jneb
|
526
|
-
lb
|
527
|
-
log
|
528
|
-
lt
|
529
|
-
lw
|
530
|
-
mint
|
531
|
-
mlog
|
532
|
-
modOp
|
533
|
-
modi
|
534
|
-
moveOp
|
535
|
-
movi
|
536
|
-
mroo
|
537
|
-
mul
|
538
|
-
muli
|
539
|
-
mldv
|
540
|
-
noop
|
541
|
-
not
|
542
|
-
or
|
543
|
-
ori
|
544
|
-
poph
|
545
|
-
popl
|
546
|
-
pshh
|
547
|
-
pshl
|
548
|
-
ret
|
549
|
-
rvrt
|
550
|
-
sb
|
551
|
-
sll
|
552
|
-
slli
|
553
|
-
srl
|
554
|
-
srli
|
555
|
-
srw
|
556
|
-
sub
|
557
|
-
subi
|
558
|
-
sw
|
559
|
-
sww
|
560
|
-
time
|
561
|
-
tr
|
562
|
-
tro
|
563
|
-
wdcm
|
564
|
-
wqcm
|
565
|
-
wdop
|
566
|
-
wqop
|
567
|
-
wdml
|
568
|
-
wqml
|
569
|
-
wddv
|
570
|
-
wqdv
|
571
|
-
wdmd
|
572
|
-
wqmd
|
573
|
-
wdam
|
574
|
-
wqam
|
575
|
-
wdmm
|
576
|
-
wqmm
|
577
|
-
xor
|
578
|
-
xori
|
579
|
-
alocDependentCost {
|
580
|
-
...DependentCostFragment
|
581
|
-
}
|
582
|
-
bldd {
|
583
|
-
...DependentCostFragment
|
584
|
-
}
|
585
|
-
bsiz {
|
586
|
-
...DependentCostFragment
|
587
|
-
}
|
588
|
-
cfe {
|
589
|
-
...DependentCostFragment
|
590
|
-
}
|
591
|
-
cfeiDependentCost {
|
592
|
-
...DependentCostFragment
|
593
|
-
}
|
594
|
-
call {
|
595
|
-
...DependentCostFragment
|
596
|
-
}
|
597
|
-
ccp {
|
598
|
-
...DependentCostFragment
|
599
|
-
}
|
600
|
-
croo {
|
601
|
-
...DependentCostFragment
|
602
|
-
}
|
603
|
-
csiz {
|
604
|
-
...DependentCostFragment
|
605
|
-
}
|
606
|
-
ed19DependentCost {
|
607
|
-
...DependentCostFragment
|
608
|
-
}
|
609
|
-
k256 {
|
610
|
-
...DependentCostFragment
|
611
|
-
}
|
612
|
-
ldc {
|
613
|
-
...DependentCostFragment
|
614
|
-
}
|
615
|
-
logd {
|
616
|
-
...DependentCostFragment
|
617
|
-
}
|
618
|
-
mcl {
|
619
|
-
...DependentCostFragment
|
620
|
-
}
|
621
|
-
mcli {
|
622
|
-
...DependentCostFragment
|
623
|
-
}
|
624
|
-
mcp {
|
625
|
-
...DependentCostFragment
|
626
|
-
}
|
627
|
-
mcpi {
|
628
|
-
...DependentCostFragment
|
629
|
-
}
|
630
|
-
meq {
|
631
|
-
...DependentCostFragment
|
632
|
-
}
|
633
|
-
retd {
|
634
|
-
...DependentCostFragment
|
635
|
-
}
|
636
|
-
s256 {
|
637
|
-
...DependentCostFragment
|
638
|
-
}
|
639
|
-
scwq {
|
640
|
-
...DependentCostFragment
|
641
|
-
}
|
642
|
-
smo {
|
643
|
-
...DependentCostFragment
|
644
|
-
}
|
645
|
-
srwq {
|
646
|
-
...DependentCostFragment
|
647
|
-
}
|
648
|
-
swwq {
|
649
|
-
...DependentCostFragment
|
650
|
-
}
|
651
483
|
contractRoot {
|
652
484
|
...DependentCostFragment
|
653
485
|
}
|
@@ -657,6 +489,10 @@ var GasCostsFragmentDoc = gql`
|
|
657
489
|
vmInitialization {
|
658
490
|
...DependentCostFragment
|
659
491
|
}
|
492
|
+
s256 {
|
493
|
+
...DependentCostFragment
|
494
|
+
}
|
495
|
+
ecr1
|
660
496
|
newStoragePerByte
|
661
497
|
}
|
662
498
|
${DependentCostFragmentDoc}`;
|
@@ -693,16 +529,12 @@ ${GasCostsFragmentDoc}`;
|
|
693
529
|
var ChainInfoFragmentDoc = gql`
|
694
530
|
fragment chainInfoFragment on ChainInfo {
|
695
531
|
name
|
696
|
-
latestBlock {
|
697
|
-
...blockFragment
|
698
|
-
}
|
699
532
|
daHeight
|
700
533
|
consensusParameters {
|
701
534
|
...consensusParametersFragment
|
702
535
|
}
|
703
536
|
}
|
704
|
-
${
|
705
|
-
${ConsensusParametersFragmentDoc}`;
|
537
|
+
${ConsensusParametersFragmentDoc}`;
|
706
538
|
var ContractBalanceFragmentDoc = gql`
|
707
539
|
fragment contractBalanceFragment on ContractBalance {
|
708
540
|
contract
|
@@ -735,6 +567,12 @@ var RelayedTransactionStatusFragmentDoc = gql`
|
|
735
567
|
}
|
736
568
|
}
|
737
569
|
`;
|
570
|
+
var TransactionRawPayloadFragmentDoc = gql`
|
571
|
+
fragment transactionRawPayload on Transaction {
|
572
|
+
id
|
573
|
+
rawPayload
|
574
|
+
}
|
575
|
+
`;
|
738
576
|
var GetVersionDocument = gql`
|
739
577
|
query getVersion {
|
740
578
|
nodeInfo {
|
@@ -756,6 +594,17 @@ var GetChainDocument = gql`
|
|
756
594
|
}
|
757
595
|
}
|
758
596
|
${ChainInfoFragmentDoc}`;
|
597
|
+
var GetChainAndNodeInfoDocument = gql`
|
598
|
+
query getChainAndNodeInfo {
|
599
|
+
chain {
|
600
|
+
...chainInfoFragment
|
601
|
+
}
|
602
|
+
nodeInfo {
|
603
|
+
...nodeInfoFragment
|
604
|
+
}
|
605
|
+
}
|
606
|
+
${ChainInfoFragmentDoc}
|
607
|
+
${NodeInfoFragmentDoc}`;
|
759
608
|
var GetTransactionDocument = gql`
|
760
609
|
query getTransaction($transactionId: TransactionId!) {
|
761
610
|
transaction(id: $transactionId) {
|
@@ -813,6 +662,24 @@ var EstimatePredicatesDocument = gql`
|
|
813
662
|
}
|
814
663
|
}
|
815
664
|
${TransactionEstimatePredicatesFragmentDoc}`;
|
665
|
+
var GetLatestBlockDocument = gql`
|
666
|
+
query getLatestBlock {
|
667
|
+
chain {
|
668
|
+
latestBlock {
|
669
|
+
...blockFragment
|
670
|
+
}
|
671
|
+
}
|
672
|
+
}
|
673
|
+
${BlockFragmentDoc}`;
|
674
|
+
var GetLatestBlockHeightDocument = gql`
|
675
|
+
query getLatestBlockHeight {
|
676
|
+
chain {
|
677
|
+
latestBlock {
|
678
|
+
height
|
679
|
+
}
|
680
|
+
}
|
681
|
+
}
|
682
|
+
`;
|
816
683
|
var GetBlockDocument = gql`
|
817
684
|
query getBlock($blockId: BlockId, $height: U32) {
|
818
685
|
block(id: $blockId, height: $height) {
|
@@ -825,12 +692,12 @@ var GetBlockWithTransactionsDocument = gql`
|
|
825
692
|
block(id: $blockId, height: $blockHeight) {
|
826
693
|
...blockFragment
|
827
694
|
transactions {
|
828
|
-
...
|
695
|
+
...transactionRawPayload
|
829
696
|
}
|
830
697
|
}
|
831
698
|
}
|
832
699
|
${BlockFragmentDoc}
|
833
|
-
${
|
700
|
+
${TransactionRawPayloadFragmentDoc}`;
|
834
701
|
var GetBlocksDocument = gql`
|
835
702
|
query getBlocks($after: String, $before: String, $first: Int, $last: Int) {
|
836
703
|
blocks(after: $after, before: $before, first: $first, last: $last) {
|
@@ -905,10 +772,10 @@ var GetContractBalanceDocument = gql`
|
|
905
772
|
var GetBalanceDocument = gql`
|
906
773
|
query getBalance($owner: Address!, $assetId: AssetId!) {
|
907
774
|
balance(owner: $owner, assetId: $assetId) {
|
908
|
-
|
775
|
+
amount
|
909
776
|
}
|
910
777
|
}
|
911
|
-
|
778
|
+
`;
|
912
779
|
var GetLatestGasPriceDocument = gql`
|
913
780
|
query getLatestGasPrice {
|
914
781
|
latestGasPrice {
|
@@ -937,13 +804,13 @@ var GetBalancesDocument = gql`
|
|
937
804
|
}
|
938
805
|
edges {
|
939
806
|
node {
|
940
|
-
|
807
|
+
assetId
|
808
|
+
amount
|
941
809
|
}
|
942
810
|
}
|
943
811
|
}
|
944
812
|
}
|
945
|
-
${PageInfoFragmentDoc}
|
946
|
-
${BalanceFragmentDoc}`;
|
813
|
+
${PageInfoFragmentDoc}`;
|
947
814
|
var GetMessagesDocument = gql`
|
948
815
|
query getMessages($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
|
949
816
|
messages(
|
@@ -1024,6 +891,19 @@ var GetMessageByNonceDocument = gql`
|
|
1024
891
|
}
|
1025
892
|
}
|
1026
893
|
${MessageFragmentDoc}`;
|
894
|
+
var IsUserAccountDocument = gql`
|
895
|
+
query isUserAccount($blobId: BlobId!, $contractId: ContractId!, $transactionId: TransactionId!) {
|
896
|
+
blob(id: $blobId) {
|
897
|
+
id
|
898
|
+
}
|
899
|
+
contract(id: $contractId) {
|
900
|
+
id
|
901
|
+
}
|
902
|
+
transaction(id: $transactionId) {
|
903
|
+
id
|
904
|
+
}
|
905
|
+
}
|
906
|
+
`;
|
1027
907
|
var SubmitAndAwaitDocument = gql`
|
1028
908
|
subscription submitAndAwait($encodedTransaction: HexString!) {
|
1029
909
|
submitAndAwait(tx: $encodedTransaction) {
|
@@ -1056,6 +936,9 @@ function getSdk(requester) {
|
|
1056
936
|
getChain(variables, options) {
|
1057
937
|
return requester(GetChainDocument, variables, options);
|
1058
938
|
},
|
939
|
+
getChainAndNodeInfo(variables, options) {
|
940
|
+
return requester(GetChainAndNodeInfoDocument, variables, options);
|
941
|
+
},
|
1059
942
|
getTransaction(variables, options) {
|
1060
943
|
return requester(GetTransactionDocument, variables, options);
|
1061
944
|
},
|
@@ -1071,6 +954,12 @@ function getSdk(requester) {
|
|
1071
954
|
estimatePredicates(variables, options) {
|
1072
955
|
return requester(EstimatePredicatesDocument, variables, options);
|
1073
956
|
},
|
957
|
+
getLatestBlock(variables, options) {
|
958
|
+
return requester(GetLatestBlockDocument, variables, options);
|
959
|
+
},
|
960
|
+
getLatestBlockHeight(variables, options) {
|
961
|
+
return requester(GetLatestBlockHeightDocument, variables, options);
|
962
|
+
},
|
1074
963
|
getBlock(variables, options) {
|
1075
964
|
return requester(GetBlockDocument, variables, options);
|
1076
965
|
},
|
@@ -1131,6 +1020,9 @@ function getSdk(requester) {
|
|
1131
1020
|
getMessageByNonce(variables, options) {
|
1132
1021
|
return requester(GetMessageByNonceDocument, variables, options);
|
1133
1022
|
},
|
1023
|
+
isUserAccount(variables, options) {
|
1024
|
+
return requester(IsUserAccountDocument, variables, options);
|
1025
|
+
},
|
1134
1026
|
submitAndAwait(variables, options) {
|
1135
1027
|
return requester(SubmitAndAwaitDocument, variables, options);
|
1136
1028
|
},
|
@@ -4474,10 +4366,11 @@ var handleGqlErrorMessage = (errorMessage, rawError) => {
|
|
4474
4366
|
// src/providers/provider.ts
|
4475
4367
|
var MAX_RETRIES = 10;
|
4476
4368
|
var RESOURCES_PAGE_SIZE_LIMIT = 512;
|
4369
|
+
var TRANSACTIONS_PAGE_SIZE_LIMIT = 60;
|
4477
4370
|
var BLOCKS_PAGE_SIZE_LIMIT = 5;
|
4478
4371
|
var DEFAULT_RESOURCE_CACHE_TTL = 2e4;
|
4479
4372
|
var processGqlChain = (chain) => {
|
4480
|
-
const { name, daHeight, consensusParameters
|
4373
|
+
const { name, daHeight, consensusParameters } = chain;
|
4481
4374
|
const {
|
4482
4375
|
contractParams,
|
4483
4376
|
feeParams,
|
@@ -4528,14 +4421,6 @@ var processGqlChain = (chain) => {
|
|
4528
4421
|
maxScriptDataLength: bn17(scriptParams.maxScriptDataLength)
|
4529
4422
|
},
|
4530
4423
|
gasCosts
|
4531
|
-
},
|
4532
|
-
latestBlock: {
|
4533
|
-
id: latestBlock.id,
|
4534
|
-
height: bn17(latestBlock.height),
|
4535
|
-
time: latestBlock.header.time,
|
4536
|
-
transactions: latestBlock.transactions.map((i) => ({
|
4537
|
-
id: i.id
|
4538
|
-
}))
|
4539
4424
|
}
|
4540
4425
|
};
|
4541
4426
|
};
|
@@ -4566,14 +4451,17 @@ var _Provider = class {
|
|
4566
4451
|
retryOptions: void 0,
|
4567
4452
|
headers: void 0
|
4568
4453
|
});
|
4569
|
-
const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
|
4454
|
+
const { url: rawUrl, urlWithoutAuth, headers: authHeaders } = _Provider.extractBasicAuth(url);
|
4570
4455
|
this.url = rawUrl;
|
4571
4456
|
this.urlWithoutAuth = urlWithoutAuth;
|
4572
|
-
this.options = { ...this.options, ...options };
|
4573
4457
|
this.url = url;
|
4574
|
-
|
4575
|
-
|
4576
|
-
|
4458
|
+
const { FUELS } = versions;
|
4459
|
+
const headers = { ...authHeaders, ...options.headers, Source: `ts-sdk-${FUELS}` };
|
4460
|
+
this.options = {
|
4461
|
+
...this.options,
|
4462
|
+
...options,
|
4463
|
+
headers
|
4464
|
+
};
|
4577
4465
|
this.operations = this.createOperations();
|
4578
4466
|
const { resourceCacheTTL } = this.options;
|
4579
4467
|
if (isDefined2(resourceCacheTTL)) {
|
@@ -4712,9 +4600,25 @@ var _Provider = class {
|
|
4712
4600
|
* @returns A promise that resolves to the Chain and NodeInfo.
|
4713
4601
|
*/
|
4714
4602
|
async fetchChainAndNodeInfo() {
|
4715
|
-
|
4716
|
-
|
4717
|
-
|
4603
|
+
let nodeInfo;
|
4604
|
+
let chain;
|
4605
|
+
try {
|
4606
|
+
nodeInfo = this.getNode();
|
4607
|
+
chain = this.getChain();
|
4608
|
+
} catch (error) {
|
4609
|
+
const data = await this.operations.getChainAndNodeInfo();
|
4610
|
+
nodeInfo = {
|
4611
|
+
maxDepth: bn17(data.nodeInfo.maxDepth),
|
4612
|
+
maxTx: bn17(data.nodeInfo.maxTx),
|
4613
|
+
nodeVersion: data.nodeInfo.nodeVersion,
|
4614
|
+
utxoValidation: data.nodeInfo.utxoValidation,
|
4615
|
+
vmBacktrace: data.nodeInfo.vmBacktrace
|
4616
|
+
};
|
4617
|
+
_Provider.ensureClientVersionIsSupported(nodeInfo);
|
4618
|
+
chain = processGqlChain(data.chain);
|
4619
|
+
_Provider.chainInfoCache[this.urlWithoutAuth] = chain;
|
4620
|
+
_Provider.nodeInfoCache[this.urlWithoutAuth] = nodeInfo;
|
4621
|
+
}
|
4718
4622
|
return {
|
4719
4623
|
chain,
|
4720
4624
|
nodeInfo
|
@@ -4806,8 +4710,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4806
4710
|
* @returns A promise that resolves to the latest block number.
|
4807
4711
|
*/
|
4808
4712
|
async getBlockNumber() {
|
4809
|
-
const {
|
4810
|
-
|
4713
|
+
const {
|
4714
|
+
chain: {
|
4715
|
+
latestBlock: { height }
|
4716
|
+
}
|
4717
|
+
} = await this.operations.getLatestBlockHeight();
|
4718
|
+
return bn17(height);
|
4811
4719
|
}
|
4812
4720
|
/**
|
4813
4721
|
* Returns the node information for the current provider network.
|
@@ -5354,17 +5262,18 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5354
5262
|
* @returns A promise that resolves to the block or null.
|
5355
5263
|
*/
|
5356
5264
|
async getBlock(idOrHeight) {
|
5357
|
-
let
|
5358
|
-
if (
|
5359
|
-
|
5360
|
-
|
5361
|
-
|
5362
|
-
|
5363
|
-
variables = { blockId: idOrHeight };
|
5265
|
+
let block;
|
5266
|
+
if (idOrHeight === "latest") {
|
5267
|
+
const {
|
5268
|
+
chain: { latestBlock }
|
5269
|
+
} = await this.operations.getLatestBlock();
|
5270
|
+
block = latestBlock;
|
5364
5271
|
} else {
|
5365
|
-
|
5272
|
+
const isblockId = typeof idOrHeight === "string" && idOrHeight.length === 66;
|
5273
|
+
const variables = isblockId ? { blockId: idOrHeight } : { height: bn17(idOrHeight).toString(10) };
|
5274
|
+
const response = await this.operations.getBlock(variables);
|
5275
|
+
block = response.block;
|
5366
5276
|
}
|
5367
|
-
const { block } = await this.operations.getBlock(variables);
|
5368
5277
|
if (!block) {
|
5369
5278
|
return null;
|
5370
5279
|
}
|
@@ -5490,7 +5399,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5490
5399
|
async getTransactions(paginationArgs) {
|
5491
5400
|
const {
|
5492
5401
|
transactions: { edges, pageInfo }
|
5493
|
-
} = await this.operations.getTransactions(
|
5402
|
+
} = await this.operations.getTransactions({
|
5403
|
+
...this.validatePaginationArgs({
|
5404
|
+
inputArgs: paginationArgs,
|
5405
|
+
paginationLimit: TRANSACTIONS_PAGE_SIZE_LIMIT
|
5406
|
+
})
|
5407
|
+
});
|
5494
5408
|
const coder = new TransactionCoder5();
|
5495
5409
|
const transactions = edges.map(({ node: { rawPayload } }) => {
|
5496
5410
|
try {
|
@@ -5746,6 +5660,40 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5746
5660
|
});
|
5747
5661
|
return bn17(latestBlockHeight);
|
5748
5662
|
}
|
5663
|
+
/**
|
5664
|
+
* Check if the given ID is an account.
|
5665
|
+
*
|
5666
|
+
* @param id - The ID to check.
|
5667
|
+
* @returns A promise that resolves to the result of the check.
|
5668
|
+
*/
|
5669
|
+
async isUserAccount(id) {
|
5670
|
+
const { contract, blob, transaction } = await this.operations.isUserAccount({
|
5671
|
+
blobId: id,
|
5672
|
+
contractId: id,
|
5673
|
+
transactionId: id
|
5674
|
+
});
|
5675
|
+
if (contract || blob || transaction) {
|
5676
|
+
return false;
|
5677
|
+
}
|
5678
|
+
return true;
|
5679
|
+
}
|
5680
|
+
async getAddressType(id) {
|
5681
|
+
const { contract, blob, transaction } = await this.operations.isUserAccount({
|
5682
|
+
blobId: id,
|
5683
|
+
contractId: id,
|
5684
|
+
transactionId: id
|
5685
|
+
});
|
5686
|
+
if (contract) {
|
5687
|
+
return "Contract";
|
5688
|
+
}
|
5689
|
+
if (blob) {
|
5690
|
+
return "Blob";
|
5691
|
+
}
|
5692
|
+
if (transaction) {
|
5693
|
+
return "Transaction";
|
5694
|
+
}
|
5695
|
+
return "Account";
|
5696
|
+
}
|
5749
5697
|
/**
|
5750
5698
|
* Get the transaction response for the given transaction ID.
|
5751
5699
|
*
|
@@ -10707,7 +10655,7 @@ var StorageAbstract = class {
|
|
10707
10655
|
import { Interface as Interface4 } from "@fuel-ts/abi-coder";
|
10708
10656
|
import { Address as Address9 } from "@fuel-ts/address";
|
10709
10657
|
import { ErrorCode as ErrorCode25, FuelError as FuelError27 } from "@fuel-ts/errors";
|
10710
|
-
import { arrayify as arrayify21, hexlify as hexlify23 } from "@fuel-ts/utils";
|
10658
|
+
import { arrayify as arrayify21, hexlify as hexlify23, concat as concat7 } from "@fuel-ts/utils";
|
10711
10659
|
|
10712
10660
|
// src/predicate/utils/getPredicateRoot.ts
|
10713
10661
|
import { hash as hash3 } from "@fuel-ts/hasher";
|
@@ -10723,10 +10671,17 @@ var getPredicateRoot = (bytecode) => {
|
|
10723
10671
|
};
|
10724
10672
|
|
10725
10673
|
// src/predicate/predicate.ts
|
10674
|
+
function getDataOffset(binary) {
|
10675
|
+
const buffer = binary.buffer.slice(binary.byteOffset + 8, binary.byteOffset + 16);
|
10676
|
+
const dataView = new DataView(buffer);
|
10677
|
+
const dataOffset = dataView.getBigUint64(0, false);
|
10678
|
+
return Number(dataOffset);
|
10679
|
+
}
|
10726
10680
|
var Predicate = class extends Account {
|
10727
10681
|
bytes;
|
10728
10682
|
predicateData = [];
|
10729
10683
|
interface;
|
10684
|
+
loaderBytecode = "";
|
10730
10685
|
/**
|
10731
10686
|
* Creates an instance of the Predicate class.
|
10732
10687
|
*
|
@@ -10741,7 +10696,13 @@ var Predicate = class extends Account {
|
|
10741
10696
|
abi,
|
10742
10697
|
provider,
|
10743
10698
|
data,
|
10744
|
-
configurableConstants
|
10699
|
+
configurableConstants,
|
10700
|
+
/**
|
10701
|
+
* TODO: Implement a getBytes method within the Predicate class. This method should return the loaderBytecode if it is set.
|
10702
|
+
* The getBytes method should be used in all places where we use this.bytes.
|
10703
|
+
* Note: Do not set loaderBytecode to a default string here; it should remain undefined when not provided.
|
10704
|
+
*/
|
10705
|
+
loaderBytecode = ""
|
10745
10706
|
}) {
|
10746
10707
|
const { predicateBytes, predicateInterface } = Predicate.processPredicateData(
|
10747
10708
|
bytecode,
|
@@ -10752,6 +10713,7 @@ var Predicate = class extends Account {
|
|
10752
10713
|
super(address, provider);
|
10753
10714
|
this.bytes = predicateBytes;
|
10754
10715
|
this.interface = predicateInterface;
|
10716
|
+
this.loaderBytecode = loaderBytecode;
|
10755
10717
|
if (data !== void 0 && data.length > 0) {
|
10756
10718
|
this.predicateData = data;
|
10757
10719
|
}
|
@@ -10876,7 +10838,7 @@ var Predicate = class extends Account {
|
|
10876
10838
|
* @param abiInterface - The ABI interface of the predicate.
|
10877
10839
|
* @returns The mutated bytes with the configurable constants set.
|
10878
10840
|
*/
|
10879
|
-
static setConfigurableConstants(bytes, configurableConstants, abiInterface) {
|
10841
|
+
static setConfigurableConstants(bytes, configurableConstants, abiInterface, loaderBytecode) {
|
10880
10842
|
const mutatedBytes = bytes;
|
10881
10843
|
try {
|
10882
10844
|
if (!abiInterface) {
|
@@ -10902,6 +10864,15 @@ var Predicate = class extends Account {
|
|
10902
10864
|
const encoded = abiInterface.encodeConfigurable(key, value);
|
10903
10865
|
mutatedBytes.set(encoded, offset);
|
10904
10866
|
});
|
10867
|
+
if (loaderBytecode) {
|
10868
|
+
const offset = getDataOffset(bytes);
|
10869
|
+
const dataSection = mutatedBytes.slice(offset);
|
10870
|
+
const dataSectionLen = dataSection.length;
|
10871
|
+
const dataSectionLenBytes = new Uint8Array(8);
|
10872
|
+
const dataSectionLenDataView = new DataView(dataSectionLenBytes.buffer);
|
10873
|
+
dataSectionLenDataView.setBigUint64(0, BigInt(dataSectionLen), false);
|
10874
|
+
mutatedBytes.set(concat7([loaderBytecode, dataSectionLenBytes, dataSection]));
|
10875
|
+
}
|
10905
10876
|
} catch (err) {
|
10906
10877
|
throw new FuelError27(
|
10907
10878
|
ErrorCode25.INVALID_CONFIGURABLE_CONSTANTS,
|
@@ -11657,6 +11628,7 @@ export {
|
|
11657
11628
|
ScriptTransactionRequest,
|
11658
11629
|
Signer,
|
11659
11630
|
StorageAbstract,
|
11631
|
+
TRANSACTIONS_PAGE_SIZE_LIMIT,
|
11660
11632
|
TransactionResponse,
|
11661
11633
|
TransactionStatus,
|
11662
11634
|
TransactionType,
|