Hi guys, I found the response data of the field price in API (https://docs.moralis.io/reference/getnfttrades) and SDK Moralis.EvmApi.nft.getNFTTrades are different because it misses the ‘wei’ in the SDK Code. I already created the PR for easy checking. Please help me double-check it, thank you
https://github.com/MoralisWeb3/Moralis-JS-SDK/pull/881
Can you give an example of how it is different?
Sure, here is the code
const today = `${startOfToday().toISOString().substring(0, 10)}T00:00:00.000Z`;
const yesterday = `${startOfYesterday().toISOString().substring(0, 10)}T00:00:00.000Z`;
const { result } = await this.moralisSrv.getTradeByMarket({
address: '0x9c57d0278199c931cf149cc769f37bb7847091e7',
chain: '0x1',
fromDate: yesterday,
toDate: today,
limit: LIMIT_PAGING,
});
this.logger.log(
`price.wei: ${result[0].price.wei} --- price.gwei: ${result[0].price.gwei} --- price.ether: ${result[0].price.ether} --- defaultPrice: ${result[0].price}`,
);
and here is the log
price.wei: 69990000000000000000000000000000000 --- price.gwei: 69990000000000000000000000.0 --- price.ether: 69990000000000000.0 --- defaultPrice: 69990000000000000000000000000000000
As you can see, the raw data from API is correct but the SDK format it to wrong type
1 Like
this PR should fix the issue:
Cool, thank for your help