@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
package/dist/index.global.js
CHANGED
@@ -39280,6 +39280,13 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
39280
39280
|
}
|
39281
39281
|
return this.outputs.length - 1;
|
39282
39282
|
}
|
39283
|
+
/**
|
39284
|
+
* Calculates the maximum gas for the transaction.
|
39285
|
+
*
|
39286
|
+
* @param chainInfo - The chain information.
|
39287
|
+
* @param minGas - The minimum gas.
|
39288
|
+
* @returns the maximum gas.
|
39289
|
+
*/
|
39283
39290
|
calculateMaxGas(chainInfo, minGas) {
|
39284
39291
|
const { consensusParameters } = chainInfo;
|
39285
39292
|
const {
|
@@ -40411,7 +40418,6 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
40411
40418
|
* Constructor to initialize a Provider.
|
40412
40419
|
*
|
40413
40420
|
* @param url - GraphQL endpoint of the Fuel node
|
40414
|
-
* @param chainInfo - Chain info of the Fuel node
|
40415
40421
|
* @param options - Additional options for the provider
|
40416
40422
|
* @hidden
|
40417
40423
|
*/
|
@@ -40434,10 +40440,14 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
40434
40440
|
this.operations = this.createOperations();
|
40435
40441
|
this.cache = options.cacheUtxo ? new MemoryCache(options.cacheUtxo) : void 0;
|
40436
40442
|
}
|
40443
|
+
/** @hidden */
|
40437
40444
|
static clearChainAndNodeCaches() {
|
40438
40445
|
_Provider.nodeInfoCache = {};
|
40439
40446
|
_Provider.chainInfoCache = {};
|
40440
40447
|
}
|
40448
|
+
/**
|
40449
|
+
* @hidden
|
40450
|
+
*/
|
40441
40451
|
static getFetchFn(options) {
|
40442
40452
|
const { retryOptions, timeout } = options;
|
40443
40453
|
return autoRetryFetch(async (...args) => {
|
@@ -40453,8 +40463,11 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
40453
40463
|
}
|
40454
40464
|
/**
|
40455
40465
|
* Creates a new instance of the Provider class. This is the recommended way to initialize a Provider.
|
40466
|
+
*
|
40456
40467
|
* @param url - GraphQL endpoint of the Fuel node
|
40457
40468
|
* @param options - Additional options for the provider
|
40469
|
+
*
|
40470
|
+
* @returns A promise that resolves to a Provider instance.
|
40458
40471
|
*/
|
40459
40472
|
static async create(url, options = {}) {
|
40460
40473
|
const provider = new _Provider(url, options);
|
@@ -40463,6 +40476,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
40463
40476
|
}
|
40464
40477
|
/**
|
40465
40478
|
* Returns the cached chainInfo for the current URL.
|
40479
|
+
*
|
40480
|
+
* @returns the chain information configuration.
|
40466
40481
|
*/
|
40467
40482
|
getChain() {
|
40468
40483
|
const chain = _Provider.chainInfoCache[this.url];
|
@@ -40476,6 +40491,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
40476
40491
|
}
|
40477
40492
|
/**
|
40478
40493
|
* Returns the cached nodeInfo for the current URL.
|
40494
|
+
*
|
40495
|
+
* @returns the node information configuration.
|
40479
40496
|
*/
|
40480
40497
|
getNode() {
|
40481
40498
|
const node = _Provider.nodeInfoCache[this.url];
|
@@ -40507,6 +40524,9 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
40507
40524
|
}
|
40508
40525
|
/**
|
40509
40526
|
* Updates the URL for the provider and fetches the consensus parameters for the new URL, if needed.
|
40527
|
+
*
|
40528
|
+
* @param url - The URL to connect to.
|
40529
|
+
* @param options - Additional options for the provider.
|
40510
40530
|
*/
|
40511
40531
|
async connect(url, options) {
|
40512
40532
|
this.url = url;
|
@@ -40515,9 +40535,9 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
40515
40535
|
await this.fetchChainAndNodeInfo();
|
40516
40536
|
}
|
40517
40537
|
/**
|
40518
|
-
*
|
40538
|
+
* Return the chain and node information.
|
40519
40539
|
*
|
40520
|
-
* @returns
|
40540
|
+
* @returns A promise that resolves to the Chain and NodeInfo.
|
40521
40541
|
*/
|
40522
40542
|
async fetchChainAndNodeInfo() {
|
40523
40543
|
const chain = await this.fetchChain();
|
@@ -40528,6 +40548,9 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
40528
40548
|
nodeInfo
|
40529
40549
|
};
|
40530
40550
|
}
|
40551
|
+
/**
|
40552
|
+
* @hidden
|
40553
|
+
*/
|
40531
40554
|
static ensureClientVersionIsSupported(nodeInfo) {
|
40532
40555
|
const { isMajorSupported, isMinorSupported, supportedVersion } = checkFuelCoreVersionCompatibility(nodeInfo.nodeVersion);
|
40533
40556
|
if (!isMajorSupported || !isMinorSupported) {
|
@@ -40543,6 +40566,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
40543
40566
|
* Create GraphQL client and set operations.
|
40544
40567
|
*
|
40545
40568
|
* @returns The operation SDK object
|
40569
|
+
* @hidden
|
40546
40570
|
*/
|
40547
40571
|
createOperations() {
|
40548
40572
|
const fetchFn = _Provider.getFetchFn(this.options);
|
@@ -40587,18 +40611,18 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
40587
40611
|
return nodeVersion;
|
40588
40612
|
}
|
40589
40613
|
/**
|
40590
|
-
* Returns the block number.
|
40614
|
+
* Returns the latest block number.
|
40591
40615
|
*
|
40592
|
-
* @returns A promise that resolves to the block number
|
40616
|
+
* @returns A promise that resolves to the latest block number.
|
40593
40617
|
*/
|
40594
40618
|
async getBlockNumber() {
|
40595
40619
|
const { chain } = await this.operations.getChain();
|
40596
40620
|
return bn(chain.latestBlock.height, 10);
|
40597
40621
|
}
|
40598
40622
|
/**
|
40599
|
-
* Returns the
|
40600
|
-
*
|
40601
|
-
* @returns
|
40623
|
+
* Returns the node information for the current provider network.
|
40624
|
+
*
|
40625
|
+
* @returns a promise that resolves to the node information.
|
40602
40626
|
*/
|
40603
40627
|
async fetchNode() {
|
40604
40628
|
const { nodeInfo } = await this.operations.getNodeInfo();
|
@@ -40613,9 +40637,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
40613
40637
|
return processedNodeInfo;
|
40614
40638
|
}
|
40615
40639
|
/**
|
40616
|
-
*
|
40617
|
-
*
|
40618
|
-
* @returns
|
40640
|
+
* Returns the chain information for the current provider network.
|
40641
|
+
*
|
40642
|
+
* @returns a promise that resolves to the chain information.
|
40619
40643
|
*/
|
40620
40644
|
async fetchChain() {
|
40621
40645
|
const { chain } = await this.operations.getChain();
|
@@ -40624,8 +40648,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
40624
40648
|
return processedChain;
|
40625
40649
|
}
|
40626
40650
|
/**
|
40627
|
-
* Returns the chain ID
|
40628
|
-
*
|
40651
|
+
* Returns the chain ID for the current provider network.
|
40652
|
+
*
|
40653
|
+
* @returns A promise that resolves to the chain ID number.
|
40629
40654
|
*/
|
40630
40655
|
getChainId() {
|
40631
40656
|
const {
|
@@ -40634,9 +40659,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
40634
40659
|
return chainId.toNumber();
|
40635
40660
|
}
|
40636
40661
|
/**
|
40637
|
-
* Returns the base asset ID for the current provider network
|
40662
|
+
* Returns the base asset ID for the current provider network.
|
40638
40663
|
*
|
40639
|
-
* @returns the base asset ID
|
40664
|
+
* @returns the base asset ID.
|
40640
40665
|
*/
|
40641
40666
|
getBaseAssetId() {
|
40642
40667
|
const {
|
@@ -40651,6 +40676,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
40651
40676
|
* the transaction will be mutated and those dependencies will be added.
|
40652
40677
|
*
|
40653
40678
|
* @param transactionRequestLike - The transaction request object.
|
40679
|
+
* @param sendTransactionParams - The provider send transaction parameters (optional).
|
40654
40680
|
* @returns A promise that resolves to the transaction response object.
|
40655
40681
|
*/
|
40656
40682
|
// #region Provider-sendTransaction
|
@@ -40695,7 +40721,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
40695
40721
|
* the transaction will be mutated and those dependencies will be added.
|
40696
40722
|
*
|
40697
40723
|
* @param transactionRequestLike - The transaction request object.
|
40698
|
-
* @param
|
40724
|
+
* @param sendTransactionParams - The provider call parameters (optional).
|
40699
40725
|
* @returns A promise that resolves to the call result object.
|
40700
40726
|
*/
|
40701
40727
|
async call(transactionRequestLike, { utxoValidation, estimateTxDependencies = true } = {}) {
|
@@ -40715,6 +40741,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
40715
40741
|
/**
|
40716
40742
|
* Verifies whether enough gas is available to complete transaction.
|
40717
40743
|
*
|
40744
|
+
* @template T - The type of the transaction request object.
|
40745
|
+
*
|
40718
40746
|
* @param transactionRequest - The transaction request object.
|
40719
40747
|
* @returns A promise that resolves to the estimated transaction request object.
|
40720
40748
|
*/
|
@@ -40749,9 +40777,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
40749
40777
|
* If there are missing variable outputs,
|
40750
40778
|
* `addVariableOutputs` is called on the transaction.
|
40751
40779
|
*
|
40752
|
-
*
|
40753
40780
|
* @param transactionRequest - The transaction request object.
|
40754
|
-
* @returns A promise.
|
40781
|
+
* @returns A promise that resolves to the estimate transaction dependencies.
|
40755
40782
|
*/
|
40756
40783
|
async estimateTxDependencies(transactionRequest) {
|
40757
40784
|
if (transactionRequest.type === TransactionType.Create) {
|
@@ -40864,6 +40891,14 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
40864
40891
|
}
|
40865
40892
|
return results;
|
40866
40893
|
}
|
40894
|
+
/**
|
40895
|
+
* Dry runs multiple transactions.
|
40896
|
+
*
|
40897
|
+
* @param transactionRequests - Array of transaction request objects.
|
40898
|
+
* @param sendTransactionParams - The provider call parameters (optional).
|
40899
|
+
*
|
40900
|
+
* @returns A promise that resolves to an array of results for each transaction call.
|
40901
|
+
*/
|
40867
40902
|
async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
|
40868
40903
|
if (estimateTxDependencies) {
|
40869
40904
|
return this.estimateMultipleTxDependencies(transactionRequests);
|
@@ -40934,6 +40969,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
40934
40969
|
* the transaction will be mutated and those dependencies will be added
|
40935
40970
|
*
|
40936
40971
|
* @param transactionRequestLike - The transaction request object.
|
40972
|
+
* @param estimateTxParams - The estimate transaction params (optional).
|
40937
40973
|
* @returns A promise that resolves to the call result object.
|
40938
40974
|
*/
|
40939
40975
|
async simulate(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
@@ -40958,14 +40994,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
40958
40994
|
* to set gasLimit and also reserve balance amounts
|
40959
40995
|
* on the the transaction.
|
40960
40996
|
*
|
40961
|
-
* @privateRemarks
|
40962
|
-
* The tolerance is add on top of the gasUsed calculated
|
40963
|
-
* from the node, this create a safe margin costs like
|
40964
|
-
* change states on transfer that don't occur on the dryRun
|
40965
|
-
* transaction. The default value is 0.2 or 20%
|
40966
|
-
*
|
40967
40997
|
* @param transactionRequestLike - The transaction request object.
|
40968
|
-
* @param
|
40998
|
+
* @param transactionCostParams - The transaction cost parameters (optional).
|
40999
|
+
*
|
40969
41000
|
* @returns A promise that resolves to the transaction cost object.
|
40970
41001
|
*/
|
40971
41002
|
async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
|
@@ -41033,6 +41064,15 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41033
41064
|
updateMaxFee
|
41034
41065
|
};
|
41035
41066
|
}
|
41067
|
+
/**
|
41068
|
+
* Get the required quantities and associated resources for a transaction.
|
41069
|
+
*
|
41070
|
+
* @param owner - address to add resources from.
|
41071
|
+
* @param transactionRequestLike - transaction request to populate resources for.
|
41072
|
+
* @param quantitiesToContract - quantities for the contract (optional).
|
41073
|
+
*
|
41074
|
+
* @returns a promise resolving to the required quantities for the transaction.
|
41075
|
+
*/
|
41036
41076
|
async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
|
41037
41077
|
const ownerAddress = Address.fromAddressOrString(owner);
|
41038
41078
|
const transactionRequest = transactionRequestify(clone_default(transactionRequestLike));
|
@@ -41054,6 +41094,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41054
41094
|
}
|
41055
41095
|
/**
|
41056
41096
|
* Returns coins for the given owner.
|
41097
|
+
*
|
41098
|
+
* @param owner - The address to get coins for.
|
41099
|
+
* @param assetId - The asset ID of coins to get (optional).
|
41100
|
+
* @param paginationArgs - Pagination arguments (optional).
|
41101
|
+
*
|
41102
|
+
* @returns A promise that resolves to the coins.
|
41057
41103
|
*/
|
41058
41104
|
async getCoins(owner, assetId, paginationArgs) {
|
41059
41105
|
const ownerAddress = Address.fromAddressOrString(owner);
|
@@ -41076,8 +41122,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41076
41122
|
* Returns resources for the given owner satisfying the spend query.
|
41077
41123
|
*
|
41078
41124
|
* @param owner - The address to get resources for.
|
41079
|
-
* @param quantities - The quantities to get.
|
41080
|
-
* @param excludedIds - IDs of excluded resources from the selection.
|
41125
|
+
* @param quantities - The coin quantities to get.
|
41126
|
+
* @param excludedIds - IDs of excluded resources from the selection (optional).
|
41081
41127
|
* @returns A promise that resolves to the resources.
|
41082
41128
|
*/
|
41083
41129
|
async getResourcesToSpend(owner, quantities, excludedIds) {
|
@@ -41132,7 +41178,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41132
41178
|
* Returns block matching the given ID or height.
|
41133
41179
|
*
|
41134
41180
|
* @param idOrHeight - ID or height of the block.
|
41135
|
-
* @returns A promise that resolves to the block.
|
41181
|
+
* @returns A promise that resolves to the block or null.
|
41136
41182
|
*/
|
41137
41183
|
async getBlock(idOrHeight) {
|
41138
41184
|
let variables;
|
@@ -41262,7 +41308,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41262
41308
|
* Returns balances for the given owner.
|
41263
41309
|
*
|
41264
41310
|
* @param owner - The address to get coins for.
|
41265
|
-
* @param paginationArgs - Pagination arguments.
|
41311
|
+
* @param paginationArgs - Pagination arguments (optional).
|
41266
41312
|
* @returns A promise that resolves to the balances.
|
41267
41313
|
*/
|
41268
41314
|
async getBalances(owner, paginationArgs) {
|
@@ -41281,7 +41327,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41281
41327
|
* Returns message for the given address.
|
41282
41328
|
*
|
41283
41329
|
* @param address - The address to get message from.
|
41284
|
-
* @param paginationArgs - Pagination arguments.
|
41330
|
+
* @param paginationArgs - Pagination arguments (optional).
|
41285
41331
|
* @returns A promise that resolves to the messages.
|
41286
41332
|
*/
|
41287
41333
|
async getMessages(address, paginationArgs) {
|
@@ -41312,8 +41358,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41312
41358
|
*
|
41313
41359
|
* @param transactionId - The transaction to get message from.
|
41314
41360
|
* @param messageId - The message id from MessageOut receipt.
|
41315
|
-
* @param commitBlockId - The commit block id.
|
41316
|
-
* @param commitBlockHeight - The commit block height.
|
41361
|
+
* @param commitBlockId - The commit block id (optional).
|
41362
|
+
* @param commitBlockHeight - The commit block height (optional).
|
41317
41363
|
* @returns A promise that resolves to the message proof.
|
41318
41364
|
*/
|
41319
41365
|
async getMessageProof(transactionId, nonce, commitBlockId, commitBlockHeight) {
|
@@ -41401,10 +41447,21 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41401
41447
|
data
|
41402
41448
|
};
|
41403
41449
|
}
|
41450
|
+
/**
|
41451
|
+
* Get the latest gas price from the node.
|
41452
|
+
*
|
41453
|
+
* @returns A promise that resolves to the latest gas price.
|
41454
|
+
*/
|
41404
41455
|
async getLatestGasPrice() {
|
41405
41456
|
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
41406
41457
|
return bn(latestGasPrice.gasPrice);
|
41407
41458
|
}
|
41459
|
+
/**
|
41460
|
+
* Returns the estimate gas price for the given block horizon.
|
41461
|
+
*
|
41462
|
+
* @param blockHorizon - The block horizon to estimate gas price for.
|
41463
|
+
* @returns A promise that resolves to the estimated gas price.
|
41464
|
+
*/
|
41408
41465
|
async estimateGasPrice(blockHorizon) {
|
41409
41466
|
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
41410
41467
|
blockHorizon: String(blockHorizon)
|
@@ -41424,8 +41481,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41424
41481
|
/**
|
41425
41482
|
* Lets you produce blocks with custom timestamps and the block number of the last block produced.
|
41426
41483
|
*
|
41427
|
-
* @param amount - The amount of blocks to produce
|
41428
|
-
* @param startTime - The UNIX timestamp (milliseconds) to set for the first produced block
|
41484
|
+
* @param amount - The amount of blocks to produce.
|
41485
|
+
* @param startTime - The UNIX timestamp (milliseconds) to set for the first produced block (optional).
|
41429
41486
|
* @returns A promise that resolves to the block number of the last produced block.
|
41430
41487
|
*/
|
41431
41488
|
async produceBlocks(amount, startTime) {
|
@@ -41435,6 +41492,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41435
41492
|
});
|
41436
41493
|
return bn(latestBlockHeight);
|
41437
41494
|
}
|
41495
|
+
/**
|
41496
|
+
* Get the transaction response for the given transaction ID.
|
41497
|
+
*
|
41498
|
+
* @param transactionId - The transaction ID to get the response for.
|
41499
|
+
* @returns A promise that resolves to the transaction response.
|
41500
|
+
*/
|
41438
41501
|
// eslint-disable-next-line @typescript-eslint/require-await
|
41439
41502
|
async getTransactionResponse(transactionId) {
|
41440
41503
|
return new TransactionResponse(transactionId, this);
|
@@ -41443,7 +41506,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41443
41506
|
* Returns Message for given nonce.
|
41444
41507
|
*
|
41445
41508
|
* @param nonce - The nonce of the message to retrieve.
|
41446
|
-
* @returns A promise that resolves to the Message object.
|
41509
|
+
* @returns A promise that resolves to the Message object or null.
|
41447
41510
|
*/
|
41448
41511
|
async getMessageByNonce(nonce) {
|
41449
41512
|
const { message } = await this.operations.getMessageByNonce({ nonce });
|
@@ -41452,6 +41515,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41452
41515
|
}
|
41453
41516
|
return message;
|
41454
41517
|
}
|
41518
|
+
/**
|
41519
|
+
* Get the relayed transaction for the given transaction ID.
|
41520
|
+
*
|
41521
|
+
* @param relayedTransactionId - The relayed transaction ID to get the response for.
|
41522
|
+
* @returns A promise that resolves to the relayed transaction.
|
41523
|
+
*/
|
41455
41524
|
async getRelayedTransactionStatus(relayedTransactionId) {
|
41456
41525
|
const { relayedTransactionStatus } = await this.operations.getRelayedTransactionStatus({
|
41457
41526
|
relayedTransactionId
|
@@ -41461,6 +41530,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41461
41530
|
}
|
41462
41531
|
return relayedTransactionStatus;
|
41463
41532
|
}
|
41533
|
+
/**
|
41534
|
+
* @hidden
|
41535
|
+
*/
|
41464
41536
|
extractDryRunError(transactionRequest, receipts, dryRunStatus) {
|
41465
41537
|
const status = dryRunStatus;
|
41466
41538
|
let logs = [];
|
@@ -41490,7 +41562,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41490
41562
|
}
|
41491
41563
|
});
|
41492
41564
|
};
|
41565
|
+
/** @hidden */
|
41493
41566
|
__publicField(Provider, "chainInfoCache", {});
|
41567
|
+
/** @hidden */
|
41494
41568
|
__publicField(Provider, "nodeInfoCache", {});
|
41495
41569
|
|
41496
41570
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
@@ -41779,12 +41853,16 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41779
41853
|
* The provider used to interact with the network.
|
41780
41854
|
*/
|
41781
41855
|
_provider;
|
41856
|
+
/**
|
41857
|
+
* The connector for use with external wallets
|
41858
|
+
*/
|
41782
41859
|
_connector;
|
41783
41860
|
/**
|
41784
41861
|
* Creates a new Account instance.
|
41785
41862
|
*
|
41786
41863
|
* @param address - The address of the account.
|
41787
41864
|
* @param provider - A Provider instance (optional).
|
41865
|
+
* @param connector - A FuelConnector instance (optional).
|
41788
41866
|
*/
|
41789
41867
|
constructor(address, provider, connector) {
|
41790
41868
|
super();
|
@@ -41826,8 +41904,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41826
41904
|
/**
|
41827
41905
|
* Retrieves resources satisfying the spend query for the account.
|
41828
41906
|
*
|
41829
|
-
* @param quantities -
|
41830
|
-
* @param excludedIds - IDs of resources to be excluded from the query.
|
41907
|
+
* @param quantities - Quantities of resources to be obtained.
|
41908
|
+
* @param excludedIds - IDs of resources to be excluded from the query (optional).
|
41831
41909
|
* @returns A promise that resolves to an array of Resources.
|
41832
41910
|
*/
|
41833
41911
|
async getResourcesToSpend(quantities, excludedIds) {
|
@@ -41836,7 +41914,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41836
41914
|
/**
|
41837
41915
|
* Retrieves coins owned by the account.
|
41838
41916
|
*
|
41839
|
-
* @param assetId - The asset ID of the coins to retrieve.
|
41917
|
+
* @param assetId - The asset ID of the coins to retrieve (optional).
|
41840
41918
|
* @returns A promise that resolves to an array of Coins.
|
41841
41919
|
*/
|
41842
41920
|
async getCoins(assetId) {
|
@@ -41889,7 +41967,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41889
41967
|
/**
|
41890
41968
|
* Retrieves the balance of the account for the given asset.
|
41891
41969
|
*
|
41892
|
-
* @param assetId - The asset ID to check the balance for.
|
41970
|
+
* @param assetId - The asset ID to check the balance for (optional).
|
41893
41971
|
* @returns A promise that resolves to the balance amount.
|
41894
41972
|
*/
|
41895
41973
|
async getBalance(assetId) {
|
@@ -41929,7 +42007,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41929
42007
|
* @typeParam T - The type of the TransactionRequest.
|
41930
42008
|
* @param request - The transaction request to fund.
|
41931
42009
|
* @param params - The estimated transaction parameters.
|
41932
|
-
* @returns
|
42010
|
+
* @returns A promise that resolves to the funded transaction request.
|
41933
42011
|
*/
|
41934
42012
|
async fund(request, params) {
|
41935
42013
|
const { addedSignatures, estimatedPredicates, requiredQuantities, updateMaxFee } = params;
|
@@ -42022,8 +42100,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42022
42100
|
*
|
42023
42101
|
* @param destination - The address of the destination.
|
42024
42102
|
* @param amount - The amount of coins to transfer.
|
42025
|
-
* @param assetId - The asset ID of the coins to transfer.
|
42026
|
-
* @param txParams - The transaction parameters (
|
42103
|
+
* @param assetId - The asset ID of the coins to transfer (optional).
|
42104
|
+
* @param txParams - The transaction parameters (optional).
|
42027
42105
|
* @returns A promise that resolves to the prepared transaction request.
|
42028
42106
|
*/
|
42029
42107
|
async createTransfer(destination, amount, assetId, txParams = {}) {
|
@@ -42037,8 +42115,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42037
42115
|
*
|
42038
42116
|
* @param destination - The address of the destination.
|
42039
42117
|
* @param amount - The amount of coins to transfer.
|
42040
|
-
* @param assetId - The asset ID of the coins to transfer.
|
42041
|
-
* @param txParams - The transaction parameters (
|
42118
|
+
* @param assetId - The asset ID of the coins to transfer (optional).
|
42119
|
+
* @param txParams - The transaction parameters (optional).
|
42042
42120
|
* @returns A promise that resolves to the transaction response.
|
42043
42121
|
*/
|
42044
42122
|
async transfer(destination, amount, assetId, txParams = {}) {
|
@@ -42098,8 +42176,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42098
42176
|
*
|
42099
42177
|
* @param contractId - The address of the contract.
|
42100
42178
|
* @param amount - The amount of coins to transfer.
|
42101
|
-
* @param assetId - The asset ID of the coins to transfer.
|
42102
|
-
* @param txParams - The
|
42179
|
+
* @param assetId - The asset ID of the coins to transfer (optional).
|
42180
|
+
* @param txParams - The transaction parameters (optional).
|
42103
42181
|
* @returns A promise that resolves to the transaction response.
|
42104
42182
|
*/
|
42105
42183
|
async transferToContract(contractId, amount, assetId, txParams = {}) {
|
@@ -42140,7 +42218,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42140
42218
|
*
|
42141
42219
|
* @param recipient - Address of the recipient on the base chain.
|
42142
42220
|
* @param amount - Amount of base asset.
|
42143
|
-
* @param txParams - The
|
42221
|
+
* @param txParams - The transaction parameters (optional).
|
42144
42222
|
* @returns A promise that resolves to the transaction response.
|
42145
42223
|
*/
|
42146
42224
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
@@ -42170,7 +42248,14 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42170
42248
|
await this.fund(request, txCost);
|
42171
42249
|
return this.sendTransaction(request);
|
42172
42250
|
}
|
42173
|
-
/**
|
42251
|
+
/**
|
42252
|
+
* Sign a message from the account via the connector.
|
42253
|
+
*
|
42254
|
+
* @param message - the message to sign.
|
42255
|
+
* @returns a promise that resolves to the signature.
|
42256
|
+
*
|
42257
|
+
* @hidden
|
42258
|
+
*/
|
42174
42259
|
async signMessage(message) {
|
42175
42260
|
if (!this._connector) {
|
42176
42261
|
throw new FuelError(ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
|
@@ -42178,7 +42263,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42178
42263
|
return this._connector.signMessage(this.address.toString(), message);
|
42179
42264
|
}
|
42180
42265
|
/**
|
42181
|
-
* Signs a transaction
|
42266
|
+
* Signs a transaction from the account via the connector..
|
42182
42267
|
*
|
42183
42268
|
* @param transactionRequestLike - The transaction request to sign.
|
42184
42269
|
* @returns A promise that resolves to the signature of the transaction.
|
@@ -42196,6 +42281,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42196
42281
|
* Sends a transaction to the network.
|
42197
42282
|
*
|
42198
42283
|
* @param transactionRequestLike - The transaction request to be sent.
|
42284
|
+
* @param sendTransactionParams - The provider send transaction parameters (optional).
|
42199
42285
|
* @returns A promise that resolves to the transaction response.
|
42200
42286
|
*/
|
42201
42287
|
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
|
@@ -42217,6 +42303,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42217
42303
|
* Simulates a transaction.
|
42218
42304
|
*
|
42219
42305
|
* @param transactionRequestLike - The transaction request to be simulated.
|
42306
|
+
* @param estimateTxParams - The estimate transaction params (optional).
|
42220
42307
|
* @returns A promise that resolves to the call result.
|
42221
42308
|
*/
|
42222
42309
|
async simulateTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
@@ -43855,6 +43942,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43855
43942
|
* Populates the witness signature for a transaction and sends it to the network using `provider.sendTransaction`.
|
43856
43943
|
*
|
43857
43944
|
* @param transactionRequestLike - The transaction request to send.
|
43945
|
+
* @param estimateTxDependencies - Whether to estimate the transaction dependencies.
|
43946
|
+
* @param awaitExecution - Whether to wait for the transaction to be executed.
|
43858
43947
|
* @returns A promise that resolves to the TransactionResponse object.
|
43859
43948
|
*/
|
43860
43949
|
async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
|
@@ -43886,6 +43975,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43886
43975
|
}
|
43887
43976
|
);
|
43888
43977
|
}
|
43978
|
+
/**
|
43979
|
+
* Encrypts an unlocked wallet with a password.
|
43980
|
+
*
|
43981
|
+
* @param password - the password to encrypt the wallet with.
|
43982
|
+
* @returns - the encrypted wallet.
|
43983
|
+
*/
|
43889
43984
|
async encrypt(password) {
|
43890
43985
|
return encryptKeystoreWallet(this.privateKey, this.address, password);
|
43891
43986
|
}
|