@bsv/simple-mcp 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Matias Jackson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # @bsv/simple MCP Server
2
+
3
+ An MCP (Model Context Protocol) server that provides AI agents with knowledge and code generation tools for building BSV blockchain applications using `@bsv/simple`.
4
+
5
+ ## Quick Start
6
+
7
+ ### Claude Code (local)
8
+ ```bash
9
+ cd simple-mcp
10
+ npm install && npm run build
11
+ ```
12
+
13
+ Add to `~/.claude/settings.json`:
14
+ ```json
15
+ {
16
+ "mcpServers": {
17
+ "simple": {
18
+ "command": "node",
19
+ "args": ["/path/to/simple-mcp/dist/index.js"]
20
+ }
21
+ }
22
+ }
23
+ ```
24
+
25
+ ### Docker
26
+ ```bash
27
+ docker build -t simple-mcp .
28
+ ```
29
+
30
+ Add to `~/.claude/settings.json`:
31
+ ```json
32
+ {
33
+ "mcpServers": {
34
+ "simple": {
35
+ "command": "docker",
36
+ "args": ["run", "-i", "--rm", "simple-mcp"]
37
+ }
38
+ }
39
+ }
40
+ ```
41
+
42
+ ## Resources
43
+
44
+ | URI | Description |
45
+ |-----|-------------|
46
+ | `simple://api/wallet` | WalletCore + BrowserWallet + ServerWallet methods |
47
+ | `simple://api/tokens` | Token create/list/send/redeem/messagebox |
48
+ | `simple://api/inscriptions` | Text/JSON/hash inscriptions |
49
+ | `simple://api/messagebox` | Certification, payments, identity registry |
50
+ | `simple://api/certification` | Certifier, certificates, revocation |
51
+ | `simple://api/did` | DID class, wallet DID methods |
52
+ | `simple://api/credentials` | Schema, Issuer, VC/VP, revocation stores |
53
+ | `simple://api/overlay` | Overlay, SHIP/SLAP, broadcasting |
54
+ | `simple://guide/nextjs` | Complete Next.js integration guide |
55
+
56
+ ## Tools
57
+
58
+ | Tool | Description |
59
+ |------|-------------|
60
+ | `scaffold_nextjs_config` | Generate next.config.ts + package.json for BSV apps |
61
+ | `generate_wallet_setup` | Wallet initialization code (browser or server) |
62
+ | `generate_payment_handler` | Payment handler functions |
63
+ | `generate_token_handler` | Token CRUD operations |
64
+ | `generate_inscription_handler` | OP_RETURN inscription handlers |
65
+ | `generate_messagebox_setup` | MessageBox P2P integration |
66
+ | `generate_server_route` | Next.js API route for server wallet |
67
+ | `generate_credential_issuer` | CredentialIssuer setup with schema |
68
+ | `generate_did_integration` | DID integration code |
69
+
70
+ ## Prompts
71
+
72
+ | Prompt | Description |
73
+ |--------|-------------|
74
+ | `integrate_simple` | Full integration walkthrough |
75
+ | `add_bsv_feature` | Feature-specific code generation |
76
+ | `debug_simple` | Debugging help for common issues |
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,152 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
5
+ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
6
+ const zod_1 = require("zod");
7
+ // Resources
8
+ const api_reference_1 = require("./resources/api-reference");
9
+ const integration_1 = require("./resources/integration");
10
+ const gotchas_1 = require("./resources/gotchas");
11
+ const patterns_1 = require("./resources/patterns");
12
+ // Tools
13
+ const scaffold_1 = require("./tools/scaffold");
14
+ const wallet_1 = require("./tools/wallet");
15
+ const payment_1 = require("./tools/payment");
16
+ const token_1 = require("./tools/token");
17
+ const inscription_1 = require("./tools/inscription");
18
+ const messagebox_1 = require("./tools/messagebox");
19
+ const server_route_1 = require("./tools/server-route");
20
+ const credential_1 = require("./tools/credential");
21
+ const did_1 = require("./tools/did");
22
+ // Prompts
23
+ const integrate_1 = require("./prompts/integrate");
24
+ const add_feature_1 = require("./prompts/add-feature");
25
+ const debug_1 = require("./prompts/debug");
26
+ // ============================================================================
27
+ // Create MCP Server
28
+ // ============================================================================
29
+ const server = new mcp_js_1.McpServer({
30
+ name: 'simple-mcp',
31
+ version: '1.0.0'
32
+ });
33
+ // ============================================================================
34
+ // Resources
35
+ // ============================================================================
36
+ server.resource('wallet-api', 'simple://api/wallet', async () => ({
37
+ contents: [{ uri: 'simple://api/wallet', mimeType: 'text/markdown', text: api_reference_1.walletApiReference }]
38
+ }));
39
+ server.resource('tokens-api', 'simple://api/tokens', async () => ({
40
+ contents: [{ uri: 'simple://api/tokens', mimeType: 'text/markdown', text: api_reference_1.tokensApiReference }]
41
+ }));
42
+ server.resource('inscriptions-api', 'simple://api/inscriptions', async () => ({
43
+ contents: [{ uri: 'simple://api/inscriptions', mimeType: 'text/markdown', text: api_reference_1.inscriptionsApiReference }]
44
+ }));
45
+ server.resource('messagebox-api', 'simple://api/messagebox', async () => ({
46
+ contents: [{ uri: 'simple://api/messagebox', mimeType: 'text/markdown', text: api_reference_1.messageboxApiReference }]
47
+ }));
48
+ server.resource('certification-api', 'simple://api/certification', async () => ({
49
+ contents: [{ uri: 'simple://api/certification', mimeType: 'text/markdown', text: api_reference_1.certificationApiReference }]
50
+ }));
51
+ server.resource('did-api', 'simple://api/did', async () => ({
52
+ contents: [{ uri: 'simple://api/did', mimeType: 'text/markdown', text: api_reference_1.didApiReference }]
53
+ }));
54
+ server.resource('credentials-api', 'simple://api/credentials', async () => ({
55
+ contents: [{ uri: 'simple://api/credentials', mimeType: 'text/markdown', text: api_reference_1.credentialsApiReference }]
56
+ }));
57
+ server.resource('overlay-api', 'simple://api/overlay', async () => ({
58
+ contents: [{ uri: 'simple://api/overlay', mimeType: 'text/markdown', text: api_reference_1.overlayApiReference }]
59
+ }));
60
+ server.resource('nextjs-guide', 'simple://guide/nextjs', async () => ({
61
+ contents: [{ uri: 'simple://guide/nextjs', mimeType: 'text/markdown', text: integration_1.nextjsIntegrationGuide }]
62
+ }));
63
+ server.resource('gotchas', 'simple://guide/gotchas', async () => ({
64
+ contents: [{ uri: 'simple://guide/gotchas', mimeType: 'text/markdown', text: gotchas_1.gotchasReference }]
65
+ }));
66
+ server.resource('patterns', 'simple://guide/patterns', async () => ({
67
+ contents: [{ uri: 'simple://guide/patterns', mimeType: 'text/markdown', text: patterns_1.codePatterns }]
68
+ }));
69
+ // ============================================================================
70
+ // Tools
71
+ // ============================================================================
72
+ server.tool('scaffold_nextjs_config', 'Generate next.config.ts, package.json additions, and .gitignore for a BSV app', { features: zod_1.z.array(zod_1.z.string()).describe('Features to enable: payments, tokens, inscriptions, messagebox, certification, did, credentials, overlay, server-wallet') }, async ({ features }) => ({
73
+ content: [{ type: 'text', text: (0, scaffold_1.scaffoldNextjsConfig)(features) }]
74
+ }));
75
+ server.tool('generate_wallet_setup', 'Generate wallet initialization code for browser or server', {
76
+ target: zod_1.z.enum(['browser', 'server']).describe('Target environment'),
77
+ framework: zod_1.z.enum(['nextjs', 'react', 'vanilla']).describe('Target framework')
78
+ }, async ({ target, framework }) => ({
79
+ content: [{ type: 'text', text: (0, wallet_1.generateWalletSetup)(target, framework) }]
80
+ }));
81
+ server.tool('generate_payment_handler', 'Generate payment handler function', {
82
+ type: zod_1.z.enum(['simple', 'multi-output', 'server-funding']).describe('Payment type'),
83
+ basket: zod_1.z.string().optional().describe('Basket name for tracking payments')
84
+ }, async ({ type, basket }) => ({
85
+ content: [{ type: 'text', text: (0, payment_1.generatePaymentHandler)(type, basket) }]
86
+ }));
87
+ server.tool('generate_token_handler', 'Generate token handler functions', {
88
+ operations: zod_1.z.array(zod_1.z.enum(['create', 'list', 'send', 'redeem', 'messagebox'])).describe('Token operations to generate')
89
+ }, async ({ operations }) => ({
90
+ content: [{ type: 'text', text: (0, token_1.generateTokenHandler)(operations) }]
91
+ }));
92
+ server.tool('generate_inscription_handler', 'Generate inscription handler functions', {
93
+ types: zod_1.z.array(zod_1.z.enum(['text', 'json', 'file-hash', 'image-hash'])).describe('Inscription types to generate')
94
+ }, async ({ types }) => ({
95
+ content: [{ type: 'text', text: (0, inscription_1.generateInscriptionHandler)(types) }]
96
+ }));
97
+ server.tool('generate_messagebox_setup', 'Generate MessageBox integration code', {
98
+ features: zod_1.z.array(zod_1.z.enum(['certify', 'send', 'receive', 'search'])).describe('MessageBox features to generate'),
99
+ registryUrl: zod_1.z.string().optional().describe('Identity registry URL (default: /api/identity-registry)')
100
+ }, async ({ features, registryUrl }) => ({
101
+ content: [{ type: 'text', text: (0, messagebox_1.generateMessageBoxSetup)(features, registryUrl) }]
102
+ }));
103
+ server.tool('generate_server_route', 'Generate Next.js API route using handler factories (identity-registry, did-resolver, server-wallet, credential-issuer, or all)', {
104
+ routeType: zod_1.z.enum(['identity-registry', 'did-resolver', 'server-wallet', 'credential-issuer', 'all']).describe('Which server route to generate')
105
+ }, async ({ routeType }) => ({
106
+ content: [{ type: 'text', text: (0, server_route_1.generateServerRoute)(routeType) }]
107
+ }));
108
+ server.tool('generate_credential_issuer', 'Generate CredentialIssuer setup with schema', {
109
+ schemaFields: zod_1.z.array(zod_1.z.object({
110
+ key: zod_1.z.string(),
111
+ label: zod_1.z.string(),
112
+ type: zod_1.z.string(),
113
+ required: zod_1.z.boolean().optional()
114
+ })).describe('Schema field definitions'),
115
+ revocation: zod_1.z.boolean().describe('Enable revocation support')
116
+ }, async ({ schemaFields, revocation }) => ({
117
+ content: [{ type: 'text', text: (0, credential_1.generateCredentialIssuer)(schemaFields, revocation) }]
118
+ }));
119
+ server.tool('generate_did_integration', 'Generate DID integration code (V2 UTXO chain-linked or legacy)', {
120
+ features: zod_1.z.array(zod_1.z.enum(['create', 'resolve', 'update', 'deactivate', 'list', 'get', 'register'])).describe('DID features: create (new V2 DID), resolve (cross-wallet with proxy), update, deactivate, list, get (legacy), register (legacy)')
121
+ }, async ({ features }) => ({
122
+ content: [{ type: 'text', text: (0, did_1.generateDIDIntegration)(features) }]
123
+ }));
124
+ // ============================================================================
125
+ // Prompts
126
+ // ============================================================================
127
+ server.prompt(integrate_1.integratePrompt.name, integrate_1.integratePrompt.description, {
128
+ framework: zod_1.z.string().optional().describe('Target framework: nextjs, react, or vanilla'),
129
+ features: zod_1.z.string().optional().describe('Comma-separated features: payments, tokens, inscriptions, messagebox, certification, did, credentials, overlay, server-wallet')
130
+ }, ({ framework, features }) => ({
131
+ messages: integrate_1.integratePrompt.getMessages({ framework: framework || 'nextjs', features: features || 'payments' })
132
+ }));
133
+ server.prompt(add_feature_1.addFeaturePrompt.name, add_feature_1.addFeaturePrompt.description, {
134
+ feature: zod_1.z.string().describe('Feature to add: payments, tokens, inscriptions, messagebox, certification, did, credentials, overlay, server-wallet'),
135
+ framework: zod_1.z.string().optional().describe('Target framework: nextjs, react, or vanilla')
136
+ }, ({ feature, framework }) => ({
137
+ messages: add_feature_1.addFeaturePrompt.getMessages({ feature, framework: framework || 'nextjs' })
138
+ }));
139
+ server.prompt(debug_1.debugPrompt.name, debug_1.debugPrompt.description, {
140
+ error: zod_1.z.string().describe('Error message or problem description'),
141
+ feature: zod_1.z.string().optional().describe('Feature area: wallet, payments, tokens, inscriptions, messagebox, certification, did, credentials, overlay, server-wallet')
142
+ }, ({ error, feature }) => ({
143
+ messages: debug_1.debugPrompt.getMessages({ error, feature: feature || 'general' })
144
+ }));
145
+ // ============================================================================
146
+ // Start Server
147
+ // ============================================================================
148
+ async function main() {
149
+ const transport = new stdio_js_1.StdioServerTransport();
150
+ await server.connect(transport);
151
+ }
152
+ main().catch(console.error);
@@ -0,0 +1,16 @@
1
+ export declare const addFeaturePrompt: {
2
+ name: string;
3
+ description: string;
4
+ arguments: {
5
+ name: string;
6
+ description: string;
7
+ required: boolean;
8
+ }[];
9
+ getMessages(args: Record<string, string>): {
10
+ role: "user";
11
+ content: {
12
+ type: "text";
13
+ text: string;
14
+ };
15
+ }[];
16
+ };
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addFeaturePrompt = void 0;
4
+ exports.addFeaturePrompt = {
5
+ name: 'add_bsv_feature',
6
+ description: 'Generate code for adding a specific BSV feature (payments, tokens, messagebox, etc.) to an existing project.',
7
+ arguments: [
8
+ {
9
+ name: 'feature',
10
+ description: 'The feature to add: payments, tokens, inscriptions, messagebox, certification, did, credentials, overlay, server-wallet',
11
+ required: true
12
+ },
13
+ {
14
+ name: 'framework',
15
+ description: 'Target framework: nextjs, react, or vanilla',
16
+ required: false
17
+ }
18
+ ],
19
+ getMessages(args) {
20
+ const feature = args.feature || 'payments';
21
+ const framework = args.framework || 'nextjs';
22
+ return [
23
+ {
24
+ role: 'user',
25
+ content: {
26
+ type: 'text',
27
+ text: `I have an existing ${framework} project with @bsv/simple already set up. I want to add the "${feature}" feature.
28
+
29
+ Please:
30
+ 1. Read the relevant API reference for this feature (use the simple://api/${feature} resource)
31
+ 2. Generate the implementation code using the appropriate tool
32
+ 3. Show me any gotchas specific to this feature
33
+ 4. Provide a complete, working code example I can drop into my project
34
+
35
+ Assume I already have a wallet instance available. Generate production-ready TypeScript code.`
36
+ }
37
+ }
38
+ ];
39
+ }
40
+ };
@@ -0,0 +1,16 @@
1
+ export declare const debugPrompt: {
2
+ name: string;
3
+ description: string;
4
+ arguments: {
5
+ name: string;
6
+ description: string;
7
+ required: boolean;
8
+ }[];
9
+ getMessages(args: Record<string, string>): {
10
+ role: "user";
11
+ content: {
12
+ type: "text";
13
+ text: string;
14
+ };
15
+ }[];
16
+ };
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.debugPrompt = void 0;
4
+ exports.debugPrompt = {
5
+ name: 'debug_simple',
6
+ description: 'Help debug issues with @bsv/simple code. Checks common gotchas and suggests fixes.',
7
+ arguments: [
8
+ {
9
+ name: 'error',
10
+ description: 'The error message or description of the problem',
11
+ required: true
12
+ },
13
+ {
14
+ name: 'feature',
15
+ description: 'Which feature area: wallet, payments, tokens, inscriptions, messagebox, certification, did, credentials, overlay, server-wallet',
16
+ required: false
17
+ }
18
+ ],
19
+ getMessages(args) {
20
+ const error = args.error || 'Unknown error';
21
+ const feature = args.feature || 'general';
22
+ return [
23
+ {
24
+ role: 'user',
25
+ content: {
26
+ type: 'text',
27
+ text: `I'm having an issue with @bsv/simple in the "${feature}" area.
28
+
29
+ Error/Problem: ${error}
30
+
31
+ Please:
32
+ 1. Read the gotchas reference (simple://guide/gotchas resource) to check if this is a known issue
33
+ 2. Read the relevant API reference for the feature area
34
+ 3. Identify the likely cause based on common patterns
35
+ 4. Suggest a fix with corrected code
36
+
37
+ Common causes to check:
38
+ - basket insertion vs wallet payment confusion
39
+ - PeerPayClient.acceptPayment() swallowing errors
40
+ - result.tx being undefined
41
+ - Missing serverExternalPackages in next.config.ts
42
+ - Static vs dynamic imports for server code
43
+ - Overlay topic/service prefix requirements (tm_, ls_)
44
+ - FileRevocationStore used in browser context
45
+ - Writing manual API route code instead of using handler factories
46
+ - Importing @bsv/sdk directly (use @bsv/simple/server exports instead)
47
+ - pay() now uses MessageBox P2P, not direct on-chain P2PKH`
48
+ }
49
+ }
50
+ ];
51
+ }
52
+ };
@@ -0,0 +1,16 @@
1
+ export declare const integratePrompt: {
2
+ name: string;
3
+ description: string;
4
+ arguments: {
5
+ name: string;
6
+ description: string;
7
+ required: boolean;
8
+ }[];
9
+ getMessages(args: Record<string, string>): {
10
+ role: "user";
11
+ content: {
12
+ type: "text";
13
+ text: string;
14
+ };
15
+ }[];
16
+ };
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.integratePrompt = void 0;
4
+ exports.integratePrompt = {
5
+ name: 'integrate_simple',
6
+ description: 'Walk through adding @bsv/simple to a project. Asks about framework, features needed, and generates complete setup.',
7
+ arguments: [
8
+ {
9
+ name: 'framework',
10
+ description: 'Target framework: nextjs, react, or vanilla',
11
+ required: false
12
+ },
13
+ {
14
+ name: 'features',
15
+ description: 'Comma-separated features: payments, tokens, inscriptions, messagebox, certification, did, credentials, overlay, server-wallet',
16
+ required: false
17
+ }
18
+ ],
19
+ getMessages(args) {
20
+ const framework = args.framework || 'nextjs';
21
+ const features = args.features ? args.features.split(',').map(f => f.trim()) : ['payments'];
22
+ return [
23
+ {
24
+ role: 'user',
25
+ content: {
26
+ type: 'text',
27
+ text: `I want to integrate @bsv/simple into my ${framework} project. I need these features: ${features.join(', ')}.
28
+
29
+ Please help me:
30
+ 1. Set up the project configuration (next.config.ts if Next.js, package.json dependencies)
31
+ 2. Create wallet initialization code (browser wallet for client, server wallet if needed)
32
+ 3. Generate handler functions for each feature I listed
33
+ 4. Show me the critical gotchas I should watch out for
34
+
35
+ Use the MCP resources and tools to generate the code. Start with scaffold_nextjs_config, then generate_wallet_setup, then the feature-specific generators.`
36
+ }
37
+ }
38
+ ];
39
+ }
40
+ };
@@ -0,0 +1,8 @@
1
+ export declare const walletApiReference = "# @bsv/simple \u2014 Wallet API Reference\n\n## Initialization\n\n### Browser\n```typescript\nimport { createWallet } from '@bsv/simple/browser'\nconst wallet = await createWallet()\n// Optional defaults:\nconst wallet = await createWallet({ network: 'main' })\n```\n\n### Server (Node.js)\n```typescript\nconst { ServerWallet } = await import('@bsv/simple/server')\nconst wallet = await ServerWallet.create({\n privateKey: 'hex_private_key',\n network: 'main',\n storageUrl: 'https://storage.babbage.systems'\n})\n```\n\n## WalletCore Methods (shared by Browser + Server)\n\n### Wallet Info\n- `getIdentityKey(): string` \u2014 Compressed public key hex (66 chars)\n- `getAddress(): string` \u2014 P2PKH address from identity key\n- `getStatus(): WalletStatus` \u2014 { isConnected, identityKey, network }\n- `getWalletInfo(): WalletInfo` \u2014 { identityKey, address, network, isConnected }\n- `getClient(): WalletInterface` \u2014 Underlying SDK wallet client\n\n### Key Derivation\n- `derivePublicKey(protocolID: [SecurityLevel, string], keyID: string, counterparty?: string, forSelf?: boolean): Promise<string>` \u2014 Derive public key for any protocol\n- `derivePaymentKey(counterparty: string, invoiceNumber?: string): Promise<string>` \u2014 Derive BRC-29 payment key (protocol [2, '3241645161d8'])\n\n### Payments\n- `pay(options: PaymentOptions): Promise<TransactionResult>` \u2014 Payment via MessageBox P2P (PeerPayClient)\n- `send(options: SendOptions): Promise<SendResult>` \u2014 Multi-output: combine P2PKH + OP_RETURN + PushDrop in one tx\n- `fundServerWallet(request: PaymentRequest, basket?: string): Promise<TransactionResult>` \u2014 Fund a ServerWallet using BRC-29 derivation\n\n### PaymentOptions\n```typescript\ninterface PaymentOptions {\n to: string // recipient identity key\n satoshis: number // amount\n memo?: string // optional memo\n description?: string // tx description\n}\n```\n\n### SendOptions (multi-output)\n```typescript\ninterface SendOptions {\n outputs: SendOutputSpec[]\n description?: string\n}\n\ninterface SendOutputSpec {\n to?: string // recipient key\n satoshis?: number // amount\n data?: Array<string | object | number[]> // data fields\n description?: string\n basket?: string\n protocolID?: [number, string] // for PushDrop\n keyID?: string // for PushDrop\n}\n// Rules: to only \u2192 P2PKH | data only \u2192 OP_RETURN | to + data \u2192 PushDrop\n```\n\n## ServerWallet-specific Methods\n- `createPaymentRequest(options: { satoshis: number, memo?: string }): PaymentRequest` \u2014 Generate BRC-29 payment request\n- `receivePayment(payment: IncomingPayment): Promise<void>` \u2014 Internalize payment using wallet payment protocol\n\n## Result Types\n```typescript\ninterface TransactionResult { txid: string; tx: any; outputs?: OutputInfo[] }\ninterface SendResult extends TransactionResult { outputDetails: SendOutputDetail[] }\ninterface SendOutputDetail { index: number; type: 'p2pkh' | 'op_return' | 'pushdrop'; satoshis: number; description: string }\n```\n";
2
+ export declare const tokensApiReference = "# @bsv/simple \u2014 Tokens API Reference\n\n## Methods (mixed into wallet via createTokenMethods)\n\n### createToken(options: TokenOptions): Promise<TokenResult>\nCreate an encrypted PushDrop token.\n```typescript\ninterface TokenOptions {\n to?: string // recipient key (default: self)\n data: any // JSON-serializable data (encrypted)\n basket?: string // default: 'tokens'\n protocolID?: [number, string] // default: [0, 'token']\n keyID?: string // default: '1'\n satoshis?: number // default: 1\n}\ninterface TokenResult extends TransactionResult {\n basket: string\n encrypted: boolean\n}\n```\nExample:\n```typescript\nconst result = await wallet.createToken({\n data: { type: 'loyalty', points: 100 },\n basket: 'my-tokens'\n})\n```\n\n### listTokenDetails(basket?: string): Promise<TokenDetail[]>\nList and decrypt all tokens in a basket.\n```typescript\ninterface TokenDetail {\n outpoint: string // txid.vout\n satoshis: number\n data: any // decrypted payload\n protocolID: any\n keyID: string\n counterparty: string\n}\n```\n\n### sendToken(options: SendTokenOptions): Promise<TransactionResult>\nTransfer a token to another key (on-chain, two-step sign flow).\n```typescript\ninterface SendTokenOptions { basket: string; outpoint: string; to: string }\n```\n\n### redeemToken(options: RedeemTokenOptions): Promise<TransactionResult>\nSpend/destroy a token (reclaims satoshis).\n```typescript\ninterface RedeemTokenOptions { basket: string; outpoint: string }\n```\n\n### sendTokenViaMessageBox(options: SendTokenOptions): Promise<TransactionResult>\nTransfer a token via MessageBox P2P messaging (off-chain delivery).\n\n### listIncomingTokens(): Promise<any[]>\nList tokens waiting in the `simple_token_inbox` MessageBox.\n\n### acceptIncomingToken(token: any, basket?: string): Promise<any>\nAccept incoming token into a basket via `basket insertion` protocol.\n";
3
+ export declare const inscriptionsApiReference = "# @bsv/simple \u2014 Inscriptions API Reference\n\nAll inscriptions create OP_RETURN outputs (0 satoshis).\n\n## Methods\n\n### inscribeText(text: string, opts?): Promise<InscriptionResult>\nCreate an OP_RETURN text inscription.\n- Default basket: `'text'`\n\n### inscribeJSON(data: object, opts?): Promise<InscriptionResult>\nCreate an OP_RETURN JSON inscription.\n- Default basket: `'json'`\n\n### inscribeFileHash(hash: string, opts?): Promise<InscriptionResult>\nCreate an OP_RETURN SHA-256 file hash inscription.\n- Default basket: `'hash-document'`\n- Validates: must be 64-char hex string\n\n### inscribeImageHash(hash: string, opts?): Promise<InscriptionResult>\nCreate an OP_RETURN SHA-256 image hash inscription.\n- Default basket: `'hash-image'`\n- Validates: must be 64-char hex string\n\n## Shared Options\n```typescript\nopts?: { basket?: string; description?: string }\n```\n\n## Result Type\n```typescript\ninterface InscriptionResult extends TransactionResult {\n type: 'text' | 'json' | 'file-hash' | 'image-hash'\n dataSize: number\n basket: string\n}\n```\n\n## Example\n```typescript\nconst text = await wallet.inscribeText('Hello blockchain!')\nconst json = await wallet.inscribeJSON({ title: 'Doc', created: Date.now() })\nconst hash = await wallet.inscribeFileHash('a'.repeat(64))\n```\n";
4
+ export declare const messageboxApiReference = "# @bsv/simple \u2014 MessageBox API Reference\n\n## Identity & Certification\n\n### certifyForMessageBox(handle: string, registryUrl?: string, host?: string): Promise<{ txid, handle }>\nRegister a handle on the identity registry and anoint the MessageBox host.\n\n### getMessageBoxHandle(registryUrl?: string): Promise<string | null>\nCheck if wallet has a registered handle. Returns null if none found.\n\n### revokeMessageBoxCertification(registryUrl?: string): Promise<void>\nRemove all registered handles for this identity key.\n\n## Payments\n\n### sendMessageBoxPayment(to: string, satoshis: number): Promise<any>\nSend payment via MessageBox using `createPaymentToken()` + `sendMessage()`.\nReturns: `{ txid, amount, recipient }`\n\n### listIncomingPayments(): Promise<any[]>\nList payments in the `payment_inbox` MessageBox.\n\n### acceptIncomingPayment(payment: any, basket?: string): Promise<any>\nAccept a payment. If `basket` is provided, uses `basket insertion` protocol (recommended). Otherwise uses `PeerPayClient.acceptPayment()`.\n\n**IMPORTANT:** When not using a basket, PeerPayClient.acceptPayment() swallows errors. The library checks `typeof result === 'string'` and throws.\n\n## Identity Registry\n\n### registerIdentityTag(tag: string, registryUrl?: string): Promise<{ tag }>\nRegister a tag in the identity registry.\n\n### lookupIdentityByTag(query: string, registryUrl?: string): Promise<{ tag, identityKey }[]>\nSearch the identity registry by tag.\n\n### listMyTags(registryUrl?: string): Promise<{ tag, createdAt }[]>\nList all tags registered to this identity key.\n\n### revokeIdentityTag(tag: string, registryUrl?: string): Promise<void>\nRemove a registered tag.\n\n## Registry API Format\nThe identity registry expects these API endpoints:\n- `GET ?action=lookup&query=...` \u2192 `{ success, results: [{ tag, identityKey }] }`\n- `GET ?action=list&identityKey=...` \u2192 `{ success, tags: [{ tag, createdAt }] }`\n- `POST ?action=register` body: `{ tag, identityKey }` \u2192 `{ success }`\n- `POST ?action=revoke` body: `{ tag, identityKey }` \u2192 `{ success }`\n\n## Server-side Setup (3 lines)\n```typescript\n// app/api/identity-registry/route.ts\nimport { createIdentityRegistryHandler } from '@bsv/simple/server'\nconst handler = createIdentityRegistryHandler()\nexport const GET = handler.GET, POST = handler.POST\n```\n";
5
+ export declare const certificationApiReference = "# @bsv/simple \u2014 Certification API Reference\n\n## Certifier Class (standalone)\n\n### Certifier.create(config?): Promise<Certifier>\n```typescript\nconst certifier = await Certifier.create() // random key\nconst certifier = await Certifier.create({\n privateKey: 'hex',\n certificateType: 'base64type',\n defaultFields: { role: 'admin' },\n includeTimestamp: true // default: true\n})\n```\n\n### certifier.getInfo(): { publicKey, certificateType }\n\n### certifier.certify(wallet: WalletCore, additionalFields?): Promise<CertificateData>\nIssues a certificate AND acquires it into the wallet in one call.\n\n## Wallet Methods\n\n### acquireCertificateFrom(config): Promise<CertificateData>\n```typescript\nawait wallet.acquireCertificateFrom({\n serverUrl: 'https://certifier.example.com',\n replaceExisting: true // revoke old certs first (default: true)\n})\n```\nServer must expose: `GET ?action=info` \u2192 `{ certifierPublicKey, certificateType }`, `POST ?action=certify` \u2192 CertificateData. Use `createCredentialIssuerHandler()` from `@bsv/simple/server` to set this up automatically.\n\n### listCertificatesFrom(config): Promise<{ totalCertificates, certificates }>\n```typescript\nconst result = await wallet.listCertificatesFrom({\n certifiers: [certifierPubKey],\n types: [certificateType],\n limit: 100\n})\n```\n\n### relinquishCert(args): Promise<void>\n```typescript\nawait wallet.relinquishCert({ type, serialNumber, certifier })\n```\n\n## CertificateData Type\n```typescript\ninterface CertificateData {\n type: string; serialNumber: string; subject: string; certifier: string\n revocationOutpoint: string; fields: Record<string, string>\n signature: string; keyringForSubject: Record<string, string>\n}\n```\n";
6
+ export declare const didApiReference = "# @bsv/simple \u2014 DID API Reference\n\n## Overview\n\n`did:bsv:` DIDs use UTXO chain-linking on the BSV blockchain. The DID identifier\nis the txid of the issuance transaction. The chain of output-0 spends carries\nthe DID Document and its updates.\n\n## DID Class (standalone, no wallet needed)\n\n### DID.buildDocument(txid, subjectPubKeyHex, controllerDID?, services?): DIDDocumentV2\nBuild a W3C DID Document with JsonWebKey2020 verification method.\n\n### DID.fromTxid(txid: string): string\nCreate a DID string from a transaction ID: `did:bsv:<txid>`\n\n### DID.parse(didString: string): DIDParseResult\nParse `did:bsv:<txid>` \u2192 `{ method: 'bsv', identifier: '<txid>' }`\nAlso accepts legacy 66-char pubkey identifiers.\n\n### DID.isValid(didString: string): boolean\nCheck if a DID string is valid `did:bsv:` format (64-char txid or 66-char pubkey).\n\n### DID.fromIdentityKey(identityKey: string): DIDDocument\n**Deprecated.** Generate a legacy DID Document from a compressed public key.\n\n### DID.getCertificateType(): string\nReturns the base64 certificate type for DID persistence.\n\n## Wallet Methods (V2 \u2014 UTXO Chain-Linked)\n\n### createDID(options?: DIDCreateOptions): Promise<DIDCreateResult>\nCreate a new on-chain DID with UTXO chain linking.\n- TX0: Issuance (chain UTXO + OP_RETURN marker)\n- TX1: Document (spends TX0, new chain UTXO + OP_RETURN with DID Document)\n```typescript\ninterface DIDCreateOptions {\n basket?: string // default: 'did_v2'\n identityCode?: string // auto-generated if omitted\n services?: DIDService[] // optional services in document\n}\ninterface DIDCreateResult {\n did: string // 'did:bsv:<txid>'\n txid: string // issuance txid\n identityCode: string\n document: DIDDocumentV2\n}\n```\n\n### resolveDID(didString: string): Promise<DIDResolutionResult>\nResolve any `did:bsv:` DID to its Document.\n\n**Resolution order:**\n1. Local basket (own DIDs \u2014 fastest)\n2. Server-side proxy (`didProxyUrl` \u2014 handles nChain + WoC fallback)\n3. Direct resolvers (server-side only \u2014 no proxy needed)\n\n**Important:** In browsers, set `didProxyUrl` for cross-wallet resolution:\n```typescript\nconst wallet = await createWallet({ didProxyUrl: '/api/resolve-did' })\n```\n```typescript\ninterface DIDResolutionResult {\n didDocument: DIDDocumentV2 | null\n didDocumentMetadata: { created?: string; updated?: string; deactivated?: boolean; versionId?: string }\n didResolutionMetadata: { contentType?: string; error?: string; message?: string }\n}\n```\n\n### updateDID(options: DIDUpdateOptions): Promise<DIDCreateResult>\nUpdate a DID document by spending the current chain UTXO.\n```typescript\ninterface DIDUpdateOptions {\n did: string // DID to update\n services?: DIDService[] // new services\n additionalKeys?: string[] // extra verification keys (compressed pubkey hex)\n}\n```\n\n### deactivateDID(didString: string): Promise<{ txid: string }>\nRevoke a DID. Spends the chain UTXO with payload `\"3\"` (revocation marker).\nChain terminates \u2014 resolvers will return `deactivated: true`.\n\n### listDIDs(): Promise<DIDChainState[]>\nList all DIDs owned by this wallet.\n```typescript\ninterface DIDChainState {\n did: string; identityCode: string; issuanceTxid: string\n currentOutpoint: string; status: 'active' | 'deactivated'\n created: string; updated: string\n}\n```\n\n## Legacy Wallet Methods (deprecated)\n\n### getDID(): DIDDocument\nGet legacy identity-key-based DID Document (synchronous).\n\n### registerDID(options?: { persist?: boolean }): Promise<DIDDocument>\nPersist legacy DID as a BSV certificate.\n\n## DID Document Structure (V2)\n```typescript\ninterface DIDDocumentV2 {\n '@context': string // 'https://www.w3.org/ns/did/v1'\n id: string // 'did:bsv:<txid>'\n controller?: string\n verificationMethod: DIDVerificationMethodV2[]\n authentication: string[]\n service?: DIDService[]\n}\ninterface DIDVerificationMethodV2 {\n id: string // 'did:bsv:<txid>#subject-key'\n type: 'JsonWebKey2020'\n controller: string\n publicKeyJwk: { kty: 'EC'; crv: 'secp256k1'; x: string; y: string }\n}\ninterface DIDService {\n id: string; type: string; serviceEndpoint: string\n}\n```\n\n## Cross-Wallet Resolution (Proxy Setup)\n\nBrowser-side resolution of other wallets' DIDs requires a server-side proxy\nbecause:\n- nChain Universal Resolver is unreliable (returns HTTP 500)\n- WhatsOnChain API calls from browsers are blocked by CORS and rate-limited\n\nThe proxy (`/api/resolve-did`) makes all external calls server-side:\n1. Try nChain resolver (10s timeout)\n2. On failure \u2192 WoC chain-following: fetch TX \u2192 parse OP_RETURN \u2192 follow output 0 spend \u2192 return last document\n\nSee the DID guide (`docs/guides/did.md`) for the complete proxy implementation.\n\n## Example\n```typescript\nimport { createWallet, DID } from '@bsv/simple/browser'\n\nconst wallet = await createWallet({ didProxyUrl: '/api/resolve-did' })\n\n// Create\nconst { did, document } = await wallet.createDID()\nconsole.log(did) // 'did:bsv:d803b04a...'\n\n// Resolve (cross-wallet, goes through proxy)\nconst result = await wallet.resolveDID('did:bsv:<other-txid>')\nconsole.log(result.didDocument)\n\n// Update\nawait wallet.updateDID({ did, services: [{ id: did + '#api', type: 'API', serviceEndpoint: 'https://...' }] })\n\n// List\nconst dids = await wallet.listDIDs()\n\n// Deactivate\nawait wallet.deactivateDID(did)\n\n// Static utilities\nDID.isValid('did:bsv:d803b04a...') // true\nDID.parse('did:bsv:d803b04a...') // { method: 'bsv', identifier: 'd803b04a...' }\n```\n";
7
+ export declare const credentialsApiReference = "# @bsv/simple \u2014 Credentials API Reference\n\n## CredentialSchema\n\n### Constructor\n```typescript\nconst schema = new CredentialSchema({\n id: 'my-schema',\n name: 'My Credential',\n description: 'Optional',\n fields: [\n { key: 'name', label: 'Full Name', type: 'text', required: true },\n { key: 'email', label: 'Email', type: 'email' },\n { key: 'role', label: 'Role', type: 'select', options: [{ value: 'admin', label: 'Admin' }] }\n ],\n validate: (values) => values.name.length < 2 ? 'Name too short' : null,\n computedFields: (values) => ({ verified: 'true', timestamp: Date.now().toString() })\n})\n```\n\n### Methods\n- `validate(values: Record<string, string>): string | null`\n- `computeFields(values: Record<string, string>): Record<string, string>`\n- `getInfo(): { id, name, description?, certificateTypeBase64, fieldCount }`\n- `getConfig(): CredentialSchemaConfig`\n\n## CredentialIssuer\n\n### CredentialIssuer.create(config): Promise<CredentialIssuer>\n```typescript\nconst issuer = await CredentialIssuer.create({\n privateKey: 'hex_key',\n schemas: [schemaConfig],\n revocation: {\n enabled: true,\n wallet: walletInstance, // for creating revocation UTXOs\n store: new MemoryRevocationStore() // or FileRevocationStore\n }\n})\n```\n\n### Methods\n- `issue(subjectIdentityKey, schemaId, fields): Promise<VerifiableCredential>`\n- `verify(vc: VerifiableCredential): Promise<VerificationResult>`\n- `revoke(serialNumber: string): Promise<{ txid }>`\n- `isRevoked(serialNumber: string): Promise<boolean>`\n- `getInfo(): { publicKey, did, schemas: [{ id, name }] }`\n\n## Revocation Stores\n\n### MemoryRevocationStore (browser/tests)\n```typescript\nimport { MemoryRevocationStore } from '@bsv/simple/browser'\nconst store = new MemoryRevocationStore()\n```\n\n### FileRevocationStore (server only)\n```typescript\nimport { FileRevocationStore } from '@bsv/simple/server'\nconst store = new FileRevocationStore() // default: .revocation-secrets.json\nconst store = new FileRevocationStore('/custom/path.json')\n```\n\n### RevocationStore Interface\n```typescript\ninterface RevocationStore {\n save(serialNumber: string, record: RevocationRecord): Promise<void>\n load(serialNumber: string): Promise<RevocationRecord | undefined>\n delete(serialNumber: string): Promise<void>\n has(serialNumber: string): Promise<boolean>\n findByOutpoint(outpoint: string): Promise<boolean>\n}\n```\n\n## W3C VC/VP Utilities\n```typescript\nimport { toVerifiableCredential, toVerifiablePresentation } from '@bsv/simple/browser'\n\nconst vc = toVerifiableCredential(certData, issuerPublicKey, { credentialType: 'MyType' })\nconst vp = toVerifiablePresentation([vc1, vc2], holderKey)\n```\n\n## Wallet Methods\n- `acquireCredential(config): Promise<VerifiableCredential>` \u2014 Acquire VC from remote issuer (uses `?action=info` and `?action=certify` query params)\n- `listCredentials(config): Promise<VerifiableCredential[]>` \u2014 List certs as W3C VCs\n- `createPresentation(credentials): VerifiablePresentation` \u2014 Wrap VCs into a VP\n\n## Server-Side Handler\n\n```typescript\n// app/api/credential-issuer/route.ts (no [[...path]] catch-all needed!)\nimport { createCredentialIssuerHandler } from '@bsv/simple/server'\nconst handler = createCredentialIssuerHandler({\n schemas: [{ id: 'my-cred', name: 'MyCred', fields: [{ key: 'name', label: 'Name', type: 'text', required: true }] }]\n})\nexport const GET = handler.GET, POST = handler.POST\n```\n";
8
+ export declare const overlayApiReference = "# @bsv/simple \u2014 Overlay API Reference\n\n## Overlay Class (standalone)\n\n### Overlay.create(config): Promise<Overlay>\n```typescript\nconst overlay = await Overlay.create({\n topics: ['tm_my_topic'], // MUST start with 'tm_'\n network: 'mainnet', // 'mainnet' | 'testnet' | 'local'\n slapTrackers: ['https://...'], // optional\n hostOverrides: { tm_topic: ['url'] }, // optional\n additionalHosts: { tm_topic: ['url'] } // optional\n})\n```\n\n### Instance Methods\n- `getInfo(): OverlayInfo` \u2014 { topics, network }\n- `addTopic(topic: string): void` \u2014 Add topic (must start with 'tm_')\n- `removeTopic(topic: string): void` \u2014 Remove topic\n- `broadcast(tx: Transaction, topics?: string[]): Promise<OverlayBroadcastResult>`\n- `query(service: string, query: unknown, timeout?: number): Promise<LookupAnswer>`\n- `lookupOutputs(service: string, query: unknown): Promise<OverlayOutput[]>`\n- `getBroadcaster(): TopicBroadcaster` \u2014 Raw SDK broadcaster\n- `getResolver(): LookupResolver` \u2014 Raw SDK resolver\n\n## Wallet Methods (overlay module)\n\n### advertiseSHIP(domain, topic, basket?): Promise<TransactionResult>\nCreate a SHIP advertisement token. Topic must start with 'tm_'.\n\n### advertiseSLAP(domain, service, basket?): Promise<TransactionResult>\nCreate a SLAP advertisement token. Service must start with 'ls_'.\n\n### broadcastAction(overlay, actionOptions, topics?): Promise<{ txid, broadcast }>\nCreate an action and broadcast to overlay in one step.\n\n### withRetry<T>(operation, overlay, maxRetries?): Promise<T>\nDouble-spend retry wrapper using `withDoubleSpendRetry`.\n\n## Types\n```typescript\ninterface OverlayConfig {\n topics: string[]\n network?: 'mainnet' | 'testnet' | 'local'\n slapTrackers?: string[]\n hostOverrides?: Record<string, string[]>\n additionalHosts?: Record<string, string[]>\n}\ninterface OverlayBroadcastResult { success: boolean; txid?: string; code?: string; description?: string }\ninterface OverlayOutput { beef: number[]; outputIndex: number; context?: number[] }\n```\n";