@supanovaapp/sdk 0.2.0 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -6
- package/dist/index.cjs.js +521 -519
- package/dist/index.d.ts +1459 -0
- package/dist/index.esm.js +58289 -52904
- package/package.json +10 -6
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1459 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supa SDK
|
|
3
|
+
*
|
|
4
|
+
* React SDK for seamless integration with Supa Backend API and Privy.io authentication,
|
|
5
|
+
* featuring full Canton Network support with Ed25519 signing via Stellar wallets.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* Basic setup
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import { SupaProvider, useAuth, useCanton } from '@supa/sdk';
|
|
13
|
+
*
|
|
14
|
+
* function App() {
|
|
15
|
+
* return (
|
|
16
|
+
* <SupaProvider config={{ privyAppId: 'your_app_id' }}>
|
|
17
|
+
* <Dashboard />
|
|
18
|
+
* </SupaProvider>
|
|
19
|
+
* );
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* function Dashboard() {
|
|
23
|
+
* const { login, authenticated } = useAuth();
|
|
24
|
+
* const { registerCanton, isRegistered } = useCanton();
|
|
25
|
+
*
|
|
26
|
+
* if (!authenticated) {
|
|
27
|
+
* return <button onClick={login}>Login</button>;
|
|
28
|
+
* }
|
|
29
|
+
*
|
|
30
|
+
* if (!isRegistered) {
|
|
31
|
+
* return <button onClick={registerCanton}>Register Canton</button>;
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
34
|
+
* return <div>Ready to use Canton Network!</div>;
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @see {@link https://github.com/your-repo/supa-sdk | GitHub Repository}
|
|
39
|
+
* @see {@link https://docs.privy.io | Privy Documentation}
|
|
40
|
+
* @see {@link https://canton.network | Canton Network}
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
import { AxiosRequestConfig } from 'axios';
|
|
44
|
+
import { JSX } from 'react/jsx-runtime';
|
|
45
|
+
import { ReactNode } from 'react';
|
|
46
|
+
import { User } from '@privy-io/react-auth';
|
|
47
|
+
import { useSignRawHash } from '@privy-io/react-auth/extended-chains';
|
|
48
|
+
import { useSmartWallets as useSmartWallets_2 } from '@privy-io/react-auth/smart-wallets';
|
|
49
|
+
|
|
50
|
+
export declare interface AccountTokenBalance {
|
|
51
|
+
contractAddress: string;
|
|
52
|
+
tokenBalance: string;
|
|
53
|
+
error?: any | null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export declare interface AccountTokensBalancesResponse {
|
|
57
|
+
address: string;
|
|
58
|
+
tokenBalances: AccountTokenBalance[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export declare type AlchemyNetwork = 'eth-mainnet' | 'arb-mainnet' | 'opt-mainnet' | 'polygon-mainnet';
|
|
62
|
+
|
|
63
|
+
export declare class ApiClient {
|
|
64
|
+
private client;
|
|
65
|
+
private getAccessToken?;
|
|
66
|
+
private nodeIdentifier;
|
|
67
|
+
constructor(config?: ClientConfig);
|
|
68
|
+
get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
69
|
+
post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
|
70
|
+
put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
|
71
|
+
delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
72
|
+
patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
|
73
|
+
setAccessTokenGetter(getter: () => Promise<string | null>): void;
|
|
74
|
+
getBaseURL(): string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export declare interface ApiError {
|
|
78
|
+
statusCode: number;
|
|
79
|
+
message: string;
|
|
80
|
+
error?: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export declare interface ApiResponse<T = any> {
|
|
84
|
+
data?: T;
|
|
85
|
+
error?: ApiError;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export declare class ApiService {
|
|
89
|
+
private client;
|
|
90
|
+
constructor(client: ApiClient);
|
|
91
|
+
/**
|
|
92
|
+
* Get current user information
|
|
93
|
+
* GET /user/me
|
|
94
|
+
*/
|
|
95
|
+
getCurrentUser(): Promise<UserResponseDto>;
|
|
96
|
+
/**
|
|
97
|
+
* Get all users
|
|
98
|
+
* GET /user/all
|
|
99
|
+
*/
|
|
100
|
+
getAllUsers(): Promise<UserResponseDto[]>;
|
|
101
|
+
/**
|
|
102
|
+
* Get user by Privy user ID
|
|
103
|
+
* GET /user/{privyUserId}
|
|
104
|
+
*/
|
|
105
|
+
getUserByPrivyId(privyUserId: string): Promise<UserResponseDto>;
|
|
106
|
+
/**
|
|
107
|
+
* Get current user's smart wallet token balances
|
|
108
|
+
* GET /user/smart_wallet_balances
|
|
109
|
+
*/
|
|
110
|
+
getSmartWalletBalances(force?: boolean): Promise<UserBalanceResponseDto>;
|
|
111
|
+
/**
|
|
112
|
+
* Create new dialog
|
|
113
|
+
* POST /dialogs
|
|
114
|
+
*/
|
|
115
|
+
createDialog(text: string): Promise<DialogWithMessagesResponseDto>;
|
|
116
|
+
/**
|
|
117
|
+
* Get all user dialogs
|
|
118
|
+
* GET /dialogs
|
|
119
|
+
*/
|
|
120
|
+
getAllDialogs(params?: PaginationParams): Promise<OffsetPaginatedDto<DialogListResponseDto>>;
|
|
121
|
+
/**
|
|
122
|
+
* Get specific dialog
|
|
123
|
+
* GET /dialogs/{id}
|
|
124
|
+
*/
|
|
125
|
+
getDialog(id: number): Promise<DialogListResponseDto>;
|
|
126
|
+
/**
|
|
127
|
+
* Delete dialog
|
|
128
|
+
* DELETE /dialogs/{id}
|
|
129
|
+
*/
|
|
130
|
+
deleteDialog(id: number): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Create new message in dialog
|
|
133
|
+
* POST /dialogs/{dialogId}/messages
|
|
134
|
+
*/
|
|
135
|
+
createMessage(dialogId: number, text: string): Promise<MessageResponseDto>;
|
|
136
|
+
/**
|
|
137
|
+
* Get all messages in dialog
|
|
138
|
+
* GET /dialogs/{dialogId}/messages
|
|
139
|
+
*/
|
|
140
|
+
getDialogMessages(dialogId: number, params?: PaginationParams): Promise<OffsetPaginatedDto<MessageResponseDto>>;
|
|
141
|
+
/**
|
|
142
|
+
* Get specific message
|
|
143
|
+
* GET /messages/{id}
|
|
144
|
+
*/
|
|
145
|
+
getMessage(id: number): Promise<MessageResponseDto>;
|
|
146
|
+
/**
|
|
147
|
+
* Get token prices by contract addresses
|
|
148
|
+
* POST /onchain/tokens_prices_by_addresses
|
|
149
|
+
*/
|
|
150
|
+
getTokenPricesByAddresses(addresses: Array<{
|
|
151
|
+
network: AlchemyNetwork;
|
|
152
|
+
contractAddress: string;
|
|
153
|
+
}>): Promise<NetworkAddressAndPriceDto[]>;
|
|
154
|
+
/**
|
|
155
|
+
* Get token prices by symbols
|
|
156
|
+
* GET /onchain/tokens_prices
|
|
157
|
+
* @param symbols Array of token symbols (e.g., ['BTC', 'ETH', 'USDT'])
|
|
158
|
+
*/
|
|
159
|
+
getTokenPrices(symbols: string[]): Promise<Record<string, number>>;
|
|
160
|
+
/**
|
|
161
|
+
* Get token price history
|
|
162
|
+
* GET /onchain/token_price_history
|
|
163
|
+
*/
|
|
164
|
+
getTokenPriceHistory(params: TokenPriceHistoryParams): Promise<TokenPriceHistoryResponse>;
|
|
165
|
+
/**
|
|
166
|
+
* Get 24hr price changes for tokens
|
|
167
|
+
* POST /onchain/tokens_24hr_changes
|
|
168
|
+
*/
|
|
169
|
+
getTokens24hrPriceChanges(tokens: Array<{
|
|
170
|
+
network: AlchemyNetwork;
|
|
171
|
+
contractAddress: string;
|
|
172
|
+
}>): Promise<TokenInfoWithPriceChangeDto[]>;
|
|
173
|
+
/**
|
|
174
|
+
* Get token info by address(es)
|
|
175
|
+
* GET /onchain/token_info/{network}
|
|
176
|
+
* @param network Blockchain network
|
|
177
|
+
* @param addresses Single address or array of addresses
|
|
178
|
+
*/
|
|
179
|
+
getTokenInfo(network: string, addresses: string | string[]): Promise<Record<string, TokenInfo>>;
|
|
180
|
+
/**
|
|
181
|
+
* Get account token balances
|
|
182
|
+
* GET /onchain/account_tokens_balances/{network}
|
|
183
|
+
*/
|
|
184
|
+
getAccountTokenBalances(network: string, account: string, force?: boolean): Promise<AccountTokensBalancesResponse>;
|
|
185
|
+
/**
|
|
186
|
+
* Get user transactions
|
|
187
|
+
* GET /transactions
|
|
188
|
+
*/
|
|
189
|
+
getTransactions(params?: TransactionQueryParams): Promise<any>;
|
|
190
|
+
/**
|
|
191
|
+
* Force load user transactions
|
|
192
|
+
* POST /transactions/transactions_force
|
|
193
|
+
*/
|
|
194
|
+
forceLoadTransactions(params?: TransactionQueryParams): Promise<any>;
|
|
195
|
+
/**
|
|
196
|
+
* Get SupaPoints balance
|
|
197
|
+
* GET /supa_points/balance
|
|
198
|
+
*/
|
|
199
|
+
getSupaPointsBalance(): Promise<SupaPointsBalanceResponseDto>;
|
|
200
|
+
/**
|
|
201
|
+
* Get SupaPoints history
|
|
202
|
+
* GET /supa_points/history
|
|
203
|
+
*/
|
|
204
|
+
getSupaPointsHistory(params?: SupaPointsHistoryParams): Promise<OffsetPaginatedDto<any>>;
|
|
205
|
+
/**
|
|
206
|
+
* Process daily login
|
|
207
|
+
* POST /supa_points/daily_login
|
|
208
|
+
*/
|
|
209
|
+
dailyLogin(): Promise<DailyLoginResponseDto>;
|
|
210
|
+
/**
|
|
211
|
+
* Check if paymaster can sponsor user operation
|
|
212
|
+
* POST /paymaster
|
|
213
|
+
*/
|
|
214
|
+
checkPaymasterSponsorship(request: PaymasterRequestDto): Promise<PaymasterResponseDto>;
|
|
215
|
+
/**
|
|
216
|
+
* Get Privy balance
|
|
217
|
+
* GET /privy/balance
|
|
218
|
+
*/
|
|
219
|
+
getPrivyBalance(): Promise<any>;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Converts base64 string to Uint8Array
|
|
224
|
+
* @param base64 - Base64 encoded string
|
|
225
|
+
* @returns Byte array
|
|
226
|
+
*/
|
|
227
|
+
export declare const base64ToBytes: (base64: string) => Uint8Array;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Converts base64 string to hex format
|
|
231
|
+
* @param base64 - Base64 encoded string
|
|
232
|
+
* @returns Hex string with 0x prefix
|
|
233
|
+
* @example
|
|
234
|
+
* ```ts
|
|
235
|
+
* const hex = base64ToHex('SGVsbG8=');
|
|
236
|
+
* console.log(hex); // "0x48656c6c6f"
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
export declare const base64ToHex: (base64: string) => string;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Converts Uint8Array to base64 string
|
|
243
|
+
* @param bytes - Byte array to convert
|
|
244
|
+
* @returns Base64 encoded string
|
|
245
|
+
*/
|
|
246
|
+
export declare const bytesToBase64: (bytes: Uint8Array) => string;
|
|
247
|
+
|
|
248
|
+
export declare interface CantonActiveContract {
|
|
249
|
+
/** Contract ID */
|
|
250
|
+
contractId: string;
|
|
251
|
+
/** Template ID */
|
|
252
|
+
templateId: string;
|
|
253
|
+
/** Contract blob data (untyped) */
|
|
254
|
+
blob: unknown;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** Active contract response item from API */
|
|
258
|
+
export declare interface CantonActiveContractItem {
|
|
259
|
+
/** Workflow ID (can be empty) */
|
|
260
|
+
workflowId: string;
|
|
261
|
+
/** Contract entry containing the active contract */
|
|
262
|
+
contractEntry: CantonContractEntry;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** Response from /canton/api/active_contracts */
|
|
266
|
+
export declare type CantonActiveContractsResponseDto = CantonActiveContractItem[];
|
|
267
|
+
|
|
268
|
+
/** Amount with rate decay for Canton Amulet */
|
|
269
|
+
export declare interface CantonAmuletAmount {
|
|
270
|
+
/** Initial amount as decimal string */
|
|
271
|
+
initialAmount: string;
|
|
272
|
+
/** Round number when created */
|
|
273
|
+
createdAt: {
|
|
274
|
+
number: string;
|
|
275
|
+
};
|
|
276
|
+
/** Rate per round for decay */
|
|
277
|
+
ratePerRound: {
|
|
278
|
+
rate: string;
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** Create argument for Canton Amulet contract */
|
|
283
|
+
export declare interface CantonAmuletCreateArgument {
|
|
284
|
+
/** DSO party ID */
|
|
285
|
+
dso: string;
|
|
286
|
+
/** Owner party ID */
|
|
287
|
+
owner: string;
|
|
288
|
+
/** Amount with rate */
|
|
289
|
+
amount: CantonAmuletAmount;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/** Contract entry wrapper */
|
|
293
|
+
export declare interface CantonContractEntry {
|
|
294
|
+
JsActiveContract: CantonJsActiveContract;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/** Created event for Canton contract */
|
|
298
|
+
export declare interface CantonCreatedEvent {
|
|
299
|
+
/** Offset in ledger */
|
|
300
|
+
offset: number;
|
|
301
|
+
/** Node ID */
|
|
302
|
+
nodeId: number;
|
|
303
|
+
/** Contract ID */
|
|
304
|
+
contractId: string;
|
|
305
|
+
/** Template ID in format packageId:module:entity */
|
|
306
|
+
templateId: string;
|
|
307
|
+
/** Contract key (can be null) */
|
|
308
|
+
contractKey: unknown | null;
|
|
309
|
+
/** Create argument data */
|
|
310
|
+
createArgument: CantonAmuletCreateArgument | Record<string, unknown>;
|
|
311
|
+
/** Created event blob (base64) */
|
|
312
|
+
createdEventBlob: string;
|
|
313
|
+
/** Interface views */
|
|
314
|
+
interfaceViews: unknown[];
|
|
315
|
+
/** Witness parties */
|
|
316
|
+
witnessParties: string[];
|
|
317
|
+
/** Signatories */
|
|
318
|
+
signatories: string[];
|
|
319
|
+
/** Observers */
|
|
320
|
+
observers: string[];
|
|
321
|
+
/** Created timestamp (ISO 8601) */
|
|
322
|
+
createdAt: string;
|
|
323
|
+
/** Package name */
|
|
324
|
+
packageName: string;
|
|
325
|
+
/** Representative package ID */
|
|
326
|
+
representativePackageId: string;
|
|
327
|
+
/** ACS delta flag */
|
|
328
|
+
acsDelta: boolean;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/** Lock information for locked UTXO */
|
|
332
|
+
export declare interface CantonHoldingLockDto {
|
|
333
|
+
/** Party IDs holding the lock */
|
|
334
|
+
holders: string[];
|
|
335
|
+
/** Lock expiration timestamp (ISO 8601, can be null) */
|
|
336
|
+
expiresAt: string | null;
|
|
337
|
+
/** Relative expiration duration (can be null) */
|
|
338
|
+
expiresAfter: Record<string, unknown> | null;
|
|
339
|
+
/** Context describing why the UTXO is locked (can be null) */
|
|
340
|
+
context: string | null;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/** Canton instrument/token identifier */
|
|
344
|
+
export declare interface CantonInstrumentIdDto {
|
|
345
|
+
/** DSO party ID (instrument administrator) */
|
|
346
|
+
admin: string;
|
|
347
|
+
/** Token identifier (e.g., "Amulet" for Canton Coin) */
|
|
348
|
+
id: string;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** Active contract in Canton */
|
|
352
|
+
export declare interface CantonJsActiveContract {
|
|
353
|
+
/** Created event with all contract details */
|
|
354
|
+
createdEvent: CantonCreatedEvent;
|
|
355
|
+
/** Synchronizer ID */
|
|
356
|
+
synchronizerId: string;
|
|
357
|
+
/** Reassignment counter */
|
|
358
|
+
reassignmentCounter: number;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/** Locked UTXO with lock information */
|
|
362
|
+
export declare interface CantonLockedUtxoDto {
|
|
363
|
+
/** Contract ID of the locked UTXO */
|
|
364
|
+
contractId: string;
|
|
365
|
+
/** Locked amount as decimal string */
|
|
366
|
+
amount: string;
|
|
367
|
+
/** Lock information including holders, expiration, and context */
|
|
368
|
+
lock: CantonHoldingLockDto;
|
|
369
|
+
/** UTXO metadata including creation info and demurrage rate */
|
|
370
|
+
metadata: CantonUtxoMetadataDto;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export declare interface CantonMeResponseDto {
|
|
374
|
+
/** Canton party ID */
|
|
375
|
+
partyId: string;
|
|
376
|
+
/** User email (can be null if not set) */
|
|
377
|
+
email: string | null;
|
|
378
|
+
/** Indicates whether the transfer preapproval is set and NOT EXPIRED for the party */
|
|
379
|
+
transferPreapprovalSet: boolean;
|
|
380
|
+
/** Transfer preapproval expiration date (ISO 8601, can be null) */
|
|
381
|
+
transferPreapprovalExpiresAt: string | null;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/** Request for preparing Amulet (Canton Coin) transfer */
|
|
385
|
+
export declare interface CantonPrepareAmuletTransferRequestDto {
|
|
386
|
+
/** Canton party ID of the receiver wallet */
|
|
387
|
+
receiverPartyId: string;
|
|
388
|
+
/** Amount of Amulet to transfer (decimal string with max 10 decimal places) */
|
|
389
|
+
amount: string;
|
|
390
|
+
/** Optional memo for the transfer */
|
|
391
|
+
memo?: string;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export declare interface CantonPrepareRegisterRequestDto {
|
|
395
|
+
/** Base64 stellar public key from privy */
|
|
396
|
+
publicKey: string;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export declare interface CantonPrepareTapRequestDto {
|
|
400
|
+
/** Positive integer amount of how many canton coins to receive */
|
|
401
|
+
amount: string;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export declare interface CantonPrepareTransactionRequestDto {
|
|
405
|
+
/** Command or array of commands */
|
|
406
|
+
commands: unknown;
|
|
407
|
+
/** Optional disclosed contracts */
|
|
408
|
+
disclosedContracts?: unknown;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export declare interface CantonPrepareTransactionResponseDto {
|
|
412
|
+
/** Base64 hash to be signed by the user */
|
|
413
|
+
hash: string;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export declare interface CantonQueryCompletionResponseDto {
|
|
417
|
+
/** Status of the completion query */
|
|
418
|
+
status: CantonQueryCompletionStatus;
|
|
419
|
+
/** Completion data (nullable, present when status is 'completed') */
|
|
420
|
+
data: Record<string, unknown> | null;
|
|
421
|
+
/** Message explaining the status */
|
|
422
|
+
message: string;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export declare type CantonQueryCompletionStatus = 'completed' | 'unknown';
|
|
426
|
+
|
|
427
|
+
export declare interface CantonRegisterParams {
|
|
428
|
+
/** Base64 public key from Stellar wallet */
|
|
429
|
+
publicKey: string;
|
|
430
|
+
/** Function to sign hash (returns signature in hex) */
|
|
431
|
+
signFunction: (hashHex: string) => Promise<string>;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
export declare class CantonService {
|
|
435
|
+
private client;
|
|
436
|
+
constructor(client: ApiClient);
|
|
437
|
+
/**
|
|
438
|
+
* Register Canton wallet
|
|
439
|
+
* Flow:
|
|
440
|
+
* 1. Call /canton/register/prepare with publicKey -> get hash
|
|
441
|
+
* 2. Sign hash with Stellar wallet
|
|
442
|
+
* 3. Call /canton/register/submit with hash + signature
|
|
443
|
+
*
|
|
444
|
+
* @param params Registration parameters
|
|
445
|
+
*/
|
|
446
|
+
registerCanton(params: CantonRegisterParams, errCounter?: number): Promise<void>;
|
|
447
|
+
/**
|
|
448
|
+
* Tap devnet faucet to receive test Canton coins
|
|
449
|
+
* Flow:
|
|
450
|
+
* 1. Call /canton/devnet/tap with amount -> get hash
|
|
451
|
+
* 2. Sign hash with Stellar wallet
|
|
452
|
+
* 3. Call /canton/api/submit_prepared with hash + signature
|
|
453
|
+
* 4. Poll for completion
|
|
454
|
+
*
|
|
455
|
+
* @param params Tap parameters
|
|
456
|
+
* @param options Polling options
|
|
457
|
+
*/
|
|
458
|
+
tapDevnet(params: CantonTapParams, options?: CantonSubmitPreparedOptions): Promise<CantonQueryCompletionResponseDto>;
|
|
459
|
+
/**
|
|
460
|
+
* Submit signed Canton transaction
|
|
461
|
+
* @param hash Base64 hash
|
|
462
|
+
* @param signature Base64 signature
|
|
463
|
+
*/
|
|
464
|
+
submitPrepared(hash: string, signature: string): Promise<CantonSubmitTransactionResponseDto>;
|
|
465
|
+
/**
|
|
466
|
+
* Query completion status for a submission
|
|
467
|
+
* @param submissionId Submission ID from submitPrepared
|
|
468
|
+
*/
|
|
469
|
+
queryCompletion(submissionId: string): Promise<CantonQueryCompletionResponseDto>;
|
|
470
|
+
/**
|
|
471
|
+
* Submit signed Canton transaction and wait for completion
|
|
472
|
+
* Polls the ledger API until the transaction is completed or timeout is reached
|
|
473
|
+
* @param hash Base64 hash
|
|
474
|
+
* @param signature Base64 signature
|
|
475
|
+
* @param options Polling options (timeout, pollInterval)
|
|
476
|
+
* @returns Completion data when transaction is completed
|
|
477
|
+
* @throws Error if timeout is reached before completion
|
|
478
|
+
*/
|
|
479
|
+
submitPreparedAndWait(hash: string, signature: string, options?: CantonSubmitPreparedOptions): Promise<CantonQueryCompletionResponseDto>;
|
|
480
|
+
/**
|
|
481
|
+
* Get current Canton user info (partyId and email)
|
|
482
|
+
* Only works after registration
|
|
483
|
+
*/
|
|
484
|
+
getMe(): Promise<CantonMeResponseDto>;
|
|
485
|
+
/**
|
|
486
|
+
* Get active contracts with optional template filtering
|
|
487
|
+
* Returns array of active contract items with full contract details
|
|
488
|
+
* @param templateIds Optional array of template IDs to filter by
|
|
489
|
+
*/
|
|
490
|
+
getActiveContracts(templateIds?: string[]): Promise<CantonActiveContractsResponseDto>;
|
|
491
|
+
/**
|
|
492
|
+
* Sign text message (client-side only, no backend call)
|
|
493
|
+
* Converts text to bytes and signs with Stellar wallet
|
|
494
|
+
* @param message Text message to sign
|
|
495
|
+
* @param signFunction Function to sign hash (returns signature in hex)
|
|
496
|
+
*/
|
|
497
|
+
signMessage(message: string, signFunction: (hashHex: string) => Promise<string>): Promise<string>;
|
|
498
|
+
/**
|
|
499
|
+
* Prepare Canton transaction
|
|
500
|
+
* @param commands Command or array of commands
|
|
501
|
+
* @param disclosedContracts Optional disclosed contracts
|
|
502
|
+
*/
|
|
503
|
+
prepareTransaction(commands: unknown, disclosedContracts?: unknown): Promise<CantonPrepareTransactionResponseDto>;
|
|
504
|
+
/**
|
|
505
|
+
* Check if user has Canton wallet registered
|
|
506
|
+
* This is inferred - if /me succeeds, user has wallet
|
|
507
|
+
*/
|
|
508
|
+
checkRegistrationStatus(): Promise<boolean>;
|
|
509
|
+
/**
|
|
510
|
+
* Prepare transfer preapproval
|
|
511
|
+
* Flow: prepare -> sign -> submit
|
|
512
|
+
* No request body required
|
|
513
|
+
*/
|
|
514
|
+
prepareTransferPreapproval(): Promise<CantonPrepareTransactionResponseDto>;
|
|
515
|
+
/**
|
|
516
|
+
* Get Canton wallet balances
|
|
517
|
+
* Returns balances for all tokens grouped by instrument ID
|
|
518
|
+
* Includes unlocked and locked UTXOs
|
|
519
|
+
*/
|
|
520
|
+
getBalances(): Promise<CantonWalletBalancesResponseDto>;
|
|
521
|
+
/**
|
|
522
|
+
* Prepare Amulet (Canton Coin) transfer
|
|
523
|
+
* @param params Transfer parameters (receiverPartyId, amount, memo)
|
|
524
|
+
* @throws Error if amount has more than 10 decimal places
|
|
525
|
+
*/
|
|
526
|
+
prepareAmuletTransfer(params: CantonPrepareAmuletTransferRequestDto): Promise<CantonPrepareTransactionResponseDto>;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export declare interface CantonSubmitPreparedOptions {
|
|
530
|
+
/** Timeout in milliseconds to wait for completion (default: 30000) */
|
|
531
|
+
timeout?: number;
|
|
532
|
+
/** Polling interval in milliseconds (default: 1000) */
|
|
533
|
+
pollInterval?: number;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export declare interface CantonSubmitRegisterRequestDto {
|
|
537
|
+
/** Base64 hash provided for signing */
|
|
538
|
+
hash: string;
|
|
539
|
+
/** Base64 signature for provided hash */
|
|
540
|
+
signature: string;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
export declare interface CantonSubmitTransactionResponseDto {
|
|
544
|
+
/** Submission ID for tracking completion */
|
|
545
|
+
submissionId: string;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
export declare interface CantonTapParams {
|
|
549
|
+
/** Amount of Canton coins to receive */
|
|
550
|
+
amount: string;
|
|
551
|
+
/** Function to sign hash (returns signature in hex) */
|
|
552
|
+
signFunction: (hashHex: string) => Promise<string>;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/** Token balance with unlocked and locked UTXOs */
|
|
556
|
+
export declare interface CantonTokenBalanceDto {
|
|
557
|
+
/** Unique identifier for this token type */
|
|
558
|
+
instrumentId: CantonInstrumentIdDto;
|
|
559
|
+
/** Total unlocked balance as decimal string */
|
|
560
|
+
totalUnlockedBalance: string;
|
|
561
|
+
/** Total locked balance as decimal string */
|
|
562
|
+
totalLockedBalance: string;
|
|
563
|
+
/** Total balance (unlocked + locked) as decimal string */
|
|
564
|
+
totalBalance: string;
|
|
565
|
+
/** Number of unlocked UTXOs */
|
|
566
|
+
unlockedUtxoCount: number;
|
|
567
|
+
/** Number of locked UTXOs */
|
|
568
|
+
lockedUtxoCount: number;
|
|
569
|
+
/** List of unlocked UTXOs */
|
|
570
|
+
unlockedUtxos: CantonUnlockedUtxoDto[];
|
|
571
|
+
/** List of locked UTXOs */
|
|
572
|
+
lockedUtxos: CantonLockedUtxoDto[];
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/** Unlocked UTXO */
|
|
576
|
+
export declare interface CantonUnlockedUtxoDto {
|
|
577
|
+
/** Contract ID of the UTXO */
|
|
578
|
+
contractId: string;
|
|
579
|
+
/** Amount as decimal string */
|
|
580
|
+
amount: string;
|
|
581
|
+
/** UTXO metadata including creation info and demurrage rate */
|
|
582
|
+
metadata: CantonUtxoMetadataDto;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/** UTXO metadata including creation info and demurrage rate */
|
|
586
|
+
export declare interface CantonUtxoMetadataDto {
|
|
587
|
+
/** Round number when the UTXO was created */
|
|
588
|
+
createdInRound: string;
|
|
589
|
+
/** Demurrage rate per round (balance decrease rate for Canton Coin) */
|
|
590
|
+
demurrageRate: string;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/** Canton wallet balances response */
|
|
594
|
+
export declare interface CantonWalletBalancesResponseDto {
|
|
595
|
+
/** Party ID of the wallet owner */
|
|
596
|
+
partyId: string;
|
|
597
|
+
/** Token balances grouped by instrument ID */
|
|
598
|
+
tokens: CantonTokenBalanceDto[];
|
|
599
|
+
/** Timestamp when balances were fetched (ISO 8601) */
|
|
600
|
+
fetchedAt: string;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
export declare interface ClientConfig {
|
|
604
|
+
baseURL?: string;
|
|
605
|
+
nodeIdentifier: string;
|
|
606
|
+
getAccessToken?: () => Promise<string | null>;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
export declare function ConfirmationModal({ open, onClose, onConfirm, onReject, title, message, confirmText, rejectText, description, infoText, icon, loading, }: ConfirmationModalProps): JSX.Element;
|
|
610
|
+
|
|
611
|
+
export declare interface ConfirmationModalProps {
|
|
612
|
+
open: boolean;
|
|
613
|
+
onClose: () => void;
|
|
614
|
+
onConfirm: () => void;
|
|
615
|
+
onReject: () => void;
|
|
616
|
+
title?: ReactNode;
|
|
617
|
+
message: string;
|
|
618
|
+
confirmText?: string;
|
|
619
|
+
rejectText?: string;
|
|
620
|
+
description?: string;
|
|
621
|
+
infoText?: string;
|
|
622
|
+
icon?: ReactNode;
|
|
623
|
+
loading?: boolean;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
export declare interface ConfirmModalOptions {
|
|
627
|
+
title?: string;
|
|
628
|
+
message: string;
|
|
629
|
+
confirmText?: string;
|
|
630
|
+
rejectText?: string;
|
|
631
|
+
description?: string;
|
|
632
|
+
icon?: ReactNode;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
export declare function createApiClient(config?: ClientConfig): ApiClient;
|
|
636
|
+
|
|
637
|
+
export declare interface DailyLoginResponseDto {
|
|
638
|
+
/** Current SupaPoints balance */
|
|
639
|
+
balance: number;
|
|
640
|
+
/** SupaPoints balance change */
|
|
641
|
+
add: number;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
export declare interface DialogListResponseDto {
|
|
645
|
+
id: number;
|
|
646
|
+
createdAt: string;
|
|
647
|
+
updatedAt: string;
|
|
648
|
+
isProcessingNow: boolean;
|
|
649
|
+
firstMessage: string;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
export declare interface DialogWithMessagesResponseDto {
|
|
653
|
+
id: number;
|
|
654
|
+
createdAt: string;
|
|
655
|
+
updatedAt: string;
|
|
656
|
+
isProcessingNow: boolean;
|
|
657
|
+
messages: MessageResponseDto[];
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
export declare function getApiClient(): ApiClient;
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* Gets the first Stellar wallet from user and wallets array
|
|
664
|
+
* Convenience function that throws if no Stellar wallet is found
|
|
665
|
+
*
|
|
666
|
+
* @param user - Privy user object
|
|
667
|
+
* @param wallets - Privy wallets array from useWallets hook
|
|
668
|
+
* @returns First Stellar wallet found
|
|
669
|
+
* @throws {Error} If no Stellar wallet found
|
|
670
|
+
*
|
|
671
|
+
* @example
|
|
672
|
+
* ```ts
|
|
673
|
+
* try {
|
|
674
|
+
* const wallet = getFirstStellarWallet(user, wallets);
|
|
675
|
+
* console.log('Using wallet:', wallet.address);
|
|
676
|
+
* } catch (err) {
|
|
677
|
+
* console.error('No Stellar wallet available');
|
|
678
|
+
* }
|
|
679
|
+
* ```
|
|
680
|
+
*/
|
|
681
|
+
export declare const getFirstStellarWallet: (user: any, wallets: any[]) => StellarWallet;
|
|
682
|
+
|
|
683
|
+
export declare interface GetPricesByAddressesBodyDto {
|
|
684
|
+
/** Array of pairs of alchemy network and contract address */
|
|
685
|
+
addresses: Array<{
|
|
686
|
+
network: AlchemyNetwork;
|
|
687
|
+
contractAddress: string;
|
|
688
|
+
}>;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Converts Stellar wallet public key to Canton Network base64 format
|
|
693
|
+
* Handles removal of leading 00 byte and conversion from hex to base64
|
|
694
|
+
*
|
|
695
|
+
* @param wallet - Stellar wallet object containing publicKey
|
|
696
|
+
* @returns Public key in base64 format ready for Canton Network API
|
|
697
|
+
* @throws {Error} If wallet is invalid or publicKey is missing/malformed
|
|
698
|
+
*
|
|
699
|
+
* @example
|
|
700
|
+
* ```ts
|
|
701
|
+
* const publicKeyBase64 = getPublicKeyBase64(stellarWallet);
|
|
702
|
+
* // Use with Canton Network API
|
|
703
|
+
* await fetch('/canton/register/prepare', {
|
|
704
|
+
* body: JSON.stringify({ publicKey: publicKeyBase64 })
|
|
705
|
+
* });
|
|
706
|
+
* ```
|
|
707
|
+
*/
|
|
708
|
+
export declare const getPublicKeyBase64: (wallet: StellarWallet | any) => string;
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Extracts all Stellar wallets from Privy user and wallets array
|
|
712
|
+
* Combines wallets from both user.linkedAccounts and useWallets hook,
|
|
713
|
+
* removing duplicates by address.
|
|
714
|
+
*
|
|
715
|
+
* @param user - Privy user object
|
|
716
|
+
* @param wallets - Privy wallets array from useWallets hook
|
|
717
|
+
* @returns Array of unique Stellar wallets
|
|
718
|
+
*
|
|
719
|
+
* @example
|
|
720
|
+
* ```ts
|
|
721
|
+
* const { user } = usePrivy();
|
|
722
|
+
* const { wallets } = useWallets();
|
|
723
|
+
* const stellarWallets = getStellarWallets(user, wallets);
|
|
724
|
+
* console.log(`Found ${stellarWallets.length} Stellar wallets`);
|
|
725
|
+
* ```
|
|
726
|
+
*/
|
|
727
|
+
export declare const getStellarWallets: (user: any, wallets: any[]) => StellarWallet[];
|
|
728
|
+
|
|
729
|
+
export declare interface GetTokens24hrPriceChangeParams {
|
|
730
|
+
/** Array of pairs of alchemy network and contract address */
|
|
731
|
+
tokens: Array<{
|
|
732
|
+
network: AlchemyNetwork;
|
|
733
|
+
contractAddress: string;
|
|
734
|
+
}>;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Converts hex string to base64 format
|
|
739
|
+
* @param hex - Hex string (with or without 0x prefix)
|
|
740
|
+
* @returns Base64 encoded string
|
|
741
|
+
* @example
|
|
742
|
+
* ```ts
|
|
743
|
+
* const base64 = hexToBase64('0x48656c6c6f');
|
|
744
|
+
* console.log(base64); // "SGVsbG8="
|
|
745
|
+
* ```
|
|
746
|
+
*/
|
|
747
|
+
export declare const hexToBase64: (hex: string) => string;
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Type guard to check if a wallet is a Stellar wallet
|
|
751
|
+
* @param wallet - Wallet object to check
|
|
752
|
+
* @returns True if wallet is a valid Stellar wallet
|
|
753
|
+
*
|
|
754
|
+
* @example
|
|
755
|
+
* ```ts
|
|
756
|
+
* if (isStellarWallet(wallet)) {
|
|
757
|
+
* console.log('Stellar wallet address:', wallet.address);
|
|
758
|
+
* }
|
|
759
|
+
* ```
|
|
760
|
+
*/
|
|
761
|
+
export declare const isStellarWallet: (wallet: any) => wallet is StellarWallet;
|
|
762
|
+
|
|
763
|
+
export declare interface MessageResponseDto {
|
|
764
|
+
id: number;
|
|
765
|
+
dialogId: number;
|
|
766
|
+
text: string;
|
|
767
|
+
isReply: boolean;
|
|
768
|
+
date: string;
|
|
769
|
+
command?: any | null;
|
|
770
|
+
payload?: any | null;
|
|
771
|
+
actionSuggestions?: any | null;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
export declare interface ModalResult<T = void> {
|
|
775
|
+
confirmed: boolean;
|
|
776
|
+
data?: T;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
export declare interface NetworkAddressAndPriceDto {
|
|
780
|
+
/** Alchemy network */
|
|
781
|
+
network: string;
|
|
782
|
+
/** Contract address */
|
|
783
|
+
contractAddress: string;
|
|
784
|
+
/** USD price */
|
|
785
|
+
price: number;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
export declare interface NewDialogRequestDto {
|
|
789
|
+
text: string;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
export declare interface NewMessageRequestDto {
|
|
793
|
+
/** Message text content */
|
|
794
|
+
text: string;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
export declare interface OffsetPaginatedDto<T = any> {
|
|
798
|
+
data: T[];
|
|
799
|
+
pagination: OffsetPaginationDto;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
export declare interface OffsetPaginationDto {
|
|
803
|
+
limit: number;
|
|
804
|
+
currentPage: number;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* TypeScript types generated from Supa Backend API Swagger
|
|
809
|
+
* Based on OpenAPI 3.0.0 specification
|
|
810
|
+
*/
|
|
811
|
+
export declare type Order = 'ASC' | 'DESC';
|
|
812
|
+
|
|
813
|
+
export declare interface PaginationParams {
|
|
814
|
+
limit?: number;
|
|
815
|
+
page?: number;
|
|
816
|
+
order?: Order;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
export declare interface PaymasterRequestDataDto {
|
|
820
|
+
/** User operation hex-string */
|
|
821
|
+
userOperation: string;
|
|
822
|
+
/** Entrypoint address */
|
|
823
|
+
entryPoint: string;
|
|
824
|
+
/** Network ID */
|
|
825
|
+
chainId: number;
|
|
826
|
+
/** Sponsorship policy ID */
|
|
827
|
+
sponsorshipPolicyId: string;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
export declare interface PaymasterRequestDto {
|
|
831
|
+
/** Request type */
|
|
832
|
+
type: 'sponsorshipPolicy.webhook';
|
|
833
|
+
/** Request data */
|
|
834
|
+
data: PaymasterRequestDataDto;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
export declare interface PaymasterResponseDto {
|
|
838
|
+
sponsor: boolean;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Converts Privy public key (hex with leading 00) to Canton format (base64 without leading 00)
|
|
843
|
+
* This function handles the conversion from Privy's Stellar wallet public key format
|
|
844
|
+
* to Canton Network's expected base64 format.
|
|
845
|
+
*
|
|
846
|
+
* @param publicKeyHex - Public key in hex format from Privy (may include 0x prefix and leading 00)
|
|
847
|
+
* @returns Public key in base64 format for Canton Network
|
|
848
|
+
* @throws {Error} If conversion fails
|
|
849
|
+
*
|
|
850
|
+
* @example
|
|
851
|
+
* ```ts
|
|
852
|
+
* const wallet = { publicKey: '00e95cb2553361ed...' };
|
|
853
|
+
* const cantonKey = privyPublicKeyToCantonBase64(wallet.publicKey);
|
|
854
|
+
* // Use cantonKey for Canton Network API calls
|
|
855
|
+
* ```
|
|
856
|
+
*/
|
|
857
|
+
export declare const privyPublicKeyToCantonBase64: (publicKeyHex: string) => string;
|
|
858
|
+
|
|
859
|
+
export declare interface SendTransactionOptions {
|
|
860
|
+
onSuccess?: (result: CantonQueryCompletionResponseDto) => void;
|
|
861
|
+
onRejection?: () => void;
|
|
862
|
+
onError?: (error: Error) => void;
|
|
863
|
+
skipModal?: boolean;
|
|
864
|
+
modalTitle?: string;
|
|
865
|
+
modalDescription?: string;
|
|
866
|
+
modalConfirmText?: string;
|
|
867
|
+
modalRejectText?: string;
|
|
868
|
+
/** Custom content to display in modal instead of transaction hash */
|
|
869
|
+
modalDisplayContent?: string;
|
|
870
|
+
/** Show technical transaction details (command, contracts, hash) as JSON. Default: false */
|
|
871
|
+
showTechnicalDetails?: boolean;
|
|
872
|
+
submitOptions?: CantonSubmitPreparedOptions;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
export declare function SignMessageModal({ open, onClose, onConfirm, onReject, message, loading, title, description, confirmText, rejectText, }: SignMessageModalProps): JSX.Element;
|
|
876
|
+
|
|
877
|
+
export declare interface SignMessageModalOptions {
|
|
878
|
+
message: string;
|
|
879
|
+
title?: string;
|
|
880
|
+
description?: string;
|
|
881
|
+
confirmText?: string;
|
|
882
|
+
rejectText?: string;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
export declare interface SignMessageModalProps {
|
|
886
|
+
open: boolean;
|
|
887
|
+
onClose: () => void;
|
|
888
|
+
onConfirm: () => void;
|
|
889
|
+
onReject: () => void;
|
|
890
|
+
message: string;
|
|
891
|
+
loading?: boolean;
|
|
892
|
+
title?: string;
|
|
893
|
+
description?: string;
|
|
894
|
+
confirmText?: string;
|
|
895
|
+
rejectText?: string;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
export declare interface SignMessageOptions {
|
|
899
|
+
onSuccess?: (signature: string) => void;
|
|
900
|
+
onRejection?: () => void;
|
|
901
|
+
onError?: (error: Error) => void;
|
|
902
|
+
skipModal?: boolean;
|
|
903
|
+
title?: string;
|
|
904
|
+
description?: string;
|
|
905
|
+
confirmText?: string;
|
|
906
|
+
rejectText?: string;
|
|
907
|
+
/** Custom content to display in modal instead of message */
|
|
908
|
+
displayContent?: string;
|
|
909
|
+
/** Show technical details (address, chainType, hash) as JSON. Default: false */
|
|
910
|
+
showTechnicalDetails?: boolean;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
export declare interface SignRawHashModalOptions {
|
|
914
|
+
skipModal?: boolean;
|
|
915
|
+
title?: string;
|
|
916
|
+
description?: string;
|
|
917
|
+
confirmText?: string;
|
|
918
|
+
rejectText?: string;
|
|
919
|
+
infoText?: string;
|
|
920
|
+
/** Custom content to display instead of auto-generated JSON */
|
|
921
|
+
displayHash?: string;
|
|
922
|
+
/** Show technical details (address, chainType, hash) as JSON. Default: false */
|
|
923
|
+
showTechnicalDetails?: boolean;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
declare type SignRawHashParams = Parameters<ReturnType<typeof useSignRawHash>['signRawHash']>[0];
|
|
927
|
+
|
|
928
|
+
export declare function SignTransactionModal({ open, onClose, onConfirm, onReject, transaction, loading, title, description, confirmText, rejectText, infoText, }: SignTransactionModalProps): JSX.Element;
|
|
929
|
+
|
|
930
|
+
export declare interface SignTransactionModalOptions {
|
|
931
|
+
transaction: string;
|
|
932
|
+
title?: string;
|
|
933
|
+
description?: string;
|
|
934
|
+
confirmText?: string;
|
|
935
|
+
rejectText?: string;
|
|
936
|
+
infoText?: string;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
export declare interface SignTransactionModalProps {
|
|
940
|
+
open: boolean;
|
|
941
|
+
onClose: () => void;
|
|
942
|
+
onConfirm: () => void;
|
|
943
|
+
onReject: () => void;
|
|
944
|
+
transaction: string;
|
|
945
|
+
loading?: boolean;
|
|
946
|
+
title?: string;
|
|
947
|
+
description?: string;
|
|
948
|
+
confirmText?: string;
|
|
949
|
+
rejectText?: string;
|
|
950
|
+
infoText?: string;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* Stellar wallet utilities for Privy integration
|
|
955
|
+
* Stellar chain type is used for Ed25519 signing required by Canton Network
|
|
956
|
+
*/
|
|
957
|
+
/**
|
|
958
|
+
* Stellar wallet interface representing a Privy Stellar wallet
|
|
959
|
+
*/
|
|
960
|
+
export declare interface StellarWallet {
|
|
961
|
+
/** Stellar address (public key in Stellar format) */
|
|
962
|
+
address: string;
|
|
963
|
+
/** Raw public key in hex format */
|
|
964
|
+
publicKey: string;
|
|
965
|
+
/** Chain type, always 'stellar' for Stellar wallets */
|
|
966
|
+
chainType: 'stellar';
|
|
967
|
+
/** Wallet client type (e.g., 'privy') */
|
|
968
|
+
walletClientType?: string;
|
|
969
|
+
/** Whether the wallet was imported or created */
|
|
970
|
+
imported?: boolean;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* Removes leading 00 byte from hex string if present
|
|
975
|
+
* Required for Stellar public keys from Privy which include a leading 00 byte
|
|
976
|
+
* @param hex - Hex string (with or without 0x prefix)
|
|
977
|
+
* @returns Clean hex string with 0x prefix
|
|
978
|
+
* @example
|
|
979
|
+
* ```ts
|
|
980
|
+
* const clean = stripLeadingZero('0x00e95cb2553361ed...');
|
|
981
|
+
* console.log(clean); // "0xe95cb2553361ed..."
|
|
982
|
+
* ```
|
|
983
|
+
*/
|
|
984
|
+
export declare const stripLeadingZero: (hex: string) => string;
|
|
985
|
+
|
|
986
|
+
export declare interface SupaConfig {
|
|
987
|
+
privyAppId: string;
|
|
988
|
+
privyClientId?: string;
|
|
989
|
+
apiBaseUrl?: string;
|
|
990
|
+
nodeIdentifier: string;
|
|
991
|
+
appearance?: {
|
|
992
|
+
theme?: 'light' | 'dark';
|
|
993
|
+
accentColor?: string;
|
|
994
|
+
logo?: string;
|
|
995
|
+
};
|
|
996
|
+
loginMethods?: Array<'email' | 'wallet' | 'google' | 'twitter' | 'discord' | 'github' | 'linkedin'>;
|
|
997
|
+
smartWallets?: {
|
|
998
|
+
enabled?: boolean;
|
|
999
|
+
paymasterContext?: {
|
|
1000
|
+
mode?: string;
|
|
1001
|
+
calculateGasLimits?: boolean;
|
|
1002
|
+
expiryDuration?: number;
|
|
1003
|
+
sponsorshipInfo?: {
|
|
1004
|
+
webhookData?: Record<string, any>;
|
|
1005
|
+
smartAccountInfo?: {
|
|
1006
|
+
name?: string;
|
|
1007
|
+
version?: string;
|
|
1008
|
+
};
|
|
1009
|
+
};
|
|
1010
|
+
};
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
export declare interface SupaContextValue {
|
|
1015
|
+
apiClient: ApiClient;
|
|
1016
|
+
cantonService: CantonService;
|
|
1017
|
+
apiService: ApiService;
|
|
1018
|
+
config: SupaConfig;
|
|
1019
|
+
theme: 'light' | 'dark';
|
|
1020
|
+
confirm: (options: ConfirmModalOptions) => Promise<ModalResult>;
|
|
1021
|
+
signMessageConfirm: (options: SignMessageModalOptions) => Promise<ModalResult>;
|
|
1022
|
+
signTransactionConfirm: (options: SignTransactionModalOptions) => Promise<ModalResult>;
|
|
1023
|
+
setModalLoading: (loading: boolean) => void;
|
|
1024
|
+
closeModal: () => void;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
export declare interface SupaPointsBalanceResponseDto {
|
|
1028
|
+
/** Current SupaPoints balance */
|
|
1029
|
+
balance: number;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
export declare interface SupaPointsHistoryParams extends PaginationParams {
|
|
1033
|
+
startDate?: string;
|
|
1034
|
+
endDate?: string;
|
|
1035
|
+
action?: string;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
export declare function SupaProvider({ config, children }: SupaProviderProps): JSX.Element | null;
|
|
1039
|
+
|
|
1040
|
+
export declare interface SupaProviderProps {
|
|
1041
|
+
config: SupaConfig;
|
|
1042
|
+
children: ReactNode;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
export declare type TimeInterval = 'ONE_HOUR' | 'ONE_DAY' | 'ONE_MONTH' | 'ONE_YEAR' | 'ALL_TIME';
|
|
1046
|
+
|
|
1047
|
+
export declare interface TokenInfo {
|
|
1048
|
+
network: string;
|
|
1049
|
+
logo: string;
|
|
1050
|
+
name: string;
|
|
1051
|
+
website: string;
|
|
1052
|
+
description: string;
|
|
1053
|
+
explorer: string;
|
|
1054
|
+
type: string;
|
|
1055
|
+
symbol: string;
|
|
1056
|
+
decimals: number;
|
|
1057
|
+
status: string;
|
|
1058
|
+
tags: string[];
|
|
1059
|
+
id: string;
|
|
1060
|
+
links: any[];
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
export declare interface TokenInfoWithPriceChangeDto {
|
|
1064
|
+
/** Token name */
|
|
1065
|
+
name: string;
|
|
1066
|
+
/** Token symbol */
|
|
1067
|
+
symbol: string;
|
|
1068
|
+
/** Token logo */
|
|
1069
|
+
logo: string;
|
|
1070
|
+
/** Token description */
|
|
1071
|
+
description?: string | null;
|
|
1072
|
+
/** Decimals */
|
|
1073
|
+
decimals: number;
|
|
1074
|
+
/** Contract address */
|
|
1075
|
+
contractAddress: string;
|
|
1076
|
+
/** Network */
|
|
1077
|
+
network: string;
|
|
1078
|
+
/** Native token flag */
|
|
1079
|
+
native: boolean;
|
|
1080
|
+
/** Price change */
|
|
1081
|
+
priceChange: TokenPriceChange;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
export declare interface TokenPriceChange {
|
|
1085
|
+
currentPrice: number;
|
|
1086
|
+
oldPrice: number;
|
|
1087
|
+
priceChangeAbsolute: number;
|
|
1088
|
+
priceChangePercentage: number;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
export declare interface TokenPriceHistoryDataPoint {
|
|
1092
|
+
value: string;
|
|
1093
|
+
timestamp: string;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
export declare interface TokenPriceHistoryParams {
|
|
1097
|
+
contractAddress: string;
|
|
1098
|
+
network: AlchemyNetwork;
|
|
1099
|
+
interval?: TimeInterval;
|
|
1100
|
+
limit?: number;
|
|
1101
|
+
page?: number;
|
|
1102
|
+
order?: Order;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
export declare interface TokenPriceHistoryResponse {
|
|
1106
|
+
symbol: string;
|
|
1107
|
+
currency: string;
|
|
1108
|
+
data: TokenPriceHistoryDataPoint[];
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
export declare interface TransactionQueryParams {
|
|
1112
|
+
withScam?: boolean;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Return type for useAPI hook
|
|
1117
|
+
* Provides organized access to all backend API methods
|
|
1118
|
+
*/
|
|
1119
|
+
declare interface UseAPIReturn {
|
|
1120
|
+
/** User management and profile methods */
|
|
1121
|
+
user: {
|
|
1122
|
+
/** Fetches current authenticated user profile */
|
|
1123
|
+
getCurrent: () => Promise<UserResponseDto>;
|
|
1124
|
+
/** Fetches all users (admin only) */
|
|
1125
|
+
getAll: () => Promise<UserResponseDto[]>;
|
|
1126
|
+
/** Fetches user by Privy ID */
|
|
1127
|
+
getByPrivyId: (privyUserId: string) => Promise<UserResponseDto>;
|
|
1128
|
+
/** Fetches user's smart wallet token balances */
|
|
1129
|
+
getBalance: (force?: boolean) => Promise<UserBalanceResponseDto>;
|
|
1130
|
+
};
|
|
1131
|
+
/** AI dialog management methods */
|
|
1132
|
+
dialogs: {
|
|
1133
|
+
/** Creates a new AI dialog with initial message */
|
|
1134
|
+
create: (text: string) => Promise<DialogWithMessagesResponseDto>;
|
|
1135
|
+
/** Fetches all user dialogs with pagination */
|
|
1136
|
+
findAll: (params?: PaginationParams) => Promise<OffsetPaginatedDto<DialogListResponseDto>>;
|
|
1137
|
+
/** Fetches a specific dialog by ID */
|
|
1138
|
+
findOne: (id: number) => Promise<DialogListResponseDto>;
|
|
1139
|
+
/** Deletes a dialog and all its messages */
|
|
1140
|
+
delete: (id: number) => Promise<void>;
|
|
1141
|
+
};
|
|
1142
|
+
/** AI message methods within dialogs */
|
|
1143
|
+
messages: {
|
|
1144
|
+
/** Creates a new message in a dialog */
|
|
1145
|
+
create: (dialogId: number, text: string) => Promise<MessageResponseDto>;
|
|
1146
|
+
/** Fetches all messages in a dialog with pagination */
|
|
1147
|
+
findAll: (dialogId: number, params?: PaginationParams) => Promise<OffsetPaginatedDto<MessageResponseDto>>;
|
|
1148
|
+
/** Fetches a specific message by ID */
|
|
1149
|
+
findOne: (id: number) => Promise<MessageResponseDto>;
|
|
1150
|
+
};
|
|
1151
|
+
/** On-chain data and token price methods */
|
|
1152
|
+
onchain: {
|
|
1153
|
+
/** Fetches token prices by contract addresses */
|
|
1154
|
+
getPricesByAddresses: (addresses: Array<{
|
|
1155
|
+
network: AlchemyNetwork;
|
|
1156
|
+
contractAddress: string;
|
|
1157
|
+
}>) => Promise<NetworkAddressAndPriceDto[]>;
|
|
1158
|
+
/** Fetches token prices by symbols (BTC, ETH, etc.) */
|
|
1159
|
+
getTokenPrices: (symbols: string[]) => Promise<Record<string, number>>;
|
|
1160
|
+
/** Fetches historical price data for a token */
|
|
1161
|
+
getPriceHistory: (params: TokenPriceHistoryParams) => Promise<TokenPriceHistoryResponse>;
|
|
1162
|
+
/** Fetches 24-hour price changes for tokens */
|
|
1163
|
+
get24hrPriceChanges: (tokens: Array<{
|
|
1164
|
+
network: AlchemyNetwork;
|
|
1165
|
+
contractAddress: string;
|
|
1166
|
+
}>) => Promise<TokenInfoWithPriceChangeDto[]>;
|
|
1167
|
+
/** Fetches detailed token information */
|
|
1168
|
+
getTokenInfo: (network: string, addresses: string | string[]) => Promise<Record<string, TokenInfo>>;
|
|
1169
|
+
/** Fetches token balances for an account */
|
|
1170
|
+
getAccountBalances: (network: string, account: string, force?: boolean) => Promise<AccountTokensBalancesResponse>;
|
|
1171
|
+
};
|
|
1172
|
+
/** Transaction history methods */
|
|
1173
|
+
transactions: {
|
|
1174
|
+
/** Fetches user transaction history */
|
|
1175
|
+
get: (params?: TransactionQueryParams) => Promise<any>;
|
|
1176
|
+
/** Forces reload of transaction history from blockchain */
|
|
1177
|
+
forceLoad: (params?: TransactionQueryParams) => Promise<any>;
|
|
1178
|
+
};
|
|
1179
|
+
/** SupaPoints reward system methods */
|
|
1180
|
+
supaPoints: {
|
|
1181
|
+
/** Fetches current SupaPoints balance */
|
|
1182
|
+
getBalance: () => Promise<SupaPointsBalanceResponseDto>;
|
|
1183
|
+
/** Fetches SupaPoints transaction history */
|
|
1184
|
+
getHistory: (params?: SupaPointsHistoryParams) => Promise<OffsetPaginatedDto<any>>;
|
|
1185
|
+
/** Processes daily login bonus */
|
|
1186
|
+
dailyLogin: () => Promise<DailyLoginResponseDto>;
|
|
1187
|
+
};
|
|
1188
|
+
/** Paymaster sponsorship methods */
|
|
1189
|
+
paymaster: {
|
|
1190
|
+
/** Checks if transaction qualifies for gas sponsorship */
|
|
1191
|
+
checkSponsorship: (request: PaymasterRequestDto) => Promise<PaymasterResponseDto>;
|
|
1192
|
+
};
|
|
1193
|
+
/** Privy wallet methods */
|
|
1194
|
+
privy: {
|
|
1195
|
+
/** Fetches Privy embedded wallet balance */
|
|
1196
|
+
getBalance: () => Promise<any>;
|
|
1197
|
+
};
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
/**
|
|
1201
|
+
* Hook for managing user authentication via Privy
|
|
1202
|
+
* Automatically configures API client with access token when user authenticates
|
|
1203
|
+
*
|
|
1204
|
+
* @returns Authentication methods and user state
|
|
1205
|
+
*
|
|
1206
|
+
* @example
|
|
1207
|
+
* ```tsx
|
|
1208
|
+
* function LoginButton() {
|
|
1209
|
+
* const { login, logout, authenticated, user } = useAuth();
|
|
1210
|
+
*
|
|
1211
|
+
* if (!authenticated) {
|
|
1212
|
+
* return <button onClick={login}>Login</button>;
|
|
1213
|
+
* }
|
|
1214
|
+
*
|
|
1215
|
+
* return (
|
|
1216
|
+
* <div>
|
|
1217
|
+
* <p>Welcome, {user?.email?.address}!</p>
|
|
1218
|
+
* <button onClick={logout}>Logout</button>
|
|
1219
|
+
* </div>
|
|
1220
|
+
* );
|
|
1221
|
+
* }
|
|
1222
|
+
* ```
|
|
1223
|
+
*/
|
|
1224
|
+
export declare const useAuth: () => UseAuthReturn;
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
* Return type for useAuth hook
|
|
1228
|
+
*/
|
|
1229
|
+
export declare interface UseAuthReturn {
|
|
1230
|
+
/** Opens Privy login modal */
|
|
1231
|
+
login: () => void;
|
|
1232
|
+
/** Logs out the current user */
|
|
1233
|
+
logout: () => Promise<void>;
|
|
1234
|
+
/** Whether user is authenticated */
|
|
1235
|
+
authenticated: boolean;
|
|
1236
|
+
/** Whether authentication is in progress */
|
|
1237
|
+
loading: boolean;
|
|
1238
|
+
/** Privy user object containing linked accounts and profile data */
|
|
1239
|
+
user: User | null;
|
|
1240
|
+
/** Gets Privy JWT access token for authenticated API calls */
|
|
1241
|
+
getAccessToken: () => Promise<string | null>;
|
|
1242
|
+
/** Whether SDK is ready (not loading) */
|
|
1243
|
+
ready: boolean;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
/**
|
|
1247
|
+
* Hook for Canton Network operations
|
|
1248
|
+
*/
|
|
1249
|
+
export declare function useCanton(): UseCantonReturn;
|
|
1250
|
+
|
|
1251
|
+
export declare interface UseCantonReturn {
|
|
1252
|
+
/** First Stellar wallet (primary) */
|
|
1253
|
+
stellarWallet: StellarWallet | null;
|
|
1254
|
+
/** All Stellar wallets */
|
|
1255
|
+
stellarWallets: StellarWallet[];
|
|
1256
|
+
/** Create new Stellar wallet */
|
|
1257
|
+
createStellarWallet: () => Promise<StellarWallet | null>;
|
|
1258
|
+
/** Register Canton wallet on backend */
|
|
1259
|
+
registerCanton: () => Promise<void>;
|
|
1260
|
+
/** Whether Canton wallet is registered */
|
|
1261
|
+
isRegistered: boolean;
|
|
1262
|
+
/** Canton user info (partyId, email, transferPreapprovalSet) */
|
|
1263
|
+
cantonUser: CantonMeResponseDto | null;
|
|
1264
|
+
/** Get Canton user info */
|
|
1265
|
+
getMe: () => Promise<CantonMeResponseDto>;
|
|
1266
|
+
/** Get active contracts with optional filtering */
|
|
1267
|
+
getActiveContracts: (templateIds?: string[]) => Promise<CantonActiveContractsResponseDto>;
|
|
1268
|
+
/** Canton wallet balances */
|
|
1269
|
+
cantonBalances: CantonWalletBalancesResponseDto | null;
|
|
1270
|
+
/** Get Canton wallet balances */
|
|
1271
|
+
getBalances: () => Promise<CantonWalletBalancesResponseDto>;
|
|
1272
|
+
/** Tap devnet faucet */
|
|
1273
|
+
tapDevnet: (amount: string, options?: CantonSubmitPreparedOptions) => Promise<CantonQueryCompletionResponseDto>;
|
|
1274
|
+
/** Sign hash with Stellar wallet */
|
|
1275
|
+
signHash: (hashBase64: string) => Promise<string>;
|
|
1276
|
+
/** Sign text message */
|
|
1277
|
+
signMessage: (message: string) => Promise<string>;
|
|
1278
|
+
/** Prepare and submit transaction with polling for completion */
|
|
1279
|
+
sendTransaction: (commands: unknown, disclosedContracts?: unknown, options?: CantonSubmitPreparedOptions) => Promise<CantonQueryCompletionResponseDto>;
|
|
1280
|
+
/** Send Canton Coin (Amulet) to another party */
|
|
1281
|
+
sendCantonCoin: (receiverPartyId: string, amount: string, memo?: string, options?: CantonSubmitPreparedOptions) => Promise<CantonQueryCompletionResponseDto>;
|
|
1282
|
+
/** Setup transfer preapproval (internal, called automatically) */
|
|
1283
|
+
setupTransferPreapproval: () => Promise<void>;
|
|
1284
|
+
/** Loading state */
|
|
1285
|
+
loading: boolean;
|
|
1286
|
+
/** Error state */
|
|
1287
|
+
error: Error | null;
|
|
1288
|
+
/** Clear error */
|
|
1289
|
+
clearError: () => void;
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
export declare function useConfirmModal(): UseConfirmModalReturn;
|
|
1293
|
+
|
|
1294
|
+
export declare interface UseConfirmModalReturn {
|
|
1295
|
+
/** Show a generic confirmation modal */
|
|
1296
|
+
confirm: (options: ConfirmModalOptions) => Promise<ModalResult>;
|
|
1297
|
+
/** Show a message signing confirmation modal */
|
|
1298
|
+
signMessageConfirm: (options: SignMessageModalOptions) => Promise<ModalResult>;
|
|
1299
|
+
/** Show a transaction signing confirmation modal */
|
|
1300
|
+
signTransactionConfirm: (options: SignTransactionModalOptions) => Promise<ModalResult>;
|
|
1301
|
+
/** Set loading state for current modal */
|
|
1302
|
+
setModalLoading: (loading: boolean) => void;
|
|
1303
|
+
/** Close current modal */
|
|
1304
|
+
closeModal: () => void;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
export declare interface UserBalanceEntryDto {
|
|
1308
|
+
/** Token contract address */
|
|
1309
|
+
contractAddress: string;
|
|
1310
|
+
/** Token balance as a big integer string */
|
|
1311
|
+
tokenBalance: string;
|
|
1312
|
+
/** Token balance as a human-readable decimal string */
|
|
1313
|
+
tokenBalanceDecimal: string;
|
|
1314
|
+
/** Token decimals */
|
|
1315
|
+
decimals: number;
|
|
1316
|
+
/** Token logo URL */
|
|
1317
|
+
logoUrl: string;
|
|
1318
|
+
/** Token name */
|
|
1319
|
+
name: string;
|
|
1320
|
+
/** Token symbol */
|
|
1321
|
+
symbol: string;
|
|
1322
|
+
/** Network name */
|
|
1323
|
+
network: string;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
export declare interface UserBalanceResponseDto {
|
|
1327
|
+
/** Wallet address */
|
|
1328
|
+
address: string;
|
|
1329
|
+
/** List of token balances */
|
|
1330
|
+
balances: UserBalanceEntryDto[];
|
|
1331
|
+
/** Total USD balance. Decimal string */
|
|
1332
|
+
totalUsdBalance: string;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
export declare interface UserResponseDto {
|
|
1336
|
+
[key: string]: any;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
export declare function useSendTransaction(): UseSendTransactionReturn;
|
|
1340
|
+
|
|
1341
|
+
export declare interface UseSendTransactionReturn {
|
|
1342
|
+
/** Sign and send a Canton transaction with confirmation modal */
|
|
1343
|
+
sendTransaction: (commands: unknown, disclosedContracts?: unknown, options?: SendTransactionOptions) => Promise<CantonQueryCompletionResponseDto | null>;
|
|
1344
|
+
loading: boolean;
|
|
1345
|
+
error: Error | null;
|
|
1346
|
+
clearError: () => void;
|
|
1347
|
+
stellarWallets: StellarWallet[];
|
|
1348
|
+
stellarWallet: StellarWallet | null;
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
export declare function useSignMessage(): UseSignMessageReturn;
|
|
1352
|
+
|
|
1353
|
+
export declare interface UseSignMessageReturn {
|
|
1354
|
+
/** Sign a text message with confirmation modal */
|
|
1355
|
+
signMessage: (message: string, options?: SignMessageOptions) => Promise<string | null>;
|
|
1356
|
+
loading: boolean;
|
|
1357
|
+
error: Error | null;
|
|
1358
|
+
clearError: () => void;
|
|
1359
|
+
stellarWallets: StellarWallet[];
|
|
1360
|
+
stellarWallet: StellarWallet | null;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
export declare function useSignRawHashWithModal(): UseSignRawHashWithModalReturn;
|
|
1364
|
+
|
|
1365
|
+
export declare interface UseSignRawHashWithModalReturn {
|
|
1366
|
+
/** Sign a raw hash with confirmation modal */
|
|
1367
|
+
signRawHashWithModal: (params: SignRawHashParams, modalOptions?: SignRawHashModalOptions) => Promise<{
|
|
1368
|
+
signature: string;
|
|
1369
|
+
} | null>;
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
/**
|
|
1373
|
+
* Hook for using Privy Smart Wallets
|
|
1374
|
+
* Must be used within SmartWalletsProvider (automatically enabled in SupaProvider when smartWallets.enabled = true)
|
|
1375
|
+
*/
|
|
1376
|
+
export declare function useSmartWallets(): UseSmartWalletsReturn;
|
|
1377
|
+
|
|
1378
|
+
export declare interface UseSmartWalletsReturn {
|
|
1379
|
+
/** Client for interacting with smart wallets */
|
|
1380
|
+
client: ReturnType<typeof useSmartWallets_2>['client'];
|
|
1381
|
+
/** Get client for specific chain */
|
|
1382
|
+
getClientForChain: ReturnType<typeof useSmartWallets_2>['getClientForChain'];
|
|
1383
|
+
/** Get user's smart wallet address */
|
|
1384
|
+
address: string | undefined;
|
|
1385
|
+
/** Whether smart wallets are ready to use */
|
|
1386
|
+
ready: boolean;
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
export declare function useStellarWallet(): UseStellarWalletReturn;
|
|
1390
|
+
|
|
1391
|
+
export declare interface UseStellarWalletReturn {
|
|
1392
|
+
stellarWallets: StellarWallet[];
|
|
1393
|
+
stellarWallet: StellarWallet | null;
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
/**
|
|
1397
|
+
* Main hook for accessing all Supa SDK features
|
|
1398
|
+
* Combines authentication, Canton Network, and API functionality
|
|
1399
|
+
*
|
|
1400
|
+
* @returns Combined SDK functionality with convenience methods
|
|
1401
|
+
*
|
|
1402
|
+
* @example
|
|
1403
|
+
* Basic usage
|
|
1404
|
+
* ```tsx
|
|
1405
|
+
* function Dashboard() {
|
|
1406
|
+
* const { auth, canton, api } = useSupa();
|
|
1407
|
+
*
|
|
1408
|
+
* if (!auth.authenticated) {
|
|
1409
|
+
* return <button onClick={auth.login}>Login</button>;
|
|
1410
|
+
* }
|
|
1411
|
+
*
|
|
1412
|
+
* return (
|
|
1413
|
+
* <div>
|
|
1414
|
+
* <p>User: {auth.user?.email?.address}</p>
|
|
1415
|
+
* <button onClick={() => canton.registerCanton()}>
|
|
1416
|
+
* Register Canton
|
|
1417
|
+
* </button>
|
|
1418
|
+
* </div>
|
|
1419
|
+
* );
|
|
1420
|
+
* }
|
|
1421
|
+
* ```
|
|
1422
|
+
*
|
|
1423
|
+
* @example
|
|
1424
|
+
* Using automated onboarding
|
|
1425
|
+
* ```tsx
|
|
1426
|
+
* function OnboardButton() {
|
|
1427
|
+
* const { onboard, canton } = useSupa();
|
|
1428
|
+
*
|
|
1429
|
+
* return (
|
|
1430
|
+
* <button onClick={onboard}>
|
|
1431
|
+
* {canton.isRegistered ? 'Already registered' : 'Get Started'}
|
|
1432
|
+
* </button>
|
|
1433
|
+
* );
|
|
1434
|
+
* }
|
|
1435
|
+
* ```
|
|
1436
|
+
*/
|
|
1437
|
+
declare const useSupa: () => UseSupaReturn;
|
|
1438
|
+
export { useSupa }
|
|
1439
|
+
export { useSupa as useWalletino }
|
|
1440
|
+
|
|
1441
|
+
export declare function useSupaContext(): SupaContextValue;
|
|
1442
|
+
|
|
1443
|
+
/**
|
|
1444
|
+
* Return type for useSupa hook
|
|
1445
|
+
*/
|
|
1446
|
+
declare interface UseSupaReturn {
|
|
1447
|
+
/** Authentication methods and user state */
|
|
1448
|
+
auth: UseAuthReturn;
|
|
1449
|
+
/** Canton Network operations and wallet management */
|
|
1450
|
+
canton: UseCantonReturn;
|
|
1451
|
+
/** Backend API methods for data access */
|
|
1452
|
+
api: UseAPIReturn;
|
|
1453
|
+
/** Automated onboarding flow (login → create wallet → register Canton) */
|
|
1454
|
+
onboard: () => Promise<void>;
|
|
1455
|
+
}
|
|
1456
|
+
export { UseSupaReturn }
|
|
1457
|
+
export { UseSupaReturn as UseWalletinoReturn }
|
|
1458
|
+
|
|
1459
|
+
export { }
|