@dakota-xyz/ts-sdk 1.0.15
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/LICENSE +21 -0
- package/README.md +607 -0
- package/dist/index.d.mts +5723 -0
- package/dist/index.d.ts +5723 -0
- package/dist/index.js +2074 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2044 -0
- package/dist/index.mjs.map +1 -0
- package/dist/webhook/index.d.mts +409 -0
- package/dist/webhook/index.d.ts +409 -0
- package/dist/webhook/index.js +936 -0
- package/dist/webhook/index.js.map +1 -0
- package/dist/webhook/index.mjs +921 -0
- package/dist/webhook/index.mjs.map +1 -0
- package/package.json +96 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2044 @@
|
|
|
1
|
+
// src/client/environment.ts
|
|
2
|
+
var Environment = /* @__PURE__ */ ((Environment2) => {
|
|
3
|
+
Environment2["Sandbox"] = "sandbox";
|
|
4
|
+
Environment2["Production"] = "production";
|
|
5
|
+
Environment2["Development"] = "development";
|
|
6
|
+
Environment2["Local"] = "local";
|
|
7
|
+
return Environment2;
|
|
8
|
+
})(Environment || {});
|
|
9
|
+
var ENVIRONMENT_URLS = {
|
|
10
|
+
["sandbox" /* Sandbox */]: "https://api.platform.sandbox.dakota.xyz",
|
|
11
|
+
["production" /* Production */]: "https://api.platform.dakota.xyz",
|
|
12
|
+
["development" /* Development */]: "https://api.platform.development.dakota.xyz",
|
|
13
|
+
["local" /* Local */]: "http://localhost:6464"
|
|
14
|
+
};
|
|
15
|
+
function getEnvironmentURL(env) {
|
|
16
|
+
const url = ENVIRONMENT_URLS[env];
|
|
17
|
+
if (!url) {
|
|
18
|
+
throw new Error(`Unknown environment: ${env}`);
|
|
19
|
+
}
|
|
20
|
+
return url;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/client/errors.ts
|
|
24
|
+
var RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
|
|
25
|
+
var APIError = class _APIError extends Error {
|
|
26
|
+
/** HTTP status code */
|
|
27
|
+
statusCode;
|
|
28
|
+
/** Machine-readable error code */
|
|
29
|
+
code;
|
|
30
|
+
/** Additional error details */
|
|
31
|
+
details;
|
|
32
|
+
/** Request ID for support tickets */
|
|
33
|
+
requestId;
|
|
34
|
+
/** Raw response body */
|
|
35
|
+
rawBody;
|
|
36
|
+
/** Whether this error is safe to retry */
|
|
37
|
+
retryable;
|
|
38
|
+
constructor(statusCode, code, message, options) {
|
|
39
|
+
super(message);
|
|
40
|
+
this.name = "APIError";
|
|
41
|
+
this.statusCode = statusCode;
|
|
42
|
+
this.code = code;
|
|
43
|
+
this.details = options?.details ?? null;
|
|
44
|
+
this.requestId = options?.requestId ?? null;
|
|
45
|
+
this.rawBody = options?.rawBody ?? null;
|
|
46
|
+
this.retryable = RETRYABLE_STATUS_CODES.has(statusCode);
|
|
47
|
+
if (Error.captureStackTrace) {
|
|
48
|
+
Error.captureStackTrace(this, _APIError);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Create an APIError from an HTTP response.
|
|
53
|
+
*/
|
|
54
|
+
static async fromResponse(response) {
|
|
55
|
+
const requestId = response.headers.get("x-request-id");
|
|
56
|
+
let rawBody = null;
|
|
57
|
+
let code = `http_${response.status}`;
|
|
58
|
+
let message = response.statusText || "Unknown error";
|
|
59
|
+
let details = null;
|
|
60
|
+
try {
|
|
61
|
+
rawBody = await response.text();
|
|
62
|
+
const parsed = JSON.parse(rawBody);
|
|
63
|
+
if (parsed.type && typeof parsed.type === "string") {
|
|
64
|
+
const hashIndex = parsed.type.lastIndexOf("#");
|
|
65
|
+
if (hashIndex !== -1) {
|
|
66
|
+
code = parsed.type.substring(hashIndex + 1);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (parsed.code) {
|
|
70
|
+
code = parsed.code;
|
|
71
|
+
}
|
|
72
|
+
if (parsed.title) {
|
|
73
|
+
message = parsed.title;
|
|
74
|
+
if (parsed.detail) {
|
|
75
|
+
message = `${parsed.title}: ${parsed.detail}`;
|
|
76
|
+
}
|
|
77
|
+
} else if (parsed.message) {
|
|
78
|
+
message = parsed.message;
|
|
79
|
+
} else if (parsed.detail) {
|
|
80
|
+
message = parsed.detail;
|
|
81
|
+
}
|
|
82
|
+
if (parsed.details && typeof parsed.details === "object") {
|
|
83
|
+
details = parsed.details;
|
|
84
|
+
}
|
|
85
|
+
} catch {
|
|
86
|
+
}
|
|
87
|
+
return new _APIError(response.status, code, message, {
|
|
88
|
+
details,
|
|
89
|
+
requestId,
|
|
90
|
+
rawBody
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
toString() {
|
|
94
|
+
if (this.code) {
|
|
95
|
+
return `APIError [${this.statusCode} ${this.code}]: ${this.message}`;
|
|
96
|
+
}
|
|
97
|
+
return `APIError [${this.statusCode}]: ${this.message}`;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
var TransportError = class _TransportError extends Error {
|
|
101
|
+
/** The underlying error that caused this transport error */
|
|
102
|
+
cause;
|
|
103
|
+
constructor(message, cause) {
|
|
104
|
+
super(message);
|
|
105
|
+
this.name = "TransportError";
|
|
106
|
+
this.cause = cause;
|
|
107
|
+
if (Error.captureStackTrace) {
|
|
108
|
+
Error.captureStackTrace(this, _TransportError);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
toString() {
|
|
112
|
+
if (this.cause) {
|
|
113
|
+
return `TransportError: ${this.message} (caused by: ${this.cause.message})`;
|
|
114
|
+
}
|
|
115
|
+
return `TransportError: ${this.message}`;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
var ConfigurationError = class _ConfigurationError extends Error {
|
|
119
|
+
constructor(message) {
|
|
120
|
+
super(message);
|
|
121
|
+
this.name = "ConfigurationError";
|
|
122
|
+
if (Error.captureStackTrace) {
|
|
123
|
+
Error.captureStackTrace(this, _ConfigurationError);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// src/client/config.ts
|
|
129
|
+
var AuthMode = /* @__PURE__ */ ((AuthMode2) => {
|
|
130
|
+
AuthMode2["Auto"] = "auto";
|
|
131
|
+
AuthMode2["APIKey"] = "api_key";
|
|
132
|
+
AuthMode2["ApplicationToken"] = "application_token";
|
|
133
|
+
return AuthMode2;
|
|
134
|
+
})(AuthMode || {});
|
|
135
|
+
var DEFAULT_RETRY_POLICY = {
|
|
136
|
+
maxAttempts: 3,
|
|
137
|
+
initialBackoffMs: 200,
|
|
138
|
+
maxBackoffMs: 2e3
|
|
139
|
+
};
|
|
140
|
+
var noopLogger = {
|
|
141
|
+
debug: () => {
|
|
142
|
+
},
|
|
143
|
+
info: () => {
|
|
144
|
+
},
|
|
145
|
+
warn: () => {
|
|
146
|
+
},
|
|
147
|
+
error: () => {
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
var consoleLogger = {
|
|
151
|
+
debug: (msg, ...args) => console.debug(`[Dakota SDK] ${msg}`, ...args),
|
|
152
|
+
info: (msg, ...args) => console.info(`[Dakota SDK] ${msg}`, ...args),
|
|
153
|
+
warn: (msg, ...args) => console.warn(`[Dakota SDK] ${msg}`, ...args),
|
|
154
|
+
error: (msg, ...args) => console.error(`[Dakota SDK] ${msg}`, ...args)
|
|
155
|
+
};
|
|
156
|
+
function generateUUID() {
|
|
157
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
158
|
+
const r = Math.random() * 16 | 0;
|
|
159
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
160
|
+
return v.toString(16);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function resolveConfig(config) {
|
|
164
|
+
const authMode = config.authMode ?? "auto" /* Auto */;
|
|
165
|
+
if (authMode === "auto" /* Auto */) {
|
|
166
|
+
if (!config.apiKey && !config.applicationToken) {
|
|
167
|
+
throw new ConfigurationError("API key or application token is required");
|
|
168
|
+
}
|
|
169
|
+
} else if (authMode === "api_key" /* APIKey */) {
|
|
170
|
+
if (!config.apiKey) {
|
|
171
|
+
throw new ConfigurationError("API key is required when using AuthMode.APIKey");
|
|
172
|
+
}
|
|
173
|
+
} else if (authMode === "application_token" /* ApplicationToken */) {
|
|
174
|
+
if (!config.applicationToken) {
|
|
175
|
+
throw new ConfigurationError(
|
|
176
|
+
"Application token is required when using AuthMode.ApplicationToken"
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
let baseURL;
|
|
181
|
+
if (config.baseURL) {
|
|
182
|
+
baseURL = config.baseURL.replace(/\/$/, "");
|
|
183
|
+
try {
|
|
184
|
+
new URL(baseURL);
|
|
185
|
+
} catch {
|
|
186
|
+
throw new ConfigurationError("Invalid base URL");
|
|
187
|
+
}
|
|
188
|
+
} else {
|
|
189
|
+
const env = config.environment ?? "sandbox" /* Sandbox */;
|
|
190
|
+
baseURL = getEnvironmentURL(env);
|
|
191
|
+
}
|
|
192
|
+
const timeout = config.timeout ?? 15e3;
|
|
193
|
+
if (timeout <= 0) {
|
|
194
|
+
throw new ConfigurationError("Timeout must be greater than zero");
|
|
195
|
+
}
|
|
196
|
+
const retryPolicy = {
|
|
197
|
+
maxAttempts: config.retryPolicy?.maxAttempts ?? DEFAULT_RETRY_POLICY.maxAttempts,
|
|
198
|
+
initialBackoffMs: config.retryPolicy?.initialBackoffMs ?? DEFAULT_RETRY_POLICY.initialBackoffMs,
|
|
199
|
+
maxBackoffMs: config.retryPolicy?.maxBackoffMs ?? DEFAULT_RETRY_POLICY.maxBackoffMs
|
|
200
|
+
};
|
|
201
|
+
if (retryPolicy.maxAttempts <= 0) {
|
|
202
|
+
throw new ConfigurationError("Retry max attempts must be greater than zero");
|
|
203
|
+
}
|
|
204
|
+
if (retryPolicy.initialBackoffMs <= 0) {
|
|
205
|
+
throw new ConfigurationError("Retry initial backoff must be greater than zero");
|
|
206
|
+
}
|
|
207
|
+
if (retryPolicy.maxBackoffMs <= 0) {
|
|
208
|
+
throw new ConfigurationError("Retry max backoff must be greater than zero");
|
|
209
|
+
}
|
|
210
|
+
if (retryPolicy.maxBackoffMs < retryPolicy.initialBackoffMs) {
|
|
211
|
+
throw new ConfigurationError("Retry max backoff must be >= initial backoff");
|
|
212
|
+
}
|
|
213
|
+
return {
|
|
214
|
+
apiKey: config.apiKey ?? null,
|
|
215
|
+
applicationToken: config.applicationToken ?? null,
|
|
216
|
+
baseURL,
|
|
217
|
+
authMode,
|
|
218
|
+
timeout,
|
|
219
|
+
retryPolicy,
|
|
220
|
+
logger: config.logger ?? noopLogger,
|
|
221
|
+
automaticIdempotency: config.automaticIdempotency ?? true,
|
|
222
|
+
idempotencyKeyGenerator: config.idempotencyKeyGenerator ?? generateUUID,
|
|
223
|
+
fetch: config.fetch ?? globalThis.fetch
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// src/client/transport.ts
|
|
228
|
+
var RETRYABLE_STATUS_CODES2 = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
|
|
229
|
+
var SAFE_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD", "PUT", "DELETE", "OPTIONS"]);
|
|
230
|
+
var Transport = class {
|
|
231
|
+
config;
|
|
232
|
+
constructor(config) {
|
|
233
|
+
this.config = config;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Make an HTTP request with automatic retry and error handling.
|
|
237
|
+
*/
|
|
238
|
+
async request(options) {
|
|
239
|
+
const { method, path, body, query, headers, idempotencyKey, signal } = options;
|
|
240
|
+
const url = this.buildURL(path, query);
|
|
241
|
+
const requestHeaders = this.buildHeaders(method, path, headers, idempotencyKey);
|
|
242
|
+
const requestBody = body !== void 0 ? JSON.stringify(body) : void 0;
|
|
243
|
+
return this.executeWithRetry(url, {
|
|
244
|
+
method,
|
|
245
|
+
headers: requestHeaders,
|
|
246
|
+
body: requestBody,
|
|
247
|
+
signal
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Build the full URL with query parameters.
|
|
252
|
+
*/
|
|
253
|
+
buildURL(path, query) {
|
|
254
|
+
const url = new URL(path, this.config.baseURL);
|
|
255
|
+
if (query) {
|
|
256
|
+
for (const [key, value] of Object.entries(query)) {
|
|
257
|
+
if (value !== void 0) {
|
|
258
|
+
url.searchParams.set(key, String(value));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return url.toString();
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Build request headers with authentication.
|
|
266
|
+
*/
|
|
267
|
+
buildHeaders(method, path, customHeaders, idempotencyKey) {
|
|
268
|
+
const headers = {
|
|
269
|
+
"Content-Type": "application/json",
|
|
270
|
+
Accept: "application/json",
|
|
271
|
+
"User-Agent": "dakota-ts-sdk/1.0.0",
|
|
272
|
+
...customHeaders
|
|
273
|
+
};
|
|
274
|
+
this.addAuthHeader(headers, path);
|
|
275
|
+
if (method === "POST") {
|
|
276
|
+
const key = idempotencyKey ?? (this.config.automaticIdempotency ? this.config.idempotencyKeyGenerator() : void 0);
|
|
277
|
+
if (key) {
|
|
278
|
+
headers["x-idempotency-key"] = key;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return headers;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Add authentication header based on auth mode and path.
|
|
285
|
+
*/
|
|
286
|
+
addAuthHeader(headers, path) {
|
|
287
|
+
if (headers["x-api-key"] || headers["x-application-token"]) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const { authMode, apiKey, applicationToken } = this.config;
|
|
291
|
+
switch (authMode) {
|
|
292
|
+
case "api_key" /* APIKey */:
|
|
293
|
+
if (apiKey) {
|
|
294
|
+
headers["x-api-key"] = apiKey;
|
|
295
|
+
}
|
|
296
|
+
break;
|
|
297
|
+
case "application_token" /* ApplicationToken */:
|
|
298
|
+
if (applicationToken) {
|
|
299
|
+
headers["x-application-token"] = applicationToken;
|
|
300
|
+
}
|
|
301
|
+
break;
|
|
302
|
+
case "auto" /* Auto */:
|
|
303
|
+
default:
|
|
304
|
+
if (path.startsWith("/applications") && applicationToken) {
|
|
305
|
+
headers["x-application-token"] = applicationToken;
|
|
306
|
+
} else if (apiKey) {
|
|
307
|
+
headers["x-api-key"] = apiKey;
|
|
308
|
+
} else if (applicationToken) {
|
|
309
|
+
headers["x-application-token"] = applicationToken;
|
|
310
|
+
}
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Execute request with exponential backoff retry.
|
|
316
|
+
*/
|
|
317
|
+
async executeWithRetry(url, init) {
|
|
318
|
+
const { maxAttempts, initialBackoffMs, maxBackoffMs } = this.config.retryPolicy;
|
|
319
|
+
const method = init.method ?? "GET";
|
|
320
|
+
let lastError;
|
|
321
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
322
|
+
try {
|
|
323
|
+
const controller = new AbortController();
|
|
324
|
+
const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
|
|
325
|
+
const signal = init.signal ? this.mergeAbortSignals(init.signal, controller.signal) : controller.signal;
|
|
326
|
+
this.logRequest(method, url, attempt);
|
|
327
|
+
const response = await this.config.fetch(url, {
|
|
328
|
+
...init,
|
|
329
|
+
signal
|
|
330
|
+
});
|
|
331
|
+
clearTimeout(timeoutId);
|
|
332
|
+
this.logResponse(method, url, response.status, attempt);
|
|
333
|
+
if (response.ok) {
|
|
334
|
+
if (response.status === 204) {
|
|
335
|
+
return void 0;
|
|
336
|
+
}
|
|
337
|
+
return await response.json();
|
|
338
|
+
}
|
|
339
|
+
const apiError = await APIError.fromResponse(response);
|
|
340
|
+
if (this.shouldRetry(response.status, method, init, attempt)) {
|
|
341
|
+
lastError = apiError;
|
|
342
|
+
const delay = this.calculateBackoff(attempt, response, initialBackoffMs, maxBackoffMs);
|
|
343
|
+
this.config.logger.warn(
|
|
344
|
+
`Request failed with ${response.status}, retrying in ${delay}ms (attempt ${attempt}/${maxAttempts})`
|
|
345
|
+
);
|
|
346
|
+
await this.sleep(delay);
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
throw apiError;
|
|
350
|
+
} catch (error) {
|
|
351
|
+
if (error instanceof APIError) {
|
|
352
|
+
throw error;
|
|
353
|
+
}
|
|
354
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
355
|
+
lastError = new TransportError("Request timed out", error);
|
|
356
|
+
} else if (error instanceof Error) {
|
|
357
|
+
lastError = new TransportError("Network error", error);
|
|
358
|
+
} else {
|
|
359
|
+
lastError = new TransportError("Unknown error");
|
|
360
|
+
}
|
|
361
|
+
if (this.shouldRetryNetworkError(method, init, attempt)) {
|
|
362
|
+
const delay = this.calculateBackoff(attempt, null, initialBackoffMs, maxBackoffMs);
|
|
363
|
+
this.config.logger.warn(
|
|
364
|
+
`Network error, retrying in ${delay}ms (attempt ${attempt}/${maxAttempts})`
|
|
365
|
+
);
|
|
366
|
+
await this.sleep(delay);
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
throw lastError;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
throw lastError ?? new TransportError("Request failed after all retries");
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Determine if a request should be retried based on status code.
|
|
376
|
+
*/
|
|
377
|
+
shouldRetry(status, method, init, attempt) {
|
|
378
|
+
if (attempt >= this.config.retryPolicy.maxAttempts) {
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
if (!RETRYABLE_STATUS_CODES2.has(status)) {
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
if (SAFE_METHODS.has(method)) {
|
|
385
|
+
return true;
|
|
386
|
+
}
|
|
387
|
+
if (method === "POST" && init.headers) {
|
|
388
|
+
const headers = init.headers;
|
|
389
|
+
return !!headers["x-idempotency-key"];
|
|
390
|
+
}
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Determine if a network error should be retried.
|
|
395
|
+
*/
|
|
396
|
+
shouldRetryNetworkError(method, init, attempt) {
|
|
397
|
+
if (attempt >= this.config.retryPolicy.maxAttempts) {
|
|
398
|
+
return false;
|
|
399
|
+
}
|
|
400
|
+
if (SAFE_METHODS.has(method)) {
|
|
401
|
+
return true;
|
|
402
|
+
}
|
|
403
|
+
if (method === "POST" && init.headers) {
|
|
404
|
+
const headers = init.headers;
|
|
405
|
+
return !!headers["x-idempotency-key"];
|
|
406
|
+
}
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Calculate backoff delay with jitter.
|
|
411
|
+
*/
|
|
412
|
+
calculateBackoff(attempt, response, initialBackoffMs, maxBackoffMs) {
|
|
413
|
+
if (response) {
|
|
414
|
+
const retryAfter = response.headers.get("retry-after");
|
|
415
|
+
if (retryAfter) {
|
|
416
|
+
const seconds = parseInt(retryAfter, 10);
|
|
417
|
+
if (!isNaN(seconds)) {
|
|
418
|
+
return seconds * 1e3;
|
|
419
|
+
}
|
|
420
|
+
const date = Date.parse(retryAfter);
|
|
421
|
+
if (!isNaN(date)) {
|
|
422
|
+
return Math.max(0, date - Date.now());
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
const exponentialDelay = initialBackoffMs * Math.pow(2, attempt - 1);
|
|
427
|
+
const cappedDelay = Math.min(exponentialDelay, maxBackoffMs);
|
|
428
|
+
const jitter = cappedDelay * 0.2 * (Math.random() * 2 - 1);
|
|
429
|
+
return Math.round(cappedDelay + jitter);
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Merge multiple abort signals.
|
|
433
|
+
*/
|
|
434
|
+
mergeAbortSignals(signal1, signal2) {
|
|
435
|
+
const controller = new AbortController();
|
|
436
|
+
const abort = () => controller.abort();
|
|
437
|
+
signal1.addEventListener("abort", abort);
|
|
438
|
+
signal2.addEventListener("abort", abort);
|
|
439
|
+
if (signal1.aborted || signal2.aborted) {
|
|
440
|
+
controller.abort();
|
|
441
|
+
}
|
|
442
|
+
return controller.signal;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Sleep for the specified duration.
|
|
446
|
+
*/
|
|
447
|
+
sleep(ms) {
|
|
448
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Log outgoing request.
|
|
452
|
+
*/
|
|
453
|
+
logRequest(method, url, attempt) {
|
|
454
|
+
this.config.logger.debug(
|
|
455
|
+
`Request: ${method} ${url}${attempt > 1 ? ` (attempt ${attempt})` : ""}`
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Log response.
|
|
460
|
+
*/
|
|
461
|
+
logResponse(method, url, status, attempt) {
|
|
462
|
+
this.config.logger.debug(
|
|
463
|
+
`Response: ${method} ${url} -> ${status}${attempt > 1 ? ` (attempt ${attempt})` : ""}`
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
// src/client/pagination.ts
|
|
469
|
+
function defaultCursorExtractor(item) {
|
|
470
|
+
if (!item.id) {
|
|
471
|
+
throw new Error("Item does not have an id field for cursor extraction");
|
|
472
|
+
}
|
|
473
|
+
return item.id;
|
|
474
|
+
}
|
|
475
|
+
var PaginatedIterator = class {
|
|
476
|
+
fetcher;
|
|
477
|
+
cursorExtractor;
|
|
478
|
+
cursor;
|
|
479
|
+
buffer = [];
|
|
480
|
+
hasMore = true;
|
|
481
|
+
started = false;
|
|
482
|
+
constructor(fetcher, cursorExtractor) {
|
|
483
|
+
this.fetcher = fetcher;
|
|
484
|
+
this.cursorExtractor = cursorExtractor ?? defaultCursorExtractor;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Implement async iterator protocol.
|
|
488
|
+
*/
|
|
489
|
+
[Symbol.asyncIterator]() {
|
|
490
|
+
return {
|
|
491
|
+
next: async () => {
|
|
492
|
+
const item = await this.next();
|
|
493
|
+
if (item === null) {
|
|
494
|
+
return { done: true, value: void 0 };
|
|
495
|
+
}
|
|
496
|
+
return { done: false, value: item };
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Get the next item, or null if no more items.
|
|
502
|
+
*/
|
|
503
|
+
async next() {
|
|
504
|
+
if (this.buffer.length > 0) {
|
|
505
|
+
return this.buffer.shift();
|
|
506
|
+
}
|
|
507
|
+
if (!this.hasMore && this.started) {
|
|
508
|
+
return null;
|
|
509
|
+
}
|
|
510
|
+
await this.fetchNextPage();
|
|
511
|
+
if (this.buffer.length > 0) {
|
|
512
|
+
return this.buffer.shift();
|
|
513
|
+
}
|
|
514
|
+
return null;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Collect all items into an array.
|
|
518
|
+
*/
|
|
519
|
+
async toArray() {
|
|
520
|
+
const items = [];
|
|
521
|
+
for await (const item of this) {
|
|
522
|
+
items.push(item);
|
|
523
|
+
}
|
|
524
|
+
return items;
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Get the first item, or null if none.
|
|
528
|
+
*/
|
|
529
|
+
async first() {
|
|
530
|
+
return this.next();
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Fetch the next page of results.
|
|
534
|
+
*/
|
|
535
|
+
async fetchNextPage() {
|
|
536
|
+
this.started = true;
|
|
537
|
+
const response = await this.fetcher(this.cursor);
|
|
538
|
+
this.buffer = response.data ?? [];
|
|
539
|
+
if (this.buffer.length > 0) {
|
|
540
|
+
const lastItem = this.buffer[this.buffer.length - 1];
|
|
541
|
+
if (lastItem) {
|
|
542
|
+
this.cursor = this.cursorExtractor(lastItem);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
this.hasMore = response.meta?.has_more_after ?? false;
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
function paginate(fetcher, cursorExtractor) {
|
|
549
|
+
return new PaginatedIterator(fetcher, cursorExtractor);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
// src/client/resources/base.ts
|
|
553
|
+
var BaseResource = class {
|
|
554
|
+
transport;
|
|
555
|
+
constructor(transport) {
|
|
556
|
+
this.transport = transport;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Create a paginated iterator for a list endpoint.
|
|
560
|
+
*/
|
|
561
|
+
paginate(path, params, cursorExtractor) {
|
|
562
|
+
const fetcher = async (cursor) => {
|
|
563
|
+
const query = {};
|
|
564
|
+
if (params) {
|
|
565
|
+
for (const [key, value] of Object.entries(params)) {
|
|
566
|
+
if (value !== void 0) {
|
|
567
|
+
query[key] = value;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
if (cursor) {
|
|
572
|
+
query.starting_after = cursor;
|
|
573
|
+
}
|
|
574
|
+
const response = await this.transport.request({
|
|
575
|
+
method: "GET",
|
|
576
|
+
path,
|
|
577
|
+
query
|
|
578
|
+
});
|
|
579
|
+
return {
|
|
580
|
+
data: response.data ?? [],
|
|
581
|
+
meta: response.meta
|
|
582
|
+
};
|
|
583
|
+
};
|
|
584
|
+
return paginate(fetcher, cursorExtractor);
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
// src/client/resources/customers.ts
|
|
589
|
+
var CustomersResource = class extends BaseResource {
|
|
590
|
+
/**
|
|
591
|
+
* Create a new customer.
|
|
592
|
+
*
|
|
593
|
+
* Creates a customer record and initiates KYB onboarding.
|
|
594
|
+
* Returns a URL where the customer can complete verification.
|
|
595
|
+
*
|
|
596
|
+
* @param data - Customer creation data
|
|
597
|
+
* @returns Created customer with KYB onboarding URL
|
|
598
|
+
*
|
|
599
|
+
* @example
|
|
600
|
+
* ```typescript
|
|
601
|
+
* const customer = await client.customers.create({
|
|
602
|
+
* name: 'Acme Corp',
|
|
603
|
+
* customerType: 'business',
|
|
604
|
+
* externalId: 'your-internal-id',
|
|
605
|
+
* });
|
|
606
|
+
* console.log(customer.applicationUrl); // KYB onboarding URL
|
|
607
|
+
* ```
|
|
608
|
+
*/
|
|
609
|
+
async create(data) {
|
|
610
|
+
return this.transport.request({
|
|
611
|
+
method: "POST",
|
|
612
|
+
path: "/customers",
|
|
613
|
+
body: data
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* List all customers.
|
|
618
|
+
*
|
|
619
|
+
* Returns a paginated async iterator over customer records.
|
|
620
|
+
*
|
|
621
|
+
* @param params - Optional filter and pagination parameters
|
|
622
|
+
* @returns Async iterator of customers
|
|
623
|
+
*
|
|
624
|
+
* @example
|
|
625
|
+
* ```typescript
|
|
626
|
+
* // Iterate through all customers
|
|
627
|
+
* for await (const customer of client.customers.list()) {
|
|
628
|
+
* console.log(customer.name);
|
|
629
|
+
* }
|
|
630
|
+
*
|
|
631
|
+
* // With filters
|
|
632
|
+
* const active = client.customers.list({ kyb_status: 'active' });
|
|
633
|
+
*
|
|
634
|
+
* // Collect all to array
|
|
635
|
+
* const all = await client.customers.list().toArray();
|
|
636
|
+
* ```
|
|
637
|
+
*/
|
|
638
|
+
list(params) {
|
|
639
|
+
return this.paginate("/customers", params);
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Get a customer by ID.
|
|
643
|
+
*
|
|
644
|
+
* @param customerId - Customer ID (KSUID)
|
|
645
|
+
* @returns Customer record
|
|
646
|
+
*
|
|
647
|
+
* @example
|
|
648
|
+
* ```typescript
|
|
649
|
+
* const customer = await client.customers.get('cust_abc123');
|
|
650
|
+
* console.log(customer.kybStatus);
|
|
651
|
+
* ```
|
|
652
|
+
*/
|
|
653
|
+
async get(customerId) {
|
|
654
|
+
return this.transport.request({
|
|
655
|
+
method: "GET",
|
|
656
|
+
path: `/customers/${customerId}`
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
// src/client/resources/recipients.ts
|
|
662
|
+
var RecipientsResource = class extends BaseResource {
|
|
663
|
+
/**
|
|
664
|
+
* Create a new recipient for a customer.
|
|
665
|
+
*
|
|
666
|
+
* Recipients represent entities that can receive payments.
|
|
667
|
+
*
|
|
668
|
+
* @param customerId - Customer ID
|
|
669
|
+
* @param data - Recipient creation data
|
|
670
|
+
* @returns Created recipient
|
|
671
|
+
*
|
|
672
|
+
* @example
|
|
673
|
+
* ```typescript
|
|
674
|
+
* const recipient = await client.recipients.create(customerId, {
|
|
675
|
+
* name: 'Treasury Account',
|
|
676
|
+
* });
|
|
677
|
+
* ```
|
|
678
|
+
*/
|
|
679
|
+
async create(customerId, data) {
|
|
680
|
+
return this.transport.request({
|
|
681
|
+
method: "POST",
|
|
682
|
+
path: `/customers/${customerId}/recipients`,
|
|
683
|
+
body: data
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* List recipients for a customer.
|
|
688
|
+
*
|
|
689
|
+
* @param customerId - Customer ID
|
|
690
|
+
* @param params - Pagination parameters
|
|
691
|
+
* @returns Async iterator of recipients
|
|
692
|
+
*
|
|
693
|
+
* @example
|
|
694
|
+
* ```typescript
|
|
695
|
+
* for await (const recipient of client.recipients.list(customerId)) {
|
|
696
|
+
* console.log(recipient.name);
|
|
697
|
+
* }
|
|
698
|
+
* ```
|
|
699
|
+
*/
|
|
700
|
+
list(customerId, params) {
|
|
701
|
+
return this.paginate(`/customers/${customerId}/recipients`, params);
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Get a recipient by ID.
|
|
705
|
+
*
|
|
706
|
+
* @param recipientId - Recipient ID
|
|
707
|
+
* @returns Recipient record
|
|
708
|
+
*
|
|
709
|
+
* @example
|
|
710
|
+
* ```typescript
|
|
711
|
+
* const recipient = await client.recipients.get(recipientId);
|
|
712
|
+
* ```
|
|
713
|
+
*/
|
|
714
|
+
async get(recipientId) {
|
|
715
|
+
return this.transport.request({
|
|
716
|
+
method: "GET",
|
|
717
|
+
path: `/recipients/${recipientId}`
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Update a recipient.
|
|
722
|
+
*
|
|
723
|
+
* @param recipientId - Recipient ID
|
|
724
|
+
* @param data - Update data
|
|
725
|
+
* @returns Updated recipient
|
|
726
|
+
*
|
|
727
|
+
* @example
|
|
728
|
+
* ```typescript
|
|
729
|
+
* const recipient = await client.recipients.update(recipientId, {
|
|
730
|
+
* name: 'Updated Name',
|
|
731
|
+
* });
|
|
732
|
+
* ```
|
|
733
|
+
*/
|
|
734
|
+
async update(recipientId, data) {
|
|
735
|
+
return this.transport.request({
|
|
736
|
+
method: "PUT",
|
|
737
|
+
path: `/recipients/${recipientId}`,
|
|
738
|
+
body: data
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
|
|
743
|
+
// src/client/resources/destinations.ts
|
|
744
|
+
var DestinationsResource = class extends BaseResource {
|
|
745
|
+
/**
|
|
746
|
+
* Create a new destination for a recipient.
|
|
747
|
+
*
|
|
748
|
+
* Destinations can be bank accounts (fiat_us) or crypto wallets (crypto).
|
|
749
|
+
*
|
|
750
|
+
* @param recipientId - Recipient ID
|
|
751
|
+
* @param data - Destination creation data
|
|
752
|
+
* @returns Created destination
|
|
753
|
+
*
|
|
754
|
+
* @example
|
|
755
|
+
* ```typescript
|
|
756
|
+
* // Create a bank destination (for off-ramp)
|
|
757
|
+
* const bankDest = await client.destinations.create(recipientId, {
|
|
758
|
+
* destination_type: 'fiat_us',
|
|
759
|
+
* bank_name: 'Chase Bank',
|
|
760
|
+
* account_holder_name: 'Acme Corp',
|
|
761
|
+
* account_number: '123456789',
|
|
762
|
+
* routing_number: '021000021',
|
|
763
|
+
* account_type: 'checking',
|
|
764
|
+
* });
|
|
765
|
+
*
|
|
766
|
+
* // Create a crypto destination (for on-ramp)
|
|
767
|
+
* const cryptoDest = await client.destinations.create(recipientId, {
|
|
768
|
+
* destination_type: 'crypto',
|
|
769
|
+
* crypto_address: '0x742d35Cc6634C0532925a3b844Bc9e7595f...',
|
|
770
|
+
* network_id: 'ethereum-mainnet',
|
|
771
|
+
* });
|
|
772
|
+
* ```
|
|
773
|
+
*/
|
|
774
|
+
async create(recipientId, data) {
|
|
775
|
+
return this.transport.request({
|
|
776
|
+
method: "POST",
|
|
777
|
+
path: `/recipients/${recipientId}/destinations`,
|
|
778
|
+
body: data
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* List destinations for a recipient.
|
|
783
|
+
*
|
|
784
|
+
* @param recipientId - Recipient ID
|
|
785
|
+
* @param params - Pagination parameters
|
|
786
|
+
* @returns Async iterator of destinations
|
|
787
|
+
*
|
|
788
|
+
* @example
|
|
789
|
+
* ```typescript
|
|
790
|
+
* for await (const dest of client.destinations.list(recipientId)) {
|
|
791
|
+
* console.log(dest);
|
|
792
|
+
* }
|
|
793
|
+
* ```
|
|
794
|
+
*/
|
|
795
|
+
list(recipientId, params) {
|
|
796
|
+
return this.paginate(
|
|
797
|
+
`/recipients/${recipientId}/destinations`,
|
|
798
|
+
params,
|
|
799
|
+
(item) => item.destination_id
|
|
800
|
+
);
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
// src/client/resources/accounts.ts
|
|
805
|
+
var AccountsResource = class extends BaseResource {
|
|
806
|
+
/**
|
|
807
|
+
* Create a new account.
|
|
808
|
+
*
|
|
809
|
+
* Accounts define the flow of funds:
|
|
810
|
+
* - **onramp**: USD → crypto (customer sends USD, receives stablecoin)
|
|
811
|
+
* - **offramp**: crypto → USD (customer sends stablecoin, receives USD)
|
|
812
|
+
* - **swap**: crypto → crypto (stablecoin conversion)
|
|
813
|
+
*
|
|
814
|
+
* @param data - Account creation data
|
|
815
|
+
* @returns Created account
|
|
816
|
+
*
|
|
817
|
+
* @example
|
|
818
|
+
* ```typescript
|
|
819
|
+
* // Create an off-ramp account (crypto → USD)
|
|
820
|
+
* const offramp = await client.accounts.create({
|
|
821
|
+
* account_type: 'offramp',
|
|
822
|
+
* customer_id: customerId,
|
|
823
|
+
* fiat_destination_id: bankDestinationId,
|
|
824
|
+
* asset: 'USDC',
|
|
825
|
+
* network_id: 'ethereum-mainnet',
|
|
826
|
+
* rail: 'ach',
|
|
827
|
+
* capabilities: ['ach'],
|
|
828
|
+
* });
|
|
829
|
+
* // Returns: { crypto_address: '0x...' } - customer sends USDC here
|
|
830
|
+
*
|
|
831
|
+
* // Create an on-ramp account (USD → crypto)
|
|
832
|
+
* const onramp = await client.accounts.create({
|
|
833
|
+
* account_type: 'onramp',
|
|
834
|
+
* customer_id: customerId,
|
|
835
|
+
* crypto_destination_id: cryptoDestinationId,
|
|
836
|
+
* asset: 'USDC',
|
|
837
|
+
* network_id: 'ethereum-mainnet',
|
|
838
|
+
* rail: 'ach',
|
|
839
|
+
* capabilities: ['ach'],
|
|
840
|
+
* });
|
|
841
|
+
* // Returns: { bank_account: { bank_name, aba_routing_number, account_number } } - customer sends USD here
|
|
842
|
+
* ```
|
|
843
|
+
*/
|
|
844
|
+
async create(data) {
|
|
845
|
+
return this.transport.request({
|
|
846
|
+
method: "POST",
|
|
847
|
+
path: "/accounts",
|
|
848
|
+
body: data
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* List accounts.
|
|
853
|
+
*
|
|
854
|
+
* @param params - Filter and pagination parameters
|
|
855
|
+
* @returns Async iterator of accounts
|
|
856
|
+
*
|
|
857
|
+
* @example
|
|
858
|
+
* ```typescript
|
|
859
|
+
* // List all accounts
|
|
860
|
+
* for await (const account of client.accounts.list()) {
|
|
861
|
+
* console.log(account);
|
|
862
|
+
* }
|
|
863
|
+
*
|
|
864
|
+
* // Filter by customer
|
|
865
|
+
* const customerAccounts = client.accounts.list({ customer_id: customerId });
|
|
866
|
+
* ```
|
|
867
|
+
*/
|
|
868
|
+
list(params) {
|
|
869
|
+
return this.paginate("/accounts", params);
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Get an account by ID.
|
|
873
|
+
*
|
|
874
|
+
* @param accountId - Account ID
|
|
875
|
+
* @returns Account record
|
|
876
|
+
*
|
|
877
|
+
* @example
|
|
878
|
+
* ```typescript
|
|
879
|
+
* const account = await client.accounts.get(accountId);
|
|
880
|
+
* ```
|
|
881
|
+
*/
|
|
882
|
+
async get(accountId) {
|
|
883
|
+
return this.transport.request({
|
|
884
|
+
method: "GET",
|
|
885
|
+
path: `/accounts/${accountId}`
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Update an account.
|
|
890
|
+
*
|
|
891
|
+
* @param accountId - Account ID
|
|
892
|
+
* @param data - Update data
|
|
893
|
+
* @returns Updated account
|
|
894
|
+
*
|
|
895
|
+
* @example
|
|
896
|
+
* ```typescript
|
|
897
|
+
* const account = await client.accounts.update(accountId, {
|
|
898
|
+
* status: 'inactive',
|
|
899
|
+
* });
|
|
900
|
+
* ```
|
|
901
|
+
*/
|
|
902
|
+
async update(accountId, data) {
|
|
903
|
+
return this.transport.request({
|
|
904
|
+
method: "PATCH",
|
|
905
|
+
path: `/accounts/${accountId}`,
|
|
906
|
+
body: data
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
};
|
|
910
|
+
|
|
911
|
+
// src/client/resources/transactions.ts
|
|
912
|
+
var TransactionsResource = class extends BaseResource {
|
|
913
|
+
/**
|
|
914
|
+
* Create a one-off transaction.
|
|
915
|
+
*
|
|
916
|
+
* One-off transactions allow single transfers without setting up accounts.
|
|
917
|
+
*
|
|
918
|
+
* @param data - Transaction creation data
|
|
919
|
+
* @returns Created transaction
|
|
920
|
+
*
|
|
921
|
+
* @example
|
|
922
|
+
* ```typescript
|
|
923
|
+
* const tx = await client.transactions.create({
|
|
924
|
+
* customer_id: customerId,
|
|
925
|
+
* amount: '1000.00',
|
|
926
|
+
* source_asset: 'USDC',
|
|
927
|
+
* source_network_id: 'ethereum-mainnet',
|
|
928
|
+
* destination_id: destinationId,
|
|
929
|
+
* destination_asset: 'USD',
|
|
930
|
+
* destination_payment_rail: 'ach',
|
|
931
|
+
* payment_reference: 'Invoice #12345',
|
|
932
|
+
* });
|
|
933
|
+
*
|
|
934
|
+
* console.log(tx.crypto_address); // Send USDC here
|
|
935
|
+
* console.log(tx.status); // Transaction status
|
|
936
|
+
* ```
|
|
937
|
+
*/
|
|
938
|
+
async create(data) {
|
|
939
|
+
return this.transport.request({
|
|
940
|
+
method: "POST",
|
|
941
|
+
path: "/transactions",
|
|
942
|
+
body: data
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* List one-off transactions.
|
|
947
|
+
*
|
|
948
|
+
* @param params - Filter and pagination parameters
|
|
949
|
+
* @returns Async iterator of transactions
|
|
950
|
+
*
|
|
951
|
+
* @example
|
|
952
|
+
* ```typescript
|
|
953
|
+
* // List all transactions
|
|
954
|
+
* for await (const tx of client.transactions.list()) {
|
|
955
|
+
* console.log(tx.id, tx.status);
|
|
956
|
+
* }
|
|
957
|
+
*
|
|
958
|
+
* // Filter by customer and status
|
|
959
|
+
* const completed = client.transactions.list({
|
|
960
|
+
* customer_id: customerId,
|
|
961
|
+
* status: 'completed',
|
|
962
|
+
* });
|
|
963
|
+
* ```
|
|
964
|
+
*/
|
|
965
|
+
list(params) {
|
|
966
|
+
return this.paginate("/transactions", params);
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Get a transaction by ID.
|
|
970
|
+
*
|
|
971
|
+
* @param transactionId - Transaction ID
|
|
972
|
+
* @returns Transaction record
|
|
973
|
+
*
|
|
974
|
+
* @example
|
|
975
|
+
* ```typescript
|
|
976
|
+
* const tx = await client.transactions.get(transactionId);
|
|
977
|
+
* console.log(tx.status);
|
|
978
|
+
* ```
|
|
979
|
+
*/
|
|
980
|
+
async get(transactionId) {
|
|
981
|
+
return this.transport.request({
|
|
982
|
+
method: "GET",
|
|
983
|
+
path: `/transactions/${transactionId}`
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Cancel a transaction.
|
|
988
|
+
*
|
|
989
|
+
* Only pending transactions can be cancelled.
|
|
990
|
+
*
|
|
991
|
+
* @param transactionId - Transaction ID
|
|
992
|
+
* @returns Cancelled transaction
|
|
993
|
+
*
|
|
994
|
+
* @example
|
|
995
|
+
* ```typescript
|
|
996
|
+
* const tx = await client.transactions.cancel(transactionId);
|
|
997
|
+
* console.log(tx.status); // 'cancelled'
|
|
998
|
+
* ```
|
|
999
|
+
*/
|
|
1000
|
+
async cancel(transactionId) {
|
|
1001
|
+
return this.transport.request({
|
|
1002
|
+
method: "POST",
|
|
1003
|
+
path: `/transactions/${transactionId}/cancellations`
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
};
|
|
1007
|
+
var AutoTransactionsResource = class extends BaseResource {
|
|
1008
|
+
/**
|
|
1009
|
+
* List auto transactions.
|
|
1010
|
+
*
|
|
1011
|
+
* @param params - Pagination parameters
|
|
1012
|
+
* @returns Async iterator of auto transactions
|
|
1013
|
+
*/
|
|
1014
|
+
list(params) {
|
|
1015
|
+
return this.paginate("/auto-transactions", params);
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Get an auto transaction by ID.
|
|
1019
|
+
*
|
|
1020
|
+
* @param transactionId - Auto transaction ID
|
|
1021
|
+
* @returns Auto transaction record
|
|
1022
|
+
*/
|
|
1023
|
+
async get(transactionId) {
|
|
1024
|
+
return this.transport.request({
|
|
1025
|
+
method: "GET",
|
|
1026
|
+
path: `/auto-transactions/${transactionId}`
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
// src/client/resources/wallets.ts
|
|
1032
|
+
var WalletsResource = class extends BaseResource {
|
|
1033
|
+
/**
|
|
1034
|
+
* Create a new wallet.
|
|
1035
|
+
*
|
|
1036
|
+
* Creates a non-custodial multi-sig wallet for a customer.
|
|
1037
|
+
*
|
|
1038
|
+
* @param data - Wallet creation data
|
|
1039
|
+
* @returns Created wallet
|
|
1040
|
+
*
|
|
1041
|
+
* @example
|
|
1042
|
+
* ```typescript
|
|
1043
|
+
* const wallet = await client.wallets.create({
|
|
1044
|
+
* customer_id: customerId,
|
|
1045
|
+
* family: 'evm',
|
|
1046
|
+
* name: 'Treasury Wallet',
|
|
1047
|
+
* });
|
|
1048
|
+
* console.log(wallet.address);
|
|
1049
|
+
* ```
|
|
1050
|
+
*/
|
|
1051
|
+
async create(data) {
|
|
1052
|
+
return this.transport.request({
|
|
1053
|
+
method: "POST",
|
|
1054
|
+
path: "/wallets",
|
|
1055
|
+
body: data
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Get wallet balances.
|
|
1060
|
+
*
|
|
1061
|
+
* @param walletId - Wallet ID
|
|
1062
|
+
* @returns Array of balances
|
|
1063
|
+
*
|
|
1064
|
+
* @example
|
|
1065
|
+
* ```typescript
|
|
1066
|
+
* const balances = await client.wallets.getBalances(walletId);
|
|
1067
|
+
* for (const balance of balances) {
|
|
1068
|
+
* console.log(balance.asset, balance.amount);
|
|
1069
|
+
* }
|
|
1070
|
+
* ```
|
|
1071
|
+
*/
|
|
1072
|
+
async getBalances(walletId) {
|
|
1073
|
+
const response = await this.transport.request({
|
|
1074
|
+
method: "GET",
|
|
1075
|
+
path: `/wallets/${walletId}/balances`
|
|
1076
|
+
});
|
|
1077
|
+
return response.data;
|
|
1078
|
+
}
|
|
1079
|
+
/**
|
|
1080
|
+
* Create a wallet transaction.
|
|
1081
|
+
*
|
|
1082
|
+
* @param walletId - Wallet ID
|
|
1083
|
+
* @param data - Transaction data
|
|
1084
|
+
* @returns Created transaction
|
|
1085
|
+
*
|
|
1086
|
+
* @example
|
|
1087
|
+
* ```typescript
|
|
1088
|
+
* const tx = await client.wallets.createTransaction(walletId, {
|
|
1089
|
+
* to: '0x...',
|
|
1090
|
+
* amount: '100.00',
|
|
1091
|
+
* asset: 'USDC',
|
|
1092
|
+
* network_id: 'ethereum-mainnet',
|
|
1093
|
+
* });
|
|
1094
|
+
* ```
|
|
1095
|
+
*/
|
|
1096
|
+
async createTransaction(walletId, data) {
|
|
1097
|
+
return this.transport.request({
|
|
1098
|
+
method: "POST",
|
|
1099
|
+
path: `/wallets/${walletId}/transactions`,
|
|
1100
|
+
body: data
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
};
|
|
1104
|
+
|
|
1105
|
+
// src/client/resources/events.ts
|
|
1106
|
+
var EventsResource = class extends BaseResource {
|
|
1107
|
+
/**
|
|
1108
|
+
* List events.
|
|
1109
|
+
*
|
|
1110
|
+
* Events track all platform activity and can be used for audit trails.
|
|
1111
|
+
*
|
|
1112
|
+
* @param params - Filter and pagination parameters
|
|
1113
|
+
* @returns Async iterator of events
|
|
1114
|
+
*
|
|
1115
|
+
* @example
|
|
1116
|
+
* ```typescript
|
|
1117
|
+
* for await (const event of client.events.list()) {
|
|
1118
|
+
* console.log(event.type, event.data);
|
|
1119
|
+
* }
|
|
1120
|
+
*
|
|
1121
|
+
* // Filter by event type
|
|
1122
|
+
* const customerEvents = client.events.list({
|
|
1123
|
+
* event_type: 'customer.created',
|
|
1124
|
+
* });
|
|
1125
|
+
* ```
|
|
1126
|
+
*/
|
|
1127
|
+
list(params) {
|
|
1128
|
+
return this.paginate("/events", params);
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Get an event by ID.
|
|
1132
|
+
*
|
|
1133
|
+
* @param eventId - Event ID
|
|
1134
|
+
* @returns Event record
|
|
1135
|
+
*
|
|
1136
|
+
* @example
|
|
1137
|
+
* ```typescript
|
|
1138
|
+
* const event = await client.events.get(eventId);
|
|
1139
|
+
* ```
|
|
1140
|
+
*/
|
|
1141
|
+
async get(eventId) {
|
|
1142
|
+
return this.transport.request({
|
|
1143
|
+
method: "GET",
|
|
1144
|
+
path: `/events/${eventId}`
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
};
|
|
1148
|
+
|
|
1149
|
+
// src/client/resources/applications.ts
|
|
1150
|
+
var ApplicationsResource = class extends BaseResource {
|
|
1151
|
+
/**
|
|
1152
|
+
* List applications.
|
|
1153
|
+
*
|
|
1154
|
+
* @param params - Pagination parameters
|
|
1155
|
+
* @returns Async iterator of applications
|
|
1156
|
+
*/
|
|
1157
|
+
list(params) {
|
|
1158
|
+
return this.paginate("/applications", params);
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Get an application by ID.
|
|
1162
|
+
*
|
|
1163
|
+
* @param applicationId - Application ID
|
|
1164
|
+
* @returns Application record
|
|
1165
|
+
*/
|
|
1166
|
+
async get(applicationId) {
|
|
1167
|
+
return this.transport.request({
|
|
1168
|
+
method: "GET",
|
|
1169
|
+
path: `/applications/${applicationId}`
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* Submit an application for review.
|
|
1174
|
+
*
|
|
1175
|
+
* @param applicationId - Application ID
|
|
1176
|
+
* @param data - Submission data
|
|
1177
|
+
* @returns Submitted application
|
|
1178
|
+
*/
|
|
1179
|
+
async submit(applicationId, data) {
|
|
1180
|
+
return this.transport.request({
|
|
1181
|
+
method: "POST",
|
|
1182
|
+
path: `/applications/${applicationId}/submissions`,
|
|
1183
|
+
body: data ?? {}
|
|
1184
|
+
});
|
|
1185
|
+
}
|
|
1186
|
+
/**
|
|
1187
|
+
* List associated individuals for an application.
|
|
1188
|
+
*
|
|
1189
|
+
* @param applicationId - Application ID
|
|
1190
|
+
* @param params - Pagination parameters
|
|
1191
|
+
* @returns Async iterator of individuals
|
|
1192
|
+
*/
|
|
1193
|
+
listIndividuals(applicationId, params) {
|
|
1194
|
+
return this.paginate(
|
|
1195
|
+
`/applications/${applicationId}/associated-individuals`,
|
|
1196
|
+
params
|
|
1197
|
+
);
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* Add an associated individual to an application.
|
|
1201
|
+
*
|
|
1202
|
+
* @param applicationId - Application ID
|
|
1203
|
+
* @param data - Individual data
|
|
1204
|
+
* @returns Created individual
|
|
1205
|
+
*/
|
|
1206
|
+
async addIndividual(applicationId, data) {
|
|
1207
|
+
return this.transport.request({
|
|
1208
|
+
method: "POST",
|
|
1209
|
+
path: `/applications/${applicationId}/associated-individuals`,
|
|
1210
|
+
body: data
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* Get an associated individual.
|
|
1215
|
+
*
|
|
1216
|
+
* @param applicationId - Application ID
|
|
1217
|
+
* @param individualId - Individual ID
|
|
1218
|
+
* @returns Individual record
|
|
1219
|
+
*/
|
|
1220
|
+
async getIndividual(applicationId, individualId) {
|
|
1221
|
+
return this.transport.request({
|
|
1222
|
+
method: "GET",
|
|
1223
|
+
path: `/applications/${applicationId}/associated-individuals/${individualId}`
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* Update an associated individual.
|
|
1228
|
+
*
|
|
1229
|
+
* @param applicationId - Application ID
|
|
1230
|
+
* @param individualId - Individual ID
|
|
1231
|
+
* @param data - Update data
|
|
1232
|
+
* @returns Updated individual
|
|
1233
|
+
*/
|
|
1234
|
+
async updateIndividual(applicationId, individualId, data) {
|
|
1235
|
+
return this.transport.request({
|
|
1236
|
+
method: "PATCH",
|
|
1237
|
+
path: `/applications/${applicationId}/associated-individuals/${individualId}`,
|
|
1238
|
+
body: data
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Delete an associated individual.
|
|
1243
|
+
*
|
|
1244
|
+
* @param applicationId - Application ID
|
|
1245
|
+
* @param individualId - Individual ID
|
|
1246
|
+
*/
|
|
1247
|
+
async deleteIndividual(applicationId, individualId) {
|
|
1248
|
+
await this.transport.request({
|
|
1249
|
+
method: "DELETE",
|
|
1250
|
+
path: `/applications/${applicationId}/associated-individuals/${individualId}`
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
/**
|
|
1254
|
+
* Update business details for an application.
|
|
1255
|
+
*
|
|
1256
|
+
* @param applicationId - Application ID
|
|
1257
|
+
* @param data - Business details
|
|
1258
|
+
* @returns Updated application
|
|
1259
|
+
*/
|
|
1260
|
+
async updateBusinessDetails(applicationId, data) {
|
|
1261
|
+
return this.transport.request({
|
|
1262
|
+
method: "PATCH",
|
|
1263
|
+
path: `/applications/${applicationId}/business-details`,
|
|
1264
|
+
body: data
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* Get document upload URL for an application.
|
|
1269
|
+
*
|
|
1270
|
+
* @param applicationId - Application ID
|
|
1271
|
+
* @param data - Document metadata
|
|
1272
|
+
* @returns Upload URL and document ID
|
|
1273
|
+
*/
|
|
1274
|
+
async getDocumentUploadUrl(applicationId, data) {
|
|
1275
|
+
return this.transport.request({
|
|
1276
|
+
method: "POST",
|
|
1277
|
+
path: `/applications/${applicationId}/document-uploads`,
|
|
1278
|
+
body: data
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
};
|
|
1282
|
+
|
|
1283
|
+
// src/client/resources/policies.ts
|
|
1284
|
+
var PoliciesResource = class extends BaseResource {
|
|
1285
|
+
/**
|
|
1286
|
+
* Create a new policy.
|
|
1287
|
+
*
|
|
1288
|
+
* @param data - Policy creation data
|
|
1289
|
+
* @returns Created policy
|
|
1290
|
+
*/
|
|
1291
|
+
async create(data) {
|
|
1292
|
+
return this.transport.request({
|
|
1293
|
+
method: "POST",
|
|
1294
|
+
path: "/policies",
|
|
1295
|
+
body: data
|
|
1296
|
+
});
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* List policies.
|
|
1300
|
+
*
|
|
1301
|
+
* @param params - Pagination parameters
|
|
1302
|
+
* @returns Async iterator of policies
|
|
1303
|
+
*/
|
|
1304
|
+
list(params) {
|
|
1305
|
+
return this.paginate("/policies", params);
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* Get a policy by ID.
|
|
1309
|
+
*
|
|
1310
|
+
* @param policyId - Policy ID
|
|
1311
|
+
* @returns Policy record
|
|
1312
|
+
*/
|
|
1313
|
+
async get(policyId) {
|
|
1314
|
+
return this.transport.request({
|
|
1315
|
+
method: "GET",
|
|
1316
|
+
path: `/policies/${policyId}`
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Delete a policy.
|
|
1321
|
+
*
|
|
1322
|
+
* @param policyId - Policy ID
|
|
1323
|
+
*/
|
|
1324
|
+
async delete(policyId) {
|
|
1325
|
+
await this.transport.request({
|
|
1326
|
+
method: "DELETE",
|
|
1327
|
+
path: `/policies/${policyId}`
|
|
1328
|
+
});
|
|
1329
|
+
}
|
|
1330
|
+
/**
|
|
1331
|
+
* Add a rule to a policy.
|
|
1332
|
+
*
|
|
1333
|
+
* @param policyId - Policy ID
|
|
1334
|
+
* @param data - Rule creation data
|
|
1335
|
+
* @returns Created rule
|
|
1336
|
+
*/
|
|
1337
|
+
async addRule(policyId, data) {
|
|
1338
|
+
return this.transport.request({
|
|
1339
|
+
method: "POST",
|
|
1340
|
+
path: `/policies/${policyId}/rules`,
|
|
1341
|
+
body: data
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
* Update a policy rule.
|
|
1346
|
+
*
|
|
1347
|
+
* @param policyId - Policy ID
|
|
1348
|
+
* @param ruleId - Rule ID
|
|
1349
|
+
* @param data - Update data
|
|
1350
|
+
* @returns Updated rule
|
|
1351
|
+
*/
|
|
1352
|
+
async updateRule(policyId, ruleId, data) {
|
|
1353
|
+
return this.transport.request({
|
|
1354
|
+
method: "PATCH",
|
|
1355
|
+
path: `/policies/${policyId}/rules/${ruleId}`,
|
|
1356
|
+
body: data
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
/**
|
|
1360
|
+
* Delete a policy rule.
|
|
1361
|
+
*
|
|
1362
|
+
* @param policyId - Policy ID
|
|
1363
|
+
* @param ruleId - Rule ID
|
|
1364
|
+
*/
|
|
1365
|
+
async deleteRule(policyId, ruleId) {
|
|
1366
|
+
await this.transport.request({
|
|
1367
|
+
method: "DELETE",
|
|
1368
|
+
path: `/policies/${policyId}/rules/${ruleId}`
|
|
1369
|
+
});
|
|
1370
|
+
}
|
|
1371
|
+
/**
|
|
1372
|
+
* Attach a policy to a wallet.
|
|
1373
|
+
*
|
|
1374
|
+
* @param policyId - Policy ID
|
|
1375
|
+
* @param walletId - Wallet ID
|
|
1376
|
+
*/
|
|
1377
|
+
async attachToWallet(policyId, walletId) {
|
|
1378
|
+
await this.transport.request({
|
|
1379
|
+
method: "PUT",
|
|
1380
|
+
path: `/policies/${policyId}/wallets/${walletId}`
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* Detach a policy from a wallet.
|
|
1385
|
+
*
|
|
1386
|
+
* @param policyId - Policy ID
|
|
1387
|
+
* @param walletId - Wallet ID
|
|
1388
|
+
*/
|
|
1389
|
+
async detachFromWallet(policyId, walletId) {
|
|
1390
|
+
await this.transport.request({
|
|
1391
|
+
method: "DELETE",
|
|
1392
|
+
path: `/policies/${policyId}/wallets/${walletId}`
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
};
|
|
1396
|
+
|
|
1397
|
+
// src/client/resources/signer-groups.ts
|
|
1398
|
+
var SignerGroupsResource = class extends BaseResource {
|
|
1399
|
+
/**
|
|
1400
|
+
* Create a new signer group.
|
|
1401
|
+
*
|
|
1402
|
+
* @param data - Signer group creation data
|
|
1403
|
+
* @returns Created signer group
|
|
1404
|
+
*/
|
|
1405
|
+
async create(data) {
|
|
1406
|
+
return this.transport.request({
|
|
1407
|
+
method: "POST",
|
|
1408
|
+
path: "/signer-groups",
|
|
1409
|
+
body: data
|
|
1410
|
+
});
|
|
1411
|
+
}
|
|
1412
|
+
/**
|
|
1413
|
+
* List signer groups.
|
|
1414
|
+
*
|
|
1415
|
+
* @param params - Pagination parameters
|
|
1416
|
+
* @returns Async iterator of signer groups
|
|
1417
|
+
*/
|
|
1418
|
+
list(params) {
|
|
1419
|
+
return this.paginate("/signer-groups", params);
|
|
1420
|
+
}
|
|
1421
|
+
/**
|
|
1422
|
+
* Get a signer group by ID.
|
|
1423
|
+
*
|
|
1424
|
+
* @param signerGroupId - Signer group ID
|
|
1425
|
+
* @returns Signer group record
|
|
1426
|
+
*/
|
|
1427
|
+
async get(signerGroupId) {
|
|
1428
|
+
return this.transport.request({
|
|
1429
|
+
method: "GET",
|
|
1430
|
+
path: `/signer-groups/${signerGroupId}`
|
|
1431
|
+
});
|
|
1432
|
+
}
|
|
1433
|
+
/**
|
|
1434
|
+
* Add a signer to a group.
|
|
1435
|
+
*
|
|
1436
|
+
* @param signerGroupId - Signer group ID
|
|
1437
|
+
* @param data - Signer creation data
|
|
1438
|
+
* @returns Created signer
|
|
1439
|
+
*/
|
|
1440
|
+
async addSigner(signerGroupId, data) {
|
|
1441
|
+
return this.transport.request({
|
|
1442
|
+
method: "POST",
|
|
1443
|
+
path: `/signer-groups/${signerGroupId}/signers`,
|
|
1444
|
+
body: data
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
/**
|
|
1448
|
+
* Remove a signer from a group.
|
|
1449
|
+
*
|
|
1450
|
+
* @param signerGroupId - Signer group ID
|
|
1451
|
+
* @param signerId - Signer ID
|
|
1452
|
+
*/
|
|
1453
|
+
async removeSigner(signerGroupId, signerId) {
|
|
1454
|
+
await this.transport.request({
|
|
1455
|
+
method: "DELETE",
|
|
1456
|
+
path: `/signer-groups/${signerGroupId}/signers/${signerId}`
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
/**
|
|
1460
|
+
* Attach a signer group to a wallet.
|
|
1461
|
+
*
|
|
1462
|
+
* @param walletId - Wallet ID
|
|
1463
|
+
* @param signerGroupId - Signer group ID
|
|
1464
|
+
*/
|
|
1465
|
+
async attachToWallet(walletId, signerGroupId) {
|
|
1466
|
+
await this.transport.request({
|
|
1467
|
+
method: "PUT",
|
|
1468
|
+
path: `/wallets/${walletId}/signer-groups/${signerGroupId}`
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
/**
|
|
1472
|
+
* Detach a signer group from a wallet.
|
|
1473
|
+
*
|
|
1474
|
+
* @param walletId - Wallet ID
|
|
1475
|
+
* @param signerGroupId - Signer group ID
|
|
1476
|
+
*/
|
|
1477
|
+
async detachFromWallet(walletId, signerGroupId) {
|
|
1478
|
+
await this.transport.request({
|
|
1479
|
+
method: "DELETE",
|
|
1480
|
+
path: `/wallets/${walletId}/signer-groups/${signerGroupId}`
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
};
|
|
1484
|
+
var SignersResource = class extends BaseResource {
|
|
1485
|
+
/**
|
|
1486
|
+
* List all signers.
|
|
1487
|
+
*
|
|
1488
|
+
* @param params - Pagination parameters
|
|
1489
|
+
* @returns Async iterator of signers
|
|
1490
|
+
*/
|
|
1491
|
+
list(params) {
|
|
1492
|
+
return this.paginate("/signers", params);
|
|
1493
|
+
}
|
|
1494
|
+
/**
|
|
1495
|
+
* Get a signer by public key.
|
|
1496
|
+
*
|
|
1497
|
+
* @param publicKey - Signer public key
|
|
1498
|
+
* @returns Signer record
|
|
1499
|
+
*/
|
|
1500
|
+
async getByPublicKey(publicKey) {
|
|
1501
|
+
return this.transport.request({
|
|
1502
|
+
method: "GET",
|
|
1503
|
+
path: `/signers/${publicKey}`
|
|
1504
|
+
});
|
|
1505
|
+
}
|
|
1506
|
+
/**
|
|
1507
|
+
* Delete a signer by public key.
|
|
1508
|
+
*
|
|
1509
|
+
* Soft-deletes all signers with the given public key.
|
|
1510
|
+
*
|
|
1511
|
+
* @param publicKey - Signer public key
|
|
1512
|
+
*/
|
|
1513
|
+
async delete(publicKey) {
|
|
1514
|
+
await this.transport.request({
|
|
1515
|
+
method: "DELETE",
|
|
1516
|
+
path: `/signers/${publicKey}`
|
|
1517
|
+
});
|
|
1518
|
+
}
|
|
1519
|
+
};
|
|
1520
|
+
|
|
1521
|
+
// src/client/resources/api-keys.ts
|
|
1522
|
+
var ApiKeysResource = class extends BaseResource {
|
|
1523
|
+
/**
|
|
1524
|
+
* Create a new API key.
|
|
1525
|
+
*
|
|
1526
|
+
* @param data - API key creation data
|
|
1527
|
+
* @returns Created API key (includes secret, only shown once)
|
|
1528
|
+
*/
|
|
1529
|
+
async create(data) {
|
|
1530
|
+
return this.transport.request({
|
|
1531
|
+
method: "POST",
|
|
1532
|
+
path: "/api-keys",
|
|
1533
|
+
body: data
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1536
|
+
/**
|
|
1537
|
+
* List API keys.
|
|
1538
|
+
*
|
|
1539
|
+
* @param params - Pagination parameters
|
|
1540
|
+
* @returns Async iterator of API keys
|
|
1541
|
+
*/
|
|
1542
|
+
list(params) {
|
|
1543
|
+
return this.paginate("/api-keys", params);
|
|
1544
|
+
}
|
|
1545
|
+
/**
|
|
1546
|
+
* Delete an API key.
|
|
1547
|
+
*
|
|
1548
|
+
* @param apiKeyId - API key ID
|
|
1549
|
+
*/
|
|
1550
|
+
async delete(apiKeyId) {
|
|
1551
|
+
await this.transport.request({
|
|
1552
|
+
method: "DELETE",
|
|
1553
|
+
path: `/api-keys/${apiKeyId}`
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
};
|
|
1557
|
+
|
|
1558
|
+
// src/client/resources/users.ts
|
|
1559
|
+
var UsersResource = class extends BaseResource {
|
|
1560
|
+
/**
|
|
1561
|
+
* Create a new user.
|
|
1562
|
+
*
|
|
1563
|
+
* @param data - User creation data
|
|
1564
|
+
* @returns Created user
|
|
1565
|
+
*/
|
|
1566
|
+
async create(data) {
|
|
1567
|
+
return this.transport.request({
|
|
1568
|
+
method: "POST",
|
|
1569
|
+
path: "/users",
|
|
1570
|
+
body: data
|
|
1571
|
+
});
|
|
1572
|
+
}
|
|
1573
|
+
/**
|
|
1574
|
+
* List users.
|
|
1575
|
+
*
|
|
1576
|
+
* @param params - Pagination parameters
|
|
1577
|
+
* @returns Async iterator of users
|
|
1578
|
+
*/
|
|
1579
|
+
list(params) {
|
|
1580
|
+
return this.paginate("/users", params);
|
|
1581
|
+
}
|
|
1582
|
+
/**
|
|
1583
|
+
* Get a user by ID.
|
|
1584
|
+
*
|
|
1585
|
+
* @param userId - User ID
|
|
1586
|
+
* @returns User record
|
|
1587
|
+
*/
|
|
1588
|
+
async get(userId) {
|
|
1589
|
+
return this.transport.request({
|
|
1590
|
+
method: "GET",
|
|
1591
|
+
path: `/users/${userId}`
|
|
1592
|
+
});
|
|
1593
|
+
}
|
|
1594
|
+
/**
|
|
1595
|
+
* Update a user.
|
|
1596
|
+
*
|
|
1597
|
+
* @param userId - User ID
|
|
1598
|
+
* @param data - Update data
|
|
1599
|
+
* @returns Updated user
|
|
1600
|
+
*/
|
|
1601
|
+
async update(userId, data) {
|
|
1602
|
+
return this.transport.request({
|
|
1603
|
+
method: "PATCH",
|
|
1604
|
+
path: `/users/${userId}`,
|
|
1605
|
+
body: data
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Delete a user.
|
|
1610
|
+
*
|
|
1611
|
+
* @param userId - User ID
|
|
1612
|
+
*/
|
|
1613
|
+
async delete(userId) {
|
|
1614
|
+
await this.transport.request({
|
|
1615
|
+
method: "DELETE",
|
|
1616
|
+
path: `/users/${userId}`
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1619
|
+
};
|
|
1620
|
+
|
|
1621
|
+
// src/client/resources/webhooks.ts
|
|
1622
|
+
var WebhooksResource = class extends BaseResource {
|
|
1623
|
+
/**
|
|
1624
|
+
* Create a new webhook target.
|
|
1625
|
+
*
|
|
1626
|
+
* @param data - Webhook target creation data
|
|
1627
|
+
* @returns Created webhook target
|
|
1628
|
+
*/
|
|
1629
|
+
async createTarget(data) {
|
|
1630
|
+
return this.transport.request({
|
|
1631
|
+
method: "POST",
|
|
1632
|
+
path: "/webhooks/targets",
|
|
1633
|
+
body: data
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
/**
|
|
1637
|
+
* List webhook targets.
|
|
1638
|
+
*
|
|
1639
|
+
* @param params - Pagination parameters
|
|
1640
|
+
* @returns Async iterator of webhook targets
|
|
1641
|
+
*/
|
|
1642
|
+
listTargets(params) {
|
|
1643
|
+
return this.paginate("/webhooks/targets", params);
|
|
1644
|
+
}
|
|
1645
|
+
/**
|
|
1646
|
+
* Get a webhook target by ID.
|
|
1647
|
+
*
|
|
1648
|
+
* @param targetId - Webhook target ID
|
|
1649
|
+
* @returns Webhook target record
|
|
1650
|
+
*/
|
|
1651
|
+
async getTarget(targetId) {
|
|
1652
|
+
return this.transport.request({
|
|
1653
|
+
method: "GET",
|
|
1654
|
+
path: `/webhooks/targets/${targetId}`
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
/**
|
|
1658
|
+
* Update a webhook target.
|
|
1659
|
+
*
|
|
1660
|
+
* @param targetId - Webhook target ID
|
|
1661
|
+
* @param data - Update data
|
|
1662
|
+
* @returns Updated webhook target
|
|
1663
|
+
*/
|
|
1664
|
+
async updateTarget(targetId, data) {
|
|
1665
|
+
return this.transport.request({
|
|
1666
|
+
method: "PATCH",
|
|
1667
|
+
path: `/webhooks/targets/${targetId}`,
|
|
1668
|
+
body: data
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1671
|
+
/**
|
|
1672
|
+
* Delete a webhook target.
|
|
1673
|
+
*
|
|
1674
|
+
* @param targetId - Webhook target ID
|
|
1675
|
+
*/
|
|
1676
|
+
async deleteTarget(targetId) {
|
|
1677
|
+
await this.transport.request({
|
|
1678
|
+
method: "DELETE",
|
|
1679
|
+
path: `/webhooks/targets/${targetId}`
|
|
1680
|
+
});
|
|
1681
|
+
}
|
|
1682
|
+
/**
|
|
1683
|
+
* List webhook events.
|
|
1684
|
+
*
|
|
1685
|
+
* @param params - Pagination parameters
|
|
1686
|
+
* @returns Async iterator of webhook events
|
|
1687
|
+
*/
|
|
1688
|
+
listEvents(params) {
|
|
1689
|
+
return this.paginate("/webhooks", params);
|
|
1690
|
+
}
|
|
1691
|
+
/**
|
|
1692
|
+
* Get a webhook event by ID.
|
|
1693
|
+
*
|
|
1694
|
+
* @param eventId - Webhook event ID
|
|
1695
|
+
* @returns Webhook event record
|
|
1696
|
+
*/
|
|
1697
|
+
async getEvent(eventId) {
|
|
1698
|
+
return this.transport.request({
|
|
1699
|
+
method: "GET",
|
|
1700
|
+
path: `/webhooks/${eventId}`
|
|
1701
|
+
});
|
|
1702
|
+
}
|
|
1703
|
+
/**
|
|
1704
|
+
* Replay a webhook event.
|
|
1705
|
+
*
|
|
1706
|
+
* @param eventId - Webhook event ID
|
|
1707
|
+
*/
|
|
1708
|
+
async replayEvent(eventId) {
|
|
1709
|
+
await this.transport.request({
|
|
1710
|
+
method: "POST",
|
|
1711
|
+
path: `/webhooks/events/${eventId}/replay`
|
|
1712
|
+
});
|
|
1713
|
+
}
|
|
1714
|
+
};
|
|
1715
|
+
|
|
1716
|
+
// src/client/resources/info.ts
|
|
1717
|
+
var InfoResource = class extends BaseResource {
|
|
1718
|
+
/**
|
|
1719
|
+
* Get supported countries.
|
|
1720
|
+
*
|
|
1721
|
+
* @returns Array of supported countries
|
|
1722
|
+
*
|
|
1723
|
+
* @example
|
|
1724
|
+
* ```typescript
|
|
1725
|
+
* const countries = await client.info.getCountries();
|
|
1726
|
+
* ```
|
|
1727
|
+
*/
|
|
1728
|
+
async getCountries() {
|
|
1729
|
+
const response = await this.transport.request({
|
|
1730
|
+
method: "GET",
|
|
1731
|
+
path: "/capabilities/countries"
|
|
1732
|
+
});
|
|
1733
|
+
return response.data;
|
|
1734
|
+
}
|
|
1735
|
+
/**
|
|
1736
|
+
* Get supported networks.
|
|
1737
|
+
*
|
|
1738
|
+
* @returns Array of supported networks
|
|
1739
|
+
*
|
|
1740
|
+
* @example
|
|
1741
|
+
* ```typescript
|
|
1742
|
+
* const networks = await client.info.getNetworks();
|
|
1743
|
+
* for (const network of networks) {
|
|
1744
|
+
* console.log(network.id, network.name);
|
|
1745
|
+
* }
|
|
1746
|
+
* ```
|
|
1747
|
+
*/
|
|
1748
|
+
async getNetworks() {
|
|
1749
|
+
const response = await this.transport.request({
|
|
1750
|
+
method: "GET",
|
|
1751
|
+
path: "/capabilities/networks"
|
|
1752
|
+
});
|
|
1753
|
+
return response.data;
|
|
1754
|
+
}
|
|
1755
|
+
};
|
|
1756
|
+
|
|
1757
|
+
// src/client/resources/sandbox.ts
|
|
1758
|
+
var SandboxResource = class extends BaseResource {
|
|
1759
|
+
/**
|
|
1760
|
+
* Simulate an inbound payment event.
|
|
1761
|
+
*
|
|
1762
|
+
* Triggers a simulated payment event through the mock banking provider.
|
|
1763
|
+
* The required fields depend on the simulation `type`:
|
|
1764
|
+
*
|
|
1765
|
+
* | Type | Required Fields |
|
|
1766
|
+
* |------|-----------------|
|
|
1767
|
+
* | `ach_inbound`, `wire_inbound` | `account_id` |
|
|
1768
|
+
* | `crypto_inbound` | `wallet_id` |
|
|
1769
|
+
* | `*_outbound_*`, `*_reversal` | `movement_id` |
|
|
1770
|
+
*
|
|
1771
|
+
* @param data - Simulation request data
|
|
1772
|
+
* @returns Simulation response with ID and state
|
|
1773
|
+
*
|
|
1774
|
+
* @example Simulate ACH deposit to on-ramp
|
|
1775
|
+
* ```typescript
|
|
1776
|
+
* const result = await client.sandbox.simulateInbound({
|
|
1777
|
+
* simulation_id: `sim_${Date.now()}`,
|
|
1778
|
+
* type: 'ach_inbound',
|
|
1779
|
+
* account_id: 'acc_123',
|
|
1780
|
+
* amount: '1000.00',
|
|
1781
|
+
* currency: 'USD',
|
|
1782
|
+
* });
|
|
1783
|
+
* ```
|
|
1784
|
+
*
|
|
1785
|
+
* @example Simulate off-ramp ACH settlement
|
|
1786
|
+
* ```typescript
|
|
1787
|
+
* // After creating a one-off transaction for off-ramp testing
|
|
1788
|
+
* const tx = await client.transactions.create({
|
|
1789
|
+
* customer_id: 'cust_123',
|
|
1790
|
+
* amount: '100.00',
|
|
1791
|
+
* source_asset: 'USDC',
|
|
1792
|
+
* source_network_id: 'ethereum-sepolia',
|
|
1793
|
+
* destination_id: 'dest_456',
|
|
1794
|
+
* destination_asset: 'USD',
|
|
1795
|
+
* destination_payment_rail: 'ach',
|
|
1796
|
+
* });
|
|
1797
|
+
*
|
|
1798
|
+
* // Simulate the ACH settlement
|
|
1799
|
+
* await client.sandbox.simulateInbound({
|
|
1800
|
+
* simulation_id: `sim_${Date.now()}`,
|
|
1801
|
+
* type: 'ach_outbound_settled',
|
|
1802
|
+
* movement_id: tx.id,
|
|
1803
|
+
* amount: '100.00',
|
|
1804
|
+
* currency: 'USD',
|
|
1805
|
+
* });
|
|
1806
|
+
* ```
|
|
1807
|
+
*
|
|
1808
|
+
* @example Simulate crypto deposit to wallet
|
|
1809
|
+
* ```typescript
|
|
1810
|
+
* const result = await client.sandbox.simulateInbound({
|
|
1811
|
+
* simulation_id: `sim_${Date.now()}`,
|
|
1812
|
+
* type: 'crypto_inbound',
|
|
1813
|
+
* wallet_id: 'wallet_789',
|
|
1814
|
+
* amount: '500.00',
|
|
1815
|
+
* currency: 'USDC',
|
|
1816
|
+
* });
|
|
1817
|
+
* ```
|
|
1818
|
+
*/
|
|
1819
|
+
async simulateInbound(data) {
|
|
1820
|
+
return this.transport.request({
|
|
1821
|
+
method: "POST",
|
|
1822
|
+
path: "/sandbox/simulate/inbound",
|
|
1823
|
+
body: data
|
|
1824
|
+
});
|
|
1825
|
+
}
|
|
1826
|
+
/**
|
|
1827
|
+
* Simulate an onboarding state transition.
|
|
1828
|
+
*
|
|
1829
|
+
* Drives KYB, KYC, or applicant account status through a sandbox transition
|
|
1830
|
+
* without waiting for real compliance review.
|
|
1831
|
+
*
|
|
1832
|
+
* **Important:** For full activation, you typically need TWO calls:
|
|
1833
|
+
* 1. `kyb_approve` - Approves the KYB application
|
|
1834
|
+
* 2. `applicant_activate` - Activates the applicant (triggers provisioning)
|
|
1835
|
+
*
|
|
1836
|
+
* @param data - Simulation request data
|
|
1837
|
+
* @returns Simulation response with previous and new state
|
|
1838
|
+
*
|
|
1839
|
+
* @example Approve KYB and activate applicant
|
|
1840
|
+
* ```typescript
|
|
1841
|
+
* // Step 1: Approve the KYB application
|
|
1842
|
+
* await client.sandbox.simulateOnboarding({
|
|
1843
|
+
* type: 'kyb_approve',
|
|
1844
|
+
* applicant_id: customer.application_id,
|
|
1845
|
+
* simulation_id: `sim_kyb_${Date.now()}`,
|
|
1846
|
+
* });
|
|
1847
|
+
*
|
|
1848
|
+
* // Step 2: Activate the applicant (triggers provisioning)
|
|
1849
|
+
* await client.sandbox.simulateOnboarding({
|
|
1850
|
+
* type: 'applicant_activate',
|
|
1851
|
+
* applicant_id: customer.application_id,
|
|
1852
|
+
* simulation_id: `sim_activate_${Date.now()}`,
|
|
1853
|
+
* });
|
|
1854
|
+
* ```
|
|
1855
|
+
*
|
|
1856
|
+
* @example Reject a KYB application
|
|
1857
|
+
* ```typescript
|
|
1858
|
+
* await client.sandbox.simulateOnboarding({
|
|
1859
|
+
* type: 'kyb_reject',
|
|
1860
|
+
* applicant_id: applicationId,
|
|
1861
|
+
* simulation_id: `sim_${Date.now()}`,
|
|
1862
|
+
* reason_code: 'MISSING_DOCUMENTS',
|
|
1863
|
+
* });
|
|
1864
|
+
* ```
|
|
1865
|
+
*/
|
|
1866
|
+
async simulateOnboarding(data) {
|
|
1867
|
+
return this.transport.request({
|
|
1868
|
+
method: "POST",
|
|
1869
|
+
path: "/sandbox/simulate/onboarding",
|
|
1870
|
+
body: data
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1873
|
+
/**
|
|
1874
|
+
* Get detailed simulation status and callback history.
|
|
1875
|
+
*
|
|
1876
|
+
* Returns the current state and callback delivery history for a sandbox simulation.
|
|
1877
|
+
* Use this to debug async flows and see whether callbacks have been delivered.
|
|
1878
|
+
*
|
|
1879
|
+
* @param simulationId - Simulation ID returned from simulateInbound/simulateOnboarding
|
|
1880
|
+
* @returns Full simulation inspection including state and callbacks
|
|
1881
|
+
*
|
|
1882
|
+
* @example
|
|
1883
|
+
* ```typescript
|
|
1884
|
+
* const inspection = await client.sandbox.getSimulation('sim_123');
|
|
1885
|
+
* console.log('State:', inspection.state);
|
|
1886
|
+
* console.log('Callbacks:', inspection.callbacks);
|
|
1887
|
+
* ```
|
|
1888
|
+
*/
|
|
1889
|
+
async getSimulation(simulationId) {
|
|
1890
|
+
return this.transport.request({
|
|
1891
|
+
method: "GET",
|
|
1892
|
+
path: `/sandbox/simulations/${simulationId}`
|
|
1893
|
+
});
|
|
1894
|
+
}
|
|
1895
|
+
/**
|
|
1896
|
+
* Advance a stateful simulation to the next state.
|
|
1897
|
+
*
|
|
1898
|
+
* Some scenarios pause and wait for explicit advancement. Use this method
|
|
1899
|
+
* to continue a paused simulation with a specific action.
|
|
1900
|
+
*
|
|
1901
|
+
* @param simulationId - Simulation ID
|
|
1902
|
+
* @param data - Action to take (e.g., 'release', 'reject', 'confirm', 'expire')
|
|
1903
|
+
* @returns Updated simulation state
|
|
1904
|
+
*
|
|
1905
|
+
* @example
|
|
1906
|
+
* ```typescript
|
|
1907
|
+
* const result = await client.sandbox.advanceSimulation('sim_123', {
|
|
1908
|
+
* action: 'release',
|
|
1909
|
+
* });
|
|
1910
|
+
* console.log('New state:', result.new_state);
|
|
1911
|
+
* ```
|
|
1912
|
+
*/
|
|
1913
|
+
async advanceSimulation(simulationId, data) {
|
|
1914
|
+
return this.transport.request({
|
|
1915
|
+
method: "POST",
|
|
1916
|
+
path: `/sandbox/simulations/${simulationId}/advance`,
|
|
1917
|
+
body: data
|
|
1918
|
+
});
|
|
1919
|
+
}
|
|
1920
|
+
/**
|
|
1921
|
+
* List available sandbox scenarios.
|
|
1922
|
+
*
|
|
1923
|
+
* Returns all simulation scenarios supported by the platform.
|
|
1924
|
+
* Use these scenario names in the `scenario` field of simulateInbound.
|
|
1925
|
+
*
|
|
1926
|
+
* @param params - Pagination parameters
|
|
1927
|
+
* @returns Async iterator of scenarios
|
|
1928
|
+
*
|
|
1929
|
+
* @example
|
|
1930
|
+
* ```typescript
|
|
1931
|
+
* const scenarios = await client.sandbox.listScenarios().toArray();
|
|
1932
|
+
* for (const scenario of scenarios) {
|
|
1933
|
+
* console.log(`${scenario.name}: ${scenario.description}`);
|
|
1934
|
+
* }
|
|
1935
|
+
* ```
|
|
1936
|
+
*/
|
|
1937
|
+
listScenarios(params) {
|
|
1938
|
+
return this.paginate("/sandbox/scenarios", params);
|
|
1939
|
+
}
|
|
1940
|
+
};
|
|
1941
|
+
|
|
1942
|
+
// src/client/client.ts
|
|
1943
|
+
var DakotaClient = class {
|
|
1944
|
+
config;
|
|
1945
|
+
transport;
|
|
1946
|
+
// API Resources
|
|
1947
|
+
/** Customers API - manage customer records and KYB */
|
|
1948
|
+
customers;
|
|
1949
|
+
/** Recipients API - manage payment recipients */
|
|
1950
|
+
recipients;
|
|
1951
|
+
/** Destinations API - manage bank accounts and crypto wallets */
|
|
1952
|
+
destinations;
|
|
1953
|
+
/** Accounts API - manage on-ramp, off-ramp, and swap accounts */
|
|
1954
|
+
accounts;
|
|
1955
|
+
/** Transactions API - manage one-off transactions */
|
|
1956
|
+
transactions;
|
|
1957
|
+
/** Auto Transactions API - manage automated transactions */
|
|
1958
|
+
autoTransactions;
|
|
1959
|
+
/** Wallets API - manage non-custodial wallets */
|
|
1960
|
+
wallets;
|
|
1961
|
+
/** Events API - query platform events */
|
|
1962
|
+
events;
|
|
1963
|
+
/** Applications API - manage KYB applications */
|
|
1964
|
+
applications;
|
|
1965
|
+
/** Policies API - manage transaction policies */
|
|
1966
|
+
policies;
|
|
1967
|
+
/** Signer Groups API - manage multi-sig signer groups */
|
|
1968
|
+
signerGroups;
|
|
1969
|
+
/** Signers API - manage individual signers */
|
|
1970
|
+
signers;
|
|
1971
|
+
/** API Keys API - manage API keys */
|
|
1972
|
+
apiKeys;
|
|
1973
|
+
/** Users API - manage platform users */
|
|
1974
|
+
users;
|
|
1975
|
+
/** Webhooks API - manage webhook targets and events */
|
|
1976
|
+
webhooks;
|
|
1977
|
+
/** Info API - query platform capabilities */
|
|
1978
|
+
info;
|
|
1979
|
+
/** Sandbox API - testing simulations (sandbox only) */
|
|
1980
|
+
sandbox;
|
|
1981
|
+
/**
|
|
1982
|
+
* Create a new Dakota client.
|
|
1983
|
+
*
|
|
1984
|
+
* @param config - Client configuration
|
|
1985
|
+
* @throws ConfigurationError if configuration is invalid
|
|
1986
|
+
*
|
|
1987
|
+
* @example
|
|
1988
|
+
* ```typescript
|
|
1989
|
+
* // Basic usage (sandbox)
|
|
1990
|
+
* const client = new DakotaClient({
|
|
1991
|
+
* apiKey: 'your_api_key',
|
|
1992
|
+
* });
|
|
1993
|
+
*
|
|
1994
|
+
* // Production
|
|
1995
|
+
* const client = new DakotaClient({
|
|
1996
|
+
* apiKey: 'your_production_api_key',
|
|
1997
|
+
* environment: Environment.Production,
|
|
1998
|
+
* });
|
|
1999
|
+
*
|
|
2000
|
+
* // With custom configuration
|
|
2001
|
+
* const client = new DakotaClient({
|
|
2002
|
+
* apiKey: 'your_api_key',
|
|
2003
|
+
* timeout: 30000,
|
|
2004
|
+
* retryPolicy: {
|
|
2005
|
+
* maxAttempts: 5,
|
|
2006
|
+
* initialBackoffMs: 100,
|
|
2007
|
+
* maxBackoffMs: 5000,
|
|
2008
|
+
* },
|
|
2009
|
+
* logger: console,
|
|
2010
|
+
* });
|
|
2011
|
+
* ```
|
|
2012
|
+
*/
|
|
2013
|
+
constructor(config) {
|
|
2014
|
+
this.config = resolveConfig(config);
|
|
2015
|
+
this.transport = new Transport(this.config);
|
|
2016
|
+
this.customers = new CustomersResource(this.transport);
|
|
2017
|
+
this.recipients = new RecipientsResource(this.transport);
|
|
2018
|
+
this.destinations = new DestinationsResource(this.transport);
|
|
2019
|
+
this.accounts = new AccountsResource(this.transport);
|
|
2020
|
+
this.transactions = new TransactionsResource(this.transport);
|
|
2021
|
+
this.autoTransactions = new AutoTransactionsResource(this.transport);
|
|
2022
|
+
this.wallets = new WalletsResource(this.transport);
|
|
2023
|
+
this.events = new EventsResource(this.transport);
|
|
2024
|
+
this.applications = new ApplicationsResource(this.transport);
|
|
2025
|
+
this.policies = new PoliciesResource(this.transport);
|
|
2026
|
+
this.signerGroups = new SignerGroupsResource(this.transport);
|
|
2027
|
+
this.signers = new SignersResource(this.transport);
|
|
2028
|
+
this.apiKeys = new ApiKeysResource(this.transport);
|
|
2029
|
+
this.users = new UsersResource(this.transport);
|
|
2030
|
+
this.webhooks = new WebhooksResource(this.transport);
|
|
2031
|
+
this.info = new InfoResource(this.transport);
|
|
2032
|
+
this.sandbox = new SandboxResource(this.transport);
|
|
2033
|
+
}
|
|
2034
|
+
/**
|
|
2035
|
+
* Get the resolved base URL.
|
|
2036
|
+
*/
|
|
2037
|
+
get baseURL() {
|
|
2038
|
+
return this.config.baseURL;
|
|
2039
|
+
}
|
|
2040
|
+
};
|
|
2041
|
+
|
|
2042
|
+
export { APIError, AccountsResource, ApiKeysResource, ApplicationsResource, AuthMode, AutoTransactionsResource, ConfigurationError, CustomersResource, DEFAULT_RETRY_POLICY, DakotaClient, DestinationsResource, Environment, EventsResource, InfoResource, PaginatedIterator, PoliciesResource, RecipientsResource, SandboxResource, SignerGroupsResource, SignersResource, TransactionsResource, TransportError, UsersResource, WalletsResource, WebhooksResource, consoleLogger, getEnvironmentURL, noopLogger, paginate };
|
|
2043
|
+
//# sourceMappingURL=index.mjs.map
|
|
2044
|
+
//# sourceMappingURL=index.mjs.map
|