Adding support for Asset Icon API endpoints

This commit is contained in:
softsimon 2021-12-20 23:25:44 +04:00
parent d238b1a779
commit 4893ff1d81
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7
3 changed files with 16 additions and 0 deletions

View File

@ -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)

View File

@ -7,6 +7,11 @@ export const useAssets = (api: AxiosInstance): AssetsInstance => {
return data;
};
const getAssetIcon = async (params: { asset_id: string }) => {
const { data } = await api.get<BinaryData>(`/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<string[]>(`/v1/assets/icons`);
return data;
};
return {
getAsset,
getAssetIcon,
getAssetTxs,
getAssetSupply,
getAssetsIcons,
};
};

View File

@ -16,6 +16,7 @@ interface AssetStats {
export interface AssetsInstance {
getAsset: (params: { asset_id: string }) => Promise<Asset>;
getAssetIcon: (params: { asset_id: string }) => Promise<BinaryData>;
getAssetTxs: (params: {
asset_id: string;
is_mempool: boolean;
@ -24,4 +25,5 @@ export interface AssetsInstance {
asset_id: string;
decimal: boolean;
}) => Promise<Asset>;
getAssetsIcons: () => Promise<string[]>
}