@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/account.d.ts
CHANGED
@@ -2,7 +2,7 @@ import { AbstractAccount } from '@fuel-ts/interfaces';
|
|
2
2
|
import type { AbstractAddress, BytesLike } from '@fuel-ts/interfaces';
|
3
3
|
import type { BigNumberish, BN } from '@fuel-ts/math';
|
4
4
|
import type { FuelConnector } from './connectors';
|
5
|
-
import type {
|
5
|
+
import type { TransactionRequestLike, CallResult, TransactionRequest, Coin, CoinQuantityLike, CoinQuantity, Message, Resource, ExcludeResourcesOption, Provider, ScriptTransactionRequestLike, ProviderSendTxParams, TransactionResponse, EstimateTransactionParams, TransactionCost } from './providers';
|
6
6
|
import { ScriptTransactionRequest } from './providers';
|
7
7
|
export type TxParamsType = Pick<ScriptTransactionRequestLike, 'gasLimit' | 'tip' | 'maturity' | 'maxFee' | 'witnessLimit'>;
|
8
8
|
export type TransferParams = {
|
@@ -71,13 +71,13 @@ export declare class Account extends AbstractAccount {
|
|
71
71
|
* @param assetId - The asset ID of the coins to retrieve (optional).
|
72
72
|
* @returns A promise that resolves to an array of Coins.
|
73
73
|
*/
|
74
|
-
getCoins(assetId?: BytesLike
|
74
|
+
getCoins(assetId?: BytesLike): Promise<Coin[]>;
|
75
75
|
/**
|
76
76
|
* Retrieves messages owned by the account.
|
77
77
|
*
|
78
78
|
* @returns A promise that resolves to an array of Messages.
|
79
79
|
*/
|
80
|
-
getMessages(
|
80
|
+
getMessages(): Promise<Message[]>;
|
81
81
|
/**
|
82
82
|
* Retrieves the balance of the account for the given asset.
|
83
83
|
*
|
@@ -90,7 +90,7 @@ export declare class Account extends AbstractAccount {
|
|
90
90
|
*
|
91
91
|
* @returns A promise that resolves to an array of Coins and their quantities.
|
92
92
|
*/
|
93
|
-
getBalances(): Promise<
|
93
|
+
getBalances(): Promise<CoinQuantity[]>;
|
94
94
|
/**
|
95
95
|
* Funds a transaction request by adding the necessary resources.
|
96
96
|
*
|
package/dist/account.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAKtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAKtD,OAAO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,6 @@ ${TransactionFragmentDoc}`;
|
|
37366
37366
|
first: $first
|
37367
37367
|
last: $last
|
37368
37368
|
) {
|
37369
|
-
pageInfo {
|
37370
|
-
...pageInfoFragment
|
37371
|
-
}
|
37372
37369
|
edges {
|
37373
37370
|
node {
|
37374
37371
|
...coinFragment
|
@@ -37376,8 +37373,7 @@ ${TransactionFragmentDoc}`;
|
|
37376
37373
|
}
|
37377
37374
|
}
|
37378
37375
|
}
|
37379
|
-
${
|
37380
|
-
${CoinFragmentDoc}`;
|
37376
|
+
${CoinFragmentDoc}`;
|
37381
37377
|
var GetCoinsToSpendDocument = lib_default2`
|
37382
37378
|
query getCoinsToSpend($owner: Address!, $queryPerAsset: [SpendQueryElementInput!]!, $excludedIds: ExcludeInput) {
|
37383
37379
|
coinsToSpend(
|
@@ -37436,9 +37432,6 @@ ${MessageCoinFragmentDoc}`;
|
|
37436
37432
|
first: $first
|
37437
37433
|
last: $last
|
37438
37434
|
) {
|
37439
|
-
pageInfo {
|
37440
|
-
...pageInfoFragment
|
37441
|
-
}
|
37442
37435
|
edges {
|
37443
37436
|
node {
|
37444
37437
|
...balanceFragment
|
@@ -37446,8 +37439,7 @@ ${MessageCoinFragmentDoc}`;
|
|
37446
37439
|
}
|
37447
37440
|
}
|
37448
37441
|
}
|
37449
|
-
${
|
37450
|
-
${BalanceFragmentDoc}`;
|
37442
|
+
${BalanceFragmentDoc}`;
|
37451
37443
|
var GetMessagesDocument = lib_default2`
|
37452
37444
|
query getMessages($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
|
37453
37445
|
messages(
|
@@ -37457,9 +37449,6 @@ ${BalanceFragmentDoc}`;
|
|
37457
37449
|
first: $first
|
37458
37450
|
last: $last
|
37459
37451
|
) {
|
37460
|
-
pageInfo {
|
37461
|
-
...pageInfoFragment
|
37462
|
-
}
|
37463
37452
|
edges {
|
37464
37453
|
node {
|
37465
37454
|
...messageFragment
|
@@ -37467,8 +37456,7 @@ ${BalanceFragmentDoc}`;
|
|
37467
37456
|
}
|
37468
37457
|
}
|
37469
37458
|
}
|
37470
|
-
${
|
37471
|
-
${MessageFragmentDoc}`;
|
37459
|
+
${MessageFragmentDoc}`;
|
37472
37460
|
var GetMessageProofDocument = lib_default2`
|
37473
37461
|
query getMessageProof($transactionId: TransactionId!, $nonce: Nonce!, $commitBlockId: BlockId, $commitBlockHeight: U32) {
|
37474
37462
|
messageProof(
|
@@ -41110,27 +41098,21 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41110
41098
|
* @returns A promise that resolves to the coins.
|
41111
41099
|
*/
|
41112
41100
|
async getCoins(owner, assetId, paginationArgs) {
|
41113
|
-
this.validatePaginationArgs(paginationArgs);
|
41114
41101
|
const ownerAddress = Address.fromAddressOrString(owner);
|
41115
|
-
const {
|
41116
|
-
|
41117
|
-
} = await this.operations.getCoins({
|
41118
|
-
first: 100,
|
41102
|
+
const result = await this.operations.getCoins({
|
41103
|
+
first: 10,
|
41119
41104
|
...paginationArgs,
|
41120
41105
|
filter: { owner: ownerAddress.toB256(), assetId: assetId && hexlify(assetId) }
|
41121
41106
|
});
|
41122
|
-
const coins = edges.map((
|
41123
|
-
|
41124
|
-
|
41125
|
-
|
41126
|
-
|
41127
|
-
|
41128
|
-
|
41107
|
+
const coins = result.coins.edges.map((edge) => edge.node);
|
41108
|
+
return coins.map((coin) => ({
|
41109
|
+
id: coin.utxoId,
|
41110
|
+
assetId: coin.assetId,
|
41111
|
+
amount: bn(coin.amount),
|
41112
|
+
owner: Address.fromAddressOrString(coin.owner),
|
41113
|
+
blockCreated: bn(coin.blockCreated),
|
41114
|
+
txCreatedIdx: bn(coin.txCreatedIdx)
|
41129
41115
|
}));
|
41130
|
-
return {
|
41131
|
-
coins,
|
41132
|
-
pageInfo
|
41133
|
-
};
|
41134
41116
|
}
|
41135
41117
|
/**
|
41136
41118
|
* Returns resources for the given owner satisfying the spend query.
|
@@ -41340,22 +41322,17 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41340
41322
|
* @param paginationArgs - Pagination arguments (optional).
|
41341
41323
|
* @returns A promise that resolves to the balances.
|
41342
41324
|
*/
|
41343
|
-
async getBalances(owner) {
|
41344
|
-
const {
|
41345
|
-
|
41346
|
-
|
41347
|
-
/**
|
41348
|
-
* The query parameters for this method were designed to support pagination,
|
41349
|
-
* but the current Fuel-Core implementation does not support pagination yet.
|
41350
|
-
*/
|
41351
|
-
first: 1e4,
|
41325
|
+
async getBalances(owner, paginationArgs) {
|
41326
|
+
const result = await this.operations.getBalances({
|
41327
|
+
first: 10,
|
41328
|
+
...paginationArgs,
|
41352
41329
|
filter: { owner: Address.fromAddressOrString(owner).toB256() }
|
41353
41330
|
});
|
41354
|
-
const balances = edges.map((
|
41355
|
-
|
41356
|
-
|
41331
|
+
const balances = result.balances.edges.map((edge) => edge.node);
|
41332
|
+
return balances.map((balance) => ({
|
41333
|
+
assetId: balance.assetId,
|
41334
|
+
amount: bn(balance.amount)
|
41357
41335
|
}));
|
41358
|
-
return { balances };
|
41359
41336
|
}
|
41360
41337
|
/**
|
41361
41338
|
* Returns message for the given address.
|
@@ -41365,33 +41342,27 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41365
41342
|
* @returns A promise that resolves to the messages.
|
41366
41343
|
*/
|
41367
41344
|
async getMessages(address, paginationArgs) {
|
41368
|
-
this.
|
41369
|
-
|
41370
|
-
messages: { edges, pageInfo }
|
41371
|
-
} = await this.operations.getMessages({
|
41372
|
-
first: 100,
|
41345
|
+
const result = await this.operations.getMessages({
|
41346
|
+
first: 10,
|
41373
41347
|
...paginationArgs,
|
41374
41348
|
owner: Address.fromAddressOrString(address).toB256()
|
41375
41349
|
});
|
41376
|
-
const messages = edges.map((
|
41350
|
+
const messages = result.messages.edges.map((edge) => edge.node);
|
41351
|
+
return messages.map((message) => ({
|
41377
41352
|
messageId: InputMessageCoder.getMessageId({
|
41378
|
-
sender:
|
41379
|
-
recipient:
|
41380
|
-
nonce:
|
41381
|
-
amount: bn(
|
41382
|
-
data:
|
41353
|
+
sender: message.sender,
|
41354
|
+
recipient: message.recipient,
|
41355
|
+
nonce: message.nonce,
|
41356
|
+
amount: bn(message.amount),
|
41357
|
+
data: message.data
|
41383
41358
|
}),
|
41384
|
-
sender: Address.fromAddressOrString(
|
41385
|
-
recipient: Address.fromAddressOrString(
|
41386
|
-
nonce:
|
41387
|
-
amount: bn(
|
41388
|
-
data: InputMessageCoder.decodeData(
|
41389
|
-
daHeight: bn(
|
41359
|
+
sender: Address.fromAddressOrString(message.sender),
|
41360
|
+
recipient: Address.fromAddressOrString(message.recipient),
|
41361
|
+
nonce: message.nonce,
|
41362
|
+
amount: bn(message.amount),
|
41363
|
+
data: InputMessageCoder.decodeData(message.data),
|
41364
|
+
daHeight: bn(message.daHeight)
|
41390
41365
|
}));
|
41391
|
-
return {
|
41392
|
-
messages,
|
41393
|
-
pageInfo
|
41394
|
-
};
|
41395
41366
|
}
|
41396
41367
|
/**
|
41397
41368
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
@@ -41570,18 +41541,6 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41570
41541
|
}
|
41571
41542
|
return relayedTransactionStatus;
|
41572
41543
|
}
|
41573
|
-
/**
|
41574
|
-
* @hidden
|
41575
|
-
*/
|
41576
|
-
validatePaginationArgs({ first, last } = {}) {
|
41577
|
-
const MAX_PAGINATION_LIMIT = 1e3;
|
41578
|
-
if ((first || 0) > MAX_PAGINATION_LIMIT || (last || 0) > MAX_PAGINATION_LIMIT) {
|
41579
|
-
throw new FuelError(
|
41580
|
-
ErrorCode.INVALID_INPUT_PARAMETERS,
|
41581
|
-
"Pagination limit cannot exceed 1000 items"
|
41582
|
-
);
|
41583
|
-
}
|
41584
|
-
}
|
41585
41544
|
/**
|
41586
41545
|
* @hidden
|
41587
41546
|
*/
|
@@ -41975,16 +41934,52 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41975
41934
|
* @param assetId - The asset ID of the coins to retrieve (optional).
|
41976
41935
|
* @returns A promise that resolves to an array of Coins.
|
41977
41936
|
*/
|
41978
|
-
async getCoins(assetId
|
41979
|
-
|
41937
|
+
async getCoins(assetId) {
|
41938
|
+
const coins = [];
|
41939
|
+
const pageSize = 9999;
|
41940
|
+
let cursor;
|
41941
|
+
for (; ; ) {
|
41942
|
+
const pageCoins = await this.provider.getCoins(this.address, assetId, {
|
41943
|
+
first: pageSize,
|
41944
|
+
after: cursor
|
41945
|
+
});
|
41946
|
+
coins.push(...pageCoins);
|
41947
|
+
const hasNextPage = pageCoins.length >= pageSize;
|
41948
|
+
if (!hasNextPage) {
|
41949
|
+
break;
|
41950
|
+
}
|
41951
|
+
throw new FuelError(
|
41952
|
+
ErrorCode.NOT_SUPPORTED,
|
41953
|
+
`Wallets containing more than ${pageSize} coins exceed the current supported limit.`
|
41954
|
+
);
|
41955
|
+
}
|
41956
|
+
return coins;
|
41980
41957
|
}
|
41981
41958
|
/**
|
41982
41959
|
* Retrieves messages owned by the account.
|
41983
41960
|
*
|
41984
41961
|
* @returns A promise that resolves to an array of Messages.
|
41985
41962
|
*/
|
41986
|
-
async getMessages(
|
41987
|
-
|
41963
|
+
async getMessages() {
|
41964
|
+
const messages = [];
|
41965
|
+
const pageSize = 9999;
|
41966
|
+
let cursor;
|
41967
|
+
for (; ; ) {
|
41968
|
+
const pageMessages = await this.provider.getMessages(this.address, {
|
41969
|
+
first: pageSize,
|
41970
|
+
after: cursor
|
41971
|
+
});
|
41972
|
+
messages.push(...pageMessages);
|
41973
|
+
const hasNextPage = pageMessages.length >= pageSize;
|
41974
|
+
if (!hasNextPage) {
|
41975
|
+
break;
|
41976
|
+
}
|
41977
|
+
throw new FuelError(
|
41978
|
+
ErrorCode.NOT_SUPPORTED,
|
41979
|
+
`Wallets containing more than ${pageSize} messages exceed the current supported limit.`
|
41980
|
+
);
|
41981
|
+
}
|
41982
|
+
return messages;
|
41988
41983
|
}
|
41989
41984
|
/**
|
41990
41985
|
* Retrieves the balance of the account for the given asset.
|
@@ -42003,7 +41998,25 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42003
41998
|
* @returns A promise that resolves to an array of Coins and their quantities.
|
42004
41999
|
*/
|
42005
42000
|
async getBalances() {
|
42006
|
-
|
42001
|
+
const balances = [];
|
42002
|
+
const pageSize = 9999;
|
42003
|
+
let cursor;
|
42004
|
+
for (; ; ) {
|
42005
|
+
const pageBalances = await this.provider.getBalances(this.address, {
|
42006
|
+
first: pageSize,
|
42007
|
+
after: cursor
|
42008
|
+
});
|
42009
|
+
balances.push(...pageBalances);
|
42010
|
+
const hasNextPage = pageBalances.length >= pageSize;
|
42011
|
+
if (!hasNextPage) {
|
42012
|
+
break;
|
42013
|
+
}
|
42014
|
+
throw new FuelError(
|
42015
|
+
ErrorCode.NOT_SUPPORTED,
|
42016
|
+
`Wallets containing more than ${pageSize} balances exceed the current supported limit.`
|
42017
|
+
);
|
42018
|
+
}
|
42019
|
+
return balances;
|
42007
42020
|
}
|
42008
42021
|
/**
|
42009
42022
|
* Funds a transaction request by adding the necessary resources.
|