@unisat/wallet-sdk
Version:
UniSat Wallet SDK
111 lines (110 loc) • 3.47 kB
TypeScript
/// <reference types="node" />
import bitcore from 'bitcore-lib';
import { EventEmitter } from 'events';
interface KeystoneKey {
path: string;
extendedPublicKey: string;
}
interface DeserializeOption {
mfp: string;
keys: KeystoneKey[];
hdPath?: string;
activeIndexes?: number[];
connectionType?: 'USB' | 'QR';
}
interface Wallet {
index: number;
publicKey: string;
path: string;
}
export declare class KeystoneKeyring extends EventEmitter {
static type: string;
type: string;
mfp: string;
keys: KeystoneKey[];
hdPath?: string;
activeIndexes?: number[];
root: bitcore.HDPublicKey;
connectionType?: 'USB' | 'QR';
page: number;
perPage: number;
origin: string;
constructor(opts?: DeserializeOption);
initFromUR(type: string, cbor: string, connectionType?: 'USB' | 'QR'): Promise<void>;
getHardenedPath(hdPath: string): string;
getHDPublicKey(hdPath: string): any;
getDefaultHdPath(): string;
getConnectionType(): "USB" | "QR";
initRoot(): void;
deserialize(opts: DeserializeOption): Promise<void>;
serialize(): Promise<DeserializeOption>;
addAccounts(numberOfAccounts?: number): Promise<any[]>;
addChangeAddressAccounts(numberOfAccounts?: number): Promise<any[]>;
getAccounts(): Promise<any[]>;
getAccounts2(): Promise<{
index: number;
path: string;
publicKey: any;
}[]>;
getAccountsWithBrand(): Promise<{
address: string;
index: number;
}[]>;
getWalletByIndex(index: number): Wallet;
getChangeAddressWalletByIndex(index: number): Wallet;
removeAccount(publicKey: string): void;
exportAccount(_publicKey: string): Promise<void>;
getFirstPage(): Promise<{
address: string;
index: number;
}[]>;
getNextPage(): Promise<{
address: string;
index: number;
}[]>;
getPreviousPage(): Promise<{
address: string;
index: number;
}[]>;
getAddresses(start: number, end: number): {
address: string;
index: number;
}[];
getPage(increment: number): Promise<{
address: string;
index: number;
}[]>;
activeAccounts(indexes: number[]): string[];
changeHdPath(hdPath: string): void;
changeChangeAddressHdPath(hdPath: string): any[];
getAccountByHdPath(hdPath: string, index: number): any;
getChangeAddressAccountByHdPath(hdPath: string, index: number): any;
genSignPsbtUr(psbtHex: string): Promise<{
type: string;
cbor: string;
}>;
parseSignPsbtUr(type: string, cbor: string): Promise<string>;
genSignMsgUr(publicKey: string, text: string): Promise<{
requestId: any;
type: string;
cbor: string;
}>;
parseSignMsgUr(type: string, cbor: string): Promise<import("@keystonehq/keystone-sdk").BtcSignature>;
signMessage(publicKey: string, text: string): Promise<string>;
genSignCosmosUr(cosmosSignRequest: {
requestId?: string;
signData: string;
dataType: any;
path: string;
chainId?: string;
accountNumber?: string;
address?: string;
}): Promise<{
requestId: any;
type: string;
cbor: string;
}>;
parseSignCosmosUr(type: string, cbor: string): Promise<import("@keystonehq/keystone-sdk").CosmosSignature>;
verifyMessage(publicKey: string, text: string, sig: string): Promise<any>;
}
export {};