carbon-js-sdk 0.6.3 → 0.6.4
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/lib/clients/ETHClient.js +3 -1
- package/package.json +1 -1
package/lib/clients/ETHClient.js
CHANGED
|
@@ -69,13 +69,15 @@ class ETHClient {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
approveERC20(params) {
|
|
72
|
+
var _a;
|
|
72
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
74
|
const { token, gasPriceGwei, gasLimit, ethAddress, spenderAddress, signer, amount } = params;
|
|
74
75
|
const contractAddress = token.tokenAddress;
|
|
75
76
|
const rpcProvider = this.getProvider();
|
|
76
77
|
const contract = new ethers_1.ethers.Contract(contractAddress, eth_1.ABIs.erc20, rpcProvider);
|
|
78
|
+
const approvalAmount = ethers_1.ethers.BigNumber.from((_a = amount === null || amount === void 0 ? void 0 : amount.toString(10)) !== null && _a !== void 0 ? _a : ethers_1.ethers.constants.MaxUint256);
|
|
77
79
|
const nonce = yield this.getTxNonce(ethAddress, params.nonce, rpcProvider);
|
|
78
|
-
const approveResultTx = yield contract.connect(signer).approve(spenderAddress !== null && spenderAddress !== void 0 ? spenderAddress : token.bridgeAddress,
|
|
80
|
+
const approveResultTx = yield contract.connect(signer).approve(spenderAddress !== null && spenderAddress !== void 0 ? spenderAddress : token.bridgeAddress, approvalAmount, Object.assign(Object.assign({ nonce }, gasPriceGwei && ({ gasPrice: gasPriceGwei.shiftedBy(9).toString(10) })), gasLimit && ({ gasLimit: gasLimit.toString(10) })));
|
|
79
81
|
return approveResultTx;
|
|
80
82
|
});
|
|
81
83
|
}
|