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
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,789 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Storage adapter interface
|
|
5
|
+
* Implement this to provide custom storage (e.g., AsyncStorage for React Native)
|
|
6
|
+
*/
|
|
7
|
+
interface StorageAdapter {
|
|
8
|
+
getItem(key: string): Promise<string | null>;
|
|
9
|
+
setItem(key: string, value: string): Promise<void>;
|
|
10
|
+
removeItem(key: string): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Storage keys used by the SDK
|
|
14
|
+
*/
|
|
15
|
+
declare const STORAGE_KEYS: {
|
|
16
|
+
readonly ACCESS_TOKEN: "zo_access_token";
|
|
17
|
+
readonly REFRESH_TOKEN: "zo_refresh_token";
|
|
18
|
+
readonly TOKEN_EXPIRY: "zo_token_expiry";
|
|
19
|
+
readonly REFRESH_EXPIRY: "zo_refresh_expiry";
|
|
20
|
+
readonly USER: "zo_user";
|
|
21
|
+
readonly CLIENT_DEVICE_ID: "zo_device_id";
|
|
22
|
+
readonly CLIENT_DEVICE_SECRET: "zo_device_secret";
|
|
23
|
+
readonly AVATAR_URL: "zo_avatar_url";
|
|
24
|
+
readonly NICKNAME: "zo_nickname";
|
|
25
|
+
readonly CITY: "zo_city";
|
|
26
|
+
readonly BODY_TYPE: "zo_body_type";
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* LocalStorage adapter for web browsers
|
|
30
|
+
*/
|
|
31
|
+
declare class LocalStorageAdapter implements StorageAdapter {
|
|
32
|
+
getItem(key: string): Promise<string | null>;
|
|
33
|
+
setItem(key: string, value: string): Promise<void>;
|
|
34
|
+
removeItem(key: string): Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* AsyncStorage adapter for React Native
|
|
38
|
+
* Provide AsyncStorage from @react-native-async-storage/async-storage
|
|
39
|
+
*/
|
|
40
|
+
declare class AsyncStorageAdapter implements StorageAdapter {
|
|
41
|
+
private storage;
|
|
42
|
+
constructor(asyncStorage: AsyncStorageAdapter['storage']);
|
|
43
|
+
getItem(key: string): Promise<string | null>;
|
|
44
|
+
setItem(key: string, value: string): Promise<void>;
|
|
45
|
+
removeItem(key: string): Promise<void>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface ZoPassportConfig {
|
|
49
|
+
/** Your ZO client key (required) */
|
|
50
|
+
clientKey: string;
|
|
51
|
+
/** API base URL (default: https://api.io.zo.xyz) */
|
|
52
|
+
baseUrl?: string;
|
|
53
|
+
/** Request timeout in ms (default: 10000) */
|
|
54
|
+
timeout?: number;
|
|
55
|
+
/** Storage adapter for tokens (default: LocalStorageAdapter) */
|
|
56
|
+
storageAdapter?: StorageAdapter;
|
|
57
|
+
}
|
|
58
|
+
declare class ZoApiClient {
|
|
59
|
+
private client;
|
|
60
|
+
private config;
|
|
61
|
+
private storage;
|
|
62
|
+
constructor(config: ZoPassportConfig);
|
|
63
|
+
private setupInterceptors;
|
|
64
|
+
private getOrCreateDeviceCredentials;
|
|
65
|
+
get axiosInstance(): AxiosInstance;
|
|
66
|
+
getStorage(): StorageAdapter;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface ZoTokenBalanceResponse {
|
|
70
|
+
balance: number;
|
|
71
|
+
currency: {
|
|
72
|
+
name: string;
|
|
73
|
+
symbol: string;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
interface WalletBalance {
|
|
77
|
+
total_amount: number;
|
|
78
|
+
currency: string;
|
|
79
|
+
}
|
|
80
|
+
interface Transaction {
|
|
81
|
+
id: string;
|
|
82
|
+
created_at: string;
|
|
83
|
+
updated_at: string;
|
|
84
|
+
amount: number;
|
|
85
|
+
description: string;
|
|
86
|
+
claimed_at: string;
|
|
87
|
+
grant: {
|
|
88
|
+
id: string;
|
|
89
|
+
name: string;
|
|
90
|
+
description: string;
|
|
91
|
+
};
|
|
92
|
+
action: 'deposit' | 'spend';
|
|
93
|
+
}
|
|
94
|
+
interface WalletUser {
|
|
95
|
+
avatar?: {
|
|
96
|
+
image: string;
|
|
97
|
+
};
|
|
98
|
+
first_name: string;
|
|
99
|
+
nickname?: string;
|
|
100
|
+
wallet_address: string;
|
|
101
|
+
}
|
|
102
|
+
interface BalanceResponse {
|
|
103
|
+
data: {
|
|
104
|
+
total_amount: number;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
interface TransactionsResponse {
|
|
108
|
+
data: {
|
|
109
|
+
results: Transaction[];
|
|
110
|
+
next?: string;
|
|
111
|
+
previous?: string;
|
|
112
|
+
count: number;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
interface FormattedTransaction {
|
|
116
|
+
id: string;
|
|
117
|
+
description: string;
|
|
118
|
+
amount: string;
|
|
119
|
+
date: string;
|
|
120
|
+
timestamp: string;
|
|
121
|
+
action: 'deposit' | 'spend';
|
|
122
|
+
color: string;
|
|
123
|
+
}
|
|
124
|
+
interface WalletCardProps {
|
|
125
|
+
balance: number;
|
|
126
|
+
user: WalletUser;
|
|
127
|
+
isOpen?: boolean;
|
|
128
|
+
onToggle?: () => void;
|
|
129
|
+
isLoading?: boolean;
|
|
130
|
+
}
|
|
131
|
+
interface TransactionItemProps {
|
|
132
|
+
transaction: Transaction;
|
|
133
|
+
showDate?: boolean;
|
|
134
|
+
}
|
|
135
|
+
interface TransactionListProps {
|
|
136
|
+
transactions: Transaction[];
|
|
137
|
+
isLoading?: boolean;
|
|
138
|
+
onEndReached?: () => void;
|
|
139
|
+
}
|
|
140
|
+
interface MovingShineProps {
|
|
141
|
+
duration?: number;
|
|
142
|
+
}
|
|
143
|
+
interface WalletScreenProps {
|
|
144
|
+
/** User data for the wallet */
|
|
145
|
+
user: WalletUser;
|
|
146
|
+
/** Current balance */
|
|
147
|
+
balance: number;
|
|
148
|
+
/** Transaction history */
|
|
149
|
+
transactions: Transaction[];
|
|
150
|
+
/** Loading state */
|
|
151
|
+
isLoading?: boolean;
|
|
152
|
+
/** Callback when back button is pressed */
|
|
153
|
+
onBack?: () => void;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
interface ZoUser {
|
|
157
|
+
id: string;
|
|
158
|
+
first_name?: string;
|
|
159
|
+
last_name?: string;
|
|
160
|
+
bio?: string;
|
|
161
|
+
date_of_birth?: string;
|
|
162
|
+
place_name?: string;
|
|
163
|
+
body_type?: 'bro' | 'bae';
|
|
164
|
+
pfp_image?: string;
|
|
165
|
+
email_address?: string;
|
|
166
|
+
mobile_country_code?: string;
|
|
167
|
+
mobile_number?: string;
|
|
168
|
+
wallet_address?: string;
|
|
169
|
+
membership?: 'citizen' | 'founder';
|
|
170
|
+
cultures?: string[];
|
|
171
|
+
avatar?: {
|
|
172
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
173
|
+
image?: string;
|
|
174
|
+
};
|
|
175
|
+
role?: string;
|
|
176
|
+
created_at?: string;
|
|
177
|
+
updated_at?: string;
|
|
178
|
+
}
|
|
179
|
+
interface ZoProfileResponse {
|
|
180
|
+
id: string;
|
|
181
|
+
first_name?: string;
|
|
182
|
+
last_name?: string;
|
|
183
|
+
bio?: string;
|
|
184
|
+
date_of_birth?: string;
|
|
185
|
+
location?: {
|
|
186
|
+
place_name?: string;
|
|
187
|
+
latitude?: number;
|
|
188
|
+
longitude?: number;
|
|
189
|
+
};
|
|
190
|
+
body_type?: 'bro' | 'bae';
|
|
191
|
+
pfp_image?: string;
|
|
192
|
+
email_address?: string;
|
|
193
|
+
mobile_country_code?: string;
|
|
194
|
+
mobile_number?: string;
|
|
195
|
+
wallet_address?: string;
|
|
196
|
+
zo_membership?: string;
|
|
197
|
+
cultures?: string[];
|
|
198
|
+
avatar?: {
|
|
199
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
200
|
+
image?: string;
|
|
201
|
+
};
|
|
202
|
+
founder_nfts?: any[];
|
|
203
|
+
founder_nfts_count?: number;
|
|
204
|
+
role?: string;
|
|
205
|
+
}
|
|
206
|
+
interface ZoProfileUpdatePayload {
|
|
207
|
+
first_name?: string;
|
|
208
|
+
last_name?: string;
|
|
209
|
+
bio?: string;
|
|
210
|
+
date_of_birth?: string;
|
|
211
|
+
place_name?: string;
|
|
212
|
+
body_type?: 'bro' | 'bae';
|
|
213
|
+
pfp_image?: string;
|
|
214
|
+
cultures?: string[];
|
|
215
|
+
}
|
|
216
|
+
interface ZoAuthOTPRequest {
|
|
217
|
+
mobile_country_code: string;
|
|
218
|
+
mobile_number: string;
|
|
219
|
+
message_channel: string;
|
|
220
|
+
}
|
|
221
|
+
interface ZoAuthOTPVerifyRequest {
|
|
222
|
+
mobile_country_code: string;
|
|
223
|
+
mobile_number: string;
|
|
224
|
+
otp: string;
|
|
225
|
+
}
|
|
226
|
+
interface ZoAuthResponse {
|
|
227
|
+
user: ZoUser;
|
|
228
|
+
access_token: string;
|
|
229
|
+
refresh_token: string;
|
|
230
|
+
access_token_expiry: string;
|
|
231
|
+
refresh_token_expiry: string;
|
|
232
|
+
device_id?: string;
|
|
233
|
+
device_secret?: string;
|
|
234
|
+
}
|
|
235
|
+
interface ZoTokenRefreshResponse {
|
|
236
|
+
access: string;
|
|
237
|
+
refresh: string;
|
|
238
|
+
access_expiry: string;
|
|
239
|
+
refresh_expiry: string;
|
|
240
|
+
}
|
|
241
|
+
interface ZoAvatarGenerateRequest {
|
|
242
|
+
body_type: 'bro' | 'bae';
|
|
243
|
+
}
|
|
244
|
+
interface ZoAvatarGenerateResponse {
|
|
245
|
+
task_id: string;
|
|
246
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
247
|
+
}
|
|
248
|
+
interface ZoAvatarStatusResponse {
|
|
249
|
+
task_id: string;
|
|
250
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
251
|
+
result?: {
|
|
252
|
+
avatar_url?: string;
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
interface ZoErrorResponse {
|
|
256
|
+
success?: boolean;
|
|
257
|
+
error?: string;
|
|
258
|
+
message?: string;
|
|
259
|
+
detail?: string;
|
|
260
|
+
errors?: string[];
|
|
261
|
+
}
|
|
262
|
+
interface ZoPassportProfile {
|
|
263
|
+
avatar?: string;
|
|
264
|
+
name?: string;
|
|
265
|
+
isFounder?: boolean;
|
|
266
|
+
}
|
|
267
|
+
interface ZoPassportCompletion {
|
|
268
|
+
done: number;
|
|
269
|
+
total: number;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
declare class ZoAuth {
|
|
273
|
+
private client;
|
|
274
|
+
constructor(client: ZoApiClient);
|
|
275
|
+
/**
|
|
276
|
+
* Send OTP to phone number
|
|
277
|
+
* Step 1 of ZO phone authentication
|
|
278
|
+
*/
|
|
279
|
+
sendOTP(countryCode: string, phoneNumber: string): Promise<{
|
|
280
|
+
success: boolean;
|
|
281
|
+
message: string;
|
|
282
|
+
}>;
|
|
283
|
+
/**
|
|
284
|
+
* Verify OTP and authenticate user
|
|
285
|
+
* Step 2 of ZO phone authentication
|
|
286
|
+
* Returns full auth response with tokens and user profile
|
|
287
|
+
*/
|
|
288
|
+
verifyOTP(countryCode: string, phoneNumber: string, otp: string): Promise<{
|
|
289
|
+
success: boolean;
|
|
290
|
+
data?: ZoAuthResponse;
|
|
291
|
+
error?: string;
|
|
292
|
+
}>;
|
|
293
|
+
/**
|
|
294
|
+
* Refresh access token using refresh token
|
|
295
|
+
*/
|
|
296
|
+
refreshAccessToken(refreshToken: string): Promise<{
|
|
297
|
+
success: boolean;
|
|
298
|
+
tokens?: {
|
|
299
|
+
access: string;
|
|
300
|
+
refresh: string;
|
|
301
|
+
access_expiry: string;
|
|
302
|
+
refresh_expiry: string;
|
|
303
|
+
};
|
|
304
|
+
error?: string;
|
|
305
|
+
}>;
|
|
306
|
+
/**
|
|
307
|
+
* Check if user is authenticated
|
|
308
|
+
*/
|
|
309
|
+
checkLoginStatus(accessToken: string): Promise<{
|
|
310
|
+
success: boolean;
|
|
311
|
+
isAuthenticated: boolean;
|
|
312
|
+
}>;
|
|
313
|
+
/**
|
|
314
|
+
* Extract error message from various ZO API error formats
|
|
315
|
+
*/
|
|
316
|
+
private extractErrorMessage;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
declare class ZoProfile {
|
|
320
|
+
private client;
|
|
321
|
+
constructor(client: ZoApiClient);
|
|
322
|
+
/**
|
|
323
|
+
* Get user profile
|
|
324
|
+
*/
|
|
325
|
+
getProfile(accessToken: string): Promise<{
|
|
326
|
+
success: boolean;
|
|
327
|
+
profile?: ZoProfileResponse;
|
|
328
|
+
error?: string;
|
|
329
|
+
}>;
|
|
330
|
+
/**
|
|
331
|
+
* Update user profile (partial updates supported)
|
|
332
|
+
*/
|
|
333
|
+
updateProfile(accessToken: string, updates: ZoProfileUpdatePayload): Promise<{
|
|
334
|
+
success: boolean;
|
|
335
|
+
profile?: ZoProfileResponse;
|
|
336
|
+
error?: string;
|
|
337
|
+
}>;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
declare class ZoAvatar {
|
|
341
|
+
private client;
|
|
342
|
+
constructor(client: ZoApiClient);
|
|
343
|
+
/**
|
|
344
|
+
* Generate avatar for user
|
|
345
|
+
*/
|
|
346
|
+
generateAvatar(accessToken: string, bodyType: 'bro' | 'bae'): Promise<{
|
|
347
|
+
success: boolean;
|
|
348
|
+
task_id?: string;
|
|
349
|
+
status?: string;
|
|
350
|
+
error?: string;
|
|
351
|
+
}>;
|
|
352
|
+
/**
|
|
353
|
+
* Check avatar generation status
|
|
354
|
+
*/
|
|
355
|
+
getAvatarStatus(accessToken: string, taskId: string): Promise<{
|
|
356
|
+
success: boolean;
|
|
357
|
+
status?: 'pending' | 'processing' | 'completed' | 'failed';
|
|
358
|
+
avatarUrl?: string;
|
|
359
|
+
error?: string;
|
|
360
|
+
}>;
|
|
361
|
+
/**
|
|
362
|
+
* Poll avatar status until completion
|
|
363
|
+
*/
|
|
364
|
+
pollAvatarStatus(accessToken: string, taskId: string, options?: {
|
|
365
|
+
onProgress?: (status: string) => void;
|
|
366
|
+
onComplete?: (avatarUrl: string) => void;
|
|
367
|
+
onError?: (error: string) => void;
|
|
368
|
+
maxAttempts?: number;
|
|
369
|
+
interval?: number;
|
|
370
|
+
}): Promise<void>;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
declare class ZoWallet {
|
|
374
|
+
private client;
|
|
375
|
+
private cachedBalance;
|
|
376
|
+
private userWalletAddress;
|
|
377
|
+
private network;
|
|
378
|
+
constructor(client: ZoApiClient);
|
|
379
|
+
/**
|
|
380
|
+
* Set the user's wallet address for on-chain queries
|
|
381
|
+
*/
|
|
382
|
+
setWalletAddress(address: string, network?: 'base' | 'avalanche'): void;
|
|
383
|
+
/**
|
|
384
|
+
* Get wallet balance - tries on-chain first, then API fallback
|
|
385
|
+
* @returns Wallet balance amount
|
|
386
|
+
*/
|
|
387
|
+
getBalance(): Promise<number>;
|
|
388
|
+
/**
|
|
389
|
+
* Fetch balance directly from blockchain via JSON-RPC
|
|
390
|
+
*/
|
|
391
|
+
private getOnChainBalance;
|
|
392
|
+
/**
|
|
393
|
+
* Fetch balance from Zo API endpoints (tries multiple endpoints with fallback)
|
|
394
|
+
*/
|
|
395
|
+
private getBalanceFromAPI;
|
|
396
|
+
/**
|
|
397
|
+
* Get transaction history
|
|
398
|
+
* @param page - Optional page number for pagination
|
|
399
|
+
* @returns Array of transactions
|
|
400
|
+
*/
|
|
401
|
+
getTransactions(page?: number): Promise<{
|
|
402
|
+
transactions: Transaction[];
|
|
403
|
+
next?: string;
|
|
404
|
+
previous?: string;
|
|
405
|
+
count: number;
|
|
406
|
+
}>;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
declare const COUNTRY_CODES: readonly [{
|
|
410
|
+
readonly code: "1";
|
|
411
|
+
readonly country: "US";
|
|
412
|
+
readonly flag: "🇺🇸";
|
|
413
|
+
readonly name: "United States";
|
|
414
|
+
}, {
|
|
415
|
+
readonly code: "91";
|
|
416
|
+
readonly country: "IN";
|
|
417
|
+
readonly flag: "🇮🇳";
|
|
418
|
+
readonly name: "India";
|
|
419
|
+
}, {
|
|
420
|
+
readonly code: "44";
|
|
421
|
+
readonly country: "GB";
|
|
422
|
+
readonly flag: "🇬🇧";
|
|
423
|
+
readonly name: "United Kingdom";
|
|
424
|
+
}, {
|
|
425
|
+
readonly code: "86";
|
|
426
|
+
readonly country: "CN";
|
|
427
|
+
readonly flag: "🇨🇳";
|
|
428
|
+
readonly name: "China";
|
|
429
|
+
}, {
|
|
430
|
+
readonly code: "81";
|
|
431
|
+
readonly country: "JP";
|
|
432
|
+
readonly flag: "🇯🇵";
|
|
433
|
+
readonly name: "Japan";
|
|
434
|
+
}, {
|
|
435
|
+
readonly code: "82";
|
|
436
|
+
readonly country: "KR";
|
|
437
|
+
readonly flag: "🇰🇷";
|
|
438
|
+
readonly name: "South Korea";
|
|
439
|
+
}, {
|
|
440
|
+
readonly code: "33";
|
|
441
|
+
readonly country: "FR";
|
|
442
|
+
readonly flag: "🇫🇷";
|
|
443
|
+
readonly name: "France";
|
|
444
|
+
}, {
|
|
445
|
+
readonly code: "49";
|
|
446
|
+
readonly country: "DE";
|
|
447
|
+
readonly flag: "🇩🇪";
|
|
448
|
+
readonly name: "Germany";
|
|
449
|
+
}, {
|
|
450
|
+
readonly code: "7";
|
|
451
|
+
readonly country: "RU";
|
|
452
|
+
readonly flag: "🇷🇺";
|
|
453
|
+
readonly name: "Russia";
|
|
454
|
+
}, {
|
|
455
|
+
readonly code: "55";
|
|
456
|
+
readonly country: "BR";
|
|
457
|
+
readonly flag: "🇧🇷";
|
|
458
|
+
readonly name: "Brazil";
|
|
459
|
+
}, {
|
|
460
|
+
readonly code: "61";
|
|
461
|
+
readonly country: "AU";
|
|
462
|
+
readonly flag: "🇦🇺";
|
|
463
|
+
readonly name: "Australia";
|
|
464
|
+
}, {
|
|
465
|
+
readonly code: "65";
|
|
466
|
+
readonly country: "SG";
|
|
467
|
+
readonly flag: "🇸🇬";
|
|
468
|
+
readonly name: "Singapore";
|
|
469
|
+
}, {
|
|
470
|
+
readonly code: "971";
|
|
471
|
+
readonly country: "AE";
|
|
472
|
+
readonly flag: "🇦🇪";
|
|
473
|
+
readonly name: "UAE";
|
|
474
|
+
}, {
|
|
475
|
+
readonly code: "966";
|
|
476
|
+
readonly country: "SA";
|
|
477
|
+
readonly flag: "🇸🇦";
|
|
478
|
+
readonly name: "Saudi Arabia";
|
|
479
|
+
}, {
|
|
480
|
+
readonly code: "62";
|
|
481
|
+
readonly country: "ID";
|
|
482
|
+
readonly flag: "🇮🇩";
|
|
483
|
+
readonly name: "Indonesia";
|
|
484
|
+
}, {
|
|
485
|
+
readonly code: "60";
|
|
486
|
+
readonly country: "MY";
|
|
487
|
+
readonly flag: "🇲🇾";
|
|
488
|
+
readonly name: "Malaysia";
|
|
489
|
+
}, {
|
|
490
|
+
readonly code: "66";
|
|
491
|
+
readonly country: "TH";
|
|
492
|
+
readonly flag: "🇹🇭";
|
|
493
|
+
readonly name: "Thailand";
|
|
494
|
+
}, {
|
|
495
|
+
readonly code: "84";
|
|
496
|
+
readonly country: "VN";
|
|
497
|
+
readonly flag: "🇻🇳";
|
|
498
|
+
readonly name: "Vietnam";
|
|
499
|
+
}, {
|
|
500
|
+
readonly code: "63";
|
|
501
|
+
readonly country: "PH";
|
|
502
|
+
readonly flag: "🇵🇭";
|
|
503
|
+
readonly name: "Philippines";
|
|
504
|
+
}, {
|
|
505
|
+
readonly code: "31";
|
|
506
|
+
readonly country: "NL";
|
|
507
|
+
readonly flag: "🇳🇱";
|
|
508
|
+
readonly name: "Netherlands";
|
|
509
|
+
}];
|
|
510
|
+
/**
|
|
511
|
+
* Format phone number for display
|
|
512
|
+
* e.g., "5551234567" → "555-123-4567"
|
|
513
|
+
*/
|
|
514
|
+
declare function formatPhoneNumber(phone: string): string;
|
|
515
|
+
/**
|
|
516
|
+
* Parse phone number to clean digits only
|
|
517
|
+
* Removes all non-digit characters
|
|
518
|
+
*/
|
|
519
|
+
declare function parsePhoneNumber(phone: string): string;
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Format balance number with commas
|
|
523
|
+
* @param balance - Raw balance number
|
|
524
|
+
* @returns Formatted string (e.g., "1,234.56")
|
|
525
|
+
*/
|
|
526
|
+
declare const formatBalance: (balance: number) => string;
|
|
527
|
+
/**
|
|
528
|
+
* Format balance for short display
|
|
529
|
+
* @param balance - Raw balance number
|
|
530
|
+
* @returns Shortened string (e.g., "1.2K", "1.5M")
|
|
531
|
+
*/
|
|
532
|
+
declare const formatBalanceShort: (balance: number) => string;
|
|
533
|
+
/**
|
|
534
|
+
* Format wallet address to short form
|
|
535
|
+
* @param address - Full wallet address
|
|
536
|
+
* @returns Shortened address (e.g., "0x12...34ab")
|
|
537
|
+
*/
|
|
538
|
+
declare const formatWalletAddress: (address: string) => string;
|
|
539
|
+
/**
|
|
540
|
+
* Format nickname with @ prefix
|
|
541
|
+
* @param nickname - User nickname
|
|
542
|
+
* @returns Formatted nickname (e.g., "@john")
|
|
543
|
+
*/
|
|
544
|
+
declare const formatNickname: (nickname: string) => string;
|
|
545
|
+
/**
|
|
546
|
+
* Format transaction amount
|
|
547
|
+
* @param amount - Transaction amount
|
|
548
|
+
* @param action - deposit or spend
|
|
549
|
+
* @returns Formatted amount with +/- prefix
|
|
550
|
+
*/
|
|
551
|
+
declare const formatTransactionAmount: (amount: number, action: "deposit" | "spend") => string;
|
|
552
|
+
/**
|
|
553
|
+
* Get transaction color
|
|
554
|
+
* @param action - deposit or spend
|
|
555
|
+
* @returns Color hex code
|
|
556
|
+
*/
|
|
557
|
+
declare const getTransactionColor: (action: "deposit" | "spend") => string;
|
|
558
|
+
|
|
559
|
+
type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'none';
|
|
560
|
+
interface LoggerConfig {
|
|
561
|
+
enabled: boolean;
|
|
562
|
+
level: LogLevel;
|
|
563
|
+
prefix: string;
|
|
564
|
+
}
|
|
565
|
+
declare class Logger {
|
|
566
|
+
private config;
|
|
567
|
+
/**
|
|
568
|
+
* Configure the logger
|
|
569
|
+
* @param options - Logger configuration
|
|
570
|
+
*/
|
|
571
|
+
configure(options: Partial<LoggerConfig>): void;
|
|
572
|
+
/**
|
|
573
|
+
* Enable debug logging
|
|
574
|
+
*/
|
|
575
|
+
enable(): void;
|
|
576
|
+
/**
|
|
577
|
+
* Disable all logging
|
|
578
|
+
*/
|
|
579
|
+
disable(): void;
|
|
580
|
+
/**
|
|
581
|
+
* Set log level
|
|
582
|
+
*/
|
|
583
|
+
setLevel(level: LogLevel): void;
|
|
584
|
+
private shouldLog;
|
|
585
|
+
debug(...args: unknown[]): void;
|
|
586
|
+
info(...args: unknown[]): void;
|
|
587
|
+
warn(...args: unknown[]): void;
|
|
588
|
+
error(...args: unknown[]): void;
|
|
589
|
+
}
|
|
590
|
+
declare const logger: Logger;
|
|
591
|
+
|
|
592
|
+
interface ZoPassportSDKConfig extends ZoPassportConfig {
|
|
593
|
+
/** Optional: Provide a custom storage adapter (default: LocalStorageAdapter) */
|
|
594
|
+
storageAdapter?: StorageAdapter;
|
|
595
|
+
/** Optional: Enable auto token refresh (default: true) */
|
|
596
|
+
autoRefresh?: boolean;
|
|
597
|
+
/** Optional: Token refresh interval in ms (default: 60000 = 1 minute) */
|
|
598
|
+
refreshInterval?: number;
|
|
599
|
+
/** Optional: Enable debug logging (default: false) */
|
|
600
|
+
debug?: boolean;
|
|
601
|
+
}
|
|
602
|
+
declare class ZoPassportSDK {
|
|
603
|
+
private client;
|
|
604
|
+
private storage;
|
|
605
|
+
private refreshTimer;
|
|
606
|
+
private _readyPromise;
|
|
607
|
+
auth: ZoAuth;
|
|
608
|
+
profile: ZoProfile;
|
|
609
|
+
avatar: ZoAvatar;
|
|
610
|
+
wallet: ZoWallet;
|
|
611
|
+
private _user;
|
|
612
|
+
private _isAuthenticated;
|
|
613
|
+
constructor(config: ZoPassportSDKConfig);
|
|
614
|
+
/**
|
|
615
|
+
* Wait for the SDK to be ready (session loaded from storage)
|
|
616
|
+
* Use this if you need to check isAuthenticated immediately after construction
|
|
617
|
+
*/
|
|
618
|
+
ready(): Promise<void>;
|
|
619
|
+
private loadSession;
|
|
620
|
+
private saveSession;
|
|
621
|
+
clearSession(): Promise<void>;
|
|
622
|
+
private startAutoRefresh;
|
|
623
|
+
private stopAutoRefresh;
|
|
624
|
+
private refreshTokenIfNeeded;
|
|
625
|
+
get user(): ZoUser | null;
|
|
626
|
+
get isAuthenticated(): boolean;
|
|
627
|
+
/**
|
|
628
|
+
* Complete phone authentication flow
|
|
629
|
+
*/
|
|
630
|
+
loginWithPhone(countryCode: string, phoneNumber: string, otp: string): Promise<{
|
|
631
|
+
success: boolean;
|
|
632
|
+
user?: ZoUser;
|
|
633
|
+
error?: string;
|
|
634
|
+
}>;
|
|
635
|
+
/**
|
|
636
|
+
* Logout and clear session
|
|
637
|
+
*/
|
|
638
|
+
logout(): Promise<void>;
|
|
639
|
+
/**
|
|
640
|
+
* Get current user profile
|
|
641
|
+
*/
|
|
642
|
+
getProfile(): Promise<ZoUser | null>;
|
|
643
|
+
/**
|
|
644
|
+
* Update user profile
|
|
645
|
+
*/
|
|
646
|
+
updateProfile(updates: {
|
|
647
|
+
first_name?: string;
|
|
648
|
+
last_name?: string;
|
|
649
|
+
bio?: string;
|
|
650
|
+
date_of_birth?: string;
|
|
651
|
+
place_name?: string;
|
|
652
|
+
body_type?: 'bro' | 'bae';
|
|
653
|
+
}): Promise<{
|
|
654
|
+
success: boolean;
|
|
655
|
+
profile?: ZoUser;
|
|
656
|
+
error?: string;
|
|
657
|
+
}>;
|
|
658
|
+
/**
|
|
659
|
+
* Generate avatar
|
|
660
|
+
*/
|
|
661
|
+
generateAvatar(bodyType: 'bro' | 'bae'): Promise<{
|
|
662
|
+
success: boolean;
|
|
663
|
+
avatarUrl?: string;
|
|
664
|
+
error?: string;
|
|
665
|
+
}>;
|
|
666
|
+
/**
|
|
667
|
+
* Get wallet balance
|
|
668
|
+
*/
|
|
669
|
+
getWalletBalance(): Promise<number>;
|
|
670
|
+
/**
|
|
671
|
+
* Get wallet transactions
|
|
672
|
+
*/
|
|
673
|
+
getWalletTransactions(page?: number): Promise<{
|
|
674
|
+
transactions: Transaction[];
|
|
675
|
+
next?: string;
|
|
676
|
+
previous?: string;
|
|
677
|
+
count: number;
|
|
678
|
+
}>;
|
|
679
|
+
/**
|
|
680
|
+
* Cleanup
|
|
681
|
+
*/
|
|
682
|
+
destroy(): void;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
declare const ASSETS: {
|
|
686
|
+
readonly BRO_AVATAR: "/bro.png";
|
|
687
|
+
readonly BAE_AVATAR: "/bae.png";
|
|
688
|
+
readonly FALLBACK_AVATAR: "/zo-fallback.png";
|
|
689
|
+
readonly DEFAULT_AVATAR: "/images/rank1.jpeg";
|
|
690
|
+
readonly ZO_LOGO: "/figma-assets/landing-zo-logo.png";
|
|
691
|
+
readonly ZO_COIN: "/zo-coin.gif";
|
|
692
|
+
readonly LANDING_VIDEO: "/videos/loading-screen-background.mp4";
|
|
693
|
+
readonly PORTAL_VIDEO: "/videos/opening-disks.mp4";
|
|
694
|
+
readonly FOUNDER_BG: "https://proxy.cdn.zo.xyz/gallery/media/images/a1659b07-94f0-4490-9b3c-3366715d9717_20250515053726.png";
|
|
695
|
+
readonly CITIZEN_BG: "https://proxy.cdn.zo.xyz/gallery/media/images/bda9da5a-eefe-411d-8d90-667c80024463_20250515053805.png";
|
|
696
|
+
readonly LOADER: "/lotties/loader.json";
|
|
697
|
+
readonly SPINNER: "/lotties/spinner.json";
|
|
698
|
+
};
|
|
699
|
+
declare const CULTURE_STICKERS: {
|
|
700
|
+
readonly travel: "/cultural-stickers/Travel&Adventure.png";
|
|
701
|
+
readonly design: "/cultural-stickers/Design.png";
|
|
702
|
+
readonly tech: "/cultural-stickers/Science&Technology.png";
|
|
703
|
+
readonly food: "/cultural-stickers/Food.png";
|
|
704
|
+
readonly music: "/cultural-stickers/Music&Entertainment.png";
|
|
705
|
+
readonly photography: "/cultural-stickers/Photography.png";
|
|
706
|
+
readonly fitness: "/cultural-stickers/Health&Fitness.png";
|
|
707
|
+
readonly sports: "/cultural-stickers/Sport.png";
|
|
708
|
+
readonly literature: "/cultural-stickers/Literature&Stories.png";
|
|
709
|
+
readonly cinema: "/cultural-stickers/Television&Cinema.png";
|
|
710
|
+
readonly spiritual: "/cultural-stickers/Spiritual.png";
|
|
711
|
+
readonly nature: "/cultural-stickers/Nature&Wildlife.png";
|
|
712
|
+
readonly business: "/cultural-stickers/Business.png";
|
|
713
|
+
readonly law: "/cultural-stickers/Law.png";
|
|
714
|
+
readonly lifestyle: "/cultural-stickers/Home&Lifestyle.png";
|
|
715
|
+
readonly gaming: "/cultural-stickers/Game.png";
|
|
716
|
+
readonly stories: "/cultural-stickers/Stories&Journal.png";
|
|
717
|
+
};
|
|
718
|
+
declare const CULTURES: readonly [{
|
|
719
|
+
readonly id: "travel";
|
|
720
|
+
readonly name: "Travel & Adventure";
|
|
721
|
+
readonly icon: "/cultural-stickers/Travel&Adventure.png";
|
|
722
|
+
}, {
|
|
723
|
+
readonly id: "design";
|
|
724
|
+
readonly name: "Design";
|
|
725
|
+
readonly icon: "/cultural-stickers/Design.png";
|
|
726
|
+
}, {
|
|
727
|
+
readonly id: "tech";
|
|
728
|
+
readonly name: "Science & Technology";
|
|
729
|
+
readonly icon: "/cultural-stickers/Science&Technology.png";
|
|
730
|
+
}, {
|
|
731
|
+
readonly id: "food";
|
|
732
|
+
readonly name: "Food";
|
|
733
|
+
readonly icon: "/cultural-stickers/Food.png";
|
|
734
|
+
}, {
|
|
735
|
+
readonly id: "music";
|
|
736
|
+
readonly name: "Music & Entertainment";
|
|
737
|
+
readonly icon: "/cultural-stickers/Music&Entertainment.png";
|
|
738
|
+
}, {
|
|
739
|
+
readonly id: "photography";
|
|
740
|
+
readonly name: "Photography";
|
|
741
|
+
readonly icon: "/cultural-stickers/Photography.png";
|
|
742
|
+
}, {
|
|
743
|
+
readonly id: "fitness";
|
|
744
|
+
readonly name: "Health & Fitness";
|
|
745
|
+
readonly icon: "/cultural-stickers/Health&Fitness.png";
|
|
746
|
+
}, {
|
|
747
|
+
readonly id: "sports";
|
|
748
|
+
readonly name: "Sport";
|
|
749
|
+
readonly icon: "/cultural-stickers/Sport.png";
|
|
750
|
+
}, {
|
|
751
|
+
readonly id: "literature";
|
|
752
|
+
readonly name: "Literature & Stories";
|
|
753
|
+
readonly icon: "/cultural-stickers/Literature&Stories.png";
|
|
754
|
+
}, {
|
|
755
|
+
readonly id: "cinema";
|
|
756
|
+
readonly name: "Television & Cinema";
|
|
757
|
+
readonly icon: "/cultural-stickers/Television&Cinema.png";
|
|
758
|
+
}, {
|
|
759
|
+
readonly id: "spiritual";
|
|
760
|
+
readonly name: "Spiritual";
|
|
761
|
+
readonly icon: "/cultural-stickers/Spiritual.png";
|
|
762
|
+
}, {
|
|
763
|
+
readonly id: "nature";
|
|
764
|
+
readonly name: "Nature & Wildlife";
|
|
765
|
+
readonly icon: "/cultural-stickers/Nature&Wildlife.png";
|
|
766
|
+
}, {
|
|
767
|
+
readonly id: "business";
|
|
768
|
+
readonly name: "Business";
|
|
769
|
+
readonly icon: "/cultural-stickers/Business.png";
|
|
770
|
+
}, {
|
|
771
|
+
readonly id: "law";
|
|
772
|
+
readonly name: "Law";
|
|
773
|
+
readonly icon: "/cultural-stickers/Law.png";
|
|
774
|
+
}, {
|
|
775
|
+
readonly id: "lifestyle";
|
|
776
|
+
readonly name: "Home & Lifestyle";
|
|
777
|
+
readonly icon: "/cultural-stickers/Home&Lifestyle.png";
|
|
778
|
+
}, {
|
|
779
|
+
readonly id: "gaming";
|
|
780
|
+
readonly name: "Game";
|
|
781
|
+
readonly icon: "/cultural-stickers/Game.png";
|
|
782
|
+
}, {
|
|
783
|
+
readonly id: "stories";
|
|
784
|
+
readonly name: "Stories & Journal";
|
|
785
|
+
readonly icon: "/cultural-stickers/Stories&Journal.png";
|
|
786
|
+
}];
|
|
787
|
+
type CultureId = typeof CULTURES[number]['id'];
|
|
788
|
+
|
|
789
|
+
export { ASSETS, AsyncStorageAdapter, type BalanceResponse, COUNTRY_CODES, CULTURES, CULTURE_STICKERS, type CultureId, type FormattedTransaction, LocalStorageAdapter, type MovingShineProps, STORAGE_KEYS, type StorageAdapter, type Transaction, type TransactionItemProps, type TransactionListProps, type TransactionsResponse, type WalletBalance, type WalletCardProps, type WalletScreenProps, type WalletUser, ZoApiClient, ZoAuth, type ZoAuthOTPRequest, type ZoAuthOTPVerifyRequest, type ZoAuthResponse, ZoAvatar, type ZoAvatarGenerateRequest, type ZoAvatarGenerateResponse, type ZoAvatarStatusResponse, type ZoErrorResponse, type ZoPassportCompletion, type ZoPassportConfig, type ZoPassportProfile, ZoPassportSDK, ZoProfile, type ZoProfileResponse, type ZoProfileUpdatePayload, type ZoTokenBalanceResponse, type ZoTokenRefreshResponse, type ZoUser, ZoWallet, formatBalance, formatBalanceShort, formatNickname, formatPhoneNumber, formatTransactionAmount, formatWalletAddress, getTransactionColor, logger, parsePhoneNumber };
|