@sardis/sdk 0.2.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/CHANGELOG.md +47 -0
- package/LICENSE +21 -0
- package/README.md +439 -0
- package/dist/browser/index.js +7049 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/sardis.umd.js +7071 -0
- package/dist/browser/sardis.umd.js.map +1 -0
- package/dist/cjs/client.js +644 -0
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/demo.js +699 -0
- package/dist/cjs/demo.js.map +1 -0
- package/dist/cjs/errors.js +630 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/index.js +131 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/integrations/index.js +21 -0
- package/dist/cjs/integrations/index.js.map +1 -0
- package/dist/cjs/integrations/langchain.js +339 -0
- package/dist/cjs/integrations/langchain.js.map +1 -0
- package/dist/cjs/integrations/openai.js +505 -0
- package/dist/cjs/integrations/openai.js.map +1 -0
- package/dist/cjs/integrations/vercel-ai.js +198 -0
- package/dist/cjs/integrations/vercel-ai.js.map +1 -0
- package/dist/cjs/resources/a2a.js +158 -0
- package/dist/cjs/resources/a2a.js.map +1 -0
- package/dist/cjs/resources/agents.js +142 -0
- package/dist/cjs/resources/agents.js.map +1 -0
- package/dist/cjs/resources/base.js +124 -0
- package/dist/cjs/resources/base.js.map +1 -0
- package/dist/cjs/resources/cards.js +43 -0
- package/dist/cjs/resources/cards.js.map +1 -0
- package/dist/cjs/resources/holds.js +64 -0
- package/dist/cjs/resources/holds.js.map +1 -0
- package/dist/cjs/resources/index.js +31 -0
- package/dist/cjs/resources/index.js.map +1 -0
- package/dist/cjs/resources/ledger.js +43 -0
- package/dist/cjs/resources/ledger.js.map +1 -0
- package/dist/cjs/resources/marketplace.js +88 -0
- package/dist/cjs/resources/marketplace.js.map +1 -0
- package/dist/cjs/resources/payments.js +33 -0
- package/dist/cjs/resources/payments.js.map +1 -0
- package/dist/cjs/resources/policies.js +31 -0
- package/dist/cjs/resources/policies.js.map +1 -0
- package/dist/cjs/resources/transactions.js +37 -0
- package/dist/cjs/resources/transactions.js.map +1 -0
- package/dist/cjs/resources/ucp.js +133 -0
- package/dist/cjs/resources/ucp.js.map +1 -0
- package/dist/cjs/resources/wallets.js +109 -0
- package/dist/cjs/resources/wallets.js.map +1 -0
- package/dist/cjs/resources/webhooks.js +81 -0
- package/dist/cjs/resources/webhooks.js.map +1 -0
- package/dist/cjs/types.js +11 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/client.d.ts +419 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +637 -0
- package/dist/client.js.map +1 -0
- package/dist/demo.d.ts +335 -0
- package/dist/demo.d.ts.map +1 -0
- package/dist/demo.js +694 -0
- package/dist/demo.js.map +1 -0
- package/dist/errors.d.ts +522 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +612 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +85 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/index.d.ts +4 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/integrations/index.js +5 -0
- package/dist/integrations/index.js.map +1 -0
- package/dist/integrations/langchain.d.ts +68 -0
- package/dist/integrations/langchain.d.ts.map +1 -0
- package/dist/integrations/langchain.js +335 -0
- package/dist/integrations/langchain.js.map +1 -0
- package/dist/integrations/openai.d.ts +97 -0
- package/dist/integrations/openai.d.ts.map +1 -0
- package/dist/integrations/openai.js +467 -0
- package/dist/integrations/openai.js.map +1 -0
- package/dist/integrations/vercel-ai.d.ts +180 -0
- package/dist/integrations/vercel-ai.d.ts.map +1 -0
- package/dist/integrations/vercel-ai.js +194 -0
- package/dist/integrations/vercel-ai.js.map +1 -0
- package/dist/resources/a2a.d.ts +254 -0
- package/dist/resources/a2a.d.ts.map +1 -0
- package/dist/resources/a2a.js +154 -0
- package/dist/resources/a2a.js.map +1 -0
- package/dist/resources/agents.d.ts +111 -0
- package/dist/resources/agents.d.ts.map +1 -0
- package/dist/resources/agents.js +138 -0
- package/dist/resources/agents.js.map +1 -0
- package/dist/resources/base.d.ts +115 -0
- package/dist/resources/base.d.ts.map +1 -0
- package/dist/resources/base.js +120 -0
- package/dist/resources/base.js.map +1 -0
- package/dist/resources/cards.d.ts +19 -0
- package/dist/resources/cards.d.ts.map +1 -0
- package/dist/resources/cards.js +39 -0
- package/dist/resources/cards.js.map +1 -0
- package/dist/resources/holds.d.ts +44 -0
- package/dist/resources/holds.d.ts.map +1 -0
- package/dist/resources/holds.js +60 -0
- package/dist/resources/holds.js.map +1 -0
- package/dist/resources/index.d.ts +16 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +16 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/ledger.d.ts +38 -0
- package/dist/resources/ledger.d.ts.map +1 -0
- package/dist/resources/ledger.js +39 -0
- package/dist/resources/ledger.js.map +1 -0
- package/dist/resources/marketplace.d.ts +60 -0
- package/dist/resources/marketplace.d.ts.map +1 -0
- package/dist/resources/marketplace.js +84 -0
- package/dist/resources/marketplace.js.map +1 -0
- package/dist/resources/payments.d.ts +24 -0
- package/dist/resources/payments.d.ts.map +1 -0
- package/dist/resources/payments.js +29 -0
- package/dist/resources/payments.js.map +1 -0
- package/dist/resources/policies.d.ts +23 -0
- package/dist/resources/policies.d.ts.map +1 -0
- package/dist/resources/policies.js +27 -0
- package/dist/resources/policies.js.map +1 -0
- package/dist/resources/transactions.d.ts +32 -0
- package/dist/resources/transactions.d.ts.map +1 -0
- package/dist/resources/transactions.js +33 -0
- package/dist/resources/transactions.js.map +1 -0
- package/dist/resources/ucp.d.ts +218 -0
- package/dist/resources/ucp.d.ts.map +1 -0
- package/dist/resources/ucp.js +129 -0
- package/dist/resources/ucp.js.map +1 -0
- package/dist/resources/wallets.d.ts +71 -0
- package/dist/resources/wallets.d.ts.map +1 -0
- package/dist/resources/wallets.js +105 -0
- package/dist/resources/wallets.js.map +1 -0
- package/dist/resources/webhooks.d.ts +57 -0
- package/dist/resources/webhooks.d.ts.map +1 -0
- package/dist/resources/webhooks.js +77 -0
- package/dist/resources/webhooks.js.map +1 -0
- package/dist/types.d.ts +1045 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/package.json +114 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,1045 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sardis SDK Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* This module contains all TypeScript type definitions used throughout
|
|
5
|
+
* the Sardis SDK.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import type { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
10
|
+
/**
|
|
11
|
+
* Supported blockchain networks.
|
|
12
|
+
*
|
|
13
|
+
* Each network supports different stablecoins and has different
|
|
14
|
+
* transaction characteristics (speed, cost, etc.).
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Note: Solana support is planned but NOT YET IMPLEMENTED.
|
|
18
|
+
* Using 'solana' or 'solana_devnet' will throw a NotImplementedError.
|
|
19
|
+
*/
|
|
20
|
+
export type Chain = 'base' | 'base_sepolia' | 'polygon' | 'polygon_amoy' | 'ethereum' | 'ethereum_sepolia' | 'arbitrum' | 'arbitrum_sepolia' | 'optimism' | 'optimism_sepolia';
|
|
21
|
+
/**
|
|
22
|
+
* Experimental chains - NOT YET IMPLEMENTED.
|
|
23
|
+
* These are planned for future releases.
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export type ExperimentalChain = 'solana' | 'solana_devnet';
|
|
27
|
+
/**
|
|
28
|
+
* Supported stablecoin tokens.
|
|
29
|
+
*
|
|
30
|
+
* - USDC: USD Coin (Circle)
|
|
31
|
+
* - USDT: Tether USD
|
|
32
|
+
* - PYUSD: PayPal USD
|
|
33
|
+
* - EURC: Euro Coin (Circle)
|
|
34
|
+
*/
|
|
35
|
+
export type Token = 'USDC' | 'USDT' | 'PYUSD' | 'EURC';
|
|
36
|
+
/**
|
|
37
|
+
* MPC (Multi-Party Computation) wallet providers.
|
|
38
|
+
*
|
|
39
|
+
* - turnkey: Turnkey.com infrastructure
|
|
40
|
+
* - fireblocks: Fireblocks custody platform
|
|
41
|
+
* - local: Local key management (development only)
|
|
42
|
+
*/
|
|
43
|
+
export type MPCProvider = 'turnkey' | 'fireblocks' | 'local';
|
|
44
|
+
/**
|
|
45
|
+
* Configuration options for the SardisClient.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const options: SardisClientOptions = {
|
|
50
|
+
* apiKey: 'sk_live_xxx',
|
|
51
|
+
* timeout: 30000,
|
|
52
|
+
* maxRetries: 3,
|
|
53
|
+
* retryDelay: 1000,
|
|
54
|
+
* };
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export interface SardisClientOptions {
|
|
58
|
+
/** API base URL (defaults to https://api.sardis.network) */
|
|
59
|
+
baseUrl?: string;
|
|
60
|
+
/** API key for authentication (required) */
|
|
61
|
+
apiKey: string;
|
|
62
|
+
/** Request timeout in milliseconds (default: 30000) */
|
|
63
|
+
timeout?: number;
|
|
64
|
+
/** Connection timeout in milliseconds (default: 10000) */
|
|
65
|
+
connectTimeout?: number;
|
|
66
|
+
/** Maximum number of retry attempts (default: 3) */
|
|
67
|
+
maxRetries?: number;
|
|
68
|
+
/** Initial retry delay in milliseconds (default: 1000) */
|
|
69
|
+
retryDelay?: number;
|
|
70
|
+
/** Maximum retry delay in milliseconds (default: 30000) */
|
|
71
|
+
maxRetryDelay?: number;
|
|
72
|
+
/** HTTP status codes to retry on (default: [408, 429, 500, 502, 503, 504]) */
|
|
73
|
+
retryOn?: number[];
|
|
74
|
+
/** Whether to retry on network errors (default: true) */
|
|
75
|
+
retryOnNetworkError?: boolean;
|
|
76
|
+
/** Token refresh configuration for automatic token renewal */
|
|
77
|
+
tokenRefresh?: TokenRefreshConfig;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Configuration for automatic token refresh.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* const config: TokenRefreshConfig = {
|
|
85
|
+
* refreshToken: async () => {
|
|
86
|
+
* const response = await fetch('/auth/refresh');
|
|
87
|
+
* const data = await response.json();
|
|
88
|
+
* return data.accessToken;
|
|
89
|
+
* },
|
|
90
|
+
* };
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export interface TokenRefreshConfig {
|
|
94
|
+
/** Function to refresh the authentication token */
|
|
95
|
+
refreshToken: () => Promise<string>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Retry configuration options.
|
|
99
|
+
*/
|
|
100
|
+
export interface RetryConfig {
|
|
101
|
+
/** Maximum number of retry attempts */
|
|
102
|
+
maxRetries: number;
|
|
103
|
+
/** Initial retry delay in milliseconds */
|
|
104
|
+
retryDelay: number;
|
|
105
|
+
/** Maximum retry delay in milliseconds */
|
|
106
|
+
maxRetryDelay: number;
|
|
107
|
+
/** HTTP status codes to retry on */
|
|
108
|
+
retryOn: number[];
|
|
109
|
+
/** Whether to retry on network errors */
|
|
110
|
+
retryOnNetworkError: boolean;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Options for individual requests.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* const controller = new AbortController();
|
|
118
|
+
* const options: RequestOptions = {
|
|
119
|
+
* timeout: 5000,
|
|
120
|
+
* signal: controller.signal,
|
|
121
|
+
* };
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
export interface RequestOptions {
|
|
125
|
+
/** Query parameters */
|
|
126
|
+
params?: Record<string, unknown>;
|
|
127
|
+
/** Request body data */
|
|
128
|
+
data?: unknown;
|
|
129
|
+
/** AbortSignal for request cancellation */
|
|
130
|
+
signal?: AbortSignal;
|
|
131
|
+
/** Request timeout in milliseconds */
|
|
132
|
+
timeout?: number;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Request interceptor for modifying outgoing requests.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* const interceptor: RequestInterceptor = {
|
|
140
|
+
* onRequest: (config) => {
|
|
141
|
+
* config.headers['X-Request-ID'] = generateRequestId();
|
|
142
|
+
* return config;
|
|
143
|
+
* },
|
|
144
|
+
* onError: (error) => {
|
|
145
|
+
* console.error('Request failed:', error);
|
|
146
|
+
* throw error;
|
|
147
|
+
* },
|
|
148
|
+
* };
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
export interface RequestInterceptor {
|
|
152
|
+
/** Called before each request is sent */
|
|
153
|
+
onRequest?: (config: AxiosRequestConfig) => AxiosRequestConfig | Promise<AxiosRequestConfig>;
|
|
154
|
+
/** Called when an error occurs */
|
|
155
|
+
onError?: (error: Error) => void | Promise<void>;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Response interceptor for modifying incoming responses.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
162
|
+
* const interceptor: ResponseInterceptor = {
|
|
163
|
+
* onResponse: (response) => {
|
|
164
|
+
* console.log(`Response received: ${response.status}`);
|
|
165
|
+
* return response;
|
|
166
|
+
* },
|
|
167
|
+
* onError: (error) => {
|
|
168
|
+
* if (error.response?.status === 401) {
|
|
169
|
+
* // Handle unauthorized
|
|
170
|
+
* }
|
|
171
|
+
* throw error;
|
|
172
|
+
* },
|
|
173
|
+
* };
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
export interface ResponseInterceptor {
|
|
177
|
+
/** Called after each response is received */
|
|
178
|
+
onResponse?: (response: AxiosResponse) => AxiosResponse | Promise<AxiosResponse>;
|
|
179
|
+
/** Called when an error occurs */
|
|
180
|
+
onError?: (error: Error) => void | Promise<void>;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Pagination parameters for list operations.
|
|
184
|
+
*/
|
|
185
|
+
export interface PaginationParams {
|
|
186
|
+
/** Maximum number of items to return per page */
|
|
187
|
+
limit?: number;
|
|
188
|
+
/** Cursor for pagination (offset or ID) */
|
|
189
|
+
cursor?: string;
|
|
190
|
+
/** Offset for pagination (alternative to cursor) */
|
|
191
|
+
offset?: number;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Paginated response structure.
|
|
195
|
+
*
|
|
196
|
+
* @typeParam T - The type of items in the response
|
|
197
|
+
*/
|
|
198
|
+
export interface PaginatedResponse<T> {
|
|
199
|
+
/** Array of items in this page */
|
|
200
|
+
data: T[];
|
|
201
|
+
/** Whether there are more items */
|
|
202
|
+
hasMore: boolean;
|
|
203
|
+
/** Cursor for the next page */
|
|
204
|
+
nextCursor?: string;
|
|
205
|
+
/** Total count of items (if available) */
|
|
206
|
+
total?: number;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Token-specific spending limits.
|
|
210
|
+
*/
|
|
211
|
+
export interface TokenLimit {
|
|
212
|
+
/** Token symbol */
|
|
213
|
+
token: Token;
|
|
214
|
+
/** Per-transaction spending limit (in token's decimal format) */
|
|
215
|
+
limit_per_tx?: string;
|
|
216
|
+
/** Total spending limit (in token's decimal format) */
|
|
217
|
+
limit_total?: string;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Non-custodial wallet for an agent.
|
|
221
|
+
*
|
|
222
|
+
* Wallets are MPC-based and never hold funds directly -
|
|
223
|
+
* they only sign transactions.
|
|
224
|
+
*/
|
|
225
|
+
export interface Wallet {
|
|
226
|
+
/** Unique wallet identifier (API field) */
|
|
227
|
+
wallet_id: string;
|
|
228
|
+
/** Backwards-compat alias (older SDKs used `id`) */
|
|
229
|
+
id: string;
|
|
230
|
+
/** ID of the agent that owns this wallet */
|
|
231
|
+
agent_id: string;
|
|
232
|
+
/** MPC provider used for key management */
|
|
233
|
+
mpc_provider: MPCProvider;
|
|
234
|
+
/** Mapping of chain names to wallet addresses */
|
|
235
|
+
addresses: Record<string, string>;
|
|
236
|
+
/** Default currency for display purposes */
|
|
237
|
+
currency: Token;
|
|
238
|
+
/** Token-specific spending limits */
|
|
239
|
+
token_limits: Record<string, TokenLimit>;
|
|
240
|
+
/** Per-transaction spending limit (in default currency) */
|
|
241
|
+
limit_per_tx: string;
|
|
242
|
+
/** Total spending limit (in default currency) */
|
|
243
|
+
limit_total: string;
|
|
244
|
+
/** Whether the wallet is active and can sign transactions */
|
|
245
|
+
is_active: boolean;
|
|
246
|
+
/** ISO 8601 timestamp of creation */
|
|
247
|
+
created_at: string;
|
|
248
|
+
/** ISO 8601 timestamp of last update */
|
|
249
|
+
updated_at: string;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Wallet balance for a specific token on a specific chain.
|
|
253
|
+
*
|
|
254
|
+
* Balances are read directly from the blockchain (non-custodial).
|
|
255
|
+
*/
|
|
256
|
+
export interface WalletBalance {
|
|
257
|
+
/** Wallet ID */
|
|
258
|
+
wallet_id: string;
|
|
259
|
+
/** Chain identifier */
|
|
260
|
+
chain: string;
|
|
261
|
+
/** Token symbol */
|
|
262
|
+
token: Token;
|
|
263
|
+
/** Current balance (from blockchain) */
|
|
264
|
+
balance: string;
|
|
265
|
+
/** Wallet address on this chain */
|
|
266
|
+
address: string;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Input for creating a new wallet.
|
|
270
|
+
*/
|
|
271
|
+
export interface CreateWalletInput {
|
|
272
|
+
/** Agent ID that will own this wallet */
|
|
273
|
+
agent_id: string;
|
|
274
|
+
/** MPC provider to use (defaults to 'turnkey') */
|
|
275
|
+
mpc_provider?: MPCProvider;
|
|
276
|
+
/** Default currency (defaults to 'USDC') */
|
|
277
|
+
currency?: Token;
|
|
278
|
+
/** Per-transaction spending limit */
|
|
279
|
+
limit_per_tx?: string;
|
|
280
|
+
/** Total spending limit */
|
|
281
|
+
limit_total?: string;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Input for setting a wallet address on a chain.
|
|
285
|
+
*/
|
|
286
|
+
export interface SetAddressInput {
|
|
287
|
+
/** Chain identifier */
|
|
288
|
+
chain: string;
|
|
289
|
+
/** Wallet address on this chain */
|
|
290
|
+
address: string;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Input for transferring stablecoins from a wallet.
|
|
294
|
+
*
|
|
295
|
+
* This is an "agent action": the caller is the agent process using an API key.
|
|
296
|
+
* Sardis enforces policy + compliance and signs via the agent MPC wallet.
|
|
297
|
+
*/
|
|
298
|
+
export interface WalletTransferInput {
|
|
299
|
+
destination: string;
|
|
300
|
+
amount: string;
|
|
301
|
+
token?: Token;
|
|
302
|
+
chain?: Chain;
|
|
303
|
+
domain?: string;
|
|
304
|
+
memo?: string;
|
|
305
|
+
}
|
|
306
|
+
export interface WalletTransferResponse {
|
|
307
|
+
tx_hash: string;
|
|
308
|
+
status: string;
|
|
309
|
+
from_address: string;
|
|
310
|
+
to_address: string;
|
|
311
|
+
amount: string;
|
|
312
|
+
token: Token;
|
|
313
|
+
chain: Chain;
|
|
314
|
+
audit_anchor?: string | null;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Payment execution status.
|
|
318
|
+
*/
|
|
319
|
+
export type PaymentStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'refunded';
|
|
320
|
+
/**
|
|
321
|
+
* A completed or in-progress payment.
|
|
322
|
+
*/
|
|
323
|
+
export interface Payment {
|
|
324
|
+
/** Unique payment identifier */
|
|
325
|
+
id: string;
|
|
326
|
+
/** Source wallet address */
|
|
327
|
+
from_wallet: string;
|
|
328
|
+
/** Destination wallet address */
|
|
329
|
+
to_wallet: string;
|
|
330
|
+
/** Payment amount (in token's decimal format) */
|
|
331
|
+
amount: string;
|
|
332
|
+
/** Transaction fee */
|
|
333
|
+
fee: string;
|
|
334
|
+
/** Token used for payment */
|
|
335
|
+
token: Token;
|
|
336
|
+
/** Chain where payment was executed */
|
|
337
|
+
chain: Chain;
|
|
338
|
+
/** Current payment status */
|
|
339
|
+
status: PaymentStatus;
|
|
340
|
+
/** Purpose or description of the payment */
|
|
341
|
+
purpose?: string;
|
|
342
|
+
/** Blockchain transaction hash */
|
|
343
|
+
tx_hash?: string;
|
|
344
|
+
/** Block number where transaction was included */
|
|
345
|
+
block_number?: number;
|
|
346
|
+
/** Error message if payment failed */
|
|
347
|
+
error_message?: string;
|
|
348
|
+
/** ISO 8601 timestamp of creation */
|
|
349
|
+
created_at: string;
|
|
350
|
+
/** ISO 8601 timestamp of completion */
|
|
351
|
+
completed_at?: string;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Input for executing a payment mandate.
|
|
355
|
+
*/
|
|
356
|
+
export interface ExecutePaymentInput {
|
|
357
|
+
/** Payment mandate object */
|
|
358
|
+
mandate: Record<string, unknown>;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Input for executing an AP2 payment bundle.
|
|
362
|
+
*/
|
|
363
|
+
export interface ExecuteAP2Input {
|
|
364
|
+
/** Intent object describing the payment purpose */
|
|
365
|
+
intent: Record<string, unknown>;
|
|
366
|
+
/** Cart object with items being purchased */
|
|
367
|
+
cart: Record<string, unknown>;
|
|
368
|
+
/** Payment object with execution details */
|
|
369
|
+
payment: Record<string, unknown>;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Response from payment execution.
|
|
373
|
+
*/
|
|
374
|
+
export interface ExecutePaymentResponse {
|
|
375
|
+
/** Payment ID */
|
|
376
|
+
payment_id: string;
|
|
377
|
+
/** Execution status */
|
|
378
|
+
status: PaymentStatus;
|
|
379
|
+
/** Transaction hash (if submitted to chain) */
|
|
380
|
+
tx_hash?: string;
|
|
381
|
+
/** Chain where payment was executed */
|
|
382
|
+
chain: string;
|
|
383
|
+
/** Audit anchor hash */
|
|
384
|
+
audit_anchor?: string;
|
|
385
|
+
/** Ledger transaction ID */
|
|
386
|
+
ledger_tx_id?: string;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Response from AP2 payment execution.
|
|
390
|
+
*/
|
|
391
|
+
export interface ExecuteAP2Response {
|
|
392
|
+
/** Mandate ID */
|
|
393
|
+
mandate_id: string;
|
|
394
|
+
/** Ledger transaction ID */
|
|
395
|
+
ledger_tx_id: string;
|
|
396
|
+
/** Blockchain transaction hash */
|
|
397
|
+
chain_tx_hash: string;
|
|
398
|
+
/** Chain where executed */
|
|
399
|
+
chain: string;
|
|
400
|
+
/** Audit anchor hash */
|
|
401
|
+
audit_anchor: string;
|
|
402
|
+
/** Execution status */
|
|
403
|
+
status: string;
|
|
404
|
+
/** Compliance provider used (if any) */
|
|
405
|
+
compliance_provider?: string;
|
|
406
|
+
/** Compliance rule applied (if any) */
|
|
407
|
+
compliance_rule?: string;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Hold (pre-authorization) status.
|
|
411
|
+
*/
|
|
412
|
+
export type HoldStatus = 'active' | 'captured' | 'voided' | 'expired';
|
|
413
|
+
/**
|
|
414
|
+
* A fund hold (pre-authorization).
|
|
415
|
+
*
|
|
416
|
+
* Holds reserve funds for a future payment without actually
|
|
417
|
+
* transferring them.
|
|
418
|
+
*/
|
|
419
|
+
export interface Hold {
|
|
420
|
+
/** Unique hold identifier */
|
|
421
|
+
id: string;
|
|
422
|
+
/** Wallet ID where funds are held */
|
|
423
|
+
wallet_id: string;
|
|
424
|
+
/** Merchant ID (if applicable) */
|
|
425
|
+
merchant_id?: string;
|
|
426
|
+
/** Hold amount */
|
|
427
|
+
amount: string;
|
|
428
|
+
/** Token being held */
|
|
429
|
+
token: Token;
|
|
430
|
+
/** Current hold status */
|
|
431
|
+
status: HoldStatus;
|
|
432
|
+
/** Purpose or description of the hold */
|
|
433
|
+
purpose?: string;
|
|
434
|
+
/** ISO 8601 timestamp when hold expires */
|
|
435
|
+
expires_at: string;
|
|
436
|
+
/** Amount that was captured (if captured) */
|
|
437
|
+
captured_amount?: string;
|
|
438
|
+
/** ISO 8601 timestamp of capture (if captured) */
|
|
439
|
+
captured_at?: string;
|
|
440
|
+
/** ISO 8601 timestamp of void (if voided) */
|
|
441
|
+
voided_at?: string;
|
|
442
|
+
/** ISO 8601 timestamp of creation */
|
|
443
|
+
created_at: string;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Input for creating a hold.
|
|
447
|
+
*/
|
|
448
|
+
export interface CreateHoldInput {
|
|
449
|
+
/** Wallet ID to hold funds from */
|
|
450
|
+
wallet_id: string;
|
|
451
|
+
/** Amount to hold */
|
|
452
|
+
amount: string;
|
|
453
|
+
/** Token to hold (defaults to 'USDC') */
|
|
454
|
+
token?: Token;
|
|
455
|
+
/** Merchant ID */
|
|
456
|
+
merchant_id?: string;
|
|
457
|
+
/** Purpose or description */
|
|
458
|
+
purpose?: string;
|
|
459
|
+
/** Duration in hours before expiration (default: 24) */
|
|
460
|
+
duration_hours?: number;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Input for capturing a hold.
|
|
464
|
+
*/
|
|
465
|
+
export interface CaptureHoldInput {
|
|
466
|
+
/** Amount to capture (defaults to full hold amount) */
|
|
467
|
+
amount?: string;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Response from hold creation.
|
|
471
|
+
*/
|
|
472
|
+
export interface CreateHoldResponse {
|
|
473
|
+
/** Hold ID */
|
|
474
|
+
hold_id: string;
|
|
475
|
+
/** Initial status */
|
|
476
|
+
status: HoldStatus;
|
|
477
|
+
/** Expiration timestamp */
|
|
478
|
+
expires_at: string;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Webhook event types.
|
|
482
|
+
*/
|
|
483
|
+
export type WebhookEventType = 'payment.completed' | 'payment.failed' | 'hold.created' | 'hold.captured' | 'hold.voided' | 'hold.expired' | 'wallet.funded' | 'wallet.low_balance' | 'offer.received' | 'offer.accepted' | 'offer.completed';
|
|
484
|
+
/**
|
|
485
|
+
* A webhook subscription.
|
|
486
|
+
*/
|
|
487
|
+
export interface Webhook {
|
|
488
|
+
/** Unique webhook identifier */
|
|
489
|
+
id: string;
|
|
490
|
+
/** Organization ID */
|
|
491
|
+
organization_id: string;
|
|
492
|
+
/** Endpoint URL to receive events */
|
|
493
|
+
url: string;
|
|
494
|
+
/** Event types to subscribe to */
|
|
495
|
+
events: WebhookEventType[];
|
|
496
|
+
/** Whether webhook is active */
|
|
497
|
+
is_active: boolean;
|
|
498
|
+
/** Total number of delivery attempts */
|
|
499
|
+
total_deliveries: number;
|
|
500
|
+
/** Number of successful deliveries */
|
|
501
|
+
successful_deliveries: number;
|
|
502
|
+
/** Number of failed deliveries */
|
|
503
|
+
failed_deliveries: number;
|
|
504
|
+
/** ISO 8601 timestamp of last delivery */
|
|
505
|
+
last_delivery_at?: string;
|
|
506
|
+
/** ISO 8601 timestamp of creation */
|
|
507
|
+
created_at: string;
|
|
508
|
+
/** ISO 8601 timestamp of last update */
|
|
509
|
+
updated_at: string;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* A webhook delivery attempt.
|
|
513
|
+
*/
|
|
514
|
+
export interface WebhookDelivery {
|
|
515
|
+
/** Unique delivery identifier */
|
|
516
|
+
id: string;
|
|
517
|
+
/** Webhook subscription ID */
|
|
518
|
+
subscription_id: string;
|
|
519
|
+
/** Event ID */
|
|
520
|
+
event_id: string;
|
|
521
|
+
/** Event type */
|
|
522
|
+
event_type: string;
|
|
523
|
+
/** Endpoint URL */
|
|
524
|
+
url: string;
|
|
525
|
+
/** HTTP status code from endpoint */
|
|
526
|
+
status_code?: number;
|
|
527
|
+
/** Whether delivery succeeded */
|
|
528
|
+
success: boolean;
|
|
529
|
+
/** Error message (if failed) */
|
|
530
|
+
error?: string;
|
|
531
|
+
/** Response time in milliseconds */
|
|
532
|
+
duration_ms: number;
|
|
533
|
+
/** Attempt number (for retries) */
|
|
534
|
+
attempt_number: number;
|
|
535
|
+
/** ISO 8601 timestamp of delivery */
|
|
536
|
+
created_at: string;
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Input for creating a webhook.
|
|
540
|
+
*/
|
|
541
|
+
export interface CreateWebhookInput {
|
|
542
|
+
/** Endpoint URL */
|
|
543
|
+
url: string;
|
|
544
|
+
/** Event types to subscribe to */
|
|
545
|
+
events: WebhookEventType[];
|
|
546
|
+
/** Organization ID (optional) */
|
|
547
|
+
organization_id?: string;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Input for updating a webhook.
|
|
551
|
+
*/
|
|
552
|
+
export interface UpdateWebhookInput {
|
|
553
|
+
/** New endpoint URL */
|
|
554
|
+
url?: string;
|
|
555
|
+
/** New event types */
|
|
556
|
+
events?: WebhookEventType[];
|
|
557
|
+
/** Whether webhook is active */
|
|
558
|
+
is_active?: boolean;
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Service categories in the marketplace.
|
|
562
|
+
*/
|
|
563
|
+
export type ServiceCategory = 'payment' | 'data' | 'compute' | 'ai' | 'storage' | 'oracle' | 'other';
|
|
564
|
+
/**
|
|
565
|
+
* Service listing status.
|
|
566
|
+
*/
|
|
567
|
+
export type ServiceStatus = 'draft' | 'active' | 'paused' | 'archived';
|
|
568
|
+
/**
|
|
569
|
+
* Offer status.
|
|
570
|
+
*/
|
|
571
|
+
export type OfferStatus = 'pending' | 'accepted' | 'rejected' | 'completed' | 'cancelled' | 'disputed';
|
|
572
|
+
/**
|
|
573
|
+
* A service listing in the marketplace.
|
|
574
|
+
*/
|
|
575
|
+
export interface Service {
|
|
576
|
+
/** Unique service identifier */
|
|
577
|
+
id: string;
|
|
578
|
+
/** Provider agent ID */
|
|
579
|
+
provider_agent_id: string;
|
|
580
|
+
/** Service name */
|
|
581
|
+
name: string;
|
|
582
|
+
/** Service description */
|
|
583
|
+
description?: string;
|
|
584
|
+
/** Service category */
|
|
585
|
+
category: ServiceCategory;
|
|
586
|
+
/** Searchable tags */
|
|
587
|
+
tags: string[];
|
|
588
|
+
/** Price amount */
|
|
589
|
+
price_amount: string;
|
|
590
|
+
/** Price token */
|
|
591
|
+
price_token: Token;
|
|
592
|
+
/** Pricing type (e.g., 'per_request', 'subscription') */
|
|
593
|
+
price_type: string;
|
|
594
|
+
/** Service capabilities */
|
|
595
|
+
capabilities: Record<string, unknown>;
|
|
596
|
+
/** API endpoint URL */
|
|
597
|
+
api_endpoint?: string;
|
|
598
|
+
/** Current status */
|
|
599
|
+
status: ServiceStatus;
|
|
600
|
+
/** Total number of orders */
|
|
601
|
+
total_orders: number;
|
|
602
|
+
/** Number of completed orders */
|
|
603
|
+
completed_orders: number;
|
|
604
|
+
/** Average rating (1-5) */
|
|
605
|
+
rating?: number;
|
|
606
|
+
/** ISO 8601 timestamp of creation */
|
|
607
|
+
created_at: string;
|
|
608
|
+
/** ISO 8601 timestamp of last update */
|
|
609
|
+
updated_at: string;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* An offer for a service.
|
|
613
|
+
*/
|
|
614
|
+
export interface ServiceOffer {
|
|
615
|
+
/** Unique offer identifier */
|
|
616
|
+
id: string;
|
|
617
|
+
/** Service ID */
|
|
618
|
+
service_id: string;
|
|
619
|
+
/** Provider agent ID */
|
|
620
|
+
provider_agent_id: string;
|
|
621
|
+
/** Consumer agent ID */
|
|
622
|
+
consumer_agent_id: string;
|
|
623
|
+
/** Total offer amount */
|
|
624
|
+
total_amount: string;
|
|
625
|
+
/** Payment token */
|
|
626
|
+
token: Token;
|
|
627
|
+
/** Current status */
|
|
628
|
+
status: OfferStatus;
|
|
629
|
+
/** Escrow transaction hash */
|
|
630
|
+
escrow_tx_hash?: string;
|
|
631
|
+
/** Amount in escrow */
|
|
632
|
+
escrow_amount: string;
|
|
633
|
+
/** Amount released from escrow */
|
|
634
|
+
released_amount: string;
|
|
635
|
+
/** ISO 8601 timestamp of creation */
|
|
636
|
+
created_at: string;
|
|
637
|
+
/** ISO 8601 timestamp of acceptance */
|
|
638
|
+
accepted_at?: string;
|
|
639
|
+
/** ISO 8601 timestamp of completion */
|
|
640
|
+
completed_at?: string;
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* A review for a service.
|
|
644
|
+
*/
|
|
645
|
+
export interface ServiceReview {
|
|
646
|
+
/** Unique review identifier */
|
|
647
|
+
id: string;
|
|
648
|
+
/** Offer ID this review is for */
|
|
649
|
+
offer_id: string;
|
|
650
|
+
/** Service ID */
|
|
651
|
+
service_id: string;
|
|
652
|
+
/** Reviewer agent ID */
|
|
653
|
+
reviewer_agent_id: string;
|
|
654
|
+
/** Rating (1-5) */
|
|
655
|
+
rating: number;
|
|
656
|
+
/** Review comment */
|
|
657
|
+
comment?: string;
|
|
658
|
+
/** ISO 8601 timestamp of creation */
|
|
659
|
+
created_at: string;
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Input for creating a service.
|
|
663
|
+
*/
|
|
664
|
+
export interface CreateServiceInput {
|
|
665
|
+
/** Service name */
|
|
666
|
+
name: string;
|
|
667
|
+
/** Service description */
|
|
668
|
+
description?: string;
|
|
669
|
+
/** Service category */
|
|
670
|
+
category: ServiceCategory;
|
|
671
|
+
/** Searchable tags */
|
|
672
|
+
tags?: string[];
|
|
673
|
+
/** Price amount */
|
|
674
|
+
price_amount: string;
|
|
675
|
+
/** Price token (defaults to 'USDC') */
|
|
676
|
+
price_token?: Token;
|
|
677
|
+
/** Service capabilities */
|
|
678
|
+
capabilities?: Record<string, unknown>;
|
|
679
|
+
/** API endpoint URL */
|
|
680
|
+
api_endpoint?: string;
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Input for creating an offer.
|
|
684
|
+
*/
|
|
685
|
+
export interface CreateOfferInput {
|
|
686
|
+
/** Service ID */
|
|
687
|
+
service_id: string;
|
|
688
|
+
/** Consumer agent ID */
|
|
689
|
+
consumer_agent_id: string;
|
|
690
|
+
/** Total offer amount */
|
|
691
|
+
total_amount: string;
|
|
692
|
+
/** Payment token (defaults to 'USDC') */
|
|
693
|
+
token?: Token;
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Input for searching services.
|
|
697
|
+
*/
|
|
698
|
+
export interface SearchServicesInput {
|
|
699
|
+
/** Text query */
|
|
700
|
+
query?: string;
|
|
701
|
+
/** Filter by category */
|
|
702
|
+
category?: ServiceCategory;
|
|
703
|
+
/** Minimum price */
|
|
704
|
+
min_price?: string;
|
|
705
|
+
/** Maximum price */
|
|
706
|
+
max_price?: string;
|
|
707
|
+
/** Filter by tags */
|
|
708
|
+
tags?: string[];
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Gas estimation for a transaction.
|
|
712
|
+
*/
|
|
713
|
+
export interface GasEstimate {
|
|
714
|
+
/** Estimated gas limit */
|
|
715
|
+
gas_limit: number;
|
|
716
|
+
/** Gas price in Gwei */
|
|
717
|
+
gas_price_gwei: string;
|
|
718
|
+
/** Maximum fee per gas in Gwei (EIP-1559) */
|
|
719
|
+
max_fee_gwei: string;
|
|
720
|
+
/** Maximum priority fee in Gwei (EIP-1559) */
|
|
721
|
+
max_priority_fee_gwei: string;
|
|
722
|
+
/** Estimated cost in Wei */
|
|
723
|
+
estimated_cost_wei: number;
|
|
724
|
+
/** Estimated cost in USD */
|
|
725
|
+
estimated_cost_usd?: string;
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Transaction status on the blockchain.
|
|
729
|
+
*/
|
|
730
|
+
export interface TransactionStatus {
|
|
731
|
+
/** Transaction hash */
|
|
732
|
+
tx_hash: string;
|
|
733
|
+
/** Chain identifier */
|
|
734
|
+
chain: string;
|
|
735
|
+
/** Current status */
|
|
736
|
+
status: 'pending' | 'submitted' | 'confirming' | 'confirmed' | 'failed';
|
|
737
|
+
/** Block number (if confirmed) */
|
|
738
|
+
block_number?: number;
|
|
739
|
+
/** Number of confirmations */
|
|
740
|
+
confirmations: number;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Information about a supported blockchain.
|
|
744
|
+
*/
|
|
745
|
+
export interface ChainInfo {
|
|
746
|
+
/** Chain display name */
|
|
747
|
+
name: string;
|
|
748
|
+
/** Chain ID */
|
|
749
|
+
chain_id: number;
|
|
750
|
+
/** Native token symbol */
|
|
751
|
+
native_token: string;
|
|
752
|
+
/** Average block time in seconds */
|
|
753
|
+
block_time: number;
|
|
754
|
+
/** Block explorer URL */
|
|
755
|
+
explorer: string;
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* A ledger entry recording a transaction.
|
|
759
|
+
*/
|
|
760
|
+
export interface LedgerEntry {
|
|
761
|
+
/** Transaction ID */
|
|
762
|
+
tx_id: string;
|
|
763
|
+
/** Related mandate ID */
|
|
764
|
+
mandate_id?: string;
|
|
765
|
+
/** Source wallet address */
|
|
766
|
+
from_wallet?: string;
|
|
767
|
+
/** Destination wallet address */
|
|
768
|
+
to_wallet?: string;
|
|
769
|
+
/** Transaction amount */
|
|
770
|
+
amount: string;
|
|
771
|
+
/** Currency/token */
|
|
772
|
+
currency: string;
|
|
773
|
+
/** Chain where executed */
|
|
774
|
+
chain?: string;
|
|
775
|
+
/** Blockchain transaction hash */
|
|
776
|
+
chain_tx_hash?: string;
|
|
777
|
+
/** Audit anchor hash */
|
|
778
|
+
audit_anchor?: string;
|
|
779
|
+
/** ISO 8601 timestamp of creation */
|
|
780
|
+
created_at: string;
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Sardis error details structure.
|
|
784
|
+
*/
|
|
785
|
+
export interface SardisErrorDetails {
|
|
786
|
+
/** Error code */
|
|
787
|
+
code: string;
|
|
788
|
+
/** Error message */
|
|
789
|
+
message: string;
|
|
790
|
+
/** Additional details */
|
|
791
|
+
details?: Record<string, unknown>;
|
|
792
|
+
/** Request ID for support */
|
|
793
|
+
request_id?: string;
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Key algorithm for agent signing.
|
|
797
|
+
*/
|
|
798
|
+
export type KeyAlgorithm = 'ed25519' | 'ecdsa-p256';
|
|
799
|
+
/**
|
|
800
|
+
* Spending limits for an agent.
|
|
801
|
+
*/
|
|
802
|
+
export interface SpendingLimits {
|
|
803
|
+
/** Per-transaction limit */
|
|
804
|
+
per_transaction?: string;
|
|
805
|
+
/** Daily spending limit */
|
|
806
|
+
daily?: string;
|
|
807
|
+
/** Monthly spending limit */
|
|
808
|
+
monthly?: string;
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Policy configuration for an agent.
|
|
812
|
+
*/
|
|
813
|
+
export interface AgentPolicy {
|
|
814
|
+
/** Allowed merchant categories */
|
|
815
|
+
allowed_categories?: string[];
|
|
816
|
+
/** Blocked merchants */
|
|
817
|
+
blocked_merchants?: string[];
|
|
818
|
+
/** Allowed merchants (whitelist mode) */
|
|
819
|
+
allowed_merchants?: string[];
|
|
820
|
+
/** Maximum single transaction amount */
|
|
821
|
+
max_transaction_amount?: string;
|
|
822
|
+
/** Require approval above this amount */
|
|
823
|
+
approval_threshold?: string;
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* An agent in the Sardis system.
|
|
827
|
+
*
|
|
828
|
+
* Agents are the core identity entities that can own wallets,
|
|
829
|
+
* issue mandates, and be subject to spending policies.
|
|
830
|
+
*/
|
|
831
|
+
export interface Agent {
|
|
832
|
+
/** Unique agent identifier (API field) */
|
|
833
|
+
agent_id: string;
|
|
834
|
+
/** Backwards-compat alias (older SDKs used `id`) */
|
|
835
|
+
id: string;
|
|
836
|
+
/** Display name */
|
|
837
|
+
name: string;
|
|
838
|
+
/** Agent description */
|
|
839
|
+
description?: string;
|
|
840
|
+
/** Organization ID */
|
|
841
|
+
organization_id?: string;
|
|
842
|
+
/** Associated wallet ID */
|
|
843
|
+
wallet_id?: string;
|
|
844
|
+
/** Public key for signing */
|
|
845
|
+
public_key?: string;
|
|
846
|
+
/** Key algorithm */
|
|
847
|
+
key_algorithm: KeyAlgorithm;
|
|
848
|
+
/** Spending limits */
|
|
849
|
+
spending_limits?: SpendingLimits;
|
|
850
|
+
/** Policy configuration */
|
|
851
|
+
policy?: AgentPolicy;
|
|
852
|
+
/** Whether agent is active */
|
|
853
|
+
is_active: boolean;
|
|
854
|
+
/** Arbitrary metadata */
|
|
855
|
+
metadata: Record<string, unknown>;
|
|
856
|
+
/** ISO 8601 timestamp of creation */
|
|
857
|
+
created_at: string;
|
|
858
|
+
/** ISO 8601 timestamp of last update */
|
|
859
|
+
updated_at: string;
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Input for creating an agent.
|
|
863
|
+
*/
|
|
864
|
+
export interface CreateAgentInput {
|
|
865
|
+
/** Display name (required) */
|
|
866
|
+
name: string;
|
|
867
|
+
/** Agent description */
|
|
868
|
+
description?: string;
|
|
869
|
+
/** Organization ID */
|
|
870
|
+
organization_id?: string;
|
|
871
|
+
/** Public key for signing */
|
|
872
|
+
public_key?: string;
|
|
873
|
+
/** Key algorithm */
|
|
874
|
+
key_algorithm?: KeyAlgorithm;
|
|
875
|
+
/** Spending limits */
|
|
876
|
+
spending_limits?: SpendingLimits;
|
|
877
|
+
/** Policy configuration */
|
|
878
|
+
policy?: AgentPolicy;
|
|
879
|
+
/** Arbitrary metadata */
|
|
880
|
+
metadata?: Record<string, unknown>;
|
|
881
|
+
}
|
|
882
|
+
export interface PolicySpendingLimit {
|
|
883
|
+
vendor_pattern: string;
|
|
884
|
+
max_amount: number;
|
|
885
|
+
period: string;
|
|
886
|
+
currency?: string;
|
|
887
|
+
}
|
|
888
|
+
export interface ParsedPolicy {
|
|
889
|
+
name: string;
|
|
890
|
+
description: string;
|
|
891
|
+
spending_limits?: PolicySpendingLimit[];
|
|
892
|
+
requires_approval_above?: number | null;
|
|
893
|
+
global_daily_limit?: number | null;
|
|
894
|
+
global_monthly_limit?: number | null;
|
|
895
|
+
is_active?: boolean;
|
|
896
|
+
policy_id?: string | null;
|
|
897
|
+
agent_id?: string | null;
|
|
898
|
+
[key: string]: unknown;
|
|
899
|
+
}
|
|
900
|
+
export interface PolicyPreviewResponse {
|
|
901
|
+
parsed: ParsedPolicy;
|
|
902
|
+
warnings: string[];
|
|
903
|
+
requires_confirmation: boolean;
|
|
904
|
+
confirmation_message: string;
|
|
905
|
+
}
|
|
906
|
+
export interface ApplyPolicyFromNLResponse {
|
|
907
|
+
success: boolean;
|
|
908
|
+
policy_id: string;
|
|
909
|
+
agent_id: string;
|
|
910
|
+
trust_level?: string;
|
|
911
|
+
limit_per_tx?: string;
|
|
912
|
+
limit_total?: string;
|
|
913
|
+
merchant_rules_count?: number;
|
|
914
|
+
message?: string;
|
|
915
|
+
[key: string]: unknown;
|
|
916
|
+
}
|
|
917
|
+
export interface PolicyCheckResponse {
|
|
918
|
+
allowed: boolean;
|
|
919
|
+
reason: string;
|
|
920
|
+
policy_id?: string | null;
|
|
921
|
+
}
|
|
922
|
+
export type CardStatus = 'pending' | 'active' | 'frozen' | 'cancelled' | string;
|
|
923
|
+
export interface Card {
|
|
924
|
+
id: string;
|
|
925
|
+
card_id: string;
|
|
926
|
+
wallet_id: string;
|
|
927
|
+
provider: string;
|
|
928
|
+
provider_card_id?: string | null;
|
|
929
|
+
card_type: string;
|
|
930
|
+
status: CardStatus;
|
|
931
|
+
limit_per_tx: number;
|
|
932
|
+
limit_daily: number;
|
|
933
|
+
limit_monthly: number;
|
|
934
|
+
funded_amount?: number;
|
|
935
|
+
created_at?: string;
|
|
936
|
+
[key: string]: unknown;
|
|
937
|
+
}
|
|
938
|
+
export interface IssueCardInput {
|
|
939
|
+
wallet_id: string;
|
|
940
|
+
card_type?: string;
|
|
941
|
+
limit_per_tx?: string;
|
|
942
|
+
limit_daily?: string;
|
|
943
|
+
limit_monthly?: string;
|
|
944
|
+
locked_merchant_id?: string | null;
|
|
945
|
+
funding_source?: string;
|
|
946
|
+
}
|
|
947
|
+
export interface UpdateCardLimitsInput {
|
|
948
|
+
limit_per_tx?: string;
|
|
949
|
+
limit_daily?: string;
|
|
950
|
+
limit_monthly?: string;
|
|
951
|
+
}
|
|
952
|
+
export interface SimulateCardPurchaseInput {
|
|
953
|
+
amount: string;
|
|
954
|
+
currency?: string;
|
|
955
|
+
merchant_name?: string;
|
|
956
|
+
mcc_code?: string;
|
|
957
|
+
status?: string;
|
|
958
|
+
decline_reason?: string | null;
|
|
959
|
+
}
|
|
960
|
+
export interface CardTransaction {
|
|
961
|
+
transaction_id: string;
|
|
962
|
+
card_id: string;
|
|
963
|
+
amount: string;
|
|
964
|
+
currency: string;
|
|
965
|
+
merchant_name: string;
|
|
966
|
+
merchant_category: string;
|
|
967
|
+
status: string;
|
|
968
|
+
created_at: string;
|
|
969
|
+
settled_at?: string | null;
|
|
970
|
+
decline_reason?: string | null;
|
|
971
|
+
[key: string]: unknown;
|
|
972
|
+
}
|
|
973
|
+
export interface SimulateCardPurchaseResponse {
|
|
974
|
+
transaction: CardTransaction;
|
|
975
|
+
policy: {
|
|
976
|
+
allowed: boolean;
|
|
977
|
+
reason: string;
|
|
978
|
+
};
|
|
979
|
+
card: Card;
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* Input for updating an agent.
|
|
983
|
+
*/
|
|
984
|
+
export interface UpdateAgentInput {
|
|
985
|
+
/** Display name */
|
|
986
|
+
name?: string;
|
|
987
|
+
/** Agent description */
|
|
988
|
+
description?: string;
|
|
989
|
+
/** Spending limits */
|
|
990
|
+
spending_limits?: SpendingLimits;
|
|
991
|
+
/** Policy configuration */
|
|
992
|
+
policy?: AgentPolicy;
|
|
993
|
+
/** Whether agent is active */
|
|
994
|
+
is_active?: boolean;
|
|
995
|
+
/** Arbitrary metadata (merged with existing) */
|
|
996
|
+
metadata?: Record<string, unknown>;
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* Options for listing agents.
|
|
1000
|
+
*/
|
|
1001
|
+
export interface ListAgentsOptions {
|
|
1002
|
+
/** Maximum number of agents to return */
|
|
1003
|
+
limit?: number;
|
|
1004
|
+
/** Pagination offset */
|
|
1005
|
+
offset?: number;
|
|
1006
|
+
/** Filter by active status */
|
|
1007
|
+
is_active?: boolean;
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* A single operation in a bulk request.
|
|
1011
|
+
*/
|
|
1012
|
+
export interface BulkOperation<T = unknown> {
|
|
1013
|
+
/** HTTP method */
|
|
1014
|
+
method: 'GET' | 'POST' | 'PATCH' | 'DELETE';
|
|
1015
|
+
/** API path */
|
|
1016
|
+
path: string;
|
|
1017
|
+
/** Query parameters */
|
|
1018
|
+
params?: Record<string, unknown>;
|
|
1019
|
+
/** Request body */
|
|
1020
|
+
data?: T;
|
|
1021
|
+
}
|
|
1022
|
+
/**
|
|
1023
|
+
* Result of a single bulk operation.
|
|
1024
|
+
*
|
|
1025
|
+
* @typeParam T - The expected response type
|
|
1026
|
+
*/
|
|
1027
|
+
export type BulkOperationResult<T> = {
|
|
1028
|
+
success: true;
|
|
1029
|
+
data: T;
|
|
1030
|
+
} | {
|
|
1031
|
+
success: false;
|
|
1032
|
+
error: Error;
|
|
1033
|
+
};
|
|
1034
|
+
/**
|
|
1035
|
+
* Options for bulk operations.
|
|
1036
|
+
*/
|
|
1037
|
+
export interface BulkOptions {
|
|
1038
|
+
/** Maximum concurrent requests (default: 5) */
|
|
1039
|
+
concurrency?: number;
|
|
1040
|
+
/** Stop on first error (default: false) */
|
|
1041
|
+
stopOnError?: boolean;
|
|
1042
|
+
/** AbortSignal for cancellation */
|
|
1043
|
+
signal?: AbortSignal;
|
|
1044
|
+
}
|
|
1045
|
+
//# sourceMappingURL=types.d.ts.map
|