This is a screenshot of console log for my problem
export const deriveStakeAddress = async ( rewardAddress: string ):
Promise<string> => {
const endPoint = `addresses/${rewardAddress}`;
const request: string = 'https://cardano-mainnet.blockfrost.io/api/v0/' + endPoint
console.log("Request:", request);
const response = await fetch(request, {
//@ts-ignore
headers: {
"Content-Type": "application/json",
project_id: process.env.REACT_APP_BLOCKFROST_KEY
},
method: "GET",
});
const result = await response.json();
console.log("Stake address: ", result);
return result.stake_address;
};
export const findAssets = async (networkId: number, stakeAddress: string) =>
{
const endPoint = `accounts/${stakeAddress}/addresses/assets`;
const request: string = 'https://cardano-mainnet.blockfrost.io/api/v0/' + endPoint;
console.log("Request:", request);
const response = await fetch(request, {
//@ts-ignore
headers: {
"Content-Type": "application/json",
project_id: process.env.REACT_APP_BLOCKFROST_KEY
},
method: "GET",
});
const result = await response.json();
console.log("Assets: ", result);
return result;
};
And then I called above functions as following.
const walletAddress: string = 'addr1qxzpuc....6vexzc';
const stakeAddress: string = await deriveStakeAddress( walletAddress );
const assets = await findAssets( stakeAddress );
But I faced errors for some wallets such as Yoroi, Eternl.
On the other hand, there was no errors for Nami wallet. (here)