Skip to content

Commit

Permalink
Merge pull request #59 from iamonuwa/fix/docs-typos
Browse files Browse the repository at this point in the history
fix(docs): update typos on docs
  • Loading branch information
Rahat-ch authored Aug 31, 2023
2 parents 0f08ab2 + e3c642b commit 72293f5
Show file tree
Hide file tree
Showing 14 changed files with 888 additions and 13,242 deletions.
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,46 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern
static website generator.

### Installation

```
$ yarn
$ npm install
```

### Local Development

```
$ yarn start
$ npm start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
This command starts a local development server and opens up a browser window.
Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
$ npm build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.
This command generates static content into the `build` directory and can be
served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
$ USE_SSH=true npm run deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
$ GIT_USER=<Your GitHub username> npm run deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
If you are using GitHub pages for hosting, this command is a convenient way to
build the website and push to the `gh-pages` branch.

48 changes: 36 additions & 12 deletions docs/quickexplore/erc20transfers.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,55 @@ sidebar_position: 3

# Exploring ERC20 Transfers

:::info
You should already have the node cli set up before following this guide. View those instructions [here](setupnodecli.md)
:::

In the previous tutorials we set up our Smart Accounts and created Native Transfers using the Node JS CLI tool, in this tutorial we will use the tool to start exploring ERC20 token transfers. If you would like to view the code that powers this script, you can do so in the source code of the CLI tool in `scripts/erc20/erc20Transfer.ts` and `scripts/gasless/erc20Transfer.ts`

This tutorial uses USDC on Polygon Mumbai from this contract Address: 0xdA5289fCAAF71d52a80A254da614a192b693e977. You can swap matic test tokens for USDC via [uniswap](https://app.uniswap.org/#/swap), just connect with your EOA while on the mumbai testnet and swap with this address. At the time of writing this I was able to swap 1 test matic for 75 test USDC tokens. Make sure to fund your smart account with some test USDC.
:::info You should already have the node cli set up before following this guide.
View those instructions [here](setupnodecli.md) :::

In the previous tutorials we set up our Smart Accounts and created Native
Transfers using the Node JS CLI tool, in this tutorial we will use the tool to
start exploring ERC20 token transfers. If you would like to view the code that
powers this script, you can do so in the source code of the CLI tool in
`scripts/erc20/erc20Transfer.ts` and `scripts/gasless/erc20Transfer.ts`

This tutorial uses USDC on Polygon Mumbai from this contract Address:
0xdA5289fCAAF71d52a80A254da614a192b693e977. You can swap matic test tokens for
USDC via [Uniswap](https://app.uniswap.org/#/swap), just connect with your EOA
while on the mumbai testnet and swap with this address. At the time of writing
this I was able to swap 1 test matic for 75 test USDC tokens. Make sure to fund
your smart account with some test USDC.

## Initiating a transfer

Before executing our first ERC20 transfer, now that we have our smart account address we need to fund it with some test network tokens! Since we are using the Polygon Mumbai network head over to the [Polygon Faucet](https://faucet.polygon.technology/) and paste in your smart account address and get some test tokens!
Before executing our first ERC20 transfer, now that we have our smart account
address we need to fund it with some test network tokens! Since we are using the
Polygon Mumbai network head over to the
[Polygon Faucet](https://faucet.polygon.technology/) and paste in your smart
account address and get some test tokens!

```bash
yarn run smartAccount erc20Transfer --to=0x322Af0da66D00be980C7aa006377FCaaEee3BDFD --amount=0.1 --token=0xdA5289fCAAF71d52a80A254da614a192b693e977
```

Please feel free of course to transfer to any wallet of your choice. The `--to` flag in the script will be the recipient of the transfer you decide to make. The `--token` flag will be the contract of the token you want to transfer. In this case we are using the USDC POS contract on Polygon Mumbai.
Please feel free of course to transfer to any wallet of your choice. The `--to`
flag in the script will be the recipient of the transfer you decide to make. The
`--token` flag will be the contract of the token you want to transfer. In this
case we are using the USDC POS contract on Polygon Mumbai.

Upon successful transfer you will see several details printed to your terminal which include: the userOp information, userOp hash, and transaction detail information once confirmed.
Upon successful transfer you will see several details printed to your terminal
which include: the userOp information, userOp hash, and transaction detail
information once confirmed.

## Token Paymaster transfers

What if we wanted to skip having to load up on native tokens for gas entirely? Let's execute this same transaction but we will pay gas fees using only our USDC tokens.
What if we wanted to skip having to load up on native tokens for gas entirely?
Let's execute this same transaction but we will pay gas fees using only our USDC
tokens.

```bash
yarn run smartAccount erc20Transfer --to=0x322Af0da66D00be980C7aa006377FCaaEee3BDFD --amount=0.1 --token=0xdA5289fCAAF71d52a80A254da614a192b693e977 --withTokenPaymaster
```
If you take a look at your token balances on [Polygonscan](https://mumbai.polygonscan.com/) you will notice that no gas was deducted in matic from your account! This unlocks a lot of powerful user experiences for your dApps.

If you take a look at your token balances on
[Polygonscan](https://mumbai.polygonscan.com/) you will notice that no gas was
deducted in matic from your account! This unlocks a lot of powerful user
experiences for your dApps.

65 changes: 42 additions & 23 deletions docs/quickexplore/setupnodecli.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,31 @@ sidebar_position: 1

Our Node JS CLI Tool allows you to quickly execute scripts for more use cases

This guide will take you through the initial setup of our tool so you can see more Account Abstraction use cases in action with our SDK.
This guide will take you through the initial setup of our tool so you can see
more Account Abstraction use cases in action with our SDK.

To get started clone down this [GitHub Repository](https://github.com/bcnmy/sdk-examples)
To get started clone down this
[GitHub Repository](https://github.com/bcnmy/sdk-examples)

## Clone the Repository

```bash
git clone https://github.com/bcnmy/sdk-examples.git
```

In your preferred command line interface navigate to the `sdk-examples` directory you just cloned and then into the `backend-node` directory.
In your preferred command line interface navigate to the `sdk-examples`
directory you just cloned and then into the `backend-node` directory.

## Navigate to the Directory

```bash
cd sdk-examples/backend-node
```

Install all dependencies using either yarn or npm
Install all dependencies using either yarn or npm

## Install Dependencies

```bash
yarn install

