import { BinaryReader , BinaryWriter , createSerializeWire , SerializableWire } from '@neo-one/client-common' ; import { DeserializeWireBaseOptions , DeserializeWireOptions } from '../Serializable' ; export interface PreparationPayloadCompactAdd { readonly validatorIndex : number ; readonly invocationScript : Buffer ; } export class PreparationPayloadCompact implements SerializableWire { public static deserializeWireBase ( options ) { const { reader } = options ; const validatorIndex = reader . readUInt16LE ( ) ; const invocationScript = reader . readVarBytesLE ( 1024 ) ; return new PreparationPayloadCompact ( { validatorIndex , invocationScript } ) ; } public static deserializeWire ( options ) { return this . deserializeWireBase ( { context : options . context , reader : new BinaryReader ( options . buffer ) } ) ; } public readonly validatorIndex : number ; public readonly invocationScript : Buffer ; public readonly serializeWire = createSerializeWire ( this . serializeWireBase ) ; public constructor ( { validatorIndex , invocationScript } ) { this . validatorIndex = validatorIndex ; this . invocationScript = invocationScript ; } public serializeWireBase ( writer ) { writer . writeInt16LE ( this . validatorIndex ) ; writer . writeVarBytesLE ( this . invocationScript ) ; } }