Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async getNumCoins (): Promise {
const getCoinTable = new Messages.GetCoinTable()
const response = await this.transport.call(Messages.MessageType.MESSAGETYPE_GETCOINTABLE, getCoinTable) as Event
if(response.message_type === Events.FAILURE) throw event
return (response.proto as Messages.CoinTable).getNumCoins()
}
public async getCoinTable (start: number = 0, end: number = start + 10): Promise {
const getCoinTable = new Messages.GetCoinTable()
getCoinTable.setStart(start)
getCoinTable.setEnd(end)
const response = await this.transport.call(Messages.MessageType.MESSAGETYPE_GETCOINTABLE, getCoinTable) as Event
if(response.message_type === Events.FAILURE) throw event
const coinTable = response.message as Messages.CoinTable.AsObject
return coinTable.tableList
}