-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add pontus-x network support WIP * feat: add pontus-x network support * refactor: custom chain config * feat: allow multiple custom networks to be added to metamask * refactor: clarify network for tokens to add * feat: multiple custom chains in write networks script * fix: custom ocean config for multiple custom chains * fix: tests --------- Co-authored-by: Albert Peci <[email protected]>
- Loading branch information
1 parent
735106b
commit 3b757a5
Showing
11 changed files
with
134 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,35 @@ | ||
import { Chain } from 'wagmi' | ||
import * as wagmiChains from 'wagmi/chains' | ||
import { networksMetadata } from '../../../networksMetadata.config' | ||
|
||
export const genx = { | ||
id: 100, | ||
name: 'GEN-X Testnet', | ||
network: 'genx', | ||
nativeCurrency: { | ||
decimals: 18, | ||
name: 'GX', | ||
symbol: 'GX' | ||
}, | ||
export const additionalChains: Chain[] = networksMetadata.map((metadata) => ({ | ||
id: metadata.chainId, | ||
name: metadata.name, | ||
network: metadata.chain, | ||
nativeCurrency: metadata.nativeCurrency, | ||
rpcUrls: { | ||
public: { http: ['https://rpc.genx.minimal-gaia-x.eu'] }, | ||
default: { http: ['https://rpc.genx.minimal-gaia-x.eu'] } | ||
public: { http: metadata.rpc }, | ||
default: { http: metadata.rpc } | ||
}, | ||
blockExplorers: { | ||
default: { | ||
name: 'GEN-X Testnet Explorer', | ||
url: 'https://explorer.pontus-x.eu' | ||
name: metadata.explorers[0].name, | ||
url: metadata.explorers[0].url | ||
} | ||
} | ||
} as Chain | ||
})) | ||
|
||
export const getSupportedChains = (chainIdsSupported: number[]): Chain[] => { | ||
const chains = [wagmiChains, genx].map((chain) => { | ||
return Object.values(chain).filter((chain) => | ||
chainIdsSupported.includes(chain.id) | ||
) | ||
}) | ||
const wagmiChainsFiltered = [wagmiChains] | ||
.map((chain) => { | ||
return Object.values(chain).filter( | ||
(chain) => | ||
chainIdsSupported.includes(chain.id) && | ||
// ensure to overwrite custom "additional" chains | ||
!additionalChains.map((addChain) => addChain.id).includes(chain.id) | ||
) | ||
}) | ||
.flat() as Chain[] | ||
|
||
return chains.flat() | ||
return [...wagmiChainsFiltered, ...additionalChains] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,8 @@ | |
position: relative; | ||
} | ||
|
||
.symbol { | ||
.symbol, | ||
.network { | ||
text-transform: none; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters