@supanovaapp/sdk 0.2.3 → 0.2.5
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.cjs.js +376 -376
- package/dist/index.d.ts +55 -7
- package/dist/index.esm.js +18531 -18355
- package/package.json +5 -1
package/dist/index.d.ts
CHANGED
|
@@ -64,6 +64,8 @@ export declare class ApiClient {
|
|
|
64
64
|
private client;
|
|
65
65
|
private getAccessToken?;
|
|
66
66
|
private nodeIdentifier;
|
|
67
|
+
private cache;
|
|
68
|
+
private cacheTTL;
|
|
67
69
|
constructor(config?: ClientConfig);
|
|
68
70
|
get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
69
71
|
post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
|
@@ -87,12 +89,36 @@ export declare interface ApiResponse<T = any> {
|
|
|
87
89
|
|
|
88
90
|
export declare class ApiService {
|
|
89
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;
|
|
90
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;
|
|
91
116
|
/**
|
|
92
117
|
* Get current user information
|
|
93
118
|
* GET /user/me
|
|
119
|
+
* С мемоизацией на 5 минут и дедупликацией одновременных запросов
|
|
94
120
|
*/
|
|
95
|
-
getCurrentUser(): Promise<UserResponseDto>;
|
|
121
|
+
getCurrentUser(force?: boolean): Promise<UserResponseDto>;
|
|
96
122
|
/**
|
|
97
123
|
* Get all users
|
|
98
124
|
* GET /user/all
|
|
@@ -195,8 +221,9 @@ export declare class ApiService {
|
|
|
195
221
|
/**
|
|
196
222
|
* Get SupaPoints balance
|
|
197
223
|
* GET /supa_points/balance
|
|
224
|
+
* С мемоизацией на 5 минут и дедупликацией одновременных запросов
|
|
198
225
|
*/
|
|
199
|
-
getSupaPointsBalance(): Promise<SupaPointsBalanceResponseDto>;
|
|
226
|
+
getSupaPointsBalance(force?: boolean): Promise<SupaPointsBalanceResponseDto>;
|
|
200
227
|
/**
|
|
201
228
|
* Get SupaPoints history
|
|
202
229
|
* GET /supa_points/history
|
|
@@ -215,8 +242,9 @@ export declare class ApiService {
|
|
|
215
242
|
/**
|
|
216
243
|
* Get Privy balance
|
|
217
244
|
* GET /privy/balance
|
|
245
|
+
* С мемоизацией на 5 минут и дедупликацией одновременных запросов
|
|
218
246
|
*/
|
|
219
|
-
getPrivyBalance(): Promise<any>;
|
|
247
|
+
getPrivyBalance(force?: boolean): Promise<any>;
|
|
220
248
|
}
|
|
221
249
|
|
|
222
250
|
/**
|
|
@@ -433,7 +461,16 @@ export declare interface CantonRegisterParams {
|
|
|
433
461
|
|
|
434
462
|
export declare class CantonService {
|
|
435
463
|
private client;
|
|
464
|
+
private meCache;
|
|
465
|
+
private meCacheTimestamp;
|
|
466
|
+
private mePendingPromise;
|
|
467
|
+
private readonly CACHE_TTL;
|
|
436
468
|
constructor(client: ApiClient);
|
|
469
|
+
/**
|
|
470
|
+
* Инвалидация кеша /me
|
|
471
|
+
* Вызывается после операций регистрации/изменения пользователя
|
|
472
|
+
*/
|
|
473
|
+
private invalidateMeCache;
|
|
437
474
|
/**
|
|
438
475
|
* Register Canton wallet
|
|
439
476
|
* Flow:
|
|
@@ -480,8 +517,9 @@ export declare class CantonService {
|
|
|
480
517
|
/**
|
|
481
518
|
* Get current Canton user info (partyId and email)
|
|
482
519
|
* Only works after registration
|
|
520
|
+
* С мемоизацией на 5 минут и дедупликацией одновременных запросов
|
|
483
521
|
*/
|
|
484
|
-
getMe(): Promise<CantonMeResponseDto>;
|
|
522
|
+
getMe(force?: boolean): Promise<CantonMeResponseDto>;
|
|
485
523
|
/**
|
|
486
524
|
* Get active contracts with optional template filtering
|
|
487
525
|
* Returns array of active contract items with full contract details
|
|
@@ -659,6 +697,10 @@ export declare interface DialogWithMessagesResponseDto {
|
|
|
659
697
|
|
|
660
698
|
export declare function getApiClient(): ApiClient;
|
|
661
699
|
|
|
700
|
+
export declare function getApiService(): ApiService;
|
|
701
|
+
|
|
702
|
+
export declare function getCantonService(): CantonService;
|
|
703
|
+
|
|
662
704
|
/**
|
|
663
705
|
* Gets the first Stellar wallet from user and wallets array
|
|
664
706
|
* Convenience function that throws if no Stellar wallet is found
|
|
@@ -960,8 +1002,10 @@ export declare interface SignTransactionModalProps {
|
|
|
960
1002
|
export declare interface StellarWallet {
|
|
961
1003
|
/** Stellar address (public key in Stellar format) */
|
|
962
1004
|
address: string;
|
|
963
|
-
/** Raw public key in hex format */
|
|
964
|
-
publicKey
|
|
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;
|
|
965
1009
|
/** Chain type, always 'stellar' for Stellar wallets */
|
|
966
1010
|
chainType: 'stellar';
|
|
967
1011
|
/** Wallet client type (e.g., 'privy') */
|
|
@@ -993,7 +1037,7 @@ export declare interface SupaConfig {
|
|
|
993
1037
|
accentColor?: string;
|
|
994
1038
|
logo?: string;
|
|
995
1039
|
};
|
|
996
|
-
loginMethods?: Array<'email' | 'wallet' | 'google' | 'twitter' | 'discord' | 'github' | 'linkedin'>;
|
|
1040
|
+
loginMethods?: Array<'email' | 'wallet' | 'google' | 'twitter' | 'discord' | 'github' | 'linkedin' | 'telegram'>;
|
|
997
1041
|
smartWallets?: {
|
|
998
1042
|
enabled?: boolean;
|
|
999
1043
|
paymasterContext?: {
|
|
@@ -1009,6 +1053,10 @@ export declare interface SupaConfig {
|
|
|
1009
1053
|
};
|
|
1010
1054
|
};
|
|
1011
1055
|
};
|
|
1056
|
+
/** Default chain for smart wallets and transactions */
|
|
1057
|
+
defaultChain?: any;
|
|
1058
|
+
/** Supported chains for the app */
|
|
1059
|
+
supportedChains?: any[];
|
|
1012
1060
|
}
|
|
1013
1061
|
|
|
1014
1062
|
export declare interface SupaContextValue {
|