Skip to content
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

Add Rootstock #2077

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ const onboard = Onboard({
label: 'Arbitrum Nova',
rpcUrl: 'https://nova.arbitrum.io/rpc'
},
{
id: '0x1e',
token: 'RBTC',
label: 'Rootstock Mainnet',
rpcUrl: 'https://public-node.rsk.co'
},
{
id: '0x1f',
token: 'tRBTC',
label: 'Rootstock Testnet',
rpcUrl: 'https://public-node.testnet.rsk.co'
},
{
id: '0x2105',
token: 'ETH',
Expand Down
12 changes: 12 additions & 0 deletions docs/src/lib/services/onboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,18 @@ const intiOnboard = async (theme) => {
token: 'OETH',
label: 'Optimism',
rpcUrl: 'https://mainnet.optimism.io'
},
{
id: '0x1e',
token: 'RBTC',
label: 'Rootstock Mainnet',
rpcUrl: 'https://public-node.rsk.co'
},
{
id: '0x1f',
token: 'tRBTC',
label: 'Rootstock Testnet',
rpcUrl: 'https://public-node.testnet.rsk.co'
}
],
appMetadata: {
Expand Down
15 changes: 14 additions & 1 deletion docs/src/routes/docs/[...1]overview/[...1]introduction/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ web3-onboard supports all EVM networks. Supporting a new network is simply a mat
- Goerli
- Sepolia
- Base Goerli
- Rootstock
- All other EVM networks

### Optional - Use an API key to fetch real time transaction data, balances & gas
Expand Down Expand Up @@ -126,7 +127,19 @@ const onboard = Onboard({
token: 'ETH',
label: 'Base',
rpcUrl: 'https://mainnet.base.org'
}
},
{
id: '0x1e',
token: 'RBTC',
label: 'Rootstock Mainnet',
rpcUrl: 'https://public-node.rsk.co'
},
{
id: '0x1f',
token: 'tRBTC',
label: 'Rootstock Testnet',
rpcUrl: 'https://public-node.testnet.rsk.co'
},
]
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ const chains = [
token: 'ETH',
label: 'Base',
rpcUrl: 'https://mainnet.base.org'
},
{
id: '0x1e',
token: 'RBTC',
label: 'Rootstock Mainnet',
rpcUrl: 'https://public-node.rsk.co'
},
{
id: '0x1f',
token: 'tRBTC',
label: 'Rootstock Testnet',
rpcUrl: 'https://public-node.testnet.rsk.co'
}
]
```
Expand Down
12 changes: 12 additions & 0 deletions docs/src/routes/docs/[...3]modules/[...1]core/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,18 @@ const onboard = Onboard({
token: 'OETH',
label: 'Optimism',
rpcUrl: 'https://mainnet.optimism.io'
},
{
id: '0x1e',
token: 'RBTC',
label: 'Rootstock Mainnet',
rpcUrl: 'https://public-node.rsk.co'
},
{
id: '0x1f',
token: 'tRBTC',
label: 'Rootstock Testnet',
rpcUrl: 'https://public-node.testnet.rsk.co'
}
],
appMetadata: {
Expand Down
12 changes: 12 additions & 0 deletions docs/src/routes/docs/[...3]modules/[...3]react/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ init({
token: 'ETH',
label: 'Base',
rpcUrl: 'https://mainnet.base.org'
},
{
id: '0x1e',
token: 'RBTC',
label: 'Rootstock Mainnet',
rpcUrl: 'https://public-node.rsk.co'
},
{
id: '0x1f',
token: 'tRBTC',
label: 'Rootstock Testnet',
rpcUrl: 'https://public-node.testnet.rsk.co'
}
]
})
Expand Down
12 changes: 12 additions & 0 deletions docs/src/routes/docs/[...3]modules/[...7]vue/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ const web3Onboard = init({
token: 'ETH',
label: 'Base',
rpcUrl: 'https://mainnet.base.org'
},
{
id: '0x1e',
token: 'RBTC',
label: 'Rootstock Mainnet',
rpcUrl: 'https://public-node.rsk.co'
},
{
id: '0x1f',
token: 'tRBTC',
label: 'Rootstock Testnet',
rpcUrl: 'https://public-node.testnet.rsk.co'
}
]
})
Expand Down
12 changes: 12 additions & 0 deletions docs/src/routes/docs/[...4]wallets/[...14]injected/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ const onboard = Onboard({
token: 'ETH',
label: 'Base',
rpcUrl: 'https://mainnet.base.org'
},
{
id: '0x1e',
token: 'RBTC',
label: 'Rootstock Mainnet',
rpcUrl: 'https://public-node.rsk.co'
},
{
id: '0x1f',
token: 'tRBTC',
label: 'Rootstock Testnet',
rpcUrl: 'https://public-node.testnet.rsk.co'
}
],
appMetadata: {
Expand Down
12 changes: 12 additions & 0 deletions examples/with-ledger/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ init({
token: 'FTM',
label: 'Fantom',
rpcUrl: 'https://rpc.ftm.tools/'
},
{
id: '0x1e',
token: 'RBTC',
label: 'Rootstock Mainnet',
rpcUrl: 'https://public-node.rsk.co'
},
{
id: '0x1f',
token: 'tRBTC',
label: 'Rootstock Testnet',
rpcUrl: 'https://public-node.testnet.rsk.co'
}
],
appMetadata: {
Expand Down
12 changes: 12 additions & 0 deletions examples/with-nextjs-13/web3-onboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ export default init({
token: 'MATIC',
label: 'Matic Mainnet',
rpcUrl: 'https://matic-mainnet.chainstacklabs.com'
},
{
id: '0x1e',
token: 'RBTC',
label: 'Rootstock Mainnet',
rpcUrl: 'https://public-node.rsk.co'
},
{
id: '0x1f',
token: 'tRBTC',
label: 'Rootstock Testnet',
rpcUrl: 'https://public-node.testnet.rsk.co'
}
],
appMetadata: {
Expand Down
12 changes: 12 additions & 0 deletions examples/with-vite-react/src/web3-onboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,18 @@ export default init({
token: 'ETH',
label: 'Base',
rpcUrl: 'https://mainnet.base.org'
},
{
id: '0x1e',
token: 'RBTC',
label: 'Rootstock Mainnet',
rpcUrl: 'https://public-node.rsk.co'
},
{
id: '0x1f',
token: 'tRBTC',
label: 'Rootstock Testnet',
rpcUrl: 'https://public-node.testnet.rsk.co'
}
],
appMetadata: {
Expand Down
12 changes: 12 additions & 0 deletions examples/with-vuejs-v2/src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ const web3Onboard = init({
token: 'ETH',
label: 'Base',
rpcUrl: 'https://mainnet.base.org'
},
{
id: '0x1e',
token: 'RBTC',
label: 'Rootstock Mainnet',
rpcUrl: 'https://public-node.rsk.co'
},
{
id: '0x1f',
token: 'tRBTC',
label: 'Rootstock Testnet',
rpcUrl: 'https://public-node.testnet.rsk.co'
}
],
});
Expand Down
12 changes: 12 additions & 0 deletions examples/with-vuejs/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ init({
token: 'ARB',
label: 'Arbitrum Nova',
rpcUrl: 'https://nova.arbitrum.io/rpc'
},
{
id: '0x1e',
token: 'RBTC',
label: 'Rootstock Mainnet',
rpcUrl: 'https://public-node.rsk.co'
},
{
id: '0x1f',
token: 'tRBTC',
label: 'Rootstock Testnet',
rpcUrl: 'https://public-node.testnet.rsk.co'
}
]
})
Expand Down
14 changes: 13 additions & 1 deletion packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,19 @@ const onboard = Onboard({
token: 'FTM',
label: 'Fantom Mainnet',
rpcUrl: 'https://rpc.ftm.tools/'
}
},
{
id: '0x1e',
token: 'RBTC',
label: 'Rootstock Mainnet',
rpcUrl: 'https://public-node.rsk.co'
},
{
id: '0x1f',
token: 'tRBTC',
label: 'Rootstock Testnet',
rpcUrl: 'https://public-node.testnet.rsk.co'
},
],
appMetadata: {
name: 'Token Swap',
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/core",
"version": "2.21.3-alpha.1",
"version": "2.21.3-alpha.2",
"description": "Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
"keywords": [
"Ethereum",
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export { default as gnosisIcon } from './gnosis.js'
export { default as harmonyOneIcon } from './harmony-one.js'
export { default as arbitrumIcon } from './arbitrum.js'
export { default as baseIcon } from './base.js'
export { default as rootstockIcon } from './rootstock.js'
// other
export { default as hourglass } from './hourglass.js'
export { default as questionIcon } from './question.js'
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/icons/rootstock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export default `<svg id="Layer_2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 340.13 376.93"><g id="Layer_1-2"><g><circle cx="170.16" cy="51.8" r="51.8"/><path d="M314.19,211.93c-24.79-14.29-56.46-5.78-70.75,19.01-4.92,8.53-7.13,17.87-6.92,27.04h0c.52,22.83-20.01,34.71-39.53,22.92-.77-.47-1.56-.93-2.36-1.36-19.74-11.02-19.73-34.49,.02-45.5,16.17-8.76,27.16-25.89,27.16-45.57,0-.4-.02-.79-.03-1.18l.02,.03c-.51-22.86,20.07-34.73,39.61-22.85h0c15.65,9.5,35.87,10.39,52.84,.58,24.77-14.31,33.25-46,18.94-70.77-14.31-24.77-46-33.25-70.77-18.94-16.96,9.8-26.27,27.73-25.88,46.02h0c.51,22.81-20,34.68-39.5,22.91-7.87-4.82-17.11-7.6-27.01-7.6s-19.14,2.78-27,7.59c-19.46,11.73-39.91-.12-39.39-22.88h0c.4-18.33-8.96-36.3-25.97-46.09-24.8-14.26-56.47-5.72-70.73,19.08-14.26,24.8-5.72,56.47,19.08,70.73,16.95,9.75,37.11,8.84,52.73-.63h0c19.49-11.83,40.02,.03,39.5,22.83l.02-.03c0,.4-.03,.8-.03,1.21,0,19.69,10.98,36.81,27.16,45.57,19.76,11.02,19.75,34.52-.02,45.52-.8,.43-1.58,.89-2.35,1.36-19.46,11.71-39.9-.15-39.38-22.91h0c.22-9.21-2.01-18.6-6.96-27.16-14.34-24.76-46.03-33.2-70.79-18.87C1.09,226.32-7.35,258.01,6.98,282.77c14.34,24.76,46.03,33.2,70.79,18.87,.32-.19,.63-.39,.95-.58l-.03,.04c19.51-11.84,40.04,.03,39.51,22.84l.02-.03c0,.42-.03,.85-.03,1.27,.03,28.61,23.24,51.78,51.85,51.75,28.61-.03,51.78-23.24,51.75-51.85,0-.38-.02-.76-.03-1.14l.02,.03c-.52-22.87,20.07-34.75,39.62-22.87l-.03-.05c.36,.22,.7,.44,1.06,.65,24.79,14.29,56.46,5.78,70.75-19.01,14.29-24.79,5.78-56.46-19.01-70.75Z"/></g></g></svg>
`
19 changes: 16 additions & 3 deletions packages/core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import {
avalancheIcon,
harmonyOneIcon,
arbitrumIcon,
baseIcon
baseIcon,
rootstockIcon
} from './icons/index.js'

import type {
Expand Down Expand Up @@ -137,7 +138,9 @@ export const chainIdToLabel: Record<string, string> = {
'0x64': 'Gnosis',
'0x63564C40': 'Harmony One',
'0xa4b1': 'Arbitrum One',
'0xa4ba': 'Arbitrum Nova'
'0xa4ba': 'Arbitrum Nova',
'0x1e': 'Rootstock Mainnet',
'0x1f': 'Rootstock Testnet'
}

export const networkToChainId: Record<string, ChainId> = {
Expand All @@ -150,7 +153,9 @@ export const networkToChainId: Record<string, ChainId> = {
'bsc-main': '0x38',
'matic-main': '0x89',
'fantom-main': '0xfa',
'matic-mumbai': '0x80001'
'matic-mumbai': '0x80001',
'rootstock-mainnet': '0x1e',
'rootstock-testnet': '0x1f'
}

export const chainStyles: Record<string, ChainStyle> = {
Expand Down Expand Up @@ -233,6 +238,14 @@ export const chainStyles: Record<string, ChainStyle> = {
'0x80001': {
icon: polygonIcon,
color: '#8247E5'
},
'0x1e': {
icon: rootstockIcon,
color: '#0259F9'
},
'0x1f': {
icon: rootstockIcon,
color: '#8247E5'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this color match the color noted above? i.e. #0259F9

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
color: '#8247E5'
color: '#0259F9'

}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@web3-onboard/capsule": "2.0.1",
"@web3-onboard/cede-store": "^2.2.0",
"@web3-onboard/coinbase": "^2.2.6",
"@web3-onboard/core": "^2.21.3-alpha.1",
"@web3-onboard/core": "^2.21.3-alpha.2",
"@web3-onboard/dcent": "^2.2.7",
"@web3-onboard/enkrypt": "^2.0.3",
"@web3-onboard/fortmatic": "^2.0.18",
Expand Down
15 changes: 15 additions & 0 deletions packages/demo/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,18 @@
token: 'OETH',
label: 'Optimism',
rpcUrl: 'https://mainnet.optimism.io'
},
{
id: '0x1e',
token: 'RBTC',
label: 'Rootstock Mainnet',
rpcUrl: 'https://public-node.rsk.co'
},
{
id: '0x1f',
token: 'tRBTC',
label: 'Rootstock Testnet',
rpcUrl: 'https://public-node.testnet.rsk.co'
}
],
connect: {
Expand Down Expand Up @@ -751,6 +763,9 @@
<button on:click={() => onboard.setChain({ chainId: 10 })}
>Set Chain to Optimism</button
>
<button on:click={() => onboard.setChain({ chainId: '0x1f' })}
>Set Chain to Rootstock</button
>
</div>
<div class="position-buttons">
<button
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
"dependencies": {
"@web3-onboard/common": "^2.3.3",
"@web3-onboard/core": "^2.21.3-alpha.1",
"@web3-onboard/core": "^2.21.3-alpha.2",
"use-sync-external-store": "1.0.0"
},
"peerDependencies": {
Expand Down