Skip to content

Commit

Permalink
fix: changed of pr-review
Browse files Browse the repository at this point in the history
  • Loading branch information
RutvikGhaskataEalf committed Jan 6, 2025
1 parent cc6ba65 commit 93a0c58
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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({
Expand Down
24 changes: 12 additions & 12 deletions docs/quick-start/developers/nft-dapp/_create_nft.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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<typeof formSchema>) => {
setTransactionStatus(true);
Expand Down
11 changes: 5 additions & 6 deletions docs/quick-start/developers/nft-dapp/_fetch_nft_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -23,7 +23,6 @@ const getBalanceOfNft = async (
},
sideChainSmartContract: IContract
): Promise<number> => {
// @ts-ignore
const { data }: { data: { balance: number } } =
await sideChainSmartContract?.callViewMethod("getBalance", values);
return data.balance;
Expand All @@ -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[],
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:

<Tabs>
<TabItem value="Linux and macOs" label="Linux and macOs" default>
Expand Down
8 changes: 4 additions & 4 deletions docs/quick-start/developers/nft-dapp/_transfer_nft.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
Expand All @@ -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;
Expand Down Expand Up @@ -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<typeof formSchema>) {
transferNftToOtherAccount(values);
Expand All @@ -122,4 +122,4 @@ function onSubmit(values: z.infer<typeof formSchema>) {
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.

0 comments on commit 93a0c58

Please sign in to comment.