Skip to content

Commit

Permalink
drop axios in favor of fetch; module config (#1235)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmosites authored Dec 4, 2023
1 parent 5e2c609 commit 773306b
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion source/pool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"devDependencies": {
"@airswap/constants": "4.1.6",
"@airswap/metadata": "4.1.11",
"@airswap/metadata": "4.1.12",
"@airswap/types": "4.1.1",
"@airswap/utils": "4.1.8",
"prompt-confirm": "^2.0.4"
Expand Down
2 changes: 1 addition & 1 deletion tools/libraries/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"lib": ["es2021", "dom"],
"lib": ["dom"],
"outDir": "./build"
}
}
13 changes: 6 additions & 7 deletions tools/metadata/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import axios from 'axios'
import { ethers } from 'ethers'
import {
TokenInfo,
Expand Down Expand Up @@ -44,7 +43,7 @@ export async function getKnownTokens(
const promises = await Promise.allSettled(
tokenlists[chainId].map(async (url) => {
try {
const { data } = await axios.get(url)
const data = await (await fetch(url)).json()
if (data.tokens) {
return data.tokens
}
Expand Down Expand Up @@ -262,12 +261,12 @@ export async function getCollectionTokenInfo(
}
}

async function fetchMetaData(uri: string) {
if (validUrl.isUri(uri)) {
if (uri.startsWith('ipfs')) {
uri = `https://cloudflare-ipfs.com/${uri.replace('://', '/')}`
async function fetchMetaData(url: string) {
if (validUrl.isUri(url)) {
if (url.startsWith('ipfs')) {
url = `https://cloudflare-ipfs.com/${url.replace('://', '/')}`
}
const { data } = await axios.get(uri)
const data = await (await fetch(url)).json()
if (typeof data === 'string')
try {
return JSON.parse(data)
Expand Down
3 changes: 1 addition & 2 deletions tools/metadata/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airswap/metadata",
"version": "4.1.11",
"version": "4.1.12",
"description": "AirSwap: Token Metadata for Developers",
"repository": {
"type": "git",
Expand All @@ -25,7 +25,6 @@
"@airswap/wrapper": "4.1.5",
"@openzeppelin/contracts": "^4.8.3",
"@uniswap/token-lists": "^1.0.0-beta.24",
"axios": "^1.6.0",
"ethers": "^5.6.9",
"valid-url": "^1.0.9"
},
Expand Down
4 changes: 2 additions & 2 deletions tools/metadata/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./build",
"lib": ["ES2020.Promise"]
"lib": ["dom"],
"outDir": "./build"
}
}
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "commonjs",
"moduleResolution": "nodenext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"resolveJsonModule": true,
"sourceMap": true,
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2762,7 +2762,7 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.12.0.tgz#ce1c9d143389679e253b314241ea9aa5cec980d3"
integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==

axios@^1.0.0, axios@^1.6.0:
axios@^1.0.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.0.tgz#f1e5292f26b2fd5c2e66876adc5b06cdbd7d2102"
integrity sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==
Expand Down

0 comments on commit 773306b

Please sign in to comment.