Skip to content

Commit 7b5d9ce

Browse files
authored
Merge pull request #1657 from oasisprotocol/matevz/feature/more-add-metamask-buttons
manage-tokens: Show "Add to MetaMask" button directly in the section
2 parents 11fca84 + 6d12c5b commit 7b5d9ce

2 files changed

Lines changed: 27 additions & 10 deletions

File tree

docs/general/manage-tokens/README.mdx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
description: Transfer, deposit, withdraw and delegate your ROSE
33
---
44

5+
import {AddSapphireToMetaMask as S, AddSapphireTestnetToMetaMask as ST} from '@site/src/AddToMetaMask';
6+
57
# Manage your Tokens
68

79
The **native token** on Oasis Mainnet is called **ROSE**. Native tokens are used
@@ -181,18 +183,24 @@ as a laptop or a mobile phone, and **you are responsible to keep it safe**:
181183

182184
### MetaMask
183185

184-
[MetaMask] is probably the best-known crypto wallet. However, it is an
185-
**EVM-compatible** wallet. This means **you can only use it to check the account
186-
balances and sign transactions on Sapphire and Emerald chains**. You cannot use
187-
it, for example, to sign **consensus layer transactions** or perform
188-
**deposits** and **withdrawals** to and from ParaTimes.
186+
[MetaMask] is probably the best-known crypto wallet. Use the buttons below
187+
to add Oasis-managed endpoints for the **Sapphire chain** to your Metamask:
189188

190-
You can add the Sapphire RPC endpoint by clicking on the "Add to MetaMask"
191-
button next to your preferred Mainnet endpoint provider in the [Sapphire]
192-
chapter.
189+
| Mainnet | Testnet |
190+
|---------|---------|
191+
| <S rpcs={['https://sapphire.oasis.io','wss://sapphire.oasis.io/ws']} hideRpcs={true} /> | <ST rpcs={['https://testnet.sapphire.oasis.io','wss://testnet.sapphire.oasis.io/ws']} hideRpcs={true} /> |
193192

194193
![Metamask - Adding Sapphire Mainnet Network Configuration](../images/wallet/metamask/settings.png)
195194

195+
To learn more about Sapphire and explore other RPC endpoints check out the
196+
[Sapphire] chapter.
197+
198+
Keep in mind that Metamask is an EVM-compatible wallet. This means **you
199+
can only use it to check the account balances and sign transactions on
200+
Sapphire and Emerald chains**. You cannot use it, for example, to sign
201+
**consensus layer transactions** or perform **deposits** and **withdrawals**
202+
to and from ParaTimes.
203+
196204
[MetaMask]: https://metamask.io/download/
197205
[Sapphire]: ../../build/sapphire/network.mdx#rpc-endpoints
198206

src/AddToMetaMask.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ const AddToMetaMask = (props: {
55
chainId: string,
66
token: string,
77
rpcs: string[],
8+
hideRpcs: boolean,
89
be: string[],
910
}) => {
1011
return (
1112
<span>
12-
{props.rpcs.map(item => (
13+
{!props.hideRpcs && props.rpcs.map(item => (
1314
<code key={item}>{item}<br/></code>
1415
))}
1516
<button
16-
className="button button--primary margin-top--md"
17+
className={"button button--primary"+(props.hideRpcs ? "" : " margin-top--md")}
1718
onClick={() => {
1819
if (!window.ethereum?.request) {
1920
return alert('Have you installed MetaMask yet? If not, please do so.\n\nComputer: Once it is installed, you will be able to add the ParaTime to your MetaMask.\n\nPhone: Open the website through your MetaMask Browser to add the ParaTime.')
@@ -49,48 +50,56 @@ const AddToMetaMask = (props: {
4950

5051
export const AddSapphireToMetaMask = (props: {
5152
rpcs: string[],
53+
hideRpcs: boolean,
5254
}) => {
5355
return AddToMetaMask({
5456
name: 'Oasis Sapphire',
5557
chainId: '0x5afe',
5658
token: 'ROSE',
5759
rpcs: props.rpcs,
60+
hideRpcs: props.hideRpcs,
5861
be: ['https://explorer.oasis.io/mainnet/sapphire'],
5962
});
6063
};
6164

6265
export const AddSapphireTestnetToMetaMask = (props: {
6366
rpcs: string[],
67+
hideRpcs: boolean,
6468
}) => {
6569
return AddToMetaMask({
6670
name: 'Oasis Sapphire Testnet',
6771
chainId: '0x5aff',
6872
token: 'TEST',
6973
rpcs: props.rpcs,
74+
hideRpcs: props.hideRpcs,
7075
be: ['https://explorer.oasis.io/testnet/sapphire'],
7176
});
7277
};
7378

7479
export const AddEmeraldToMetaMask = (props: {
7580
rpcs: string[],
81+
hideRpcs: boolean,
7682
}) => {
7783
return AddToMetaMask({
7884
name: 'Oasis Emerald',
7985
chainId: '0xa516',
8086
token: 'ROSE',
8187
rpcs: props.rpcs,
88+
hideRpcs: props.hideRpcs,
8289
be: ['https://explorer.oasis.io/mainnet/emerald'],
8390
});
8491
};
8592

8693
export const AddEmeraldTestnetToMetaMask = (props: {
8794
rpcs: string[],
95+
hideRpcs: boolean,
8896
}) => {
8997
return AddToMetaMask({
9098
name: 'Oasis Emerald Testnet',
9199
chainId: '0xa515',
92100
token: 'TEST',
93101
rpcs: props.rpcs,
102+
hideRpcs: props.hideRpcs,
94103
be: ['https://explorer.oasis.io/testnet/emerald'],
95104
});
96105
};

0 commit comments

Comments
 (0)