@bountyagents/bountyagents-task 2026.2.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/.env.local +1 -0
- package/dist/escrow.d.ts +3 -0
- package/dist/escrow.js +14 -0
- package/dist/escrow.js.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +42394 -0
- package/dist/index.js.map +1 -0
- package/dist/mizu.d.ts +27 -0
- package/dist/mizu.js +53 -0
- package/dist/mizu.js.map +1 -0
- package/dist/mizuPublisher.d.ts +27 -0
- package/dist/mizuPublisher.js +53 -0
- package/dist/mizuPublisher.js.map +1 -0
- package/dist/signers.d.ts +13 -0
- package/dist/signers.js +26 -0
- package/dist/signers.js.map +1 -0
- package/dist/signing.d.ts +21 -0
- package/dist/signing.js +72 -0
- package/dist/signing.js.map +1 -0
- package/dist/taskPublisher.d.ts +27 -0
- package/dist/taskPublisher.js +53 -0
- package/dist/taskPublisher.js.map +1 -0
- package/dist/token.d.ts +5 -0
- package/dist/token.js +12 -0
- package/dist/token.js.map +1 -0
- package/dist/types.d.ts +187 -0
- package/dist/types.js +77 -0
- package/dist/types.js.map +1 -0
- package/index.ts +34 -0
- package/openclaw.plugin.json +10 -0
- package/package.json +38 -0
- package/src/escrow.ts +27 -0
- package/src/index.ts +413 -0
- package/src/signers.ts +36 -0
- package/src/signing.ts +113 -0
- package/src/token.ts +17 -0
- package/src/types.ts +101 -0
- package/tsconfig.json +16 -0
package/.env.local
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
NPM_TOKEN=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
|
package/dist/escrow.d.ts
ADDED
package/dist/escrow.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { encodePacked, getAddress, keccak256, stringToBytes } from 'viem';
|
|
2
|
+
export const taskDepositKey = (taskId) => keccak256(stringToBytes(taskId));
|
|
3
|
+
export const buildSettleDataHash = (contractAddress, key, owner, token, worker, amount) => {
|
|
4
|
+
return keccak256(encodePacked(['string', 'address', 'bytes32', 'address', 'address', 'address', 'uint256'], [
|
|
5
|
+
'SETTLE',
|
|
6
|
+
getAddress(contractAddress),
|
|
7
|
+
key,
|
|
8
|
+
getAddress(owner),
|
|
9
|
+
getAddress(token),
|
|
10
|
+
getAddress(worker),
|
|
11
|
+
amount
|
|
12
|
+
]));
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=escrow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escrow.js","sourceRoot":"","sources":["../src/escrow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAE/E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAc,EAAO,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AAExF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,eAAuB,EACvB,GAAQ,EACR,KAAa,EACb,KAAa,EACb,MAAc,EACd,MAAc,EACT,EAAE;IACP,OAAO,SAAS,CACd,YAAY,CACV,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,EAC5E;QACE,QAAQ;QACR,UAAU,CAAC,eAAgC,CAAC;QAC5C,GAAG;QACH,UAAU,CAAC,KAAsB,CAAC;QAClC,UAAU,CAAC,KAAsB,CAAC;QAClC,UAAU,CAAC,MAAuB,CAAC;QACnC,MAAM;KACP,CACF,CACF,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TaskRecord, ResponseRecord } from '@bountyagents/task-db';
|
|
3
|
+
import { Hex } from 'viem';
|
|
4
|
+
import { Signer } from './signers.js';
|
|
5
|
+
export interface BountyAgentsPluginOptions {
|
|
6
|
+
serviceUrl: string;
|
|
7
|
+
contractAddress: string;
|
|
8
|
+
}
|
|
9
|
+
export interface PluginTool {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
inputSchema: z.ZodTypeAny;
|
|
13
|
+
execute: (input: unknown) => Promise<unknown>;
|
|
14
|
+
}
|
|
15
|
+
declare abstract class BaseBountyPlugin {
|
|
16
|
+
protected readonly signer: Signer;
|
|
17
|
+
protected readonly baseUrl: string;
|
|
18
|
+
protected readonly contractAddress: `0x${string}`;
|
|
19
|
+
private readonly tools;
|
|
20
|
+
constructor(signer: Signer, options: BountyAgentsPluginOptions);
|
|
21
|
+
getTools(): PluginTool[];
|
|
22
|
+
executeTool(name: string, input: unknown): Promise<unknown>;
|
|
23
|
+
protected registerTool<TSchema extends z.ZodTypeAny>(name: string, description: string, schema: TSchema, executor: (input: z.infer<TSchema>) => Promise<unknown>): void;
|
|
24
|
+
protected request(path: string, body?: unknown, method?: 'GET' | 'POST'): Promise<unknown>;
|
|
25
|
+
protected signPayload(payload: string): Promise<Hex>;
|
|
26
|
+
protected signDigest(digest: Hex): Promise<Hex>;
|
|
27
|
+
protected fetchTask(taskId: string): Promise<TaskRecord>;
|
|
28
|
+
protected fetchResponse(responseId: string): Promise<ResponseRecord>;
|
|
29
|
+
}
|
|
30
|
+
export declare class BountyAgentsPublisherPlugin extends BaseBountyPlugin {
|
|
31
|
+
constructor(signer: Signer, options: BountyAgentsPluginOptions);
|
|
32
|
+
private createTask;
|
|
33
|
+
private fundTask;
|
|
34
|
+
private decideOnResponse;
|
|
35
|
+
private cancelTask;
|
|
36
|
+
private queryTasks;
|
|
37
|
+
private queryTaskResponses;
|
|
38
|
+
private createSettlementSignature;
|
|
39
|
+
}
|
|
40
|
+
export declare class BountyAgentsWorkerPlugin extends BaseBountyPlugin {
|
|
41
|
+
constructor(signer: Signer, options: BountyAgentsPluginOptions);
|
|
42
|
+
private submitResponse;
|
|
43
|
+
private queryWorkerResponses;
|
|
44
|
+
private settleTask;
|
|
45
|
+
}
|
|
46
|
+
export * from './taskPublisher.js';
|