import { InvalidFormatError } from '@neo-one/client-common' ; import { InvalidPolicyChangeTypeError } from '../errors' ; export enum PolicyChangeType { GasPerBlock = 0x00 , RegisterPrice = 0x01 , UnregisterCandidate = 0x02 , RegisterCandidate = 0x03 , RoleDesignation = 0x04 , FeePerByte = 0x05 , ExecFeeFactor = 0x06 , StoragePrice = 0x07 , BlockAccount = 0x08 , UnblockAccount = 0x09 , MinimumDeploymentFee = 0x0a } const isPolicyChangeType = ( value ) : value is PolicyChangeType => PolicyChangeType [ value ] !== undefined ; export const assertPolicyChangeType = ( value ) : PolicyChangeType => { if ( isPolicyChangeType ( value ) ) { return value ; } throw new InvalidPolicyChangeTypeError ( value ) ; } ; export type PolicyChangeTypeJSON = keyof typeof PolicyChangeType ; export const isPolicyChangeTypeJSON = ( state ) : state is PolicyChangeTypeJSON => PolicyChangeType [ state as any ] !== undefined ; export const assertPolicyChangeTypeJSON = ( state ) : PolicyChangeTypeJSON => { if ( isPolicyChangeTypeJSON ( state ) ) { return state ; } throw new InvalidFormatError ( ) ; } ; export const toPolicyChangeTypeJSON = ( state ) => assertPolicyChangeTypeJSON ( PolicyChangeType [ state ] ) ;