UNPKG

@okxweb3/coin-base

Version:
50 lines (49 loc) 2.99 kB
/// <reference types="node" /> import { CalcTxHashParams, DerivePriKeyParams, GetAddressParams, GetDerivedPathParam, GetRawTransactionParams, HardwareRawTransactionParam, MpcMessageParam, MpcRawTransactionParam, MpcTransactionParam, NewAddressParams, SignCommonMsgParams, SignTxParams, TypedMessage, ValidAddressParams, ValidPrivateKeyParams, ValidSignedTransactionParams, VerifyMessageParams } from './common'; import { BN } from './index'; export declare function secp256k1SignTest(privateKey: Buffer): boolean; export declare function makeSignature(v: number, r: Buffer, s: Buffer): string; export declare function intToHex(i: Number): string; export declare const toUnsigned: (num: BN) => Buffer; export declare function padWithZeroes(hexString: string, targetLength: number): string; export declare const fromSigned: (num: Buffer) => BN; export declare function ecdsaSign(msgHash: Buffer, privateKey: Buffer, chainId?: number): { v: number; r: Buffer; s: Buffer; }; declare abstract class BaseWallet { getRandomPrivateKey(): Promise<any>; getDerivedPrivateKey(param: DerivePriKeyParams): Promise<any>; getDerivedPrivateKeyOld(param: DerivePriKeyParams): Promise<any>; abstract getNewAddress(param: NewAddressParams): Promise<any>; abstract validAddress(param: ValidAddressParams): Promise<any>; abstract signTransaction(param: SignTxParams): Promise<any>; getDerivedPath(param: GetDerivedPathParam): Promise<any>; validPrivateKey(param: ValidPrivateKeyParams): Promise<any>; signMessage(param: SignTxParams): Promise<string>; signCommonMsg(params: SignCommonMsgParams): Promise<any>; verifyMessage(param: VerifyMessageParams): Promise<boolean>; ecRecover(message: TypedMessage, signature: string): Promise<string>; getAddressByPublicKey(param: GetAddressParams): Promise<any>; getMPCRawTransaction(param: MpcRawTransactionParam): Promise<any>; getMPCTransaction(param: MpcTransactionParam): Promise<any>; getMPCRawMessage(param: MpcRawTransactionParam): Promise<any>; getMPCSignedMessage(param: MpcMessageParam): Promise<any>; getHardWareRawTransaction(param: SignTxParams): Promise<any>; getHardWareSignedTransaction(param: HardwareRawTransactionParam): Promise<any>; getHardWareMessageHash(param: SignTxParams): Promise<any>; calcTxHash(param: CalcTxHashParams): Promise<string>; getRawTransaction(param: GetRawTransactionParams): Promise<string>; validSignedTransaction(param: ValidSignedTransactionParams): Promise<any>; estimateFee(param: SignTxParams): Promise<number>; } declare class SimpleWallet extends BaseWallet { mockAddress: string | undefined; mockPublicKey: string | undefined; mockData(mockAddress: string, mockPublicKey: string): void; getNewAddress(param: NewAddressParams): Promise<any>; validAddress(param: ValidAddressParams): Promise<any>; signTransaction(param: SignTxParams): Promise<any>; } export { BaseWallet, SimpleWallet };