Skip to content

Commit

Permalink
Merge pull request #1650 from WalletConnect/feat/add-enableSwaps-flag
Browse files Browse the repository at this point in the history
refactor: add enableSwaps flag
  • Loading branch information
enesozturk authored Jul 24, 2024
2 parents 2cd2428 + cd4c972 commit 0a44aa5
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 21 deletions.
3 changes: 1 addition & 2 deletions docs/appkit/javascript/ethers/about/implementation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ const modal = createWeb3Modal({
ethersConfig,
chains: [mainnet],
projectId,
enableAnalytics: true, // Optional - defaults to your Cloud configuration
enableOnramp: true // Optional - false as default
enableAnalytics: true // Optional - defaults to your Cloud configuration
})
```

Expand Down
3 changes: 1 addition & 2 deletions docs/appkit/javascript/ethers5/implementation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ const modal = createWeb3Modal({
ethersConfig,
chains: [mainnet],
projectId,
enableAnalytics: true, // Optional - defaults to your Cloud configuration
enableOnramp: true // Optional - false as default
enableAnalytics: true // Optional - defaults to your Cloud configuration
})
```

Expand Down
3 changes: 1 addition & 2 deletions docs/appkit/next/ethers/about/implementation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ createWeb3Modal({
ethersConfig,
chains: [mainnet],
projectId,
enableAnalytics: true, // Optional - defaults to your Cloud configuration
enableOnramp: true // Optional - false as default
enableAnalytics: true // Optional - defaults to your Cloud configuration
})

export function Web3Modal({ children }) {
Expand Down
3 changes: 1 addition & 2 deletions docs/appkit/next/ethers5/implementation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ createWeb3Modal({
ethersConfig,
chains: [mainnet],
projectId,
enableAnalytics: true, // Optional - defaults to your Cloud configuration
enableOnramp: true // Optional - false as default
enableAnalytics: true // Optional - defaults to your Cloud configuration
})

export function Web3Modal({ children }) {
Expand Down
3 changes: 1 addition & 2 deletions docs/appkit/next/wagmi/about/implementation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ if (!projectId) throw new Error('Project ID is not defined')
createWeb3Modal({
wagmiConfig: config,
projectId,
enableAnalytics: true, // Optional - defaults to your Cloud configuration
enableOnramp: true // Optional - false as default
enableAnalytics: true // Optional - defaults to your Cloud configuration
})

export default function Web3ModalProvider({
Expand Down
3 changes: 1 addition & 2 deletions docs/appkit/react/wagmi/about/implementation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ const config = defaultWagmiConfig({
createWeb3Modal({
wagmiConfig: config,
projectId,
enableAnalytics: true, // Optional - defaults to your Cloud configuration
enableOnramp: true // Optional - false as default
enableAnalytics: true // Optional - defaults to your Cloud configuration
})

export function Web3ModalProvider({ children }) {
Expand Down
6 changes: 4 additions & 2 deletions docs/appkit/shared/onramp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ On-Ramp is supported in the latest version of Web3Modal. If you are using an old

## Integration

In order to enable On-Ramp on Web3Modal add the `enableOnramp` flag set to `true` in the `createWeb3Modal` function configuration.
The On-Ramp feature is enabled by default, so no additional configuration is required.

If you prefer to disable it, set the `enableOnramp` flag to `false` in the configuration of the `createWeb3Modal` function.

```ts
const modal = createWeb3Modal({
//...
chains: [mainnet],
projectId,
/* highlight-add-start */
enableOnramp: true // Optional - false as default
enableOnramp: false // Optional - true by default
/* highlight-add-end */
})
```
22 changes: 22 additions & 0 deletions docs/appkit/shared/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,28 @@ createWeb3Modal({
})
```

## enableSwaps

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

```ts
createWeb3Modal({
//...
enableSwaps: false
})
```

## enableOnramp

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

```ts
createWeb3Modal({
//...
enableOnramp: false
})
```

<Button name="Learn More" url="/cloud/analytics" />

## customWallets
Expand Down
19 changes: 18 additions & 1 deletion docs/appkit/shared/swaps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,21 @@ Swaps is currently in Beta. Users may experience changes or improvements in the
3. **Select Tokens**: Choose the tokens you wish to swap from the available options.
4. **Type amount**: Enter your desired swap values. You can use the Max button to swap your all tokens or enter any specific number.
5. **See swap details**: Once you type amount value. You'll see the available quote details as received amount, network fee, maximum slippage, or price impact.
6. **Confirm Swap**: Review the swap details, including the transaction fee, and confirm the swap.
6. **Confirm Swap**: Review the swap details, including the transaction fee, and confirm the swap.

## Integration

The Swaps feature is enabled by default, so no additional configuration is required.

If you prefer to disable it, set the `enableSwaps` flag to `false` in the configuration of the `createWeb3Modal` function.

```ts
const modal = createWeb3Modal({
//...
chains: [mainnet],
projectId,
/* highlight-add-start */
enableSwaps: false // Optional - true by default
/* highlight-add-end */
})
```
3 changes: 1 addition & 2 deletions docs/appkit/vue/ethers/about/implementation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ In your `App.vue` file set up the following configuration.
ethersConfig,
chains: [mainnet],
projectId,
enableAnalytics: true, // Optional - defaults to your Cloud configuration
enableOnramp: true // Optional - false as default
enableAnalytics: true // Optional - defaults to your Cloud configuration
})
</script>

Expand Down
3 changes: 1 addition & 2 deletions docs/appkit/vue/ethers5/implementation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ In your `App.vue` file set up the following configuration.
ethersConfig,
chains: [mainnet],
projectId,
enableAnalytics: true, // Optional - defaults to your Cloud configuration
enableOnramp: true // Optional - false as default
enableAnalytics: true // Optional - defaults to your Cloud configuration
})
</script>

Expand Down
3 changes: 1 addition & 2 deletions docs/appkit/vue/wagmi/about/implementation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ In your `App.vue` file set up the following configuration
createWeb3Modal({
wagmiConfig: config,
projectId,
enableAnalytics: true, // Optional - defaults to your Cloud configuration
enableOnramp: true // Optional - false as default
enableAnalytics: true // Optional - defaults to your Cloud configuration
})
</script>

Expand Down

0 comments on commit 0a44aa5

Please sign in to comment.