|
1 | 1 | ### Create NFT Token |
2 | 2 | **Step 1: Write a Function to create NFTs on the mainchain** |
| 3 | + |
3 | 4 | Now, let's write the **create NFTs on MainChain** function. |
4 | 5 | 1. Scroll down to find the comment `// step 6 - Create an NFT on the mainchain`. |
5 | 6 |
|
@@ -59,7 +60,9 @@ const createNFTOnMainChain = async (values: INftParams) => { |
59 | 60 | 4. **Handles Success:** Updates the notification to show successful NFT creation. |
60 | 61 | 5. **Handles Errors:** Displays an error message if the operation fails and logs the error. |
61 | 62 | 6. **Final Return:** Returns `"success"` if the NFT is created successfully; otherwise, returns `"error"`. |
| 63 | + |
62 | 64 | **Step 2: Write the Function for Validate NFT Info Exist** |
| 65 | + |
63 | 66 | Now, let's write the Validate NFT Info Exist function. |
64 | 67 | 1. Scroll down to find the comment `// step 7 - Validate an NFT token on the mainchain`. |
65 | 68 |
|
@@ -157,7 +160,9 @@ const validateNftToken = async (values: INftParams) => { |
157 | 160 | 6. **Fetches Merkle Path:** Retrieves the Merkle path for the validated transaction. |
158 | 161 | 7. **Handles Success:** Updates the notification to show successful validation and returns necessary values. |
159 | 162 | 8. **Handles Errors:** Logs errors and returns `"error"` if something goes wrong. |
| 163 | + |
160 | 164 | **Step 3: Write a Function for Create NFT on dAppChain** |
| 165 | + |
161 | 166 | Now, let's write the Create NFT on dAppChain function. |
162 | 167 | 1. Scroll down to find the comment `// step 8 - Create a NFT on dAppChain`. |
163 | 168 |
|
@@ -202,8 +207,11 @@ const createNftTokenOnSideChain = async (values: INftValidateResult) => { |
202 | 207 | 3. **Calls Smart Contract Method:** Sends the transaction to the dAppChain smart contract to create the NFT. |
203 | 208 | 4. **Handles Success:** Updates the notification to show successful NFT creation on the dAppChain. |
204 | 209 | 5. **Handles Errors:** Logs errors and returns `"error"` if something goes wrong. |
| 210 | + |
205 | 211 | **Step 4: Write a Function for Issue NFT Token which has been Created on dAppChain.** |
| 212 | + |
206 | 213 | Now, let's write the Issue NFT Function. |
| 214 | + |
207 | 215 | 1. Scroll down to find the comment `// step 9 - Issue a NFT Function which has been Created on dAppChain`. |
208 | 216 |
|
209 | 217 | 2. Replace the existing **`issueNftOnSideChain`** function with this code snippet: |
@@ -255,8 +263,11 @@ const issueNftOnSideChain = async (values: { |
255 | 263 | 3. **Calls Smart Contract Method:** Sends the transaction to the dAppChain smart contract to issue the NFT. |
256 | 264 | 4. **Handles Success:** Updates the notification to show successful issuance and notifies the user that the NFT will appear in their wallet. |
257 | 265 | 5. **Handles Errors:** Logs and displays any error messages, updates the transaction status, and returns `"error"`. |
| 266 | + |
258 | 267 | **Step 5: Create a Function to Call Necessary Functions for NFT Creation** |
| 268 | + |
259 | 269 | Now, let's write the createNftToken Function. |
| 270 | + |
260 | 271 | 1. Scroll down to find the comment `// step 10 - Call Necessary Function for Create NFT`. |
261 | 272 |
|
262 | 273 | 2. Replace the existing **`createNftToken`** function with this code snippet: |
|
0 commit comments