@stwd/sdk 0.1.0

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 ADDED
@@ -0,0 +1,406 @@
1
+ # @stwd/sdk
2
+
3
+ TypeScript client for the [Steward](https://steward.fi) API. Use this in your agents, bots, or platform integrations to create wallets, set policies, and submit transactions for signing.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @stwd/sdk
9
+ # bun add @stwd/sdk
10
+ # pnpm add @stwd/sdk
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```typescript
16
+ import { StewardClient } from '@stwd/sdk';
17
+
18
+ const steward = new StewardClient({
19
+ baseUrl: 'https://api.steward.fi',
20
+ tenantId: 'my-platform',
21
+ apiKey: 'sk-...',
22
+ });
23
+
24
+ const agent = await steward.createWallet('agent-1', 'My Trading Bot');
25
+ console.log(agent.walletAddress); // 0x...
26
+
27
+ const result = await steward.signTransaction(agent.id, {
28
+ to: '0xSomeContract',
29
+ value: '10000000000000000', // 0.01 ETH in wei
30
+ chainId: 8453,
31
+ });
32
+
33
+ if ('txHash' in result) {
34
+ console.log('Broadcast:', result.txHash);
35
+ } else {
36
+ // result.status === 'pending_approval'
37
+ console.log('Queued for human review');
38
+ }
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Constructor
44
+
45
+ ```typescript
46
+ new StewardClient(config: StewardClientConfig)
47
+ ```
48
+
49
+ ### `StewardClientConfig`
50
+
51
+ | Field | Type | Required | Description |
52
+ |-------|------|----------|-------------|
53
+ | `baseUrl` | `string` | ✅ | Base URL of the Steward API (e.g. `https://api.steward.fi`) |
54
+ | `apiKey` | `string` | — | API key sent as `X-Steward-Key` header |
55
+ | `tenantId` | `string` | — | Tenant ID sent as `X-Steward-Tenant` header |
56
+
57
+ ---
58
+
59
+ ## Methods
60
+
61
+ ### `createWallet`
62
+
63
+ Create a new agent wallet. Steward generates a keypair, encrypts it in the vault, and returns the agent identity.
64
+
65
+ ```typescript
66
+ createWallet(agentId: string, name: string, platformId?: string): Promise<AgentIdentity>
67
+ ```
68
+
69
+ | Param | Description |
70
+ |-------|-------------|
71
+ | `agentId` | Unique identifier for the agent within your tenant |
72
+ | `name` | Human-readable label (e.g. `"DeFi Scout Bot"`) |
73
+ | `platformId` | Optional external ID (e.g. your platform's agent UUID) |
74
+
75
+ **Returns:** [`AgentIdentity`](#agentidentity)
76
+
77
+ ```typescript
78
+ const agent = await steward.createWallet('scout-1', 'DeFi Scout', 'ext-uuid-123');
79
+ // { id: 'scout-1', walletAddress: '0x...', tenantId: '...', name: '...', createdAt: Date }
80
+ ```
81
+
82
+ ---
83
+
84
+ ### `getAgent`
85
+
86
+ Fetch an agent by ID.
87
+
88
+ ```typescript
89
+ getAgent(agentId: string): Promise<AgentIdentity>
90
+ ```
91
+
92
+ ---
93
+
94
+ ### `listAgents`
95
+
96
+ List all agents for the authenticated tenant.
97
+
98
+ ```typescript
99
+ listAgents(): Promise<AgentIdentity[]>
100
+ ```
101
+
102
+ ---
103
+
104
+ ### `signTransaction`
105
+
106
+ Submit a transaction for policy evaluation and signing.
107
+
108
+ ```typescript
109
+ signTransaction(agentId: string, tx: SignTransactionInput): Promise<SignTransactionResult>
110
+ ```
111
+
112
+ #### `SignTransactionInput`
113
+
114
+ | Field | Type | Required | Description |
115
+ |-------|------|----------|-------------|
116
+ | `to` | `string` | ✅ | Destination address |
117
+ | `value` | `string` | ✅ | Value in wei (as string to avoid BigInt issues) |
118
+ | `data` | `string` | — | Hex-encoded calldata |
119
+ | `chainId` | `number` | — | EVM chain ID (defaults to the server's configured chain) |
120
+
121
+ #### `SignTransactionResult`
122
+
123
+ The return type is a discriminated union:
124
+
125
+ ```typescript
126
+ type SignTransactionResult =
127
+ | { txHash: string } // signed and broadcast
128
+ | { status: 'pending_approval'; results: PolicyResult[] } // queued
129
+ ```
130
+
131
+ ```typescript
132
+ const result = await steward.signTransaction('scout-1', {
133
+ to: '0xDEX...',
134
+ value: '50000000000000000', // 0.05 ETH
135
+ chainId: 8453,
136
+ });
137
+
138
+ if ('txHash' in result) {
139
+ // Transaction was auto-approved and broadcast
140
+ console.log('tx:', result.txHash);
141
+ } else {
142
+ // Value exceeded auto-approve threshold — needs human sign-off
143
+ console.log('queued, policy results:', result.results);
144
+ }
145
+ ```
146
+
147
+ **Throws:** [`StewardApiError`](#stearderAPIerror) with status `400` if a hard policy rejects the transaction. `error.data.results` contains per-policy details.
148
+
149
+ ---
150
+
151
+ ### `signMessage`
152
+
153
+ Sign an arbitrary message (EIP-191 personal sign) with the agent's key.
154
+
155
+ ```typescript
156
+ signMessage(agentId: string, message: string): Promise<SignMessageResult>
157
+ ```
158
+
159
+ ```typescript
160
+ const { signature } = await steward.signMessage('scout-1', 'Hello Steward');
161
+ ```
162
+
163
+ ---
164
+
165
+ ### `getPolicies`
166
+
167
+ Retrieve the current policy rules for an agent.
168
+
169
+ ```typescript
170
+ getPolicies(agentId: string): Promise<PolicyRule[]>
171
+ ```
172
+
173
+ ---
174
+
175
+ ### `setPolicies`
176
+
177
+ Replace the full policy set for an agent (PUT semantics — replaces all existing policies).
178
+
179
+ ```typescript
180
+ setPolicies(agentId: string, policies: PolicyRule[]): Promise<void>
181
+ ```
182
+
183
+ ```typescript
184
+ await steward.setPolicies('scout-1', [
185
+ {
186
+ id: 'daily-cap',
187
+ type: 'spending-limit',
188
+ enabled: true,
189
+ config: {
190
+ maxPerTx: '100000000000000000', // 0.1 ETH
191
+ maxPerDay: '500000000000000000', // 0.5 ETH
192
+ maxPerWeek: '2000000000000000000', // 2 ETH
193
+ },
194
+ },
195
+ {
196
+ id: 'whitelist',
197
+ type: 'approved-addresses',
198
+ enabled: true,
199
+ config: {
200
+ mode: 'whitelist',
201
+ addresses: [
202
+ '0xUniswapRouter...',
203
+ '0xAavePool...',
204
+ ],
205
+ },
206
+ },
207
+ {
208
+ id: 'hours',
209
+ type: 'time-window',
210
+ enabled: true,
211
+ config: {
212
+ allowedHours: [{ start: 9, end: 17 }], // 09:00–17:00 UTC
213
+ allowedDays: [1, 2, 3, 4, 5], // Mon–Fri
214
+ },
215
+ },
216
+ {
217
+ id: 'rate',
218
+ type: 'rate-limit',
219
+ enabled: true,
220
+ config: {
221
+ maxTxPerHour: 10,
222
+ maxTxPerDay: 50,
223
+ },
224
+ },
225
+ {
226
+ id: 'auto',
227
+ type: 'auto-approve-threshold',
228
+ enabled: true,
229
+ config: {
230
+ threshold: '10000000000000000', // auto-sign below 0.01 ETH, queue above
231
+ },
232
+ },
233
+ ]);
234
+ ```
235
+
236
+ ---
237
+
238
+ ### `getHistory`
239
+
240
+ Retrieve signing history for an agent.
241
+
242
+ ```typescript
243
+ getHistory(agentId: string): Promise<StewardHistoryEntry[]>
244
+ ```
245
+
246
+ ```typescript
247
+ interface StewardHistoryEntry {
248
+ timestamp: number; // Unix ms
249
+ value: string; // wei
250
+ }
251
+ ```
252
+
253
+ ---
254
+
255
+ ## Types
256
+
257
+ ### `AgentIdentity`
258
+
259
+ ```typescript
260
+ interface AgentIdentity {
261
+ id: string;
262
+ tenantId: string;
263
+ name: string;
264
+ walletAddress: string; // checksummed EVM address
265
+ platformId?: string; // your external agent ID, if provided
266
+ erc8004TokenId?: string; // on-chain agent NFT ID, if registered
267
+ createdAt: Date;
268
+ }
269
+ ```
270
+
271
+ ### `PolicyRule`
272
+
273
+ ```typescript
274
+ interface PolicyRule {
275
+ id: string;
276
+ type: PolicyType;
277
+ enabled: boolean;
278
+ config: Record<string, unknown>; // see policy config types below
279
+ }
280
+
281
+ type PolicyType =
282
+ | 'spending-limit'
283
+ | 'approved-addresses'
284
+ | 'auto-approve-threshold'
285
+ | 'time-window'
286
+ | 'rate-limit';
287
+ ```
288
+
289
+ ### Policy Config Types
290
+
291
+ ```typescript
292
+ interface SpendingLimitConfig {
293
+ maxPerTx: string; // wei string
294
+ maxPerDay: string;
295
+ maxPerWeek: string;
296
+ }
297
+
298
+ interface ApprovedAddressesConfig {
299
+ addresses: string[];
300
+ mode: 'whitelist' | 'blacklist';
301
+ }
302
+
303
+ interface AutoApproveConfig {
304
+ threshold: string; // wei — transactions at or below this are auto-signed
305
+ }
306
+
307
+ interface TimeWindowConfig {
308
+ allowedHours: { start: number; end: number }[]; // UTC 24h
309
+ allowedDays: number[]; // 0 = Sunday … 6 = Saturday
310
+ }
311
+
312
+ interface RateLimitConfig {
313
+ maxTxPerHour: number;
314
+ maxTxPerDay: number;
315
+ }
316
+ ```
317
+
318
+ ### `PolicyResult`
319
+
320
+ Returned in rejection errors and pending-approval responses so you can see exactly which policy blocked or queued the transaction.
321
+
322
+ ```typescript
323
+ interface PolicyResult {
324
+ policyId: string;
325
+ type: PolicyType;
326
+ passed: boolean;
327
+ reason?: string; // human-readable explanation on failure
328
+ }
329
+ ```
330
+
331
+ ---
332
+
333
+ ## Error Handling
334
+
335
+ All methods throw `StewardApiError` on failure.
336
+
337
+ ```typescript
338
+ class StewardApiError<TData = unknown> extends Error {
339
+ readonly status: number; // HTTP status code (0 = network error)
340
+ readonly data?: TData; // parsed response body, if available
341
+ }
342
+ ```
343
+
344
+ ### Common Status Codes
345
+
346
+ | Status | Meaning |
347
+ |--------|---------|
348
+ | `0` | Network error / connection refused |
349
+ | `400` | Hard policy rejection — check `error.data.results` |
350
+ | `401` | Invalid or missing API key |
351
+ | `404` | Agent not found |
352
+ | `409` | Agent ID already exists |
353
+ | `500` | Server error |
354
+
355
+ ### Example
356
+
357
+ ```typescript
358
+ import { StewardClient, StewardApiError } from '@stwd/sdk';
359
+ import type { PolicyResult } from '@stwd/sdk';
360
+
361
+ try {
362
+ const result = await steward.signTransaction('agent-1', tx);
363
+ } catch (err) {
364
+ if (err instanceof StewardApiError) {
365
+ if (err.status === 400) {
366
+ const failed = (err.data as { results: PolicyResult[] })?.results
367
+ ?.filter(r => !r.passed);
368
+ console.error('Rejected by policies:', failed?.map(r => r.reason));
369
+ } else if (err.status === 0) {
370
+ console.error('Could not reach Steward API');
371
+ } else {
372
+ console.error(`API error ${err.status}:`, err.message);
373
+ }
374
+ }
375
+ }
376
+ ```
377
+
378
+ ---
379
+
380
+ ## Request Headers
381
+
382
+ The SDK sets these headers automatically:
383
+
384
+ | Header | Value |
385
+ |--------|-------|
386
+ | `Content-Type` | `application/json` |
387
+ | `Accept` | `application/json` |
388
+ | `X-Steward-Key` | Your `apiKey` |
389
+ | `X-Steward-Tenant` | Your `tenantId` |
390
+
391
+ ---
392
+
393
+ ## Policy Hard vs Soft Gates
394
+
395
+ Understanding how policies interact:
396
+
397
+ - **Hard policies** (`spending-limit`, `approved-addresses`, `rate-limit`, `time-window`) — any failure **rejects** the transaction immediately with HTTP 400
398
+ - **Soft policy** (`auto-approve-threshold`) — failure **queues** the transaction for manual approval (HTTP 202), but does not reject
399
+
400
+ This means you can set conservative limits that block dangerous transactions outright, while still letting moderately large (but in-policy) transactions go to a human reviewer rather than being auto-executed.
401
+
402
+ ---
403
+
404
+ ## License
405
+
406
+ MIT
@@ -0,0 +1,78 @@
1
+ import type { AgentBalance, AgentIdentity, PolicyResult, PolicyRule } from "./types";
2
+ export interface BatchAgentSpec {
3
+ id: string;
4
+ name: string;
5
+ platformId?: string;
6
+ }
7
+ export interface BatchCreateResult {
8
+ created: AgentIdentity[];
9
+ errors: Array<{
10
+ id: string;
11
+ error: string;
12
+ }>;
13
+ }
14
+ export type GetBalanceResult = AgentBalance;
15
+ export interface StewardClientConfig {
16
+ baseUrl: string;
17
+ apiKey?: string;
18
+ tenantId?: string;
19
+ }
20
+ export interface SignTransactionInput {
21
+ to: string;
22
+ value: string;
23
+ data?: string;
24
+ chainId?: number;
25
+ }
26
+ export interface StewardPendingApproval {
27
+ status: "pending_approval";
28
+ results: PolicyResult[];
29
+ }
30
+ export interface StewardHistoryEntry {
31
+ timestamp: number;
32
+ value: string;
33
+ }
34
+ export interface SignMessageResult {
35
+ signature: string;
36
+ }
37
+ export type CreateWalletResult = AgentIdentity;
38
+ export type GetHistoryResult = StewardHistoryEntry[];
39
+ export type SignTransactionResult = {
40
+ txHash: string;
41
+ } | StewardPendingApproval;
42
+ export type StewardErrorResponse = {
43
+ results?: PolicyResult[];
44
+ };
45
+ export declare class StewardApiError<TData = unknown> extends Error {
46
+ readonly status: number;
47
+ readonly data?: TData;
48
+ constructor(message: string, status: number, data?: TData);
49
+ }
50
+ export declare class StewardClient {
51
+ private readonly baseUrl;
52
+ private readonly apiKey?;
53
+ private readonly tenantId?;
54
+ constructor({ baseUrl, apiKey, tenantId }: StewardClientConfig);
55
+ createWallet(agentId: string, name: string, platformId?: string): Promise<CreateWalletResult>;
56
+ signTransaction(agentId: string, tx: SignTransactionInput): Promise<SignTransactionResult>;
57
+ getPolicies(agentId: string): Promise<PolicyRule[]>;
58
+ setPolicies(agentId: string, policies: PolicyRule[]): Promise<void>;
59
+ getAgent(agentId: string): Promise<AgentIdentity>;
60
+ listAgents(): Promise<AgentIdentity[]>;
61
+ getHistory(agentId: string): Promise<GetHistoryResult>;
62
+ signMessage(agentId: string, message: string): Promise<SignMessageResult>;
63
+ /**
64
+ * Get the on-chain native balance for an agent wallet.
65
+ * Optionally pass a chainId to query a specific network (defaults to the server's active chain).
66
+ */
67
+ getBalance(agentId: string, chainId?: number): Promise<GetBalanceResult>;
68
+ /**
69
+ * Create multiple agent wallets in a single request.
70
+ * Optionally supply a shared policy set to apply to every created agent.
71
+ */
72
+ createWalletBatch(agents: BatchAgentSpec[], policies?: PolicyRule[]): Promise<BatchCreateResult>;
73
+ private request;
74
+ private buildHeaders;
75
+ private parseJson;
76
+ private isPendingApproval;
77
+ }
78
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAe,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAElG,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UA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YAiBxF,OAAO;IAoCrB,OAAO,CAAC,YAAY;YAmBN,SAAS;IAcvB,OAAO,CAAC,iBAAiB;CAG1B"}
package/dist/client.js ADDED
@@ -0,0 +1,183 @@
1
+ function parseAgentIdentity(agent) {
2
+ return {
3
+ ...agent,
4
+ createdAt: new Date(agent.createdAt),
5
+ };
6
+ }
7
+ export class StewardApiError extends Error {
8
+ status;
9
+ data;
10
+ constructor(message, status, data) {
11
+ super(message);
12
+ this.name = "StewardApiError";
13
+ this.status = status;
14
+ this.data = data;
15
+ }
16
+ }
17
+ export class StewardClient {
18
+ baseUrl;
19
+ apiKey;
20
+ tenantId;
21
+ constructor({ baseUrl, apiKey, tenantId }) {
22
+ this.baseUrl = baseUrl.replace(/\/+$/, "");
23
+ this.apiKey = apiKey;
24
+ this.tenantId = tenantId;
25
+ }
26
+ async createWallet(agentId, name, platformId) {
27
+ const response = await this.request("/agents", {
28
+ method: "POST",
29
+ body: JSON.stringify({ id: agentId, name, platformId }),
30
+ });
31
+ if (!response.ok) {
32
+ throw new StewardApiError(response.error, response.status, response.data);
33
+ }
34
+ return parseAgentIdentity(response.data);
35
+ }
36
+ async signTransaction(agentId, tx) {
37
+ const response = await this.request(`/vault/${encodeURIComponent(agentId)}/sign`, {
38
+ method: "POST",
39
+ body: JSON.stringify(tx),
40
+ });
41
+ if (response.ok) {
42
+ return response.data;
43
+ }
44
+ if (response.status === 202 && this.isPendingApproval(response.data)) {
45
+ return response.data;
46
+ }
47
+ throw new StewardApiError(response.error, response.status, response.data);
48
+ }
49
+ async getPolicies(agentId) {
50
+ const response = await this.request(`/agents/${encodeURIComponent(agentId)}/policies`);
51
+ if (!response.ok) {
52
+ throw new StewardApiError(response.error, response.status, response.data);
53
+ }
54
+ return response.data;
55
+ }
56
+ async setPolicies(agentId, policies) {
57
+ const response = await this.request(`/agents/${encodeURIComponent(agentId)}/policies`, {
58
+ method: "PUT",
59
+ body: JSON.stringify(policies),
60
+ });
61
+ if (!response.ok) {
62
+ throw new StewardApiError(response.error, response.status, response.data);
63
+ }
64
+ }
65
+ async getAgent(agentId) {
66
+ const response = await this.request(`/agents/${encodeURIComponent(agentId)}`);
67
+ if (!response.ok) {
68
+ throw new StewardApiError(response.error, response.status, response.data);
69
+ }
70
+ return parseAgentIdentity(response.data);
71
+ }
72
+ async listAgents() {
73
+ const response = await this.request("/agents");
74
+ if (!response.ok) {
75
+ throw new StewardApiError(response.error, response.status, response.data);
76
+ }
77
+ return response.data.map(parseAgentIdentity);
78
+ }
79
+ async getHistory(agentId) {
80
+ const response = await this.request(`/vault/${encodeURIComponent(agentId)}/history`);
81
+ if (!response.ok) {
82
+ throw new StewardApiError(response.error, response.status, response.data);
83
+ }
84
+ return response.data;
85
+ }
86
+ async signMessage(agentId, message) {
87
+ const response = await this.request(`/vault/${encodeURIComponent(agentId)}/sign-message`, {
88
+ method: "POST",
89
+ body: JSON.stringify({ message }),
90
+ });
91
+ if (!response.ok) {
92
+ throw new StewardApiError(response.error, response.status, response.data);
93
+ }
94
+ return response.data;
95
+ }
96
+ /**
97
+ * Get the on-chain native balance for an agent wallet.
98
+ * Optionally pass a chainId to query a specific network (defaults to the server's active chain).
99
+ */
100
+ async getBalance(agentId, chainId) {
101
+ const params = chainId ? `?chainId=${chainId}` : "";
102
+ const response = await this.request(`/agents/${encodeURIComponent(agentId)}/balance${params}`);
103
+ if (!response.ok) {
104
+ throw new StewardApiError(response.error, response.status, response.data);
105
+ }
106
+ return response.data;
107
+ }
108
+ /**
109
+ * Create multiple agent wallets in a single request.
110
+ * Optionally supply a shared policy set to apply to every created agent.
111
+ */
112
+ async createWalletBatch(agents, policies) {
113
+ const response = await this.request("/agents/batch", {
114
+ method: "POST",
115
+ body: JSON.stringify({ agents, applyPolicies: policies }),
116
+ });
117
+ if (!response.ok) {
118
+ throw new StewardApiError(response.error, response.status, response.data);
119
+ }
120
+ const result = response.data;
121
+ return {
122
+ ...result,
123
+ created: result.created.map(parseAgentIdentity),
124
+ };
125
+ }
126
+ async request(path, init = {}) {
127
+ let response;
128
+ try {
129
+ response = await fetch(`${this.baseUrl}${path}`, {
130
+ ...init,
131
+ headers: this.buildHeaders(init.headers),
132
+ });
133
+ }
134
+ catch (error) {
135
+ throw new StewardApiError(error instanceof Error ? error.message : "Network request failed", 0);
136
+ }
137
+ const payload = await this.parseJson(response);
138
+ if (!payload.ok) {
139
+ return {
140
+ ok: false,
141
+ status: response.status,
142
+ error: payload.error ?? `Request failed with status ${response.status}`,
143
+ data: payload.data,
144
+ };
145
+ }
146
+ if (typeof payload.data === "undefined") {
147
+ return { ok: true, status: response.status, data: undefined };
148
+ }
149
+ return { ok: true, status: response.status, data: payload.data };
150
+ }
151
+ buildHeaders(headers) {
152
+ const merged = new Headers(headers);
153
+ if (!merged.has("Content-Type")) {
154
+ merged.set("Content-Type", "application/json");
155
+ }
156
+ if (!merged.has("Accept")) {
157
+ merged.set("Accept", "application/json");
158
+ }
159
+ if (this.apiKey) {
160
+ merged.set("X-Steward-Key", this.apiKey);
161
+ }
162
+ if (this.tenantId) {
163
+ merged.set("X-Steward-Tenant", this.tenantId);
164
+ }
165
+ return merged;
166
+ }
167
+ async parseJson(response) {
168
+ const text = await response.text();
169
+ if (!text) {
170
+ return { ok: response.ok };
171
+ }
172
+ try {
173
+ return JSON.parse(text);
174
+ }
175
+ catch {
176
+ throw new StewardApiError("Received invalid JSON from Steward API", response.status);
177
+ }
178
+ }
179
+ isPendingApproval(data) {
180
+ return typeof data !== "undefined" && "status" in data && data.status === "pending_approval";
181
+ }
182
+ }
183
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAmDA,SAAS,kBAAkB,CAAC,KAAoB;IAC9C,OAAO;QACL,GAAG,KAAK;QACR,SAAS,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;KACrC,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,eAAiC,SAAQ,KAAK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;IACH,CAAC;IAEO,iBAAiB,CAAC,IAA+D;QACvF,OAAO,OAAO,IAAI,KAAK,WAAW,IAAI,QAAQ,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,kBAAkB,CAAC;IAC/F,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ export { StewardClient, StewardApiError } from "./client";
2
+ export type { BatchAgentSpec, BatchCreateResult, CreateWalletResult, GetBalanceResult, GetHistoryResult, SignMessageResult, SignTransactionInput, SignTransactionResult, StewardClientConfig, StewardErrorResponse, StewardHistoryEntry, StewardPendingApproval, } from "./client";
3
+ export type { AgentBalance, AgentIdentity, ApiResponse, ApprovedAddressesConfig, AutoApproveConfig, PolicyResult, PolicyRule, PolicyType, RateLimitConfig, SpendingLimitConfig, TimeWindowConfig, } from "./types";
4
+ export { SUPPORTED_CHAINS } from "./types";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC1D,YAAY,EACV,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { StewardClient, StewardApiError } from "./client";
2
+ export { SUPPORTED_CHAINS } from "./types";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AA4B1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,67 @@
1
+ export interface AgentIdentity {
2
+ id: string;
3
+ tenantId: string;
4
+ name: string;
5
+ walletAddress: string;
6
+ erc8004TokenId?: string;
7
+ platformId?: string;
8
+ createdAt: Date;
9
+ }
10
+ export type PolicyType = "spending-limit" | "approved-addresses" | "auto-approve-threshold" | "time-window" | "rate-limit";
11
+ export interface PolicyRule {
12
+ id: string;
13
+ type: PolicyType;
14
+ enabled: boolean;
15
+ config: Record<string, unknown>;
16
+ }
17
+ export interface PolicyResult {
18
+ policyId: string;
19
+ type: PolicyType;
20
+ passed: boolean;
21
+ reason?: string;
22
+ }
23
+ export interface ApiResponse<T = unknown> {
24
+ ok: boolean;
25
+ data?: T;
26
+ error?: string;
27
+ }
28
+ export interface AgentBalance {
29
+ agentId: string;
30
+ walletAddress: string;
31
+ balances: {
32
+ native: string;
33
+ nativeFormatted: string;
34
+ chainId: number;
35
+ symbol: string;
36
+ };
37
+ }
38
+ export interface SpendingLimitConfig {
39
+ maxPerTx: string;
40
+ maxPerDay: string;
41
+ maxPerWeek: string;
42
+ }
43
+ export interface ApprovedAddressesConfig {
44
+ addresses: string[];
45
+ mode: "whitelist" | "blacklist";
46
+ }
47
+ export interface AutoApproveConfig {
48
+ threshold: string;
49
+ }
50
+ export interface TimeWindowConfig {
51
+ allowedHours: {
52
+ start: number;
53
+ end: number;
54
+ }[];
55
+ allowedDays: number[];
56
+ }
57
+ export interface RateLimitConfig {
58
+ maxTxPerHour: number;
59
+ maxTxPerDay: number;
60
+ }
61
+ export declare const SUPPORTED_CHAINS: {
62
+ readonly base: 8453;
63
+ readonly baseSepolia: 84532;
64
+ readonly bsc: 56;
65
+ readonly bscTestnet: 97;
66
+ };
67
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,MAAM,UAAU,GAClB,gBAAgB,GAChB,oBAAoB,GACpB,wBAAwB,GACxB,aAAa,GACb,YAAY,CAAC;AAEjB,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACtC,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM,CAAC;QACf,eAAe,EAAE,MAAM,CAAC;QACxB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,EAAE,WAAW,GAAG,WAAW,CAAC;CACjC;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/C,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,gBAAgB;;;;;CAKnB,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,9 @@
1
+ // Standalone type definitions for the published SDK
2
+ // These mirror @stwd/shared but are bundled here for npm distribution
3
+ export const SUPPORTED_CHAINS = {
4
+ base: 8453,
5
+ baseSepolia: 84532,
6
+ bsc: 56,
7
+ bscTestnet: 97,
8
+ };
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,sEAAsE;AA2EtE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,IAAI;IACV,WAAW,EAAE,KAAK;IAClB,GAAG,EAAE,EAAE;IACP,UAAU,EAAE,EAAE;CACN,CAAC"}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@stwd/sdk",
3
+ "version": "0.1.0",
4
+ "description": "TypeScript SDK for Steward — agent wallet infrastructure with policy enforcement",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "prepublishOnly": "npm run build"
21
+ },
22
+ "keywords": [
23
+ "steward",
24
+ "agent",
25
+ "wallet",
26
+ "policy",
27
+ "ethereum",
28
+ "base",
29
+ "web3",
30
+ "ai-agent",
31
+ "sdk"
32
+ ],
33
+ "author": "0xSolace",
34
+ "license": "MIT",
35
+ "homepage": "https://steward.fi",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/0xSolace/steward"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ }
43
+ }