necjs
Version:
NECJS SDK for NCOG Earth Chain RPC
60 lines (59 loc) • 1.92 kB
TypeScript
import type { Provider } from './provider';
export interface TxParams {
from: string;
nonce: any;
gasPrice: string;
gasLimit?: string;
gas?: string;
to: string;
value: string;
data?: string;
chainId?: number;
}
export interface MlKem {
keyGen(): Promise<{
pubKey: string;
privKey: string;
}>;
encrypt(pubKey: string, message: string): Promise<{
encryptedData: string;
version: string;
}>;
decrypt(privKey: string, encryptedData: string, version: string): Promise<string>;
symEncrypt(ssKey: string, message: string): Promise<{
encryptedData: string;
version: string;
}>;
symDecrypt(ssKey: string, encryptedData: string, version: string): Promise<string>;
privateKeyToAddress(privateKey: string): string;
signTransactionMLDSA87: (TxObject: any, privateKeyHex: string) => any;
decodeRLPTransaction: (txHex: string) => any;
}
export declare class Wallet {
mlkem: MlKem;
privateKey: string;
readonly address: string;
private constructor();
static create(hexPrivateKey: string): Promise<Wallet>;
connect(provider: Provider): Signer;
/**
* Unified connect: creates a Wallet, Provider, and Signer in one call.
* @param hexPrivateKey The private key as a hex string.
* @param providerUrl The RPC URL (optional, defaults to http://localhost:8545)
* @returns { signer, provider, address }
*/
static connect(hexPrivateKey: string, providerUrl?: string): Promise<{
signer: Signer;
provider: Provider;
address: string;
}>;
}
export declare class Signer {
private provider;
private wallet;
constructor(provider: Provider, wallet: Wallet);
get address(): string;
getAddress(): Promise<string>;
sendTransaction(txParams: TxParams): Promise<string>;
decode(rawSigned: string): Promise<any>;
}