UNPKG

@onekeyfe/blockchain-libs

Version:
57 lines (56 loc) 2.55 kB
/// <reference types="node" /> import { AddressValidation, SignedTx, TypedMessage, UnsignedTx } from '../../../types/provider'; import { Signer, Verifier } from '../../../types/secret'; import { BaseProvider } from '../../abc'; import { BlockBook } from './blockbook'; import AddressEncodings from './sdk/addressEncodings'; import { Network } from './sdk/networks'; declare type GetAccountParams = { type: 'simple'; xpub: string; } | { type: 'details'; xpub: string; } | { type: 'history'; xpub: string; to?: number; }; declare class Provider extends BaseProvider { private _versionBytesToEncodings?; get network(): Network; get blockbook(): Promise<BlockBook>; get versionBytesToEncodings(): { public: Record<number, Array<AddressEncodings>>; private: Record<number, Array<AddressEncodings>>; }; private isValidExtendedKey; isValidXpub(xpub: string | Buffer): boolean; isValidXprv(xprv: string | Buffer): boolean; xprvToXpub(xprv: string): string; getAccount(params: GetAccountParams, addressEncoding?: AddressEncodings): Promise<any>; xpubToAddresses(xpub: string, relativePaths: Array<string>, addressEncoding?: AddressEncodings): Record<string, string>; pubkeyToAddress(verifier: Verifier, encoding: AddressEncodings): Promise<string>; verifyAddress(address: string): Promise<AddressValidation>; buildUnsignedTx(unsignedTx: UnsignedTx): Promise<UnsignedTx>; signTransaction(unsignedTx: UnsignedTx, signers: { [p: string]: Signer; }): Promise<SignedTx>; signMessage({ message }: TypedMessage, signer: Signer, address?: string): Promise<string>; verifyMessage(address: string, { message }: TypedMessage, signature: string): Promise<boolean>; private pubkeyToPayment; private parseAddressEncodings; private packTransaction; private collectInfoForSoftwareSign; collectTxs(txids: string[]): Promise<Record<string, string>>; get hardwareCoinName(): string; hardwareGetXpubs(paths: string[], showOnDevice: boolean): Promise<{ path: string; xpub: string; }[]>; hardwareGetAddress(path: string, showOnDevice: boolean, addressToVerify?: string): Promise<string>; hardwareSignTransaction(unsignedTx: UnsignedTx, signers: Record<string, string>): Promise<SignedTx>; hardwareSignMessage({ message }: TypedMessage, signer: string): Promise<string>; hardwareVerifyMessage(address: string, { message }: TypedMessage, signature: string): Promise<boolean>; } export { Provider };