2021-07-26 15:40:37 +02:00
|
|
|
type Utxo = {
|
|
|
|
height: number;
|
|
|
|
value: number;
|
|
|
|
address: string;
|
|
|
|
txId: string;
|
|
|
|
vout: number;
|
|
|
|
wif?: string;
|
|
|
|
};
|
|
|
|
|
2022-09-03 00:48:07 +01:00
|
|
|
export type ElectrumTransaction = {
|
2021-07-26 15:40:37 +02:00
|
|
|
txid: string;
|
|
|
|
hash: string;
|
|
|
|
version: number;
|
|
|
|
size: number;
|
|
|
|
vsize: number;
|
|
|
|
weight: number;
|
|
|
|
locktime: number;
|
|
|
|
vin: {
|
|
|
|
txid: string;
|
|
|
|
vout: number;
|
|
|
|
scriptSig: { asm: string; hex: string };
|
|
|
|
txinwitness: string[];
|
|
|
|
sequence: number;
|
2022-09-03 00:48:07 +01:00
|
|
|
addresses?: string[];
|
2021-07-26 15:40:37 +02:00
|
|
|
}[];
|
|
|
|
vout: {
|
|
|
|
value: number;
|
|
|
|
n: number;
|
|
|
|
scriptPubKey: {
|
|
|
|
asm: string;
|
|
|
|
hex: string;
|
|
|
|
reqSigs: number;
|
|
|
|
type: string;
|
|
|
|
addresses: string[];
|
|
|
|
};
|
|
|
|
}[];
|
|
|
|
blockhash: string;
|
2021-08-27 16:14:29 +01:00
|
|
|
confirmations?: number;
|
2021-07-26 15:40:37 +02:00
|
|
|
time: number;
|
|
|
|
blocktime: number;
|
|
|
|
};
|
|
|
|
|
2021-08-26 22:38:30 +01:00
|
|
|
type MempoolTransaction = {
|
|
|
|
height: 0;
|
|
|
|
tx_hash: string; // eslint-disable-line camelcase
|
|
|
|
fee: number;
|
|
|
|
};
|
|
|
|
|
2021-08-10 21:53:02 +02:00
|
|
|
export async function connectMain(): Promise<void>;
|
|
|
|
|
2021-08-04 22:23:57 +02:00
|
|
|
export async function waitTillConnected(): Promise<boolean>;
|
|
|
|
|
|
|
|
export function forceDisconnect(): void;
|
|
|
|
|
2021-07-26 15:40:37 +02:00
|
|
|
export function getBalanceByAddress(address: string): Promise<{ confirmed: number; unconfirmed: number }>;
|
|
|
|
|
|
|
|
export function multiGetUtxoByAddress(addresses: string[]): Promise<Record<string, Utxo[]>>;
|
|
|
|
|
|
|
|
// TODO: this function returns different results based on the value of `verbose`, consider splitting it into two
|
|
|
|
export function multiGetTransactionByTxid(
|
|
|
|
txIds: string[],
|
|
|
|
batchsize: number = 45,
|
|
|
|
verbose: true = true,
|
2022-09-03 00:48:07 +01:00
|
|
|
): Promise<Record<string, ElectrumTransaction>>;
|
2021-07-26 15:40:37 +02:00
|
|
|
export function multiGetTransactionByTxid(txIds: string[], batchsize: number, verbose: false): Promise<Record<string, string>>;
|
|
|
|
|
2022-09-03 00:48:07 +01:00
|
|
|
export function getTransactionsByAddress(address: string): ElectrumTransaction[];
|
2021-07-26 15:40:37 +02:00
|
|
|
|
2021-08-26 22:38:30 +01:00
|
|
|
export function getMempoolTransactionsByAddress(address: string): Promise<MempoolTransaction[]>;
|
|
|
|
|
2021-07-26 15:40:37 +02:00
|
|
|
export function estimateCurrentBlockheight(): number;
|
|
|
|
|
2022-09-10 12:11:28 +01:00
|
|
|
export type ElectrumHistory = {
|
2022-09-03 00:48:07 +01:00
|
|
|
tx_hash: string; // eslint-disable-line camelcase
|
|
|
|
height: number;
|
|
|
|
address: string;
|
2022-09-10 12:11:28 +01:00
|
|
|
};
|
2022-09-03 00:48:07 +01:00
|
|
|
|
|
|
|
export function multiGetHistoryByAddress(addresses: string[]): Promise<Record<string, ElectrumHistory[]>>;
|
2021-07-26 15:40:37 +02:00
|
|
|
|
2021-08-26 22:38:30 +01:00
|
|
|
export function estimateFees(): Promise<{ fast: number; medium: number; slow: number }>;
|
|
|
|
|
2021-07-26 15:40:37 +02:00
|
|
|
export function broadcastV2(txhex: string): Promise<string>;
|
2022-03-13 19:28:45 +00:00
|
|
|
|
2022-09-03 00:48:07 +01:00
|
|
|
export function getTransactionsFullByAddress(address: string): Promise<ElectrumTransaction[]>;
|
2022-06-21 13:43:28 +01:00
|
|
|
|
2022-09-03 00:48:07 +01:00
|
|
|
export function txhexToElectrumTransaction(txhes: string): ElectrumTransaction;
|
2022-09-05 19:34:02 +01:00
|
|
|
|
|
|
|
export function isDisabled(): Promise<boolean>;
|