argus/src/lib/resolver-web.d.ts

103 lines
4.4 KiB
TypeScript
Raw Normal View History

export function normalizeName(input: any): string;
export function buildIndex({ electrum, WebSocket: WS, client, directIP }?: {
electrum?: {
url: string;
ip: string;
}[] | undefined;
directIP?: boolean | undefined;
}): Promise<Map<any, any>>;
export function resolveName(input: any, opts?: {}): Promise<any>;
export function parseElectrumRecord(records: any): ({
url: string;
ip: string;
} | {
url: string;
ip?: undefined;
})[];
export function getElectrumServers(index: any): ({
url: string;
ip: string;
} | {
url: string;
ip?: undefined;
})[];
export function fetchElectrumServers(opts?: {}): Promise<({
url: string;
ip: string;
} | {
url: string;
ip?: undefined;
})[]>;
export function parseTldsRecord(records: any): string[];
export function getBcnrTlds(index: any): string[];
export function fetchBcnrTlds(opts?: {}): Promise<string[]>;
export function isBcnrNativeTld(tldOrList: any, tld: any): boolean;
export interface ElectrumServer { url: string; ip?: string }
export interface BnsNetwork {
id: "chipnet" | "mainnet";
label: string;
prefix: "bchtest" | "bitcoincash";
beacon: string | null;
beaconScripthash: string | null;
tldBeacon: string | null;
tldBeaconScripthash: string | null;
electrum: ElectrumServer[];
beaconOnly: RegExp;
electrumListName: string;
rootTldName: string;
bootstrapTlds: string[];
startHeight: number | null;
hostingBucket: string;
nameListUrl: string;
cdnIndexUrl: string;
nostrTags: { names: string; tlds: string };
explorerTx: string;
faucets: { name: string; url: string }[];
operatorAddress: string | null;
accountPath: string;
bchnRpcPort: number;
blocklists: { name: string; beacon: string; scripthash?: string }[];
}
/** The transaction's single BNS payload; null when it has none or more than one. */
export function onlyPayload(vouts: any[]): any | null;
/** REG/TREG: is `mint` the only token of its category there is or can ever be? */
export function soleCertificate(tx: any, mint: any): boolean;
/** REL: does `tx` burn `entry`'s certificate, spending it from a beacon transaction in `txs`? */
export function burnsCertificate(tx: any, entry: { category: string }, txs: Map<string, any>): boolean;
/** One-block gap after a release. `releasedAt` undefined = never released. */
export function mayReRegister(releasedAt: number | undefined, height: number): boolean;
export interface BlockFlag {
name: string; reason: string; reportTxid: string; txid: string; height: number;
evidence: string | null; vote: string | null; source: string | null; address: string;
}
export function sha256(bytes: Uint8Array): Uint8Array;
export function addressToLockHex(address: string): string;
export function addressToScripthash(address: string): string;
export const BLOCK_REASONS: Set<string>;
/** Reduce one list's history to its current flags (pure). */
export function reduceBlocklist(o: { history: { tx_hash: string; height: number }[]; txs: Map<string, any> | Record<string, any>; address: string; source?: string | null }): Map<string, BlockFlag>;
export function blocklistAddress(list: { name?: string; beacon?: string }, index?: Map<string, any> | null): string | null;
export function buildBlocklists(o?: { network?: any; lists?: { name?: string; beacon?: string }[]; index?: Map<string, any> | null; electrum?: any; WebSocket?: any; client?: any; directIP?: boolean }): Promise<Map<string, BlockFlag & { sources: BlockFlag[] }>>;
export function withBlockFlag<T extends { name: string }>(entry: T, flags: Map<string, BlockFlag> | null): T;
export const NETWORKS: { chipnet: BnsNetwork; mainnet: BnsNetwork };
export const DEFAULT_NETWORK_ID: "chipnet";
export function networkIdFromEnv(): string;
export function getNetwork(idOrRecord?: string | BnsNetwork): BnsNetwork;
export const NETWORK: BnsNetwork;
export function requireBeacons(network?: string | BnsNetwork): BnsNetwork;
export const BEACON: string | null;
export const BEACON_SCRIPTHASH: string | null;
export const TLD_BEACON: string | null;
export const TLD_BEACON_SCRIPTHASH: string | null;
export const ELECTRUM: ElectrumServer[];
export const PREFIX: "BNS1";
export const TLD: ".bch";
export const DEFAULT_TLD: "bch";
export const CHIPNET_ELECTRUM: {
url: string;
ip: string;
}[];
export const ELECTRUM_LIST_NAME: string;
export const ROOT_TLD_NAME: string;
export const BOOTSTRAP_TLDS: string[];