-
Notifications
You must be signed in to change notification settings - Fork 7
Martinh/ntt supported chains #268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
208e28d
logic to fetch ntt supported chains
martin0995 bb2164b
import new logic
martin0995 b970c37
update script to fetch ntt supported chains
martin0995 a5f36f2
update ntt supported chains
martin0995 376426d
ntt supported chains file
martin0995 2d04af6
updae script for ntt
martin0995 3d947c3
update script to map klaytn to kaia
martin0995 c0f34cf
update chain name
martin0995 89c7afa
prettier check
martin0995 b8de626
prettier
martin0995 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
}, | ||
"ntt": { | ||
"mainnet": true, | ||
"testnet": true, | ||
"testnet": false, | ||
"devnet": false | ||
}, | ||
"tokenBridge": { | ||
|
This file contains hidden or 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 |
---|---|---|
|
@@ -33,7 +33,7 @@ | |
}, | ||
"ntt": { | ||
"mainnet": true, | ||
"testnet": true, | ||
"testnet": false, | ||
"devnet": false | ||
}, | ||
"tokenBridge": { | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -34,7 +34,7 @@ | |
}, | ||
"ntt": { | ||
"mainnet": true, | ||
"testnet": true, | ||
"testnet": false, | ||
"devnet": false | ||
}, | ||
"tokenBridge": { | ||
|
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -37,7 +37,7 @@ | |
}, | ||
"ntt": { | ||
"mainnet": true, | ||
"testnet": true, | ||
"testnet": false, | ||
"devnet": false | ||
}, | ||
"tokenBridge": { | ||
|
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -34,7 +34,7 @@ | |
}, | ||
"ntt": { | ||
"mainnet": true, | ||
"testnet": true, | ||
"testnet": false, | ||
"devnet": false | ||
}, | ||
"tokenBridge": { | ||
|
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// This script fetches the relayer NTT chains from the Wormhole SDK repository | ||
// and generates a JSON file with the supported chains for each network. | ||
|
||
import axios from 'axios'; | ||
import fs from 'fs'; | ||
|
||
// The below mapping is used to override the chain names in the output. | ||
const chainNameOverrides: Record<string, string> = { | ||
Klaytn: "Kaia", | ||
}; | ||
|
||
// The URL to the relayer file in the Wormhole SDK repository. | ||
const RELAYER_FILE_URL = 'https://raw.githubusercontent.com/wormhole-foundation/wormhole-sdk-ts/main/core/base/src/constants/contracts/relayer.ts'; | ||
|
||
async function extractRelayerNTTChains() { | ||
const res = await axios.get(RELAYER_FILE_URL); | ||
const text = res.data; | ||
|
||
const relayerChains: Record<string, string[]> = { | ||
Mainnet: [], | ||
Testnet: [], | ||
Devnet: [], | ||
}; | ||
|
||
const networkBlockRegex = /\[\s*"(\w+)"\s*,\s*\[((?:.|\n)*?)\]\s*\]/gm; | ||
let match; | ||
while ((match = networkBlockRegex.exec(text)) !== null) { | ||
const network = match[1]; | ||
const body = match[2]; | ||
|
||
const chainRegex = /\[\s*"([\w\d]+)"\s*,\s*"0x[a-fA-F0-9]{40}"\s*\]/g; | ||
let chainMatch; | ||
while ((chainMatch = chainRegex.exec(body)) !== null) { | ||
const originalName = chainMatch[1]; | ||
const normalizedName = chainNameOverrides[originalName] || originalName; | ||
|
||
relayerChains[network].push(normalizedName); | ||
} | ||
} | ||
|
||
relayerChains.Mainnet.push('Solana'); | ||
relayerChains.Testnet.push('Solana'); | ||
|
||
for (const net of Object.keys(relayerChains)) { | ||
relayerChains[net] = [...new Set(relayerChains[net])]; | ||
} | ||
|
||
fs.mkdirSync('./src/generated', { recursive: true }); | ||
fs.writeFileSync('./src/generated/ntt-support.json', JSON.stringify(relayerChains, null, 2)); | ||
|
||
console.log('Wrote NTT relayer support to scripts/generated/ntt-support.json'); | ||
} | ||
|
||
extractRelayerNTTChains(); |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"Mainnet": [ | ||
"Ethereum", | ||
"Bsc", | ||
"Polygon", | ||
"Avalanche", | ||
"Fantom", | ||
"Kaia", | ||
"Celo", | ||
"Moonbeam", | ||
"Base", | ||
"Arbitrum", | ||
"Optimism", | ||
"Blast", | ||
"Scroll", | ||
"Mantle", | ||
"Xlayer", | ||
"Berachain", | ||
"Seievm", | ||
"Ink", | ||
"Worldchain", | ||
"Snaxchain", | ||
"Unichain", | ||
"Solana" | ||
], | ||
"Testnet": [ | ||
"Ethereum", | ||
"Bsc", | ||
"Polygon", | ||
"Avalanche", | ||
"Fantom", | ||
"Celo", | ||
"Seievm", | ||
"Moonbeam", | ||
"Arbitrum", | ||
"Optimism", | ||
"Base", | ||
"Sepolia", | ||
"ArbitrumSepolia", | ||
"BaseSepolia", | ||
"OptimismSepolia", | ||
"Berachain", | ||
"Unichain", | ||
"Ink", | ||
"Monad", | ||
"PolygonSepolia", | ||
"Solana" | ||
], | ||
"Devnet": [ | ||
"Ethereum", | ||
"Bsc" | ||
] | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.