|
2 | 2 |
|
3 | 3 | Provider-agnostic wallet adapters for signing and sending transactions across managed and local backends. |
4 | 4 |
|
| 5 | +## Why wallet-adapters? |
| 6 | + |
| 7 | +`@opensea/wallet-adapters` is the shared wallet layer used across the OpenSea developer toolchain. Every package that needs to sign transactions depends on the same `WalletAdapter` interface: |
| 8 | + |
| 9 | +- [`@opensea/sdk`](https://github.com/ProjectOpenSea/opensea-js) — TypeScript SDK for buying, selling, and managing NFTs |
| 10 | +- [`@opensea/cli`](https://github.com/ProjectOpenSea/opensea-cli) — command-line interface for the OpenSea API |
| 11 | +- [`@opensea/tool-sdk`](https://github.com/ProjectOpenSea/tool-sdk) — SDK for building ERC-8257 AI agent tools |
| 12 | +- [`opensea-skill`](https://github.com/ProjectOpenSea/opensea-skill) — modular AI agent skills for Claude, Devin, and other assistants |
| 13 | + |
| 14 | +By implementing the `WalletAdapter` interface once, a new wallet provider automatically works everywhere — the CLI, the SDK, AI agent tool execution, and any future package that depends on this library. |
| 15 | + |
5 | 16 | ## Features |
6 | 17 |
|
7 | 18 | - **Provider-agnostic interface** — unified `WalletAdapter` abstraction with capabilities declaration |
@@ -151,6 +162,33 @@ wallet.onResponse = (method, result, durationMs) => { |
151 | 162 | } |
152 | 163 | ``` |
153 | 164 |
|
| 165 | +## Adding a New Provider |
| 166 | + |
| 167 | +To add a wallet provider, implement the `WalletAdapter` interface: |
| 168 | + |
| 169 | +```ts |
| 170 | +import type { WalletAdapter, WalletCapabilities } from "@opensea/wallet-adapters" |
| 171 | + |
| 172 | +export class MyProviderAdapter implements WalletAdapter { |
| 173 | + readonly name = "my-provider" |
| 174 | + readonly capabilities: WalletCapabilities = { |
| 175 | + signMessage: true, |
| 176 | + signTypedData: true, |
| 177 | + managedGas: true, |
| 178 | + managedNonce: true, |
| 179 | + } |
| 180 | + |
| 181 | + async getAddress(): Promise<string> { /* ... */ } |
| 182 | + async sendTransaction(tx) { /* ... */ } |
| 183 | + async signMessage(request) { /* ... */ } |
| 184 | + async signTypedData(request) { /* ... */ } |
| 185 | + |
| 186 | + static fromEnv(): MyProviderAdapter { /* ... */ } |
| 187 | +} |
| 188 | +``` |
| 189 | + |
| 190 | +Then register it in the `createWalletFromEnv()` factory in `src/factory.ts` so the CLI and tool-sdk auto-detect it from environment variables. |
| 191 | + |
154 | 192 | ## License |
155 | 193 |
|
156 | 194 | MIT |
0 commit comments