Skip to content

Commit

Permalink
Merge branch 'main' into ethers-v6-migration-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dasanra committed Nov 23, 2023
2 parents a120bcb + 5e561b1 commit 0616a40
Show file tree
Hide file tree
Showing 41 changed files with 3,499 additions and 337 deletions.
3 changes: 3 additions & 0 deletions .gitbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ redirects:
safe-smart-account/security/security-audits: safe-smart-account/security-audits.md
safe-smart-account/security/bug-bounty-program: miscellaneous/bug-bounty-program.md
safe-smart-account/security/past-paid-bounties: miscellaneous/past-paid-bounties.md
safe-apps-sdk/safe-apps: safe-apps/README.md
safe-apps-sdk/overview: safe-apps/README.md
safe-apps-sdk/example-safe-app: safe-apps/get-started.md
139 changes: 139 additions & 0 deletions .github/scripts/generateSupportedNetworks.js
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'
]
204 changes: 158 additions & 46 deletions .github/styles/Vocab/default/accept.txt
Original file line number Diff line number Diff line change
@@ -1,57 +1,169 @@
Safe{Core} Protocol
Safe{Core} Account Abstraction SDK
Safe Smart Account
Safe Module
Safe Modules
Safe Guards
Safe Transaction Service
Blockchain
blockchain
blockchains
onchain
offchain
Offchain
multisig
Auth Kit
Protocol Kit
Relay Kit
Onramp Kit
API Kit
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
ETH
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
Canto
Cascadia
Celo
Chiado
Client Gateway
CloudWalk
Config
Crab
Cronos
Crossbell
DAO
Darwinia
EIP
ERC
Gunicorn
WSGI
Sourcify
Etherscan
Blockscout
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
34 changes: 34 additions & 0 deletions .github/workflows/generate-supported-networks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Weekly update for supported networks

on:
schedule:
- cron: "0 9 * * 1"
workflow_dispatch:

jobs:
generate-supported-networks:
runs-on: ubuntu-latest
steps:
- name: Use Node.js 20.x
uses: actions/setup-node@v2
with:
node-version: '20.x'
cache: 'yarn'
cache-dependency-path: ./yarn.lock
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Generate supported networks
run: node ./.github/scripts/generateSupportedNetworks.js
- uses: actions/checkout@v4
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
Loading

0 comments on commit 0616a40

Please sign in to comment.