Expand All @@ -31,43 +39,54 @@ yarn install
npm install
```

From this point we will continue using yarn but you can substitute any of the below commands with npm as well.
Open the code in your preferred code editor to reference any of the code powering the script and now let's create a configuration object for the CLI to use. From your command line run the command below:
From this point we will continue using yarn but you can substitute any of the
below commands with npm as well. Open the code in your preferred code editor to
reference any of the code powering the script and now let's create a
configuration object for the CLI to use. From your command line run the command
below:

## Initialize Smart Account

```bash
yarn run smartAccount init --network=mumbai
```
You will have a `config.json` file created in the root of this directory which should look something like this:

You will have a `config.json` file created in the root of this directory which
should look something like this:

### Example of Config.json File

```json
{
"privateKey": "83ad2579e0162864ba0b48f217bdaba43c6020a79fcbe456fe736c524bbaa8d5",
"accountIndex": 0,
"chainId": 80001,
"rpcUrl": "https://rpc.ankr.com/polygon_mumbai",
"bundlerUrl": "https://bundler.biconomy.io/api/v2/80001/<BUNDLER_API_KEY_OBTAINED_FROM_BICONOMY>",
"biconomyPaymasterUrl": "https://paymaster.biconomy.io/api/v1/80001/<YOUR_PAYMASTER_API_KEY_FROM_DASHBOARD>",
"preferredToken": "",
"tokenList": []
"privateKey": "83ad2579e0162864ba0b48f217bdaba43c6020a79fcbe456fe736c524bbaa8d5",
"accountIndex": 0,
"chainId": 80001,
"rpcUrl": "https://rpc.ankr.com/polygon_mumbai",
"bundlerUrl": "https://bundler.biconomy.io/api/v2/80001/<BUNDLER_API_KEY_OBTAINED_FROM_BICONOMY>",
"biconomyPaymasterUrl": "https://paymaster.biconomy.io/api/v1/80001/<YOUR_PAYMASTER_API_KEY_FROM_DASHBOARD>",
"preferredToken": "",
"tokenList": []
}

