Skip to content

Commit

Permalink
feat: add ability to define chains other than ethereum in calls (UMAp…
Browse files Browse the repository at this point in the history
…rotocol#3876)

Signed-off-by: chrismaree <[email protected]>
  • Loading branch information
chrismaree authored Apr 14, 2022
1 parent d472e17 commit 858331f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/sdk/src/coingecko/coingecko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 858331f

Please sign in to comment.