@monkeymask/wallet-standard
v0.2.2
Published
Banano Wallet Standard types, SIWB, and protocol for MonkeyMask
Maintainers
Readme
@monkeymask/wallet-standard
Banano Wallet Standard types, protocol helpers, and Sign In With Banano (SIWB) for MonkeyMask.
Framework-agnostic and safe to import on the server (SIWB verify, codecs, URI parsing).
Install
npm install @monkeymask/wallet-standardOptional peer (only needed for client-side signing helpers that call bananojs):
npm install @bananocoin/bananojsWhat's included
| Module | Purpose |
|--------|---------|
| chains | banano: chain identifiers |
| features | Wallet Standard feature + operation types (send, mint, transfer, …) |
| protocol | Request/response envelope for extension messaging |
| siwb | Build and verify SIWB sign-in messages |
| nft / nftScan | NFT representative codecs and ledger scan helpers |
| representatives | Representative list helpers |
| uri | ban: payment URI build/parse, BAN ↔ raw conversion |
| errors | Standard error codes (4001 = user rejected) |
SIWB (server)
import {
createSignInMessageText,
deserializeSignInOutput,
verifySignIn,
generateNonce,
} from '@monkeymask/wallet-standard';
import bananojs from '@bananocoin/bananojs';
// 1. Issue a nonce (store it durably — e.g. Convex, Redis, DB).
const input = {
domain: 'yourdapp.com',
address: 'ban_1…',
nonce: generateNonce(),
issuedAt: new Date().toISOString(),
};
const message = createSignInMessageText(input);
// 2. Wallet signs via banano:signIn; POST { input, output } to your API.
const output = deserializeSignInOutput(rawOutput);
const valid = verifySignIn(input, output, bananojs.BananoUtil, {
expectedDomain: 'yourdapp.com',
});Payment URIs
import {
buildBananoUri,
parseBananoUri,
banToRaw,
rawToBan,
} from '@monkeymask/wallet-standard';
const uri = buildBananoUri({ address: 'ban_1…', amount: '1.5' });
// ban:ban_1…?amount=1.5
const req = parseBananoUri(uri);Docs
Full integration guide (features, transaction intents, NFT ops, error handling):
- MonkeyMask docs — source for the live docs site
- Monorepo README
Related packages
@monkeymask/react— React provider and hooks- MonkeyMask extension — Chrome wallet that implements this standard
License
See the monkeymask repository.
