v2.3.0 (#12)
* FIX: getBlocks optional params * v2.3.0 - new minor version for mempool-js - Add support for Bisq API - Add support for Liquid API - Change the main object to export network objects. - Change README.md instructions. Co-authored-by: softsimon <softsimon@users.noreply.github.com>
This commit is contained in:
13
src/app/bisq/addresses.ts
Normal file
13
src/app/bisq/addresses.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { Address, AddressesInstance } from '../../interfaces/bisq/addresses';
|
||||
|
||||
export const useAddresses = (api: AxiosInstance): AddressesInstance => {
|
||||
const getAddress = async (params: { address: string }) => {
|
||||
const { data } = await api.get<Address>(`/block/${params.address}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
return {
|
||||
getAddress,
|
||||
};
|
||||
};
|
||||
27
src/app/bisq/blocks.ts
Normal file
27
src/app/bisq/blocks.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { Block, BlocksInstance } from '../../interfaces/bisq/blocks';
|
||||
|
||||
export const useBlocks = (api: AxiosInstance): BlocksInstance => {
|
||||
const getBlock = async (params: { hash: string }) => {
|
||||
const { data } = await api.get<Block>(`/block/${params.hash}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
const getBlocks = async (params: { index: number; length: number }) => {
|
||||
const { data } = await api.get<Block>(
|
||||
`/blocks/${params.index}/${params.length}`
|
||||
);
|
||||
return data;
|
||||
};
|
||||
|
||||
const getBlocksTipHeight = async () => {
|
||||
const { data } = await api.get<number>(`/blocks/tip/height`);
|
||||
return data;
|
||||
};
|
||||
|
||||
return {
|
||||
getBlock,
|
||||
getBlocks,
|
||||
getBlocksTipHeight,
|
||||
};
|
||||
};
|
||||
13
src/app/bisq/statistics.ts
Normal file
13
src/app/bisq/statistics.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { Stats, StatsInstance } from '../../interfaces/bisq/statistics';
|
||||
|
||||
export const useStatistics = (api: AxiosInstance): StatsInstance => {
|
||||
const getStats = async () => {
|
||||
const { data } = await api.get<Stats>(`/stats`);
|
||||
return data;
|
||||
};
|
||||
|
||||
return {
|
||||
getStats,
|
||||
};
|
||||
};
|
||||
21
src/app/bisq/transactions.ts
Normal file
21
src/app/bisq/transactions.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { Tx, TransactionsInstance } from '../../interfaces/bisq/transactions';
|
||||
|
||||
export const useTransactions = (api: AxiosInstance): TransactionsInstance => {
|
||||
const getTx = async (params: { txid: string }) => {
|
||||
const { data } = await api.get<Tx>(`/tx/${params.txid}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
const getTxs = async (params: { index: number; length: number }) => {
|
||||
const { data } = await api.get<Tx[]>(
|
||||
`/txs/${params.index}/${params.length}`
|
||||
);
|
||||
return data;
|
||||
};
|
||||
|
||||
return {
|
||||
getTx,
|
||||
getTxs,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user