Skip to content

Commit

Permalink
Merge pull request #12 from getsafle/feature-update-1inch-url
Browse files Browse the repository at this point in the history
  • Loading branch information
apoorvq authored Oct 26, 2023
2 parents 96f8ae7 + 3585a4f commit 342bcd0
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@

- Updated getSupportedTokens method to accept dex as a parameter and return tokens only for the selected dex

### 1.0.4 (2023-10-26)


- Updated 1Inch API URL and request handling
5 changes: 3 additions & 2 deletions constants/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module.exports ={
supportedChains : ['ethereum', 'polygon', 'bsc' ],
oneInchBaseURL : "https://api-safle.1inch.io/v5.0",
oneInchBaseURL : "https://api.1inch.dev/swap/v5.2",
pancakeBaseURL: "https://tokens.pancakeswap.finance/pancakeswap-extended.json",
uniswapBaseURL: "https://tokens.uniswap.org/",
errorMessages:{
INVALID_CHAIN: "Invalid chain selected"
}
},
oneinchAuthToken: 'I00gf2qW3ebQSNZrcLrfmZelxmLxqdyL'
}
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function getTokensOneInch(chain) {
} else {
return { error: config.errorMessages.INVALID_CHAIN };
}
const { response, error } = await helper.getRequest({ url: `${url}/tokens` });
const { response, error } = await helper.getRequest({ url: `${url}/tokens`, headers: {Authorization: `Bearer ${config.oneinchAuthToken}` }});
if (error) {
return error;
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@getsafle/safle-token-lists",
"version": "1.0.3",
"version": "1.0.4",
"description": "This is a JS SDK catering to supported tokens list on safle swaps fetched from all the supported DEXs on different chains.",
"main": "index.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion utils/helper.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const axios = require('axios')

const getRequest = async ({ url }) => {
const getRequest = async ({ url, headers }) => {
try {
const response = await axios({
url: `${url}`,
method: 'GET',
headers
});
return { response: response.data };
} catch (error) {
Expand Down

0 comments on commit 342bcd0

Please sign in to comment.