Skip to content

Commit

Permalink
@airwap/utils: drop wrapper dep; add native tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
dmosites committed Feb 16, 2024
1 parent 0a8b536 commit 753c13e
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 18 deletions.
2 changes: 1 addition & 1 deletion source/batch-call/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@airswap/swap-erc20": "4.2.1"
},
"devDependencies": {
"@airswap/utils": "4.2.7",
"@airswap/utils": "4.2.8",
"prompt-confirm": "^2.0.4"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion source/pool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@openzeppelin/contracts": "^4.8.3"
},
"devDependencies": {
"@airswap/utils": "4.2.7",
"@airswap/utils": "4.2.8",
"@airswap/merkle": "0.0.2",
"prompt-confirm": "^2.0.4"
},
Expand Down
2 changes: 1 addition & 1 deletion source/registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"access": "public"
},
"devDependencies": {
"@airswap/utils": "4.2.7",
"@airswap/utils": "4.2.8",
"prompt-confirm": "^2.0.4"
}
}
2 changes: 1 addition & 1 deletion source/staking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"access": "public"
},
"devDependencies": {
"@airswap/utils": "4.2.7",
"@airswap/utils": "4.2.8",
"prompt-confirm": "^2.0.4"
}
}
2 changes: 1 addition & 1 deletion source/swap-erc20/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"devDependencies": {
"@airswap/staking": "4.2.1",
"@airswap/utils": "4.2.7",
"@airswap/utils": "4.2.8",
"prompt-confirm": "^2.0.4"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion source/swap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@openzeppelin/contracts": "^4.8.3"
},
"devDependencies": {
"@airswap/utils": "4.2.7",
"@airswap/utils": "4.2.8",
"@nomicfoundation/hardhat-network-helpers": "^1.0.7"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion source/wrapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@openzeppelin/contracts": "^4.8.3"
},
"devDependencies": {
"@airswap/utils": "4.2.7",
"@airswap/utils": "4.2.8",
"@uniswap/v2-periphery": "^1.1.0-beta.0",
"prompt-confirm": "^2.0.4"
},
Expand Down
4 changes: 2 additions & 2 deletions tools/libraries/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airswap/libraries",
"version": "4.2.10",
"version": "4.2.11",
"description": "AirSwap: Libraries for Developers",
"repository": {
"type": "git",
Expand Down Expand Up @@ -29,7 +29,7 @@
"@airswap/staking": "4.2.1",
"@airswap/swap": "4.2.1",
"@airswap/swap-erc20": "4.2.1",
"@airswap/utils": "4.2.7",
"@airswap/utils": "4.2.8",
"@airswap/wrapper": "4.2.1",
"browser-or-node": "^2.1.1",
"ethers": "^5.6.9",
Expand Down
2 changes: 1 addition & 1 deletion tools/stores/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"test": "REDISCLOUD_URL=redis://localhost:6379 TS_NODE_COMPILER_OPTIONS='{\"strict\":false}' yarn mocha -r ts-node/esm test/*.ts"
},
"dependencies": {
"@airswap/utils": "4.2.7",
"@airswap/utils": "4.2.8",
"redis": "^4.6.13"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion tools/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airswap/utils",
"version": "4.2.7",
"version": "4.2.8",
"description": "AirSwap: Utilities for Developers",
"repository": {
"type": "git",
Expand Down
22 changes: 22 additions & 0 deletions tools/utils/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,28 @@ export const stakingTokenAddresses: Record<number, string> = {
[ChainIds.HOLESKY]: '0x4092d6dba9abb7450b9d91aa7ed2712935d63b39',
}

export const wrappedNativeTokenAddresses: Record<number, string> = {
[ChainIds.MAINNET]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
[ChainIds.RSK]: '0x967f8799af07df1534d48a95a5c9febe92c53ae0',
[ChainIds.RSKTESTNET]: '0x09b6ca5e4496238a1f176aea6bb607db96c2286e',
[ChainIds.TELOS]: '0xD102cE6A4dB07D247fcc28F366A623Df0938CA9E',
[ChainIds.TELOSTESTNET]: '0xaE85Bf723A9e74d6c663dd226996AC1b8d075AA9',
[ChainIds.BSC]: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c',
[ChainIds.BSCTESTNET]: '0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd',
[ChainIds.POLYGON]: '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270',
[ChainIds.BASE]: '0x4200000000000000000000000000000000000006',
[ChainIds.HOLESKY]: '0x94373a4919b3240d86ea41593d5eba789fef3848',
[ChainIds.ARBITRUM]: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1',
[ChainIds.FUJI]: '0xd9d01a9f7c810ec035c0e42cb9e80ef44d7f8692',
[ChainIds.AVALANCHE]: '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7',
[ChainIds.LINEAGOERLI]: '0x2C1b868d6596a18e32E61B901E4060C872647b6C',
[ChainIds.LINEA]: '0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f',
[ChainIds.MUMBAI]: '0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889',
[ChainIds.BASESEPOLIA]: '0x4200000000000000000000000000000000000006',
[ChainIds.ARBITRUMSEPOLIA]: '0x0091f4e75a03c11cb9be8e3717219005eb780d89',
[ChainIds.SEPOLIA]: '0x7b79995e5f793a07bc00c21412e50ecae098e7f9',
}

export const ownerAddresses: Record<number, string> = {
[ChainIds.MAINNET]: '0xf8bB149F9525875Fa47B8CC632d368EB600FAba3',
[ChainIds.RSK]: '0xed669F5fe2A37Ef204DB178c7a982717B9f03Ec2',
Expand Down
12 changes: 7 additions & 5 deletions tools/utils/src/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import {
CollectionTokenInfo,
CollectionTokenMetadata,
CollectionTokenAttribute,
} from './types'
import {
TokenKinds,
chainCurrencies,
chainNames,
stakingTokenAddresses,
} from '@airswap/utils'
wrappedNativeTokenAddresses,
} from './constants'
import TOKEN_LISTS from './tokenlists'
import TOKEN_DEFAULTS from './tokendefaults'
import wethDeploys from '@airswap/wrapper/deploys-weth.js'
import validUrl from 'valid-url'

const AIRSWAP_LOGO_URI =
Expand Down Expand Up @@ -77,7 +79,7 @@ export async function getKnownTokens(
}
}
}
if (wethDeploys[chainId]) {
if (wrappedNativeTokenAddresses[chainId]) {
const wrappedTokens = getWrappedTokens()
for (let i = 0; i < wrappedTokens.length; i++) {
if (wrappedTokens[i].chainId == chainId) {
Expand Down Expand Up @@ -130,12 +132,12 @@ export function firstTokenBySymbol(

export function getWrappedTokens(): TokenInfo[] {
const _wrappedTokens: TokenInfo[] = []
for (const chainId in wethDeploys) {
for (const chainId in wrappedNativeTokenAddresses) {
const _chainId = Number(chainId)
_wrappedTokens.push({
name: `Wrapped ${chainCurrencies[_chainId]}`,
symbol: `W${chainCurrencies[_chainId]}`,
address: wethDeploys[_chainId],
address: wrappedNativeTokenAddresses[_chainId],
decimals: 18,
chainId: Number(_chainId),
})
Expand Down
3 changes: 2 additions & 1 deletion tools/utils/src/tokendefaults.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ChainIds, TokenInfo } from '@airswap/utils'
import { ChainIds } from './constants'
import { TokenInfo } from './types'
const TEST_TOKEN_DECIMALS = 6

export default [
Expand Down
2 changes: 1 addition & 1 deletion tools/utils/src/tokenlists.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainIds } from '@airswap/utils'
import { ChainIds } from './constants'

export default {
[ChainIds.MAINNET]: [
Expand Down

0 comments on commit 753c13e

Please sign in to comment.