@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/test-utils.js
CHANGED
@@ -655,6 +655,26 @@ var DryRunTransactionExecutionStatusFragmentDoc = import_graphql_tag.default`
|
|
655
655
|
}
|
656
656
|
${DryRunTransactionStatusFragmentDoc}
|
657
657
|
${ReceiptFragmentDoc}`;
|
658
|
+
var BlockFragmentDoc = import_graphql_tag.default`
|
659
|
+
fragment blockFragment on Block {
|
660
|
+
id
|
661
|
+
height
|
662
|
+
header {
|
663
|
+
time
|
664
|
+
daHeight
|
665
|
+
stateTransitionBytecodeVersion
|
666
|
+
transactionsCount
|
667
|
+
transactionsRoot
|
668
|
+
messageOutboxRoot
|
669
|
+
eventInboxRoot
|
670
|
+
prevRoot
|
671
|
+
applicationHash
|
672
|
+
}
|
673
|
+
transactions {
|
674
|
+
id
|
675
|
+
}
|
676
|
+
}
|
677
|
+
`;
|
658
678
|
var CoinFragmentDoc = import_graphql_tag.default`
|
659
679
|
fragment coinFragment on Coin {
|
660
680
|
type: __typename
|
@@ -736,33 +756,6 @@ var MessageProofFragmentDoc = import_graphql_tag.default`
|
|
736
756
|
data
|
737
757
|
}
|
738
758
|
`;
|
739
|
-
var BalanceFragmentDoc = import_graphql_tag.default`
|
740
|
-
fragment balanceFragment on Balance {
|
741
|
-
owner
|
742
|
-
amount
|
743
|
-
assetId
|
744
|
-
}
|
745
|
-
`;
|
746
|
-
var BlockFragmentDoc = import_graphql_tag.default`
|
747
|
-
fragment blockFragment on Block {
|
748
|
-
id
|
749
|
-
height
|
750
|
-
header {
|
751
|
-
time
|
752
|
-
daHeight
|
753
|
-
stateTransitionBytecodeVersion
|
754
|
-
transactionsCount
|
755
|
-
transactionsRoot
|
756
|
-
messageOutboxRoot
|
757
|
-
eventInboxRoot
|
758
|
-
prevRoot
|
759
|
-
applicationHash
|
760
|
-
}
|
761
|
-
transactions {
|
762
|
-
id
|
763
|
-
}
|
764
|
-
}
|
765
|
-
`;
|
766
759
|
var TxParametersFragmentDoc = import_graphql_tag.default`
|
767
760
|
fragment TxParametersFragment on TxParameters {
|
768
761
|
version
|
@@ -820,167 +813,6 @@ var DependentCostFragmentDoc = import_graphql_tag.default`
|
|
820
813
|
`;
|
821
814
|
var GasCostsFragmentDoc = import_graphql_tag.default`
|
822
815
|
fragment GasCostsFragment on GasCosts {
|
823
|
-
version
|
824
|
-
add
|
825
|
-
addi
|
826
|
-
aloc
|
827
|
-
and
|
828
|
-
andi
|
829
|
-
bal
|
830
|
-
bhei
|
831
|
-
bhsh
|
832
|
-
burn
|
833
|
-
cb
|
834
|
-
cfei
|
835
|
-
cfsi
|
836
|
-
div
|
837
|
-
divi
|
838
|
-
ecr1
|
839
|
-
eck1
|
840
|
-
ed19
|
841
|
-
eq
|
842
|
-
exp
|
843
|
-
expi
|
844
|
-
flag
|
845
|
-
gm
|
846
|
-
gt
|
847
|
-
gtf
|
848
|
-
ji
|
849
|
-
jmp
|
850
|
-
jne
|
851
|
-
jnei
|
852
|
-
jnzi
|
853
|
-
jmpf
|
854
|
-
jmpb
|
855
|
-
jnzf
|
856
|
-
jnzb
|
857
|
-
jnef
|
858
|
-
jneb
|
859
|
-
lb
|
860
|
-
log
|
861
|
-
lt
|
862
|
-
lw
|
863
|
-
mint
|
864
|
-
mlog
|
865
|
-
modOp
|
866
|
-
modi
|
867
|
-
moveOp
|
868
|
-
movi
|
869
|
-
mroo
|
870
|
-
mul
|
871
|
-
muli
|
872
|
-
mldv
|
873
|
-
noop
|
874
|
-
not
|
875
|
-
or
|
876
|
-
ori
|
877
|
-
poph
|
878
|
-
popl
|
879
|
-
pshh
|
880
|
-
pshl
|
881
|
-
ret
|
882
|
-
rvrt
|
883
|
-
sb
|
884
|
-
sll
|
885
|
-
slli
|
886
|
-
srl
|
887
|
-
srli
|
888
|
-
srw
|
889
|
-
sub
|
890
|
-
subi
|
891
|
-
sw
|
892
|
-
sww
|
893
|
-
time
|
894
|
-
tr
|
895
|
-
tro
|
896
|
-
wdcm
|
897
|
-
wqcm
|
898
|
-
wdop
|
899
|
-
wqop
|
900
|
-
wdml
|
901
|
-
wqml
|
902
|
-
wddv
|
903
|
-
wqdv
|
904
|
-
wdmd
|
905
|
-
wqmd
|
906
|
-
wdam
|
907
|
-
wqam
|
908
|
-
wdmm
|
909
|
-
wqmm
|
910
|
-
xor
|
911
|
-
xori
|
912
|
-
alocDependentCost {
|
913
|
-
...DependentCostFragment
|
914
|
-
}
|
915
|
-
bldd {
|
916
|
-
...DependentCostFragment
|
917
|
-
}
|
918
|
-
bsiz {
|
919
|
-
...DependentCostFragment
|
920
|
-
}
|
921
|
-
cfe {
|
922
|
-
...DependentCostFragment
|
923
|
-
}
|
924
|
-
cfeiDependentCost {
|
925
|
-
...DependentCostFragment
|
926
|
-
}
|
927
|
-
call {
|
928
|
-
...DependentCostFragment
|
929
|
-
}
|
930
|
-
ccp {
|
931
|
-
...DependentCostFragment
|
932
|
-
}
|
933
|
-
croo {
|
934
|
-
...DependentCostFragment
|
935
|
-
}
|
936
|
-
csiz {
|
937
|
-
...DependentCostFragment
|
938
|
-
}
|
939
|
-
ed19DependentCost {
|
940
|
-
...DependentCostFragment
|
941
|
-
}
|
942
|
-
k256 {
|
943
|
-
...DependentCostFragment
|
944
|
-
}
|
945
|
-
ldc {
|
946
|
-
...DependentCostFragment
|
947
|
-
}
|
948
|
-
logd {
|
949
|
-
...DependentCostFragment
|
950
|
-
}
|
951
|
-
mcl {
|
952
|
-
...DependentCostFragment
|
953
|
-
}
|
954
|
-
mcli {
|
955
|
-
...DependentCostFragment
|
956
|
-
}
|
957
|
-
mcp {
|
958
|
-
...DependentCostFragment
|
959
|
-
}
|
960
|
-
mcpi {
|
961
|
-
...DependentCostFragment
|
962
|
-
}
|
963
|
-
meq {
|
964
|
-
...DependentCostFragment
|
965
|
-
}
|
966
|
-
retd {
|
967
|
-
...DependentCostFragment
|
968
|
-
}
|
969
|
-
s256 {
|
970
|
-
...DependentCostFragment
|
971
|
-
}
|
972
|
-
scwq {
|
973
|
-
...DependentCostFragment
|
974
|
-
}
|
975
|
-
smo {
|
976
|
-
...DependentCostFragment
|
977
|
-
}
|
978
|
-
srwq {
|
979
|
-
...DependentCostFragment
|
980
|
-
}
|
981
|
-
swwq {
|
982
|
-
...DependentCostFragment
|
983
|
-
}
|
984
816
|
contractRoot {
|
985
817
|
...DependentCostFragment
|
986
818
|
}
|
@@ -990,6 +822,10 @@ var GasCostsFragmentDoc = import_graphql_tag.default`
|
|
990
822
|
vmInitialization {
|
991
823
|
...DependentCostFragment
|
992
824
|
}
|
825
|
+
s256 {
|
826
|
+
...DependentCostFragment
|
827
|
+
}
|
828
|
+
ecr1
|
993
829
|
newStoragePerByte
|
994
830
|
}
|
995
831
|
${DependentCostFragmentDoc}`;
|
@@ -1026,16 +862,12 @@ ${GasCostsFragmentDoc}`;
|
|
1026
862
|
var ChainInfoFragmentDoc = import_graphql_tag.default`
|
1027
863
|
fragment chainInfoFragment on ChainInfo {
|
1028
864
|
name
|
1029
|
-
latestBlock {
|
1030
|
-
...blockFragment
|
1031
|
-
}
|
1032
865
|
daHeight
|
1033
866
|
consensusParameters {
|
1034
867
|
...consensusParametersFragment
|
1035
868
|
}
|
1036
869
|
}
|
1037
|
-
${
|
1038
|
-
${ConsensusParametersFragmentDoc}`;
|
870
|
+
${ConsensusParametersFragmentDoc}`;
|
1039
871
|
var ContractBalanceFragmentDoc = import_graphql_tag.default`
|
1040
872
|
fragment contractBalanceFragment on ContractBalance {
|
1041
873
|
contract
|
@@ -1068,6 +900,12 @@ var RelayedTransactionStatusFragmentDoc = import_graphql_tag.default`
|
|
1068
900
|
}
|
1069
901
|
}
|
1070
902
|
`;
|
903
|
+
var TransactionRawPayloadFragmentDoc = import_graphql_tag.default`
|
904
|
+
fragment transactionRawPayload on Transaction {
|
905
|
+
id
|
906
|
+
rawPayload
|
907
|
+
}
|
908
|
+
`;
|
1071
909
|
var GetVersionDocument = import_graphql_tag.default`
|
1072
910
|
query getVersion {
|
1073
911
|
nodeInfo {
|
@@ -1089,6 +927,17 @@ var GetChainDocument = import_graphql_tag.default`
|
|
1089
927
|
}
|
1090
928
|
}
|
1091
929
|
${ChainInfoFragmentDoc}`;
|
930
|
+
var GetChainAndNodeInfoDocument = import_graphql_tag.default`
|
931
|
+
query getChainAndNodeInfo {
|
932
|
+
chain {
|
933
|
+
...chainInfoFragment
|
934
|
+
}
|
935
|
+
nodeInfo {
|
936
|
+
...nodeInfoFragment
|
937
|
+
}
|
938
|
+
}
|
939
|
+
${ChainInfoFragmentDoc}
|
940
|
+
${NodeInfoFragmentDoc}`;
|
1092
941
|
var GetTransactionDocument = import_graphql_tag.default`
|
1093
942
|
query getTransaction($transactionId: TransactionId!) {
|
1094
943
|
transaction(id: $transactionId) {
|
@@ -1146,6 +995,24 @@ var EstimatePredicatesDocument = import_graphql_tag.default`
|
|
1146
995
|
}
|
1147
996
|
}
|
1148
997
|
${TransactionEstimatePredicatesFragmentDoc}`;
|
998
|
+
var GetLatestBlockDocument = import_graphql_tag.default`
|
999
|
+
query getLatestBlock {
|
1000
|
+
chain {
|
1001
|
+
latestBlock {
|
1002
|
+
...blockFragment
|
1003
|
+
}
|
1004
|
+
}
|
1005
|
+
}
|
1006
|
+
${BlockFragmentDoc}`;
|
1007
|
+
var GetLatestBlockHeightDocument = import_graphql_tag.default`
|
1008
|
+
query getLatestBlockHeight {
|
1009
|
+
chain {
|
1010
|
+
latestBlock {
|
1011
|
+
height
|
1012
|
+
}
|
1013
|
+
}
|
1014
|
+
}
|
1015
|
+
`;
|
1149
1016
|
var GetBlockDocument = import_graphql_tag.default`
|
1150
1017
|
query getBlock($blockId: BlockId, $height: U32) {
|
1151
1018
|
block(id: $blockId, height: $height) {
|
@@ -1158,12 +1025,12 @@ var GetBlockWithTransactionsDocument = import_graphql_tag.default`
|
|
1158
1025
|
block(id: $blockId, height: $blockHeight) {
|
1159
1026
|
...blockFragment
|
1160
1027
|
transactions {
|
1161
|
-
...
|
1028
|
+
...transactionRawPayload
|
1162
1029
|
}
|
1163
1030
|
}
|
1164
1031
|
}
|
1165
1032
|
${BlockFragmentDoc}
|
1166
|
-
${
|
1033
|
+
${TransactionRawPayloadFragmentDoc}`;
|
1167
1034
|
var GetBlocksDocument = import_graphql_tag.default`
|
1168
1035
|
query getBlocks($after: String, $before: String, $first: Int, $last: Int) {
|
1169
1036
|
blocks(after: $after, before: $before, first: $first, last: $last) {
|
@@ -1238,10 +1105,10 @@ var GetContractBalanceDocument = import_graphql_tag.default`
|
|
1238
1105
|
var GetBalanceDocument = import_graphql_tag.default`
|
1239
1106
|
query getBalance($owner: Address!, $assetId: AssetId!) {
|
1240
1107
|
balance(owner: $owner, assetId: $assetId) {
|
1241
|
-
|
1108
|
+
amount
|
1242
1109
|
}
|
1243
1110
|
}
|
1244
|
-
|
1111
|
+
`;
|
1245
1112
|
var GetLatestGasPriceDocument = import_graphql_tag.default`
|
1246
1113
|
query getLatestGasPrice {
|
1247
1114
|
latestGasPrice {
|
@@ -1270,13 +1137,13 @@ var GetBalancesDocument = import_graphql_tag.default`
|
|
1270
1137
|
}
|
1271
1138
|
edges {
|
1272
1139
|
node {
|
1273
|
-
|
1140
|
+
assetId
|
1141
|
+
amount
|
1274
1142
|
}
|
1275
1143
|
}
|
1276
1144
|
}
|
1277
1145
|
}
|
1278
|
-
${PageInfoFragmentDoc}
|
1279
|
-
${BalanceFragmentDoc}`;
|
1146
|
+
${PageInfoFragmentDoc}`;
|
1280
1147
|
var GetMessagesDocument = import_graphql_tag.default`
|
1281
1148
|
query getMessages($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
|
1282
1149
|
messages(
|
@@ -1357,6 +1224,19 @@ var GetMessageByNonceDocument = import_graphql_tag.default`
|
|
1357
1224
|
}
|
1358
1225
|
}
|
1359
1226
|
${MessageFragmentDoc}`;
|
1227
|
+
var IsUserAccountDocument = import_graphql_tag.default`
|
1228
|
+
query isUserAccount($blobId: BlobId!, $contractId: ContractId!, $transactionId: TransactionId!) {
|
1229
|
+
blob(id: $blobId) {
|
1230
|
+
id
|
1231
|
+
}
|
1232
|
+
contract(id: $contractId) {
|
1233
|
+
id
|
1234
|
+
}
|
1235
|
+
transaction(id: $transactionId) {
|
1236
|
+
id
|
1237
|
+
}
|
1238
|
+
}
|
1239
|
+
`;
|
1360
1240
|
var SubmitAndAwaitDocument = import_graphql_tag.default`
|
1361
1241
|
subscription submitAndAwait($encodedTransaction: HexString!) {
|
1362
1242
|
submitAndAwait(tx: $encodedTransaction) {
|
@@ -1389,6 +1269,9 @@ function getSdk(requester) {
|
|
1389
1269
|
getChain(variables, options) {
|
1390
1270
|
return requester(GetChainDocument, variables, options);
|
1391
1271
|
},
|
1272
|
+
getChainAndNodeInfo(variables, options) {
|
1273
|
+
return requester(GetChainAndNodeInfoDocument, variables, options);
|
1274
|
+
},
|
1392
1275
|
getTransaction(variables, options) {
|
1393
1276
|
return requester(GetTransactionDocument, variables, options);
|
1394
1277
|
},
|
@@ -1404,6 +1287,12 @@ function getSdk(requester) {
|
|
1404
1287
|
estimatePredicates(variables, options) {
|
1405
1288
|
return requester(EstimatePredicatesDocument, variables, options);
|
1406
1289
|
},
|
1290
|
+
getLatestBlock(variables, options) {
|
1291
|
+
return requester(GetLatestBlockDocument, variables, options);
|
1292
|
+
},
|
1293
|
+
getLatestBlockHeight(variables, options) {
|
1294
|
+
return requester(GetLatestBlockHeightDocument, variables, options);
|
1295
|
+
},
|
1407
1296
|
getBlock(variables, options) {
|
1408
1297
|
return requester(GetBlockDocument, variables, options);
|
1409
1298
|
},
|
@@ -1464,6 +1353,9 @@ function getSdk(requester) {
|
|
1464
1353
|
getMessageByNonce(variables, options) {
|
1465
1354
|
return requester(GetMessageByNonceDocument, variables, options);
|
1466
1355
|
},
|
1356
|
+
isUserAccount(variables, options) {
|
1357
|
+
return requester(IsUserAccountDocument, variables, options);
|
1358
|
+
},
|
1467
1359
|
submitAndAwait(variables, options) {
|
1468
1360
|
return requester(SubmitAndAwaitDocument, variables, options);
|
1469
1361
|
},
|
@@ -4649,10 +4541,11 @@ var handleGqlErrorMessage = (errorMessage, rawError) => {
|
|
4649
4541
|
// src/providers/provider.ts
|
4650
4542
|
var MAX_RETRIES = 10;
|
4651
4543
|
var RESOURCES_PAGE_SIZE_LIMIT = 512;
|
4544
|
+
var TRANSACTIONS_PAGE_SIZE_LIMIT = 60;
|
4652
4545
|
var BLOCKS_PAGE_SIZE_LIMIT = 5;
|
4653
4546
|
var DEFAULT_RESOURCE_CACHE_TTL = 2e4;
|
4654
4547
|
var processGqlChain = (chain) => {
|
4655
|
-
const { name, daHeight, consensusParameters
|
4548
|
+
const { name, daHeight, consensusParameters } = chain;
|
4656
4549
|
const {
|
4657
4550
|
contractParams,
|
4658
4551
|
feeParams,
|
@@ -4703,14 +4596,6 @@ var processGqlChain = (chain) => {
|
|
4703
4596
|
maxScriptDataLength: (0, import_math19.bn)(scriptParams.maxScriptDataLength)
|
4704
4597
|
},
|
4705
4598
|
gasCosts
|
4706
|
-
},
|
4707
|
-
latestBlock: {
|
4708
|
-
id: latestBlock.id,
|
4709
|
-
height: (0, import_math19.bn)(latestBlock.height),
|
4710
|
-
time: latestBlock.header.time,
|
4711
|
-
transactions: latestBlock.transactions.map((i) => ({
|
4712
|
-
id: i.id
|
4713
|
-
}))
|
4714
4599
|
}
|
4715
4600
|
};
|
4716
4601
|
};
|
@@ -4741,14 +4626,17 @@ var _Provider = class {
|
|
4741
4626
|
retryOptions: void 0,
|
4742
4627
|
headers: void 0
|
4743
4628
|
});
|
4744
|
-
const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
|
4629
|
+
const { url: rawUrl, urlWithoutAuth, headers: authHeaders } = _Provider.extractBasicAuth(url);
|
4745
4630
|
this.url = rawUrl;
|
4746
4631
|
this.urlWithoutAuth = urlWithoutAuth;
|
4747
|
-
this.options = { ...this.options, ...options };
|
4748
4632
|
this.url = url;
|
4749
|
-
|
4750
|
-
|
4751
|
-
|
4633
|
+
const { FUELS } = import_versions.versions;
|
4634
|
+
const headers = { ...authHeaders, ...options.headers, Source: `ts-sdk-${FUELS}` };
|
4635
|
+
this.options = {
|
4636
|
+
...this.options,
|
4637
|
+
...options,
|
4638
|
+
headers
|
4639
|
+
};
|
4752
4640
|
this.operations = this.createOperations();
|
4753
4641
|
const { resourceCacheTTL } = this.options;
|
4754
4642
|
if ((0, import_utils30.isDefined)(resourceCacheTTL)) {
|
@@ -4887,9 +4775,25 @@ var _Provider = class {
|
|
4887
4775
|
* @returns A promise that resolves to the Chain and NodeInfo.
|
4888
4776
|
*/
|
4889
4777
|
async fetchChainAndNodeInfo() {
|
4890
|
-
|
4891
|
-
|
4892
|
-
|
4778
|
+
let nodeInfo;
|
4779
|
+
let chain;
|
4780
|
+
try {
|
4781
|
+
nodeInfo = this.getNode();
|
4782
|
+
chain = this.getChain();
|
4783
|
+
} catch (error) {
|
4784
|
+
const data = await this.operations.getChainAndNodeInfo();
|
4785
|
+
nodeInfo = {
|
4786
|
+
maxDepth: (0, import_math19.bn)(data.nodeInfo.maxDepth),
|
4787
|
+
maxTx: (0, import_math19.bn)(data.nodeInfo.maxTx),
|
4788
|
+
nodeVersion: data.nodeInfo.nodeVersion,
|
4789
|
+
utxoValidation: data.nodeInfo.utxoValidation,
|
4790
|
+
vmBacktrace: data.nodeInfo.vmBacktrace
|
4791
|
+
};
|
4792
|
+
_Provider.ensureClientVersionIsSupported(nodeInfo);
|
4793
|
+
chain = processGqlChain(data.chain);
|
4794
|
+
_Provider.chainInfoCache[this.urlWithoutAuth] = chain;
|
4795
|
+
_Provider.nodeInfoCache[this.urlWithoutAuth] = nodeInfo;
|
4796
|
+
}
|
4893
4797
|
return {
|
4894
4798
|
chain,
|
4895
4799
|
nodeInfo
|
@@ -4981,8 +4885,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4981
4885
|
* @returns A promise that resolves to the latest block number.
|
4982
4886
|
*/
|
4983
4887
|
async getBlockNumber() {
|
4984
|
-
const {
|
4985
|
-
|
4888
|
+
const {
|
4889
|
+
chain: {
|
4890
|
+
latestBlock: { height }
|
4891
|
+
}
|
4892
|
+
} = await this.operations.getLatestBlockHeight();
|
4893
|
+
return (0, import_math19.bn)(height);
|
4986
4894
|
}
|
4987
4895
|
/**
|
4988
4896
|
* Returns the node information for the current provider network.
|
@@ -5529,17 +5437,18 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5529
5437
|
* @returns A promise that resolves to the block or null.
|
5530
5438
|
*/
|
5531
5439
|
async getBlock(idOrHeight) {
|
5532
|
-
let
|
5533
|
-
if (
|
5534
|
-
|
5535
|
-
|
5536
|
-
|
5537
|
-
|
5538
|
-
variables = { blockId: idOrHeight };
|
5440
|
+
let block;
|
5441
|
+
if (idOrHeight === "latest") {
|
5442
|
+
const {
|
5443
|
+
chain: { latestBlock }
|
5444
|
+
} = await this.operations.getLatestBlock();
|
5445
|
+
block = latestBlock;
|
5539
5446
|
} else {
|
5540
|
-
|
5447
|
+
const isblockId = typeof idOrHeight === "string" && idOrHeight.length === 66;
|
5448
|
+
const variables = isblockId ? { blockId: idOrHeight } : { height: (0, import_math19.bn)(idOrHeight).toString(10) };
|
5449
|
+
const response = await this.operations.getBlock(variables);
|
5450
|
+
block = response.block;
|
5541
5451
|
}
|
5542
|
-
const { block } = await this.operations.getBlock(variables);
|
5543
5452
|
if (!block) {
|
5544
5453
|
return null;
|
5545
5454
|
}
|
@@ -5665,7 +5574,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5665
5574
|
async getTransactions(paginationArgs) {
|
5666
5575
|
const {
|
5667
5576
|
transactions: { edges, pageInfo }
|
5668
|
-
} = await this.operations.getTransactions(
|
5577
|
+
} = await this.operations.getTransactions({
|
5578
|
+
...this.validatePaginationArgs({
|
5579
|
+
inputArgs: paginationArgs,
|
5580
|
+
paginationLimit: TRANSACTIONS_PAGE_SIZE_LIMIT
|
5581
|
+
})
|
5582
|
+
});
|
5669
5583
|
const coder = new import_transactions22.TransactionCoder();
|
5670
5584
|
const transactions = edges.map(({ node: { rawPayload } }) => {
|
5671
5585
|
try {
|
@@ -5921,6 +5835,40 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5921
5835
|
});
|
5922
5836
|
return (0, import_math19.bn)(latestBlockHeight);
|
5923
5837
|
}
|
5838
|
+
/**
|
5839
|
+
* Check if the given ID is an account.
|
5840
|
+
*
|
5841
|
+
* @param id - The ID to check.
|
5842
|
+
* @returns A promise that resolves to the result of the check.
|
5843
|
+
*/
|
5844
|
+
async isUserAccount(id) {
|
5845
|
+
const { contract, blob, transaction } = await this.operations.isUserAccount({
|
5846
|
+
blobId: id,
|
5847
|
+
contractId: id,
|
5848
|
+
transactionId: id
|
5849
|
+
});
|
5850
|
+
if (contract || blob || transaction) {
|
5851
|
+
return false;
|
5852
|
+
}
|
5853
|
+
return true;
|
5854
|
+
}
|
5855
|
+
async getAddressType(id) {
|
5856
|
+
const { contract, blob, transaction } = await this.operations.isUserAccount({
|
5857
|
+
blobId: id,
|
5858
|
+
contractId: id,
|
5859
|
+
transactionId: id
|
5860
|
+
});
|
5861
|
+
if (contract) {
|
5862
|
+
return "Contract";
|
5863
|
+
}
|
5864
|
+
if (blob) {
|
5865
|
+
return "Blob";
|
5866
|
+
}
|
5867
|
+
if (transaction) {
|
5868
|
+
return "Transaction";
|
5869
|
+
}
|
5870
|
+
return "Account";
|
5871
|
+
}
|
5924
5872
|
/**
|
5925
5873
|
* Get the transaction response for the given transaction ID.
|
5926
5874
|
*
|