@kryptos_connect/mobile-sdk 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +244 -115
- package/dist/index.mjs +247 -118
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1015,7 +1015,8 @@ var styles4 = import_react_native4.StyleSheet.create({
|
|
|
1015
1015
|
flex: 1
|
|
1016
1016
|
},
|
|
1017
1017
|
footer: {
|
|
1018
|
-
borderTopWidth: 1
|
|
1018
|
+
borderTopWidth: 1,
|
|
1019
|
+
marginBottom: 24
|
|
1019
1020
|
}
|
|
1020
1021
|
});
|
|
1021
1022
|
|
|
@@ -1283,20 +1284,26 @@ var styles8 = import_react_native8.StyleSheet.create({
|
|
|
1283
1284
|
|
|
1284
1285
|
// src/components/Footer.tsx
|
|
1285
1286
|
var Footer = () => {
|
|
1286
|
-
|
|
1287
|
+
const { clientInfo } = useKryptosConnect();
|
|
1288
|
+
const isSandbox = clientInfo?.project_stage === "sandbox";
|
|
1289
|
+
return /* @__PURE__ */ import_react13.default.createElement(
|
|
1290
|
+
import_react_native9.View,
|
|
1291
|
+
{
|
|
1292
|
+
style: [
|
|
1293
|
+
styles9.container,
|
|
1294
|
+
{ justifyContent: isSandbox ? "space-between" : "center" }
|
|
1295
|
+
]
|
|
1296
|
+
},
|
|
1297
|
+
/* @__PURE__ */ import_react13.default.createElement(PoweredByKryptos, null),
|
|
1298
|
+
/* @__PURE__ */ import_react13.default.createElement(Mode, null)
|
|
1299
|
+
);
|
|
1287
1300
|
};
|
|
1288
1301
|
var styles9 = import_react_native9.StyleSheet.create({
|
|
1289
1302
|
container: {
|
|
1290
1303
|
width: "100%",
|
|
1291
1304
|
paddingVertical: 8,
|
|
1292
1305
|
alignItems: "center",
|
|
1293
|
-
|
|
1294
|
-
},
|
|
1295
|
-
// Anchor Mode to the right side
|
|
1296
|
-
modeWrapper: {
|
|
1297
|
-
position: "absolute",
|
|
1298
|
-
right: 8,
|
|
1299
|
-
top: 4
|
|
1306
|
+
flexDirection: "row"
|
|
1300
1307
|
}
|
|
1301
1308
|
});
|
|
1302
1309
|
|
|
@@ -2151,7 +2158,8 @@ var WalletConnectComponent = ({
|
|
|
2151
2158
|
onAddHandle,
|
|
2152
2159
|
handleClose,
|
|
2153
2160
|
modalOpen,
|
|
2154
|
-
setAddIntegrationMode
|
|
2161
|
+
setAddIntegrationMode,
|
|
2162
|
+
providersList
|
|
2155
2163
|
}) => {
|
|
2156
2164
|
const { walletConnectProjectId } = useKryptosConnect();
|
|
2157
2165
|
const theme = useTheme();
|
|
@@ -2199,7 +2207,8 @@ var WalletConnectComponent = ({
|
|
|
2199
2207
|
onClose,
|
|
2200
2208
|
handleClose,
|
|
2201
2209
|
modalOpen,
|
|
2202
|
-
setAddIntegrationMode
|
|
2210
|
+
setAddIntegrationMode,
|
|
2211
|
+
providersList
|
|
2203
2212
|
}
|
|
2204
2213
|
));
|
|
2205
2214
|
};
|
|
@@ -2208,17 +2217,85 @@ function ConnectButton({
|
|
|
2208
2217
|
onAddHandle,
|
|
2209
2218
|
handleClose,
|
|
2210
2219
|
modalOpen,
|
|
2211
|
-
setAddIntegrationMode
|
|
2220
|
+
setAddIntegrationMode,
|
|
2221
|
+
providersList
|
|
2212
2222
|
}) {
|
|
2213
2223
|
const theme = useTheme();
|
|
2214
2224
|
const { open, disconnect } = (0, import_appkit_react_native3.useAppKit)();
|
|
2215
|
-
const { address, isConnected
|
|
2225
|
+
const { address, isConnected } = (0, import_appkit_react_native3.useAccount)();
|
|
2216
2226
|
const { linkToken, user, clientId } = useKryptosConnect();
|
|
2217
2227
|
const [selectedChains, setSelectedChains] = (0, import_react29.useState)(/* @__PURE__ */ new Set());
|
|
2218
2228
|
const [errorMessage, setErrorMessage] = (0, import_react29.useState)("");
|
|
2219
2229
|
const [chainErrors, setChainErrors] = (0, import_react29.useState)({});
|
|
2220
2230
|
const [isLoading, setIsLoading] = (0, import_react29.useState)(false);
|
|
2221
|
-
const userUsedChains =
|
|
2231
|
+
const [userUsedChains, setUserUsedChains] = (0, import_react29.useState)([]);
|
|
2232
|
+
const [isFetchingChains, setIsFetchingChains] = (0, import_react29.useState)(false);
|
|
2233
|
+
const availableChains = (0, import_react29.useMemo)(() => {
|
|
2234
|
+
if (userUsedChains.length > 0) {
|
|
2235
|
+
return userUsedChains;
|
|
2236
|
+
}
|
|
2237
|
+
if (integration.walletSupportedChains && integration.walletSupportedChains.length > 0) {
|
|
2238
|
+
return integration.walletSupportedChains;
|
|
2239
|
+
}
|
|
2240
|
+
return [];
|
|
2241
|
+
}, [userUsedChains, integration.walletSupportedChains]);
|
|
2242
|
+
(0, import_react29.useEffect)(() => {
|
|
2243
|
+
if (!isConnected || !address || !address.trim()) {
|
|
2244
|
+
setUserUsedChains([]);
|
|
2245
|
+
setSelectedChains(/* @__PURE__ */ new Set());
|
|
2246
|
+
setIsFetchingChains(false);
|
|
2247
|
+
return;
|
|
2248
|
+
}
|
|
2249
|
+
const debounceTimer = setTimeout(async () => {
|
|
2250
|
+
if (linkToken && address && address.trim() && isConnected) {
|
|
2251
|
+
try {
|
|
2252
|
+
setIsFetchingChains(true);
|
|
2253
|
+
let chains = [];
|
|
2254
|
+
if (integration.isEvmWallet) {
|
|
2255
|
+
const res = await getUserUsedChains(linkToken, address.trim());
|
|
2256
|
+
if (res && Array.isArray(res) && res.length > 0) {
|
|
2257
|
+
chains = res;
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
if (chains.length === 0 && integration.walletSupportedChains && integration.walletSupportedChains.length > 0) {
|
|
2261
|
+
chains = integration.walletSupportedChains;
|
|
2262
|
+
}
|
|
2263
|
+
if (chains.length > 0) {
|
|
2264
|
+
setUserUsedChains(chains);
|
|
2265
|
+
setSelectedChains(new Set(chains.map((chain) => chain.id)));
|
|
2266
|
+
} else {
|
|
2267
|
+
setUserUsedChains([]);
|
|
2268
|
+
setSelectedChains(/* @__PURE__ */ new Set());
|
|
2269
|
+
}
|
|
2270
|
+
} catch (error) {
|
|
2271
|
+
console.error("Failed to fetch user chains:", error);
|
|
2272
|
+
if (integration.walletSupportedChains && integration.walletSupportedChains.length > 0) {
|
|
2273
|
+
setUserUsedChains(integration.walletSupportedChains);
|
|
2274
|
+
setSelectedChains(
|
|
2275
|
+
new Set(
|
|
2276
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2277
|
+
integration.walletSupportedChains.map((chain) => chain.id)
|
|
2278
|
+
)
|
|
2279
|
+
);
|
|
2280
|
+
} else {
|
|
2281
|
+
setUserUsedChains([]);
|
|
2282
|
+
setSelectedChains(/* @__PURE__ */ new Set());
|
|
2283
|
+
}
|
|
2284
|
+
} finally {
|
|
2285
|
+
setIsFetchingChains(false);
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
}, 500);
|
|
2289
|
+
return () => {
|
|
2290
|
+
clearTimeout(debounceTimer);
|
|
2291
|
+
};
|
|
2292
|
+
}, [
|
|
2293
|
+
linkToken,
|
|
2294
|
+
address,
|
|
2295
|
+
isConnected,
|
|
2296
|
+
integration.isEvmWallet,
|
|
2297
|
+
integration.walletSupportedChains
|
|
2298
|
+
]);
|
|
2222
2299
|
const validateForm = () => {
|
|
2223
2300
|
if (!address) {
|
|
2224
2301
|
setErrorMessage("Please connect a wallet");
|
|
@@ -2236,7 +2313,7 @@ function ConnectButton({
|
|
|
2236
2313
|
setIsLoading(true);
|
|
2237
2314
|
setErrorMessage("");
|
|
2238
2315
|
setChainErrors({});
|
|
2239
|
-
const chainsToProcess =
|
|
2316
|
+
const chainsToProcess = availableChains.filter(
|
|
2240
2317
|
(c) => selectedChains.has(c.id)
|
|
2241
2318
|
);
|
|
2242
2319
|
const integrationsToAdd = [];
|
|
@@ -2244,43 +2321,46 @@ function ConnectButton({
|
|
|
2244
2321
|
const walletTestsPayload = chainsToProcess.map((chain) => {
|
|
2245
2322
|
const walletId = generateUUID();
|
|
2246
2323
|
const displaySuffix = address ? address?.length > 8 ? `${address.slice(0, 4)}...${address.slice(-4)}` : address : "";
|
|
2247
|
-
const alias = `${
|
|
2324
|
+
const alias = `${chain.id} (${displaySuffix})`;
|
|
2325
|
+
const provider = providersList.find((p) => p.id === chain.id);
|
|
2248
2326
|
return {
|
|
2249
2327
|
chain,
|
|
2250
2328
|
walletId,
|
|
2251
2329
|
alias,
|
|
2252
2330
|
credential: {
|
|
2253
|
-
source:
|
|
2331
|
+
source: provider?.id,
|
|
2254
2332
|
credential: {
|
|
2255
2333
|
address,
|
|
2256
2334
|
userId: user?.user_id || "0",
|
|
2257
|
-
projectId:
|
|
2335
|
+
projectId: provider?.projectId,
|
|
2258
2336
|
apiKey: "0",
|
|
2259
2337
|
secret: "0",
|
|
2260
2338
|
privateKey: "0",
|
|
2261
2339
|
alias,
|
|
2262
2340
|
walletId,
|
|
2263
|
-
exchange:
|
|
2341
|
+
exchange: provider?.id
|
|
2264
2342
|
}
|
|
2265
2343
|
}
|
|
2266
2344
|
};
|
|
2267
2345
|
});
|
|
2268
2346
|
const results = await Promise.allSettled(
|
|
2347
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2269
2348
|
walletTestsPayload.map(
|
|
2270
|
-
(
|
|
2349
|
+
(testData) => testCredentials(linkToken, { ...testData.credential })
|
|
2271
2350
|
)
|
|
2272
2351
|
);
|
|
2273
2352
|
results.forEach((result, index) => {
|
|
2274
2353
|
const { chain, walletId, alias } = walletTestsPayload[index];
|
|
2275
|
-
|
|
2354
|
+
const provider = providersList.find((p) => p.id === chain.id);
|
|
2355
|
+
if (result.status === "fulfilled" && result.value?.valid && provider) {
|
|
2276
2356
|
const data = {
|
|
2277
2357
|
alias,
|
|
2278
|
-
exchange:
|
|
2279
|
-
id:
|
|
2280
|
-
public_name:
|
|
2358
|
+
exchange: provider.id.toLowerCase(),
|
|
2359
|
+
id: provider.id,
|
|
2360
|
+
public_name: provider.public_name,
|
|
2281
2361
|
sync_time: (/* @__PURE__ */ new Date()).getTime(),
|
|
2282
2362
|
fetchAll: true,
|
|
2283
|
-
logo:
|
|
2363
|
+
logo: provider.logo || null,
|
|
2284
2364
|
startTime: null,
|
|
2285
2365
|
endTime: null,
|
|
2286
2366
|
uid: user?.user_id || "",
|
|
@@ -2293,18 +2373,27 @@ function ConnectButton({
|
|
|
2293
2373
|
environment: "sandbox"
|
|
2294
2374
|
},
|
|
2295
2375
|
addedOn: (/* @__PURE__ */ new Date()).getTime(),
|
|
2296
|
-
default_chain:
|
|
2297
|
-
default_chain_logo:
|
|
2298
|
-
type:
|
|
2299
|
-
isNftSupported:
|
|
2300
|
-
chainId: chain?.community_id || chain.chainId || chain.id,
|
|
2301
|
-
address
|
|
2376
|
+
default_chain: provider.id,
|
|
2377
|
+
default_chain_logo: null,
|
|
2378
|
+
type: provider.type,
|
|
2379
|
+
isNftSupported: provider.isEvmWallet || provider.nftSupport || false
|
|
2302
2380
|
};
|
|
2303
2381
|
integrationsToAdd.push(data);
|
|
2304
2382
|
} else {
|
|
2305
|
-
|
|
2383
|
+
if (result.status === "rejected") {
|
|
2384
|
+
errors[chain.id] = result.reason?.response?.data?.message || "Failed to process chain";
|
|
2385
|
+
} else if (result.status === "fulfilled") {
|
|
2386
|
+
errors[chain.id] = result.value?.message || "Failed to verify chain";
|
|
2387
|
+
}
|
|
2306
2388
|
}
|
|
2307
2389
|
});
|
|
2390
|
+
setChainErrors(errors);
|
|
2391
|
+
if (Object.keys(errors).length > 0) {
|
|
2392
|
+
setErrorMessage(
|
|
2393
|
+
`Cannot add integrations. ${Object.keys(errors).length} chain${Object.keys(errors).length > 1 ? "s" : ""} failed verification. Please fix the errors and try again.`
|
|
2394
|
+
);
|
|
2395
|
+
return;
|
|
2396
|
+
}
|
|
2308
2397
|
if (integrationsToAdd.length > 0) {
|
|
2309
2398
|
onAddHandle(integrationsToAdd);
|
|
2310
2399
|
setChainErrors({});
|
|
@@ -2322,17 +2411,17 @@ function ConnectButton({
|
|
|
2322
2411
|
setIsLoading(false);
|
|
2323
2412
|
}
|
|
2324
2413
|
};
|
|
2325
|
-
const toggleChainSelection = (
|
|
2414
|
+
const toggleChainSelection = (chainId) => {
|
|
2326
2415
|
const newSelected = new Set(selectedChains);
|
|
2327
|
-
if (newSelected.has(
|
|
2328
|
-
newSelected.delete(
|
|
2416
|
+
if (newSelected.has(chainId)) {
|
|
2417
|
+
newSelected.delete(chainId);
|
|
2329
2418
|
} else {
|
|
2330
|
-
newSelected.add(
|
|
2419
|
+
newSelected.add(chainId);
|
|
2331
2420
|
}
|
|
2332
2421
|
setSelectedChains(newSelected);
|
|
2333
|
-
if (chainErrors[
|
|
2422
|
+
if (chainErrors[chainId]) {
|
|
2334
2423
|
const newErrors = { ...chainErrors };
|
|
2335
|
-
delete newErrors[
|
|
2424
|
+
delete newErrors[chainId];
|
|
2336
2425
|
setChainErrors(newErrors);
|
|
2337
2426
|
}
|
|
2338
2427
|
};
|
|
@@ -2353,107 +2442,149 @@ function ConnectButton({
|
|
|
2353
2442
|
onPress: () => open({ view: "Connect" })
|
|
2354
2443
|
},
|
|
2355
2444
|
"Connect Wallet"
|
|
2356
|
-
)) : /* @__PURE__ */ import_react29.default.createElement(import_react_native14.View,
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
}
|
|
2366
|
-
|
|
2367
|
-
|
|
2445
|
+
)) : /* @__PURE__ */ import_react29.default.createElement(import_react_native14.View, { style: styles13.connectedContainer }, /* @__PURE__ */ import_react29.default.createElement(import_react_native14.View, { style: styles13.connectedHeader }, /* @__PURE__ */ import_react29.default.createElement(
|
|
2446
|
+
import_react_native14.Text,
|
|
2447
|
+
{
|
|
2448
|
+
style: [styles13.connectedTitle, { color: theme.colors.text }]
|
|
2449
|
+
},
|
|
2450
|
+
"Wallet Connected"
|
|
2451
|
+
), /* @__PURE__ */ import_react29.default.createElement(
|
|
2452
|
+
import_react_native14.Text,
|
|
2453
|
+
{
|
|
2454
|
+
style: [styles13.connectedText, { color: theme.colors.text }]
|
|
2455
|
+
},
|
|
2456
|
+
"Address: ",
|
|
2457
|
+
address
|
|
2458
|
+
), /* @__PURE__ */ import_react29.default.createElement(Button, { variant: "ghost", size: "sm", onPress: () => disconnect() }, "Disconnect Wallet"), isFetchingChains ? /* @__PURE__ */ import_react29.default.createElement(
|
|
2459
|
+
import_react_native14.Text,
|
|
2460
|
+
{
|
|
2461
|
+
style: [styles13.fetchingText, { color: theme.colors.text }]
|
|
2462
|
+
},
|
|
2463
|
+
"Fetching chains..."
|
|
2464
|
+
) : null), availableChains.length > 0 && address && /* @__PURE__ */ import_react29.default.createElement(
|
|
2465
|
+
import_react_native14.ScrollView,
|
|
2466
|
+
{
|
|
2467
|
+
style: styles13.scrollView,
|
|
2468
|
+
contentContainerStyle: styles13.scrollViewContent,
|
|
2469
|
+
showsVerticalScrollIndicator: true,
|
|
2470
|
+
nestedScrollEnabled: true
|
|
2471
|
+
},
|
|
2472
|
+
/* @__PURE__ */ import_react29.default.createElement(import_react_native14.Text, { style: [styles13.chainTitle, { color: theme.colors.text }] }, "Select Chains to Add:"),
|
|
2473
|
+
/* @__PURE__ */ import_react29.default.createElement(import_react_native14.View, null, /* @__PURE__ */ import_react29.default.createElement(import_react_native14.View, { style: styles13.chainChips }, availableChains.map((chain) => {
|
|
2474
|
+
const isSelected = selectedChains.has(chain.id);
|
|
2475
|
+
const hasError = chainErrors[chain.id];
|
|
2476
|
+
return /* @__PURE__ */ import_react29.default.createElement(
|
|
2477
|
+
import_react_native14.TouchableOpacity,
|
|
2368
2478
|
{
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
backgroundColor: hasError ? theme.colors.errorLight : isSelected ? theme.colors.primary + "20" : theme.colors.surface,
|
|
2373
|
-
borderColor: hasError ? theme.colors.error : isSelected ? theme.colors.primary : theme.colors.border
|
|
2374
|
-
}
|
|
2375
|
-
]
|
|
2479
|
+
onPress: () => toggleChainSelection(chain.id),
|
|
2480
|
+
style: styles13.chainButton,
|
|
2481
|
+
key: chain.id
|
|
2376
2482
|
},
|
|
2377
2483
|
/* @__PURE__ */ import_react29.default.createElement(
|
|
2378
|
-
import_react_native14.
|
|
2484
|
+
import_react_native14.View,
|
|
2379
2485
|
{
|
|
2380
2486
|
style: [
|
|
2381
|
-
styles13.
|
|
2487
|
+
styles13.chainChip,
|
|
2382
2488
|
{
|
|
2383
|
-
|
|
2489
|
+
backgroundColor: hasError ? theme.colors.errorLight : isSelected ? theme.colors.primary + "20" : theme.colors.surface,
|
|
2490
|
+
borderColor: hasError ? theme.colors.error : isSelected ? theme.colors.primary : theme.colors.border
|
|
2384
2491
|
}
|
|
2385
2492
|
]
|
|
2386
2493
|
},
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2494
|
+
/* @__PURE__ */ import_react29.default.createElement(
|
|
2495
|
+
import_react_native14.Text,
|
|
2496
|
+
{
|
|
2497
|
+
style: [
|
|
2498
|
+
styles13.chainName,
|
|
2499
|
+
{
|
|
2500
|
+
color: hasError ? theme.colors.error : isSelected ? theme.colors.primary : theme.colors.text
|
|
2501
|
+
}
|
|
2502
|
+
]
|
|
2503
|
+
},
|
|
2504
|
+
chain.id
|
|
2505
|
+
),
|
|
2506
|
+
isSelected ? /* @__PURE__ */ import_react29.default.createElement(
|
|
2507
|
+
CloseIcon,
|
|
2508
|
+
{
|
|
2509
|
+
size: 12,
|
|
2510
|
+
color: hasError ? theme.colors.error : theme.colors.primary
|
|
2511
|
+
}
|
|
2512
|
+
) : /* @__PURE__ */ import_react29.default.createElement(
|
|
2513
|
+
PlusIcon,
|
|
2514
|
+
{
|
|
2515
|
+
size: 12,
|
|
2516
|
+
color: theme.colors.textSecondary
|
|
2517
|
+
}
|
|
2518
|
+
)
|
|
2401
2519
|
)
|
|
2402
|
-
)
|
|
2403
|
-
)
|
|
2404
|
-
}))), Object.keys(chainErrors).length > 0 && /* @__PURE__ */ import_react29.default.createElement(import_react_native14.View, { style: styles13.chainErrorsContainer }, /* @__PURE__ */ import_react29.default.createElement(
|
|
2405
|
-
import_react_native14.Text,
|
|
2406
|
-
{
|
|
2407
|
-
style: [
|
|
2408
|
-
styles13.chainErrorsTitle,
|
|
2409
|
-
{ color: theme.colors.error }
|
|
2410
|
-
]
|
|
2411
|
-
},
|
|
2412
|
-
"Errors:"
|
|
2413
|
-
), Object.entries(chainErrors).map(([chainId2, error]) => {
|
|
2414
|
-
const chain = userUsedChains.find(
|
|
2415
|
-
(c) => c.id === chainId2
|
|
2416
|
-
);
|
|
2417
|
-
return /* @__PURE__ */ import_react29.default.createElement(
|
|
2520
|
+
);
|
|
2521
|
+
})), errorMessage ? /* @__PURE__ */ import_react29.default.createElement(import_react_native14.View, { style: styles13.errorMessageContainer }, /* @__PURE__ */ import_react29.default.createElement(Alert, { variant: "destructive" }, /* @__PURE__ */ import_react29.default.createElement(AlertDescription, null, errorMessage))) : null, Object.keys(chainErrors || {}).length > 0 && /* @__PURE__ */ import_react29.default.createElement(import_react_native14.View, { style: styles13.chainErrorsContainer }, /* @__PURE__ */ import_react29.default.createElement(
|
|
2418
2522
|
import_react_native14.Text,
|
|
2419
2523
|
{
|
|
2420
|
-
key: chainId2,
|
|
2421
2524
|
style: [
|
|
2422
|
-
styles13.
|
|
2525
|
+
styles13.chainErrorsTitle,
|
|
2423
2526
|
{ color: theme.colors.error }
|
|
2424
2527
|
]
|
|
2425
2528
|
},
|
|
2426
|
-
"
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2529
|
+
"Errors:"
|
|
2530
|
+
), Object.entries(chainErrors).map(([chainId, error]) => {
|
|
2531
|
+
const chain = availableChains.find(
|
|
2532
|
+
(c) => c.id === chainId
|
|
2533
|
+
);
|
|
2534
|
+
return /* @__PURE__ */ import_react29.default.createElement(
|
|
2535
|
+
import_react_native14.Text,
|
|
2536
|
+
{
|
|
2537
|
+
key: chainId,
|
|
2538
|
+
style: [
|
|
2539
|
+
styles13.chainErrorItem,
|
|
2540
|
+
{ color: theme.colors.error }
|
|
2541
|
+
]
|
|
2542
|
+
},
|
|
2543
|
+
"\u2022 ",
|
|
2544
|
+
chain?.name ?? chainId,
|
|
2545
|
+
": ",
|
|
2546
|
+
String(error)
|
|
2547
|
+
);
|
|
2548
|
+
})))
|
|
2549
|
+
))), availableChains.length > 0 && address && /* @__PURE__ */ import_react29.default.createElement(ModalFooter, { style: { paddingVertical: 8 } }, /* @__PURE__ */ import_react29.default.createElement(
|
|
2432
2550
|
Button,
|
|
2433
2551
|
{
|
|
2434
2552
|
variant: "outline",
|
|
2435
2553
|
size: "lg",
|
|
2436
2554
|
onPress: onSubmitWalletConnect,
|
|
2437
2555
|
loading: isLoading,
|
|
2438
|
-
disabled: isLoading || !!address &&
|
|
2556
|
+
disabled: isLoading || !!address && availableChains.length > 0 && selectedChains.size === 0,
|
|
2439
2557
|
style: styles13.button
|
|
2440
2558
|
},
|
|
2441
2559
|
selectedChains.size > 0 ? `Add ${selectedChains.size} Chain${selectedChains.size > 1 ? "s" : ""}` : "Add Integration"
|
|
2442
2560
|
), /* @__PURE__ */ import_react29.default.createElement(Footer, null)));
|
|
2443
2561
|
}
|
|
2444
2562
|
var styles13 = import_react_native14.StyleSheet.create({
|
|
2445
|
-
|
|
2563
|
+
connectedContainer: {
|
|
2564
|
+
flex: 1
|
|
2565
|
+
},
|
|
2566
|
+
connectedHeader: {
|
|
2567
|
+
marginBottom: 8
|
|
2568
|
+
},
|
|
2569
|
+
connectedTitle: { fontSize: 12, fontWeight: "600", marginBottom: 4 },
|
|
2446
2570
|
connectedText: { fontSize: 14, marginBottom: 4 },
|
|
2571
|
+
fetchingText: { fontSize: 12, marginBottom: 4, textAlign: "center" },
|
|
2447
2572
|
infoText: {
|
|
2448
2573
|
fontSize: 16,
|
|
2449
2574
|
fontWeight: "600",
|
|
2450
2575
|
marginBottom: 8,
|
|
2451
2576
|
textAlign: "center"
|
|
2452
2577
|
},
|
|
2578
|
+
scrollView: {
|
|
2579
|
+
flex: 1
|
|
2580
|
+
},
|
|
2453
2581
|
scrollViewContent: {
|
|
2454
|
-
paddingBottom:
|
|
2582
|
+
paddingBottom: 40,
|
|
2455
2583
|
flexGrow: 1
|
|
2456
2584
|
},
|
|
2585
|
+
errorMessageContainer: {
|
|
2586
|
+
marginTop: 16
|
|
2587
|
+
},
|
|
2457
2588
|
headerContent: {
|
|
2458
2589
|
flexDirection: "row",
|
|
2459
2590
|
alignItems: "center"
|
|
@@ -2472,17 +2603,13 @@ var styles13 = import_react_native14.StyleSheet.create({
|
|
|
2472
2603
|
contentContainer: {
|
|
2473
2604
|
padding: 20,
|
|
2474
2605
|
// theme.spacing.xl
|
|
2475
|
-
paddingBottom:
|
|
2606
|
+
paddingBottom: 20,
|
|
2476
2607
|
width: "100%",
|
|
2477
2608
|
overflow: "hidden",
|
|
2478
2609
|
alignSelf: "center",
|
|
2479
2610
|
flexDirection: "column",
|
|
2480
2611
|
flex: 1
|
|
2481
2612
|
},
|
|
2482
|
-
chainSelection: {
|
|
2483
|
-
marginBottom: 16
|
|
2484
|
-
// theme.spacing.lg
|
|
2485
|
-
},
|
|
2486
2613
|
chainTitle: {
|
|
2487
2614
|
fontSize: 14,
|
|
2488
2615
|
// theme.fontSize.md
|
|
@@ -2534,9 +2661,7 @@ var styles13 = import_react_native14.StyleSheet.create({
|
|
|
2534
2661
|
// theme.spacing.xs
|
|
2535
2662
|
},
|
|
2536
2663
|
button: {
|
|
2537
|
-
width: "100%"
|
|
2538
|
-
marginTop: 16
|
|
2539
|
-
// theme.spacing.lg - consistent button spacing
|
|
2664
|
+
width: "100%"
|
|
2540
2665
|
},
|
|
2541
2666
|
emptyState: {
|
|
2542
2667
|
flex: 1,
|
|
@@ -2561,7 +2686,8 @@ var IntegrationForm = ({
|
|
|
2561
2686
|
onAddHandle,
|
|
2562
2687
|
open,
|
|
2563
2688
|
setAddIntegrationMode,
|
|
2564
|
-
handleClose
|
|
2689
|
+
handleClose,
|
|
2690
|
+
providersList
|
|
2565
2691
|
}) => {
|
|
2566
2692
|
const { clientId, linkToken, user } = useKryptosConnect();
|
|
2567
2693
|
const theme = useTheme();
|
|
@@ -2795,7 +2921,7 @@ var IntegrationForm = ({
|
|
|
2795
2921
|
isNftSupported: metadata.isEvmWallet || metadata.nftSupport || false
|
|
2796
2922
|
};
|
|
2797
2923
|
if (metadata.community_id) {
|
|
2798
|
-
data.chainId =
|
|
2924
|
+
data.chainId = metadata.community_id;
|
|
2799
2925
|
}
|
|
2800
2926
|
if (formValues.address) data.address = formValues.address;
|
|
2801
2927
|
if (formValues.account_name) data.accountName = formValues.account_name;
|
|
@@ -2966,7 +3092,8 @@ var IntegrationForm = ({
|
|
|
2966
3092
|
onAddHandle,
|
|
2967
3093
|
modalOpen: open,
|
|
2968
3094
|
setAddIntegrationMode,
|
|
2969
|
-
handleClose
|
|
3095
|
+
handleClose,
|
|
3096
|
+
providersList
|
|
2970
3097
|
}
|
|
2971
3098
|
));
|
|
2972
3099
|
};
|
|
@@ -3353,7 +3480,8 @@ var Integration = ({
|
|
|
3353
3480
|
},
|
|
3354
3481
|
open: !!addIntegrationMode,
|
|
3355
3482
|
setAddIntegrationMode,
|
|
3356
|
-
handleClose
|
|
3483
|
+
handleClose,
|
|
3484
|
+
providersList: supportedProviders
|
|
3357
3485
|
}
|
|
3358
3486
|
));
|
|
3359
3487
|
};
|
|
@@ -3380,9 +3508,10 @@ var styles15 = import_react_native16.StyleSheet.create({
|
|
|
3380
3508
|
flex: 1
|
|
3381
3509
|
},
|
|
3382
3510
|
headerSection: {
|
|
3383
|
-
paddingHorizontal: 20
|
|
3511
|
+
paddingHorizontal: 20,
|
|
3512
|
+
// theme.spacing.xl
|
|
3513
|
+
paddingTop: 10
|
|
3384
3514
|
// theme.spacing.xl
|
|
3385
|
-
// paddingTop: 10, // theme.spacing.xl
|
|
3386
3515
|
},
|
|
3387
3516
|
title: {
|
|
3388
3517
|
fontSize: 16,
|
package/dist/index.mjs
CHANGED
|
@@ -1002,7 +1002,8 @@ var styles4 = StyleSheet4.create({
|
|
|
1002
1002
|
flex: 1
|
|
1003
1003
|
},
|
|
1004
1004
|
footer: {
|
|
1005
|
-
borderTopWidth: 1
|
|
1005
|
+
borderTopWidth: 1,
|
|
1006
|
+
marginBottom: 24
|
|
1006
1007
|
}
|
|
1007
1008
|
});
|
|
1008
1009
|
|
|
@@ -1281,20 +1282,26 @@ var styles8 = StyleSheet8.create({
|
|
|
1281
1282
|
|
|
1282
1283
|
// src/components/Footer.tsx
|
|
1283
1284
|
var Footer = () => {
|
|
1284
|
-
|
|
1285
|
+
const { clientInfo } = useKryptosConnect();
|
|
1286
|
+
const isSandbox = clientInfo?.project_stage === "sandbox";
|
|
1287
|
+
return /* @__PURE__ */ React13.createElement(
|
|
1288
|
+
View9,
|
|
1289
|
+
{
|
|
1290
|
+
style: [
|
|
1291
|
+
styles9.container,
|
|
1292
|
+
{ justifyContent: isSandbox ? "space-between" : "center" }
|
|
1293
|
+
]
|
|
1294
|
+
},
|
|
1295
|
+
/* @__PURE__ */ React13.createElement(PoweredByKryptos, null),
|
|
1296
|
+
/* @__PURE__ */ React13.createElement(Mode, null)
|
|
1297
|
+
);
|
|
1285
1298
|
};
|
|
1286
1299
|
var styles9 = StyleSheet9.create({
|
|
1287
1300
|
container: {
|
|
1288
1301
|
width: "100%",
|
|
1289
1302
|
paddingVertical: 8,
|
|
1290
1303
|
alignItems: "center",
|
|
1291
|
-
|
|
1292
|
-
},
|
|
1293
|
-
// Anchor Mode to the right side
|
|
1294
|
-
modeWrapper: {
|
|
1295
|
-
position: "absolute",
|
|
1296
|
-
right: 8,
|
|
1297
|
-
top: 4
|
|
1304
|
+
flexDirection: "row"
|
|
1298
1305
|
}
|
|
1299
1306
|
});
|
|
1300
1307
|
|
|
@@ -2026,7 +2033,7 @@ var PlusIcon = ({
|
|
|
2026
2033
|
|
|
2027
2034
|
// src/wallet-connect/index.tsx
|
|
2028
2035
|
import { useAccount, useAppKit } from "@reown/appkit-react-native";
|
|
2029
|
-
import React29, { useState } from "react";
|
|
2036
|
+
import React29, { useEffect as useEffect2, useMemo, useState } from "react";
|
|
2030
2037
|
import {
|
|
2031
2038
|
ScrollView as ScrollView2,
|
|
2032
2039
|
StyleSheet as StyleSheet13,
|
|
@@ -2177,7 +2184,8 @@ var WalletConnectComponent = ({
|
|
|
2177
2184
|
onAddHandle,
|
|
2178
2185
|
handleClose,
|
|
2179
2186
|
modalOpen,
|
|
2180
|
-
setAddIntegrationMode
|
|
2187
|
+
setAddIntegrationMode,
|
|
2188
|
+
providersList
|
|
2181
2189
|
}) => {
|
|
2182
2190
|
const { walletConnectProjectId } = useKryptosConnect();
|
|
2183
2191
|
const theme = useTheme();
|
|
@@ -2225,7 +2233,8 @@ var WalletConnectComponent = ({
|
|
|
2225
2233
|
onClose,
|
|
2226
2234
|
handleClose,
|
|
2227
2235
|
modalOpen,
|
|
2228
|
-
setAddIntegrationMode
|
|
2236
|
+
setAddIntegrationMode,
|
|
2237
|
+
providersList
|
|
2229
2238
|
}
|
|
2230
2239
|
));
|
|
2231
2240
|
};
|
|
@@ -2234,17 +2243,85 @@ function ConnectButton({
|
|
|
2234
2243
|
onAddHandle,
|
|
2235
2244
|
handleClose,
|
|
2236
2245
|
modalOpen,
|
|
2237
|
-
setAddIntegrationMode
|
|
2246
|
+
setAddIntegrationMode,
|
|
2247
|
+
providersList
|
|
2238
2248
|
}) {
|
|
2239
2249
|
const theme = useTheme();
|
|
2240
2250
|
const { open, disconnect } = useAppKit();
|
|
2241
|
-
const { address, isConnected
|
|
2251
|
+
const { address, isConnected } = useAccount();
|
|
2242
2252
|
const { linkToken, user, clientId } = useKryptosConnect();
|
|
2243
2253
|
const [selectedChains, setSelectedChains] = useState(/* @__PURE__ */ new Set());
|
|
2244
2254
|
const [errorMessage, setErrorMessage] = useState("");
|
|
2245
2255
|
const [chainErrors, setChainErrors] = useState({});
|
|
2246
2256
|
const [isLoading, setIsLoading] = useState(false);
|
|
2247
|
-
const userUsedChains =
|
|
2257
|
+
const [userUsedChains, setUserUsedChains] = useState([]);
|
|
2258
|
+
const [isFetchingChains, setIsFetchingChains] = useState(false);
|
|
2259
|
+
const availableChains = useMemo(() => {
|
|
2260
|
+
if (userUsedChains.length > 0) {
|
|
2261
|
+
return userUsedChains;
|
|
2262
|
+
}
|
|
2263
|
+
if (integration.walletSupportedChains && integration.walletSupportedChains.length > 0) {
|
|
2264
|
+
return integration.walletSupportedChains;
|
|
2265
|
+
}
|
|
2266
|
+
return [];
|
|
2267
|
+
}, [userUsedChains, integration.walletSupportedChains]);
|
|
2268
|
+
useEffect2(() => {
|
|
2269
|
+
if (!isConnected || !address || !address.trim()) {
|
|
2270
|
+
setUserUsedChains([]);
|
|
2271
|
+
setSelectedChains(/* @__PURE__ */ new Set());
|
|
2272
|
+
setIsFetchingChains(false);
|
|
2273
|
+
return;
|
|
2274
|
+
}
|
|
2275
|
+
const debounceTimer = setTimeout(async () => {
|
|
2276
|
+
if (linkToken && address && address.trim() && isConnected) {
|
|
2277
|
+
try {
|
|
2278
|
+
setIsFetchingChains(true);
|
|
2279
|
+
let chains = [];
|
|
2280
|
+
if (integration.isEvmWallet) {
|
|
2281
|
+
const res = await getUserUsedChains(linkToken, address.trim());
|
|
2282
|
+
if (res && Array.isArray(res) && res.length > 0) {
|
|
2283
|
+
chains = res;
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
if (chains.length === 0 && integration.walletSupportedChains && integration.walletSupportedChains.length > 0) {
|
|
2287
|
+
chains = integration.walletSupportedChains;
|
|
2288
|
+
}
|
|
2289
|
+
if (chains.length > 0) {
|
|
2290
|
+
setUserUsedChains(chains);
|
|
2291
|
+
setSelectedChains(new Set(chains.map((chain) => chain.id)));
|
|
2292
|
+
} else {
|
|
2293
|
+
setUserUsedChains([]);
|
|
2294
|
+
setSelectedChains(/* @__PURE__ */ new Set());
|
|
2295
|
+
}
|
|
2296
|
+
} catch (error) {
|
|
2297
|
+
console.error("Failed to fetch user chains:", error);
|
|
2298
|
+
if (integration.walletSupportedChains && integration.walletSupportedChains.length > 0) {
|
|
2299
|
+
setUserUsedChains(integration.walletSupportedChains);
|
|
2300
|
+
setSelectedChains(
|
|
2301
|
+
new Set(
|
|
2302
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2303
|
+
integration.walletSupportedChains.map((chain) => chain.id)
|
|
2304
|
+
)
|
|
2305
|
+
);
|
|
2306
|
+
} else {
|
|
2307
|
+
setUserUsedChains([]);
|
|
2308
|
+
setSelectedChains(/* @__PURE__ */ new Set());
|
|
2309
|
+
}
|
|
2310
|
+
} finally {
|
|
2311
|
+
setIsFetchingChains(false);
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
}, 500);
|
|
2315
|
+
return () => {
|
|
2316
|
+
clearTimeout(debounceTimer);
|
|
2317
|
+
};
|
|
2318
|
+
}, [
|
|
2319
|
+
linkToken,
|
|
2320
|
+
address,
|
|
2321
|
+
isConnected,
|
|
2322
|
+
integration.isEvmWallet,
|
|
2323
|
+
integration.walletSupportedChains
|
|
2324
|
+
]);
|
|
2248
2325
|
const validateForm = () => {
|
|
2249
2326
|
if (!address) {
|
|
2250
2327
|
setErrorMessage("Please connect a wallet");
|
|
@@ -2262,7 +2339,7 @@ function ConnectButton({
|
|
|
2262
2339
|
setIsLoading(true);
|
|
2263
2340
|
setErrorMessage("");
|
|
2264
2341
|
setChainErrors({});
|
|
2265
|
-
const chainsToProcess =
|
|
2342
|
+
const chainsToProcess = availableChains.filter(
|
|
2266
2343
|
(c) => selectedChains.has(c.id)
|
|
2267
2344
|
);
|
|
2268
2345
|
const integrationsToAdd = [];
|
|
@@ -2270,43 +2347,46 @@ function ConnectButton({
|
|
|
2270
2347
|
const walletTestsPayload = chainsToProcess.map((chain) => {
|
|
2271
2348
|
const walletId = generateUUID();
|
|
2272
2349
|
const displaySuffix = address ? address?.length > 8 ? `${address.slice(0, 4)}...${address.slice(-4)}` : address : "";
|
|
2273
|
-
const alias = `${
|
|
2350
|
+
const alias = `${chain.id} (${displaySuffix})`;
|
|
2351
|
+
const provider = providersList.find((p) => p.id === chain.id);
|
|
2274
2352
|
return {
|
|
2275
2353
|
chain,
|
|
2276
2354
|
walletId,
|
|
2277
2355
|
alias,
|
|
2278
2356
|
credential: {
|
|
2279
|
-
source:
|
|
2357
|
+
source: provider?.id,
|
|
2280
2358
|
credential: {
|
|
2281
2359
|
address,
|
|
2282
2360
|
userId: user?.user_id || "0",
|
|
2283
|
-
projectId:
|
|
2361
|
+
projectId: provider?.projectId,
|
|
2284
2362
|
apiKey: "0",
|
|
2285
2363
|
secret: "0",
|
|
2286
2364
|
privateKey: "0",
|
|
2287
2365
|
alias,
|
|
2288
2366
|
walletId,
|
|
2289
|
-
exchange:
|
|
2367
|
+
exchange: provider?.id
|
|
2290
2368
|
}
|
|
2291
2369
|
}
|
|
2292
2370
|
};
|
|
2293
2371
|
});
|
|
2294
2372
|
const results = await Promise.allSettled(
|
|
2373
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2295
2374
|
walletTestsPayload.map(
|
|
2296
|
-
(
|
|
2375
|
+
(testData) => testCredentials(linkToken, { ...testData.credential })
|
|
2297
2376
|
)
|
|
2298
2377
|
);
|
|
2299
2378
|
results.forEach((result, index) => {
|
|
2300
2379
|
const { chain, walletId, alias } = walletTestsPayload[index];
|
|
2301
|
-
|
|
2380
|
+
const provider = providersList.find((p) => p.id === chain.id);
|
|
2381
|
+
if (result.status === "fulfilled" && result.value?.valid && provider) {
|
|
2302
2382
|
const data = {
|
|
2303
2383
|
alias,
|
|
2304
|
-
exchange:
|
|
2305
|
-
id:
|
|
2306
|
-
public_name:
|
|
2384
|
+
exchange: provider.id.toLowerCase(),
|
|
2385
|
+
id: provider.id,
|
|
2386
|
+
public_name: provider.public_name,
|
|
2307
2387
|
sync_time: (/* @__PURE__ */ new Date()).getTime(),
|
|
2308
2388
|
fetchAll: true,
|
|
2309
|
-
logo:
|
|
2389
|
+
logo: provider.logo || null,
|
|
2310
2390
|
startTime: null,
|
|
2311
2391
|
endTime: null,
|
|
2312
2392
|
uid: user?.user_id || "",
|
|
@@ -2319,18 +2399,27 @@ function ConnectButton({
|
|
|
2319
2399
|
environment: "sandbox"
|
|
2320
2400
|
},
|
|
2321
2401
|
addedOn: (/* @__PURE__ */ new Date()).getTime(),
|
|
2322
|
-
default_chain:
|
|
2323
|
-
default_chain_logo:
|
|
2324
|
-
type:
|
|
2325
|
-
isNftSupported:
|
|
2326
|
-
chainId: chain?.community_id || chain.chainId || chain.id,
|
|
2327
|
-
address
|
|
2402
|
+
default_chain: provider.id,
|
|
2403
|
+
default_chain_logo: null,
|
|
2404
|
+
type: provider.type,
|
|
2405
|
+
isNftSupported: provider.isEvmWallet || provider.nftSupport || false
|
|
2328
2406
|
};
|
|
2329
2407
|
integrationsToAdd.push(data);
|
|
2330
2408
|
} else {
|
|
2331
|
-
|
|
2409
|
+
if (result.status === "rejected") {
|
|
2410
|
+
errors[chain.id] = result.reason?.response?.data?.message || "Failed to process chain";
|
|
2411
|
+
} else if (result.status === "fulfilled") {
|
|
2412
|
+
errors[chain.id] = result.value?.message || "Failed to verify chain";
|
|
2413
|
+
}
|
|
2332
2414
|
}
|
|
2333
2415
|
});
|
|
2416
|
+
setChainErrors(errors);
|
|
2417
|
+
if (Object.keys(errors).length > 0) {
|
|
2418
|
+
setErrorMessage(
|
|
2419
|
+
`Cannot add integrations. ${Object.keys(errors).length} chain${Object.keys(errors).length > 1 ? "s" : ""} failed verification. Please fix the errors and try again.`
|
|
2420
|
+
);
|
|
2421
|
+
return;
|
|
2422
|
+
}
|
|
2334
2423
|
if (integrationsToAdd.length > 0) {
|
|
2335
2424
|
onAddHandle(integrationsToAdd);
|
|
2336
2425
|
setChainErrors({});
|
|
@@ -2348,17 +2437,17 @@ function ConnectButton({
|
|
|
2348
2437
|
setIsLoading(false);
|
|
2349
2438
|
}
|
|
2350
2439
|
};
|
|
2351
|
-
const toggleChainSelection = (
|
|
2440
|
+
const toggleChainSelection = (chainId) => {
|
|
2352
2441
|
const newSelected = new Set(selectedChains);
|
|
2353
|
-
if (newSelected.has(
|
|
2354
|
-
newSelected.delete(
|
|
2442
|
+
if (newSelected.has(chainId)) {
|
|
2443
|
+
newSelected.delete(chainId);
|
|
2355
2444
|
} else {
|
|
2356
|
-
newSelected.add(
|
|
2445
|
+
newSelected.add(chainId);
|
|
2357
2446
|
}
|
|
2358
2447
|
setSelectedChains(newSelected);
|
|
2359
|
-
if (chainErrors[
|
|
2448
|
+
if (chainErrors[chainId]) {
|
|
2360
2449
|
const newErrors = { ...chainErrors };
|
|
2361
|
-
delete newErrors[
|
|
2450
|
+
delete newErrors[chainId];
|
|
2362
2451
|
setChainErrors(newErrors);
|
|
2363
2452
|
}
|
|
2364
2453
|
};
|
|
@@ -2379,107 +2468,149 @@ function ConnectButton({
|
|
|
2379
2468
|
onPress: () => open({ view: "Connect" })
|
|
2380
2469
|
},
|
|
2381
2470
|
"Connect Wallet"
|
|
2382
|
-
)) : /* @__PURE__ */ React29.createElement(View13,
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
}
|
|
2392
|
-
|
|
2393
|
-
|
|
2471
|
+
)) : /* @__PURE__ */ React29.createElement(View13, { style: styles13.connectedContainer }, /* @__PURE__ */ React29.createElement(View13, { style: styles13.connectedHeader }, /* @__PURE__ */ React29.createElement(
|
|
2472
|
+
Text11,
|
|
2473
|
+
{
|
|
2474
|
+
style: [styles13.connectedTitle, { color: theme.colors.text }]
|
|
2475
|
+
},
|
|
2476
|
+
"Wallet Connected"
|
|
2477
|
+
), /* @__PURE__ */ React29.createElement(
|
|
2478
|
+
Text11,
|
|
2479
|
+
{
|
|
2480
|
+
style: [styles13.connectedText, { color: theme.colors.text }]
|
|
2481
|
+
},
|
|
2482
|
+
"Address: ",
|
|
2483
|
+
address
|
|
2484
|
+
), /* @__PURE__ */ React29.createElement(Button, { variant: "ghost", size: "sm", onPress: () => disconnect() }, "Disconnect Wallet"), isFetchingChains ? /* @__PURE__ */ React29.createElement(
|
|
2485
|
+
Text11,
|
|
2486
|
+
{
|
|
2487
|
+
style: [styles13.fetchingText, { color: theme.colors.text }]
|
|
2488
|
+
},
|
|
2489
|
+
"Fetching chains..."
|
|
2490
|
+
) : null), availableChains.length > 0 && address && /* @__PURE__ */ React29.createElement(
|
|
2491
|
+
ScrollView2,
|
|
2492
|
+
{
|
|
2493
|
+
style: styles13.scrollView,
|
|
2494
|
+
contentContainerStyle: styles13.scrollViewContent,
|
|
2495
|
+
showsVerticalScrollIndicator: true,
|
|
2496
|
+
nestedScrollEnabled: true
|
|
2497
|
+
},
|
|
2498
|
+
/* @__PURE__ */ React29.createElement(Text11, { style: [styles13.chainTitle, { color: theme.colors.text }] }, "Select Chains to Add:"),
|
|
2499
|
+
/* @__PURE__ */ React29.createElement(View13, null, /* @__PURE__ */ React29.createElement(View13, { style: styles13.chainChips }, availableChains.map((chain) => {
|
|
2500
|
+
const isSelected = selectedChains.has(chain.id);
|
|
2501
|
+
const hasError = chainErrors[chain.id];
|
|
2502
|
+
return /* @__PURE__ */ React29.createElement(
|
|
2503
|
+
TouchableOpacity4,
|
|
2394
2504
|
{
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
backgroundColor: hasError ? theme.colors.errorLight : isSelected ? theme.colors.primary + "20" : theme.colors.surface,
|
|
2399
|
-
borderColor: hasError ? theme.colors.error : isSelected ? theme.colors.primary : theme.colors.border
|
|
2400
|
-
}
|
|
2401
|
-
]
|
|
2505
|
+
onPress: () => toggleChainSelection(chain.id),
|
|
2506
|
+
style: styles13.chainButton,
|
|
2507
|
+
key: chain.id
|
|
2402
2508
|
},
|
|
2403
2509
|
/* @__PURE__ */ React29.createElement(
|
|
2404
|
-
|
|
2510
|
+
View13,
|
|
2405
2511
|
{
|
|
2406
2512
|
style: [
|
|
2407
|
-
styles13.
|
|
2513
|
+
styles13.chainChip,
|
|
2408
2514
|
{
|
|
2409
|
-
|
|
2515
|
+
backgroundColor: hasError ? theme.colors.errorLight : isSelected ? theme.colors.primary + "20" : theme.colors.surface,
|
|
2516
|
+
borderColor: hasError ? theme.colors.error : isSelected ? theme.colors.primary : theme.colors.border
|
|
2410
2517
|
}
|
|
2411
2518
|
]
|
|
2412
2519
|
},
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2520
|
+
/* @__PURE__ */ React29.createElement(
|
|
2521
|
+
Text11,
|
|
2522
|
+
{
|
|
2523
|
+
style: [
|
|
2524
|
+
styles13.chainName,
|
|
2525
|
+
{
|
|
2526
|
+
color: hasError ? theme.colors.error : isSelected ? theme.colors.primary : theme.colors.text
|
|
2527
|
+
}
|
|
2528
|
+
]
|
|
2529
|
+
},
|
|
2530
|
+
chain.id
|
|
2531
|
+
),
|
|
2532
|
+
isSelected ? /* @__PURE__ */ React29.createElement(
|
|
2533
|
+
CloseIcon,
|
|
2534
|
+
{
|
|
2535
|
+
size: 12,
|
|
2536
|
+
color: hasError ? theme.colors.error : theme.colors.primary
|
|
2537
|
+
}
|
|
2538
|
+
) : /* @__PURE__ */ React29.createElement(
|
|
2539
|
+
PlusIcon,
|
|
2540
|
+
{
|
|
2541
|
+
size: 12,
|
|
2542
|
+
color: theme.colors.textSecondary
|
|
2543
|
+
}
|
|
2544
|
+
)
|
|
2427
2545
|
)
|
|
2428
|
-
)
|
|
2429
|
-
)
|
|
2430
|
-
}))), Object.keys(chainErrors).length > 0 && /* @__PURE__ */ React29.createElement(View13, { style: styles13.chainErrorsContainer }, /* @__PURE__ */ React29.createElement(
|
|
2431
|
-
Text11,
|
|
2432
|
-
{
|
|
2433
|
-
style: [
|
|
2434
|
-
styles13.chainErrorsTitle,
|
|
2435
|
-
{ color: theme.colors.error }
|
|
2436
|
-
]
|
|
2437
|
-
},
|
|
2438
|
-
"Errors:"
|
|
2439
|
-
), Object.entries(chainErrors).map(([chainId2, error]) => {
|
|
2440
|
-
const chain = userUsedChains.find(
|
|
2441
|
-
(c) => c.id === chainId2
|
|
2442
|
-
);
|
|
2443
|
-
return /* @__PURE__ */ React29.createElement(
|
|
2546
|
+
);
|
|
2547
|
+
})), errorMessage ? /* @__PURE__ */ React29.createElement(View13, { style: styles13.errorMessageContainer }, /* @__PURE__ */ React29.createElement(Alert, { variant: "destructive" }, /* @__PURE__ */ React29.createElement(AlertDescription, null, errorMessage))) : null, Object.keys(chainErrors || {}).length > 0 && /* @__PURE__ */ React29.createElement(View13, { style: styles13.chainErrorsContainer }, /* @__PURE__ */ React29.createElement(
|
|
2444
2548
|
Text11,
|
|
2445
2549
|
{
|
|
2446
|
-
key: chainId2,
|
|
2447
2550
|
style: [
|
|
2448
|
-
styles13.
|
|
2551
|
+
styles13.chainErrorsTitle,
|
|
2449
2552
|
{ color: theme.colors.error }
|
|
2450
2553
|
]
|
|
2451
2554
|
},
|
|
2452
|
-
"
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2555
|
+
"Errors:"
|
|
2556
|
+
), Object.entries(chainErrors).map(([chainId, error]) => {
|
|
2557
|
+
const chain = availableChains.find(
|
|
2558
|
+
(c) => c.id === chainId
|
|
2559
|
+
);
|
|
2560
|
+
return /* @__PURE__ */ React29.createElement(
|
|
2561
|
+
Text11,
|
|
2562
|
+
{
|
|
2563
|
+
key: chainId,
|
|
2564
|
+
style: [
|
|
2565
|
+
styles13.chainErrorItem,
|
|
2566
|
+
{ color: theme.colors.error }
|
|
2567
|
+
]
|
|
2568
|
+
},
|
|
2569
|
+
"\u2022 ",
|
|
2570
|
+
chain?.name ?? chainId,
|
|
2571
|
+
": ",
|
|
2572
|
+
String(error)
|
|
2573
|
+
);
|
|
2574
|
+
})))
|
|
2575
|
+
))), availableChains.length > 0 && address && /* @__PURE__ */ React29.createElement(ModalFooter, { style: { paddingVertical: 8 } }, /* @__PURE__ */ React29.createElement(
|
|
2458
2576
|
Button,
|
|
2459
2577
|
{
|
|
2460
2578
|
variant: "outline",
|
|
2461
2579
|
size: "lg",
|
|
2462
2580
|
onPress: onSubmitWalletConnect,
|
|
2463
2581
|
loading: isLoading,
|
|
2464
|
-
disabled: isLoading || !!address &&
|
|
2582
|
+
disabled: isLoading || !!address && availableChains.length > 0 && selectedChains.size === 0,
|
|
2465
2583
|
style: styles13.button
|
|
2466
2584
|
},
|
|
2467
2585
|
selectedChains.size > 0 ? `Add ${selectedChains.size} Chain${selectedChains.size > 1 ? "s" : ""}` : "Add Integration"
|
|
2468
2586
|
), /* @__PURE__ */ React29.createElement(Footer, null)));
|
|
2469
2587
|
}
|
|
2470
2588
|
var styles13 = StyleSheet13.create({
|
|
2471
|
-
|
|
2589
|
+
connectedContainer: {
|
|
2590
|
+
flex: 1
|
|
2591
|
+
},
|
|
2592
|
+
connectedHeader: {
|
|
2593
|
+
marginBottom: 8
|
|
2594
|
+
},
|
|
2595
|
+
connectedTitle: { fontSize: 12, fontWeight: "600", marginBottom: 4 },
|
|
2472
2596
|
connectedText: { fontSize: 14, marginBottom: 4 },
|
|
2597
|
+
fetchingText: { fontSize: 12, marginBottom: 4, textAlign: "center" },
|
|
2473
2598
|
infoText: {
|
|
2474
2599
|
fontSize: 16,
|
|
2475
2600
|
fontWeight: "600",
|
|
2476
2601
|
marginBottom: 8,
|
|
2477
2602
|
textAlign: "center"
|
|
2478
2603
|
},
|
|
2604
|
+
scrollView: {
|
|
2605
|
+
flex: 1
|
|
2606
|
+
},
|
|
2479
2607
|
scrollViewContent: {
|
|
2480
|
-
paddingBottom:
|
|
2608
|
+
paddingBottom: 40,
|
|
2481
2609
|
flexGrow: 1
|
|
2482
2610
|
},
|
|
2611
|
+
errorMessageContainer: {
|
|
2612
|
+
marginTop: 16
|
|
2613
|
+
},
|
|
2483
2614
|
headerContent: {
|
|
2484
2615
|
flexDirection: "row",
|
|
2485
2616
|
alignItems: "center"
|
|
@@ -2498,17 +2629,13 @@ var styles13 = StyleSheet13.create({
|
|
|
2498
2629
|
contentContainer: {
|
|
2499
2630
|
padding: 20,
|
|
2500
2631
|
// theme.spacing.xl
|
|
2501
|
-
paddingBottom:
|
|
2632
|
+
paddingBottom: 20,
|
|
2502
2633
|
width: "100%",
|
|
2503
2634
|
overflow: "hidden",
|
|
2504
2635
|
alignSelf: "center",
|
|
2505
2636
|
flexDirection: "column",
|
|
2506
2637
|
flex: 1
|
|
2507
2638
|
},
|
|
2508
|
-
chainSelection: {
|
|
2509
|
-
marginBottom: 16
|
|
2510
|
-
// theme.spacing.lg
|
|
2511
|
-
},
|
|
2512
2639
|
chainTitle: {
|
|
2513
2640
|
fontSize: 14,
|
|
2514
2641
|
// theme.fontSize.md
|
|
@@ -2560,9 +2687,7 @@ var styles13 = StyleSheet13.create({
|
|
|
2560
2687
|
// theme.spacing.xs
|
|
2561
2688
|
},
|
|
2562
2689
|
button: {
|
|
2563
|
-
width: "100%"
|
|
2564
|
-
marginTop: 16
|
|
2565
|
-
// theme.spacing.lg - consistent button spacing
|
|
2690
|
+
width: "100%"
|
|
2566
2691
|
},
|
|
2567
2692
|
emptyState: {
|
|
2568
2693
|
flex: 1,
|
|
@@ -2594,7 +2719,8 @@ var IntegrationForm = ({
|
|
|
2594
2719
|
onAddHandle,
|
|
2595
2720
|
open,
|
|
2596
2721
|
setAddIntegrationMode,
|
|
2597
|
-
handleClose
|
|
2722
|
+
handleClose,
|
|
2723
|
+
providersList
|
|
2598
2724
|
}) => {
|
|
2599
2725
|
const { clientId, linkToken, user } = useKryptosConnect();
|
|
2600
2726
|
const theme = useTheme();
|
|
@@ -2828,7 +2954,7 @@ var IntegrationForm = ({
|
|
|
2828
2954
|
isNftSupported: metadata.isEvmWallet || metadata.nftSupport || false
|
|
2829
2955
|
};
|
|
2830
2956
|
if (metadata.community_id) {
|
|
2831
|
-
data.chainId =
|
|
2957
|
+
data.chainId = metadata.community_id;
|
|
2832
2958
|
}
|
|
2833
2959
|
if (formValues.address) data.address = formValues.address;
|
|
2834
2960
|
if (formValues.account_name) data.accountName = formValues.account_name;
|
|
@@ -2999,7 +3125,8 @@ var IntegrationForm = ({
|
|
|
2999
3125
|
onAddHandle,
|
|
3000
3126
|
modalOpen: open,
|
|
3001
3127
|
setAddIntegrationMode,
|
|
3002
|
-
handleClose
|
|
3128
|
+
handleClose,
|
|
3129
|
+
providersList
|
|
3003
3130
|
}
|
|
3004
3131
|
));
|
|
3005
3132
|
};
|
|
@@ -3386,7 +3513,8 @@ var Integration = ({
|
|
|
3386
3513
|
},
|
|
3387
3514
|
open: !!addIntegrationMode,
|
|
3388
3515
|
setAddIntegrationMode,
|
|
3389
|
-
handleClose
|
|
3516
|
+
handleClose,
|
|
3517
|
+
providersList: supportedProviders
|
|
3390
3518
|
}
|
|
3391
3519
|
));
|
|
3392
3520
|
};
|
|
@@ -3413,9 +3541,10 @@ var styles15 = StyleSheet15.create({
|
|
|
3413
3541
|
flex: 1
|
|
3414
3542
|
},
|
|
3415
3543
|
headerSection: {
|
|
3416
|
-
paddingHorizontal: 20
|
|
3544
|
+
paddingHorizontal: 20,
|
|
3545
|
+
// theme.spacing.xl
|
|
3546
|
+
paddingTop: 10
|
|
3417
3547
|
// theme.spacing.xl
|
|
3418
|
-
// paddingTop: 10, // theme.spacing.xl
|
|
3419
3548
|
},
|
|
3420
3549
|
title: {
|
|
3421
3550
|
fontSize: 16,
|
|
@@ -3914,11 +4043,11 @@ var styles18 = StyleSheet18.create({
|
|
|
3914
4043
|
});
|
|
3915
4044
|
|
|
3916
4045
|
// src/molecules/EndModal.tsx
|
|
3917
|
-
import React35, { useEffect as
|
|
4046
|
+
import React35, { useEffect as useEffect3 } from "react";
|
|
3918
4047
|
import { StyleSheet as StyleSheet19, Text as Text17, View as View19 } from "react-native";
|
|
3919
4048
|
var EndModal = ({ open, onClose }) => {
|
|
3920
4049
|
const theme = useTheme();
|
|
3921
|
-
|
|
4050
|
+
useEffect3(() => {
|
|
3922
4051
|
if (!open) return;
|
|
3923
4052
|
const timer = setTimeout(() => {
|
|
3924
4053
|
onClose();
|