@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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Dakota
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
# Dakota TypeScript SDK
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://www.npmjs.com/package/@dakota-xyz/ts-sdk)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
|
|
7
|
+
Official TypeScript SDK for the [Dakota Platform](https://dakota.xyz) - infrastructure for stablecoin payments, on/off-ramps, and non-custodial wallets.
|
|
8
|
+
|
|
9
|
+
## What is Dakota?
|
|
10
|
+
|
|
11
|
+
Dakota provides APIs to:
|
|
12
|
+
|
|
13
|
+
- **On-ramp**: Accept USD bank transfers and deliver stablecoins (USDC/USDT) to blockchain wallets
|
|
14
|
+
- **Off-ramp**: Convert stablecoins to USD and deposit to bank accounts via ACH/Wire
|
|
15
|
+
- **Swap**: Exchange stablecoins across networks (e.g., USDC on Ethereum → USDT on Polygon)
|
|
16
|
+
- **Wallets**: Create non-custodial multi-sig wallets with policy controls
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @dakota-xyz/ts-sdk
|
|
22
|
+
# or
|
|
23
|
+
yarn add @dakota-xyz/ts-sdk
|
|
24
|
+
# or
|
|
25
|
+
pnpm add @dakota-xyz/ts-sdk
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { DakotaClient, Environment } from '@dakota-xyz/ts-sdk';
|
|
32
|
+
|
|
33
|
+
const client = new DakotaClient({
|
|
34
|
+
apiKey: 'your_api_key',
|
|
35
|
+
// Sandbox by default. For production:
|
|
36
|
+
// environment: Environment.Production,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// List your customers
|
|
40
|
+
for await (const customer of client.customers.list()) {
|
|
41
|
+
console.log(`Customer: ${customer.name} (KYB: ${customer.kyb_status})`);
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Complete Flow: Off-Ramp (Crypto → USD)
|
|
46
|
+
|
|
47
|
+
This example shows a complete off-ramp flow where a customer sends USDC and receives USD in their bank account.
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { DakotaClient } from '@dakota-xyz/ts-sdk';
|
|
51
|
+
|
|
52
|
+
const client = new DakotaClient({ apiKey: 'your_api_key' });
|
|
53
|
+
|
|
54
|
+
// Step 1: Create a customer (triggers KYB onboarding)
|
|
55
|
+
const customerResp = await client.customers.create({
|
|
56
|
+
name: 'Acme Corporation',
|
|
57
|
+
customer_type: 'business',
|
|
58
|
+
external_id: 'acme-123', // Your internal ID
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const customerId = customerResp.id;
|
|
62
|
+
console.log(`Created customer: ${customerId}`);
|
|
63
|
+
console.log(`KYB onboarding URL: ${customerResp.application_url}`);
|
|
64
|
+
|
|
65
|
+
// Customer completes KYB at the onboarding URL...
|
|
66
|
+
// You'll receive webhooks as status changes.
|
|
67
|
+
// Wait until kyb_status becomes "active" before proceeding.
|
|
68
|
+
|
|
69
|
+
// Step 2: Create a recipient (the entity receiving USD)
|
|
70
|
+
const recipient = await client.recipients.create(customerId, {
|
|
71
|
+
name: 'Acme Treasury',
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const recipientId = recipient.id;
|
|
75
|
+
console.log(`Created recipient: ${recipientId}`);
|
|
76
|
+
|
|
77
|
+
// Step 3: Create a bank destination (where USD will be sent)
|
|
78
|
+
const bankDest = await client.destinations.create(recipientId, {
|
|
79
|
+
destination_type: 'fiat_us',
|
|
80
|
+
name: 'Primary Bank Account',
|
|
81
|
+
bank_name: 'Chase Bank',
|
|
82
|
+
account_holder_name: 'Acme Corporation',
|
|
83
|
+
account_number: '123456789',
|
|
84
|
+
aba_routing_number: '021000021',
|
|
85
|
+
account_type: 'checking',
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
console.log(`Created bank destination: ${bankDest.id}`);
|
|
89
|
+
|
|
90
|
+
// Step 4: Create an off-ramp account
|
|
91
|
+
// Dakota returns a crypto address where customer sends USDC
|
|
92
|
+
const account = await client.accounts.create({
|
|
93
|
+
account_type: 'offramp',
|
|
94
|
+
customer_id: customerId,
|
|
95
|
+
fiat_destination_id: bankDest.id,
|
|
96
|
+
asset: 'USDC',
|
|
97
|
+
network_id: 'ethereum-mainnet',
|
|
98
|
+
rail: 'ach',
|
|
99
|
+
capabilities: ['ach'],
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
console.log('Off-ramp account created!');
|
|
103
|
+
console.log(`Send USDC to: ${account.crypto_address}`);
|
|
104
|
+
|
|
105
|
+
// When customer sends USDC to this address:
|
|
106
|
+
// 1. Dakota detects the deposit
|
|
107
|
+
// 2. Converts USDC to USD
|
|
108
|
+
// 3. Initiates ACH transfer to the bank account
|
|
109
|
+
// 4. You receive webhook notifications at each step
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Complete Flow: On-Ramp (USD → Crypto)
|
|
113
|
+
|
|
114
|
+
Accept USD bank transfers and deliver stablecoins to customer wallets.
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
// Step 1: Create customer (same as off-ramp)
|
|
118
|
+
// Step 2: Create recipient
|
|
119
|
+
|
|
120
|
+
// Step 3: Create a crypto destination (where stablecoins will be sent)
|
|
121
|
+
const cryptoDest = await client.destinations.create(recipientId, {
|
|
122
|
+
destination_type: 'crypto',
|
|
123
|
+
name: 'Crypto Wallet',
|
|
124
|
+
address: '0x742d35Cc6634C0532925a3b844Bc9e7595f...',
|
|
125
|
+
network_id: 'ethereum-mainnet',
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// Step 4: Create an on-ramp account
|
|
129
|
+
// Dakota returns bank details where customer sends USD
|
|
130
|
+
const onramp = await client.accounts.create({
|
|
131
|
+
account_type: 'onramp',
|
|
132
|
+
customer_id: customerId,
|
|
133
|
+
crypto_destination_id: cryptoDest.id,
|
|
134
|
+
asset: 'USDC',
|
|
135
|
+
network_id: 'ethereum-mainnet',
|
|
136
|
+
rail: 'ach',
|
|
137
|
+
capabilities: ['ach'],
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
console.log('Send USD to:');
|
|
141
|
+
console.log(` Bank: ${onramp.bank_account.bank_name}`);
|
|
142
|
+
console.log(` Routing: ${onramp.bank_account.aba_routing_number}`);
|
|
143
|
+
console.log(` Account: ${onramp.bank_account.account_number}`);
|
|
144
|
+
|
|
145
|
+
// When customer sends USD:
|
|
146
|
+
// 1. Dakota receives the bank transfer
|
|
147
|
+
// 2. Converts USD to USDC
|
|
148
|
+
// 3. Sends USDC to the customer's wallet address
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## One-Off Transactions
|
|
152
|
+
|
|
153
|
+
For single transactions without creating accounts:
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
const tx = await client.transactions.create({
|
|
157
|
+
customer_id: customerId,
|
|
158
|
+
amount: '1000.00',
|
|
159
|
+
source_asset: 'USDC',
|
|
160
|
+
source_network_id: 'ethereum-mainnet',
|
|
161
|
+
destination_id: destinationId,
|
|
162
|
+
destination_asset: 'USD',
|
|
163
|
+
destination_payment_rail: 'ach',
|
|
164
|
+
payment_reference: 'Invoice #12345',
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
console.log(`Transaction created: ${tx.id}`);
|
|
168
|
+
console.log(`Send ${tx.send_amount} USDC to: ${tx.crypto_address}`);
|
|
169
|
+
console.log(`Status: ${tx.status}`);
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Handling Webhooks
|
|
173
|
+
|
|
174
|
+
Dakota sends webhooks for all status changes. Set up a handler:
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
import express from 'express';
|
|
178
|
+
import { WebhookHandler, WebhookEventType } from '@dakota-xyz/ts-sdk/webhook';
|
|
179
|
+
|
|
180
|
+
const app = express();
|
|
181
|
+
|
|
182
|
+
const handler = new WebhookHandler({
|
|
183
|
+
publicKey: 'your_webhook_public_key_hex',
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// Handle specific event types
|
|
187
|
+
handler.on(WebhookEventType.CustomerCreated, async (event) => {
|
|
188
|
+
console.log('Customer created:', event.id);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
handler.on(WebhookEventType.TransactionUpdated, async (event) => {
|
|
192
|
+
console.log('Transaction updated:', event.id);
|
|
193
|
+
// Check transaction status, update your records, notify user, etc.
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// Wildcard patterns
|
|
197
|
+
handler.on('transaction.*', async (event) => {
|
|
198
|
+
console.log('Transaction event:', event.type);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
// Catch-all for other events
|
|
202
|
+
handler.onDefault(async (event) => {
|
|
203
|
+
console.log(`Event: ${event.id} (type: ${event.type})`);
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
app.post(
|
|
207
|
+
'/webhooks/dakota',
|
|
208
|
+
express.raw({ type: 'application/json' }),
|
|
209
|
+
handler.expressMiddleware()
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
app.listen(8080);
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Pagination
|
|
216
|
+
|
|
217
|
+
Iterate through large collections:
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
// Async iteration
|
|
221
|
+
for await (const customer of client.customers.list()) {
|
|
222
|
+
console.log(`${customer.id}: ${customer.name}`);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Collect all to array
|
|
226
|
+
const allCustomers = await client.customers.list().toArray();
|
|
227
|
+
|
|
228
|
+
// Get first item only
|
|
229
|
+
const firstCustomer = await client.customers.list().first();
|
|
230
|
+
|
|
231
|
+
// With filters
|
|
232
|
+
const activeCustomers = client.customers.list({ kyb_status: 'active' });
|
|
233
|
+
|
|
234
|
+
// Iterate transactions with filters
|
|
235
|
+
const completedTxs = client.transactions.list({
|
|
236
|
+
customer_id: customerId,
|
|
237
|
+
status: 'completed',
|
|
238
|
+
});
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Error Handling
|
|
242
|
+
|
|
243
|
+
```typescript
|
|
244
|
+
import { DakotaClient, APIError, TransportError } from '@dakota-xyz/ts-sdk';
|
|
245
|
+
|
|
246
|
+
try {
|
|
247
|
+
const customer = await client.customers.get('invalid_id');
|
|
248
|
+
} catch (error) {
|
|
249
|
+
if (error instanceof APIError) {
|
|
250
|
+
console.log(`API Error: ${error.message} (HTTP ${error.statusCode})`);
|
|
251
|
+
console.log(`Error Code: ${error.code}`);
|
|
252
|
+
console.log(`Request ID: ${error.requestId}`); // Include in support tickets
|
|
253
|
+
|
|
254
|
+
if (error.retryable) {
|
|
255
|
+
// Safe to retry (429, 503, etc.)
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (error instanceof TransportError) {
|
|
260
|
+
console.log(`Network Error: ${error.message}`);
|
|
261
|
+
console.log(`Cause: ${error.cause}`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## Environments
|
|
267
|
+
|
|
268
|
+
The SDK supports two main environments. **Sandbox is the default** for safe testing.
|
|
269
|
+
|
|
270
|
+
| Environment | URL | Use Case |
|
|
271
|
+
|-------------|-----|----------|
|
|
272
|
+
| **Sandbox** (default) | `https://api.platform.sandbox.dakota.xyz` | Testing & development |
|
|
273
|
+
| **Production** | `https://api.platform.dakota.xyz` | Live transactions with real money |
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
// Sandbox (default) - safe for testing, no real money moves
|
|
277
|
+
const client = new DakotaClient({
|
|
278
|
+
apiKey: 'your_sandbox_api_key',
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
// Production - real money, real transactions
|
|
282
|
+
const client = new DakotaClient({
|
|
283
|
+
apiKey: 'your_production_api_key',
|
|
284
|
+
environment: Environment.Production,
|
|
285
|
+
});
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
> **Note**: Sandbox and Production use different API keys. Make sure you're using the correct key for each environment.
|
|
289
|
+
|
|
290
|
+
## Configuration Options
|
|
291
|
+
|
|
292
|
+
```typescript
|
|
293
|
+
import { DakotaClient, Environment, AuthMode } from '@dakota-xyz/ts-sdk';
|
|
294
|
+
|
|
295
|
+
const client = new DakotaClient({
|
|
296
|
+
// Required: Authentication (at least one)
|
|
297
|
+
apiKey: 'your_api_key',
|
|
298
|
+
applicationToken: 'your_app_token', // For /applications endpoints
|
|
299
|
+
|
|
300
|
+
// Environment (default: Sandbox)
|
|
301
|
+
environment: Environment.Production,
|
|
302
|
+
|
|
303
|
+
// Or override with custom URL
|
|
304
|
+
baseURL: 'https://custom.api.url',
|
|
305
|
+
|
|
306
|
+
// Auth mode (default: Auto)
|
|
307
|
+
authMode: AuthMode.Auto, // Auto, APIKey, or ApplicationToken
|
|
308
|
+
|
|
309
|
+
// Custom timeout (default: 15000ms)
|
|
310
|
+
timeout: 30000,
|
|
311
|
+
|
|
312
|
+
// Custom retry policy
|
|
313
|
+
retryPolicy: {
|
|
314
|
+
maxAttempts: 5,
|
|
315
|
+
initialBackoffMs: 100,
|
|
316
|
+
maxBackoffMs: 5000,
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
// Automatic idempotency keys for POST (default: true)
|
|
320
|
+
automaticIdempotency: true,
|
|
321
|
+
|
|
322
|
+
// Custom idempotency key generator
|
|
323
|
+
idempotencyKeyGenerator: () => crypto.randomUUID(),
|
|
324
|
+
|
|
325
|
+
// Structured logging
|
|
326
|
+
logger: console, // or custom logger
|
|
327
|
+
});
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## Supported Networks
|
|
331
|
+
|
|
332
|
+
| Network | Production | Sandbox |
|
|
333
|
+
|---------|------------|---------|
|
|
334
|
+
| Ethereum | `ethereum-mainnet` | `ethereum-sepolia` |
|
|
335
|
+
| Polygon | `polygon-mainnet` | `polygon-amoy` |
|
|
336
|
+
| Arbitrum | `arbitrum-mainnet` | `arbitrum-sepolia` |
|
|
337
|
+
| Base | `base-mainnet` | `base-sepolia` |
|
|
338
|
+
| Optimism | `optimism-mainnet` | - |
|
|
339
|
+
| Solana | `solana-mainnet` | `solana-devnet` |
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## API Reference
|
|
344
|
+
|
|
345
|
+
### Customers
|
|
346
|
+
|
|
347
|
+
Manage customer entities representing businesses and organizations.
|
|
348
|
+
|
|
349
|
+
| Method | Description |
|
|
350
|
+
|--------|-------------|
|
|
351
|
+
| `customers.create(data)` | Create a customer (triggers KYB) |
|
|
352
|
+
| `customers.list(params?)` | List all customers (paginated) |
|
|
353
|
+
| `customers.get(id)` | Get customer by ID |
|
|
354
|
+
|
|
355
|
+
### Recipients
|
|
356
|
+
|
|
357
|
+
Manage recipient entities for payouts and transfers.
|
|
358
|
+
|
|
359
|
+
| Method | Description |
|
|
360
|
+
|--------|-------------|
|
|
361
|
+
| `recipients.create(customerId, data)` | Create a recipient |
|
|
362
|
+
| `recipients.list(customerId, params?)` | List recipients for customer |
|
|
363
|
+
| `recipients.get(id)` | Get recipient by ID |
|
|
364
|
+
| `recipients.update(id, data)` | Update recipient |
|
|
365
|
+
|
|
366
|
+
### Destinations
|
|
367
|
+
|
|
368
|
+
Manage bank accounts and crypto wallet destinations.
|
|
369
|
+
|
|
370
|
+
| Method | Description |
|
|
371
|
+
|--------|-------------|
|
|
372
|
+
| `destinations.create(recipientId, data)` | Create destination (bank or crypto) |
|
|
373
|
+
| `destinations.list(recipientId, params?)` | List destinations for recipient |
|
|
374
|
+
|
|
375
|
+
### Accounts
|
|
376
|
+
|
|
377
|
+
Manage on-ramp, off-ramp, and swap accounts.
|
|
378
|
+
|
|
379
|
+
| Method | Description |
|
|
380
|
+
|--------|-------------|
|
|
381
|
+
| `accounts.create(data)` | Create account (onramp/offramp/swap) |
|
|
382
|
+
| `accounts.list(params?)` | List accounts |
|
|
383
|
+
| `accounts.get(id)` | Get account by ID |
|
|
384
|
+
| `accounts.update(id, data)` | Update account |
|
|
385
|
+
|
|
386
|
+
### Transactions
|
|
387
|
+
|
|
388
|
+
Create and manage one-off transactions.
|
|
389
|
+
|
|
390
|
+
| Method | Description |
|
|
391
|
+
|--------|-------------|
|
|
392
|
+
| `transactions.create(data)` | Create one-off transaction |
|
|
393
|
+
| `transactions.list(params?)` | List transactions |
|
|
394
|
+
| `transactions.get(id)` | Get transaction by ID |
|
|
395
|
+
| `transactions.cancel(id)` | Cancel pending transaction |
|
|
396
|
+
|
|
397
|
+
### Auto Transactions
|
|
398
|
+
|
|
399
|
+
View automated transaction configurations.
|
|
400
|
+
|
|
401
|
+
| Method | Description |
|
|
402
|
+
|--------|-------------|
|
|
403
|
+
| `autoTransactions.list(params?)` | List auto transactions |
|
|
404
|
+
| `autoTransactions.get(id)` | Get auto transaction by ID |
|
|
405
|
+
|
|
406
|
+
### Wallets
|
|
407
|
+
|
|
408
|
+
Manage non-custodial multi-sig wallets.
|
|
409
|
+
|
|
410
|
+
| Method | Description |
|
|
411
|
+
|--------|-------------|
|
|
412
|
+
| `wallets.create(data)` | Create wallet |
|
|
413
|
+
| `wallets.getBalances(id)` | Get wallet balances |
|
|
414
|
+
| `wallets.createTransaction(id, data)` | Create wallet transaction |
|
|
415
|
+
|
|
416
|
+
### Events
|
|
417
|
+
|
|
418
|
+
Query platform events for audit trails.
|
|
419
|
+
|
|
420
|
+
| Method | Description |
|
|
421
|
+
|--------|-------------|
|
|
422
|
+
| `events.list(params?)` | List events |
|
|
423
|
+
| `events.get(id)` | Get event by ID |
|
|
424
|
+
|
|
425
|
+
### Applications (KYB)
|
|
426
|
+
|
|
427
|
+
Manage KYB onboarding applications.
|
|
428
|
+
|
|
429
|
+
| Method | Description |
|
|
430
|
+
|--------|-------------|
|
|
431
|
+
| `applications.list(params?)` | List applications |
|
|
432
|
+
| `applications.get(id)` | Get application by ID |
|
|
433
|
+
| `applications.submit(id, data?)` | Submit for review |
|
|
434
|
+
| `applications.listIndividuals(id, params?)` | List associated individuals |
|
|
435
|
+
| `applications.addIndividual(id, data)` | Add individual |
|
|
436
|
+
| `applications.getIndividual(appId, indId)` | Get individual |
|
|
437
|
+
| `applications.updateIndividual(appId, indId, data)` | Update individual |
|
|
438
|
+
| `applications.deleteIndividual(appId, indId)` | Delete individual |
|
|
439
|
+
| `applications.updateBusinessDetails(id, data)` | Update business details |
|
|
440
|
+
| `applications.getDocumentUploadUrl(id, data)` | Get document upload URL |
|
|
441
|
+
|
|
442
|
+
### Policies
|
|
443
|
+
|
|
444
|
+
Manage transaction policies and rules.
|
|
445
|
+
|
|
446
|
+
| Method | Description |
|
|
447
|
+
|--------|-------------|
|
|
448
|
+
| `policies.create(data)` | Create policy |
|
|
449
|
+
| `policies.list(params?)` | List policies |
|
|
450
|
+
| `policies.get(id)` | Get policy by ID |
|
|
451
|
+
| `policies.delete(id)` | Delete policy |
|
|
452
|
+
| `policies.addRule(policyId, data)` | Add rule to policy |
|
|
453
|
+
| `policies.updateRule(policyId, ruleId, data)` | Update rule |
|
|
454
|
+
| `policies.deleteRule(policyId, ruleId)` | Delete rule |
|
|
455
|
+
| `policies.attachToWallet(policyId, walletId)` | Attach to wallet |
|
|
456
|
+
| `policies.detachFromWallet(policyId, walletId)` | Detach from wallet |
|
|
457
|
+
|
|
458
|
+
### Signer Groups
|
|
459
|
+
|
|
460
|
+
Manage multi-party authorization.
|
|
461
|
+
|
|
462
|
+
| Method | Description |
|
|
463
|
+
|--------|-------------|
|
|
464
|
+
| `signerGroups.create(data)` | Create signer group |
|
|
465
|
+
| `signerGroups.list(params?)` | List signer groups |
|
|
466
|
+
| `signerGroups.get(id)` | Get signer group by ID |
|
|
467
|
+
| `signerGroups.addSigner(groupId, data)` | Add signer to group |
|
|
468
|
+
| `signerGroups.removeSigner(groupId, signerId)` | Remove signer |
|
|
469
|
+
| `signerGroups.attachToWallet(walletId, groupId)` | Attach to wallet |
|
|
470
|
+
| `signerGroups.detachFromWallet(walletId, groupId)` | Detach from wallet |
|
|
471
|
+
|
|
472
|
+
### Signers
|
|
473
|
+
|
|
474
|
+
Manage individual signers.
|
|
475
|
+
|
|
476
|
+
| Method | Description |
|
|
477
|
+
|--------|-------------|
|
|
478
|
+
| `signers.list(params?)` | List all signers |
|
|
479
|
+
| `signers.getByPublicKey(publicKey)` | Get signer by public key |
|
|
480
|
+
| `signers.delete(publicKey)` | Delete signer by public key |
|
|
481
|
+
|
|
482
|
+
### API Keys
|
|
483
|
+
|
|
484
|
+
Manage API key credentials.
|
|
485
|
+
|
|
486
|
+
| Method | Description |
|
|
487
|
+
|--------|-------------|
|
|
488
|
+
| `apiKeys.create(data)` | Create API key (secret shown once) |
|
|
489
|
+
| `apiKeys.list(params?)` | List API keys |
|
|
490
|
+
| `apiKeys.delete(id)` | Delete API key |
|
|
491
|
+
|
|
492
|
+
### Users
|
|
493
|
+
|
|
494
|
+
Manage platform users.
|
|
495
|
+
|
|
496
|
+
| Method | Description |
|
|
497
|
+
|--------|-------------|
|
|
498
|
+
| `users.create(data)` | Create user |
|
|
499
|
+
| `users.list(params?)` | List users |
|
|
500
|
+
| `users.get(id)` | Get user by ID |
|
|
501
|
+
| `users.update(id, data)` | Update user |
|
|
502
|
+
| `users.delete(id)` | Delete user |
|
|
503
|
+
|
|
504
|
+
### Webhooks
|
|
505
|
+
|
|
506
|
+
Manage webhook targets and events.
|
|
507
|
+
|
|
508
|
+
| Method | Description |
|
|
509
|
+
|--------|-------------|
|
|
510
|
+
| `webhooks.createTarget(data)` | Create webhook target |
|
|
511
|
+
| `webhooks.listTargets(params?)` | List webhook targets |
|
|
512
|
+
| `webhooks.getTarget(id)` | Get webhook target by ID |
|
|
513
|
+
| `webhooks.updateTarget(id, data)` | Update webhook target |
|
|
514
|
+
| `webhooks.deleteTarget(id)` | Delete webhook target |
|
|
515
|
+
| `webhooks.listEvents(params?)` | List webhook events |
|
|
516
|
+
| `webhooks.getEvent(id)` | Get webhook event by ID |
|
|
517
|
+
| `webhooks.replayEvent(id)` | Replay webhook event |
|
|
518
|
+
|
|
519
|
+
### Info
|
|
520
|
+
|
|
521
|
+
Query platform capabilities.
|
|
522
|
+
|
|
523
|
+
| Method | Description |
|
|
524
|
+
|--------|-------------|
|
|
525
|
+
| `info.getCountries()` | Get supported countries |
|
|
526
|
+
| `info.getNetworks()` | Get supported networks |
|
|
527
|
+
|
|
528
|
+
### Sandbox
|
|
529
|
+
|
|
530
|
+
Test simulations (sandbox environment only).
|
|
531
|
+
|
|
532
|
+
| Method | Description |
|
|
533
|
+
|--------|-------------|
|
|
534
|
+
| `sandbox.simulateInbound(data)` | Simulate inbound deposit |
|
|
535
|
+
| `sandbox.simulateOnboarding(data)` | Simulate KYB completion |
|
|
536
|
+
| `sandbox.getSimulation(id)` | Get simulation by ID |
|
|
537
|
+
| `sandbox.advanceSimulation(id)` | Advance simulation state |
|
|
538
|
+
| `sandbox.listScenarios(params?)` | List available scenarios |
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
## Webhook Event Types
|
|
543
|
+
|
|
544
|
+
| Event Type | Description |
|
|
545
|
+
|------------|-------------|
|
|
546
|
+
| `customer.created` | Customer was created |
|
|
547
|
+
| `customer.updated` | Customer was updated |
|
|
548
|
+
| `customer.kyb_status_changed` | KYB status changed |
|
|
549
|
+
| `recipient.created` | Recipient was created |
|
|
550
|
+
| `recipient.updated` | Recipient was updated |
|
|
551
|
+
| `destination.created` | Destination was created |
|
|
552
|
+
| `account.created` | Account was created |
|
|
553
|
+
| `account.updated` | Account was updated |
|
|
554
|
+
| `transaction.created` | Transaction was created |
|
|
555
|
+
| `transaction.updated` | Transaction was updated |
|
|
556
|
+
| `transaction.completed` | Transaction completed |
|
|
557
|
+
| `transaction.failed` | Transaction failed |
|
|
558
|
+
| `transaction.cancelled` | Transaction was cancelled |
|
|
559
|
+
| `wallet.created` | Wallet was created |
|
|
560
|
+
| `application.created` | Application was created |
|
|
561
|
+
| `application.submitted` | Application was submitted |
|
|
562
|
+
| `application.approved` | Application was approved |
|
|
563
|
+
| `application.rejected` | Application was rejected |
|
|
564
|
+
|
|
565
|
+
---
|
|
566
|
+
|
|
567
|
+
## Regenerating Types
|
|
568
|
+
|
|
569
|
+
The SDK uses types generated from the OpenAPI spec. To regenerate:
|
|
570
|
+
|
|
571
|
+
```bash
|
|
572
|
+
npm run generate
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
## Testing
|
|
576
|
+
|
|
577
|
+
```bash
|
|
578
|
+
npm test # Run all tests
|
|
579
|
+
npm run test:watch # Watch mode
|
|
580
|
+
npm run test:coverage # With coverage
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
## Building
|
|
584
|
+
|
|
585
|
+
```bash
|
|
586
|
+
npm run build # Build ESM + CJS
|
|
587
|
+
npm run typecheck # Type check only
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
## Resources
|
|
591
|
+
|
|
592
|
+
- [Dakota Documentation](https://docs.dakota.xyz)
|
|
593
|
+
- [API Reference](https://docs.dakota.xyz/api-reference)
|
|
594
|
+
- [Common Flows](https://docs.dakota.xyz/documentation/common-flows)
|
|
595
|
+
|
|
596
|
+
## Contributing
|
|
597
|
+
|
|
598
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details on:
|
|
599
|
+
|
|
600
|
+
- Reporting bugs and suggesting features
|
|
601
|
+
- Development setup and workflow
|
|
602
|
+
- Code style and commit conventions
|
|
603
|
+
- Pull request process
|
|
604
|
+
|
|
605
|
+
## License
|
|
606
|
+
|
|
607
|
+
This project is licensed under the [MIT License](LICENSE).
|