Skip to content

Commit

Permalink
Merge pull request #39 from getsafle/feature-update-response-structur…
Browse files Browse the repository at this point in the history
…e-approvalRawTransaction

Feature update response structure approval raw transaction
  • Loading branch information
apoorvq authored Dec 15, 2022
2 parents 01d19cb + 7849d26 commit 16607f4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,7 @@
### 1.1.3 (2022-12-14)

- Removed the async declaration in the function `getBaseURL()` and `getRPCURL()`.

### 1.1.4 (2022-12-14)

- Output of the `approvalRawTransaction()` will be returned directly without the response object.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@getsafle/1inch-controller",
"version": "1.1.3",
"version": "1.1.4",
"description": "1inch controller for safle token swaps",
"main": "src/index.js",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class OneInch {
async approvalRawTransaction({ fromContractAddress, walletAddress, fromQuantity }) {
{
if (fromContractAddress.toLowerCase() === config.ETHEREUM_ADDRESS.toLowerCase()) {
return { response: true }
return true
}
const web3Provider = new ethers.providers.JsonRpcProvider(this.rpcUrl);
const contract = new Contract(fromContractAddress, TOKEN_CONTRACT_ABI, web3Provider);
Expand All @@ -101,10 +101,10 @@ class OneInch {

response.from = walletAddress;
response.gas = web3Utils.hexToNumber((await contract.estimateGas.approve(config.SWAP_ROUTER_ADDRESS, fromQuantity, { from: walletAddress }))._hex);
return { response };
return response;
}
else
return { response: true }
return true
}
}
}
Expand Down

0 comments on commit 16607f4

Please sign in to comment.