@aura-payments/sdk 2.1.1 → 2.3.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/README.md CHANGED
@@ -14,6 +14,8 @@ pnpm add @aura-payments/sdk
14
14
 
15
15
  ## Quick Start
16
16
 
17
+ Receive USDC and split it across recipients in one call (testnet):
18
+
17
19
  ```typescript
18
20
  import { AuraClient } from '@aura-payments/sdk'
19
21
 
@@ -21,25 +23,36 @@ const client = new AuraClient({
21
23
  apiKey: process.env.AURA_API_KEY!,
22
24
  })
23
25
 
24
- // Create a multi-party escrow
25
- const escrow = await client.escrows.create({
26
+ // receiveAndSplit pays from the wallet owned by this id with type 'buyer' —
27
+ // create the wallet with the SAME id and type (the default type is 'BUSINESS').
28
+ const PAYER_ID = 'my-agent'
29
+
30
+ // 1. Provision (create-or-get) the payer wallet — moves no money.
31
+ const wallet = await client.wallets.create({ entityId: PAYER_ID, chain: 'ARC', type: 'buyer' })
32
+
33
+ // 2. (testnet) drip USDC into the payer wallet.
34
+ await client.wallets.requestTestnetFunds(wallet.walletId)
35
+
36
+ // 3. Escrow create → fund → release, in one call.
37
+ const result = await client.escrows.receiveAndSplit({
26
38
  orderId: 'order-123',
27
- amountUsdc: '100.00',
28
- splits: {
29
- vendorEntityId: 'vendor-1',
30
- sellerEntityId: 'seller-1',
31
- platformEntityId: 'platform-1',
32
- vendorPercentage: 70,
33
- sellerPercentage: 20,
34
- platformPercentage: 10,
35
- },
36
- adminSafeAddress: '0x...',
39
+ payerOwnerId: PAYER_ID,
40
+ amount: '10',
41
+ chain: 'ARC',
42
+ splits: [
43
+ { ownerType: 'vendor', ownerId: 'vendor-1', role: 'vendor', percentage: 80 },
44
+ { ownerType: 'platform', ownerId: 'platform-1', role: 'platform', percentage: 20 },
45
+ ],
37
46
  })
38
47
 
39
- console.log(`Escrow created: ${escrow.escrowId}`)
40
- console.log(`Vault address: ${escrow.vaultAddress}`)
48
+ console.log(result.stage) // 'released' on the happy path
49
+ console.log(result.escrow.escrowId)
41
50
  ```
42
51
 
52
+ Scaffold this flow into any project with the CLI: `npx @aura-payments/cli init`
53
+ (writes `.mcp.json`, `.env.example`, an `AGENTS.md` section, and
54
+ `examples/aura/receive.ts`).
55
+
43
56
  ## Features
44
57
 
45
58
  - **Type-Safe** - Full TypeScript support with comprehensive type definitions
