import { BigNumber } from 'ethers' ; export function addHex ( a , b ) { return BigNumber . from ( a ) . add ( BigNumber . from ( b ) ) . toHexString ( ) ; } export function subHex ( a , b ) { return BigNumber . from ( a ) . sub ( BigNumber . from ( b ) ) . toHexString ( ) ; } export function eqHex ( a , b ) { return BigNumber . from ( a ) . eq ( b ) ; } export function eqHexArray ( a , b ) { return ( a . length === b . length && a . reduce ( ( equalsSoFar , aVal , idx ) => equalsSoFar && eqHex ( aVal , b [ idx ] ) , true ) ) ; } export function toHex ( a ) { return BigNumber . from ( a ) . toHexString ( ) ; } export function fromHex ( a ) { return BigNumber . from ( a ) . toNumber ( ) ; }