@fuel-ts/account 0.88.0 → 0.89.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 +67 -48
- package/dist/account.d.ts.map +1 -1
- package/dist/index.global.js +305 -138
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +257 -102
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +257 -102
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +126 -72
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/script-transaction-request.d.ts +7 -0
- package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +1 -0
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
- package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
- package/dist/providers/transaction-summary/operations.d.ts +4 -2
- package/dist/providers/transaction-summary/operations.d.ts.map +1 -1
- package/dist/providers/transaction-summary/types.d.ts +1 -0
- package/dist/providers/transaction-summary/types.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts +3 -3
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils.global.js +456 -310
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +250 -102
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +250 -102
- package/dist/test-utils.mjs.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts +8 -0
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/package.json +15 -15
package/dist/account.d.ts
CHANGED
@@ -3,7 +3,13 @@ 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
5
|
import type { TransactionRequestLike, CallResult, TransactionRequest, Coin, CoinQuantityLike, CoinQuantity, Message, Resource, ExcludeResourcesOption, Provider, ScriptTransactionRequestLike, ProviderSendTxParams, TransactionResponse, EstimateTransactionParams, TransactionCost } from './providers';
|
6
|
+
import { ScriptTransactionRequest } from './providers';
|
6
7
|
export type TxParamsType = Pick<ScriptTransactionRequestLike, 'gasLimit' | 'tip' | 'maturity' | 'maxFee' | 'witnessLimit'>;
|
8
|
+
export type TransferParams = {
|
9
|
+
destination: string | AbstractAddress;
|
10
|
+
amount: BigNumberish;
|
11
|
+
assetId?: BytesLike;
|
12
|
+
};
|
7
13
|
export type EstimatedTxParams = Pick<TransactionCost, 'estimatedPredicates' | 'addedSignatures' | 'requiredQuantities' | 'updateMaxFee'>;
|
8
14
|
/**
|
9
15
|
* `Account` provides an abstraction for interacting with accounts or wallets on the network.
|
@@ -17,12 +23,16 @@ export declare class Account extends AbstractAccount {
|
|
17
23
|
* The provider used to interact with the network.
|
18
24
|
*/
|
19
25
|
protected _provider?: Provider;
|
26
|
+
/**
|
27
|
+
* The connector for use with external wallets
|
28
|
+
*/
|
20
29
|
protected _connector?: FuelConnector;
|
21
30
|
/**
|
22
31
|
* Creates a new Account instance.
|
23
32
|
*
|
24
33
|
* @param address - The address of the account.
|
25
34
|
* @param provider - A Provider instance (optional).
|
35
|
+
* @param connector - A FuelConnector instance (optional).
|
26
36
|
*/
|
27
37
|
constructor(address: string | AbstractAddress, provider?: Provider, connector?: FuelConnector);
|
28
38
|
/**
|
@@ -49,15 +59,15 @@ export declare class Account extends AbstractAccount {
|
|
49
59
|
/**
|
50
60
|
* Retrieves resources satisfying the spend query for the account.
|
51
61
|
*
|
52
|
-
* @param quantities -
|
53
|
-
* @param excludedIds - IDs of resources to be excluded from the query.
|
62
|
+
* @param quantities - Quantities of resources to be obtained.
|
63
|
+
* @param excludedIds - IDs of resources to be excluded from the query (optional).
|
54
64
|
* @returns A promise that resolves to an array of Resources.
|
55
65
|
*/
|
56
|
-
getResourcesToSpend(quantities: CoinQuantityLike[]
|
66
|
+
getResourcesToSpend(quantities: CoinQuantityLike[], excludedIds?: ExcludeResourcesOption): Promise<Resource[]>;
|
57
67
|
/**
|
58
68
|
* Retrieves coins owned by the account.
|
59
69
|
*
|
60
|
-
* @param assetId - The asset ID of the coins to retrieve.
|
70
|
+
* @param assetId - The asset ID of the coins to retrieve (optional).
|
61
71
|
* @returns A promise that resolves to an array of Coins.
|
62
72
|
*/
|
63
73
|
getCoins(assetId?: BytesLike): Promise<Coin[]>;
|
@@ -70,7 +80,7 @@ export declare class Account extends AbstractAccount {
|
|
70
80
|
/**
|
71
81
|
* Retrieves the balance of the account for the given asset.
|
72
82
|
*
|
73
|
-
* @param assetId - The asset ID to check the balance for.
|
83
|
+
* @param assetId - The asset ID to check the balance for (optional).
|
74
84
|
* @returns A promise that resolves to the balance amount.
|
75
85
|
*/
|
76
86
|
getBalance(assetId?: BytesLike): Promise<BN>;
|
@@ -86,7 +96,7 @@ export declare class Account extends AbstractAccount {
|
|
86
96
|
* @typeParam T - The type of the TransactionRequest.
|
87
97
|
* @param request - The transaction request to fund.
|
88
98
|
* @param params - The estimated transaction parameters.
|
89
|
-
* @returns
|
99
|
+
* @returns A promise that resolves to the funded transaction request.
|
90
100
|
*/
|
91
101
|
fund<T extends TransactionRequest>(request: T, params: EstimatedTxParams): Promise<T>;
|
92
102
|
/**
|
@@ -94,73 +104,75 @@ export declare class Account extends AbstractAccount {
|
|
94
104
|
*
|
95
105
|
* @param destination - The address of the destination.
|
96
106
|
* @param amount - The amount of coins to transfer.
|
97
|
-
* @param assetId - The asset ID of the coins to transfer.
|
98
|
-
* @param txParams - The transaction parameters (
|
107
|
+
* @param assetId - The asset ID of the coins to transfer (optional).
|
108
|
+
* @param txParams - The transaction parameters (optional).
|
99
109
|
* @returns A promise that resolves to the prepared transaction request.
|
100
110
|
*/
|
101
|
-
createTransfer(
|
102
|
-
/** Address of the destination */
|
103
|
-
destination: string | AbstractAddress,
|
104
|
-
/** Amount of coins */
|
105
|
-
amount: BigNumberish,
|
106
|
-
/** Asset ID of coins */
|
107
|
-
assetId?: BytesLike,
|
108
|
-
/** Tx Params */
|
109
|
-
txParams?: TxParamsType): Promise<TransactionRequest>;
|
111
|
+
createTransfer(destination: string | AbstractAddress, amount: BigNumberish, assetId?: BytesLike, txParams?: TxParamsType): Promise<TransactionRequest>;
|
110
112
|
/**
|
111
113
|
* Transfers coins to a destination address.
|
112
114
|
*
|
113
115
|
* @param destination - The address of the destination.
|
114
116
|
* @param amount - The amount of coins to transfer.
|
115
|
-
* @param assetId - The asset ID of the coins to transfer.
|
116
|
-
* @param txParams - The transaction parameters (
|
117
|
+
* @param assetId - The asset ID of the coins to transfer (optional).
|
118
|
+
* @param txParams - The transaction parameters (optional).
|
117
119
|
* @returns A promise that resolves to the transaction response.
|
118
120
|
*/
|
119
|
-
transfer(
|
120
|
-
/**
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
txParams?: TxParamsType): Promise<TransactionResponse>;
|
121
|
+
transfer(destination: string | AbstractAddress, amount: BigNumberish, assetId?: BytesLike, txParams?: TxParamsType): Promise<TransactionResponse>;
|
122
|
+
/**
|
123
|
+
* Transfers multiple amounts of a token to multiple recipients.
|
124
|
+
*
|
125
|
+
* @param transferParams - An array of `TransferParams` objects representing the transfers to be made.
|
126
|
+
* @param txParams - Optional transaction parameters.
|
127
|
+
* @returns A promise that resolves to a `TransactionResponse` object representing the transaction result.
|
128
|
+
*/
|
129
|
+
batchTransfer(transferParams: TransferParams[], txParams?: TxParamsType): Promise<TransactionResponse>;
|
130
|
+
/**
|
131
|
+
* Adds a transfer to the given transaction request.
|
132
|
+
*
|
133
|
+
* @param request - The script transaction request to add transfers to.
|
134
|
+
* @param transferParams - The object representing the transfer to be made.
|
135
|
+
* @returns The updated transaction request with the added transfer.
|
136
|
+
*/
|
137
|
+
addTransfer(request: ScriptTransactionRequest, transferParams: TransferParams): ScriptTransactionRequest;
|
138
|
+
/**
|
139
|
+
* Adds multiple transfers to a script transaction request.
|
140
|
+
*
|
141
|
+
* @param request - The script transaction request to add transfers to.
|
142
|
+
* @param transferParams - An array of `TransferParams` objects representing the transfers to be made.
|
143
|
+
* @returns The updated script transaction request.
|
144
|
+
*/
|
145
|
+
addBatchTransfer(request: ScriptTransactionRequest, transferParams: TransferParams[]): ScriptTransactionRequest;
|
128
146
|
/**
|
129
147
|
* Transfers coins to a contract address.
|
130
148
|
*
|
131
149
|
* @param contractId - The address of the contract.
|
132
150
|
* @param amount - The amount of coins to transfer.
|
133
|
-
* @param assetId - The asset ID of the coins to transfer.
|
134
|
-
* @param txParams - The
|
151
|
+
* @param assetId - The asset ID of the coins to transfer (optional).
|
152
|
+
* @param txParams - The transaction parameters (optional).
|
135
153
|
* @returns A promise that resolves to the transaction response.
|
136
154
|
*/
|
137
|
-
transferToContract(
|
138
|
-
/** Contract address */
|
139
|
-
contractId: string | AbstractAddress,
|
140
|
-
/** Amount of coins */
|
141
|
-
amount: BigNumberish,
|
142
|
-
/** Asset ID of coins */
|
143
|
-
assetId?: BytesLike,
|
144
|
-
/** Tx Params */
|
145
|
-
txParams?: TxParamsType): Promise<TransactionResponse>;
|
155
|
+
transferToContract(contractId: string | AbstractAddress, amount: BigNumberish, assetId?: BytesLike, txParams?: TxParamsType): Promise<TransactionResponse>;
|
146
156
|
/**
|
147
157
|
* Withdraws an amount of the base asset to the base chain.
|
148
158
|
*
|
149
159
|
* @param recipient - Address of the recipient on the base chain.
|
150
160
|
* @param amount - Amount of base asset.
|
151
|
-
* @param txParams - The
|
161
|
+
* @param txParams - The transaction parameters (optional).
|
152
162
|
* @returns A promise that resolves to the transaction response.
|
153
163
|
*/
|
154
|
-
withdrawToBaseLayer(
|
155
|
-
/**
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
164
|
+
withdrawToBaseLayer(recipient: string | AbstractAddress, amount: BigNumberish, txParams?: TxParamsType): Promise<TransactionResponse>;
|
165
|
+
/**
|
166
|
+
* Sign a message from the account via the connector.
|
167
|
+
*
|
168
|
+
* @param message - the message to sign.
|
169
|
+
* @returns a promise that resolves to the signature.
|
170
|
+
*
|
171
|
+
* @hidden
|
172
|
+
*/
|
161
173
|
signMessage(message: string): Promise<string>;
|
162
174
|
/**
|
163
|
-
* Signs a transaction
|
175
|
+
* Signs a transaction from the account via the connector..
|
164
176
|
*
|
165
177
|
* @param transactionRequestLike - The transaction request to sign.
|
166
178
|
* @returns A promise that resolves to the signature of the transaction.
|
@@ -170,6 +182,7 @@ export declare class Account extends AbstractAccount {
|
|
170
182
|
* Sends a transaction to the network.
|
171
183
|
*
|
172
184
|
* @param transactionRequestLike - The transaction request to be sent.
|
185
|
+
* @param sendTransactionParams - The provider send transaction parameters (optional).
|
173
186
|
* @returns A promise that resolves to the transaction response.
|
174
187
|
*/
|
175
188
|
sendTransaction(transactionRequestLike: TransactionRequestLike, { estimateTxDependencies, awaitExecution }?: ProviderSendTxParams): Promise<TransactionResponse>;
|
@@ -177,9 +190,15 @@ export declare class Account extends AbstractAccount {
|
|
177
190
|
* Simulates a transaction.
|
178
191
|
*
|
179
192
|
* @param transactionRequestLike - The transaction request to be simulated.
|
193
|
+
* @param estimateTxParams - The estimate transaction params (optional).
|
180
194
|
* @returns A promise that resolves to the call result.
|
181
195
|
*/
|
182
196
|
simulateTransaction(transactionRequestLike: TransactionRequestLike, { estimateTxDependencies }?: EstimateTransactionParams): Promise<CallResult>;
|
197
|
+
/** @hidden * */
|
198
|
+
private validateTransferAmount;
|
199
|
+
/** @hidden * */
|
200
|
+
private estimateAndFundTransaction;
|
201
|
+
/** @hidden * */
|
183
202
|
private validateGasLimitAndMaxFee;
|
184
203
|
}
|
185
204
|
//# sourceMappingURL=account.d.ts.map
|
package/dist/account.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAEA,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,sBAAsB,EACtB,UAAU,EACV,kBAAkB,EAClB,IAAI,EACJ,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,sBAAsB,EACtB,QAAQ,EACR,4BAA4B,EAC5B,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,eAAe,EAChB,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAEA,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,sBAAsB,EACtB,UAAU,EACV,kBAAkB,EAClB,IAAI,EACJ,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,sBAAsB,EACtB,QAAQ,EACR,4BAA4B,EAC5B,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,eAAe,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,wBAAwB,EAGzB,MAAM,aAAa,CAAC;AASrB,MAAM,MAAM,YAAY,GAAG,IAAI,CAC7B,4BAA4B,EAC5B,UAAU,GA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