Skip to content

chore: added onramp and swaps docs #434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion appkit/react-native/core/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ Allows you to toggle (enable or disable) additional features provided by AppKit.

### swaps

Enable or disable the swap feature in your AppKit. [Swaps](/appkit/react/transactions/swaps) feature is enabled by default.
Enable or disable the swap feature in your AppKit. [Swaps](/appkit/react-native/transactions/swaps) feature is enabled by default.

```ts
createAppKit({
Expand All @@ -182,6 +182,19 @@ createAppKit({
});
```

### onramp

Enable or disable the On-Ramp feature in your AppKit. [On-Ramp](/appkit/react-native/transactions/onramp) feature is enabled by default.

```ts
createAppKit({
//...
features: {
onramp: true,
},
});
```

### email

This boolean defines whether you want to enable email login. This feature is enabled by default.
Expand Down
63 changes: 63 additions & 0 deletions appkit/react-native/transactions/onramp.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: On-Ramp
---

Enable users to purchase crypto with fiat directly within your React Native app using AppKit's On-Ramp feature. This integration allows users to securely access over 100 cryptocurrencies and purchase tokens to support in-app activity and transactions across multiple chains.

## Configuration

The On-Ramp feature is enabled by default in AppKit. Here's how to configure it in your app:

```typescript
import { createAppKit } from '@reown/appkit...'; // Ensure this import path is correct for your project

createAppKit({
projectId: 'YOUR_PROJECT_ID',
// ... other config options
features: {
onramp: true, // Optional - true by default
}
});
```

If you want to disable the On-Ramp feature, you can set `onramp: false` in the features configuration.

## Usage

### Opening the On-Ramp View

You can programmatically open the On-Ramp view using the `useAppKit` hook:

```typescript
import { useAppKit } from '@reown/appkit-...'; // Ensure this import path is correct for your project

function OnRampButton() {
const { open } = useAppKit();

const handleOnRampPress = () => {
open({ view: 'OnRamp' });
};

return (
<Button
title="Buy Crypto"
onPress={handleOnRampPress}
/>
);
}
```

### User Flow

1. When users tap the "Buy Crypto" button or select it from the account view, they'll be presented with the On-Ramp interface.

2. In the On-Ramp interface, users can:
- Select the fiat currency they want to use
- Select the cryptocurrency they want to purchase
- Enter the amount they want to purchase
- Choose a payment method (e.g., credit card, bank transfer)
- Review the transaction details including fees and exchange rates

3. After reviewing the transaction details, users can confirm the purchase.

4. Once confirmed, the transaction will be processed, and the cryptocurrency will be added to their wallet.
66 changes: 66 additions & 0 deletions appkit/react-native/transactions/swaps.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: Swaps
---

Enable users to swap cryptocurrencies directly within your React Native app using AppKit's Swaps feature. This integration allows users to securely trade between a wide variety of tokens across multiple chains.

## Configuration

The Swaps feature is enabled by default in AppKit. Here's how to configure it in your app:

```typescript
import { createAppKit } from '@reown/appkit...'; // Ensure this import path is correct for your project

createAppKit({
projectId: 'YOUR_PROJECT_ID',
// ... other config options
features: {
swaps: true, // Optional - true by default
}
});
```

If you want to disable the Swaps feature, you can set `swaps: false` in the features configuration.

## Usage

### Opening the Swaps View

You can programmatically open the Swaps view using the `useAppKit` hook:

```typescript
import { useAppKit } from '@reown/appkit-...'; // Ensure this import path is correct for your project

function SwapButton() {
const { open } = useAppKit();

const handleSwapPress = () => {
open({ view: 'Swap' });
};

return (
<Button
title="Swap Tokens"
onPress={handleSwapPress}
/>
);
}
```

### User Flow

1. When users tap the "Swap Tokens" button or select it from the account view, they'll be presented with the Swaps interface.

2. In the Swaps interface, users can:
- Select the token they want to swap from
- Select the token they want to swap to
- Enter the amount they want to swap
- Review the transaction details including:
- Price impact
- Network cost
- Slippage tolerance
- Provider fee

3. After reviewing the transaction details, users can confirm the swap.

4. Once confirmed, the transaction will be processed and the tokens will be swapped in their wallet.
7 changes: 7 additions & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,13 @@
"appkit/react-native/core/resources"
]
},
{
"group": "Transactions",
"pages": [
"appkit/react-native/transactions/swaps",
"appkit/react-native/transactions/onramp"
]
},
{
"group": "Notifications",
"pages": [
Expand Down