Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: NFTChat High Level Fixes #938

Merged
merged 3 commits into from
Dec 22, 2023
Merged

fix: NFTChat High Level Fixes #938

merged 3 commits into from
Dec 22, 2023

Conversation

Aman035
Copy link
Member

@Aman035 Aman035 commented Dec 19, 2023

Fixes Issue

closes #937

Changes proposed

  • Fixed minor issues for NFT profile with High Level Class Fn
  • Added a reinitialize fn which lets the NFT owner to reset or fresh restart a NFT Account. ( Useful in case of NFT transfers without password acknowledgement )
   // Assuming userAlice is the new NFT Owner
   // The decryption of keys failed since the old signer does not match with new one and no password is provided.
   // SDK switches to Guest Mode
    userAlice = await PushAPI.initialize(
      new ethers.Wallet(
        `0x${process.env['NFT_HOLDER_WALLET_PRIVATE_KEY_1'] || ''}`
      ),
      {
        env,
        account: nftAccount1,
      }
    );
    
    // Error Log is Displayed to user

    // UserAlice Reinitialize for fresh start by providing a new password
    // Note : This works only when userAlice is the owner of the NFT 
    await userAlice.reinitialize({
      versionMeta: {
        NFTPGP_V1: { password: process.env['NFT_PROFILE_PASSWORD_1'] || '' },
      },
    });

Check List (Check all the applicable boxes)

  • My code follows the code style of this project.
  • My change requires changes to the documentation.
  • I have updated the documentation accordingly.
  • This PR does not contain plagiarized content.
  • The title of my pull request is a short description of the requested changes.

@Aman035 Aman035 linked an issue Dec 19, 2023 that may be closed by this pull request
Copy link

File: packages/examples/sdk-backend-node/.env.sample

All looks good.

File: packages/examples/sdk-backend-node/chat/index.ts

  • There are some commented lines of code that need to be removed.
  • The indentation seems to be incorrect. The lines starting with console.log and await statements should be indented inside the runChatUseCases function.

Here's the corrected code:

import { runChatLowlevelUseCases } from './chat.lowlevel';
import { runNFTChatLowLevelUseCases } from './nftChat.lowlevel';
import { runChatClassUseCases } from './chat';
import { runNFTChatClassUseCases } from './nftChat';

export const runChatUseCases = async (): Promise<void> => {
  console.log(`
░█████╗░██╗░░██╗

Copy link

File: packages/examples/sdk-backend-node/.env.sample

  • All looks good.

File: packages/examples/sdk-backend-node/chat/index.ts

  • There is a code block that seems to be commented out and broken. It should be removed or fixed.

File: packages/examples/sdk-backend-node/chat/nftChat.ts

  • The file is empty. It should contain code related to NFT chat functionality.

File: packages/examples/sdk-backend-node/package.json

  • All looks good.

File: packages/restapi/README.md

  • All looks good.

File: packages/restapi/src/lib/pushapi/PushAPI.ts

  • Line 84: There is a missing closing parenthesis at the end of the if statement. It should be added.

File: packages/restapi/src/lib/pushapi/chat.ts

  • The file is empty. It should contain code related to chat functionality.

Copy link

File: packages/examples/sdk-backend-node/.env.sample

WALLET PRIVATE KEY

WALLET_PRIVATE_KEY=your_channel_key

ENVIRONMENT OF PUSH NETWORK - prod, staging OR dev

PUSH_NODE_NETWORK=staging

TO ENABLE API RESPONSES TO BE SHOWN OR HIDDEN - true OR false

SHOW_API_RESPONSE=false

NFT CONTRACT ADDRESS

NFT_CONTRACT_ADDRESS_1=your_nft_contract_address

NFT CHAIN ID

NFT_CHAIN_ID_1=your_nft_chain_id

NFT TOKEN ID

NFT_TOKEN_ID_1=your_nft_token_id

NFT HOLDER WALLET PRIVATE KEY

NFT_HOLDER_WALLET_PRIVATE_KEY_1=your_nft_holder_wallet_private_key

NFT PROFILE WALLET PASSWORD

NFT_PROFILE_PASSWORD_1=your_nft_profile_password
NFT_CONTRACT_ADDRESS_2=your_nft_contract_address
NFT_CHAIN_ID_2=your_nft_chain_id
NFT_TOKEN_ID_2=your_nft_token_id
NFT_HOLDER_WALLET_PRIVATE_KEY_2=your_nft_holder_wallet_private_key
NFT_PROFILE_PASSWORD_2=your_nft_profile_password
NFT_CONTRACT_ADDRESS_3=your_nft_contract_address
NFT_CHAIN_ID_3=your_nft_chain_id
NFT_TOKEN_ID

@mohammeds1992 mohammeds1992 merged commit a4d9ba4 into main Dec 22, 2023
1 check passed
@Aman035 Aman035 deleted the fix-nft-chat branch March 6, 2024 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 [BUG] - NFT Chat Issue With High Level Class Functions
2 participants