# decane-connect-kit > Wallet-connect and non-custodial social sign-in for EVM, Solana, Tron, and Bitcoin dApps, in one npm package (`decane-connect-kit`, MIT license, React 18+ peer dependency, full TypeScript declarations included). Two independent integration paths — wallet-connect (open source, free, no backend) and social sign-in (hosted, requires an API key) — that can be used alone or together through the same `` provider and hook API. This file is a self-contained integration spec: everything below is grounded in the actual package source, not paraphrased documentation. ``` npm install decane-connect-kit ``` **Building a React Native / Expo app?** That is a different package with a different API — no components, no hooks — and its own spec: https://kit.decane.app/llms-expo.txt (`decane-connect-kit-expo`). **Verifying users on your own backend?** That is the server-side package `decane-node`, summarised in Part 3 below — its full self-contained spec is at https://kit.decane.app/llms-node.txt. **Shipping apps to your own clients?** If you are an agency, builder or platform and each client needs their OWN isolated sign-in, there is a server-to-server provisioning API that creates a project and API key per client in one call: https://kit.decane.app/llms-connect.txt (`/connect/v1`). You do not need it for a single product. --- ## Version and freshness ```yaml version: 2.32.0 document-revision: 2026-11-16 canonical: https://kit.decane.app/llms.txt version-manifest: https://kit.decane.app/llms-version.json ``` Since 2.4.0 every social account also gets a **Tron** wallet — three wallets (EVM, Solana, Tron) from one sign-in, all derived from one key. Since 2.5.0 the SDK records a per-user **transaction history** you can read back. Since 2.6.0 **KingsChat** is a sign-in option alongside email and Google, and login-alone recovery is always on — a user who reinstalls gets their wallet back from signing in, so the old `serverAssistedRecovery` option is gone. Server-side token verification has its own package, **`decane-node`** (see Part 3). Since 2.26 sessions last **eight hours** and renew themselves while the user is active (see "Sessions"). Since 2.27 an app can choose the **identity tier** (`protection: 'identity'`): no passkey, no password, no recovery file — signing in is the whole ceremony (see "Protection tiers"). Wallet creation now waits for the enclave to enrol the wallet and throws `WalletEnrolmentError` instead of leaving a wallet that only ever worked on one device. `version` is the npm package version whose API surface this document describes. If you are working from a cached or previously-read copy of this file, compare its `version` against the one at `version-manifest` — a ~200-byte JSON document that is cheap to fetch. If the manifest reports a higher version, re-read this file before relying on it: the API surface has changed. The manifest also lists what changed in each release, so you can decide whether the delta affects you. This file is served as a plain-text document at the canonical URL above. It is not a download — fetch it directly, any time, no auth or headers required. --- ## Part 1 — Wallet connect (open source, free, no backend required) Detects installed wallets and manages CAIP-25 sessions across chains. Never uses `window.ethereum` — detection is via EIP-6963 (`window.addEventListener('eip6963:announceProvider', ...)`) for EVM, the Solana Wallet Standard for Solana, TronLink's injected provider for Tron, and Unisat/Xverse/OKX-style providers for Bitcoin. ### Minimal working setup ```tsx import { DecaneKit, useDecane, useWalletSelector, WalletSelector } from 'decane-connect-kit'; // 1. Wrap your app once function App() { return ( ); } // 2. Open the picker and read connection state from hooks // already renders and // internally — you never render them yourself, just control them via hooks. function ConnectButton() { const { isConnected, connectedWallet, activeChain, disconnect } = useDecane(); const { open } = useWalletSelector(); if (isConnected) { return (
Connected: {connectedWallet?.name} on {activeChain}
); } return ; } ``` `` takes one `config` prop of type `DecaneConfig`: ```ts interface DecaneConfig { chains?: ChainDescriptor[]; // custom chains to register at init supportedChainIds?: string[]; // restrict which built-in chains are available networks?: 'evm' | 'solana' | 'tron' | 'bitcoin' | 'all'; // overridden by `mode` when both set defaultChain?: string; // CAIP-2 id, e.g. 'eip155:1' theme?: 'light' | 'dark' | 'auto'; mode?: ConnectMode; // see ConnectMode below — default 'wallets' social?: SocialConfig; // required when mode includes '+social' or is 'social' } type ConnectMode = | 'all' | 'wallets' // 'wallets' is the default — all wallet types, no social | 'social' // social sign-in only, no wallet connect | 'evm' | 'solana' | 'tron' // single chain type, no social | 'evm+social' | 'solana+social' | 'tron+social' | 'evm+tron' | 'evm+tron+social'; ``` ### Hooks (all exported from `decane-connect-kit`) - **`useDecane()`** — connection state: `{ provider, wallets, evmWallets, solanaWallets, multiChainWallets, chains, connectedWallet, activeSession, activeChain, isConnected, theme, setTheme, connect(wallet, preferredChain?), disconnect(), addChain(chain), removeChain(chainId) }`. - **`useWalletSelector()`** — `{ isOpen, open(), close() }`, controls the built-in `` modal. - **`useChainSwitch()`** — `{ switchChain(chainId): Promise, loading, error, activeChain, grantedChains }`. Extends the current CAIP-25 session to include a new chain (calls `wallet_requestPermissions` under the hood, preserving any existing granted scope for that chain). - **`useSignMessage()`** — `{ signMessage(message: string, options?: { chainId?, account? }): Promise, signature, loading, error, reset() }`. - **`useSendTransaction()`** — `{ sendTransaction(tx: TxParams, options?: { chainId?, from? }): Promise, txHash, loading, error, reset() }`, where `TxParams = { to: string; value?: string; data?: string; gas?: string; gasPrice?: string }` (value as decimal or `0x`-hex wei). - **`useSignTypedData()`** — `{ signTypedData(typedData: { domain, types, message }, options?): Promise, signature, loading, error, reset() }`. EVM only — throws `DecaneErrorCode.EVM_ONLY_METHOD` (5031) if the active chain is Solana/Tron/Bitcoin. All four signing/session hooks resolve `chainId`/`account` from the active CAIP-25 session when not explicitly passed, and throw a `DecaneError` (see below) on failure — errors are also captured in the hook's own `error` state. ### CAIP-25 session model Connecting a wallet doesn't itself grant permissions — call `provider.request({ method: 'wallet_requestPermissions', params: [{ requiredScopes: {...}, optionalScopes: {...} }] })` (or use `useChainSwitch().switchChain(chainId)` for the common case of extending to one more chain). A granted scope looks like: ```ts interface ChainScope { methods: CAIP25Method[]; // subset of: wallet_sendTransaction, wallet_signMessage, wallet_signTypedData, wallet_requestPermissions, wallet_revokePermissions, wallet_getPermissions accounts: string[]; // CAIP-10, e.g. 'eip155:1:0xAbc...' or 'solana:mainnet:BxY3...' events?: string[]; } ``` `provider.activeSession` (`ActiveSession`) exposes `{ sessionId, grantedScopes, walletId, walletType, createdAt }`. Signing on a chain outside the granted scope throws `CHAIN_NOT_IN_SCOPE` (5011). ### Chains 64 built-in chains ship with the package: 59 EVM chains (`eip155:*` — Ethereum, Base, Arbitrum One + Nova, Optimism, BNB Chain, Polygon, Avalanche, plus ~50 more L2s/appchains including Blast, Scroll, zkSync Era, Linea, Mantle, Sei, Monad, Berachain, World Chain, Zora, and others — full list is `BUILT_IN_CHAINS` in the package source), 2 Solana clusters (`solana:mainnet`, `solana:devnet`), 2 Tron networks (`tron:mainnet`, `tron:shasta`), and 1 Bitcoin (`bip122:mainnet`). Named constants for all of them are exported as `CHAINS` (e.g. `CHAINS.ETHEREUM === 'eip155:1'`, `CHAINS.BASE === 'eip155:8453'`). Register a custom chain (e.g. a local devnet) via `provider.addChain(chain)` or the `config.chains` array: ```ts provider.addChain({ id: 'eip155:31337', type: 'evm', name: 'Localhost', chainId: 31337, nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrl: 'http://localhost:8545', isCustom: true, }); ``` `ChainDescriptor` shape: `{ id: string /* CAIP-2 */; type: 'evm'|'solana'|'tron'|'bitcoin'; name: string; nativeCurrency: { name, symbol, decimals }; rpcUrl?; blockExplorerUrl?; iconUrl?; chainId?: number /* EVM only */; isCustom?: boolean }`. ### `` (rendered automatically by ``) Props (for reference — you control it via `useWalletSelector()`, you don't render it yourself): `{ provider, open, onClose, onConnect, theme?, networks?, mode?, socialAuthMethods?, onGoogleSignIn?, onEmailStart?, onEmailVerify? }`. ### Errors `DecaneError extends Error` with a `code: DecaneErrorCode` field: | Code | Value | Meaning | |---|---|---| | `USER_REJECTED` | 4001 | User rejected the wallet prompt | | `UNAUTHORIZED` | 4100 | Not authorized for the requested method/chain | | `NO_ACTIVE_SESSION` | 5001 | Signing attempted before any session was granted | | `SCOPE_MISMATCH` | 5002 | Account not in the granted scope | | `SESSION_EXPIRED` | 5003 | Session expired, re-request permissions | | `UNSUPPORTED_CHAIN` | 5010 | Chain not registered (built-in or custom) | | `CHAIN_NOT_IN_SCOPE` | 5011 | Chain not included in the current granted session | | `INVALID_CHAIN_CONFIG` | 5012 | Malformed `ChainDescriptor` passed to `addChain` | | `NO_WALLET_CONNECTED` | 5020 | No wallet connected yet | | `WALLET_DISCONNECTED` | 5021 | Wallet disconnected mid-operation | | `PROVIDER_ERROR` | 5022 | Underlying wallet provider threw (wrapped) | | `METHOD_NOT_SUPPORTED` | 5030 | Unknown/unsupported CAIP-25 method | | `EVM_ONLY_METHOD` | 5031 | `wallet_signTypedData` called on a non-EVM chain | --- ## Part 2 — Social sign-in (hosted, Google/email embedded wallets) Non-custodial embedded wallets for users with no wallet installed at all. On first sign-in, a private key is generated client-side and immediately split with Shamir secret sharing into three shares — device (stored in IndexedDB, wrapped by a passkey or PIN), server (encrypted at rest on the key server), and recovery (the user's to keep) — any two of which reconstruct the key; one alone reveals nothing. Signing happens inside a TEE (Trusted Execution Environment, a hardware-isolated enclave) which reconstructs the key only in isolated memory, verifies it controls the account's recorded wallet, signs, and discards it — the full private key never exists in plaintext outside that enclave, and never touches the server's own process memory or disk. Requires an API key from the developer dashboard (has its own pricing — Free/Scale/Enterprise tiers, see https://kit.decane.app/pricing). ### Standalone usage (no React) ```ts import { createDecaneConnect } from 'decane-connect-kit'; const connect = await createDecaneConnect({ apiKey: 'dck_live_...', chains: ['evm:1', 'solana:mainnet'], // Chain = `evm:${number}` | `solana:'mainnet'|'devnet'` authMethods: ['google', 'email'], }); const { addresses, isNewUser, profile } = await connect.connectWithGoogle(); // addresses: { evm?: string; solana?: string } // profile: { name?: string; email?: string; picture?: string } | undefined const sig = await connect.signMessage({ chain: 'evm:1', message: 'hello' }); const txHash = await connect.sendTransaction({ chain: 'evm:1', to: '0x...', value: 1000000000000000n }); // ERC-20 transfer = a contract call: `to` is the token contract, value 0n, `data` is the encoded transfer(). import { Interface, parseUnits } from 'ethers'; const data = new Interface(['function transfer(address,uint256)']) .encodeFunctionData('transfer', [recipient, parseUnits('1.5', 6)]); // 6 = token decimals const erc20Hash = await connect.sendTransaction({ chain: 'evm:1', to: TOKEN_ADDRESS, value: 0n, data }); // Solana: sendTransaction is EVM-only. Build + serialize an unsigned tx, sign it (returns // broadcast-ready bytes), then broadcast yourself via @solana/web3.js: const signed = await connect.signSolanaTransaction(serializedUnsignedTx); // Uint8Array -> signed Uint8Array // await new Connection(rpcUrl).sendRawTransaction(signed); ``` `createDecaneConnect(config: DecaneConnectConfig): Promise` throws a plain `Error` (not `DecaneConnectError`) if `apiKey` is missing or `chains` is empty. **`DecaneConnectConfig`** (full shape): ```ts interface DecaneConnectConfig { apiKey: string; chains: Chain[]; authMethods: Array<'google' | 'email'>; apiBaseUrl?: string; // default: https://api.decane.app — self-host override only sessionDurationMinutes?: number; // default: 480 (capped by the JWT and signer TTL) promptPin?: () => Promise; // required if the browser has no passkey support rpId?: string; // WebAuthn RP ID, defaults to window.location.hostname rpName?: string; // WebAuthn RP display name rpcUrls?: Record; // override built-in public RPCs per chain teeUrl?: string; // tests/self-hosted only; default is the enclave the signed manifest names (2.33.0), and an override is still attested against that manifest // Require a fresh passkey assertion for EVERY signature (TEE-verified, // single-use 60s challenge) instead of letting an unlocked session sign // freely until expiry. Does NOT shorten the session — see "Signing // authority model" below. Default false. Needs a passkey; PIN-only wallets // have no authenticator to assert with and signing fails rather than // falling back. Also available as SocialConfig.requireAssertionPerSignature // on the React path. requireAssertionPerSignature?: boolean; // How this device holds its share of the wallet — see "Protection tiers". // 'device' (default): wrapped at rest under a passkey or the unlock password. // 'identity': nothing stored, nothing asked; every visit is a sign-in and the // enclave provisions a fresh share against it. Same key either way. protection?: 'identity' | 'device'; /** @deprecated alias for protection: 'identity' */ deferDeviceProtection?: boolean; // Resume the live session in a NEW tab, not only after a reload. Default // false in the device tier, true in the identity tier. The session handle is // the signing credential, so this widens where it can be read from one tab // to the whole origin — pair with requireAssertionPerSignature if that matters. resumeSessionAcrossTabs?: boolean; persistSession?: boolean; // default true — reload resumes the session // Recovery. The key is split 2-of-3 (device/server/recovery). A user on a new // device is restored by signing in (the enclave holds a sealed share — "Flow // S"); a synced passkey (Flow A) and a saved recovery file (Flow B) are the // fallbacks. Flow B requires the two callbacks marked below. offerRecoveryAtSignup?: boolean; // default false since 2.7.4 — opt in to offer a recovery file at signup onRecoveryShareOffer?: (addresses: { evmAddress: string; solanaAddress: string }) => Promise<{ wants: boolean; password?: string; passwordHint?: string }>; onRecoveryFileReady?: (file: RecoveryShareFile, filename: string) => Promise; promptForRecoveryFile?: () => Promise<{ file: RecoveryShareFile; password: string } | null>; // Flow B onRecoveryRotated?: (addresses: { evmAddress: string; solanaAddress: string }) => Promise<{ password: string; passwordHint?: string }>; // Flow B — REQUIRED; recovery throws without it onRecoveryProgress?: (event: RecoveryProgress) => void; } ``` **`DecaneConnect`** (the object `createDecaneConnect` resolves to) — full method set: ```ts interface DecaneConnect { connect(): Promise; // opens whichever authMethods are configured connectWithGoogle(): Promise; connectWithEmail(email: string): Promise<{ codeRequired: true }>; verifyEmailCode(email: string, code: string): Promise; connectWithToken(token: string, opts?: { providerId?: string }): Promise; // custom auth — see below linkWithToken(token: string, opts?: { providerId?: string }): Promise<{ alreadyLinked: boolean; id?: string }>; // 2.30.0, linked logins listLinkedLogins(): Promise; unlinkLogin(id: string): Promise; unlock(): Promise; // re-authenticate an expired session isUnlocked(): boolean; sessionExpiresAt(): number | null; signMessage(req: SignMessageRequest): Promise; // EVM, Solana, or Tron chain. message: string | Uint8Array — on EVM/Tron the enclave hashes TEXT, so bytes must be valid UTF-8 (decoded losslessly; SIWE and every hex personal_sign a dApp sends qualify) or the call throws CallSequenceError. Solana signs raw bytes. sendTransaction(req: SendTransactionRequest): Promise; // EVM; auto-records to history signSolanaTransaction(tx: Uint8Array): Promise; signTronTransaction(rawDataHex: string): Promise; // sign a TronWeb-built tx's raw_data recordTransaction(tx: RecordTransactionInput): Promise; // record a tx you broadcast getTransactionHistory(limit?: number): Promise; // most recent first disconnect(): Promise; getAddresses(): { evm?: string; solana?: string; tron?: string } | null; // three wallets rotateShares(opts: { password: string; passwordHint?: string }): Promise; // new recovery file; invalidates the old one. Needs a fresh WebAuthn assertion. exportPortableBackup(opts: { password: string; passwordHint?: string }): Promise; // two-share bearer file (device+recovery); also rotates the set hasRecoveryShare(): Promise; // UX flag — has the user ever saved a recovery file shouldPromptRecovery(): Promise; // true at most once — time to nudge saving one dismissRecoveryPrompt(): Promise; // call regardless of answer; the nudge fires once ever hasBackup(): Promise; // is a server-side wrapped-share backup present (Flow A) deleteBackup(): Promise; // delete it — disables Flow A passkey-sync recovery on(event: SdkEvent, handler: (...args: unknown[]) => void): void; off(event: SdkEvent, handler: (...args: unknown[]) => void): void; } // ConnectResult = { addresses: { evm?: string; solana?: string; tron?: string }; isNewUser: boolean; profile?: AuthProfile } // AuthProfile = { name?: string; email?: string; picture?: string } — pass-through from the provider, never stored // SdkEvent = 'connected' | 'disconnected' | 'session-expired' | 'session-renewed' | 'session-started' // | 'wallet-creating' | 'wallet-unlocking' | 'enrolment-failed' | 'migrated-to-identity' // TransactionRecord = { id, chain, kind, txHash, to, value, status, metadata, createdAt } // RecordTransactionInput = { chain, txHash?, to?, value?, kind?, status?, metadata? } ``` **Three wallets from one sign-in.** Every account has an EVM address, a Solana address, and a Tron address — the Tron and EVM addresses share one secp256k1 key (Tron is the EVM address re-encoded), so there is no extra key to manage. `getAddresses()` returns all three. Tron uses CAIP-style chain ids `tron:mainnet` (also `tron:shasta` / `tron:nile`); `signMessage` accepts a Tron chain, and `signTronTransaction(rawDataHex)` signs a transaction you built with TronWeb (the enclave computes the txID and signs — you broadcast the result). **Transaction history.** `sendTransaction` records itself automatically. For Solana/Tron transactions your dApp broadcasts, call `recordTransaction({ chain, txHash, to?, value?, metadata? })` so they appear in the user's history; read it back with `getTransactionHistory()`. This is a plain data API — the SDK renders no history UI; you build it. Records are keyed by `(user, txHash)`, so re-recording a hash with a new `status` updates in place. Email sign-in is the two-step `connectWithEmail(email)` → `verifyEmailCode(email, code)` flow — a 6-digit code is emailed, `connectWithEmail` always resolves the same way regardless of whether the address has an account (prevents email enumeration). > Note: the package also exports standalone `startEmailAuth`/`verifyEmailCode` functions, but their first parameter is an internal `ApiClient` type that isn't part of the public API — use `DecaneConnect.connectWithEmail()`/`.verifyEmailCode()` instead (shown above), not the standalone functions. ### React usage ```tsx import { DecaneKit, useSocialAuth, SocialWalletModal } from 'decane-connect-kit'; function App() { return ( ); } function SignInButton() { const { isConnected, addresses, signInWithGoogle, googleLoading } = useSocialAuth(); if (isConnected) return
Signed in: {addresses?.evm}
; return ; } ``` - **`useSocialAuth()`** — sign-in flow: `{ isConnected, isUnlocked, isNewUser, profile, providerSubject, addresses, sessionExpiresAt, needsReconnect, canUsePasskey, phase: "creating" | "unlocking" | null, isCreatingWallet, googleLoading, kingschatLoading, xLoading, emailLoading, phoneLoading, tokenLoading, customLoading, customAuthLabel, error, clearError(), signInWithGoogle(), signInWithKingsChat(), signInWithX(), sendEmailCode(email): Promise<{codeRequired:true}>, confirmEmailCode(email, code), sendPhoneCode(phone): Promise<{codeRequired:true}>, confirmPhoneCode(phone, code), signInWithToken(token, opts?), signInWithAccessToken(token), signInWithCustomAuth?(), signInWithPasskey(), unlock(), disconnect() }`. `signInWithCustomAuth` is `undefined` unless `social.customAuth` is configured. `canUsePasskey` is true when this device can sign the remembered user back in with one passkey prompt — see "Signing back in after sign-out". - **`useSocialWallet()`** — sign-in + signing + modal control: everything in `useSocialAuth()` plus `{ modalOpen, openModal(), closeModal(), signMessage(chain, message), sendTransaction(req), signTypedData(req), signAuthorization(req), signSolanaTransaction(tx), signTronTransaction(rawDataHex), getEthereumProvider(opts?): Eip1193Provider, getBalance(chain?), getBalances(), recordTransaction(tx), getTransactionHistory(limit?), getAccessToken(): string | null, hasPasskey(), addPasskey(), deviceProtected(), protectDevice(), setUnlockPassword(password), canUnlockWithPassword(), unlockWithPassword(password), removeUnlockPassword(), forgetLastUser(), rotateShares({ password, passwordHint? }), exportPortableBackup({ password, passwordHint? }), hasRecoveryShare(), shouldPromptRecovery(), dismissRecoveryPrompt(), loading, error, clearError() }`. Passkey and password methods are per DEVICE: `addPasskey`/`setUnlockPassword` need a live session; `canUnlockWithPassword`/`unlockWithPassword` and `signInWithPasskey` are the signed-out pair that open one without an identity provider. `` is rendered automatically by `` (props: `{ open, onClose, theme?, socialAuth, onUnlock, onDisconnect }`) — control it via `useSocialWallet().openModal()`/`.closeModal()`, don't render it directly. ### Signing back in after sign-out `disconnect()` ends the session (revokes the JWT, drops it) but deliberately keeps the device's passkey-wrapped or password-wrapped share, so a returning user is one prompt from a session instead of a full sign-in. Since 2.22 it also remembers WHICH account signed out. That is what lets `canUsePasskey` / `canUnlockWithPassword` offer that account's own way back even when several accounts are enrolled on the same browser — before, with more than one enrolled, the kit refused to guess and both read false. The remembered id is a lookup key, not a credential: `signInWithPasskey` still needs a server-verified WebAuthn assertion and `unlockWithPassword` still needs the password. - Offer the shortcut when `canUsePasskey` (prefer it) or `await canUnlockWithPassword()` is true; fall back to the full method list otherwise. - "Use a different account" = `forgetLastUser()`. It drops the memory so the previous account stops being offered, and recomputes `canUsePasskey`. Device shares are untouched. - Only the explicit entry points consult the memory. `connect()`/`unlock()` keep the strict lookup, so an ordinary sign-in never silently re-offers the account the user just left. ### Sessions — since 2.26.0 An access token lasts **eight hours**. The SDK renews it at 75% of its life while the user is active (`POST /auth/refresh`, emitting `session-renewed`), and the backend caps the chain at **seven days** from the sign-in, after which the user signs in again. The enclave's signing session has its own life; when it lapses with the token still valid, `unlock()` reopens it without a sign-in (no prompt in the identity tier; the passkey/password in the device tier). With `resumeSessionAcrossTabs` a new tab resumes the live session instead of reading as signed out. `disconnect()` stops the renewal. ### Sign-in only, no wallet — `wallet: 'on-demand'` (since 2.33.0, `next` tag) Every sign-in method (email, phone, Google, X, KingsChat, custom JWT) without creating a wallet, Clerk-style. In `decane-connect-kit` 2.33.0, published under the `next` tag (`npm install decane-connect-kit@next`) until it moves to `latest`. Set `wallet: 'on-demand'` in the client config (or `config.social` for ``): sign-in gives a session (`getAccessToken()`, profile, renewals) and calls no enclave. - `isSignedIn()`, `hasWallet()`; `ConnectResult.hasWallet`; `getAddresses()` is null until there is a wallet. - `createWallet()` gives the same account a wallet later (or opens the one it already has); emits `wallet-creating` then `wallet-created`. - Signing or `unlock()` with no wallet throws `NoWalletError` (code `NO_WALLET`). - React: `useSocialAuth()` / `useSocialWallet()` add `isSignedIn`, `hasWallet`, `createWallet`; the modal shows a signed-in screen for accounts with no wallet. - Same in the Expo SDK. - Pricing: users without a wallet are billed apart from wallet users: free up to 10,000 a month, then $25/month with 10,000 included and $0.02 per user above. ### Protection tiers — since 2.27.0 (`deferDeviceProtection` since 2.23.0) Every wallet is a 2-of-3 split {device, server, recovery}. At creation the recovery share is sealed by the enclave ("enrolment"); with it, `/signer/provision` hands any signed-in session a fresh device share on the JWT alone. The tier is **how this device holds that share** — never which key the wallet is. | | `protection: 'device'` (default) | `protection: 'identity'` | |---|---|---| | At creation | share wrapped under a passkey (or `promptUnlockPassword`) | nothing stored, nothing asked | | Later visits | passkey/password unlock, or sign in | sign in; the enclave provisions | | `requireAssertionPerSignature` | available | not applicable | | Lost device | sign in again | sign in again | **The identity tier's security statement, verbatim:** a wallet is exactly as safe as the user's identity-provider account plus Decane (the JWT signing key and the attested enclave). Anyone who can obtain a valid Decane session for the user can sign. There is no device-bound factor. Mitigations: a new-device email on every provision from an unseen device, a per-user freeze switch operated by Decane, and (follow-up) a fresh sign-in requirement for high-value operations. Do not choose it where a stolen Google session must not be enough to move funds. - The tier belongs to **this client, not the wallet**: two apps on one project can hold the same wallet in different tiers (a marketplace with passkeys, a social app without). Same key, same addresses. A per-signature assertion declared by one app protects that app's sessions, not the wallet. - Switching an app to `'identity'` ports users on their next sign-in with no loss of funds: an enrolled wallet provisions silently; one never enrolled but holding a wrapped share on this device is unlocked ONE last time, enrolled, and never prompted again (`migrated-to-identity` fires). Nothing is re-split, rotated or moved. - In the identity tier `canSignInWithPasskey()` is false, `signInWithPasskey()` and `addPasskey()` throw `CallSequenceError`, `protectDevice()` is a no-op returning false, and `offerRecoveryAtSignup` is ignored. - The device tier keeps the deferred pattern for apps that want the passkey asked at their own moment: `deviceProtected()` / `protectDevice()` on `useSocialWallet()` — `protectDevice()` needs a live session, provisions a share from the enclave if the device has none, wraps it (passkey, else password), resolves false on a dismissed prompt, and is idempotent. - **Creation waits for enrolment, in every tier** (since 2.27.0): the server share is uploaded as provisional, the enclave seals the recovery share (three attempts, no retry on 429/403), and only then does the session open. On failure the SDK throws `WalletEnrolmentError`, deletes any share it stored, and the backend still reports no wallet — the next sign-in creates afresh. Before, a failed enrolment left a wallet that could never be provisioned to another device. The server's `wallet_created` event records the tier as `unlockMethod: "identity" | "passkey" | "password"`. ### Handing a session to another app of the same project — since 2.24.0 Two apps of one Decane project are one identity, and often one host (`/` and `/square`). Since 2.24.0 the client keys everything it persists — the remembered identity, the last signed-out user, the live session — by the **app id**, not the API key, so two apps under different keys on one origin see the same signed-in user, and a same-tab navigation between them resumes the full session with no prompt. (What an older build wrote under the key is read once and moved.) For everything else — a new tab, a different origin, a lapsed session — the sending app puts its access token in the URL and the receiving app adopts it: ```ts // sender: the same token every API call carries as a Bearer location.assign(`/square?decane_token=${encodeURIComponent(getAccessToken()!)}`); // receiver, on load const token = new URLSearchParams(location.search).get("decane_token"); if (token) { history.replaceState(null, "", location.pathname); // out of the address bar at once if (!isConnected) await signInWithAccessToken(token); // useSocialAuth() } ``` - `connectWithAccessToken(token)` / `signInWithAccessToken(token)`: signed in at once — `addresses`, `getAccessToken()` and every Bearer call work — but **not unlocked**. The first `unlock()` or signing call provisions or unwraps the device share as an ordinary returning sign-in would; with `deferDeviceProtection` that prompts for nothing. - The backend judges the token: a revoked or foreign one throws `InvalidAccessTokenError` (`INVALID_ACCESS_TOKEN`), as does one that is expired or not a Decane token. The session lasts as long as the token (at most eight hours by default); when it lapses the client emits `session-expired` and `needsReconnect` reads true. - Strip the parameter from the URL immediately and never log it: it is a bearer credential for its remaining lifetime. ### Signing authority model — per-signature assertion since 2.2.0 Two modes, and the distinction matters when comparing against other embedded-wallet SDKs. **Default (session authority).** `unlock()` opens a TEE session with a TTL (`sessionDurationMinutes`, default 480, settable on `` since 2.29.2; the effective lifetime is the shortest of this, the JWT expiry and the signer TTL, so `sessionExpiresAt` is the value to trust). For that window a live session is sufficient authority: signatures need no further prompt. Authority is bounded by *time* and dies on expiry or `pagehide` — it is not standing. **`requireAssertionPerSignature: true` (per-signature authority).** The session still stays warm — this is the point, since tearing it down would cost a fresh TDX attestation and a full re-auth per signature — but a live session stops being sufficient. Each signature requires a fresh WebAuthn assertion answered against a single-use, 60-second challenge, verified *inside the enclave* (the same gate already protecting `rotateShares` / `exportPortableBackup`). Client-side refusal is not the mechanism; the TEE will not sign without it. ```ts // standalone await createDecaneConnect({ apiKey, chains, authMethods, requireAssertionPerSignature: true }); // React ``` Consequences worth stating explicitly: - **It does not shorten the session.** The countdown is unchanged; `sessionDurationMinutes` is the separate knob for that. Turning this on and expecting a shorter timer is the common misreading. - **Multi-step flows prompt per leg.** ERC-20 approve + swap is two prompts. - **Requires a passkey.** PIN-only wallets fail rather than degrade. - **A declined prompt is not an expired session.** It surfaces as `ExportNotAuthorizedError` and the session handle stays valid, so no reconnect is forced. - **Scope limit, stated plainly:** the policy is declared by the client at session open. It makes a leaked session *handle* worthless without the authenticator, but a fully compromised page could open a session without the flag. Server-sourced policy (per user / per project) would be needed to make it unbypassable; not implemented. Requires TEE signer v0.2.3+. Sessions that don't opt in behave exactly as before, so older clients are unaffected. ### Custom auth (bring your own JWT issuer) — since 2.1.0 Instead of Google/email, a dApp can sign users in with a token from its own identity system (Auth0, Clerk, Firebase, Cognito, or its own backend). The developer registers an issuer + JWKS URL against their project in the dashboard; the SDK exchanges a token that issuer already signed for a Decane session. Everything downstream — wallet creation, signing, recovery — is identical to Google/email sign-in. Decane never sees a credential, only a signed token, its issuer, and one claim. The user's wallet is derived from `HMAC(providerId + ':' + )`, so the same claim value always resolves to the same wallet. The dashboard therefore treats `issuer` and `identity_claim` as immutable after creation, and refuses to delete a provider that has users (disable it instead) — changing either would silently re-identify existing users onto empty wallets. Two ways to use it: ```tsx // A. Built-in UI — renders a button in WalletSelector and SocialWalletModal // alongside Google/email. getToken() runs when the user clicks it. ', mode: 'all', social: { apiKey: 'dck_live_...', authMethods: ['google', 'email'], customAuth: { label: 'Continue with Acme Inc', // button text providerId: undefined, // only needed with >1 provider configured getToken: async () => (await myAuthClient.getSession()).accessToken, }, }, }}>{children} // B. Headless — you already have the token, drive your own UI const { signInWithToken, tokenLoading } = useSocialAuth(); await signInWithToken(token /*, { providerId } */); // ...or with no React at all: const { addresses, isNewUser } = await connect.connectWithToken(token); `profile` carries who the provider says the user is — `{ name?, email?, picture? }` — and is **absent** when the provider released nothing (email sign-in always, and Google when the user withheld it). Decane never stores it: the backend keeps only an HMAC and a masked identifier, so there is no profile to fetch later. Cache what you need at sign-in if you want to greet the user by name after a reload. ``` `SocialConfig.customAuth?: { label: string; providerId?: string; getToken: () => Promise }`. `providerId` is only required when a project has more than one enabled provider — with several configured the backend will not guess, because trying each issuer in turn would let a token from a weak provider be accepted as if it came from a strong one. The backend (`POST /auth/external`) verifies, in order: signature against the published JWKS (key rotation handled automatically — an unrecognized `kid` triggers a refetch), issuer, expiry, audience if one is configured, and that the identity claim is a non-empty string or number. Failures 1–4 collapse into one opaque `INVALID_TOKEN` so error messages can't be used to probe for forgeable gaps. Config-level problems report distinctly: `NO_PROVIDER`, `AMBIGUOUS_PROVIDER`, `MISSING_CLAIM`. The JWKS URL must return a standard key set and must be `https://` (or localhost in dev) — a downgraded fetch would let an on-path attacker serve a forged key set and mint tokens for any user: ```json { "keys": [ { "kty": "RSA", "kid": "key-1", "use": "sig", "alg": "RS256", "n": "0vx7ago...", "e": "AQAB" } ] } ``` EC keys work too (`kty: "EC"`, `crv`, `x`, `y` instead of `n`/`e`). The `kid` must match the JWT header's `kid`. Multiple keys in the array is how rotation works. Always set `exp` on the tokens you issue, and keep it short. Sign-in still accepts a token without one, and logs it; linking a login refuses one. ### Linked logins: one wallet, email and phone — since 2.30.0 An account is keyed by the login it was created with, so the same person signing in by email and by a phone number your backend verified would reach two different wallets. Linking fixes that: while someone is signed in, attach a login from your own provider to their account, and from then on that login opens the same wallet. ```ts // Signed in (by email, Google, anything). Your backend verified their phone // and signed a fresh token for it with your custom-auth issuer. const { linkWithToken, listLinkedLogins, unlinkLogin } = useSocialAuth(); await linkWithToken(phoneToken /*, { providerId } */); // { alreadyLinked, id? } // Later, signed out: the phone token opens the same account and wallet. await signInWithToken(phoneToken); ``` - `linkWithToken(token, opts?)` needs a signed-in session. The token must be fresh: it carries `exp` and `iat` and was issued in the last ten minutes (30 s of clock skew allowed). Linking one already on this account is a no-op (`alreadyLinked: true`). - A login that already opens a different account throws `LoginInUseError` (`LOGIN_IN_USE`). Decane never merges accounts: each is its own key and its own addresses, so merging would mean choosing a wallet to abandon. - `listLinkedLogins()` returns `{ id, providerId, providerName, identifier (masked), linkedAt }[]`. `unlinkLogin(id)` removes one, for "change my number": unlink the old, link the new. The login an account was created with cannot be removed. - Headless: `connect.linkWithToken`, `connect.listLinkedLogins`, `connect.unlinkLogin`. Server: decane-node `linkExternalLogin(accessToken, token, opts?)`, `listLinkedLogins(accessToken)`, `unlinkLogin(accessToken, id)` (1.6.0), and the same in Python and Rust (1.1.0). - Backend: `POST /auth/link/external` `{ token, providerId? }`, `GET /auth/link/external`, `DELETE /auth/link/external/:id`, each with `X-API-Key` and the user's Bearer token. - Use a stable id as the identity claim (`sub` = your user id), not the phone number itself: carriers recycle numbers, and an id lets a person change theirs without losing the wallet. - Whoever holds your issuer's signing key can sign in as any of those logins, and Decane provisions a new device from a sign-in alone. Keep the key in a secret manager and issue tokens that live minutes, not hours. ### Which enclave, and how it is checked — since 2.33.0 The SDK no longer has the enclave's URL or measurements built in. They come from a **signed enclave manifest**: a small JSON document listing the enclave URL, the approved OS measurements (MRTD, RTMR0-2) and the approved app id and compose hashes, signed (ECDSA P-256) with a key Decane keeps offline. Only the public keys are pinned in the package. - The SDK fetches it from `GET {apiBaseUrl}/attestation/manifest` and uses it only if a signature verifies against a pinned key and its `version` is not lower than the highest this browser has accepted (kept in localStorage). Otherwise it uses the last accepted manifest, then the one bundled in the package; with none it talks to no enclave (`AttestationError`). - The backend serves the manifest but cannot change it. - Moving the enclave or changing what it runs is a newly signed manifest, not a package release. Attestation reads the measurements from the Intel-verified quote itself: signature chain and TCB status (DCAP, in the browser), the nonce, MRTD and RTMR0-2 against an approved OS, the enclave's dstack event log replayed to the quote's RTMR3, and the app-id and compose-hash recorded at boot against the manifest. The instance id, which changes on every restart, is not pinned. Before 2.33.0 the SDK compared a measurement string the enclave reported about itself, which any TDX machine could claim. The verifier is one dependency-free file shared by every Decane client and the backend: `infra/enclave-evidence.ts` (`openManifest`, `verifyEvidence`). ### Gas sponsorship — since 2.32.0 (early access) In `decane-connect-kit` 2.32.0 and later (`npm install decane-connect-kit`). EVM only, Base (8453) first. Self-serve from the dashboard, project page "Gas sponsorship" (owner only): set a payout wallet (required before it can be turned on), switch it on, set caps (per transaction, per user per day, per project per day), and top up the prepaid gas tank in a stablecoin ($10 to $10,000; USDC on Base, Ethereum, Arbitrum, Polygon or Solana, or USDT on Tron). Sponsored sends are paid from the tank; an empty tank stops sponsoring and nothing is billed afterwards. When a user pays the gas in a token, the payment goes to the payout wallet and the owner's markup on that token (0 to 50%) is the project's to keep. On the CLIENT (the object `createDecaneConnect()` returns); the React hooks do not expose it yet. ```ts // The project pays the gas (default). One call, or several in `calls`, atomically. const { userOpHash, transactionHash, success } = await decane.sendSponsoredTransaction({ chain: 'evm:8453', to, data, value, // or: calls: [{ to, data, value }, …] payGasWith: { token: USDC }, // optional: the user pays the fee in a token }); await decane.getSponsorshipStatus('evm:8453'); // { enabled, reason? } e.g. reason 'PROJECT_SUSPENDED' await decane.quoteGasInToken({ chain: 'evm:8453', token: USDC, gas }); // { token, maxAmount } ``` Config: `social.gasSponsorship = { payGasWith?: 'sponsor' | { token }, routeSendTransaction?: boolean }`. `payGasWith` defaults to `'sponsor'`. `routeSendTransaction: true` sends ordinary `sendTransaction` through sponsorship too, which then resolves ON INCLUSION (up to 120 s) instead of on broadcast; default false. - Resolves once the operation is on chain; throws with the sponsor's reason when the project's policy refuses the send. - The wallet stays the same EOA and address: its first sponsored send delegates it to Simple7702Account (EIP-7702) in the same ERC-4337 operation. A wallet already delegated to another contract is refused. - The SDK uses only the EntryPoint (v0.8), paymaster and 7702 delegate pinned in the package and refuses a config naming anything else; the paymaster in each answer must equal the pinned one. - Paying in a token approves at most twice the worst-case fee, never unlimited. - Requests go through `POST /sponsor/v1/:chainId/rpc` (and `GET …/config`) on the backend with the session's token; no sponsor credential ever reaches the client. Only the session's own wallet can be sponsored; 120 calls a minute per session; frozen wallets and suspended projects are refused. ### Errors All extend `DecaneConnectError` (`{ code: string; message: string; retryable: boolean }`): | Class | code | retryable | Trigger | |---|---|---|---| | `InvalidApiKeyError` | `INVALID_API_KEY` | no | API key is invalid or revoked | | `OriginNotAllowedError` | `ORIGIN_NOT_ALLOWED` | no | Calling origin isn't in the API key's allowlist | | `SessionExpiredError` | `SESSION_EXPIRED` | yes | Session TTL elapsed — call `unlock()` | | `UnlockRequiredError` | `UNLOCK_REQUIRED` | yes | Signing attempted before unlocking | | `ReconnectRequiredError` | `RECONNECT_REQUIRED` | yes | Session ended and JWT expired — sign in again | | `UserCancelledError` | `USER_CANCELLED` | yes | User dismissed a passkey/PIN/OAuth prompt | | `WebAuthnNotSupportedError` | `WEBAUTHN_UNSUPPORTED` | no | Browser has no WebAuthn support and no `promptPin` configured | | `InvalidPinError` | `INVALID_PIN` | yes | Incorrect PIN entered | | `CallSequenceError` | `CALL_SEQUENCE` | no | SDK methods called out of order (e.g. signing before connecting) | | `NetworkError` | `NETWORK` | yes | Request to the backend failed | | `ShareCorruptedError` | `SHARE_CORRUPTED` | no | Locally stored device share is corrupted | | `NewDeviceError` | `NEW_DEVICE` | no | No device share found on this device — re-authenticate to provision it | | `PromptPinNotConfiguredError` | `PROMPT_PIN_NOT_CONFIGURED` | no | Passkey unavailable and no `promptPin` callback was provided | | `AttestationError` | `ATTESTATION_FAILED` | no | the enclave's quote failed verification, it runs something the signed manifest does not approve, or no trusted manifest was available | | `RecoveryFailedError` | `RECOVERY_FAILED` | yes | Recovery flow failed | | `InvalidRecoveryFileError` | `INVALID_RECOVERY_FILE` | no | Uploaded file isn't a valid recovery file | | `WrongPasswordError` | `WRONG_PASSWORD` | yes | Incorrect password for the recovery file | | `RecoveryWalletMismatchError` | `RECOVERY_WALLET_MISMATCH` | no | Recovery file is for a different wallet than the signed-in account | | `ExportNotAuthorizedError` | `EXPORT_NOT_AUTHORIZED` | yes | Export needs a fresh security check first | | `WalletEnrolmentError` | `WALLET_ENROLMENT_FAILED` | yes | Creation stopped: the enclave did not seal the wallet's share. Nothing was created — sign in again (2.27.0) | | `ProvisioningRateLimitedError` | `PROVISIONING_RATE_LIMITED` | yes | `/signer/provision` answered 429 — too many devices/tabs this hour; the wallet is fine, wait and sign in again. Never a new-device dead end (2.27.0) | | `EnclaveHttpError` | `ENCLAVE_HTTP` | 5xx only | Any other non-OK enclave answer; `.status` carries the HTTP status (2.27.0) | | `StaleDeviceShareError` | `STALE_DEVICE_SHARE` | yes | This device's share is from a superseded set; cleared, re-recover | | `InvalidAccessTokenError` | `INVALID_ACCESS_TOKEN` | no | `connectWithAccessToken` given a revoked or foreign token | --- ## Part 3 — Server-side token verification (`decane-node`) When a signed-in user calls your own backend, send the Decane access token (`getAccessToken()` on the client) as `Authorization: Bearer ` and verify it server-side with the **`decane-node`** package — the `@privy-io/node` equivalent. `npm install decane-node` (Node 18+). ```ts import { DecaneClient } from 'decane-node'; // Two verification modes: // 1. Static verification key (Privy-style, offline) — copy your project's ES256 // public key from the dashboard (API Keys page) into DECANE_VERIFICATION_KEY. // 2. JWKS (default) — omit the key; the SDK fetches/caches Decane's public JWKS. // appId is checked against the token's project_id (the audience-equivalent). const decane = new DecaneClient({ appId: process.env.DECANE_APP_ID, verificationKey: process.env.DECANE_VERIFICATION_KEY, // optional; JWKS if unset }); const claims = await decane.verifyAccessToken(token); // throws DecaneAuthError if invalid claims.userId; // stable Decane user id (uid) // Or fail-closed without throwing, and resolve addresses: const safe = await decane.safeVerifyAccessToken(token); // DecaneClaims | null const user = await decane.getUser(token); // { id, addresses, linkedAccounts } ``` `verificationKey` also reads from the `DECANE_VERIFICATION_KEY` env var, so a backend can pass only `appId` in code. A standalone `verifyAccessToken({ token, appId, verificationKey })` is also exported for a drop-in replacement of Privy's function. npm: https://www.npmjs.com/package/decane-node Since decane-node 1.2.0 the server can also **sign users in** — email OTP, Google/KingsChat token exchange, and custom-auth JWT exchange run as pure HTTP with the project's `dck_` API key (`new DecaneClient({ appId, apiKey })` then `connectWithEmail`/`verifyEmailCode`, `connectWithGoogleToken`, `connectWithKingsChatToken`, `connectWithToken`). Browser-bound flows (Google redirect, KingsChat popup, passkeys) and wallet creation/signing remain client-side. This is a summary. The full `decane-node` spec — sign-in methods, verification modes, error codes, config env fallbacks, revocation caveats, Privy migration — is its own self-contained document at https://kit.decane.app/llms-node.txt (human docs: https://kit.decane.app/node-docs). --- ## Part 4 — Decane RPC (live on Base; more chains as they go live) Standard Ethereum JSON-RPC over HTTP, no SDK needed: `POST https://backend.decane.app/rpc/v1/{chainId}/{key}` with an RPC-only key (`dck_rpc_…`: a secret key whose only scope is `rpc`, see Part 5). Works as the transport URL in viem, ethers, wagmi, MetaMask, Hardhat or Foundry. From a server, any key with the `rpc` scope (including one that does everything) calls `POST https://backend.decane.app/rpc/v1/{chainId}` with `Authorization: Bearer `. A key with any server scope is refused in the URL form (403, -32003): URLs end up in frontend code, logs and browser history. - Plans, per ACCOUNT (the project owner), shared across all its projects and keys: Free 20 requests/s; Builder Club 200 requests/s (free, by application from the dashboard). - A batch holds at most 10 calls and counts one request per call; a batch with any method not served is refused whole. - Served: eth_call, eth_estimateGas, eth_getBalance, eth_getCode, eth_getTransactionCount, eth_getStorageAt, eth_getLogs, eth_getProof, eth_blockNumber, eth_getBlockByNumber/Hash, eth_getBlockReceipts, eth_getBlockTransactionCountByNumber/Hash, eth_getTransactionByHash, eth_getTransactionReceipt, eth_getTransactionByBlock{Number,Hash}AndIndex, eth_getUncleCountByBlock{Number,Hash}, eth_gasPrice, eth_maxPriorityFeePerGas, eth_feeHistory, eth_blobBaseFee, eth_createAccessList, eth_sendRawTransaction, eth_chainId, net_version, web3_clientVersion, eth_syncing. - Not served: signing with node keys (eth_sign*, personal_*, eth_accounts, eth_sendTransaction), debug/trace, txpool, filters, subscriptions, WebSockets. - Limits: eth_getLogs at most 10,000 blocks per call (-32602 otherwise); request body at most 1 MB (blob transactions not served); answers over 10 MB refused. - Errors (HTTP / JSON-RPC code): 400 -32700 bad JSON; 400 -32600/-32601/-32602 invalid request, method not served, bad params; 401 -32003 unknown or revoked key; 404 -32004 chain not served; 413 -32600 body over 1 MB; 429 -32005 over the plan's rate, with `Retry-After: 1` (refused calls are not billed); 503 upstream unavailable or busy. - Usage per key, chain, method and day appears in the dashboard within about a minute. Billing will be per request; no price is set yet. --- ## Part 5 — Secret keys and scopes A project has ONE kind of secret key; each key carries scopes saying what it may do. Make them on the project's API keys page in the dashboard (shown once, stored hashed, at most 20 live per project). One key per job is suggested; one key for everything is allowed. | Scope | Allows | |---|---| | `users:read` | `GET /v1/app/users`, `/v1/app/users/emails`, `GET /v1/app/users/:id/metadata` and `/preferences` | | `users:write` | `PATCH`/`PUT` metadata and preferences, `POST /v1/app/users/:id/unsubscribe` | | `users:create` | `POST /v1/app/users` | | `wallets:create` | `POST /v1/app/users/:id/wallet`, and `POST /v1/app/users` unless `createWallet: false` | | `payments` | Decane Payments: `POST /v1/app/checkout`, `/v1/app/withdrawals`, `/v1/app/deposit-addresses`, `GET /v1/app/payments[/:id]` and `/payments/options` | | `rpc` | Decane RPC (Part 4) | - Presets: Server API (the server scopes), RPC only (`rpc`), Everything (all), or any custom set. - Prefix: a key with any server scope is `dck_sk_…` and is a secret (never in frontend code). An RPC-only key is `dck_rpc_…`, safe in an RPC URL because it can do nothing else; it can never gain a server scope (make a new key). - Scopes can be changed on an existing key; the change applies at once. - A request a key's scopes do not cover answers 403 `INSUFFICIENT_SCOPE` with `error.missingScopes`, naming what to add. - Keys made before scopes existed keep exactly what they could do: `dck_sk_` keys have the four server scopes, `dck_rpc_` keys have `rpc`. - The publishable `dck_live_` key (browser, origin-locked) and the organization token `dck_org_` (provisioning, Part on Connect) are separate credentials and are not scoped keys. --- ## Decane Payments — accept crypto payments (checkout) and cross-chain withdrawals Take crypto payments without running a bridge. Settlement runs through Dextopus's deposit router; Decane holds the provider keys, relays webhooks and adds its fee to the quote. Self-serve per project in the dashboard's Payments page. Works with or without Decane wallets. **Merchant setup (dashboard → Payments):** - Settlement addresses, one per network family: ONE EVM address (saved for Base, Ethereum, Arbitrum and Polygon, settling as USDC), plus optional Solana (USDC) and Tron (USDT). At least one is required before Payments can be on. - Turn Payments on. Give the server key the `payments` scope ("Accept payments"). - Payment events go to the project's existing webhook (same URL and secret as sign-ins): `payment.completed`, `payment.partial`, `payment.failed`, `payment.expired`. Sent once, never retried: reconcile with `getPayment` / `listPayments`. **Checkout (pay-in):** your server calls `POST /v1/app/checkout` with an exact `amount` (base units of the settlement asset). You get an `id` and a hosted `url`. Without `settlementChainId` it settles on Base when there is an EVM address, then the other EVM chains, then Solana, then Tron. - The payer picks the network they pay from, then its native coin, USDC or USDT (Dextopus lists more tokens than its quotes accept, so only these are offered; one it still refuses is hidden for a day). The list comes from Dextopus (fetched live, cached 10 minutes; the curated stablecoins stand in if Dextopus is unreachable). Only networks of a family the merchant has an address on are offered. Every EVM network Dextopus routes is offered (70+, detected from its token list; Eclipse is excluded as Solana VM) with the merchant's one EVM address; the page shows six popular networks and a search for the rest. - The payer is NEVER asked for a refund address. Checkouts are NON-strict quotes: whatever the payer sends is converted and settled to the merchant. The outcome is judged by what settled: at or above the amount (0.5% tolerance) is `paid` (an overpayment's extra is the merchant's); clearly less is `partial`. Only a deposit that cannot settle at all is refunded, to the MERCHANT's own address on the payer's network family. - A quoted checkout keeps watching past its countdown: a late payment still settles. - Fulfil on `payment.completed`, matched by `data.id` or `data.orderRef`. A short payment raises `payment.partial` instead (with `data.settledAmount`, in base units like `amount`): decide whether to fulfil. **Withdrawal (pay-out):** `POST /v1/app/withdrawals` — send `amount` of what you hold (origin chain/asset) and it settles to any chain/asset/address you name. `refundTo` here is the sender's own origin-chain address. **Static address:** `POST /v1/app/deposit-addresses` — a reusable per-user deposit address that always settles to your target (for crediting balances). Server reference: the `decane-node` docs (llms-node.txt, 1.7.0+). Python and Rust ports follow. **Payer-facing surface (public, keyed by the unguessable session id, no key):** - `GET /checkout/:id` → the payment (status adds `partial`; `orderRef`; `settledAmount`) plus `merchant: { name }` (the project's name, nothing else about it), `settlementAsset` and `payAssetInfo` ({ decimals, symbol }). - `GET /checkout/:id/pay-options` → `{ payOptions: [{ chainId, chainName, asset, symbol, name, decimals, logoUrl, label }] }`, already filtered to the merchant's networks. - `POST /checkout/:id/quote` `{ payChainId, payAsset }` → the deposit address and exact `amountIn`. (`refundTo`, sent by older clients, is ignored.) - `GET /checkout/:id/status`, `POST /checkout/:id/submit` `{ txHash }`. **Client side (decane-connect-kit 2.34.0+):** `createCheckoutClient(sessionId, { apiBase? })` wraps that surface (get, payOptions, quote, status, submit). `` embeds the flow, with a one-tap "Approve" for a connected EVM wallet. `payCheckoutWithEvmWallet(provider, { from, depositAddress, amountIn, payAsset })` sends the ERC-20/native transfer yourself (it moves real funds; try it small). `formatCheckoutAmount(raw, asset)` turns base units into "10 USDC". Or redirect to the checkout's `url`: the hosted page (currently `https://decane-checkout.vercel.app/`, moving to `checkout.decane.app`). In 2.34.0 the component still shows a refund-address box; it is harmless (the backend ignores it) and goes in the next release. --- ## Package - npm: https://www.npmjs.com/package/decane-connect-kit - Install: `npm install decane-connect-kit` - License: MIT - Peer dependency: React 18 or later - TypeScript: full type declarations included, no `@types` package needed ## Optional (human-readable pages) - Full documentation: https://kit.decane.app/docs - Landing page: https://kit.decane.app - Pricing (social sign-in hosted tiers): https://kit.decane.app/pricing - Gas sponsorship: https://kit.decane.app/gas-sponsorship - Decane RPC: https://kit.decane.app/rpc