@xchainjs/xchain-dash
Version:
Custom Dash client and utilities used by XChainJS clients
146 lines (145 loc) • 4.25 kB
TypeScript
import { Network } from '@xchainjs/xchain-client';
/**
* Parameters for fetching address details from the Insight API.
*/
export type InsightAddressParams = {
network: Network;
address: string;
pageNum?: number;
};
/**
* Response structure for address details fetched from the Insight API.
*/
export type InsightAddressResponse = {
addrStr: string;
balance: number;
balanceSat: number;
totalReceived: number;
totalReceivedSat: number;
totalSent: number;
totalSentSat: number;
txAppearances: number;
txApperances: number;
unconfirmedAppearances: number;
unconfirmedBalance: number;
unconfirmedBalanceSat: number;
unconfirmedTxApperances: number;
};
/**
* Parameters for fetching transaction details from the Insight API.
*/
export type InsightTransactionParams = {
network: Network;
txid: string;
};
/**
* Response structure for transaction details fetched from the Insight API.
*/
export type InsightTxResponse = {
blockhash: string;
blockheight: number;
blocktime: number;
cbTx: {
height: number;
merkleRootMNList: string;
merkleRootQuorums: string;
version: number;
};
confirmations: number;
extraPayload: string;
extraPayloadSize: number;
isCoinBase: boolean;
locktime: number;
size: number;
time: number;
txid: string;
txlock: boolean;
type: number;
valueOut: number;
version: number;
vin: [
{
addr: string;
doubleSpentTxID: string;
n: number;
scriptSig: {
asm: string;
hex: string;
};
sequence: number;
txid: number;
value: number;
valueSat: number;
}
];
vout: [
{
n: number;
scriptPubKey: {
addresses: string[];
asm: string;
hex: string;
type: string;
};
spentHeight: number;
spentIndex: number;
spentTxId: string;
value: string;
}
];
};
/**
* Raw transaction data fetched from the Insight API.
*/
export type InsightRawTx = string;
/**
* Response structure for UTXO details fetched from the Insight API.
*/
export type InsightUtxoResponse = {
address: string;
txid: string;
vout: number;
scriptPubKey: string;
amount: number;
satoshis: number;
height: number;
confirmations: number;
};
/**
* Fetch address details from the Insight API.
*
* @param {InsightAddressParams} p Parameters for fetching address details.
* @returns {Promise<InsightAddressResponse>} Address details fetched from the Insight API.
*/
export declare const getAddress: (p: InsightAddressParams) => Promise<InsightAddressResponse>;
/**
* Fetch transactions associated with an address from the Insight API.
*
* @param {InsightAddressParams} p Parameters for fetching address transactions.
* @returns {Promise<{ txs: InsightTxResponse[]; pagesTotal: number }>} Transactions associated with the address.
*/
export declare const getAddressTxs: (p: InsightAddressParams) => Promise<{
txs: InsightTxResponse[];
pagesTotal: number;
}>;
/**
* Fetch UTXOs associated with an address from the Insight API.
*
* @param {InsightAddressParams} p Parameters for fetching address UTXOs.
* @returns {Promise<InsightUtxoResponse[]>} UTXOs associated with the address.
*/
export declare const getAddressUtxos: (p: InsightAddressParams) => Promise<InsightUtxoResponse[]>;
/**
* Fetch transaction details from the Insight API.
*
* @param {InsightTransactionParams} p Parameters for fetching transaction details.
* @returns {Promise<InsightTxResponse>} Transaction details fetched from the Insight API.
*/
export declare const getTx: (p: InsightTransactionParams) => Promise<InsightTxResponse>;
/**
* Fetch raw transaction data from the Insight API.
*
* @param {InsightTransactionParams} p Parameters for fetching raw transaction data.
* @returns {Promise<InsightRawTx>} Raw transaction data fetched from the Insight API.
*/
export declare const getRawTx: (p: InsightTransactionParams) => Promise<InsightRawTx>;