@pollar/core 0.4.5 → 0.5.2
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.mts +1483 -290
- package/dist/index.d.ts +1483 -290
- package/dist/index.js +540 -361
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +531 -359
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,330 @@
|
|
|
1
1
|
import * as openapi_fetch from 'openapi-fetch';
|
|
2
2
|
|
|
3
|
+
type StellarNetwork = 'mainnet' | 'testnet';
|
|
4
|
+
type StellarClientConfig = StellarNetwork | {
|
|
5
|
+
horizonUrl: string;
|
|
6
|
+
};
|
|
7
|
+
interface StellarBalance {
|
|
8
|
+
asset: string;
|
|
9
|
+
balance: string;
|
|
10
|
+
assetIssuer?: string;
|
|
11
|
+
}
|
|
12
|
+
declare class StellarClient {
|
|
13
|
+
private readonly horizonUrl;
|
|
14
|
+
constructor(config: StellarClientConfig);
|
|
15
|
+
submitTransaction(signedXdr: string): Promise<{
|
|
16
|
+
success: true;
|
|
17
|
+
hash: string;
|
|
18
|
+
} | {
|
|
19
|
+
success: false;
|
|
20
|
+
errorCode: string;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare enum WalletType {
|
|
25
|
+
FREIGHTER = "freighter",
|
|
26
|
+
ALBEDO = "albedo"
|
|
27
|
+
}
|
|
28
|
+
interface ConnectWalletResponse {
|
|
29
|
+
address: string;
|
|
30
|
+
publicKey: string;
|
|
31
|
+
}
|
|
32
|
+
interface SignTransactionOptions {
|
|
33
|
+
network?: string;
|
|
34
|
+
networkPassphrase?: string;
|
|
35
|
+
accountToSign?: string;
|
|
36
|
+
}
|
|
37
|
+
interface SignAuthEntryOptions {
|
|
38
|
+
accountToSign?: string;
|
|
39
|
+
}
|
|
40
|
+
interface SignTransactionResponse {
|
|
41
|
+
signedTxXdr: string;
|
|
42
|
+
}
|
|
43
|
+
interface SignAuthEntryResponse {
|
|
44
|
+
signedAuthEntry: string;
|
|
45
|
+
}
|
|
46
|
+
interface WalletAdapter {
|
|
47
|
+
type: WalletType;
|
|
48
|
+
isAvailable(): Promise<boolean>;
|
|
49
|
+
connect(): Promise<ConnectWalletResponse>;
|
|
50
|
+
disconnect(): Promise<void>;
|
|
51
|
+
getPublicKey(): Promise<string | null>;
|
|
52
|
+
signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse>;
|
|
53
|
+
signAuthEntry(entryXdr: string, options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare class FreighterAdapter implements WalletAdapter {
|
|
57
|
+
readonly type = WalletType.FREIGHTER;
|
|
58
|
+
isAvailable(): Promise<boolean>;
|
|
59
|
+
connect(): Promise<ConnectWalletResponse>;
|
|
60
|
+
disconnect(): Promise<void>;
|
|
61
|
+
getPublicKey(): Promise<string | null>;
|
|
62
|
+
getNetwork(): Promise<string>;
|
|
63
|
+
signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse>;
|
|
64
|
+
signAuthEntry(entryXdr: string, options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
declare class AlbedoAdapter implements WalletAdapter {
|
|
68
|
+
readonly type = WalletType.ALBEDO;
|
|
69
|
+
isAvailable(): Promise<boolean>;
|
|
70
|
+
connect(): Promise<ConnectWalletResponse>;
|
|
71
|
+
disconnect(): Promise<void>;
|
|
72
|
+
getPublicKey(): Promise<string | null>;
|
|
73
|
+
getNetwork(): Promise<string>;
|
|
74
|
+
signTransaction(xdr: string, _options?: SignTransactionOptions): Promise<SignTransactionResponse>;
|
|
75
|
+
signAuthEntry(entryXdr: string, _options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
type PollarApplicationConfigResponse = paths['/auth/login']['post']['responses'][200]['content']['application/json'];
|
|
79
|
+
type PollarApplicationConfigContent = PollarApplicationConfigResponse['content'];
|
|
80
|
+
interface PollarClientConfig {
|
|
81
|
+
stellarNetwork?: StellarNetwork;
|
|
82
|
+
baseUrl?: string;
|
|
83
|
+
apiKey: string;
|
|
84
|
+
}
|
|
85
|
+
type TxBuildBody = NonNullable<paths['/tx/build']['post']['requestBody']>['content']['application/json'];
|
|
86
|
+
type TxBuildResponse = paths['/tx/build']['post']['responses'][200]['content']['application/json'];
|
|
87
|
+
type TxSignAndSendBody = NonNullable<paths['/tx/sign-and-send']['post']['requestBody']>['content']['application/json'];
|
|
88
|
+
type TxSignSendResponse = paths['/tx/sign-and-send']['post']['responses'][200]['content']['application/json'];
|
|
89
|
+
type PollarLoginOptions = {
|
|
90
|
+
provider: 'google';
|
|
91
|
+
} | {
|
|
92
|
+
provider: 'github';
|
|
93
|
+
} | {
|
|
94
|
+
provider: 'email';
|
|
95
|
+
email: string;
|
|
96
|
+
} | {
|
|
97
|
+
provider: 'wallet';
|
|
98
|
+
type: WalletType;
|
|
99
|
+
};
|
|
100
|
+
type TxBuildContent = TxBuildResponse['content'];
|
|
101
|
+
type TransactionState = {
|
|
102
|
+
step: 'idle';
|
|
103
|
+
} | {
|
|
104
|
+
step: 'building';
|
|
105
|
+
} | {
|
|
106
|
+
step: 'built';
|
|
107
|
+
buildData: TxBuildContent;
|
|
108
|
+
} | {
|
|
109
|
+
step: 'signing';
|
|
110
|
+
buildData?: TxBuildContent;
|
|
111
|
+
external?: true;
|
|
112
|
+
} | {
|
|
113
|
+
step: 'success';
|
|
114
|
+
buildData?: TxBuildContent;
|
|
115
|
+
hash: string;
|
|
116
|
+
external?: true;
|
|
117
|
+
} | {
|
|
118
|
+
step: 'error';
|
|
119
|
+
details?: string;
|
|
120
|
+
buildData?: TxBuildContent;
|
|
121
|
+
external?: true;
|
|
122
|
+
};
|
|
123
|
+
declare const AUTH_ERROR_CODES: {
|
|
124
|
+
readonly SESSION_CREATE_FAILED: "SESSION_CREATE_FAILED";
|
|
125
|
+
readonly EMAIL_SEND_FAILED: "EMAIL_SEND_FAILED";
|
|
126
|
+
readonly EMAIL_VERIFY_FAILED: "EMAIL_VERIFY_FAILED";
|
|
127
|
+
readonly EMAIL_CODE_EXPIRED: "EMAIL_CODE_EXPIRED";
|
|
128
|
+
readonly EMAIL_CODE_INVALID: "EMAIL_CODE_INVALID";
|
|
129
|
+
readonly AUTH_FAILED: "AUTH_FAILED";
|
|
130
|
+
readonly WALLET_CONNECT_FAILED: "WALLET_CONNECT_FAILED";
|
|
131
|
+
readonly WALLET_AUTH_FAILED: "WALLET_AUTH_FAILED";
|
|
132
|
+
readonly UNEXPECTED_ERROR: "UNEXPECTED_ERROR";
|
|
133
|
+
};
|
|
134
|
+
type AuthErrorCode = (typeof AUTH_ERROR_CODES)[keyof typeof AUTH_ERROR_CODES];
|
|
135
|
+
type AuthState = {
|
|
136
|
+
step: 'idle';
|
|
137
|
+
} | {
|
|
138
|
+
step: 'creating_session';
|
|
139
|
+
} | {
|
|
140
|
+
step: 'entering_email';
|
|
141
|
+
clientSessionId: string;
|
|
142
|
+
} | {
|
|
143
|
+
step: 'sending_email';
|
|
144
|
+
email: string;
|
|
145
|
+
} | {
|
|
146
|
+
step: 'entering_code';
|
|
147
|
+
clientSessionId: string;
|
|
148
|
+
email: string;
|
|
149
|
+
} | {
|
|
150
|
+
step: 'verifying_email_code';
|
|
151
|
+
clientSessionId: string;
|
|
152
|
+
email: string;
|
|
153
|
+
} | {
|
|
154
|
+
step: 'opening_oauth';
|
|
155
|
+
provider: 'google' | 'github';
|
|
156
|
+
} | {
|
|
157
|
+
step: 'connecting_wallet';
|
|
158
|
+
walletType: WalletType;
|
|
159
|
+
} | {
|
|
160
|
+
step: 'wallet_not_installed';
|
|
161
|
+
walletType: WalletType;
|
|
162
|
+
} | {
|
|
163
|
+
step: 'authenticating_wallet';
|
|
164
|
+
} | {
|
|
165
|
+
step: 'authenticating';
|
|
166
|
+
} | {
|
|
167
|
+
step: 'authenticated';
|
|
168
|
+
session: PollarApplicationConfigContent;
|
|
169
|
+
} | {
|
|
170
|
+
step: 'error';
|
|
171
|
+
previousStep: string;
|
|
172
|
+
message: string;
|
|
173
|
+
errorCode: AuthErrorCode;
|
|
174
|
+
clientSessionId?: string;
|
|
175
|
+
email?: string;
|
|
176
|
+
};
|
|
177
|
+
type NetworkState = {
|
|
178
|
+
step: 'idle';
|
|
179
|
+
} | {
|
|
180
|
+
step: 'connected';
|
|
181
|
+
network: StellarNetwork;
|
|
182
|
+
};
|
|
183
|
+
declare class PollarFlowError extends Error {
|
|
184
|
+
readonly code: "INVALID_FLOW";
|
|
185
|
+
constructor(message: string);
|
|
186
|
+
}
|
|
187
|
+
type WalletBalanceContent = paths['/wallet/balance']['get']['responses'][200]['content']['application/json']['content'];
|
|
188
|
+
type WalletBalanceRecord = WalletBalanceContent['balances'][number];
|
|
189
|
+
type WalletBalanceState = {
|
|
190
|
+
step: 'idle';
|
|
191
|
+
} | {
|
|
192
|
+
step: 'loading';
|
|
193
|
+
} | {
|
|
194
|
+
step: 'loaded';
|
|
195
|
+
data: WalletBalanceContent;
|
|
196
|
+
} | {
|
|
197
|
+
step: 'error';
|
|
198
|
+
message: string;
|
|
199
|
+
};
|
|
200
|
+
type TxHistoryRecord = paths['/tx/history']['get']['responses'][200]['content']['application/json']['content']['records'][number];
|
|
201
|
+
type TxHistoryParams = NonNullable<paths['/tx/history']['get']['parameters']['query']>;
|
|
202
|
+
type TxHistoryContent = paths['/tx/history']['get']['responses'][200]['content']['application/json']['content'];
|
|
203
|
+
type TxHistoryState = {
|
|
204
|
+
step: 'idle';
|
|
205
|
+
} | {
|
|
206
|
+
step: 'loading';
|
|
207
|
+
params: TxHistoryParams;
|
|
208
|
+
} | {
|
|
209
|
+
step: 'loaded';
|
|
210
|
+
params: TxHistoryParams;
|
|
211
|
+
data: TxHistoryContent;
|
|
212
|
+
} | {
|
|
213
|
+
step: 'error';
|
|
214
|
+
params: TxHistoryParams;
|
|
215
|
+
message: string;
|
|
216
|
+
};
|
|
217
|
+
type KycLevel = 'basic' | 'intermediate' | 'enhanced';
|
|
218
|
+
type KycStatus = 'none' | 'pending' | 'approved' | 'rejected';
|
|
219
|
+
type KycFlow = 'iframe' | 'form' | 'redirect';
|
|
220
|
+
type KycProvider = paths['/kyc/providers']['get']['responses'][200]['content']['application/json']['content']['providers'][number];
|
|
221
|
+
type KycStartBody = NonNullable<paths['/kyc/start']['post']['requestBody']>['content']['application/json'];
|
|
222
|
+
type KycStartResponse = paths['/kyc/start']['post']['responses'][200]['content']['application/json']['content'];
|
|
223
|
+
type RampsQuoteQuery = NonNullable<paths['/ramps/quote']['get']['parameters']['query']>;
|
|
224
|
+
type RampQuote = paths['/ramps/quote']['get']['responses'][200]['content']['application/json']['content']['quotes'][number];
|
|
225
|
+
type RampsQuoteResponse = paths['/ramps/quote']['get']['responses'][200]['content']['application/json']['content'];
|
|
226
|
+
type RampsOnrampBody = NonNullable<paths['/ramps/onramp']['post']['requestBody']>['content']['application/json'];
|
|
227
|
+
type RampsOnrampResponse = paths['/ramps/onramp']['post']['responses'][200]['content']['application/json']['content'];
|
|
228
|
+
type RampsOfframpBody = NonNullable<paths['/ramps/offramp']['post']['requestBody']>['content']['application/json'];
|
|
229
|
+
type RampsOfframpResponse = paths['/ramps/offramp']['post']['responses'][200]['content']['application/json']['content'];
|
|
230
|
+
type RampsTransactionResponse = paths['/ramps/transaction/{txId}']['get']['responses'][200]['content']['application/json']['content'];
|
|
231
|
+
type RampTxStatus = RampsTransactionResponse['status'];
|
|
232
|
+
type RampDirection = RampsTransactionResponse['direction'];
|
|
233
|
+
type PaymentInstructions = RampsOnrampResponse['paymentInstructions'];
|
|
234
|
+
|
|
235
|
+
declare class PollarClient {
|
|
236
|
+
readonly apiKey: string;
|
|
237
|
+
readonly id: string;
|
|
238
|
+
readonly basePath: string;
|
|
239
|
+
private readonly _api;
|
|
240
|
+
private _session;
|
|
241
|
+
private _transactionState;
|
|
242
|
+
private _transactionStateListeners;
|
|
243
|
+
private _txHistoryState;
|
|
244
|
+
private _txHistoryStateListeners;
|
|
245
|
+
private _walletBalanceState;
|
|
246
|
+
private _walletBalanceStateListeners;
|
|
247
|
+
private _authState;
|
|
248
|
+
private _authStateListeners;
|
|
249
|
+
private _networkState;
|
|
250
|
+
private _networkStateListeners;
|
|
251
|
+
private _walletAdapter;
|
|
252
|
+
private _loginController;
|
|
253
|
+
constructor(config: PollarClientConfig);
|
|
254
|
+
getAuthState(): AuthState;
|
|
255
|
+
onAuthStateChange(cb: (state: AuthState) => void): () => void;
|
|
256
|
+
login(options: PollarLoginOptions): void;
|
|
257
|
+
beginEmailLogin(): void;
|
|
258
|
+
sendEmailCode(email: string): void;
|
|
259
|
+
verifyEmailCode(code: string): void;
|
|
260
|
+
loginWallet(type: WalletType): void;
|
|
261
|
+
cancelLogin(): void;
|
|
262
|
+
logout(): void;
|
|
263
|
+
getNetwork(): StellarNetwork;
|
|
264
|
+
getNetworkState(): NetworkState;
|
|
265
|
+
setNetwork(network: StellarNetwork): void;
|
|
266
|
+
onNetworkStateChange(cb: (state: NetworkState) => void): () => void;
|
|
267
|
+
getTransactionState(): TransactionState | null;
|
|
268
|
+
onTransactionStateChange(cb: (state: TransactionState) => void): () => void;
|
|
269
|
+
getTxHistoryState(): TxHistoryState;
|
|
270
|
+
onTxHistoryStateChange(cb: (state: TxHistoryState) => void): () => void;
|
|
271
|
+
fetchTxHistory(params?: TxHistoryParams): Promise<void>;
|
|
272
|
+
getWalletBalanceState(): WalletBalanceState;
|
|
273
|
+
onWalletBalanceStateChange(cb: (state: WalletBalanceState) => void): () => void;
|
|
274
|
+
refreshBalance(publicKey?: string): Promise<void>;
|
|
275
|
+
buildTx(operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']): Promise<void>;
|
|
276
|
+
getWalletType(): WalletType | null;
|
|
277
|
+
signAndSubmitTx(unsignedXdr: string): Promise<void>;
|
|
278
|
+
getAppConfig(): Promise<unknown>;
|
|
279
|
+
getKycStatus(providerId?: string): Promise<{
|
|
280
|
+
status: KycStatus;
|
|
281
|
+
level?: KycLevel | undefined;
|
|
282
|
+
providerId: string;
|
|
283
|
+
expiresAt?: string;
|
|
284
|
+
}>;
|
|
285
|
+
getKycProviders(country: string): Promise<{
|
|
286
|
+
providers: KycProvider[];
|
|
287
|
+
}>;
|
|
288
|
+
startKyc(body: KycStartBody): Promise<KycStartResponse>;
|
|
289
|
+
resolveKyc(providerId: string, level?: KycLevel): Promise<{
|
|
290
|
+
alreadyApproved: boolean;
|
|
291
|
+
} & Partial<{
|
|
292
|
+
sessionId: string;
|
|
293
|
+
kycUrl?: string;
|
|
294
|
+
fields?: {
|
|
295
|
+
name: string;
|
|
296
|
+
type: string;
|
|
297
|
+
required: boolean;
|
|
298
|
+
}[];
|
|
299
|
+
}>>;
|
|
300
|
+
pollKycStatus(providerId: string, opts?: {
|
|
301
|
+
intervalMs?: number;
|
|
302
|
+
timeoutMs?: number;
|
|
303
|
+
}): Promise<KycStatus>;
|
|
304
|
+
getRampsQuote(query: RampsQuoteQuery): Promise<RampsQuoteResponse>;
|
|
305
|
+
createOnRamp(body: RampsOnrampBody): Promise<RampsOnrampResponse>;
|
|
306
|
+
createOffRamp(body: RampsOfframpBody): Promise<RampsOfframpResponse>;
|
|
307
|
+
getRampTransaction(txId: string): Promise<RampsTransactionResponse>;
|
|
308
|
+
pollRampTransaction(txId: string, opts?: {
|
|
309
|
+
intervalMs?: number;
|
|
310
|
+
timeoutMs?: number;
|
|
311
|
+
}): Promise<RampTxStatus>;
|
|
312
|
+
private _setTxHistoryState;
|
|
313
|
+
private _setWalletBalanceState;
|
|
314
|
+
/** Creates a new AbortController, cancelling any existing flow first. */
|
|
315
|
+
private _newController;
|
|
316
|
+
/** Builds the deps object passed to flow functions via bind pattern. */
|
|
317
|
+
private _flowDeps;
|
|
318
|
+
private _handleFlowError;
|
|
319
|
+
private _restoreSession;
|
|
320
|
+
private _storeSession;
|
|
321
|
+
private _clearSession;
|
|
322
|
+
private _networkPassphrase;
|
|
323
|
+
private _setNetworkState;
|
|
324
|
+
private _setAuthState;
|
|
325
|
+
private _setTransactionState;
|
|
326
|
+
}
|
|
327
|
+
|
|
3
328
|
/**
|
|
4
329
|
* This file was auto-generated by openapi-typescript.
|
|
5
330
|
* Do not make direct changes to the file.
|
|
@@ -244,8 +569,8 @@ interface paths {
|
|
|
244
569
|
get?: never;
|
|
245
570
|
put?: never;
|
|
246
571
|
/**
|
|
247
|
-
*
|
|
248
|
-
* @description
|
|
572
|
+
* Sign and submit transaction
|
|
573
|
+
* @description Sends an unsigned XDR to the wallet service for signing, then submits the signed transaction to the Stellar network.
|
|
249
574
|
*/
|
|
250
575
|
post: operations["postTxSignAndSend"];
|
|
251
576
|
delete?: never;
|
|
@@ -274,48 +599,228 @@ interface paths {
|
|
|
274
599
|
patch?: never;
|
|
275
600
|
trace?: never;
|
|
276
601
|
};
|
|
277
|
-
|
|
278
|
-
interface operations {
|
|
279
|
-
getHealth: {
|
|
602
|
+
"/tx/history": {
|
|
280
603
|
parameters: {
|
|
281
604
|
query?: never;
|
|
282
605
|
header?: never;
|
|
283
606
|
path?: never;
|
|
284
607
|
cookie?: never;
|
|
285
608
|
};
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
};
|
|
306
|
-
};
|
|
609
|
+
/**
|
|
610
|
+
* Get transaction history
|
|
611
|
+
* @description Returns paginated transaction history for the authenticated SDK user. Only includes transactions submitted through Pollar. Transactions appear as PENDING immediately after /tx/build and are updated to SUCCESS or FAILED after /tx/sign-and-send.
|
|
612
|
+
*/
|
|
613
|
+
get: operations["getTxHistory"];
|
|
614
|
+
put?: never;
|
|
615
|
+
post?: never;
|
|
616
|
+
delete?: never;
|
|
617
|
+
options?: never;
|
|
618
|
+
head?: never;
|
|
619
|
+
patch?: never;
|
|
620
|
+
trace?: never;
|
|
621
|
+
};
|
|
622
|
+
"/wallet/balance": {
|
|
623
|
+
parameters: {
|
|
624
|
+
query?: never;
|
|
625
|
+
header?: never;
|
|
626
|
+
path?: never;
|
|
627
|
+
cookie?: never;
|
|
307
628
|
};
|
|
629
|
+
/**
|
|
630
|
+
* Get wallet balances
|
|
631
|
+
* @description Returns XLM and configured asset balances for a Stellar account using Soroban RPC (no Horizon). The asset list is derived from the application's enabled assets. "available" reflects the spendable amount after minimum reserve (XLM) and selling liabilities.
|
|
632
|
+
*/
|
|
633
|
+
get: operations["getWalletBalance"];
|
|
634
|
+
put?: never;
|
|
635
|
+
post?: never;
|
|
636
|
+
delete?: never;
|
|
637
|
+
options?: never;
|
|
638
|
+
head?: never;
|
|
639
|
+
patch?: never;
|
|
640
|
+
trace?: never;
|
|
308
641
|
};
|
|
309
|
-
|
|
642
|
+
"/kyc/status": {
|
|
310
643
|
parameters: {
|
|
311
644
|
query?: never;
|
|
312
645
|
header?: never;
|
|
313
646
|
path?: never;
|
|
314
647
|
cookie?: never;
|
|
315
648
|
};
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
649
|
+
/**
|
|
650
|
+
* Get KYC status
|
|
651
|
+
* @description Returns the KYC verification status of the authenticated end-user. Optionally filter by a specific provider. If no providerId is given, returns the first active verification found across all providers configured for the application.
|
|
652
|
+
*/
|
|
653
|
+
get: operations["getKycStatus"];
|
|
654
|
+
put?: never;
|
|
655
|
+
post?: never;
|
|
656
|
+
delete?: never;
|
|
657
|
+
options?: never;
|
|
658
|
+
head?: never;
|
|
659
|
+
patch?: never;
|
|
660
|
+
trace?: never;
|
|
661
|
+
};
|
|
662
|
+
"/kyc/providers": {
|
|
663
|
+
parameters: {
|
|
664
|
+
query?: never;
|
|
665
|
+
header?: never;
|
|
666
|
+
path?: never;
|
|
667
|
+
cookie?: never;
|
|
668
|
+
};
|
|
669
|
+
/**
|
|
670
|
+
* List available KYC providers
|
|
671
|
+
* @description Returns the KYC providers enabled for the application, filtered by the given country (ISO 3166-1 alpha-2). Use this to show the user which KYC options are available before calling POST /kyc/start.
|
|
672
|
+
*/
|
|
673
|
+
get: operations["getKycProviders"];
|
|
674
|
+
put?: never;
|
|
675
|
+
post?: never;
|
|
676
|
+
delete?: never;
|
|
677
|
+
options?: never;
|
|
678
|
+
head?: never;
|
|
679
|
+
patch?: never;
|
|
680
|
+
trace?: never;
|
|
681
|
+
};
|
|
682
|
+
"/kyc/start": {
|
|
683
|
+
parameters: {
|
|
684
|
+
query?: never;
|
|
685
|
+
header?: never;
|
|
686
|
+
path?: never;
|
|
687
|
+
cookie?: never;
|
|
688
|
+
};
|
|
689
|
+
get?: never;
|
|
690
|
+
put?: never;
|
|
691
|
+
/**
|
|
692
|
+
* Start a KYC session
|
|
693
|
+
* @description Initiates a KYC verification session with the specified provider and level. Returns a sessionId and either a kycUrl (for iframe/redirect flows) or a fields array (for form flows). The session expires in 30 minutes.
|
|
694
|
+
*/
|
|
695
|
+
post: operations["postKycStart"];
|
|
696
|
+
delete?: never;
|
|
697
|
+
options?: never;
|
|
698
|
+
head?: never;
|
|
699
|
+
patch?: never;
|
|
700
|
+
trace?: never;
|
|
701
|
+
};
|
|
702
|
+
"/ramps/quote": {
|
|
703
|
+
parameters: {
|
|
704
|
+
query?: never;
|
|
705
|
+
header?: never;
|
|
706
|
+
path?: never;
|
|
707
|
+
cookie?: never;
|
|
708
|
+
};
|
|
709
|
+
/**
|
|
710
|
+
* Get ramp quotes
|
|
711
|
+
* @description Returns available quotes for converting fiat to crypto (onramp) or crypto to fiat (offramp) for a given country, amount, and currency. Each quote includes a quoteId valid for 15 minutes. Pass the quoteId to POST /ramps/onramp or POST /ramps/offramp to execute the transaction.
|
|
712
|
+
*/
|
|
713
|
+
get: operations["getRampsQuote"];
|
|
714
|
+
put?: never;
|
|
715
|
+
post?: never;
|
|
716
|
+
delete?: never;
|
|
717
|
+
options?: never;
|
|
718
|
+
head?: never;
|
|
719
|
+
patch?: never;
|
|
720
|
+
trace?: never;
|
|
721
|
+
};
|
|
722
|
+
"/ramps/onramp": {
|
|
723
|
+
parameters: {
|
|
724
|
+
query?: never;
|
|
725
|
+
header?: never;
|
|
726
|
+
path?: never;
|
|
727
|
+
cookie?: never;
|
|
728
|
+
};
|
|
729
|
+
get?: never;
|
|
730
|
+
put?: never;
|
|
731
|
+
/**
|
|
732
|
+
* Create onramp transaction
|
|
733
|
+
* @description Initiates a fiat-to-crypto onramp transaction using a previously obtained quoteId. Returns payment instructions (CLABE, PIX key, etc.) the user must use to send funds. The quote expires in 15 minutes — a new one must be requested after expiry.
|
|
734
|
+
*/
|
|
735
|
+
post: operations["postRampsOnramp"];
|
|
736
|
+
delete?: never;
|
|
737
|
+
options?: never;
|
|
738
|
+
head?: never;
|
|
739
|
+
patch?: never;
|
|
740
|
+
trace?: never;
|
|
741
|
+
};
|
|
742
|
+
"/ramps/offramp": {
|
|
743
|
+
parameters: {
|
|
744
|
+
query?: never;
|
|
745
|
+
header?: never;
|
|
746
|
+
path?: never;
|
|
747
|
+
cookie?: never;
|
|
748
|
+
};
|
|
749
|
+
get?: never;
|
|
750
|
+
put?: never;
|
|
751
|
+
/**
|
|
752
|
+
* Create offramp transaction
|
|
753
|
+
* @description Initiates a crypto-to-fiat offramp transaction using a previously obtained quoteId. Funds will be sent from the user's wallet to the provided bank account. The quote expires in 15 minutes.
|
|
754
|
+
*/
|
|
755
|
+
post: operations["postRampsOfframp"];
|
|
756
|
+
delete?: never;
|
|
757
|
+
options?: never;
|
|
758
|
+
head?: never;
|
|
759
|
+
patch?: never;
|
|
760
|
+
trace?: never;
|
|
761
|
+
};
|
|
762
|
+
"/ramps/transaction/{txId}": {
|
|
763
|
+
parameters: {
|
|
764
|
+
query?: never;
|
|
765
|
+
header?: never;
|
|
766
|
+
path?: never;
|
|
767
|
+
cookie?: never;
|
|
768
|
+
};
|
|
769
|
+
/**
|
|
770
|
+
* Get ramp transaction status
|
|
771
|
+
* @description Returns the current status of an onramp or offramp transaction. Use this endpoint to poll for status updates. Only the authenticated user who created the transaction can access it.
|
|
772
|
+
*/
|
|
773
|
+
get: operations["getRampsTransactionByTxId"];
|
|
774
|
+
put?: never;
|
|
775
|
+
post?: never;
|
|
776
|
+
delete?: never;
|
|
777
|
+
options?: never;
|
|
778
|
+
head?: never;
|
|
779
|
+
patch?: never;
|
|
780
|
+
trace?: never;
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
interface operations {
|
|
784
|
+
getHealth: {
|
|
785
|
+
parameters: {
|
|
786
|
+
query?: never;
|
|
787
|
+
header?: never;
|
|
788
|
+
path?: never;
|
|
789
|
+
cookie?: never;
|
|
790
|
+
};
|
|
791
|
+
requestBody?: never;
|
|
792
|
+
responses: {
|
|
793
|
+
/** @description Service is healthy */
|
|
794
|
+
200: {
|
|
795
|
+
headers: {
|
|
796
|
+
[name: string]: unknown;
|
|
797
|
+
};
|
|
798
|
+
content: {
|
|
799
|
+
"application/json": {
|
|
800
|
+
/** @constant */
|
|
801
|
+
code: "SDK_API_HEALTH_OK";
|
|
802
|
+
/** @constant */
|
|
803
|
+
success: true;
|
|
804
|
+
content: {
|
|
805
|
+
/** @constant */
|
|
806
|
+
status: "ok";
|
|
807
|
+
version: string;
|
|
808
|
+
};
|
|
809
|
+
};
|
|
810
|
+
};
|
|
811
|
+
};
|
|
812
|
+
};
|
|
813
|
+
};
|
|
814
|
+
postAuthSession: {
|
|
815
|
+
parameters: {
|
|
816
|
+
query?: never;
|
|
817
|
+
header?: never;
|
|
818
|
+
path?: never;
|
|
819
|
+
cookie?: never;
|
|
820
|
+
};
|
|
821
|
+
requestBody?: never;
|
|
822
|
+
responses: {
|
|
823
|
+
/** @description Session created */
|
|
319
824
|
201: {
|
|
320
825
|
headers: {
|
|
321
826
|
[name: string]: unknown;
|
|
@@ -576,7 +1081,7 @@ interface operations {
|
|
|
576
1081
|
path?: never;
|
|
577
1082
|
cookie?: never;
|
|
578
1083
|
};
|
|
579
|
-
requestBody
|
|
1084
|
+
requestBody: {
|
|
580
1085
|
content: {
|
|
581
1086
|
"application/json": {
|
|
582
1087
|
clientSessionId: string;
|
|
@@ -665,7 +1170,7 @@ interface operations {
|
|
|
665
1170
|
path?: never;
|
|
666
1171
|
cookie?: never;
|
|
667
1172
|
};
|
|
668
|
-
requestBody
|
|
1173
|
+
requestBody: {
|
|
669
1174
|
content: {
|
|
670
1175
|
"application/json": {
|
|
671
1176
|
clientSessionId: string;
|
|
@@ -752,7 +1257,7 @@ interface operations {
|
|
|
752
1257
|
path?: never;
|
|
753
1258
|
cookie?: never;
|
|
754
1259
|
};
|
|
755
|
-
requestBody
|
|
1260
|
+
requestBody: {
|
|
756
1261
|
content: {
|
|
757
1262
|
"application/json": {
|
|
758
1263
|
clientSessionId: string;
|
|
@@ -840,7 +1345,7 @@ interface operations {
|
|
|
840
1345
|
path?: never;
|
|
841
1346
|
cookie?: never;
|
|
842
1347
|
};
|
|
843
|
-
requestBody
|
|
1348
|
+
requestBody: {
|
|
844
1349
|
content: {
|
|
845
1350
|
"application/json": {
|
|
846
1351
|
clientSessionId: string;
|
|
@@ -1080,12 +1585,26 @@ interface operations {
|
|
|
1080
1585
|
path?: never;
|
|
1081
1586
|
cookie?: never;
|
|
1082
1587
|
};
|
|
1083
|
-
requestBody
|
|
1588
|
+
requestBody: {
|
|
1084
1589
|
content: {
|
|
1085
1590
|
"application/json": {
|
|
1086
1591
|
/** @enum {string} */
|
|
1087
|
-
network: "testnet" | "
|
|
1592
|
+
network: "testnet" | "mainnet";
|
|
1088
1593
|
publicKey: string;
|
|
1594
|
+
options?: {
|
|
1595
|
+
timeoutSec?: number;
|
|
1596
|
+
memo?: {
|
|
1597
|
+
/** @constant */
|
|
1598
|
+
type: "text";
|
|
1599
|
+
value: string;
|
|
1600
|
+
} | {
|
|
1601
|
+
/** @constant */
|
|
1602
|
+
type: "id";
|
|
1603
|
+
value: string;
|
|
1604
|
+
};
|
|
1605
|
+
maxFeeStroops?: number;
|
|
1606
|
+
};
|
|
1607
|
+
} & ({
|
|
1089
1608
|
/** @constant */
|
|
1090
1609
|
operation: "payment";
|
|
1091
1610
|
params: {
|
|
@@ -1099,21 +1618,174 @@ interface operations {
|
|
|
1099
1618
|
type: "credit_alphanum4";
|
|
1100
1619
|
code: string;
|
|
1101
1620
|
issuer: string;
|
|
1621
|
+
} | {
|
|
1622
|
+
/** @constant */
|
|
1623
|
+
type: "credit_alphanum12";
|
|
1624
|
+
code: string;
|
|
1625
|
+
issuer: string;
|
|
1102
1626
|
};
|
|
1103
1627
|
};
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1628
|
+
} | {
|
|
1629
|
+
/** @constant */
|
|
1630
|
+
operation: "change_trust";
|
|
1631
|
+
params: {
|
|
1632
|
+
asset: {
|
|
1107
1633
|
/** @constant */
|
|
1108
|
-
type: "
|
|
1634
|
+
type: "credit_alphanum4";
|
|
1635
|
+
code: string;
|
|
1636
|
+
issuer: string;
|
|
1637
|
+
} | {
|
|
1638
|
+
/** @constant */
|
|
1639
|
+
type: "credit_alphanum12";
|
|
1640
|
+
code: string;
|
|
1641
|
+
issuer: string;
|
|
1642
|
+
} | {
|
|
1643
|
+
/** @constant */
|
|
1644
|
+
type: "liquidity_pool_shares";
|
|
1645
|
+
assetA: {
|
|
1646
|
+
/** @constant */
|
|
1647
|
+
type: "native";
|
|
1648
|
+
} | {
|
|
1649
|
+
/** @constant */
|
|
1650
|
+
type: "credit_alphanum4";
|
|
1651
|
+
code: string;
|
|
1652
|
+
issuer: string;
|
|
1653
|
+
} | {
|
|
1654
|
+
/** @constant */
|
|
1655
|
+
type: "credit_alphanum12";
|
|
1656
|
+
code: string;
|
|
1657
|
+
issuer: string;
|
|
1658
|
+
};
|
|
1659
|
+
assetB: {
|
|
1660
|
+
/** @constant */
|
|
1661
|
+
type: "native";
|
|
1662
|
+
} | {
|
|
1663
|
+
/** @constant */
|
|
1664
|
+
type: "credit_alphanum4";
|
|
1665
|
+
code: string;
|
|
1666
|
+
issuer: string;
|
|
1667
|
+
} | {
|
|
1668
|
+
/** @constant */
|
|
1669
|
+
type: "credit_alphanum12";
|
|
1670
|
+
code: string;
|
|
1671
|
+
issuer: string;
|
|
1672
|
+
};
|
|
1673
|
+
};
|
|
1674
|
+
limit?: string;
|
|
1675
|
+
};
|
|
1676
|
+
} | {
|
|
1677
|
+
/** @constant */
|
|
1678
|
+
operation: "path_payment_strict_send";
|
|
1679
|
+
params: {
|
|
1680
|
+
destination: string;
|
|
1681
|
+
sendAsset: {
|
|
1682
|
+
/** @constant */
|
|
1683
|
+
type: "native";
|
|
1684
|
+
} | {
|
|
1685
|
+
/** @constant */
|
|
1686
|
+
type: "credit_alphanum4";
|
|
1687
|
+
code: string;
|
|
1688
|
+
issuer: string;
|
|
1689
|
+
} | {
|
|
1690
|
+
/** @constant */
|
|
1691
|
+
type: "credit_alphanum12";
|
|
1692
|
+
code: string;
|
|
1693
|
+
issuer: string;
|
|
1694
|
+
};
|
|
1695
|
+
sendAmount: string;
|
|
1696
|
+
destAsset: {
|
|
1697
|
+
/** @constant */
|
|
1698
|
+
type: "native";
|
|
1699
|
+
} | {
|
|
1700
|
+
/** @constant */
|
|
1701
|
+
type: "credit_alphanum4";
|
|
1702
|
+
code: string;
|
|
1703
|
+
issuer: string;
|
|
1704
|
+
} | {
|
|
1705
|
+
/** @constant */
|
|
1706
|
+
type: "credit_alphanum12";
|
|
1707
|
+
code: string;
|
|
1708
|
+
issuer: string;
|
|
1709
|
+
};
|
|
1710
|
+
destMin: string;
|
|
1711
|
+
/** @default [] */
|
|
1712
|
+
path?: ({
|
|
1713
|
+
/** @constant */
|
|
1714
|
+
type: "native";
|
|
1715
|
+
} | {
|
|
1716
|
+
/** @constant */
|
|
1717
|
+
type: "credit_alphanum4";
|
|
1718
|
+
code: string;
|
|
1719
|
+
issuer: string;
|
|
1720
|
+
} | {
|
|
1721
|
+
/** @constant */
|
|
1722
|
+
type: "credit_alphanum12";
|
|
1723
|
+
code: string;
|
|
1724
|
+
issuer: string;
|
|
1725
|
+
})[];
|
|
1726
|
+
};
|
|
1727
|
+
} | {
|
|
1728
|
+
/** @constant */
|
|
1729
|
+
operation: "create_account";
|
|
1730
|
+
params: {
|
|
1731
|
+
destination: string;
|
|
1732
|
+
startingBalance: string;
|
|
1733
|
+
};
|
|
1734
|
+
} | {
|
|
1735
|
+
/** @constant */
|
|
1736
|
+
operation: "invoke_contract";
|
|
1737
|
+
params: {
|
|
1738
|
+
contractId: string;
|
|
1739
|
+
method: string;
|
|
1740
|
+
/** @default [] */
|
|
1741
|
+
args?: ({
|
|
1742
|
+
/** @constant */
|
|
1743
|
+
type: "bool";
|
|
1744
|
+
value: boolean;
|
|
1745
|
+
} | {
|
|
1746
|
+
/** @constant */
|
|
1747
|
+
type: "i32";
|
|
1748
|
+
value: number;
|
|
1749
|
+
} | {
|
|
1750
|
+
/** @constant */
|
|
1751
|
+
type: "u32";
|
|
1752
|
+
value: number;
|
|
1753
|
+
} | {
|
|
1754
|
+
/** @enum {string} */
|
|
1755
|
+
type: "i64" | "u64" | "i128" | "u128" | "i256" | "u256";
|
|
1109
1756
|
value: string;
|
|
1110
1757
|
} | {
|
|
1111
1758
|
/** @constant */
|
|
1112
|
-
type: "
|
|
1759
|
+
type: "address";
|
|
1113
1760
|
value: string;
|
|
1114
|
-
}
|
|
1761
|
+
} | {
|
|
1762
|
+
/** @enum {string} */
|
|
1763
|
+
type: "string" | "symbol";
|
|
1764
|
+
value: string;
|
|
1765
|
+
} | {
|
|
1766
|
+
/** @constant */
|
|
1767
|
+
type: "bytes";
|
|
1768
|
+
/** @description Base64-encoded bytes */
|
|
1769
|
+
value: string;
|
|
1770
|
+
} | {
|
|
1771
|
+
/** @constant */
|
|
1772
|
+
type: "vec";
|
|
1773
|
+
/** @description Array of ScValArg items */
|
|
1774
|
+
value: unknown[];
|
|
1775
|
+
} | {
|
|
1776
|
+
/** @constant */
|
|
1777
|
+
type: "map";
|
|
1778
|
+
/** @description Array of {key, val} ScValArg pairs */
|
|
1779
|
+
value: {
|
|
1780
|
+
key: unknown;
|
|
1781
|
+
val: unknown;
|
|
1782
|
+
}[];
|
|
1783
|
+
} | {
|
|
1784
|
+
/** @constant */
|
|
1785
|
+
type: "void";
|
|
1786
|
+
})[];
|
|
1115
1787
|
};
|
|
1116
|
-
};
|
|
1788
|
+
});
|
|
1117
1789
|
};
|
|
1118
1790
|
};
|
|
1119
1791
|
responses: {
|
|
@@ -1190,12 +1862,13 @@ interface operations {
|
|
|
1190
1862
|
path?: never;
|
|
1191
1863
|
cookie?: never;
|
|
1192
1864
|
};
|
|
1193
|
-
requestBody
|
|
1865
|
+
requestBody: {
|
|
1194
1866
|
content: {
|
|
1195
1867
|
"application/json": {
|
|
1196
1868
|
/** @enum {string} */
|
|
1197
|
-
network: "testnet" | "
|
|
1198
|
-
|
|
1869
|
+
network: "testnet" | "mainnet";
|
|
1870
|
+
publicKey: string;
|
|
1871
|
+
unsignedXdr: string;
|
|
1199
1872
|
};
|
|
1200
1873
|
};
|
|
1201
1874
|
};
|
|
@@ -1252,7 +1925,7 @@ interface operations {
|
|
|
1252
1925
|
getTxStatus: {
|
|
1253
1926
|
parameters: {
|
|
1254
1927
|
query: {
|
|
1255
|
-
network: "testnet" | "
|
|
1928
|
+
network: "testnet" | "mainnet";
|
|
1256
1929
|
hash: string;
|
|
1257
1930
|
};
|
|
1258
1931
|
header?: never;
|
|
@@ -1311,254 +1984,774 @@ interface operations {
|
|
|
1311
1984
|
};
|
|
1312
1985
|
};
|
|
1313
1986
|
};
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
};
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1987
|
+
getTxHistory: {
|
|
1988
|
+
parameters: {
|
|
1989
|
+
query?: {
|
|
1990
|
+
network?: "testnet" | "mainnet";
|
|
1991
|
+
limit?: number;
|
|
1992
|
+
offset?: number;
|
|
1993
|
+
};
|
|
1994
|
+
header?: never;
|
|
1995
|
+
path?: never;
|
|
1996
|
+
cookie?: never;
|
|
1997
|
+
};
|
|
1998
|
+
requestBody?: never;
|
|
1999
|
+
responses: {
|
|
2000
|
+
/** @description Paginated list of transactions */
|
|
2001
|
+
200: {
|
|
2002
|
+
headers: {
|
|
2003
|
+
[name: string]: unknown;
|
|
2004
|
+
};
|
|
2005
|
+
content: {
|
|
2006
|
+
"application/json": {
|
|
2007
|
+
/** @constant */
|
|
2008
|
+
code: "SDK_TX_HISTORY";
|
|
2009
|
+
/** @constant */
|
|
2010
|
+
success: true;
|
|
2011
|
+
content: {
|
|
2012
|
+
records: {
|
|
2013
|
+
id: string;
|
|
2014
|
+
hash: string;
|
|
2015
|
+
/** @enum {string} */
|
|
2016
|
+
network: "testnet" | "mainnet";
|
|
2017
|
+
/** @enum {string} */
|
|
2018
|
+
status: "PENDING" | "SUCCESS" | "FAILED";
|
|
2019
|
+
operation: string;
|
|
2020
|
+
feeXlm?: string;
|
|
2021
|
+
resultCode?: string;
|
|
2022
|
+
details: {
|
|
2023
|
+
[key: string]: unknown;
|
|
2024
|
+
};
|
|
2025
|
+
summary: string;
|
|
2026
|
+
createdAt: string;
|
|
2027
|
+
}[];
|
|
2028
|
+
total: number;
|
|
2029
|
+
limit: number;
|
|
2030
|
+
offset: number;
|
|
2031
|
+
};
|
|
2032
|
+
};
|
|
2033
|
+
};
|
|
2034
|
+
};
|
|
2035
|
+
/** @description Validation error */
|
|
2036
|
+
400: {
|
|
2037
|
+
headers: {
|
|
2038
|
+
[name: string]: unknown;
|
|
2039
|
+
};
|
|
2040
|
+
content: {
|
|
2041
|
+
"application/json": {
|
|
2042
|
+
/** @constant */
|
|
2043
|
+
success: false;
|
|
2044
|
+
error: string;
|
|
2045
|
+
};
|
|
2046
|
+
};
|
|
2047
|
+
};
|
|
2048
|
+
/** @description Unauthorized */
|
|
2049
|
+
401: {
|
|
2050
|
+
headers: {
|
|
2051
|
+
[name: string]: unknown;
|
|
2052
|
+
};
|
|
2053
|
+
content: {
|
|
2054
|
+
"application/json": {
|
|
2055
|
+
/** @constant */
|
|
2056
|
+
success: false;
|
|
2057
|
+
error: string;
|
|
2058
|
+
};
|
|
2059
|
+
};
|
|
2060
|
+
};
|
|
2061
|
+
};
|
|
2062
|
+
};
|
|
2063
|
+
getWalletBalance: {
|
|
2064
|
+
parameters: {
|
|
2065
|
+
query: {
|
|
2066
|
+
network: "testnet" | "mainnet";
|
|
2067
|
+
publicKey: string;
|
|
2068
|
+
};
|
|
2069
|
+
header?: never;
|
|
2070
|
+
path?: never;
|
|
2071
|
+
cookie?: never;
|
|
2072
|
+
};
|
|
2073
|
+
requestBody?: never;
|
|
2074
|
+
responses: {
|
|
2075
|
+
/** @description Account balances */
|
|
2076
|
+
200: {
|
|
2077
|
+
headers: {
|
|
2078
|
+
[name: string]: unknown;
|
|
2079
|
+
};
|
|
2080
|
+
content: {
|
|
2081
|
+
"application/json": {
|
|
2082
|
+
/** @constant */
|
|
2083
|
+
code: "SDK_WALLET_BALANCE";
|
|
2084
|
+
/** @constant */
|
|
2085
|
+
success: true;
|
|
2086
|
+
content: {
|
|
2087
|
+
publicKey: string;
|
|
2088
|
+
/** @enum {string} */
|
|
2089
|
+
network: "testnet" | "mainnet";
|
|
2090
|
+
exists: boolean;
|
|
2091
|
+
balances: {
|
|
2092
|
+
/** @enum {string} */
|
|
2093
|
+
type: "native" | "credit_alphanum4" | "credit_alphanum12";
|
|
2094
|
+
code: string;
|
|
2095
|
+
issuer?: string;
|
|
2096
|
+
balance: string;
|
|
2097
|
+
available: string;
|
|
2098
|
+
limit?: string;
|
|
2099
|
+
enabledInApp: boolean;
|
|
2100
|
+
trustlineRemoved: boolean;
|
|
2101
|
+
}[];
|
|
2102
|
+
};
|
|
2103
|
+
};
|
|
2104
|
+
};
|
|
2105
|
+
};
|
|
2106
|
+
/** @description Validation error */
|
|
2107
|
+
400: {
|
|
2108
|
+
headers: {
|
|
2109
|
+
[name: string]: unknown;
|
|
2110
|
+
};
|
|
2111
|
+
content: {
|
|
2112
|
+
"application/json": {
|
|
2113
|
+
/** @constant */
|
|
2114
|
+
success: false;
|
|
2115
|
+
error: string;
|
|
2116
|
+
};
|
|
2117
|
+
};
|
|
2118
|
+
};
|
|
2119
|
+
/** @description Unauthorized */
|
|
2120
|
+
401: {
|
|
2121
|
+
headers: {
|
|
2122
|
+
[name: string]: unknown;
|
|
2123
|
+
};
|
|
2124
|
+
content: {
|
|
2125
|
+
"application/json": {
|
|
2126
|
+
/** @constant */
|
|
2127
|
+
success: false;
|
|
2128
|
+
error: string;
|
|
2129
|
+
};
|
|
2130
|
+
};
|
|
2131
|
+
};
|
|
2132
|
+
};
|
|
2133
|
+
};
|
|
2134
|
+
getKycStatus: {
|
|
2135
|
+
parameters: {
|
|
2136
|
+
query?: {
|
|
2137
|
+
providerId?: string;
|
|
2138
|
+
};
|
|
2139
|
+
header?: never;
|
|
2140
|
+
path?: never;
|
|
2141
|
+
cookie?: never;
|
|
2142
|
+
};
|
|
2143
|
+
requestBody?: never;
|
|
2144
|
+
responses: {
|
|
2145
|
+
/** @description KYC status for the authenticated user */
|
|
2146
|
+
200: {
|
|
2147
|
+
headers: {
|
|
2148
|
+
[name: string]: unknown;
|
|
2149
|
+
};
|
|
2150
|
+
content: {
|
|
2151
|
+
"application/json": {
|
|
2152
|
+
/** @constant */
|
|
2153
|
+
code: "SDK_KYC_STATUS";
|
|
2154
|
+
/** @constant */
|
|
2155
|
+
success: true;
|
|
2156
|
+
content: {
|
|
2157
|
+
/** @enum {string} */
|
|
2158
|
+
status: "none" | "pending" | "approved" | "rejected";
|
|
2159
|
+
/** @enum {string} */
|
|
2160
|
+
level?: "basic" | "intermediate" | "enhanced";
|
|
2161
|
+
providerId: string;
|
|
2162
|
+
expiresAt?: string;
|
|
2163
|
+
};
|
|
2164
|
+
};
|
|
2165
|
+
};
|
|
2166
|
+
};
|
|
2167
|
+
/** @description Validation error */
|
|
2168
|
+
400: {
|
|
2169
|
+
headers: {
|
|
2170
|
+
[name: string]: unknown;
|
|
2171
|
+
};
|
|
2172
|
+
content: {
|
|
2173
|
+
"application/json": {
|
|
2174
|
+
/** @constant */
|
|
2175
|
+
success: false;
|
|
2176
|
+
error: string;
|
|
2177
|
+
};
|
|
2178
|
+
};
|
|
2179
|
+
};
|
|
2180
|
+
/** @description Unauthorized */
|
|
2181
|
+
401: {
|
|
2182
|
+
headers: {
|
|
2183
|
+
[name: string]: unknown;
|
|
2184
|
+
};
|
|
2185
|
+
content: {
|
|
2186
|
+
"application/json": {
|
|
2187
|
+
/** @constant */
|
|
2188
|
+
success: false;
|
|
2189
|
+
error: string;
|
|
2190
|
+
};
|
|
2191
|
+
};
|
|
2192
|
+
};
|
|
2193
|
+
/** @description Not found */
|
|
2194
|
+
404: {
|
|
2195
|
+
headers: {
|
|
2196
|
+
[name: string]: unknown;
|
|
2197
|
+
};
|
|
2198
|
+
content: {
|
|
2199
|
+
"application/json": {
|
|
2200
|
+
/** @constant */
|
|
2201
|
+
success: false;
|
|
2202
|
+
error: string;
|
|
2203
|
+
};
|
|
2204
|
+
};
|
|
2205
|
+
};
|
|
2206
|
+
};
|
|
1341
2207
|
};
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
2208
|
+
getKycProviders: {
|
|
2209
|
+
parameters: {
|
|
2210
|
+
query: {
|
|
2211
|
+
country: string;
|
|
2212
|
+
};
|
|
2213
|
+
header?: never;
|
|
2214
|
+
path?: never;
|
|
2215
|
+
cookie?: never;
|
|
2216
|
+
};
|
|
2217
|
+
requestBody?: never;
|
|
2218
|
+
responses: {
|
|
2219
|
+
/** @description List of KYC providers available for the country */
|
|
2220
|
+
200: {
|
|
2221
|
+
headers: {
|
|
2222
|
+
[name: string]: unknown;
|
|
2223
|
+
};
|
|
2224
|
+
content: {
|
|
2225
|
+
"application/json": {
|
|
2226
|
+
/** @constant */
|
|
2227
|
+
code: "SDK_KYC_PROVIDERS";
|
|
2228
|
+
/** @constant */
|
|
2229
|
+
success: true;
|
|
2230
|
+
content: {
|
|
2231
|
+
providers: {
|
|
2232
|
+
id: string;
|
|
2233
|
+
name: string;
|
|
2234
|
+
/** @enum {string} */
|
|
2235
|
+
flow: "iframe" | "form" | "redirect";
|
|
2236
|
+
levels: ("basic" | "intermediate" | "enhanced")[];
|
|
2237
|
+
}[];
|
|
2238
|
+
};
|
|
2239
|
+
};
|
|
2240
|
+
};
|
|
2241
|
+
};
|
|
2242
|
+
/** @description Validation error */
|
|
2243
|
+
400: {
|
|
2244
|
+
headers: {
|
|
2245
|
+
[name: string]: unknown;
|
|
2246
|
+
};
|
|
2247
|
+
content: {
|
|
2248
|
+
"application/json": {
|
|
2249
|
+
/** @constant */
|
|
2250
|
+
success: false;
|
|
2251
|
+
error: string;
|
|
2252
|
+
};
|
|
2253
|
+
};
|
|
2254
|
+
};
|
|
2255
|
+
/** @description Unauthorized */
|
|
2256
|
+
401: {
|
|
2257
|
+
headers: {
|
|
2258
|
+
[name: string]: unknown;
|
|
2259
|
+
};
|
|
2260
|
+
content: {
|
|
2261
|
+
"application/json": {
|
|
2262
|
+
/** @constant */
|
|
2263
|
+
success: false;
|
|
2264
|
+
error: string;
|
|
2265
|
+
};
|
|
2266
|
+
};
|
|
2267
|
+
};
|
|
2268
|
+
};
|
|
2269
|
+
};
|
|
2270
|
+
postKycStart: {
|
|
2271
|
+
parameters: {
|
|
2272
|
+
query?: never;
|
|
2273
|
+
header?: never;
|
|
2274
|
+
path?: never;
|
|
2275
|
+
cookie?: never;
|
|
2276
|
+
};
|
|
2277
|
+
requestBody: {
|
|
2278
|
+
content: {
|
|
2279
|
+
"application/json": {
|
|
2280
|
+
providerId: string;
|
|
2281
|
+
/** @enum {string} */
|
|
2282
|
+
level: "basic" | "intermediate" | "enhanced";
|
|
2283
|
+
};
|
|
2284
|
+
};
|
|
2285
|
+
};
|
|
2286
|
+
responses: {
|
|
2287
|
+
/** @description KYC session created */
|
|
2288
|
+
200: {
|
|
2289
|
+
headers: {
|
|
2290
|
+
[name: string]: unknown;
|
|
2291
|
+
};
|
|
2292
|
+
content: {
|
|
2293
|
+
"application/json": {
|
|
2294
|
+
/** @constant */
|
|
2295
|
+
code: "SDK_KYC_STARTED";
|
|
2296
|
+
/** @constant */
|
|
2297
|
+
success: true;
|
|
2298
|
+
content: {
|
|
2299
|
+
sessionId: string;
|
|
2300
|
+
kycUrl?: string;
|
|
2301
|
+
fields?: {
|
|
2302
|
+
name: string;
|
|
2303
|
+
type: string;
|
|
2304
|
+
required: boolean;
|
|
2305
|
+
}[];
|
|
2306
|
+
};
|
|
2307
|
+
};
|
|
2308
|
+
};
|
|
2309
|
+
};
|
|
2310
|
+
/** @description Validation error */
|
|
2311
|
+
400: {
|
|
2312
|
+
headers: {
|
|
2313
|
+
[name: string]: unknown;
|
|
2314
|
+
};
|
|
2315
|
+
content: {
|
|
2316
|
+
"application/json": {
|
|
2317
|
+
/** @constant */
|
|
2318
|
+
success: false;
|
|
2319
|
+
error: string;
|
|
2320
|
+
};
|
|
2321
|
+
};
|
|
2322
|
+
};
|
|
2323
|
+
/** @description Unauthorized */
|
|
2324
|
+
401: {
|
|
2325
|
+
headers: {
|
|
2326
|
+
[name: string]: unknown;
|
|
2327
|
+
};
|
|
2328
|
+
content: {
|
|
2329
|
+
"application/json": {
|
|
2330
|
+
/** @constant */
|
|
2331
|
+
success: false;
|
|
2332
|
+
error: string;
|
|
2333
|
+
};
|
|
2334
|
+
};
|
|
2335
|
+
};
|
|
2336
|
+
/** @description Provider not found or not enabled for this application */
|
|
2337
|
+
404: {
|
|
2338
|
+
headers: {
|
|
2339
|
+
[name: string]: unknown;
|
|
2340
|
+
};
|
|
2341
|
+
content: {
|
|
2342
|
+
"application/json": {
|
|
2343
|
+
/** @constant */
|
|
2344
|
+
success: false;
|
|
2345
|
+
error: string;
|
|
2346
|
+
};
|
|
2347
|
+
};
|
|
2348
|
+
};
|
|
2349
|
+
};
|
|
2350
|
+
};
|
|
2351
|
+
getRampsQuote: {
|
|
2352
|
+
parameters: {
|
|
2353
|
+
query: {
|
|
2354
|
+
country: string;
|
|
2355
|
+
amount: number;
|
|
2356
|
+
currency: string;
|
|
2357
|
+
direction: "onramp" | "offramp";
|
|
2358
|
+
};
|
|
2359
|
+
header?: never;
|
|
2360
|
+
path?: never;
|
|
2361
|
+
cookie?: never;
|
|
2362
|
+
};
|
|
2363
|
+
requestBody?: never;
|
|
2364
|
+
responses: {
|
|
2365
|
+
/** @description List of available quotes sorted by recommendation. First item is the best option. */
|
|
2366
|
+
200: {
|
|
2367
|
+
headers: {
|
|
2368
|
+
[name: string]: unknown;
|
|
2369
|
+
};
|
|
2370
|
+
content: {
|
|
2371
|
+
"application/json": {
|
|
2372
|
+
/** @constant */
|
|
2373
|
+
code: "SDK_RAMPS_QUOTES";
|
|
2374
|
+
/** @constant */
|
|
2375
|
+
success: true;
|
|
2376
|
+
content: {
|
|
2377
|
+
quotes: {
|
|
2378
|
+
quoteId: string;
|
|
2379
|
+
provider: string;
|
|
2380
|
+
fee: number;
|
|
2381
|
+
feeCurrency: string;
|
|
2382
|
+
rate: number;
|
|
2383
|
+
/** @enum {string} */
|
|
2384
|
+
rail: "SPEI" | "PIX" | "PSE" | "ACH";
|
|
2385
|
+
/** @enum {string} */
|
|
2386
|
+
protocol: "SEP-24" | "REST";
|
|
2387
|
+
estimatedTime: string;
|
|
2388
|
+
recommended: boolean;
|
|
2389
|
+
}[];
|
|
2390
|
+
};
|
|
2391
|
+
};
|
|
2392
|
+
};
|
|
2393
|
+
};
|
|
2394
|
+
/** @description Validation error */
|
|
2395
|
+
400: {
|
|
2396
|
+
headers: {
|
|
2397
|
+
[name: string]: unknown;
|
|
2398
|
+
};
|
|
2399
|
+
content: {
|
|
2400
|
+
"application/json": {
|
|
2401
|
+
/** @constant */
|
|
2402
|
+
success: false;
|
|
2403
|
+
error: string;
|
|
2404
|
+
};
|
|
2405
|
+
};
|
|
2406
|
+
};
|
|
2407
|
+
/** @description Unauthorized */
|
|
2408
|
+
401: {
|
|
2409
|
+
headers: {
|
|
2410
|
+
[name: string]: unknown;
|
|
2411
|
+
};
|
|
2412
|
+
content: {
|
|
2413
|
+
"application/json": {
|
|
2414
|
+
/** @constant */
|
|
2415
|
+
success: false;
|
|
2416
|
+
error: string;
|
|
2417
|
+
};
|
|
2418
|
+
};
|
|
2419
|
+
};
|
|
2420
|
+
};
|
|
2421
|
+
};
|
|
2422
|
+
postRampsOnramp: {
|
|
2423
|
+
parameters: {
|
|
2424
|
+
query?: never;
|
|
2425
|
+
header?: never;
|
|
2426
|
+
path?: never;
|
|
2427
|
+
cookie?: never;
|
|
2428
|
+
};
|
|
2429
|
+
requestBody: {
|
|
2430
|
+
content: {
|
|
2431
|
+
"application/json": {
|
|
2432
|
+
quoteId: string;
|
|
2433
|
+
amount: number;
|
|
2434
|
+
currency: string;
|
|
2435
|
+
country: string;
|
|
2436
|
+
walletAddress: string;
|
|
2437
|
+
};
|
|
2438
|
+
};
|
|
2439
|
+
};
|
|
2440
|
+
responses: {
|
|
2441
|
+
/** @description Onramp transaction created with payment instructions */
|
|
2442
|
+
200: {
|
|
2443
|
+
headers: {
|
|
2444
|
+
[name: string]: unknown;
|
|
2445
|
+
};
|
|
2446
|
+
content: {
|
|
2447
|
+
"application/json": {
|
|
2448
|
+
/** @constant */
|
|
2449
|
+
code: "SDK_RAMPS_ONRAMP_CREATED";
|
|
2450
|
+
/** @constant */
|
|
2451
|
+
success: true;
|
|
2452
|
+
content: {
|
|
2453
|
+
txId: string;
|
|
2454
|
+
provider: string;
|
|
2455
|
+
/** @enum {string} */
|
|
2456
|
+
status: "pending" | "processing" | "completed" | "failed";
|
|
2457
|
+
paymentInstructions: {
|
|
2458
|
+
/** @enum {string} */
|
|
2459
|
+
type: "CLABE" | "PIX" | "PSE" | "ACH";
|
|
2460
|
+
value: string;
|
|
2461
|
+
amount: number;
|
|
2462
|
+
currency: string;
|
|
2463
|
+
expiresAt?: string;
|
|
2464
|
+
};
|
|
2465
|
+
};
|
|
2466
|
+
};
|
|
2467
|
+
};
|
|
2468
|
+
};
|
|
2469
|
+
/** @description Validation error or quote expired */
|
|
2470
|
+
400: {
|
|
2471
|
+
headers: {
|
|
2472
|
+
[name: string]: unknown;
|
|
2473
|
+
};
|
|
2474
|
+
content: {
|
|
2475
|
+
"application/json": {
|
|
2476
|
+
/** @constant */
|
|
2477
|
+
success: false;
|
|
2478
|
+
error: string;
|
|
2479
|
+
};
|
|
2480
|
+
};
|
|
2481
|
+
};
|
|
2482
|
+
/** @description Unauthorized */
|
|
2483
|
+
401: {
|
|
2484
|
+
headers: {
|
|
2485
|
+
[name: string]: unknown;
|
|
2486
|
+
};
|
|
2487
|
+
content: {
|
|
2488
|
+
"application/json": {
|
|
2489
|
+
/** @constant */
|
|
2490
|
+
success: false;
|
|
2491
|
+
error: string;
|
|
2492
|
+
};
|
|
2493
|
+
};
|
|
2494
|
+
};
|
|
2495
|
+
/** @description Quote not found */
|
|
2496
|
+
404: {
|
|
2497
|
+
headers: {
|
|
2498
|
+
[name: string]: unknown;
|
|
2499
|
+
};
|
|
2500
|
+
content: {
|
|
2501
|
+
"application/json": {
|
|
2502
|
+
/** @constant */
|
|
2503
|
+
success: false;
|
|
2504
|
+
error: string;
|
|
2505
|
+
};
|
|
2506
|
+
};
|
|
2507
|
+
};
|
|
2508
|
+
};
|
|
2509
|
+
};
|
|
2510
|
+
postRampsOfframp: {
|
|
2511
|
+
parameters: {
|
|
2512
|
+
query?: never;
|
|
2513
|
+
header?: never;
|
|
2514
|
+
path?: never;
|
|
2515
|
+
cookie?: never;
|
|
2516
|
+
};
|
|
2517
|
+
requestBody: {
|
|
2518
|
+
content: {
|
|
2519
|
+
"application/json": {
|
|
2520
|
+
quoteId: string;
|
|
2521
|
+
amount: number;
|
|
2522
|
+
currency: string;
|
|
2523
|
+
country: string;
|
|
2524
|
+
walletAddress: string;
|
|
2525
|
+
bankDetails: {
|
|
2526
|
+
/** @enum {string} */
|
|
2527
|
+
type: "CLABE" | "PIX" | "PSE" | "ACH";
|
|
2528
|
+
value: string;
|
|
2529
|
+
};
|
|
2530
|
+
};
|
|
2531
|
+
};
|
|
2532
|
+
};
|
|
2533
|
+
responses: {
|
|
2534
|
+
/** @description Offramp transaction created */
|
|
2535
|
+
200: {
|
|
2536
|
+
headers: {
|
|
2537
|
+
[name: string]: unknown;
|
|
2538
|
+
};
|
|
2539
|
+
content: {
|
|
2540
|
+
"application/json": {
|
|
2541
|
+
/** @constant */
|
|
2542
|
+
code: "SDK_RAMPS_OFFRAMP_CREATED";
|
|
2543
|
+
/** @constant */
|
|
2544
|
+
success: true;
|
|
2545
|
+
content: {
|
|
2546
|
+
txId: string;
|
|
2547
|
+
provider: string;
|
|
2548
|
+
/** @enum {string} */
|
|
2549
|
+
status: "pending" | "processing" | "completed" | "failed";
|
|
2550
|
+
};
|
|
2551
|
+
};
|
|
2552
|
+
};
|
|
2553
|
+
};
|
|
2554
|
+
/** @description Validation error or quote expired */
|
|
2555
|
+
400: {
|
|
2556
|
+
headers: {
|
|
2557
|
+
[name: string]: unknown;
|
|
2558
|
+
};
|
|
2559
|
+
content: {
|
|
2560
|
+
"application/json": {
|
|
2561
|
+
/** @constant */
|
|
2562
|
+
success: false;
|
|
2563
|
+
error: string;
|
|
2564
|
+
};
|
|
2565
|
+
};
|
|
2566
|
+
};
|
|
2567
|
+
/** @description Unauthorized */
|
|
2568
|
+
401: {
|
|
2569
|
+
headers: {
|
|
2570
|
+
[name: string]: unknown;
|
|
2571
|
+
};
|
|
2572
|
+
content: {
|
|
2573
|
+
"application/json": {
|
|
2574
|
+
/** @constant */
|
|
2575
|
+
success: false;
|
|
2576
|
+
error: string;
|
|
2577
|
+
};
|
|
2578
|
+
};
|
|
2579
|
+
};
|
|
2580
|
+
/** @description Quote not found */
|
|
2581
|
+
404: {
|
|
2582
|
+
headers: {
|
|
2583
|
+
[name: string]: unknown;
|
|
2584
|
+
};
|
|
2585
|
+
content: {
|
|
2586
|
+
"application/json": {
|
|
2587
|
+
/** @constant */
|
|
2588
|
+
success: false;
|
|
2589
|
+
error: string;
|
|
2590
|
+
};
|
|
2591
|
+
};
|
|
2592
|
+
};
|
|
2593
|
+
};
|
|
2594
|
+
};
|
|
2595
|
+
getRampsTransactionByTxId: {
|
|
2596
|
+
parameters: {
|
|
2597
|
+
query?: never;
|
|
2598
|
+
header?: never;
|
|
2599
|
+
path: {
|
|
2600
|
+
/** @description Transaction ID returned by POST /ramps/onramp or POST /ramps/offramp */
|
|
2601
|
+
txId: string;
|
|
2602
|
+
};
|
|
2603
|
+
cookie?: never;
|
|
2604
|
+
};
|
|
2605
|
+
requestBody?: never;
|
|
2606
|
+
responses: {
|
|
2607
|
+
/** @description Transaction status and details */
|
|
2608
|
+
200: {
|
|
2609
|
+
headers: {
|
|
2610
|
+
[name: string]: unknown;
|
|
2611
|
+
};
|
|
2612
|
+
content: {
|
|
2613
|
+
"application/json": {
|
|
2614
|
+
/** @constant */
|
|
2615
|
+
code: "SDK_RAMPS_TX_STATUS";
|
|
2616
|
+
/** @constant */
|
|
2617
|
+
success: true;
|
|
2618
|
+
content: {
|
|
2619
|
+
txId: string;
|
|
2620
|
+
provider: string;
|
|
2621
|
+
/** @enum {string} */
|
|
2622
|
+
status: "pending" | "processing" | "completed" | "failed";
|
|
2623
|
+
/** @enum {string} */
|
|
2624
|
+
direction: "onramp" | "offramp";
|
|
2625
|
+
amount: number;
|
|
2626
|
+
currency: string;
|
|
2627
|
+
updatedAt: string;
|
|
2628
|
+
};
|
|
2629
|
+
};
|
|
2630
|
+
};
|
|
2631
|
+
};
|
|
2632
|
+
/** @description Unauthorized */
|
|
2633
|
+
401: {
|
|
2634
|
+
headers: {
|
|
2635
|
+
[name: string]: unknown;
|
|
2636
|
+
};
|
|
2637
|
+
content: {
|
|
2638
|
+
"application/json": {
|
|
2639
|
+
/** @constant */
|
|
2640
|
+
success: false;
|
|
2641
|
+
error: string;
|
|
2642
|
+
};
|
|
2643
|
+
};
|
|
2644
|
+
};
|
|
2645
|
+
/** @description Forbidden */
|
|
2646
|
+
403: {
|
|
2647
|
+
headers: {
|
|
2648
|
+
[name: string]: unknown;
|
|
2649
|
+
};
|
|
2650
|
+
content: {
|
|
2651
|
+
"application/json": {
|
|
2652
|
+
/** @constant */
|
|
2653
|
+
success: false;
|
|
2654
|
+
error: string;
|
|
2655
|
+
};
|
|
2656
|
+
};
|
|
2657
|
+
};
|
|
2658
|
+
/** @description Not found */
|
|
2659
|
+
404: {
|
|
2660
|
+
headers: {
|
|
2661
|
+
[name: string]: unknown;
|
|
2662
|
+
};
|
|
2663
|
+
content: {
|
|
2664
|
+
"application/json": {
|
|
2665
|
+
/** @constant */
|
|
2666
|
+
success: false;
|
|
2667
|
+
error: string;
|
|
2668
|
+
};
|
|
2669
|
+
};
|
|
2670
|
+
};
|
|
2671
|
+
};
|
|
1345
2672
|
};
|
|
1346
|
-
};
|
|
1347
|
-
|
|
1348
|
-
declare enum WalletType {
|
|
1349
|
-
FREIGHTER = "freighter",
|
|
1350
|
-
ALBEDO = "albedo"
|
|
1351
|
-
}
|
|
1352
|
-
interface ConnectWalletResponse {
|
|
1353
|
-
address: string;
|
|
1354
|
-
publicKey: string;
|
|
1355
|
-
}
|
|
1356
|
-
interface SignTransactionOptions {
|
|
1357
|
-
network?: string;
|
|
1358
|
-
networkPassphrase?: string;
|
|
1359
|
-
accountToSign?: string;
|
|
1360
|
-
}
|
|
1361
|
-
interface SignAuthEntryOptions {
|
|
1362
|
-
accountToSign?: string;
|
|
1363
|
-
}
|
|
1364
|
-
interface SignTransactionResponse {
|
|
1365
|
-
signedTxXdr: string;
|
|
1366
|
-
}
|
|
1367
|
-
interface SignAuthEntryResponse {
|
|
1368
|
-
signedAuthEntry: string;
|
|
1369
|
-
}
|
|
1370
|
-
interface WalletAdapter {
|
|
1371
|
-
type: WalletType;
|
|
1372
|
-
isAvailable(): Promise<boolean>;
|
|
1373
|
-
connect(): Promise<ConnectWalletResponse>;
|
|
1374
|
-
disconnect(): Promise<void>;
|
|
1375
|
-
getPublicKey(): Promise<string | null>;
|
|
1376
|
-
signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse>;
|
|
1377
|
-
signAuthEntry(entryXdr: string, options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse>;
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
declare class FreighterAdapter implements WalletAdapter {
|
|
1381
|
-
readonly type = WalletType.FREIGHTER;
|
|
1382
|
-
isAvailable(): Promise<boolean>;
|
|
1383
|
-
connect(): Promise<ConnectWalletResponse>;
|
|
1384
|
-
disconnect(): Promise<void>;
|
|
1385
|
-
getPublicKey(): Promise<string | null>;
|
|
1386
|
-
getNetwork(): Promise<string>;
|
|
1387
|
-
signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse>;
|
|
1388
|
-
signAuthEntry(entryXdr: string, options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse>;
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
declare class AlbedoAdapter implements WalletAdapter {
|
|
1392
|
-
readonly type = WalletType.ALBEDO;
|
|
1393
|
-
isAvailable(): Promise<boolean>;
|
|
1394
|
-
connect(): Promise<ConnectWalletResponse>;
|
|
1395
|
-
disconnect(): Promise<void>;
|
|
1396
|
-
getPublicKey(): Promise<string | null>;
|
|
1397
|
-
getNetwork(): Promise<string>;
|
|
1398
|
-
signTransaction(xdr: string, _options?: SignTransactionOptions): Promise<SignTransactionResponse>;
|
|
1399
|
-
signAuthEntry(entryXdr: string, _options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse>;
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
|
-
type PollarApplicationConfigResponse = paths['/auth/login']['post']['responses'][200]['content']['application/json'];
|
|
1403
|
-
type PollarApplicationConfigContent = PollarApplicationConfigResponse['content'];
|
|
1404
|
-
interface PollarClientConfig {
|
|
1405
|
-
stellarNetwork?: StellarNetwork;
|
|
1406
|
-
baseUrl?: string;
|
|
1407
|
-
apiKey: string;
|
|
1408
|
-
}
|
|
1409
|
-
type TxBuildBody = NonNullable<paths['/tx/build']['post']['requestBody']>['content']['application/json'];
|
|
1410
|
-
type TxBuildResponse = paths['/tx/build']['post']['responses'][200]['content']['application/json'];
|
|
1411
|
-
type TxSignAndSendBody = NonNullable<paths['/tx/sign-and-send']['post']['requestBody']>['content']['application/json'];
|
|
1412
|
-
type TxSignSendResponse = paths['/tx/sign-and-send']['post']['responses'][200]['content']['application/json'];
|
|
1413
|
-
type PollarLoginOptions = {
|
|
1414
|
-
provider: 'google';
|
|
1415
|
-
} | {
|
|
1416
|
-
provider: 'github';
|
|
1417
|
-
} | {
|
|
1418
|
-
provider: 'email';
|
|
1419
|
-
email: string;
|
|
1420
|
-
} | {
|
|
1421
|
-
provider: 'wallet';
|
|
1422
|
-
type: WalletType;
|
|
1423
|
-
};
|
|
1424
|
-
type NetworkCodes = (typeof STATE_VAR_CODES)[typeof PollarStateVar.NETWORK];
|
|
1425
|
-
type StateNetworkCodes = NetworkCodes[keyof (typeof STATE_VAR_CODES)[typeof PollarStateVar.NETWORK]];
|
|
1426
|
-
type TransactionCodes = (typeof STATE_VAR_CODES)[typeof PollarStateVar.TRANSACTION];
|
|
1427
|
-
type StateTransactionCodes = TransactionCodes[keyof (typeof STATE_VAR_CODES)[typeof PollarStateVar.TRANSACTION]];
|
|
1428
|
-
type StateVarCodes = StateNetworkCodes | StateTransactionCodes;
|
|
1429
|
-
interface PollarStateEntry {
|
|
1430
|
-
var: PollarStateVar;
|
|
1431
|
-
code: StateVarCodes;
|
|
1432
|
-
status: StateStatus;
|
|
1433
|
-
level: 'info' | 'warn' | 'error';
|
|
1434
|
-
data?: unknown;
|
|
1435
|
-
ts: number;
|
|
1436
|
-
}
|
|
1437
|
-
type PollarState = {
|
|
1438
|
-
[key in PollarStateVar]: PollarStateEntry[];
|
|
1439
|
-
};
|
|
1440
|
-
declare const AUTH_ERROR_CODES: {
|
|
1441
|
-
readonly SESSION_CREATE_FAILED: "SESSION_CREATE_FAILED";
|
|
1442
|
-
readonly EMAIL_SEND_FAILED: "EMAIL_SEND_FAILED";
|
|
1443
|
-
readonly EMAIL_VERIFY_FAILED: "EMAIL_VERIFY_FAILED";
|
|
1444
|
-
readonly EMAIL_CODE_EXPIRED: "EMAIL_CODE_EXPIRED";
|
|
1445
|
-
readonly EMAIL_CODE_INVALID: "EMAIL_CODE_INVALID";
|
|
1446
|
-
readonly AUTH_FAILED: "AUTH_FAILED";
|
|
1447
|
-
readonly WALLET_CONNECT_FAILED: "WALLET_CONNECT_FAILED";
|
|
1448
|
-
readonly WALLET_AUTH_FAILED: "WALLET_AUTH_FAILED";
|
|
1449
|
-
readonly UNEXPECTED_ERROR: "UNEXPECTED_ERROR";
|
|
1450
|
-
};
|
|
1451
|
-
type AuthErrorCode = (typeof AUTH_ERROR_CODES)[keyof typeof AUTH_ERROR_CODES];
|
|
1452
|
-
type AuthState = {
|
|
1453
|
-
step: 'idle';
|
|
1454
|
-
} | {
|
|
1455
|
-
step: 'creating_session';
|
|
1456
|
-
} | {
|
|
1457
|
-
step: 'entering_email';
|
|
1458
|
-
clientSessionId: string;
|
|
1459
|
-
} | {
|
|
1460
|
-
step: 'sending_email';
|
|
1461
|
-
email: string;
|
|
1462
|
-
} | {
|
|
1463
|
-
step: 'entering_code';
|
|
1464
|
-
clientSessionId: string;
|
|
1465
|
-
email: string;
|
|
1466
|
-
} | {
|
|
1467
|
-
step: 'verifying_email_code';
|
|
1468
|
-
clientSessionId: string;
|
|
1469
|
-
email: string;
|
|
1470
|
-
} | {
|
|
1471
|
-
step: 'opening_oauth';
|
|
1472
|
-
provider: 'google' | 'github';
|
|
1473
|
-
} | {
|
|
1474
|
-
step: 'connecting_wallet';
|
|
1475
|
-
walletType: WalletType;
|
|
1476
|
-
} | {
|
|
1477
|
-
step: 'wallet_not_installed';
|
|
1478
|
-
walletType: WalletType;
|
|
1479
|
-
} | {
|
|
1480
|
-
step: 'authenticating_wallet';
|
|
1481
|
-
} | {
|
|
1482
|
-
step: 'authenticating';
|
|
1483
|
-
} | {
|
|
1484
|
-
step: 'authenticated';
|
|
1485
|
-
session: PollarApplicationConfigContent;
|
|
1486
|
-
} | {
|
|
1487
|
-
step: 'error';
|
|
1488
|
-
previousStep: string;
|
|
1489
|
-
message: string;
|
|
1490
|
-
errorCode: AuthErrorCode;
|
|
1491
|
-
clientSessionId?: string;
|
|
1492
|
-
email?: string;
|
|
1493
|
-
};
|
|
1494
|
-
declare class PollarFlowError extends Error {
|
|
1495
|
-
readonly code: "INVALID_FLOW";
|
|
1496
|
-
constructor(message: string);
|
|
1497
2673
|
}
|
|
1498
2674
|
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
readonly id: string;
|
|
1502
|
-
readonly basePath: string;
|
|
1503
|
-
private readonly _api;
|
|
1504
|
-
private _session;
|
|
1505
|
-
private _stateListeners;
|
|
1506
|
-
private _state;
|
|
1507
|
-
private _authState;
|
|
1508
|
-
private _authStateListeners;
|
|
1509
|
-
private _loginController;
|
|
1510
|
-
constructor(config: PollarClientConfig);
|
|
1511
|
-
isAuthenticated(): boolean;
|
|
1512
|
-
getAuthState(): AuthState;
|
|
1513
|
-
onAuthStateChange(cb: (state: AuthState) => void): () => void;
|
|
1514
|
-
login(options: PollarLoginOptions): void;
|
|
1515
|
-
beginEmailLogin(): void;
|
|
1516
|
-
sendEmailCode(email: string): void;
|
|
1517
|
-
verifyEmailCode(code: string): void;
|
|
1518
|
-
loginOAuth(provider: 'google' | 'github'): void;
|
|
1519
|
-
loginWallet(type: WalletType): void;
|
|
1520
|
-
cancelLogin(): void;
|
|
1521
|
-
logout(): void;
|
|
1522
|
-
getApi(): PollarApiClient;
|
|
1523
|
-
getNetwork(): "testnet" | "public";
|
|
1524
|
-
onStateChange(cb: (state: PollarStateEntry) => void): () => void;
|
|
1525
|
-
buildTx(operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']): Promise<void>;
|
|
1526
|
-
submitTx(signedXdr: string): Promise<void>;
|
|
1527
|
-
/** Creates a new AbortController, cancelling any existing flow first. */
|
|
1528
|
-
private _newController;
|
|
1529
|
-
/** Builds the deps object passed to flow functions via bind pattern. */
|
|
1530
|
-
private _flowDeps;
|
|
1531
|
-
private _handleFlowError;
|
|
1532
|
-
private _readStore;
|
|
1533
|
-
private _storeSession;
|
|
1534
|
-
private _clearSession;
|
|
1535
|
-
private _setAuthState;
|
|
1536
|
-
private _emitState;
|
|
1537
|
-
}
|
|
2675
|
+
type PollarApiClient = ReturnType<typeof createApiClient>;
|
|
2676
|
+
declare function createApiClient(baseUrl: string): openapi_fetch.Client<paths, `${string}/${string}`>;
|
|
1538
2677
|
|
|
1539
2678
|
declare function isValidSession(value: unknown): value is PollarApplicationConfigContent;
|
|
1540
2679
|
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
2680
|
+
/**
|
|
2681
|
+
* GET /kyc/status
|
|
2682
|
+
* Returns the current user's KYC status for a given provider.
|
|
2683
|
+
* Requires a valid auth token in the API client.
|
|
2684
|
+
*/
|
|
2685
|
+
declare function getKycStatus(api: PollarApiClient, providerId?: string): Promise<{
|
|
2686
|
+
status: KycStatus;
|
|
2687
|
+
level?: KycLevel | undefined;
|
|
2688
|
+
providerId: string;
|
|
2689
|
+
expiresAt?: string;
|
|
2690
|
+
}>;
|
|
2691
|
+
/**
|
|
2692
|
+
* GET /kyc/providers
|
|
2693
|
+
* Returns available KYC providers for a given country.
|
|
2694
|
+
*/
|
|
2695
|
+
declare function getKycProviders(api: PollarApiClient, country: string): Promise<{
|
|
2696
|
+
providers: KycProvider[];
|
|
2697
|
+
}>;
|
|
2698
|
+
/**
|
|
2699
|
+
* POST /kyc/start
|
|
2700
|
+
* Starts a KYC session.
|
|
2701
|
+
* - flow=iframe/redirect: returns kycUrl to embed or redirect to
|
|
2702
|
+
* - flow=form: returns fields[] to render a custom form
|
|
2703
|
+
*/
|
|
2704
|
+
declare function startKyc(api: PollarApiClient, body: KycStartBody): Promise<KycStartResponse>;
|
|
2705
|
+
/**
|
|
2706
|
+
* Orchestrates the full KYC resolution flow:
|
|
2707
|
+
* 1. Checks current status
|
|
2708
|
+
* 2. If already approved, returns early
|
|
2709
|
+
* 3. Otherwise starts KYC and returns the session (kycUrl or fields)
|
|
2710
|
+
*/
|
|
2711
|
+
declare function resolveKyc(api: PollarApiClient, providerId: string, level?: KycLevel): Promise<{
|
|
2712
|
+
alreadyApproved: boolean;
|
|
2713
|
+
} & Partial<KycStartResponse>>;
|
|
2714
|
+
/**
|
|
2715
|
+
* Polls GET /kyc/status every intervalMs until status is 'approved' or 'rejected'.
|
|
2716
|
+
* Throws if timeoutMs is exceeded.
|
|
2717
|
+
*/
|
|
2718
|
+
declare function pollKycStatus(api: PollarApiClient, providerId: string, { intervalMs, timeoutMs }?: {
|
|
2719
|
+
intervalMs?: number;
|
|
2720
|
+
timeoutMs?: number;
|
|
2721
|
+
}): Promise<KycStatus>;
|
|
2722
|
+
|
|
2723
|
+
/**
|
|
2724
|
+
* GET /ramps/quote
|
|
2725
|
+
* Returns available quotes for an onramp or offramp.
|
|
2726
|
+
* The backend ranks providers by country, amount, fee and availability.
|
|
2727
|
+
* The first quote in the array is the recommended one.
|
|
2728
|
+
*/
|
|
2729
|
+
declare function getRampsQuote(api: PollarApiClient, query: RampsQuoteQuery): Promise<RampsQuoteResponse>;
|
|
2730
|
+
/**
|
|
2731
|
+
* POST /ramps/onramp
|
|
2732
|
+
* Creates an onramp transaction.
|
|
2733
|
+
* For custodial users: backend orchestrates the full SEP-24 flow and returns payment instructions.
|
|
2734
|
+
* For non-custodial: backend may return an unsigned XDR that the client must sign via a wallet adapter.
|
|
2735
|
+
*/
|
|
2736
|
+
declare function createOnRamp(api: PollarApiClient, body: RampsOnrampBody): Promise<RampsOnrampResponse>;
|
|
2737
|
+
/**
|
|
2738
|
+
* POST /ramps/offramp
|
|
2739
|
+
* Creates an offramp transaction.
|
|
2740
|
+
* Backend initiates the bank transfer once the Stellar transaction is confirmed.
|
|
2741
|
+
*/
|
|
2742
|
+
declare function createOffRamp(api: PollarApiClient, body: RampsOfframpBody): Promise<RampsOfframpResponse>;
|
|
2743
|
+
/**
|
|
2744
|
+
* GET /ramps/transaction/{txId}
|
|
2745
|
+
* Returns the current status of a ramp transaction.
|
|
2746
|
+
*/
|
|
2747
|
+
declare function getRampTransaction(api: PollarApiClient, txId: string): Promise<RampsTransactionResponse>;
|
|
2748
|
+
/**
|
|
2749
|
+
* Polls GET /ramps/transaction/{txId} every intervalMs until status is 'completed' or 'failed'.
|
|
2750
|
+
* Throws if timeoutMs is exceeded.
|
|
2751
|
+
*/
|
|
2752
|
+
declare function pollRampTransaction(api: PollarApiClient, txId: string, { intervalMs, timeoutMs }?: {
|
|
2753
|
+
intervalMs?: number;
|
|
2754
|
+
timeoutMs?: number;
|
|
2755
|
+
}): Promise<RampTxStatus>;
|
|
1563
2756
|
|
|
1564
|
-
export { AUTH_ERROR_CODES, AlbedoAdapter, type AuthErrorCode, type AuthState, type ConnectWalletResponse, FreighterAdapter, type
|
|
2757
|
+
export { AUTH_ERROR_CODES, AlbedoAdapter, type AuthErrorCode, type AuthState, type ConnectWalletResponse, FreighterAdapter, type KycFlow, type KycLevel, type KycProvider, type KycStartBody, type KycStartResponse, type KycStatus, type NetworkState, type PaymentInstructions, type PollarApiClient, type PollarApplicationConfigContent, type PollarApplicationConfigResponse, PollarClient, type PollarClientConfig, PollarFlowError, type PollarLoginOptions, type RampDirection, type RampQuote, type RampTxStatus, type RampsOfframpBody, type RampsOfframpResponse, type RampsOnrampBody, type RampsOnrampResponse, type RampsQuoteQuery, type RampsQuoteResponse, type RampsTransactionResponse, type SignAuthEntryOptions, type SignAuthEntryResponse, type SignTransactionOptions, type SignTransactionResponse, type StellarBalance, StellarClient, type StellarClientConfig, type StellarNetwork, type TransactionState, type TxBuildBody, type TxBuildContent, type TxBuildResponse, type TxHistoryContent, type TxHistoryParams, type TxHistoryRecord, type TxHistoryState, type TxSignAndSendBody, type TxSignSendResponse, type WalletAdapter, type WalletBalanceContent, type WalletBalanceRecord, type WalletBalanceState, WalletType, createOffRamp, createOnRamp, getKycProviders, getKycStatus, getRampTransaction, getRampsQuote, isValidSession, pollKycStatus, pollRampTransaction, type paths as pollarPaths, resolveKyc, startKyc };
|