From 858331ffabde7806283c968d773ea0d41a8e02b3 Mon Sep 17 00:00:00 2001 From: Chris Maree Date: Thu, 14 Apr 2022 09:34:46 +0200 Subject: [PATCH] feat: add ability to define chains other than ethereum in calls (#3876) Signed-off-by: chrismaree --- packages/sdk/src/coingecko/coingecko.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/sdk/src/coingecko/coingecko.ts b/packages/sdk/src/coingecko/coingecko.ts index d7cc7faf57..c34771cdb6 100644 --- a/packages/sdk/src/coingecko/coingecko.ts +++ b/packages/sdk/src/coingecko/coingecko.ts @@ -40,11 +40,11 @@ class Coingecko { if (result.prices) return result.prices; throw new Error("Something went wrong fetching coingecko prices!"); } - async getContractDetails(contract_address: string, id = "ethereum") { - return this.call(`coins/${id}/contract/${contract_address.toLowerCase()}`); + async getContractDetails(contract_address: string, platform_id = "ethereum") { + return this.call(`coins/${platform_id}/contract/${contract_address.toLowerCase()}`); } - async getCurrentPriceByContract(contract_address: string, currency = "usd") { - const result = await this.getContractDetails(contract_address); + async getCurrentPriceByContract(contract_address: string, currency = "usd", platform_id = "ethereum") { + const result = await this.getContractDetails(contract_address, platform_id); const price = get(result, ["market_data", "current_price", currency], null); assert(price !== null, "No current price available for: " + contract_address); return [result.last_updated, price];