@cryptorubic/web3 1.0.0-alpha.no-sdk.43 → 1.0.0-alpha.no-sdk.44
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.
package/package.json
CHANGED
|
@@ -28,9 +28,9 @@ class TronAdapterSigner extends abstract_adapter_signer_1.AbstractAdapterSigner
|
|
|
28
28
|
}
|
|
29
29
|
async sendTransaction(params) {
|
|
30
30
|
try {
|
|
31
|
-
const transaction = await this.
|
|
32
|
-
const signedTransaction = await this.
|
|
33
|
-
const receipt = await this.
|
|
31
|
+
const transaction = await this.wallet.transactionBuilder.triggerSmartContract(params.contractAddress, params.methodSignature, params.txOptions, params.parameters, this.walletAddress);
|
|
32
|
+
const signedTransaction = await this.wallet.trx.sign(transaction.transaction);
|
|
33
|
+
const receipt = await this.wallet.trx.sendRawTransaction(signedTransaction);
|
|
34
34
|
if (params.txOptions.onTransactionHash) {
|
|
35
35
|
params.txOptions.onTransactionHash(receipt.transaction.txID);
|
|
36
36
|
}
|
|
@@ -43,7 +43,7 @@ class TronAdapterSigner extends abstract_adapter_signer_1.AbstractAdapterSigner
|
|
|
43
43
|
}
|
|
44
44
|
async trySendTransaction(params) {
|
|
45
45
|
try {
|
|
46
|
-
await this.
|
|
46
|
+
await this.wallet.transactionBuilder.estimateEnergy(params.contractAddress, params.methodSignature, {}, params.parameters, this.walletAddress);
|
|
47
47
|
}
|
|
48
48
|
catch (err) {
|
|
49
49
|
const errMessage = typeof err === 'object' ? err.message : err;
|
|
@@ -57,7 +57,7 @@ class TronAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
|
57
57
|
tokensAddresses.splice(indexOfNativeCoin, 1);
|
|
58
58
|
promises[1] = this.getBalance(userAddress);
|
|
59
59
|
}
|
|
60
|
-
promises[0] = this.batchMulticallTokenBalance(userAddress, tokensAddresses,
|
|
60
|
+
promises[0] = this.batchMulticallTokenBalance(userAddress, tokensAddresses, 50);
|
|
61
61
|
const results = await Promise.all(promises);
|
|
62
62
|
const tokensBalances = results[0].map((tokenResults) => {
|
|
63
63
|
const { success, output } = tokenResults[0];
|
|
@@ -270,7 +270,7 @@ class TronAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
|
270
270
|
}
|
|
271
271
|
async approveTokens(tokenAddress, spenderAddress, amount = 'infinity', options = {}) {
|
|
272
272
|
try {
|
|
273
|
-
const contract = await this.
|
|
273
|
+
const contract = await this.signer.wallet.contract(trc_20_contract_abi_1.TRC20_CONTRACT_ABI, tokenAddress);
|
|
274
274
|
const rawValue = amount === 'infinity' ? new bignumber_js_1.default(2).pow(256).minus(1) : amount;
|
|
275
275
|
const transactionHash = await contract.approve(spenderAddress, rawValue.toFixed(0)).send({
|
|
276
276
|
...(options.feeLimit && {
|