@pgchain/blockchain-libs
Version:
PGWallet Blockchain Libs
34 lines (33 loc) • 1.84 kB
TypeScript
/// <reference types="node" />
import { starcoin_types } from '@starcoin/starcoin';
import { AddressValidation, SignedTx, TypedMessage, UnsignedTx } from '../../../types/provider';
import { Signer, Verifier } from '../../../types/secret';
import { BaseProvider } from '../../abc';
import { StcClient } from './starcoin';
declare class Provider extends BaseProvider {
get starcoin(): Promise<StcClient>;
buildUnsignedTx(unsignedTx: UnsignedTx): Promise<UnsignedTx>;
pubkeyToAddress(verifier: Verifier, encoding?: string): Promise<string>;
signTransaction(unsignedTx: UnsignedTx, signers: {
[p: string]: Signer;
}): Promise<SignedTx>;
verifyAddress(address: string): Promise<AddressValidation>;
signMessage({ message }: TypedMessage, signer: Signer, address?: string): Promise<string>;
verifyMessage(publicKey: string, // require pubkey here!!
{ message }: TypedMessage, signature: string): Promise<boolean>;
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(publicKey: string, // require pubkey here!!
{ message }: TypedMessage, signature: string): Promise<boolean>;
}
export declare const buildUnsignedRawTx: (unsignedTx: UnsignedTx, chainId: string) => [starcoin_types.RawUserTransaction, Uint8Array];
export declare const buildSignedTx: (senderPublicKey: string, rawSignature: Buffer, rawTxn: starcoin_types.RawUserTransaction) => {
txid: string;
rawTx: string;
};
export { Provider };