Skip to content

Commit

Permalink
v2 of the AP docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Karkunow committed Feb 20, 2024
1 parent f87c457 commit b1be55b
Show file tree
Hide file tree
Showing 17 changed files with 426 additions and 213 deletions.
2 changes: 1 addition & 1 deletion docs/aurora-cloud/chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To make Aurora Chain work in the best possible way for your business, we will he
1. *Base token* of your Aurora Chain.
2. *Gas mechanics* within your chain, such as fixed fee or percentage-based fees, gasless transactions, paying for gas with a custom token, etc.
3. *Permission levels*: whitelist usage - who can transact or deploy contracts?
You can learn about how to operate Aurora Chain Whitelists from your dApp [here](/aurora-cloud/chain#whitelist-management).
You can learn about how to operate Aurora Chain Whitelists from your DApp [here](/aurora-cloud/chain#whitelist-management).
4. *Private chain*: can be built using a private NEAR shard [Calimero](https://www.calimero.network/).

## How do I create my Aurora Chain?
Expand Down
37 changes: 0 additions & 37 deletions docs/aurora-cloud/mobile-wallet/promo-widget.md

This file was deleted.

45 changes: 0 additions & 45 deletions docs/aurora-cloud/mobile-wallet/wallet-connect.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/getting-started/aurora-engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Aurora is backed by top VCs such as Pantera Capital, Electric Capital, Dragonfly

Thanks to Aurora’s EVM, Ethereum native applications can seamlessly be ported to NEAR’s L2-like network that is built as a smart contract on NEAR.
Developers may enjoy familiar Ethereum tooling when working with their Solidity smart contracts on Aurora.
The base fee of Aurora is ETH, which provides a smooth experience for dapps’ users.
The base fee of Aurora is ETH, which provides a smooth experience for DApps’ users.

Besides the EVM, Aurora developed the Rainbow Bridge which allows users to transfer assets between Ethereum, NEAR, and Aurora.
Several integrations of bridges from/to other networks have been launched as well, and more is coming!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
title: "Integrating From Scratch"
sidebar_position: 4
title: "Integration Example"
---


In this article, we will go through a development of a simple [Web3Modal](https://docs.walletconnect.com/web3modal/about) example to use Aurora Pass in a dApp.
In this article, we will go through a development of a simple [Web3Modal](https://docs.walletconnect.com/web3modal/about) example to use Aurora Pass in a DApp.

## Create a simple React app
### Create a simple React app

To start, let's create a React application by using `create-react-app`. Of course, you can just use your already existing codebase instead, we're doing this just for the demonstration purposes.
You will need to run in your terminal:
Expand All @@ -20,93 +19,29 @@ npm start
Your React app will be running now at `http://localhost:3000`, just open that link in you browser to see the UI.
You can read more about the `create-react-app` [here](https://create-react-app.dev/docs/getting-started/), in the case you want to learn more details.

## Add Aurora Promo Widget
### Add Aurora Promo Widget

We have talked about the Promo Widget [before](/aurora-cloud/mobile-wallet/promo-widget), but now it is time to try it in practice.
We have talked about the Promo Widget [before](/onboard/promo-widget), but now it is time to try it in practice.
You need to follow the code [here](/onboard/promo-widget) to add the Promo Widget popup to you DApp.
After this, we can add Web3Modal to the project.

To add the `promo.js` script to our React app we can use the `useEffect` hook like this:

```jsx title="aurora-pass-example/src/App.js"
...
import { useEffect } from "react";

let scriptAdded = false;

function App() {
useEffect(() => {
if(!scriptAdded) {
const script = document.createElement("script");
script.src = "https://pass.auroracloud.dev/promo.js";
script.async = true;
document.body.appendChild(script);
}
}, []);

...
}
```

Now, let's add a function `openModal` to display our Promo Widget just after the imports somewhere:

```jsx title="aurora-pass-example/src/App.js"
...
const openWeb3Modal = () => {
alert("Just a placeholder for now. We will add Web3Modal here later.")
};

const openWidget = () => {
window.openPromo
? window.openPromo({ onComplete: openWeb3Modal, config: {hideUpdateAppBlock: true} })
: openWeb3Modal()
}
...
```

Now, we can set the `onClick` attribute of the already existing `App-link` element to use `openWidget` function:

```jsx title="aurora-pass-example/src/App.js"

function App() {
...

return (
<div className="App">
<header className="App-header">
...
<a
className="App-link"
href="#"
onClick={openWidget}
>
Open Promo
</a>
</header>
</div>
);
}
```

If you click on `Open Promo` link, you will be able to see the Promo Widget now:
![ap_widget_example_1](/img/ap_widget_example_1.png)

And then, if you click further on the 'Skip, I have a wallet' button, you will see the placeholder message about Web3Modal:
![ap_widget_example_1](/img/ap_widget_example_2.png)

Let's add Web3Modal to it now.

## Adding Web3Modal
### Adding Web3Modal

We will follow the [Web3Model Wagmi v2 documentation](https://docs.walletconnect.com/web3modal/react/about?platform=wagmi) closely here.

1). First, let's add some new packages to the project:
#### Import libraries and get projectId

First, let's add some new packages to the project:

```bash
npm install @web3modal/[email protected] wagmi viem @tanstack/react-query
```

2). Let's signup now at [WalletConnect Cloud](https://cloud.walletconnect.com/sign-in) to get a WalletConnect `projectId`. You will get some random string like `4aee871f7a80f1ff5c7892226bd3ascd`
Let's signup now at [WalletConnect Cloud](https://cloud.walletconnect.com/sign-in) to get a WalletConnect `projectId`. You will get some random string like `4aee871f7a80f1ff5c7892226bd3ascd`

3). Let's create a file with a Web3Modal component:
#### Add Web3Modal component

Now, let's create a file with a Web3Modal component:

```jsx title="aurora-pass-example/src/Web3Modal.js"
import { createWeb3Modal, defaultWagmiConfig } from '@web3modal/wagmi/react'
Expand Down Expand Up @@ -149,23 +84,7 @@ export default function Web3Modal({ children }) {
}
```

:::note

Please note that it could be important for Aurora chain to be the first one in the list of `chains` for everything to work properly with AuroraPass and Web3Modal v2:

```jsx
/*You can do this */
const chains = [auroraChain, ethereumChain, bscChain];

/*But not this*/
const chains = [ethereumChain, auroraChain, bscChain];
```

To allow the second situation you can use `defaultChain` option while setting up your Web3Modal component.
You can read more [here](https://docs.walletconnect.com/web3modal/react/options#defaultchain).
:::

4). Now, we can use the Web3Modal component in our App. First of all notice that we need to wrap into it the part of the App using the `wagmi` hooks. In this case we wrapping it fully into it:
Now, we can use the Web3Modal component in our App. First of all notice that we need to wrap into it the part of the App using the `wagmi` hooks. In this case we wrapping it fully into it:

```jsx title="aurora-pass-example/src/App.js"

Expand All @@ -186,7 +105,9 @@ function App() {

But we haven't displayed the popup yet. How can we do it?

5). To open the popup, let's use `useWeb3Modal` hook inside the App component, to be more specific – the `open` function it provides.
#### Displaying Web3Modal

To open the wallets popup, let's use `useWeb3Modal` hook inside the App component, to be more specific – the `open` function it provides.
We also need to edit a bit our old `openWidget` function to accept `onComplete` argument, and pass there the `open` function:

```jsx title="aurora-pass-example/src/App.js"
Expand Down Expand Up @@ -230,7 +151,9 @@ If you will go into your App now, you will be able to see the WalletConnect popu

But, it won't contain the AuroraPass yet. Let's add it there.

6). To do this, we need to modify the `Web3Modal.js` file a bit and add some options to it:
### Add AuroraPass to your wallet list

To do this, we need to modify the `Web3Modal.js` file a bit and add some options to it:

```jsx title="aurora-pass-example/src/Web3Modal.js
let options = {
Expand All @@ -257,7 +180,9 @@ But we won't see if the connection was successful yet, because we don't have any

![wc_ap_connected_no_ui](/img/wc_ap_connected_no_ui.png)

7). Let's fix it by replacing the 'Edit src/App.js and save to reload' label with a simple `Account` component showing us if we have connected to the dApp already.
### Displaying the connection status in DApp

Let's fix it by replacing the 'Edit src/App.js and save to reload' label with a simple `Account` component showing us if we have connected to the DApp already.
We can do that inside the App component file right away by using `useAccount` wagmi hook:

```jsx title="aurora-pass-example/src/App.js
Expand Down Expand Up @@ -295,10 +220,12 @@ Now we're able to see the status of our connection on the main screen:

![wc_ap_account](/img/wc_ap_account.png)

And the corresponding account after we've connected via the Web3Modal to the dApp:
And the corresponding account after we've connected via the Web3Modal to the DApp:

![wc_ap_connected_ui.png](/img/wc_ap_connected_ui.png)

### Final thoughts

Congratulations on the completing your first AuroraPass integration!

If you still have some questions, please contact our team via [Discord](https://discord.com/invite/dEFJBz8HQV) by opening a support ticket there.
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
---
title: "Introduction"
sidebar_position: 1
---

# Aurora Pass

Aurora Pass is a mobile cryptocurrency wallet that makes it easier than ever to manage your Aurora Mainnet and Aurora Chain assets, and use any dApps across these chains.
Aurora Pass is a mobile cryptocurrency wallet that makes it easier than ever to manage your Aurora Mainnet and Aurora Chain assets, and use any DApps across these chains. It helps also to onboard your users, even if they are not familiar with Web3 ecosystem yet.

## Key Features

- Secure and non-custodial wallet.
- Simple and user-friendly interface.
- 50 free transactions for each user per month.
- Secure and non-custodial wallet.
- Send and receive assets on Aurora Mainnet and Aurora Chains.
- View your portfolio balances and recent transactions.
- Connect to dApps via WalletConnect v2.
- Connect to DApps via WalletConnect v2.

## Integration

You can integrate Aurora Pass into your dApp by using a [WalletConnect v2](https://docs.walletconnect.com/). You have two options available as a developer:
Connecting Aurora Pass to a DApp is done the same way as every other EVM wallet implementing a [WalletConnect v2](https://docs.walletconnect.com/).
See more info on how to configure or add WalletConnect [here](/onboard/wallet-connect).

You can follow the step-by-step [integration example](/onboard/integration-example) to understand better how different components work together.

1. If you already have a WalletConnect integration, you can read more about it [here](/aurora-cloud/mobile-wallet/wallet-connect).
2. If you don't, you can start from scratch [here](/aurora-cloud/mobile-wallet/integration-example) with a simple Web3Modal example.
## Promo Widget

## Onboarding new users
To allow new users to install Aurora Pass quickly, you can add a [promo widget](/onboard/promo-widget) to your DApp. It will direct a user to download Aurora Pass application on a mobile phone in the most convinient way.

To facilitate the onboarding of new users, you can add this [promo widget](/aurora-cloud/mobile-wallet/promo-widget) to your dApp.
It is optional to add it to your DApp. But otherwise, you will need to implement some other way to lead user to the installation of the wallet. So, we advice everyone to use it as an onboarding entrypoint in their DApps.

## Free transactions

Aurora Pass requires a login with an email or Apple/Google auth which will provide them with free transactions on Aurora Mainnet.
The basic plan for Aurora Pass users is 50 free transactions per month. This feature is achieved by using Gasless Management feature of Aurora Chains.
In parallel, dApps can also pay for their user’s EOA transaction fees by getting their own gasless deal for their users or contracts.
In parallel, DApps can also pay for their user’s EOA transaction fees by getting their own gasless deal for their users or contracts.

If the monthly free transaction limit is reached or the transaction is not sponsored by a dApp, a pack of transactions can be purchased from within the Aurora Pass app.
If the monthly free transaction limit is reached or the transaction is not sponsored by a DApp, a pack of transactions can be purchased from within the Aurora Pass app.
Right now, there is only one transaction pack available: 500 free transactions for a price around $4.99.

## Security
Expand All @@ -51,13 +52,6 @@ The seed phrase is stored using [expo-secure-store](https://docs.expo.dev/versio
- on Android, values are stored in SharedPreferences, encrypted with Android’s Keystore system;
- on iOS, values are stored using the keychain services.

## Displaying the arguments of transaction

When signing a transaction, which calls a contract **verified** on Aurora Explorer, the wallet will display the decoded function call and arguments instead of some hex codes and argument values,
which will be displayed for the non-verified ones.
So, we advice you to verify all (or most) of your contracts, which gives your users better understanding of their interactions with your product via Aurora Pass.

## Tokens recovery
## Troubleshooting

Aurora Pass does not currently support other EVM chains and L2s. But sometimes by mistake users can send their assets to their Aurora Pass address on those networks instead.
These tokens can be easily recovered by importing the seed phrase into a compatible wallet like MetaMask and then bridging them to Aurora or to any other address.
If you encounter any issues, please visit our [Troubleshooting Page](/onboard/troubleshooting) to find a solution.
3 changes: 3 additions & 0 deletions docs/onboard/own-wallet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
sidebar_label: Create your own wallet (AP Pro)
---
Loading

0 comments on commit b1be55b

Please sign in to comment.