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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | 54x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 1x 1x 3x 3x 3x 3x 3x 1x 1x 1x 1x 1x | import {
APIClient,
Asset,
Checksum256Type,
Int64Type,
NameType,
PublicKeyType,
} from '@wharfkit/antelope'
import * as Types from '../../types'
export class HyperionV2APIClient {
public state: HyperionV2StateAPIClient
public history: HyperionV2HistoryAPIClient
constructor(private client: APIClient) {
this.state = new HyperionV2StateAPIClient(client)
this.history = new HyperionV2HistoryAPIClient(client)
}
get_health() {
return this.client.call({
path: `/v2/health`,
method: 'GET',
responseType: Types.v2.GetHealthResponse,
})
}
}
class HyperionV2StateAPIClient {
constructor(private client: APIClient) {}
async get_voters(producer?: NameType, proxy?: boolean, skip?: number, limit?: number) {
const queryParts: string[] = []
if (producer) queryParts.push(`producer=${producer}`)
if (proxy !== undefined) queryParts.push(`proxy=${proxy}`)
if (skip !== undefined) queryParts.push(`skip=${skip}`)
if (limit !== undefined) queryParts.push(`limit=${limit}`)
const queryParams = queryParts.length ? '?' + queryParts.join('&') : ''
return this.client.call({
path: `/v2/state/get_voters${queryParams}`,
method: 'GET',
responseType: Types.v2.GetVotersResponse,
})
}
async get_links(account?: NameType, code?: NameType, action?: NameType, permission?: NameType) {
const queryParts: string[] = []
if (account !== undefined) queryParts.push(`account=${account}`)
Iif (code !== undefined) queryParts.push(`code=${code}`)
Iif (action !== undefined) queryParts.push(`action=${action}`)
Iif (permission !== undefined) queryParts.push(`permission=${permission}`)
const queryParams = queryParts.length ? '?' + queryParts.join('&') : ''
return this.client.call({
path: `/v2/state/get_links${queryParams}`,
method: 'GET',
responseType: Types.v2.GetLinksResponse,
})
}
async get_key_accounts(public_key: PublicKeyType) {
return this.client.call({
path: `/v2/state/get_key_accounts?public_key=${public_key}`,
method: 'GET',
responseType: Types.v2.GetKeyAccountsResponse,
})
}
async get_tokens(account: NameType) {
return this.client.call({
path: `/v2/state/get_tokens?account=${account}`,
method: 'GET',
responseType: Types.v2.GetTokensResponse,
})
}
async get_proposals(options?: {
proposer?: NameType
proposal?: NameType
account?: NameType
requested?: string
provided?: string
track?: number | boolean
skip?: number
limit?: number
}) {
const queryParts: string[] = []
for (const [key, value] of Object.entries(options || {})) {
queryParts.push(`${key}=${value}`)
}
const queryParams = queryParts.length ? '?' + queryParts.join('&') : ''
return this.client.call({
path: `/v2/state/get_proposals${queryParams}`,
method: 'GET',
responseType: Types.v2.GetProposalsResponse,
})
}
async get_account(account: NameType) {
return this.client.call({
path: `/v2/state/get_account?account=${account}`,
method: 'GET',
responseType: Types.v2.GetAccountResponse,
})
}
}
export class HyperionV2HistoryAPIClient {
constructor(private client: APIClient) {}
async get_abi_snapshot(contract: string, block?: number, fetch = false) {
Iif (!block) {
const info = await this.client.v1.chain.get_info()
block = Number(info.last_irreversible_block_num)
}
return this.client.call({
path: `/v2/history/get_abi_snapshot?contract=${encodeURIComponent(
contract
)}&block=${block}&fetch=${fetch}`,
method: 'GET',
responseType: Types.v2.GetABISnapshotResponse,
})
}
async get_actions(
account?: NameType | null,
options?: {
filter?: string
skip?: number
limit?: number
sort?: string
after?: string
before?: string
transfer_to?: NameType
transfer_from?: NameType
transfer_symbol?: Asset.Symbol
act_name?: string
act_account?: NameType
}
) {
const queryParts: string[] = []
if (account) {
queryParts.push(`account=${account}`)
}
for (const [key, value] of Object.entries(options || {})) {
queryParts.push(`${key}=${value}`)
}
const queryParams = queryParts.length ? '?' + queryParts.join('&') : ''
return this.client.call({
path: `/v2/history/get_actions${queryParams}`,
method: 'GET',
responseType: Types.v2.GetActionsResponse,
})
}
async get_created_accounts(
account: NameType,
options?: {
skip?: number
limit?: number
}
) {
const queryParts: string[] = [`account=${account}`]
for (const [key, value] of Object.entries(options || {})) {
queryParts.push(`${key}=${value}`)
}
const queryParams = queryParts.length ? '?' + queryParts.join('&') : ''
return this.client.call({
path: `/v2/history/get_created_accounts${queryParams}`,
method: 'GET',
responseType: Types.v2.GetCreatedAccountsResponse,
})
}
async get_creator(account: NameType) {
return this.client.call({
path: `/v2/history/get_creator?account=${account}`,
method: 'GET',
responseType: Types.v2.GetCreatorResponse,
})
}
async get_deltas(code: NameType, scope: NameType, table: NameType, payer: NameType) {
return this.client.call({
path: `/v2/history/get_deltas?code=${code}&scope=${scope}&table=${table}&payer=${payer}`,
method: 'GET',
responseType: Types.v2.GetDeltasResponse,
})
}
async get_table_state(code: NameType, table: NameType, block_num: Int64Type, after_key = '') {
return this.client.call({
path: `/v2/history/get_table_state?code=${code}&table=${table}&block_num=${block_num}&after_key=${after_key}`,
method: 'GET',
responseType: Types.v2.GetTableStateResponse,
})
}
async get_transaction(id: Checksum256Type) {
return this.client.call({
path: `/v2/history/get_transaction?id=${id}`,
method: 'GET',
responseType: Types.v2.GetTransactionResponse,
})
}
async get_transfers() {
throw new Error('Method not implemented.')
}
async get_transacted_accounts() {
throw new Error('Method not implemented.')
}
}
|