UNPKG

@zlattice/lattice-js

Version:

Lattice blockchain TypeScript SDK with dual module support (CJS + ESM)

58 lines 2.31 kB
import { type TransactionType } from "../../common/constants.js"; import { type Curve } from "../../common/constants.js"; import type { Addr, Hash, UInt64 } from "../../common/types/type.alias.js"; import { Result } from "neverthrow"; export declare class Transaction { number?: number; type: TransactionType; parentHash?: Hash; hub?: Addr[]; daemonHash?: Hash; codeHash?: Hash; owner: Addr; linker: Addr; amount?: UInt64; joule?: UInt64; difficulty?: UInt64; pow?: UInt64; proofOfWork?: string; payload?: string; timestamp?: UInt64; code?: string; sign?: string; constructor(number: number, type: TransactionType, parentHash: Hash, hub: Addr[], daemonHash: Hash, codeHash: Hash, owner: Addr, linker: Addr, amount: UInt64, joule: UInt64, difficulty: UInt64, pow: UInt64, proofOfWork: string, payload: string, timestamp: UInt64, code: string, sign: string); getTypeCode(): number; static default(): Transaction; /** * Validate the transaction * @returns The error or null */ validate(): Result<null, Error>; /** * Sign the transaction * @param chainId - The chain id of the transaction * @param curve - The curve of the transaction * @param privateKey - The private key of the transaction * @returns The transaction signature */ signTx(chainId: number, curve: Curve, privateKey: string): Result<string, Error>; /** * Sign the hash of the transaction * @param hash - The hash of the transaction * @param curve - The curve of the transaction * @param privateKey - The private key of the transaction * @returns The transaction signature */ signHash(hash: Buffer, curve: Curve, privateKey: string): Result<string, Error>; /** * Sign the hash of the transaction * @param curve - The curve of the transaction * @param hash - The hash of the transaction * @param privateKey - The private key of the transaction * @returns The transaction signature(buffer) */ doSign(curve: Curve, hash: Buffer, privateKey: string): Result<Buffer, Error>; handleNumber(value: number | Uint8Array): Uint8Array; rlpEncodeHash(chainId: number, curve: Curve): Buffer; } //# sourceMappingURL=transaction.d.ts.map