Moralis does not fetch sub account address in user section.dont know what I am doing wrong but I am be able to mint NFTs only with my main address on metamask
I think that you have to authenticate with that account 2 first, if the problem is not seeing that account in that User table
I am trying to get the current User by
let user = Moralis.User.current();
should i re authenticate with that user?
can you explain again what is the problem?
I donβt understand the connection between the original post and this question
I have Account1 and Account2 in metamask as you see .metamask does not popup while I am using Account 2 for minting NFT through the Dapp.so as a result its not adding that address to Moralis Users in dashboard,but I have no issue while I am using Account1
I think that you only need to select/activate account 2 in MetaMask, use enableWeb() if needed and that should be all
async function submit(){
Moralis.enableWeb3();
let user = Moralis.User.current();
const input = document.querySelector('#input_image');
let data = input.files[0]
console.log(data)
const imageFile = new Moralis.File(data.name, data)
await imageFile.saveIPFS();
let imageHash = imageFile.hash();
let metadata = {
name: name,
description: description,
price: price,
image: "/ipfs/" + imageHash
}
console.log(metadata);
const jsonFile = new Moralis.File("metadata.json", {base64 : btoa(JSON.stringify(metadata))});
await jsonFile.saveIPFS();
let metadataHash = jsonFile.hash();
console.log(jsonFile.ipfs())
let res = await Moralis.Plugins.rarible.lazyMint({
chain: 'rinkeby',
userAddress: user.get('ethAddress'),
//Account Maybe
tokenType: 'ERC721',
tokenUri: 'ipfs://' + metadataHash,
royaltiesAmount: 5, // 0.05% royalty. Optional
})}
this is my function when i submit to mint NFT
i am kind of new and using rarible plugin for minting ,idk how to fix it i am calling enableweb3() but dont know how to initiate it for account2
try to change the account in metamask directly