Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | 76x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 6x 5x 29x 1x | import {ABISerializableConstructor, APIClient, NameType} from '@wharfkit/antelope'
import * as Types from './types'
export class LightAPIClient {
constructor(private client: APIClient) {}
get_networks() {
return this.callJson<Types.NetworkInfo>('/api/networks')
}
get_account(network: string, account: NameType | string) {
return this.callStruct(
`/api/account/${this.encodeSegment(network)}/${this.encodeSegment(account)}`,
Types.AccountResponse
)
}
get_accinfo(network: string, account: NameType | string) {
return this.callStruct(
`/api/accinfo/${this.encodeSegment(network)}/${this.encodeSegment(account)}`,
Types.AccountInfoResponse
)
}
get_balances(network: string, account: NameType | string) {
return this.callStruct(
`/api/balances/${this.encodeSegment(network)}/${this.encodeSegment(account)}`,
Types.BalancesResponse
)
}
get_rexbalance(network: string, account: NameType | string) {
return this.callStruct(
`/api/rexbalance/${this.encodeSegment(network)}/${this.encodeSegment(account)}`,
Types.RexBalanceResponse
)
}
get_rexraw(network: string, account: NameType | string) {
return this.callStruct(
`/api/rexraw/${this.encodeSegment(network)}/${this.encodeSegment(account)}`,
Types.RexRawResponse
)
}
get_tokenbalance(
network: string,
account: NameType | string,
contract: NameType | string,
token: string
) {
return this.callText(
`/api/tokenbalance/${this.encodeSegment(network)}/${this.encodeSegment(
account
)}/${this.encodeSegment(contract)}/${this.encodeSegment(token)}`
)
}
get_key(key: string) {
return this.callJson<Types.KeyLookupResponse>(`/api/key/${this.encodeSegment(key)}`)
}
get_codehash(hash: string) {
return this.callJson<Types.CodeHashResponse>(`/api/codehash/${this.encodeSegment(hash)}`)
}
get_topholders(network: string, contract: NameType | string, token: string, count: number) {
return this.callJson<Types.TopHolderRow[]>(
`/api/topholders/${this.encodeSegment(network)}/${this.encodeSegment(
contract
)}/${this.encodeSegment(token)}/${this.encodeSegment(count)}`
)
}
get_holdercount(network: string, contract: NameType | string, token: string) {
return this.callText(
`/api/holdercount/${this.encodeSegment(network)}/${this.encodeSegment(
contract
)}/${this.encodeSegment(token)}`
)
}
get_usercount(network: string) {
return this.callText(`/api/usercount/${this.encodeSegment(network)}`)
}
get_topram(network: string, count: number) {
return this.callJson<Types.TopRamRow[]>(
`/api/topram/${this.encodeSegment(network)}/${this.encodeSegment(count)}`
)
}
get_topstake(network: string, count: number) {
return this.callJson<Types.TopStakeRow[]>(
`/api/topstake/${this.encodeSegment(network)}/${this.encodeSegment(count)}`
)
}
get_sync(network: string) {
return this.callText(`/api/sync/${this.encodeSegment(network)}`)
}
get_status() {
return this.callText('/api/status')
}
private callStruct<T extends ABISerializableConstructor>(path: string, responseType: T) {
return this.client.call({
path,
method: 'GET',
responseType,
})
}
private callJson<T>(path: string) {
return this.client.call<T>({
path,
method: 'GET',
})
}
private callText(path: string) {
return this.client.call<string>({
path,
method: 'GET',
})
}
private encodeSegment(value: string | number | NameType) {
return encodeURIComponent(String(value))
}
}
|