@supanovaapp/sdk 0.2.9 → 0.2.11

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