Skip to content

v2.18.5

Compare
Choose a tag to compare
@0xFirekeeper 0xFirekeeper released this 13 Mar 14:51
· 24 commits to main since this release
613177f

What's Changed

// Instantiate Insight
var insight = await ThirdwebInsight.Create(client);

// Fetch current token price
var ethPriceToday = await insight.GetTokenPrice(addressOrSymbol: "ETH", chainId: 1);
Console.WriteLine($"ETH price today: {ethPriceToday.PriceUsd}");

// Fetch token price at specified timestamp
var ethPriceYesterday = await insight.GetTokenPrice(
  addressOrSymbol: "ETH",
  chainId: 1, 
  timestamp: Utils.GetUnixTimeStampNow() - 86400
);
Console.WriteLine($"ETH price yesterday: {ethPriceYesterday.PriceUsd}");

// Fetch multiple token prices across multiple chains
var multiTokenPrices = await insight.GetTokenPrices(
  addressOrSymbols: new string[] { "POL", "APE" },
  chainIds: new BigInteger[] { 137, 33139 }
);
Console.WriteLine($"Multi token prices: {JsonConvert.SerializeObject(multiTokenPrices, Formatting.Indented)}");