@sip-protocol/api 0.1.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.
@@ -0,0 +1,123 @@
1
+ import type { ChainId, HexString } from '@sip-protocol/types'
2
+
3
+ /**
4
+ * Standard API response wrapper
5
+ */
6
+ export interface ApiResponse<T = unknown> {
7
+ success: boolean
8
+ data?: T
9
+ error?: {
10
+ code: string
11
+ message: string
12
+ details?: unknown
13
+ }
14
+ }
15
+
16
+ /**
17
+ * Health check response
18
+ */
19
+ export interface HealthResponse {
20
+ status: 'healthy' | 'unhealthy'
21
+ version: string
22
+ timestamp: string
23
+ uptime: number
24
+ }
25
+
26
+ /**
27
+ * Request schemas
28
+ */
29
+ export interface GenerateStealthRequest {
30
+ chain: ChainId
31
+ recipientMetaAddress: {
32
+ spendingKey: HexString
33
+ viewingKey: HexString
34
+ chain: ChainId
35
+ label?: string
36
+ }
37
+ }
38
+
39
+ export interface CreateCommitmentRequest {
40
+ value: string // bigint as string
41
+ blindingFactor?: HexString
42
+ }
43
+
44
+ export interface GenerateFundingProofRequest {
45
+ balance: string // bigint as string
46
+ minRequired: string // bigint as string
47
+ balanceBlinding: HexString
48
+ }
49
+
50
+ export interface GetQuoteRequest {
51
+ inputChain: ChainId
52
+ inputToken: string
53
+ inputAmount: string // bigint as string
54
+ outputChain: ChainId
55
+ outputToken: string
56
+ slippageTolerance?: number
57
+ }
58
+
59
+ export interface ExecuteSwapRequest {
60
+ intentId: string
61
+ quoteId: string
62
+ privacy?: 'transparent' | 'shielded' | 'compliant'
63
+ viewingKey?: HexString
64
+ }
65
+
66
+ /**
67
+ * Response schemas
68
+ */
69
+ export interface StealthAddressResponse {
70
+ stealthAddress: {
71
+ address: HexString
72
+ ephemeralPublicKey: HexString
73
+ viewTag: number
74
+ }
75
+ }
76
+
77
+ export interface CommitmentResponse {
78
+ commitment: HexString
79
+ blindingFactor: HexString
80
+ }
81
+
82
+ export interface FundingProofResponse {
83
+ proof: HexString
84
+ publicInputs: HexString[]
85
+ }
86
+
87
+ export interface QuoteResponse {
88
+ quoteId: string
89
+ inputAmount: string
90
+ outputAmount: string
91
+ rate: string
92
+ estimatedTime: number
93
+ fees: {
94
+ network: string
95
+ protocol: string
96
+ }
97
+ route?: {
98
+ steps: Array<{
99
+ chain: ChainId
100
+ protocol: string
101
+ fromToken: string
102
+ toToken: string
103
+ }>
104
+ }
105
+ }
106
+
107
+ export interface SwapResponse {
108
+ swapId: string
109
+ status: 'pending' | 'processing' | 'completed' | 'failed'
110
+ transactionHash?: HexString
111
+ timestamp: string
112
+ }
113
+
114
+ export interface SwapStatusResponse {
115
+ id: string
116
+ status: 'pending' | 'processing' | 'completed' | 'failed'
117
+ transactionHash?: HexString
118
+ inputAmount: string
119
+ outputAmount?: string
120
+ createdAt: string
121
+ updatedAt: string
122
+ error?: string
123
+ }