@dakota-xyz/ts-sdk 1.4.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -906,8 +906,13 @@ type components = {
906
906
  * @example external_customer_123
907
907
  */
908
908
  readonly external_id?: string;
909
- /** @description ID of an existing customer to associate this new customer with as a sub-client. The referenced customer must belong to the same client. */
909
+ /** @description ID of an existing sub-client to associate this new customer with. The referenced customer must belong to the same client and must itself be a sub-client. Cannot be combined with is_sub_client. */
910
910
  readonly sub_client_id?: components["schemas"]["KSUID"];
911
+ /**
912
+ * @description When true, create this customer as a sub-client. A customer can only be designated a sub-client at creation time; a regular customer cannot be promoted to a sub-client afterwards. Cannot be combined with sub_client_id.
913
+ * @default false
914
+ */
915
+ readonly is_sub_client: boolean;
911
916
  };
912
917
  /** @description Response returned when a customer creation process is successfully initiated. */
913
918
  readonly CustomerCreateResponse: {
@@ -1026,7 +1031,7 @@ type components = {
1026
1031
  */
1027
1032
  readonly sub_client_name?: string;
1028
1033
  /**
1029
- * @description Whether this customer is acting as a sub-client (has other customers associated with it).
1034
+ * @description Whether this customer is a sub-client. This is set when the customer is created and cannot be changed afterwards.
1030
1035
  * @default false
1031
1036
  */
1032
1037
  readonly is_sub_client: boolean;
@@ -1773,7 +1778,7 @@ type components = {
1773
1778
  readonly PaginatedCustomerTransactionResponse: components["schemas"]["PaginatedListResponse"] & {
1774
1779
  readonly data?: readonly components["schemas"]["Transaction"][];
1775
1780
  };
1776
- readonly PaginatedTransactionResourceResponse: components["schemas"]["PaginatedOneOffTransactionResponse"] | components["schemas"]["PaginatedCustomerTransactionResponse"];
1781
+ readonly PaginatedTransactionResourceResponse: components["schemas"]["PaginatedOneOffTransactionResponse"] | components["schemas"]["PaginatedCustomerTransactionResponse"] | components["schemas"]["PaginatedWalletTransactionResponse"];
1777
1782
  /** @description An amount of money with its asset. */
1778
1783
  readonly TransactionAmount: {
1779
1784
  /**
@@ -2331,6 +2336,9 @@ type components = {
2331
2336
  readonly PaginatedOneOffTransactionResponse: components["schemas"]["PaginatedListResponse"] & {
2332
2337
  readonly data?: readonly components["schemas"]["OneOffTransaction"][];
2333
2338
  };
2339
+ readonly PaginatedWalletTransactionResponse: components["schemas"]["PaginatedListResponse"] & {
2340
+ readonly data?: readonly components["schemas"]["WalletTransaction"][];
2341
+ };
2334
2342
  /** @description Non-custodial wallet managed by Dakota Platform with a single address usable across networks within the same family. */
2335
2343
  readonly Wallet: {
2336
2344
  readonly id: components["schemas"]["KSUID"];
@@ -2374,7 +2382,7 @@ type components = {
2374
2382
  /** @description List of asset balances */
2375
2383
  readonly balances: readonly components["schemas"]["AssetBalance"][];
2376
2384
  /**
2377
- * @description Total USD value of all balances
2385
+ * @description Total USD value of all balances, as a decimal string with 2 decimal places (cents). Rounded DOWN (truncated toward zero), never rounded up, so the value never exceeds the holder's spendable balance.
2378
2386
  * @example 1234.56
2379
2387
  */
2380
2388
  readonly total_amount_usd: string;
@@ -2383,7 +2391,7 @@ type components = {
2383
2391
  readonly AssetBalance: {
2384
2392
  readonly asset: components["schemas"]["AssetDeployment"];
2385
2393
  /**
2386
- * @description USD value of this asset balance
2394
+ * @description USD value of this asset balance, as a decimal string with 2 decimal places (cents). Rounded DOWN (truncated toward zero), never rounded up, so the value never exceeds the holder's spendable balance.
2387
2395
  * @example 123.45
2388
2396
  */
2389
2397
  readonly amount_usd: string;
@@ -2415,6 +2423,18 @@ type components = {
2415
2423
  readonly amount?: string;
2416
2424
  readonly asset?: components["schemas"]["Asset"];
2417
2425
  readonly status: components["schemas"]["TransactionStatus"];
2426
+ /**
2427
+ * Format: int64
2428
+ * @description Unix time the transaction was created.
2429
+ * @example 1781181600
2430
+ */
2431
+ readonly created_at?: number;
2432
+ /**
2433
+ * Format: int64
2434
+ * @description Unix time the transaction was confirmed on chain; absent until confirmed.
2435
+ * @example 1781181660
2436
+ */
2437
+ readonly confirmed_at?: number;
2418
2438
  };
2419
2439
  /**
2420
2440
  * @description Type of transaction
@@ -4568,8 +4588,19 @@ type Address = components['schemas']['Address'];
4568
4588
  type PersonName = components['schemas']['PersonName'];
4569
4589
  /** Customer record */
4570
4590
  type Customer = components['schemas']['Customer'];
4571
- /** Customer creation request */
4572
- type CustomerCreateRequest = components['schemas']['CustomerCreateRequest'];
4591
+ /**
4592
+ * Customer creation request.
4593
+ *
4594
+ * NOTE: openapi-typescript generates `is_sub_client` as required because the
4595
+ * OpenAPI spec declares a `default: false`. The spec's `required:` list is
4596
+ * only `['name', 'customer_type']`, so this alias re-exports with
4597
+ * `is_sub_client` optional to match the server's runtime behaviour. Pass
4598
+ * `is_sub_client: true` to designate a sub-client at creation; cannot be
4599
+ * combined with `sub_client_id`. See ENG-2454.
4600
+ */
4601
+ type CustomerCreateRequest = Omit<components['schemas']['CustomerCreateRequest'], 'is_sub_client'> & {
4602
+ is_sub_client?: boolean;
4603
+ };
4573
4604
  /** Customer creation response */
4574
4605
  type CustomerCreateResponse = components['schemas']['CustomerCreateResponse'];
4575
4606
  /** KYB status */
@@ -4604,10 +4635,17 @@ type Recipient = components['schemas']['RecipientResponse'];
4604
4635
  type RecipientRequest = components['schemas']['RecipientRequest'];
4605
4636
  /** Recipient update request */
4606
4637
  type RecipientUpdateRequest = components['schemas']['RecipientRequest'];
4607
- /** Destination response union */
4638
+ /** Destination response union (used by `destinations.list`) */
4608
4639
  type Destination = components['schemas']['DestinationResponseUnion'];
4609
4640
  /** Destination request union */
4610
4641
  type DestinationRequest = components['schemas']['DestinationRequestUnion'];
4642
+ /**
4643
+ * Response for `destinations.create` — the platform returns just `{ id }`
4644
+ * (per `IDResponse`), NOT the full `DestinationResponseUnion`. Call
4645
+ * `destinations.list(recipientId)` afterwards to read the full shape if
4646
+ * you need it.
4647
+ */
4648
+ type DestinationCreateResponse = components['schemas']['IDResponse'];
4611
4649
  /** Fiat US destination request */
4612
4650
  type FiatUSDestinationRequest = components['schemas']['FiatUSDestinationRequest'];
4613
4651
  /** Crypto destination request */
@@ -4650,8 +4688,24 @@ type WalletCreateRequest = components['schemas']['WalletCreateRequest'];
4650
4688
  type WalletBalance = components['schemas']['AssetBalance'];
4651
4689
  /** Wallet balances */
4652
4690
  type WalletBalances = components['schemas']['WalletBalances'];
4653
- /** Wallet transaction request */
4654
- type WalletTransactionRequest = components['schemas']['SendTransactionIntent'];
4691
+ /**
4692
+ * Wallet transaction request body.
4693
+ *
4694
+ * `POST /wallets/{id}/transactions` expects an endorsed envelope —
4695
+ * `{ signatures: string[], intent: SendTransactionIntent }` — NOT a bare
4696
+ * intent. Build the `SendTransactionIntent`, canonicalize per RFC 8785,
4697
+ * sign with the wallet's signer-group ECDSA P-256 key, then post the
4698
+ * `{ signatures, intent }` envelope.
4699
+ *
4700
+ * @see https://docs.dakota.xyz/documentation/signing-guide
4701
+ */
4702
+ type WalletTransactionRequest = components['schemas']['EndorsedRequest'];
4703
+ /**
4704
+ * The bare intent that goes inside `WalletTransactionRequest.intent`.
4705
+ * Exposed for callers building + signing the intent locally before
4706
+ * wrapping it in the endorsed envelope.
4707
+ */
4708
+ type SendTransactionIntent = components['schemas']['SendTransactionIntent'];
4655
4709
  /**
4656
4710
  * Endorsed request envelope: `{ signatures: string[], intent: <one of the
4657
4711
  * endorsed intent types> }`. Required by every mutating policy / signer-group
@@ -5178,6 +5232,19 @@ interface TransactionListParams extends ListParams {
5178
5232
  source_network_id?: string;
5179
5233
  source_asset?: string;
5180
5234
  destination_asset?: string;
5235
+ /**
5236
+ * Filter wallet transactions by wallet ID.
5237
+ * Only valid with `transaction_type: 'wallet'`.
5238
+ */
5239
+ wallet_id?: string;
5240
+ /**
5241
+ * Filter wallet transactions by direction relative to the wallet:
5242
+ * - `'out'` — transactions sent FROM the wallet
5243
+ * - `'in'` — transactions recorded with the wallet as the recipient
5244
+ *
5245
+ * Only valid with `transaction_type: 'wallet'`.
5246
+ */
5247
+ direction?: 'in' | 'out';
5181
5248
  }
5182
5249
  /** Event list parameters */
5183
5250
  interface EventListParams extends ListParams {
@@ -5216,6 +5283,15 @@ declare class CustomersResource extends BaseResource {
5216
5283
  * { idempotencyKey: 'create-acme-corp-001' }
5217
5284
  * );
5218
5285
  * console.log(customer.applicationUrl); // KYB onboarding URL
5286
+ *
5287
+ * // Designate as a sub-client at creation (ENG-2454).
5288
+ * // `is_sub_client` can only be set here — a regular customer cannot
5289
+ * // be promoted afterwards. Cannot be combined with `sub_client_id`.
5290
+ * const subClient = await client.customers.create({
5291
+ * name: 'Partner Corp',
5292
+ * customer_type: 'business',
5293
+ * is_sub_client: true,
5294
+ * });
5219
5295
  * ```
5220
5296
  */
5221
5297
  create(data: CustomerCreateRequest, options?: RequestOptions): Promise<CustomerCreateResponse>;
@@ -5410,33 +5486,42 @@ declare class DestinationsResource extends BaseResource {
5410
5486
  /**
5411
5487
  * Create a new destination for a recipient.
5412
5488
  *
5413
- * Destinations can be bank accounts (fiat_us) or crypto wallets (crypto).
5489
+ * Destinations can be bank accounts (fiat_us / fiat_iban) or crypto
5490
+ * wallets (crypto).
5491
+ *
5492
+ * The platform returns just `{ id }` here (per `IDResponse`), not the
5493
+ * full destination object. Call `destinations.list(recipientId)` if
5494
+ * you need the rest of the fields.
5414
5495
  *
5415
5496
  * @param recipientId - Recipient ID
5416
5497
  * @param data - Destination creation data
5417
- * @returns Created destination
5498
+ * @returns `{ id }` of the newly-created destination
5418
5499
  *
5419
5500
  * @example
5420
5501
  * ```typescript
5421
- * // Create a bank destination (for off-ramp)
5422
- * const bankDest = await client.destinations.create(recipientId, {
5423
- * destination_type: 'fiat_us',
5424
- * bank_name: 'Chase Bank',
5425
- * account_holder_name: 'Acme Corp',
5426
- * account_number: '123456789',
5427
- * routing_number: '021000021',
5428
- * account_type: 'checking',
5429
- * });
5430
- *
5431
- * // Create a crypto destination (for on-ramp)
5502
+ * // Crypto destination (for on-ramp)
5432
5503
  * const cryptoDest = await client.destinations.create(recipientId, {
5433
5504
  * destination_type: 'crypto',
5505
+ * name: 'Treasury USDC',
5434
5506
  * crypto_address: '0x742d35Cc6634C0532925a3b844Bc9e7595f...',
5435
5507
  * network_id: 'ethereum-mainnet',
5436
5508
  * });
5509
+ * // → cryptoDest.id
5510
+ *
5511
+ * // Fiat US destination (for off-ramp)
5512
+ * const bankDest = await client.destinations.create(recipientId, {
5513
+ * destination_type: 'fiat_us',
5514
+ * name: 'Acme Chase Checking',
5515
+ * bank_name: 'JPMorgan Chase',
5516
+ * account_holder_name: 'Acme Corp',
5517
+ * account_number: '000123456789',
5518
+ * aba_routing_number: '021000021',
5519
+ * account_type: 'checking',
5520
+ * });
5521
+ * // → bankDest.id
5437
5522
  * ```
5438
5523
  */
5439
- create(recipientId: string, data: DestinationRequest, options?: RequestOptions): Promise<Destination>;
5524
+ create(recipientId: string, data: DestinationRequest, options?: RequestOptions): Promise<DestinationCreateResponse>;
5440
5525
  /**
5441
5526
  * List destinations for a recipient.
5442
5527
  *
@@ -5641,6 +5726,13 @@ declare class TransactionsResource extends BaseResource {
5641
5726
  * customer_id: customerId,
5642
5727
  * status: 'completed',
5643
5728
  * });
5729
+ *
5730
+ * // Wallet-scoped filters (require transaction_type: 'wallet')
5731
+ * const sent = client.transactions.list({
5732
+ * transaction_type: 'wallet',
5733
+ * wallet_id: walletId,
5734
+ * direction: 'out',
5735
+ * });
5644
5736
  * ```
5645
5737
  */
5646
5738
  list(params?: TransactionListParams): PaginatedIterator<OneOffTransaction>;
@@ -5754,34 +5846,71 @@ declare class WalletsResource extends BaseResource {
5754
5846
  /**
5755
5847
  * Get wallet balances.
5756
5848
  *
5849
+ * Returns the platform's full `WalletBalances` response: the wallet id,
5850
+ * its on-chain address, every per-asset balance, and a pre-computed
5851
+ * `total_amount_usd` across all assets. The previous return shape
5852
+ * (`WalletBalance[]`) silently dropped `address` and `total_amount_usd`,
5853
+ * forcing callers to do a second `wallets.get()` and sum the balances
5854
+ * by hand. This is a small breaking change with a one-line migration
5855
+ * (`balances` → `balances.balances`); the prior shape had been broken
5856
+ * since 1.3.x anyway.
5857
+ *
5757
5858
  * @param walletId - Wallet ID
5758
- * @returns Array of balances
5859
+ * @returns `{ wallet_id, address, balances, total_amount_usd }`
5759
5860
  *
5760
5861
  * @example
5761
5862
  * ```typescript
5762
- * const balances = await client.wallets.getBalances(walletId);
5763
- * for (const balance of balances) {
5764
- * console.log(balance.asset, balance.amount);
5863
+ * const { address, total_amount_usd, balances } =
5864
+ * await client.wallets.getBalances(walletId);
5865
+ * console.log(`${address} → $${total_amount_usd}`);
5866
+ * for (const b of balances) {
5867
+ * console.log(b.asset.id, b.amount_usd);
5765
5868
  * }
5766
5869
  * ```
5767
5870
  */
5768
- getBalances(walletId: string): Promise<WalletBalance[]>;
5871
+ getBalances(walletId: string): Promise<WalletBalances>;
5769
5872
  /**
5770
- * Create a wallet transaction.
5873
+ * Send a transaction from a wallet.
5874
+ *
5875
+ * The platform expects an **endorsed request** envelope —
5876
+ * `{ signatures, intent }` — at this endpoint. Build the
5877
+ * `SendTransactionIntent`, canonicalize it per RFC 8785 (JCS), sign
5878
+ * with the wallet's signer-group ECDSA P-256 key, base64-encode the
5879
+ * DER signature, then post the envelope.
5771
5880
  *
5772
5881
  * @param walletId - Wallet ID
5773
- * @param data - Transaction data
5882
+ * @param data - Endorsed wallet transaction request: `{ signatures, intent }`
5774
5883
  * @returns Created transaction
5775
5884
  *
5776
5885
  * @example
5777
5886
  * ```typescript
5887
+ * import canonicalize from 'canonicalize';
5888
+ * import { createSign, createPrivateKey, randomUUID } from 'node:crypto';
5889
+ *
5890
+ * const intent = {
5891
+ * wallet_id: walletId,
5892
+ * caip2: 'eip155:1', // 11155111 for sepolia
5893
+ * operation: {
5894
+ * kind: 'transfer',
5895
+ * from: wallet.address,
5896
+ * to: '0x...',
5897
+ * amount: '100.00',
5898
+ * asset_id: 'USDC',
5899
+ * },
5900
+ * idempotency_key: randomUUID(),
5901
+ * };
5902
+ * const canonical = canonicalize(intent)!;
5903
+ * const sig = createSign('SHA256').update(canonical).sign({
5904
+ * key: createPrivateKey({ key: privateKeyDer, format: 'der', type: 'pkcs8' }),
5905
+ * dsaEncoding: 'der',
5906
+ * });
5778
5907
  * const tx = await client.wallets.createTransaction(walletId, {
5779
- * to: '0x...',
5780
- * amount: '100.00',
5781
- * asset: 'USDC',
5782
- * network_id: 'ethereum-mainnet',
5908
+ * signatures: [sig.toString('base64')],
5909
+ * intent,
5783
5910
  * });
5784
5911
  * ```
5912
+ *
5913
+ * @see https://docs.dakota.xyz/documentation/signing-guide
5785
5914
  */
5786
5915
  createTransaction(walletId: string, data: WalletTransactionRequest, options?: RequestOptions): Promise<WalletTransaction>;
5787
5916
  }
@@ -6878,4 +7007,4 @@ declare class ConfigurationError extends Error {
6878
7007
  constructor(message: string);
6879
7008
  }
6880
7009
 
6881
- export { APIError, type Account, type AccountCreateRequest, type AccountListParams, type AccountUpdateRequest, AccountsResource, type Address, type AdvanceSimulationRequest, type AdvanceSimulationResult, type ApiKey, type ApiKeyCreateRequest, type ApiKeyResponse, ApiKeysResource, type Application, type ApplicationDocumentType, type ApplicationDocumentUploadRequest, type ApplicationDocumentUploadUrlRequest, type ApplicationListItem, type ApplicationStatus, type ApplicationSubmissionRequest, ApplicationsResource, type AssociatedIndividual, type AssociatedIndividualRequest, type AttachedPolicy, type AttachedWallet, type AttestationSubmitRequest, type AttestationType, AuthMode, type AutoTransaction, AutoTransactionsResource, type AverageMonthlyRevenue, type BulkImportSumsubTokensRequest, type BulkImportSumsubTokensResponse, type BulkImportSumsubTokensResult, type BusinessApplicationCreateRequest, type BusinessDetailsResponse, type BusinessPurposeOfAccount, type BusinessSourceOfFunds, type ClientPricingConfig, ConfigurationError, type Country, type CreateApiKeyForClientRequest, type CryptoDestination, type CryptoDestinationRequest, type CursorExtractor, type Customer, type CustomerCreateRequest, type CustomerCreateResponse, type CustomerListParams, CustomersResource, DEFAULT_RETRY_POLICY, DakotaClient, type DakotaClientConfig, type Destination, type DestinationRequest, DestinationsResource, type DocumentUploadResponse, type DocumentUploadUrlResponse, type EDDRequest, type EDDWithApplicationID, type EmploymentStatus, type EndorsedRequest, Environment, type Event, type EventListParams, type EventType, EventsResource, type ExpectedMonthlyDeposit, type Family, type FiatUSDestination, type FiatUSDestinationRequest, type IndividualDetailsResponse, type IndividualDocumentType, type IndividualDocumentUploadRequest, type IndividualDocumentUploadUrlRequest, type IndividualRequest, type IndividualRole, type IndividualTitle, InfoResource, type KSUID, type KybStatus, type LegalStructure, type ListParams, type Logger, type Meta, type Network, type NetworkId, type OfframpAccount, type OfframpAccountCreateRequest, type OneOffTransaction, type OneOffTransactionRequest, type OnrampAccount, type OnrampAccountCreateRequest, type PageFetcher, PaginatedIterator, type PaginatedResponse, type PaginationMeta, type PaginationParams, type PaymentCapability, type PersonName, PoliciesResource, type Policy, type PolicyCreateRequest, type PolicyRule, type PolicyRuleCreateRequest, type Recipient, type RecipientRequest, type RecipientUpdateRequest, RecipientsResource, type RequestOptions, type ResolvedConfig, type RetryPolicy, SandboxResource, type SandboxScenario, type SelfServeCreditTier, type SelfServeCreditTiersResponse, type SelfServeCreditsBalanceResponse, type SelfServeCreditsLedgerEntry, type SelfServeCreditsLedgerEntryType, type SelfServeCreditsLedgerParams, type SelfServeCreditsLedgerResponse, type SelfServeCreditsPricingResponse, type SelfServeCreditsPurchaseRequest, type SelfServeCreditsPurchaseResponse, SelfServeResource, type Signer, type SignerCreateRequest, type SignerGroup, type SignerGroupCreateRequest, SignerGroupsResource, SignersResource, type SimulateInboundRequest, type SimulateInboundType, type SimulateOnboardingRequest, type SimulateOnboardingResponse, type SimulateOnboardingType, type SimulationCallbackRecord, type SimulationInspection, type SimulationResponse, type SubClientSummary, type SwapAccount, type SwapAccountCreateRequest, type TransactionListParams, type TransactionStatus, TransactionsResource, TransportError, type UpdateCustomerSubClientRequest, type UploadedDocumentMetadata, type User, type UserCreateRequest, type UserUpdateRequest, UsersResource, type Wallet, type WalletBalance, type WalletBalances, type WalletCreateRequest, type WalletTransaction, type WalletTransactionRequest, WalletsResource, type WebhookEvent, type WebhookHistoryList, type WebhookHistoryListParams, type WebhookHistoryResponse, type WebhookReplayResponse, type WebhookTarget, type WebhookTargetCreateRequest, type WebhookTargetUpdateRequest, WebhooksResource, consoleLogger, getEnvironmentURL, noopLogger, paginate };
7010
+ export { APIError, type Account, type AccountCreateRequest, type AccountListParams, type AccountUpdateRequest, AccountsResource, type Address, type AdvanceSimulationRequest, type AdvanceSimulationResult, type ApiKey, type ApiKeyCreateRequest, type ApiKeyResponse, ApiKeysResource, type Application, type ApplicationDocumentType, type ApplicationDocumentUploadRequest, type ApplicationDocumentUploadUrlRequest, type ApplicationListItem, type ApplicationStatus, type ApplicationSubmissionRequest, ApplicationsResource, type AssociatedIndividual, type AssociatedIndividualRequest, type AttachedPolicy, type AttachedWallet, type AttestationSubmitRequest, type AttestationType, AuthMode, type AutoTransaction, AutoTransactionsResource, type AverageMonthlyRevenue, type BulkImportSumsubTokensRequest, type BulkImportSumsubTokensResponse, type BulkImportSumsubTokensResult, type BusinessApplicationCreateRequest, type BusinessDetailsResponse, type BusinessPurposeOfAccount, type BusinessSourceOfFunds, type ClientPricingConfig, ConfigurationError, type Country, type CreateApiKeyForClientRequest, type CryptoDestination, type CryptoDestinationRequest, type CursorExtractor, type Customer, type CustomerCreateRequest, type CustomerCreateResponse, type CustomerListParams, CustomersResource, DEFAULT_RETRY_POLICY, DakotaClient, type DakotaClientConfig, type Destination, type DestinationCreateResponse, type DestinationRequest, DestinationsResource, type DocumentUploadResponse, type DocumentUploadUrlResponse, type EDDRequest, type EDDWithApplicationID, type EmploymentStatus, type EndorsedRequest, Environment, type Event, type EventListParams, type EventType, EventsResource, type ExpectedMonthlyDeposit, type Family, type FiatUSDestination, type FiatUSDestinationRequest, type IndividualDetailsResponse, type IndividualDocumentType, type IndividualDocumentUploadRequest, type IndividualDocumentUploadUrlRequest, type IndividualRequest, type IndividualRole, type IndividualTitle, InfoResource, type KSUID, type KybStatus, type LegalStructure, type ListParams, type Logger, type Meta, type Network, type NetworkId, type OfframpAccount, type OfframpAccountCreateRequest, type OneOffTransaction, type OneOffTransactionRequest, type OnrampAccount, type OnrampAccountCreateRequest, type PageFetcher, PaginatedIterator, type PaginatedResponse, type PaginationMeta, type PaginationParams, type PaymentCapability, type PersonName, PoliciesResource, type Policy, type PolicyCreateRequest, type PolicyRule, type PolicyRuleCreateRequest, type Recipient, type RecipientRequest, type RecipientUpdateRequest, RecipientsResource, type RequestOptions, type ResolvedConfig, type RetryPolicy, SandboxResource, type SandboxScenario, type SelfServeCreditTier, type SelfServeCreditTiersResponse, type SelfServeCreditsBalanceResponse, type SelfServeCreditsLedgerEntry, type SelfServeCreditsLedgerEntryType, type SelfServeCreditsLedgerParams, type SelfServeCreditsLedgerResponse, type SelfServeCreditsPricingResponse, type SelfServeCreditsPurchaseRequest, type SelfServeCreditsPurchaseResponse, SelfServeResource, type SendTransactionIntent, type Signer, type SignerCreateRequest, type SignerGroup, type SignerGroupCreateRequest, SignerGroupsResource, SignersResource, type SimulateInboundRequest, type SimulateInboundType, type SimulateOnboardingRequest, type SimulateOnboardingResponse, type SimulateOnboardingType, type SimulationCallbackRecord, type SimulationInspection, type SimulationResponse, type SubClientSummary, type SwapAccount, type SwapAccountCreateRequest, type TransactionListParams, type TransactionStatus, TransactionsResource, TransportError, type UpdateCustomerSubClientRequest, type UploadedDocumentMetadata, type User, type UserCreateRequest, type UserUpdateRequest, UsersResource, type Wallet, type WalletBalance, type WalletBalances, type WalletCreateRequest, type WalletTransaction, type WalletTransactionRequest, WalletsResource, type WebhookEvent, type WebhookHistoryList, type WebhookHistoryListParams, type WebhookHistoryResponse, type WebhookReplayResponse, type WebhookTarget, type WebhookTargetCreateRequest, type WebhookTargetUpdateRequest, WebhooksResource, consoleLogger, getEnvironmentURL, noopLogger, paginate };
package/dist/index.js CHANGED
@@ -614,6 +614,15 @@ var CustomersResource = class extends BaseResource {
614
614
  * { idempotencyKey: 'create-acme-corp-001' }
615
615
  * );
616
616
  * console.log(customer.applicationUrl); // KYB onboarding URL
617
+ *
618
+ * // Designate as a sub-client at creation (ENG-2454).
619
+ * // `is_sub_client` can only be set here — a regular customer cannot
620
+ * // be promoted afterwards. Cannot be combined with `sub_client_id`.
621
+ * const subClient = await client.customers.create({
622
+ * name: 'Partner Corp',
623
+ * customer_type: 'business',
624
+ * is_sub_client: true,
625
+ * });
617
626
  * ```
618
627
  */
619
628
  async create(data, options) {
@@ -856,30 +865,39 @@ var DestinationsResource = class extends BaseResource {
856
865
  /**
857
866
  * Create a new destination for a recipient.
858
867
  *
859
- * Destinations can be bank accounts (fiat_us) or crypto wallets (crypto).
868
+ * Destinations can be bank accounts (fiat_us / fiat_iban) or crypto
869
+ * wallets (crypto).
870
+ *
871
+ * The platform returns just `{ id }` here (per `IDResponse`), not the
872
+ * full destination object. Call `destinations.list(recipientId)` if
873
+ * you need the rest of the fields.
860
874
  *
861
875
  * @param recipientId - Recipient ID
862
876
  * @param data - Destination creation data
863
- * @returns Created destination
877
+ * @returns `{ id }` of the newly-created destination
864
878
  *
865
879
  * @example
866
880
  * ```typescript
867
- * // Create a bank destination (for off-ramp)
868
- * const bankDest = await client.destinations.create(recipientId, {
869
- * destination_type: 'fiat_us',
870
- * bank_name: 'Chase Bank',
871
- * account_holder_name: 'Acme Corp',
872
- * account_number: '123456789',
873
- * routing_number: '021000021',
874
- * account_type: 'checking',
875
- * });
876
- *
877
- * // Create a crypto destination (for on-ramp)
881
+ * // Crypto destination (for on-ramp)
878
882
  * const cryptoDest = await client.destinations.create(recipientId, {
879
883
  * destination_type: 'crypto',
884
+ * name: 'Treasury USDC',
880
885
  * crypto_address: '0x742d35Cc6634C0532925a3b844Bc9e7595f...',
881
886
  * network_id: 'ethereum-mainnet',
882
887
  * });
888
+ * // → cryptoDest.id
889
+ *
890
+ * // Fiat US destination (for off-ramp)
891
+ * const bankDest = await client.destinations.create(recipientId, {
892
+ * destination_type: 'fiat_us',
893
+ * name: 'Acme Chase Checking',
894
+ * bank_name: 'JPMorgan Chase',
895
+ * account_holder_name: 'Acme Corp',
896
+ * account_number: '000123456789',
897
+ * aba_routing_number: '021000021',
898
+ * account_type: 'checking',
899
+ * });
900
+ * // → bankDest.id
883
901
  * ```
884
902
  */
885
903
  async create(recipientId, data, options) {
@@ -1115,6 +1133,13 @@ var TransactionsResource = class extends BaseResource {
1115
1133
  * customer_id: customerId,
1116
1134
  * status: 'completed',
1117
1135
  * });
1136
+ *
1137
+ * // Wallet-scoped filters (require transaction_type: 'wallet')
1138
+ * const sent = client.transactions.list({
1139
+ * transaction_type: 'wallet',
1140
+ * wallet_id: walletId,
1141
+ * direction: 'out',
1142
+ * });
1118
1143
  * ```
1119
1144
  */
1120
1145
  list(params) {
@@ -1256,40 +1281,76 @@ var WalletsResource = class extends BaseResource {
1256
1281
  /**
1257
1282
  * Get wallet balances.
1258
1283
  *
1284
+ * Returns the platform's full `WalletBalances` response: the wallet id,
1285
+ * its on-chain address, every per-asset balance, and a pre-computed
1286
+ * `total_amount_usd` across all assets. The previous return shape
1287
+ * (`WalletBalance[]`) silently dropped `address` and `total_amount_usd`,
1288
+ * forcing callers to do a second `wallets.get()` and sum the balances
1289
+ * by hand. This is a small breaking change with a one-line migration
1290
+ * (`balances` → `balances.balances`); the prior shape had been broken
1291
+ * since 1.3.x anyway.
1292
+ *
1259
1293
  * @param walletId - Wallet ID
1260
- * @returns Array of balances
1294
+ * @returns `{ wallet_id, address, balances, total_amount_usd }`
1261
1295
  *
1262
1296
  * @example
1263
1297
  * ```typescript
1264
- * const balances = await client.wallets.getBalances(walletId);
1265
- * for (const balance of balances) {
1266
- * console.log(balance.asset, balance.amount);
1298
+ * const { address, total_amount_usd, balances } =
1299
+ * await client.wallets.getBalances(walletId);
1300
+ * console.log(`${address} → $${total_amount_usd}`);
1301
+ * for (const b of balances) {
1302
+ * console.log(b.asset.id, b.amount_usd);
1267
1303
  * }
1268
1304
  * ```
1269
1305
  */
1270
1306
  async getBalances(walletId) {
1271
- const response = await this.transport.request({
1307
+ return this.transport.request({
1272
1308
  method: "GET",
1273
1309
  path: `/wallets/${walletId}/balances`
1274
1310
  });
1275
- return response.balances ? [...response.balances] : [];
1276
1311
  }
1277
1312
  /**
1278
- * Create a wallet transaction.
1313
+ * Send a transaction from a wallet.
1314
+ *
1315
+ * The platform expects an **endorsed request** envelope —
1316
+ * `{ signatures, intent }` — at this endpoint. Build the
1317
+ * `SendTransactionIntent`, canonicalize it per RFC 8785 (JCS), sign
1318
+ * with the wallet's signer-group ECDSA P-256 key, base64-encode the
1319
+ * DER signature, then post the envelope.
1279
1320
  *
1280
1321
  * @param walletId - Wallet ID
1281
- * @param data - Transaction data
1322
+ * @param data - Endorsed wallet transaction request: `{ signatures, intent }`
1282
1323
  * @returns Created transaction
1283
1324
  *
1284
1325
  * @example
1285
1326
  * ```typescript
1327
+ * import canonicalize from 'canonicalize';
1328
+ * import { createSign, createPrivateKey, randomUUID } from 'node:crypto';
1329
+ *
1330
+ * const intent = {
1331
+ * wallet_id: walletId,
1332
+ * caip2: 'eip155:1', // 11155111 for sepolia
1333
+ * operation: {
1334
+ * kind: 'transfer',
1335
+ * from: wallet.address,
1336
+ * to: '0x...',
1337
+ * amount: '100.00',
1338
+ * asset_id: 'USDC',
1339
+ * },
1340
+ * idempotency_key: randomUUID(),
1341
+ * };
1342
+ * const canonical = canonicalize(intent)!;
1343
+ * const sig = createSign('SHA256').update(canonical).sign({
1344
+ * key: createPrivateKey({ key: privateKeyDer, format: 'der', type: 'pkcs8' }),
1345
+ * dsaEncoding: 'der',
1346
+ * });
1286
1347
  * const tx = await client.wallets.createTransaction(walletId, {
1287
- * to: '0x...',
1288
- * amount: '100.00',
1289
- * asset: 'USDC',
1290
- * network_id: 'ethereum-mainnet',
1348
+ * signatures: [sig.toString('base64')],
1349
+ * intent,
1291
1350
  * });
1292
1351
  * ```
1352
+ *
1353
+ * @see https://docs.dakota.xyz/documentation/signing-guide
1293
1354
  */
1294
1355
  async createTransaction(walletId, data, options) {
1295
1356
  return this.transport.request({