@fuel-ts/account 0.94.9 → 0.96.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 +266 -267
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +179 -229
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +179 -230
- package/dist/index.mjs.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/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/test-utils.global.js +266 -267
- 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 +15 -15
package/dist/index.js
CHANGED
@@ -90,6 +90,7 @@ __export(src_exports, {
|
|
90
90
|
ScriptTransactionRequest: () => ScriptTransactionRequest,
|
91
91
|
Signer: () => Signer,
|
92
92
|
StorageAbstract: () => StorageAbstract,
|
93
|
+
TRANSACTIONS_PAGE_SIZE_LIMIT: () => TRANSACTIONS_PAGE_SIZE_LIMIT,
|
93
94
|
TransactionResponse: () => TransactionResponse,
|
94
95
|
TransactionStatus: () => TransactionStatus,
|
95
96
|
TransactionType: () => import_transactions7.TransactionType,
|
@@ -509,6 +510,26 @@ var DryRunTransactionExecutionStatusFragmentDoc = import_graphql_tag.default`
|
|
509
510
|
}
|
510
511
|
${DryRunTransactionStatusFragmentDoc}
|
511
512
|
${ReceiptFragmentDoc}`;
|
513
|
+
var BlockFragmentDoc = import_graphql_tag.default`
|
514
|
+
fragment blockFragment on Block {
|
515
|
+
id
|
516
|
+
height
|
517
|
+
header {
|
518
|
+
time
|
519
|
+
daHeight
|
520
|
+
stateTransitionBytecodeVersion
|
521
|
+
transactionsCount
|
522
|
+
transactionsRoot
|
523
|
+
messageOutboxRoot
|
524
|
+
eventInboxRoot
|
525
|
+
prevRoot
|
526
|
+
applicationHash
|
527
|
+
}
|
528
|
+
transactions {
|
529
|
+
id
|
530
|
+
}
|
531
|
+
}
|
532
|
+
`;
|
512
533
|
var CoinFragmentDoc = import_graphql_tag.default`
|
513
534
|
fragment coinFragment on Coin {
|
514
535
|
type: __typename
|
@@ -590,33 +611,6 @@ var MessageProofFragmentDoc = import_graphql_tag.default`
|
|
590
611
|
data
|
591
612
|
}
|
592
613
|
`;
|
593
|
-
var BalanceFragmentDoc = import_graphql_tag.default`
|
594
|
-
fragment balanceFragment on Balance {
|
595
|
-
owner
|
596
|
-
amount
|
597
|
-
assetId
|
598
|
-
}
|
599
|
-
`;
|
600
|
-
var BlockFragmentDoc = import_graphql_tag.default`
|
601
|
-
fragment blockFragment on Block {
|
602
|
-
id
|
603
|
-
height
|
604
|
-
header {
|
605
|
-
time
|
606
|
-
daHeight
|
607
|
-
stateTransitionBytecodeVersion
|
608
|
-
transactionsCount
|
609
|
-
transactionsRoot
|
610
|
-
messageOutboxRoot
|
611
|
-
eventInboxRoot
|
612
|
-
prevRoot
|
613
|
-
applicationHash
|
614
|
-
}
|
615
|
-
transactions {
|
616
|
-
id
|
617
|
-
}
|
618
|
-
}
|
619
|
-
`;
|
620
614
|
var TxParametersFragmentDoc = import_graphql_tag.default`
|
621
615
|
fragment TxParametersFragment on TxParameters {
|
622
616
|
version
|
@@ -674,167 +668,6 @@ var DependentCostFragmentDoc = import_graphql_tag.default`
|
|
674
668
|
`;
|
675
669
|
var GasCostsFragmentDoc = import_graphql_tag.default`
|
676
670
|
fragment GasCostsFragment on GasCosts {
|
677
|
-
version
|
678
|
-
add
|
679
|
-
addi
|
680
|
-
aloc
|
681
|
-
and
|
682
|
-
andi
|
683
|
-
bal
|
684
|
-
bhei
|
685
|
-
bhsh
|
686
|
-
burn
|
687
|
-
cb
|
688
|
-
cfei
|
689
|
-
cfsi
|
690
|
-
div
|
691
|
-
divi
|
692
|
-
ecr1
|
693
|
-
eck1
|
694
|
-
ed19
|
695
|
-
eq
|
696
|
-
exp
|
697
|
-
expi
|
698
|
-
flag
|
699
|
-
gm
|
700
|
-
gt
|
701
|
-
gtf
|
702
|
-
ji
|
703
|
-
jmp
|
704
|
-
jne
|
705
|
-
jnei
|
706
|
-
jnzi
|
707
|
-
jmpf
|
708
|
-
jmpb
|
709
|
-
jnzf
|
710
|
-
jnzb
|
711
|
-
jnef
|
712
|
-
jneb
|
713
|
-
lb
|
714
|
-
log
|
715
|
-
lt
|
716
|
-
lw
|
717
|
-
mint
|
718
|
-
mlog
|
719
|
-
modOp
|
720
|
-
modi
|
721
|
-
moveOp
|
722
|
-
movi
|
723
|
-
mroo
|
724
|
-
mul
|
725
|
-
muli
|
726
|
-
mldv
|
727
|
-
noop
|
728
|
-
not
|
729
|
-
or
|
730
|
-
ori
|
731
|
-
poph
|
732
|
-
popl
|
733
|
-
pshh
|
734
|
-
pshl
|
735
|
-
ret
|
736
|
-
rvrt
|
737
|
-
sb
|
738
|
-
sll
|
739
|
-
slli
|
740
|
-
srl
|
741
|
-
srli
|
742
|
-
srw
|
743
|
-
sub
|
744
|
-
subi
|
745
|
-
sw
|
746
|
-
sww
|
747
|
-
time
|
748
|
-
tr
|
749
|
-
tro
|
750
|
-
wdcm
|
751
|
-
wqcm
|
752
|
-
wdop
|
753
|
-
wqop
|
754
|
-
wdml
|
755
|
-
wqml
|
756
|
-
wddv
|
757
|
-
wqdv
|
758
|
-
wdmd
|
759
|
-
wqmd
|
760
|
-
wdam
|
761
|
-
wqam
|
762
|
-
wdmm
|
763
|
-
wqmm
|
764
|
-
xor
|
765
|
-
xori
|
766
|
-
alocDependentCost {
|
767
|
-
...DependentCostFragment
|
768
|
-
}
|
769
|
-
bldd {
|
770
|
-
...DependentCostFragment
|
771
|
-
}
|
772
|
-
bsiz {
|
773
|
-
...DependentCostFragment
|
774
|
-
}
|
775
|
-
cfe {
|
776
|
-
...DependentCostFragment
|
777
|
-
}
|
778
|
-
cfeiDependentCost {
|
779
|
-
...DependentCostFragment
|
780
|
-
}
|
781
|
-
call {
|
782
|
-
...DependentCostFragment
|
783
|
-
}
|
784
|
-
ccp {
|
785
|
-
...DependentCostFragment
|
786
|
-
}
|
787
|
-
croo {
|
788
|
-
...DependentCostFragment
|
789
|
-
}
|
790
|
-
csiz {
|
791
|
-
...DependentCostFragment
|
792
|
-
}
|
793
|
-
ed19DependentCost {
|
794
|
-
...DependentCostFragment
|
795
|
-
}
|
796
|
-
k256 {
|
797
|
-
...DependentCostFragment
|
798
|
-
}
|
799
|
-
ldc {
|
800
|
-
...DependentCostFragment
|
801
|
-
}
|
802
|
-
logd {
|
803
|
-
...DependentCostFragment
|
804
|
-
}
|
805
|
-
mcl {
|
806
|
-
...DependentCostFragment
|
807
|
-
}
|
808
|
-
mcli {
|
809
|
-
...DependentCostFragment
|
810
|
-
}
|
811
|
-
mcp {
|
812
|
-
...DependentCostFragment
|
813
|
-
}
|
814
|
-
mcpi {
|
815
|
-
...DependentCostFragment
|
816
|
-
}
|
817
|
-
meq {
|
818
|
-
...DependentCostFragment
|
819
|
-
}
|
820
|
-
retd {
|
821
|
-
...DependentCostFragment
|
822
|
-
}
|
823
|
-
s256 {
|
824
|
-
...DependentCostFragment
|
825
|
-
}
|
826
|
-
scwq {
|
827
|
-
...DependentCostFragment
|
828
|
-
}
|
829
|
-
smo {
|
830
|
-
...DependentCostFragment
|
831
|
-
}
|
832
|
-
srwq {
|
833
|
-
...DependentCostFragment
|
834
|
-
}
|
835
|
-
swwq {
|
836
|
-
...DependentCostFragment
|
837
|
-
}
|
838
671
|
contractRoot {
|
839
672
|
...DependentCostFragment
|
840
673
|
}
|
@@ -844,6 +677,10 @@ var GasCostsFragmentDoc = import_graphql_tag.default`
|
|
844
677
|
vmInitialization {
|
845
678
|
...DependentCostFragment
|
846
679
|
}
|
680
|
+
s256 {
|
681
|
+
...DependentCostFragment
|
682
|
+
}
|
683
|
+
ecr1
|
847
684
|
newStoragePerByte
|
848
685
|
}
|
849
686
|
${DependentCostFragmentDoc}`;
|
@@ -880,16 +717,12 @@ ${GasCostsFragmentDoc}`;
|
|
880
717
|
var ChainInfoFragmentDoc = import_graphql_tag.default`
|
881
718
|
fragment chainInfoFragment on ChainInfo {
|
882
719
|
name
|
883
|
-
latestBlock {
|
884
|
-
...blockFragment
|
885
|
-
}
|
886
720
|
daHeight
|
887
721
|
consensusParameters {
|
888
722
|
...consensusParametersFragment
|
889
723
|
}
|
890
724
|
}
|
891
|
-
${
|
892
|
-
${ConsensusParametersFragmentDoc}`;
|
725
|
+
${ConsensusParametersFragmentDoc}`;
|
893
726
|
var ContractBalanceFragmentDoc = import_graphql_tag.default`
|
894
727
|
fragment contractBalanceFragment on ContractBalance {
|
895
728
|
contract
|
@@ -922,6 +755,12 @@ var RelayedTransactionStatusFragmentDoc = import_graphql_tag.default`
|
|
922
755
|
}
|
923
756
|
}
|
924
757
|
`;
|
758
|
+
var TransactionRawPayloadFragmentDoc = import_graphql_tag.default`
|
759
|
+
fragment transactionRawPayload on Transaction {
|
760
|
+
id
|
761
|
+
rawPayload
|
762
|
+
}
|
763
|
+
`;
|
925
764
|
var GetVersionDocument = import_graphql_tag.default`
|
926
765
|
query getVersion {
|
927
766
|
nodeInfo {
|
@@ -943,6 +782,17 @@ var GetChainDocument = import_graphql_tag.default`
|
|
943
782
|
}
|
944
783
|
}
|
945
784
|
${ChainInfoFragmentDoc}`;
|
785
|
+
var GetChainAndNodeInfoDocument = import_graphql_tag.default`
|
786
|
+
query getChainAndNodeInfo {
|
787
|
+
chain {
|
788
|
+
...chainInfoFragment
|
789
|
+
}
|
790
|
+
nodeInfo {
|
791
|
+
...nodeInfoFragment
|
792
|
+
}
|
793
|
+
}
|
794
|
+
${ChainInfoFragmentDoc}
|
795
|
+
${NodeInfoFragmentDoc}`;
|
946
796
|
var GetTransactionDocument = import_graphql_tag.default`
|
947
797
|
query getTransaction($transactionId: TransactionId!) {
|
948
798
|
transaction(id: $transactionId) {
|
@@ -1000,6 +850,24 @@ var EstimatePredicatesDocument = import_graphql_tag.default`
|
|
1000
850
|
}
|
1001
851
|
}
|
1002
852
|
${TransactionEstimatePredicatesFragmentDoc}`;
|
853
|
+
var GetLatestBlockDocument = import_graphql_tag.default`
|
854
|
+
query getLatestBlock {
|
855
|
+
chain {
|
856
|
+
latestBlock {
|
857
|
+
...blockFragment
|
858
|
+
}
|
859
|
+
}
|
860
|
+
}
|
861
|
+
${BlockFragmentDoc}`;
|
862
|
+
var GetLatestBlockHeightDocument = import_graphql_tag.default`
|
863
|
+
query getLatestBlockHeight {
|
864
|
+
chain {
|
865
|
+
latestBlock {
|
866
|
+
height
|
867
|
+
}
|
868
|
+
}
|
869
|
+
}
|
870
|
+
`;
|
1003
871
|
var GetBlockDocument = import_graphql_tag.default`
|
1004
872
|
query getBlock($blockId: BlockId, $height: U32) {
|
1005
873
|
block(id: $blockId, height: $height) {
|
@@ -1012,12 +880,12 @@ var GetBlockWithTransactionsDocument = import_graphql_tag.default`
|
|
1012
880
|
block(id: $blockId, height: $blockHeight) {
|
1013
881
|
...blockFragment
|
1014
882
|
transactions {
|
1015
|
-
...
|
883
|
+
...transactionRawPayload
|
1016
884
|
}
|
1017
885
|
}
|
1018
886
|
}
|
1019
887
|
${BlockFragmentDoc}
|
1020
|
-
${
|
888
|
+
${TransactionRawPayloadFragmentDoc}`;
|
1021
889
|
var GetBlocksDocument = import_graphql_tag.default`
|
1022
890
|
query getBlocks($after: String, $before: String, $first: Int, $last: Int) {
|
1023
891
|
blocks(after: $after, before: $before, first: $first, last: $last) {
|
@@ -1092,10 +960,10 @@ var GetContractBalanceDocument = import_graphql_tag.default`
|
|
1092
960
|
var GetBalanceDocument = import_graphql_tag.default`
|
1093
961
|
query getBalance($owner: Address!, $assetId: AssetId!) {
|
1094
962
|
balance(owner: $owner, assetId: $assetId) {
|
1095
|
-
|
963
|
+
amount
|
1096
964
|
}
|
1097
965
|
}
|
1098
|
-
|
966
|
+
`;
|
1099
967
|
var GetLatestGasPriceDocument = import_graphql_tag.default`
|
1100
968
|
query getLatestGasPrice {
|
1101
969
|
latestGasPrice {
|
@@ -1124,13 +992,13 @@ var GetBalancesDocument = import_graphql_tag.default`
|
|
1124
992
|
}
|
1125
993
|
edges {
|
1126
994
|
node {
|
1127
|
-
|
995
|
+
assetId
|
996
|
+
amount
|
1128
997
|
}
|
1129
998
|
}
|
1130
999
|
}
|
1131
1000
|
}
|
1132
|
-
${PageInfoFragmentDoc}
|
1133
|
-
${BalanceFragmentDoc}`;
|
1001
|
+
${PageInfoFragmentDoc}`;
|
1134
1002
|
var GetMessagesDocument = import_graphql_tag.default`
|
1135
1003
|
query getMessages($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
|
1136
1004
|
messages(
|
@@ -1211,6 +1079,19 @@ var GetMessageByNonceDocument = import_graphql_tag.default`
|
|
1211
1079
|
}
|
1212
1080
|
}
|
1213
1081
|
${MessageFragmentDoc}`;
|
1082
|
+
var IsUserAccountDocument = import_graphql_tag.default`
|
1083
|
+
query isUserAccount($blobId: BlobId!, $contractId: ContractId!, $transactionId: TransactionId!) {
|
1084
|
+
blob(id: $blobId) {
|
1085
|
+
id
|
1086
|
+
}
|
1087
|
+
contract(id: $contractId) {
|
1088
|
+
id
|
1089
|
+
}
|
1090
|
+
transaction(id: $transactionId) {
|
1091
|
+
id
|
1092
|
+
}
|
1093
|
+
}
|
1094
|
+
`;
|
1214
1095
|
var SubmitAndAwaitDocument = import_graphql_tag.default`
|
1215
1096
|
subscription submitAndAwait($encodedTransaction: HexString!) {
|
1216
1097
|
submitAndAwait(tx: $encodedTransaction) {
|
@@ -1243,6 +1124,9 @@ function getSdk(requester) {
|
|
1243
1124
|
getChain(variables, options) {
|
1244
1125
|
return requester(GetChainDocument, variables, options);
|
1245
1126
|
},
|
1127
|
+
getChainAndNodeInfo(variables, options) {
|
1128
|
+
return requester(GetChainAndNodeInfoDocument, variables, options);
|
1129
|
+
},
|
1246
1130
|
getTransaction(variables, options) {
|
1247
1131
|
return requester(GetTransactionDocument, variables, options);
|
1248
1132
|
},
|
@@ -1258,6 +1142,12 @@ function getSdk(requester) {
|
|
1258
1142
|
estimatePredicates(variables, options) {
|
1259
1143
|
return requester(EstimatePredicatesDocument, variables, options);
|
1260
1144
|
},
|
1145
|
+
getLatestBlock(variables, options) {
|
1146
|
+
return requester(GetLatestBlockDocument, variables, options);
|
1147
|
+
},
|
1148
|
+
getLatestBlockHeight(variables, options) {
|
1149
|
+
return requester(GetLatestBlockHeightDocument, variables, options);
|
1150
|
+
},
|
1261
1151
|
getBlock(variables, options) {
|
1262
1152
|
return requester(GetBlockDocument, variables, options);
|
1263
1153
|
},
|
@@ -1318,6 +1208,9 @@ function getSdk(requester) {
|
|
1318
1208
|
getMessageByNonce(variables, options) {
|
1319
1209
|
return requester(GetMessageByNonceDocument, variables, options);
|
1320
1210
|
},
|
1211
|
+
isUserAccount(variables, options) {
|
1212
|
+
return requester(IsUserAccountDocument, variables, options);
|
1213
|
+
},
|
1321
1214
|
submitAndAwait(variables, options) {
|
1322
1215
|
return requester(SubmitAndAwaitDocument, variables, options);
|
1323
1216
|
},
|
@@ -4644,10 +4537,11 @@ var handleGqlErrorMessage = (errorMessage, rawError) => {
|
|
4644
4537
|
// src/providers/provider.ts
|
4645
4538
|
var MAX_RETRIES = 10;
|
4646
4539
|
var RESOURCES_PAGE_SIZE_LIMIT = 512;
|
4540
|
+
var TRANSACTIONS_PAGE_SIZE_LIMIT = 60;
|
4647
4541
|
var BLOCKS_PAGE_SIZE_LIMIT = 5;
|
4648
4542
|
var DEFAULT_RESOURCE_CACHE_TTL = 2e4;
|
4649
4543
|
var processGqlChain = (chain) => {
|
4650
|
-
const { name, daHeight, consensusParameters
|
4544
|
+
const { name, daHeight, consensusParameters } = chain;
|
4651
4545
|
const {
|
4652
4546
|
contractParams,
|
4653
4547
|
feeParams,
|
@@ -4698,14 +4592,6 @@ var processGqlChain = (chain) => {
|
|
4698
4592
|
maxScriptDataLength: (0, import_math18.bn)(scriptParams.maxScriptDataLength)
|
4699
4593
|
},
|
4700
4594
|
gasCosts
|
4701
|
-
},
|
4702
|
-
latestBlock: {
|
4703
|
-
id: latestBlock.id,
|
4704
|
-
height: (0, import_math18.bn)(latestBlock.height),
|
4705
|
-
time: latestBlock.header.time,
|
4706
|
-
transactions: latestBlock.transactions.map((i) => ({
|
4707
|
-
id: i.id
|
4708
|
-
}))
|
4709
4595
|
}
|
4710
4596
|
};
|
4711
4597
|
};
|
@@ -4736,14 +4622,17 @@ var _Provider = class {
|
|
4736
4622
|
retryOptions: void 0,
|
4737
4623
|
headers: void 0
|
4738
4624
|
});
|
4739
|
-
const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
|
4625
|
+
const { url: rawUrl, urlWithoutAuth, headers: authHeaders } = _Provider.extractBasicAuth(url);
|
4740
4626
|
this.url = rawUrl;
|
4741
4627
|
this.urlWithoutAuth = urlWithoutAuth;
|
4742
|
-
this.options = { ...this.options, ...options };
|
4743
4628
|
this.url = url;
|
4744
|
-
|
4745
|
-
|
4746
|
-
|
4629
|
+
const { FUELS } = import_versions.versions;
|
4630
|
+
const headers = { ...authHeaders, ...options.headers, Source: `ts-sdk-${FUELS}` };
|
4631
|
+
this.options = {
|
4632
|
+
...this.options,
|
4633
|
+
...options,
|
4634
|
+
headers
|
4635
|
+
};
|
4747
4636
|
this.operations = this.createOperations();
|
4748
4637
|
const { resourceCacheTTL } = this.options;
|
4749
4638
|
if ((0, import_utils28.isDefined)(resourceCacheTTL)) {
|
@@ -4882,9 +4771,25 @@ var _Provider = class {
|
|
4882
4771
|
* @returns A promise that resolves to the Chain and NodeInfo.
|
4883
4772
|
*/
|
4884
4773
|
async fetchChainAndNodeInfo() {
|
4885
|
-
|
4886
|
-
|
4887
|
-
|
4774
|
+
let nodeInfo;
|
4775
|
+
let chain;
|
4776
|
+
try {
|
4777
|
+
nodeInfo = this.getNode();
|
4778
|
+
chain = this.getChain();
|
4779
|
+
} catch (error) {
|
4780
|
+
const data = await this.operations.getChainAndNodeInfo();
|
4781
|
+
nodeInfo = {
|
4782
|
+
maxDepth: (0, import_math18.bn)(data.nodeInfo.maxDepth),
|
4783
|
+
maxTx: (0, import_math18.bn)(data.nodeInfo.maxTx),
|
4784
|
+
nodeVersion: data.nodeInfo.nodeVersion,
|
4785
|
+
utxoValidation: data.nodeInfo.utxoValidation,
|
4786
|
+
vmBacktrace: data.nodeInfo.vmBacktrace
|
4787
|
+
};
|
4788
|
+
_Provider.ensureClientVersionIsSupported(nodeInfo);
|
4789
|
+
chain = processGqlChain(data.chain);
|
4790
|
+
_Provider.chainInfoCache[this.urlWithoutAuth] = chain;
|
4791
|
+
_Provider.nodeInfoCache[this.urlWithoutAuth] = nodeInfo;
|
4792
|
+
}
|
4888
4793
|
return {
|
4889
4794
|
chain,
|
4890
4795
|
nodeInfo
|
@@ -4976,8 +4881,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4976
4881
|
* @returns A promise that resolves to the latest block number.
|
4977
4882
|
*/
|
4978
4883
|
async getBlockNumber() {
|
4979
|
-
const {
|
4980
|
-
|
4884
|
+
const {
|
4885
|
+
chain: {
|
4886
|
+
latestBlock: { height }
|
4887
|
+
}
|
4888
|
+
} = await this.operations.getLatestBlockHeight();
|
4889
|
+
return (0, import_math18.bn)(height);
|
4981
4890
|
}
|
4982
4891
|
/**
|
4983
4892
|
* Returns the node information for the current provider network.
|
@@ -5524,17 +5433,18 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5524
5433
|
* @returns A promise that resolves to the block or null.
|
5525
5434
|
*/
|
5526
5435
|
async getBlock(idOrHeight) {
|
5527
|
-
let
|
5528
|
-
if (
|
5529
|
-
|
5530
|
-
|
5531
|
-
|
5532
|
-
|
5533
|
-
variables = { blockId: idOrHeight };
|
5436
|
+
let block;
|
5437
|
+
if (idOrHeight === "latest") {
|
5438
|
+
const {
|
5439
|
+
chain: { latestBlock }
|
5440
|
+
} = await this.operations.getLatestBlock();
|
5441
|
+
block = latestBlock;
|
5534
5442
|
} else {
|
5535
|
-
|
5443
|
+
const isblockId = typeof idOrHeight === "string" && idOrHeight.length === 66;
|
5444
|
+
const variables = isblockId ? { blockId: idOrHeight } : { height: (0, import_math18.bn)(idOrHeight).toString(10) };
|
5445
|
+
const response = await this.operations.getBlock(variables);
|
5446
|
+
block = response.block;
|
5536
5447
|
}
|
5537
|
-
const { block } = await this.operations.getBlock(variables);
|
5538
5448
|
if (!block) {
|
5539
5449
|
return null;
|
5540
5450
|
}
|
@@ -5660,7 +5570,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5660
5570
|
async getTransactions(paginationArgs) {
|
5661
5571
|
const {
|
5662
5572
|
transactions: { edges, pageInfo }
|
5663
|
-
} = await this.operations.getTransactions(
|
5573
|
+
} = await this.operations.getTransactions({
|
5574
|
+
...this.validatePaginationArgs({
|
5575
|
+
inputArgs: paginationArgs,
|
5576
|
+
paginationLimit: TRANSACTIONS_PAGE_SIZE_LIMIT
|
5577
|
+
})
|
5578
|
+
});
|
5664
5579
|
const coder = new import_transactions22.TransactionCoder();
|
5665
5580
|
const transactions = edges.map(({ node: { rawPayload } }) => {
|
5666
5581
|
try {
|
@@ -5916,6 +5831,40 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5916
5831
|
});
|
5917
5832
|
return (0, import_math18.bn)(latestBlockHeight);
|
5918
5833
|
}
|
5834
|
+
/**
|
5835
|
+
* Check if the given ID is an account.
|
5836
|
+
*
|
5837
|
+
* @param id - The ID to check.
|
5838
|
+
* @returns A promise that resolves to the result of the check.
|
5839
|
+
*/
|
5840
|
+
async isUserAccount(id) {
|
5841
|
+
const { contract, blob, transaction } = await this.operations.isUserAccount({
|
5842
|
+
blobId: id,
|
5843
|
+
contractId: id,
|
5844
|
+
transactionId: id
|
5845
|
+
});
|
5846
|
+
if (contract || blob || transaction) {
|
5847
|
+
return false;
|
5848
|
+
}
|
5849
|
+
return true;
|
5850
|
+
}
|
5851
|
+
async getAddressType(id) {
|
5852
|
+
const { contract, blob, transaction } = await this.operations.isUserAccount({
|
5853
|
+
blobId: id,
|
5854
|
+
contractId: id,
|
5855
|
+
transactionId: id
|
5856
|
+
});
|
5857
|
+
if (contract) {
|
5858
|
+
return "Contract";
|
5859
|
+
}
|
5860
|
+
if (blob) {
|
5861
|
+
return "Blob";
|
5862
|
+
}
|
5863
|
+
if (transaction) {
|
5864
|
+
return "Transaction";
|
5865
|
+
}
|
5866
|
+
return "Account";
|
5867
|
+
}
|
5919
5868
|
/**
|
5920
5869
|
* Get the transaction response for the given transaction ID.
|
5921
5870
|
*
|
@@ -11842,6 +11791,7 @@ __publicField(Fuel, "defaultConfig", {});
|
|
11842
11791
|
ScriptTransactionRequest,
|
11843
11792
|
Signer,
|
11844
11793
|
StorageAbstract,
|
11794
|
+
TRANSACTIONS_PAGE_SIZE_LIMIT,
|
11845
11795
|
TransactionResponse,
|
11846
11796
|
TransactionStatus,
|
11847
11797
|
TransactionType,
|