2

enter image description here

export const callApi = async (endPoint: string) => { try { const request: string = env.REACT_APP_BLOCKFROST_URL + endPoint const response = await fetch(request, { //@ts-ignore headers: { "Content-Type": "application/json", project_id: process.env.REACT_APP_BLOCKFROST_KEY, }, method: "GET", }) let data = await response.json() return data } catch (error) {} }

export const findAssets = async (stakeAddress: string) => { const endPoint = accounts/${stakeAddress}/addresses/assets const result = await callApi(endPoint)

return result } enter image description here

2 Answers 2

2

As you can see in the error message, the address you provide is not in the expected format.

Addresses on testnets start with "addr_test1" but the address you provide starts with "addr1" (probably a mainnet address).

Try to add a testnet address to the request and it should work.

Example testnet address: addr_test1qpmtp5t0t5y6cqkaz7rfsyrx7mld77kpvksgkwm0p7en7qum7a589n30e80tclzrrnj8qr4qvzj6al0vpgtnmrkkksnqd8upj0

Also note that you probably want to use the PreProd network instead of the testnet. Testnet has been broken a while ago.

2
  • Thanks for your great answer!
    – Bzzard
    Nov 2, 2022 at 13:25
  • You're welcome. I see you're new here. If this has answered your question, you can mark the answer as accepted.
    – eddex
    Nov 2, 2022 at 15:24
0

As mentioned in the error message, you're using invalid (mainnet) address against testnet endpoint

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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