Skip to main content

SDK API

Four packages. The first three share one session. ESM only.

@zunialab/sdk-web​

Export
createZuniaSession()Session that picks a transport.
connectWithZunia(options)Create, connect, return the session.
restoreSession(options)Create and restore, or null.
createExtensionSession / createZuniaWsSession / createWalletConnectSessionForce one transport.
getZunia / getZuniaSync / isZuniaInstalled / enableZuniaProvider helpers.
renderQrSvg / qrMatrixLocal QR rendering.
createConnectWithZuniaButtonDOM button. CSS at @zunialab/sdk-web/connect-button.css.
explainZuniaError / zuniaCapabilities / zuniaSignModeRe-exported from @zunialab/sdk-core.

ConnectOptions: chains, metadata, prefer (auto | extension | native-ws | walletconnect), apiBase (the Zunia relay is https://api.zunialab.com), wsBase, walletConnectProjectId, loadWalletConnect, timeoutMs, requestTimeoutMs, storage (null disables persistence), openInstallIfMissing.

A session exposes connect, restore, disconnect, unlock, signIn, signAmino, signDirect, signArbitrary, suggestChain, getKey, getOfflineSigner, getOfflineSignerOnlyAmino, getOfflineSignerFor, capabilities, accounts, chains, status, transport, pairing, verificationCode, on / off, subscribe, getSnapshot.

@zunialab/sdk-react​

Export
useZuniaSession(options?)Hook. Options { restore, session }. Returns the snapshot plus connected, locked, connecting, restoring, connect, disconnect, restore, unlock, signIn, session.
useZunia()Detect window.zunia.
ConnectWithZuniaButtonOfficial button.
ConnectPairingModalQR, then 6-digit code.
ZuniaQrCode / ZuniaMarkPresentational.
Re-exportscreateZuniaSession, ZuniaConnectError, explainZuniaError, createNonce, …

@zunialab/sdk-core​

Export
verifySignIn / createNonce / buildSignInMessage / parseSignInMessage / checkSignInBindingSign-in.
ZuniaConnectError / ZuniaSignInError / explainZuniaErrorErrors, and words for them.
zuniaCapabilities / zuniaSignMode / aminoNeedsEscaping / ZUNIA_SIGNING_FEATURESWhat a Zunia extension can sign, and which mode to ask it for.
checkAminoSignature / serializeAminoSignDocWhether an Amino signature is over the bytes the chain rebuilds.
ConnectCipher / deriveConnectKeys / verificationCodeFrom / parsePairingUri / buildPairingUrizunia.connect.v2 crypto and URIs.
normalizeAminoResponse / normalizeDirectResponse / normalizeStdSignatureWire to CosmJS shapes.
TypesZuniaProvider, ZuniaSession, ZuniaAccountInfo, …
ConstantsZUNIA_CONNECT_PROTOCOL, ZUNIA_CONNECT_PATHS, ZUNIA_WALLETCONNECT, deep links.

Test vectors: test-vectors/sign-in-vectors.json and test-vectors/connect-v2-vectors.json inside the package.

@zunialab/interchain​

IBC channel discovery, denom unwinding, packet-forward / ibc-hooks memos, cross-chain swaps and NFTs. Used by the wallet. A dApp can use it without talking to Zunia.