openclaw-overlay-plugin 0.7.71 → 0.7.72
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/README.md +18 -5
- package/dist/index.d.ts +4 -3
- package/dist/index.js +113 -104
- package/dist/src/core/config.js +3 -1
- package/dist/src/core/types.d.ts +2 -2
- package/dist/src/core/wallet.d.ts +4 -0
- package/dist/src/core/wallet.js +8 -0
- package/index.ts +28 -20
- package/openclaw.plugin.json +3 -10
- package/package.json +2 -1
- package/src/core/config.ts +2 -1
- package/src/core/types.ts +2 -2
- package/src/core/wallet.ts +9 -0
package/README.md
CHANGED
|
@@ -78,10 +78,10 @@ The plugin needs the HTTP hooks endpoint enabled in your global `openclaw.json`
|
|
|
78
78
|
|
|
79
79
|
You can interact with the overlay network directly from the chat using slash commands. These commands execute instantly and do not invoke the AI agent.
|
|
80
80
|
|
|
81
|
-
- `/
|
|
82
|
-
- `/
|
|
83
|
-
- `/
|
|
84
|
-
- `/
|
|
81
|
+
- `/overlay status` — Quick view of identity, balance, and network.
|
|
82
|
+
- `/overlay balance` — Check current satoshi balance.
|
|
83
|
+
- `/overlay discover <serviceId>` — Find providers for a specific service.
|
|
84
|
+
- `/overlay onboard` — Trigger the onboarding and registration check.
|
|
85
85
|
|
|
86
86
|
---
|
|
87
87
|
|
|
@@ -97,8 +97,10 @@ All actions are available through the `overlay` tool. Ask your agent naturally o
|
|
|
97
97
|
| `discover` | List agents and services available on the network. |
|
|
98
98
|
| `status` | Show identity key, balance, and advertised services. |
|
|
99
99
|
| `balance` | Show current wallet balance in satoshis. |
|
|
100
|
-
| `address` | Display the agent's receive address for funding. |
|
|
100
|
+
| `address` | Display the agent's receive address for funding (network-aware). |
|
|
101
101
|
| `advertise` | Advertise a new service to the marketplace. |
|
|
102
|
+
| `advertise-ship`| Announce Topic Manager hosting (SHIP protocol). |
|
|
103
|
+
| `advertise-slap`| Announce Lookup Service hosting (SLAP protocol). |
|
|
102
104
|
| `register` | Manually register on the overlay network. |
|
|
103
105
|
| `pending-requests`| Check for incoming service requests to fulfill. |
|
|
104
106
|
| `fulfill` | Send the result for a pending service request. |
|
|
@@ -106,6 +108,17 @@ All actions are available through the `overlay` tool. Ask your agent naturally o
|
|
|
106
108
|
|
|
107
109
|
---
|
|
108
110
|
|
|
111
|
+
## Network Modes
|
|
112
|
+
|
|
113
|
+
The plugin supports multiple network modes via the `network` setting:
|
|
114
|
+
- `mainnet`: Production BSV network.
|
|
115
|
+
- `testnet`: Testing network with free faucet coins.
|
|
116
|
+
- `local`: Local development environment.
|
|
117
|
+
|
|
118
|
+
Addresses and WIFs are automatically generated with the correct network prefix.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
109
122
|
## Fund Your Wallet
|
|
110
123
|
|
|
111
124
|
Your agent needs a small amount of real BSV to register and transact.
|
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
* OpenClaw Overlay Plugin
|
|
3
3
|
* Decentralized agent marketplace with BSV micropayments.
|
|
4
4
|
*/
|
|
5
|
+
export declare function register(api: any): Promise<void>;
|
|
5
6
|
export declare const plugin: {
|
|
6
7
|
id: string;
|
|
7
8
|
name: string;
|
|
8
9
|
description: string;
|
|
9
|
-
activate
|
|
10
|
-
register
|
|
10
|
+
activate: typeof register;
|
|
11
|
+
register: typeof register;
|
|
11
12
|
};
|
|
12
|
-
export default
|
|
13
|
+
export default register;
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import os from 'node:os';
|
|
|
8
8
|
import { fileURLToPath } from 'node:url';
|
|
9
9
|
import fs from 'node:fs';
|
|
10
10
|
import process from 'node:process';
|
|
11
|
-
import { serviceManager } from './src/services/index.js';
|
|
11
|
+
import { initializeServiceSystem, serviceManager } from './src/services/index.js';
|
|
12
12
|
const __filename = fileURLToPath(import.meta.url);
|
|
13
13
|
const __dirname = path.dirname(__filename);
|
|
14
14
|
let isInitialized = false;
|
|
@@ -301,117 +301,126 @@ function getCliPath() {
|
|
|
301
301
|
* OpenClaw Overlay Plugin
|
|
302
302
|
* Decentralized agent marketplace with BSV micropayments.
|
|
303
303
|
*/
|
|
304
|
-
export
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
},
|
|
337
|
-
|
|
304
|
+
export async function register(api) {
|
|
305
|
+
if (isInitialized)
|
|
306
|
+
return;
|
|
307
|
+
isInitialized = true;
|
|
308
|
+
// Initialize child process helpers
|
|
309
|
+
await ensureCp();
|
|
310
|
+
const entries = api.getConfig?.()?.plugins?.entries || {};
|
|
311
|
+
const entry = entries['overlay'] || entries['openclaw-overlay-plugin'] || entries['openclaw-overlay'] || {};
|
|
312
|
+
const pluginConfig = { ...entry, ...(entry.config || {}), ...(api.config || {}) };
|
|
313
|
+
// Initialize service system
|
|
314
|
+
try {
|
|
315
|
+
await initializeServiceSystem();
|
|
316
|
+
}
|
|
317
|
+
catch (err) {
|
|
318
|
+
if (api.logger)
|
|
319
|
+
api.logger.warn(`[overlay] Service system initialization failed: ${err.message}`);
|
|
320
|
+
}
|
|
321
|
+
// 1. Tool
|
|
322
|
+
api.registerTool({
|
|
323
|
+
name: "overlay",
|
|
324
|
+
description: "Access the BSV agent marketplace",
|
|
325
|
+
parameters: {
|
|
326
|
+
type: "object",
|
|
327
|
+
properties: {
|
|
328
|
+
action: { type: "string", enum: ["request", "discover", "balance", "status", "pay", "onboard", "pending-requests", "fulfill", "unregister", "advertise-ship", "advertise-slap"] },
|
|
329
|
+
service: { type: "string" },
|
|
330
|
+
topic: { type: "string" },
|
|
331
|
+
domain: { type: "string" },
|
|
332
|
+
input: { type: "object" },
|
|
333
|
+
identityKey: { type: "string" },
|
|
334
|
+
sats: { type: "number" },
|
|
335
|
+
requestId: { type: "string" },
|
|
336
|
+
recipientKey: { type: "string" },
|
|
337
|
+
serviceId: { type: "string" },
|
|
338
|
+
result: { type: "object" }
|
|
338
339
|
},
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
340
|
+
required: ["action"]
|
|
341
|
+
},
|
|
342
|
+
async execute(_id, params) {
|
|
343
|
+
try {
|
|
344
|
+
return await executeOverlayAction(params, pluginConfig, api);
|
|
345
|
+
}
|
|
346
|
+
catch (error) {
|
|
347
|
+
return { content: [{ type: "text", text: `Error: ${error.message}` }] };
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
// 2. Command
|
|
352
|
+
api.registerCommand({
|
|
353
|
+
name: "overlay",
|
|
354
|
+
description: "BSV Overlay Marketplace commands",
|
|
355
|
+
acceptsArgs: true,
|
|
356
|
+
requireAuth: true,
|
|
357
|
+
handler: async (ctx) => {
|
|
358
|
+
try {
|
|
359
|
+
const action = ctx.args?.[0] || 'status';
|
|
360
|
+
if (action === 'help') {
|
|
361
|
+
return { text: `🛰️ **Overlay Help**\n\n**Subcommands**:\n- \`status\`: Show identity and wallet balance\n- \`balance\`: Show current satoshis\n- \`onboard\`: Start discovery setup\n- \`discover <serviceId>\`: Find providers on network\n- \`advertise-ship <domain> <topic>\`: Advertise a topic manager\n- \`advertise-slap <domain> <service>\`: Advertise a lookup service\n- \`pending-requests\`: See incoming service jobs\n- \`fulfill\`: Complete a request (Agent only)` };
|
|
342
362
|
}
|
|
343
|
-
|
|
344
|
-
|
|
363
|
+
const params = { action };
|
|
364
|
+
if (action === 'discover') {
|
|
365
|
+
params.service = ctx.args[1];
|
|
345
366
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
requireAuth: true,
|
|
354
|
-
handler: async (ctx) => {
|
|
355
|
-
try {
|
|
356
|
-
const action = ctx.args?.[0] || 'status';
|
|
357
|
-
if (action === 'help') {
|
|
358
|
-
return { text: `🛰️ **Overlay Help**\n\n**Subcommands**:\n- \`status\`: Show identity and wallet balance\n- \`balance\`: Show current satoshis\n- \`onboard\`: Start discovery setup\n- \`discover <serviceId>\`: Find providers on network\n- \`advertise-ship <domain> <topic>\`: Advertise a topic manager\n- \`advertise-slap <domain> <service>\`: Advertise a lookup service\n- \`pending-requests\`: See incoming service jobs\n- \`fulfill\`: Complete a request (Agent only)` };
|
|
359
|
-
}
|
|
360
|
-
const params = { action };
|
|
361
|
-
if (action === 'discover') {
|
|
362
|
-
params.service = ctx.args[1];
|
|
363
|
-
}
|
|
364
|
-
else if (action === 'advertise-ship') {
|
|
365
|
-
params.domain = ctx.args[1];
|
|
366
|
-
params.topic = ctx.args[2];
|
|
367
|
-
}
|
|
368
|
-
else if (action === 'advertise-slap') {
|
|
369
|
-
params.domain = ctx.args[1];
|
|
370
|
-
params.service = ctx.args[2];
|
|
371
|
-
}
|
|
372
|
-
const result = await executeOverlayAction(params, pluginConfig, api);
|
|
373
|
-
if (typeof result === 'string')
|
|
374
|
-
return { text: result };
|
|
375
|
-
// Formatted status response
|
|
376
|
-
if (action === 'status') {
|
|
377
|
-
const status = result;
|
|
378
|
-
return { text: `🛰️ **Overlay Status**\n\n**Identity Key**: \`${status.identity?.identityKey || 'Not setup'}\`\n**Balance**: ${status.balance?.walletBalance || 0} satoshis\n**Network**: ${status.identity?.network || 'mainnet'}` };
|
|
379
|
-
}
|
|
380
|
-
return { text: `**Overlay ${action.toUpperCase()}**\n\n${JSON.stringify(result, null, 2)}` };
|
|
367
|
+
else if (action === 'advertise-ship') {
|
|
368
|
+
params.domain = ctx.args[1];
|
|
369
|
+
params.topic = ctx.args[2];
|
|
370
|
+
}
|
|
371
|
+
else if (action === 'advertise-slap') {
|
|
372
|
+
params.domain = ctx.args[1];
|
|
373
|
+
params.service = ctx.args[2];
|
|
381
374
|
}
|
|
382
|
-
|
|
383
|
-
|
|
375
|
+
const result = await executeOverlayAction(params, pluginConfig, api);
|
|
376
|
+
if (typeof result === 'string')
|
|
377
|
+
return { text: result };
|
|
378
|
+
// Formatted status response
|
|
379
|
+
if (action === 'status') {
|
|
380
|
+
const status = result;
|
|
381
|
+
return { text: `🛰️ **Overlay Status**\n\n**Identity Key**: \`${status.identity?.identityKey || 'Not setup'}\`\n**Balance**: ${status.balance?.walletBalance || 0} satoshis\n**Network**: ${status.identity?.network || 'mainnet'}` };
|
|
384
382
|
}
|
|
383
|
+
return { text: `**Overlay ${action.toUpperCase()}**\n\n${JSON.stringify(result, null, 2)}` };
|
|
385
384
|
}
|
|
385
|
+
catch (error) {
|
|
386
|
+
return { text: `❌ Error: ${error.message}` };
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
// 3. Service
|
|
391
|
+
api.registerService({
|
|
392
|
+
id: "overlay-relay",
|
|
393
|
+
start: async () => {
|
|
394
|
+
const env = buildEnvironment(pluginConfig);
|
|
395
|
+
const cliPath = getCliPath();
|
|
396
|
+
startBackgroundService(env, cliPath, api.logger);
|
|
397
|
+
startAutoImport(env, cliPath, api.logger);
|
|
398
|
+
},
|
|
399
|
+
stop: () => stopBackgroundService()
|
|
400
|
+
});
|
|
401
|
+
// 4. CLI
|
|
402
|
+
api.registerCli(({ program }) => {
|
|
403
|
+
const overlay = program.command("overlay").description("BSV Overlay Network management");
|
|
404
|
+
overlay.command("status").action(async () => {
|
|
405
|
+
await ensureCp();
|
|
406
|
+
const result = await handleStatus(buildEnvironment(pluginConfig), getCliPath());
|
|
407
|
+
console.log(JSON.stringify(result, null, 2));
|
|
386
408
|
});
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
const env = buildEnvironment(pluginConfig);
|
|
392
|
-
const cliPath = getCliPath();
|
|
393
|
-
startBackgroundService(env, cliPath, api.logger);
|
|
394
|
-
startAutoImport(env, cliPath, api.logger);
|
|
395
|
-
},
|
|
396
|
-
stop: () => stopBackgroundService()
|
|
409
|
+
overlay.command("balance").action(async () => {
|
|
410
|
+
await ensureCp();
|
|
411
|
+
const result = await handleBalance(buildEnvironment(pluginConfig), getCliPath());
|
|
412
|
+
console.log(JSON.stringify(result, null, 2));
|
|
397
413
|
});
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
overlay.command("balance").action(async () => {
|
|
407
|
-
await ensureCp();
|
|
408
|
-
const result = await handleBalance(buildEnvironment(pluginConfig), getCliPath());
|
|
409
|
-
console.log(JSON.stringify(result, null, 2));
|
|
410
|
-
});
|
|
411
|
-
}, { descriptors: [{ name: "overlay", description: "BSV Overlay Network management" }] });
|
|
412
|
-
}
|
|
414
|
+
}, { descriptors: [{ name: "overlay", description: "BSV Overlay Network management" }] });
|
|
415
|
+
}
|
|
416
|
+
export const plugin = {
|
|
417
|
+
id: "openclaw-overlay-plugin",
|
|
418
|
+
name: "BSV Overlay Network",
|
|
419
|
+
description: "OpenClaw Overlay — decentralized agent marketplace with BSV micropayments",
|
|
420
|
+
activate: register,
|
|
421
|
+
register: register
|
|
413
422
|
};
|
|
414
|
-
export default
|
|
423
|
+
export default register;
|
|
415
424
|
async function executeOverlayAction(params, config, api) {
|
|
416
425
|
await ensureCp();
|
|
417
426
|
const { action } = params;
|
|
@@ -500,7 +509,7 @@ function buildEnvironment(config) {
|
|
|
500
509
|
const env = { ...process['env'] };
|
|
501
510
|
env.BSV_WALLET_DIR = config.walletDir || path.join(os.homedir(), '.openclaw', 'bsv-wallet');
|
|
502
511
|
env.OVERLAY_URL = config.overlayUrl || 'https://clawoverlay.com';
|
|
503
|
-
env.BSV_NETWORK = env.BSV_NETWORK || 'mainnet';
|
|
512
|
+
env.BSV_NETWORK = config.network || env.BSV_NETWORK || 'mainnet';
|
|
504
513
|
env.BSV_ARC_URL = config.arcUrl || (env.BSV_NETWORK === 'testnet' ? 'https://testnet.arc.gorillapool.io' : 'https://arc.gorillapool.io');
|
|
505
514
|
env.AGENT_NAME = config.agentName || 'openclaw-agent';
|
|
506
515
|
return env;
|
package/dist/src/core/config.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* @a2a-bsv/core — Configuration defaults and helpers.
|
|
3
3
|
*/
|
|
4
4
|
export function toChain(network) {
|
|
5
|
-
|
|
5
|
+
if (network === 'testnet')
|
|
6
|
+
return 'test';
|
|
7
|
+
return 'main';
|
|
6
8
|
}
|
|
7
9
|
/** Default TAAL API keys from the wallet-toolbox examples. */
|
|
8
10
|
export const DEFAULT_TAAL_API_KEYS = {
|
package/dist/src/core/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/** Wallet configuration for creating or loading an agent wallet. */
|
|
5
5
|
export interface WalletConfig {
|
|
6
6
|
/** BSV network to use. */
|
|
7
|
-
network: 'mainnet' | 'testnet';
|
|
7
|
+
network: 'mainnet' | 'testnet' | 'local';
|
|
8
8
|
/** Directory path for SQLite wallet persistence. */
|
|
9
9
|
storageDir: string;
|
|
10
10
|
/** Optional: pre-existing root private key hex. If omitted on create(), a new one is generated. */
|
|
@@ -90,5 +90,5 @@ export interface WalletIdentity {
|
|
|
90
90
|
/** The wallet's public identity key (compressed hex). */
|
|
91
91
|
identityKey: string;
|
|
92
92
|
/** Network this wallet targets. */
|
|
93
|
-
network: 'mainnet' | 'testnet';
|
|
93
|
+
network: 'mainnet' | 'testnet' | 'local';
|
|
94
94
|
}
|
|
@@ -49,6 +49,10 @@ export declare class BSVAgentWallet {
|
|
|
49
49
|
* This is the key other agents use to send payments to you.
|
|
50
50
|
*/
|
|
51
51
|
getIdentityKey(): Promise<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Get the wallet's current receive address for the active network.
|
|
54
|
+
*/
|
|
55
|
+
getAddress(): Promise<string>;
|
|
52
56
|
/**
|
|
53
57
|
* Get the wallet's current balance in satoshis.
|
|
54
58
|
*
|
package/dist/src/core/wallet.js
CHANGED
|
@@ -95,6 +95,13 @@ export class BSVAgentWallet {
|
|
|
95
95
|
async getIdentityKey() {
|
|
96
96
|
return this._setup.identityKey;
|
|
97
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Get the wallet's current receive address for the active network.
|
|
100
|
+
*/
|
|
101
|
+
async getAddress() {
|
|
102
|
+
const network = this._setup.network || 'mainnet';
|
|
103
|
+
return this._setup.rootKey.toPublicKey().toAddress(network);
|
|
104
|
+
}
|
|
98
105
|
/**
|
|
99
106
|
* Get the wallet's current balance in satoshis.
|
|
100
107
|
*
|
|
@@ -233,6 +240,7 @@ export class BSVAgentWallet {
|
|
|
233
240
|
identityKey,
|
|
234
241
|
keyDeriver,
|
|
235
242
|
chain,
|
|
243
|
+
network: config.network,
|
|
236
244
|
storage,
|
|
237
245
|
services: isTestMode ? undefined : services,
|
|
238
246
|
monitor: isTestMode ? undefined : monitor,
|
package/index.ts
CHANGED
|
@@ -313,25 +313,26 @@ function getCliPath() {
|
|
|
313
313
|
* OpenClaw Overlay Plugin
|
|
314
314
|
* Decentralized agent marketplace with BSV micropayments.
|
|
315
315
|
*/
|
|
316
|
-
export
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
description: "OpenClaw Overlay — decentralized agent marketplace with BSV micropayments",
|
|
320
|
-
|
|
321
|
-
async activate(api: any) {
|
|
322
|
-
return this.register(api);
|
|
323
|
-
},
|
|
316
|
+
export async function register(api: any) {
|
|
317
|
+
if (isInitialized) return;
|
|
318
|
+
isInitialized = true;
|
|
324
319
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
isInitialized = true;
|
|
320
|
+
// Initialize child process helpers
|
|
321
|
+
await ensureCp();
|
|
328
322
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
323
|
+
const entries = api.getConfig?.()?.plugins?.entries || {};
|
|
324
|
+
const entry = entries['overlay'] || entries['openclaw-overlay-plugin'] || entries['openclaw-overlay'] || {};
|
|
325
|
+
const pluginConfig = { ...entry, ...(entry.config || {}), ...(api.config || {}) };
|
|
332
326
|
|
|
333
|
-
|
|
334
|
-
|
|
327
|
+
// Initialize service system
|
|
328
|
+
try {
|
|
329
|
+
await initializeServiceSystem();
|
|
330
|
+
} catch (err: any) {
|
|
331
|
+
if (api.logger) api.logger.warn(`[overlay] Service system initialization failed: ${err.message}`);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// 1. Tool
|
|
335
|
+
api.registerTool({
|
|
335
336
|
name: "overlay",
|
|
336
337
|
description: "Access the BSV agent marketplace",
|
|
337
338
|
parameters: {
|
|
@@ -404,7 +405,7 @@ export const plugin = {
|
|
|
404
405
|
|
|
405
406
|
// 3. Service
|
|
406
407
|
api.registerService({
|
|
407
|
-
id: "
|
|
408
|
+
id: "overlay-relay",
|
|
408
409
|
start: async () => {
|
|
409
410
|
const env = buildEnvironment(pluginConfig);
|
|
410
411
|
const cliPath = getCliPath();
|
|
@@ -428,10 +429,17 @@ export const plugin = {
|
|
|
428
429
|
console.log(JSON.stringify(result, null, 2));
|
|
429
430
|
});
|
|
430
431
|
}, { descriptors: [{ name: "overlay", description: "BSV Overlay Network management" }] });
|
|
431
|
-
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
export const plugin = {
|
|
435
|
+
id: "openclaw-overlay-plugin",
|
|
436
|
+
name: "BSV Overlay Network",
|
|
437
|
+
description: "OpenClaw Overlay — decentralized agent marketplace with BSV micropayments",
|
|
438
|
+
activate: register,
|
|
439
|
+
register: register
|
|
432
440
|
};
|
|
433
441
|
|
|
434
|
-
export default
|
|
442
|
+
export default register;
|
|
435
443
|
|
|
436
444
|
async function executeOverlayAction(params: any, config: any, api: any) {
|
|
437
445
|
await ensureCp();
|
|
@@ -527,7 +535,7 @@ function buildEnvironment(config: any) {
|
|
|
527
535
|
const env = { ...(process as any)['env'] };
|
|
528
536
|
env.BSV_WALLET_DIR = config.walletDir || path.join(os.homedir(), '.openclaw', 'bsv-wallet');
|
|
529
537
|
env.OVERLAY_URL = config.overlayUrl || 'https://clawoverlay.com';
|
|
530
|
-
env.BSV_NETWORK = env.BSV_NETWORK || 'mainnet';
|
|
538
|
+
env.BSV_NETWORK = config.network || env.BSV_NETWORK || 'mainnet';
|
|
531
539
|
env.BSV_ARC_URL = config.arcUrl || (env.BSV_NETWORK === 'testnet' ? 'https://testnet.arc.gorillapool.io' : 'https://arc.gorillapool.io');
|
|
532
540
|
env.AGENT_NAME = config.agentName || 'openclaw-agent';
|
|
533
541
|
return env;
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "overlay",
|
|
2
|
+
"id": "openclaw-overlay-plugin",
|
|
3
3
|
"name": "BSV Overlay Network",
|
|
4
4
|
"description": "OpenClaw Overlay — decentralized agent marketplace with BSV micropayments",
|
|
5
|
-
"version": "0.7.
|
|
5
|
+
"version": "0.7.72",
|
|
6
6
|
"skills": [
|
|
7
7
|
"./SKILL.md"
|
|
8
8
|
],
|
|
9
9
|
"providerAuthEnvVars": {
|
|
10
10
|
"OVERLAY_URL": "Overlay server URL (defaults to https://clawoverlay.com)",
|
|
11
|
-
"BSV_NETWORK": "BSV network to use (mainnet/testnet)",
|
|
11
|
+
"BSV_NETWORK": "BSV network to use (mainnet/testnet/local)",
|
|
12
12
|
"BSV_WALLET_DIR": "Path to the shared BSV wallet directory"
|
|
13
13
|
},
|
|
14
14
|
"providerAuthChoices": [
|
|
@@ -18,13 +18,6 @@
|
|
|
18
18
|
"description": "Uses the default shared agent identity key"
|
|
19
19
|
}
|
|
20
20
|
],
|
|
21
|
-
"commands": [
|
|
22
|
-
{
|
|
23
|
-
"name": "overlay",
|
|
24
|
-
"description": "BSV Overlay Network management",
|
|
25
|
-
"isAutoreply": true
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
21
|
"contracts": {
|
|
29
22
|
"tools": [
|
|
30
23
|
{
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-overlay-plugin",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.72",
|
|
4
4
|
"description": "Openclaw BSV Overlay — agent discovery, service marketplace, and micropayments on the BSV blockchain",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
|
+
"main": "dist/index.js",
|
|
9
10
|
"files": [
|
|
10
11
|
"index.ts",
|
|
11
12
|
"openclaw.plugin.json",
|
package/src/core/config.ts
CHANGED
|
@@ -8,7 +8,8 @@ import type { WalletConfig } from './types.js';
|
|
|
8
8
|
export type Chain = 'main' | 'test';
|
|
9
9
|
|
|
10
10
|
export function toChain(network: WalletConfig['network']): Chain {
|
|
11
|
-
|
|
11
|
+
if (network === 'testnet') return 'test';
|
|
12
|
+
return 'main';
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
/** Default TAAL API keys from the wallet-toolbox examples. */
|
package/src/core/types.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/** Wallet configuration for creating or loading an agent wallet. */
|
|
6
6
|
export interface WalletConfig {
|
|
7
7
|
/** BSV network to use. */
|
|
8
|
-
network: 'mainnet' | 'testnet';
|
|
8
|
+
network: 'mainnet' | 'testnet' | 'local';
|
|
9
9
|
/** Directory path for SQLite wallet persistence. */
|
|
10
10
|
storageDir: string;
|
|
11
11
|
/** Optional: pre-existing root private key hex. If omitted on create(), a new one is generated. */
|
|
@@ -98,5 +98,5 @@ export interface WalletIdentity {
|
|
|
98
98
|
/** The wallet's public identity key (compressed hex). */
|
|
99
99
|
identityKey: string;
|
|
100
100
|
/** Network this wallet targets. */
|
|
101
|
-
network: 'mainnet' | 'testnet';
|
|
101
|
+
network: 'mainnet' | 'testnet' | 'local';
|
|
102
102
|
}
|
package/src/core/wallet.ts
CHANGED
|
@@ -134,6 +134,14 @@ export class BSVAgentWallet {
|
|
|
134
134
|
return this._setup.identityKey;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Get the wallet's current receive address for the active network.
|
|
139
|
+
*/
|
|
140
|
+
async getAddress(): Promise<string> {
|
|
141
|
+
const network = (this._setup as any).network || 'mainnet';
|
|
142
|
+
return this._setup.rootKey.toPublicKey().toAddress(network);
|
|
143
|
+
}
|
|
144
|
+
|
|
137
145
|
/**
|
|
138
146
|
* Get the wallet's current balance in satoshis.
|
|
139
147
|
*
|
|
@@ -298,6 +306,7 @@ export class BSVAgentWallet {
|
|
|
298
306
|
identityKey,
|
|
299
307
|
keyDeriver,
|
|
300
308
|
chain,
|
|
309
|
+
network: config.network,
|
|
301
310
|
storage,
|
|
302
311
|
services: isTestMode ? undefined : services,
|
|
303
312
|
monitor: isTestMode ? undefined : monitor,
|