@supanovaapp/sdk 0.2.1 → 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 +160 -8
- package/dist/index.esm.js +58289 -52904
- package/package.json +6 -3
package/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ import { JSX } from 'react/jsx-runtime';
|
|
|
45
45
|
import { ReactNode } from 'react';
|
|
46
46
|
import { User } from '@privy-io/react-auth';
|
|
47
47
|
import { useSignRawHash } from '@privy-io/react-auth/extended-chains';
|
|
48
|
+
import { useSmartWallets as useSmartWallets_2 } from '@privy-io/react-auth/smart-wallets';
|
|
48
49
|
|
|
49
50
|
export declare interface AccountTokenBalance {
|
|
50
51
|
contractAddress: string;
|
|
@@ -327,6 +328,26 @@ export declare interface CantonCreatedEvent {
|
|
|
327
328
|
acsDelta: boolean;
|
|
328
329
|
}
|
|
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
|
+
|
|
330
351
|
/** Active contract in Canton */
|
|
331
352
|
export declare interface CantonJsActiveContract {
|
|
332
353
|
/** Created event with all contract details */
|
|
@@ -337,11 +358,37 @@ export declare interface CantonJsActiveContract {
|
|
|
337
358
|
reassignmentCounter: number;
|
|
338
359
|
}
|
|
339
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
|
+
|
|
340
373
|
export declare interface CantonMeResponseDto {
|
|
341
374
|
/** Canton party ID */
|
|
342
375
|
partyId: string;
|
|
343
376
|
/** User email (can be null if not set) */
|
|
344
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;
|
|
345
392
|
}
|
|
346
393
|
|
|
347
394
|
export declare interface CantonPrepareRegisterRequestDto {
|
|
@@ -356,7 +403,7 @@ export declare interface CantonPrepareTapRequestDto {
|
|
|
356
403
|
|
|
357
404
|
export declare interface CantonPrepareTransactionRequestDto {
|
|
358
405
|
/** Command or array of commands */
|
|
359
|
-
|
|
406
|
+
commands: unknown;
|
|
360
407
|
/** Optional disclosed contracts */
|
|
361
408
|
disclosedContracts?: unknown;
|
|
362
409
|
}
|
|
@@ -450,16 +497,33 @@ export declare class CantonService {
|
|
|
450
497
|
signMessage(message: string, signFunction: (hashHex: string) => Promise<string>): Promise<string>;
|
|
451
498
|
/**
|
|
452
499
|
* Prepare Canton transaction
|
|
453
|
-
* @param
|
|
500
|
+
* @param commands Command or array of commands
|
|
454
501
|
* @param disclosedContracts Optional disclosed contracts
|
|
455
502
|
*/
|
|
456
|
-
prepareTransaction(
|
|
503
|
+
prepareTransaction(commands: unknown, disclosedContracts?: unknown): Promise<CantonPrepareTransactionResponseDto>;
|
|
457
504
|
/**
|
|
458
505
|
* Check if user has Canton wallet registered
|
|
459
|
-
* This is inferred - if
|
|
460
|
-
* If it fails with 409 or similar, wallet already exists
|
|
506
|
+
* This is inferred - if /me succeeds, user has wallet
|
|
461
507
|
*/
|
|
462
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>;
|
|
463
527
|
}
|
|
464
528
|
|
|
465
529
|
export declare interface CantonSubmitPreparedOptions {
|
|
@@ -488,6 +552,54 @@ export declare interface CantonTapParams {
|
|
|
488
552
|
signFunction: (hashHex: string) => Promise<string>;
|
|
489
553
|
}
|
|
490
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
|
+
|
|
491
603
|
export declare interface ClientConfig {
|
|
492
604
|
baseURL?: string;
|
|
493
605
|
nodeIdentifier: string;
|
|
@@ -882,6 +994,21 @@ export declare interface SupaConfig {
|
|
|
882
994
|
logo?: string;
|
|
883
995
|
};
|
|
884
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
|
+
};
|
|
885
1012
|
}
|
|
886
1013
|
|
|
887
1014
|
export declare interface SupaContextValue {
|
|
@@ -1132,12 +1259,16 @@ export declare interface UseCantonReturn {
|
|
|
1132
1259
|
registerCanton: () => Promise<void>;
|
|
1133
1260
|
/** Whether Canton wallet is registered */
|
|
1134
1261
|
isRegistered: boolean;
|
|
1135
|
-
/** Canton user info (partyId
|
|
1262
|
+
/** Canton user info (partyId, email, transferPreapprovalSet) */
|
|
1136
1263
|
cantonUser: CantonMeResponseDto | null;
|
|
1137
1264
|
/** Get Canton user info */
|
|
1138
1265
|
getMe: () => Promise<CantonMeResponseDto>;
|
|
1139
1266
|
/** Get active contracts with optional filtering */
|
|
1140
1267
|
getActiveContracts: (templateIds?: string[]) => Promise<CantonActiveContractsResponseDto>;
|
|
1268
|
+
/** Canton wallet balances */
|
|
1269
|
+
cantonBalances: CantonWalletBalancesResponseDto | null;
|
|
1270
|
+
/** Get Canton wallet balances */
|
|
1271
|
+
getBalances: () => Promise<CantonWalletBalancesResponseDto>;
|
|
1141
1272
|
/** Tap devnet faucet */
|
|
1142
1273
|
tapDevnet: (amount: string, options?: CantonSubmitPreparedOptions) => Promise<CantonQueryCompletionResponseDto>;
|
|
1143
1274
|
/** Sign hash with Stellar wallet */
|
|
@@ -1145,7 +1276,11 @@ export declare interface UseCantonReturn {
|
|
|
1145
1276
|
/** Sign text message */
|
|
1146
1277
|
signMessage: (message: string) => Promise<string>;
|
|
1147
1278
|
/** Prepare and submit transaction with polling for completion */
|
|
1148
|
-
sendTransaction: (
|
|
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>;
|
|
1149
1284
|
/** Loading state */
|
|
1150
1285
|
loading: boolean;
|
|
1151
1286
|
/** Error state */
|
|
@@ -1205,7 +1340,7 @@ export declare function useSendTransaction(): UseSendTransactionReturn;
|
|
|
1205
1340
|
|
|
1206
1341
|
export declare interface UseSendTransactionReturn {
|
|
1207
1342
|
/** Sign and send a Canton transaction with confirmation modal */
|
|
1208
|
-
sendTransaction: (
|
|
1343
|
+
sendTransaction: (commands: unknown, disclosedContracts?: unknown, options?: SendTransactionOptions) => Promise<CantonQueryCompletionResponseDto | null>;
|
|
1209
1344
|
loading: boolean;
|
|
1210
1345
|
error: Error | null;
|
|
1211
1346
|
clearError: () => void;
|
|
@@ -1234,6 +1369,23 @@ export declare interface UseSignRawHashWithModalReturn {
|
|
|
1234
1369
|
} | null>;
|
|
1235
1370
|
}
|
|
1236
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
|
+
|
|
1237
1389
|
export declare function useStellarWallet(): UseStellarWalletReturn;
|
|
1238
1390
|
|
|
1239
1391
|
export declare interface UseStellarWalletReturn {
|