UNPKG

15.5 kBTypeScriptView Raw
1/**
2 * @module RPC-API-Methods
3 * copyright defined in eosjs/LICENSE.txt
4 */
5import { TransactionReceiptHeader, TransactionTrace } from './eosjs-api-interfaces';
6import { Authorization } from './eosjs-serialize';
7/** Structured format for abis */
8export interface Abi {
9 version: string;
10 types: {
11 new_type_name: string;
12 type: string;
13 }[];
14 structs: {
15 name: string;
16 base: string;
17 fields: {
18 name: string;
19 type: string;
20 }[];
21 }[];
22 actions: {
23 name: string;
24 type: string;
25 ricardian_contract: string;
26 }[];
27 tables: {
28 name: string;
29 type: string;
30 index_type: string;
31 key_names: string[];
32 key_types: string[];
33 }[];
34 ricardian_clauses: {
35 id: string;
36 body: string;
37 }[];
38 error_messages: {
39 error_code: number;
40 error_msg: string;
41 }[];
42 abi_extensions: {
43 tag: number;
44 value: string;
45 }[];
46 variants?: {
47 name: string;
48 types: string[];
49 }[];
50 action_results?: {
51 name: string;
52 result_type: string;
53 }[];
54 kv_tables?: {
55 [key: string]: {
56 type: string;
57 primary_index: {
58 name: string;
59 type: string;
60 };
61 secondary_indices: {
62 [key: string]: {
63 type: string;
64 };
65 }[];
66 };
67 }[];
68}
69export interface BlockHeader {
70 timestamp: string;
71 producer: string;
72 confirmed: number;
73 previous: string;
74 transaction_mroot: string;
75 action_mroot: string;
76 schedule_version: number;
77 new_producers?: ProducerScheduleType;
78 header_extensions: [number, string][];
79}
80export interface SignedBlockHeader extends BlockHeader {
81 producer_signature: string;
82}
83export interface AccountResourceInfo {
84 used: number;
85 available: number;
86 max: number;
87 last_usage_update_time?: string;
88 current_used?: number;
89}
90export interface ResourceOverview {
91 owner: string;
92 ram_bytes: number;
93 net_weight: string;
94 cpu_weight: string;
95}
96export interface ResourceDelegation {
97 from: string;
98 to: string;
99 net_weight: string;
100 cpu_weight: string;
101}
102export interface RefundRequest {
103 owner: string;
104 request_time: string;
105 net_amount: string;
106 cpu_amount: string;
107}
108export interface VoterInfo {
109 owner: string;
110 proxy: string;
111 producers: string[];
112 staked: number;
113 last_vote_weight: string;
114 proxied_vote_weight: string;
115 is_proxy: number;
116 flags1: number;
117 reserved2: number;
118 reserved3: string;
119}
120export interface RexBalance {
121 version: number;
122 owner: string;
123 vote_stake: string;
124 rex_balance: string;
125 matured_rex: number;
126 rex_maturities: any;
127}
128export interface Authority {
129 threshold: number;
130 keys: KeyWeight[];
131 accounts: PermissionLevelWeight[];
132 waits: WaitWeight[];
133}
134export interface KeyWeight {
135 key: string;
136 weight: number;
137}
138export interface Permission {
139 perm_name: string;
140 parent: string;
141 required_auth: Authority;
142}
143export interface PermissionLevel {
144 actor: string;
145 permission: string;
146}
147export interface PermissionLevelWeight {
148 permission: PermissionLevel;
149 weight: number;
150}
151export interface WaitWeight {
152 wait_sec: number;
153 weight: number;
154}
155/** Return value of `/v1/chain/abi_bin_to_json` */
156export interface AbiBinToJsonResult {
157 args: 'any';
158}
159/** Return value of `/v1/chain/abi_json_to_bin` */
160export interface AbiJsonToBinResult {
161 binargs: 'string';
162}
163/** Return value of `/v1/chain/get_abi` */
164export interface GetAbiResult {
165 account_name: string;
166 abi?: Abi;
167}
168/** Return value of `/v1/chain/get_account` */
169export interface GetAccountResult {
170 account_name: string;
171 head_block_num: number;
172 head_block_time: string;
173 privileged: boolean;
174 last_code_update: string;
175 created: string;
176 core_liquid_balance?: string;
177 ram_quota: number;
178 net_weight: number;
179 cpu_weight: number;
180 net_limit: AccountResourceInfo;
181 cpu_limit: AccountResourceInfo;
182 ram_usage: number;
183 permissions: Permission[];
184 total_resources: ResourceOverview | null;
185 self_delegated_bandwidth: ResourceDelegation | null;
186 refund_request: RefundRequest | null;
187 voter_info: any;
188 rex_info: any;
189}
190export interface AccountResult {
191 account_name: string;
192 permission_name: string;
193 authorizing_account?: Authorization;
194 authorizing_key?: string;
195 weight: number;
196 threshold: number;
197}
198/** Return value of `/v1/chain/get_accounts_by_authorizers` */
199export interface GetAccountsByAuthorizersResult {
200 accounts: AccountResult[];
201}
202export interface GetActivatedProtocolFeaturesParams {
203 limit?: number;
204 search_by_block_num?: boolean;
205 reverse?: boolean;
206 lower_bound?: number;
207 upper_bound?: number;
208}
209export interface ActivatedProtocolFeature {
210 feature_digest: string;
211 activation_ordinal: number;
212 activation_block_num: number;
213 description_digest: string;
214 dependencies: string[];
215 protocol_feature_type: string;
216 specification: {
217 name: string;
218 value: string;
219 };
220}
221/** Return value of `/v1/chain/get_activated_protocol_features` */
222export interface GetActivatedProtocolFeaturesResult {
223 activated_protocol_features: ActivatedProtocolFeature[];
224 more?: number;
225}
226/** Return value of `/v1/chain/get_block_info` */
227export interface GetBlockInfoResult {
228 timestamp: string;
229 producer: string;
230 confirmed: number;
231 previous: string;
232 transaction_mroot: string;
233 action_mroot: string;
234 schedule_version: number;
235 producer_signature: string;
236 id: string;
237 block_num: number;
238 ref_block_num: number;
239 ref_block_prefix: number;
240}
241/** Returned action from nodeos, data is optional */
242export interface ProcessedAction {
243 account: string;
244 name: string;
245 authorization: Authorization[];
246 data?: any;
247 hex_data?: string;
248}
249export interface ProcessedTransaction {
250 expiration?: string;
251 ref_block_num?: number;
252 ref_block_prefix?: number;
253 max_net_usage_words?: number;
254 max_cpu_usage_ms?: number;
255 delay_sec?: number;
256 context_free_actions?: ProcessedAction[];
257 context_free_data?: Uint8Array[];
258 actions: ProcessedAction[];
259 transaction_extensions?: [number, string][];
260}
261export interface PackedTransaction {
262 id: string;
263 signatures: string[];
264 compression: number | string;
265 packed_context_free_data: string;
266 context_free_data: string[];
267 packed_trx: string;
268 transaction: ProcessedTransaction;
269}
270export interface PackedTrx {
271 signatures: string[];
272 compression: number;
273 packed_trx: string;
274 packed_context_free_data: string;
275}
276export interface TransactionReceipt extends TransactionReceiptHeader {
277 trx: PackedTransaction;
278}
279/** Return value of `/v1/chain/get_block` */
280export interface GetBlockResult {
281 timestamp: string;
282 producer: string;
283 confirmed: number;
284 previous: string;
285 transaction_mroot: string;
286 action_mroot: string;
287 schedule_version: number;
288 new_producers: ProducerScheduleType | null;
289 producer_signature: string;
290 transactions: any;
291 id: string;
292 block_num: number;
293 ref_block_prefix: number;
294}
295/** Used to calculate TAPoS fields in transactions */
296export interface BlockTaposInfo {
297 block_num: number;
298 id: string;
299 timestamp?: string;
300 header?: BlockHeader;
301}
302export interface ProducerKey {
303 producer_name: string;
304 block_signing_key: string;
305}
306export interface BlockSigningAuthority {
307 threshold: number;
308 keys: KeyWeight[];
309}
310export interface ProducerAuthority {
311 producer_name: string;
312 authority: [number | string, BlockSigningAuthority];
313}
314export interface ProducerAuthoritySchedule {
315 version: number;
316 producers: ProducerAuthority[];
317}
318export interface ProducerScheduleType {
319 version: number;
320 producers: ProducerKey[];
321}
322export interface ScheduleInfo {
323 schedule_lib_num: number;
324 schedule_hash: string;
325 schedule: ProducerScheduleType;
326}
327export interface IncrementalMerkle {
328 _active_nodes: string[];
329 _node_count: number;
330}
331export interface ProtocolFeatureActivationSet {
332 protocol_features: string[];
333}
334export interface SecurityGroupInfo {
335 version: number;
336 participants: string[];
337}
338export interface StateExtension {
339 security_group_info: SecurityGroupInfo;
340}
341/** Return value of `/v1/chain/get_block_header_state` */
342export interface GetBlockHeaderStateResult {
343 id: string;
344 header: SignedBlockHeader;
345 pending_schedule: ScheduleInfo;
346 activated_protocol_features: ProtocolFeatureActivationSet;
347 additional_signatures: string[];
348 block_num: number;
349 dpos_proposed_irreversible_blocknum: number;
350 dpos_irreversible_blocknum: number;
351 active_schedule: ProducerAuthoritySchedule;
352 blockroot_merkle: IncrementalMerkle;
353 producer_to_last_produced: Map<string, number>;
354 producer_to_last_implied_irb: Map<string, number>;
355 valid_block_signing_authority: any;
356 confirm_count: number[];
357 state_extension: [number, StateExtension];
358}
359/** Subset of `GetBlockHeaderStateResult` used to calculate TAPoS fields in transactions */
360export interface BlockHeaderStateTaposInfo {
361 block_num: number;
362 id: string;
363 header: SignedBlockHeader;
364}
365/** Return value of `/v1/chain/get_code` */
366export interface GetCodeResult {
367 account_name: string;
368 code_hash: string;
369 wast: string;
370 wasm: string;
371 abi?: Abi;
372}
373/** Return value of `/v1/chain/get_code_hash` */
374export interface GetCodeHashResult {
375 account_name: string;
376 code_hash: string;
377}
378/** Return value of `/v1/chain/get_currency_stats` */
379export interface GetCurrencyStatsResult {
380 [key: string]: {
381 supply: string;
382 max_supply: string;
383 issuer: string;
384 };
385}
386/** Return value of `/v1/chain/get_info` */
387export interface GetInfoResult {
388 server_version: string;
389 chain_id: string;
390 head_block_num: number;
391 last_irreversible_block_num: number;
392 last_irreversible_block_id: string;
393 last_irreversible_block_time?: string;
394 head_block_id: string;
395 head_block_time: string;
396 head_block_producer: string;
397 virtual_block_cpu_limit: number;
398 virtual_block_net_limit: number;
399 block_cpu_limit: number;
400 block_net_limit: number;
401 server_version_string?: string;
402 fork_db_head_block_num?: number;
403 fork_db_head_block_id?: string;
404 server_full_version_string?: string;
405 first_block_num?: number;
406}
407/** Return value of /v1/chain/get_producer_schedule */
408export interface GetProducerScheduleResult {
409 active: ProducerAuthoritySchedule | null;
410 pending: ProducerAuthoritySchedule | null;
411 proposed: ProducerAuthoritySchedule | null;
412}
413export interface ProducerDetails {
414 owner: string;
415 producer_authority?: any[];
416 url: string;
417 is_active?: number;
418 total_votes: string;
419 producer_key: string;
420 unpaid_blocks?: number;
421 last_claim_time?: string;
422 location?: number;
423}
424/** Return value of `/v1/chain/get_producers` */
425export interface GetProducersResult {
426 rows: ProducerDetails[];
427 total_producer_vote_weight: string;
428 more: string;
429}
430/** Return value of `/v1/chain/get_raw_code_and_abi` */
431export interface GetRawCodeAndAbiResult {
432 account_name: string;
433 wasm: string;
434 abi: string;
435}
436/** Return value of `/v1/chain/get_raw_abi` */
437export interface GetRawAbiResult {
438 account_name: string;
439 code_hash: string;
440 abi_hash: string;
441 abi: string;
442}
443export interface DeferredTransaction extends ProcessedTransaction {
444 deferred_transaction_generation?: {
445 sender_trx_id: string;
446 sender_id: string;
447 sender: string;
448 };
449}
450export interface GeneratedTransaction {
451 trx_id: string;
452 sender: string;
453 sender_id: string;
454 payer: string;
455 delay_until: string;
456 expiration: string;
457 published: string;
458 packed_trx?: string[];
459 transaction?: DeferredTransaction[];
460}
461/** Return value of `/v1/chain/get_scheduled_transactions` */
462export interface GetScheduledTransactionsResult {
463 transactions: GeneratedTransaction[];
464 more: string;
465}
466/** Return value of `/v1/chain/get_table_rows` and `/v1/chain/get_kv_table_rows` */
467export interface GetTableRowsResult {
468 rows: any[];
469 more: boolean;
470 next_key: string;
471 next_key_bytes: string;
472}
473export interface GetTableByScopeResultRow {
474 code: string;
475 scope: string;
476 table: string;
477 payer: string;
478 count: number;
479}
480/** Return value of `/v1/chain/get_table_by_scope` */
481export interface GetTableByScopeResult {
482 rows: GetTableByScopeResultRow[];
483 more: string;
484}
485/** Arguments for `push_transaction` */
486export interface PushTransactionArgs {
487 signatures: string[];
488 compression?: number;
489 serializedTransaction: Uint8Array;
490 serializedContextFreeData?: Uint8Array;
491}
492/** Return value of `/v1/chain/push_ro_transaction` */
493export interface ReadOnlyTransactResult {
494 head_block_num: number;
495 head_block_id: string;
496 last_irreversible_block_num: number;
497 last_irreversible_block_id: string;
498 code_hash: string;
499 pending_transactions: string[];
500 result: TransactionTrace;
501}
502export interface DBSizeIndexCount {
503 index: string;
504 row_count: number;
505}
506/** Return value of `/v1/db_size/get` */
507export interface DBSizeGetResult {
508 free_bytes: number;
509 used_bytes: number;
510 size: number;
511 indices: DBSizeIndexCount[];
512}
513export interface TraceApiAction {
514 global_sequence: number;
515 receiver: string;
516 account: string;
517 action: string;
518 authorization: Authorization[];
519 data: any;
520 return_value: any;
521}
522export interface TraceApiTransactionHeader {
523 expiration: string;
524 ref_block_num: number;
525 ref_block_prefix: number;
526 max_net_usage_words: number;
527 max_cpu_usage_ms: number;
528 delay_sec: number;
529}
530export interface TraceApiTransaction {
531 id: string;
532 actions: TraceApiAction[];
533 status?: string;
534 cpu_usage_us?: number;
535 net_usage_words?: number;
536 signatures?: string[];
537 transaction_header?: TraceApiTransactionHeader;
538 bill_to_accounts: string[];
539}
540/** Return value of `/v1/trace_api/get_block` */
541export interface TraceApiGetBlockResult {
542 id: string;
543 number: number;
544 previous_id: string;
545 status: string;
546 timestamp: string;
547 producer: string;
548 transaction_mroot?: string;
549 action_mroot?: string;
550 schedule_version: number;
551 transactions: TraceApiTransaction;
552}
553export interface OrderedActionResult {
554 global_action_seq: number;
555 account_action_seq: number;
556 block_num: number;
557 block_time: string;
558 action_trace: any;
559}
560/** Return value of `/v1/history/get_actions` */
561export interface GetActionsResult {
562 actions: OrderedActionResult[];
563 last_irreversible_block: number;
564 time_limit_exceeded_error?: boolean;
565}
566/** Return value of `/v1/history/get_transaction` */
567export interface GetTransactionResult {
568 id: string;
569 trx: any;
570 block_time: string;
571 block_num: number;
572 last_irreversible_block: number;
573 traces: any[];
574}
575/** Return value of `/v1/history/get_key_accounts` */
576export interface GetKeyAccountsResult {
577 account_names: string[];
578}
579/** Return value of `/v1/history/get_controlled_accounts` */
580export interface GetControlledAccountsResult {
581 controlled_accounts: string[];
582}