valta-sdk 2.1.0 → 2.1.2
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 +176 -98
- package/dist/chunk-LBY67QV7.js +244 -0
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,158 +1,236 @@
|
|
|
1
|
-
#
|
|
1
|
+
# valta-sdk
|
|
2
2
|
|
|
3
|
-
Official TypeScript SDK for [Valta](https://valta.co)
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
3
|
+
Official JavaScript/TypeScript SDK for [Valta](https://valta.co) — AI agent financial infrastructure.
|
|
6
4
|
|
|
5
|
+
Give your AI agents their own wallets, spending policies, kill switches, and audit logs.
|
|
7
6
|
```bash
|
|
8
7
|
npm install valta-sdk
|
|
9
8
|
```
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
---
|
|
12
11
|
|
|
12
|
+
## Quick Start
|
|
13
13
|
```typescript
|
|
14
|
-
import
|
|
14
|
+
import Valta from 'valta-sdk';
|
|
15
15
|
|
|
16
|
-
const valta = new Valta(
|
|
17
|
-
|
|
16
|
+
const valta = new Valta('vk_live_your_api_key');
|
|
17
|
+
|
|
18
|
+
// Create an agent
|
|
19
|
+
const agent = await valta.agents.create({
|
|
20
|
+
name: 'My Trading Agent',
|
|
21
|
+
type: 'trading',
|
|
18
22
|
});
|
|
19
23
|
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
agentId:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
// Assign a spend policy
|
|
25
|
+
await valta.policies.create({
|
|
26
|
+
agentId: agent.id,
|
|
27
|
+
name: 'Daily limit',
|
|
28
|
+
maxSpendPerDay: 500,
|
|
29
|
+
currency: 'USDC',
|
|
26
30
|
});
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
console.log("Pending human approval:", result.request_id);
|
|
32
|
-
} else {
|
|
33
|
-
console.log("Denied:", result.reason);
|
|
34
|
-
}
|
|
35
|
-
```
|
|
32
|
+
// Check wallet balance
|
|
33
|
+
const wallet = await valta.wallets.get(agent.id);
|
|
34
|
+
console.log(wallet.balance); // { usdc: '245.00' }
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
// Freeze agent instantly
|
|
37
|
+
await valta.agents.freeze(agent.id);
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
- **Kill Switch** - Instantly freeze agent spending
|
|
43
|
-
- **Agent Tools** - Configure and execute agent tools
|
|
44
|
-
- **Agent Chains** - Create agent-to-agent workflows
|
|
45
|
-
- **Balance Queries** - Check wallet balance programmatically
|
|
39
|
+
// Pull immutable audit log
|
|
40
|
+
const logs = await valta.audit.list({ agentId: agent.id });
|
|
41
|
+
```
|
|
46
42
|
|
|
47
|
-
|
|
43
|
+
---
|
|
48
44
|
|
|
49
|
-
|
|
45
|
+
## Get an API Key
|
|
50
46
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
**Option 1 — Dashboard:**
|
|
48
|
+
1. Go to [valta.co/dashboard](https://valta.co/dashboard)
|
|
49
|
+
2. Navigate to API Keys
|
|
50
|
+
3. Click Generate Key
|
|
51
|
+
|
|
52
|
+
**Option 2 — CLI (no dashboard needed):**
|
|
53
|
+
```bash
|
|
54
|
+
npx valta-sdk login
|
|
56
55
|
```
|
|
57
56
|
|
|
58
|
-
|
|
57
|
+
---
|
|
59
58
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
## CLI
|
|
60
|
+
|
|
61
|
+
The SDK ships with a terminal CLI. Use Valta entirely without a browser.
|
|
62
|
+
```bash
|
|
63
|
+
# Authenticate
|
|
64
|
+
valta login
|
|
65
|
+
|
|
66
|
+
# List your agents
|
|
67
|
+
valta agents list
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
# Freeze an agent
|
|
70
|
+
valta agents freeze ag_abc123
|
|
71
|
+
|
|
72
|
+
# Log out
|
|
73
|
+
valta logout
|
|
71
74
|
```
|
|
72
75
|
|
|
73
|
-
|
|
76
|
+
---
|
|
74
77
|
|
|
78
|
+
## Agents
|
|
75
79
|
```typescript
|
|
76
|
-
//
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
// List all agents
|
|
81
|
+
const { agents } = await valta.agents.list();
|
|
82
|
+
|
|
83
|
+
// Get one agent
|
|
84
|
+
const agent = await valta.agents.get('ag_abc123');
|
|
85
|
+
|
|
86
|
+
// Create an agent
|
|
87
|
+
const agent = await valta.agents.create({
|
|
88
|
+
name: 'Portfolio Watcher',
|
|
89
|
+
type: 'analytics',
|
|
85
90
|
});
|
|
86
91
|
|
|
87
|
-
//
|
|
88
|
-
|
|
92
|
+
// Freeze an agent (stops all spending)
|
|
93
|
+
await valta.agents.freeze('ag_abc123');
|
|
94
|
+
|
|
95
|
+
// Unfreeze
|
|
96
|
+
await valta.agents.unfreeze('ag_abc123');
|
|
97
|
+
|
|
98
|
+
// Delete
|
|
99
|
+
await valta.agents.delete('ag_abc123');
|
|
89
100
|
```
|
|
90
101
|
|
|
91
|
-
|
|
102
|
+
---
|
|
92
103
|
|
|
104
|
+
## Wallets
|
|
93
105
|
```typescript
|
|
94
|
-
// Get
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
await valta.
|
|
106
|
+
// Get wallet balance
|
|
107
|
+
const wallet = await valta.wallets.get('ag_abc123');
|
|
108
|
+
// { usdc: '500.00', usdcPending: '0.00' }
|
|
109
|
+
|
|
110
|
+
// Transfer funds between agents
|
|
111
|
+
await valta.wallets.transfer('ag_abc123', {
|
|
112
|
+
toAgentId: 'ag_def456',
|
|
113
|
+
amount: '100.00',
|
|
114
|
+
currency: 'USDC',
|
|
115
|
+
note: 'Fund allocation',
|
|
116
|
+
});
|
|
100
117
|
```
|
|
101
118
|
|
|
102
|
-
|
|
119
|
+
---
|
|
103
120
|
|
|
121
|
+
## Policies
|
|
104
122
|
```typescript
|
|
105
|
-
//
|
|
106
|
-
await valta.
|
|
123
|
+
// Create a spend policy
|
|
124
|
+
await valta.policies.create({
|
|
125
|
+
agentId: 'ag_abc123',
|
|
126
|
+
name: 'Conservative limit',
|
|
127
|
+
maxSpendPerDay: 200,
|
|
128
|
+
maxSpendPerTransaction: 50,
|
|
129
|
+
currency: 'USDC',
|
|
130
|
+
});
|
|
107
131
|
|
|
108
|
-
//
|
|
109
|
-
await valta.
|
|
132
|
+
// List policies for an agent
|
|
133
|
+
const policies = await valta.policies.list('ag_abc123');
|
|
134
|
+
|
|
135
|
+
// Update a policy
|
|
136
|
+
await valta.policies.update('pol_xyz', {
|
|
137
|
+
maxSpendPerDay: 500,
|
|
138
|
+
});
|
|
110
139
|
```
|
|
111
140
|
|
|
112
|
-
|
|
141
|
+
---
|
|
113
142
|
|
|
143
|
+
## Audit Logs
|
|
114
144
|
```typescript
|
|
115
|
-
// Get
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
145
|
+
// Get full audit trail for an agent
|
|
146
|
+
const { logs } = await valta.audit.list({
|
|
147
|
+
agentId: 'ag_abc123',
|
|
148
|
+
limit: 50,
|
|
149
|
+
});
|
|
120
150
|
|
|
121
|
-
//
|
|
122
|
-
|
|
151
|
+
// Each log entry is immutable and hash-chained
|
|
152
|
+
console.log(logs[0]);
|
|
153
|
+
// {
|
|
154
|
+
// id: 'log_001',
|
|
155
|
+
// action: 'transfer',
|
|
156
|
+
// amount: '100.00',
|
|
157
|
+
// hash: '0xabc...',
|
|
158
|
+
// previousHash: '0xdef...',
|
|
159
|
+
// createdAt: '2026-03-21T...'
|
|
160
|
+
// }
|
|
123
161
|
```
|
|
124
162
|
|
|
125
|
-
|
|
163
|
+
---
|
|
126
164
|
|
|
165
|
+
## API Keys
|
|
127
166
|
```typescript
|
|
128
|
-
//
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
{ order: 3, agent_id: "report", agent_name: "Report Agent", action: "generate_report", input_from: "previous" },
|
|
135
|
-
],
|
|
136
|
-
});
|
|
167
|
+
// List your API keys
|
|
168
|
+
const keys = await valta.keys.list();
|
|
169
|
+
|
|
170
|
+
// Create a new key
|
|
171
|
+
const { key } = await valta.keys.create('production');
|
|
172
|
+
console.log(key); // shown once — save it now
|
|
137
173
|
|
|
138
|
-
//
|
|
139
|
-
await valta.
|
|
174
|
+
// Revoke a key
|
|
175
|
+
await valta.keys.revoke('key_abc123');
|
|
140
176
|
```
|
|
141
177
|
|
|
178
|
+
---
|
|
179
|
+
|
|
142
180
|
## Error Handling
|
|
143
181
|
|
|
182
|
+
The SDK throws typed errors so you always know what went wrong.
|
|
144
183
|
```typescript
|
|
145
|
-
import {
|
|
184
|
+
import Valta, { AuthError, TierError, RateLimitError } from 'valta-sdk';
|
|
146
185
|
|
|
147
186
|
try {
|
|
148
|
-
await valta.
|
|
149
|
-
} catch (
|
|
150
|
-
if (
|
|
151
|
-
console.
|
|
187
|
+
await valta.agents.create({ name: 'Agent', type: 'trading' });
|
|
188
|
+
} catch (err) {
|
|
189
|
+
if (err instanceof TierError) {
|
|
190
|
+
console.log(`Upgrade required: ${err.requiredTier}`);
|
|
191
|
+
console.log(`Upgrade at: ${err.upgradeUrl}`);
|
|
192
|
+
} else if (err instanceof AuthError) {
|
|
193
|
+
console.log('Invalid API key');
|
|
194
|
+
} else if (err instanceof RateLimitError) {
|
|
195
|
+
console.log('Slow down — rate limit hit');
|
|
152
196
|
}
|
|
153
197
|
}
|
|
154
198
|
```
|
|
155
199
|
|
|
200
|
+
| Error | Status | When |
|
|
201
|
+
|---|---|---|
|
|
202
|
+
| `AuthError` | 401 | Invalid or missing API key |
|
|
203
|
+
| `TierError` | 403 | Feature requires a higher tier |
|
|
204
|
+
| `RateLimitError` | 429 | Too many requests |
|
|
205
|
+
| `NotFoundError` | 404 | Agent/resource not found |
|
|
206
|
+
| `ValtaError` | 5xx | Server error |
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Tier Limits
|
|
211
|
+
|
|
212
|
+
| Feature | Free | Builder | Startup | Enterprise |
|
|
213
|
+
|---|---|---|---|---|
|
|
214
|
+
| Agent wallets | 1 | 10 | Unlimited | Unlimited |
|
|
215
|
+
| Policies | 1 | Unlimited | Unlimited | Unlimited |
|
|
216
|
+
| API calls/day | 100 | 1,000 | Unlimited | Unlimited |
|
|
217
|
+
| Audit export | ✗ | ✗ | ✓ | ✓ |
|
|
218
|
+
| Team members | 1 | 1 | 5 | Unlimited |
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## TypeScript
|
|
223
|
+
|
|
224
|
+
The SDK is written in TypeScript. All types are included — no `@types` package needed.
|
|
225
|
+
```typescript
|
|
226
|
+
import Valta, { Agent, Policy, WalletBalance } from 'valta-sdk';
|
|
227
|
+
|
|
228
|
+
const agent: Agent = await valta.agents.get('ag_abc123');
|
|
229
|
+
const wallet: WalletBalance = await valta.wallets.get(agent.id);
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
156
234
|
## License
|
|
157
235
|
|
|
158
|
-
MIT
|
|
236
|
+
MIT — built by [Valta](https://valta.co)
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
// src/errors/index.ts
|
|
2
|
+
var ValtaError = class extends Error {
|
|
3
|
+
constructor(message, code, status) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "ValtaError";
|
|
6
|
+
this.code = code;
|
|
7
|
+
this.status = status;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var AuthError = class extends ValtaError {
|
|
11
|
+
constructor(message = "Invalid or missing API key") {
|
|
12
|
+
super(message, "UNAUTHORIZED", 401);
|
|
13
|
+
this.name = "AuthError";
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var TierError = class extends ValtaError {
|
|
17
|
+
constructor(message, requiredTier) {
|
|
18
|
+
super(message, "TIER_LIMIT", 403);
|
|
19
|
+
this.name = "TierError";
|
|
20
|
+
this.requiredTier = requiredTier;
|
|
21
|
+
this.upgradeUrl = "https://valta.co/upgrade";
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var RateLimitError = class extends ValtaError {
|
|
25
|
+
constructor(message = "Rate limit exceeded. Slow down your requests.") {
|
|
26
|
+
super(message, "RATE_LIMIT", 429);
|
|
27
|
+
this.name = "RateLimitError";
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var NotFoundError = class extends ValtaError {
|
|
31
|
+
constructor(resource) {
|
|
32
|
+
super(`${resource} not found`, "NOT_FOUND", 404);
|
|
33
|
+
this.name = "NotFoundError";
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/http/requester.ts
|
|
38
|
+
var DEFAULT_BASE_URL = "https://valta.co/api/v1";
|
|
39
|
+
var Requester = class {
|
|
40
|
+
constructor(apiKey, baseUrl) {
|
|
41
|
+
if (!apiKey || typeof apiKey !== "string") {
|
|
42
|
+
throw new AuthError("An API key is required. Get one at https://valta.co/dashboard/api-keys");
|
|
43
|
+
}
|
|
44
|
+
this.apiKey = apiKey;
|
|
45
|
+
this.baseUrl = baseUrl ?? DEFAULT_BASE_URL;
|
|
46
|
+
}
|
|
47
|
+
async request(path, options = {}) {
|
|
48
|
+
const { method = "GET", body } = options;
|
|
49
|
+
const res = await fetch(`${this.baseUrl}${path}`, {
|
|
50
|
+
method,
|
|
51
|
+
headers: {
|
|
52
|
+
"x-api-key": this.apiKey,
|
|
53
|
+
"Content-Type": "application/json",
|
|
54
|
+
"X-Valta-SDK": "0.2.0"
|
|
55
|
+
},
|
|
56
|
+
body: body ? JSON.stringify(body) : void 0
|
|
57
|
+
});
|
|
58
|
+
if (!res.ok) {
|
|
59
|
+
let errorData = {};
|
|
60
|
+
try {
|
|
61
|
+
errorData = await res.json();
|
|
62
|
+
} catch {
|
|
63
|
+
}
|
|
64
|
+
const message = errorData.message ?? "An unknown error occurred";
|
|
65
|
+
switch (res.status) {
|
|
66
|
+
case 401:
|
|
67
|
+
throw new AuthError(message);
|
|
68
|
+
case 403:
|
|
69
|
+
throw new TierError(message, errorData.requiredTier ?? "builder");
|
|
70
|
+
case 404:
|
|
71
|
+
throw new NotFoundError(path);
|
|
72
|
+
case 429:
|
|
73
|
+
throw new RateLimitError(message);
|
|
74
|
+
default:
|
|
75
|
+
throw new ValtaError(message, "SERVER_ERROR", res.status);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return res.json();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// src/resources/agents.ts
|
|
83
|
+
var AgentsResource = class {
|
|
84
|
+
constructor(requester) {
|
|
85
|
+
this.requester = requester;
|
|
86
|
+
}
|
|
87
|
+
// Get all agents
|
|
88
|
+
async list(params = {}) {
|
|
89
|
+
const query = new URLSearchParams();
|
|
90
|
+
if (params.limit) query.set("limit", String(params.limit));
|
|
91
|
+
if (params.offset) query.set("offset", String(params.offset));
|
|
92
|
+
if (params.status) query.set("status", params.status);
|
|
93
|
+
const qs = query.toString();
|
|
94
|
+
return this.requester.request(
|
|
95
|
+
`/agents${qs ? `?${qs}` : ""}`
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
// Get one agent by ID
|
|
99
|
+
async get(agentId) {
|
|
100
|
+
return this.requester.request(`/agents/${agentId}`);
|
|
101
|
+
}
|
|
102
|
+
// Create a new agent
|
|
103
|
+
async create(params) {
|
|
104
|
+
return this.requester.request("/agents", {
|
|
105
|
+
method: "POST",
|
|
106
|
+
body: params
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
// Update an agent
|
|
110
|
+
async update(agentId, params) {
|
|
111
|
+
return this.requester.request(`/agents/${agentId}`, {
|
|
112
|
+
method: "PATCH",
|
|
113
|
+
body: params
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
// Freeze an agent (stops it from spending)
|
|
117
|
+
async freeze(agentId) {
|
|
118
|
+
return this.requester.request(`/agents/${agentId}/freeze`, {
|
|
119
|
+
method: "POST"
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
// Unfreeze an agent
|
|
123
|
+
async unfreeze(agentId) {
|
|
124
|
+
return this.requester.request(`/agents/${agentId}/unfreeze`, {
|
|
125
|
+
method: "POST"
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
// Delete an agent
|
|
129
|
+
async delete(agentId) {
|
|
130
|
+
return this.requester.request(
|
|
131
|
+
`/agents/${agentId}`,
|
|
132
|
+
{ method: "DELETE" }
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// src/resources/wallets.ts
|
|
138
|
+
var WalletsResource = class {
|
|
139
|
+
constructor(requester) {
|
|
140
|
+
this.requester = requester;
|
|
141
|
+
}
|
|
142
|
+
// Get wallet balance for an agent
|
|
143
|
+
async get(agentId) {
|
|
144
|
+
return this.requester.request(
|
|
145
|
+
`/agents/${agentId}/wallet`
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
// Transfer funds from one agent wallet to another
|
|
149
|
+
async transfer(agentId, params) {
|
|
150
|
+
return this.requester.request(
|
|
151
|
+
`/agents/${agentId}/wallet/transfer`,
|
|
152
|
+
{ method: "POST", body: params }
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// src/resources/policies.ts
|
|
158
|
+
var PoliciesResource = class {
|
|
159
|
+
constructor(requester) {
|
|
160
|
+
this.requester = requester;
|
|
161
|
+
}
|
|
162
|
+
async list(agentId) {
|
|
163
|
+
const qs = agentId ? `?agentId=${agentId}` : "";
|
|
164
|
+
return this.requester.request(`/policies${qs}`);
|
|
165
|
+
}
|
|
166
|
+
async create(params) {
|
|
167
|
+
return this.requester.request("/policies", {
|
|
168
|
+
method: "POST",
|
|
169
|
+
body: params
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
async update(policyId, params) {
|
|
173
|
+
return this.requester.request(`/policies/${policyId}`, {
|
|
174
|
+
method: "PATCH",
|
|
175
|
+
body: params
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
async delete(policyId) {
|
|
179
|
+
return this.requester.request(`/policies/${policyId}`, {
|
|
180
|
+
method: "DELETE"
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// src/resources/audit.ts
|
|
186
|
+
var AuditResource = class {
|
|
187
|
+
constructor(requester) {
|
|
188
|
+
this.requester = requester;
|
|
189
|
+
}
|
|
190
|
+
async list(params = {}) {
|
|
191
|
+
const query = new URLSearchParams();
|
|
192
|
+
if (params.agentId) query.set("agentId", params.agentId);
|
|
193
|
+
if (params.limit) query.set("limit", String(params.limit));
|
|
194
|
+
if (params.offset) query.set("offset", String(params.offset));
|
|
195
|
+
if (params.from) query.set("from", params.from);
|
|
196
|
+
if (params.to) query.set("to", params.to);
|
|
197
|
+
const qs = query.toString();
|
|
198
|
+
return this.requester.request(`/audit${qs ? `?${qs}` : ""}`);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
// src/resources/keys.ts
|
|
203
|
+
var KeysResource = class {
|
|
204
|
+
constructor(requester) {
|
|
205
|
+
this.requester = requester;
|
|
206
|
+
}
|
|
207
|
+
async list() {
|
|
208
|
+
return this.requester.request("/keys");
|
|
209
|
+
}
|
|
210
|
+
async create(name) {
|
|
211
|
+
return this.requester.request("/keys", {
|
|
212
|
+
method: "POST",
|
|
213
|
+
body: { name }
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
async revoke(keyId) {
|
|
217
|
+
return this.requester.request(`/keys/${keyId}`, {
|
|
218
|
+
method: "DELETE"
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// src/client.ts
|
|
224
|
+
var ValtaClient = class {
|
|
225
|
+
constructor(config) {
|
|
226
|
+
const apiKey = typeof config === "string" ? config : config.apiKey;
|
|
227
|
+
const baseUrl = typeof config === "object" ? config.baseUrl : void 0;
|
|
228
|
+
const requester = new Requester(apiKey, baseUrl);
|
|
229
|
+
this.agents = new AgentsResource(requester);
|
|
230
|
+
this.wallets = new WalletsResource(requester);
|
|
231
|
+
this.policies = new PoliciesResource(requester);
|
|
232
|
+
this.audit = new AuditResource(requester);
|
|
233
|
+
this.keys = new KeysResource(requester);
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
export {
|
|
238
|
+
ValtaError,
|
|
239
|
+
AuthError,
|
|
240
|
+
TierError,
|
|
241
|
+
RateLimitError,
|
|
242
|
+
NotFoundError,
|
|
243
|
+
ValtaClient
|
|
244
|
+
};
|
package/dist/cli/index.cjs
CHANGED
|
@@ -101,7 +101,7 @@ var Requester = class {
|
|
|
101
101
|
const res = await fetch(`${this.baseUrl}${path}`, {
|
|
102
102
|
method,
|
|
103
103
|
headers: {
|
|
104
|
-
"
|
|
104
|
+
"x-api-key": this.apiKey,
|
|
105
105
|
"Content-Type": "application/json",
|
|
106
106
|
"X-Valta-SDK": "0.2.0"
|
|
107
107
|
},
|
package/dist/cli/index.js
CHANGED
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valta-sdk",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "Official SDK for Valta — AI agent financial infrastructure",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
|
+
|
|
9
10
|
".": {
|
|
10
11
|
"types": "./dist/index.d.ts",
|
|
11
12
|
"import": "./dist/index.mjs",
|