@oasisprotocol/privana-sdk 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +239 -0
- package/dist/index.cjs +4438 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +2 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +1059 -0
- package/dist/index.d.ts +1059 -0
- package/dist/index.js +4340 -0
- package/dist/index.js.map +1 -0
- package/package.json +90 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1059 @@
|
|
|
1
|
+
import { WalletClient, Address as Address$1 } from 'viem';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import * as React$1 from 'react';
|
|
4
|
+
import { ReactNode, ComponentProps, ReactElement } from 'react';
|
|
5
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
6
|
+
import { VariantProps } from 'class-variance-authority';
|
|
7
|
+
|
|
8
|
+
var networks = {
|
|
9
|
+
testnet: {
|
|
10
|
+
chainId: 23295,
|
|
11
|
+
name: "Sapphire Testnet",
|
|
12
|
+
accountingContract: "0xaF8e5de153A584528B57DD4B9B0195956BBDF571",
|
|
13
|
+
apiUrl: "https://flexvaults-staging.rofl.build"
|
|
14
|
+
},
|
|
15
|
+
mainnet: {
|
|
16
|
+
chainId: 23294,
|
|
17
|
+
name: "Sapphire Mainnet",
|
|
18
|
+
accountingContract: "0x0000000000000000000000000000000000000000",
|
|
19
|
+
apiUrl: ""
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var config = {
|
|
23
|
+
networks: networks
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type Address = `0x${string}`;
|
|
27
|
+
type Bytes32 = `0x${string}`;
|
|
28
|
+
type HexString = `0x${string}`;
|
|
29
|
+
type IntegerLike = string | number;
|
|
30
|
+
type HostedAuthResponseMode = 'web_message' | 'redirect';
|
|
31
|
+
type Network = keyof typeof config.networks;
|
|
32
|
+
interface NetworkConfig {
|
|
33
|
+
chainId: number;
|
|
34
|
+
name: string;
|
|
35
|
+
accountingContract: Address;
|
|
36
|
+
apiUrl: string;
|
|
37
|
+
}
|
|
38
|
+
declare const NETWORK_CONFIG: {
|
|
39
|
+
readonly testnet: {
|
|
40
|
+
readonly accountingContract: Address;
|
|
41
|
+
readonly chainId: number;
|
|
42
|
+
readonly name: string;
|
|
43
|
+
readonly apiUrl: string;
|
|
44
|
+
};
|
|
45
|
+
readonly mainnet: {
|
|
46
|
+
readonly accountingContract: Address;
|
|
47
|
+
readonly chainId: number;
|
|
48
|
+
readonly name: string;
|
|
49
|
+
readonly apiUrl: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
declare function getChainId(network: Network): number;
|
|
53
|
+
declare function getAccountingContract(network: Network): Address;
|
|
54
|
+
declare function getApiUrl(network: Network): string;
|
|
55
|
+
declare function normalizeHex(value: string): HexString;
|
|
56
|
+
declare function normalizeAddress(value: string): Address;
|
|
57
|
+
|
|
58
|
+
interface HostedAuthConfig {
|
|
59
|
+
clientId: string;
|
|
60
|
+
redirectUri: string;
|
|
61
|
+
}
|
|
62
|
+
interface HostedAuthSession {
|
|
63
|
+
accessToken: string;
|
|
64
|
+
refreshToken: string;
|
|
65
|
+
idToken: string;
|
|
66
|
+
tokenType: string;
|
|
67
|
+
address: Address;
|
|
68
|
+
clientId: string;
|
|
69
|
+
redirectUri: string;
|
|
70
|
+
expiresAt: number;
|
|
71
|
+
refreshExpiresAt: number;
|
|
72
|
+
}
|
|
73
|
+
interface HostedAuthPendingTransaction {
|
|
74
|
+
codeVerifier: string;
|
|
75
|
+
state: string;
|
|
76
|
+
}
|
|
77
|
+
interface HostedAuthCallbackSuccess {
|
|
78
|
+
code: string;
|
|
79
|
+
state: string | null;
|
|
80
|
+
}
|
|
81
|
+
interface HostedAuthCallbackError {
|
|
82
|
+
error: string;
|
|
83
|
+
errorDescription?: string;
|
|
84
|
+
state: string | null;
|
|
85
|
+
}
|
|
86
|
+
type HostedAuthCallback = HostedAuthCallbackSuccess | HostedAuthCallbackError;
|
|
87
|
+
|
|
88
|
+
interface TokenConfig {
|
|
89
|
+
id: Bytes32;
|
|
90
|
+
symbol: string;
|
|
91
|
+
decimals: number;
|
|
92
|
+
contract: Address;
|
|
93
|
+
name: string;
|
|
94
|
+
chainId: number;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
interface ChainConfig {
|
|
98
|
+
id: number;
|
|
99
|
+
name: string;
|
|
100
|
+
explorerUrl: string;
|
|
101
|
+
}
|
|
102
|
+
declare const SUPPORTED_CHAINS: ChainConfig[];
|
|
103
|
+
declare function getChainById(chainId: number): ChainConfig | undefined;
|
|
104
|
+
declare function getExplorerAddressUrl(chainId: number, address: string): string | undefined;
|
|
105
|
+
|
|
106
|
+
interface DepositAddressRequest {
|
|
107
|
+
chain_type?: string;
|
|
108
|
+
version?: number;
|
|
109
|
+
}
|
|
110
|
+
interface DepositCheckRequest {
|
|
111
|
+
chain_type?: string;
|
|
112
|
+
chain_id: number;
|
|
113
|
+
tx_hash: HexString;
|
|
114
|
+
amount: IntegerLike;
|
|
115
|
+
log_index?: number;
|
|
116
|
+
version?: number;
|
|
117
|
+
}
|
|
118
|
+
interface LockFundsRequest {
|
|
119
|
+
service_address: Address;
|
|
120
|
+
token_id: Bytes32;
|
|
121
|
+
amount: IntegerLike;
|
|
122
|
+
expiry: IntegerLike;
|
|
123
|
+
nonce: IntegerLike;
|
|
124
|
+
signature: HexString;
|
|
125
|
+
}
|
|
126
|
+
interface ModifyLockRequest {
|
|
127
|
+
lock_id: number;
|
|
128
|
+
amount: IntegerLike;
|
|
129
|
+
new_expiry: IntegerLike;
|
|
130
|
+
nonce: IntegerLike;
|
|
131
|
+
signature: HexString;
|
|
132
|
+
}
|
|
133
|
+
interface UnlockFundsRequest {
|
|
134
|
+
user_address: Address;
|
|
135
|
+
lock_id: number;
|
|
136
|
+
}
|
|
137
|
+
interface UnlockAllExpiredRequest {
|
|
138
|
+
user_address: Address;
|
|
139
|
+
}
|
|
140
|
+
interface TransferFundsRequest {
|
|
141
|
+
to_address: Address;
|
|
142
|
+
token_id: Bytes32;
|
|
143
|
+
amount: IntegerLike;
|
|
144
|
+
nonce: IntegerLike;
|
|
145
|
+
signature: HexString;
|
|
146
|
+
}
|
|
147
|
+
interface TransferLockedFundsRequest {
|
|
148
|
+
user_address: Address;
|
|
149
|
+
lock_id: number;
|
|
150
|
+
to_address: Address;
|
|
151
|
+
amount: IntegerLike;
|
|
152
|
+
service_address: Address;
|
|
153
|
+
nonce: IntegerLike;
|
|
154
|
+
signature: HexString;
|
|
155
|
+
}
|
|
156
|
+
interface WithdrawalRequest {
|
|
157
|
+
token_id: Bytes32;
|
|
158
|
+
amount: IntegerLike;
|
|
159
|
+
nonce: IntegerLike;
|
|
160
|
+
signature: HexString;
|
|
161
|
+
}
|
|
162
|
+
interface WithdrawFromLockRequest {
|
|
163
|
+
to_address: Address;
|
|
164
|
+
lock_id: number;
|
|
165
|
+
amount: IntegerLike;
|
|
166
|
+
nonce: IntegerLike;
|
|
167
|
+
signature: HexString;
|
|
168
|
+
}
|
|
169
|
+
interface BatchBalancesRequest {
|
|
170
|
+
token_ids: Bytes32[];
|
|
171
|
+
}
|
|
172
|
+
interface HistoryRequest {
|
|
173
|
+
offset?: number;
|
|
174
|
+
limit?: number;
|
|
175
|
+
}
|
|
176
|
+
interface SiweLoginRequest {
|
|
177
|
+
siwe_message: string;
|
|
178
|
+
signature: HexString;
|
|
179
|
+
}
|
|
180
|
+
interface HostedAuthAuthorizeUrlRequest {
|
|
181
|
+
client_id: string;
|
|
182
|
+
redirect_uri: string;
|
|
183
|
+
code_challenge: string;
|
|
184
|
+
state: string;
|
|
185
|
+
chain_id: number;
|
|
186
|
+
response_mode?: HostedAuthResponseMode;
|
|
187
|
+
code_challenge_method?: 'S256';
|
|
188
|
+
}
|
|
189
|
+
interface HostedAuthTokenExchangeRequest {
|
|
190
|
+
grant_type?: 'authorization_code';
|
|
191
|
+
code: string;
|
|
192
|
+
code_verifier: string;
|
|
193
|
+
client_id: string;
|
|
194
|
+
redirect_uri: string;
|
|
195
|
+
}
|
|
196
|
+
interface JwtRefreshRequest {
|
|
197
|
+
refresh_token: string;
|
|
198
|
+
}
|
|
199
|
+
interface JwtLogoutRequest {
|
|
200
|
+
refresh_token?: string;
|
|
201
|
+
revoke_all?: boolean;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
interface MinDepositAmounts {
|
|
205
|
+
native: string;
|
|
206
|
+
erc20: string;
|
|
207
|
+
}
|
|
208
|
+
interface DepositAddressResponse {
|
|
209
|
+
deposit_address: Address;
|
|
210
|
+
chain_type: string;
|
|
211
|
+
version: number;
|
|
212
|
+
min_deposit: Record<string, MinDepositAmounts>;
|
|
213
|
+
}
|
|
214
|
+
interface DepositCheckResponse {
|
|
215
|
+
status: 'credited' | 'pending' | 'error';
|
|
216
|
+
deposit_id?: string;
|
|
217
|
+
amount?: string;
|
|
218
|
+
token_address?: Address;
|
|
219
|
+
detail?: string;
|
|
220
|
+
}
|
|
221
|
+
interface TransactionSubmissionResponse {
|
|
222
|
+
status: string;
|
|
223
|
+
detail?: string;
|
|
224
|
+
}
|
|
225
|
+
interface BalanceResponse {
|
|
226
|
+
user_address: Address;
|
|
227
|
+
token_id: Bytes32;
|
|
228
|
+
balance: string;
|
|
229
|
+
token_symbol: string;
|
|
230
|
+
chain_id: string;
|
|
231
|
+
}
|
|
232
|
+
interface TokenBalance {
|
|
233
|
+
token_id: Bytes32;
|
|
234
|
+
balance: string;
|
|
235
|
+
token_symbol: string;
|
|
236
|
+
chain_id: string;
|
|
237
|
+
}
|
|
238
|
+
interface BatchBalancesResponse {
|
|
239
|
+
user_address: Address;
|
|
240
|
+
balances: TokenBalance[];
|
|
241
|
+
}
|
|
242
|
+
type HistoryKind = 'deposit' | 'withdraw' | 'createLock' | 'transferFromLock' | 'transferBalance' | 'unknown';
|
|
243
|
+
interface HistoryEntry {
|
|
244
|
+
kind: HistoryKind;
|
|
245
|
+
timestamp: number;
|
|
246
|
+
token_id?: Bytes32 | null;
|
|
247
|
+
amount?: string | null;
|
|
248
|
+
counterparty?: Address | null;
|
|
249
|
+
deposit_id?: Bytes32 | null;
|
|
250
|
+
chain_id?: number | null;
|
|
251
|
+
}
|
|
252
|
+
interface HistoryResponse {
|
|
253
|
+
history: HistoryEntry[];
|
|
254
|
+
total: number;
|
|
255
|
+
}
|
|
256
|
+
interface TokenInfoResponse {
|
|
257
|
+
token_id: Bytes32;
|
|
258
|
+
token_type: number;
|
|
259
|
+
token_type_name: string;
|
|
260
|
+
data: string;
|
|
261
|
+
chain_id: number;
|
|
262
|
+
chain_name: string;
|
|
263
|
+
token_address: Address;
|
|
264
|
+
symbol: string;
|
|
265
|
+
name: string;
|
|
266
|
+
decimals: number;
|
|
267
|
+
}
|
|
268
|
+
interface TokenListResponse {
|
|
269
|
+
tokens: TokenInfoResponse[];
|
|
270
|
+
}
|
|
271
|
+
interface LockInfo {
|
|
272
|
+
lock_id: number;
|
|
273
|
+
user_address: Address;
|
|
274
|
+
service_address: Address;
|
|
275
|
+
token_id: Bytes32;
|
|
276
|
+
amount: string;
|
|
277
|
+
expiry: number;
|
|
278
|
+
is_expired: boolean;
|
|
279
|
+
}
|
|
280
|
+
interface LockedFundsResponse {
|
|
281
|
+
user_address: Address;
|
|
282
|
+
service_address?: Address;
|
|
283
|
+
locks: LockInfo[];
|
|
284
|
+
total_locked: string;
|
|
285
|
+
}
|
|
286
|
+
interface ExpiredLocksResponse {
|
|
287
|
+
user_address: Address;
|
|
288
|
+
expired_locks: LockInfo[];
|
|
289
|
+
}
|
|
290
|
+
interface TotalLockedBalanceResponse {
|
|
291
|
+
user_address: Address;
|
|
292
|
+
token_id: Bytes32;
|
|
293
|
+
total_locked: string;
|
|
294
|
+
}
|
|
295
|
+
interface WithdrawalInfo {
|
|
296
|
+
index: number;
|
|
297
|
+
user_address: Address;
|
|
298
|
+
to_address: Address;
|
|
299
|
+
amount: string;
|
|
300
|
+
block_number: number;
|
|
301
|
+
token_id: Bytes32;
|
|
302
|
+
resolved: boolean;
|
|
303
|
+
tx_identifier: string;
|
|
304
|
+
}
|
|
305
|
+
interface PendingWithdrawalsResponse {
|
|
306
|
+
user_address: Address;
|
|
307
|
+
pending_withdrawals: WithdrawalInfo[];
|
|
308
|
+
}
|
|
309
|
+
type WithdrawalInfoResponse = WithdrawalInfo;
|
|
310
|
+
interface TransferNonceResponse {
|
|
311
|
+
user_address: Address;
|
|
312
|
+
nonce: string;
|
|
313
|
+
}
|
|
314
|
+
interface WithdrawalNonceResponse {
|
|
315
|
+
user_address: Address;
|
|
316
|
+
nonce: string;
|
|
317
|
+
}
|
|
318
|
+
interface LockNonceResponse {
|
|
319
|
+
user_address: Address;
|
|
320
|
+
nonce: string;
|
|
321
|
+
}
|
|
322
|
+
interface ModifyLockNonceResponse {
|
|
323
|
+
user_address: Address;
|
|
324
|
+
nonce: string;
|
|
325
|
+
}
|
|
326
|
+
interface TransferLockedNonceResponse {
|
|
327
|
+
service_address: Address;
|
|
328
|
+
nonce: string;
|
|
329
|
+
}
|
|
330
|
+
interface SiweDomainResponse {
|
|
331
|
+
domain: string;
|
|
332
|
+
}
|
|
333
|
+
interface SiweNonceResponse {
|
|
334
|
+
address: Address;
|
|
335
|
+
nonce: string;
|
|
336
|
+
expires_in: number;
|
|
337
|
+
}
|
|
338
|
+
interface SiweLoginResponse {
|
|
339
|
+
siwe_token: HexString;
|
|
340
|
+
jwt_access_token: string;
|
|
341
|
+
jwt_refresh_token: string;
|
|
342
|
+
address: Address;
|
|
343
|
+
jwt_expires_in: number;
|
|
344
|
+
jwt_refresh_expires_in: number;
|
|
345
|
+
}
|
|
346
|
+
interface HostedAuthTokenExchangeResponse {
|
|
347
|
+
access_token: string;
|
|
348
|
+
id_token: string;
|
|
349
|
+
refresh_token: string;
|
|
350
|
+
token_type: string;
|
|
351
|
+
expires_in: number;
|
|
352
|
+
refresh_expires_in: number;
|
|
353
|
+
address: Address;
|
|
354
|
+
}
|
|
355
|
+
interface JwtRefreshResponse {
|
|
356
|
+
token: string;
|
|
357
|
+
refresh_token: string;
|
|
358
|
+
expires_in: number;
|
|
359
|
+
refresh_expires_in: number;
|
|
360
|
+
}
|
|
361
|
+
interface JwtLogoutResponse {
|
|
362
|
+
message: string;
|
|
363
|
+
revoked_tokens: number;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
declare const HOSTED_AUTH_CLOCK_SKEW_MS = 30000;
|
|
367
|
+
type StorageLike = Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;
|
|
368
|
+
declare function createPkceVerifier(length?: number): string;
|
|
369
|
+
declare function createPkceChallenge(verifier: string): Promise<string>;
|
|
370
|
+
declare function createHostedAuthState(length?: number): string;
|
|
371
|
+
declare function createHostedAuthStorageKey(apiUrl: string, config: HostedAuthConfig): string;
|
|
372
|
+
declare function createHostedAuthPendingStorageKey(apiUrl: string, config: HostedAuthConfig): string;
|
|
373
|
+
declare function persistHostedAuthPendingTransaction(storage: StorageLike, key: string, transaction: HostedAuthPendingTransaction): void;
|
|
374
|
+
declare function readHostedAuthPendingTransaction(storage: StorageLike, key: string): HostedAuthPendingTransaction | null;
|
|
375
|
+
declare function clearHostedAuthPendingTransaction(storage: StorageLike, key: string): void;
|
|
376
|
+
declare function parseHostedAuthCallback(url: URL, redirectUri: string): HostedAuthCallback | null;
|
|
377
|
+
declare function stripHostedAuthCallbackParams(url: URL): string;
|
|
378
|
+
declare function buildHostedAuthSession(response: HostedAuthTokenExchangeResponse, config: HostedAuthConfig, now?: number): HostedAuthSession;
|
|
379
|
+
declare function applyRefreshResponse(session: HostedAuthSession, response: JwtRefreshResponse, now?: number): HostedAuthSession;
|
|
380
|
+
declare function isHostedAuthSessionActive(session: HostedAuthSession, now?: number, skewMs?: number): boolean;
|
|
381
|
+
declare function isHostedAuthRefreshActive(session: HostedAuthSession, now?: number, skewMs?: number): boolean;
|
|
382
|
+
|
|
383
|
+
interface HttpClientConfig {
|
|
384
|
+
baseUrl: string;
|
|
385
|
+
timeout?: number;
|
|
386
|
+
headers?: Record<string, string>;
|
|
387
|
+
}
|
|
388
|
+
declare class HttpClient {
|
|
389
|
+
private readonly baseUrl;
|
|
390
|
+
private readonly timeout;
|
|
391
|
+
private readonly headers;
|
|
392
|
+
constructor(config: HttpClientConfig);
|
|
393
|
+
get<T>(path: string): Promise<T>;
|
|
394
|
+
post<T>(path: string, body?: unknown): Promise<T>;
|
|
395
|
+
getBaseUrl(): string;
|
|
396
|
+
setHeader(name: string, value: string): void;
|
|
397
|
+
removeHeader(name: string): void;
|
|
398
|
+
getHeader(name: string): string | undefined;
|
|
399
|
+
private request;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
type PrivanaClientConfig = HttpClientConfig;
|
|
403
|
+
declare class PrivanaClient {
|
|
404
|
+
private readonly http;
|
|
405
|
+
constructor(config: PrivanaClientConfig);
|
|
406
|
+
getBaseUrl(): string;
|
|
407
|
+
getDepositAddress(request?: DepositAddressRequest): Promise<DepositAddressResponse>;
|
|
408
|
+
checkDeposit(request: DepositCheckRequest): Promise<DepositCheckResponse>;
|
|
409
|
+
getDepositStatus(depositId: string): Promise<DepositCheckResponse>;
|
|
410
|
+
getBalance(tokenId: Bytes32 | string): Promise<BalanceResponse>;
|
|
411
|
+
getBatchBalances(request: BatchBalancesRequest): Promise<BatchBalancesResponse>;
|
|
412
|
+
getHistory(request?: HistoryRequest): Promise<HistoryResponse>;
|
|
413
|
+
listTokens(): Promise<TokenListResponse>;
|
|
414
|
+
getTokenInfo(tokenId: Bytes32 | string): Promise<TokenInfoResponse>;
|
|
415
|
+
lockFunds(request: LockFundsRequest): Promise<TransactionSubmissionResponse>;
|
|
416
|
+
modifyLock(request: ModifyLockRequest): Promise<TransactionSubmissionResponse>;
|
|
417
|
+
unlockFunds(request: UnlockFundsRequest): Promise<TransactionSubmissionResponse>;
|
|
418
|
+
unlockAllExpired(request: UnlockAllExpiredRequest): Promise<TransactionSubmissionResponse>;
|
|
419
|
+
getLockedFunds(serviceAddress?: Address | string): Promise<LockedFundsResponse>;
|
|
420
|
+
getTotalLockedBalance(tokenId: Bytes32 | string): Promise<TotalLockedBalanceResponse>;
|
|
421
|
+
getExpiredLocks(): Promise<ExpiredLocksResponse>;
|
|
422
|
+
transferFunds(request: TransferFundsRequest): Promise<TransactionSubmissionResponse>;
|
|
423
|
+
getTransferNonce(userAddress: Address | string): Promise<TransferNonceResponse>;
|
|
424
|
+
getLockNonce(userAddress: Address | string): Promise<LockNonceResponse>;
|
|
425
|
+
getModifyLockNonce(userAddress: Address | string): Promise<ModifyLockNonceResponse>;
|
|
426
|
+
transferLockedFunds(request: TransferLockedFundsRequest): Promise<TransactionSubmissionResponse>;
|
|
427
|
+
withdrawFromLock(request: WithdrawFromLockRequest): Promise<TransactionSubmissionResponse>;
|
|
428
|
+
requestWithdrawal(request: WithdrawalRequest): Promise<TransactionSubmissionResponse>;
|
|
429
|
+
getWithdrawalNonce(userAddress: Address | string): Promise<WithdrawalNonceResponse>;
|
|
430
|
+
getTransferLockedNonce(serviceAddress: Address | string): Promise<TransferLockedNonceResponse>;
|
|
431
|
+
getPendingWithdrawals(userAddress: Address | string): Promise<PendingWithdrawalsResponse>;
|
|
432
|
+
getWithdrawalInfo(index: number): Promise<WithdrawalInfoResponse>;
|
|
433
|
+
getSiweDomain(): Promise<SiweDomainResponse>;
|
|
434
|
+
getSiweNonce(userAddress: Address | string): Promise<SiweNonceResponse>;
|
|
435
|
+
loginWithSiwe(request: SiweLoginRequest): Promise<SiweLoginResponse>;
|
|
436
|
+
getHostedAuthAuthorizeUrl(request: HostedAuthAuthorizeUrlRequest): string;
|
|
437
|
+
exchangeHostedAuthCode(request: HostedAuthTokenExchangeRequest): Promise<HostedAuthTokenExchangeResponse>;
|
|
438
|
+
refreshJwtSession(request: JwtRefreshRequest): Promise<JwtRefreshResponse>;
|
|
439
|
+
logoutJwtSession(request?: JwtLogoutRequest): Promise<JwtLogoutResponse>;
|
|
440
|
+
setPrivateReadToken(token: string): void;
|
|
441
|
+
getPrivateReadToken(): string | undefined;
|
|
442
|
+
clearPrivateReadToken(): void;
|
|
443
|
+
setBearerToken(token: string): void;
|
|
444
|
+
clearBearerToken(): void;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
declare class AccountingApiError extends Error {
|
|
448
|
+
readonly statusCode: number;
|
|
449
|
+
readonly detail?: string | undefined;
|
|
450
|
+
constructor(message: string, statusCode: number, detail?: string | undefined);
|
|
451
|
+
}
|
|
452
|
+
declare class NetworkError extends Error {
|
|
453
|
+
readonly cause?: Error | undefined;
|
|
454
|
+
constructor(message: string, cause?: Error | undefined);
|
|
455
|
+
}
|
|
456
|
+
declare class ValidationError extends Error {
|
|
457
|
+
readonly field?: string | undefined;
|
|
458
|
+
constructor(message: string, field?: string | undefined);
|
|
459
|
+
}
|
|
460
|
+
declare class HostedAuthError extends Error {
|
|
461
|
+
constructor(message: string);
|
|
462
|
+
}
|
|
463
|
+
declare class HostedAuthRequiredError extends HostedAuthError {
|
|
464
|
+
constructor(message?: string);
|
|
465
|
+
}
|
|
466
|
+
declare class HostedAuthStateMismatchError extends HostedAuthError {
|
|
467
|
+
constructor(message?: string);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
interface EIP712Domain {
|
|
471
|
+
name: string;
|
|
472
|
+
version: string;
|
|
473
|
+
chainId: number;
|
|
474
|
+
verifyingContract: Address;
|
|
475
|
+
}
|
|
476
|
+
declare function createDomain(chainId: number, verifyingContract: Address): EIP712Domain;
|
|
477
|
+
declare const LOCK_TYPES: {
|
|
478
|
+
readonly Lock: readonly [{
|
|
479
|
+
readonly name: "serviceAddress";
|
|
480
|
+
readonly type: "address";
|
|
481
|
+
}, {
|
|
482
|
+
readonly name: "tokenId";
|
|
483
|
+
readonly type: "bytes32";
|
|
484
|
+
}, {
|
|
485
|
+
readonly name: "amount";
|
|
486
|
+
readonly type: "uint256";
|
|
487
|
+
}, {
|
|
488
|
+
readonly name: "expiry";
|
|
489
|
+
readonly type: "uint256";
|
|
490
|
+
}, {
|
|
491
|
+
readonly name: "nonce";
|
|
492
|
+
readonly type: "uint256";
|
|
493
|
+
}];
|
|
494
|
+
};
|
|
495
|
+
declare const TRANSFER_TYPES: {
|
|
496
|
+
readonly Transfer: readonly [{
|
|
497
|
+
readonly name: "toAddress";
|
|
498
|
+
readonly type: "address";
|
|
499
|
+
}, {
|
|
500
|
+
readonly name: "tokenId";
|
|
501
|
+
readonly type: "bytes32";
|
|
502
|
+
}, {
|
|
503
|
+
readonly name: "amount";
|
|
504
|
+
readonly type: "uint256";
|
|
505
|
+
}, {
|
|
506
|
+
readonly name: "nonce";
|
|
507
|
+
readonly type: "uint256";
|
|
508
|
+
}];
|
|
509
|
+
};
|
|
510
|
+
declare const TRANSFER_LOCKED_TYPES: {
|
|
511
|
+
readonly TransferLocked: readonly [{
|
|
512
|
+
readonly name: "userAddress";
|
|
513
|
+
readonly type: "address";
|
|
514
|
+
}, {
|
|
515
|
+
readonly name: "toAddress";
|
|
516
|
+
readonly type: "address";
|
|
517
|
+
}, {
|
|
518
|
+
readonly name: "lockId";
|
|
519
|
+
readonly type: "uint256";
|
|
520
|
+
}, {
|
|
521
|
+
readonly name: "amount";
|
|
522
|
+
readonly type: "uint256";
|
|
523
|
+
}, {
|
|
524
|
+
readonly name: "nonce";
|
|
525
|
+
readonly type: "uint256";
|
|
526
|
+
}, {
|
|
527
|
+
readonly name: "serviceAddress";
|
|
528
|
+
readonly type: "address";
|
|
529
|
+
}];
|
|
530
|
+
};
|
|
531
|
+
declare const WITHDRAW_TYPES: {
|
|
532
|
+
readonly Withdraw: readonly [{
|
|
533
|
+
readonly name: "tokenId";
|
|
534
|
+
readonly type: "bytes32";
|
|
535
|
+
}, {
|
|
536
|
+
readonly name: "amount";
|
|
537
|
+
readonly type: "uint256";
|
|
538
|
+
}, {
|
|
539
|
+
readonly name: "nonce";
|
|
540
|
+
readonly type: "uint256";
|
|
541
|
+
}];
|
|
542
|
+
};
|
|
543
|
+
declare const MODIFY_LOCK_TYPES: {
|
|
544
|
+
readonly ModifyLock: readonly [{
|
|
545
|
+
readonly name: "lockId";
|
|
546
|
+
readonly type: "uint256";
|
|
547
|
+
}, {
|
|
548
|
+
readonly name: "amount";
|
|
549
|
+
readonly type: "uint256";
|
|
550
|
+
}, {
|
|
551
|
+
readonly name: "newExpiry";
|
|
552
|
+
readonly type: "uint256";
|
|
553
|
+
}, {
|
|
554
|
+
readonly name: "nonce";
|
|
555
|
+
readonly type: "uint256";
|
|
556
|
+
}];
|
|
557
|
+
};
|
|
558
|
+
declare const WITHDRAW_FROM_LOCK_TYPES: {
|
|
559
|
+
readonly WithdrawFromLock: readonly [{
|
|
560
|
+
readonly name: "userAddress";
|
|
561
|
+
readonly type: "address";
|
|
562
|
+
}, {
|
|
563
|
+
readonly name: "toAddress";
|
|
564
|
+
readonly type: "address";
|
|
565
|
+
}, {
|
|
566
|
+
readonly name: "lockId";
|
|
567
|
+
readonly type: "uint256";
|
|
568
|
+
}, {
|
|
569
|
+
readonly name: "amount";
|
|
570
|
+
readonly type: "uint256";
|
|
571
|
+
}, {
|
|
572
|
+
readonly name: "nonce";
|
|
573
|
+
readonly type: "uint256";
|
|
574
|
+
}];
|
|
575
|
+
};
|
|
576
|
+
interface LockMessage {
|
|
577
|
+
serviceAddress: Address;
|
|
578
|
+
tokenId: Bytes32;
|
|
579
|
+
amount: bigint;
|
|
580
|
+
expiry: bigint;
|
|
581
|
+
nonce: bigint;
|
|
582
|
+
}
|
|
583
|
+
interface TransferMessage {
|
|
584
|
+
toAddress: Address;
|
|
585
|
+
tokenId: Bytes32;
|
|
586
|
+
amount: bigint;
|
|
587
|
+
nonce: bigint;
|
|
588
|
+
}
|
|
589
|
+
interface TransferLockedMessage {
|
|
590
|
+
userAddress: Address;
|
|
591
|
+
toAddress: Address;
|
|
592
|
+
lockId: bigint;
|
|
593
|
+
amount: bigint;
|
|
594
|
+
nonce: bigint;
|
|
595
|
+
serviceAddress: Address;
|
|
596
|
+
}
|
|
597
|
+
interface WithdrawMessage {
|
|
598
|
+
tokenId: Bytes32;
|
|
599
|
+
amount: bigint;
|
|
600
|
+
nonce: bigint;
|
|
601
|
+
}
|
|
602
|
+
interface ModifyLockMessage {
|
|
603
|
+
lockId: bigint;
|
|
604
|
+
amount: bigint;
|
|
605
|
+
newExpiry: bigint;
|
|
606
|
+
nonce: bigint;
|
|
607
|
+
}
|
|
608
|
+
interface WithdrawFromLockMessage {
|
|
609
|
+
userAddress: Address;
|
|
610
|
+
toAddress: Address;
|
|
611
|
+
lockId: bigint;
|
|
612
|
+
amount: bigint;
|
|
613
|
+
nonce: bigint;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
interface SignLockParams {
|
|
617
|
+
walletClient: WalletClient;
|
|
618
|
+
chainId: number;
|
|
619
|
+
verifyingContract: Address;
|
|
620
|
+
message: LockMessage;
|
|
621
|
+
}
|
|
622
|
+
declare function signLockMessage({ walletClient, chainId, verifyingContract, message, }: SignLockParams): Promise<`0x${string}`>;
|
|
623
|
+
declare function createLockExpiry(minutesFromNow?: number): bigint;
|
|
624
|
+
|
|
625
|
+
interface SignModifyLockParams {
|
|
626
|
+
walletClient: WalletClient;
|
|
627
|
+
chainId: number;
|
|
628
|
+
verifyingContract: Address;
|
|
629
|
+
message: ModifyLockMessage;
|
|
630
|
+
}
|
|
631
|
+
declare function signModifyLockMessage({ walletClient, chainId, verifyingContract, message, }: SignModifyLockParams): Promise<`0x${string}`>;
|
|
632
|
+
|
|
633
|
+
interface SignTransferParams {
|
|
634
|
+
walletClient: WalletClient;
|
|
635
|
+
chainId: number;
|
|
636
|
+
verifyingContract: Address;
|
|
637
|
+
message: TransferMessage;
|
|
638
|
+
}
|
|
639
|
+
declare function signTransferMessage({ walletClient, chainId, verifyingContract, message, }: SignTransferParams): Promise<`0x${string}`>;
|
|
640
|
+
|
|
641
|
+
interface SignTransferLockedParams {
|
|
642
|
+
walletClient: WalletClient;
|
|
643
|
+
chainId: number;
|
|
644
|
+
verifyingContract: Address;
|
|
645
|
+
message: TransferLockedMessage;
|
|
646
|
+
}
|
|
647
|
+
declare function signTransferLockedMessage({ walletClient, chainId, verifyingContract, message, }: SignTransferLockedParams): Promise<`0x${string}`>;
|
|
648
|
+
|
|
649
|
+
interface SignWithdrawParams {
|
|
650
|
+
walletClient: WalletClient;
|
|
651
|
+
chainId: number;
|
|
652
|
+
verifyingContract: Address;
|
|
653
|
+
message: WithdrawMessage;
|
|
654
|
+
}
|
|
655
|
+
declare function signWithdrawMessage({ walletClient, chainId, verifyingContract, message, }: SignWithdrawParams): Promise<`0x${string}`>;
|
|
656
|
+
|
|
657
|
+
interface SignWithdrawFromLockParams {
|
|
658
|
+
walletClient: WalletClient;
|
|
659
|
+
chainId: number;
|
|
660
|
+
verifyingContract: Address;
|
|
661
|
+
message: WithdrawFromLockMessage;
|
|
662
|
+
}
|
|
663
|
+
declare function signWithdrawFromLockMessage({ walletClient, chainId, verifyingContract, message, }: SignWithdrawFromLockParams): Promise<`0x${string}`>;
|
|
664
|
+
|
|
665
|
+
type TokensStatus = 'loading' | 'ready' | 'error';
|
|
666
|
+
interface PrivanaContextValue {
|
|
667
|
+
client: PrivanaClient;
|
|
668
|
+
networkConfig: NetworkConfig;
|
|
669
|
+
enabledTokens: TokenConfig[];
|
|
670
|
+
defaultToken: TokenConfig | undefined;
|
|
671
|
+
getTokenById: (id: string) => TokenConfig | undefined;
|
|
672
|
+
getChainById: (id: number) => ChainConfig | undefined;
|
|
673
|
+
chains: ChainConfig[];
|
|
674
|
+
tokensStatus: TokensStatus;
|
|
675
|
+
tokensError?: Error;
|
|
676
|
+
pollingInterval: number;
|
|
677
|
+
serviceAddress?: Address;
|
|
678
|
+
hostedAuthConfig: HostedAuthConfig | null;
|
|
679
|
+
hostedAuthSession: HostedAuthSession | null;
|
|
680
|
+
setHostedAuthSession: (session: HostedAuthSession | null) => void;
|
|
681
|
+
clearHostedAuthSession: () => void;
|
|
682
|
+
refreshHostedAuthSession: () => Promise<HostedAuthSession>;
|
|
683
|
+
}
|
|
684
|
+
declare function readStoredHostedAuthSession(storage: Pick<Storage, 'getItem' | 'removeItem'>, hostedAuthStorageKey: string, now?: number): HostedAuthSession | null;
|
|
685
|
+
declare function syncHostedAuthSessionToClient(client: Pick<PrivanaClient, 'clearBearerToken' | 'clearPrivateReadToken' | 'setBearerToken'>, hostedAuthConfig: HostedAuthConfig | null, hostedAuthSession: HostedAuthSession | null): void;
|
|
686
|
+
interface PrivanaProviderProps {
|
|
687
|
+
children: ReactNode;
|
|
688
|
+
/**
|
|
689
|
+
* Network configuration including chainId, accountingContract, apiUrl, and name.
|
|
690
|
+
* Defaults to testnet config. Partial overrides are merged with defaults.
|
|
691
|
+
*/
|
|
692
|
+
networkConfig?: Partial<NetworkConfig>;
|
|
693
|
+
/**
|
|
694
|
+
* Optional list of token IDs to filter from the API response.
|
|
695
|
+
* When provided, only tokens whose ID matches this list are enabled.
|
|
696
|
+
* When omitted, all tokens returned by the API are enabled.
|
|
697
|
+
*/
|
|
698
|
+
tokens?: string[];
|
|
699
|
+
/**
|
|
700
|
+
* Chain configurations to use. Defaults to SDK built-in chains from config.json.
|
|
701
|
+
* Pass custom ChainConfig[] for deployments targeting different chains.
|
|
702
|
+
*/
|
|
703
|
+
chains?: ChainConfig[];
|
|
704
|
+
pollingInterval?: number;
|
|
705
|
+
/**
|
|
706
|
+
* The service address for lock operations.
|
|
707
|
+
*/
|
|
708
|
+
serviceAddress?: Address;
|
|
709
|
+
/**
|
|
710
|
+
* Optional hosted redirect auth configuration for cross-domain browser apps.
|
|
711
|
+
*/
|
|
712
|
+
hostedAuth?: HostedAuthConfig;
|
|
713
|
+
}
|
|
714
|
+
declare function PrivanaProvider({ children, networkConfig: networkConfigOverride, tokens, chains, pollingInterval, serviceAddress, hostedAuth, }: PrivanaProviderProps): react_jsx_runtime.JSX.Element;
|
|
715
|
+
declare function usePrivanaContext(): PrivanaContextValue;
|
|
716
|
+
declare function useSafePrivanaContext(): PrivanaContextValue | null;
|
|
717
|
+
|
|
718
|
+
declare function usePrivanaClient(): PrivanaClient;
|
|
719
|
+
|
|
720
|
+
interface UseHostedRedirectAuthResult {
|
|
721
|
+
session: HostedAuthSession | null;
|
|
722
|
+
isAuthenticated: boolean;
|
|
723
|
+
isLoading: boolean;
|
|
724
|
+
error: Error | null;
|
|
725
|
+
login: () => Promise<void>;
|
|
726
|
+
completeLogin: () => Promise<HostedAuthSession | null>;
|
|
727
|
+
logout: () => Promise<void>;
|
|
728
|
+
refresh: () => Promise<HostedAuthSession>;
|
|
729
|
+
}
|
|
730
|
+
declare function useHostedRedirectAuth(): UseHostedRedirectAuthResult;
|
|
731
|
+
|
|
732
|
+
interface UseBalanceOptions {
|
|
733
|
+
tokenId?: Bytes32;
|
|
734
|
+
enabled?: boolean;
|
|
735
|
+
}
|
|
736
|
+
interface UseBalanceResult {
|
|
737
|
+
balance: string;
|
|
738
|
+
balanceWei: string;
|
|
739
|
+
balanceFormatted: string;
|
|
740
|
+
tokenSymbol: string;
|
|
741
|
+
chainId: string;
|
|
742
|
+
isLoading: boolean;
|
|
743
|
+
isError: boolean;
|
|
744
|
+
error: Error | null;
|
|
745
|
+
refetch: () => void;
|
|
746
|
+
}
|
|
747
|
+
declare function useBalance(options?: UseBalanceOptions): UseBalanceResult;
|
|
748
|
+
|
|
749
|
+
interface UseBatchBalancesOptions {
|
|
750
|
+
tokenIds: Bytes32[];
|
|
751
|
+
enabled?: boolean;
|
|
752
|
+
}
|
|
753
|
+
interface UseBatchBalancesResult {
|
|
754
|
+
balances: TokenBalance[];
|
|
755
|
+
isLoading: boolean;
|
|
756
|
+
isError: boolean;
|
|
757
|
+
error: Error | null;
|
|
758
|
+
refetch: () => void;
|
|
759
|
+
}
|
|
760
|
+
declare function useBatchBalances(options: UseBatchBalancesOptions): UseBatchBalancesResult;
|
|
761
|
+
|
|
762
|
+
interface UseDepositOptions {
|
|
763
|
+
onDepositAddressReceived?: (response: DepositAddressResponse) => void;
|
|
764
|
+
onDepositSuccess?: (txHash: string) => void;
|
|
765
|
+
onCredited?: (txHash: string, response: DepositCheckResponse) => void;
|
|
766
|
+
/** Called when deposit check polling times out - deposit may still be processing */
|
|
767
|
+
onCheckTimeout?: (txHash: string) => void;
|
|
768
|
+
onError?: (error: Error) => void;
|
|
769
|
+
/** Polling interval in ms for checking deposit status (default: 5000) */
|
|
770
|
+
pollInterval?: number;
|
|
771
|
+
/** Max time to wait for deposit to be credited in ms (default: 180000 = 3 minutes) */
|
|
772
|
+
pollTimeout?: number;
|
|
773
|
+
/** Number of block confirmations to wait before checking deposit status (default: 15) */
|
|
774
|
+
confirmations?: number;
|
|
775
|
+
}
|
|
776
|
+
interface DepositParams {
|
|
777
|
+
tokenId: Bytes32;
|
|
778
|
+
amount: bigint;
|
|
779
|
+
}
|
|
780
|
+
interface UseDepositResult {
|
|
781
|
+
depositAddress: DepositAddressResponse | null;
|
|
782
|
+
txHash: `0x${string}` | undefined;
|
|
783
|
+
isGettingAddress: boolean;
|
|
784
|
+
isSwitchingChain: boolean;
|
|
785
|
+
isSendingTransaction: boolean;
|
|
786
|
+
isWaitingForConfirmation: boolean;
|
|
787
|
+
isWaitingForProcessing: boolean;
|
|
788
|
+
/** True if processing timed out (deposit may still be processing in background) */
|
|
789
|
+
didTimeout: boolean;
|
|
790
|
+
/**
|
|
791
|
+
* True when an on-chain transfer succeeded but the API verification step
|
|
792
|
+
* (checkDeposit or status polling) failed. The funds have already left the
|
|
793
|
+
* wallet, so a fresh `deposit()` would cause a double spend. Call
|
|
794
|
+
* `retryVerification()` to re-run verification against the existing txHash,
|
|
795
|
+
* or `reset()` to discard local tracking (the deposit may still be credited
|
|
796
|
+
* in the background).
|
|
797
|
+
*/
|
|
798
|
+
verificationFailed: boolean;
|
|
799
|
+
isPending: boolean;
|
|
800
|
+
error: Error | null;
|
|
801
|
+
deposit: (params: DepositParams) => Promise<void>;
|
|
802
|
+
/** Re-run the API verification (sweep trigger + polling) for the existing txHash. */
|
|
803
|
+
retryVerification: () => Promise<void>;
|
|
804
|
+
reset: () => void;
|
|
805
|
+
}
|
|
806
|
+
declare function useDeposit(options?: UseDepositOptions): UseDepositResult;
|
|
807
|
+
|
|
808
|
+
interface UseWithdrawOptions {
|
|
809
|
+
onSuccess?: (response: TransactionSubmissionResponse) => void;
|
|
810
|
+
/** Called when withdrawal is submitted to the backend */
|
|
811
|
+
onSubmitSuccess?: (response: TransactionSubmissionResponse) => void;
|
|
812
|
+
/** Called when withdrawal is fully processed (broadcast to destination chain) */
|
|
813
|
+
onProcessingSuccess?: () => void;
|
|
814
|
+
/** Called when processing times out - withdrawal may still be processing */
|
|
815
|
+
onProcessingTimeout?: () => void;
|
|
816
|
+
onError?: (error: Error) => void;
|
|
817
|
+
/** Polling interval in ms for checking withdrawal status (default: 3000) */
|
|
818
|
+
pollInterval?: number;
|
|
819
|
+
/** Max time to wait for withdrawal to be processed in ms (default: 180000 = 3 minutes) */
|
|
820
|
+
pollTimeout?: number;
|
|
821
|
+
}
|
|
822
|
+
interface WithdrawParams {
|
|
823
|
+
tokenId: Bytes32;
|
|
824
|
+
amount: bigint;
|
|
825
|
+
}
|
|
826
|
+
type WithdrawStep = 'idle' | 'switching-chain' | 'signing' | 'submitting' | 'processing';
|
|
827
|
+
interface UseWithdrawResult {
|
|
828
|
+
withdraw: (params: WithdrawParams) => Promise<TransactionSubmissionResponse | undefined>;
|
|
829
|
+
isPending: boolean;
|
|
830
|
+
isSuccess: boolean;
|
|
831
|
+
currentStep: WithdrawStep;
|
|
832
|
+
/** True if processing timed out (withdrawal may still be processing in background) */
|
|
833
|
+
didTimeout: boolean;
|
|
834
|
+
error: Error | null;
|
|
835
|
+
reset: () => void;
|
|
836
|
+
}
|
|
837
|
+
declare function useWithdraw(options?: UseWithdrawOptions): UseWithdrawResult;
|
|
838
|
+
|
|
839
|
+
interface UseLockFundsOptions {
|
|
840
|
+
onSuccess?: (response: TransactionSubmissionResponse) => void;
|
|
841
|
+
onError?: (error: Error) => void;
|
|
842
|
+
}
|
|
843
|
+
interface LockFundsParams {
|
|
844
|
+
tokenId: Bytes32;
|
|
845
|
+
amount: bigint;
|
|
846
|
+
expiry: bigint;
|
|
847
|
+
}
|
|
848
|
+
interface UseLockFundsResult {
|
|
849
|
+
lockFunds: (params: LockFundsParams) => Promise<TransactionSubmissionResponse | undefined>;
|
|
850
|
+
isPending: boolean;
|
|
851
|
+
isSuccess: boolean;
|
|
852
|
+
error: Error | null;
|
|
853
|
+
reset: () => void;
|
|
854
|
+
}
|
|
855
|
+
declare function useLockFunds(options?: UseLockFundsOptions): UseLockFundsResult;
|
|
856
|
+
|
|
857
|
+
interface UseUnlockFundsOptions {
|
|
858
|
+
onSuccess?: (response: TransactionSubmissionResponse) => void;
|
|
859
|
+
onError?: (error: Error) => void;
|
|
860
|
+
}
|
|
861
|
+
interface UnlockFundsParams {
|
|
862
|
+
lockId: number;
|
|
863
|
+
}
|
|
864
|
+
interface UseUnlockFundsResult {
|
|
865
|
+
unlockFunds: (params: UnlockFundsParams) => Promise<TransactionSubmissionResponse | undefined>;
|
|
866
|
+
unlockAllExpired: () => Promise<TransactionSubmissionResponse | undefined>;
|
|
867
|
+
isPending: boolean;
|
|
868
|
+
isSuccess: boolean;
|
|
869
|
+
error: Error | null;
|
|
870
|
+
reset: () => void;
|
|
871
|
+
}
|
|
872
|
+
declare function useUnlockFunds(options?: UseUnlockFundsOptions): UseUnlockFundsResult;
|
|
873
|
+
|
|
874
|
+
interface UseTransferOptions {
|
|
875
|
+
onSuccess?: (response: TransactionSubmissionResponse) => void;
|
|
876
|
+
onError?: (error: Error) => void;
|
|
877
|
+
}
|
|
878
|
+
interface TransferParams {
|
|
879
|
+
toAddress: Address;
|
|
880
|
+
tokenId: Bytes32;
|
|
881
|
+
amount: bigint;
|
|
882
|
+
}
|
|
883
|
+
interface TransferLockedParams {
|
|
884
|
+
lockId: number;
|
|
885
|
+
toAddress: Address;
|
|
886
|
+
amount: bigint;
|
|
887
|
+
}
|
|
888
|
+
interface UseTransferResult {
|
|
889
|
+
transfer: (params: TransferParams) => Promise<TransactionSubmissionResponse | undefined>;
|
|
890
|
+
transferLocked: (params: TransferLockedParams) => Promise<TransactionSubmissionResponse | undefined>;
|
|
891
|
+
isPending: boolean;
|
|
892
|
+
isSuccess: boolean;
|
|
893
|
+
error: Error | null;
|
|
894
|
+
reset: () => void;
|
|
895
|
+
}
|
|
896
|
+
declare function useTransfer(options?: UseTransferOptions): UseTransferResult;
|
|
897
|
+
|
|
898
|
+
interface UseLockedFundsOptions {
|
|
899
|
+
enabled?: boolean;
|
|
900
|
+
}
|
|
901
|
+
interface UseLockedFundsResult {
|
|
902
|
+
locks: LockInfo[];
|
|
903
|
+
totalLocked: string;
|
|
904
|
+
isLoading: boolean;
|
|
905
|
+
isError: boolean;
|
|
906
|
+
error: Error | null;
|
|
907
|
+
refetch: () => void;
|
|
908
|
+
}
|
|
909
|
+
declare function useLockedFunds(options?: UseLockedFundsOptions): UseLockedFundsResult;
|
|
910
|
+
|
|
911
|
+
interface UseTotalLockedBalanceOptions {
|
|
912
|
+
tokenId?: Bytes32;
|
|
913
|
+
enabled?: boolean;
|
|
914
|
+
}
|
|
915
|
+
interface UseTotalLockedBalanceResult {
|
|
916
|
+
totalLocked: string;
|
|
917
|
+
isLoading: boolean;
|
|
918
|
+
isError: boolean;
|
|
919
|
+
error: Error | null;
|
|
920
|
+
refetch: () => void;
|
|
921
|
+
}
|
|
922
|
+
declare function useTotalLockedBalance(options?: UseTotalLockedBalanceOptions): UseTotalLockedBalanceResult;
|
|
923
|
+
|
|
924
|
+
interface UseExpiredLocksOptions {
|
|
925
|
+
enabled?: boolean;
|
|
926
|
+
}
|
|
927
|
+
interface UseExpiredLocksResult {
|
|
928
|
+
expiredLocks: LockInfo[];
|
|
929
|
+
hasExpiredLocks: boolean;
|
|
930
|
+
isLoading: boolean;
|
|
931
|
+
isError: boolean;
|
|
932
|
+
error: Error | null;
|
|
933
|
+
refetch: () => void;
|
|
934
|
+
}
|
|
935
|
+
declare function useExpiredLocks(options?: UseExpiredLocksOptions): UseExpiredLocksResult;
|
|
936
|
+
|
|
937
|
+
interface UsePendingWithdrawalsOptions {
|
|
938
|
+
enabled?: boolean;
|
|
939
|
+
}
|
|
940
|
+
interface UsePendingWithdrawalsResult {
|
|
941
|
+
withdrawals: WithdrawalInfo[];
|
|
942
|
+
hasPendingWithdrawals: boolean;
|
|
943
|
+
isLoading: boolean;
|
|
944
|
+
isError: boolean;
|
|
945
|
+
error: Error | null;
|
|
946
|
+
refetch: () => void;
|
|
947
|
+
}
|
|
948
|
+
declare function usePendingWithdrawals(options?: UsePendingWithdrawalsOptions): UsePendingWithdrawalsResult;
|
|
949
|
+
|
|
950
|
+
interface UseHistoryOptions {
|
|
951
|
+
offset?: number;
|
|
952
|
+
limit?: number;
|
|
953
|
+
enabled?: boolean;
|
|
954
|
+
}
|
|
955
|
+
interface UseHistoryResult {
|
|
956
|
+
history: HistoryEntry[];
|
|
957
|
+
total: number;
|
|
958
|
+
isLoading: boolean;
|
|
959
|
+
isError: boolean;
|
|
960
|
+
error: Error | null;
|
|
961
|
+
refetch: () => void;
|
|
962
|
+
}
|
|
963
|
+
declare function useHistory(options?: UseHistoryOptions): UseHistoryResult;
|
|
964
|
+
|
|
965
|
+
interface SafeAccountResult {
|
|
966
|
+
address: Address$1 | undefined;
|
|
967
|
+
isConnected: boolean;
|
|
968
|
+
}
|
|
969
|
+
declare function useSafeAccount(): SafeAccountResult;
|
|
970
|
+
|
|
971
|
+
interface UseTokenInfoOptions {
|
|
972
|
+
tokenId?: Bytes32 | string;
|
|
973
|
+
enabled?: boolean;
|
|
974
|
+
}
|
|
975
|
+
interface UseTokenInfoResult {
|
|
976
|
+
data: TokenInfoResponse | undefined;
|
|
977
|
+
isLoading: boolean;
|
|
978
|
+
isError: boolean;
|
|
979
|
+
error: Error | null;
|
|
980
|
+
refetch: () => void;
|
|
981
|
+
}
|
|
982
|
+
declare function useTokenInfo(options?: UseTokenInfoOptions): UseTokenInfoResult;
|
|
983
|
+
|
|
984
|
+
interface UseTokenListOptions {
|
|
985
|
+
enabled?: boolean;
|
|
986
|
+
}
|
|
987
|
+
interface UseTokenListResult {
|
|
988
|
+
tokens: TokenInfoResponse[];
|
|
989
|
+
isLoading: boolean;
|
|
990
|
+
isError: boolean;
|
|
991
|
+
error: Error | null;
|
|
992
|
+
refetch: () => void;
|
|
993
|
+
}
|
|
994
|
+
declare function useTokenList(options?: UseTokenListOptions): UseTokenListResult;
|
|
995
|
+
|
|
996
|
+
interface UseModifyLockOptions {
|
|
997
|
+
onSuccess?: (response: TransactionSubmissionResponse) => void;
|
|
998
|
+
onError?: (error: Error) => void;
|
|
999
|
+
}
|
|
1000
|
+
interface ModifyLockParams {
|
|
1001
|
+
lockId: number;
|
|
1002
|
+
amount: bigint;
|
|
1003
|
+
newExpiry: bigint;
|
|
1004
|
+
}
|
|
1005
|
+
interface UseModifyLockResult {
|
|
1006
|
+
modifyLock: (params: ModifyLockParams) => Promise<TransactionSubmissionResponse | undefined>;
|
|
1007
|
+
isPending: boolean;
|
|
1008
|
+
isSuccess: boolean;
|
|
1009
|
+
error: Error | null;
|
|
1010
|
+
reset: () => void;
|
|
1011
|
+
}
|
|
1012
|
+
declare function useModifyLock(options?: UseModifyLockOptions): UseModifyLockResult;
|
|
1013
|
+
|
|
1014
|
+
declare const buttonVariants: (props?: ({
|
|
1015
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
1016
|
+
size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
|
|
1017
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1018
|
+
declare function Button({ className, variant, size, asChild, ...props }: React$1.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
1019
|
+
asChild?: boolean;
|
|
1020
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1021
|
+
|
|
1022
|
+
type ButtonVariantProps = VariantProps<typeof buttonVariants>;
|
|
1023
|
+
interface PrivanaButtonProps extends Omit<ComponentProps<'button'>, 'children'> {
|
|
1024
|
+
children?: ReactNode;
|
|
1025
|
+
variant?: ButtonVariantProps['variant'];
|
|
1026
|
+
size?: ButtonVariantProps['size'];
|
|
1027
|
+
asChild?: boolean;
|
|
1028
|
+
renderButton?: (props: {
|
|
1029
|
+
onClick: () => void;
|
|
1030
|
+
isOpen: boolean;
|
|
1031
|
+
}) => ReactElement;
|
|
1032
|
+
hideWhenDisconnected?: boolean;
|
|
1033
|
+
showLockedFunds?: boolean;
|
|
1034
|
+
defaultTab?: 'deposit' | 'withdraw';
|
|
1035
|
+
onDepositSuccess?: () => void;
|
|
1036
|
+
}
|
|
1037
|
+
declare function PrivanaButton({ children, className, variant, size, asChild, renderButton, hideWhenDisconnected, showLockedFunds, defaultTab, onDepositSuccess, ...buttonProps }: PrivanaButtonProps): react_jsx_runtime.JSX.Element | null;
|
|
1038
|
+
|
|
1039
|
+
interface PrivanaModalProps {
|
|
1040
|
+
open: boolean;
|
|
1041
|
+
onClose: () => void;
|
|
1042
|
+
showLockedFunds?: boolean;
|
|
1043
|
+
defaultTab?: 'deposit' | 'withdraw';
|
|
1044
|
+
onDepositSuccess?: () => void;
|
|
1045
|
+
}
|
|
1046
|
+
declare function PrivanaModal({ open, onClose, showLockedFunds, defaultTab, onDepositSuccess, }: PrivanaModalProps): react_jsx_runtime.JSX.Element;
|
|
1047
|
+
declare function PrivanaInlineModal({ className, showLockedFunds, defaultTab, onDepositSuccess, }: {
|
|
1048
|
+
className?: string;
|
|
1049
|
+
showLockedFunds?: boolean;
|
|
1050
|
+
defaultTab?: 'deposit' | 'withdraw';
|
|
1051
|
+
onDepositSuccess?: () => void;
|
|
1052
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1053
|
+
|
|
1054
|
+
declare function Skeleton({ className, ...props }: React.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
1055
|
+
|
|
1056
|
+
declare function getTokenIcon(symbol: string, size?: number): react_jsx_runtime.JSX.Element;
|
|
1057
|
+
declare function getChainIcon(chainId: number, size?: number): react_jsx_runtime.JSX.Element;
|
|
1058
|
+
|
|
1059
|
+
export { AccountingApiError, type Address, type BalanceResponse, type BatchBalancesRequest, type BatchBalancesResponse, Button, type Bytes32, type ChainConfig, type DepositAddressRequest, type DepositAddressResponse, type DepositCheckRequest, type DepositCheckResponse, type DepositParams, type EIP712Domain, type ExpiredLocksResponse, HOSTED_AUTH_CLOCK_SKEW_MS, type HexString, type HistoryEntry, type HistoryKind, type HistoryRequest, type HistoryResponse, type HostedAuthAuthorizeUrlRequest, type HostedAuthCallback, type HostedAuthCallbackError, type HostedAuthCallbackSuccess, type HostedAuthConfig, HostedAuthError, type HostedAuthPendingTransaction, HostedAuthRequiredError, type HostedAuthResponseMode, type HostedAuthSession, HostedAuthStateMismatchError, type HostedAuthTokenExchangeRequest, type HostedAuthTokenExchangeResponse, HttpClient, type HttpClientConfig, type IntegerLike, type JwtLogoutRequest, type JwtLogoutResponse, type JwtRefreshRequest, type JwtRefreshResponse, LOCK_TYPES, type LockFundsParams, type LockFundsRequest, type LockInfo, type LockMessage, type LockNonceResponse, type LockedFundsResponse, MODIFY_LOCK_TYPES, type MinDepositAmounts, type ModifyLockMessage, type ModifyLockNonceResponse, type ModifyLockParams, type ModifyLockRequest, NETWORK_CONFIG, type Network, type NetworkConfig, NetworkError, type PendingWithdrawalsResponse, PrivanaButton, type PrivanaButtonProps, PrivanaClient, type PrivanaClientConfig, type PrivanaContextValue, PrivanaInlineModal, PrivanaModal, PrivanaProvider, type PrivanaProviderProps, SUPPORTED_CHAINS, type SignLockParams, type SignModifyLockParams, type SignTransferLockedParams, type SignTransferParams, type SignWithdrawFromLockParams, type SignWithdrawParams, type SiweDomainResponse, type SiweLoginRequest, type SiweLoginResponse, type SiweNonceResponse, Skeleton, TRANSFER_LOCKED_TYPES, TRANSFER_TYPES, type TokenBalance, type TokenConfig, type TokenInfoResponse, type TokenListResponse, type TokensStatus, type TotalLockedBalanceResponse, type TransactionSubmissionResponse, type TransferFundsRequest, type TransferLockedFundsRequest, type TransferLockedMessage, type TransferLockedNonceResponse, type TransferLockedParams, type TransferMessage, type TransferNonceResponse, type TransferParams, type UnlockAllExpiredRequest, type UnlockFundsParams, type UnlockFundsRequest, type UseBalanceOptions, type UseBalanceResult, type UseBatchBalancesOptions, type UseBatchBalancesResult, type UseDepositOptions, type UseDepositResult, type UseExpiredLocksOptions, type UseExpiredLocksResult, type UseHistoryOptions, type UseHistoryResult, type UseHostedRedirectAuthResult, type UseLockFundsOptions, type UseLockFundsResult, type UseLockedFundsOptions, type UseLockedFundsResult, type UseModifyLockOptions, type UseModifyLockResult, 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, WITHDRAW_FROM_LOCK_TYPES, WITHDRAW_TYPES, type WithdrawFromLockMessage, type WithdrawFromLockRequest, type WithdrawMessage, type WithdrawParams, type WithdrawStep, type WithdrawalInfo, type WithdrawalInfoResponse, type WithdrawalNonceResponse, type WithdrawalRequest, applyRefreshResponse, buildHostedAuthSession, buttonVariants, clearHostedAuthPendingTransaction, createDomain, createHostedAuthPendingStorageKey, createHostedAuthState, createHostedAuthStorageKey, createLockExpiry, createPkceChallenge, createPkceVerifier, getAccountingContract, getApiUrl, getChainById, getChainIcon, getChainId, getExplorerAddressUrl, getTokenIcon, isHostedAuthRefreshActive, isHostedAuthSessionActive, normalizeAddress, normalizeHex, parseHostedAuthCallback, persistHostedAuthPendingTransaction, readHostedAuthPendingTransaction, readStoredHostedAuthSession, signLockMessage, signModifyLockMessage, signTransferLockedMessage, signTransferMessage, signWithdrawFromLockMessage, signWithdrawMessage, stripHostedAuthCallbackParams, syncHostedAuthSessionToClient, useBalance, useBatchBalances, useDeposit, useExpiredLocks, useHistory, useHostedRedirectAuth, useLockFunds, useLockedFunds, useModifyLock, usePendingWithdrawals, usePrivanaClient, usePrivanaContext, useSafeAccount, useSafePrivanaContext, useTokenInfo, useTokenList, useTotalLockedBalance, useTransfer, useUnlockFunds, useWithdraw };
|