@fuel-ts/account 0.0.0-rc-1356-20240522164420 → 0.0.0-rc-1356-20240523144307
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 +32 -49
- package/dist/account.d.ts.map +1 -1
- package/dist/index.global.js +144 -49
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +144 -49
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +144 -49
- package/dist/index.mjs.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/test-utils.global.js +144 -49
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +144 -49
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +144 -49
- 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
@@ -43001,6 +43001,13 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
43001
43001
|
}
|
43002
43002
|
return this.outputs.length - 1;
|
43003
43003
|
}
|
43004
|
+
/**
|
43005
|
+
* Calculates the maximum gas for the transaction.
|
43006
|
+
*
|
43007
|
+
* @param chainInfo - The chain information.
|
43008
|
+
* @param minGas - The minimum gas.
|
43009
|
+
* @returns the maximum gas.
|
43010
|
+
*/
|
43004
43011
|
calculateMaxGas(chainInfo, minGas) {
|
43005
43012
|
const { consensusParameters } = chainInfo;
|
43006
43013
|
const {
|
@@ -44083,7 +44090,6 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
44083
44090
|
* Constructor to initialize a Provider.
|
44084
44091
|
*
|
44085
44092
|
* @param url - GraphQL endpoint of the Fuel node
|
44086
|
-
* @param chainInfo - Chain info of the Fuel node
|
44087
44093
|
* @param options - Additional options for the provider
|
44088
44094
|
* @hidden
|
44089
44095
|
*/
|
@@ -44106,10 +44112,14 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
44106
44112
|
this.operations = this.createOperations();
|
44107
44113
|
this.cache = options.cacheUtxo ? new MemoryCache(options.cacheUtxo) : void 0;
|
44108
44114
|
}
|
44115
|
+
/** @hidden */
|
44109
44116
|
static clearChainAndNodeCaches() {
|
44110
44117
|
_Provider.nodeInfoCache = {};
|
44111
44118
|
_Provider.chainInfoCache = {};
|
44112
44119
|
}
|
44120
|
+
/**
|
44121
|
+
* @hidden
|
44122
|
+
*/
|
44113
44123
|
static getFetchFn(options) {
|
44114
44124
|
const { retryOptions, timeout } = options;
|
44115
44125
|
return autoRetryFetch(async (...args) => {
|
@@ -44125,8 +44135,11 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
44125
44135
|
}
|
44126
44136
|
/**
|
44127
44137
|
* Creates a new instance of the Provider class. This is the recommended way to initialize a Provider.
|
44138
|
+
*
|
44128
44139
|
* @param url - GraphQL endpoint of the Fuel node
|
44129
44140
|
* @param options - Additional options for the provider
|
44141
|
+
*
|
44142
|
+
* @returns A promise that resolves to a Provider instance.
|
44130
44143
|
*/
|
44131
44144
|
static async create(url, options = {}) {
|
44132
44145
|
const provider = new _Provider(url, options);
|
@@ -44135,6 +44148,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
44135
44148
|
}
|
44136
44149
|
/**
|
44137
44150
|
* Returns the cached chainInfo for the current URL.
|
44151
|
+
*
|
44152
|
+
* @returns the chain information configuration.
|
44138
44153
|
*/
|
44139
44154
|
getChain() {
|
44140
44155
|
const chain = _Provider.chainInfoCache[this.url];
|
@@ -44148,6 +44163,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
44148
44163
|
}
|
44149
44164
|
/**
|
44150
44165
|
* Returns the cached nodeInfo for the current URL.
|
44166
|
+
*
|
44167
|
+
* @returns the node information configuration.
|
44151
44168
|
*/
|
44152
44169
|
getNode() {
|
44153
44170
|
const node = _Provider.nodeInfoCache[this.url];
|
@@ -44179,6 +44196,9 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
44179
44196
|
}
|
44180
44197
|
/**
|
44181
44198
|
* Updates the URL for the provider and fetches the consensus parameters for the new URL, if needed.
|
44199
|
+
*
|
44200
|
+
* @param url - The URL to connect to.
|
44201
|
+
* @param options - Additional options for the provider.
|
44182
44202
|
*/
|
44183
44203
|
async connect(url, options) {
|
44184
44204
|
this.url = url;
|
@@ -44187,9 +44207,9 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
44187
44207
|
await this.fetchChainAndNodeInfo();
|
44188
44208
|
}
|
44189
44209
|
/**
|
44190
|
-
*
|
44210
|
+
* Return the chain and node information.
|
44191
44211
|
*
|
44192
|
-
* @returns
|
44212
|
+
* @returns A promise that resolves to the Chain and NodeInfo.
|
44193
44213
|
*/
|
44194
44214
|
async fetchChainAndNodeInfo() {
|
44195
44215
|
const chain = await this.fetchChain();
|
@@ -44200,6 +44220,9 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
44200
44220
|
nodeInfo
|
44201
44221
|
};
|
44202
44222
|
}
|
44223
|
+
/**
|
44224
|
+
* @hidden
|
44225
|
+
*/
|
44203
44226
|
static ensureClientVersionIsSupported(nodeInfo) {
|
44204
44227
|
const { isMajorSupported, isMinorSupported, supportedVersion } = checkFuelCoreVersionCompatibility(nodeInfo.nodeVersion);
|
44205
44228
|
if (!isMajorSupported || !isMinorSupported) {
|
@@ -44215,6 +44238,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44215
44238
|
* Create GraphQL client and set operations.
|
44216
44239
|
*
|
44217
44240
|
* @returns The operation SDK object
|
44241
|
+
* @hidden
|
44218
44242
|
*/
|
44219
44243
|
createOperations() {
|
44220
44244
|
const fetchFn = _Provider.getFetchFn(this.options);
|
@@ -44259,18 +44283,18 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44259
44283
|
return nodeVersion;
|
44260
44284
|
}
|
44261
44285
|
/**
|
44262
|
-
* Returns the block number.
|
44286
|
+
* Returns the latest block number.
|
44263
44287
|
*
|
44264
|
-
* @returns A promise that resolves to the block number
|
44288
|
+
* @returns A promise that resolves to the latest block number.
|
44265
44289
|
*/
|
44266
44290
|
async getBlockNumber() {
|
44267
44291
|
const { chain } = await this.operations.getChain();
|
44268
44292
|
return bn(chain.latestBlock.height, 10);
|
44269
44293
|
}
|
44270
44294
|
/**
|
44271
|
-
* Returns the
|
44272
|
-
*
|
44273
|
-
* @returns
|
44295
|
+
* Returns the node information for the current provider network.
|
44296
|
+
*
|
44297
|
+
* @returns a promise that resolves to the node information.
|
44274
44298
|
*/
|
44275
44299
|
async fetchNode() {
|
44276
44300
|
const { nodeInfo } = await this.operations.getNodeInfo();
|
@@ -44285,9 +44309,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44285
44309
|
return processedNodeInfo;
|
44286
44310
|
}
|
44287
44311
|
/**
|
44288
|
-
*
|
44289
|
-
*
|
44290
|
-
* @returns
|
44312
|
+
* Returns the chain information for the current provider network.
|
44313
|
+
*
|
44314
|
+
* @returns a promise that resolves to the chain information.
|
44291
44315
|
*/
|
44292
44316
|
async fetchChain() {
|
44293
44317
|
const { chain } = await this.operations.getChain();
|
@@ -44296,8 +44320,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44296
44320
|
return processedChain;
|
44297
44321
|
}
|
44298
44322
|
/**
|
44299
|
-
* Returns the chain ID
|
44300
|
-
*
|
44323
|
+
* Returns the chain ID for the current provider network.
|
44324
|
+
*
|
44325
|
+
* @returns A promise that resolves to the chain ID number.
|
44301
44326
|
*/
|
44302
44327
|
getChainId() {
|
44303
44328
|
const {
|
@@ -44306,9 +44331,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44306
44331
|
return chainId.toNumber();
|
44307
44332
|
}
|
44308
44333
|
/**
|
44309
|
-
* Returns the base asset ID for the current provider network
|
44334
|
+
* Returns the base asset ID for the current provider network.
|
44310
44335
|
*
|
44311
|
-
* @returns the base asset ID
|
44336
|
+
* @returns the base asset ID.
|
44312
44337
|
*/
|
44313
44338
|
getBaseAssetId() {
|
44314
44339
|
const {
|
@@ -44323,6 +44348,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44323
44348
|
* the transaction will be mutated and those dependencies will be added.
|
44324
44349
|
*
|
44325
44350
|
* @param transactionRequestLike - The transaction request object.
|
44351
|
+
* @param sendTransactionParams - The provider send transaction parameters (optional).
|
44326
44352
|
* @returns A promise that resolves to the transaction response object.
|
44327
44353
|
*/
|
44328
44354
|
// #region Provider-sendTransaction
|
@@ -44367,7 +44393,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44367
44393
|
* the transaction will be mutated and those dependencies will be added.
|
44368
44394
|
*
|
44369
44395
|
* @param transactionRequestLike - The transaction request object.
|
44370
|
-
* @param
|
44396
|
+
* @param sendTransactionParams - The provider call parameters (optional).
|
44371
44397
|
* @returns A promise that resolves to the call result object.
|
44372
44398
|
*/
|
44373
44399
|
async call(transactionRequestLike, { utxoValidation, estimateTxDependencies = true } = {}) {
|
@@ -44387,6 +44413,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44387
44413
|
/**
|
44388
44414
|
* Verifies whether enough gas is available to complete transaction.
|
44389
44415
|
*
|
44416
|
+
* @template T - The type of the transaction request object.
|
44417
|
+
*
|
44390
44418
|
* @param transactionRequest - The transaction request object.
|
44391
44419
|
* @returns A promise that resolves to the estimated transaction request object.
|
44392
44420
|
*/
|
@@ -44421,9 +44449,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44421
44449
|
* If there are missing variable outputs,
|
44422
44450
|
* `addVariableOutputs` is called on the transaction.
|
44423
44451
|
*
|
44424
|
-
*
|
44425
44452
|
* @param transactionRequest - The transaction request object.
|
44426
|
-
* @returns A promise.
|
44453
|
+
* @returns A promise that resolves to the estimate transaction dependencies.
|
44427
44454
|
*/
|
44428
44455
|
async estimateTxDependencies(transactionRequest) {
|
44429
44456
|
if (transactionRequest.type === TransactionType.Create) {
|
@@ -44536,6 +44563,14 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44536
44563
|
}
|
44537
44564
|
return results;
|
44538
44565
|
}
|
44566
|
+
/**
|
44567
|
+
* Dry runs multiple transactions.
|
44568
|
+
*
|
44569
|
+
* @param transactionRequests - Array of transaction request objects.
|
44570
|
+
* @param sendTransactionParams - The provider call parameters (optional).
|
44571
|
+
*
|
44572
|
+
* @returns A promise that resolves to an array of results for each transaction call.
|
44573
|
+
*/
|
44539
44574
|
async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
|
44540
44575
|
if (estimateTxDependencies) {
|
44541
44576
|
return this.estimateMultipleTxDependencies(transactionRequests);
|
@@ -44606,6 +44641,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44606
44641
|
* the transaction will be mutated and those dependencies will be added
|
44607
44642
|
*
|
44608
44643
|
* @param transactionRequestLike - The transaction request object.
|
44644
|
+
* @param estimateTxParams - The estimate transaction params (optional).
|
44609
44645
|
* @returns A promise that resolves to the call result object.
|
44610
44646
|
*/
|
44611
44647
|
async simulate(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
@@ -44630,14 +44666,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44630
44666
|
* to set gasLimit and also reserve balance amounts
|
44631
44667
|
* on the the transaction.
|
44632
44668
|
*
|
44633
|
-
* @privateRemarks
|
44634
|
-
* The tolerance is add on top of the gasUsed calculated
|
44635
|
-
* from the node, this create a safe margin costs like
|
44636
|
-
* change states on transfer that don't occur on the dryRun
|
44637
|
-
* transaction. The default value is 0.2 or 20%
|
44638
|
-
*
|
44639
44669
|
* @param transactionRequestLike - The transaction request object.
|
44640
|
-
* @param
|
44670
|
+
* @param transactionCostParams - The transaction cost parameters (optional).
|
44671
|
+
*
|
44641
44672
|
* @returns A promise that resolves to the transaction cost object.
|
44642
44673
|
*/
|
44643
44674
|
async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
|
@@ -44705,6 +44736,15 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44705
44736
|
updateMaxFee
|
44706
44737
|
};
|
44707
44738
|
}
|
44739
|
+
/**
|
44740
|
+
* Get the required quantities and associated resources for a transaction.
|
44741
|
+
*
|
44742
|
+
* @param owner - address to add resources from.
|
44743
|
+
* @param transactionRequestLike - transaction request to populate resources for.
|
44744
|
+
* @param quantitiesToContract - quantities for the contract (optional).
|
44745
|
+
*
|
44746
|
+
* @returns a promise resolving to the required quantities for the transaction.
|
44747
|
+
*/
|
44708
44748
|
async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
|
44709
44749
|
const ownerAddress = Address.fromAddressOrString(owner);
|
44710
44750
|
const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
|
@@ -44726,6 +44766,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44726
44766
|
}
|
44727
44767
|
/**
|
44728
44768
|
* Returns coins for the given owner.
|
44769
|
+
*
|
44770
|
+
* @param owner - The address to get coins for.
|
44771
|
+
* @param assetId - The asset ID of coins to get (optional).
|
44772
|
+
* @param paginationArgs - Pagination arguments (optional).
|
44773
|
+
*
|
44774
|
+
* @returns A promise that resolves to the coins.
|
44729
44775
|
*/
|
44730
44776
|
async getCoins(owner, assetId, paginationArgs) {
|
44731
44777
|
const ownerAddress = Address.fromAddressOrString(owner);
|
@@ -44748,8 +44794,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44748
44794
|
* Returns resources for the given owner satisfying the spend query.
|
44749
44795
|
*
|
44750
44796
|
* @param owner - The address to get resources for.
|
44751
|
-
* @param quantities - The quantities to get.
|
44752
|
-
* @param excludedIds - IDs of excluded resources from the selection.
|
44797
|
+
* @param quantities - The coin quantities to get.
|
44798
|
+
* @param excludedIds - IDs of excluded resources from the selection (optional).
|
44753
44799
|
* @returns A promise that resolves to the resources.
|
44754
44800
|
*/
|
44755
44801
|
async getResourcesToSpend(owner, quantities, excludedIds) {
|
@@ -44804,7 +44850,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44804
44850
|
* Returns block matching the given ID or height.
|
44805
44851
|
*
|
44806
44852
|
* @param idOrHeight - ID or height of the block.
|
44807
|
-
* @returns A promise that resolves to the block.
|
44853
|
+
* @returns A promise that resolves to the block or null.
|
44808
44854
|
*/
|
44809
44855
|
async getBlock(idOrHeight) {
|
44810
44856
|
let variables;
|
@@ -44934,7 +44980,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44934
44980
|
* Returns balances for the given owner.
|
44935
44981
|
*
|
44936
44982
|
* @param owner - The address to get coins for.
|
44937
|
-
* @param paginationArgs - Pagination arguments.
|
44983
|
+
* @param paginationArgs - Pagination arguments (optional).
|
44938
44984
|
* @returns A promise that resolves to the balances.
|
44939
44985
|
*/
|
44940
44986
|
async getBalances(owner, paginationArgs) {
|
@@ -44953,7 +44999,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44953
44999
|
* Returns message for the given address.
|
44954
45000
|
*
|
44955
45001
|
* @param address - The address to get message from.
|
44956
|
-
* @param paginationArgs - Pagination arguments.
|
45002
|
+
* @param paginationArgs - Pagination arguments (optional).
|
44957
45003
|
* @returns A promise that resolves to the messages.
|
44958
45004
|
*/
|
44959
45005
|
async getMessages(address, paginationArgs) {
|
@@ -44984,8 +45030,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44984
45030
|
*
|
44985
45031
|
* @param transactionId - The transaction to get message from.
|
44986
45032
|
* @param messageId - The message id from MessageOut receipt.
|
44987
|
-
* @param commitBlockId - The commit block id.
|
44988
|
-
* @param commitBlockHeight - The commit block height.
|
45033
|
+
* @param commitBlockId - The commit block id (optional).
|
45034
|
+
* @param commitBlockHeight - The commit block height (optional).
|
44989
45035
|
* @returns A promise that resolves to the message proof.
|
44990
45036
|
*/
|
44991
45037
|
async getMessageProof(transactionId, nonce, commitBlockId, commitBlockHeight) {
|
@@ -45073,10 +45119,21 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45073
45119
|
data
|
45074
45120
|
};
|
45075
45121
|
}
|
45122
|
+
/**
|
45123
|
+
* Get the latest gas price from the node.
|
45124
|
+
*
|
45125
|
+
* @returns A promise that resolves to the latest gas price.
|
45126
|
+
*/
|
45076
45127
|
async getLatestGasPrice() {
|
45077
45128
|
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
45078
45129
|
return bn(latestGasPrice.gasPrice);
|
45079
45130
|
}
|
45131
|
+
/**
|
45132
|
+
* Returns the estimate gas price for the given block horizon.
|
45133
|
+
*
|
45134
|
+
* @param blockHorizon - The block horizon to estimate gas price for.
|
45135
|
+
* @returns A promise that resolves to the estimated gas price.
|
45136
|
+
*/
|
45080
45137
|
async estimateGasPrice(blockHorizon) {
|
45081
45138
|
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
45082
45139
|
blockHorizon: String(blockHorizon)
|
@@ -45096,8 +45153,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45096
45153
|
/**
|
45097
45154
|
* Lets you produce blocks with custom timestamps and the block number of the last block produced.
|
45098
45155
|
*
|
45099
|
-
* @param amount - The amount of blocks to produce
|
45100
|
-
* @param startTime - The UNIX timestamp (milliseconds) to set for the first produced block
|
45156
|
+
* @param amount - The amount of blocks to produce.
|
45157
|
+
* @param startTime - The UNIX timestamp (milliseconds) to set for the first produced block (optional).
|
45101
45158
|
* @returns A promise that resolves to the block number of the last produced block.
|
45102
45159
|
*/
|
45103
45160
|
async produceBlocks(amount, startTime) {
|
@@ -45107,6 +45164,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45107
45164
|
});
|
45108
45165
|
return bn(latestBlockHeight);
|
45109
45166
|
}
|
45167
|
+
/**
|
45168
|
+
* Get the transaction response for the given transaction ID.
|
45169
|
+
*
|
45170
|
+
* @param transactionId - The transaction ID to get the response for.
|
45171
|
+
* @returns A promise that resolves to the transaction response.
|
45172
|
+
*/
|
45110
45173
|
// eslint-disable-next-line @typescript-eslint/require-await
|
45111
45174
|
async getTransactionResponse(transactionId) {
|
45112
45175
|
return new TransactionResponse(transactionId, this);
|
@@ -45115,7 +45178,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45115
45178
|
* Returns Message for given nonce.
|
45116
45179
|
*
|
45117
45180
|
* @param nonce - The nonce of the message to retrieve.
|
45118
|
-
* @returns A promise that resolves to the Message object.
|
45181
|
+
* @returns A promise that resolves to the Message object or null.
|
45119
45182
|
*/
|
45120
45183
|
async getMessageByNonce(nonce) {
|
45121
45184
|
const { message } = await this.operations.getMessageByNonce({ nonce });
|
@@ -45124,6 +45187,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45124
45187
|
}
|
45125
45188
|
return message;
|
45126
45189
|
}
|
45190
|
+
/**
|
45191
|
+
* Get the relayed transaction for the given transaction ID.
|
45192
|
+
*
|
45193
|
+
* @param relayedTransactionId - The relayed transaction ID to get the response for.
|
45194
|
+
* @returns A promise that resolves to the relayed transaction.
|
45195
|
+
*/
|
45127
45196
|
async getRelayedTransactionStatus(relayedTransactionId) {
|
45128
45197
|
const { relayedTransactionStatus } = await this.operations.getRelayedTransactionStatus({
|
45129
45198
|
relayedTransactionId
|
@@ -45133,6 +45202,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45133
45202
|
}
|
45134
45203
|
return relayedTransactionStatus;
|
45135
45204
|
}
|
45205
|
+
/**
|
45206
|
+
* @hidden
|
45207
|
+
*/
|
45136
45208
|
extractDryRunError(transactionRequest, receipts, dryRunStatus) {
|
45137
45209
|
const status = dryRunStatus;
|
45138
45210
|
let logs = [];
|
@@ -45162,7 +45234,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45162
45234
|
}
|
45163
45235
|
});
|
45164
45236
|
};
|
45237
|
+
/** @hidden */
|
45165
45238
|
__publicField(Provider, "chainInfoCache", {});
|
45239
|
+
/** @hidden */
|
45166
45240
|
__publicField(Provider, "nodeInfoCache", {});
|
45167
45241
|
|
45168
45242
|
// src/providers/chains.ts
|
@@ -45280,12 +45354,16 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45280
45354
|
* The provider used to interact with the network.
|
45281
45355
|
*/
|
45282
45356
|
_provider;
|
45357
|
+
/**
|
45358
|
+
* The connector for use with external wallets
|
45359
|
+
*/
|
45283
45360
|
_connector;
|
45284
45361
|
/**
|
45285
45362
|
* Creates a new Account instance.
|
45286
45363
|
*
|
45287
45364
|
* @param address - The address of the account.
|
45288
45365
|
* @param provider - A Provider instance (optional).
|
45366
|
+
* @param connector - A FuelConnector instance (optional).
|
45289
45367
|
*/
|
45290
45368
|
constructor(address, provider, connector) {
|
45291
45369
|
super();
|
@@ -45327,8 +45405,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45327
45405
|
/**
|
45328
45406
|
* Retrieves resources satisfying the spend query for the account.
|
45329
45407
|
*
|
45330
|
-
* @param quantities -
|
45331
|
-
* @param excludedIds - IDs of resources to be excluded from the query.
|
45408
|
+
* @param quantities - Quantities of resources to be obtained.
|
45409
|
+
* @param excludedIds - IDs of resources to be excluded from the query (optional).
|
45332
45410
|
* @returns A promise that resolves to an array of Resources.
|
45333
45411
|
*/
|
45334
45412
|
async getResourcesToSpend(quantities, excludedIds) {
|
@@ -45337,7 +45415,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45337
45415
|
/**
|
45338
45416
|
* Retrieves coins owned by the account.
|
45339
45417
|
*
|
45340
|
-
* @param assetId - The asset ID of the coins to retrieve.
|
45418
|
+
* @param assetId - The asset ID of the coins to retrieve (optional).
|
45341
45419
|
* @returns A promise that resolves to an array of Coins.
|
45342
45420
|
*/
|
45343
45421
|
async getCoins(assetId) {
|
@@ -45390,7 +45468,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45390
45468
|
/**
|
45391
45469
|
* Retrieves the balance of the account for the given asset.
|
45392
45470
|
*
|
45393
|
-
* @param assetId - The asset ID to check the balance for.
|
45471
|
+
* @param assetId - The asset ID to check the balance for (optional).
|
45394
45472
|
* @returns A promise that resolves to the balance amount.
|
45395
45473
|
*/
|
45396
45474
|
async getBalance(assetId) {
|
@@ -45430,7 +45508,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45430
45508
|
* @typeParam T - The type of the TransactionRequest.
|
45431
45509
|
* @param request - The transaction request to fund.
|
45432
45510
|
* @param params - The estimated transaction parameters.
|
45433
|
-
* @returns
|
45511
|
+
* @returns A promise that resolves to the funded transaction request.
|
45434
45512
|
*/
|
45435
45513
|
async fund(request, params) {
|
45436
45514
|
const { addedSignatures, estimatedPredicates, requiredQuantities, updateMaxFee } = params;
|
@@ -45523,8 +45601,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45523
45601
|
*
|
45524
45602
|
* @param destination - The address of the destination.
|
45525
45603
|
* @param amount - The amount of coins to transfer.
|
45526
|
-
* @param assetId - The asset ID of the coins to transfer.
|
45527
|
-
* @param txParams - The transaction parameters (
|
45604
|
+
* @param assetId - The asset ID of the coins to transfer (optional).
|
45605
|
+
* @param txParams - The transaction parameters (optional).
|
45528
45606
|
* @returns A promise that resolves to the prepared transaction request.
|
45529
45607
|
*/
|
45530
45608
|
async createTransfer(destination, amount, assetId, txParams = {}) {
|
@@ -45538,8 +45616,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45538
45616
|
*
|
45539
45617
|
* @param destination - The address of the destination.
|
45540
45618
|
* @param amount - The amount of coins to transfer.
|
45541
|
-
* @param assetId - The asset ID of the coins to transfer.
|
45542
|
-
* @param txParams - The transaction parameters (
|
45619
|
+
* @param assetId - The asset ID of the coins to transfer (optional).
|
45620
|
+
* @param txParams - The transaction parameters (optional).
|
45543
45621
|
* @returns A promise that resolves to the transaction response.
|
45544
45622
|
*/
|
45545
45623
|
async transfer(destination, amount, assetId, txParams = {}) {
|
@@ -45599,8 +45677,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45599
45677
|
*
|
45600
45678
|
* @param contractId - The address of the contract.
|
45601
45679
|
* @param amount - The amount of coins to transfer.
|
45602
|
-
* @param assetId - The asset ID of the coins to transfer.
|
45603
|
-
* @param txParams - The
|
45680
|
+
* @param assetId - The asset ID of the coins to transfer (optional).
|
45681
|
+
* @param txParams - The transaction parameters (optional).
|
45604
45682
|
* @returns A promise that resolves to the transaction response.
|
45605
45683
|
*/
|
45606
45684
|
async transferToContract(contractId, amount, assetId, txParams = {}) {
|
@@ -45641,7 +45719,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45641
45719
|
*
|
45642
45720
|
* @param recipient - Address of the recipient on the base chain.
|
45643
45721
|
* @param amount - Amount of base asset.
|
45644
|
-
* @param txParams - The
|
45722
|
+
* @param txParams - The transaction parameters (optional).
|
45645
45723
|
* @returns A promise that resolves to the transaction response.
|
45646
45724
|
*/
|
45647
45725
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
@@ -45671,7 +45749,14 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45671
45749
|
await this.fund(request, txCost);
|
45672
45750
|
return this.sendTransaction(request);
|
45673
45751
|
}
|
45674
|
-
/**
|
45752
|
+
/**
|
45753
|
+
* Sign a message from the account via the connector.
|
45754
|
+
*
|
45755
|
+
* @param message - the message to sign.
|
45756
|
+
* @returns a promise that resolves to the signature.
|
45757
|
+
*
|
45758
|
+
* @hidden
|
45759
|
+
*/
|
45675
45760
|
async signMessage(message) {
|
45676
45761
|
if (!this._connector) {
|
45677
45762
|
throw new FuelError(ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
|
@@ -45679,7 +45764,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45679
45764
|
return this._connector.signMessage(this.address.toString(), message);
|
45680
45765
|
}
|
45681
45766
|
/**
|
45682
|
-
* Signs a transaction
|
45767
|
+
* Signs a transaction from the account via the connector..
|
45683
45768
|
*
|
45684
45769
|
* @param transactionRequestLike - The transaction request to sign.
|
45685
45770
|
* @returns A promise that resolves to the signature of the transaction.
|
@@ -45697,6 +45782,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45697
45782
|
* Sends a transaction to the network.
|
45698
45783
|
*
|
45699
45784
|
* @param transactionRequestLike - The transaction request to be sent.
|
45785
|
+
* @param sendTransactionParams - The provider send transaction parameters (optional).
|
45700
45786
|
* @returns A promise that resolves to the transaction response.
|
45701
45787
|
*/
|
45702
45788
|
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
|
@@ -45718,6 +45804,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
45718
45804
|
* Simulates a transaction.
|
45719
45805
|
*
|
45720
45806
|
* @param transactionRequestLike - The transaction request to be simulated.
|
45807
|
+
* @param estimateTxParams - The estimate transaction params (optional).
|
45721
45808
|
* @returns A promise that resolves to the call result.
|
45722
45809
|
*/
|
45723
45810
|
async simulateTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
@@ -47356,6 +47443,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47356
47443
|
* Populates the witness signature for a transaction and sends it to the network using `provider.sendTransaction`.
|
47357
47444
|
*
|
47358
47445
|
* @param transactionRequestLike - The transaction request to send.
|
47446
|
+
* @param estimateTxDependencies - Whether to estimate the transaction dependencies.
|
47447
|
+
* @param awaitExecution - Whether to wait for the transaction to be executed.
|
47359
47448
|
* @returns A promise that resolves to the TransactionResponse object.
|
47360
47449
|
*/
|
47361
47450
|
async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
|
@@ -47387,6 +47476,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47387
47476
|
}
|
47388
47477
|
);
|
47389
47478
|
}
|
47479
|
+
/**
|
47480
|
+
* Encrypts an unlocked wallet with a password.
|
47481
|
+
*
|
47482
|
+
* @param password - the password to encrypt the wallet with.
|
47483
|
+
* @returns - the encrypted wallet.
|
47484
|
+
*/
|
47390
47485
|
async encrypt(password) {
|
47391
47486
|
return encryptKeystoreWallet(this.privateKey, this.address, password);
|
47392
47487
|
}
|