openclaw-overlay-plugin 0.7.34 → 0.7.35
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 +1 -1
- package/dist/index.js +13 -2
- package/dist/src/scripts/config.d.ts +1 -1
- package/dist/src/scripts/config.js +1 -1
- package/index.ts +15 -2
- package/openclaw.plugin.json +2 -1
- package/package.json +1 -1
- package/src/scripts/config.ts +1 -1
- package/dist/cli-main.d.ts +0 -7
- package/dist/cli-main.js +0 -192
- package/dist/cli.d.ts +0 -8
- package/dist/cli.js +0 -14
- package/dist/core/config.d.ts +0 -11
- package/dist/core/config.js +0 -13
- package/dist/core/index.d.ts +0 -25
- package/dist/core/index.js +0 -26
- package/dist/core/payment.d.ts +0 -16
- package/dist/core/payment.js +0 -94
- package/dist/core/types.d.ts +0 -94
- package/dist/core/types.js +0 -4
- package/dist/core/verify.d.ts +0 -28
- package/dist/core/verify.js +0 -104
- package/dist/core/wallet.d.ts +0 -99
- package/dist/core/wallet.js +0 -219
- package/dist/scripts/baemail/commands.d.ts +0 -64
- package/dist/scripts/baemail/commands.js +0 -259
- package/dist/scripts/baemail/handler.d.ts +0 -36
- package/dist/scripts/baemail/handler.js +0 -284
- package/dist/scripts/baemail/index.d.ts +0 -5
- package/dist/scripts/baemail/index.js +0 -5
- package/dist/scripts/config.d.ts +0 -48
- package/dist/scripts/config.js +0 -68
- package/dist/scripts/index.d.ts +0 -7
- package/dist/scripts/index.js +0 -7
- package/dist/scripts/messaging/connect.d.ts +0 -8
- package/dist/scripts/messaging/connect.js +0 -114
- package/dist/scripts/messaging/handlers.d.ts +0 -21
- package/dist/scripts/messaging/handlers.js +0 -334
- package/dist/scripts/messaging/inbox.d.ts +0 -11
- package/dist/scripts/messaging/inbox.js +0 -51
- package/dist/scripts/messaging/index.d.ts +0 -8
- package/dist/scripts/messaging/index.js +0 -8
- package/dist/scripts/messaging/poll.d.ts +0 -7
- package/dist/scripts/messaging/poll.js +0 -52
- package/dist/scripts/messaging/send.d.ts +0 -7
- package/dist/scripts/messaging/send.js +0 -43
- package/dist/scripts/output.d.ts +0 -12
- package/dist/scripts/output.js +0 -19
- package/dist/scripts/overlay/discover.d.ts +0 -7
- package/dist/scripts/overlay/discover.js +0 -72
- package/dist/scripts/overlay/index.d.ts +0 -7
- package/dist/scripts/overlay/index.js +0 -7
- package/dist/scripts/overlay/registration.d.ts +0 -19
- package/dist/scripts/overlay/registration.js +0 -176
- package/dist/scripts/overlay/services.d.ts +0 -29
- package/dist/scripts/overlay/services.js +0 -167
- package/dist/scripts/overlay/transaction.d.ts +0 -42
- package/dist/scripts/overlay/transaction.js +0 -103
- package/dist/scripts/payment/build.d.ts +0 -24
- package/dist/scripts/payment/build.js +0 -54
- package/dist/scripts/payment/commands.d.ts +0 -15
- package/dist/scripts/payment/commands.js +0 -73
- package/dist/scripts/payment/index.d.ts +0 -6
- package/dist/scripts/payment/index.js +0 -6
- package/dist/scripts/payment/types.d.ts +0 -56
- package/dist/scripts/payment/types.js +0 -4
- package/dist/scripts/services/index.d.ts +0 -6
- package/dist/scripts/services/index.js +0 -6
- package/dist/scripts/services/queue.d.ts +0 -11
- package/dist/scripts/services/queue.js +0 -28
- package/dist/scripts/services/request.d.ts +0 -7
- package/dist/scripts/services/request.js +0 -82
- package/dist/scripts/services/respond.d.ts +0 -11
- package/dist/scripts/services/respond.js +0 -132
- package/dist/scripts/types.d.ts +0 -107
- package/dist/scripts/types.js +0 -4
- package/dist/scripts/utils/index.d.ts +0 -6
- package/dist/scripts/utils/index.js +0 -6
- package/dist/scripts/utils/merkle.d.ts +0 -12
- package/dist/scripts/utils/merkle.js +0 -47
- package/dist/scripts/utils/storage.d.ts +0 -66
- package/dist/scripts/utils/storage.js +0 -211
- package/dist/scripts/utils/woc.d.ts +0 -26
- package/dist/scripts/utils/woc.js +0 -91
- package/dist/scripts/wallet/balance.d.ts +0 -22
- package/dist/scripts/wallet/balance.js +0 -240
- package/dist/scripts/wallet/identity.d.ts +0 -70
- package/dist/scripts/wallet/identity.js +0 -151
- package/dist/scripts/wallet/index.d.ts +0 -6
- package/dist/scripts/wallet/index.js +0 -6
- package/dist/scripts/wallet/setup.d.ts +0 -15
- package/dist/scripts/wallet/setup.js +0 -105
- package/dist/scripts/x-verification/commands.d.ts +0 -27
- package/dist/scripts/x-verification/commands.js +0 -222
- package/dist/scripts/x-verification/index.d.ts +0 -4
- package/dist/scripts/x-verification/index.js +0 -4
- package/dist/services/built-in/api-proxy/index.d.ts +0 -6
- package/dist/services/built-in/api-proxy/index.js +0 -23
- package/dist/services/built-in/code-develop/index.d.ts +0 -6
- package/dist/services/built-in/code-develop/index.js +0 -23
- package/dist/services/built-in/code-review/index.d.ts +0 -10
- package/dist/services/built-in/code-review/index.js +0 -51
- package/dist/services/built-in/image-analysis/index.d.ts +0 -6
- package/dist/services/built-in/image-analysis/index.js +0 -33
- package/dist/services/built-in/memory-store/index.d.ts +0 -6
- package/dist/services/built-in/memory-store/index.js +0 -22
- package/dist/services/built-in/roulette/index.d.ts +0 -6
- package/dist/services/built-in/roulette/index.js +0 -27
- package/dist/services/built-in/summarize/index.d.ts +0 -6
- package/dist/services/built-in/summarize/index.js +0 -21
- package/dist/services/built-in/tell-joke/handler.d.ts +0 -7
- package/dist/services/built-in/tell-joke/handler.js +0 -122
- package/dist/services/built-in/tell-joke/index.d.ts +0 -9
- package/dist/services/built-in/tell-joke/index.js +0 -31
- package/dist/services/built-in/translate/index.d.ts +0 -6
- package/dist/services/built-in/translate/index.js +0 -21
- package/dist/services/built-in/web-research/index.d.ts +0 -9
- package/dist/services/built-in/web-research/index.js +0 -51
- package/dist/services/index.d.ts +0 -13
- package/dist/services/index.js +0 -14
- package/dist/services/loader.d.ts +0 -77
- package/dist/services/loader.js +0 -292
- package/dist/services/manager.d.ts +0 -86
- package/dist/services/manager.js +0 -255
- package/dist/services/registry.d.ts +0 -98
- package/dist/services/registry.js +0 -204
- package/dist/services/types.d.ts +0 -230
- package/dist/services/types.js +0 -30
- package/dist/test/cli.test.d.ts +0 -7
- package/dist/test/cli.test.js +0 -329
- package/dist/test/comprehensive-overlay.test.d.ts +0 -13
- package/dist/test/comprehensive-overlay.test.js +0 -593
- package/dist/test/key-derivation.test.d.ts +0 -12
- package/dist/test/key-derivation.test.js +0 -86
- package/dist/test/overlay-submit.test.d.ts +0 -10
- package/dist/test/overlay-submit.test.js +0 -460
- package/dist/test/request-response-flow.test.d.ts +0 -5
- package/dist/test/request-response-flow.test.js +0 -209
- package/dist/test/service-system.test.d.ts +0 -5
- package/dist/test/service-system.test.js +0 -190
- package/dist/test/utils/server-logic.d.ts +0 -98
- package/dist/test/utils/server-logic.js +0 -286
- package/dist/test/wallet.test.d.ts +0 -7
- package/dist/test/wallet.test.js +0 -146
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ After installing, you can configure the plugin in `~/.openclaw/openclaw.json` un
|
|
|
34
34
|
"maxAutoPaySats": 200,
|
|
35
35
|
"dailyBudgetSats": 5000,
|
|
36
36
|
"chaintracksUrl": "https://chaintracks-us-1.bsvb.tech",
|
|
37
|
-
"arcUrl": "https://
|
|
37
|
+
"arcUrl": "https://arc.gorillapool.io"
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
package/dist/index.js
CHANGED
|
@@ -405,8 +405,14 @@ function stopBackgroundService() {
|
|
|
405
405
|
stopAutoImport();
|
|
406
406
|
}
|
|
407
407
|
export default function register(api) {
|
|
408
|
-
// Capture config at registration time
|
|
409
|
-
|
|
408
|
+
// Capture config at registration time
|
|
409
|
+
// Check all possible IDs for backward compatibility and various installation methods
|
|
410
|
+
const entries = api.getConfig?.()?.plugins?.entries || {};
|
|
411
|
+
const entry = entries['openclaw-overlay']
|
|
412
|
+
|| entries['openclaw-overlay-plugin']
|
|
413
|
+
|| entries['bsv-overlay']
|
|
414
|
+
|| {};
|
|
415
|
+
// Merge: gateway-level api.config > nested entry.config > flat entry properties
|
|
410
416
|
const pluginConfig = { ...entry, ...(entry.config || {}), ...(api.config || {}) };
|
|
411
417
|
// Register the overlay agent tool
|
|
412
418
|
api.registerTool({
|
|
@@ -1416,6 +1422,11 @@ function buildEnvironment(config) {
|
|
|
1416
1422
|
}
|
|
1417
1423
|
// Set defaults
|
|
1418
1424
|
env.BSV_NETWORK = env.BSV_NETWORK || 'mainnet';
|
|
1425
|
+
if (!env.BSV_ARC_URL) {
|
|
1426
|
+
env.BSV_ARC_URL = env.BSV_NETWORK === 'testnet'
|
|
1427
|
+
? 'https://testnet.arc.gorillapool.io'
|
|
1428
|
+
: 'https://arc.gorillapool.io';
|
|
1429
|
+
}
|
|
1419
1430
|
if (config.agentName) {
|
|
1420
1431
|
env.AGENT_NAME = config.agentName;
|
|
1421
1432
|
}
|
|
@@ -16,7 +16,7 @@ export declare const WOC_API_KEY: string;
|
|
|
16
16
|
/** Overlay state directory for registration, services, etc. */
|
|
17
17
|
export declare const OVERLAY_STATE_DIR: string;
|
|
18
18
|
/** Protocol identifier for overlay transactions */
|
|
19
|
-
export declare const PROTOCOL_ID = "
|
|
19
|
+
export declare const PROTOCOL_ID = "clawdbot-overlay-v1";
|
|
20
20
|
/** Topic managers for overlay submissions */
|
|
21
21
|
export declare const TOPICS: {
|
|
22
22
|
readonly IDENTITY: "tm_openclaw_identity";
|
|
@@ -36,7 +36,7 @@ export const WOC_API_KEY = process.env.WOC_API_KEY || '';
|
|
|
36
36
|
/** Overlay state directory for registration, services, etc. */
|
|
37
37
|
export const OVERLAY_STATE_DIR = path.join(os.homedir(), '.openclaw', 'openclaw-overlay');
|
|
38
38
|
/** Protocol identifier for overlay transactions */
|
|
39
|
-
export const PROTOCOL_ID = '
|
|
39
|
+
export const PROTOCOL_ID = 'clawdbot-overlay-v1';
|
|
40
40
|
/** Topic managers for overlay submissions */
|
|
41
41
|
export const TOPICS = {
|
|
42
42
|
IDENTITY: 'tm_openclaw_identity',
|
package/index.ts
CHANGED
|
@@ -448,8 +448,15 @@ function stopBackgroundService() {
|
|
|
448
448
|
}
|
|
449
449
|
|
|
450
450
|
export default function register(api: any) {
|
|
451
|
-
// Capture config at registration time
|
|
452
|
-
|
|
451
|
+
// Capture config at registration time
|
|
452
|
+
// Check all possible IDs for backward compatibility and various installation methods
|
|
453
|
+
const entries = api.getConfig?.()?.plugins?.entries || {};
|
|
454
|
+
const entry = entries['openclaw-overlay']
|
|
455
|
+
|| entries['openclaw-overlay-plugin']
|
|
456
|
+
|| entries['bsv-overlay']
|
|
457
|
+
|| {};
|
|
458
|
+
|
|
459
|
+
// Merge: gateway-level api.config > nested entry.config > flat entry properties
|
|
453
460
|
const pluginConfig = { ...entry, ...(entry.config || {}), ...(api.config || {}) };
|
|
454
461
|
|
|
455
462
|
// Register the overlay agent tool
|
|
@@ -1598,6 +1605,12 @@ function buildEnvironment(config: any) {
|
|
|
1598
1605
|
|
|
1599
1606
|
// Set defaults
|
|
1600
1607
|
env.BSV_NETWORK = env.BSV_NETWORK || 'mainnet';
|
|
1608
|
+
|
|
1609
|
+
if (!env.BSV_ARC_URL) {
|
|
1610
|
+
env.BSV_ARC_URL = env.BSV_NETWORK === 'testnet'
|
|
1611
|
+
? 'https://testnet.arc.gorillapool.io'
|
|
1612
|
+
: 'https://arc.gorillapool.io';
|
|
1613
|
+
}
|
|
1601
1614
|
if (config.agentName) {
|
|
1602
1615
|
env.AGENT_NAME = config.agentName;
|
|
1603
1616
|
} else if (!env.AGENT_NAME) {
|
package/openclaw.plugin.json
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"arcUrl": {
|
|
30
30
|
"type": "string",
|
|
31
|
+
"default": "https://arc.gorillapool.io",
|
|
31
32
|
"description": "Custom ARC/Arcade server URL for transaction broadcasting"
|
|
32
33
|
},
|
|
33
34
|
"agentName": {
|
|
@@ -90,7 +91,7 @@
|
|
|
90
91
|
},
|
|
91
92
|
"arcUrl": {
|
|
92
93
|
"label": "ARC/Arcade Server URL",
|
|
93
|
-
"placeholder": "https://arc.
|
|
94
|
+
"placeholder": "https://arc.gorillapool.io",
|
|
94
95
|
"help": "Custom server for transaction broadcasting",
|
|
95
96
|
"advanced": true
|
|
96
97
|
},
|
package/package.json
CHANGED
package/src/scripts/config.ts
CHANGED
|
@@ -46,7 +46,7 @@ export const WOC_API_KEY = process.env.WOC_API_KEY || '';
|
|
|
46
46
|
export const OVERLAY_STATE_DIR = path.join(os.homedir(), '.openclaw', 'openclaw-overlay');
|
|
47
47
|
|
|
48
48
|
/** Protocol identifier for overlay transactions */
|
|
49
|
-
export const PROTOCOL_ID = '
|
|
49
|
+
export const PROTOCOL_ID = 'clawdbot-overlay-v1';
|
|
50
50
|
|
|
51
51
|
/** Topic managers for overlay submissions */
|
|
52
52
|
export const TOPICS = {
|
package/dist/cli-main.d.ts
DELETED
package/dist/cli-main.js
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BSV Overlay CLI - Main Command Dispatcher
|
|
3
|
-
*
|
|
4
|
-
* Routes commands to the appropriate modules.
|
|
5
|
-
* All business logic is in the scripts/ modules.
|
|
6
|
-
*/
|
|
7
|
-
import { ok, fail } from './scripts/output.js';
|
|
8
|
-
// Wallet commands
|
|
9
|
-
import { cmdSetup, cmdIdentity, cmdAddress } from './scripts/wallet/setup.js';
|
|
10
|
-
import { cmdBalance, cmdImport, cmdRefund } from './scripts/wallet/balance.js';
|
|
11
|
-
// Overlay registration commands
|
|
12
|
-
import { cmdRegister, cmdUnregister } from './scripts/overlay/registration.js';
|
|
13
|
-
// Service commands
|
|
14
|
-
import { cmdServices, cmdAdvertise, cmdRemove, cmdReadvertise } from './scripts/overlay/services.js';
|
|
15
|
-
// Discovery commands
|
|
16
|
-
import { cmdDiscover } from './scripts/overlay/discover.js';
|
|
17
|
-
// Payment commands
|
|
18
|
-
import { cmdPay, cmdVerify, cmdAccept } from './scripts/payment/commands.js';
|
|
19
|
-
// Messaging commands
|
|
20
|
-
import { cmdSend } from './scripts/messaging/send.js';
|
|
21
|
-
import { cmdInbox, cmdAck } from './scripts/messaging/inbox.js';
|
|
22
|
-
import { cmdPoll } from './scripts/messaging/poll.js';
|
|
23
|
-
import { cmdConnect } from './scripts/messaging/connect.js';
|
|
24
|
-
// Service request/response commands
|
|
25
|
-
import { cmdRequestService } from './scripts/services/request.js';
|
|
26
|
-
import { cmdRespondService, cmdResearchRespond } from './scripts/services/respond.js';
|
|
27
|
-
import { cmdServiceQueue, cmdResearchQueue } from './scripts/services/queue.js';
|
|
28
|
-
// X verification commands
|
|
29
|
-
import { cmdXVerifyStart, cmdXVerifyComplete, cmdXVerifications, cmdXLookup, cmdXEngagementQueue, cmdXEngagementFulfill, } from './scripts/x-verification/commands.js';
|
|
30
|
-
// Baemail commands
|
|
31
|
-
import { cmdBaemailSetup, cmdBaemailConfig, cmdBaemailBlock, cmdBaemailUnblock, cmdBaemailLog, cmdBaemailRefund, } from './scripts/baemail/commands.js';
|
|
32
|
-
const [, , command, ...args] = process.argv;
|
|
33
|
-
async function main() {
|
|
34
|
-
try {
|
|
35
|
-
switch (command) {
|
|
36
|
-
// Help
|
|
37
|
-
case 'help':
|
|
38
|
-
case '--help':
|
|
39
|
-
case '-h':
|
|
40
|
-
ok({
|
|
41
|
-
usage: 'openclaw-overlay <command> [args...]',
|
|
42
|
-
commands: {
|
|
43
|
-
wallet: ['setup', 'identity', 'address', 'balance', 'import <txid> [vout]', 'refund <address>'],
|
|
44
|
-
registration: ['register', 'unregister'],
|
|
45
|
-
services: ['services', 'advertise <id> <name> <priceSats> [desc]', 'readvertise <id> [name] [priceSats] [desc]', 'remove <id>'],
|
|
46
|
-
discovery: ['discover [--service <type>] [--agent <name>]'],
|
|
47
|
-
payments: ['pay <pubkey> <sats> [desc]', 'verify <beef>', 'accept <beef> <prefix> <suffix> <senderKey> [desc]'],
|
|
48
|
-
messaging: ['send <key> <type> <json>', 'inbox', 'ack', 'poll', 'connect'],
|
|
49
|
-
'service-requests': ['request-service <key> <serviceId> <sats> [input]', 'service-queue', 'respond-service <reqId> <key> <serviceId> <result>'],
|
|
50
|
-
research: ['research-queue', 'research-respond <reqId>'],
|
|
51
|
-
'x-verification': ['x-verify-start <handle>', 'x-verify-complete <handle>', 'x-verifications', 'x-lookup <handle>', 'x-engagement-queue', 'x-engagement-fulfill <reqId> <result>'],
|
|
52
|
-
baemail: ['baemail-setup <price> <xHandle> <forwardEmail> <greeting>', 'baemail-config', 'baemail-block <sender>', 'baemail-unblock <sender>', 'baemail-log [limit]', 'baemail-refund <msgId>'],
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
break;
|
|
56
|
-
// Wallet
|
|
57
|
-
case 'setup':
|
|
58
|
-
await cmdSetup();
|
|
59
|
-
break;
|
|
60
|
-
case 'identity':
|
|
61
|
-
await cmdIdentity();
|
|
62
|
-
break;
|
|
63
|
-
case 'address':
|
|
64
|
-
await cmdAddress();
|
|
65
|
-
break;
|
|
66
|
-
case 'balance':
|
|
67
|
-
await cmdBalance();
|
|
68
|
-
break;
|
|
69
|
-
case 'import':
|
|
70
|
-
await cmdImport(args[0], args[1]);
|
|
71
|
-
break;
|
|
72
|
-
case 'refund':
|
|
73
|
-
await cmdRefund(args[0]);
|
|
74
|
-
break;
|
|
75
|
-
// Overlay registration
|
|
76
|
-
case 'register':
|
|
77
|
-
await cmdRegister();
|
|
78
|
-
break;
|
|
79
|
-
case 'unregister':
|
|
80
|
-
await cmdUnregister();
|
|
81
|
-
break;
|
|
82
|
-
// Services
|
|
83
|
-
case 'services':
|
|
84
|
-
await cmdServices();
|
|
85
|
-
break;
|
|
86
|
-
case 'advertise':
|
|
87
|
-
await cmdAdvertise(args[0], args[1], args[2], args[3]);
|
|
88
|
-
break;
|
|
89
|
-
case 'remove':
|
|
90
|
-
await cmdRemove(args[0]);
|
|
91
|
-
break;
|
|
92
|
-
case 'readvertise':
|
|
93
|
-
await cmdReadvertise(args[0], args[1], args[2], args.slice(3).join(' ') || undefined);
|
|
94
|
-
break;
|
|
95
|
-
// Discovery
|
|
96
|
-
case 'discover':
|
|
97
|
-
await cmdDiscover(args);
|
|
98
|
-
break;
|
|
99
|
-
// Payments
|
|
100
|
-
case 'pay':
|
|
101
|
-
await cmdPay(args[0], args[1], args.slice(2).join(' ') || undefined);
|
|
102
|
-
break;
|
|
103
|
-
case 'verify':
|
|
104
|
-
await cmdVerify(args[0]);
|
|
105
|
-
break;
|
|
106
|
-
case 'accept':
|
|
107
|
-
await cmdAccept(args[0], args[1], args[2], args[3], args.slice(4).join(' ') || undefined);
|
|
108
|
-
break;
|
|
109
|
-
// Messaging (relay)
|
|
110
|
-
case 'send':
|
|
111
|
-
await cmdSend(args[0], args[1], args[2]);
|
|
112
|
-
break;
|
|
113
|
-
case 'inbox':
|
|
114
|
-
await cmdInbox(args);
|
|
115
|
-
break;
|
|
116
|
-
case 'ack':
|
|
117
|
-
await cmdAck(args);
|
|
118
|
-
break;
|
|
119
|
-
case 'poll':
|
|
120
|
-
await cmdPoll();
|
|
121
|
-
break;
|
|
122
|
-
case 'connect':
|
|
123
|
-
await cmdConnect();
|
|
124
|
-
break;
|
|
125
|
-
case 'request-service':
|
|
126
|
-
await cmdRequestService(args[0], args[1], args[2], args[3]);
|
|
127
|
-
break;
|
|
128
|
-
case 'research-respond':
|
|
129
|
-
await cmdResearchRespond(args[0]);
|
|
130
|
-
break;
|
|
131
|
-
case 'research-queue':
|
|
132
|
-
await cmdResearchQueue();
|
|
133
|
-
break;
|
|
134
|
-
case 'service-queue':
|
|
135
|
-
await cmdServiceQueue();
|
|
136
|
-
break;
|
|
137
|
-
case 'respond-service':
|
|
138
|
-
await cmdRespondService(args[0], args[1], args[2], args.slice(3).join(' '));
|
|
139
|
-
break;
|
|
140
|
-
// X Account Verification
|
|
141
|
-
case 'x-verify-start':
|
|
142
|
-
await cmdXVerifyStart(args[0]);
|
|
143
|
-
break;
|
|
144
|
-
case 'x-verify-complete':
|
|
145
|
-
await cmdXVerifyComplete(args[0]);
|
|
146
|
-
break;
|
|
147
|
-
case 'x-verifications':
|
|
148
|
-
await cmdXVerifications();
|
|
149
|
-
break;
|
|
150
|
-
case 'x-lookup':
|
|
151
|
-
await cmdXLookup(args[0]);
|
|
152
|
-
break;
|
|
153
|
-
// X Engagement Service
|
|
154
|
-
case 'x-engagement-queue':
|
|
155
|
-
await cmdXEngagementQueue();
|
|
156
|
-
break;
|
|
157
|
-
case 'x-engagement-fulfill':
|
|
158
|
-
await cmdXEngagementFulfill(args[0], args[1]);
|
|
159
|
-
break;
|
|
160
|
-
// Baemail Service
|
|
161
|
-
case 'baemail-setup':
|
|
162
|
-
await cmdBaemailSetup(args[0], args[1], args[2], args[3]);
|
|
163
|
-
break;
|
|
164
|
-
case 'baemail-config':
|
|
165
|
-
await cmdBaemailConfig();
|
|
166
|
-
break;
|
|
167
|
-
case 'baemail-block':
|
|
168
|
-
await cmdBaemailBlock(args[0]);
|
|
169
|
-
break;
|
|
170
|
-
case 'baemail-unblock':
|
|
171
|
-
await cmdBaemailUnblock(args[0]);
|
|
172
|
-
break;
|
|
173
|
-
case 'baemail-log':
|
|
174
|
-
await cmdBaemailLog(args[0]);
|
|
175
|
-
break;
|
|
176
|
-
case 'baemail-refund':
|
|
177
|
-
await cmdBaemailRefund(args[0]);
|
|
178
|
-
break;
|
|
179
|
-
default:
|
|
180
|
-
fail(`Unknown command: ${command || '(none)'}. Commands: setup, identity, address, balance, import, refund, ` +
|
|
181
|
-
`register, unregister, services, advertise, readvertise, remove, discover, pay, verify, accept, ` +
|
|
182
|
-
`send, inbox, ack, poll, connect, request-service, research-queue, research-respond, ` +
|
|
183
|
-
`service-queue, respond-service, x-verify-start, x-verify-complete, x-verifications, x-lookup, ` +
|
|
184
|
-
`x-engagement-queue, x-engagement-fulfill, baemail-setup, baemail-config, baemail-block, ` +
|
|
185
|
-
`baemail-unblock, baemail-log, baemail-refund`);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
catch (err) {
|
|
189
|
-
fail(err.message || String(err));
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
main();
|
package/dist/cli.d.ts
DELETED
package/dist/cli.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* BSV Overlay CLI - Bootstrap Entry Point
|
|
4
|
-
*
|
|
5
|
-
* Sets environment variables before importing the main CLI module
|
|
6
|
-
* to suppress dotenv v17 verbose logging.
|
|
7
|
-
*/
|
|
8
|
-
// Must be set before any imports that might load dotenv
|
|
9
|
-
process.env.DOTENV_CONFIG_QUIET = 'true';
|
|
10
|
-
// Dynamic import to ensure env var is set first
|
|
11
|
-
import('./cli-main.js');
|
|
12
|
-
// Before importing the library
|
|
13
|
-
globalThis.window = { fetch: globalThis.fetch };
|
|
14
|
-
export {};
|
package/dist/core/config.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @a2a-bsv/core — Configuration defaults and helpers.
|
|
3
|
-
*/
|
|
4
|
-
import type { WalletConfig } from './types.js';
|
|
5
|
-
/** Map our 'mainnet'/'testnet' to the wallet-toolbox's 'main'/'test' chain type. */
|
|
6
|
-
export type Chain = 'main' | 'test';
|
|
7
|
-
export declare function toChain(network: WalletConfig['network']): Chain;
|
|
8
|
-
/** Default TAAL API keys from the wallet-toolbox examples. */
|
|
9
|
-
export declare const DEFAULT_TAAL_API_KEYS: Record<Chain, string>;
|
|
10
|
-
/** Default SQLite database name. */
|
|
11
|
-
export declare const DEFAULT_DB_NAME = "a2a_agent_wallet";
|
package/dist/core/config.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @a2a-bsv/core — Configuration defaults and helpers.
|
|
3
|
-
*/
|
|
4
|
-
export function toChain(network) {
|
|
5
|
-
return network === 'mainnet' ? 'main' : 'test';
|
|
6
|
-
}
|
|
7
|
-
/** Default TAAL API keys from the wallet-toolbox examples. */
|
|
8
|
-
export const DEFAULT_TAAL_API_KEYS = {
|
|
9
|
-
main: 'mainnet_9596de07e92300c6287e4393594ae39c',
|
|
10
|
-
test: 'testnet_0e6cf72133b43ea2d7861da2a38684e3',
|
|
11
|
-
};
|
|
12
|
-
/** Default SQLite database name. */
|
|
13
|
-
export const DEFAULT_DB_NAME = 'a2a_agent_wallet';
|
package/dist/core/index.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @a2a-bsv/core — Agent-to-agent BSV payment library.
|
|
3
|
-
*
|
|
4
|
-
* Wraps @bsv/sdk and @bsv/wallet-toolbox to provide a clean, minimal API
|
|
5
|
-
* for AI agents to pay each other using BSV blockchain transactions.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* import { BSVAgentWallet } from '@a2a-bsv/core';
|
|
10
|
-
*
|
|
11
|
-
* const wallet = await BSVAgentWallet.load({
|
|
12
|
-
* network: 'testnet',
|
|
13
|
-
* storageDir: './my-agent-wallet',
|
|
14
|
-
* });
|
|
15
|
-
*
|
|
16
|
-
* const identityKey = await wallet.getIdentityKey();
|
|
17
|
-
* console.log('My identity:', identityKey);
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export { BSVAgentWallet } from './wallet.js';
|
|
21
|
-
export type { WalletConfig, WalletIdentity, PaymentParams, PaymentResult, VerifyParams, VerifyResult, AcceptParams, AcceptResult, } from './types.js';
|
|
22
|
-
export { toChain, DEFAULT_TAAL_API_KEYS, DEFAULT_DB_NAME } from './config.js';
|
|
23
|
-
export type { Chain } from './config.js';
|
|
24
|
-
export { buildPayment } from './payment.js';
|
|
25
|
-
export { verifyPayment, acceptPayment } from './verify.js';
|
package/dist/core/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @a2a-bsv/core — Agent-to-agent BSV payment library.
|
|
3
|
-
*
|
|
4
|
-
* Wraps @bsv/sdk and @bsv/wallet-toolbox to provide a clean, minimal API
|
|
5
|
-
* for AI agents to pay each other using BSV blockchain transactions.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* import { BSVAgentWallet } from '@a2a-bsv/core';
|
|
10
|
-
*
|
|
11
|
-
* const wallet = await BSVAgentWallet.load({
|
|
12
|
-
* network: 'testnet',
|
|
13
|
-
* storageDir: './my-agent-wallet',
|
|
14
|
-
* });
|
|
15
|
-
*
|
|
16
|
-
* const identityKey = await wallet.getIdentityKey();
|
|
17
|
-
* console.log('My identity:', identityKey);
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
// Main wallet class
|
|
21
|
-
export { BSVAgentWallet } from './wallet.js';
|
|
22
|
-
// Config helpers (for advanced use)
|
|
23
|
-
export { toChain, DEFAULT_TAAL_API_KEYS, DEFAULT_DB_NAME } from './config.js';
|
|
24
|
-
// Lower-level helpers (for advanced use)
|
|
25
|
-
export { buildPayment } from './payment.js';
|
|
26
|
-
export { verifyPayment, acceptPayment } from './verify.js';
|
package/dist/core/payment.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @a2a-bsv/core — Payment construction helpers.
|
|
3
|
-
*
|
|
4
|
-
* Uses BRC-29 key derivation so the recipient can internalize the payment
|
|
5
|
-
* without ever reusing an address.
|
|
6
|
-
*/
|
|
7
|
-
import type { SetupWallet } from '@bsv/wallet-toolbox';
|
|
8
|
-
import type { PaymentParams, PaymentResult } from './types.js';
|
|
9
|
-
/**
|
|
10
|
-
* Build a BRC-29 payment transaction using the wallet's createAction API.
|
|
11
|
-
*
|
|
12
|
-
* The transaction is created with `acceptDelayedBroadcast: false` — the sender
|
|
13
|
-
* broadcasts immediately. The resulting Atomic BEEF and derivation metadata are
|
|
14
|
-
* returned so the recipient can verify and internalize the payment on their side.
|
|
15
|
-
*/
|
|
16
|
-
export declare function buildPayment(setup: SetupWallet, params: PaymentParams): Promise<PaymentResult>;
|
package/dist/core/payment.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @a2a-bsv/core — Payment construction helpers.
|
|
3
|
-
*
|
|
4
|
-
* Uses BRC-29 key derivation so the recipient can internalize the payment
|
|
5
|
-
* without ever reusing an address.
|
|
6
|
-
*/
|
|
7
|
-
import { Beef, Utils } from '@bsv/sdk';
|
|
8
|
-
import { randomBytesBase64, ScriptTemplateBRC29 } from '@bsv/wallet-toolbox';
|
|
9
|
-
/**
|
|
10
|
-
* Build a BRC-29 payment transaction using the wallet's createAction API.
|
|
11
|
-
*
|
|
12
|
-
* The transaction is created with `acceptDelayedBroadcast: false` — the sender
|
|
13
|
-
* broadcasts immediately. The resulting Atomic BEEF and derivation metadata are
|
|
14
|
-
* returned so the recipient can verify and internalize the payment on their side.
|
|
15
|
-
*/
|
|
16
|
-
export async function buildPayment(setup, params) {
|
|
17
|
-
const { to, satoshis, description } = params;
|
|
18
|
-
const desc = normalizeDescription(description ?? 'agent payment');
|
|
19
|
-
// Generate unique BRC-29 derivation prefixes and suffixes
|
|
20
|
-
const derivationPrefix = randomBytesBase64(8);
|
|
21
|
-
const derivationSuffix = randomBytesBase64(8);
|
|
22
|
-
// Build BRC-29 locking script
|
|
23
|
-
const keyDeriver = setup.keyDeriver;
|
|
24
|
-
const t = new ScriptTemplateBRC29({
|
|
25
|
-
derivationPrefix,
|
|
26
|
-
derivationSuffix,
|
|
27
|
-
keyDeriver,
|
|
28
|
-
});
|
|
29
|
-
// Determine the recipient identity key.
|
|
30
|
-
// If `to` is a compressed public key hex (66 chars, starts with 02/03), use directly.
|
|
31
|
-
// Otherwise treat as an address — for BRC-29 we need a public key.
|
|
32
|
-
let recipientPubKey;
|
|
33
|
-
if (/^0[23][0-9a-fA-F]{64}$/.test(to)) {
|
|
34
|
-
recipientPubKey = to;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
// If it's an address, we can't do BRC-29 (needs pubkey). Throw a clear error.
|
|
38
|
-
throw new Error('PaymentParams.to must be a compressed public key (hex) for BRC-29 payments. ' +
|
|
39
|
-
'Raw BSV addresses are not supported — the recipient must share their identity key.');
|
|
40
|
-
}
|
|
41
|
-
const lockingScript = t.lock(setup.rootKey.toString(), recipientPubKey);
|
|
42
|
-
const label = 'a2a-payment';
|
|
43
|
-
const car = await setup.wallet.createAction({
|
|
44
|
-
outputs: [
|
|
45
|
-
{
|
|
46
|
-
lockingScript: lockingScript.toHex(),
|
|
47
|
-
satoshis,
|
|
48
|
-
outputDescription: desc,
|
|
49
|
-
tags: ['relinquish'],
|
|
50
|
-
customInstructions: JSON.stringify({
|
|
51
|
-
derivationPrefix,
|
|
52
|
-
derivationSuffix,
|
|
53
|
-
type: 'BRC29',
|
|
54
|
-
}),
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
options: {
|
|
58
|
-
randomizeOutputs: false,
|
|
59
|
-
acceptDelayedBroadcast: false,
|
|
60
|
-
},
|
|
61
|
-
labels: [label],
|
|
62
|
-
description: desc,
|
|
63
|
-
});
|
|
64
|
-
// Extract the txid from the createAction result.
|
|
65
|
-
// The tx field is a number[] (AtomicBEEF binary). Parse it to get txid.
|
|
66
|
-
if (!car.tx) {
|
|
67
|
-
throw new Error('createAction did not return a transaction. Check wallet funding.');
|
|
68
|
-
}
|
|
69
|
-
const beef = Beef.fromBinary(car.tx);
|
|
70
|
-
// The last transaction in the beef is our new tx
|
|
71
|
-
const lastTx = beef.txs[beef.txs.length - 1];
|
|
72
|
-
const txid = lastTx.txid;
|
|
73
|
-
// Encode the atomic BEEF as base64
|
|
74
|
-
const atomicBinary = beef.toBinaryAtomic(txid);
|
|
75
|
-
const beefBase64 = Utils.toBase64(atomicBinary);
|
|
76
|
-
return {
|
|
77
|
-
beef: beefBase64,
|
|
78
|
-
txid,
|
|
79
|
-
satoshis,
|
|
80
|
-
derivationPrefix,
|
|
81
|
-
derivationSuffix,
|
|
82
|
-
senderIdentityKey: setup.identityKey,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Ensure description meets BRC-100's 5-50 character requirement.
|
|
87
|
-
*/
|
|
88
|
-
function normalizeDescription(desc) {
|
|
89
|
-
if (desc.length < 5)
|
|
90
|
-
return desc.padEnd(5, ' ');
|
|
91
|
-
if (desc.length > 50)
|
|
92
|
-
return desc.slice(0, 50);
|
|
93
|
-
return desc;
|
|
94
|
-
}
|
package/dist/core/types.d.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @a2a-bsv/core — Type definitions for agent-to-agent BSV payments.
|
|
3
|
-
*/
|
|
4
|
-
/** Wallet configuration for creating or loading an agent wallet. */
|
|
5
|
-
export interface WalletConfig {
|
|
6
|
-
/** BSV network to use. */
|
|
7
|
-
network: 'mainnet' | 'testnet';
|
|
8
|
-
/** Directory path for SQLite wallet persistence. */
|
|
9
|
-
storageDir: string;
|
|
10
|
-
/** Optional: pre-existing root private key hex. If omitted on create(), a new one is generated. */
|
|
11
|
-
rootKeyHex?: string;
|
|
12
|
-
/** Optional TAAL API key for ARC broadcasting. Falls back to public default. */
|
|
13
|
-
taalApiKey?: string;
|
|
14
|
-
/** Optional fee model in sat/KB. Falls back to BSV_FEE_MODEL env var or default 100 sat/KB. */
|
|
15
|
-
feeModel?: number;
|
|
16
|
-
}
|
|
17
|
-
/** Parameters for building a payment transaction. */
|
|
18
|
-
export interface PaymentParams {
|
|
19
|
-
/** Recipient's compressed public key (hex) or BSV address. */
|
|
20
|
-
to: string;
|
|
21
|
-
/** Amount to pay in satoshis. */
|
|
22
|
-
satoshis: number;
|
|
23
|
-
/** Human-readable description (5-50 chars per BRC-100). */
|
|
24
|
-
description?: string;
|
|
25
|
-
/** Optional metadata embedded as OP_RETURN (future use). */
|
|
26
|
-
metadata?: {
|
|
27
|
-
taskId?: string;
|
|
28
|
-
protocol?: string;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
/** Result from building a payment. */
|
|
32
|
-
export interface PaymentResult {
|
|
33
|
-
/** Base64-encoded Atomic BEEF transaction data. */
|
|
34
|
-
beef: string;
|
|
35
|
-
/** Transaction ID (hex). */
|
|
36
|
-
txid: string;
|
|
37
|
-
/** Amount paid in satoshis. */
|
|
38
|
-
satoshis: number;
|
|
39
|
-
/** BRC-29 derivation prefix (base64). Needed by recipient to internalize. */
|
|
40
|
-
derivationPrefix: string;
|
|
41
|
-
/** BRC-29 derivation suffix (base64). Needed by recipient to internalize. */
|
|
42
|
-
derivationSuffix: string;
|
|
43
|
-
/** Sender's identity key (compressed hex). Needed by recipient to internalize. */
|
|
44
|
-
senderIdentityKey: string;
|
|
45
|
-
}
|
|
46
|
-
/** Parameters for verifying an incoming payment. */
|
|
47
|
-
export interface VerifyParams {
|
|
48
|
-
/** Base64-encoded Atomic BEEF data. */
|
|
49
|
-
beef: string;
|
|
50
|
-
/** Expected payment amount in satoshis. */
|
|
51
|
-
expectedAmount?: number;
|
|
52
|
-
/** Expected sender identity key (optional). */
|
|
53
|
-
expectedSender?: string;
|
|
54
|
-
}
|
|
55
|
-
/** Result from verifying a payment. */
|
|
56
|
-
export interface VerifyResult {
|
|
57
|
-
/** Whether the payment passes all checks. */
|
|
58
|
-
valid: boolean;
|
|
59
|
-
/** Transaction ID (hex). */
|
|
60
|
-
txid: string;
|
|
61
|
-
/** Number of outputs found in the transaction. */
|
|
62
|
-
outputCount: number;
|
|
63
|
-
/** Errors encountered during verification. */
|
|
64
|
-
errors: string[];
|
|
65
|
-
}
|
|
66
|
-
/** Parameters for accepting (internalizing) a verified payment. */
|
|
67
|
-
export interface AcceptParams {
|
|
68
|
-
/** Base64-encoded Atomic BEEF data. */
|
|
69
|
-
beef: string;
|
|
70
|
-
/** The output index to internalize (default: 0). */
|
|
71
|
-
vout?: number;
|
|
72
|
-
/** BRC-29 derivation prefix from the PaymentResult. */
|
|
73
|
-
derivationPrefix: string;
|
|
74
|
-
/** BRC-29 derivation suffix from the PaymentResult. */
|
|
75
|
-
derivationSuffix: string;
|
|
76
|
-
/** Sender's identity key from the PaymentResult. */
|
|
77
|
-
senderIdentityKey: string;
|
|
78
|
-
/** Human-readable description for wallet records (5-50 chars). */
|
|
79
|
-
description?: string;
|
|
80
|
-
}
|
|
81
|
-
/** Result from accepting a payment. */
|
|
82
|
-
export interface AcceptResult {
|
|
83
|
-
/** Whether the payment was accepted. */
|
|
84
|
-
accepted: boolean;
|
|
85
|
-
}
|
|
86
|
-
/** Serializable wallet identity info, persisted alongside the SQLite database. */
|
|
87
|
-
export interface WalletIdentity {
|
|
88
|
-
/** The root private key (hex). Guard this carefully. */
|
|
89
|
-
rootKeyHex: string;
|
|
90
|
-
/** The wallet's public identity key (compressed hex). */
|
|
91
|
-
identityKey: string;
|
|
92
|
-
/** Network this wallet targets. */
|
|
93
|
-
network: 'mainnet' | 'testnet';
|
|
94
|
-
}
|
package/dist/core/types.js
DELETED