@openserv-labs/client 2.1.1 → 2.1.3
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 +7 -7
- package/dist/erc8004-api.d.ts +6 -135
- package/dist/erc8004-api.d.ts.map +1 -1
- package/dist/erc8004-api.js +92 -159
- package/dist/payments-api.d.ts +30 -13
- package/dist/payments-api.d.ts.map +1 -1
- package/dist/payments-api.js +53 -14
- package/dist/triggers-api.d.ts +72 -1
- package/dist/triggers-api.d.ts.map +1 -1
- package/dist/triggers-api.js +96 -0
- package/dist/types.d.ts +10 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/workflows-api.d.ts +110 -1
- package/dist/workflows-api.d.ts.map +1 -1
- package/dist/workflows-api.js +112 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -378,12 +378,12 @@ For more control over individual steps, use the lower-level methods directly:
|
|
|
378
378
|
|
|
379
379
|
```typescript
|
|
380
380
|
// Generate a web3 wallet for the workspace
|
|
381
|
-
const wallet = await client.
|
|
381
|
+
const wallet = await client.workflows.generateWallet({ id: 123 })
|
|
382
382
|
console.log('Wallet address:', wallet.address)
|
|
383
383
|
|
|
384
384
|
// Import an existing wallet
|
|
385
|
-
const imported = await client.
|
|
386
|
-
|
|
385
|
+
const imported = await client.workflows.importWallet({
|
|
386
|
+
id: 123,
|
|
387
387
|
address: '0x...',
|
|
388
388
|
network: 'base',
|
|
389
389
|
chainId: 8453,
|
|
@@ -391,11 +391,11 @@ const imported = await client.erc8004.importWallet({
|
|
|
391
391
|
})
|
|
392
392
|
|
|
393
393
|
// Get the workspace wallet
|
|
394
|
-
const existing = await client.
|
|
394
|
+
const existing = await client.workflows.getWallet({ id: 123 })
|
|
395
395
|
console.log(existing.deployed, existing.erc8004AgentId)
|
|
396
396
|
|
|
397
397
|
// Delete the workspace wallet
|
|
398
|
-
await client.
|
|
398
|
+
await client.workflows.deleteWallet({ id: 123 })
|
|
399
399
|
|
|
400
400
|
// Get a presigned IPFS URL for uploading the agent card
|
|
401
401
|
const { url } = await client.erc8004.presignIpfsUrl({ workflowId: 123 })
|
|
@@ -432,8 +432,8 @@ for (const trigger of callableTriggers) {
|
|
|
432
432
|
}
|
|
433
433
|
|
|
434
434
|
// Sign feedback auth for the reputation system
|
|
435
|
-
const { signature } = await client.
|
|
436
|
-
|
|
435
|
+
const { signature } = await client.workflows.signFeedbackAuth({
|
|
436
|
+
id: 123,
|
|
437
437
|
buyerAddress: '0xBuyer...'
|
|
438
438
|
})
|
|
439
439
|
```
|
package/dist/erc8004-api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PlatformClient } from "./client";
|
|
2
|
-
import type { Erc8004DeployRequest,
|
|
2
|
+
import type { Erc8004DeployRequest, PresignIpfsUrlResponse, WorkflowData } from "./types";
|
|
3
3
|
/**
|
|
4
4
|
* API for ERC-8004 agent identity operations on the OpenServ platform.
|
|
5
5
|
*
|
|
@@ -15,7 +15,7 @@ import type { Erc8004DeployRequest, Web3Wallet, ImportWeb3WalletRequest, Callabl
|
|
|
15
15
|
* const client = new PlatformClient({ apiKey: 'your-key' });
|
|
16
16
|
*
|
|
17
17
|
* // Generate a web3 wallet for the workspace
|
|
18
|
-
* const wallet = await client.
|
|
18
|
+
* const wallet = await client.workflows.generateWallet({ id: 123 });
|
|
19
19
|
*
|
|
20
20
|
* // Get a presigned IPFS URL for uploading the agent card
|
|
21
21
|
* const { url } = await client.erc8004.presignIpfsUrl({ workflowId: 123 });
|
|
@@ -110,8 +110,9 @@ export declare class Erc8004API {
|
|
|
110
110
|
* @param params.privateKey - Funded private key for on-chain transactions (must have ETH for gas)
|
|
111
111
|
* @param params.chainId - Chain ID (default: 8453 for Base mainnet)
|
|
112
112
|
* @param params.rpcUrl - RPC URL (default: "https://mainnet.base.org")
|
|
113
|
-
* @param params.name - Agent name override (
|
|
114
|
-
* @param params.description - Agent description override
|
|
113
|
+
* @param params.name - Agent name override (defaults: single trigger → trigger name, else workspace name)
|
|
114
|
+
* @param params.description - Agent description override (defaults: single trigger → trigger description, else workspace goal + service list)
|
|
115
|
+
* @param params.image - Agent image URL (optional)
|
|
115
116
|
* @returns Deployment result with agentId, IPFS CID, transaction hash, and URLs
|
|
116
117
|
*
|
|
117
118
|
* @example
|
|
@@ -136,6 +137,7 @@ export declare class Erc8004API {
|
|
|
136
137
|
rpcUrl?: string;
|
|
137
138
|
name?: string;
|
|
138
139
|
description?: string;
|
|
140
|
+
image?: string;
|
|
139
141
|
}): Promise<RegisterOnChainResult>;
|
|
140
142
|
/**
|
|
141
143
|
* Upload a JSON string to IPFS using a presigned Pinata URL.
|
|
@@ -166,137 +168,6 @@ export declare class Erc8004API {
|
|
|
166
168
|
presignIpfsUrl(params: {
|
|
167
169
|
workflowId: number;
|
|
168
170
|
}): Promise<PresignIpfsUrlResponse>;
|
|
169
|
-
/**
|
|
170
|
-
* Get the web3 wallet associated with a workspace.
|
|
171
|
-
*
|
|
172
|
-
* @param params - Parameters
|
|
173
|
-
* @param params.workflowId - The workflow (workspace) ID
|
|
174
|
-
* @returns The web3 wallet details
|
|
175
|
-
*
|
|
176
|
-
* @example
|
|
177
|
-
* ```typescript
|
|
178
|
-
* const wallet = await client.erc8004.getWallet({ workflowId: 123 });
|
|
179
|
-
* console.log(wallet.address, wallet.deployed, wallet.erc8004AgentId);
|
|
180
|
-
* ```
|
|
181
|
-
*/
|
|
182
|
-
getWallet(params: {
|
|
183
|
-
workflowId: number;
|
|
184
|
-
}): Promise<Web3Wallet>;
|
|
185
|
-
/**
|
|
186
|
-
* Generate a new web3 wallet for a workspace.
|
|
187
|
-
*
|
|
188
|
-
* Creates a fresh wallet with a server-generated private key. The wallet
|
|
189
|
-
* is stored securely on the platform and used for ERC-8004 operations.
|
|
190
|
-
* A workspace can only have one web3 wallet.
|
|
191
|
-
*
|
|
192
|
-
* @param params - Parameters
|
|
193
|
-
* @param params.workflowId - The workflow (workspace) ID
|
|
194
|
-
* @returns The generated web3 wallet
|
|
195
|
-
* @throws Error if the workspace already has a web3 wallet
|
|
196
|
-
*
|
|
197
|
-
* @example
|
|
198
|
-
* ```typescript
|
|
199
|
-
* const wallet = await client.erc8004.generateWallet({ workflowId: 123 });
|
|
200
|
-
* console.log('Wallet address:', wallet.address);
|
|
201
|
-
* ```
|
|
202
|
-
*/
|
|
203
|
-
generateWallet(params: {
|
|
204
|
-
workflowId: number;
|
|
205
|
-
}): Promise<Web3Wallet>;
|
|
206
|
-
/**
|
|
207
|
-
* Import an existing web3 wallet into a workspace.
|
|
208
|
-
*
|
|
209
|
-
* Use this to associate a pre-existing wallet (e.g., one that already has
|
|
210
|
-
* an ERC-8004 registration) with a workspace.
|
|
211
|
-
* A workspace can only have one web3 wallet.
|
|
212
|
-
*
|
|
213
|
-
* @param params - Import parameters
|
|
214
|
-
* @param params.workflowId - The workflow (workspace) ID
|
|
215
|
-
* @param params.address - Wallet address
|
|
216
|
-
* @param params.network - Network name (e.g., "base")
|
|
217
|
-
* @param params.chainId - Chain ID (e.g., 8453)
|
|
218
|
-
* @param params.privateKey - Wallet private key
|
|
219
|
-
* @returns The imported web3 wallet
|
|
220
|
-
* @throws Error if the workspace already has a web3 wallet
|
|
221
|
-
*
|
|
222
|
-
* @example
|
|
223
|
-
* ```typescript
|
|
224
|
-
* const wallet = await client.erc8004.importWallet({
|
|
225
|
-
* workflowId: 123,
|
|
226
|
-
* address: '0x...',
|
|
227
|
-
* network: 'base',
|
|
228
|
-
* chainId: 8453,
|
|
229
|
-
* privateKey: '0x...',
|
|
230
|
-
* });
|
|
231
|
-
* ```
|
|
232
|
-
*/
|
|
233
|
-
importWallet(params: ImportWeb3WalletRequest & {
|
|
234
|
-
workflowId: number;
|
|
235
|
-
}): Promise<Web3Wallet>;
|
|
236
|
-
/**
|
|
237
|
-
* Delete the web3 wallet associated with a workspace.
|
|
238
|
-
*
|
|
239
|
-
* This removes the wallet record from the platform. Note that the on-chain
|
|
240
|
-
* ERC-8004 registration is not affected -- this only removes the platform's
|
|
241
|
-
* association.
|
|
242
|
-
*
|
|
243
|
-
* @param params - Parameters
|
|
244
|
-
* @param params.workflowId - The workflow (workspace) ID
|
|
245
|
-
*
|
|
246
|
-
* @example
|
|
247
|
-
* ```typescript
|
|
248
|
-
* await client.erc8004.deleteWallet({ workflowId: 123 });
|
|
249
|
-
* ```
|
|
250
|
-
*/
|
|
251
|
-
deleteWallet(params: {
|
|
252
|
-
workflowId: number;
|
|
253
|
-
}): Promise<void>;
|
|
254
|
-
/**
|
|
255
|
-
* Sign a feedback auth message for a buyer address.
|
|
256
|
-
*
|
|
257
|
-
* This is used for the ERC-8004 reputation system. The workspace's web3 wallet
|
|
258
|
-
* signs an auth message that allows a buyer to submit feedback/reputation
|
|
259
|
-
* for the agent on-chain.
|
|
260
|
-
*
|
|
261
|
-
* @param params - Parameters
|
|
262
|
-
* @param params.workflowId - The workflow (workspace) ID
|
|
263
|
-
* @param params.buyerAddress - The buyer's wallet address to authorize
|
|
264
|
-
* @returns Object containing the signed feedback auth
|
|
265
|
-
*
|
|
266
|
-
* @example
|
|
267
|
-
* ```typescript
|
|
268
|
-
* const { signature } = await client.erc8004.signFeedbackAuth({
|
|
269
|
-
* workflowId: 123,
|
|
270
|
-
* buyerAddress: '0xBuyer...',
|
|
271
|
-
* });
|
|
272
|
-
* ```
|
|
273
|
-
*/
|
|
274
|
-
signFeedbackAuth(params: {
|
|
275
|
-
workflowId: number;
|
|
276
|
-
buyerAddress: string;
|
|
277
|
-
}): Promise<SignFeedbackAuthResponse>;
|
|
278
|
-
/**
|
|
279
|
-
* Get callable triggers for a workspace.
|
|
280
|
-
*
|
|
281
|
-
* Returns the list of triggers that can be called externally, along with
|
|
282
|
-
* their input schemas and endpoint URLs. This is used during ERC-8004
|
|
283
|
-
* deployment to register the agent's available services on-chain.
|
|
284
|
-
*
|
|
285
|
-
* @param params - Parameters
|
|
286
|
-
* @param params.workflowId - The workflow (workspace) ID
|
|
287
|
-
* @returns Array of callable triggers with their schemas and endpoints
|
|
288
|
-
*
|
|
289
|
-
* @example
|
|
290
|
-
* ```typescript
|
|
291
|
-
* const triggers = await client.erc8004.getCallableTriggers({ workflowId: 123 });
|
|
292
|
-
* for (const trigger of triggers) {
|
|
293
|
-
* console.log(trigger.name, trigger.webEndpoint);
|
|
294
|
-
* }
|
|
295
|
-
* ```
|
|
296
|
-
*/
|
|
297
|
-
getCallableTriggers(params: {
|
|
298
|
-
workflowId: number;
|
|
299
|
-
}): Promise<CallableTrigger[]>;
|
|
300
171
|
}
|
|
301
172
|
/**
|
|
302
173
|
* Result of a successful on-chain ERC-8004 registration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erc8004-api.d.ts","sourceRoot":"","sources":["../src/erc8004-api.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EACV,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"erc8004-api.d.ts","sourceRoot":"","sources":["../src/erc8004-api.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,YAAY,EACb,MAAM,SAAS,CAAC;AAIjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,UAAU;IACT,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,cAAc;IAM1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqDG;IACG,MAAM,CACV,MAAM,EAAE,oBAAoB,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GACpD,OAAO,CAAC,YAAY,CAAC;IAsBxB;;;OAGG;YACW,iBAAiB;IAiC/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACG,eAAe,CAAC,MAAM,EAAE;QAC5B,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAsQlC;;OAEG;YACW,YAAY;IAyB1B;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IA8CjC;;;;;;;;;;;;;;;;OAgBG;IACG,cAAc,CAAC,MAAM,EAAE;QAC3B,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAKpC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,gBAAgB,EAAE,MAAM,CAAC;IACzB,4FAA4F;IAC5F,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/erc8004-api.js
CHANGED
|
@@ -21,7 +21,7 @@ const erc8004_contracts_js_1 = require("./erc8004-contracts.js");
|
|
|
21
21
|
* const client = new PlatformClient({ apiKey: 'your-key' });
|
|
22
22
|
*
|
|
23
23
|
* // Generate a web3 wallet for the workspace
|
|
24
|
-
* const wallet = await client.
|
|
24
|
+
* const wallet = await client.workflows.generateWallet({ id: 123 });
|
|
25
25
|
*
|
|
26
26
|
* // Get a presigned IPFS URL for uploading the agent card
|
|
27
27
|
* const { url } = await client.erc8004.presignIpfsUrl({ workflowId: 123 });
|
|
@@ -124,7 +124,7 @@ class Erc8004API {
|
|
|
124
124
|
: String(originalError);
|
|
125
125
|
let walletAddress = null;
|
|
126
126
|
try {
|
|
127
|
-
const wallet = await this.getWallet({ workflowId });
|
|
127
|
+
const wallet = await this.client.workflows.getWallet({ id: workflowId });
|
|
128
128
|
walletAddress = wallet.address;
|
|
129
129
|
}
|
|
130
130
|
catch {
|
|
@@ -136,7 +136,7 @@ class Erc8004API {
|
|
|
136
136
|
`\n\nNote: automatic USDC-to-ETH swap is coming soon. ` +
|
|
137
137
|
`Once available, pass swap: true to convert USDC in the wallet to ETH for gas.`
|
|
138
138
|
: `\n\nNo wallet found for this workspace. ` +
|
|
139
|
-
`Generate one first with client.
|
|
139
|
+
`Generate one first with client.workflows.generateWallet({ id: ${workflowId} }), ` +
|
|
140
140
|
`then fund it with ETH and retry.`;
|
|
141
141
|
return new Error(originalMessage + fundingHint);
|
|
142
142
|
}
|
|
@@ -157,8 +157,9 @@ class Erc8004API {
|
|
|
157
157
|
* @param params.privateKey - Funded private key for on-chain transactions (must have ETH for gas)
|
|
158
158
|
* @param params.chainId - Chain ID (default: 8453 for Base mainnet)
|
|
159
159
|
* @param params.rpcUrl - RPC URL (default: "https://mainnet.base.org")
|
|
160
|
-
* @param params.name - Agent name override (
|
|
161
|
-
* @param params.description - Agent description override
|
|
160
|
+
* @param params.name - Agent name override (defaults: single trigger → trigger name, else workspace name)
|
|
161
|
+
* @param params.description - Agent description override (defaults: single trigger → trigger description, else workspace goal + service list)
|
|
162
|
+
* @param params.image - Agent image URL (optional)
|
|
162
163
|
* @returns Deployment result with agentId, IPFS CID, transaction hash, and URLs
|
|
163
164
|
*
|
|
164
165
|
* @example
|
|
@@ -177,39 +178,108 @@ class Erc8004API {
|
|
|
177
178
|
* ```
|
|
178
179
|
*/
|
|
179
180
|
async registerOnChain(params) {
|
|
180
|
-
const { workflowId, privateKey, chainId = 8453, rpcUrl = "https://mainnet.base.org",
|
|
181
|
-
// 1. Get wallet and
|
|
182
|
-
const wallet = await
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
181
|
+
const { workflowId, privateKey, chainId = 8453, rpcUrl = "https://mainnet.base.org", image, } = params;
|
|
182
|
+
// 1. Get wallet, callable triggers, and workspace data
|
|
183
|
+
const [wallet, callableTriggers, workspace] = await Promise.all([
|
|
184
|
+
this.client.workflows.getWallet({ id: workflowId }),
|
|
185
|
+
this.client.triggers.getCallableTriggers({ workflowId }),
|
|
186
|
+
this.client.workflows.get({ id: workflowId }),
|
|
187
|
+
]);
|
|
188
|
+
// Derive name and description from triggers/workspace (matching monorepo logic)
|
|
189
|
+
let name = params.name;
|
|
190
|
+
let description = params.description;
|
|
191
|
+
if (!name || !description) {
|
|
192
|
+
if (callableTriggers.length === 1 && callableTriggers[0]) {
|
|
193
|
+
const t = callableTriggers[0];
|
|
194
|
+
if (!name)
|
|
195
|
+
name = t.name || workspace.name;
|
|
196
|
+
if (!description)
|
|
197
|
+
description = t.description || workspace.goal || "Default";
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
if (!name)
|
|
201
|
+
name = workspace.name;
|
|
202
|
+
if (!description) {
|
|
203
|
+
const triggerBullets = callableTriggers
|
|
204
|
+
.filter((t) => t.description)
|
|
205
|
+
.map((t) => `- ${t.name}: ${t.description}`)
|
|
206
|
+
.join("\n");
|
|
207
|
+
description = [
|
|
208
|
+
workspace.goal || "Default",
|
|
209
|
+
...(triggerBullets ? [`\nServices:\n${triggerBullets}`] : []),
|
|
210
|
+
].join("");
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// 2. Build ERC-8004 agent card (matches monorepo addRegistrationFile format)
|
|
215
|
+
const baseUrl = this.client.rawClient.defaults.baseURL || "https://api.openserv.ai";
|
|
216
|
+
const services = [];
|
|
217
|
+
// MCP endpoint (machine-facing, aggregates all x402 triggers)
|
|
218
|
+
const mcpEndpoint = `${baseUrl}/workspaces/${workflowId}/trigger-x402-mcp/mcp`;
|
|
219
|
+
services.push({
|
|
220
|
+
name: "MCP",
|
|
221
|
+
endpoint: mcpEndpoint,
|
|
222
|
+
version: "2025-06-18",
|
|
223
|
+
});
|
|
224
|
+
for (const t of callableTriggers) {
|
|
225
|
+
const meta = {};
|
|
226
|
+
if (t.name)
|
|
227
|
+
meta.triggerName = t.name;
|
|
228
|
+
if (t.description)
|
|
229
|
+
meta.description = t.description;
|
|
230
|
+
// WEB endpoint (human-facing paywall URL)
|
|
231
|
+
services.push({
|
|
232
|
+
name: "web",
|
|
233
|
+
endpoint: t.webEndpoint,
|
|
234
|
+
...(Object.keys(meta).length > 0 ? meta : {}),
|
|
235
|
+
});
|
|
236
|
+
// HTTP endpoint (machine-facing x402 URL)
|
|
237
|
+
if (t.httpEndpoint) {
|
|
238
|
+
const httpMeta = { ...meta };
|
|
239
|
+
if (t.inputSchema)
|
|
240
|
+
httpMeta.inputSchema = t.inputSchema;
|
|
241
|
+
services.push({
|
|
242
|
+
name: "http",
|
|
243
|
+
endpoint: t.httpEndpoint,
|
|
244
|
+
...(Object.keys(httpMeta).length > 0 ? httpMeta : {}),
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
// Add walletAddress as an endpoint (deduplicate first)
|
|
194
249
|
if (wallet.address) {
|
|
250
|
+
const filtered = services.filter((s) => s.name !== "agentWallet" && s.name !== "wallet");
|
|
251
|
+
services.length = 0;
|
|
252
|
+
services.push(...filtered);
|
|
195
253
|
services.push({
|
|
196
254
|
name: "agentWallet",
|
|
197
255
|
endpoint: `eip155:${chainId}:${wallet.address}`,
|
|
198
|
-
triggerName: undefined,
|
|
199
|
-
description: undefined,
|
|
200
256
|
});
|
|
201
257
|
}
|
|
258
|
+
// Build registrations array (populated on re-deploy)
|
|
259
|
+
const existingAgentId = wallet.erc8004AgentId;
|
|
260
|
+
const registrations = [];
|
|
261
|
+
if (existingAgentId) {
|
|
262
|
+
const [, tokenId] = existingAgentId.split(":");
|
|
263
|
+
if (tokenId) {
|
|
264
|
+
const contracts = (0, erc8004_contracts_js_1.getErc8004Contracts)(chainId);
|
|
265
|
+
registrations.push({
|
|
266
|
+
agentId: Number.parseInt(tokenId, 10),
|
|
267
|
+
agentRegistry: `eip155:${chainId}:${contracts.IDENTITY_REGISTRY}`,
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}
|
|
202
271
|
const agentCard = {
|
|
203
272
|
type: "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
|
|
204
273
|
name,
|
|
205
274
|
description,
|
|
275
|
+
...(image && { image }),
|
|
206
276
|
services,
|
|
277
|
+
...(registrations.length > 0 && { registrations }),
|
|
207
278
|
active: true,
|
|
208
279
|
x402support: true,
|
|
209
280
|
};
|
|
210
281
|
const agentCardJson = JSON.stringify(agentCard);
|
|
211
282
|
// 3. Detect first deploy vs re-deploy
|
|
212
|
-
const existingAgentId = wallet.erc8004AgentId;
|
|
213
283
|
const isRedeploy = !!existingAgentId;
|
|
214
284
|
// 4. Save initial state
|
|
215
285
|
await this.deploy({
|
|
@@ -417,142 +487,5 @@ class Erc8004API {
|
|
|
417
487
|
async presignIpfsUrl(params) {
|
|
418
488
|
return this.client.put(`/workspaces/${params.workflowId}/erc-8004/presign-ipfs-url`);
|
|
419
489
|
}
|
|
420
|
-
// ===========================================================================
|
|
421
|
-
// Web3 Wallet Management
|
|
422
|
-
// ===========================================================================
|
|
423
|
-
/**
|
|
424
|
-
* Get the web3 wallet associated with a workspace.
|
|
425
|
-
*
|
|
426
|
-
* @param params - Parameters
|
|
427
|
-
* @param params.workflowId - The workflow (workspace) ID
|
|
428
|
-
* @returns The web3 wallet details
|
|
429
|
-
*
|
|
430
|
-
* @example
|
|
431
|
-
* ```typescript
|
|
432
|
-
* const wallet = await client.erc8004.getWallet({ workflowId: 123 });
|
|
433
|
-
* console.log(wallet.address, wallet.deployed, wallet.erc8004AgentId);
|
|
434
|
-
* ```
|
|
435
|
-
*/
|
|
436
|
-
async getWallet(params) {
|
|
437
|
-
return this.client.get(`/workspaces/${params.workflowId}/web3`);
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* Generate a new web3 wallet for a workspace.
|
|
441
|
-
*
|
|
442
|
-
* Creates a fresh wallet with a server-generated private key. The wallet
|
|
443
|
-
* is stored securely on the platform and used for ERC-8004 operations.
|
|
444
|
-
* A workspace can only have one web3 wallet.
|
|
445
|
-
*
|
|
446
|
-
* @param params - Parameters
|
|
447
|
-
* @param params.workflowId - The workflow (workspace) ID
|
|
448
|
-
* @returns The generated web3 wallet
|
|
449
|
-
* @throws Error if the workspace already has a web3 wallet
|
|
450
|
-
*
|
|
451
|
-
* @example
|
|
452
|
-
* ```typescript
|
|
453
|
-
* const wallet = await client.erc8004.generateWallet({ workflowId: 123 });
|
|
454
|
-
* console.log('Wallet address:', wallet.address);
|
|
455
|
-
* ```
|
|
456
|
-
*/
|
|
457
|
-
async generateWallet(params) {
|
|
458
|
-
return this.client.post(`/workspaces/${params.workflowId}/web3/generate`);
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* Import an existing web3 wallet into a workspace.
|
|
462
|
-
*
|
|
463
|
-
* Use this to associate a pre-existing wallet (e.g., one that already has
|
|
464
|
-
* an ERC-8004 registration) with a workspace.
|
|
465
|
-
* A workspace can only have one web3 wallet.
|
|
466
|
-
*
|
|
467
|
-
* @param params - Import parameters
|
|
468
|
-
* @param params.workflowId - The workflow (workspace) ID
|
|
469
|
-
* @param params.address - Wallet address
|
|
470
|
-
* @param params.network - Network name (e.g., "base")
|
|
471
|
-
* @param params.chainId - Chain ID (e.g., 8453)
|
|
472
|
-
* @param params.privateKey - Wallet private key
|
|
473
|
-
* @returns The imported web3 wallet
|
|
474
|
-
* @throws Error if the workspace already has a web3 wallet
|
|
475
|
-
*
|
|
476
|
-
* @example
|
|
477
|
-
* ```typescript
|
|
478
|
-
* const wallet = await client.erc8004.importWallet({
|
|
479
|
-
* workflowId: 123,
|
|
480
|
-
* address: '0x...',
|
|
481
|
-
* network: 'base',
|
|
482
|
-
* chainId: 8453,
|
|
483
|
-
* privateKey: '0x...',
|
|
484
|
-
* });
|
|
485
|
-
* ```
|
|
486
|
-
*/
|
|
487
|
-
async importWallet(params) {
|
|
488
|
-
const { workflowId, ...body } = params;
|
|
489
|
-
return this.client.post(`/workspaces/${workflowId}/web3/import`, body);
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* Delete the web3 wallet associated with a workspace.
|
|
493
|
-
*
|
|
494
|
-
* This removes the wallet record from the platform. Note that the on-chain
|
|
495
|
-
* ERC-8004 registration is not affected -- this only removes the platform's
|
|
496
|
-
* association.
|
|
497
|
-
*
|
|
498
|
-
* @param params - Parameters
|
|
499
|
-
* @param params.workflowId - The workflow (workspace) ID
|
|
500
|
-
*
|
|
501
|
-
* @example
|
|
502
|
-
* ```typescript
|
|
503
|
-
* await client.erc8004.deleteWallet({ workflowId: 123 });
|
|
504
|
-
* ```
|
|
505
|
-
*/
|
|
506
|
-
async deleteWallet(params) {
|
|
507
|
-
await this.client.delete(`/workspaces/${params.workflowId}/web3`);
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
|
-
* Sign a feedback auth message for a buyer address.
|
|
511
|
-
*
|
|
512
|
-
* This is used for the ERC-8004 reputation system. The workspace's web3 wallet
|
|
513
|
-
* signs an auth message that allows a buyer to submit feedback/reputation
|
|
514
|
-
* for the agent on-chain.
|
|
515
|
-
*
|
|
516
|
-
* @param params - Parameters
|
|
517
|
-
* @param params.workflowId - The workflow (workspace) ID
|
|
518
|
-
* @param params.buyerAddress - The buyer's wallet address to authorize
|
|
519
|
-
* @returns Object containing the signed feedback auth
|
|
520
|
-
*
|
|
521
|
-
* @example
|
|
522
|
-
* ```typescript
|
|
523
|
-
* const { signature } = await client.erc8004.signFeedbackAuth({
|
|
524
|
-
* workflowId: 123,
|
|
525
|
-
* buyerAddress: '0xBuyer...',
|
|
526
|
-
* });
|
|
527
|
-
* ```
|
|
528
|
-
*/
|
|
529
|
-
async signFeedbackAuth(params) {
|
|
530
|
-
return this.client.post(`/workspaces/${params.workflowId}/web3/sign-feedback-auth`, { buyerAddress: params.buyerAddress });
|
|
531
|
-
}
|
|
532
|
-
// ===========================================================================
|
|
533
|
-
// Callable Triggers
|
|
534
|
-
// ===========================================================================
|
|
535
|
-
/**
|
|
536
|
-
* Get callable triggers for a workspace.
|
|
537
|
-
*
|
|
538
|
-
* Returns the list of triggers that can be called externally, along with
|
|
539
|
-
* their input schemas and endpoint URLs. This is used during ERC-8004
|
|
540
|
-
* deployment to register the agent's available services on-chain.
|
|
541
|
-
*
|
|
542
|
-
* @param params - Parameters
|
|
543
|
-
* @param params.workflowId - The workflow (workspace) ID
|
|
544
|
-
* @returns Array of callable triggers with their schemas and endpoints
|
|
545
|
-
*
|
|
546
|
-
* @example
|
|
547
|
-
* ```typescript
|
|
548
|
-
* const triggers = await client.erc8004.getCallableTriggers({ workflowId: 123 });
|
|
549
|
-
* for (const trigger of triggers) {
|
|
550
|
-
* console.log(trigger.name, trigger.webEndpoint);
|
|
551
|
-
* }
|
|
552
|
-
* ```
|
|
553
|
-
*/
|
|
554
|
-
async getCallableTriggers(params) {
|
|
555
|
-
return this.client.get(`/workspaces/${params.workflowId}/callable-triggers`);
|
|
556
|
-
}
|
|
557
490
|
}
|
|
558
491
|
exports.Erc8004API = Erc8004API;
|
package/dist/payments-api.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ import type { X402PaymentRequest, X402PaymentResult } from "./types";
|
|
|
10
10
|
* ```typescript
|
|
11
11
|
* const client = new PlatformClient();
|
|
12
12
|
*
|
|
13
|
-
* // Pay and execute an x402 workflow
|
|
13
|
+
* // Pay and execute an x402 workflow by ID - only wallet key needed!
|
|
14
14
|
* const result = await client.payments.payWorkflow({
|
|
15
|
-
*
|
|
16
|
-
* input: {
|
|
15
|
+
* workflowId: 123,
|
|
16
|
+
* input: { prompt: 'Hello world' }
|
|
17
17
|
* });
|
|
18
18
|
*
|
|
19
19
|
* console.log(result.response); // Workflow response
|
|
@@ -26,24 +26,28 @@ export declare class PaymentsAPI {
|
|
|
26
26
|
* Pay for and execute an x402-protected workflow.
|
|
27
27
|
*
|
|
28
28
|
* This method handles the entire x402 payment flow automatically:
|
|
29
|
-
* 1.
|
|
30
|
-
* 2.
|
|
31
|
-
* 3.
|
|
32
|
-
* 4.
|
|
33
|
-
* 5.
|
|
34
|
-
* 6.
|
|
29
|
+
* 1. Resolves the x402 trigger URL (from workflowId or provided triggerUrl)
|
|
30
|
+
* 2. Creates a payment-enabled fetch wrapper using your wallet
|
|
31
|
+
* 3. Makes a request to the trigger URL
|
|
32
|
+
* 4. Automatically handles the 402 Payment Required response
|
|
33
|
+
* 5. Signs and submits the payment
|
|
34
|
+
* 6. Retries the request with payment proof
|
|
35
|
+
* 7. Returns the workflow response
|
|
36
|
+
*
|
|
37
|
+
* Provide either `workflowId` (recommended) or `triggerUrl`.
|
|
35
38
|
*
|
|
36
39
|
* @param params - Payment parameters
|
|
37
|
-
* @param params.
|
|
40
|
+
* @param params.workflowId - The workflow ID (recommended - resolves x402 trigger URL automatically)
|
|
41
|
+
* @param params.triggerUrl - The x402 trigger URL (alternative to workflowId)
|
|
38
42
|
* @param params.privateKey - Wallet private key for payment (or uses WALLET_PRIVATE_KEY env var)
|
|
39
43
|
* @param params.input - Input data to pass to the workflow
|
|
40
44
|
* @returns Payment result with workflow response
|
|
41
45
|
*
|
|
42
46
|
* @example
|
|
43
47
|
* ```typescript
|
|
44
|
-
* //
|
|
48
|
+
* // By workflow ID (recommended)
|
|
45
49
|
* const result = await client.payments.payWorkflow({
|
|
46
|
-
*
|
|
50
|
+
* workflowId: 123,
|
|
47
51
|
* input: { prompt: 'Generate a summary' }
|
|
48
52
|
* });
|
|
49
53
|
*
|
|
@@ -52,15 +56,28 @@ export declare class PaymentsAPI {
|
|
|
52
56
|
*
|
|
53
57
|
* @example
|
|
54
58
|
* ```typescript
|
|
59
|
+
* // By direct URL
|
|
60
|
+
* const result = await client.payments.payWorkflow({
|
|
61
|
+
* triggerUrl: 'https://api.openserv.ai/webhooks/x402/trigger/abc123',
|
|
62
|
+
* input: { prompt: 'Generate a summary' }
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
55
68
|
* // Explicitly providing private key
|
|
56
69
|
* const result = await client.payments.payWorkflow({
|
|
57
|
-
*
|
|
70
|
+
* workflowId: 123,
|
|
58
71
|
* privateKey: '0x...',
|
|
59
72
|
* input: { query: 'What is the weather?' }
|
|
60
73
|
* });
|
|
61
74
|
* ```
|
|
62
75
|
*/
|
|
63
76
|
payWorkflow(params: X402PaymentRequest): Promise<X402PaymentResult>;
|
|
77
|
+
/**
|
|
78
|
+
* Resolve the x402 trigger URL from workflowId or return the provided triggerUrl.
|
|
79
|
+
*/
|
|
80
|
+
private resolveX402TriggerUrl;
|
|
64
81
|
/**
|
|
65
82
|
* Discover available x402 services from the platform.
|
|
66
83
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payments-api.d.ts","sourceRoot":"","sources":["../src/payments-api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAErE;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,cAAc;IAE1C
|
|
1
|
+
{"version":3,"file":"payments-api.d.ts","sourceRoot":"","sources":["../src/payments-api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAErE;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,cAAc;IAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkDG;IACG,WAAW,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAgDzE;;OAEG;YACW,qBAAqB;IAmCnC;;;;;;;;;;;;;;;;;OAiBG;IACG,gBAAgB,IAAI,OAAO,CAC/B,KAAK,CAAC;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC,CACH;IAmBD;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,mBAAmB,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAC5D,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;QAClC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAClC,WAAW,EAAE,OAAO,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;KAC/B,CAAC;CAeH"}
|
package/dist/payments-api.js
CHANGED
|
@@ -13,10 +13,10 @@ const x402_fetch_1 = require("x402-fetch");
|
|
|
13
13
|
* ```typescript
|
|
14
14
|
* const client = new PlatformClient();
|
|
15
15
|
*
|
|
16
|
-
* // Pay and execute an x402 workflow
|
|
16
|
+
* // Pay and execute an x402 workflow by ID - only wallet key needed!
|
|
17
17
|
* const result = await client.payments.payWorkflow({
|
|
18
|
-
*
|
|
19
|
-
* input: {
|
|
18
|
+
* workflowId: 123,
|
|
19
|
+
* input: { prompt: 'Hello world' }
|
|
20
20
|
* });
|
|
21
21
|
*
|
|
22
22
|
* console.log(result.response); // Workflow response
|
|
@@ -31,24 +31,28 @@ class PaymentsAPI {
|
|
|
31
31
|
* Pay for and execute an x402-protected workflow.
|
|
32
32
|
*
|
|
33
33
|
* This method handles the entire x402 payment flow automatically:
|
|
34
|
-
* 1.
|
|
35
|
-
* 2.
|
|
36
|
-
* 3.
|
|
37
|
-
* 4.
|
|
38
|
-
* 5.
|
|
39
|
-
* 6.
|
|
34
|
+
* 1. Resolves the x402 trigger URL (from workflowId or provided triggerUrl)
|
|
35
|
+
* 2. Creates a payment-enabled fetch wrapper using your wallet
|
|
36
|
+
* 3. Makes a request to the trigger URL
|
|
37
|
+
* 4. Automatically handles the 402 Payment Required response
|
|
38
|
+
* 5. Signs and submits the payment
|
|
39
|
+
* 6. Retries the request with payment proof
|
|
40
|
+
* 7. Returns the workflow response
|
|
41
|
+
*
|
|
42
|
+
* Provide either `workflowId` (recommended) or `triggerUrl`.
|
|
40
43
|
*
|
|
41
44
|
* @param params - Payment parameters
|
|
42
|
-
* @param params.
|
|
45
|
+
* @param params.workflowId - The workflow ID (recommended - resolves x402 trigger URL automatically)
|
|
46
|
+
* @param params.triggerUrl - The x402 trigger URL (alternative to workflowId)
|
|
43
47
|
* @param params.privateKey - Wallet private key for payment (or uses WALLET_PRIVATE_KEY env var)
|
|
44
48
|
* @param params.input - Input data to pass to the workflow
|
|
45
49
|
* @returns Payment result with workflow response
|
|
46
50
|
*
|
|
47
51
|
* @example
|
|
48
52
|
* ```typescript
|
|
49
|
-
* //
|
|
53
|
+
* // By workflow ID (recommended)
|
|
50
54
|
* const result = await client.payments.payWorkflow({
|
|
51
|
-
*
|
|
55
|
+
* workflowId: 123,
|
|
52
56
|
* input: { prompt: 'Generate a summary' }
|
|
53
57
|
* });
|
|
54
58
|
*
|
|
@@ -57,15 +61,25 @@ class PaymentsAPI {
|
|
|
57
61
|
*
|
|
58
62
|
* @example
|
|
59
63
|
* ```typescript
|
|
64
|
+
* // By direct URL
|
|
65
|
+
* const result = await client.payments.payWorkflow({
|
|
66
|
+
* triggerUrl: 'https://api.openserv.ai/webhooks/x402/trigger/abc123',
|
|
67
|
+
* input: { prompt: 'Generate a summary' }
|
|
68
|
+
* });
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
60
73
|
* // Explicitly providing private key
|
|
61
74
|
* const result = await client.payments.payWorkflow({
|
|
62
|
-
*
|
|
75
|
+
* workflowId: 123,
|
|
63
76
|
* privateKey: '0x...',
|
|
64
77
|
* input: { query: 'What is the weather?' }
|
|
65
78
|
* });
|
|
66
79
|
* ```
|
|
67
80
|
*/
|
|
68
81
|
async payWorkflow(params) {
|
|
82
|
+
const triggerUrl = await this.resolveX402TriggerUrl(params);
|
|
69
83
|
const privateKey = params.privateKey || process.env.WALLET_PRIVATE_KEY;
|
|
70
84
|
if (!privateKey) {
|
|
71
85
|
throw new Error("Private key is required. Provide it as a parameter or set WALLET_PRIVATE_KEY env var.");
|
|
@@ -77,7 +91,7 @@ class PaymentsAPI {
|
|
|
77
91
|
// Wrap fetch with x402 payment handling
|
|
78
92
|
const x402Fetch = (0, x402_fetch_1.wrapFetchWithPayment)(fetch, signer);
|
|
79
93
|
// Make the request - x402Fetch automatically handles 402 responses
|
|
80
|
-
const response = await x402Fetch(
|
|
94
|
+
const response = await x402Fetch(triggerUrl, {
|
|
81
95
|
method: "POST",
|
|
82
96
|
headers: { "Content-Type": "application/json" },
|
|
83
97
|
body: JSON.stringify({
|
|
@@ -99,6 +113,31 @@ class PaymentsAPI {
|
|
|
99
113
|
chainId: 8453,
|
|
100
114
|
};
|
|
101
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Resolve the x402 trigger URL from workflowId or return the provided triggerUrl.
|
|
118
|
+
*/
|
|
119
|
+
async resolveX402TriggerUrl(params) {
|
|
120
|
+
if (params.triggerUrl)
|
|
121
|
+
return params.triggerUrl;
|
|
122
|
+
if (!params.workflowId) {
|
|
123
|
+
throw new Error("Either workflowId or triggerUrl is required.");
|
|
124
|
+
}
|
|
125
|
+
const triggers = await this.client.triggers.list({
|
|
126
|
+
workflowId: params.workflowId,
|
|
127
|
+
});
|
|
128
|
+
// Find matching x402 trigger: by name if specified, otherwise first x402 trigger with a token
|
|
129
|
+
const trigger = params.triggerName
|
|
130
|
+
? triggers.find((t) => t.name === params.triggerName && t.token && t.props?.x402Pricing)
|
|
131
|
+
: triggers.find((t) => t.token && t.props?.x402Pricing);
|
|
132
|
+
if (!trigger?.token) {
|
|
133
|
+
const hint = params.triggerName
|
|
134
|
+
? `x402 trigger "${params.triggerName}"`
|
|
135
|
+
: "No x402 trigger";
|
|
136
|
+
throw new Error(`${hint} not found in workflow ${params.workflowId}.`);
|
|
137
|
+
}
|
|
138
|
+
const baseUrl = this.client.rawClient.defaults.baseURL || "https://api.openserv.ai";
|
|
139
|
+
return `${baseUrl}/webhooks/x402/trigger/${trigger.token}`;
|
|
140
|
+
}
|
|
102
141
|
/**
|
|
103
142
|
* Discover available x402 services from the platform.
|
|
104
143
|
*
|
package/dist/triggers-api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PlatformClient } from "./client";
|
|
2
|
-
import type { Trigger } from "./types";
|
|
2
|
+
import type { CallableTrigger, Trigger } from "./types";
|
|
3
3
|
/**
|
|
4
4
|
* Defines a single property in an input schema.
|
|
5
5
|
*/
|
|
@@ -281,5 +281,76 @@ export declare class TriggersAPI {
|
|
|
281
281
|
id: string;
|
|
282
282
|
input?: string;
|
|
283
283
|
}): Promise<unknown>;
|
|
284
|
+
/**
|
|
285
|
+
* Fire a webhook trigger by workflow ID or direct URL.
|
|
286
|
+
*
|
|
287
|
+
* When `workflowId` is provided, the method automatically resolves the
|
|
288
|
+
* webhook trigger token by listing the workflow's triggers and finding
|
|
289
|
+
* the first non-x402 trigger with a token. You can narrow which trigger
|
|
290
|
+
* to use by also passing `triggerId` or `triggerName`.
|
|
291
|
+
*
|
|
292
|
+
* @param params - Parameters
|
|
293
|
+
* @param params.workflowId - The workflow ID (recommended - resolves webhook URL automatically)
|
|
294
|
+
* @param params.triggerUrl - Direct webhook URL (alternative to workflowId)
|
|
295
|
+
* @param params.triggerId - Specific trigger ID within the workflow (optional, used with workflowId)
|
|
296
|
+
* @param params.triggerName - Specific trigger name within the workflow (optional, used with workflowId)
|
|
297
|
+
* @param params.input - Input data to pass to the workflow
|
|
298
|
+
* @returns The webhook response data
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* ```typescript
|
|
302
|
+
* // By workflow ID (recommended)
|
|
303
|
+
* const result = await client.triggers.fireWebhook({
|
|
304
|
+
* workflowId: 123,
|
|
305
|
+
* input: { query: 'hello world' }
|
|
306
|
+
* });
|
|
307
|
+
*
|
|
308
|
+
* // By workflow ID + trigger name
|
|
309
|
+
* const result = await client.triggers.fireWebhook({
|
|
310
|
+
* workflowId: 123,
|
|
311
|
+
* triggerName: 'My Webhook',
|
|
312
|
+
* input: { query: 'hello world' }
|
|
313
|
+
* });
|
|
314
|
+
*
|
|
315
|
+
* // By direct URL
|
|
316
|
+
* const result = await client.triggers.fireWebhook({
|
|
317
|
+
* triggerUrl: 'https://api.openserv.ai/webhooks/trigger/TOKEN',
|
|
318
|
+
* input: { query: 'hello world' }
|
|
319
|
+
* });
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
fireWebhook(params: {
|
|
323
|
+
workflowId?: number;
|
|
324
|
+
triggerUrl?: string;
|
|
325
|
+
triggerId?: string;
|
|
326
|
+
triggerName?: string;
|
|
327
|
+
input?: Record<string, unknown>;
|
|
328
|
+
}): Promise<unknown>;
|
|
329
|
+
/**
|
|
330
|
+
* Resolve a webhook trigger token from workflowId.
|
|
331
|
+
*/
|
|
332
|
+
private resolveWebhookToken;
|
|
333
|
+
/**
|
|
334
|
+
* Get callable triggers for a workspace.
|
|
335
|
+
*
|
|
336
|
+
* Returns the list of triggers that can be called externally, along with
|
|
337
|
+
* their input schemas and endpoint URLs. This is used during ERC-8004
|
|
338
|
+
* deployment to register the agent's available services on-chain.
|
|
339
|
+
*
|
|
340
|
+
* @param params - Parameters
|
|
341
|
+
* @param params.workflowId - The workflow (workspace) ID
|
|
342
|
+
* @returns Array of callable triggers with their schemas and endpoints
|
|
343
|
+
*
|
|
344
|
+
* @example
|
|
345
|
+
* ```typescript
|
|
346
|
+
* const triggers = await client.triggers.getCallableTriggers({ workflowId: 123 });
|
|
347
|
+
* for (const trigger of triggers) {
|
|
348
|
+
* console.log(trigger.name, trigger.webEndpoint);
|
|
349
|
+
* }
|
|
350
|
+
* ```
|
|
351
|
+
*/
|
|
352
|
+
getCallableTriggers(params: {
|
|
353
|
+
workflowId: number;
|
|
354
|
+
}): Promise<CallableTrigger[]>;
|
|
284
355
|
}
|
|
285
356
|
//# sourceMappingURL=triggers-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"triggers-api.d.ts","sourceRoot":"","sources":["../src/triggers-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"triggers-api.d.ts","sourceRoot":"","sources":["../src/triggers-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAMxD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC3D,KAAK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|
+
* Fire a webhook trigger by workflow ID or direct URL.
|
|
290
|
+
*
|
|
291
|
+
* When `workflowId` is provided, the method automatically resolves the
|
|
292
|
+
* webhook trigger token by listing the workflow's triggers and finding
|
|
293
|
+
* the first non-x402 trigger with a token. You can narrow which trigger
|
|
294
|
+
* to use by also passing `triggerId` or `triggerName`.
|
|
295
|
+
*
|
|
296
|
+
* @param params - Parameters
|
|
297
|
+
* @param params.workflowId - The workflow ID (recommended - resolves webhook URL automatically)
|
|
298
|
+
* @param params.triggerUrl - Direct webhook URL (alternative to workflowId)
|
|
299
|
+
* @param params.triggerId - Specific trigger ID within the workflow (optional, used with workflowId)
|
|
300
|
+
* @param params.triggerName - Specific trigger name within the workflow (optional, used with workflowId)
|
|
301
|
+
* @param params.input - Input data to pass to the workflow
|
|
302
|
+
* @returns The webhook response data
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* ```typescript
|
|
306
|
+
* // By workflow ID (recommended)
|
|
307
|
+
* const result = await client.triggers.fireWebhook({
|
|
308
|
+
* workflowId: 123,
|
|
309
|
+
* input: { query: 'hello world' }
|
|
310
|
+
* });
|
|
311
|
+
*
|
|
312
|
+
* // By workflow ID + trigger name
|
|
313
|
+
* const result = await client.triggers.fireWebhook({
|
|
314
|
+
* workflowId: 123,
|
|
315
|
+
* triggerName: 'My Webhook',
|
|
316
|
+
* input: { query: 'hello world' }
|
|
317
|
+
* });
|
|
318
|
+
*
|
|
319
|
+
* // By direct URL
|
|
320
|
+
* const result = await client.triggers.fireWebhook({
|
|
321
|
+
* triggerUrl: 'https://api.openserv.ai/webhooks/trigger/TOKEN',
|
|
322
|
+
* input: { query: 'hello world' }
|
|
323
|
+
* });
|
|
324
|
+
* ```
|
|
325
|
+
*/
|
|
326
|
+
async fireWebhook(params) {
|
|
327
|
+
if (params.triggerUrl) {
|
|
328
|
+
// Direct URL provided -- use raw POST (the URL may point to an external host)
|
|
329
|
+
return this.client.post(params.triggerUrl, params.input || {});
|
|
330
|
+
}
|
|
331
|
+
const token = await this.resolveWebhookToken(params);
|
|
332
|
+
return this.client.post(`/webhooks/trigger/${token}`, params.input || {});
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Resolve a webhook trigger token from workflowId.
|
|
336
|
+
*/
|
|
337
|
+
async resolveWebhookToken(params) {
|
|
338
|
+
if (!params.workflowId) {
|
|
339
|
+
throw new Error("Either workflowId or triggerUrl is required.");
|
|
340
|
+
}
|
|
341
|
+
const triggers = await this.list({ workflowId: params.workflowId });
|
|
342
|
+
let trigger;
|
|
343
|
+
if (params.triggerId) {
|
|
344
|
+
trigger = triggers.find((t) => t.id === params.triggerId && t.token);
|
|
345
|
+
}
|
|
346
|
+
else if (params.triggerName) {
|
|
347
|
+
trigger = triggers.find((t) => t.name === params.triggerName && t.token);
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
trigger = triggers.find((t) => t.token && !t.props?.x402Pricing);
|
|
351
|
+
}
|
|
352
|
+
if (!trigger?.token) {
|
|
353
|
+
const hint = params.triggerId
|
|
354
|
+
? `Trigger ${params.triggerId}`
|
|
355
|
+
: params.triggerName
|
|
356
|
+
? `Trigger "${params.triggerName}"`
|
|
357
|
+
: "No webhook trigger";
|
|
358
|
+
throw new Error(`${hint} not found or has no token in workflow ${params.workflowId}.`);
|
|
359
|
+
}
|
|
360
|
+
return trigger.token;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Get callable triggers for a workspace.
|
|
364
|
+
*
|
|
365
|
+
* Returns the list of triggers that can be called externally, along with
|
|
366
|
+
* their input schemas and endpoint URLs. This is used during ERC-8004
|
|
367
|
+
* deployment to register the agent's available services on-chain.
|
|
368
|
+
*
|
|
369
|
+
* @param params - Parameters
|
|
370
|
+
* @param params.workflowId - The workflow (workspace) ID
|
|
371
|
+
* @returns Array of callable triggers with their schemas and endpoints
|
|
372
|
+
*
|
|
373
|
+
* @example
|
|
374
|
+
* ```typescript
|
|
375
|
+
* const triggers = await client.triggers.getCallableTriggers({ workflowId: 123 });
|
|
376
|
+
* for (const trigger of triggers) {
|
|
377
|
+
* console.log(trigger.name, trigger.webEndpoint);
|
|
378
|
+
* }
|
|
379
|
+
* ```
|
|
380
|
+
*/
|
|
381
|
+
async getCallableTriggers(params) {
|
|
382
|
+
return this.client.get(`/workspaces/${params.workflowId}/callable-triggers`);
|
|
383
|
+
}
|
|
288
384
|
}
|
|
289
385
|
exports.TriggersAPI = TriggersAPI;
|
package/dist/types.d.ts
CHANGED
|
@@ -309,10 +309,18 @@ export interface SignFeedbackAuthResponse {
|
|
|
309
309
|
}
|
|
310
310
|
/**
|
|
311
311
|
* Request parameters for paying and executing an x402 workflow.
|
|
312
|
+
*
|
|
313
|
+
* Provide either `workflowId` (recommended) or `triggerUrl`. When `workflowId`
|
|
314
|
+
* is given, the x402 trigger URL is resolved automatically by looking up the
|
|
315
|
+
* workflow's triggers.
|
|
312
316
|
*/
|
|
313
317
|
export interface X402PaymentRequest {
|
|
314
|
-
/** The
|
|
315
|
-
|
|
318
|
+
/** The workflow ID to pay for. The x402 trigger URL is resolved automatically. */
|
|
319
|
+
workflowId?: number;
|
|
320
|
+
/** The x402 trigger URL (alternative to workflowId - use when you already have the URL) */
|
|
321
|
+
triggerUrl?: string;
|
|
322
|
+
/** Specific trigger name within the workflow (optional, used with workflowId) */
|
|
323
|
+
triggerName?: string;
|
|
316
324
|
/** Wallet private key for payment (or uses WALLET_PRIVATE_KEY env var) */
|
|
317
325
|
privateKey?: string;
|
|
318
326
|
/** Input data to pass to the workflow */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAMpD,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB,EAAE,MA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iFAAiF;IACjF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,wDAAwD;IACxD,OAAO,EAAE,OAAO,CAAC;IACjB,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/workflows-api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PlatformClient } from "./client";
|
|
2
|
-
import type { WorkflowConfig, TaskDefinition, EdgeDefinition, Edge } from "./types";
|
|
2
|
+
import type { WorkflowConfig, TaskDefinition, EdgeDefinition, Edge, ImportWeb3WalletRequest, SignFeedbackAuthResponse, Web3Wallet } from "./types";
|
|
3
3
|
import type { TriggerConfig } from "./triggers-api";
|
|
4
4
|
import { Workflow } from "./workflow";
|
|
5
5
|
/**
|
|
@@ -159,5 +159,114 @@ export declare class WorkflowsAPI {
|
|
|
159
159
|
private getTriggerName;
|
|
160
160
|
private resolveEdgeRef;
|
|
161
161
|
private resolveNodeId;
|
|
162
|
+
/**
|
|
163
|
+
* Get the web3 wallet associated with a workspace.
|
|
164
|
+
*
|
|
165
|
+
* @param params - Parameters
|
|
166
|
+
* @param params.id - The workflow (workspace) ID
|
|
167
|
+
* @returns The web3 wallet details
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* const wallet = await client.workflows.getWallet({ id: 123 });
|
|
172
|
+
* console.log(wallet.address, wallet.deployed, wallet.erc8004AgentId);
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
getWallet(params: {
|
|
176
|
+
id: number;
|
|
177
|
+
}): Promise<Web3Wallet>;
|
|
178
|
+
/**
|
|
179
|
+
* Generate a new web3 wallet for a workspace.
|
|
180
|
+
*
|
|
181
|
+
* Creates a fresh wallet with a server-generated private key. The wallet
|
|
182
|
+
* is stored securely on the platform and used for ERC-8004 operations.
|
|
183
|
+
* A workspace can only have one web3 wallet.
|
|
184
|
+
*
|
|
185
|
+
* @param params - Parameters
|
|
186
|
+
* @param params.id - The workflow (workspace) ID
|
|
187
|
+
* @returns The generated web3 wallet
|
|
188
|
+
* @throws Error if the workspace already has a web3 wallet
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* const wallet = await client.workflows.generateWallet({ id: 123 });
|
|
193
|
+
* console.log('Wallet address:', wallet.address);
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
generateWallet(params: {
|
|
197
|
+
id: number;
|
|
198
|
+
}): Promise<Web3Wallet>;
|
|
199
|
+
/**
|
|
200
|
+
* Import an existing web3 wallet into a workspace.
|
|
201
|
+
*
|
|
202
|
+
* Use this to associate a pre-existing wallet (e.g., one that already has
|
|
203
|
+
* an ERC-8004 registration) with a workspace.
|
|
204
|
+
* A workspace can only have one web3 wallet.
|
|
205
|
+
*
|
|
206
|
+
* @param params - Import parameters
|
|
207
|
+
* @param params.id - The workflow (workspace) ID
|
|
208
|
+
* @param params.address - Wallet address
|
|
209
|
+
* @param params.network - Network name (e.g., "base")
|
|
210
|
+
* @param params.chainId - Chain ID (e.g., 8453)
|
|
211
|
+
* @param params.privateKey - Wallet private key
|
|
212
|
+
* @returns The imported web3 wallet
|
|
213
|
+
* @throws Error if the workspace already has a web3 wallet
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```typescript
|
|
217
|
+
* const wallet = await client.workflows.importWallet({
|
|
218
|
+
* id: 123,
|
|
219
|
+
* address: '0x...',
|
|
220
|
+
* network: 'base',
|
|
221
|
+
* chainId: 8453,
|
|
222
|
+
* privateKey: '0x...',
|
|
223
|
+
* });
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
importWallet(params: ImportWeb3WalletRequest & {
|
|
227
|
+
id: number;
|
|
228
|
+
}): Promise<Web3Wallet>;
|
|
229
|
+
/**
|
|
230
|
+
* Delete the web3 wallet associated with a workspace.
|
|
231
|
+
*
|
|
232
|
+
* This removes the wallet record from the platform. Note that the on-chain
|
|
233
|
+
* ERC-8004 registration is not affected -- this only removes the platform's
|
|
234
|
+
* association.
|
|
235
|
+
*
|
|
236
|
+
* @param params - Parameters
|
|
237
|
+
* @param params.id - The workflow (workspace) ID
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```typescript
|
|
241
|
+
* await client.workflows.deleteWallet({ id: 123 });
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
deleteWallet(params: {
|
|
245
|
+
id: number;
|
|
246
|
+
}): Promise<void>;
|
|
247
|
+
/**
|
|
248
|
+
* Sign a feedback auth message for a buyer address.
|
|
249
|
+
*
|
|
250
|
+
* This is used for the ERC-8004 reputation system. The workspace's web3 wallet
|
|
251
|
+
* signs an auth message that allows a buyer to submit feedback/reputation
|
|
252
|
+
* for the agent on-chain.
|
|
253
|
+
*
|
|
254
|
+
* @param params - Parameters
|
|
255
|
+
* @param params.id - The workflow (workspace) ID
|
|
256
|
+
* @param params.buyerAddress - The buyer's wallet address to authorize
|
|
257
|
+
* @returns Object containing the signed feedback auth
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```typescript
|
|
261
|
+
* const { signature } = await client.workflows.signFeedbackAuth({
|
|
262
|
+
* id: 123,
|
|
263
|
+
* buyerAddress: '0xBuyer...',
|
|
264
|
+
* });
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
signFeedbackAuth(params: {
|
|
268
|
+
id: number;
|
|
269
|
+
buyerAddress: string;
|
|
270
|
+
}): Promise<SignFeedbackAuthResponse>;
|
|
162
271
|
}
|
|
163
272
|
//# sourceMappingURL=workflows-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows-api.d.ts","sourceRoot":"","sources":["../src/workflows-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EACV,cAAc,EAEd,cAAc,EACd,cAAc,EACd,IAAI,
|
|
1
|
+
{"version":3,"file":"workflows-api.d.ts","sourceRoot":"","sources":["../src/workflows-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EACV,cAAc,EAEd,cAAc,EACd,cAAc,EACd,IAAI,EAEJ,uBAAuB,EACvB,wBAAwB,EAExB,UAAU,EACX,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,cAAc;IAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACG,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IAiCvD;;;;;OAKG;IACG,GAAG,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,QAAQ,CAAC;IA8C7D;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAWjC;;;;;;;OAOG;IACG,MAAM,CAAC,MAAM,EAAE;QACnB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;QACpB,IAAI,CAA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EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,CAAC;IAMjE;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACG,YAAY,CAChB,MAAM,EAAE,uBAAuB,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAC/C,OAAO,CAAC,UAAU,CAAC;IAKtB;;;;;;;;;;;;;;OAcG;IACG,YAAY,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzD;;;;;;;;;;;;;;;;;;;OAmBG;IACG,gBAAgB,CAAC,MAAM,EAAE;QAC7B,EAAE,EAAE,MAAM,CAAC;QACX,YAAY,EAAE,MAAM,CAAC;KACtB,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAMtC"}
|
package/dist/workflows-api.js
CHANGED
|
@@ -474,5 +474,117 @@ class WorkflowsAPI {
|
|
|
474
474
|
}
|
|
475
475
|
return `${ref.type}-${ref.id}`;
|
|
476
476
|
}
|
|
477
|
+
// ===========================================================================
|
|
478
|
+
// Web3 Wallet Management
|
|
479
|
+
// ===========================================================================
|
|
480
|
+
/**
|
|
481
|
+
* Get the web3 wallet associated with a workspace.
|
|
482
|
+
*
|
|
483
|
+
* @param params - Parameters
|
|
484
|
+
* @param params.id - The workflow (workspace) ID
|
|
485
|
+
* @returns The web3 wallet details
|
|
486
|
+
*
|
|
487
|
+
* @example
|
|
488
|
+
* ```typescript
|
|
489
|
+
* const wallet = await client.workflows.getWallet({ id: 123 });
|
|
490
|
+
* console.log(wallet.address, wallet.deployed, wallet.erc8004AgentId);
|
|
491
|
+
* ```
|
|
492
|
+
*/
|
|
493
|
+
async getWallet(params) {
|
|
494
|
+
return this.client.get(`/workspaces/${params.id}/web3`);
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Generate a new web3 wallet for a workspace.
|
|
498
|
+
*
|
|
499
|
+
* Creates a fresh wallet with a server-generated private key. The wallet
|
|
500
|
+
* is stored securely on the platform and used for ERC-8004 operations.
|
|
501
|
+
* A workspace can only have one web3 wallet.
|
|
502
|
+
*
|
|
503
|
+
* @param params - Parameters
|
|
504
|
+
* @param params.id - The workflow (workspace) ID
|
|
505
|
+
* @returns The generated web3 wallet
|
|
506
|
+
* @throws Error if the workspace already has a web3 wallet
|
|
507
|
+
*
|
|
508
|
+
* @example
|
|
509
|
+
* ```typescript
|
|
510
|
+
* const wallet = await client.workflows.generateWallet({ id: 123 });
|
|
511
|
+
* console.log('Wallet address:', wallet.address);
|
|
512
|
+
* ```
|
|
513
|
+
*/
|
|
514
|
+
async generateWallet(params) {
|
|
515
|
+
return this.client.post(`/workspaces/${params.id}/web3/generate`);
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Import an existing web3 wallet into a workspace.
|
|
519
|
+
*
|
|
520
|
+
* Use this to associate a pre-existing wallet (e.g., one that already has
|
|
521
|
+
* an ERC-8004 registration) with a workspace.
|
|
522
|
+
* A workspace can only have one web3 wallet.
|
|
523
|
+
*
|
|
524
|
+
* @param params - Import parameters
|
|
525
|
+
* @param params.id - The workflow (workspace) ID
|
|
526
|
+
* @param params.address - Wallet address
|
|
527
|
+
* @param params.network - Network name (e.g., "base")
|
|
528
|
+
* @param params.chainId - Chain ID (e.g., 8453)
|
|
529
|
+
* @param params.privateKey - Wallet private key
|
|
530
|
+
* @returns The imported web3 wallet
|
|
531
|
+
* @throws Error if the workspace already has a web3 wallet
|
|
532
|
+
*
|
|
533
|
+
* @example
|
|
534
|
+
* ```typescript
|
|
535
|
+
* const wallet = await client.workflows.importWallet({
|
|
536
|
+
* id: 123,
|
|
537
|
+
* address: '0x...',
|
|
538
|
+
* network: 'base',
|
|
539
|
+
* chainId: 8453,
|
|
540
|
+
* privateKey: '0x...',
|
|
541
|
+
* });
|
|
542
|
+
* ```
|
|
543
|
+
*/
|
|
544
|
+
async importWallet(params) {
|
|
545
|
+
const { id, ...body } = params;
|
|
546
|
+
return this.client.post(`/workspaces/${id}/web3/import`, body);
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Delete the web3 wallet associated with a workspace.
|
|
550
|
+
*
|
|
551
|
+
* This removes the wallet record from the platform. Note that the on-chain
|
|
552
|
+
* ERC-8004 registration is not affected -- this only removes the platform's
|
|
553
|
+
* association.
|
|
554
|
+
*
|
|
555
|
+
* @param params - Parameters
|
|
556
|
+
* @param params.id - The workflow (workspace) ID
|
|
557
|
+
*
|
|
558
|
+
* @example
|
|
559
|
+
* ```typescript
|
|
560
|
+
* await client.workflows.deleteWallet({ id: 123 });
|
|
561
|
+
* ```
|
|
562
|
+
*/
|
|
563
|
+
async deleteWallet(params) {
|
|
564
|
+
await this.client.delete(`/workspaces/${params.id}/web3`);
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Sign a feedback auth message for a buyer address.
|
|
568
|
+
*
|
|
569
|
+
* This is used for the ERC-8004 reputation system. The workspace's web3 wallet
|
|
570
|
+
* signs an auth message that allows a buyer to submit feedback/reputation
|
|
571
|
+
* for the agent on-chain.
|
|
572
|
+
*
|
|
573
|
+
* @param params - Parameters
|
|
574
|
+
* @param params.id - The workflow (workspace) ID
|
|
575
|
+
* @param params.buyerAddress - The buyer's wallet address to authorize
|
|
576
|
+
* @returns Object containing the signed feedback auth
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* ```typescript
|
|
580
|
+
* const { signature } = await client.workflows.signFeedbackAuth({
|
|
581
|
+
* id: 123,
|
|
582
|
+
* buyerAddress: '0xBuyer...',
|
|
583
|
+
* });
|
|
584
|
+
* ```
|
|
585
|
+
*/
|
|
586
|
+
async signFeedbackAuth(params) {
|
|
587
|
+
return this.client.post(`/workspaces/${params.id}/web3/sign-feedback-auth`, { buyerAddress: params.buyerAddress });
|
|
588
|
+
}
|
|
477
589
|
}
|
|
478
590
|
exports.WorkflowsAPI = WorkflowsAPI;
|
package/package.json
CHANGED