1

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)

1 Answer 1

1

The first error happens because there are no transactions for the address you try to query on the blockchain. If the address was never used, this endpoint returns a 404 error.

The second error seems to happen because you pass in 'undefined' instead of an actual stake key when building the URL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.