You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: update create frontend page to use smart contract portal (#38)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Documentation**
- Updated references from Polygon Mumbai testnet to Polygon Amoy
testnet.
- Changed installation instructions from Node.js to Bun.
- Modified file paths and configurations for ERC-20 token contract
deployment.
- Adjusted environment variables and project IDs for WalletConnect and
Smart Contract Portal Middleware.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This guide will show you how to build a full stack application using SettleMint, Polygon, wagmi and, Next Js. If this is your first time using SettleMint, we recommend the Hello World Guide.
8
+
This guide will show you how to build a full stack application using SettleMint, Polygon, wagmi and NextJS. If this is your first time using SettleMint, we recommend the Hello World Guide.
9
9
10
10
In this guide, you will learn how to connect a custom front end to your blockchain application using:
11
11
@@ -14,11 +14,11 @@ In this guide, you will learn how to connect a custom front end to your blockcha
14
14
-[Web3Auth](https://web3auth.io/) to make the transfer and receive the tokens
15
15
polygon
16
16
To complete this guide, please have the following installed:
- A code editor (ex:[VSCode](https://code.visualstudio.com)).
20
20
21
-
At the end of this guide, you will have deployed an ERC-20 token smart contract to the Polygon Mumbai Testnet and connected a front end to interact with this smart contract. The front end will allow us to send tokens that we created to any wallet address.
21
+
At the end of this guide, you will have deployed an ERC-20 token smart contract to the Polygon Amoy Testnet and connected a front end to interact with this smart contract. The front end will allow us to send tokens that we created to any wallet address.
22
22
23
23
## Part 1: The Blockchain Application
24
24
@@ -34,7 +34,7 @@ For this guide, we will name this application `TokenSender`.
34
34
35
35
After creating an application, we need to create a Blockchain Network and Node to deploy to. This is done by clicking on the `Add a blockchain network` from the Application Dashboard.
36
36
37
-
We will deploy our smart contract to the Polygon Mumbai Testnet like the image below:
37
+
We will deploy our smart contract to the Polygon Amoy Testnet like the image below:
38
38
39
39

40
40
@@ -49,7 +49,7 @@ It is now time to choose a deployment plan. Here is the configuration most suita
49
49
50
50
### Creating a Private Key
51
51
52
-
To deploy our smart contract and send tokens, we need funds to cover the transfer cost. To do this we will create a Private Key and then receive MATIC tokens, the native token of the Mumbai testnet, from the faucet. Faucets allow us to get free test tokens to spend on a testnet.
52
+
To deploy our smart contract and send tokens, we need funds to cover the transfer cost. To do this we will create a Private Key and then receive MATIC tokens, the native token of the Amoy testnet, from the faucet. Faucets allow us to get free test tokens to spend on a testnet.
53
53
54
54
To make a Private Key, click on the `Private Key` link on the right side of the dashboard. Once there, select `Create a Private Key`.
55
55
@@ -87,43 +87,35 @@ Once that is deployed, we can go to the IDE and start editing our contract.
You can find the ERC20 contract on the left in the Explorer under `contracts/GenericToken.sol`
90
+
You can find the ERC20 contract on the left in the Explorer under `contracts/GenericERC20.sol`
91
91
92
92
We don't need to change anything in this contract's code. The current default is to deploy a token called `GenericToken` with a symbol `GT`.
93
93
94
-
To change this to something less generic, we can go to the `Deploy` folder and open the `00_deploy_generic_token.ts` file. From there we can edit the below code block that starts on line 13:
94
+
To change this to something less generic, we can go to the `gnition/modules` folder and open the `main.ts` file. From there we can edit the below code block that starts on line 4:
2. Compile the contract by selecting `hardhat/compile`
126
-
3. Deploy the contract by selecting `npm/smartcontract:deploy`
116
+
1. Select the `Task Manager` on the left
117
+
2. Compile the contract by selecting `Hardhat - Build`
118
+
3. Deploy the contract by selecting `Hardhat - Deploy to platform network`
127
119
128
120
If the deployment was successful, you will see a `deployed at 0x4251501F80cE773b594C0B6CEf1289b97b0`
129
121
@@ -142,44 +134,19 @@ In addition to using NextJS, this template uses the:
142
134
-`wagmi` - to interact with the contract
143
135
-`web3auth` - to create a modal for connecting a wallet
144
136
-`tailwind` - for styling and design
137
+
-`connectkit` - connecting a wallet to your dApp
145
138
146
-
You can get all of these packages by running `npm install` in your terminal after cloning the repo.
139
+
You can get all of these packages by running `bun install` in your terminal after cloning the repo.
147
140
148
141
After that is completed, open the folder in your favorite code editor.
149
142
150
-
### Adding the ABI and Address
143
+
### Adding the ABI
151
144
152
145
The first thing we will do is add the ABI and address of our deployed contract. This allows our front end to know where to read and write data to it. This information can be found in the SettleMint IDE where you deployed your contract.
153
146
154
-
Go to the `Deployments` folder in the file explorer and the `GenericToken.json` file. Copy both the `address` and `abi` and paste it into the `contractData/data.js` file inside the template.
155
-
156
-
```javascript
157
-
exportconstcontractData= {
158
-
"address":"0x...",
159
-
"abi": [...]
160
-
```
161
-
162
-
### Adding the RPC Provider
163
-
164
-
Now we will add the RPC Provider URL that will allow us to connect to the Polygon Mumbai network.
165
-
166
-
To get this URL go back to the SettleMint platform and select the `Blochain Nodes` option on the right. From there, select your deployed node `TokenSender` and choose the `Connect` tab.
167
-
168
-
Here you will find your `JSON-RPC` URL. Copy that URL and go to the `src/pages/_app.tsx` file.
169
-
170
-
Around line 21 you will find this code block:
147
+
Go to the `ignition/deployments/chain-46622/artifacts` folder in the file explorer and copy the `GenericERC20Module#GenericERC20.json` file to the `contractData` directory.
From there, select the `Generate newAPI Key`. You can now create an API key name, expiration, and access. For this guide, selecting `All blockchain nodes in all organizations` will work.
159
+
From there, select the `Generate new API Key`. You can now create an API key name, expiration, and access. For this guide, selecting `All blockchain nodes in all organizations`and `All middlewares in all organizations`will work.
193
160
194
-
You will now see your API key that was generated only once. Copy this and add it to the end of the `JSON-RPC` that you copied in the previous step. The format should be: `JSON-RPCURL/API-KEY`
161
+
You will now see your API key that was generated only once. Copy this and add it as the `BTP_TOKEN` variable value in the `.env` file.
195
162
196
163
### Configuring web3auth
197
164
198
165
To use web3auth, you will need to make an account a project. To set up an account and a project, follow [this guide](https://web3auth.io/docs/dashboard-setup).
199
166
200
-
After creating an account, you can navigate to the `Projects` tab on the right and click on `Add Project`. From there you will see that the project has been created and you can access the Project Details page.
167
+
After creating an account, you can create a new project. From there you will see that the project has been created and you can access the Project Details page.
201
168
202
-
On that page, you will find the `ClientID` like below:
169
+
On that page, you will find the `Project ID` like below:
Using `wagmi` enables us to read different functions and values from our smart contract. In this template, we are reading the `symbol` function to display which token is connected to this smart contract.
218
+
Using the `Smart Contract Portal Middleware` enables us to read different functions and values from our smart contract. In this template, we are reading the `symbol` function to display which token is connected to this smart contract.
0 commit comments