Skip to content

Commit

Permalink
feat: add opbnb assets (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
myz1237 authored Oct 28, 2024
1 parent ae3e6ac commit 1919a70
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
]
},
"dependencies": {
"@lifi/types": "^v15.15.0"
"@lifi/types": "^v16.1.0"
},
"devDependencies": {
"@commitlint/cli": "^19.5.0",
Expand Down
31 changes: 31 additions & 0 deletions src/chains/supportedChains.evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1038,4 +1038,35 @@ export const supportedEVMChains: EVMChain[] = [
rpcUrls: ['https://rpc.xlayer.tech/', 'https://xlayerrpc.okx.com'],
},
},

// 204 - opBNB
{
key: ChainKey.OPB,
chainType: ChainType.EVM,
name: 'opBNB',
coin: CoinKey.BNB,
id: 204,
mainnet: true,
logoURI:
'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/opbnb.svg',
multicallAddress: multicallAddresses[ChainId.OPB],

metamask: {
chainId: prefixChainId(204),
blockExplorerUrls: [
'https://opbnb.bscscan.com/',
'https://opbnbscan.com/',
],
chainName: 'opBNB Mainnet',
nativeCurrency: {
name: 'BNB',
symbol: 'BNB',
decimals: 18,
},
rpcUrls: [
'https://opbnb-mainnet-rpc.bnbchain.org',
'https://1rpc.io/opbnb',
],
},
},
]
107 changes: 95 additions & 12 deletions src/coins/coins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ export const basicCoins: BasicCoin[] = [
address: '0x0000000000000000000000000000000000000000',
decimals: 18,
},
[ChainId.OPB]: {
address: '0xE7798f023fC62146e8Aa1b36Da45fb70855a77Ea',
decimals: 18,
},
},
},
// > MATIC
Expand Down Expand Up @@ -205,16 +209,6 @@ export const basicCoins: BasicCoin[] = [
address: '0x0000000000000000000000000000000000000000',
decimals: 18,
},
[ChainId.POL]: {
address: '0xa649325aa7c5093d12d6f98eb4378deae68ce23f',
decimals: 18,
},
[ChainId.DAI]: {
address: '0xca8d20f3e0144a72c6b5d576e9bd3fd8557e2b04',
decimals: 18,
symbol: 'WBNB',
name: 'Wrapped BNB',
},
[ChainId.ONE]: {
address: '0xb1f6e61e1e113625593a22fa6aa94f8052bc39e0',
decimals: 18,
Expand All @@ -229,6 +223,22 @@ export const basicCoins: BasicCoin[] = [
address: '0x2b8e9cd44c9e09d936149549a8d207c918ecb5c4',
decimals: 18,
},
[ChainId.OPB]: {
address: '0x0000000000000000000000000000000000000000',
decimals: 18,
},
[ChainId.CRO]: {
address: '0xfA9343C3897324496A05fC75abeD6bAC29f8A40f',
decimals: 18,
},
[ChainId.ERA]: {
address: '0x7400793aad94c8ca801aa036357d10f5fd0ce08f',
decimals: 18,
},
[ChainId.LNA]: {
address: '0xf5C6825015280CdfD0b56903F9F8B5A2233476F5',
decimals: 18,
},
},
},
// > DAI
Expand Down Expand Up @@ -613,6 +623,10 @@ export const basicCoins: BasicCoin[] = [
address: '0x1e4a5963abfd975d8c9021ce480b42188849d41d',
decimals: 6,
},
[ChainId.OPB]: {
address: '0x9e5aac1ba1a2e6aed6b32689dfcf62a509ca96f3',
decimals: 6,
},
},
},

Expand Down Expand Up @@ -1715,6 +1729,65 @@ export const basicCoins: BasicCoin[] = [
},
},

// WBNB
{
key: CoinKey.WBNB,
name: CoinKey.WBNB,
logoURI:
'https://static.debank.com/image/coin/logo_url/bnb/9784283a36f23a58982fc964574ea530.png',
verified: true,
chains: {
[ChainId.BSC]: {
address: '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c',
decimals: 18,
},
[ChainId.OPB]: {
address: '0x4200000000000000000000000000000000000006',
decimals: 18,
},
[ChainId.DAI]: {
address: '0xca8d20f3e0144a72c6b5d576e9bd3fd8557e2b04',
decimals: 18,
},
[ChainId.ETH]: {
address: '0x418D75f65a02b3D53B2418FB8E1fe493759c7605',
decimals: 18,
name: 'Wormhole: WBNB Token',
},
[ChainId.POL]: {
address: '0xecdcb5b88f8e3c15f95c720c51c71c9e2080525d',
decimals: 18,
},
[ChainId.AVA]: {
address: '0x442F7f22b1EE2c842bEAFf52880d4573E9201158',
decimals: 18,
},
[ChainId.AUR]: {
address: '0x2bF9b864cdc97b08B6D79ad4663e71B8aB65c45c',
decimals: 18,
},
},
},

