import { U64 } from "codechain-primitives" ; import { Transaction } from "../Transaction" ; import { NetworkId } from "../types" ; export interface CustomActionJSON { handlerId : string ; bytes : number [ ] ; } export class Custom extends Transaction { private readonly handlerId : U64 ; private readonly bytes : Buffer ; constructor ( params , networkId ) { super ( networkId ) ; this . handlerId = params . handlerId ; this . bytes = params . bytes ; } public type ( ) { return "custom" ; } protected actionToEncodeObject ( ) { const { handlerId , bytes } = this ; return [ 0xff , handlerId . toEncodeObject ( ) , bytes ] ; } protected actionToJSON ( ) { const { handlerId , bytes } = this ; return { handlerId : handlerId . toJSON ( ) , bytes : [ ... bytes ] } ; } }