@kryptos_connect/mobile-sdk 1.0.6-dev.0 → 1.0.6
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 +136 -80
- package/dist/index.js +22 -18
- package/dist/index.mjs +22 -18
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @kryptos_connect/mobile-sdk
|
|
2
2
|
|
|
3
|
-
Kryptos Connect Mobile SDK for React Native
|
|
3
|
+
Kryptos Connect Mobile SDK for React Native – works with **Expo** and **React Native CLI**. Seamless Kryptos integration with built-in authentication, theme support, and wallet connectivity. Connect your users to the complete Web3 finance ecosystem with support for 5000+ DeFi protocols, 200+ exchanges and wallets, and 100+ blockchains.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -28,6 +28,13 @@ npx expo install @kryptos_connect/mobile-sdk react-native-svg
|
|
|
28
28
|
cd ios && pod install
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
## Prerequisites
|
|
32
|
+
|
|
33
|
+
Before using this package, you'll need:
|
|
34
|
+
|
|
35
|
+
1. **Client ID**: Obtain from [Kryptos Developer Portal](https://dashboard.kryptos.io)
|
|
36
|
+
2. **WalletConnect Project ID**: Get from [WalletConnect Cloud](https://cloud.walletconnect.com) (optional, for wallet connectivity)
|
|
37
|
+
|
|
31
38
|
## Core library (all-in-one)
|
|
32
39
|
|
|
33
40
|
For Expo or bare React Native, install the core WalletConnect/AppKit deps together:
|
|
@@ -77,7 +84,7 @@ const config = {
|
|
|
77
84
|
appLogo: "https://your-logo-url.com/logo.png", // or require('./logo.png')
|
|
78
85
|
clientId: "your-client-id",
|
|
79
86
|
theme: "light", // or 'dark'
|
|
80
|
-
walletConnectProjectId: "your-walletconnect-project-id",
|
|
87
|
+
walletConnectProjectId: "your-walletconnect-project-id",
|
|
81
88
|
};
|
|
82
89
|
|
|
83
90
|
export default function App() {
|
|
@@ -89,6 +96,16 @@ export default function App() {
|
|
|
89
96
|
}
|
|
90
97
|
```
|
|
91
98
|
|
|
99
|
+
### Configuration Options
|
|
100
|
+
|
|
101
|
+
| Property | Type | Required | Description |
|
|
102
|
+
| ------------------------ | ------------------------------------------ | -------- | --------------------------------------------------------------------------- |
|
|
103
|
+
| `appName` | `string` | Yes | Your application name |
|
|
104
|
+
| `appLogo` | `React.ReactNode \| string \| ImageSource` | No | Your app logo (URL, `require()`, or React Native image source) |
|
|
105
|
+
| `clientId` | `string` | Yes | Your Kryptos client ID |
|
|
106
|
+
| `theme` | `"light" \| "dark"` | No | Default theme mode (defaults to `"light"` if not set) |
|
|
107
|
+
| `walletConnectProjectId` | `string` | No | Your WalletConnect project ID (enables built-in AppKit / wallet connection) |
|
|
108
|
+
|
|
92
109
|
### 2. Add the Connect Button
|
|
93
110
|
|
|
94
111
|
```tsx
|
|
@@ -138,29 +155,27 @@ function YourComponent() {
|
|
|
138
155
|
}
|
|
139
156
|
```
|
|
140
157
|
|
|
141
|
-
|
|
158
|
+
#### User Flow Variations
|
|
142
159
|
|
|
143
160
|
The SDK automatically handles two different user flows based on the `isAuthorized` flag returned from `generateLinkToken`:
|
|
144
161
|
|
|
145
|
-
|
|
162
|
+
**Flow 1: New User** (`isAuthorized: false` or undefined)
|
|
146
163
|
|
|
147
164
|
```
|
|
148
|
-
INIT →
|
|
165
|
+
INIT → Connect → INTEGRATION → STATUS
|
|
149
166
|
```
|
|
150
167
|
|
|
151
|
-
-
|
|
152
|
-
- User selects integrations
|
|
153
|
-
-
|
|
154
|
-
- Returns `public_token` in `onSuccess` callback
|
|
168
|
+
- **INIT (Connect)**: Fetches link token and initializes the session & an account is created for them on the backend
|
|
169
|
+
- **INTEGRATION**: User selects and connects integrations (wallets, exchanges, blockchains)
|
|
170
|
+
- **STATUS**: Success or error result; returns `public_token` in `onSuccess` when consent is given, or `null` when user was already authorized
|
|
155
171
|
|
|
156
|
-
|
|
172
|
+
**Flow 2: Authenticated User** (`isAuthorized: true`)
|
|
157
173
|
|
|
158
174
|
```
|
|
159
175
|
INIT → INTEGRATION → STATUS
|
|
160
176
|
```
|
|
161
177
|
|
|
162
|
-
- Skips
|
|
163
|
-
- Skips permissions (already consented)
|
|
178
|
+
- Skips Connect (an account already exists for the user on the backend)
|
|
164
179
|
- User directly selects integrations
|
|
165
180
|
- Returns `null` in `onSuccess` callback (no new token needed)
|
|
166
181
|
|
|
@@ -290,15 +305,39 @@ const styles = StyleSheet.create({
|
|
|
290
305
|
});
|
|
291
306
|
```
|
|
292
307
|
|
|
293
|
-
|
|
308
|
+
#### Direct Integration Flow
|
|
294
309
|
|
|
295
|
-
|
|
310
|
+
You can use the `integrationName` prop to direct users to a specific integration, bypassing the general integration selection. Useful for dedicated buttons for specific exchanges or wallets.
|
|
296
311
|
|
|
297
|
-
|
|
312
|
+
**Getting supported integration IDs:** Fetch from the public Kryptos API:
|
|
298
313
|
|
|
299
|
-
|
|
314
|
+
```bash
|
|
315
|
+
GET {BASE_URL}/integrations/public/list
|
|
316
|
+
```
|
|
300
317
|
|
|
301
|
-
|
|
318
|
+
**Usage example:**
|
|
319
|
+
|
|
320
|
+
```tsx
|
|
321
|
+
// Direct connection to a specific integration (e.g. Binance)
|
|
322
|
+
<KryptosConnectButton
|
|
323
|
+
generateLinkToken={generateLinkToken}
|
|
324
|
+
integrationName="binance"
|
|
325
|
+
onSuccess={(userConsent) => {
|
|
326
|
+
console.log("Binance connected:", userConsent);
|
|
327
|
+
}}
|
|
328
|
+
>
|
|
329
|
+
Connect Binance Account
|
|
330
|
+
</KryptosConnectButton>
|
|
331
|
+
|
|
332
|
+
// Default button text when integrationName is set: "Connect {Integration} Account"
|
|
333
|
+
<KryptosConnectButton
|
|
334
|
+
generateLinkToken={generateLinkToken}
|
|
335
|
+
integrationName="metamask"
|
|
336
|
+
onSuccess={(userConsent) => console.log("MetaMask connected:", userConsent)}
|
|
337
|
+
/>
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
**Use cases:** Dedicated integration buttons, contextual integration (e.g. exchange-focused screens), onboarding steps (e.g. connect wallet then exchange). The `integrationName` value must match an integration ID from the supported providers list.
|
|
302
341
|
|
|
303
342
|
## API Reference
|
|
304
343
|
|
|
@@ -331,14 +370,15 @@ The main button component that triggers the connection flow.
|
|
|
331
370
|
|
|
332
371
|
#### Props
|
|
333
372
|
|
|
334
|
-
| Prop | Type | Required | Description
|
|
335
|
-
| ------------------- | --------------------------------------------------------------- | -------- |
|
|
336
|
-
| `generateLinkToken` | `() => Promise<{ link_token: string; isAuthorized?: boolean }>` | Yes | Function that returns link token and authorization status. `isAuthorized: true`
|
|
337
|
-
| `onSuccess` | `(
|
|
338
|
-
| `onError` | `(error?: Error) => void` | No | Callback
|
|
339
|
-
| `
|
|
340
|
-
| `
|
|
341
|
-
| `
|
|
373
|
+
| Prop | Type | Required | Description |
|
|
374
|
+
| ------------------- | --------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
375
|
+
| `generateLinkToken` | `() => Promise<{ link_token: string; isAuthorized?: boolean }>` | Yes | Function that returns link token and authorization status. `isAuthorized: true` indicates the user is already authorized (consent API may be skipped; `onSuccess` receives `null`) |
|
|
376
|
+
| `onSuccess` | `(data: UserConsent \| null) => void` | No | Callback invoked when connection succeeds. Receives `public_token` for new users, `null` for authorized users |
|
|
377
|
+
| `onError` | `(error?: Error) => void` | No | Callback invoked when connection fails |
|
|
378
|
+
| `integrationName` | `string` | No | Integration ID from the supported providers list. When provided, skips the integration list and goes directly to that integration |
|
|
379
|
+
| `children` | `ReactNode` | No | Custom button content. Defaults to "Connect With Kryptos", or "Connect {Integration} Account" when `integrationName` is set |
|
|
380
|
+
| `style` | `ViewStyle` | No | Custom button container style |
|
|
381
|
+
| `textStyle` | `TextStyle` | No | Custom button text style |
|
|
342
382
|
|
|
343
383
|
#### TypeScript Types
|
|
344
384
|
|
|
@@ -350,6 +390,7 @@ interface KryptosConnectButtonProps {
|
|
|
350
390
|
}>;
|
|
351
391
|
onSuccess?: (data: UserConsent | null) => void;
|
|
352
392
|
onError?: (error?: Error) => void;
|
|
393
|
+
integrationName?: string; // Integration ID from the supported providers list
|
|
353
394
|
children?: ReactNode;
|
|
354
395
|
style?: ViewStyle;
|
|
355
396
|
textStyle?: TextStyle;
|
|
@@ -365,23 +406,40 @@ interface UserConsent {
|
|
|
365
406
|
// - null for authenticated users (isAuthorized: true)
|
|
366
407
|
```
|
|
367
408
|
|
|
409
|
+
### TypeScript
|
|
410
|
+
|
|
411
|
+
The package includes type definitions. You can import types from the package:
|
|
412
|
+
|
|
413
|
+
```typescript
|
|
414
|
+
import type {
|
|
415
|
+
KryptosConnectButtonProps,
|
|
416
|
+
KryptosConfig,
|
|
417
|
+
UserConsent,
|
|
418
|
+
} from "@kryptos_connect/mobile-sdk";
|
|
419
|
+
```
|
|
420
|
+
|
|
368
421
|
## Backend Integration
|
|
369
422
|
|
|
370
|
-
You
|
|
423
|
+
You need to implement two backend endpoints. The same API is used for web and mobile.
|
|
371
424
|
|
|
372
425
|
### Base URLs
|
|
373
426
|
|
|
374
|
-
| Environment | URL
|
|
375
|
-
| -------------- |
|
|
376
|
-
| **Production** | `https://connect-api.kryptos.io
|
|
427
|
+
| Environment | URL |
|
|
428
|
+
| -------------- | -------------------------------- |
|
|
429
|
+
| **Production** | `https://connect-api.kryptos.io` |
|
|
377
430
|
|
|
378
431
|
### 1. Create Link Token
|
|
379
432
|
|
|
380
|
-
|
|
433
|
+
A link token can be created in two ways: to authenticate an existing user or to create a new session.
|
|
434
|
+
|
|
435
|
+
| Approach | When to use |
|
|
436
|
+
| -------- | -------------------------------- |
|
|
437
|
+
| Option A | New user, no access token |
|
|
438
|
+
| Option B | Returning user, has access token |
|
|
381
439
|
|
|
382
440
|
#### Option A: Without Access Token (New/Anonymous User)
|
|
383
441
|
|
|
384
|
-
Use this approach for **new users**
|
|
442
|
+
Use this approach for **new users** (no access token):
|
|
385
443
|
|
|
386
444
|
```javascript
|
|
387
445
|
// Example: Node.js/Express
|
|
@@ -402,7 +460,7 @@ app.post("/api/kryptos/create-link-token", async (req, res) => {
|
|
|
402
460
|
|
|
403
461
|
const data = await response.json();
|
|
404
462
|
res.json({
|
|
405
|
-
link_token: data.
|
|
463
|
+
link_token: data.link_token,
|
|
406
464
|
isAuthorized: false, // No access token provided
|
|
407
465
|
});
|
|
408
466
|
} catch (error) {
|
|
@@ -411,18 +469,16 @@ app.post("/api/kryptos/create-link-token", async (req, res) => {
|
|
|
411
469
|
});
|
|
412
470
|
```
|
|
413
471
|
|
|
414
|
-
**User
|
|
472
|
+
**User experience flow:**
|
|
415
473
|
|
|
416
|
-
1. User
|
|
417
|
-
2.
|
|
418
|
-
3. User
|
|
419
|
-
4.
|
|
420
|
-
5. User grants permissions
|
|
421
|
-
6. `onSuccess` receives `public_token` to exchange
|
|
474
|
+
1. User taps "Connect to Kryptos"
|
|
475
|
+
2. Connect (INIT) screen initializes, then integration selection is shown
|
|
476
|
+
3. User selects and connects integrations
|
|
477
|
+
4. `onSuccess` receives `public_token` to exchange
|
|
422
478
|
|
|
423
479
|
#### Option B: With Access Token (Authenticated User)
|
|
424
480
|
|
|
425
|
-
Use this approach for **existing authenticated users
|
|
481
|
+
Use this approach for **existing authenticated users**:
|
|
426
482
|
|
|
427
483
|
```javascript
|
|
428
484
|
// Example: Node.js/Express
|
|
@@ -447,7 +503,7 @@ app.post("/api/kryptos/create-link-token", async (req, res) => {
|
|
|
447
503
|
|
|
448
504
|
const data = await response.json();
|
|
449
505
|
res.json({
|
|
450
|
-
link_token: data.
|
|
506
|
+
link_token: data.link_token,
|
|
451
507
|
isAuthorized: true, // Access token provided, user is authenticated
|
|
452
508
|
});
|
|
453
509
|
} catch (error) {
|
|
@@ -456,32 +512,30 @@ app.post("/api/kryptos/create-link-token", async (req, res) => {
|
|
|
456
512
|
});
|
|
457
513
|
```
|
|
458
514
|
|
|
459
|
-
**User
|
|
515
|
+
**User experience flow:**
|
|
460
516
|
|
|
461
|
-
1. User
|
|
462
|
-
2.
|
|
463
|
-
3. User selects integrations
|
|
464
|
-
4. `onSuccess` receives `null` (no new token needed)
|
|
517
|
+
1. User taps "Connect to Kryptos"
|
|
518
|
+
2. Connect (INIT) then integration selection is shown
|
|
519
|
+
3. User selects integrations; `onSuccess` receives `null` (no new token needed)
|
|
465
520
|
|
|
466
521
|
#### Choosing the Right Approach
|
|
467
522
|
|
|
468
|
-
| Scenario | Use Option | isAuthorized | User Flow
|
|
469
|
-
| ------------------------------------------ | ----------------- | ------------ |
|
|
470
|
-
| First-time user connecting to Kryptos | A (Without Token) | `false` |
|
|
471
|
-
| User doesn't have an access token yet | A (Without Token) | `false` |
|
|
472
|
-
| Returning user with stored access token | B (With Token) | `true` | INTEGRATION
|
|
473
|
-
| Adding more integrations for existing user | B (With Token) | `true` | INTEGRATION
|
|
523
|
+
| Scenario | Use Option | isAuthorized | User Flow (mobile) | Returns public_token |
|
|
524
|
+
| ------------------------------------------ | ----------------- | ------------ | -------------------------------------------------------------------------- | -------------------- |
|
|
525
|
+
| First-time user connecting to Kryptos | A (Without Token) | `false` | INIT → Connect(account created for user on backend) → INTEGRATION → STATUS | ✅ Yes |
|
|
526
|
+
| User doesn't have an access token yet | A (Without Token) | `false` | INIT → Connect(account created for user on backend) → INTEGRATION → STATUS | ✅ Yes |
|
|
527
|
+
| Returning user with stored access token | B (With Token) | `true` | INIT → INTEGRATION → STATUS | ❌ No |
|
|
528
|
+
| Adding more integrations for existing user | B (With Token) | `true` | INIT → INTEGRATION → STATUS | ❌ No |
|
|
474
529
|
|
|
475
|
-
**Important
|
|
530
|
+
**Important notes:**
|
|
476
531
|
|
|
477
|
-
- After the first successful connection (
|
|
478
|
-
- Use the stored `access_token` for subsequent connections (Option B)
|
|
479
|
-
- For authorized users (`isAuthorized: true`),
|
|
480
|
-
- Authorized users skip both the login/OTP and permissions steps
|
|
532
|
+
- After the first successful connection (Option A), store the `access_token` from the token exchange.
|
|
533
|
+
- Use the stored `access_token` for subsequent connections (Option B).
|
|
534
|
+
- For authorized users (`isAuthorized: true`), `onSuccess` receives `null`.
|
|
481
535
|
|
|
482
536
|
### 2. Exchange Public Token
|
|
483
537
|
|
|
484
|
-
After a successful connection, exchange the `public_token` for an `access_token`. **Important
|
|
538
|
+
After a successful connection, exchange the `public_token` for an `access_token`. **Important:** Store this `access_token` securely in your database. You will use it to create link tokens for authenticated users (Option B above).
|
|
485
539
|
|
|
486
540
|
```javascript
|
|
487
541
|
// Example: Node.js/Express
|
|
@@ -493,11 +547,11 @@ app.post("/api/kryptos/exchange-token", async (req, res) => {
|
|
|
493
547
|
method: "POST",
|
|
494
548
|
headers: {
|
|
495
549
|
"Content-Type": "application/json",
|
|
550
|
+
"X-Client-Id": YOUR_CLIENT_ID,
|
|
551
|
+
"X-Client-Secret": YOUR_CLIENT_SECRET,
|
|
496
552
|
},
|
|
497
553
|
body: JSON.stringify({
|
|
498
554
|
public_token,
|
|
499
|
-
client_id: YOUR_CLIENT_ID,
|
|
500
|
-
client_secret: YOUR_CLIENT_SECRET,
|
|
501
555
|
}),
|
|
502
556
|
});
|
|
503
557
|
|
|
@@ -505,9 +559,9 @@ app.post("/api/kryptos/exchange-token", async (req, res) => {
|
|
|
505
559
|
|
|
506
560
|
// IMPORTANT: Store the access_token securely in your database
|
|
507
561
|
// You'll need this token to:
|
|
508
|
-
// 1. Create authenticated link tokens (
|
|
562
|
+
// 1. Create authenticated link tokens (Option B)
|
|
509
563
|
// 2. Make API calls on behalf of the user
|
|
510
|
-
await saveUserAccessToken(req.user.id, data.
|
|
564
|
+
await saveUserAccessToken(req.user.id, data.access_token);
|
|
511
565
|
|
|
512
566
|
res.json({ success: true });
|
|
513
567
|
} catch (error) {
|
|
@@ -516,29 +570,26 @@ app.post("/api/kryptos/exchange-token", async (req, res) => {
|
|
|
516
570
|
});
|
|
517
571
|
```
|
|
518
572
|
|
|
519
|
-
**Complete
|
|
573
|
+
**Complete integration flow:**
|
|
520
574
|
|
|
521
|
-
1. **First
|
|
575
|
+
1. **First connection** (new user – `isAuthorized: false`):
|
|
522
576
|
|
|
523
577
|
```
|
|
524
578
|
App → generateLinkToken() [returns { link_token, isAuthorized: false }]
|
|
525
|
-
→ SDK
|
|
526
|
-
→ User
|
|
527
|
-
→
|
|
528
|
-
→ User grants permissions
|
|
529
|
-
→ onSuccess receives { public_token: "..." }
|
|
579
|
+
→ SDK: INIT → Connect → INTEGRATION → STATUS
|
|
580
|
+
→ User selects and connects integrations
|
|
581
|
+
→ onSuccess receives { public_token }
|
|
530
582
|
→ Backend exchanges public_token for access_token
|
|
531
583
|
→ Store access_token in database ← IMPORTANT
|
|
532
584
|
```
|
|
533
585
|
|
|
534
|
-
2. **Subsequent
|
|
586
|
+
2. **Subsequent connections** (returning user – `isAuthorized: true`):
|
|
535
587
|
```
|
|
536
588
|
App → generateLinkToken() [returns { link_token, isAuthorized: true }]
|
|
537
|
-
→ SDK
|
|
538
|
-
→ User
|
|
539
|
-
→
|
|
540
|
-
→
|
|
541
|
-
→ Integrations are added to user's existing account
|
|
589
|
+
→ SDK: INIT → INTEGRATION → STATUS
|
|
590
|
+
→ User sees integrations directly → connects more
|
|
591
|
+
→ onSuccess receives null
|
|
592
|
+
→ Integrations added to existing account
|
|
542
593
|
```
|
|
543
594
|
|
|
544
595
|
## Supported Platforms
|
|
@@ -558,12 +609,17 @@ app.post("/api/kryptos/exchange-token", async (req, res) => {
|
|
|
558
609
|
}
|
|
559
610
|
```
|
|
560
611
|
|
|
612
|
+
## Support
|
|
613
|
+
|
|
614
|
+
- 📧 Email: [support@kryptos.io](mailto:support@kryptos.io)
|
|
615
|
+
- 📚 Documentation: [https://docs.kryptos.io](https://docs.kryptos.io)
|
|
616
|
+
- 💬 Discord: [Join our community](https://discord.gg/kryptos)
|
|
617
|
+
- 🐛 Issues: [GitHub Issues](https://github.com/kryptos/connect-npm-package/issues)
|
|
618
|
+
|
|
561
619
|
## License
|
|
562
620
|
|
|
563
|
-
MIT © Kryptos
|
|
621
|
+
MIT © [Kryptos](https://kryptos.io)
|
|
564
622
|
|
|
565
|
-
|
|
623
|
+
---
|
|
566
624
|
|
|
567
|
-
|
|
568
|
-
- 📚 Documentation: https://dashboard.kryptos.io
|
|
569
|
-
- 🐛 Issues: https://github.com/Kryptoskatt/kryptos-connect-mobile-package/issues
|
|
625
|
+
Made with ❤️ by the Kryptos team
|
package/dist/index.js
CHANGED
|
@@ -1644,7 +1644,7 @@ var Auth = ({
|
|
|
1644
1644
|
const err = error;
|
|
1645
1645
|
console.error(error);
|
|
1646
1646
|
setErrorMessage(
|
|
1647
|
-
err?.response?.data?.message || "Failed to continue as guest"
|
|
1647
|
+
err?.response?.data?.error || err?.response?.data?.message || "Failed to continue as guest"
|
|
1648
1648
|
);
|
|
1649
1649
|
} finally {
|
|
1650
1650
|
setIsLoading(false);
|
|
@@ -2306,12 +2306,13 @@ var WalletConnectComponent = ({
|
|
|
2306
2306
|
modalOpen,
|
|
2307
2307
|
setAddIntegrationMode,
|
|
2308
2308
|
providersList,
|
|
2309
|
-
errorMessage
|
|
2309
|
+
errorMessage,
|
|
2310
|
+
showBackButton
|
|
2310
2311
|
}) => {
|
|
2311
2312
|
const { walletConnectProjectId } = useKryptosConnect();
|
|
2312
2313
|
const theme = useTheme();
|
|
2313
2314
|
if (!walletConnectProjectId) {
|
|
2314
|
-
return /* @__PURE__ */ import_react32.default.createElement(Modal, { isOpen: modalOpen, onClose: handleClose, size: "full" }, /* @__PURE__ */ import_react32.default.createElement(ModalHeader, { onClose: handleClose }, /* @__PURE__ */ import_react32.default.createElement(import_react_native16.View, { style: styles14.headerContent }, /* @__PURE__ */ import_react32.default.createElement(
|
|
2315
|
+
return /* @__PURE__ */ import_react32.default.createElement(Modal, { isOpen: modalOpen, onClose: handleClose, size: "full" }, /* @__PURE__ */ import_react32.default.createElement(ModalHeader, { onClose: handleClose }, /* @__PURE__ */ import_react32.default.createElement(import_react_native16.View, { style: styles14.headerContent }, showBackButton && /* @__PURE__ */ import_react32.default.createElement(
|
|
2315
2316
|
import_react_native16.TouchableOpacity,
|
|
2316
2317
|
{
|
|
2317
2318
|
onPress: () => {
|
|
@@ -2356,7 +2357,8 @@ var WalletConnectComponent = ({
|
|
|
2356
2357
|
modalOpen,
|
|
2357
2358
|
setAddIntegrationMode,
|
|
2358
2359
|
providersList,
|
|
2359
|
-
errorMessage
|
|
2360
|
+
errorMessage,
|
|
2361
|
+
showBackButton
|
|
2360
2362
|
}
|
|
2361
2363
|
));
|
|
2362
2364
|
};
|
|
@@ -2367,7 +2369,8 @@ function ConnectButton({
|
|
|
2367
2369
|
modalOpen,
|
|
2368
2370
|
setAddIntegrationMode,
|
|
2369
2371
|
providersList,
|
|
2370
|
-
errorMessage: errorMessageProp
|
|
2372
|
+
errorMessage: errorMessageProp,
|
|
2373
|
+
showBackButton
|
|
2371
2374
|
}) {
|
|
2372
2375
|
const theme = useTheme();
|
|
2373
2376
|
const { open, disconnect } = (0, import_appkit_react_native3.useAppKit)();
|
|
@@ -2551,7 +2554,7 @@ function ConnectButton({
|
|
|
2551
2554
|
isNftSupported: provider?.isEvmWallet || provider?.nftSupport || false,
|
|
2552
2555
|
isCustomWallet: false,
|
|
2553
2556
|
chainId: provider?.community_id,
|
|
2554
|
-
address
|
|
2557
|
+
address
|
|
2555
2558
|
};
|
|
2556
2559
|
integrationsToAdd.push(data);
|
|
2557
2560
|
} else {
|
|
@@ -2609,7 +2612,7 @@ function ConnectButton({
|
|
|
2609
2612
|
}
|
|
2610
2613
|
handleClose();
|
|
2611
2614
|
};
|
|
2612
|
-
return /* @__PURE__ */ import_react32.default.createElement(Modal, { isOpen: modalOpen, onClose, size: "full" }, /* @__PURE__ */ import_react32.default.createElement(ModalHeader, { onClose }, /* @__PURE__ */ import_react32.default.createElement(import_react_native16.View, { style: styles14.headerContent }, /* @__PURE__ */ import_react32.default.createElement(
|
|
2615
|
+
return /* @__PURE__ */ import_react32.default.createElement(Modal, { isOpen: modalOpen, onClose, size: "full" }, /* @__PURE__ */ import_react32.default.createElement(ModalHeader, { onClose }, /* @__PURE__ */ import_react32.default.createElement(import_react_native16.View, { style: styles14.headerContent }, showBackButton && /* @__PURE__ */ import_react32.default.createElement(
|
|
2613
2616
|
import_react_native16.TouchableOpacity,
|
|
2614
2617
|
{
|
|
2615
2618
|
onPress: () => {
|
|
@@ -3353,12 +3356,12 @@ var IntegrationForm = ({
|
|
|
3353
3356
|
if (result.status === "fulfilled" && result.value?.valid) {
|
|
3354
3357
|
const data = {
|
|
3355
3358
|
alias,
|
|
3356
|
-
exchange:
|
|
3357
|
-
id:
|
|
3358
|
-
public_name:
|
|
3359
|
+
exchange: chain.id.toLowerCase(),
|
|
3360
|
+
id: chain.id,
|
|
3361
|
+
public_name: chain.public_name || "",
|
|
3359
3362
|
sync_time: (/* @__PURE__ */ new Date()).getTime(),
|
|
3360
3363
|
fetchAll: true,
|
|
3361
|
-
logo:
|
|
3364
|
+
logo: chain.logo ? chain.logo : null,
|
|
3362
3365
|
startTime: null,
|
|
3363
3366
|
endTime: null,
|
|
3364
3367
|
uid: user?.user_id || "",
|
|
@@ -3368,11 +3371,11 @@ var IntegrationForm = ({
|
|
|
3368
3371
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3369
3372
|
},
|
|
3370
3373
|
addedOn: (/* @__PURE__ */ new Date()).getTime(),
|
|
3371
|
-
default_chain:
|
|
3374
|
+
default_chain: metadata.id,
|
|
3372
3375
|
default_chain_logo: "",
|
|
3373
3376
|
type: metadata.type,
|
|
3374
|
-
isNftSupported: metadata.isEvmWallet || metadata.nftSupport
|
|
3375
|
-
chainId: chain?.community_id
|
|
3377
|
+
isNftSupported: metadata.isEvmWallet || metadata.nftSupport ? true : false,
|
|
3378
|
+
chainId: chain?.community_id,
|
|
3376
3379
|
address: formValues.address,
|
|
3377
3380
|
isCustomWallet: false
|
|
3378
3381
|
};
|
|
@@ -3393,7 +3396,7 @@ var IntegrationForm = ({
|
|
|
3393
3396
|
setChainErrors(errors);
|
|
3394
3397
|
if (Object.keys(errors).length > 0) {
|
|
3395
3398
|
setErrorMessage(
|
|
3396
|
-
`Cannot add integrations. ${Object.keys(errors).length} chain${Object.keys(errors).length > 1 ? "s" : ""} failed verification.`
|
|
3399
|
+
`Cannot add integrations. ${Object.keys(errors).length} chain${Object.keys(errors).length > 1 ? "s" : ""} failed verification. Please fix the errors and try again.`
|
|
3397
3400
|
);
|
|
3398
3401
|
return;
|
|
3399
3402
|
}
|
|
@@ -3429,7 +3432,7 @@ var IntegrationForm = ({
|
|
|
3429
3432
|
public_name: metadata.public_name,
|
|
3430
3433
|
sync_time: (/* @__PURE__ */ new Date()).getTime(),
|
|
3431
3434
|
fetchAll: true,
|
|
3432
|
-
logo: metadata.logo
|
|
3435
|
+
logo: metadata.logo ? metadata.logo : null,
|
|
3433
3436
|
startTime: null,
|
|
3434
3437
|
endTime: null,
|
|
3435
3438
|
uid: user?.user_id || "",
|
|
@@ -3442,7 +3445,7 @@ var IntegrationForm = ({
|
|
|
3442
3445
|
default_chain: metadata.id,
|
|
3443
3446
|
default_chain_logo: "",
|
|
3444
3447
|
type: metadata.type,
|
|
3445
|
-
isNftSupported: metadata.isEvmWallet || metadata.nftSupport
|
|
3448
|
+
isNftSupported: metadata.isEvmWallet || metadata.nftSupport ? true : false,
|
|
3446
3449
|
isCustomWallet: false
|
|
3447
3450
|
};
|
|
3448
3451
|
if (metadata.community_id) {
|
|
@@ -3652,7 +3655,8 @@ var IntegrationForm = ({
|
|
|
3652
3655
|
setAddIntegrationMode,
|
|
3653
3656
|
handleClose,
|
|
3654
3657
|
providersList,
|
|
3655
|
-
errorMessage: errorMessageProp
|
|
3658
|
+
errorMessage: errorMessageProp,
|
|
3659
|
+
showBackButton
|
|
3656
3660
|
}
|
|
3657
3661
|
));
|
|
3658
3662
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1642,7 +1642,7 @@ var Auth = ({
|
|
|
1642
1642
|
const err = error;
|
|
1643
1643
|
console.error(error);
|
|
1644
1644
|
setErrorMessage(
|
|
1645
|
-
err?.response?.data?.message || "Failed to continue as guest"
|
|
1645
|
+
err?.response?.data?.error || err?.response?.data?.message || "Failed to continue as guest"
|
|
1646
1646
|
);
|
|
1647
1647
|
} finally {
|
|
1648
1648
|
setIsLoading(false);
|
|
@@ -2321,12 +2321,13 @@ var WalletConnectComponent = ({
|
|
|
2321
2321
|
modalOpen,
|
|
2322
2322
|
setAddIntegrationMode,
|
|
2323
2323
|
providersList,
|
|
2324
|
-
errorMessage
|
|
2324
|
+
errorMessage,
|
|
2325
|
+
showBackButton
|
|
2325
2326
|
}) => {
|
|
2326
2327
|
const { walletConnectProjectId } = useKryptosConnect();
|
|
2327
2328
|
const theme = useTheme();
|
|
2328
2329
|
if (!walletConnectProjectId) {
|
|
2329
|
-
return /* @__PURE__ */ React32.createElement(Modal, { isOpen: modalOpen, onClose: handleClose, size: "full" }, /* @__PURE__ */ React32.createElement(ModalHeader, { onClose: handleClose }, /* @__PURE__ */ React32.createElement(View14, { style: styles14.headerContent }, /* @__PURE__ */ React32.createElement(
|
|
2330
|
+
return /* @__PURE__ */ React32.createElement(Modal, { isOpen: modalOpen, onClose: handleClose, size: "full" }, /* @__PURE__ */ React32.createElement(ModalHeader, { onClose: handleClose }, /* @__PURE__ */ React32.createElement(View14, { style: styles14.headerContent }, showBackButton && /* @__PURE__ */ React32.createElement(
|
|
2330
2331
|
TouchableOpacity4,
|
|
2331
2332
|
{
|
|
2332
2333
|
onPress: () => {
|
|
@@ -2371,7 +2372,8 @@ var WalletConnectComponent = ({
|
|
|
2371
2372
|
modalOpen,
|
|
2372
2373
|
setAddIntegrationMode,
|
|
2373
2374
|
providersList,
|
|
2374
|
-
errorMessage
|
|
2375
|
+
errorMessage,
|
|
2376
|
+
showBackButton
|
|
2375
2377
|
}
|
|
2376
2378
|
));
|
|
2377
2379
|
};
|
|
@@ -2382,7 +2384,8 @@ function ConnectButton({
|
|
|
2382
2384
|
modalOpen,
|
|
2383
2385
|
setAddIntegrationMode,
|
|
2384
2386
|
providersList,
|
|
2385
|
-
errorMessage: errorMessageProp
|
|
2387
|
+
errorMessage: errorMessageProp,
|
|
2388
|
+
showBackButton
|
|
2386
2389
|
}) {
|
|
2387
2390
|
const theme = useTheme();
|
|
2388
2391
|
const { open, disconnect } = useAppKit();
|
|
@@ -2566,7 +2569,7 @@ function ConnectButton({
|
|
|
2566
2569
|
isNftSupported: provider?.isEvmWallet || provider?.nftSupport || false,
|
|
2567
2570
|
isCustomWallet: false,
|
|
2568
2571
|
chainId: provider?.community_id,
|
|
2569
|
-
address
|
|
2572
|
+
address
|
|
2570
2573
|
};
|
|
2571
2574
|
integrationsToAdd.push(data);
|
|
2572
2575
|
} else {
|
|
@@ -2624,7 +2627,7 @@ function ConnectButton({
|
|
|
2624
2627
|
}
|
|
2625
2628
|
handleClose();
|
|
2626
2629
|
};
|
|
2627
|
-
return /* @__PURE__ */ React32.createElement(Modal, { isOpen: modalOpen, onClose, size: "full" }, /* @__PURE__ */ React32.createElement(ModalHeader, { onClose }, /* @__PURE__ */ React32.createElement(View14, { style: styles14.headerContent }, /* @__PURE__ */ React32.createElement(
|
|
2630
|
+
return /* @__PURE__ */ React32.createElement(Modal, { isOpen: modalOpen, onClose, size: "full" }, /* @__PURE__ */ React32.createElement(ModalHeader, { onClose }, /* @__PURE__ */ React32.createElement(View14, { style: styles14.headerContent }, showBackButton && /* @__PURE__ */ React32.createElement(
|
|
2628
2631
|
TouchableOpacity4,
|
|
2629
2632
|
{
|
|
2630
2633
|
onPress: () => {
|
|
@@ -3374,12 +3377,12 @@ var IntegrationForm = ({
|
|
|
3374
3377
|
if (result.status === "fulfilled" && result.value?.valid) {
|
|
3375
3378
|
const data = {
|
|
3376
3379
|
alias,
|
|
3377
|
-
exchange:
|
|
3378
|
-
id:
|
|
3379
|
-
public_name:
|
|
3380
|
+
exchange: chain.id.toLowerCase(),
|
|
3381
|
+
id: chain.id,
|
|
3382
|
+
public_name: chain.public_name || "",
|
|
3380
3383
|
sync_time: (/* @__PURE__ */ new Date()).getTime(),
|
|
3381
3384
|
fetchAll: true,
|
|
3382
|
-
logo:
|
|
3385
|
+
logo: chain.logo ? chain.logo : null,
|
|
3383
3386
|
startTime: null,
|
|
3384
3387
|
endTime: null,
|
|
3385
3388
|
uid: user?.user_id || "",
|
|
@@ -3389,11 +3392,11 @@ var IntegrationForm = ({
|
|
|
3389
3392
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3390
3393
|
},
|
|
3391
3394
|
addedOn: (/* @__PURE__ */ new Date()).getTime(),
|
|
3392
|
-
default_chain:
|
|
3395
|
+
default_chain: metadata.id,
|
|
3393
3396
|
default_chain_logo: "",
|
|
3394
3397
|
type: metadata.type,
|
|
3395
|
-
isNftSupported: metadata.isEvmWallet || metadata.nftSupport
|
|
3396
|
-
chainId: chain?.community_id
|
|
3398
|
+
isNftSupported: metadata.isEvmWallet || metadata.nftSupport ? true : false,
|
|
3399
|
+
chainId: chain?.community_id,
|
|
3397
3400
|
address: formValues.address,
|
|
3398
3401
|
isCustomWallet: false
|
|
3399
3402
|
};
|
|
@@ -3414,7 +3417,7 @@ var IntegrationForm = ({
|
|
|
3414
3417
|
setChainErrors(errors);
|
|
3415
3418
|
if (Object.keys(errors).length > 0) {
|
|
3416
3419
|
setErrorMessage(
|
|
3417
|
-
`Cannot add integrations. ${Object.keys(errors).length} chain${Object.keys(errors).length > 1 ? "s" : ""} failed verification.`
|
|
3420
|
+
`Cannot add integrations. ${Object.keys(errors).length} chain${Object.keys(errors).length > 1 ? "s" : ""} failed verification. Please fix the errors and try again.`
|
|
3418
3421
|
);
|
|
3419
3422
|
return;
|
|
3420
3423
|
}
|
|
@@ -3450,7 +3453,7 @@ var IntegrationForm = ({
|
|
|
3450
3453
|
public_name: metadata.public_name,
|
|
3451
3454
|
sync_time: (/* @__PURE__ */ new Date()).getTime(),
|
|
3452
3455
|
fetchAll: true,
|
|
3453
|
-
logo: metadata.logo
|
|
3456
|
+
logo: metadata.logo ? metadata.logo : null,
|
|
3454
3457
|
startTime: null,
|
|
3455
3458
|
endTime: null,
|
|
3456
3459
|
uid: user?.user_id || "",
|
|
@@ -3463,7 +3466,7 @@ var IntegrationForm = ({
|
|
|
3463
3466
|
default_chain: metadata.id,
|
|
3464
3467
|
default_chain_logo: "",
|
|
3465
3468
|
type: metadata.type,
|
|
3466
|
-
isNftSupported: metadata.isEvmWallet || metadata.nftSupport
|
|
3469
|
+
isNftSupported: metadata.isEvmWallet || metadata.nftSupport ? true : false,
|
|
3467
3470
|
isCustomWallet: false
|
|
3468
3471
|
};
|
|
3469
3472
|
if (metadata.community_id) {
|
|
@@ -3673,7 +3676,8 @@ var IntegrationForm = ({
|
|
|
3673
3676
|
setAddIntegrationMode,
|
|
3674
3677
|
handleClose,
|
|
3675
3678
|
providersList,
|
|
3676
|
-
errorMessage: errorMessageProp
|
|
3679
|
+
errorMessage: errorMessageProp,
|
|
3680
|
+
showBackButton
|
|
3677
3681
|
}
|
|
3678
3682
|
));
|
|
3679
3683
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kryptos_connect/mobile-sdk",
|
|
3
|
-
"version": "1.0.6
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -112,4 +112,4 @@
|
|
|
112
112
|
"url": "https://github.com/Kryptoskatt/kryptos-connect-mobile-package/issues"
|
|
113
113
|
},
|
|
114
114
|
"homepage": "https://github.com/Kryptoskatt/kryptos-connect-mobile-package#readme"
|
|
115
|
-
}
|
|
115
|
+
}
|