Skip to content

Commit

Permalink
update sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0neerpat committed Jul 25, 2024
1 parent 6bef9b6 commit 76c99fc
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 53 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@ethersproject/address": "^5.0.10",
"@ethersproject/experimental": "5.4.0",
"@ethersproject/providers": "5.4.5",
"@opendollar/sdk": "1.7.4-rc.3",
"@opendollar/sdk": "1.7.5-rc.1",
"@opendollar/svg-generator": "1.7.4",
"@react-spring/web": "^9.7.3",
"@sentry/cli": "^2.31.0",
Expand Down
87 changes: 87 additions & 0 deletions src/assets/pendle-pt-reth.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions src/assets/pendle-pt-wsteth.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 21 additions & 47 deletions src/utils/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,21 @@ import OP from '../assets/op-img.svg'
import OD from '../assets/od-token.svg'
import ODG from '../assets/odg-token.svg'
import GRT from '../assets/grt.svg'

import PT_wstETH_26JUN2025 from '../assets/pendle-pt-wsteth.svg'
import PT_rETH_26JUN2025 from '../assets/pendle-pt-reth.svg'
import WSTETH from '../assets/wsteth.svg'
import CBETH from '../assets/cbETH.svg'
import RETH from '../assets/rETH.svg'
import ARB from '../assets/arb.svg'
import MAGIC from '../assets/magic.svg'
import PUFETH from '../assets/pufeth.svg'
import FALLBACK_TOKEN_ICON from '../assets/unknown-token.svg'

import { Provider } from '@ethersproject/providers'
import { ethers } from 'ethers'
import { ERC20__factory } from '@opendollar/sdk/lib/typechained'
import { RPC_URL_ETHEREUM, RPC_URL_ARBITRUM, RPC_URL_OPTIMISM, RPC_URL_POLYGON, RPC_URL_BASE } from '~/chains'

// Helper function to dynamically import SVGs
const importTokenIcon = (tokenName: string) => {
switch (tokenName) {
case 'WETH':
return WETH
case 'OP':
return OP
case 'OD':
return OD
case 'ODG':
return ODG
case 'WSTETH':
return WSTETH
case 'CBETH':
return CBETH
case 'RETH':
return RETH
case 'ARB':
return ARB
case 'MAGIC':
return MAGIC
case 'PUFETH':
return PUFETH
case 'GRT':
return GRT
default:
return require('../assets/unknown-token.svg').default
}
}

export type Tokens = {
[key: string]: {
name: string
Expand All @@ -55,23 +28,24 @@ export type Tokens = {
}
}

export const TOKEN_LOGOS: { [key: string]: string } = {
WETH: importTokenIcon('WETH'),
OP: importTokenIcon('OP'),
OD: importTokenIcon('OD'),
ODG: importTokenIcon('ODG'),
WSTETH: importTokenIcon('WSTETH'),
CBETH: importTokenIcon('CBETH'),
RETH: importTokenIcon('RETH'),
ARB: importTokenIcon('ARB'),
MAGIC: importTokenIcon('MAGIC'),
PUFETH: importTokenIcon('PUFETH'),
GRT: importTokenIcon('GRT'),
ETH: importTokenIcon('WETH'),
}

export function getTokenLogo(token: string): string {
return TOKEN_LOGOS[token] || importTokenIcon('').default
const TOKEN_LOGOS: { [key: string]: string } = {
WETH: WETH,
OP: OP,
OD: OD,
ODG: ODG,
WSTETH: WSTETH,
CBETH: CBETH,
RETH: RETH,
ARB: ARB,
MAGIC: MAGIC,
PUFETH: PUFETH,
GRT: GRT,
ETH: WETH,
'PT-rETH-26JUN2025': PT_rETH_26JUN2025,
'PT-wstETH-26JUN2025': PT_wstETH_26JUN2025,
}
return TOKEN_LOGOS[token] || FALLBACK_TOKEN_ICON
}

const gasTokenArray = [
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3695,15 +3695,15 @@ __metadata:
languageName: node
linkType: hard

"@opendollar/sdk@npm:1.7.4-rc.3":
version: 1.7.4-rc.3
resolution: "@opendollar/sdk@npm:1.7.4-rc.3"
"@opendollar/sdk@npm:1.7.5-rc.1":
version: 1.7.5-rc.1
resolution: "@opendollar/sdk@npm:1.7.5-rc.1"
dependencies:
"@opendollar/abis": 0.0.0-605371bd
ethers: 5.4.7
peerDependencies:
utf-8-validate: ^5.0.2
checksum: 8ed9174b048af9d688f1160ecc470c929da2874f0f4f6624f703cafde7b298914996afa0e0fb10f4dcbe0f9d2dd507db441278a7fa24c190c336cdc92c763bf8
checksum: bc6651b408bbf04844704c55cee399856504542e8f21849fe9c3ed7882c1266f921b05e4e1df08dbeb1a295fa5e49b280b53797a7c40e5265c4f574b19fd8b68
languageName: node
linkType: hard

Expand Down Expand Up @@ -15006,7 +15006,7 @@ __metadata:
"@ethersproject/address": ^5.0.10
"@ethersproject/experimental": 5.4.0
"@ethersproject/providers": 5.4.5
"@opendollar/sdk": 1.7.4-rc.3
"@opendollar/sdk": 1.7.5-rc.1
"@opendollar/svg-generator": 1.7.4
"@react-spring/web": ^9.7.3
"@sentry/cli": ^2.31.0
Expand Down

0 comments on commit 76c99fc

Please sign in to comment.