This application shows how you can use the Rarimo SDK to connect to browser-based wallets in React applications.
To set up this application locally, follow these steps:
-
Make sure that Node.JS, NPX, and Yarn are installed.
-
Install one of these wallets in your web browser if you don't have one already:
- Coinbase
- Metamask
- NEAR
- Phantom
- Solflare
-
Clone this folder.
-
In a terminal in this folder, install the dependencies by running this command:
yarn install
-
In the file
src/App.tsx
, set the wallet to use by changing the wallet provider fromMetamaskProvider
to your wallet. For example, to make the application use Coinbase wallets, changeMetamaskProvider
toCoinbaseProvider
, as in this example:import { CoinbaseProvider } from '@rarimo/provider' import { useProvider } from '@rarimo/react-provider' function App() { const { provider } = useProvider(CoinbaseProvider) provider?.connect() console.log(provider?.address) return <div className="App">Wallet address: {provider?.address}</div> } export default App
The SDK supports these wallets:
CoinbaseProvider
: Coinbase walletsMetamaskProvider
: Metamask walletsNearProvider
: NEAR walletsPhantomProvider
: Phantom walletsSolflareProvider
: Solflare wallets
-
In the terminal, run
yarn start
and wait for the application to start. The application opens automatically in your default web browser, or you can open the page in a web browser by going to the URLhttp://localhost:3000
. -
When the application prompts you to connect your wallet, log in to your wallet and allow the connection.
If the application is working correctly, it prints the address of your wallet on the page.
This project was bootstrapped with Create React App.