From 93a0c581684e04bc74c5684f2dab99cf519ae279 Mon Sep 17 00:00:00 2001 From: RutvikGhaskataEalf Date: Mon, 6 Jan 2025 08:00:58 +0530 Subject: [PATCH] fix: changed of pr-review --- .../_configure_portkey_and_connect_wallet.md | 6 ++--- .../developers/nft-dapp/_create_nft.md | 24 +++++++++---------- .../developers/nft-dapp/_fetch_nft_data.md | 11 ++++----- .../nft-dapp/_frontend_project_setup.md | 2 +- .../developers/nft-dapp/_transfer_nft.md | 8 +++---- 5 files changed, 25 insertions(+), 26 deletions(-) diff --git a/docs/quick-start/developers/nft-dapp/_configure_portkey_and_connect_wallet.md b/docs/quick-start/developers/nft-dapp/_configure_portkey_and_connect_wallet.md index b60d3e9..57b358d 100644 --- a/docs/quick-start/developers/nft-dapp/_configure_portkey_and_connect_wallet.md +++ b/docs/quick-start/developers/nft-dapp/_configure_portkey_and_connect_wallet.md @@ -12,7 +12,7 @@ We'll set up our Portkey provider to allow users to connect their Portkey wallet - Replace the existing **`fetchContract`** function with this updated code: -```javascript title="useNFTSmartContract.ts" +```ts title="useNFTSmartContract.ts" //Step A - Function to fetch a smart contract based on the chain symbol and the contract address const fetchContract = async ( symbol: "AELF" | "tDVW", @@ -52,7 +52,7 @@ const fetchContract = async ( - Replace the existing **`useEffect`** hook with this updated code: -```javascript title="useNFTSmartContract.ts" +```ts title="useNFTSmartContract.ts" // Step B - Effect hook to initialize and fetch the smart contracts when the provider changes useEffect(() => { (async () => { @@ -100,7 +100,7 @@ By following these steps, we'll configure the Portkey provider to connect users' - Replace the existing connect function with this code snippet: -```javascript title="header/index.tsx" +```tsx title="header/index.tsx" const connect = async (walletProvider?: IPortkeyProvider) => { // Step C - Connect Portkey Wallet const accounts = await (walletProvider ? walletProvider : provider)?.request({ diff --git a/docs/quick-start/developers/nft-dapp/_create_nft.md b/docs/quick-start/developers/nft-dapp/_create_nft.md index 75a6837..b7180ed 100644 --- a/docs/quick-start/developers/nft-dapp/_create_nft.md +++ b/docs/quick-start/developers/nft-dapp/_create_nft.md @@ -10,7 +10,7 @@ 2. Replace the form variable with this code snippet: -```javascript title="create-nft/index.tsx" +```tsx title="create-nft/index.tsx" // Step D - Configure NFT Form const form = useForm>({ resolver: zodResolver(formSchema), @@ -43,7 +43,7 @@ Let's write the functions to `Create New NFT Collection` on the aelf mainchain a - Replace the existing **`createNftCollectionOnMainChain`** function with this code snippet: -```javascript title="create-nft/index.tsx" +```tsx title="create-nft/index.tsx" // step 1 - Create New NFT Collection on MainChain Function const createNftCollectionOnMainChain = async (values: { tokenName: string; @@ -123,7 +123,7 @@ Next, we'll write the **Validate Collection Info Exist** function. - Replace the existing **`validateNftCollectionInfo`** function with this code snippet: -```javascript title="create-nft/index.tsx" +```tsx title="create-nft/index.tsx" // step 2 - Validate Collection information existence // This function validates if the token collection information already exists on the main blockchain. const validateNftCollectionInfo = async (values: INftInput) => { @@ -221,7 +221,7 @@ Next, we'll write the **Get the parent chain height** function. - Replace the existing **`GetParentChainHeight`** function with the following code snippet: -```javascript title="create-nft/index.tsx" +```tsx title="create-nft/index.tsx" // Step 3: Get the parent chain height // This function fetches the current height of the parent blockchain. const GetParentChainHeight = async () => { @@ -253,7 +253,7 @@ Next, we'll write the **Fetch the Merkle path** function. - Replace the existing **`getMerklePathByTxId`** function with this code snippet: -```javascript title="create-nft/index.tsx" +```tsx title="create-nft/index.tsx" // step 4 - Fetch the merkle path by transaction Id const getMerklePathByTxId = async (aelf: AElf, wallet: IWalletInfo) => { try { @@ -298,7 +298,7 @@ Next, we'll write the **Create a Collection on the cross-chain** function. - Replace the existing **`createCollectionOnSideChain`** function with this code snippet: -```javascript title="create-nft/index.tsx" +```tsx title="create-nft/index.tsx" // step 5 - Create a collection on the dAppChain const createCollectionOnSideChain = async ( transactionId: string, @@ -382,7 +382,7 @@ Now, let's write the create NFTs on mainchain function. 2. Replace the existing **`createNFTOnMainChain`** function with this code snippet: -```javascript title="create-nft/index.tsx" +```tsx title="create-nft/index.tsx" // step 6 - Create an NFT on the mainchain const createNFTOnMainChain = async (values: { tokenName: string; @@ -448,7 +448,7 @@ Now, let's write the Validate NFT Info Exist function. 2. Replace the existing **`validateNftToken`** function with this code snippet: -```javascript title="create-nft/index.tsx" +```tsx title="create-nft/index.tsx" // step 7 - Validate a NFT Token on MainChain const validateNftToken = async (values: INftParams) => { let validateNFTLoadingId: Id; @@ -556,7 +556,7 @@ Now, let's write the Create NFT on dAppChain function. 2. Replace the existing **`createNftTokenOnSideChain`** function with this code snippet: -```javascript title="create-nft/index.tsx" +```tsx title="create-nft/index.tsx" // step 8 - Create a NFT on dAppChain. const createNftTokenOnSideChain = async (values: INftValidateResult) => { let createSideChainNFTLoadingId: Id; @@ -609,7 +609,7 @@ Now, let's write the Issue NFT Function. 2. Replace the existing **`issueNftOnSideChain`** function with this code snippet: -```javascript title="create-nft/index.tsx" +```tsx title="create-nft/index.tsx" // step 9 - Issue a NFT Function which has been Created on dAppChain const issueNftOnSideChain = async (values: { symbol: string; @@ -669,7 +669,7 @@ Now, let's write the createNftToken Function. 2. Replace the existing **`createNftToken`** function with this code snippet: -```javascript title="create-nft/index.tsx" +```tsx title="create-nft/index.tsx" // step 10 - Call Necessary Function for Create NFT const createNftToken = async (values: INftParams) => { try { @@ -729,7 +729,7 @@ Now, let's Write a Function to Call Necessary Functions for NFT Creation. 2. Replace the existing **`onSubmit`** function with this code snippet: -```javascript title="create-nft/index.tsx" +```tsx title="create-nft/index.tsx" // Step 11 - Handle Submit Form const onSubmit = async (values: z.infer) => { setTransactionStatus(true); diff --git a/docs/quick-start/developers/nft-dapp/_fetch_nft_data.md b/docs/quick-start/developers/nft-dapp/_fetch_nft_data.md index 677a9d8..3b3b0bb 100644 --- a/docs/quick-start/developers/nft-dapp/_fetch_nft_data.md +++ b/docs/quick-start/developers/nft-dapp/_fetch_nft_data.md @@ -14,7 +14,7 @@ Let's write the Function for the fetch NFT data from user's Wallet using API. - Replace the existing **`getBalanceOfNft`** function with this code snippet: -```javascript title="commonFunctions.ts" +```ts title="commonFunctions.ts" // Function to get the balance of a specific NFT const getBalanceOfNft = async ( values: { @@ -23,7 +23,6 @@ const getBalanceOfNft = async ( }, sideChainSmartContract: IContract ): Promise => { - // @ts-ignore const { data }: { data: { balance: number } } = await sideChainSmartContract?.callViewMethod("getBalance", values); return data.balance; @@ -45,7 +44,7 @@ const getBalanceOfNft = async ( - Replace the existing **`fetchNftBalances`** function with this code snippet: -```javascript title="commonFunctions.ts" +```ts title="commonFunctions.ts" // Function to fetch balance information for an array of NFTs const fetchNftBalances = async ( nfts: Nft[], @@ -86,7 +85,7 @@ const fetchNftBalances = async ( - Replace the existing **`fetchUserNftData`** function with this code snippet: -```javascript title="commonFunctions.ts" +```ts title="commonFunctions.ts" // fetch NFT Data from eforest API export const fetchUserNftData = async ( currentWalletAddress: string, @@ -159,7 +158,7 @@ Now, Let's call **`fetchUserNftData`** on necessary page. - Replace the existing **`getNFTData`** function with this code snippet: -```javascript title="home/index.tsx" +```tsx title="home/index.tsx" // get NFT Data from User's wallet const getNFTData = async () => { const result = await fetchUserNftData( @@ -191,7 +190,7 @@ const getNFTData = async () => { - Replace the existing **`getNFTData`** function with this code snippet: -```javascript title="profile/index.tsx" +```tsx title="profile/index.tsx" // get NFT Data from User's wallet const getNFTData = async () => { const result = await fetchUserNftData( diff --git a/docs/quick-start/developers/nft-dapp/_frontend_project_setup.md b/docs/quick-start/developers/nft-dapp/_frontend_project_setup.md index d8b7f73..6ce0df6 100644 --- a/docs/quick-start/developers/nft-dapp/_frontend_project_setup.md +++ b/docs/quick-start/developers/nft-dapp/_frontend_project_setup.md @@ -87,7 +87,7 @@ export const tree = { #### Install necessary packages and libraries -- Run teh following command in the terminal: +- Run the following command in the terminal: diff --git a/docs/quick-start/developers/nft-dapp/_transfer_nft.md b/docs/quick-start/developers/nft-dapp/_transfer_nft.md index fa46fa1..b61d398 100644 --- a/docs/quick-start/developers/nft-dapp/_transfer_nft.md +++ b/docs/quick-start/developers/nft-dapp/_transfer_nft.md @@ -14,7 +14,7 @@ So now let's **Transfer NFT** to other wallet now. 2. Replace the form variable with this code snippet: -```javascript title="transfer-nft/index.tsx" +```tsx title="transfer-nft/index.tsx" // Configure NFT Transfer Form const form = useForm>({ resolver: zodResolver(formSchema), @@ -40,7 +40,7 @@ Now your form is ready for users to fill in the necessary details for their NFTs 2. Replace the form variable with this code snippet: -```javascript title="transfer-nft/index.tsx" +```tsx title="transfer-nft/index.tsx" // Transfer NFT to Other Wallet const transferNftToOtherAccount = async (values: { address: string; @@ -109,7 +109,7 @@ const transferNftToOtherAccount = async (values: { 2. Replace the form variable with this code snippet: -```javascript title="" +```tsx title="transfer-nft/index.tsx" // Handle Transfer Submit Form function onSubmit(values: z.infer) { transferNftToOtherAccount(values); @@ -122,4 +122,4 @@ function onSubmit(values: z.infer) { 2. **Parameters:** It takes `values`, which is inferred from the `formSchema` and represents the form's data. 3. **Calls Transfer Function:** It calls the `transferNftToOtherAccount` function with the form values to initiate the NFT transfer. -Now that we've written all the necessary frontend functions and components, we're ready to run the NFT dApp application in the next step. +Now that we've written all the necessary frontend functions and components, we're ready to run the NFT dApp in the next step.