+ );
+}
\ No newline at end of file
diff --git a/app/components/mdx/QuickStartBanner.tsx b/app/components/mdx/QuickStartBanner.tsx
index a0bc2ec..37a05fe 100644
--- a/app/components/mdx/QuickStartBanner.tsx
+++ b/app/components/mdx/QuickStartBanner.tsx
@@ -1,34 +1,70 @@
import { FaReact } from "react-icons/fa6";
-import { TbBrandNextjs } from "react-icons/tb";
+import { TbBrandNextjs, TbBrandReactNative } from "react-icons/tb";
import { SiTypescript } from "react-icons/si";
-import Link from 'next/link';
+import Link from "next/link";
export default function QuickStartBanner() {
return (
-
-
-
- Get straight to building your Okto-powered app with our Quickstart Guides.
+
+
+
+ Quick Start Guides
+
+
+ Get straight to building your Okto-powered app with our Quickstart Guides.
@@ -38,7 +45,7 @@ export default function TechnologyCard({ icon, title, subtitle, link }: Technolo
- {/* Added shrink-0 */}
+
diff --git a/app/global.css b/app/global.css
index 0a677db..8ccd6b1 100644
--- a/app/global.css
+++ b/app/global.css
@@ -161,4 +161,9 @@ html {
src: url('/fonts/FunnelDisplay.ttf') format('ttf');
font-weight: bold;
font-style: normal;
+}
+
+/* Add this rule to make the "About Okto" link bold in the sidebar */
+#nd-docs-layout aside a[href="/"] {
+ font-weight: bold;
}
\ No newline at end of file
diff --git a/content/docs/flutter-sdk/meta.json b/content/docs/flutter-sdk/meta.json
index af110a3..157c3cc 100644
--- a/content/docs/flutter-sdk/meta.json
+++ b/content/docs/flutter-sdk/meta.json
@@ -1,7 +1,7 @@
{
"title": "Flutter (Coming Soon)",
"pages": [
- "[About Okto](/)",
+ "[← Back to Home](/)",
"index",
"getting-started",
"authentication",
diff --git a/content/docs/index.mdx b/content/docs/index.mdx
index 56a1ce2..b4aaaab 100644
--- a/content/docs/index.mdx
+++ b/content/docs/index.mdx
@@ -4,66 +4,97 @@ full: false
icon: Star
---
-# Welcome to the Future of Web3 Development with Okto!
-
-Build powerful decentralized applications with the ease of Web2 and the power of chain abstraction. **Okto SDK** lets you integrate blockchain functionality without infrastructure complexity. Add multi-chain wallets, secure transactions, and Web3 features to any app in days, not months.
-
import TechnologyCard from "app/components/mdx/TechnologyCard";
+import FeatureCard from "app/components/mdx/FeatureCard";
import QuickStartBanner from "app/components/mdx/QuickStartBanner";
import {
- LuLayoutDashboard, LuToggleLeft, LuCode, LuWallet, LuBookOpen
+ LuLayoutDashboard, LuToggleLeft, LuCode, LuWallet, LuBookOpen,
+ LuKey, LuArrowRightLeft, LuNetwork, LuMousePointerClick,
+ LuUserPlus, LuShoppingCart, LuGamepad2, LuBoxes
} from "react-icons/lu";
import { FaDiscord } from "react-icons/fa6";
import { MousePointer2 } from 'lucide-react';
-
+# Welcome to the Future of Web3 Development with Okto!
-
+
-## Start building with Okto SDK in 4 Steps
+The **Okto SDK** is a game-changer for developers looking to integrate blockchain seamlessly into their applications, whether they are Web2 companies exploring Web3 or existing Web3 projects expanding capabilities. It eliminates the complexity of blockchain interactions by providing a **plug-and-play** abstraction layer, allowing developers to focus on building **intuitive and user-friendly experiences**.
-
+## Key Features
- }
- title="1. Get Your App Secret from Okto Dashboard"
- subtitle="Create account & get App Secret"
- link="https://docs.google.com/document/d/1nZZefjQ-1dPE--FmsBB8TLOzMOorNg8N85pMDg3rmCY/edit?usp=sharing"
+
+ }
+ title="Social Logins"
+ description="Seamless authentication with popular social providers"
+ iconColor="text-blue-500"
/>
-
- }
- title="2. Configure Chains & Tokens"
- subtitle="Select and configure the chains and tokens your application will support"
- link="https://docs.google.com/document/d/1nZZefjQ-1dPE--FmsBB8TLOzMOorNg8N85pMDg3rmCY/edit?usp=sharing"
+ }
+ title="Automated Transactions"
+ description="Simplified transaction handling and gas management"
+ iconColor="text-green-500"
/>
-
- }
- title="3. Enable Sponsorship (if needed)"
- subtitle="Configure gas sponsorship for a smoother user experience. Required for Solana, optional for other chains."
- link="https://docs.google.com/document/d/1nZZefjQ-1dPE--FmsBB8TLOzMOorNg8N85pMDg3rmCY/edit?usp=sharing"
+ }
+ title="Multi-chain Support"
+ description="Seamless interaction across different blockchains"
+ iconColor="text-purple-500"
/>
-
- }
- title="4. Choose Your SDK & Start Building!"
- subtitle="Select the Okto SDK that best fits your project's platform and begin integrating Web3 features effortlessly."
- link="/docs/okto-sdk/supported-sdk-platforms"
+ }
+ title="One-click Transactions"
+ description="Simplified user experience for multi chain transactions"
+ iconColor="text-orange-500"
+ />
+ }
+ title="Asset Management"
+ description="Cross-chain asset handling and portfolio management"
+ iconColor="text-red-500"
+ />
+ }
+ title="Easy Onboarding"
+ description="Simplified user onboarding for Web3 applications"
+ iconColor="text-teal-500"
/>
-
-
-
-📱 Check out our [supported SDK platforms](/docs/okto-sdk/supported-sdk-platforms) to find the perfect SDK for your project
-
-⚡ Explore our comprehensive [feature support](/docs/okto-sdk/feature-support) to see what you can build with Okto
+
+
+
+ Why Okto SDK?
+
+
+ By handling blockchain complexity behind the scenes, Okto SDK accelerates development, enhances security, and ensures a superior user experience—paving the way for mass adoption. 🚀
+
+
+
-🔨 Get inspired by [real-world use cases](/docs/okto-sdk/use-cases) that can be built with Okto SDK
-
+## Real-World Applications
----
+
+ }
+ title="E-commerce"
+ description="Integrate crypto payments and NFT loyalty rewards without backend rework"
+ iconColor="text-blue-500"
+ />
+ }
+ title="Gaming"
+ description="Enable seamless cross-chain asset trading in gaming environments"
+ iconColor="text-purple-500"
+ />
+ }
+ title="Web3 Projects"
+ description="Scale across multiple chains with abstracted gas management"
+ iconColor="text-green-500"
+ />
+
## Explore Okto: Dive Deeper & Learn More
@@ -71,7 +102,7 @@ import { MousePointer2 } from 'lucide-react';
}
title="Introduction to Okto Universe"
- subtitle="Discover the core concepts, architecture, and benefits of the Okto Layer and its components."
+ subtitle="Discover the core concepts of the Okto Layer and its components."
link="/docs/okto-ecosystem"
/>
@@ -85,24 +116,14 @@ import { MousePointer2 } from 'lucide-react';
}
title="Master the Developer Dashboard"
- subtitle="Learn how to leverage the Okto Admin Dashboard to configure your application, manage sponsorship, and customize onboarding flows."
+ subtitle="Learn how to leverage the Okto Admin Dashboard to configure your application."
link="docs/developer-admin-dashboard/overview"
/>
- }
- title="Real World Use Cases & Examples"
- subtitle="Explore practical use cases and code examples demonstrating how to build various Web3 applications with Okto SDK."
- link="/docs/okto-sdk/use-cases"
- />
-
}
title="Join the Okto Community"
subtitle="Connect with the Okto team and fellow developers on Discord for support, feedback, and collaboration."
link="https://discord.com/invite/okto-916349620383252511"
/>
-
-
-
\ No newline at end of file
diff --git a/content/docs/meta.json b/content/docs/meta.json
index 5f1be59..d16b339 100644
--- a/content/docs/meta.json
+++ b/content/docs/meta.json
@@ -11,11 +11,12 @@
"okto-sdk",
"react-sdk",
"react-native-sdk",
- "flutter-sdk",
- "unity-sdk",
+ "!flutter-sdk",
+ "!unity-sdk",
"typescript-sdk",
"---Resources---",
"developer-admin-dashboard",
+ "troubleshooting",
"brand-kit",
"faq",
"glossary",
diff --git a/content/docs/okto-sdk/index.mdx b/content/docs/okto-sdk/index.mdx
index 714da47..d64f567 100644
--- a/content/docs/okto-sdk/index.mdx
+++ b/content/docs/okto-sdk/index.mdx
@@ -1,100 +1,95 @@
---
title: About SDK
-description: Okto provides a suite of SDKs tailored to different platforms, enabling you to integrate Web3 functionalities effortlessly. Whether you're building for the web, mobile, or other platforms, Okto has an SDK to match your needs. Below is an overview of each SDK, its use case, and links to get started.
+description: Okto provides a suite of SDKs tailored to different platforms, enabling you to integrate Web3 functionalities effortlessly.
full: false
---
+import { Step, Steps } from "fumadocs-ui/components/steps";
import TechnologyCard from "/app/components/mdx/TechnologyCard";
import { IoBookOutline, IoCodeSlashOutline, IoRocketOutline, IoAppsOutline } from "react-icons/io5";
import { LuLayoutDashboard, LuToggleLeft, LuCode, LuBookOpen, LuWallet } from "react-icons/lu";
import { FaReact, FaUnity } from "react-icons/fa6";
-import { TbBrandReactNative, TbApi } from "react-icons/tb";
+import { TbBrandReactNative, TbBrandNextjs } from "react-icons/tb";
import { SiFlutter, SiTypescript } from "react-icons/si";
+## What is Okto SDK?
----
-
-## Quick Start
-
-Get started with Okto SDK in just four steps:
-
-
+Okto SDK is a powerful chain abstraction toolkit that simplifies blockchain development. It handles complex blockchain operations behind the scenes—from wallet management to cross-chain transactions—allowing developers to build Web3 applications using familiar development patterns.
- }
- title="1. Get Your App Secret from Okto Dashboard"
- subtitle="Sign up and retrieve your Okto App Secret"
- link="https://docs.google.com/document/d/1nZZefjQ-1dPE--FmsBB8TLOzMOorNg8N85pMDg3rmCY/edit?usp=sharing"
- />
+Whether you're creating a DeFi platform, NFT marketplace, or adding Web3 features to an existing app, Okto SDK provides the tools you need with Web2-like simplicity.
- }
- title="2. Configure Chains & Tokens in Dashboard"
- subtitle="Easily select and configure the blockchains and tokens your application will support"
- link="https://docs.google.com/document/d/1nZZefjQ-1dPE--FmsBB8TLOzMOorNg8N85pMDg3rmCY/edit?usp=sharing"
- />
+[Learn more about Okto SDK →](/docs/okto-sdk/sdk-introduction)
- }
- title="3. Enable Sponsorship (if needed)"
- subtitle="Configure gas sponsorship for a smoother user experience. Required for Solana, optional for other chains."
- link="https://docs.google.com/document/d/1nZZefjQ-1dPE--FmsBB8TLOzMOorNg8N85pMDg3rmCY/edit?usp=sharing"
- />
-
- }
- title="4. Choose Your SDK & Start Building!"
- subtitle="Select the Okto SDK that best fits your project's platform and begin integrating Web3 features effortlessly."
- link="/docs/okto-sdk/supported-sdk-platforms"
- />
+---
-
+## Start building with Okto SDK in 3 Steps
+
+
+
+ ### Get Your API Keys from Okto Dashboard
+ Create your account
+ on the Okto Dashboard and obtain your App Secret to begin integrating the SDK.
+
+
+
+ ### Configure Chains and Tokens
+ Select and configure the chains and tokens
+ your application will support. If needed, set up gas sponsorship for a smoother user experience (required for Solana, optional for other chains).
+
+
+
+ ### Start Building!
+
+ Select the Okto SDK that best fits your project's platform and begin integrating Web3 features effortlessly.
+
+
+
+
-📱 Check out our [supported SDK platforms](/docs/okto-sdk/supported-sdk-platforms) to find the perfect SDK for your project
-
⚡ Explore our comprehensive [feature support](/docs/okto-sdk/feature-support) to see what you can build with Okto
🔨 Get inspired by [real-world use cases](/docs/okto-sdk/use-cases) that can be built with Okto SDK
----
-
-## Explore Okto SDKs
-
-Pick the right SDK for your platform and start integrating Web3 features:
-
-
-
----
\ No newline at end of file
diff --git a/content/docs/react-native-sdk/index.mdx b/content/docs/react-native-sdk/index.mdx
index 3970ca7..491b549 100644
--- a/content/docs/react-native-sdk/index.mdx
+++ b/content/docs/react-native-sdk/index.mdx
@@ -1,5 +1,97 @@
---
title: Overview of React Native SDK
-description: Okto is a platform that allows you to integrate web3 functionality into your app without building things from scratch.
+description: A complete guide to integrating Okto into your React Native applications.
full: false
----
\ No newline at end of file
+---
+
+import TechnologyCard from 'app/components/mdx/TechnologyCard';
+import {
+ IoCodeSlashOutline,
+ IoKeyOutline,
+ IoWalletOutline,
+ IoBookOutline,
+ IoConstructOutline,
+ IoGitBranchOutline,
+ IoHelpCircleOutline,
+ IoSwapHorizontalOutline
+} from "react-icons/io5";
+
+## Introduction to Okto React Native SDK
+
+**Okto React Native SDK** is your all-in-one toolkit for integrating Web3 functionality into any React Native application. With minimal setup time, you can effortlessly onboard your users to the Web3 ecosystem and provide them with a seamless mobile experience.
+
+
+
+## Installation & Quickstart
+
+Kickstart your project by following our [Quickstart Guide](/docs/react-native-sdk/quickstart). This guide will take you through installing the SDK, configuring your project, and executing your first transaction.
+
+## Explore the React Native SDK
+
+
+ }
+ title="Authentication"
+ subtitle="Implement secure user login and session management"
+ link="/docs/react-native-sdk/authenticate-users/okto-auth"
+ />
+ }
+ title="Wallet Management"
+ subtitle="Configure and manage embedded and external wallets"
+ link="/docs/react-native-sdk/wallets/overview"
+ />
+ }
+ title="Usage & Features"
+ subtitle="Explore hooks, explorer functions, and intent operations"
+ link="/docs/react-native-sdk/usage-overview"
+ />
+ }
+ title="Technical Reference"
+ subtitle="In-depth documentation of classes, methods, and data models"
+ link="/docs/react-native-sdk/technical-reference"
+ />
+ }
+ title="Troubleshooting"
+ subtitle="Common issues and their solutions"
+ link="/docs/react-native-sdk/troubleshooting"
+ />
+ }
+ title="Migration Guide"
+ subtitle="Upgrade from previous versions of the SDK"
+ link="/docs/react-native-sdk/v2migration"
+ />
+
+
+## Get Started
+
+Ready to dive in? Begin with our **[Quickstart Guide](/docs/react-native-sdk/quickstart)** to set up your environment, obtain your Okto API key, and build your first React Native application powered by the Okto SDK.
+
+If you have any questions or need assistance, don't hesitate to reach out via our **[Troubleshooting](/docs/react-native-sdk/troubleshooting)** page or email us at `devrel@coindcx.com`.
+
+**Happy Building!**
\ No newline at end of file
diff --git a/content/docs/react-sdk/(Intents)/intents.mdx b/content/docs/react-sdk/(Intents)/intents.mdx
new file mode 100644
index 0000000..45bffad
--- /dev/null
+++ b/content/docs/react-sdk/(Intents)/intents.mdx
@@ -0,0 +1,61 @@
+---
+title: Understanding Intents
+full: false
+---
+
+Intents make Web3 easy. Instead of complex steps, you simply tell Okto your *intent* – what you want to achieve. Okto handles the rest, making blockchain actions feel simple.
+
+## What are Intents on Okto?
+
+Intents are like simple instructions for Web3. You say what you want, not *how* to do it. The Okto Platform figures out the best way to make it happen. The Okto Platform takes care of:
+
+- **Breaking Down Complex Tasks:** Intents become easy steps for the system.
+- **Smart Fee Handling:** Okto makes sure you pay the right amount for fees.
+- **Automatic Steps:** The system does all the work in the background.
+- **Cross-Chain Made Easy:** Moving things between blockchains is automatic.
+
+
+Cross-chain liquidity intents are coming soon! These will enable seamless token swaps across different blockchain networks. To learn more about upcoming cross-chain capabilities, check out [Cross-Chain Intents →](/docs/system-capabilities/cross-chain-intents)
+
+
+## Key Benefits:
+
+### 1. User-Friendly:
+
+- **Simple Instructions:** Tell Okto what you want in plain terms.
+- **No Tech Knowledge Needed:** Skip the blockchain details.
+- **Fewer Errors:** Automation reduces mistakes.
+
+### 2. Smart & Fast:
+
+- **Smart Fees:** Automatic, cost-effective fees.
+- **Best Routes:** Okto finds the fastest and cheapest way to do things.
+- **Quick Actions:** Complex tasks get done faster.
+
+### 3. Secure & Reliable:
+
+- **Safe Steps:** Transactions happen in a secure order.
+- **Protection Built-In:** Okto helps avoid common Web3 problems.
+- **Dependable Transfers:** Your cross-chain actions are handled reliably.
+
+## Core Intent Types:
+
+Okto SDK V2 provides these Intent types:
+
+### 1. Token Transfer Intent:
+
+Easily transfer tokens. Okto handles fees and routing.
+
+[Learn more →](/docs/react-sdk/tokenTransfer)
+
+### 2. NFT Transfer Intent:
+
+Transfer NFTs with ease and security.
+
+[Learn more →](/docs/react-sdk/nftTransfer)
+
+### 3. Raw Transaction Intent:
+
+For advanced users: direct contract calls and complex operations.
+
+[Learn more →](/docs/react-sdk/rawTransaction)
\ No newline at end of file
diff --git a/content/docs/react-sdk/(Intents)/meta.json b/content/docs/react-sdk/(Intents)/meta.json
index b714463..47a59ec 100644
--- a/content/docs/react-sdk/(Intents)/meta.json
+++ b/content/docs/react-sdk/(Intents)/meta.json
@@ -1,6 +1,6 @@
{
"title": "Intents",
"pages": [
- "tokenTransfer", "nftTransfer", "createNFTCollection", "rawTransaction"
+ "intents", "tokenTransfer", "nftTransfer", "createNFTCollection", "rawTransaction"
]
}
\ No newline at end of file
diff --git a/content/docs/react-sdk/authenticate-users/okto-auth.mdx b/content/docs/react-sdk/authenticate-users/okto-auth.mdx
index a9dcec9..a9e3a18 100644
--- a/content/docs/react-sdk/authenticate-users/okto-auth.mdx
+++ b/content/docs/react-sdk/authenticate-users/okto-auth.mdx
@@ -55,4 +55,13 @@ For debugging or understanding the token's contents, you can manually verify the
### Managing Expired Auth Tokens
-When an Okto Token expires, subsequent API requests using that token will fail. Okto SDK provides mechanisms to help you handle token expiration
\ No newline at end of file
+When an Okto Token expires, subsequent API requests using that token will fail. Okto SDK provides mechanisms to help you handle token expiration.
+
+---
+
+## Next Steps
+
+Learn more about authentication methods and session management:
+
+- [Google OAuth Authentication](./google-oauth/learn) - Implement secure authentication using Google OAuth
+- [Login & Session Management](./login-logout/loginUsingOAuth) - Handle user login and session states
diff --git a/content/docs/react-sdk/index.mdx b/content/docs/react-sdk/index.mdx
index f84e1b2..170a6ee 100644
--- a/content/docs/react-sdk/index.mdx
+++ b/content/docs/react-sdk/index.mdx
@@ -4,9 +4,19 @@ description: A complete guide to integrating Okto into your React applications.
full: false
---
-
import TechnologyCard from 'app/components/mdx/TechnologyCard';
-import { IoCodeSlashOutline } from "react-icons/io5";
+import {
+ IoCodeSlashOutline,
+ IoKeyOutline,
+ IoWalletOutline,
+ IoBookOutline,
+ IoConstructOutline,
+ IoGitBranchOutline,
+ IoHelpCircleOutline,
+ IoSwapHorizontalOutline
+} from "react-icons/io5";
+import { FaReact, FaBook, FaTools, FaExchangeAlt } from "react-icons/fa6";
+import { VscDebugConsole } from "react-icons/vsc";
## Introduction to Okto React SDK
@@ -14,12 +24,14 @@ import { IoCodeSlashOutline } from "react-icons/io5";
}
+ className="h-25"
+ icon={}
title="GitHub Repository"
subtitle="View SDK Source Code"
link="https://github.com/okto-hq/okto-js-sdk-monorepo"
/>
}
title="Template Repository"
subtitle="Example Implementation"
@@ -35,52 +47,60 @@ Kickstart your project by following our [Quickstart Guide](/docs/react-sdk/quick
---
-## Navigating the React SDK Docs
-
-Our documentation is organized into several sections to help you at every stage of your development journey—from initial setup to advanced features. Here’s an updated overview of the main sections:
-
-### 1. Getting Started
-- [Quickstart Guide](/docs/react-sdk/quickstart/new-okto-react-setup): Learn how to create a new React app and integrate the Okto SDK in minutes.
-- [Prerequisites](/docs/react-sdk/quickstart/prerequisites): A checklist of required dependencies, API keys, and initial setup steps.
-
-### 2. Authentication
-Implement secure user login and session management:
-- [Okto Auth](/docs/react-sdk/authenticate-users/okto-auth): Learn about authorization in Okto and Okto Auth Token
-- [Google OAuth](/docs/react-sdk/authenticate-users/google-oauth/learn): Setup and authenticate users via Google.
-- [Session Management](/docs/react-sdk/authenticate-users/login-logout/loginUsingOAuth): Manage user sessions and tokens.
-
-### 3. Wallets
-Manage wallet functionality and customization:
-- [Wallet Overview](/docs/react-sdk/wallets/overview): An introduction to wallet features within the SDK.
-- [Embedded Wallets](/docs/react-sdk/wallets/(embedded-wallets)): Configure self-custodial wallets integrated into your app.
-- [External Wallets](/docs/react-sdk/wallets/external-wallets) (Coming Soon): Integrate and manage third-party wallet solutions.
-
-### 4. Usage & Features
-Explore the core capabilities of the SDK:
-- [Usage Overview](/docs/react-sdk/usage-overview): A complete guide to using the Okto React SDK.
-- [Hooks](/docs/react-sdk/(hooks)/useOkto): Leverage React hooks to tap into Okto functionality.
-- [Account Operations](/docs/react-sdk/(Account)/estimate): Sign and execute user operations for on-chain actions.
-- [Explorer Functions](/docs/react-sdk/(Explorer)/getAccount): Retrieve account details, supported chains, tokens, and portfolio data.
-- [Intent Operations](/docs/react-sdk/(Intents)/…): Create and manage blockchain transactions such as token or NFT transfers.
-
-### 5. Resources
-Access additional reference materials and support:
-- [Technical Reference](/docs/react-sdk/technical-reference): In-depth documentation of classes, methods, and data models.
-- [SDK Error Warnings](/docs/react-sdk/sdk-error-warnings): A list of common error messages and troubleshooting tips.
-- [Troubleshooting](/docs/react-sdk/troubleshooting): Guidance on resolving common issues.
-- [Feature Support](/docs/react-sdk/feature-support): Information on supported chains, tokens, and additional functionalities.
-- [Template Apps](/docs/react-sdk/templateRepo): Sample projects showcasing best practices with the SDK.
-
-### 6. Migration
-- [V2 Migration Guide](/docs/react-sdk/v2migration) (Coming Soon): Instructions and tips for upgrading from previous versions of the SDK.
+## Explore the React SDK
+
+
+ }
+ title="Authentication"
+ subtitle="Implement secure user login and session management"
+ link="/docs/react-sdk/authenticate-users/okto-auth"
+ />
+ }
+ title="Wallet Management"
+ subtitle="Configure and manage embedded and external wallets"
+ link="/docs/react-sdk/wallets/overview"
+ />
+ }
+ title="Usage & Features"
+ subtitle="Explore hooks, explorer functions, and intent operations"
+ link="/docs/react-sdk/usage-overview"
+ />
+ }
+ title="Technical Reference"
+ subtitle="In-depth documentation of classes, methods, and data models"
+ link="/docs/react-sdk/technical-reference"
+ />
+ }
+ title="Troubleshooting"
+ subtitle="Common issues and their solutions"
+ link="/docs/react-sdk/troubleshooting"
+ />
+ }
+ title="Migration Guide"
+ subtitle="Upgrade from previous versions of the SDK"
+ link="/docs/react-sdk/v2migration"
+ />
+
---
## Get Started
-Ready to dive in? We recommend you begin with our **[Getting Started guide](./react-sdk/quickstart/new-okto-react-setup)** to set up your environment, get your Okto API key, and spin up a simple React app. Once you’re comfortable with the basics, feel free to explore more advanced features or check out our example apps.
+Ready to dive in? We recommend you begin with our **[Getting Started guide](./react-sdk/quickstart/new-okto-react-setup)** to set up your environment, get your Okto API key, and spin up a simple React app. Once you're comfortable with the basics, feel free to explore more advanced features or check out our example apps.
-If you have any questions or need assistance, don’t hesitate to reach out via our **[Troubleshooting](./react-sdk/troubleshooting)** page or email us at `devrel@coindcx.com`.
+If you have any questions or need assistance, don't hesitate to reach out via our **[Troubleshooting](./react-sdk/troubleshooting)** page or email us at `devrel@coindcx.com`.
**Happy Building!**
diff --git a/content/docs/react-sdk/meta.json b/content/docs/react-sdk/meta.json
index 35803f1..190031f 100644
--- a/content/docs/react-sdk/meta.json
+++ b/content/docs/react-sdk/meta.json
@@ -1,12 +1,14 @@
{
"title": "React",
"pages": [
- "[About Okto](/)",
+ "[← Back to Home](/)",
"index",
- "quickstart",
- "templateRepo",
"feature-support",
- "v2migration",
+ "---Quickstart---",
+ "./quickstart/prerequisites",
+ "./quickstart/new-okto-react-setup",
+ "./quickstart/new-okto-nextjs-setup",
+ "templateRepo",
"---Authentication---",
"./authenticate-users/okto-auth",
"./authenticate-users/google-oauth",
diff --git a/content/docs/react-sdk/quickstart/new-okto-nextjs-setup.mdx b/content/docs/react-sdk/quickstart/new-okto-nextjs-setup.mdx
index 0b96089..9c9e94a 100644
--- a/content/docs/react-sdk/quickstart/new-okto-nextjs-setup.mdx
+++ b/content/docs/react-sdk/quickstart/new-okto-nextjs-setup.mdx
@@ -6,29 +6,52 @@ full: false
import { Step, Steps } from "fumadocs-ui/components/steps";
import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+import CollapsibleCallout from 'app/components/mdx/CollapsibleCallout';
+import ExternalLink from 'app/components/mdx/ExternalLink';
-Want an even faster setup? Clone our [Template Repo](/docs/react-sdk/example-apps/template-repo) and follow the steps provided to get your dApp running in minutes!
+Want an even faster setup? Check out our Template Repo to get your dApp running in minutes!
+
+Before you begin, make sure you have:
+- Created your Okto Dashboard account.
+- Retrieved your API keys from the dashboard (`NEXT_PUBLIC_CLIENT_PRIVATE_KEY` and `NEXT_PUBLIC_CLIENT_SWA`).
+- Enabled the chains and tokens your application will use.
+
+If you need help, see our Dashboard Setup Guide for detailed instructions.
+
+
-## Prerequisites
-Before you begin, ensure you have:
+ ## Prerequisites
-- **Node.js (v18+) and npm/pnpm/yarn:** [Download Node.js](https://nodejs.org/)
-- **Okto API Keys:** You'll need your Okto API keys to connect your app to the Okto platform. Obtain your `NEXT_PUBLIC_VENDOR_PRIVATE_KEY` and `NEXT_PUBLIC_VENDOR_SWA` from the Okto Dashboard.
-- **Google OAuth Credentials:** Set up your OAuth 2.0 credentials in [Google Cloud Console](https://console.cloud.google.com/) to get your `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET`.
- - Need help? Follow our [Google Console Setup Guide](/docs/react-sdk/authenticate-users/google-oauth/google-console-setup)
-- **Auth Secret:** NextAuth needs a secret key to keep your app secure. You can easily generate one by running this command in your terminal: `openssl rand -base64 32`.
+ Before getting started, ensure you have the following:
+ - **Node.js (v18+) and npm/pnpm/yarn:** Download Node.js
+ - **Okto API Keys:** You need your `NEXT_PUBLIC_CLIENT_PRIVATE_KEY` and `NEXT_PUBLIC_CLIENT_SWA`. Obtain these from the Okto Dashboard.
+ - **Google OAuth Credentials:** Create OAuth 2.0 credentials in the Google Cloud Console to get your `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET`.
+ - **Auth Secret:** NextAuth requires a secret for signing tokens. Generate one by running:
+
+ ```bash:title="bash"
+ openssl rand -base64 32
+ ```
+
+
+ 1. Go to Google Cloud Console.
+ 2. Create OAuth 2.0 credentials for your project.
+ 3. Set the redirect URI to: `[YOUR_APP_URL]/api/auth/callback/google` (for example, `http://localhost:3000/api/auth/callback/google` during local development).
+ 4. Save your Client ID and Client Secret.
+
+ Need detailed instructions? Check our Google Console Setup Guide.
+
- ## Create Your NextJS App
+ ## 1. Create Your NextJS App
- If you already have a React app, you can skip this step and proceed directly to Step 3 to start integrating Okto.
+ If you already have a NextJS app, you can skip this step and proceed directly to the next step to start integrating Okto.
Let's start by creating a brand new Next.js app! Open your terminal and run these commands:
@@ -36,19 +59,31 @@ Before you begin, ensure you have:
npx create-next-app@latest my-okto-app
cd my-okto-app
```
- This will:
- - `npx create-next-app@latest my-okto-app`: Create a new Next.js project named `my-okto-app` in a folder of the same name.
- - `cd my-okto-app`: This command moves you *inside* the `my-okto-app` folder you just created, so all subsequent commands apply to your new project.
+
+
+ When prompted during setup, select:
+ - **TypeScript:** Yes
+ - **ESLint:** Yes
+ - **Tailwind CSS:** Yes
+ - **Use `src/` directory:** Yes
+ - **App Router:** Yes
+ - **Customize default import alias:** No
+
+
+
+ - Creates a new Next.js project named `my-okto-app`.
+ - Switches you into the project directory.
+
- ## Install Dependencies
+ ## 2. Install Dependencies
Please use version 0.0.0-dev.42 of the npm package.
- Your Next.js app needs the Okto SDK and NextAuth to work. Let's install them! Run the command below that matches your package manager (`npm`, `pnpm`, or `yarn`):
+ Your Next.js app needs the Okto SDK and NextAuth to work. Let's install them! Run the command below for the package manager of your choice:
@@ -71,84 +106,35 @@ Before you begin, ensure you have:
- ## Set up Environment Variables
+ ## 3. Set up Environment Variables
- Create `.env` in your project root:
+ Create a `.env` file in your project root and add the following environment variables:
```bash title=".env"
- NEXT_PUBLIC_VENDOR_PRIVATE_KEY = YOUR_OKTO_VENDOR_PRIVATE_KEY
- NEXT_PUBLIC_VENDOR_SWA = YOUR_OKTO_VENDOR_SWA
+ NEXT_PUBLIC_CLIENT_PRIVATE_KEY = YOUR_OKTO_CLIENT_PRIVATE_KEY
+ NEXT_PUBLIC_CLIENT_SWA = YOUR_OKTO_CLIENT_SWA
NEXT_PUBLIC_ENVIRONMENT = sandbox # or production
- AUTH_SECRET = YOUR_AUTH_SECRET # Use: openssl rand -base64 32
+ AUTH_SECRET = YOUR_AUTH_SECRET # Generate using: openssl rand -base64 32
- # Google OAuth credentials (Required only if you want to enable Google Sign-In)
+ # Google OAuth credentials (Required only if using Google Sign-In)
GOOGLE_CLIENT_SECRET = YOUR_GOOGLE_CLIENT_SECRET
GOOGLE_CLIENT_ID = YOUR_GOOGLE_CLIENT_ID
```
-
- - **Replace Placeholders!** Don't forget to replace `YOUR_GOOGLE_CLIENT_SECRET`, `YOUR_GOOGLE_CLIENT_ID`, `YOUR_AUTH_SECRET`, `YOUR_OKTO_VENDOR_PRIVATE_KEY`, and `YOUR_OKTO_VENDOR_SWA` with *your actual keys and secrets*.
- - **`AUTH_SECRET` Generation:** If you haven't already, run `openssl rand -base64 32` in your terminal to generate a secure `AUTH_SECRET` and paste it into `.env`.
- - For `NEXT_PUBLIC_ENVIRONMENT`, use `sandbox` for testing and development, and `production` for live environments.
-
-
-
- Never commit your `.env` file to version control. Add it to your `.gitignore`!
-
-
-
-
- ## Set Up Root Layout (`layout.tsx`)
-
- The `layout.tsx` file is the main structure of your app. Let's modify it to include the `AppProvider`, which sets up the Okto SDK and session management for your whole application.
- 1. **Open `layout.tsx`:** Go to the `app` directory in your project and open the `layout.tsx` file.
- 2. **Replace content:** Replace the existing code in `layout.tsx` with the code below:
-
- ```tsx title="layout.tsx"
- import type { Metadata } from "next";
- import { Inter } from "next/font/google";
- import "./globals.css";
- import AppProvider from "./components/providers";
- import { getServerSession } from "next-auth";
- import { authOptions } from "./api/auth/[...nextauth]/route";
-
- const inter = Inter({ subsets: ["latin"] });
-
- export const metadata: Metadata = {
- title: "Okto React SDK with Google Auth",
- description: "Next.js app integrated with Okto SDK and Google Authentication",
- };
-
- export default async function RootLayout({
- children,
- }: Readonly<{
- children: React.ReactNode;
- }>) {
- const session = await getServerSession(authOptions);
- return (
-
-
- {children}
-
-
- );
- }
- ```
- This layout sets up the basic structure of your app and wraps it with `AppProvider` for session and Okto context.
+
+ - Replace all placeholder values (`YOUR_...`) with your actual keys.
+ - Never commit your `.env` file to version control. Add it to your `.gitignore`.
+
- ## Create Providers Component (`providers.tsx`)
+ ## 4. Set Up the Okto Provider
- Now, let's create the `providers.tsx` component we imported in `layout.tsx`. This component will actually initialize the Okto SDK.
+ Create a provider component to initialize the Okto SDK and authentication context. Create a file at `app/components/providers.tsx` with the following code:
- 1. **Create `components` folder:** If you don't already have a folder named `components` inside your `app` directory, create one now.
- 2. **Create `providers.tsx`:** Inside the `components` folder, create a new file named `providers.tsx`.
- 3. **Add code:** Paste the following code into `providers.tsx`:
-
- ```tsx title="components/providers.tsx"
+ ```tsx title="app/components/providers.tsx"
"use client";
import { SessionProvider } from "next-auth/react";
import { OktoProvider } from "@okto_web3/react-sdk";
@@ -156,8 +142,8 @@ Before you begin, ensure you have:
const config = { // Configuration for Okto SDK
environment: process.env.NEXT_PUBLIC_ENVIRONMENT || 'sandbox', // Environment from .env
- vendorPrivKey: process.env.NEXT_PUBLIC_VENDOR_PRIVATE_KEY || '', // Vendor Private Key from .env
- vendorSWA: process.env.NEXT_PUBLIC_VENDOR_SWA || '', // Vendor SWA from .env
+ clientPrivKey: process.env.NEXT_PUBLIC_CLIENT_PRIVATE_KEY || '', // Client Private Key from .env
+ clientSWA: process.env.NEXT_PUBLIC_CLIENT_SWA || '', // Client SWA from .env
};
function AppProvider({ children, session }) {
@@ -173,19 +159,30 @@ Before you begin, ensure you have:
export default AppProvider;
```
+
+ The `AppProvider` wraps your app with:
+ - `SessionProvider` for authentication.
+ - `OktoProvider` to initialize the Okto SDK using your environment settings.
+
+ Remember that the `"use client"` directive is required for client-side components.
+
+
- ## Configure Google Login with NextAuth
+
+ ## 5. Configure Google Authentication
- To enable Google Login, you need to configure NextAuth. You'll create a `route.ts` file in a specific directory structure within your `app` folder.
+ Set up NextAuth using Google as the provider. Create the file at `app/api/auth/[...nextauth]/route.ts`:
- 1. **Create `api/auth/[...nextauth]` folders:** Inside your `app` directory, create these folders in order:
- - First, create a folder named `api`.
- - Inside `api`, create a folder named `auth`.
- - Inside `auth`, create a folder named `[...nextauth]` *(that's square brackets, then three dots, then `nextauth`, then closing square brackets)*. This special folder name in Next.js is for dynamic routes.
- 2. **Create `route.ts`:** Inside the `[...nextauth]` folder, create a new file named `route.ts`.
- 3. **Add code:** Paste the following code into `route.ts`:
+
+ Create these folders in your app directory:
+ app/
+ └── api/
+ └── auth/
+ └── [...nextauth]/
+ └── route.ts
+
```tsx title="app/api/auth/[...nextauth]/route.ts"
import NextAuth from "next-auth";
@@ -196,8 +193,8 @@ Before you begin, ensure you have:
secret: process.env.AUTH_SECRET,
providers: [
GoogleProvider({ // Configure Google Provider
- clientId: process.env.GOOGLE_CLIENT_ID!, // Your GOOGLE_CLIENT_ID from .env
- clientSecret: process.env.GOOGLE_CLIENT_SECRET!, // Your GOOGLE_CLIENT_SECRET from .env
+ clientId: process.env.GOOGLE_CLIENT_ID!, // From .env
+ clientSecret: process.env.GOOGLE_CLIENT_SECRET!, // From .env
}),
],
session: {
@@ -222,18 +219,64 @@ Before you begin, ensure you have:
export { handler as GET, handler as POST };
```
- This configuration sets up NextAuth with Google Provider and ensures the `id_token` is passed in the session, which is needed by Okto SDK for authentication.
+
+ This configuration:
+ - Sets up NextAuth to use Google for authentication.
+ - Utilizes JWT for session management.
+ - Seeds the session with Google's `id_token`, which is later used by the Okto SDK.
+
- ## Create a Sample Login Page (`page.tsx`)
+ ## 6. Set up Root Layout
+
+ Update your root layout to include the `AppProvider` so that the authentication and Okto context are available throughout your app. Modify `app/layout.tsx` as follows:
+
+ ```tsx title="app/layout.tsx"
+ import type { Metadata } from "next";
+ import { Inter } from "next/font/google";
+ import "./globals.css";
+ import AppProvider from "./components/providers";
+ import { getServerSession } from "next-auth";
+ import { authOptions } from "./api/auth/[...nextauth]/route";
+
+ const inter = Inter({ subsets: ["latin"] });
+
+ export const metadata: Metadata = {
+ title: "Okto React SDK with Google Auth",
+ description: "Next.js app integrated with Okto SDK and Google Authentication",
+ };
+
+ export default async function RootLayout({
+ children,
+ }: Readonly<{
+ children: React.ReactNode;
+ }>) {
+ const session = await getServerSession(authOptions);
+ return (
+
+
+ {children}
+
+
+ );
+ }
+ ```
+
+ Using `AppProvider` ensures that every page in your application has access to both the session and Okto context.
+
+
+
- Now, let's create a simple page where users can log in and you can test the Okto SDK! We'll create a `LoginButton` component and a `GetButton` component to interact with Okto.
+
+ ## 7. Create a Sample Login Page (`page.tsx`)
- ### 1. **Create `LoginButton.tsx` in `components` folder:**
- Inside your `app/components` folder, create a new file named `LoginButton.tsx` and paste this code:
+ Let's build a simple page to test out authentication and basic Okto operations. You will create two components—`LoginButton` and `GetButton`—and update your home page.
+ ### a. Create the Login Button Component
+
+ This component will trigger Google authentication. Create the file `app/components/LoginButton.tsx`:
```tsx title="components/LoginButton.tsx"
"use client";
@@ -260,9 +303,15 @@ Before you begin, ensure you have:
);
}
```
+
+ Using the `signIn` method from NextAuth, this button starts the Google authentication flow. No extra configuration is required on the client side.
+
- ### 2. **Create `GetButton.tsx` in `components` folder:**
- In the same `app/components` folder, create `GetButton.tsx` and paste this code:
+ ### b. Create the Get Button Component
+
+ This component is designed to call a function (such as logging out or fetching account details) and display the result in a modal.
+
+ Create the file `app/components/GetButton.tsx`:
```tsx title="components/GetButton.tsx"
"use client";
@@ -339,9 +388,14 @@ Before you begin, ensure you have:
export default GetButton;
```
+
+ This component accepts a SDK function as a prop. When clicked, it calls the function with the Okto client, displays the JSON response in a modal, and handles any errors.
+
- ### **Update `page.tsx` in `app` directory:**
- Open `app/page.tsx` and replace its content with this code:
+ ### c. Update the App Home Page
+ Integrate both buttons on your home page.
+
+ Replace the content of `app/page.tsx` with:
```tsx title="app/page.tsx"
"use client";
@@ -350,6 +404,7 @@ Before you begin, ensure you have:
import { LoginButton } from "@/app/components/LoginButton";
import GetButton from "@/app/components/GetButton";
import {getAccount, useOkto } from '@okto_web3/react-sdk';
+ import { TokenTransfer } from "@/app/components/TokenTransfer";
export default function Home() {
@@ -394,35 +449,27 @@ Before you begin, ensure you have:
+
+
+
);
}
```
- Your project structure should look like this:
- ```
- my-okto-app/
- ├── app/
- │ ├── api/
- │ │ └── auth/
- │ │ └── [...nextauth]/
- │ │ └── route.ts
- │ ├── components/
- │ │ ├── providers.tsx
- │ │ ├── LoginButton.tsx
- │ │ └── GetButton.tsx
- │ ├── layout.tsx
- │ └── page.tsx
- ├── .env
- └── package.json
- ```
+
+ After launching the app, use these buttons to:
+ - Initiate Google authentication.
+ - Trigger a logout.
+ - Retrieve your account(list of wallets)details.
+
-## 5. Run Your Dapp
+## 8. Run Your dApp
-Time to run your app and see it in action! In your terminal, inside the `my-okto-app` directory, run the command that matches your package manager:
+It's time to see your work in action. Inside the `my-okto-app` directory, run the appropriate command based on your package manager:
@@ -441,34 +488,24 @@ Time to run your app and see it in action! In your terminal, inside the `my-okto
```
-This command starts the Next.js development server.
-Now, open your web browser and go to [http://localhost:3000](http://localhost:3000).
+Open your browser and navigate to [http://localhost:3000](http://localhost:3000). You should see your "Template App" with buttons to:
+- Authenticate using Google.
+- Log out.
+- Retrieve your account details with the `getAccount` function.
-You should see your "Template App" with an "Authenticate with Google" button and "Okto Log out" and "getAccount" buttons!
-
-- **Click "Authenticate with Google"**: You should be prompted to log in with your Google account.
-- **After logging in**: You might not see any immediate changes on the page in this very basic example, but in the background, your app has authenticated with Okto using your Google login!
-- **Click "getAccount"**: This button will call the `getAccount` function from the Okto SDK and display the result in a pop-up modal.
-- **Click "Okto Log out"**: This will log you out of your app.
-
-
+
If you encounter any errors when running `npm run dev` (or `pnpm dev`, `yarn dev`), check your terminal for error messages. Common issues include:
- **Environment Variable Errors**: Double-check that you correctly set up your `.env` file and that all the `YOUR_...` placeholders are replaced with your actual keys and secrets.
- **Package Installation Errors**: If you see errors related to missing packages, try re-running the install command (e.g., `npm install`) to make sure all dependencies are installed correctly.
-
-
-
-
- ## Congratulations!
-
-🎉 Your basic Okto integration is now complete! You're ready to bring your dApp to life. Let's try out a simple user operation!
+
+
## Trying Out a User Operation
Now that we have our basic setup complete, let's implement a token transfer on Solana devnet to understand how user operations work in Okto.
@@ -476,9 +513,9 @@ Now that we have our basic setup complete, let's implement a token transfer on S
- ## Get Your Wallet Address
+ ### 1. Get Your Wallet Address
- First, get your Solana wallet address:
+ Retrieve your Solana wallet address using:
```tsx
import { getAccounts } from "@okto_web3/react-sdk";
@@ -490,21 +527,21 @@ Now that we have our basic setup complete, let's implement a token transfer on S
- ## Fund Your Wallet
+ ### 2. Fund Your Wallet
- To perform a token transfer, you'll need some funds in your wallet. Add funds to this address using the [Solana Devnet Faucet](https://faucet.solana.com).
+ Before transferring tokens, fund your wallet using the Solana Devnet Faucet.
- ## Check Network Information
+ ### 3. Review Network Information
- Before creating the user operation, check the [Network Information Guide](/docs/react-sdk/technical-reference#network-information) for getting the correct CAIP-2 IDs of chains.
+ Consult the Network Information Guide to ensure you have the correct CAIP-2 chain identifiers.
- ## Implement Token Transfer
+ ### 4. Implement Token Transfer
- Create a new component for handling the transfer:
+ Create a new component called `TokenTransfer.tsx` to handle a token transfer:
```tsx title="app/components/TokenTransfer.tsx"
"use client";
@@ -514,6 +551,7 @@ Now that we have our basic setup complete, let's implement a token transfer on S
export function TokenTransfer() {
const oktoClient = useOkto();
const [status, setStatus] = useState("");
+ const [modalVisible, setModalVisible] = useState(false);
async function handleTransfer() {
try {
@@ -533,6 +571,7 @@ Now that we have our basic setup complete, let's implement a token transfer on S
const txHash = await oktoClient.executeUserOp(signedOp);
setStatus(`Transfer complete! Hash: ${txHash}`);
+ setModalVisible(true);
} catch (error) {
console.error("Transfer failed:", error);
setStatus(`Transfer failed: ${error.message}`);
@@ -540,26 +579,169 @@ Now that we have our basic setup complete, let's implement a token transfer on S
}
return (
-