import { add0x , getLogger , serializeObject } from '@pigi/core-utils' ; import { isTransferTransaction , SignedTransaction , RollupTransaction , Transfer , RollupBlock , } from '../../types' ; import { abi , signedTransactionAbiTypes , transferAbiTypes } from './common' ; const log = getLogger ( 'abiEncoders' ) ; param signedTransaction returns export const abiEncodeSignedTransaction = ( signedTransaction ) : string => { log . debug ( `ABI encoding SignedTransaction: ${ serializeObject ( signedTransaction ) }` ) ; return abi . encode ( signedTransactionAbiTypes , [ signedTransaction . signature , abiEncodeTransaction ( signedTransaction . transaction ) , ] ) ; } ; param transaction returns export const abiEncodeTransaction = ( transaction ) : string => { if ( isTransferTransaction ( transaction ) ) { return abiEncodeTransfer ( transaction ) ; } const message = `Unknown transaction type: ${ JSON . stringify ( transaction ) }` ; log . error ( message ) ; throw Error ( message ) ; } ; export const abiEncodeRollupBlock = ( rollupBlock ) : string => { return '' ; } ; /*********************
 * PRIVATE FUNCTIONS *
 *********************/ param transfer returns const abiEncodeTransfer = ( transfer ) : string => { log . debug ( `ABI encoding Transfer: ${ serializeObject ( transfer ) }` ) ; return abi . encode ( transferAbiTypes , [ add0x ( transfer . sender ) , add0x ( transfer . recipient ) , transfer . tokenType , transfer . amount , ] ) ; } ;