zopassport 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +407 -0
- package/app/.env.example +15 -0
- package/app/README.md +28 -0
- package/app/package.json +24 -0
- package/app/reanimated-mock.js +102 -0
- package/app/reanimated-mock.jsx +97 -0
- package/app/src/App.tsx +331 -0
- package/app/src/components/FounderBadge.tsx +26 -0
- package/app/src/components/OTPInput.tsx +149 -0
- package/app/src/components/PhoneInput.tsx +109 -0
- package/app/src/components/ZoAuth.tsx +320 -0
- package/app/src/components/ZoAvatar.tsx +87 -0
- package/app/src/components/ZoLanding.tsx +231 -0
- package/app/src/components/ZoOnboarding.tsx +524 -0
- package/app/src/components/ZoPassportCard.tsx +183 -0
- package/app/src/components/ZoProgressRing.tsx +57 -0
- package/app/src/components/index.ts +16 -0
- package/app/src/components/wallet/MovingShine.tsx +43 -0
- package/app/src/components/wallet/TransactionItem.tsx +84 -0
- package/app/src/components/wallet/TransactionList.tsx +65 -0
- package/app/src/components/wallet/WalletCard.tsx +152 -0
- package/app/src/components/wallet/WalletScreen.tsx +190 -0
- package/app/src/components/wallet/ZoToken.tsx +69 -0
- package/app/src/components/wallet/index.ts +8 -0
- package/app/src/components/wallet/styles/index.ts +4 -0
- package/app/src/components/wallet/styles/walletStyles.ts +210 -0
- package/app/src/sdk/ZoPassportSDK.ts +277 -0
- package/app/src/sdk/lib/api/auth.ts +223 -0
- package/app/src/sdk/lib/api/avatar.ts +155 -0
- package/app/src/sdk/lib/api/client.ts +135 -0
- package/app/src/sdk/lib/api/index.ts +8 -0
- package/app/src/sdk/lib/api/profile.ts +80 -0
- package/app/src/sdk/lib/api/wallet.ts +59 -0
- package/app/src/sdk/lib/types/auth.ts +78 -0
- package/app/src/sdk/lib/types/avatar.ts +22 -0
- package/app/src/sdk/lib/types/index.ts +8 -0
- package/app/src/sdk/lib/types/profile.ts +18 -0
- package/app/src/sdk/lib/types/wallet.ts +103 -0
- package/app/src/sdk/lib/types.ts +205 -0
- package/app/src/sdk/lib/utils/index.ts +6 -0
- package/app/src/sdk/lib/utils/phone.ts +71 -0
- package/app/src/sdk/lib/utils/storage.ts +116 -0
- package/app/src/sdk/lib/utils/wallet.ts +73 -0
- package/app/src/sdk/types.ts +205 -0
- package/app/src/styles.css +154 -0
- package/app/svg-mock.js +125 -0
- package/app/svg-mock.jsx +120 -0
- package/app/vite.config.ts +70 -0
- package/assets/ASSETS_MANIFEST.md +124 -0
- package/assets/bae.png +0 -0
- package/assets/bro.png +0 -0
- package/assets/cultural-stickers/Business.png +0 -0
- package/assets/cultural-stickers/Default (2).jpg +0 -0
- package/assets/cultural-stickers/Design.png +0 -0
- package/assets/cultural-stickers/FollowYourHeart.png +0 -0
- package/assets/cultural-stickers/Food.png +0 -0
- package/assets/cultural-stickers/Game.png +0 -0
- package/assets/cultural-stickers/Health&Fitness.png +0 -0
- package/assets/cultural-stickers/Home&Lifestyle.png +0 -0
- package/assets/cultural-stickers/Law.png +0 -0
- package/assets/cultural-stickers/Literature&Stories.png +0 -0
- package/assets/cultural-stickers/Music&Entertainment.png +0 -0
- package/assets/cultural-stickers/Nature&Wildlife.png +0 -0
- package/assets/cultural-stickers/Photography.png +0 -0
- package/assets/cultural-stickers/Science&Technology.png +0 -0
- package/assets/cultural-stickers/Spiritual.png +0 -0
- package/assets/cultural-stickers/Sport.png +0 -0
- package/assets/cultural-stickers/Stories&Journal.png +0 -0
- package/assets/cultural-stickers/Television&Cinema.png +0 -0
- package/assets/cultural-stickers/Travel&Adventure.png +0 -0
- package/assets/cultural-stickers/z.jpg (1).jpg +0 -0
- package/assets/figma-assets/landing-zo-logo.png +0 -0
- package/assets/images/rank1.jpeg +0 -0
- package/assets/index.ts +76 -0
- package/assets/lotties/loader.json +1216 -0
- package/assets/lotties/spinner.json +1 -0
- package/assets/videos/loading-screen-background.mp4 +0 -0
- package/assets/videos/opening-disks.mp4 +0 -0
- package/assets/wallet/constants.ts +38 -0
- package/assets/zo-coin.gif +0 -0
- package/assets/zo-fallback.png +0 -0
- package/dist/assets/index.d.mts +136 -0
- package/dist/assets/index.d.ts +136 -0
- package/dist/assets/index.js +133 -0
- package/dist/assets/index.js.map +1 -0
- package/dist/assets/index.mjs +100 -0
- package/dist/assets/index.mjs.map +1 -0
- package/dist/index.d.mts +789 -0
- package/dist/index.d.ts +789 -0
- package/dist/index.js +1118 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1060 -0
- package/dist/index.mjs.map +1 -0
- package/dist/react-native.d.mts +537 -0
- package/dist/react-native.d.ts +537 -0
- package/dist/react-native.js +1617 -0
- package/dist/react-native.js.map +1 -0
- package/dist/react-native.mjs +1588 -0
- package/dist/react-native.mjs.map +1 -0
- package/dist/react.d.mts +824 -0
- package/dist/react.d.ts +824 -0
- package/dist/react.js +3856 -0
- package/dist/react.js.map +1 -0
- package/dist/react.mjs +3801 -0
- package/dist/react.mjs.map +1 -0
- package/package.json +112 -0
- package/scripts/init.js +196 -0
- package/scripts/postinstall.js +174 -0
- package/scripts/verify-build.js +121 -0
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AxiosInstance } from 'axios';
|
|
3
|
+
|
|
4
|
+
interface ZoWallet$1 {
|
|
5
|
+
address: string;
|
|
6
|
+
network: 'base' | 'avalanche';
|
|
7
|
+
balance?: number;
|
|
8
|
+
}
|
|
9
|
+
interface ZoTokenBalanceResponse {
|
|
10
|
+
balance: number;
|
|
11
|
+
currency: {
|
|
12
|
+
name: string;
|
|
13
|
+
symbol: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
interface WalletBalance {
|
|
17
|
+
total_amount: number;
|
|
18
|
+
currency: string;
|
|
19
|
+
}
|
|
20
|
+
interface Transaction {
|
|
21
|
+
id: string;
|
|
22
|
+
created_at: string;
|
|
23
|
+
updated_at: string;
|
|
24
|
+
amount: number;
|
|
25
|
+
description: string;
|
|
26
|
+
claimed_at: string;
|
|
27
|
+
grant: {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
action: 'deposit' | 'spend';
|
|
33
|
+
}
|
|
34
|
+
interface WalletUser {
|
|
35
|
+
avatar?: {
|
|
36
|
+
image: string;
|
|
37
|
+
};
|
|
38
|
+
first_name: string;
|
|
39
|
+
nickname?: string;
|
|
40
|
+
wallet_address: string;
|
|
41
|
+
}
|
|
42
|
+
interface BalanceResponse {
|
|
43
|
+
data: {
|
|
44
|
+
total_amount: number;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
interface TransactionsResponse {
|
|
48
|
+
data: {
|
|
49
|
+
results: Transaction[];
|
|
50
|
+
next?: string;
|
|
51
|
+
previous?: string;
|
|
52
|
+
count: number;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
interface FormattedTransaction {
|
|
56
|
+
id: string;
|
|
57
|
+
description: string;
|
|
58
|
+
amount: string;
|
|
59
|
+
date: string;
|
|
60
|
+
timestamp: string;
|
|
61
|
+
action: 'deposit' | 'spend';
|
|
62
|
+
color: string;
|
|
63
|
+
}
|
|
64
|
+
interface WalletCardProps {
|
|
65
|
+
balance: number;
|
|
66
|
+
user: WalletUser;
|
|
67
|
+
isOpen?: boolean;
|
|
68
|
+
onToggle?: () => void;
|
|
69
|
+
isLoading?: boolean;
|
|
70
|
+
}
|
|
71
|
+
interface TransactionItemProps {
|
|
72
|
+
transaction: Transaction;
|
|
73
|
+
showDate?: boolean;
|
|
74
|
+
}
|
|
75
|
+
interface TransactionListProps {
|
|
76
|
+
transactions: Transaction[];
|
|
77
|
+
isLoading?: boolean;
|
|
78
|
+
onEndReached?: () => void;
|
|
79
|
+
}
|
|
80
|
+
interface MovingShineProps {
|
|
81
|
+
duration?: number;
|
|
82
|
+
}
|
|
83
|
+
interface WalletScreenProps {
|
|
84
|
+
/** User data for the wallet */
|
|
85
|
+
user: WalletUser;
|
|
86
|
+
/** Current balance */
|
|
87
|
+
balance: number;
|
|
88
|
+
/** Transaction history */
|
|
89
|
+
transactions: Transaction[];
|
|
90
|
+
/** Loading state */
|
|
91
|
+
isLoading?: boolean;
|
|
92
|
+
/** Callback when back button is pressed */
|
|
93
|
+
onBack?: () => void;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
declare const WalletScreen: React.FC<WalletScreenProps>;
|
|
97
|
+
|
|
98
|
+
declare const WalletCard: React.FC<WalletCardProps>;
|
|
99
|
+
|
|
100
|
+
declare const TransactionList: React.FC<TransactionListProps>;
|
|
101
|
+
|
|
102
|
+
declare const TransactionItem: React.FC<TransactionItemProps>;
|
|
103
|
+
|
|
104
|
+
declare const MovingShine: React.FC<MovingShineProps>;
|
|
105
|
+
|
|
106
|
+
interface ZoTokenProps {
|
|
107
|
+
size?: number;
|
|
108
|
+
style?: any;
|
|
109
|
+
/** Custom source URL for the Zo coin */
|
|
110
|
+
source?: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Static $Zo Token Icon - uses the animated zo-coin.gif
|
|
114
|
+
*/
|
|
115
|
+
declare const ZoToken: React.FC<ZoTokenProps>;
|
|
116
|
+
/**
|
|
117
|
+
* Animated $Zo Token Video Component
|
|
118
|
+
* Uses the zo-coin.gif animated image
|
|
119
|
+
*/
|
|
120
|
+
declare const ZoTokenVideo: React.FC<ZoTokenProps>;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Storage adapter interface
|
|
124
|
+
* Implement this to provide custom storage (e.g., AsyncStorage for React Native)
|
|
125
|
+
*/
|
|
126
|
+
interface StorageAdapter {
|
|
127
|
+
getItem(key: string): Promise<string | null>;
|
|
128
|
+
setItem(key: string, value: string): Promise<void>;
|
|
129
|
+
removeItem(key: string): Promise<void>;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Storage keys used by the SDK
|
|
133
|
+
*/
|
|
134
|
+
declare const STORAGE_KEYS: {
|
|
135
|
+
readonly ACCESS_TOKEN: "zo_access_token";
|
|
136
|
+
readonly REFRESH_TOKEN: "zo_refresh_token";
|
|
137
|
+
readonly TOKEN_EXPIRY: "zo_token_expiry";
|
|
138
|
+
readonly REFRESH_EXPIRY: "zo_refresh_expiry";
|
|
139
|
+
readonly USER: "zo_user";
|
|
140
|
+
readonly CLIENT_DEVICE_ID: "zo_device_id";
|
|
141
|
+
readonly CLIENT_DEVICE_SECRET: "zo_device_secret";
|
|
142
|
+
readonly AVATAR_URL: "zo_avatar_url";
|
|
143
|
+
readonly NICKNAME: "zo_nickname";
|
|
144
|
+
readonly CITY: "zo_city";
|
|
145
|
+
readonly BODY_TYPE: "zo_body_type";
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* AsyncStorage adapter for React Native
|
|
149
|
+
* Provide AsyncStorage from @react-native-async-storage/async-storage
|
|
150
|
+
*/
|
|
151
|
+
declare class AsyncStorageAdapter implements StorageAdapter {
|
|
152
|
+
private storage;
|
|
153
|
+
constructor(asyncStorage: AsyncStorageAdapter['storage']);
|
|
154
|
+
getItem(key: string): Promise<string | null>;
|
|
155
|
+
setItem(key: string, value: string): Promise<void>;
|
|
156
|
+
removeItem(key: string): Promise<void>;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* In-memory storage adapter (for SSR or testing)
|
|
160
|
+
*/
|
|
161
|
+
declare class MemoryStorageAdapter implements StorageAdapter {
|
|
162
|
+
private store;
|
|
163
|
+
getItem(key: string): Promise<string | null>;
|
|
164
|
+
setItem(key: string, value: string): Promise<void>;
|
|
165
|
+
removeItem(key: string): Promise<void>;
|
|
166
|
+
/** Clear all stored data (useful for testing) */
|
|
167
|
+
clear(): void;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
interface ZoPassportConfig {
|
|
171
|
+
/** Your ZO client key (required) */
|
|
172
|
+
clientKey: string;
|
|
173
|
+
/** API base URL (default: https://api.io.zo.xyz) */
|
|
174
|
+
baseUrl?: string;
|
|
175
|
+
/** Request timeout in ms (default: 10000) */
|
|
176
|
+
timeout?: number;
|
|
177
|
+
/** Storage adapter for tokens (default: LocalStorageAdapter) */
|
|
178
|
+
storageAdapter?: StorageAdapter;
|
|
179
|
+
}
|
|
180
|
+
declare class ZoApiClient {
|
|
181
|
+
private client;
|
|
182
|
+
private config;
|
|
183
|
+
private storage;
|
|
184
|
+
constructor(config: ZoPassportConfig);
|
|
185
|
+
private setupInterceptors;
|
|
186
|
+
private getOrCreateDeviceCredentials;
|
|
187
|
+
get axiosInstance(): AxiosInstance;
|
|
188
|
+
getStorage(): StorageAdapter;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
interface ZoUser {
|
|
192
|
+
id: string;
|
|
193
|
+
first_name?: string;
|
|
194
|
+
last_name?: string;
|
|
195
|
+
bio?: string;
|
|
196
|
+
date_of_birth?: string;
|
|
197
|
+
place_name?: string;
|
|
198
|
+
body_type?: 'bro' | 'bae';
|
|
199
|
+
pfp_image?: string;
|
|
200
|
+
email_address?: string;
|
|
201
|
+
mobile_country_code?: string;
|
|
202
|
+
mobile_number?: string;
|
|
203
|
+
wallet_address?: string;
|
|
204
|
+
membership?: 'citizen' | 'founder';
|
|
205
|
+
cultures?: string[];
|
|
206
|
+
avatar?: {
|
|
207
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
208
|
+
image?: string;
|
|
209
|
+
};
|
|
210
|
+
role?: string;
|
|
211
|
+
created_at?: string;
|
|
212
|
+
updated_at?: string;
|
|
213
|
+
}
|
|
214
|
+
interface ZoProfileResponse {
|
|
215
|
+
id: string;
|
|
216
|
+
first_name?: string;
|
|
217
|
+
last_name?: string;
|
|
218
|
+
bio?: string;
|
|
219
|
+
date_of_birth?: string;
|
|
220
|
+
location?: {
|
|
221
|
+
place_name?: string;
|
|
222
|
+
latitude?: number;
|
|
223
|
+
longitude?: number;
|
|
224
|
+
};
|
|
225
|
+
body_type?: 'bro' | 'bae';
|
|
226
|
+
pfp_image?: string;
|
|
227
|
+
email_address?: string;
|
|
228
|
+
mobile_country_code?: string;
|
|
229
|
+
mobile_number?: string;
|
|
230
|
+
wallet_address?: string;
|
|
231
|
+
zo_membership?: string;
|
|
232
|
+
cultures?: string[];
|
|
233
|
+
avatar?: {
|
|
234
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
235
|
+
image?: string;
|
|
236
|
+
};
|
|
237
|
+
founder_nfts?: any[];
|
|
238
|
+
founder_nfts_count?: number;
|
|
239
|
+
role?: string;
|
|
240
|
+
}
|
|
241
|
+
interface ZoProfileUpdatePayload {
|
|
242
|
+
first_name?: string;
|
|
243
|
+
last_name?: string;
|
|
244
|
+
bio?: string;
|
|
245
|
+
date_of_birth?: string;
|
|
246
|
+
place_name?: string;
|
|
247
|
+
body_type?: 'bro' | 'bae';
|
|
248
|
+
pfp_image?: string;
|
|
249
|
+
cultures?: string[];
|
|
250
|
+
}
|
|
251
|
+
interface ZoAuthOTPRequest {
|
|
252
|
+
mobile_country_code: string;
|
|
253
|
+
mobile_number: string;
|
|
254
|
+
message_channel: string;
|
|
255
|
+
}
|
|
256
|
+
interface ZoAuthOTPVerifyRequest {
|
|
257
|
+
mobile_country_code: string;
|
|
258
|
+
mobile_number: string;
|
|
259
|
+
otp: string;
|
|
260
|
+
}
|
|
261
|
+
interface ZoAuthResponse {
|
|
262
|
+
user: ZoUser;
|
|
263
|
+
access_token: string;
|
|
264
|
+
refresh_token: string;
|
|
265
|
+
access_token_expiry: string;
|
|
266
|
+
refresh_token_expiry: string;
|
|
267
|
+
device_id?: string;
|
|
268
|
+
device_secret?: string;
|
|
269
|
+
}
|
|
270
|
+
interface ZoTokenRefreshResponse {
|
|
271
|
+
access: string;
|
|
272
|
+
refresh: string;
|
|
273
|
+
access_expiry: string;
|
|
274
|
+
refresh_expiry: string;
|
|
275
|
+
}
|
|
276
|
+
interface ZoAvatarGenerateRequest {
|
|
277
|
+
body_type: 'bro' | 'bae';
|
|
278
|
+
}
|
|
279
|
+
interface ZoAvatarGenerateResponse {
|
|
280
|
+
task_id: string;
|
|
281
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
282
|
+
}
|
|
283
|
+
interface ZoAvatarStatusResponse {
|
|
284
|
+
task_id: string;
|
|
285
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
286
|
+
result?: {
|
|
287
|
+
avatar_url?: string;
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
interface ZoErrorResponse {
|
|
291
|
+
success?: boolean;
|
|
292
|
+
error?: string;
|
|
293
|
+
message?: string;
|
|
294
|
+
detail?: string;
|
|
295
|
+
errors?: string[];
|
|
296
|
+
}
|
|
297
|
+
interface ZoPassportProfile {
|
|
298
|
+
avatar?: string;
|
|
299
|
+
name?: string;
|
|
300
|
+
isFounder?: boolean;
|
|
301
|
+
}
|
|
302
|
+
interface ZoPassportCompletion {
|
|
303
|
+
done: number;
|
|
304
|
+
total: number;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
declare class ZoAuth {
|
|
308
|
+
private client;
|
|
309
|
+
constructor(client: ZoApiClient);
|
|
310
|
+
/**
|
|
311
|
+
* Send OTP to phone number
|
|
312
|
+
* Step 1 of ZO phone authentication
|
|
313
|
+
*/
|
|
314
|
+
sendOTP(countryCode: string, phoneNumber: string): Promise<{
|
|
315
|
+
success: boolean;
|
|
316
|
+
message: string;
|
|
317
|
+
}>;
|
|
318
|
+
/**
|
|
319
|
+
* Verify OTP and authenticate user
|
|
320
|
+
* Step 2 of ZO phone authentication
|
|
321
|
+
* Returns full auth response with tokens and user profile
|
|
322
|
+
*/
|
|
323
|
+
verifyOTP(countryCode: string, phoneNumber: string, otp: string): Promise<{
|
|
324
|
+
success: boolean;
|
|
325
|
+
data?: ZoAuthResponse;
|
|
326
|
+
error?: string;
|
|
327
|
+
}>;
|
|
328
|
+
/**
|
|
329
|
+
* Refresh access token using refresh token
|
|
330
|
+
*/
|
|
331
|
+
refreshAccessToken(refreshToken: string): Promise<{
|
|
332
|
+
success: boolean;
|
|
333
|
+
tokens?: {
|
|
334
|
+
access: string;
|
|
335
|
+
refresh: string;
|
|
336
|
+
access_expiry: string;
|
|
337
|
+
refresh_expiry: string;
|
|
338
|
+
};
|
|
339
|
+
error?: string;
|
|
340
|
+
}>;
|
|
341
|
+
/**
|
|
342
|
+
* Check if user is authenticated
|
|
343
|
+
*/
|
|
344
|
+
checkLoginStatus(accessToken: string): Promise<{
|
|
345
|
+
success: boolean;
|
|
346
|
+
isAuthenticated: boolean;
|
|
347
|
+
}>;
|
|
348
|
+
/**
|
|
349
|
+
* Extract error message from various ZO API error formats
|
|
350
|
+
*/
|
|
351
|
+
private extractErrorMessage;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
declare class ZoProfile {
|
|
355
|
+
private client;
|
|
356
|
+
constructor(client: ZoApiClient);
|
|
357
|
+
/**
|
|
358
|
+
* Get user profile
|
|
359
|
+
*/
|
|
360
|
+
getProfile(accessToken: string): Promise<{
|
|
361
|
+
success: boolean;
|
|
362
|
+
profile?: ZoProfileResponse;
|
|
363
|
+
error?: string;
|
|
364
|
+
}>;
|
|
365
|
+
/**
|
|
366
|
+
* Update user profile (partial updates supported)
|
|
367
|
+
*/
|
|
368
|
+
updateProfile(accessToken: string, updates: ZoProfileUpdatePayload): Promise<{
|
|
369
|
+
success: boolean;
|
|
370
|
+
profile?: ZoProfileResponse;
|
|
371
|
+
error?: string;
|
|
372
|
+
}>;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
declare class ZoAvatar {
|
|
376
|
+
private client;
|
|
377
|
+
constructor(client: ZoApiClient);
|
|
378
|
+
/**
|
|
379
|
+
* Generate avatar for user
|
|
380
|
+
*/
|
|
381
|
+
generateAvatar(accessToken: string, bodyType: 'bro' | 'bae'): Promise<{
|
|
382
|
+
success: boolean;
|
|
383
|
+
task_id?: string;
|
|
384
|
+
status?: string;
|
|
385
|
+
error?: string;
|
|
386
|
+
}>;
|
|
387
|
+
/**
|
|
388
|
+
* Check avatar generation status
|
|
389
|
+
*/
|
|
390
|
+
getAvatarStatus(accessToken: string, taskId: string): Promise<{
|
|
391
|
+
success: boolean;
|
|
392
|
+
status?: 'pending' | 'processing' | 'completed' | 'failed';
|
|
393
|
+
avatarUrl?: string;
|
|
394
|
+
error?: string;
|
|
395
|
+
}>;
|
|
396
|
+
/**
|
|
397
|
+
* Poll avatar status until completion
|
|
398
|
+
*/
|
|
399
|
+
pollAvatarStatus(accessToken: string, taskId: string, options?: {
|
|
400
|
+
onProgress?: (status: string) => void;
|
|
401
|
+
onComplete?: (avatarUrl: string) => void;
|
|
402
|
+
onError?: (error: string) => void;
|
|
403
|
+
maxAttempts?: number;
|
|
404
|
+
interval?: number;
|
|
405
|
+
}): Promise<void>;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
declare class ZoWallet {
|
|
409
|
+
private client;
|
|
410
|
+
private cachedBalance;
|
|
411
|
+
private userWalletAddress;
|
|
412
|
+
private network;
|
|
413
|
+
constructor(client: ZoApiClient);
|
|
414
|
+
/**
|
|
415
|
+
* Set the user's wallet address for on-chain queries
|
|
416
|
+
*/
|
|
417
|
+
setWalletAddress(address: string, network?: 'base' | 'avalanche'): void;
|
|
418
|
+
/**
|
|
419
|
+
* Get wallet balance - tries on-chain first, then API fallback
|
|
420
|
+
* @returns Wallet balance amount
|
|
421
|
+
*/
|
|
422
|
+
getBalance(): Promise<number>;
|
|
423
|
+
/**
|
|
424
|
+
* Fetch balance directly from blockchain via JSON-RPC
|
|
425
|
+
*/
|
|
426
|
+
private getOnChainBalance;
|
|
427
|
+
/**
|
|
428
|
+
* Fetch balance from Zo API endpoints (tries multiple endpoints with fallback)
|
|
429
|
+
*/
|
|
430
|
+
private getBalanceFromAPI;
|
|
431
|
+
/**
|
|
432
|
+
* Get transaction history
|
|
433
|
+
* @param page - Optional page number for pagination
|
|
434
|
+
* @returns Array of transactions
|
|
435
|
+
*/
|
|
436
|
+
getTransactions(page?: number): Promise<{
|
|
437
|
+
transactions: Transaction[];
|
|
438
|
+
next?: string;
|
|
439
|
+
previous?: string;
|
|
440
|
+
count: number;
|
|
441
|
+
}>;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
interface ZoPassportSDKConfig extends ZoPassportConfig {
|
|
445
|
+
/** Optional: Provide a custom storage adapter (default: LocalStorageAdapter) */
|
|
446
|
+
storageAdapter?: StorageAdapter;
|
|
447
|
+
/** Optional: Enable auto token refresh (default: true) */
|
|
448
|
+
autoRefresh?: boolean;
|
|
449
|
+
/** Optional: Token refresh interval in ms (default: 60000 = 1 minute) */
|
|
450
|
+
refreshInterval?: number;
|
|
451
|
+
/** Optional: Enable debug logging (default: false) */
|
|
452
|
+
debug?: boolean;
|
|
453
|
+
}
|
|
454
|
+
declare class ZoPassportSDK {
|
|
455
|
+
private client;
|
|
456
|
+
private storage;
|
|
457
|
+
private refreshTimer;
|
|
458
|
+
private _readyPromise;
|
|
459
|
+
auth: ZoAuth;
|
|
460
|
+
profile: ZoProfile;
|
|
461
|
+
avatar: ZoAvatar;
|
|
462
|
+
wallet: ZoWallet;
|
|
463
|
+
private _user;
|
|
464
|
+
private _isAuthenticated;
|
|
465
|
+
constructor(config: ZoPassportSDKConfig);
|
|
466
|
+
/**
|
|
467
|
+
* Wait for the SDK to be ready (session loaded from storage)
|
|
468
|
+
* Use this if you need to check isAuthenticated immediately after construction
|
|
469
|
+
*/
|
|
470
|
+
ready(): Promise<void>;
|
|
471
|
+
private loadSession;
|
|
472
|
+
private saveSession;
|
|
473
|
+
clearSession(): Promise<void>;
|
|
474
|
+
private startAutoRefresh;
|
|
475
|
+
private stopAutoRefresh;
|
|
476
|
+
private refreshTokenIfNeeded;
|
|
477
|
+
get user(): ZoUser | null;
|
|
478
|
+
get isAuthenticated(): boolean;
|
|
479
|
+
/**
|
|
480
|
+
* Complete phone authentication flow
|
|
481
|
+
*/
|
|
482
|
+
loginWithPhone(countryCode: string, phoneNumber: string, otp: string): Promise<{
|
|
483
|
+
success: boolean;
|
|
484
|
+
user?: ZoUser;
|
|
485
|
+
error?: string;
|
|
486
|
+
}>;
|
|
487
|
+
/**
|
|
488
|
+
* Logout and clear session
|
|
489
|
+
*/
|
|
490
|
+
logout(): Promise<void>;
|
|
491
|
+
/**
|
|
492
|
+
* Get current user profile
|
|
493
|
+
*/
|
|
494
|
+
getProfile(): Promise<ZoUser | null>;
|
|
495
|
+
/**
|
|
496
|
+
* Update user profile
|
|
497
|
+
*/
|
|
498
|
+
updateProfile(updates: {
|
|
499
|
+
first_name?: string;
|
|
500
|
+
last_name?: string;
|
|
501
|
+
bio?: string;
|
|
502
|
+
date_of_birth?: string;
|
|
503
|
+
place_name?: string;
|
|
504
|
+
body_type?: 'bro' | 'bae';
|
|
505
|
+
}): Promise<{
|
|
506
|
+
success: boolean;
|
|
507
|
+
profile?: ZoUser;
|
|
508
|
+
error?: string;
|
|
509
|
+
}>;
|
|
510
|
+
/**
|
|
511
|
+
* Generate avatar
|
|
512
|
+
*/
|
|
513
|
+
generateAvatar(bodyType: 'bro' | 'bae'): Promise<{
|
|
514
|
+
success: boolean;
|
|
515
|
+
avatarUrl?: string;
|
|
516
|
+
error?: string;
|
|
517
|
+
}>;
|
|
518
|
+
/**
|
|
519
|
+
* Get wallet balance
|
|
520
|
+
*/
|
|
521
|
+
getWalletBalance(): Promise<number>;
|
|
522
|
+
/**
|
|
523
|
+
* Get wallet transactions
|
|
524
|
+
*/
|
|
525
|
+
getWalletTransactions(page?: number): Promise<{
|
|
526
|
+
transactions: Transaction[];
|
|
527
|
+
next?: string;
|
|
528
|
+
previous?: string;
|
|
529
|
+
count: number;
|
|
530
|
+
}>;
|
|
531
|
+
/**
|
|
532
|
+
* Cleanup
|
|
533
|
+
*/
|
|
534
|
+
destroy(): void;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
export { AsyncStorageAdapter, type BalanceResponse, type FormattedTransaction, MemoryStorageAdapter, MovingShine, type MovingShineProps, STORAGE_KEYS, type StorageAdapter, type Transaction, TransactionItem, type TransactionItemProps, TransactionList, type TransactionListProps, type TransactionsResponse, type WalletBalance, WalletCard, type WalletCardProps, WalletScreen, type WalletScreenProps, type WalletUser, type ZoAuthOTPRequest, type ZoAuthOTPVerifyRequest, type ZoAuthResponse, type ZoAvatarGenerateRequest, type ZoAvatarGenerateResponse, type ZoAvatarStatusResponse, type ZoErrorResponse, type ZoPassportCompletion, type ZoPassportProfile, ZoPassportSDK, type ZoPassportSDKConfig, type ZoProfileResponse, type ZoProfileUpdatePayload, ZoToken, type ZoTokenBalanceResponse, type ZoTokenRefreshResponse, ZoTokenVideo, type ZoUser, type ZoWallet$1 as ZoWallet };
|