openclaw-overlay-plugin 0.7.24 → 0.7.26
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/dist/test/overlay-submit.test.js +1 -1
- package/dist/test/utils/server-logic.d.ts +1 -1
- package/dist/test/utils/server-logic.js +1 -1
- package/index.ts +3 -2
- package/package.json +1 -1
- package/src/scripts/baemail/commands.ts +3 -2
- package/src/test/overlay-submit.test.ts +10 -10
- package/src/test/utils/server-logic.ts +1 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Run with: npx tsx src/test/overlay-submit.test.ts
|
|
9
9
|
*/
|
|
10
10
|
import { Beef, Transaction, PrivateKey, P2PKH, LockingScript, OP, PushDrop } from '@bsv/sdk';
|
|
11
|
-
const PROTOCOL_ID = '
|
|
11
|
+
const PROTOCOL_ID = 'openclaw-overlay-v1';
|
|
12
12
|
/**
|
|
13
13
|
* Extract data fields from a PushDrop script using the SDK's decode method.
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Updated to use PushDrop tokens instead of plain OP_RETURN.
|
|
9
9
|
*/
|
|
10
10
|
import { Script, LockingScript } from '@bsv/sdk';
|
|
11
|
-
export declare const PROTOCOL_ID = "
|
|
11
|
+
export declare const PROTOCOL_ID = "openclaw-overlay-v1";
|
|
12
12
|
export interface OpenclawIdentityData {
|
|
13
13
|
protocol: string;
|
|
14
14
|
type: 'identity';
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Updated to use PushDrop tokens instead of plain OP_RETURN.
|
|
9
9
|
*/
|
|
10
10
|
import { OP, Beef, PushDrop } from '@bsv/sdk';
|
|
11
|
-
export const PROTOCOL_ID = '
|
|
11
|
+
export const PROTOCOL_ID = 'openclaw-overlay-v1';
|
|
12
12
|
// ============================================================================
|
|
13
13
|
// Script Parsing using PushDrop.decode()
|
|
14
14
|
// ============================================================================
|
package/index.ts
CHANGED
|
@@ -94,10 +94,11 @@ async function startAutoImport(env, cliPath, logger) {
|
|
|
94
94
|
const network = env.BSV_NETWORK === 'testnet' ? 'test' : 'main';
|
|
95
95
|
const controller = new AbortController();
|
|
96
96
|
const timeout = setTimeout(() => controller.abort(), 15000);
|
|
97
|
-
const resp = await fetch(`https://api.whatsonchain.com/v1/bsv/${network}/address/${address}/unspent`, { signal: controller.signal });
|
|
97
|
+
const resp = await fetch(`https://api.whatsonchain.com/v1/bsv/${network}/address/${address}/unspent/all`, { signal: controller.signal });
|
|
98
98
|
clearTimeout(timeout);
|
|
99
99
|
if (!resp.ok) return;
|
|
100
|
-
const
|
|
100
|
+
const data = await resp.json();
|
|
101
|
+
const utxos = data.result || [];
|
|
101
102
|
|
|
102
103
|
for (const utxo of utxos) {
|
|
103
104
|
const key = `${utxo.tx_hash}:${utxo.tx_pos}`;
|
package/package.json
CHANGED
|
@@ -241,8 +241,9 @@ export async function cmdBaemailRefund(requestId: string | undefined): Promise<n
|
|
|
241
241
|
try {
|
|
242
242
|
// Load UTXOs
|
|
243
243
|
const address = walletIdentity.address;
|
|
244
|
-
const utxosResp = await fetchWithTimeout(`https://api.whatsonchain.com/v1/bsv/main/address/${address}/unspent`);
|
|
245
|
-
const
|
|
244
|
+
const utxosResp = await fetchWithTimeout(`https://api.whatsonchain.com/v1/bsv/main/address/${address}/unspent/all`);
|
|
245
|
+
const data = await utxosResp.json();
|
|
246
|
+
const utxos = data.result || [];
|
|
246
247
|
|
|
247
248
|
if (!utxos || utxos.length === 0) {
|
|
248
249
|
return fail('No UTXOs available for refund');
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
import { Beef, Transaction, PrivateKey, P2PKH, LockingScript, OP, PushDrop } from '@bsv/sdk';
|
|
12
12
|
|
|
13
|
-
const PROTOCOL_ID = '
|
|
13
|
+
const PROTOCOL_ID = 'openclaw-overlay-v1';
|
|
14
14
|
|
|
15
15
|
// ============================================================================
|
|
16
16
|
// Server-side logic (using PushDrop for validation)
|
|
17
17
|
// ============================================================================
|
|
18
18
|
|
|
19
|
-
interface
|
|
19
|
+
interface OpenclawIdentityData {
|
|
20
20
|
protocol: string;
|
|
21
21
|
type: 'identity';
|
|
22
22
|
identityKey: string;
|
|
@@ -27,7 +27,7 @@ interface ClawdbotIdentityData {
|
|
|
27
27
|
timestamp: string;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
interface
|
|
30
|
+
interface OpenclawServiceData {
|
|
31
31
|
protocol: string;
|
|
32
32
|
type: 'service';
|
|
33
33
|
identityKey: string;
|
|
@@ -53,14 +53,14 @@ function extractPushDropFields(script: LockingScript): number[][] | null {
|
|
|
53
53
|
/**
|
|
54
54
|
* Parse identity output using PushDrop decode and server's validation logic.
|
|
55
55
|
*/
|
|
56
|
-
function parseIdentityOutput(script: LockingScript):
|
|
56
|
+
function parseIdentityOutput(script: LockingScript): OpenclawIdentityData | null {
|
|
57
57
|
const fields = extractPushDropFields(script);
|
|
58
58
|
if (!fields || fields.length < 1) return null;
|
|
59
59
|
|
|
60
60
|
try {
|
|
61
61
|
const payload = JSON.parse(
|
|
62
62
|
new TextDecoder().decode(new Uint8Array(fields[0]))
|
|
63
|
-
) as
|
|
63
|
+
) as OpenclawIdentityData;
|
|
64
64
|
|
|
65
65
|
// Server validation rules
|
|
66
66
|
if (payload.protocol !== PROTOCOL_ID) return null;
|
|
@@ -79,14 +79,14 @@ function parseIdentityOutput(script: LockingScript): ClawdbotIdentityData | null
|
|
|
79
79
|
/**
|
|
80
80
|
* Parse service output using PushDrop decode and server's validation logic.
|
|
81
81
|
*/
|
|
82
|
-
function parseServiceOutput(script: LockingScript):
|
|
82
|
+
function parseServiceOutput(script: LockingScript): OpenclawServiceData | null {
|
|
83
83
|
const fields = extractPushDropFields(script);
|
|
84
84
|
if (!fields || fields.length < 1) return null;
|
|
85
85
|
|
|
86
86
|
try {
|
|
87
87
|
const payload = JSON.parse(
|
|
88
88
|
new TextDecoder().decode(new Uint8Array(fields[0]))
|
|
89
|
-
) as
|
|
89
|
+
) as OpenclawServiceData;
|
|
90
90
|
|
|
91
91
|
// Server validation rules
|
|
92
92
|
if (payload.protocol !== PROTOCOL_ID) return null;
|
|
@@ -276,7 +276,7 @@ async function testIdentityPayload(): Promise<void> {
|
|
|
276
276
|
const identityKey = privKey.toPublicKey().toString();
|
|
277
277
|
|
|
278
278
|
// Valid identity payload
|
|
279
|
-
const validPayload:
|
|
279
|
+
const validPayload: OpenclawIdentityData = {
|
|
280
280
|
protocol: PROTOCOL_ID,
|
|
281
281
|
type: 'identity',
|
|
282
282
|
identityKey,
|
|
@@ -332,7 +332,7 @@ async function testServicePayload(): Promise<void> {
|
|
|
332
332
|
const identityKey = privKey.toPublicKey().toString();
|
|
333
333
|
|
|
334
334
|
// Valid service payload
|
|
335
|
-
const validPayload:
|
|
335
|
+
const validPayload: OpenclawServiceData = {
|
|
336
336
|
protocol: PROTOCOL_ID,
|
|
337
337
|
type: 'service',
|
|
338
338
|
identityKey,
|
|
@@ -380,7 +380,7 @@ async function testBeefSubmission(): Promise<void> {
|
|
|
380
380
|
});
|
|
381
381
|
|
|
382
382
|
// Valid identity registration
|
|
383
|
-
const identityPayload:
|
|
383
|
+
const identityPayload: OpenclawIdentityData = {
|
|
384
384
|
protocol: PROTOCOL_ID,
|
|
385
385
|
type: 'identity',
|
|
386
386
|
identityKey,
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import { Script, OP, Beef, PushDrop, LockingScript } from '@bsv/sdk';
|
|
12
12
|
|
|
13
|
-
export const PROTOCOL_ID = '
|
|
13
|
+
export const PROTOCOL_ID = 'openclaw-overlay-v1';
|
|
14
14
|
|
|
15
15
|
// ============================================================================
|
|
16
16
|
// Type Definitions (mirrored from server)
|