@fuel-ts/account 0.0.0-rc-2408-20240620151941 → 0.0.0-rc-2366-20240620152942
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/index.global.js +95 -82
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +95 -82
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +95 -82
- package/dist/index.mjs.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +0 -18
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +5 -20
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/test-utils.global.js +95 -106
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +95 -82
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +95 -82
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +15 -15
package/dist/index.mjs
CHANGED
@@ -779,9 +779,6 @@ var GetCoinsDocument = gql`
|
|
779
779
|
first: $first
|
780
780
|
last: $last
|
781
781
|
) {
|
782
|
-
pageInfo {
|
783
|
-
...pageInfoFragment
|
784
|
-
}
|
785
782
|
edges {
|
786
783
|
node {
|
787
784
|
...coinFragment
|
@@ -789,8 +786,7 @@ var GetCoinsDocument = gql`
|
|
789
786
|
}
|
790
787
|
}
|
791
788
|
}
|
792
|
-
${
|
793
|
-
${CoinFragmentDoc}`;
|
789
|
+
${CoinFragmentDoc}`;
|
794
790
|
var GetCoinsToSpendDocument = gql`
|
795
791
|
query getCoinsToSpend($owner: Address!, $queryPerAsset: [SpendQueryElementInput!]!, $excludedIds: ExcludeInput) {
|
796
792
|
coinsToSpend(
|
@@ -849,9 +845,6 @@ var GetBalancesDocument = gql`
|
|
849
845
|
first: $first
|
850
846
|
last: $last
|
851
847
|
) {
|
852
|
-
pageInfo {
|
853
|
-
...pageInfoFragment
|
854
|
-
}
|
855
848
|
edges {
|
856
849
|
node {
|
857
850
|
...balanceFragment
|
@@ -859,8 +852,7 @@ var GetBalancesDocument = gql`
|
|
859
852
|
}
|
860
853
|
}
|
861
854
|
}
|
862
|
-
${
|
863
|
-
${BalanceFragmentDoc}`;
|
855
|
+
${BalanceFragmentDoc}`;
|
864
856
|
var GetMessagesDocument = gql`
|
865
857
|
query getMessages($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
|
866
858
|
messages(
|
@@ -870,9 +862,6 @@ var GetMessagesDocument = gql`
|
|
870
862
|
first: $first
|
871
863
|
last: $last
|
872
864
|
) {
|
873
|
-
pageInfo {
|
874
|
-
...pageInfoFragment
|
875
|
-
}
|
876
865
|
edges {
|
877
866
|
node {
|
878
867
|
...messageFragment
|
@@ -880,8 +869,7 @@ var GetMessagesDocument = gql`
|
|
880
869
|
}
|
881
870
|
}
|
882
871
|
}
|
883
|
-
${
|
884
|
-
${MessageFragmentDoc}`;
|
872
|
+
${MessageFragmentDoc}`;
|
885
873
|
var GetMessageProofDocument = gql`
|
886
874
|
query getMessageProof($transactionId: TransactionId!, $nonce: Nonce!, $commitBlockId: BlockId, $commitBlockHeight: U32) {
|
887
875
|
messageProof(
|
@@ -4575,27 +4563,21 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4575
4563
|
* @returns A promise that resolves to the coins.
|
4576
4564
|
*/
|
4577
4565
|
async getCoins(owner, assetId, paginationArgs) {
|
4578
|
-
this.validatePaginationArgs(paginationArgs);
|
4579
4566
|
const ownerAddress = Address2.fromAddressOrString(owner);
|
4580
|
-
const {
|
4581
|
-
|
4582
|
-
} = await this.operations.getCoins({
|
4583
|
-
first: 100,
|
4567
|
+
const result = await this.operations.getCoins({
|
4568
|
+
first: 10,
|
4584
4569
|
...paginationArgs,
|
4585
4570
|
filter: { owner: ownerAddress.toB256(), assetId: assetId && hexlify12(assetId) }
|
4586
4571
|
});
|
4587
|
-
const coins = edges.map((
|
4588
|
-
|
4589
|
-
|
4590
|
-
|
4591
|
-
|
4592
|
-
|
4593
|
-
|
4572
|
+
const coins = result.coins.edges.map((edge) => edge.node);
|
4573
|
+
return coins.map((coin) => ({
|
4574
|
+
id: coin.utxoId,
|
4575
|
+
assetId: coin.assetId,
|
4576
|
+
amount: bn17(coin.amount),
|
4577
|
+
owner: Address2.fromAddressOrString(coin.owner),
|
4578
|
+
blockCreated: bn17(coin.blockCreated),
|
4579
|
+
txCreatedIdx: bn17(coin.txCreatedIdx)
|
4594
4580
|
}));
|
4595
|
-
return {
|
4596
|
-
coins,
|
4597
|
-
pageInfo
|
4598
|
-
};
|
4599
4581
|
}
|
4600
4582
|
/**
|
4601
4583
|
* Returns resources for the given owner satisfying the spend query.
|
@@ -4805,22 +4787,17 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4805
4787
|
* @param paginationArgs - Pagination arguments (optional).
|
4806
4788
|
* @returns A promise that resolves to the balances.
|
4807
4789
|
*/
|
4808
|
-
async getBalances(owner) {
|
4809
|
-
const {
|
4810
|
-
|
4811
|
-
|
4812
|
-
/**
|
4813
|
-
* The query parameters for this method were designed to support pagination,
|
4814
|
-
* but the current Fuel-Core implementation does not support pagination yet.
|
4815
|
-
*/
|
4816
|
-
first: 1e4,
|
4790
|
+
async getBalances(owner, paginationArgs) {
|
4791
|
+
const result = await this.operations.getBalances({
|
4792
|
+
first: 10,
|
4793
|
+
...paginationArgs,
|
4817
4794
|
filter: { owner: Address2.fromAddressOrString(owner).toB256() }
|
4818
4795
|
});
|
4819
|
-
const balances = edges.map((
|
4820
|
-
|
4821
|
-
|
4796
|
+
const balances = result.balances.edges.map((edge) => edge.node);
|
4797
|
+
return balances.map((balance) => ({
|
4798
|
+
assetId: balance.assetId,
|
4799
|
+
amount: bn17(balance.amount)
|
4822
4800
|
}));
|
4823
|
-
return { balances };
|
4824
4801
|
}
|
4825
4802
|
/**
|
4826
4803
|
* Returns message for the given address.
|
@@ -4830,33 +4807,27 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4830
4807
|
* @returns A promise that resolves to the messages.
|
4831
4808
|
*/
|
4832
4809
|
async getMessages(address, paginationArgs) {
|
4833
|
-
this.
|
4834
|
-
|
4835
|
-
messages: { edges, pageInfo }
|
4836
|
-
} = await this.operations.getMessages({
|
4837
|
-
first: 100,
|
4810
|
+
const result = await this.operations.getMessages({
|
4811
|
+
first: 10,
|
4838
4812
|
...paginationArgs,
|
4839
4813
|
owner: Address2.fromAddressOrString(address).toB256()
|
4840
4814
|
});
|
4841
|
-
const messages = edges.map((
|
4815
|
+
const messages = result.messages.edges.map((edge) => edge.node);
|
4816
|
+
return messages.map((message) => ({
|
4842
4817
|
messageId: InputMessageCoder.getMessageId({
|
4843
|
-
sender:
|
4844
|
-
recipient:
|
4845
|
-
nonce:
|
4846
|
-
amount: bn17(
|
4847
|
-
data:
|
4818
|
+
sender: message.sender,
|
4819
|
+
recipient: message.recipient,
|
4820
|
+
nonce: message.nonce,
|
4821
|
+
amount: bn17(message.amount),
|
4822
|
+
data: message.data
|
4848
4823
|
}),
|
4849
|
-
sender: Address2.fromAddressOrString(
|
4850
|
-
recipient: Address2.fromAddressOrString(
|
4851
|
-
nonce:
|
4852
|
-
amount: bn17(
|
4853
|
-
data: InputMessageCoder.decodeData(
|
4854
|
-
daHeight: bn17(
|
4824
|
+
sender: Address2.fromAddressOrString(message.sender),
|
4825
|
+
recipient: Address2.fromAddressOrString(message.recipient),
|
4826
|
+
nonce: message.nonce,
|
4827
|
+
amount: bn17(message.amount),
|
4828
|
+
data: InputMessageCoder.decodeData(message.data),
|
4829
|
+
daHeight: bn17(message.daHeight)
|
4855
4830
|
}));
|
4856
|
-
return {
|
4857
|
-
messages,
|
4858
|
-
pageInfo
|
4859
|
-
};
|
4860
4831
|
}
|
4861
4832
|
/**
|
4862
4833
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
@@ -5035,18 +5006,6 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5035
5006
|
}
|
5036
5007
|
return relayedTransactionStatus;
|
5037
5008
|
}
|
5038
|
-
/**
|
5039
|
-
* @hidden
|
5040
|
-
*/
|
5041
|
-
validatePaginationArgs({ first, last } = {}) {
|
5042
|
-
const MAX_PAGINATION_LIMIT = 1e3;
|
5043
|
-
if ((first || 0) > MAX_PAGINATION_LIMIT || (last || 0) > MAX_PAGINATION_LIMIT) {
|
5044
|
-
throw new FuelError13(
|
5045
|
-
ErrorCode13.INVALID_INPUT_PARAMETERS,
|
5046
|
-
"Pagination limit cannot exceed 1000 items"
|
5047
|
-
);
|
5048
|
-
}
|
5049
|
-
}
|
5050
5009
|
/**
|
5051
5010
|
* @hidden
|
5052
5011
|
*/
|
@@ -5447,16 +5406,52 @@ var Account = class extends AbstractAccount {
|
|
5447
5406
|
* @param assetId - The asset ID of the coins to retrieve (optional).
|
5448
5407
|
* @returns A promise that resolves to an array of Coins.
|
5449
5408
|
*/
|
5450
|
-
async getCoins(assetId
|
5451
|
-
|
5409
|
+
async getCoins(assetId) {
|
5410
|
+
const coins = [];
|
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;
|
5452
5429
|
}
|
5453
5430
|
/**
|
5454
5431
|
* Retrieves messages owned by the account.
|
5455
5432
|
*
|
5456
5433
|
* @returns A promise that resolves to an array of Messages.
|
5457
5434
|
*/
|
5458
|
-
async getMessages(
|
5459
|
-
|
5435
|
+
async getMessages() {
|
5436
|
+
const messages = [];
|
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;
|
5460
5455
|
}
|
5461
5456
|
/**
|
5462
5457
|
* Retrieves the balance of the account for the given asset.
|
@@ -5475,7 +5470,25 @@ var Account = class extends AbstractAccount {
|
|
5475
5470
|
* @returns A promise that resolves to an array of Coins and their quantities.
|
5476
5471
|
*/
|
5477
5472
|
async getBalances() {
|
5478
|
-
|
5473
|
+
const balances = [];
|
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;
|
5479
5492
|
}
|
5480
5493
|
/**
|
5481
5494
|
* Funds a transaction request by adding the necessary resources.
|