From 4893ff1d815d97826a33228e7e049ea22b71c164 Mon Sep 17 00:00:00 2001 From: softsimon Date: Mon, 20 Dec 2021 23:25:44 +0400 Subject: [PATCH] Adding support for Asset Icon API endpoints --- README-liquid.md | 2 ++ src/app/liquid/assets.ts | 12 ++++++++++++ src/interfaces/liquid/assets.ts | 2 ++ 3 files changed, 16 insertions(+) diff --git a/README-liquid.md b/README-liquid.md index 67da57510..8679c12c9 100644 --- a/README-liquid.md +++ b/README-liquid.md @@ -16,8 +16,10 @@ Interface to access Liquid APIs. - [Get Address Txs Utxo](#get-address-txs-utxo) - Assets - [Get Asset](#get-asset) + - [Get Asset Icon](#get-asset-icon) - [Get Asset Txs](#get-asset-txs) - [Get Asset Supply](#get-asset-supply) + - [Get Assets Icons](#get-assets-icons) - Blocks - [Get Block](#get-block) - [Get Block Status](#get-block-status) diff --git a/src/app/liquid/assets.ts b/src/app/liquid/assets.ts index e69dcb585..de02d7552 100644 --- a/src/app/liquid/assets.ts +++ b/src/app/liquid/assets.ts @@ -7,6 +7,11 @@ export const useAssets = (api: AxiosInstance): AssetsInstance => { return data; }; + const getAssetIcon = async (params: { asset_id: string }) => { + const { data } = await api.get(`/v1/asset/${params.asset_id}/icon`); + return data; + }; + const getAssetTxs = async (params: { asset_id: string; is_mempool: boolean; @@ -29,9 +34,16 @@ export const useAssets = (api: AxiosInstance): AssetsInstance => { return data; }; + const getAssetsIcons = async () => { + const { data } = await api.get(`/v1/assets/icons`); + return data; + }; + return { getAsset, + getAssetIcon, getAssetTxs, getAssetSupply, + getAssetsIcons, }; }; diff --git a/src/interfaces/liquid/assets.ts b/src/interfaces/liquid/assets.ts index 068553b12..9c72b983d 100644 --- a/src/interfaces/liquid/assets.ts +++ b/src/interfaces/liquid/assets.ts @@ -16,6 +16,7 @@ interface AssetStats { export interface AssetsInstance { getAsset: (params: { asset_id: string }) => Promise; + getAssetIcon: (params: { asset_id: string }) => Promise; getAssetTxs: (params: { asset_id: string; is_mempool: boolean; @@ -24,4 +25,5 @@ export interface AssetsInstance { asset_id: string; decimal: boolean; }) => Promise; + getAssetsIcons: () => Promise }