@@ -58,8 +71,8 @@ const client = new AuraClient({
58
71
  // Required: Your API key from the Aura dashboard
59
72
  apiKey: 'ak_live_...',
60
73
 
61
- // Optional: API base URL (default: https://api.aura-payments.com)
62
- baseUrl: 'https://api.aura-payments.com',
74
+ // Optional: API base URL (default: https://getaura.sh/api)
75
+ baseUrl: 'https://getaura.sh/api',
63
76
 
64
77
  // Optional: Request timeout in ms (default: 30000)
65
78
  timeout: 30000,
@@ -78,6 +91,39 @@ const client = new AuraClient({
78
91
 
79
92
  Escrows enable secure multi-party payments with configurable splits and release conditions.
80
93
 
94
+ #### Receive and Split (one call)
95
+
96
+ `receiveAndSplit` composes the full escrow loop — create → wait for deployment →
97
+ pre-flight balance check → fund → wait for settlement → release:
98
+
99
+ ```typescript
100
+ const result = await client.escrows.receiveAndSplit({
101
+ orderId: 'order-123',
102
+ payerOwnerId: 'my-agent', // wallet owned by this id with type 'buyer' pays
103
+ amount: '10',
104
+ chain: 'ARC',
105
+ splits: [
106
+ { ownerType: 'vendor', ownerId: 'vendor-1', role: 'vendor', percentage: 80 },
107
+ { ownerType: 'platform', ownerId: 'platform-1', role: 'platform', percentage: 20 },
108
+ ],
109
+ // Optional: autoRelease (default true), waitForDeploymentMs, waitForFundingMs,
110
+ // pollIntervalMs, idempotencyKey
111
+ })
112
+ ```
113
+
114
+ The result's `stage` makes partial runs explicit:
115
+
116
+ | Stage | Meaning | Resume with |
117
+ |-------|---------|-------------|
118
+ | `created` | deployment didn't confirm in time (`deploymentPending: true`) | re-check `result.escrow.escrowId` |
119
+ | `deployed` | payer wallet lacks funds — see `result.fundingRequired` | fund the payer wallet, then `escrows.fund` + `escrows.release` |
120
+ | `funded` | funded but not released (`autoRelease: false` or settlement pending) | `escrows.release` |
121
+ | `released` | funds split to recipients (happy path) | — |
122
+
123
+ Resume a partial run by acting on the returned `escrow.escrowId` — do NOT
124
+ re-call `receiveAndSplit` with the same `orderId` (it would re-create and hit a
125
+ duplicate-orderId error).
126
+
81
127
  #### Create Escrow
82
128
 
83
129
  ```typescript
@@ -194,12 +240,29 @@ Manage Circle Developer-Controlled Wallets for your entities.
194
240
 
195
241
  ```typescript
196
242
  const wallet = await client.wallets.create({
197
- entityId: 'entity-uuid',
243
+ entityId: 'entity-id', // your unique entity identifier
198
244
  chain: 'ARC', // 'ARC' | 'ARB' | 'BASE' | 'ETH' | 'MATIC' | 'SOL'
199
- type: 'developer_controlled', // 'developer_controlled' | 'user_controlled'
245
+ type: 'buyer', // owner type: 'BUSINESS' (default) | 'buyer' | 'seller' | 'vendor' | 'platform' | ...
200
246
  })
247
+ // Create-or-get: returns { walletId, address, ownerType, ownerId, isNew, ... }
248
+ ```
249
+
250
+ Note: `receiveAndSplit` pays from the wallet owned by `payerOwnerId` with type
251
+ `'buyer'` — create that wallet with the same `entityId` and `type: 'buyer'`.
252
+
253
+ #### Request Testnet Funds
254
+
255
+ Drip testnet USDC into a wallet from the platform faucet (testnet only):
256
+
257
+ ```typescript
258
+ await client.wallets.requestTestnetFunds(wallet.walletId)
259
+ // Optional params: { token: 'USDC', chain: 'ARC' }
201
260
  ```
202
261
 
262
+ The drip lands asynchronously on-chain — poll `getBalance` until it reflects.
263
+ Throws `AuraFaucetUnavailableError` if the deployment has no faucet enabled;
264
+ fund the wallet address manually in that case.
265
+
203
266
  #### Get Wallet
204
267
 
205
268
  ```typescript
package/dist/index.d.mts CHANGED
@@ -69,6 +69,13 @@ interface Escrow {
69
69
  factoryAddress: string | null;
70
70
  deployed: boolean;
71
71
  mode: string;
72
+ /**
73
+ * Definitive fund gate: true only once the deploy outcome is known —
74
+ * contract deployed (mode 'hybrid') or the platform completed the
75
+ * Circle-only fallback (mode 'circle-only'). False while a deployment
76
+ * is still running (mode 'pending').
77
+ */
78
+ ready?: boolean;
72
79
  };
73
80
  createdAt: string;
74
81
  }
@@ -118,6 +125,13 @@ interface CreateEscrowResponse {
118
125
  factoryAddress: string | null;
119
126
  deployed: boolean;
120
127
  mode: string;
128
+ /**
129
+ * Definitive fund gate: true only once the deploy outcome is known —
130
+ * contract deployed (mode 'hybrid') or the platform completed the
131
+ * Circle-only fallback (mode 'circle-only'). False while a deployment
132
+ * is still running (mode 'pending').
133
+ */
134
+ ready?: boolean;
121
135
  };
122
136
  unlock?: {
123
137
  type: 'manual' | 'timeout' | 'oracle' | 'hybrid';
@@ -519,11 +533,12 @@ declare class Escrows {
519
533
  * Receive USDC and split it across recipients in a single call (board D4).
520
534
  *
521
535
  * Composes the existing, crash-safe escrow path:
522
- * create → poll-until-deployed → pre-flight balance → fund → poll-until-funded → release.
536
+ * create → poll-until-fundable (deployed or completed Circle-only fallback) → pre-flight balance → fund → poll-until-funded → release.
523
537
  *
524
538
  * Funds move from an Aura wallet owned by `payerOwnerId` (the agent itself or a
525
539
  * counterparty). The result's `stage` makes a partial run explicit:
526
- * - `created` — deployment didn't confirm within `waitForDeploymentMs`
540
+ * - `created` — deploy outcome not definitive within `waitForDeploymentMs`
541
+ * (neither deployed nor the completed Circle-only fallback)
527
542
  * - `deployed` — payer wallet lacks funds (see `fundingRequired`); no money moved
528
543
  * - `funded` — funded but not released (`autoRelease:false`, or funding didn't
529
544
  * settle within `waitForFundingMs` → `fundingPending: true`)
@@ -558,6 +573,217 @@ declare class Escrows {
558
573
  getDispute(escrowId: string, disputeId: string): Promise<Dispute>;
559
574
  }
560
575
 
576
+ /**
577
+ * Insights types for the Aura Payments SDK
578
+ *
579
+ * Mirrors the platform routes under `app/api/v1/insights/`:
580
+ * GET /v1/insights/overview KPIs for a period, with change vs the prior one
581
+ * GET /v1/insights/forecast ML forecast for a metric (Growth+ gated)
582
+ * GET /v1/insights/audit paginated audit log
583
+ *
584
+ * All three wrap their payload in `{data, meta}`, which the client unwraps, so
585
+ * these types describe the inner payload.
586
+ *
587
+ * `POST /v1/insights/audit/export` is not modelled: it returns an async job id
588
+ * that must be polled and then downloaded — a multi-step flow of its own.
589
+ */
590
+ /** Period selector shared by the overview and audit routes. */
591
+ type InsightsPeriod = 'today' | '7d' | '30d' | '90d' | 'custom';
592
+ /** A KPI with its change against the previous period. */
593
+ interface MetricValue {
594
+ value: number;
595
+ /** Percentage change vs the previous period. */
596
+ change: number;
597
+ previousValue: number;
598
+ }
599
+ interface SparklinePoint {
600
+ /** ISO 8601 datetime. */
601
+ timestamp: string;
602
+ value: number;
603
+ }
604
+ interface VolumeBarPoint {
605
+ label: string;
606
+ value: number;
607
+ count: number;
608
+ }
609
+ interface InsightsOverview {
610
+ /** Resolved window for the requested period; both ISO 8601 datetimes. */
611
+ period: {
612
+ start: string;
613
+ end: string;
614
+ };
615
+ metrics: {
616
+ revenue: MetricValue;
617
+ transactions: MetricValue;
618
+ activeEscrows: MetricValue;
619
+ commissions: MetricValue;
620
+ };
621
+ charts: {
622
+ revenueSparkline: SparklinePoint[];
623
+ volumeBar: VolumeBarPoint[];
624
+ /** Fraction between 0 and 1 (e.g. 0.982). */
625
+ successRate: number;
626
+ };
627
+ }
628
+ /** Metrics the forecast route can project. */
629
+ type ForecastMetric = 'revenue' | 'transaction_count' | 'escrow_count' | 'commission' | 'avg_transaction_value';
630
+ /** Forecasting algorithms accepted by the route (it validates an enum). */
631
+ type ForecastAlgorithm = 'linear_regression' | 'moving_average' | 'exponential_smoothing' | 'arima' | 'prophet' | 'ensemble';
632
+ type ForecastPeriod = 'daily' | 'weekly' | 'monthly';
633
+ interface ForecastParams {
634
+ metric: ForecastMetric;
635
+ algorithm?: ForecastAlgorithm;
636
+ period?: ForecastPeriod;
637
+ /** Number of periods to project (1–365). */
638
+ horizon?: number;
639
+ includeHistory?: boolean;
640
+ /** Historical periods to include (1–365). */
641
+ historyPeriods?: number;
642
+ }
643
+ interface TimeSeriesPoint {
644
+ /** ISO 8601 datetime. */
645
+ timestamp: string;
646
+ value: number;
647
+ label?: string;
648
+ }
649
+ interface ForecastPoint {
650
+ /** ISO 8601 date (YYYY-MM-DD). */
651
+ date: string;
652
+ predicted: number;
653
+ /** 5th percentile. */
654
+ lowerBound: number;
655
+ /** 95th percentile. */
656
+ upperBound: number;
657
+ /** Present when the date is in the past, for accuracy tracking. */
658
+ actual?: number;
659
+ }
660
+ interface ForecastSeries {
661
+ metric: ForecastMetric;
662
+ algorithm: ForecastAlgorithm;
663
+ period: ForecastPeriod;
664
+ /** e.g. 0.95 for a 95% confidence interval. */
665
+ confidenceLevel: number;
666
+ historical: TimeSeriesPoint[];
667
+ forecast: ForecastPoint[];
668
+ accuracy: {
669
+ mape: number;
670
+ r2: number;
671
+ trainingPoints: number;
672
+ };
673
+ /** ISO 8601 datetime. */
674
+ generatedAt: string;
675
+ }
676
+ interface ForecastProjection {
677
+ predicted: number;
678
+ lowerBound: number;
679
+ upperBound: number;
680
+ }
681
+ interface ForecastSummary {
682
+ currentPeriod: {
683
+ value: number;
684
+ isActual: boolean;
685
+ changeFromPrevious: number;
686
+ };
687
+ nextPeriod: ForecastProjection;
688
+ next30Days: ForecastProjection;
689
+ next90Days: ForecastProjection;
690
+ /** A qualitative band, not a number. */
691
+ modelConfidence: 'high' | 'medium' | 'low';
692
+ trend: 'up' | 'down' | 'stable';
693
+ }
694
+ interface ForecastResult {
695
+ forecast: ForecastSeries;
696
+ summary: ForecastSummary;
697
+ }
698
+ /** Who or what performed an audited action. */
699
+ type AuditActor = 'user' | 'system' | 'api' | 'cron' | 'webhook';
700
+ interface AuditParams {
701
+ action?: string;
702
+ actor?: AuditActor;
703
+ resourceType?: string;
704
+ resourceId?: string;
705
+ /** Defaults to `30d` server-side. */
706
+ range?: InsightsPeriod;
707
+ /** ISO 8601 datetime; required together with `end` when `range` is `custom`. */
708
+ start?: string;
709
+ /** ISO 8601 datetime; required together with `start` when `range` is `custom`. */
710
+ end?: string;
711
+ /** 1-based page number. */
712
+ page?: number;
713
+ /** Page size, 1–100 (default 50). */
714
+ limit?: number;
715
+ }
716
+ interface AuditEntry {
717
+ id: string;
718
+ action: string;
719
+ actor: AuditActor;
720
+ actorId?: string;
721
+ actorName?: string;
722
+ resourceType: string;
723
+ resourceId: string;
724
+ description: string;
725
+ amountUsdc?: string;
726
+ ipAddress?: string;
727
+ userAgent?: string;
728
+ /** ISO 8601 datetime. */
729
+ timestamp: string;
730
+ /** Checksum linking this entry to the previous one. */
731
+ checksum: string;
732
+ previousChecksum?: string;
733
+ /** Monotonic per-account sequence number; absent on pre-backfill rows. */
734
+ sequenceNo?: number;
735
+ }
736
+ interface AuditSummary {
737
+ totalEntries: number;
738
+ byAction: Record<string, number>;
739
+ byActor: Record<AuditActor, number>;
740
+ last24Hours: number;
741
+ chainIntegrityIssues: number;
742
+ /** ISO 8601 datetime. */
743
+ lastVerified?: string;
744
+ }
745
+ interface AuditResult {
746
+ items: AuditEntry[];
747
+ total: number;
748
+ page: number;
749
+ limit: number;
750
+ hasMore: boolean;
751
+ cursor?: string;
752
+ summary: AuditSummary;
753
+ }
754
+
755
+ /**
756
+ * Insights resource for Aura Payments SDK
757
+ *
758
+ * Read-only analytics. `POST /v1/insights/audit/export` is intentionally absent:
759
+ * it returns an async job id that must be polled and then downloaded, which is a
760
+ * multi-step flow rather than a single call.
761
+ */
762
+
763
+ declare class Insights {
764
+ private client;
765
+ constructor(client: AuraClient);
766
+ /**
767
+ * Revenue, transactions, active escrows and commissions for a period, each
768
+ * with its change against the prior period.
769
+ *
770
+ * The route defaults to `7d`. `start` and `end` are ISO 8601 datetimes and are
771
+ * both required when `period` is `'custom'`.
772
+ */
773
+ overview(period?: InsightsPeriod, start?: string, end?: string): Promise<InsightsOverview>;
774
+ /**
775
+ * Forecast a metric over a horizon. Gated to Growth+ plans; lower tiers
776
+ * surface a 403 `AuraAPIError`.
777
+ */
778
+ forecast(params: ForecastParams): Promise<ForecastResult>;
779
+ /**
780
+ * Query the account audit log by action, actor, resource and date range.
781
+ *
782
+ * The route defaults to `range: '30d'`, `page: 1`, `limit: 50`.
783
+ */
784
+ audit(params?: AuditParams): Promise<AuditResult>;
785
+ }
786
+
561
787
  /**
562
788
  * Mandate types for Aura Payments SDK.
563
789
  *
@@ -807,6 +1033,64 @@ declare class Policies {
807
1033
  create(params: CreatePolicyParams, idempotencyKey?: string): Promise<AgentPolicy>;
808
1034
  }
809
1035
 
1036
+ /**
1037
+ * Treasury types for the Aura Payments SDK
1038
+ *
1039
+ * Mirrors `POST /v1/treasury/optimize`, which returns an AI recommendation over
1040
+ * the account's wallet balances and escrow exposure. The route is snake_case and
1041
+ * — unlike the rest of the API — reports balances as JSON **numbers**, not
1042
+ * decimal strings, because it sums Circle balances with `parseFloat` and returns
1043
+ * the raw values. Treat them as display figures, never as settlement amounts.
1044
+ *
1045
+ * `POST /v1/treasury/batch` is deliberately not modelled: it executes 1–10 real
1046
+ * transfers and needs a dedicated confirm/preview flow, not a bare method call.
1047
+ */
1048
+ interface TreasuryWallet {
1049
+ id: string;
1050
+ address: string;
1051
+ chain: string;
1052
+ /** USDC balance as a number (see the module note on precision). */
1053
+ balance: number;
1054
+ }
1055
+ interface TreasuryRecommendation {
1056
+ action: string;
1057
+ reasoning: string;
1058
+ confidence: number;
1059
+ }
1060
+ interface TreasuryOptimization {
1061
+ /** Total USDC across all non-escrow wallets. */
1062
+ treasury_balance: number;
1063
+ /** USDC locked in funded/locked escrows. */
1064
+ pending_payouts: number;
1065
+ /** `treasury_balance` minus `pending_payouts`. */
1066
+ available: number;
1067
+ active_escrows: number;
1068
+ wallets: TreasuryWallet[];
1069
+ recommendation: TreasuryRecommendation;
1070
+ }
1071
+
1072
+ /**
1073
+ * Treasury resource for Aura Payments SDK
1074
+ *
1075
+ * Read-only analysis surface. `POST /v1/treasury/batch` (bulk transfers) is
1076
+ * intentionally absent — it moves real money across 1–10 recipients and needs a
1077
+ * dedicated confirm/preview flow rather than a single method call.
1078
+ */
1079
+
1080
+ declare class Treasury {
1081
+ private client;
1082
+ constructor(client: AuraClient);
1083
+ /**
1084
+ * Analyze treasury balances, escrow exposure and pending payouts, and return
1085
+ * an AI recommendation. Moves no funds.
1086
+ *
1087
+ * A POST with no body — the platform derives everything from the authenticated
1088
+ * account. Gated to Growth+ plans; lower tiers surface a 403 `AuraAPIError`
1089
+ * with code `feature_not_available`.
1090
+ */
1091
+ optimize(): Promise<TreasuryOptimization>;
1092
+ }
1093
+
810
1094
  /**
811
1095
  * Wallet types for Aura Payments SDK
812
1096
  * Public API types for external developers
@@ -1102,6 +1386,199 @@ declare class Webhooks {
1102
1386
  private static secureCompare;
1103
1387
  }
1104
1388
 
1389
+ /**
1390
+ * Withdrawal types for the Aura Payments SDK
1391
+ *
1392
+ * Mirrors the platform routes under `app/api/v1/withdrawals/`:
1393
+ * GET /v1/withdrawals list (returns the whole {withdrawals,pagination} wrapper)
1394
+ * GET /v1/withdrawals/:id get
1395
+ * POST /v1/withdrawals/estimate fee/net-amount preview (no money moves)
1396
+ * GET /v1/withdrawals/limits KYC-tier limits ({success,data} — SDK returns `data`)
1397
+ * POST /v1/withdrawals/validate destination address validation (no money moves)
1398
+ *
1399
+ * `POST /v1/withdrawals` (create) is deliberately NOT modelled here: the route is
1400
+ * behind `stepUpGuard({maxAge:'5m'})`, which an API-key client cannot satisfy.
1401
+ */
1402
+ /** Blockchain networks accepted by the withdrawal routes. */
1403
+ type WithdrawalChain = 'ARC' | 'ETH' | 'BASE' | 'ARB' | 'MATIC';
1404
+ /** Where the funds land: a CEX deposit address or a self-custody wallet. */
1405
+ type WithdrawalDestinationType = 'exchange' | 'wallet';
1406
+ /** Platform fee configuration applied to the withdrawal. */
1407
+ type WithdrawalFeeConfig = 'FREE' | 'GAS_ONLY' | 'STANDARD';
1408
+ /** Exchange hint used for deposit-address heuristics and warnings. */
1409
+ type WithdrawalExchange = 'binance' | 'coinbase' | 'kraken' | 'other';
1410
+ /** Withdrawal lifecycle: pending → submitted → confirmed | failed (or cancelled). */
1411
+ type WithdrawalStatus = 'pending' | 'submitted' | 'confirmed' | 'failed' | 'cancelled';
1412
+ /** Classification of a destination address. */
1413
+ type WithdrawalAddressType = 'eoa' | 'contract' | 'unknown';
1414
+ /** Split of the platform fee into its gas-coverage and margin components. */
1415
+ interface WithdrawalFeeBreakdown {
1416
+ gasComponent: string;
1417
+ platformComponent: string;
1418
+ }
1419
+ interface Withdrawal {
1420
+ id: string;
1421
+ status: WithdrawalStatus;
1422
+ amount: string;
1423
+ netAmount: string;
1424
+ platformFee: string;
1425
+ destinationAddress: string;
1426
+ chain: WithdrawalChain;
1427
+ exchange?: WithdrawalExchange;
1428
+ circleTransferId?: string;
1429
+ txHash?: string;
1430
+ estimatedConfirmation?: string;
1431
+ confirmedAt?: string;
1432
+ failureReason?: string;
1433
+ feeBreakdown?: WithdrawalFeeBreakdown;
1434
+ createdAt: string;
1435
+ }
1436
+ interface ListWithdrawalsParams {
1437
+ /** Page size. The route clamps this to a maximum of 100 (default 50). */
1438
+ limit?: number;
1439
+ offset?: number;
1440
+ status?: WithdrawalStatus;
1441
+ chain?: WithdrawalChain;
1442
+ /** ISO 8601 datetime. */
1443
+ fromDate?: string;
1444
+ /** ISO 8601 datetime. */
1445
+ toDate?: string;
1446
+ }
1447
+ interface ListWithdrawalsResponse {
1448
+ withdrawals: Withdrawal[];
1449
+ pagination: {
1450
+ limit: number;
1451
+ offset: number;
1452
+ count: number;
1453
+ hasMore: boolean;
1454
+ };
1455
+ }
1456
+ /**
1457
+ * Estimate request.
1458
+ *
1459
+ * `exchange` is REQUIRED by the route whenever `destinationType` is `'exchange'`
1460
+ * (the route validates a discriminated union), and is ignored for `'wallet'`.
1461
+ * `sourceChain` defaults to `ARC`; a source ≠ destination pair is bridged via CCTP
1462
+ * and only the supported routes (ARC → BASE/ETH/SOL) are accepted.
1463
+ */
1464
+ interface EstimateWithdrawalParams {
1465
+ walletId: string;
1466
+ /** USDC amount, up to 6 decimals (e.g. "100.00"). */
1467
+ amount: string;
1468
+ destinationType: WithdrawalDestinationType;
1469
+ /** EVM address: 0x + 40 hex chars. */
1470
+ destinationAddress: string;
1471
+ chain: WithdrawalChain;
1472
+ exchange?: WithdrawalExchange;
1473
+ sourceChain?: WithdrawalChain;
1474
+ feeConfig?: WithdrawalFeeConfig;
1475
+ }
1476
+ interface WithdrawalEstimate {
1477
+ requestedAmount: string;
1478
+ platformFee: string;
1479
+ /** Only set for cross-chain (CCTP) transfers. */
1480
+ bridgeFee: string | null;
1481
+ networkFee: string;
1482
+ totalFees: string;
1483
+ netAmount: string;
1484
+ /** ISO 8601 datetime. */
1485
+ estimatedConfirmationTime: string;
1486
+ estimatedMinutes: number;
1487
+ chain: WithdrawalChain;
1488
+ sourceChain: WithdrawalChain;
1489
+ needsBridge: boolean;
1490
+ destinationType: WithdrawalDestinationType;
1491
+ feeBreakdown: WithdrawalFeeBreakdown & {
1492
+ bridgeComponent: string | null;
1493
+ };
1494
+ }
1495
+ interface WithdrawalLimits {
1496
+ kycTier: string;
1497
+ limits: {
1498
+ daily: string;
1499
+ monthly: string;
1500
+ perTransaction: string;
1501
+ minimum: string;
1502
+ };
1503
+ used: {
1504
+ daily: string;
1505
+ monthly: string;
1506
+ };
1507
+ remaining: {
1508
+ daily: string;
1509
+ monthly: string;
1510
+ };
1511
+ }
1512
+ interface ValidateWithdrawalParams {
1513
+ /** EVM address: 0x + 40 hex chars. */
1514
+ address: string;
1515
+ chain: WithdrawalChain;
1516
+ /** When provided, the response includes a `feePreview`. */
1517
+ amount?: string;
1518
+ feeConfig?: WithdrawalFeeConfig;
1519
+ }
1520
+ /** Fee preview returned by `validate` when an `amount` was supplied. */
1521
+ interface WithdrawalFeePreview {
1522
+ requestedAmount: string;
1523
+ fixedFee: string;
1524
+ percentageFee: string;
1525
+ totalFee: string;
1526
+ netAmount: string;
1527
+ breakdown: WithdrawalFeeBreakdown;
1528
+ }
1529
+ interface WithdrawalValidation {
1530
+ isValid: boolean;
1531
+ chain: WithdrawalChain;
1532
+ addressType: WithdrawalAddressType;
1533
+ detectedExchange?: WithdrawalExchange;
1534
+ warnings: string[];
1535
+ checksumAddress?: string;
1536
+ /** `null` unless `amount` was passed to `validate`. */
1537
+ feePreview?: WithdrawalFeePreview | null;
1538
+ }
1539
+
1540
+ /**
1541
+ * Withdrawals resource for Aura Payments SDK
1542
+ *
1543
+ * Read + estimate surface only. `POST /v1/withdrawals` (create) is intentionally
1544
+ * absent: the platform route is guarded by `stepUpGuard({maxAge:'5m'})`, which
1545
+ * requires a session younger than five minutes. An API-key client can never
1546
+ * satisfy that, so exposing create here would ship a method that always 401s.
1547
+ */
1548
+
1549
+ declare class Withdrawals {
1550
+ private client;
1551
+ constructor(client: AuraClient);
1552
+ /**
1553
+ * Get a single withdrawal, including status, fees, destination and tx hash.
1554
+ */
1555
+ get(withdrawalId: string): Promise<Withdrawal>;
1556
+ /**
1557
+ * List withdrawals for the account, most recent first.
1558
+ *
1559
+ * Returns the whole `{withdrawals, pagination}` envelope — this route does not
1560
+ * use the `{success,data}` wrapper, so pagination metadata is preserved.
1561
+ */
1562
+ list(params?: ListWithdrawalsParams): Promise<ListWithdrawalsResponse>;
1563
+ /**
1564
+ * Preview fees and net amount for a withdrawal WITHOUT creating it.
1565
+ *
1566
+ * `params.exchange` is required by the route when `destinationType` is
1567
+ * `'exchange'`; cross-chain estimates (source ≠ destination) add a CCTP
1568
+ * bridge fee and only the supported routes are accepted.
1569
+ */
1570
+ estimate(params: EstimateWithdrawalParams): Promise<WithdrawalEstimate>;
1571
+ /**
1572
+ * Get the account's KYC-tier withdrawal limits and remaining allowance.
1573
+ */
1574
+ limits(): Promise<WithdrawalLimits>;
1575
+ /**
1576
+ * Validate a destination address for a chain. Moves no funds; when `amount` is
1577
+ * supplied the response also carries a fee preview.
1578
+ */
1579
+ validate(params: ValidateWithdrawalParams): Promise<WithdrawalValidation>;
1580
+ }
1581
+
1105
1582
  /**
1106
1583
  * Aura Payments SDK Client
1107
1584
  * Main entry point for interacting with the Aura Payments Platform API
@@ -1155,6 +1632,9 @@ declare class AuraClient {
1155
1632
  readonly agents: Agents;
1156
1633
  readonly policies: Policies;
1157
1634
  readonly mandates: Mandates;
1635
+ readonly withdrawals: Withdrawals;
1636
+ readonly treasury: Treasury;
1637
+ readonly insights: Insights;
1158
1638
  constructor(config: AuraClientConfig);
1159
1639
  /**
1160
1640
  * Normalize the base URL so resource paths like `/v1/escrow` reach the
@@ -1293,4 +1773,4 @@ declare function retryWithBackoff<T>(fn: () => Promise<T>, maxRetries?: number,
1293
1773
  */
1294
1774
  declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, timeoutMessage?: string): Promise<T>;
1295
1775
 
1296
- export { type Agent, type AgentBalance, type AgentPolicy, type AgentRiskTier, type AgentStatus, type AgentStatusResponse, type AgentType, Agents, type ApproveMandateParams, AuraAPIError, AuraAuthenticationError, AuraClient, type AuraClientConfig, AuraError, AuraFaucetUnavailableError, AuraNetworkError, AuraNotFoundError, AuraRateLimitError, AuraTimeoutError, AuraValidationError, type Chain, type ConfigureWebhookParams, type CreateAgentParams, type CreateAgentResponse, type CreateDisputeParams, type CreateEscrowParams, type CreateEscrowResponse, type CreatePolicyParams, type CreateWalletParams, type Dispute, type DisputeStatus, type Escrow, type EscrowListItem, type EscrowSortBy, type EscrowSplitInput, type EscrowSplitResponse, type EscrowState, Escrows, type EvaluatePolicyParams, type EvaluatePolicyResponse, type FreezeAgentParams, type FundEscrowParams, type InitialPolicyInput, type ListAgentsParams, type ListAgentsResponse, type ListEscrowsParams, type ListEscrowsResponse, type ListMandatesParams, type ListMandatesResponse, type ListPoliciesResponse, type ListWalletsParams, type ListWalletsResponse, type Mandate, type MandateDecisionMethod, type MandateIntent, type MandateIntentKind, MandateSignature, type MandateStatus, Mandates, type MerchantDestinationType, type MerchantRule, type MerchantRuleInput, type MerchantRuleType, type OwnerType, Policies, type PolicyDecision, type ReceiveAndSplitFundingRequired, type ReceiveAndSplitParams, type ReceiveAndSplitResult, type ReceiveAndSplitStage, type RefundEscrowParams, type RejectMandateParams, type ReleaseEscrowParams, type RequestTestnetFundsParams, type RequestTestnetFundsResponse, type SpendingLimit, type SpendingLimitInput, type SpendingLimitType, type SplitRole, type TokenBalance, type Transfer, type TransferParams, type UnfreezeAgentParams, type UnlockType, type UpdateAgentParams, type ValidateWebhookSignatureOptions, type Wallet, type WalletBalance, type WalletOwnerType, Wallets, type WebhookConfig, type WebhookEvent, type WebhookEventType, type WebhookValidationResult, Webhooks, calculateBackoff, generateIdempotencyKey, isAuraAPIError, isAuraError, isAuraFaucetUnavailableError, isAuraNetworkError, isAuraTimeoutError, isRetryableError, retryWithBackoff, withTimeout };
1776
+ export { type Agent, type AgentBalance, type AgentPolicy, type AgentRiskTier, type AgentStatus, type AgentStatusResponse, type AgentType, Agents, type ApproveMandateParams, type AuditActor, type AuditEntry, type AuditParams, type AuditResult, type AuditSummary, AuraAPIError, AuraAuthenticationError, AuraClient, type AuraClientConfig, AuraError, AuraFaucetUnavailableError, AuraNetworkError, AuraNotFoundError, AuraRateLimitError, AuraTimeoutError, AuraValidationError, type Chain, type ConfigureWebhookParams, type CreateAgentParams, type CreateAgentResponse, type CreateDisputeParams, type CreateEscrowParams, type CreateEscrowResponse, type CreatePolicyParams, type CreateWalletParams, type Dispute, type DisputeStatus, type Escrow, type EscrowListItem, type EscrowSortBy, type EscrowSplitInput, type EscrowSplitResponse, type EscrowState, Escrows, type EstimateWithdrawalParams, type EvaluatePolicyParams, type EvaluatePolicyResponse, type ForecastAlgorithm, type ForecastMetric, type ForecastParams, type ForecastPeriod, type ForecastPoint, type ForecastProjection, type ForecastResult, type ForecastSeries, type ForecastSummary, type FreezeAgentParams, type FundEscrowParams, type InitialPolicyInput, Insights, type InsightsOverview, type InsightsPeriod, type ListAgentsParams, type ListAgentsResponse, type ListEscrowsParams, type ListEscrowsResponse, type ListMandatesParams, type ListMandatesResponse, type ListPoliciesResponse, type ListWalletsParams, type ListWalletsResponse, type ListWithdrawalsParams, type ListWithdrawalsResponse, type Mandate, type MandateDecisionMethod, type MandateIntent, type MandateIntentKind, MandateSignature, type MandateStatus, Mandates, type MerchantDestinationType, type MerchantRule, type MerchantRuleInput, type MerchantRuleType, type MetricValue, type OwnerType, Policies, type PolicyDecision, type ReceiveAndSplitFundingRequired, type ReceiveAndSplitParams, type ReceiveAndSplitResult, type ReceiveAndSplitStage, type RefundEscrowParams, type RejectMandateParams, type ReleaseEscrowParams, type RequestTestnetFundsParams, type RequestTestnetFundsResponse, type SparklinePoint, type SpendingLimit, type SpendingLimitInput, type SpendingLimitType, type SplitRole, type TimeSeriesPoint, type TokenBalance, type Transfer, type TransferParams, Treasury, type TreasuryOptimization, type TreasuryRecommendation, type TreasuryWallet, type UnfreezeAgentParams, type UnlockType, type UpdateAgentParams, type ValidateWebhookSignatureOptions, type ValidateWithdrawalParams, type VolumeBarPoint, type Wallet, type WalletBalance, type WalletOwnerType, Wallets, type WebhookConfig, type WebhookEvent, type WebhookEventType, type WebhookValidationResult, Webhooks, type Withdrawal, type WithdrawalAddressType, type WithdrawalChain, type WithdrawalDestinationType, type WithdrawalEstimate, type WithdrawalExchange, type WithdrawalFeeBreakdown, type WithdrawalFeeConfig, type WithdrawalFeePreview, type WithdrawalLimits, type WithdrawalStatus, type WithdrawalValidation, Withdrawals, calculateBackoff, generateIdempotencyKey, isAuraAPIError, isAuraError, isAuraFaucetUnavailableError, isAuraNetworkError, isAuraTimeoutError, isRetryableError, retryWithBackoff, withTimeout };