```
You can update the private key value to be the address of any EOA wallet you would like. Make sure to update the API Key for bundler and paymaster url.

You can get paymaster API_KEY from [Biconomy Dashbaord](https://dashboard.biconomy.io)
You can update the private key value to be the address of any EOA wallet you
would like. Make sure to update the API Key for bundler and paymaster url.

:::note
Bundler support on dashboard is not yet live. But you can use below API key for testing purpose.
You can get paymaster API_KEY from
[Biconomy dashboard](https://dashboard.biconomy.io)

:::note Bundler support on dashboard is not yet live. But you can use below API
key for testing purpose.

cJPK7B3ru.dd7f7861-190d-45ic-af80-6877f74b8f44

For Mainnet API Keys [Contact Us](https://t.me/rhicsanchez)
:::
For Mainnet API Keys [Contact Us](https://t.me/rhicsanchez) :::

## Retrieve Smart Account Address

```bash
yarn run smartAccount address
```
This will print the EOA address associated to the private key you entered in the configuration as well as a Smart Contract Wallet that is now owned by that EOA.

This will print the EOA address associated to the private key you entered in the
configuration as well as a Smart Contract Wallet that is now owned by that EOA.
55 changes: 38 additions & 17 deletions docs/tutorials/React_vite/counter.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@ sidebar_position: 2

# Counter Smart Contract

[Remix](https://remix.ethereum.org/) is a powerful, open source tool that helps you write Solidity contracts straight from the browser. Remix also supports testing, debugging and deploying of smart contracts and much more.
[Remix](https://remix.ethereum.org/) is a powerful, open source tool that helps
you write Solidity contracts straight from the browser. Remix also supports
testing, debugging and deploying of smart contracts and much more.

It is recommended to use [Remix](https://remix.ethereum.org/) to create and deploy smart contracts quickly.
It is recommended to use [Remix](https://remix.ethereum.org/) to create and
deploy smart contracts quickly.

In Remix, when opening a basic template you will see a folder called contracts. Right click on the folder and create a new contract called Counter.sol and begin typing the code below.
In Remix, when opening a basic template you will see a folder called contracts.
Right click on the folder and create a new contract called Counter.sol and begin
typing the code below.

## License

At the start of your smart contract, you can declare a license. In this case, we will leave this as UNLICENSED as we are not too concerned about what this code is used for.
At the start of your smart contract, you can declare a license. In this case, we
will leave this as UNLICENSED as we are not too concerned about what this code
is used for.

```
// SPDX-License-Identifier: UNLICENSED
Expand All @@ -24,8 +31,9 @@ At the start of your smart contract, you can declare a license. In this case, we
pragma solidity ^0.8.9;
```

:::caution
Make sure the solidity version declared in the contract matches your compiler version
:::caution Make sure the solidity version declared in the contract matches your
compiler version

:::

Now let's write out our contract:
Expand All @@ -44,15 +52,28 @@ contract Counter {
}
```

Here is a breakdown of what this contract is doing:

1. `uint256 public count`: This line declares a public unsigned integer variable named count. Unsigned integers are non-negative numbers. The `public` keyword automatically generates a function that allows you to access the current value of the `count` state variable from outside the contract.
2. `event updateCount(uint newCount)`: This line declares an event named `updateCount`. Events are a way for your contract to communicate that something happened on the blockchain to your app front-end, which can be 'listening' for certain events and take action when they happen. In this case, the event will emit the new value of `count`.
3. `function incrementCount() public returns(uint256)`: This line declares a public function named incrementCount that doesn't take any parameters and returns an unsigned integer.
Inside the incrementCount function:
Here is a breakdown of what this contract is doing:

1. `uint256 public count`: This line declares a public unsigned integer variable
named count. Unsigned integers are non-negative numbers. The `public` keyword
automatically generates a function that allows you to access the current
value of the `count` state variable from outside the contract.
2. `event updateCount(uint newCount)`: This line declares an event named
`updateCount`. Events are a way for your contract to communicate that
something happened on the blockchain to your app front-end, which can be
'listening' for certain events and take action when they happen. In this
case, the event will emit the new value of `count`.
3. `function incrementCount() public returns(uint256)`: This line declares a
public function named incrementCount that doesn't take any parameters and
returns an unsigned integer. Inside the incrementCount function:

- `count +=1`: This line increases the `count` variable by one.
- `emit updateCount(count)`: This line triggers the `updateCount` event and
sends the new value of the count variable to the listener.
- `return count`: This line returns the new value of `count`.

Now that we have our basic contract let's deploy this to the Polygon Mumbai Test
Network. You can follow the official
[Remix Documentation](https://remix-ide.readthedocs.io/en/latest/run.html) for
Deployment to get this deployed and verified.

- `count +=1`: This line increases the `count` variable by one.
- `emit updateCount(count)`: This line triggers the `updateCount` event and sends the new value of the count variable to the listener.
- `return count`: This line returns the new value of `count`.

Now that we have our basic contract let's deploy this to the Polygon Mumbai Test Network. You can follow the official [Remix Documentation](https://remix-ide.readthedocs.io/en/latest/run.html) for Deployment to get this deployed and verified.
16 changes: 9 additions & 7 deletions docs/tutorials/React_vite/first-dapp.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
---
sidebar_label: 'Introduction'
sidebar_label: "Introduction"
sidebar_position: 1
---

# Introduction

This tutorial will cover the basics of creating a dApp powered by the Biconomy SDK. Here's an overview of what you'll learn:
This tutorial will cover the basics of creating a dApp powered by the Biconomy
SDK. Here's an overview of what you'll learn:

- Build a basic smart contract that will act as a counter.
- Deploy the smart contract with Remix.
- Use Biconomy Dashboard for getting paymaster URL and bundler URL.
- Register the contract and its write methods on the Biconomy Dashboard.
- Create a frontend with React and Vite that allows for social logins and gasless transactions with the Bicnomy SDK.
- Build a basic smart contract that will act as a counter.
- Deploy the smart contract with Remix.
- Use Biconomy Dashboard for getting paymaster URL and bundler URL.
- Register the contract and its write methods on the Biconomy Dashboard.
- Create a frontend with React and Vite that allows for social logins and
gasless transactions with the Biconomy SDK.

Loading

0 comments on commit 72293f5

Please sign in to comment.