blockfrost / blockfrost-js

Node.js SDK for the Blockfrost.io API.
https://blockfrost.io
Apache License 2.0
103 stars 25 forks source link

Wrong Metadata #125

Closed GregorWedlich closed 3 years ago

GregorWedlich commented 3 years ago

Hello,

when I call the API, I don't get the correct data from "metadataTxsLabels" but I get the data from "metadataTxsLabel".

When I call "metadataTxsLabel", I get:

{ status_code: 404, error: 'not found', message: 'The requested component was not found'. }

I think there is something wrong.

Regards.

vladimirvolek commented 3 years ago

Hi!

Thank you for your message. I will look into it.

GregorWedlich commented 3 years ago

I think I was mistaken. im not sure.

vladimirvolek commented 3 years ago

We have incorrect types in metadata endpoints. :/

GregorWedlich commented 3 years ago

No problem!

vladimirvolek commented 3 years ago

@TheLegendaryRainbowWarrior Please send your code.

GregorWedlich commented 3 years ago

@TheLegendaryRainbowWarrior Please send your code.

import { BlockFrostAPI } from '@blockfrost/blockfrost-js';

const contract = '....';

const API = new BlockFrostAPI({
  projectId: '...',
});

//const addressTXs = await API.metadataTxsLabels(contract);
const txLabels = await API.metadataTxsLabel(contract);

//console.log(addressTXs);
console.log(txLabels);

Output:

❯ node api.js

internal/process/esm_loader.js:74
    internalBinding('errors').triggerUncaughtException(
                              ^
{
  status_code: 404,
  error: 'Not Found',
  message: 'The requested component has not been found.'
}
vladimirvolek commented 3 years ago

What is the contract variable?

GregorWedlich commented 3 years ago

What is the contract variable?

contract = smart contract address

Sorry, that was my mistake, I wanted to query the Oracle metadata with the contract address, which is of course nonsense and must run via the label ID. Now everything works correctly and I get the data. I just wanted to test the API a little. Great stuff!

// Smart Contract address from PIGY Oracle
const contract = 'addr1w83xtd6pekdv93xkj4qz77a5edyuhcxeuvlwex3xm0afukgj73l65';

const API = new BlockFrostAPI({
  projectId: '<MY_PROJECT_ID>',
});

const addressTXs = await API.metadataTxsLabels(contract);
const txLabels = await API.metadataTxsLabel('247428');

console.log(addressTXs);
console.log(txLabels);
mkazlauskas commented 2 years ago

We have incorrect types in metadata endpoints. :/

The types are still incorrect for Transaction metadata endpoint