@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.mjs
CHANGED
@@ -515,6 +515,12 @@ var GasCostsFragmentDoc = gql`
|
|
515
515
|
alocDependentCost {
|
516
516
|
...DependentCostFragment
|
517
517
|
}
|
518
|
+
cfe {
|
519
|
+
...DependentCostFragment
|
520
|
+
}
|
521
|
+
cfeiDependentCost {
|
522
|
+
...DependentCostFragment
|
523
|
+
}
|
518
524
|
call {
|
519
525
|
...DependentCostFragment
|
520
526
|
}
|
@@ -755,6 +761,9 @@ ${TransactionFragmentDoc}`;
|
|
755
761
|
var GetBlocksDocument = gql`
|
756
762
|
query getBlocks($after: String, $before: String, $first: Int, $last: Int) {
|
757
763
|
blocks(after: $after, before: $before, first: $first, last: $last) {
|
764
|
+
pageInfo {
|
765
|
+
...pageInfoFragment
|
766
|
+
}
|
758
767
|
edges {
|
759
768
|
node {
|
760
769
|
...blockFragment
|
@@ -762,7 +771,8 @@ var GetBlocksDocument = gql`
|
|
762
771
|
}
|
763
772
|
}
|
764
773
|
}
|
765
|
-
${
|
774
|
+
${PageInfoFragmentDoc}
|
775
|
+
${BlockFragmentDoc}`;
|
766
776
|
var GetCoinDocument = gql`
|
767
777
|
query getCoin($coinId: UtxoId!) {
|
768
778
|
coin(utxoId: $coinId) {
|
@@ -779,6 +789,9 @@ var GetCoinsDocument = gql`
|
|
779
789
|
first: $first
|
780
790
|
last: $last
|
781
791
|
) {
|
792
|
+
pageInfo {
|
793
|
+
...pageInfoFragment
|
794
|
+
}
|
782
795
|
edges {
|
783
796
|
node {
|
784
797
|
...coinFragment
|
@@ -786,7 +799,8 @@ var GetCoinsDocument = gql`
|
|
786
799
|
}
|
787
800
|
}
|
788
801
|
}
|
789
|
-
${
|
802
|
+
${PageInfoFragmentDoc}
|
803
|
+
${CoinFragmentDoc}`;
|
790
804
|
var GetCoinsToSpendDocument = gql`
|
791
805
|
query getCoinsToSpend($owner: Address!, $queryPerAsset: [SpendQueryElementInput!]!, $excludedIds: ExcludeInput) {
|
792
806
|
coinsToSpend(
|
@@ -845,6 +859,9 @@ var GetBalancesDocument = gql`
|
|
845
859
|
first: $first
|
846
860
|
last: $last
|
847
861
|
) {
|
862
|
+
pageInfo {
|
863
|
+
...pageInfoFragment
|
864
|
+
}
|
848
865
|
edges {
|
849
866
|
node {
|
850
867
|
...balanceFragment
|
@@ -852,7 +869,8 @@ var GetBalancesDocument = gql`
|
|
852
869
|
}
|
853
870
|
}
|
854
871
|
}
|
855
|
-
${
|
872
|
+
${PageInfoFragmentDoc}
|
873
|
+
${BalanceFragmentDoc}`;
|
856
874
|
var GetMessagesDocument = gql`
|
857
875
|
query getMessages($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
|
858
876
|
messages(
|
@@ -862,6 +880,9 @@ var GetMessagesDocument = gql`
|
|
862
880
|
first: $first
|
863
881
|
last: $last
|
864
882
|
) {
|
883
|
+
pageInfo {
|
884
|
+
...pageInfoFragment
|
885
|
+
}
|
865
886
|
edges {
|
866
887
|
node {
|
867
888
|
...messageFragment
|
@@ -869,7 +890,8 @@ var GetMessagesDocument = gql`
|
|
869
890
|
}
|
870
891
|
}
|
871
892
|
}
|
872
|
-
${
|
893
|
+
${PageInfoFragmentDoc}
|
894
|
+
${MessageFragmentDoc}`;
|
873
895
|
var GetMessageProofDocument = gql`
|
874
896
|
query getMessageProof($transactionId: TransactionId!, $nonce: Nonce!, $commitBlockId: BlockId, $commitBlockHeight: U32) {
|
875
897
|
messageProof(
|
@@ -1742,7 +1764,7 @@ import {
|
|
1742
1764
|
PANIC_REASONS,
|
1743
1765
|
PANIC_DOC_URL
|
1744
1766
|
} from "@fuel-ts/transactions/configs";
|
1745
|
-
var assemblePanicError = (statusReason) => {
|
1767
|
+
var assemblePanicError = (statusReason, metadata) => {
|
1746
1768
|
let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
|
1747
1769
|
if (PANIC_REASONS.includes(statusReason)) {
|
1748
1770
|
errorMessage = `${errorMessage}
|
@@ -1751,10 +1773,13 @@ You can read more about this error at:
|
|
1751
1773
|
|
1752
1774
|
${PANIC_DOC_URL}#variant.${statusReason}`;
|
1753
1775
|
}
|
1754
|
-
return
|
1776
|
+
return new FuelError7(ErrorCode7.SCRIPT_REVERTED, errorMessage, {
|
1777
|
+
...metadata,
|
1778
|
+
reason: statusReason
|
1779
|
+
});
|
1755
1780
|
};
|
1756
1781
|
var stringify = (obj) => JSON.stringify(obj, null, 2);
|
1757
|
-
var assembleRevertError = (receipts, logs) => {
|
1782
|
+
var assembleRevertError = (receipts, logs, metadata) => {
|
1758
1783
|
let errorMessage = "The transaction reverted with an unknown reason.";
|
1759
1784
|
const revertReceipt = receipts.find(({ type }) => type === ReceiptType3.Revert);
|
1760
1785
|
let reason = "";
|
@@ -1787,25 +1812,36 @@ var assembleRevertError = (receipts, logs) => {
|
|
1787
1812
|
errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
|
1788
1813
|
break;
|
1789
1814
|
default:
|
1790
|
-
|
1791
|
-
|
1815
|
+
throw new FuelError7(
|
1816
|
+
ErrorCode7.UNKNOWN,
|
1817
|
+
`The transaction reverted with an unknown reason: ${revertReceipt.val}`,
|
1818
|
+
{
|
1819
|
+
...metadata,
|
1820
|
+
reason: "unknown"
|
1821
|
+
}
|
1822
|
+
);
|
1792
1823
|
}
|
1793
1824
|
}
|
1794
|
-
return
|
1825
|
+
return new FuelError7(ErrorCode7.SCRIPT_REVERTED, errorMessage, {
|
1826
|
+
...metadata,
|
1827
|
+
reason
|
1828
|
+
});
|
1795
1829
|
};
|
1796
1830
|
var extractTxError = (params) => {
|
1797
1831
|
const { receipts, statusReason, logs } = params;
|
1798
1832
|
const isPanic = receipts.some(({ type }) => type === ReceiptType3.Panic);
|
1799
1833
|
const isRevert = receipts.some(({ type }) => type === ReceiptType3.Revert);
|
1800
|
-
const { errorMessage, reason } = isPanic ? assemblePanicError(statusReason) : assembleRevertError(receipts, logs);
|
1801
1834
|
const metadata = {
|
1802
1835
|
logs,
|
1803
1836
|
receipts,
|
1804
1837
|
panic: isPanic,
|
1805
1838
|
revert: isRevert,
|
1806
|
-
reason
|
1839
|
+
reason: ""
|
1807
1840
|
};
|
1808
|
-
|
1841
|
+
if (isPanic) {
|
1842
|
+
return assemblePanicError(statusReason, metadata);
|
1843
|
+
}
|
1844
|
+
return assembleRevertError(receipts, logs, metadata);
|
1809
1845
|
};
|
1810
1846
|
|
1811
1847
|
// src/providers/transaction-request/errors.ts
|
@@ -3716,12 +3752,18 @@ var TransactionResponse = class {
|
|
3716
3752
|
await this.fetch();
|
3717
3753
|
}
|
3718
3754
|
/**
|
3719
|
-
*
|
3755
|
+
* Assembles the result of a transaction by retrieving the transaction summary,
|
3756
|
+
* decoding logs (if available), and handling transaction failure.
|
3720
3757
|
*
|
3721
|
-
*
|
3758
|
+
* This method can be used to obtain the result of a transaction that has just
|
3759
|
+
* been submitted or one that has already been processed.
|
3760
|
+
*
|
3761
|
+
* @template TTransactionType - The type of the transaction.
|
3762
|
+
* @param contractsAbiMap - The map of contract ABIs.
|
3763
|
+
* @returns - The assembled transaction result.
|
3764
|
+
* @throws If the transaction status is a failure.
|
3722
3765
|
*/
|
3723
|
-
async
|
3724
|
-
await this.waitForStatusChange();
|
3766
|
+
async assembleResult(contractsAbiMap) {
|
3725
3767
|
const transactionSummary = await this.getTransactionSummary(contractsAbiMap);
|
3726
3768
|
const transactionResult = {
|
3727
3769
|
gqlTransaction: this.gqlTransaction,
|
@@ -3747,6 +3789,15 @@ var TransactionResponse = class {
|
|
3747
3789
|
}
|
3748
3790
|
return transactionResult;
|
3749
3791
|
}
|
3792
|
+
/**
|
3793
|
+
* Waits for transaction to complete and returns the result.
|
3794
|
+
*
|
3795
|
+
* @returns The completed transaction result
|
3796
|
+
*/
|
3797
|
+
async waitForResult(contractsAbiMap) {
|
3798
|
+
await this.waitForStatusChange();
|
3799
|
+
return this.assembleResult(contractsAbiMap);
|
3800
|
+
}
|
3750
3801
|
/**
|
3751
3802
|
* Waits for transaction to complete and returns the result.
|
3752
3803
|
*
|
@@ -3810,6 +3861,8 @@ var mergeQuantities = (...coinQuantities) => {
|
|
3810
3861
|
|
3811
3862
|
// src/providers/provider.ts
|
3812
3863
|
var MAX_RETRIES = 10;
|
3864
|
+
var RESOURCES_PAGE_SIZE_LIMIT = 512;
|
3865
|
+
var BLOCKS_PAGE_SIZE_LIMIT = 5;
|
3813
3866
|
var processGqlChain = (chain) => {
|
3814
3867
|
const { name, daHeight, consensusParameters, latestBlock } = chain;
|
3815
3868
|
const {
|
@@ -4453,7 +4506,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4453
4506
|
/**
|
4454
4507
|
* Returns a transaction cost to enable user
|
4455
4508
|
* to set gasLimit and also reserve balance amounts
|
4456
|
-
* on the
|
4509
|
+
* on the transaction.
|
4457
4510
|
*
|
4458
4511
|
* @param transactionRequestLike - The transaction request object.
|
4459
4512
|
* @param transactionCostParams - The transaction cost parameters (optional).
|
@@ -4564,20 +4617,27 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4564
4617
|
*/
|
4565
4618
|
async getCoins(owner, assetId, paginationArgs) {
|
4566
4619
|
const ownerAddress = Address2.fromAddressOrString(owner);
|
4567
|
-
const
|
4568
|
-
|
4569
|
-
|
4620
|
+
const {
|
4621
|
+
coins: { edges, pageInfo }
|
4622
|
+
} = await this.operations.getCoins({
|
4623
|
+
...this.validatePaginationArgs({
|
4624
|
+
paginationLimit: RESOURCES_PAGE_SIZE_LIMIT,
|
4625
|
+
inputArgs: paginationArgs
|
4626
|
+
}),
|
4570
4627
|
filter: { owner: ownerAddress.toB256(), assetId: assetId && hexlify12(assetId) }
|
4571
4628
|
});
|
4572
|
-
const coins =
|
4573
|
-
|
4574
|
-
|
4575
|
-
|
4576
|
-
|
4577
|
-
|
4578
|
-
|
4579
|
-
txCreatedIdx: bn17(coin.txCreatedIdx)
|
4629
|
+
const coins = edges.map(({ node }) => ({
|
4630
|
+
id: node.utxoId,
|
4631
|
+
assetId: node.assetId,
|
4632
|
+
amount: bn17(node.amount),
|
4633
|
+
owner: Address2.fromAddressOrString(node.owner),
|
4634
|
+
blockCreated: bn17(node.blockCreated),
|
4635
|
+
txCreatedIdx: bn17(node.txCreatedIdx)
|
4580
4636
|
}));
|
4637
|
+
return {
|
4638
|
+
coins,
|
4639
|
+
pageInfo
|
4640
|
+
};
|
4581
4641
|
}
|
4582
4642
|
/**
|
4583
4643
|
* Returns resources for the given owner satisfying the spend query.
|
@@ -4670,14 +4730,21 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4670
4730
|
* @returns A promise that resolves to the blocks.
|
4671
4731
|
*/
|
4672
4732
|
async getBlocks(params) {
|
4673
|
-
const {
|
4674
|
-
|
4733
|
+
const {
|
4734
|
+
blocks: { edges, pageInfo }
|
4735
|
+
} = await this.operations.getBlocks({
|
4736
|
+
...this.validatePaginationArgs({
|
4737
|
+
paginationLimit: BLOCKS_PAGE_SIZE_LIMIT,
|
4738
|
+
inputArgs: params
|
4739
|
+
})
|
4740
|
+
});
|
4741
|
+
const blocks = edges.map(({ node: block }) => ({
|
4675
4742
|
id: block.id,
|
4676
4743
|
height: bn17(block.height),
|
4677
4744
|
time: block.header.time,
|
4678
4745
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4679
4746
|
}));
|
4680
|
-
return blocks;
|
4747
|
+
return { blocks, pageInfo };
|
4681
4748
|
}
|
4682
4749
|
/**
|
4683
4750
|
* Returns block matching the given ID or type, including transaction data.
|
@@ -4787,17 +4854,22 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4787
4854
|
* @param paginationArgs - Pagination arguments (optional).
|
4788
4855
|
* @returns A promise that resolves to the balances.
|
4789
4856
|
*/
|
4790
|
-
async getBalances(owner
|
4791
|
-
const
|
4792
|
-
|
4793
|
-
|
4857
|
+
async getBalances(owner) {
|
4858
|
+
const {
|
4859
|
+
balances: { edges }
|
4860
|
+
} = await this.operations.getBalances({
|
4861
|
+
/**
|
4862
|
+
* The query parameters for this method were designed to support pagination,
|
4863
|
+
* but the current Fuel-Core implementation does not support pagination yet.
|
4864
|
+
*/
|
4865
|
+
first: 1e4,
|
4794
4866
|
filter: { owner: Address2.fromAddressOrString(owner).toB256() }
|
4795
4867
|
});
|
4796
|
-
const balances =
|
4797
|
-
|
4798
|
-
|
4799
|
-
amount: bn17(balance.amount)
|
4868
|
+
const balances = edges.map(({ node }) => ({
|
4869
|
+
assetId: node.assetId,
|
4870
|
+
amount: bn17(node.amount)
|
4800
4871
|
}));
|
4872
|
+
return { balances };
|
4801
4873
|
}
|
4802
4874
|
/**
|
4803
4875
|
* Returns message for the given address.
|
@@ -4807,27 +4879,34 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4807
4879
|
* @returns A promise that resolves to the messages.
|
4808
4880
|
*/
|
4809
4881
|
async getMessages(address, paginationArgs) {
|
4810
|
-
const
|
4811
|
-
|
4812
|
-
|
4882
|
+
const {
|
4883
|
+
messages: { edges, pageInfo }
|
4884
|
+
} = await this.operations.getMessages({
|
4885
|
+
...this.validatePaginationArgs({
|
4886
|
+
inputArgs: paginationArgs,
|
4887
|
+
paginationLimit: RESOURCES_PAGE_SIZE_LIMIT
|
4888
|
+
}),
|
4813
4889
|
owner: Address2.fromAddressOrString(address).toB256()
|
4814
4890
|
});
|
4815
|
-
const messages =
|
4816
|
-
return messages.map((message) => ({
|
4891
|
+
const messages = edges.map(({ node }) => ({
|
4817
4892
|
messageId: InputMessageCoder.getMessageId({
|
4818
|
-
sender:
|
4819
|
-
recipient:
|
4820
|
-
nonce:
|
4821
|
-
amount: bn17(
|
4822
|
-
data:
|
4893
|
+
sender: node.sender,
|
4894
|
+
recipient: node.recipient,
|
4895
|
+
nonce: node.nonce,
|
4896
|
+
amount: bn17(node.amount),
|
4897
|
+
data: node.data
|
4823
4898
|
}),
|
4824
|
-
sender: Address2.fromAddressOrString(
|
4825
|
-
recipient: Address2.fromAddressOrString(
|
4826
|
-
nonce:
|
4827
|
-
amount: bn17(
|
4828
|
-
data: InputMessageCoder.decodeData(
|
4829
|
-
daHeight: bn17(
|
4899
|
+
sender: Address2.fromAddressOrString(node.sender),
|
4900
|
+
recipient: Address2.fromAddressOrString(node.recipient),
|
4901
|
+
nonce: node.nonce,
|
4902
|
+
amount: bn17(node.amount),
|
4903
|
+
data: InputMessageCoder.decodeData(node.data),
|
4904
|
+
daHeight: bn17(node.daHeight)
|
4830
4905
|
}));
|
4906
|
+
return {
|
4907
|
+
messages,
|
4908
|
+
pageInfo
|
4909
|
+
};
|
4831
4910
|
}
|
4832
4911
|
/**
|
4833
4912
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
@@ -5006,6 +5085,41 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5006
5085
|
}
|
5007
5086
|
return relayedTransactionStatus;
|
5008
5087
|
}
|
5088
|
+
/**
|
5089
|
+
* @hidden
|
5090
|
+
*/
|
5091
|
+
validatePaginationArgs(params) {
|
5092
|
+
const { paginationLimit, inputArgs = {} } = params;
|
5093
|
+
const { first, last, after, before } = inputArgs;
|
5094
|
+
if (after && before) {
|
5095
|
+
throw new FuelError13(
|
5096
|
+
ErrorCode13.INVALID_INPUT_PARAMETERS,
|
5097
|
+
'Pagination arguments "after" and "before" cannot be used together'
|
5098
|
+
);
|
5099
|
+
}
|
5100
|
+
if ((first || 0) > paginationLimit || (last || 0) > paginationLimit) {
|
5101
|
+
throw new FuelError13(
|
5102
|
+
ErrorCode13.INVALID_INPUT_PARAMETERS,
|
5103
|
+
`Pagination limit for this query cannot exceed ${paginationLimit} items`
|
5104
|
+
);
|
5105
|
+
}
|
5106
|
+
if (first && before) {
|
5107
|
+
throw new FuelError13(
|
5108
|
+
ErrorCode13.INVALID_INPUT_PARAMETERS,
|
5109
|
+
'The use of pagination argument "first" with "before" is not supported'
|
5110
|
+
);
|
5111
|
+
}
|
5112
|
+
if (last && after) {
|
5113
|
+
throw new FuelError13(
|
5114
|
+
ErrorCode13.INVALID_INPUT_PARAMETERS,
|
5115
|
+
'The use of pagination argument "last" with "after" is not supported'
|
5116
|
+
);
|
5117
|
+
}
|
5118
|
+
if (!first && !last) {
|
5119
|
+
inputArgs.first = paginationLimit;
|
5120
|
+
}
|
5121
|
+
return inputArgs;
|
5122
|
+
}
|
5009
5123
|
/**
|
5010
5124
|
* @hidden
|
5011
5125
|
*/
|
@@ -5406,52 +5520,16 @@ var Account = class extends AbstractAccount {
|
|
5406
5520
|
* @param assetId - The asset ID of the coins to retrieve (optional).
|
5407
5521
|
* @returns A promise that resolves to an array of Coins.
|
5408
5522
|
*/
|
5409
|
-
async getCoins(assetId) {
|
5410
|
-
|
5411
|
-
const pageSize = 9999;
|
5412
|
-
let cursor;
|
5413
|
-
for (; ; ) {
|
5414
|
-
const pageCoins = await this.provider.getCoins(this.address, assetId, {
|
5415
|
-
first: pageSize,
|
5416
|
-
after: cursor
|
5417
|
-
});
|
5418
|
-
coins.push(...pageCoins);
|
5419
|
-
const hasNextPage = pageCoins.length >= pageSize;
|
5420
|
-
if (!hasNextPage) {
|
5421
|
-
break;
|
5422
|
-
}
|
5423
|
-
throw new FuelError15(
|
5424
|
-
ErrorCode15.NOT_SUPPORTED,
|
5425
|
-
`Wallets containing more than ${pageSize} coins exceed the current supported limit.`
|
5426
|
-
);
|
5427
|
-
}
|
5428
|
-
return coins;
|
5523
|
+
async getCoins(assetId, paginationArgs) {
|
5524
|
+
return this.provider.getCoins(this.address, assetId, paginationArgs);
|
5429
5525
|
}
|
5430
5526
|
/**
|
5431
5527
|
* Retrieves messages owned by the account.
|
5432
5528
|
*
|
5433
5529
|
* @returns A promise that resolves to an array of Messages.
|
5434
5530
|
*/
|
5435
|
-
async getMessages() {
|
5436
|
-
|
5437
|
-
const pageSize = 9999;
|
5438
|
-
let cursor;
|
5439
|
-
for (; ; ) {
|
5440
|
-
const pageMessages = await this.provider.getMessages(this.address, {
|
5441
|
-
first: pageSize,
|
5442
|
-
after: cursor
|
5443
|
-
});
|
5444
|
-
messages.push(...pageMessages);
|
5445
|
-
const hasNextPage = pageMessages.length >= pageSize;
|
5446
|
-
if (!hasNextPage) {
|
5447
|
-
break;
|
5448
|
-
}
|
5449
|
-
throw new FuelError15(
|
5450
|
-
ErrorCode15.NOT_SUPPORTED,
|
5451
|
-
`Wallets containing more than ${pageSize} messages exceed the current supported limit.`
|
5452
|
-
);
|
5453
|
-
}
|
5454
|
-
return messages;
|
5531
|
+
async getMessages(paginationArgs) {
|
5532
|
+
return this.provider.getMessages(this.address, paginationArgs);
|
5455
5533
|
}
|
5456
5534
|
/**
|
5457
5535
|
* Retrieves the balance of the account for the given asset.
|
@@ -5470,25 +5548,7 @@ var Account = class extends AbstractAccount {
|
|
5470
5548
|
* @returns A promise that resolves to an array of Coins and their quantities.
|
5471
5549
|
*/
|
5472
5550
|
async getBalances() {
|
5473
|
-
|
5474
|
-
const pageSize = 9999;
|
5475
|
-
let cursor;
|
5476
|
-
for (; ; ) {
|
5477
|
-
const pageBalances = await this.provider.getBalances(this.address, {
|
5478
|
-
first: pageSize,
|
5479
|
-
after: cursor
|
5480
|
-
});
|
5481
|
-
balances.push(...pageBalances);
|
5482
|
-
const hasNextPage = pageBalances.length >= pageSize;
|
5483
|
-
if (!hasNextPage) {
|
5484
|
-
break;
|
5485
|
-
}
|
5486
|
-
throw new FuelError15(
|
5487
|
-
ErrorCode15.NOT_SUPPORTED,
|
5488
|
-
`Wallets containing more than ${pageSize} balances exceed the current supported limit.`
|
5489
|
-
);
|
5490
|
-
}
|
5491
|
-
return balances;
|
5551
|
+
return this.provider.getBalances(this.address);
|
5492
5552
|
}
|
5493
5553
|
/**
|
5494
5554
|
* Funds a transaction request by adding the necessary resources.
|
@@ -9725,7 +9785,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9725
9785
|
throw new Error("Method not implemented.");
|
9726
9786
|
}
|
9727
9787
|
/**
|
9728
|
-
* Should add the
|
9788
|
+
* Should add the assets metadata to the connector and return true if the asset
|
9729
9789
|
* was added successfully.
|
9730
9790
|
*
|
9731
9791
|
* If the asset already exists it should throw an error.
|
@@ -9739,7 +9799,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9739
9799
|
throw new Error("Method not implemented.");
|
9740
9800
|
}
|
9741
9801
|
/**
|
9742
|
-
* Should add the
|
9802
|
+
* Should add the asset metadata to the connector and return true if the asset
|
9743
9803
|
* was added successfully.
|
9744
9804
|
*
|
9745
9805
|
* If the asset already exists it should throw an error.
|
@@ -10220,6 +10280,7 @@ __publicField(Fuel, "defaultConfig", {});
|
|
10220
10280
|
export {
|
10221
10281
|
Account,
|
10222
10282
|
AddressType,
|
10283
|
+
BLOCKS_PAGE_SIZE_LIMIT,
|
10223
10284
|
BaseTransactionRequest,
|
10224
10285
|
BaseWalletUnlocked,
|
10225
10286
|
CHAIN_IDS,
|
@@ -10244,6 +10305,7 @@ export {
|
|
10244
10305
|
Predicate,
|
10245
10306
|
PrivateKeyVault,
|
10246
10307
|
Provider,
|
10308
|
+
RESOURCES_PAGE_SIZE_LIMIT,
|
10247
10309
|
ScriptTransactionRequest,
|
10248
10310
|
Signer,
|
10249
10311
|
StorageAbstract,
|