UNPKG

dpos-offline

Version:

Offline Signing Transactions for DPOS Blockchains

44 lines (43 loc) 1.64 kB
/// <reference types="node" /> import { As } from 'type-tagger'; import { Overwrite } from 'utility-types'; import { Address } from '../../interface'; import { IBaseTx, IBaseTxCodec } from '../base'; export declare type LiskTransaction<AssetType> = { recipientId: Address; senderId: Address; amount: number; senderPublicKey: Buffer & As<'publicKey'>; requesterPublicKey?: Buffer & As<'publicKey'>; timestamp: number; fee: number; asset: AssetType; type: number; id: string; signature?: Buffer & As<'signature'>; signSignature?: Buffer & As<'signature'>; signatures?: Array<Buffer & As<'signature'>>; }; export declare type PostableLiskTransaction<T> = Overwrite<LiskTransaction<T>, { amount: string; fee: string; senderPublicKey: string; requesterPublicKey?: string; signature?: string; signSignature?: string; signatures?: string[]; }>; export declare abstract class BaseLiskCodec<T> implements IBaseTxCodec<LiskTransaction<T>, PostableLiskTransaction<T>> { readonly identifier: string; readonly type: number; constructor(type: number, identifier: string); calcBytes(tx: LiskTransaction<T>): Buffer; calcFullBytes(tx: LiskTransaction<T>): Buffer; fromPostable(ptx: PostableLiskTransaction<T>): LiskTransaction<T>; toPostable(tx: LiskTransaction<T>): PostableLiskTransaction<T>; transform(from: IBaseTx): LiskTransaction<T>; abstract calcFees(tx: IBaseTx): number; createNonce(): string & As<"nonce">; fromBytes(buff: Buffer): LiskTransaction<T>; protected abstract assetBytes(tx: LiskTransaction<T>): Buffer; }