@oasisprotocol/privana-sdk 0.4.4 → 0.5.1
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/chunk-4IW4V7YJ.cjs +3805 -0
- package/dist/chunk-4IW4V7YJ.cjs.map +1 -0
- package/dist/chunk-SAJ7K5WT.js +3716 -0
- package/dist/chunk-SAJ7K5WT.js.map +1 -0
- package/dist/index.cjs +2528 -636
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +177 -334
- package/dist/index.d.ts +177 -334
- package/dist/index.js +2152 -359
- package/dist/index.js.map +1 -1
- package/dist/on-ramp.cjs +10 -974
- package/dist/on-ramp.cjs.map +1 -1
- package/dist/on-ramp.d.cts +50 -4
- package/dist/on-ramp.d.ts +50 -4
- package/dist/on-ramp.js +1 -975
- package/dist/on-ramp.js.map +1 -1
- package/dist/pending-lock-BdkuMjmY.d.cts +600 -0
- package/dist/pending-lock-BdkuMjmY.d.ts +600 -0
- package/package.json +3 -2
- package/dist/chunk-NMRIKUDN.cjs +0 -1775
- package/dist/chunk-NMRIKUDN.cjs.map +0 -1
- package/dist/chunk-WV6CGHEF.js +0 -1720
- package/dist/chunk-WV6CGHEF.js.map +0 -1
- package/dist/on-ramp-CdXqJjmm.d.cts +0 -115
- package/dist/on-ramp-CdXqJjmm.d.ts +0 -115
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Address, B as Bytes32,
|
|
2
|
-
export {
|
|
1
|
+
import { A as Address, J as JwtRefreshResponse, H as HostedAuthTokenExchangeResponse, B as Bytes32, S as SiweLoginResponse, P as PrivanaClient, N as NetworkConfig, T as TokenConfig, a as TokenBalance, b as PostDepositLockConfig, D as DepositAddressResponse, c as DepositCheckResponse, d as TransactionSubmissionResponse, e as PostDepositLockError, L as LockInfo, f as PendingDeposit, g as PendingDepositsResponse, W as WithdrawalInfo, h as HistoryEntry, i as TokenInfoResponse } from './pending-lock-BdkuMjmY.cjs';
|
|
2
|
+
export { j as BalanceResponse, k as BatchBalancesRequest, l as BatchBalancesResponse, C as CreateOnRampIntentRequest, m as CreateOnRampIntentResponse, n as CreateSignedLockRequestParams, o as DEFAULT_LOCK_DURATION_SECONDS, p as DEFAULT_ONRAMP_LOCK_BUFFER, q as DepositAddressRequest, r as DepositCheckRequest, E as ExpiredLocksResponse, s as HexString, t as HistoryKind, u as HistoryRequest, v as HistoryResponse, w as HostedAuthAuthorizeUrlRequest, x as HostedAuthResponseMode, y as HostedAuthTokenExchangeRequest, z as HttpClient, F as HttpClientConfig, I as IntegerLike, G as JwtLogoutRequest, K as JwtLogoutResponse, M as JwtRefreshRequest, O as LockFundsRequest, Q as LockNonceResponse, R as LockedFundsResponse, U as MinDepositAmounts, V as ModifyLockNonceResponse, X as ModifyLockRequest, Y as NETWORK_CONFIG, Z as Network, _ as OnRampPostDepositLockConfig, $ as OnRampRecord, a0 as OnRampStatus, a1 as PendingDepositStatus, a2 as PendingDepositsRequest, a3 as PendingOnRampsResponse, a4 as PendingWithdrawalsResponse, a5 as PostDepositLockFailureReason, a6 as PrivanaClientConfig, a7 as SignOnRampUrlRequest, a8 as SignOnRampUrlResponse, a9 as SiweDomainResponse, aa as SiweLoginRequest, ab as SiweNonceResponse, ac as SubmitPendingLockParams, ad as TokenListResponse, ae as TotalLockedBalanceResponse, af as TransferFundsRequest, ag as TransferLockedFundsRequest, ah as TransferLockedNonceResponse, ai as TransferNonceResponse, aj as UnlockAllExpiredRequest, ak as UnlockFundsRequest, al as UpdateOnRampRequest, am as UpdateOnRampResponse, an as WithdrawFromLockRequest, ao as WithdrawalInfoResponse, ap as WithdrawalNonceResponse, aq as WithdrawalRequest, ar as applyLockBuffer, as as clampLockAmount, at as clearPendingLock, au as createSignedLockRequest, av as getAccountingContract, aw as getApiUrl, ax as getChainId, ay as isSignedLockUsable, az as loadPendingLock, aA as normalizeAddress, aB as normalizeHex, aC as savePendingLock, aD as submitPendingLock } from './pending-lock-BdkuMjmY.cjs';
|
|
3
3
|
import { WalletClient, Address as Address$1 } from 'viem';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as React$1 from 'react';
|
|
@@ -7,6 +7,33 @@ import { ReactNode, ComponentProps, ReactElement } from 'react';
|
|
|
7
7
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
8
8
|
import { VariantProps } from 'class-variance-authority';
|
|
9
9
|
|
|
10
|
+
interface AllowanceTerm {
|
|
11
|
+
title: string;
|
|
12
|
+
description: string;
|
|
13
|
+
}
|
|
14
|
+
interface Allowance {
|
|
15
|
+
/**
|
|
16
|
+
* Hard cap the service is allowed to lock (`maxAmount`), in the token's base
|
|
17
|
+
* units. The pre-signed lock amount is capped to this value.
|
|
18
|
+
*/
|
|
19
|
+
value: string;
|
|
20
|
+
/**
|
|
21
|
+
* Minimum amount the delivered deposit must reach, in the token's base units.
|
|
22
|
+
* Display-only: with a pre-signed exact-amount lock, a short delivery means
|
|
23
|
+
* no lock is created at all, which is stricter than any minimum.
|
|
24
|
+
*/
|
|
25
|
+
minAmount?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Lock lifetime in seconds, applied from signing time (the `Lock` expiry is
|
|
28
|
+
* an absolute timestamp). Defaults to the SDK default (259200, 3 days) when omitted.
|
|
29
|
+
*/
|
|
30
|
+
lockDuration?: number;
|
|
31
|
+
terms?: {
|
|
32
|
+
permissions?: AllowanceTerm[];
|
|
33
|
+
restrictions?: AllowanceTerm[];
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
10
37
|
interface HostedAuthConfig {
|
|
11
38
|
clientId: string;
|
|
12
39
|
redirectUri: string;
|
|
@@ -41,272 +68,13 @@ interface ChainConfig {
|
|
|
41
68
|
id: number;
|
|
42
69
|
name: string;
|
|
43
70
|
explorerUrl: string;
|
|
71
|
+
explorerName: string;
|
|
44
72
|
}
|
|
45
73
|
declare const SUPPORTED_CHAINS: ChainConfig[];
|
|
46
74
|
declare function getChainById(chainId: number): ChainConfig | undefined;
|
|
75
|
+
declare function getExplorerLabel(chainId: number): string;
|
|
47
76
|
declare function getExplorerAddressUrl(chainId: number, address: string): string | undefined;
|
|
48
77
|
|
|
49
|
-
interface DepositAddressRequest {
|
|
50
|
-
chain_type?: string;
|
|
51
|
-
version?: number;
|
|
52
|
-
}
|
|
53
|
-
interface DepositCheckRequest {
|
|
54
|
-
chain_type?: string;
|
|
55
|
-
chain_id: number;
|
|
56
|
-
tx_hash: HexString;
|
|
57
|
-
amount: IntegerLike;
|
|
58
|
-
log_index?: number;
|
|
59
|
-
version?: number;
|
|
60
|
-
}
|
|
61
|
-
interface LockFundsRequest {
|
|
62
|
-
service_address: Address;
|
|
63
|
-
token_id: Bytes32;
|
|
64
|
-
amount: IntegerLike;
|
|
65
|
-
expiry: IntegerLike;
|
|
66
|
-
nonce: IntegerLike;
|
|
67
|
-
signature: HexString;
|
|
68
|
-
}
|
|
69
|
-
interface ModifyLockRequest {
|
|
70
|
-
lock_id: number;
|
|
71
|
-
amount: IntegerLike;
|
|
72
|
-
new_expiry: IntegerLike;
|
|
73
|
-
nonce: IntegerLike;
|
|
74
|
-
signature: HexString;
|
|
75
|
-
}
|
|
76
|
-
interface UnlockFundsRequest {
|
|
77
|
-
user_address: Address;
|
|
78
|
-
lock_id: number;
|
|
79
|
-
}
|
|
80
|
-
interface UnlockAllExpiredRequest {
|
|
81
|
-
user_address: Address;
|
|
82
|
-
}
|
|
83
|
-
interface TransferFundsRequest {
|
|
84
|
-
to_address: Address;
|
|
85
|
-
token_id: Bytes32;
|
|
86
|
-
amount: IntegerLike;
|
|
87
|
-
nonce: IntegerLike;
|
|
88
|
-
signature: HexString;
|
|
89
|
-
}
|
|
90
|
-
interface TransferLockedFundsRequest {
|
|
91
|
-
user_address: Address;
|
|
92
|
-
lock_id: number;
|
|
93
|
-
to_address: Address;
|
|
94
|
-
amount: IntegerLike;
|
|
95
|
-
service_address: Address;
|
|
96
|
-
nonce: IntegerLike;
|
|
97
|
-
signature: HexString;
|
|
98
|
-
}
|
|
99
|
-
interface WithdrawalRequest {
|
|
100
|
-
token_id: Bytes32;
|
|
101
|
-
amount: IntegerLike;
|
|
102
|
-
nonce: IntegerLike;
|
|
103
|
-
signature: HexString;
|
|
104
|
-
}
|
|
105
|
-
interface WithdrawFromLockRequest {
|
|
106
|
-
to_address: Address;
|
|
107
|
-
lock_id: number;
|
|
108
|
-
amount: IntegerLike;
|
|
109
|
-
nonce: IntegerLike;
|
|
110
|
-
signature: HexString;
|
|
111
|
-
}
|
|
112
|
-
interface BatchBalancesRequest {
|
|
113
|
-
token_ids: Bytes32[];
|
|
114
|
-
}
|
|
115
|
-
interface HistoryRequest {
|
|
116
|
-
offset?: number;
|
|
117
|
-
limit?: number;
|
|
118
|
-
}
|
|
119
|
-
interface SiweLoginRequest {
|
|
120
|
-
siwe_message: string;
|
|
121
|
-
signature: HexString;
|
|
122
|
-
}
|
|
123
|
-
interface HostedAuthAuthorizeUrlRequest {
|
|
124
|
-
client_id: string;
|
|
125
|
-
redirect_uri: string;
|
|
126
|
-
code_challenge: string;
|
|
127
|
-
state: string;
|
|
128
|
-
chain_id: number;
|
|
129
|
-
response_mode?: HostedAuthResponseMode;
|
|
130
|
-
code_challenge_method?: 'S256';
|
|
131
|
-
}
|
|
132
|
-
interface HostedAuthTokenExchangeRequest {
|
|
133
|
-
grant_type?: 'authorization_code';
|
|
134
|
-
code: string;
|
|
135
|
-
code_verifier: string;
|
|
136
|
-
client_id: string;
|
|
137
|
-
redirect_uri: string;
|
|
138
|
-
}
|
|
139
|
-
interface JwtRefreshRequest {
|
|
140
|
-
refresh_token: string;
|
|
141
|
-
}
|
|
142
|
-
interface JwtLogoutRequest {
|
|
143
|
-
refresh_token?: string;
|
|
144
|
-
revoke_all?: boolean;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
interface MinDepositAmounts {
|
|
148
|
-
native: string;
|
|
149
|
-
erc20: string;
|
|
150
|
-
}
|
|
151
|
-
interface DepositAddressResponse {
|
|
152
|
-
deposit_address: Address;
|
|
153
|
-
chain_type: string;
|
|
154
|
-
version: number;
|
|
155
|
-
min_deposit: Record<string, MinDepositAmounts>;
|
|
156
|
-
}
|
|
157
|
-
interface DepositCheckResponse {
|
|
158
|
-
status: 'credited' | 'pending' | 'error';
|
|
159
|
-
deposit_id?: string;
|
|
160
|
-
amount?: string;
|
|
161
|
-
token_address?: Address;
|
|
162
|
-
detail?: string;
|
|
163
|
-
}
|
|
164
|
-
interface TransactionSubmissionResponse {
|
|
165
|
-
submission_id: string;
|
|
166
|
-
status: string;
|
|
167
|
-
detail?: string;
|
|
168
|
-
}
|
|
169
|
-
interface BalanceResponse {
|
|
170
|
-
user_address: Address;
|
|
171
|
-
token_id: Bytes32;
|
|
172
|
-
balance: string;
|
|
173
|
-
token_symbol: string;
|
|
174
|
-
chain_id: string;
|
|
175
|
-
}
|
|
176
|
-
interface TokenBalance {
|
|
177
|
-
token_id: Bytes32;
|
|
178
|
-
balance: string;
|
|
179
|
-
token_symbol: string;
|
|
180
|
-
chain_id: string;
|
|
181
|
-
}
|
|
182
|
-
interface BatchBalancesResponse {
|
|
183
|
-
user_address: Address;
|
|
184
|
-
balances: TokenBalance[];
|
|
185
|
-
}
|
|
186
|
-
type HistoryKind = 'deposit' | 'withdraw' | 'createLock' | 'transferFromLockOut' | 'transferFromLockIn' | 'transferBalanceOut' | 'transferBalanceIn' | 'modifyLock' | 'unlockLock' | 'unknown';
|
|
187
|
-
interface HistoryEntry {
|
|
188
|
-
kind: HistoryKind;
|
|
189
|
-
timestamp: number;
|
|
190
|
-
token_id?: Bytes32 | null;
|
|
191
|
-
amount?: string | null;
|
|
192
|
-
counterparty?: Address | null;
|
|
193
|
-
deposit_id?: Bytes32 | null;
|
|
194
|
-
chain_id?: number | null;
|
|
195
|
-
}
|
|
196
|
-
interface HistoryResponse {
|
|
197
|
-
history: HistoryEntry[];
|
|
198
|
-
total: number;
|
|
199
|
-
}
|
|
200
|
-
interface TokenInfoResponse {
|
|
201
|
-
token_id: Bytes32;
|
|
202
|
-
token_type: number;
|
|
203
|
-
token_type_name: string;
|
|
204
|
-
data: string;
|
|
205
|
-
chain_id: number;
|
|
206
|
-
chain_name: string;
|
|
207
|
-
token_address: Address;
|
|
208
|
-
symbol: string;
|
|
209
|
-
name: string;
|
|
210
|
-
decimals: number;
|
|
211
|
-
}
|
|
212
|
-
interface TokenListResponse {
|
|
213
|
-
tokens: TokenInfoResponse[];
|
|
214
|
-
}
|
|
215
|
-
interface LockInfo {
|
|
216
|
-
lock_id: number;
|
|
217
|
-
user_address: Address;
|
|
218
|
-
service_address: Address;
|
|
219
|
-
token_id: Bytes32;
|
|
220
|
-
amount: string;
|
|
221
|
-
expiry: number;
|
|
222
|
-
is_expired: boolean;
|
|
223
|
-
}
|
|
224
|
-
interface LockedFundsResponse {
|
|
225
|
-
user_address: Address;
|
|
226
|
-
service_address?: Address;
|
|
227
|
-
locks: LockInfo[];
|
|
228
|
-
total_locked: string;
|
|
229
|
-
}
|
|
230
|
-
interface ExpiredLocksResponse {
|
|
231
|
-
user_address: Address;
|
|
232
|
-
expired_locks: LockInfo[];
|
|
233
|
-
}
|
|
234
|
-
interface TotalLockedBalanceResponse {
|
|
235
|
-
user_address: Address;
|
|
236
|
-
token_id: Bytes32;
|
|
237
|
-
total_locked: string;
|
|
238
|
-
}
|
|
239
|
-
interface WithdrawalInfo {
|
|
240
|
-
index: number;
|
|
241
|
-
user_address: Address;
|
|
242
|
-
to_address: Address;
|
|
243
|
-
amount: string;
|
|
244
|
-
block_number: number;
|
|
245
|
-
token_id: Bytes32;
|
|
246
|
-
resolved: boolean;
|
|
247
|
-
tx_identifier: string;
|
|
248
|
-
}
|
|
249
|
-
interface PendingWithdrawalsResponse {
|
|
250
|
-
user_address: Address;
|
|
251
|
-
pending_withdrawals: WithdrawalInfo[];
|
|
252
|
-
}
|
|
253
|
-
type WithdrawalInfoResponse = WithdrawalInfo;
|
|
254
|
-
interface TransferNonceResponse {
|
|
255
|
-
user_address: Address;
|
|
256
|
-
nonce: string;
|
|
257
|
-
}
|
|
258
|
-
interface WithdrawalNonceResponse {
|
|
259
|
-
user_address: Address;
|
|
260
|
-
nonce: string;
|
|
261
|
-
}
|
|
262
|
-
interface LockNonceResponse {
|
|
263
|
-
user_address: Address;
|
|
264
|
-
nonce: string;
|
|
265
|
-
}
|
|
266
|
-
interface ModifyLockNonceResponse {
|
|
267
|
-
user_address: Address;
|
|
268
|
-
nonce: string;
|
|
269
|
-
}
|
|
270
|
-
interface TransferLockedNonceResponse {
|
|
271
|
-
service_address: Address;
|
|
272
|
-
nonce: string;
|
|
273
|
-
}
|
|
274
|
-
interface SiweDomainResponse {
|
|
275
|
-
domain: string;
|
|
276
|
-
}
|
|
277
|
-
interface SiweNonceResponse {
|
|
278
|
-
address: Address;
|
|
279
|
-
nonce: string;
|
|
280
|
-
expires_in: number;
|
|
281
|
-
}
|
|
282
|
-
interface SiweLoginResponse {
|
|
283
|
-
siwe_token: HexString;
|
|
284
|
-
jwt_access_token: string;
|
|
285
|
-
jwt_refresh_token: string;
|
|
286
|
-
address: Address;
|
|
287
|
-
jwt_expires_in: number;
|
|
288
|
-
jwt_refresh_expires_in: number;
|
|
289
|
-
}
|
|
290
|
-
interface HostedAuthTokenExchangeResponse {
|
|
291
|
-
access_token: string;
|
|
292
|
-
id_token: string;
|
|
293
|
-
refresh_token: string;
|
|
294
|
-
token_type: string;
|
|
295
|
-
expires_in: number;
|
|
296
|
-
refresh_expires_in: number;
|
|
297
|
-
address: Address;
|
|
298
|
-
}
|
|
299
|
-
interface JwtRefreshResponse {
|
|
300
|
-
token: string;
|
|
301
|
-
refresh_token: string;
|
|
302
|
-
expires_in: number;
|
|
303
|
-
refresh_expires_in: number;
|
|
304
|
-
}
|
|
305
|
-
interface JwtLogoutResponse {
|
|
306
|
-
message: string;
|
|
307
|
-
revoked_tokens: number;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
78
|
declare const HOSTED_AUTH_CLOCK_SKEW_MS = 30000;
|
|
311
79
|
type StorageLike = Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;
|
|
312
80
|
declare function createPkceVerifier(length?: number): string;
|
|
@@ -326,74 +94,6 @@ declare function isHostedAuthRefreshActive(session: HostedAuthSession, now?: num
|
|
|
326
94
|
|
|
327
95
|
declare function buildSiweStatement(chainId: number): string;
|
|
328
96
|
|
|
329
|
-
interface HttpClientConfig {
|
|
330
|
-
baseUrl: string;
|
|
331
|
-
timeout?: number;
|
|
332
|
-
headers?: Record<string, string>;
|
|
333
|
-
}
|
|
334
|
-
declare class HttpClient {
|
|
335
|
-
private readonly baseUrl;
|
|
336
|
-
private readonly timeout;
|
|
337
|
-
private readonly headers;
|
|
338
|
-
constructor(config: HttpClientConfig);
|
|
339
|
-
get<T>(path: string): Promise<T>;
|
|
340
|
-
post<T>(path: string, body?: unknown): Promise<T>;
|
|
341
|
-
getBaseUrl(): string;
|
|
342
|
-
setHeader(name: string, value: string): void;
|
|
343
|
-
removeHeader(name: string): void;
|
|
344
|
-
getHeader(name: string): string | undefined;
|
|
345
|
-
private request;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
type PrivanaClientConfig = HttpClientConfig;
|
|
349
|
-
declare class PrivanaClient {
|
|
350
|
-
private readonly http;
|
|
351
|
-
constructor(config: PrivanaClientConfig);
|
|
352
|
-
getBaseUrl(): string;
|
|
353
|
-
getDepositAddress(request?: DepositAddressRequest): Promise<DepositAddressResponse>;
|
|
354
|
-
checkDeposit(request: DepositCheckRequest): Promise<DepositCheckResponse>;
|
|
355
|
-
getDepositStatus(depositId: string): Promise<DepositCheckResponse>;
|
|
356
|
-
getBalance(tokenId: Bytes32 | string): Promise<BalanceResponse>;
|
|
357
|
-
getBatchBalances(request: BatchBalancesRequest): Promise<BatchBalancesResponse>;
|
|
358
|
-
getHistory(request?: HistoryRequest): Promise<HistoryResponse>;
|
|
359
|
-
listTokens(): Promise<TokenListResponse>;
|
|
360
|
-
getTokenInfo(tokenId: Bytes32 | string): Promise<TokenInfoResponse>;
|
|
361
|
-
lockFunds(request: LockFundsRequest): Promise<TransactionSubmissionResponse>;
|
|
362
|
-
modifyLock(request: ModifyLockRequest): Promise<TransactionSubmissionResponse>;
|
|
363
|
-
unlockFunds(request: UnlockFundsRequest): Promise<TransactionSubmissionResponse>;
|
|
364
|
-
unlockAllExpired(request: UnlockAllExpiredRequest): Promise<TransactionSubmissionResponse>;
|
|
365
|
-
getLockedFunds(serviceAddress?: Address | string): Promise<LockedFundsResponse>;
|
|
366
|
-
getTotalLockedBalance(tokenId: Bytes32 | string): Promise<TotalLockedBalanceResponse>;
|
|
367
|
-
getExpiredLocks(): Promise<ExpiredLocksResponse>;
|
|
368
|
-
transferFunds(request: TransferFundsRequest): Promise<TransactionSubmissionResponse>;
|
|
369
|
-
getTransferNonce(userAddress: Address | string): Promise<TransferNonceResponse>;
|
|
370
|
-
getLockNonce(userAddress: Address | string): Promise<LockNonceResponse>;
|
|
371
|
-
getModifyLockNonce(userAddress: Address | string): Promise<ModifyLockNonceResponse>;
|
|
372
|
-
transferLockedFunds(request: TransferLockedFundsRequest): Promise<TransactionSubmissionResponse>;
|
|
373
|
-
withdrawFromLock(request: WithdrawFromLockRequest): Promise<TransactionSubmissionResponse>;
|
|
374
|
-
requestWithdrawal(request: WithdrawalRequest): Promise<TransactionSubmissionResponse>;
|
|
375
|
-
getWithdrawalNonce(userAddress: Address | string): Promise<WithdrawalNonceResponse>;
|
|
376
|
-
getTransferLockedNonce(serviceAddress: Address | string): Promise<TransferLockedNonceResponse>;
|
|
377
|
-
getPendingWithdrawals(userAddress: Address | string): Promise<PendingWithdrawalsResponse>;
|
|
378
|
-
getWithdrawalInfo(index: number): Promise<WithdrawalInfoResponse>;
|
|
379
|
-
getSiweDomain(): Promise<SiweDomainResponse>;
|
|
380
|
-
getSiweNonce(userAddress: Address | string): Promise<SiweNonceResponse>;
|
|
381
|
-
loginWithSiwe(request: SiweLoginRequest): Promise<SiweLoginResponse>;
|
|
382
|
-
getHostedAuthAuthorizeUrl(request: HostedAuthAuthorizeUrlRequest): string;
|
|
383
|
-
exchangeHostedAuthCode(request: HostedAuthTokenExchangeRequest): Promise<HostedAuthTokenExchangeResponse>;
|
|
384
|
-
refreshJwtSession(request: JwtRefreshRequest): Promise<JwtRefreshResponse>;
|
|
385
|
-
logoutJwtSession(request?: JwtLogoutRequest): Promise<JwtLogoutResponse>;
|
|
386
|
-
signOnRampUrl(request: SignOnRampUrlRequest): Promise<SignOnRampUrlResponse>;
|
|
387
|
-
createOnRampIntent(request: CreateOnRampIntentRequest): Promise<CreateOnRampIntentResponse>;
|
|
388
|
-
updateOnRamp(transactionId: string, request: UpdateOnRampRequest): Promise<UpdateOnRampResponse>;
|
|
389
|
-
getPendingOnRamps(): Promise<PendingOnRampsResponse>;
|
|
390
|
-
setPrivateReadToken(token: string): void;
|
|
391
|
-
getPrivateReadToken(): string | undefined;
|
|
392
|
-
clearPrivateReadToken(): void;
|
|
393
|
-
setBearerToken(token: string): void;
|
|
394
|
-
clearBearerToken(): void;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
97
|
declare class AccountingApiError extends Error {
|
|
398
98
|
readonly statusCode: number;
|
|
399
99
|
readonly detail?: string | undefined;
|
|
@@ -651,6 +351,8 @@ interface PrivanaContextValue {
|
|
|
651
351
|
tokensError?: Error;
|
|
652
352
|
pollingInterval: number;
|
|
653
353
|
serviceAddress?: Address;
|
|
354
|
+
serviceName?: string;
|
|
355
|
+
serviceIcon?: ReactNode;
|
|
654
356
|
hostedAuthConfig: HostedAuthConfig | null;
|
|
655
357
|
hostedAuthSession: HostedAuthSession | null;
|
|
656
358
|
setHostedAuthSession: (session: HostedAuthSession | null) => void;
|
|
@@ -682,6 +384,15 @@ interface PrivanaProviderProps {
|
|
|
682
384
|
* The service address for lock operations.
|
|
683
385
|
*/
|
|
684
386
|
serviceAddress?: Address;
|
|
387
|
+
/**
|
|
388
|
+
* Display name of the host application/service. Shown as the title in
|
|
389
|
+
* Privana modals (e.g. the deposit modal header). Defaults to "Privana".
|
|
390
|
+
*/
|
|
391
|
+
serviceName?: string;
|
|
392
|
+
/**
|
|
393
|
+
* Optional icon/logo for the host application/service.
|
|
394
|
+
*/
|
|
395
|
+
serviceIcon?: ReactNode;
|
|
685
396
|
/**
|
|
686
397
|
* Optional hosted redirect auth configuration for cross-domain browser apps.
|
|
687
398
|
*/
|
|
@@ -695,7 +406,7 @@ interface PrivanaProviderProps {
|
|
|
695
406
|
*/
|
|
696
407
|
siweAuth?: SiweAuthConfig;
|
|
697
408
|
}
|
|
698
|
-
declare function PrivanaProvider({ children, networkConfig: networkConfigOverride, tokens, chains, pollingInterval, serviceAddress, hostedAuth, siweAuth, }: PrivanaProviderProps): react_jsx_runtime.JSX.Element;
|
|
409
|
+
declare function PrivanaProvider({ children, networkConfig: networkConfigOverride, tokens, chains, pollingInterval, serviceAddress, serviceName, serviceIcon, hostedAuth, siweAuth, }: PrivanaProviderProps): react_jsx_runtime.JSX.Element;
|
|
699
410
|
declare function usePrivanaContext(): PrivanaContextValue;
|
|
700
411
|
declare function useSafePrivanaContext(): PrivanaContextValue | null;
|
|
701
412
|
|
|
@@ -746,7 +457,18 @@ declare function useBatchBalances(options: UseBatchBalancesOptions): UseBatchBal
|
|
|
746
457
|
interface UseDepositOptions {
|
|
747
458
|
onDepositAddressReceived?: (response: DepositAddressResponse) => void;
|
|
748
459
|
onDepositSuccess?: (txHash: string) => void;
|
|
749
|
-
|
|
460
|
+
/** `lockPending` is true when a pre-signed lock is being submitted after
|
|
461
|
+
* this credit — `onLockSubmitted` or `onLockFailed` will follow. */
|
|
462
|
+
onCredited?: (txHash: string, response: DepositCheckResponse, lockPending?: boolean) => void;
|
|
463
|
+
/** Fired when the pre-signed post-deposit lock is accepted by the API. */
|
|
464
|
+
onLockSubmitted?: (response: TransactionSubmissionResponse) => void;
|
|
465
|
+
/**
|
|
466
|
+
* Fired when the deposit credited but the pre-signed lock could not be
|
|
467
|
+
* submitted (expired, short credit, stale nonce). The funds sit in the
|
|
468
|
+
* user's available balance — re-prompt a fresh lock signature at the
|
|
469
|
+
* credited amount. Falls back to `onError` when not provided.
|
|
470
|
+
*/
|
|
471
|
+
onLockFailed?: (error: PostDepositLockError) => void;
|
|
750
472
|
/** Called when deposit check polling times out - deposit may still be processing */
|
|
751
473
|
onCheckTimeout?: (txHash: string) => void;
|
|
752
474
|
onError?: (error: Error) => void;
|
|
@@ -760,6 +482,11 @@ interface UseDepositOptions {
|
|
|
760
482
|
interface DepositParams {
|
|
761
483
|
tokenId: Bytes32;
|
|
762
484
|
amount: bigint;
|
|
485
|
+
/**
|
|
486
|
+
* Pre-sign a `Lock` for the deposited amount (capped by `maxAmount`) before
|
|
487
|
+
* the transfer; the SDK submits it once the deposit credits.
|
|
488
|
+
*/
|
|
489
|
+
postDepositLock?: PostDepositLockConfig;
|
|
763
490
|
}
|
|
764
491
|
interface UseDepositResult {
|
|
765
492
|
depositAddress: DepositAddressResponse | null;
|
|
@@ -789,6 +516,25 @@ interface UseDepositResult {
|
|
|
789
516
|
}
|
|
790
517
|
declare function useDeposit(options?: UseDepositOptions): UseDepositResult;
|
|
791
518
|
|
|
519
|
+
interface UseDepositAddressOptions {
|
|
520
|
+
enabled?: boolean;
|
|
521
|
+
}
|
|
522
|
+
interface UseDepositAddressResult {
|
|
523
|
+
depositAddress: string | null;
|
|
524
|
+
isReady: boolean;
|
|
525
|
+
isLoading: boolean;
|
|
526
|
+
isError: boolean;
|
|
527
|
+
error: Error | null;
|
|
528
|
+
refetch: () => void;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Fetches the user's Privana deposit address via the SIWE private-read flow
|
|
532
|
+
* (`POST /v1/accounting/deposits/address`) — the same authenticated path used
|
|
533
|
+
* by `useFiatOnRamp`. Used by the external-wallet deposit view to show a QR
|
|
534
|
+
* code / copyable address to send funds to.
|
|
535
|
+
*/
|
|
536
|
+
declare function useDepositAddress(options?: UseDepositAddressOptions): UseDepositAddressResult;
|
|
537
|
+
|
|
792
538
|
interface VerificationContext {
|
|
793
539
|
/** On-chain transfer that funded the user's Privana deposit address. */
|
|
794
540
|
hash: `0x${string}`;
|
|
@@ -796,6 +542,8 @@ interface VerificationContext {
|
|
|
796
542
|
chainId: number;
|
|
797
543
|
/** Transferred amount in base units (matches the deposit's token decimals). */
|
|
798
544
|
amount: bigint;
|
|
545
|
+
/** Log index of the exact Transfer event within the tx (default: 0). */
|
|
546
|
+
logIndex?: number;
|
|
799
547
|
}
|
|
800
548
|
interface UseDepositVerificationOptions {
|
|
801
549
|
/** Fired when the deposit is credited inside the Privana accounting module. */
|
|
@@ -979,6 +727,30 @@ interface UseExpiredLocksResult {
|
|
|
979
727
|
}
|
|
980
728
|
declare function useExpiredLocks(options?: UseExpiredLocksOptions): UseExpiredLocksResult;
|
|
981
729
|
|
|
730
|
+
interface UsePendingDepositsOptions {
|
|
731
|
+
/** Source chain to scan. Query is disabled while undefined. */
|
|
732
|
+
chainId?: number;
|
|
733
|
+
enabled?: boolean;
|
|
734
|
+
/** Auto-poll cadence in ms, or false for manual refetch only (default: 30s, the server scan-cache TTL). */
|
|
735
|
+
refetchInterval?: number | false;
|
|
736
|
+
/** Narrow the scan to one registered ERC20. */
|
|
737
|
+
tokenAddress?: Address;
|
|
738
|
+
/** Scan window in blocks (server default ≈ 1h, clamped ≈ 24h). */
|
|
739
|
+
lookbackBlocks?: number;
|
|
740
|
+
}
|
|
741
|
+
interface UsePendingDepositsResult {
|
|
742
|
+
pending: PendingDeposit[];
|
|
743
|
+
scannedToBlock: number | undefined;
|
|
744
|
+
isFetching: boolean;
|
|
745
|
+
isError: boolean;
|
|
746
|
+
error: Error | null;
|
|
747
|
+
isRateLimited: boolean;
|
|
748
|
+
/** Discovery is not configured for this chain server-side (503) — a deployment fault, not transient. */
|
|
749
|
+
isUnavailable: boolean;
|
|
750
|
+
refetch: () => Promise<PendingDepositsResponse | undefined>;
|
|
751
|
+
}
|
|
752
|
+
declare function usePendingDeposits(options?: UsePendingDepositsOptions): UsePendingDepositsResult;
|
|
753
|
+
|
|
982
754
|
interface UsePendingWithdrawalsOptions {
|
|
983
755
|
enabled?: boolean;
|
|
984
756
|
}
|
|
@@ -1098,9 +870,80 @@ declare function PrivanaInlineModal({ className, showLockedFunds, defaultTab, on
|
|
|
1098
870
|
onDepositSuccess?: () => void;
|
|
1099
871
|
}): react_jsx_runtime.JSX.Element;
|
|
1100
872
|
|
|
873
|
+
type DepositMethodTab = 'crypto' | 'credit-card';
|
|
874
|
+
type DepositSource = 'connected' | 'external' | 'credit-card';
|
|
875
|
+
interface DepositMethodHandlers {
|
|
876
|
+
defaultTab?: DepositMethodTab;
|
|
877
|
+
/** Allowance (shown as a "policy") the host service requests. */
|
|
878
|
+
allowance?: Allowance;
|
|
879
|
+
onSelectConnectedWallet?: () => void;
|
|
880
|
+
onSelectExternalWallet?: () => void;
|
|
881
|
+
onSelectCreditCard?: () => void;
|
|
882
|
+
onConnectWallet?: () => void;
|
|
883
|
+
/** Called when the user confirms the amount on the deposit view. */
|
|
884
|
+
onDeposit?: (args: {
|
|
885
|
+
source: DepositSource;
|
|
886
|
+
tokenId: string;
|
|
887
|
+
amount: string;
|
|
888
|
+
}) => void;
|
|
889
|
+
/** With an allowance this fires only after the pre-signed lock is accepted. */
|
|
890
|
+
onDepositSuccess?: () => void;
|
|
891
|
+
/** The deposit credited but the pre-signed lock failed — re-prompt. */
|
|
892
|
+
onLockFailed?: (error: PostDepositLockError) => void;
|
|
893
|
+
}
|
|
894
|
+
interface DepositModalProps extends DepositMethodHandlers {
|
|
895
|
+
open: boolean;
|
|
896
|
+
onClose: () => void;
|
|
897
|
+
}
|
|
898
|
+
declare function DepositModal({ open, onClose, ...handlers }: DepositModalProps): react_jsx_runtime.JSX.Element;
|
|
899
|
+
interface DepositInlineModalProps extends DepositMethodHandlers {
|
|
900
|
+
className?: string;
|
|
901
|
+
}
|
|
902
|
+
declare function DepositInlineModal({ className, ...handlers }: DepositInlineModalProps): react_jsx_runtime.JSX.Element;
|
|
903
|
+
|
|
904
|
+
interface WithdrawModalProps {
|
|
905
|
+
open: boolean;
|
|
906
|
+
onClose: () => void;
|
|
907
|
+
}
|
|
908
|
+
declare function WithdrawModal({ open, onClose }: WithdrawModalProps): react_jsx_runtime.JSX.Element;
|
|
909
|
+
interface WithdrawInlineModalProps {
|
|
910
|
+
className?: string;
|
|
911
|
+
}
|
|
912
|
+
declare function WithdrawInlineModal({ className }: WithdrawInlineModalProps): react_jsx_runtime.JSX.Element;
|
|
913
|
+
|
|
914
|
+
interface WalletSession {
|
|
915
|
+
/** Funds committed to the active session, in the display token's base units. */
|
|
916
|
+
inUse: string | bigint;
|
|
917
|
+
/** Unix timestamp (seconds) when the session lock expires; shows the countdown. */
|
|
918
|
+
expiry?: number;
|
|
919
|
+
}
|
|
920
|
+
interface WalletModalHandlers extends DepositMethodHandlers {
|
|
921
|
+
session?: WalletSession;
|
|
922
|
+
onPlay?: (args: {
|
|
923
|
+
tokenId: string;
|
|
924
|
+
amount: string;
|
|
925
|
+
}) => void;
|
|
926
|
+
onEndSession?: () => Promise<void>;
|
|
927
|
+
}
|
|
928
|
+
interface WalletModalProps extends WalletModalHandlers {
|
|
929
|
+
open: boolean;
|
|
930
|
+
onClose: () => void;
|
|
931
|
+
}
|
|
932
|
+
declare function WalletModal({ open, onClose, ...handlers }: WalletModalProps): react_jsx_runtime.JSX.Element;
|
|
933
|
+
interface WalletInlineModalProps extends WalletModalHandlers {
|
|
934
|
+
className?: string;
|
|
935
|
+
}
|
|
936
|
+
declare function WalletInlineModal({ className, ...handlers }: WalletInlineModalProps): react_jsx_runtime.JSX.Element;
|
|
937
|
+
|
|
1101
938
|
declare function Skeleton({ className, ...props }: React.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
1102
939
|
|
|
1103
940
|
declare function getTokenIcon(symbol: string, size?: number): react_jsx_runtime.JSX.Element;
|
|
1104
941
|
declare function getChainIcon(chainId: number, size?: number): react_jsx_runtime.JSX.Element;
|
|
1105
942
|
|
|
1106
|
-
|
|
943
|
+
interface PrivanaIconProps {
|
|
944
|
+
className?: string;
|
|
945
|
+
size?: number;
|
|
946
|
+
}
|
|
947
|
+
declare function PrivanaIcon({ className, size }: PrivanaIconProps): react_jsx_runtime.JSX.Element;
|
|
948
|
+
|
|
949
|
+
export { AccountingApiError, Address, type Allowance, type AllowanceTerm, Button, Bytes32, type ChainConfig, DepositAddressResponse, DepositCheckResponse, DepositInlineModal, type DepositInlineModalProps, type DepositMethodHandlers, DepositModal, type DepositModalProps, type DepositParams, type DepositSource, type EIP712Domain, HOSTED_AUTH_CLOCK_SKEW_MS, HistoryEntry, type HostedAuthCallback, type HostedAuthCallbackError, type HostedAuthCallbackSuccess, type HostedAuthConfig, HostedAuthError, type HostedAuthPendingTransaction, HostedAuthRequiredError, type HostedAuthSession, HostedAuthStateMismatchError, HostedAuthTokenExchangeResponse, JwtRefreshResponse, LOCK_TYPES, type LockFundsParams, LockInfo, type LockMessage, MODIFY_LOCK_TYPES, type ModifyLockMessage, type ModifyLockParams, NetworkConfig, NetworkError, PendingDeposit, PendingDepositsResponse, PostDepositLockConfig, PostDepositLockError, PrivanaButton, type PrivanaButtonProps, PrivanaClient, type PrivanaContextValue, PrivanaIcon, PrivanaInlineModal, PrivanaModal, PrivanaProvider, type PrivanaProviderProps, SUPPORTED_CHAINS, type SignLockParams, type SignModifyLockParams, type SignTransferLockedParams, type SignTransferParams, type SignWithdrawFromLockParams, type SignWithdrawParams, type SiweAuthConfig, type SiweAuthContextValue, SiweAuthProvider, type SiweAuthProviderProps, type SiweAuthSession, type SiweAuthTokens, SiweLoginResponse, Skeleton, TRANSFER_LOCKED_TYPES, TRANSFER_TYPES, TokenBalance, TokenConfig, TokenInfoResponse, type TokensStatus, TransactionSubmissionResponse, type TransferLockedMessage, type TransferLockedParams, type TransferMessage, type TransferParams, type UnlockFundsParams, type UseBalanceOptions, type UseBalanceResult, type UseBatchBalancesOptions, type UseBatchBalancesResult, type UseDepositAddressOptions, type UseDepositAddressResult, type UseDepositOptions, type UseDepositResult, type UseDepositVerificationOptions, type UseDepositVerificationResult, type UseExpiredLocksOptions, type UseExpiredLocksResult, type UseHistoryOptions, type UseHistoryResult, type UseHostedRedirectAuthResult, type UseLockFundsOptions, type UseLockFundsResult, type UseLockedFundsOptions, type UseLockedFundsResult, type UseModifyLockOptions, type UseModifyLockResult, type UsePendingDepositsOptions, type UsePendingDepositsResult, type UsePendingWithdrawalsOptions, type UsePendingWithdrawalsResult, type UseTokenInfoOptions, type UseTokenInfoResult, type UseTokenListOptions, type UseTokenListResult, type UseTotalLockedBalanceOptions, type UseTotalLockedBalanceResult, type UseTransferOptions, type UseTransferResult, type UseUnlockFundsOptions, type UseUnlockFundsResult, type UseWithdrawOptions, type UseWithdrawResult, ValidationError, type VerificationContext, WITHDRAW_FROM_LOCK_TYPES, WITHDRAW_TYPES, WalletInlineModal, type WalletInlineModalProps, WalletModal, type WalletModalHandlers, type WalletModalProps, type WalletSession, type WithdrawFromLockMessage, WithdrawInlineModal, type WithdrawInlineModalProps, type WithdrawMessage, WithdrawModal, type WithdrawModalProps, type WithdrawParams, type WithdrawStep, WithdrawalInfo, applyRefreshResponse, buildHostedAuthSession, buildSiweStatement, buttonVariants, clearHostedAuthPendingTransaction, createDomain, createHostedAuthPendingStorageKey, createHostedAuthState, createHostedAuthStorageKey, createLockExpiry, createPkceChallenge, createPkceVerifier, getChainById, getChainIcon, getExplorerAddressUrl, getExplorerLabel, getTokenIcon, isHostedAuthRefreshActive, isHostedAuthSessionActive, parseHostedAuthCallback, persistHostedAuthPendingTransaction, readHostedAuthPendingTransaction, readStoredHostedAuthSession, signLockMessage, signModifyLockMessage, signTransferLockedMessage, signTransferMessage, signWithdrawFromLockMessage, signWithdrawMessage, stripHostedAuthCallbackParams, syncHostedAuthSessionToClient, useBalance, useBatchBalances, useDeposit, useDepositAddress, useDepositVerification, useExpiredLocks, useHistory, useHostedRedirectAuth, useLockFunds, useLockedFunds, useModifyLock, usePendingDeposits, usePendingWithdrawals, usePrivanaClient, usePrivanaContext, useSafeAccount, useSafePrivanaContext, useSiweAuth, useTokenInfo, useTokenList, useTotalLockedBalance, useTransfer, useUnlockFunds, useWithdraw };
|