Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Karkunow committed Jan 25, 2024
1 parent a450177 commit 8bd1234
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 33 deletions.
29 changes: 18 additions & 11 deletions docs/aurora-cloud/mobile-wallet/integration-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ In this article, we will go through a development of a simple [Web3Modal](https:

## 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:
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:

```
```bash
npx create-react-app aurora-pass-example
cd aurora-pass-example
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.
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.

Expand Down Expand Up @@ -60,7 +62,8 @@ const openWidget = () => {
...
```

Now, we can set the `onClick` attribute of the already existing `App-link` element to use `openWidget` function:
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() {
Expand Down Expand Up @@ -97,7 +100,7 @@ We will follow the [Web3Model Wagmi v2 documentation](https://docs.walletconnect

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

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

Expand Down Expand Up @@ -183,7 +186,8 @@ 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. We also need to edit a bit our old `openWidget` function to accept `onComplete` argument, and pass there the `open` function:
5). To open the 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"
import { useWeb3Modal } from '@web3modal/wagmi/react';
Expand Down Expand Up @@ -227,6 +231,7 @@ 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:

```jsx title="aurora-pass-example/src/Web3Modal.js
let options = {
defaultChain: aurora, // we can set it to make sure we are using Aurora mainnet by default
Expand All @@ -239,6 +244,7 @@ let options = {
createWeb3Modal({ wagmiConfig, projectId, chains, ...options})

```

If we re-open the Web3Modal now, we will see AuroraPass wallet there:

![wc_ap_visible](/img/wc_ap_visible.png)
Expand All @@ -251,7 +257,8 @@ But we won't see if the connection was succesful yet, because we don't have anyt

![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. We can do that inside the App component file right away by using `useAccount` wagmi hook:
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.
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 All @@ -266,8 +273,8 @@ function Account () {
}

function App() {
...
return (
...
return (
<div className="App">
<Web3Modal>
<header className="App-header">
Expand All @@ -294,4 +301,4 @@ And the corresponding account after we've connected via the Web3Modal to the dAp

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.
If you still have some questions, please contact our team via [Discord](https://discord.com/invite/dEFJBz8HQV) by opening a support ticket there.
20 changes: 10 additions & 10 deletions docs/aurora-cloud/mobile-wallet/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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.

## Key Features

Expand All @@ -29,11 +29,12 @@ To facilitate the onboarding of new users, you can add this [promo widget](/auro

## 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.
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.

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.
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 @@ -46,18 +47,17 @@ The seed phrase is the only way to recover access to the wallet in case of loss

Using the wallet requires biometric authentication (e.g., faceID or touchID). In a case it is absent, the PIN code for a device will be used.
The seed phrase is stored using [expo-secure-store](https://docs.expo.dev/versions/latest/sdk/securestore/):
- on Android, values are stored in
SharedPreferences, encrypted with Android’s Keystore system;
- on iOS, values are stored using the keychain services.

- 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.
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

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.

11 changes: 6 additions & 5 deletions docs/aurora-cloud/mobile-wallet/promo-widget.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ We have already created a widget to ease the onboarding of users for your dApp.

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

You download the code for the widget and find the instructions here: https://pass.auroracloud.dev/
You download the code for the widget and find the instructions [here](https://pass.auroracloud.dev/).
For your convenience, we will also place the instructions below.

## Quick integration guide

1. Load the script from https://pass.auroracloud.dev/promo.js
1. Load a script from this [link](https://pass.auroracloud.dev/promo.js).
2. When the script is ready, it adds a function to the window called `openPromo`.
3. To open the widget, call `window.openPromo` and pass the `onComplete` function as a parameter `window.openPromo({ onComplete: function })`
4. You can also check if the function is available before calling it `window.openPromo ? window.openPromo({ onComplete: function }) : function()`
Expand All @@ -27,10 +27,11 @@ You can also take a look at the [integration example here](/aurora-cloud/mobile-
## Examples of integration

To see the widget in use, visit one of the projects on the list:
- [Aurora+](https://aurora.plus/)
- [Pipeflare](https://pipeflare.io/flare2-token/spin)

- [Aurora+](https://aurora.plus/)
- [Pipeflare](https://pipeflare.io/flare2-token/spin)

## What should be called in onComplete function?

The widget calls any function you pass to it. So you could pass anything to it, whether that’s opening WalletConnect v2 or v1 or any other function.
But, it works best and is meant to be used with WalletConnect v2 since the modal is styled in the same style.
But, it works best and is meant to be used with WalletConnect v2 since the modal is styled in the same style.
16 changes: 9 additions & 7 deletions docs/aurora-cloud/mobile-wallet/wallet-connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,22 @@ sidebar_position: 3

# Wallet Connect Integration


Aurora Pass is meant to be used with [WalletConnect v2](https://docs.walletconnect.com/) and [Web3Modal](https://docs.walletconnect.com/web3modal/about).
The WalletConnect protocol is the industry standard to create an encrypted connection between a dApp and Aurora Pass.
It is initialized by scanning a QR code, or via [deeplink](https://docs.walletconnect.com/web3wallet/mobileLinking) for mobile apps and browsers.

## Integration Guide
## Integration Guide

To integrate Aurora Pass into your dApp, just follow these steps:

1. If you use WalletConnect v1, then you need to [migrate to WalletConnect v2](https://docs.walletconnect.com/2.0/advanced/migration-from-v1.x/overview) first.
2. If you already have WalletConnect v2, then just [add the Aurora Pass wallet](/aurora-cloud/mobile-wallet/wallet-connect#adding-aurora-pass) to your dApp.
V2 migration
3. If you don't have WalletConnect at all, then take a look at the example [here](/aurora-cloud/mobile-wallet/integration-example),
read about [Web3Modal](https://docs.walletconnect.com/web3modal/about) and try to implement it yourself.
read about [Web3Modal](https://docs.walletconnect.com/web3modal/about) and try to implement it yourself.
4. If you are not sure what libraries to use during the development, please consult [here](/aurora-cloud/mobile-wallet/wallet-connect#evm-wallet-libraries).

If you need some support, please contact our team via [Discord](https://discord.com/invite/dEFJBz8HQV).
If you need some support, please contact our team via [Discord](https://discord.com/invite/dEFJBz8HQV).

## Adding Aurora Pass

Expand All @@ -32,12 +31,15 @@ You can add Aurora Pass as a recommended wallet by using the corresponding optio
2. For Web3Modal v2, use `explorerRecommendedWalletIds` option. About it please read [here](https://docs.walletconnect.com/web3modal/v2/react/wagmi/options#explorerrecommendedwalletids-optional).
3. Copy and paste the Wallet ID of Aurora Pass wallet to your Web3Modal option. You can find it [here](https://explorer.walletconnect.com/aurora-pass) or copy directly: `76260019aec5a3c44dd2421bf78e80f71a6c090d932c413a287193ed79450694`.

## EVM Wallet Libraries
## EVM Wallet Libraries

Connecting Aurora Pass to a dApp is done the same way as every other Ethereum wallet implementing the WalletConnect protocol.

The Ethereum ecosystem provides various libraries to make connecting to a wallet and interacting with smart contracts as easy as possible for dApp developers. Since Aurora Chains are EVM compatible, all the Ethereum tooling is also compatible with them.
The Ethereum ecosystem provides various libraries to make connecting to a wallet and interacting with smart contracts as easy as possible for dApp developers.
Since Aurora Chains are EVM compatible, all the Ethereum tooling is also compatible with them.

For example, [Web3Modal](https://docs.walletconnect.com/web3modal/about) developed by the WalletConnect team provides a modal with all the functionality needed to connect mobile wallets (QR code scan or deeplink). In a React application, it can be used with the popular hooks library [Wagmi](https://wagmi.sh/). Another popular modal in the Ethereum ecosystem is [RainbowKit](https://www.rainbowkit.com/).
For example, [Web3Modal](https://docs.walletconnect.com/web3modal/about) developed by the WalletConnect team provides a modal with all the functionality needed to connect mobile wallets
(QR code scan or deeplink). In a React application, it can be used with the popular hooks library [Wagmi](https://wagmi.sh/).
Another popular modal in the Ethereum ecosystem is [RainbowKit](https://www.rainbowkit.com/).

The Ethereum tooling is constantly evolving and improving so it is recommended to refer to the official documentation of your chosen library.

0 comments on commit 8bd1234

Please sign in to comment.