File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,6 +68,44 @@ const provider = sapphire.wrap(window.ethereum);
6868window .ethereum = sapphire .wrap (window .ethereum ); // If you're feeling bold.
6969```
7070
71+ ### Viem
72+
73+ ``` ts
74+ import * as sapphire from ' @oasisprotocol/sapphire-paratime' ;
75+
76+ const sapphireChainTestnet: Chain = {
77+ id: sapphire .NETWORKS .testnet .chainId ,
78+ name: ' Sapphire' ,
79+ network: ' sapphire' ,
80+ nativeCurrency: {
81+ decimals: 18 ,
82+ name: ' Sapphire' ,
83+ symbol: ' ROSE' ,
84+ },
85+ rpcUrls: {
86+ default: {
87+ http: [sapphire .NETWORKS .testnet .defaultGateway ],
88+ },
89+ public: {
90+ http: [sapphire .NETWORKS .testnet .defaultGateway ],
91+ },
92+ },
93+ blockExplorers: {
94+ default: {
95+ name: ' Sapphire Explorer (Testnet)' ,
96+ url: sapphire .NETWORKS .testnet .defaultGateway
97+ },
98+ },
99+ testnet: true ,
100+ };
101+
102+ const provider = sapphire .wrap (window .ethereum ! as EIP1193Provider );
103+ const walletClient = createWalletClient ({
104+ chain: sapphireChainTestnet ,
105+ transport: custom (provider ),
106+ });
107+ ```
108+
71109## Troubleshooting
72110
73111### ` Error: missing provider (operation="getChainId", code=UNSUPPORTED_OPERATION, ...) `
You can’t perform that action at this time.
0 commit comments