@fluent-wallet/hw-app-conflux
Version:
Ledger Hardware Wallet Conflux Application API
66 lines • 2.41 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
import type Transport from "@ledgerhq/hw-transport";
/**
* Conflux API
*
* @param transport a transport for sending commands to a device
* @param scrambleKey a scramble key
*
* @example
* import Cfx from "@ledgerhq/hw-app-conflux";
* const cfx = new Cfx(transport)
*/
export default class Conflux {
transport: Transport;
chainId: number;
constructor(transport: Transport, chainId: number, scrambleKey?: string);
/**
* get Conflux address for a given BIP 32 path.
* @param path a path in BIP 32 format
* @option boolDisplay optionally enable or not the display
* @option boolChaincode optionally enable or not the chaincode request
* @return an object with a publicKey, address and (optionally) chainCode
* @example
* cfx.getAddress("44'/503'/0'/0/0").then(o => o.publicKey)
* cfx.getAddress("44'/503'/0'/0/0",true).then(o => o.publicKey): show mainnet address
*/
getAddress(path: string, boolDisplay?: boolean, boolChaincode?: boolean): Promise<{
publicKey: string;
address: string;
chainCode?: string;
}>;
private _legacy_signTransaction;
private _signTransaction;
/**
* You can sign a transaction and retrieve v, r, s given the raw transaction and the BIP 32 path of the account to sign
* @example
cfx.signTransaction("44'/503'/0'/0/0", "e8018504e3b292008252089428ee52a8f3d6e5d15f8b131996950d7f296c7952872bd72a2487400080").then(result => ...)
*/
signTransaction(path: string, rawTxHex: string): Promise<{
s: string;
v: string;
r: string;
}>;
private _getAppConfiguration;
getAppConfiguration(): Promise<{
name: string;
version: string;
flags: number | Buffer;
}>;
/**
* You can sign a message according to cfx_sign RPC call and retrieve v, r, s given the message and the BIP 32 path of the account to sign.
* @example cfx.signPersonalMessage("44'/503'/0'/0/0", Buffer.from("test").toString("hex"))
* @param path hdPath
* @param messageHex the hex string of the message
* @returns
*/
signPersonalMessage(path: string, messageHex: string): Promise<{
v: number;
s: string;
r: string;
}>;
private pathToBuffer;
private serializePath;
}
//# sourceMappingURL=Conflux.d.ts.map