-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to generate Supported Networks pages from safe-deployments…
… repo as a github action (#278) * Add script to genereate Supported Networks pages from safe-deployments repo as a github action * Update summary * Update summary * Fix typo in supported networks script & re-generate .md files * Implement requested changes * Implement requested changes * Remove unused console.log; fix supported networks index page & block explorers * Fix some vale errors ("networks's" & "Testnet") * Re-generate supported networks * Implement requested changes (wording & correct section) * Update SUMMARY.md * Update SUMMARY.md * Update SUMMARY.md * Update SUMMARY.md * Update SUMMARY.md * Move supported networks .md folder into safe-smart-accounts * Implement requested changes (create PR on workflow, minor fixes) * Update vale dictionnary * Update vale dictionnary * Remove duplicates in vale dictionnary * Remove unnecessary steps in github workflow for supported networks * Remove duplicates in vale dictionnary * Alphabetize & deduplicate vale dictionnary * Exclude deprecated block explorer from supported networks page generation --------- Co-authored-by: Germán Martínez <[email protected]>
- Loading branch information
1 parent
6fbe44a
commit 5e561b1
Showing
13 changed files
with
3,262 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
const shell = require('shelljs') | ||
const fs = require('fs') | ||
const path = require('path') | ||
|
||
const walkPath = dir => { | ||
let results = [] | ||
const list = fs.readdirSync(dir) | ||
list.forEach(function (file) { | ||
const filePath = path.join(dir, file) | ||
const stat = fs.statSync(filePath) | ||
if (stat?.isDirectory()) { | ||
results = results.concat(walkPath(filePath)) | ||
} else { | ||
results.push(filePath) | ||
} | ||
}) | ||
|
||
return results | ||
} | ||
|
||
const deduplicate = () => [ | ||
(acc, curr) => { | ||
if (acc.includes(curr)) { | ||
return acc | ||
} | ||
|
||
return [...acc, curr] | ||
}, | ||
[] | ||
] | ||
|
||
const supportedNetworksPath = './safe-smart-account/supported-networks' | ||
|
||
const generateSupportedNetworks = async () => { | ||
const deploymentRepoUrl = 'https://github.com/safe-global/safe-deployments/' | ||
shell.exec(`git clone ${deploymentRepoUrl} ./deployments`) | ||
shell.rm('-rf', supportedNetworksPath) | ||
|
||
const fetch = await import('node-fetch') | ||
const paths = walkPath('deployments/src/assets').map(p => | ||
p.replace('deployments/src/assets/', '') | ||
) | ||
|
||
const allNetworks = await fetch | ||
.default('https://chainid.network/chains.json') | ||
.then(res => res.json()) | ||
|
||
const contracts = paths.map(p => { | ||
const file = fs.readFileSync(`deployments/src/assets/${p}`, 'utf8') | ||
const json = JSON.parse(file) | ||
|
||
return Object.entries(json.networkAddresses).map(([chainId, address]) => ({ | ||
name: p.split('/')[1].split('.')[0], | ||
version: p.split('/')[0], | ||
address, | ||
chainId, | ||
chainName: allNetworks.find(n => n.chainId === parseInt(chainId))?.name, | ||
blockExplorerUrl: allNetworks.find(n => n.chainId === parseInt(chainId)) | ||
?.explorers?.[0]?.url | ||
})) | ||
}) | ||
|
||
const versions = contracts | ||
.flat() | ||
.map(c => c.version) | ||
.reduce(...deduplicate()) | ||
.reverse() | ||
|
||
shell.mkdir(supportedNetworksPath) | ||
|
||
versions.forEach(version => { | ||
const _contracts = contracts.flat().filter(c => c.version === version) | ||
|
||
const networks = Object.entries( | ||
_contracts.reduce((acc, curr) => { | ||
const { chainId, chainName } = curr | ||
if (acc[chainId]) { | ||
return acc | ||
} | ||
|
||
return { | ||
...acc, | ||
[chainId]: chainName | ||
} | ||
}, {}) | ||
) | ||
|
||
const content = `# ${version} | ||
This page lists the addresses of all the Safe contracts \`${version}\` grouped by chain. | ||
## Networks | ||
${networks | ||
.map(([chainId, network]) => { | ||
return ` | ||
### ${network} | ||
This network's chain ID is ${chainId}. | ||
${_contracts | ||
.filter(c => c.chainId === chainId) | ||
.map( | ||
c => | ||
`- \`${c.name}.sol\`: ${ | ||
c.blockExplorerUrl == null || deprecatedBlockExplorers.includes(c.blockExplorerUrl) | ||
? c.address | ||
: `[${c.address}](${c.blockExplorerUrl}/address/${c.address})` | ||
}` | ||
) | ||
.join('\n')} | ||
` | ||
}) | ||
.join('\n')} | ||
` | ||
fs.writeFileSync(`${supportedNetworksPath}/${version}.md`, content) | ||
}) | ||
|
||
shell.rm('-rf', './deployments') | ||
} | ||
|
||
generateSupportedNetworks() | ||
|
||
const deprecatedBlockExplorers = [ | ||
'https://ropsten.etherscan.io', | ||
'https://rinkeby.etherscan.io', | ||
'https://kovan-optimistic.etherscan.io', | ||
'https://stardust-explorer.metis.io', | ||
'https://blockexplorer.rinkeby.boba.network', | ||
'https://blockexplorer.bobabeam.boba.network', | ||
'https://rabbit.analogscan.com', | ||
'https://explorer.eurus.network', | ||
'https://testnetexplorer.eurus.network', | ||
'https://explorer.tst.publicmint.io', | ||
'https://evm-testnet.venidiumexplorer.com', | ||
'https://evm.venidiumexplorer.com', | ||
'https://evm.explorer.canto.io', | ||
'https://explorer.autobahn.network' | ||
] |
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,73 +1,169 @@ | ||
Safe{Core} Protocol | ||
Safe{Core} Account Abstraction SDK | ||
Safe Smart Account | ||
Safe Module | ||
Safe Modules | ||
Safe Guards | ||
Safe Transaction Service | ||
Safe Apps SDK | ||
Safe App | ||
Safe Apps | ||
Blockchain | ||
blockchain | ||
blockchains | ||
onchain | ||
offchain | ||
Offchain | ||
multisig | ||
dapp | ||
dapps | ||
Auth Kit | ||
Protocol Kit | ||
Relay Kit | ||
Onramp Kit | ||
API Kit | ||
UI Kit | ||
IPFS | ||
Onramp | ||
Safe Transaction Service | ||
Transaction Service | ||
Safe Config Service | ||
Config Service | ||
Safe Client Gateway | ||
Client Gateway | ||
Config | ||
config | ||
backend | ||
Safe{DAO} | ||
A1 | ||
AA | ||
API | ||
ABI | ||
ABIs | ||
SDK | ||
sdk | ||
npm | ||
API | ||
API Kit | ||
Acala | ||
Alfajores | ||
Andromeda | ||
Apothem | ||
Arbitrum | ||
Arianee | ||
Astar | ||
Aurora | ||
Auth Kit | ||
Autobahn | ||
Avax | ||
BNB | ||
Blockchain | ||
Blocknative | ||
Blockscout | ||
Boba | ||
Bobabeam | ||
C-Chain | ||
C1 | ||
CORS | ||
CRA | ||
HTTP | ||
HTTPS | ||
Blocknative | ||
ETH | ||
Canto | ||
Cascadia | ||
Celo | ||
Chiado | ||
Client Gateway | ||
CloudWalk | ||
Config | ||
Crab | ||
Cronos | ||
Crossbell | ||
DAO | ||
Darwinia | ||
EIP | ||
ERC | ||
Gunicorn | ||
WSGI | ||
Sourcify | ||
Etherscan | ||
Blockscout | ||
delist | ||
wagmi | ||
crypto | ||
cryptocurrencies | ||
ETH | ||
EVM | ||
EdgeEVM | ||
Edgeware | ||
EtherLite | ||
Ethereum | ||
blockchain | ||
Etherscan | ||
Eurus | ||
Evmos | ||
Fantom | ||
Fuji | ||
Fuse | ||
GC | ||
Gelato | ||
Gnosis | ||
Godwoken | ||
Goerli | ||
Gunicorn | ||
HTTP | ||
HTTPS | ||
Haqq | ||
Holesky | ||
IPFS | ||
IoTeX | ||
KCC | ||
Kanazawa | ||
Karura | ||
Kava | ||
Klaytn | ||
Kovan | ||
LUKSO | ||
Lightlink | ||
Linea | ||
MainNet | ||
Mainnet | ||
Mandala | ||
Mantle | ||
Meld | ||
Metadium | ||
Metamask | ||
Metis | ||
Milkomeda | ||
Monerium | ||
Gelato | ||
Moonbase | ||
Moonbeam | ||
Moonriver | ||
Mordor | ||
Nova | ||
OP | ||
Offchain | ||
Onramp | ||
Onramp Kit | ||
PGN | ||
Polis | ||
Polygon | ||
Protocol Kit | ||
PublicMint | ||
REI | ||
RPC | ||
Mainnet | ||
Goerli | ||
DAO | ||
Relay Kit | ||
Rethereum | ||
Rinkeby | ||
Rollux | ||
Rootstock | ||
Ropsten | ||
SDK | ||
Safe App | ||
Safe Apps | ||
Safe Apps SDK | ||
Safe Client Gateway | ||
Safe Config Service | ||
Safe Guards | ||
Safe Module | ||
Safe Modules | ||
Safe Smart Account | ||
Safe Transaction Service | ||
Safe{Core} Account Abstraction SDK | ||
Safe{Core} Protocol | ||
Safe{DAO} | ||
Sepolia | ||
Shiden | ||
ShimmerEVM | ||
Shyft | ||
Solaris | ||
Sourcify | ||
Sparknet | ||
Stardust | ||
Supernet | ||
Syscoin | ||
TC9 | ||
Tanenbaum | ||
Telos | ||
Tenet | ||
Testnet | ||
ThunderCore | ||
Transaction Service | ||
U2U | ||
UI Kit | ||
Ultron | ||
Velas | ||
Venidium | ||
WEMIX3.0 | ||
WSGI | ||
XDC | ||
ZetaChain | ||
Zora | ||
backend | ||
blockchain | ||
blockchains | ||
composable | ||
endhint | ||
config | ||
crypto | ||
cryptocurrencies | ||
dapp | ||
dapps | ||
delist | ||
endembed | ||
endhint | ||
multisig | ||
npm | ||
offchain | ||
onchain | ||
sdk | ||
undefined | ||
v1 | ||
wagmi | ||
zkEVM | ||
zkSync |
Oops, something went wrong.