Skip to main content

Mobile SDK

The Kryptos Connect Mobile SDK provides React Native components for iOS and Android applications. It works with both Expo and React Native CLI.

Before you begin

Make sure you have completed the prerequisites in the overview and set up your backend server.

Installation

npm install @kryptos_connect/mobile-sdk react-native-svg

Core Dependencies

Install all required dependencies:

npx expo install @reown/appkit-react-native @react-native-async-storage/async-storage \
react-native-get-random-values react-native-svg @react-native-community/netinfo \
@walletconnect/react-native-compat react-native-safe-area-context expo-application

Platform Setup

iOS (React Native CLI only):

cd ios && pod install

Expo SDK 53+ - Add to babel.config.js:

module.exports = function (api) {
api.cache(true);
return {
presets: [["babel-preset-expo", { unstable_transformImportMeta: true }]],
};
};

Quick Start

import {
KryptosConnectProvider,
KryptosConnectButton,
} from "@kryptos_connect/mobile-sdk";

// 1. Wrap your app with the provider
export default function App() {
return (
<KryptosConnectProvider
config={{
appName: "My Mobile App",
appLogo: "https://yourapp.com/logo.png",
clientId: "your-kryptos-client-id",
theme: "light",
walletConnectProjectId: "your-walletconnect-project-id",
}}
>
<ConnectScreen />
</KryptosConnectProvider>
);
}

// 2. Use the connect button
function ConnectScreen() {
const generateLinkToken = async () => {
const response = await fetch(
"https://your-api.com/api/kryptos/create-link-token",
{
method: "POST",
headers: { "Content-Type": "application/json" },
},
);
const data = await response.json();
return data.link_token;
};

const handleSuccess = (userConsent) => {
if (userConsent?.public_token) {
// Exchange public token for access token
fetch("https://your-api.com/api/kryptos/exchange-token", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ public_token: userConsent.public_token }),
});
}
};

return (
<KryptosConnectButton
generateLinkToken={generateLinkToken}
onSuccess={handleSuccess}
onError={() => console.log("Connection failed")}
>
Connect to Kryptos
</KryptosConnectButton>
);
}

Provider Configuration

OptionTypeRequiredDescription
appNamestringYesYour application name
appLogostring | ReactNodeNoLogo URL or image source
clientIdstringYesKryptos client ID from Developer Portal
theme"light" | "dark"NoUI theme (default: "light")
walletConnectProjectIdstringNoWalletConnect v2 project ID

Button Configuration

OptionTypeRequiredDescription
generateLinkToken() => Promise<string>YesFunction that returns link token
onSuccess(userConsent: UserConsent) => voidNoCallback on successful connection
onError() => voidNoCallback on connection failure
childrenReactNodeNoCustom button content
styleViewStyleNoContainer styling
textStyleTextStyleNoText styling

Custom Button Styling

<KryptosConnectButton
generateLinkToken={generateLinkToken}
onSuccess={handleSuccess}
onError={handleError}
style={{ backgroundColor: "#8b5cf6", borderRadius: 12, padding: 16 }}
textStyle={{ color: "#ffffff", fontSize: 16, fontWeight: "bold" }}
>
Connect Wallet
</KryptosConnectButton>

Using KryptosConnectModal

For advanced use cases, use the modal component directly:

import { KryptosConnectModal } from "@kryptos_connect/mobile-sdk";
import { useState } from "react";
import { TouchableOpacity, Text } from "react-native";

function ConnectScreen() {
const [open, setOpen] = useState(false);

return (
<>
<TouchableOpacity onPress={() => setOpen(true)}>
<Text>Open Connection Modal</Text>
</TouchableOpacity>
<KryptosConnectModal
open={open}
setOpen={setOpen}
generateLinkToken={generateLinkToken}
onSuccess={handleSuccess}
onError={handleError}
/>
</>
);
}

WalletConnect Integration

To enable WalletConnect v2 functionality, add the required imports at your app entry point:

// App.tsx or index.js - add these imports at the top
import "@walletconnect/react-native-compat";
import "react-native-get-random-values";

import { KryptosConnectProvider } from "@kryptos_connect/mobile-sdk";

const config = {
appName: "Your App",
appLogo: "https://your-logo.png",
clientId: "your-kryptos-client-id",
walletConnectProjectId: "your-walletconnect-project-id", // Required for WalletConnect
};

export default function App() {
return (
<KryptosConnectProvider config={config}>
<YourApp />
</KryptosConnectProvider>
);
}

Platform Requirements

PlatformMinimum Version
iOS12.0+
AndroidAPI 21+ (Android 5.0+)
React Native0.60+
Expo SDK48+

Features

  • Cross-Platform: Single codebase for iOS and Android
  • Expo Support: Works with Expo and React Native CLI
  • WalletConnect v2: Built-in WalletConnect integration
  • Dark Mode: Light and dark theme support
  • TypeScript: Full TypeScript support

Package Information

Next steps