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.
This page builds the onboarding button. One click opens the wallet pop-up. The client creates a wallet or gets the wallet they already have. Your page gets the address. It can ask the client to sign a message in the same pop-up. Then it closes the pop-up.
Preview
The Assetera Wallet integration is in preview and available in a test environment only. Production availability follows.
If you sell instruments through Assetera
Register the wallet with Assetera the same way as any other wallet. Use signMessage to sign the
ownership challenge in the open pop-up. The steps are in
Register a client's wallet. This page does not repeat them.
Before you start
| You need | Where it comes from |
|---|---|
| Your site origin on the wallet's partner list | Assetera, see Get your site listed |
| The wallet URL | Assetera, when it lists your origin |
Install
npm install @asseteragmbh/wallet-connectorThe onboarding flow on this page needs version 0.2.0 or later. In that version the pop-up stays open after onboarding, so that the client can sign a message in it.
The onboarding button
Open the onboarding inside the click
Call openAsseteraOnboarding first in the click handler. Do not await anything before it. Browsers block
a pop-up that opens after an asynchronous step.
import { OnboardingError, openAsseteraOnboarding } from "@asseteragmbh/wallet-connector";
button.addEventListener("click", async () => {
try {
// No await before this call: it opens the pop-up and must run inside the click.
const wallet = await openAsseteraOnboarding({
walletUrl: process.env.NEXT_PUBLIC_ASSETERA_WALLET_URL!,
chain: "eip155:80002", // CAIP-2 chain id
locale: "en", // "en" or "de"
partnerName: "Your Bank", // shown in the overlay text only
});
try {
showWallet(wallet.address, wallet.chain, wallet.created);
await proveOwnership(wallet); // optional, next step
} finally {
wallet.close(); // always close the pop-up
}
} catch (error) {
if (error instanceof OnboardingError) showError(error.code);
}
});showWallet and showError are your own functions.
Ask for a signature in the open pop-up (optional)
The promise resolves when the client has a wallet. The pop-up stays open. If you need a signature, pass
the message to wallet.signMessage. The client confirms it in the pop-up. You can use this for example to
prove ownership of the address to your own backend.
import type { OnboardingResult } from "@asseteragmbh/wallet-connector";
async function proveOwnership(wallet: OnboardingResult) {
const message = await getMessageFromYourBackend(wallet.address);
// EIP-191 personal_sign. Rejects with OnboardingError("cancelled") if the client declines.
const signature = await wallet.signMessage(message);
await sendSignatureToYourBackend(wallet.address, message, signature);
}getMessageFromYourBackend and sendSignatureToYourBackend stand for your own calls. Show the message to
the client unchanged. Skip this step if you need only the address.
Close the pop-up
Call wallet.close() when you are done, also after an error. It closes the pop-up and removes the overlay.
Options
| Option | Required | Meaning |
|---|---|---|
walletUrl | yes | The wallet URL that Assetera gave you. |
chain | yes | The CAIP-2 chain id for the wallet, for example eip155:80002. |
locale | no | The wizard language, "en" or "de". |
partnerName | no | Your name, used only in the overlay text. |
overlay | no | true (default) shows a dimming overlay on your page. false hides it. An object { title, body, focus, cancel, blocked } replaces its text. |
addWallet | no | true asks for one more wallet, even when the client already has one. |
popupFeatures | no | The window.open feature string. The default is a centred pop-up. |
The result
| Field | Meaning |
|---|---|
address | The wallet address. |
chain | The CAIP-2 chain id. |
created | true when the wallet was created in this run. false when the client already had it. |
signMessage(message) | Asks the client to sign message in the open pop-up (EIP-191 personal_sign). Returns the signature. |
close() | Closes the pop-up and removes the overlay. You can call it more than once. |
If you do not need a signature, call close() at once.
Errors
openAsseteraOnboarding and signMessage reject with an OnboardingError. Use its code.
code | What happened | What to show the client |
|---|---|---|
popup_blocked | The browser blocked the pop-up. No overlay is shown. | Allow pop-ups for this site and try again. |
closed | The client closed the pop-up before the end, or signMessage was called after the pop-up was gone. | The wallet window was closed. Start again at any time. |
cancelled | The client cancelled in the wizard or in the overlay, or declined the signature. | You stopped the setup. Start again at any time. |
refused | The wallet refused the onboarding. | The wallet could not be set up. Contact support. |
failed | Another error in the wallet. message has the detail. | The wallet could not be set up. Try again later. |
invalid_options | The chain is not a CAIP-2 EVM id, or the wallet URL is not valid. | A configuration error on your side. Log it. |
More symptoms and fixes are in Troubleshooting.
Assetera Wallet for partner sites
Give your clients an Assetera Wallet from your own site. The wallet opens in a pop-up on its own domain and returns the wallet address to your page.
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.