@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/test-utils.js
CHANGED
@@ -2620,6 +2620,13 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2620
2620
|
}
|
2621
2621
|
return this.outputs.length - 1;
|
2622
2622
|
}
|
2623
|
+
/**
|
2624
|
+
* Calculates the maximum gas for the transaction.
|
2625
|
+
*
|
2626
|
+
* @param chainInfo - The chain information.
|
2627
|
+
* @param minGas - The minimum gas.
|
2628
|
+
* @returns the maximum gas.
|
2629
|
+
*/
|
2623
2630
|
calculateMaxGas(chainInfo, minGas) {
|
2624
2631
|
const { consensusParameters } = chainInfo;
|
2625
2632
|
const {
|
@@ -3734,7 +3741,6 @@ var _Provider = class {
|
|
3734
3741
|
* Constructor to initialize a Provider.
|
3735
3742
|
*
|
3736
3743
|
* @param url - GraphQL endpoint of the Fuel node
|
3737
|
-
* @param chainInfo - Chain info of the Fuel node
|
3738
3744
|
* @param options - Additional options for the provider
|
3739
3745
|
* @hidden
|
3740
3746
|
*/
|
@@ -3757,10 +3763,14 @@ var _Provider = class {
|
|
3757
3763
|
this.operations = this.createOperations();
|
3758
3764
|
this.cache = options.cacheUtxo ? new MemoryCache(options.cacheUtxo) : void 0;
|
3759
3765
|
}
|
3766
|
+
/** @hidden */
|
3760
3767
|
static clearChainAndNodeCaches() {
|
3761
3768
|
_Provider.nodeInfoCache = {};
|
3762
3769
|
_Provider.chainInfoCache = {};
|
3763
3770
|
}
|
3771
|
+
/**
|
3772
|
+
* @hidden
|
3773
|
+
*/
|
3764
3774
|
static getFetchFn(options) {
|
3765
3775
|
const { retryOptions, timeout } = options;
|
3766
3776
|
return autoRetryFetch(async (...args) => {
|
@@ -3776,8 +3786,11 @@ var _Provider = class {
|
|
3776
3786
|
}
|
3777
3787
|
/**
|
3778
3788
|
* Creates a new instance of the Provider class. This is the recommended way to initialize a Provider.
|
3789
|
+
*
|
3779
3790
|
* @param url - GraphQL endpoint of the Fuel node
|
3780
3791
|
* @param options - Additional options for the provider
|
3792
|
+
*
|
3793
|
+
* @returns A promise that resolves to a Provider instance.
|
3781
3794
|
*/
|
3782
3795
|
static async create(url, options = {}) {
|
3783
3796
|
const provider = new _Provider(url, options);
|
@@ -3786,6 +3799,8 @@ var _Provider = class {
|
|
3786
3799
|
}
|
3787
3800
|
/**
|
3788
3801
|
* Returns the cached chainInfo for the current URL.
|
3802
|
+
*
|
3803
|
+
* @returns the chain information configuration.
|
3789
3804
|
*/
|
3790
3805
|
getChain() {
|
3791
3806
|
const chain = _Provider.chainInfoCache[this.url];
|
@@ -3799,6 +3814,8 @@ var _Provider = class {
|
|
3799
3814
|
}
|
3800
3815
|
/**
|
3801
3816
|
* Returns the cached nodeInfo for the current URL.
|
3817
|
+
*
|
3818
|
+
* @returns the node information configuration.
|
3802
3819
|
*/
|
3803
3820
|
getNode() {
|
3804
3821
|
const node = _Provider.nodeInfoCache[this.url];
|
@@ -3830,6 +3847,9 @@ var _Provider = class {
|
|
3830
3847
|
}
|
3831
3848
|
/**
|
3832
3849
|
* Updates the URL for the provider and fetches the consensus parameters for the new URL, if needed.
|
3850
|
+
*
|
3851
|
+
* @param url - The URL to connect to.
|
3852
|
+
* @param options - Additional options for the provider.
|
3833
3853
|
*/
|
3834
3854
|
async connect(url, options) {
|
3835
3855
|
this.url = url;
|
@@ -3838,9 +3858,9 @@ var _Provider = class {
|
|
3838
3858
|
await this.fetchChainAndNodeInfo();
|
3839
3859
|
}
|
3840
3860
|
/**
|
3841
|
-
*
|
3861
|
+
* Return the chain and node information.
|
3842
3862
|
*
|
3843
|
-
* @returns
|
3863
|
+
* @returns A promise that resolves to the Chain and NodeInfo.
|
3844
3864
|
*/
|
3845
3865
|
async fetchChainAndNodeInfo() {
|
3846
3866
|
const chain = await this.fetchChain();
|
@@ -3851,6 +3871,9 @@ var _Provider = class {
|
|
3851
3871
|
nodeInfo
|
3852
3872
|
};
|
3853
3873
|
}
|
3874
|
+
/**
|
3875
|
+
* @hidden
|
3876
|
+
*/
|
3854
3877
|
static ensureClientVersionIsSupported(nodeInfo) {
|
3855
3878
|
const { isMajorSupported, isMinorSupported, supportedVersion } = (0, import_versions.checkFuelCoreVersionCompatibility)(nodeInfo.nodeVersion);
|
3856
3879
|
if (!isMajorSupported || !isMinorSupported) {
|
@@ -3866,6 +3889,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3866
3889
|
* Create GraphQL client and set operations.
|
3867
3890
|
*
|
3868
3891
|
* @returns The operation SDK object
|
3892
|
+
* @hidden
|
3869
3893
|
*/
|
3870
3894
|
createOperations() {
|
3871
3895
|
const fetchFn = _Provider.getFetchFn(this.options);
|
@@ -3910,18 +3934,18 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3910
3934
|
return nodeVersion;
|
3911
3935
|
}
|
3912
3936
|
/**
|
3913
|
-
* Returns the block number.
|
3937
|
+
* Returns the latest block number.
|
3914
3938
|
*
|
3915
|
-
* @returns A promise that resolves to the block number
|
3939
|
+
* @returns A promise that resolves to the latest block number.
|
3916
3940
|
*/
|
3917
3941
|
async getBlockNumber() {
|
3918
3942
|
const { chain } = await this.operations.getChain();
|
3919
3943
|
return (0, import_math17.bn)(chain.latestBlock.height, 10);
|
3920
3944
|
}
|
3921
3945
|
/**
|
3922
|
-
* Returns the
|
3923
|
-
*
|
3924
|
-
* @returns
|
3946
|
+
* Returns the node information for the current provider network.
|
3947
|
+
*
|
3948
|
+
* @returns a promise that resolves to the node information.
|
3925
3949
|
*/
|
3926
3950
|
async fetchNode() {
|
3927
3951
|
const { nodeInfo } = await this.operations.getNodeInfo();
|
@@ -3936,9 +3960,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3936
3960
|
return processedNodeInfo;
|
3937
3961
|
}
|
3938
3962
|
/**
|
3939
|
-
*
|
3940
|
-
*
|
3941
|
-
* @returns
|
3963
|
+
* Returns the chain information for the current provider network.
|
3964
|
+
*
|
3965
|
+
* @returns a promise that resolves to the chain information.
|
3942
3966
|
*/
|
3943
3967
|
async fetchChain() {
|
3944
3968
|
const { chain } = await this.operations.getChain();
|
@@ -3947,8 +3971,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3947
3971
|
return processedChain;
|
3948
3972
|
}
|
3949
3973
|
/**
|
3950
|
-
* Returns the chain ID
|
3951
|
-
*
|
3974
|
+
* Returns the chain ID for the current provider network.
|
3975
|
+
*
|
3976
|
+
* @returns A promise that resolves to the chain ID number.
|
3952
3977
|
*/
|
3953
3978
|
getChainId() {
|
3954
3979
|
const {
|
@@ -3957,9 +3982,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3957
3982
|
return chainId.toNumber();
|
3958
3983
|
}
|
3959
3984
|
/**
|
3960
|
-
* Returns the base asset ID for the current provider network
|
3985
|
+
* Returns the base asset ID for the current provider network.
|
3961
3986
|
*
|
3962
|
-
* @returns the base asset ID
|
3987
|
+
* @returns the base asset ID.
|
3963
3988
|
*/
|
3964
3989
|
getBaseAssetId() {
|
3965
3990
|
const {
|
@@ -3974,6 +3999,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3974
3999
|
* the transaction will be mutated and those dependencies will be added.
|
3975
4000
|
*
|
3976
4001
|
* @param transactionRequestLike - The transaction request object.
|
4002
|
+
* @param sendTransactionParams - The provider send transaction parameters (optional).
|
3977
4003
|
* @returns A promise that resolves to the transaction response object.
|
3978
4004
|
*/
|
3979
4005
|
// #region Provider-sendTransaction
|
@@ -4018,7 +4044,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4018
4044
|
* the transaction will be mutated and those dependencies will be added.
|
4019
4045
|
*
|
4020
4046
|
* @param transactionRequestLike - The transaction request object.
|
4021
|
-
* @param
|
4047
|
+
* @param sendTransactionParams - The provider call parameters (optional).
|
4022
4048
|
* @returns A promise that resolves to the call result object.
|
4023
4049
|
*/
|
4024
4050
|
async call(transactionRequestLike, { utxoValidation, estimateTxDependencies = true } = {}) {
|
@@ -4038,6 +4064,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4038
4064
|
/**
|
4039
4065
|
* Verifies whether enough gas is available to complete transaction.
|
4040
4066
|
*
|
4067
|
+
* @template T - The type of the transaction request object.
|
4068
|
+
*
|
4041
4069
|
* @param transactionRequest - The transaction request object.
|
4042
4070
|
* @returns A promise that resolves to the estimated transaction request object.
|
4043
4071
|
*/
|
@@ -4072,9 +4100,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4072
4100
|
* If there are missing variable outputs,
|
4073
4101
|
* `addVariableOutputs` is called on the transaction.
|
4074
4102
|
*
|
4075
|
-
*
|
4076
4103
|
* @param transactionRequest - The transaction request object.
|
4077
|
-
* @returns A promise.
|
4104
|
+
* @returns A promise that resolves to the estimate transaction dependencies.
|
4078
4105
|
*/
|
4079
4106
|
async estimateTxDependencies(transactionRequest) {
|
4080
4107
|
if (transactionRequest.type === import_transactions20.TransactionType.Create) {
|
@@ -4187,6 +4214,14 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4187
4214
|
}
|
4188
4215
|
return results;
|
4189
4216
|
}
|
4217
|
+
/**
|
4218
|
+
* Dry runs multiple transactions.
|
4219
|
+
*
|
4220
|
+
* @param transactionRequests - Array of transaction request objects.
|
4221
|
+
* @param sendTransactionParams - The provider call parameters (optional).
|
4222
|
+
*
|
4223
|
+
* @returns A promise that resolves to an array of results for each transaction call.
|
4224
|
+
*/
|
4190
4225
|
async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
|
4191
4226
|
if (estimateTxDependencies) {
|
4192
4227
|
return this.estimateMultipleTxDependencies(transactionRequests);
|
@@ -4257,6 +4292,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4257
4292
|
* the transaction will be mutated and those dependencies will be added
|
4258
4293
|
*
|
4259
4294
|
* @param transactionRequestLike - The transaction request object.
|
4295
|
+
* @param estimateTxParams - The estimate transaction params (optional).
|
4260
4296
|
* @returns A promise that resolves to the call result object.
|
4261
4297
|
*/
|
4262
4298
|
async simulate(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
@@ -4281,14 +4317,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4281
4317
|
* to set gasLimit and also reserve balance amounts
|
4282
4318
|
* on the the transaction.
|
4283
4319
|
*
|
4284
|
-
* @privateRemarks
|
4285
|
-
* The tolerance is add on top of the gasUsed calculated
|
4286
|
-
* from the node, this create a safe margin costs like
|
4287
|
-
* change states on transfer that don't occur on the dryRun
|
4288
|
-
* transaction. The default value is 0.2 or 20%
|
4289
|
-
*
|
4290
4320
|
* @param transactionRequestLike - The transaction request object.
|
4291
|
-
* @param
|
4321
|
+
* @param transactionCostParams - The transaction cost parameters (optional).
|
4322
|
+
*
|
4292
4323
|
* @returns A promise that resolves to the transaction cost object.
|
4293
4324
|
*/
|
4294
4325
|
async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
|
@@ -4356,6 +4387,15 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4356
4387
|
updateMaxFee
|
4357
4388
|
};
|
4358
4389
|
}
|
4390
|
+
/**
|
4391
|
+
* Get the required quantities and associated resources for a transaction.
|
4392
|
+
*
|
4393
|
+
* @param owner - address to add resources from.
|
4394
|
+
* @param transactionRequestLike - transaction request to populate resources for.
|
4395
|
+
* @param quantitiesToContract - quantities for the contract (optional).
|
4396
|
+
*
|
4397
|
+
* @returns a promise resolving to the required quantities for the transaction.
|
4398
|
+
*/
|
4359
4399
|
async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
|
4360
4400
|
const ownerAddress = import_address3.Address.fromAddressOrString(owner);
|
4361
4401
|
const transactionRequest = transactionRequestify((0, import_ramda3.clone)(transactionRequestLike));
|
@@ -4377,6 +4417,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4377
4417
|
}
|
4378
4418
|
/**
|
4379
4419
|
* Returns coins for the given owner.
|
4420
|
+
*
|
4421
|
+
* @param owner - The address to get coins for.
|
4422
|
+
* @param assetId - The asset ID of coins to get (optional).
|
4423
|
+
* @param paginationArgs - Pagination arguments (optional).
|
4424
|
+
*
|
4425
|
+
* @returns A promise that resolves to the coins.
|
4380
4426
|
*/
|
4381
4427
|
async getCoins(owner, assetId, paginationArgs) {
|
4382
4428
|
const ownerAddress = import_address3.Address.fromAddressOrString(owner);
|
@@ -4399,8 +4445,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4399
4445
|
* Returns resources for the given owner satisfying the spend query.
|
4400
4446
|
*
|
4401
4447
|
* @param owner - The address to get resources for.
|
4402
|
-
* @param quantities - The quantities to get.
|
4403
|
-
* @param excludedIds - IDs of excluded resources from the selection.
|
4448
|
+
* @param quantities - The coin quantities to get.
|
4449
|
+
* @param excludedIds - IDs of excluded resources from the selection (optional).
|
4404
4450
|
* @returns A promise that resolves to the resources.
|
4405
4451
|
*/
|
4406
4452
|
async getResourcesToSpend(owner, quantities, excludedIds) {
|
@@ -4455,7 +4501,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4455
4501
|
* Returns block matching the given ID or height.
|
4456
4502
|
*
|
4457
4503
|
* @param idOrHeight - ID or height of the block.
|
4458
|
-
* @returns A promise that resolves to the block.
|
4504
|
+
* @returns A promise that resolves to the block or null.
|
4459
4505
|
*/
|
4460
4506
|
async getBlock(idOrHeight) {
|
4461
4507
|
let variables;
|
@@ -4585,7 +4631,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4585
4631
|
* Returns balances for the given owner.
|
4586
4632
|
*
|
4587
4633
|
* @param owner - The address to get coins for.
|
4588
|
-
* @param paginationArgs - Pagination arguments.
|
4634
|
+
* @param paginationArgs - Pagination arguments (optional).
|
4589
4635
|
* @returns A promise that resolves to the balances.
|
4590
4636
|
*/
|
4591
4637
|
async getBalances(owner, paginationArgs) {
|
@@ -4604,7 +4650,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4604
4650
|
* Returns message for the given address.
|
4605
4651
|
*
|
4606
4652
|
* @param address - The address to get message from.
|
4607
|
-
* @param paginationArgs - Pagination arguments.
|
4653
|
+
* @param paginationArgs - Pagination arguments (optional).
|
4608
4654
|
* @returns A promise that resolves to the messages.
|
4609
4655
|
*/
|
4610
4656
|
async getMessages(address, paginationArgs) {
|
@@ -4635,8 +4681,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4635
4681
|
*
|
4636
4682
|
* @param transactionId - The transaction to get message from.
|
4637
4683
|
* @param messageId - The message id from MessageOut receipt.
|
4638
|
-
* @param commitBlockId - The commit block id.
|
4639
|
-
* @param commitBlockHeight - The commit block height.
|
4684
|
+
* @param commitBlockId - The commit block id (optional).
|
4685
|
+
* @param commitBlockHeight - The commit block height (optional).
|
4640
4686
|
* @returns A promise that resolves to the message proof.
|
4641
4687
|
*/
|
4642
4688
|
async getMessageProof(transactionId, nonce, commitBlockId, commitBlockHeight) {
|
@@ -4724,10 +4770,21 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4724
4770
|
data
|
4725
4771
|
};
|
4726
4772
|
}
|
4773
|
+
/**
|
4774
|
+
* Get the latest gas price from the node.
|
4775
|
+
*
|
4776
|
+
* @returns A promise that resolves to the latest gas price.
|
4777
|
+
*/
|
4727
4778
|
async getLatestGasPrice() {
|
4728
4779
|
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
4729
4780
|
return (0, import_math17.bn)(latestGasPrice.gasPrice);
|
4730
4781
|
}
|
4782
|
+
/**
|
4783
|
+
* Returns the estimate gas price for the given block horizon.
|
4784
|
+
*
|
4785
|
+
* @param blockHorizon - The block horizon to estimate gas price for.
|
4786
|
+
* @returns A promise that resolves to the estimated gas price.
|
4787
|
+
*/
|
4731
4788
|
async estimateGasPrice(blockHorizon) {
|
4732
4789
|
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
4733
4790
|
blockHorizon: String(blockHorizon)
|
@@ -4747,8 +4804,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4747
4804
|
/**
|
4748
4805
|
* Lets you produce blocks with custom timestamps and the block number of the last block produced.
|
4749
4806
|
*
|
4750
|
-
* @param amount - The amount of blocks to produce
|
4751
|
-
* @param startTime - The UNIX timestamp (milliseconds) to set for the first produced block
|
4807
|
+
* @param amount - The amount of blocks to produce.
|
4808
|
+
* @param startTime - The UNIX timestamp (milliseconds) to set for the first produced block (optional).
|
4752
4809
|
* @returns A promise that resolves to the block number of the last produced block.
|
4753
4810
|
*/
|
4754
4811
|
async produceBlocks(amount, startTime) {
|
@@ -4758,6 +4815,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4758
4815
|
});
|
4759
4816
|
return (0, import_math17.bn)(latestBlockHeight);
|
4760
4817
|
}
|
4818
|
+
/**
|
4819
|
+
* Get the transaction response for the given transaction ID.
|
4820
|
+
*
|
4821
|
+
* @param transactionId - The transaction ID to get the response for.
|
4822
|
+
* @returns A promise that resolves to the transaction response.
|
4823
|
+
*/
|
4761
4824
|
// eslint-disable-next-line @typescript-eslint/require-await
|
4762
4825
|
async getTransactionResponse(transactionId) {
|
4763
4826
|
return new TransactionResponse(transactionId, this);
|
@@ -4766,7 +4829,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4766
4829
|
* Returns Message for given nonce.
|
4767
4830
|
*
|
4768
4831
|
* @param nonce - The nonce of the message to retrieve.
|
4769
|
-
* @returns A promise that resolves to the Message object.
|
4832
|
+
* @returns A promise that resolves to the Message object or null.
|
4770
4833
|
*/
|
4771
4834
|
async getMessageByNonce(nonce) {
|
4772
4835
|
const { message } = await this.operations.getMessageByNonce({ nonce });
|
@@ -4775,6 +4838,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4775
4838
|
}
|
4776
4839
|
return message;
|
4777
4840
|
}
|
4841
|
+
/**
|
4842
|
+
* Get the relayed transaction for the given transaction ID.
|
4843
|
+
*
|
4844
|
+
* @param relayedTransactionId - The relayed transaction ID to get the response for.
|
4845
|
+
* @returns A promise that resolves to the relayed transaction.
|
4846
|
+
*/
|
4778
4847
|
async getRelayedTransactionStatus(relayedTransactionId) {
|
4779
4848
|
const { relayedTransactionStatus } = await this.operations.getRelayedTransactionStatus({
|
4780
4849
|
relayedTransactionId
|
@@ -4784,6 +4853,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4784
4853
|
}
|
4785
4854
|
return relayedTransactionStatus;
|
4786
4855
|
}
|
4856
|
+
/**
|
4857
|
+
* @hidden
|
4858
|
+
*/
|
4787
4859
|
extractDryRunError(transactionRequest, receipts, dryRunStatus) {
|
4788
4860
|
const status = dryRunStatus;
|
4789
4861
|
let logs = [];
|
@@ -4813,7 +4885,9 @@ cacheInputs_fn = function(inputs) {
|
|
4813
4885
|
}
|
4814
4886
|
});
|
4815
4887
|
};
|
4888
|
+
/** @hidden */
|
4816
4889
|
__publicField(Provider, "chainInfoCache", {});
|
4890
|
+
/** @hidden */
|
4817
4891
|
__publicField(Provider, "nodeInfoCache", {});
|
4818
4892
|
|
4819
4893
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
@@ -4940,12 +5014,16 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4940
5014
|
* The provider used to interact with the network.
|
4941
5015
|
*/
|
4942
5016
|
_provider;
|
5017
|
+
/**
|
5018
|
+
* The connector for use with external wallets
|
5019
|
+
*/
|
4943
5020
|
_connector;
|
4944
5021
|
/**
|
4945
5022
|
* Creates a new Account instance.
|
4946
5023
|
*
|
4947
5024
|
* @param address - The address of the account.
|
4948
5025
|
* @param provider - A Provider instance (optional).
|
5026
|
+
* @param connector - A FuelConnector instance (optional).
|
4949
5027
|
*/
|
4950
5028
|
constructor(address, provider, connector) {
|
4951
5029
|
super();
|
@@ -4987,8 +5065,8 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4987
5065
|
/**
|
4988
5066
|
* Retrieves resources satisfying the spend query for the account.
|
4989
5067
|
*
|
4990
|
-
* @param quantities -
|
4991
|
-
* @param excludedIds - IDs of resources to be excluded from the query.
|
5068
|
+
* @param quantities - Quantities of resources to be obtained.
|
5069
|
+
* @param excludedIds - IDs of resources to be excluded from the query (optional).
|
4992
5070
|
* @returns A promise that resolves to an array of Resources.
|
4993
5071
|
*/
|
4994
5072
|
async getResourcesToSpend(quantities, excludedIds) {
|
@@ -4997,7 +5075,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4997
5075
|
/**
|
4998
5076
|
* Retrieves coins owned by the account.
|
4999
5077
|
*
|
5000
|
-
* @param assetId - The asset ID of the coins to retrieve.
|
5078
|
+
* @param assetId - The asset ID of the coins to retrieve (optional).
|
5001
5079
|
* @returns A promise that resolves to an array of Coins.
|
5002
5080
|
*/
|
5003
5081
|
async getCoins(assetId) {
|
@@ -5050,7 +5128,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5050
5128
|
/**
|
5051
5129
|
* Retrieves the balance of the account for the given asset.
|
5052
5130
|
*
|
5053
|
-
* @param assetId - The asset ID to check the balance for.
|
5131
|
+
* @param assetId - The asset ID to check the balance for (optional).
|
5054
5132
|
* @returns A promise that resolves to the balance amount.
|
5055
5133
|
*/
|
5056
5134
|
async getBalance(assetId) {
|
@@ -5090,7 +5168,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5090
5168
|
* @typeParam T - The type of the TransactionRequest.
|
5091
5169
|
* @param request - The transaction request to fund.
|
5092
5170
|
* @param params - The estimated transaction parameters.
|
5093
|
-
* @returns
|
5171
|
+
* @returns A promise that resolves to the funded transaction request.
|
5094
5172
|
*/
|
5095
5173
|
async fund(request, params) {
|
5096
5174
|
const { addedSignatures, estimatedPredicates, requiredQuantities, updateMaxFee } = params;
|
@@ -5183,8 +5261,8 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5183
5261
|
*
|
5184
5262
|
* @param destination - The address of the destination.
|
5185
5263
|
* @param amount - The amount of coins to transfer.
|
5186
|
-
* @param assetId - The asset ID of the coins to transfer.
|
5187
|
-
* @param txParams - The transaction parameters (
|
5264
|
+
* @param assetId - The asset ID of the coins to transfer (optional).
|
5265
|
+
* @param txParams - The transaction parameters (optional).
|
5188
5266
|
* @returns A promise that resolves to the prepared transaction request.
|
5189
5267
|
*/
|
5190
5268
|
async createTransfer(destination, amount, assetId, txParams = {}) {
|
@@ -5198,8 +5276,8 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5198
5276
|
*
|
5199
5277
|
* @param destination - The address of the destination.
|
5200
5278
|
* @param amount - The amount of coins to transfer.
|
5201
|
-
* @param assetId - The asset ID of the coins to transfer.
|
5202
|
-
* @param txParams - The transaction parameters (
|
5279
|
+
* @param assetId - The asset ID of the coins to transfer (optional).
|
5280
|
+
* @param txParams - The transaction parameters (optional).
|
5203
5281
|
* @returns A promise that resolves to the transaction response.
|
5204
5282
|
*/
|
5205
5283
|
async transfer(destination, amount, assetId, txParams = {}) {
|
@@ -5259,8 +5337,8 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5259
5337
|
*
|
5260
5338
|
* @param contractId - The address of the contract.
|
5261
5339
|
* @param amount - The amount of coins to transfer.
|
5262
|
-
* @param assetId - The asset ID of the coins to transfer.
|
5263
|
-
* @param txParams - The
|
5340
|
+
* @param assetId - The asset ID of the coins to transfer (optional).
|
5341
|
+
* @param txParams - The transaction parameters (optional).
|
5264
5342
|
* @returns A promise that resolves to the transaction response.
|
5265
5343
|
*/
|
5266
5344
|
async transferToContract(contractId, amount, assetId, txParams = {}) {
|
@@ -5301,7 +5379,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5301
5379
|
*
|
5302
5380
|
* @param recipient - Address of the recipient on the base chain.
|
5303
5381
|
* @param amount - Amount of base asset.
|
5304
|
-
* @param txParams - The
|
5382
|
+
* @param txParams - The transaction parameters (optional).
|
5305
5383
|
* @returns A promise that resolves to the transaction response.
|
5306
5384
|
*/
|
5307
5385
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
@@ -5331,7 +5409,14 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5331
5409
|
await this.fund(request, txCost);
|
5332
5410
|
return this.sendTransaction(request);
|
5333
5411
|
}
|
5334
|
-
/**
|
5412
|
+
/**
|
5413
|
+
* Sign a message from the account via the connector.
|
5414
|
+
*
|
5415
|
+
* @param message - the message to sign.
|
5416
|
+
* @returns a promise that resolves to the signature.
|
5417
|
+
*
|
5418
|
+
* @hidden
|
5419
|
+
*/
|
5335
5420
|
async signMessage(message) {
|
5336
5421
|
if (!this._connector) {
|
5337
5422
|
throw new import_errors16.FuelError(import_errors16.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
|
@@ -5339,7 +5424,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5339
5424
|
return this._connector.signMessage(this.address.toString(), message);
|
5340
5425
|
}
|
5341
5426
|
/**
|
5342
|
-
* Signs a transaction
|
5427
|
+
* Signs a transaction from the account via the connector..
|
5343
5428
|
*
|
5344
5429
|
* @param transactionRequestLike - The transaction request to sign.
|
5345
5430
|
* @returns A promise that resolves to the signature of the transaction.
|
@@ -5357,6 +5442,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5357
5442
|
* Sends a transaction to the network.
|
5358
5443
|
*
|
5359
5444
|
* @param transactionRequestLike - The transaction request to be sent.
|
5445
|
+
* @param sendTransactionParams - The provider send transaction parameters (optional).
|
5360
5446
|
* @returns A promise that resolves to the transaction response.
|
5361
5447
|
*/
|
5362
5448
|
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
|
@@ -5378,6 +5464,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5378
5464
|
* Simulates a transaction.
|
5379
5465
|
*
|
5380
5466
|
* @param transactionRequestLike - The transaction request to be simulated.
|
5467
|
+
* @param estimateTxParams - The estimate transaction params (optional).
|
5381
5468
|
* @returns A promise that resolves to the call result.
|
5382
5469
|
*/
|
5383
5470
|
async simulateTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
@@ -5711,6 +5798,8 @@ var BaseWalletUnlocked = class extends Account {
|
|
5711
5798
|
* Populates the witness signature for a transaction and sends it to the network using `provider.sendTransaction`.
|
5712
5799
|
*
|
5713
5800
|
* @param transactionRequestLike - The transaction request to send.
|
5801
|
+
* @param estimateTxDependencies - Whether to estimate the transaction dependencies.
|
5802
|
+
* @param awaitExecution - Whether to wait for the transaction to be executed.
|
5714
5803
|
* @returns A promise that resolves to the TransactionResponse object.
|
5715
5804
|
*/
|
5716
5805
|
async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
|
@@ -5742,6 +5831,12 @@ var BaseWalletUnlocked = class extends Account {
|
|
5742
5831
|
}
|
5743
5832
|
);
|
5744
5833
|
}
|
5834
|
+
/**
|
5835
|
+
* Encrypts an unlocked wallet with a password.
|
5836
|
+
*
|
5837
|
+
* @param password - the password to encrypt the wallet with.
|
5838
|
+
* @returns - the encrypted wallet.
|
5839
|
+
*/
|
5745
5840
|
async encrypt(password) {
|
5746
5841
|
return encryptKeystoreWallet(this.privateKey, this.address, password);
|
5747
5842
|
}
|