import { AbiRange , BigNumber , ONE } from '@pigi/core-utils' ; import { AbiStateObject , AbiStateUpdate } from '../../src/app/serialization' ; import { TransactionResult } from '../../src/types' ; export class TestUtils { public static generateNSequentialStateUpdates ( numberOfUpdates ) { const stateUpdates = [ ] ; for ( let i = 0 ; i < numberOfUpdates ; i ++ ) { const stateObject = new AbiStateObject ( '0xbdAd2846585129Fc98538ce21cfcED21dDDE0a63' , '0x123456' ) ; const range = new AbiRange ( new BigNumber ( i * 100 ) , new BigNumber ( ( i + 0.5 ) * 100 ) ) ; const stateUpdate = new AbiStateUpdate ( stateObject , range , ONE , '0xbdAd2846585129Fc98538ce21cfcED21dDDE0a63' ) ; stateUpdates . push ( stateUpdate ) ; } return stateUpdates ; } public static generateNSequentialTransactionResults ( numberofUpdates ) { return this . generateNSequentialStateUpdates ( numberofUpdates ) . map ( ( abiStateUpdate ) : TransactionResult => { return { stateUpdate : abiStateUpdate , validRanges : [ abiStateUpdate . range ] , } ; } ) ; } }