@fuel-ts/account 0.90.0 → 0.92.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 +4 -4
- package/dist/account.d.ts.map +1 -1
- package/dist/connectors/fuel-connector.d.ts +2 -2
- package/dist/index.global.js +1079 -622
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +181 -117
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +179 -117
- package/dist/index.mjs.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +682 -507
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/assets/utils/network.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +27 -6
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts +13 -0
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/utils/extract-tx-error.d.ts +2 -8
- package/dist/providers/utils/extract-tx-error.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts +4 -16
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils/setup-test-provider-and-wallets.d.ts +2 -1
- package/dist/test-utils/setup-test-provider-and-wallets.d.ts.map +1 -1
- package/dist/test-utils.global.js +1164 -778
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +254 -172
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +253 -170
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +24 -25
package/dist/index.js
CHANGED
@@ -59,6 +59,7 @@ var src_exports = {};
|
|
59
59
|
__export(src_exports, {
|
60
60
|
Account: () => Account,
|
61
61
|
AddressType: () => AddressType,
|
62
|
+
BLOCKS_PAGE_SIZE_LIMIT: () => BLOCKS_PAGE_SIZE_LIMIT,
|
62
63
|
BaseTransactionRequest: () => BaseTransactionRequest,
|
63
64
|
BaseWalletUnlocked: () => BaseWalletUnlocked,
|
64
65
|
CHAIN_IDS: () => CHAIN_IDS,
|
@@ -83,6 +84,7 @@ __export(src_exports, {
|
|
83
84
|
Predicate: () => Predicate,
|
84
85
|
PrivateKeyVault: () => PrivateKeyVault,
|
85
86
|
Provider: () => Provider,
|
87
|
+
RESOURCES_PAGE_SIZE_LIMIT: () => RESOURCES_PAGE_SIZE_LIMIT,
|
86
88
|
ScriptTransactionRequest: () => ScriptTransactionRequest,
|
87
89
|
Signer: () => Signer,
|
88
90
|
StorageAbstract: () => StorageAbstract,
|
@@ -676,6 +678,12 @@ var GasCostsFragmentDoc = import_graphql_tag.default`
|
|
676
678
|
alocDependentCost {
|
677
679
|
...DependentCostFragment
|
678
680
|
}
|
681
|
+
cfe {
|
682
|
+
...DependentCostFragment
|
683
|
+
}
|
684
|
+
cfeiDependentCost {
|
685
|
+
...DependentCostFragment
|
686
|
+
}
|
679
687
|
call {
|
680
688
|
...DependentCostFragment
|
681
689
|
}
|
@@ -916,6 +924,9 @@ ${TransactionFragmentDoc}`;
|
|
916
924
|
var GetBlocksDocument = import_graphql_tag.default`
|
917
925
|
query getBlocks($after: String, $before: String, $first: Int, $last: Int) {
|
918
926
|
blocks(after: $after, before: $before, first: $first, last: $last) {
|
927
|
+
pageInfo {
|
928
|
+
...pageInfoFragment
|
929
|
+
}
|
919
930
|
edges {
|
920
931
|
node {
|
921
932
|
...blockFragment
|
@@ -923,7 +934,8 @@ var GetBlocksDocument = import_graphql_tag.default`
|
|
923
934
|
}
|
924
935
|
}
|
925
936
|
}
|
926
|
-
${
|
937
|
+
${PageInfoFragmentDoc}
|
938
|
+
${BlockFragmentDoc}`;
|
927
939
|
var GetCoinDocument = import_graphql_tag.default`
|
928
940
|
query getCoin($coinId: UtxoId!) {
|
929
941
|
coin(utxoId: $coinId) {
|
@@ -940,6 +952,9 @@ var GetCoinsDocument = import_graphql_tag.default`
|
|
940
952
|
first: $first
|
941
953
|
last: $last
|
942
954
|
) {
|
955
|
+
pageInfo {
|
956
|
+
...pageInfoFragment
|
957
|
+
}
|
943
958
|
edges {
|
944
959
|
node {
|
945
960
|
...coinFragment
|
@@ -947,7 +962,8 @@ var GetCoinsDocument = import_graphql_tag.default`
|
|
947
962
|
}
|
948
963
|
}
|
949
964
|
}
|
950
|
-
${
|
965
|
+
${PageInfoFragmentDoc}
|
966
|
+
${CoinFragmentDoc}`;
|
951
967
|
var GetCoinsToSpendDocument = import_graphql_tag.default`
|
952
968
|
query getCoinsToSpend($owner: Address!, $queryPerAsset: [SpendQueryElementInput!]!, $excludedIds: ExcludeInput) {
|
953
969
|
coinsToSpend(
|
@@ -1006,6 +1022,9 @@ var GetBalancesDocument = import_graphql_tag.default`
|
|
1006
1022
|
first: $first
|
1007
1023
|
last: $last
|
1008
1024
|
) {
|
1025
|
+
pageInfo {
|
1026
|
+
...pageInfoFragment
|
1027
|
+
}
|
1009
1028
|
edges {
|
1010
1029
|
node {
|
1011
1030
|
...balanceFragment
|
@@ -1013,7 +1032,8 @@ var GetBalancesDocument = import_graphql_tag.default`
|
|
1013
1032
|
}
|
1014
1033
|
}
|
1015
1034
|
}
|
1016
|
-
${
|
1035
|
+
${PageInfoFragmentDoc}
|
1036
|
+
${BalanceFragmentDoc}`;
|
1017
1037
|
var GetMessagesDocument = import_graphql_tag.default`
|
1018
1038
|
query getMessages($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
|
1019
1039
|
messages(
|
@@ -1023,6 +1043,9 @@ var GetMessagesDocument = import_graphql_tag.default`
|
|
1023
1043
|
first: $first
|
1024
1044
|
last: $last
|
1025
1045
|
) {
|
1046
|
+
pageInfo {
|
1047
|
+
...pageInfoFragment
|
1048
|
+
}
|
1026
1049
|
edges {
|
1027
1050
|
node {
|
1028
1051
|
...messageFragment
|
@@ -1030,7 +1053,8 @@ var GetMessagesDocument = import_graphql_tag.default`
|
|
1030
1053
|
}
|
1031
1054
|
}
|
1032
1055
|
}
|
1033
|
-
${
|
1056
|
+
${PageInfoFragmentDoc}
|
1057
|
+
${MessageFragmentDoc}`;
|
1034
1058
|
var GetMessageProofDocument = import_graphql_tag.default`
|
1035
1059
|
query getMessageProof($transactionId: TransactionId!, $nonce: Nonce!, $commitBlockId: BlockId, $commitBlockHeight: U32) {
|
1036
1060
|
messageProof(
|
@@ -1884,7 +1908,7 @@ var import_errors7 = require("@fuel-ts/errors");
|
|
1884
1908
|
var import_math6 = require("@fuel-ts/math");
|
1885
1909
|
var import_transactions5 = require("@fuel-ts/transactions");
|
1886
1910
|
var import_configs5 = require("@fuel-ts/transactions/configs");
|
1887
|
-
var assemblePanicError = (statusReason) => {
|
1911
|
+
var assemblePanicError = (statusReason, metadata) => {
|
1888
1912
|
let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
|
1889
1913
|
if (import_configs5.PANIC_REASONS.includes(statusReason)) {
|
1890
1914
|
errorMessage = `${errorMessage}
|
@@ -1893,10 +1917,13 @@ You can read more about this error at:
|
|
1893
1917
|
|
1894
1918
|
${import_configs5.PANIC_DOC_URL}#variant.${statusReason}`;
|
1895
1919
|
}
|
1896
|
-
return
|
1920
|
+
return new import_errors7.FuelError(import_errors7.ErrorCode.SCRIPT_REVERTED, errorMessage, {
|
1921
|
+
...metadata,
|
1922
|
+
reason: statusReason
|
1923
|
+
});
|
1897
1924
|
};
|
1898
1925
|
var stringify = (obj) => JSON.stringify(obj, null, 2);
|
1899
|
-
var assembleRevertError = (receipts, logs) => {
|
1926
|
+
var assembleRevertError = (receipts, logs, metadata) => {
|
1900
1927
|
let errorMessage = "The transaction reverted with an unknown reason.";
|
1901
1928
|
const revertReceipt = receipts.find(({ type }) => type === import_transactions5.ReceiptType.Revert);
|
1902
1929
|
let reason = "";
|
@@ -1929,25 +1956,36 @@ var assembleRevertError = (receipts, logs) => {
|
|
1929
1956
|
errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
|
1930
1957
|
break;
|
1931
1958
|
default:
|
1932
|
-
|
1933
|
-
|
1959
|
+
throw new import_errors7.FuelError(
|
1960
|
+
import_errors7.ErrorCode.UNKNOWN,
|
1961
|
+
`The transaction reverted with an unknown reason: ${revertReceipt.val}`,
|
1962
|
+
{
|
1963
|
+
...metadata,
|
1964
|
+
reason: "unknown"
|
1965
|
+
}
|
1966
|
+
);
|
1934
1967
|
}
|
1935
1968
|
}
|
1936
|
-
return
|
1969
|
+
return new import_errors7.FuelError(import_errors7.ErrorCode.SCRIPT_REVERTED, errorMessage, {
|
1970
|
+
...metadata,
|
1971
|
+
reason
|
1972
|
+
});
|
1937
1973
|
};
|
1938
1974
|
var extractTxError = (params) => {
|
1939
1975
|
const { receipts, statusReason, logs } = params;
|
1940
1976
|
const isPanic = receipts.some(({ type }) => type === import_transactions5.ReceiptType.Panic);
|
1941
1977
|
const isRevert = receipts.some(({ type }) => type === import_transactions5.ReceiptType.Revert);
|
1942
|
-
const { errorMessage, reason } = isPanic ? assemblePanicError(statusReason) : assembleRevertError(receipts, logs);
|
1943
1978
|
const metadata = {
|
1944
1979
|
logs,
|
1945
1980
|
receipts,
|
1946
1981
|
panic: isPanic,
|
1947
1982
|
revert: isRevert,
|
1948
|
-
reason
|
1983
|
+
reason: ""
|
1949
1984
|
};
|
1950
|
-
|
1985
|
+
if (isPanic) {
|
1986
|
+
return assemblePanicError(statusReason, metadata);
|
1987
|
+
}
|
1988
|
+
return assembleRevertError(receipts, logs, metadata);
|
1951
1989
|
};
|
1952
1990
|
|
1953
1991
|
// src/providers/transaction-request/errors.ts
|
@@ -3858,12 +3896,18 @@ var TransactionResponse = class {
|
|
3858
3896
|
await this.fetch();
|
3859
3897
|
}
|
3860
3898
|
/**
|
3861
|
-
*
|
3899
|
+
* Assembles the result of a transaction by retrieving the transaction summary,
|
3900
|
+
* decoding logs (if available), and handling transaction failure.
|
3862
3901
|
*
|
3863
|
-
*
|
3902
|
+
* This method can be used to obtain the result of a transaction that has just
|
3903
|
+
* been submitted or one that has already been processed.
|
3904
|
+
*
|
3905
|
+
* @template TTransactionType - The type of the transaction.
|
3906
|
+
* @param contractsAbiMap - The map of contract ABIs.
|
3907
|
+
* @returns - The assembled transaction result.
|
3908
|
+
* @throws If the transaction status is a failure.
|
3864
3909
|
*/
|
3865
|
-
async
|
3866
|
-
await this.waitForStatusChange();
|
3910
|
+
async assembleResult(contractsAbiMap) {
|
3867
3911
|
const transactionSummary = await this.getTransactionSummary(contractsAbiMap);
|
3868
3912
|
const transactionResult = {
|
3869
3913
|
gqlTransaction: this.gqlTransaction,
|
@@ -3889,6 +3933,15 @@ var TransactionResponse = class {
|
|
3889
3933
|
}
|
3890
3934
|
return transactionResult;
|
3891
3935
|
}
|
3936
|
+
/**
|
3937
|
+
* Waits for transaction to complete and returns the result.
|
3938
|
+
*
|
3939
|
+
* @returns The completed transaction result
|
3940
|
+
*/
|
3941
|
+
async waitForResult(contractsAbiMap) {
|
3942
|
+
await this.waitForStatusChange();
|
3943
|
+
return this.assembleResult(contractsAbiMap);
|
3944
|
+
}
|
3892
3945
|
/**
|
3893
3946
|
* Waits for transaction to complete and returns the result.
|
3894
3947
|
*
|
@@ -3952,6 +4005,8 @@ var mergeQuantities = (...coinQuantities) => {
|
|
3952
4005
|
|
3953
4006
|
// src/providers/provider.ts
|
3954
4007
|
var MAX_RETRIES = 10;
|
4008
|
+
var RESOURCES_PAGE_SIZE_LIMIT = 512;
|
4009
|
+
var BLOCKS_PAGE_SIZE_LIMIT = 5;
|
3955
4010
|
var processGqlChain = (chain) => {
|
3956
4011
|
const { name, daHeight, consensusParameters, latestBlock } = chain;
|
3957
4012
|
const {
|
@@ -4595,7 +4650,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4595
4650
|
/**
|
4596
4651
|
* Returns a transaction cost to enable user
|
4597
4652
|
* to set gasLimit and also reserve balance amounts
|
4598
|
-
* on the
|
4653
|
+
* on the transaction.
|
4599
4654
|
*
|
4600
4655
|
* @param transactionRequestLike - The transaction request object.
|
4601
4656
|
* @param transactionCostParams - The transaction cost parameters (optional).
|
@@ -4706,20 +4761,27 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4706
4761
|
*/
|
4707
4762
|
async getCoins(owner, assetId, paginationArgs) {
|
4708
4763
|
const ownerAddress = import_address3.Address.fromAddressOrString(owner);
|
4709
|
-
const
|
4710
|
-
|
4711
|
-
|
4764
|
+
const {
|
4765
|
+
coins: { edges, pageInfo }
|
4766
|
+
} = await this.operations.getCoins({
|
4767
|
+
...this.validatePaginationArgs({
|
4768
|
+
paginationLimit: RESOURCES_PAGE_SIZE_LIMIT,
|
4769
|
+
inputArgs: paginationArgs
|
4770
|
+
}),
|
4712
4771
|
filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils23.hexlify)(assetId) }
|
4713
4772
|
});
|
4714
|
-
const coins =
|
4715
|
-
|
4716
|
-
|
4717
|
-
|
4718
|
-
|
4719
|
-
|
4720
|
-
|
4721
|
-
txCreatedIdx: (0, import_math17.bn)(coin.txCreatedIdx)
|
4773
|
+
const coins = edges.map(({ node }) => ({
|
4774
|
+
id: node.utxoId,
|
4775
|
+
assetId: node.assetId,
|
4776
|
+
amount: (0, import_math17.bn)(node.amount),
|
4777
|
+
owner: import_address3.Address.fromAddressOrString(node.owner),
|
4778
|
+
blockCreated: (0, import_math17.bn)(node.blockCreated),
|
4779
|
+
txCreatedIdx: (0, import_math17.bn)(node.txCreatedIdx)
|
4722
4780
|
}));
|
4781
|
+
return {
|
4782
|
+
coins,
|
4783
|
+
pageInfo
|
4784
|
+
};
|
4723
4785
|
}
|
4724
4786
|
/**
|
4725
4787
|
* Returns resources for the given owner satisfying the spend query.
|
@@ -4812,14 +4874,21 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4812
4874
|
* @returns A promise that resolves to the blocks.
|
4813
4875
|
*/
|
4814
4876
|
async getBlocks(params) {
|
4815
|
-
const {
|
4816
|
-
|
4877
|
+
const {
|
4878
|
+
blocks: { edges, pageInfo }
|
4879
|
+
} = await this.operations.getBlocks({
|
4880
|
+
...this.validatePaginationArgs({
|
4881
|
+
paginationLimit: BLOCKS_PAGE_SIZE_LIMIT,
|
4882
|
+
inputArgs: params
|
4883
|
+
})
|
4884
|
+
});
|
4885
|
+
const blocks = edges.map(({ node: block }) => ({
|
4817
4886
|
id: block.id,
|
4818
4887
|
height: (0, import_math17.bn)(block.height),
|
4819
4888
|
time: block.header.time,
|
4820
4889
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4821
4890
|
}));
|
4822
|
-
return blocks;
|
4891
|
+
return { blocks, pageInfo };
|
4823
4892
|
}
|
4824
4893
|
/**
|
4825
4894
|
* Returns block matching the given ID or type, including transaction data.
|
@@ -4929,17 +4998,22 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4929
4998
|
* @param paginationArgs - Pagination arguments (optional).
|
4930
4999
|
* @returns A promise that resolves to the balances.
|
4931
5000
|
*/
|
4932
|
-
async getBalances(owner
|
4933
|
-
const
|
4934
|
-
|
4935
|
-
|
5001
|
+
async getBalances(owner) {
|
5002
|
+
const {
|
5003
|
+
balances: { edges }
|
5004
|
+
} = await this.operations.getBalances({
|
5005
|
+
/**
|
5006
|
+
* The query parameters for this method were designed to support pagination,
|
5007
|
+
* but the current Fuel-Core implementation does not support pagination yet.
|
5008
|
+
*/
|
5009
|
+
first: 1e4,
|
4936
5010
|
filter: { owner: import_address3.Address.fromAddressOrString(owner).toB256() }
|
4937
5011
|
});
|
4938
|
-
const balances =
|
4939
|
-
|
4940
|
-
|
4941
|
-
amount: (0, import_math17.bn)(balance.amount)
|
5012
|
+
const balances = edges.map(({ node }) => ({
|
5013
|
+
assetId: node.assetId,
|
5014
|
+
amount: (0, import_math17.bn)(node.amount)
|
4942
5015
|
}));
|
5016
|
+
return { balances };
|
4943
5017
|
}
|
4944
5018
|
/**
|
4945
5019
|
* Returns message for the given address.
|
@@ -4949,27 +5023,34 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4949
5023
|
* @returns A promise that resolves to the messages.
|
4950
5024
|
*/
|
4951
5025
|
async getMessages(address, paginationArgs) {
|
4952
|
-
const
|
4953
|
-
|
4954
|
-
|
5026
|
+
const {
|
5027
|
+
messages: { edges, pageInfo }
|
5028
|
+
} = await this.operations.getMessages({
|
5029
|
+
...this.validatePaginationArgs({
|
5030
|
+
inputArgs: paginationArgs,
|
5031
|
+
paginationLimit: RESOURCES_PAGE_SIZE_LIMIT
|
5032
|
+
}),
|
4955
5033
|
owner: import_address3.Address.fromAddressOrString(address).toB256()
|
4956
5034
|
});
|
4957
|
-
const messages =
|
4958
|
-
return messages.map((message) => ({
|
5035
|
+
const messages = edges.map(({ node }) => ({
|
4959
5036
|
messageId: import_transactions20.InputMessageCoder.getMessageId({
|
4960
|
-
sender:
|
4961
|
-
recipient:
|
4962
|
-
nonce:
|
4963
|
-
amount: (0, import_math17.bn)(
|
4964
|
-
data:
|
5037
|
+
sender: node.sender,
|
5038
|
+
recipient: node.recipient,
|
5039
|
+
nonce: node.nonce,
|
5040
|
+
amount: (0, import_math17.bn)(node.amount),
|
5041
|
+
data: node.data
|
4965
5042
|
}),
|
4966
|
-
sender: import_address3.Address.fromAddressOrString(
|
4967
|
-
recipient: import_address3.Address.fromAddressOrString(
|
4968
|
-
nonce:
|
4969
|
-
amount: (0, import_math17.bn)(
|
4970
|
-
data: import_transactions20.InputMessageCoder.decodeData(
|
4971
|
-
daHeight: (0, import_math17.bn)(
|
5043
|
+
sender: import_address3.Address.fromAddressOrString(node.sender),
|
5044
|
+
recipient: import_address3.Address.fromAddressOrString(node.recipient),
|
5045
|
+
nonce: node.nonce,
|
5046
|
+
amount: (0, import_math17.bn)(node.amount),
|
5047
|
+
data: import_transactions20.InputMessageCoder.decodeData(node.data),
|
5048
|
+
daHeight: (0, import_math17.bn)(node.daHeight)
|
4972
5049
|
}));
|
5050
|
+
return {
|
5051
|
+
messages,
|
5052
|
+
pageInfo
|
5053
|
+
};
|
4973
5054
|
}
|
4974
5055
|
/**
|
4975
5056
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
@@ -5148,6 +5229,41 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5148
5229
|
}
|
5149
5230
|
return relayedTransactionStatus;
|
5150
5231
|
}
|
5232
|
+
/**
|
5233
|
+
* @hidden
|
5234
|
+
*/
|
5235
|
+
validatePaginationArgs(params) {
|
5236
|
+
const { paginationLimit, inputArgs = {} } = params;
|
5237
|
+
const { first, last, after, before } = inputArgs;
|
5238
|
+
if (after && before) {
|
5239
|
+
throw new import_errors14.FuelError(
|
5240
|
+
import_errors14.ErrorCode.INVALID_INPUT_PARAMETERS,
|
5241
|
+
'Pagination arguments "after" and "before" cannot be used together'
|
5242
|
+
);
|
5243
|
+
}
|
5244
|
+
if ((first || 0) > paginationLimit || (last || 0) > paginationLimit) {
|
5245
|
+
throw new import_errors14.FuelError(
|
5246
|
+
import_errors14.ErrorCode.INVALID_INPUT_PARAMETERS,
|
5247
|
+
`Pagination limit for this query cannot exceed ${paginationLimit} items`
|
5248
|
+
);
|
5249
|
+
}
|
5250
|
+
if (first && before) {
|
5251
|
+
throw new import_errors14.FuelError(
|
5252
|
+
import_errors14.ErrorCode.INVALID_INPUT_PARAMETERS,
|
5253
|
+
'The use of pagination argument "first" with "before" is not supported'
|
5254
|
+
);
|
5255
|
+
}
|
5256
|
+
if (last && after) {
|
5257
|
+
throw new import_errors14.FuelError(
|
5258
|
+
import_errors14.ErrorCode.INVALID_INPUT_PARAMETERS,
|
5259
|
+
'The use of pagination argument "last" with "after" is not supported'
|
5260
|
+
);
|
5261
|
+
}
|
5262
|
+
if (!first && !last) {
|
5263
|
+
inputArgs.first = paginationLimit;
|
5264
|
+
}
|
5265
|
+
return inputArgs;
|
5266
|
+
}
|
5151
5267
|
/**
|
5152
5268
|
* @hidden
|
5153
5269
|
*/
|
@@ -5548,52 +5664,16 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5548
5664
|
* @param assetId - The asset ID of the coins to retrieve (optional).
|
5549
5665
|
* @returns A promise that resolves to an array of Coins.
|
5550
5666
|
*/
|
5551
|
-
async getCoins(assetId) {
|
5552
|
-
|
5553
|
-
const pageSize = 9999;
|
5554
|
-
let cursor;
|
5555
|
-
for (; ; ) {
|
5556
|
-
const pageCoins = await this.provider.getCoins(this.address, assetId, {
|
5557
|
-
first: pageSize,
|
5558
|
-
after: cursor
|
5559
|
-
});
|
5560
|
-
coins.push(...pageCoins);
|
5561
|
-
const hasNextPage = pageCoins.length >= pageSize;
|
5562
|
-
if (!hasNextPage) {
|
5563
|
-
break;
|
5564
|
-
}
|
5565
|
-
throw new import_errors16.FuelError(
|
5566
|
-
import_errors16.ErrorCode.NOT_SUPPORTED,
|
5567
|
-
`Wallets containing more than ${pageSize} coins exceed the current supported limit.`
|
5568
|
-
);
|
5569
|
-
}
|
5570
|
-
return coins;
|
5667
|
+
async getCoins(assetId, paginationArgs) {
|
5668
|
+
return this.provider.getCoins(this.address, assetId, paginationArgs);
|
5571
5669
|
}
|
5572
5670
|
/**
|
5573
5671
|
* Retrieves messages owned by the account.
|
5574
5672
|
*
|
5575
5673
|
* @returns A promise that resolves to an array of Messages.
|
5576
5674
|
*/
|
5577
|
-
async getMessages() {
|
5578
|
-
|
5579
|
-
const pageSize = 9999;
|
5580
|
-
let cursor;
|
5581
|
-
for (; ; ) {
|
5582
|
-
const pageMessages = await this.provider.getMessages(this.address, {
|
5583
|
-
first: pageSize,
|
5584
|
-
after: cursor
|
5585
|
-
});
|
5586
|
-
messages.push(...pageMessages);
|
5587
|
-
const hasNextPage = pageMessages.length >= pageSize;
|
5588
|
-
if (!hasNextPage) {
|
5589
|
-
break;
|
5590
|
-
}
|
5591
|
-
throw new import_errors16.FuelError(
|
5592
|
-
import_errors16.ErrorCode.NOT_SUPPORTED,
|
5593
|
-
`Wallets containing more than ${pageSize} messages exceed the current supported limit.`
|
5594
|
-
);
|
5595
|
-
}
|
5596
|
-
return messages;
|
5675
|
+
async getMessages(paginationArgs) {
|
5676
|
+
return this.provider.getMessages(this.address, paginationArgs);
|
5597
5677
|
}
|
5598
5678
|
/**
|
5599
5679
|
* Retrieves the balance of the account for the given asset.
|
@@ -5612,25 +5692,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5612
5692
|
* @returns A promise that resolves to an array of Coins and their quantities.
|
5613
5693
|
*/
|
5614
5694
|
async getBalances() {
|
5615
|
-
|
5616
|
-
const pageSize = 9999;
|
5617
|
-
let cursor;
|
5618
|
-
for (; ; ) {
|
5619
|
-
const pageBalances = await this.provider.getBalances(this.address, {
|
5620
|
-
first: pageSize,
|
5621
|
-
after: cursor
|
5622
|
-
});
|
5623
|
-
balances.push(...pageBalances);
|
5624
|
-
const hasNextPage = pageBalances.length >= pageSize;
|
5625
|
-
if (!hasNextPage) {
|
5626
|
-
break;
|
5627
|
-
}
|
5628
|
-
throw new import_errors16.FuelError(
|
5629
|
-
import_errors16.ErrorCode.NOT_SUPPORTED,
|
5630
|
-
`Wallets containing more than ${pageSize} balances exceed the current supported limit.`
|
5631
|
-
);
|
5632
|
-
}
|
5633
|
-
return balances;
|
5695
|
+
return this.provider.getBalances(this.address);
|
5634
5696
|
}
|
5635
5697
|
/**
|
5636
5698
|
* Funds a transaction request by adding the necessary resources.
|
@@ -9859,7 +9921,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
9859
9921
|
throw new Error("Method not implemented.");
|
9860
9922
|
}
|
9861
9923
|
/**
|
9862
|
-
* Should add the
|
9924
|
+
* Should add the assets metadata to the connector and return true if the asset
|
9863
9925
|
* was added successfully.
|
9864
9926
|
*
|
9865
9927
|
* If the asset already exists it should throw an error.
|
@@ -9873,7 +9935,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
9873
9935
|
throw new Error("Method not implemented.");
|
9874
9936
|
}
|
9875
9937
|
/**
|
9876
|
-
* Should add the
|
9938
|
+
* Should add the asset metadata to the connector and return true if the asset
|
9877
9939
|
* was added successfully.
|
9878
9940
|
*
|
9879
9941
|
* If the asset already exists it should throw an error.
|
@@ -10355,6 +10417,7 @@ __publicField(Fuel, "defaultConfig", {});
|
|
10355
10417
|
0 && (module.exports = {
|
10356
10418
|
Account,
|
10357
10419
|
AddressType,
|
10420
|
+
BLOCKS_PAGE_SIZE_LIMIT,
|
10358
10421
|
BaseTransactionRequest,
|
10359
10422
|
BaseWalletUnlocked,
|
10360
10423
|
CHAIN_IDS,
|
@@ -10379,6 +10442,7 @@ __publicField(Fuel, "defaultConfig", {});
|
|
10379
10442
|
Predicate,
|
10380
10443
|
PrivateKeyVault,
|
10381
10444
|
Provider,
|
10445
|
+
RESOURCES_PAGE_SIZE_LIMIT,
|
10382
10446
|
ScriptTransactionRequest,
|
10383
10447
|
Signer,
|
10384
10448
|
StorageAbstract,
|