// FDUSD
{
key: CoinKey.FDUSD,
name: CoinKey.FDUSD,
logoURI:
'https://static.debank.com/image/eth_token/logo_url/0xc5f0f7b66764f6ec8c8dff7ba683102295e16409/9c61b134f82d8780005895d8fb6b19ab.png',
verified: true,
chains: {
[ChainId.ETH]: {
address: '0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409',
decimals: 18,
},
[ChainId.BSC]: {
address: '0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409',
decimals: 18,
},
},
},

// > Bitcoin
{
key: CoinKey.BTC,
Expand Down Expand Up @@ -1829,7 +1902,7 @@ export const wrappedTokens: { [ChainId: string]: StaticToken } = {
symbol: 'WBNB',
decimals: 18,
chainId: ChainId.BSC,
coinKey: 'WBNB' as CoinKey,
coinKey: CoinKey.WBNB,
name: 'WBNB',
logoURI:
'https://static.debank.com/image/coin/logo_url/bnb/9784283a36f23a58982fc964574ea530.png',
Expand Down Expand Up @@ -2178,8 +2251,18 @@ export const wrappedTokens: { [ChainId: string]: StaticToken } = {
logoURI:
'https://static.debank.com/image/xlayer_token/logo_url/0xe538905cf8410324e03a5a23c1c177a474d59b2b/b58d6980429c56560d9241765bdf9c2b.png',
},
[ChainId.OPB]: {
// https://opbnb.bscscan.com/token/0x4200000000000000000000000000000000000006
address: '0x4200000000000000000000000000000000000006',
symbol: 'WBNB',
decimals: 18,
chainId: ChainId.OPB,
coinKey: CoinKey.WBNB,
name: 'Wrapped BNB',
logoURI:
'https://static.debank.com/image/bsc_token/logo_url/0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c/1177dec1b9b7f58a799c3f22d93b04e1.png',
},
}

export const findDefaultCoin = (coinKey: CoinKey): Coin => {
const coin = defaultCoins.find((coin) => coin.key === coinKey)
if (!coin) {
Expand Down
1 change: 1 addition & 0 deletions src/multicall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const multicallAddresses: { [ChainId: number]: string } = {
[ChainId.IMX]: '0xcA11bde05977b3631167028862bE2a173976CA11',
[ChainId.KAI]: '0xcA11bde05977b3631167028862bE2a173976CA11',
[ChainId.XLY]: '0xcA11bde05977b3631167028862bE2a173976CA11',
[ChainId.OPB]: '0xcA11bde05977b3631167028862bE2a173976CA11',

// TODO
// [ChainId.EXP]: '', // TODO
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ __metadata:
dependencies:
"@commitlint/cli": "npm:^19.5.0"
"@commitlint/config-conventional": "npm:^19.2.2"
"@lifi/types": "npm:^v15.15.0"
"@lifi/types": "npm:^v16.1.0"
"@solana/web3.js": "npm:^1.95.1"
"@types/fs-extra": "npm:^11.0.4"
"@typescript-eslint/eslint-plugin": "npm:^7.17.0"
Expand All @@ -620,10 +620,10 @@ __metadata:
languageName: unknown
linkType: soft

"@lifi/types@npm:^v15.15.0":
version: 15.15.0
resolution: "@lifi/types@npm:15.15.0"
checksum: 10/0c4d1d7df9626531bf9c4ccb9bc2a72ffa60299984943dd563a623ab623f7476f82e6c8ae1c7741f5eb24ff0c69b858bec435a1ba235da726e3fa50ab7a9f000
"@lifi/types@npm:^v16.1.0":
version: 16.1.0
resolution: "@lifi/types@npm:16.1.0"
checksum: 10/ff749df32d3ab7843668778771e5ad258036f8b5866dc2b4852acad935befa810c74d4196d107fc15671fa8169d5e1ca9e269fce5e5a5d21e8fd9623b67b6ecc
languageName: node
linkType: hard

Expand Down

0 comments on commit 1919a70

Please sign in to comment.