@coti-io/coti-wallet-plugin
v0.4.5
Published
React plugin for COTI private tokens in wagmi v2 apps. Optional RainbowKit wrapper at @coti-io/coti-wallet-plugin/rainbowkit.
Maintainers
Readme
@coti-io/coti-wallet-plugin
React library for adding COTI private token (pToken) support to wagmi v2 dApps.
Important: This is a plugin for existing dApps, not a standalone wallet. CotiPluginProvider must sit under a wagmi WagmiProvider. RainbowKit is optional — use @coti-io/coti-wallet-plugin/rainbowkit or bring your own connectors.
Documentation
Full documentation lives in the COTI documentation repository:
| Topic | Link | | --- | --- | | Overview and quickstart | COTI Wallet Plugin | | Integration guide | Integration Guide | | Configuration | Configuration | | API reference | API Reference | | AES key onboarding | AES Key Onboarding | | AES backup security | AES Backup Security | | Remote AES backup (deprecated) | Secure Remote AES Backup Storage | | Onboard modal theming | Onboard Modal Theming | | Example app | Example App |
Installation
npm install @coti-io/coti-wallet-pluginPeer dependencies
npm install react react-dom ethers viem @coti-io/coti-sdk-typescript @metamask/providers wagmi @tanstack/react-queryRainbowKit is optional. Install it only if you use the convenience wrapper:
npm install @rainbow-me/rainbowkitPeer floors are the stack this repo runs (wagmi@^2.14.0, viem@^2.47.0, optional @rainbow-me/rainbowkit@^2.2.0). Carets still allow later 2.x / 18.x patches. This release is validated with [email protected], [email protected], and @rainbow-me/[email protected].
Quickstart
import {
CotiPluginProvider,
usePrivateUnlock,
} from '@coti-io/coti-wallet-plugin';
import { WagmiRainbowKitProvider } from '@coti-io/coti-wallet-plugin/rainbowkit';
export function Root() {
return (
<WagmiRainbowKitProvider walletConnectProjectId={walletConnectProjectId}>
{/* Default is core only: wallet + AES unlock. */}
<CotiPluginProvider>
<App />
</CotiPluginProvider>
</WagmiRainbowKitProvider>
);
}
// Token lists, Privacy Portal, and/or PoD tracking:
// <CotiPluginProvider features={['tokens', 'portal', 'pod']}>
Hosts that already mount WagmiProvider + QueryClientProvider can skip WagmiRainbowKitProvider and wrap with CotiPluginProvider only.
See the integration guide for provider setup, unlock flow, and private operations.
Development
npm run build # dist/index.js (CJS) + dist/index.mjs (ESM) + dist/index.d.ts
npm run typecheck # TypeScript check
npm run test # Vitest suite (no coverage floors)
npm run test:coverage # same suite; fails if coverage drops below vitest.config.ts floors
npm run lint # ESLintExample app
cd examples && npm run devSee Example App for setup details.
License
Apache 2.0
