import { SimpleServer } from '@pigi/core-utils' ; import { RollupAggregator } from './rollup-aggregator' ; import { Address , SignedStateReceipt , SignedTransaction } from '../index' ; import { AGGREGATOR_API , UNISWAP_ADDRESS } from '../common' ; export class AggregatorServer extends SimpleServer { public constructor ( aggregator , hostname , port , middleware ? ) { const methods = { [ AGGREGATOR_API . getState ] : async ( account ) : Promise < SignedStateReceipt > => aggregator . getState ( account ) , [ AGGREGATOR_API . getUniswapState ] : async ( ) : Promise < SignedStateReceipt > => aggregator . getState ( UNISWAP_ADDRESS ) , [ AGGREGATOR_API . applyTransaction ] : async ( signedTransaction ) : Promise < SignedStateReceipt [ ] > => aggregator . applyTransaction ( signedTransaction ) , [ AGGREGATOR_API . requestFaucetFunds ] : async ( signedTransaction ) : Promise < SignedStateReceipt > => aggregator . requestFaucetFunds ( signedTransaction ) , [ AGGREGATOR_API . getTransactionCount ] : async ( ) : Promise < number > => aggregator . getTransactionCount ( ) , } ; super ( methods , hostname , port , middleware ) ; } }