Connect an existing wallet
Connect a client's Assetera Wallet with the wagmi connector, the RainbowKit entry or the raw EIP-1193 provider. Supported methods, error codes and pop-up rules.
A client who already has an Assetera Wallet connects it like any other wallet. The package
@asseteragmbh/wallet-connector gives you a wagmi connector, a RainbowKit wallet entry with the id
assetera-wallet, and a raw EIP-1193 provider. All three talk to the same wallet pop-up.
Preview
The Assetera Wallet integration is in preview and available in a test environment only. Production availability follows.
Choose an entry point
| Entry point | Import | Use it when |
|---|---|---|
| wagmi connector | asseteraWallet from @asseteragmbh/wallet-connector/wagmi | Your app uses wagmi v2. |
| RainbowKit wallet | asseteraRainbowWallet from @asseteragmbh/wallet-connector/rainbowkit | Your app uses the RainbowKit connect dialog. |
| EIP-1193 provider | createAsseteraWalletProvider from @asseteragmbh/wallet-connector | You use another library, or no library. |
@wagmi/core, viem and @rainbow-me/rainbowkit are optional peer dependencies. Install the ones your app
uses.
import { createConfig, http } from "wagmi";
import { polygonAmoy, sepolia } from "wagmi/chains";
import { asseteraWallet } from "@asseteragmbh/wallet-connector/wagmi";
const walletUrl = process.env.NEXT_PUBLIC_ASSETERA_WALLET_URL!;
export const config = createConfig({
chains: [polygonAmoy, sepolia],
connectors: [asseteraWallet({ walletUrl })],
transports: { [polygonAmoy.id]: http(), [sepolia.id]: http() },
});To ask a connected client for a message signature, use personal_sign. The client confirms it in the
pop-up. If you sell instruments through Assetera, register the wallet the same way as any other wallet. See
Register a client's wallet.
Supported methods
The pop-up answers these EIP-1193 methods. Any other method rejects with 4200. Read-only chain calls, for
example eth_call or eth_getBalance, go through your own RPC transport.
| Method | Opens the pop-up | Notes |
|---|---|---|
eth_requestAccounts | yes | Starts the connection. Call it from a click. |
eth_accounts | no | Answered locally from the last connection. |
eth_chainId | no | Answered locally. |
wallet_switchEthereumChain | yes | Rejects with 4902 for a chain the wallet does not offer. |
personal_sign | yes | The client confirms the message in the pop-up. |
eth_signTypedData_v4 | yes | The client confirms the typed data in the pop-up. |
eth_sendTransaction | yes | The client confirms the transaction in the pop-up. |
Error codes
A rejected request throws a ProviderRpcError with an EIP-1193 code.
| Code | Meaning |
|---|---|
4001 | The client rejected the request in the pop-up. |
4100 | Not connected. Call eth_requestAccounts first. |
4200 | The method is not supported. |
4900 | The pop-up was blocked or closed, or the wallet session ended. |
4902 | The wallet does not offer the requested chain. |
-32602 | The parameters are not valid. |
-32603 | An unexpected error in the wallet. |
Pop-up rules
- Open it from a click. The pop-up opens synchronously inside
request. Browsers allow that only during a user action. A blocked pop-up rejects with4900. - It stays open. The pop-up stays open while the client uses the wallet. Sign requests go to the same window and bring it to the front.
- No automatic reconnect. The wagmi connector returns
falsefromisAuthorized()on purpose. After a page load, the client connects again from a click. - After the client closes it, your next request needs a new click. If a request was waiting, you get a
disconnectevent. - On mobile it is a tab. The pop-up opens as a normal browser tab. The client switches back to your page when done.
Your site origin must be listed by Assetera. See Get your site listed.
Quick start
Install @asseteragmbh/wallet-connector, open the Assetera Wallet onboarding from a click, get the address, ask for a signature if you need one, close the pop-up.
Capabilities and responsibilities
What the Assetera Wallet does for your clients, which chains the preview supports, which languages the onboarding offers, and what Assetera and your site each do.