-
Notifications
You must be signed in to change notification settings - Fork 9
/
api.ts
2745 lines (1943 loc) · 88.5 KB
/
api.ts
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Generated by orval v6.12.1 🍺
* Do not edit manually.
* Oasis Indexer API V1
* An API for accessing indexed data from the Oasis Network.
* OpenAPI spec version: 0.1.0
*/
import axios from 'axios'
import type {
AxiosRequestConfig,
AxiosResponse,
AxiosError
} from 'axios'
import {
useQuery
} from '@tanstack/react-query'
import type {
UseQueryOptions,
QueryFunction,
UseQueryResult,
QueryKey
} from '@tanstack/react-query'
export type GetLayerStatsActiveAccountsWindowStepSeconds = typeof GetLayerStatsActiveAccountsWindowStepSeconds[keyof typeof GetLayerStatsActiveAccountsWindowStepSeconds];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const GetLayerStatsActiveAccountsWindowStepSeconds = {
NUMBER_300: 300,
NUMBER_86400: 86400,
} as const;
export type GetLayerStatsActiveAccountsParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
/**
* The size of the step between returned statistic windows, in seconds.
The backend supports a limited number of window sizes: 300 (5 minutes) and
86400 (1 day). Requests with other values may be rejected.
*/
window_step_seconds?: GetLayerStatsActiveAccountsWindowStepSeconds;
};
export type GetLayerStatsTxVolumeParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
/**
* The size of buckets into which the statistic is grouped, in seconds.
The backend supports a limited number of bucket sizes: 300 (5 minutes) and
86400 (1 day). Requests with other values may be rejected.
*/
bucket_size_seconds?: number;
};
export type GetRuntimeEvmTokensParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
};
export type GetRuntimeEventsParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
/**
* A filter on block round.
*/
block?: number;
/**
* A filter on transaction index. The returned events all need to originate
from a transaction that appeared in `tx_index`-th position in the block.
It is invalid to specify this filter without also specifying a `block`.
Specifying `tx_index` and `round` is an alternative to specifying `tx_hash`;
either works to fetch events from a specific transaction.
*/
tx_index?: number;
/**
* A filter on the hash of the transaction that originated the events.
Specifying `tx_index` and `round` is an alternative to specifying `tx_hash`;
either works to fetch events from a specific transaction.
*/
tx_hash?: string;
/**
* A filter on the event type.
*/
type?: RuntimeEventType;
/**
* A filter on related accounts. Every returned event will refer to
this account. For example, for a `accounts.Transfer` event, this will be
the sender or the recipient of tokens.
*/
rel?: string;
/**
* A filter on the first of `topics` in the EVM log structure, which typically contains the
event _signature_, i.e. the keccak256 hash of the event name and parameter types.
Note: The filter will match on `topics[0]` even in the rare case of anonymous events
when that field does not actually contain the signature.
*/
evm_log_signature?: string;
};
export type GetRuntimeTransactionsParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
/**
* A filter on block round.
*/
block?: number;
/**
* A filter on related accounts. Every returned transaction will refer to
this account in a way. For example, for an `accounts.Transfer` tx, this will be
the sender or the recipient of tokens.
The indexer detects related accounts inside EVM transactions and events on a
best-effort basis. For example, it inspects ERC20 methods inside `evm.Call` txs.
However, you must provide the oasis-style derived address here, not the Eth address.
See `AddressPreimage` for more info on oasis-style vs Eth addresses.
*/
rel?: string;
};
export type GetRuntimeBlocksParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
/**
* A filter on minimum block height, inclusive.
*/
from?: number;
/**
* A filter on maximum block height, inclusive.
*/
to?: number;
/**
* A filter on minimum block time, inclusive.
*/
after?: string;
/**
* A filter on maximum block time, inclusive.
*/
before?: string;
};
export type GetConsensusProposalsProposalIdVotesParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
};
export type GetConsensusProposalsParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
/**
* The submitter of the proposal.
*/
submitter?: string;
/**
* The state of the proposal.
*/
state?: string;
};
export type GetConsensusEpochsParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
};
export type GetConsensusAccountsAddressDebondingDelegationsParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
};
export type GetConsensusAccountsAddressDelegationsParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
};
export type GetConsensusAccountsParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
/**
* A filter on the minimum available account balance.
*/
minAvailable?: string;
/**
* A filter on the maximum available account balance.
*/
maxAvailable?: string;
/**
* A filter on the minimum active escrow account balance.
*/
minEscrow?: string;
/**
* A filter on the maximum active escrow account balance.
*/
maxEscrow?: string;
/**
* A filter on the minimum debonding account balance.
*/
minDebonding?: string;
/**
* A filter on the maximum debonding account balance.
*/
maxDebonding?: string;
/**
* A filter on the minimum total account balance.
*/
minTotalBalance?: string;
/**
* A filter on the maximum total account balance.
*/
maxTotalBalance?: string;
};
export type GetConsensusValidatorsParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
};
export type GetConsensusEntitiesEntityIdNodesParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
};
export type GetConsensusEntitiesParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
};
export type GetConsensusEventsParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
/**
* A filter on block height.
*/
block?: number;
/**
* A filter on transaction index. The returned events all need to originate
from a transaction that appeared in `tx_index`-th position in the block.
It is invalid to specify this filter without also specifying a `block`.
Specifying `tx_index` and `block` is an alternative to specifying `tx_hash`;
either works to fetch events from a specific transaction.
*/
tx_index?: number;
/**
* A filter on the hash of the transaction that originated the events.
Specifying `tx_index` and `block` is an alternative to specifying `tx_hash`;
either works to fetch events from a specific transaction.
*/
tx_hash?: string;
/**
* A filter on related accounts. Every returned event will refer to
this account. For example, for a `Transfer` event, this will be the
the sender or the recipient of tokens.
*/
rel?: string;
/**
* A filter on the event type.
*/
type?: ConsensusEventType;
};
export type GetConsensusTransactionsParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
/**
* A filter on block height.
*/
block?: number;
/**
* A filter on transaction method.
*/
method?: ConsensusTxMethod;
/**
* A filter on transaction sender.
*/
sender?: string;
/**
* A filter on related accounts.
*/
rel?: string;
/**
* A filter on minimum transaction fee, inclusive.
*/
minFee?: string;
/**
* A filter on maximum transaction fee, inclusive.
*/
maxFee?: string;
/**
* A filter on transaction status code.
*/
code?: number;
};
export type GetConsensusBlocksParams = {
/**
* The maximum numbers of items to return.
*/
limit?: number;
/**
* The number of items to skip before starting to collect the result set.
*/
offset?: number;
/**
* A filter on minimum block height, inclusive.
*/
from?: number;
/**
* A filter on maximum block height, inclusive.
*/
to?: number;
/**
* A filter on minimum block time, inclusive.
*/
after?: string;
/**
* A filter on maximum block time, inclusive.
*/
before?: string;
};
/**
* An empty response indicating that the requested resource was not found.
*/
export type NotFoundErrorResponse = unknown;
export type HumanReadableErrorResponse = {
/** An error message. */
msg: string;
};
export interface ActiveAccounts {
/** The date for the end of the daily active accounts measurement window. */
window_end: string;
/** The number of active accounts for the 24hour window starting at bucket_start. */
active_accounts: number;
}
/**
* A list of daily unique active account windows.
*/
export interface ActiveAccountsList {
window_size_seconds: number;
/** The list of daily unique active account windows. */
windows: ActiveAccounts[];
}
export interface TxVolume {
/** The date for this daily transaction volume measurement. */
bucket_start: string;
/** The transaction volume on this day. */
tx_volume: number;
}
/**
* A list of daily transaction volumes.
*/
export interface TxVolumeList {
bucket_size_seconds: number;
/** The list of daily transaction volumes. */
buckets: TxVolume[];
}
export interface AccountStats {
/** The total number of tokens sent, in base units. */
total_sent: string;
/** The total number of tokens received, in base units. */
total_received: string;
/** The total number of transactions this account was involved with. */
num_txns: number;
}
/**
* A list of tokens in a runtime.
*/
export type EvmTokenListAllOf = {
/** A list of L2 EVM tokens (ERC-20, ERC-271, ...). */
evm_tokens: EvmToken[];
};
export type EvmTokenList = List & EvmTokenListAllOf;
/**
* The type of a EVM token.
*/
export type EvmTokenType = typeof EvmTokenType[keyof typeof EvmTokenType];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EvmTokenType = {
ERC20: 'ERC20',
ERC721: 'ERC721',
ERC1155: 'ERC1155',
OasisSdk: 'OasisSdk',
} as const;
export interface EvmToken {
/** The Oasis address of this token's contract. */
contract_addr: string;
/** The EVM address of this token's contract. Encoded as a lowercase hex string. */
evm_contract_addr: string;
/** Name of the token, as provided by token contract's `name()` method. */
name?: string;
/** Symbol of the token, as provided by token contract's `symbol()` method. */
symbol?: string;
/** The number of least significant digits in base units that should be displayed as
decimals when displaying tokens. `tokens = base_units / (10**decimals)`.
Affects display only. Often equals 18, to match ETH.
*/
decimals?: number;
/** The heuristically determined interface that the token contract implements.
A less specialized variant of the token might be detected; for example, an
ERC-1363 token might be labeled as ERC-20 here. If the type cannot be
detected or is not supported, this field will be null/absent.
*/
type: EvmTokenType;
/** The total number of base units available. */
total_supply?: string;
/** The number of addresses that have a nonzero balance of this token,
as calculated from Transfer events.
*/
num_holders: number;
}
export interface RuntimeStatus {
/** The number of compute nodes that are registered and can run the runtime. */
active_nodes: number;
/** The height of the most recent indexed block (also sometimes referred to as "round") for this runtime. Query a synced Oasis node for the latest block produced. */
latest_block: number;
/** The RFC 3339 formatted time when the Indexer processed the latest block for this runtime. Compare with current time for approximate indexing progress with the Oasis Network. */
latest_update: string;
}
export interface RuntimeAccount {
/** The staking address for this account. */
address: string;
address_preimage?: AddressPreimage;
/** The balance(s) of this account in this runtime. Most runtimes use only one denomination, and thus
produce only one balance here. These balances do not include "layer (n+1) tokens", i.e. tokens
managed by smart contracts deployed in this runtime. For example, in EVM-compatible runtimes,
this does not include ERC-20 tokens
*/
balances: RuntimeSdkBalance[];
/** The balances of this account in each runtime, as managed by EVM smart contracts (notably, ERC-20).
NOTE: This field is limited to 1000 entries. If you need more, please let us know in a GitHub issue.
*/
evm_balances: RuntimeEvmBalance[];
stats: AccountStats;
}
/**
* The method call body.
*/
export type RuntimeTransactionBody = { [key: string]: any };
/**
* A runtime transaction.
*/
export interface RuntimeTransaction {
/** The block round at which this transaction was executed. */
round: number;
/** The 0-based index of this transaction in the block. */
index: number;
/** The second-granular consensus time when this tx's block was proposed. */
timestamp: string;
/** The Oasis cryptographic hash of this transaction's encoding. */
hash: string;
/** The Ethereum cryptographic hash of this transaction's encoding.
Absent for non-Ethereum-format transactions.
*/
eth_hash?: string;
/** The Oasis address of this transaction's 0th signer.
Unlike Ethereum, Oasis natively supports multiple-signature transactions.
However, the great majority of transactions only have a single signer in practice.
Retrieving the other signers is currently not supported by this API.
*/
sender_0: string;
/** The Ethereum address of this transaction's 0th signer.
*/
sender_0_eth?: string;
/** The nonce used with this transaction's 0th signer, to prevent replay. */
nonce_0: number;
/** The fee that this transaction's sender committed to pay to execute
it (total, native denomination, ParaTime base units, as a string).
*/
fee: string;
/** The maximum gas that this transaction's sender committed to use to
execute it.
*/
gas_limit: number;
/** The total gas used by the transaction. */
gas_used: number;
/** The total byte size of the transaction. */
size: number;
/** The method that was called. */
method: string;
/** The method call body. */
body: RuntimeTransactionBody;
/** A reasonable "to" Oasis address associated with this transaction,
if applicable. The meaning varies based on the transaction method. Some notable examples:
- For `method = "accounts.Transfer"`, this is the paratime account receiving the funds.
- For `method = "consensus.Deposit"`, this is the paratime account receiving the funds.
- For `method = "consensus.Withdraw"`, this is a consensus (!) account receiving the funds.
- For `method = "evm.Create"`, this is the address of the newly created smart contract.
- For `method = "evm.Call"`, this is the address of the called smart contract
*/
to?: string;
/** A reasonable "to" Ethereum address associated with this transaction,
*/
to_eth?: string;
/** A reasonable "amount" associated with this transaction, if
applicable. The meaning varies based on the transaction method.
Usually in native denomination, ParaTime units. As a string.
*/
amount?: string;
/** Whether this transaction successfully executed. */
success: boolean;
/** Error details of a failed transaction. */
error?: TxError;
}
/**
* A list of runtime transactions.
*/
export type RuntimeTransactionListAllOf = {
transactions: RuntimeTransaction[];
};
export type RuntimeTransactionList = List & RuntimeTransactionListAllOf;
/**
* A decoded parameter of an event emitted from an evm runtime.
*/
export interface EvmEventParam {
/** The parameter name. */
name: string;
/** The solidity type of the event parameter. */
evm_type: string;
/** The parameter value. */
value: unknown;
}
export type RuntimeEventType = typeof RuntimeEventType[keyof typeof RuntimeEventType];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const RuntimeEventType = {
accountstransfer: 'accounts.transfer',
accountsburn: 'accounts.burn',
accountsmint: 'accounts.mint',
consensus_accountsdeposit: 'consensus_accounts.deposit',
consensus_accountswithdraw: 'consensus_accounts.withdraw',
coregas_used: 'core.gas_used',
evmlog: 'evm.log',
} as const;
/**
* The decoded event contents. This spec does not encode the many possible types;
instead, see [the Go API](https://pkg.go.dev/github.com/oasisprotocol/oasis-sdk/client-sdk/go/modules).
This object will conform to one of the `*Event` types two levels down
the hierarchy (e.g. `MintEvent` from `accounts > Event > MintEvent`),
OR `evm > Event`.
*/
export type RuntimeEventBody = { [key: string]: any };
/**
* An event emitted by the runtime layer
*/
export interface RuntimeEvent {
/** The block height at which this event was generated. */
round: number;
/** 0-based index of this event's originating transaction within its block.
Absent if the event did not originate from a transaction.
*/
tx_index?: number;
/** Hash of this event's originating transaction.
Absent if the event did not originate from a transaction.
*/
tx_hash?: string | null;
/** The type of the event. */
type: RuntimeEventType;
/** The decoded event contents. This spec does not encode the many possible types;
instead, see [the Go API](https://pkg.go.dev/github.com/oasisprotocol/oasis-sdk/client-sdk/go/modules).
This object will conform to one of the `*Event` types two levels down
the hierarchy (e.g. `MintEvent` from `accounts > Event > MintEvent`),
OR `evm > Event`.
*/
body: RuntimeEventBody;
/** If the event type is `evm.log`, this field describes the human-readable type of evm event, e.g.
`Transfer`. We currently only support two types of evm events, ERC20 `Transfer` and `Approve`.
Absent if the event type is not `evm.log`.
*/
evm_log_name?: string | null;
/** The decoded `evm.log` event data. We currently support only two types of evm events, ERC20 `Transfer`
and `Approve`.
Absent if the event type is not `evm.log`.
*/
evm_log_params?: EvmEventParam[];
}
/**
* A list of runtime events.
*/
export type RuntimeEventListAllOf = {
events: RuntimeEvent[];
};
export type RuntimeEventList = List & RuntimeEventListAllOf;
/**
* A ParaTime block.
*/
export interface RuntimeBlock {
/** The block round. */
round: number;
/** The block header hash. */
hash: string;
/** The second-granular consensus time. */
timestamp: string;
/** The number of transactions in the block. */
num_transactions: number;
/** The total byte size of all transactions in the block. */
size: number;
/** The total gas used by all transactions in the block. */
gas_used: number;
}
/**
* A list of consensus blocks.
*/
export type RuntimeBlockListAllOf = {
blocks: RuntimeBlock[];
};
export type RuntimeBlockList = List & RuntimeBlockListAllOf;
export interface ProposalVote {
/** The staking address casting this vote. */
address: string;
/** The vote cast. */
vote: string;
}
/**
* A list of votes for a governance proposal.
*/
export type ProposalVotesAllOf = {
/** The unique identifier of the proposal. */
proposal_id: number;
/** The list of votes for the proposal. */
votes: ProposalVote[];
};
/**
* The target propotocol versions for this upgrade proposal.
*/
export interface ProposalTarget {
consensus_protocol?: string;
runtime_host_protocol?: string;
runtime_committee_protocol?: string;
}
/**
* A governance proposal.
*/
export interface Proposal {
/** The unique identifier of the proposal. */
id: number;
/** The staking address of the proposal submitter. */
submitter: string;
/** The state of the proposal. */
state: string;
/** The deposit attached to this proposal. */
deposit: string;
/** The name of the upgrade handler. */
handler?: string;
target?: ProposalTarget;
/** The epoch at which the proposed upgrade will happen. */
epoch?: number;
/** The proposal to cancel, if this proposal proposes
cancelling an existing proposal.
*/
cancels?: number;
/** The epoch at which this proposal was created. */
created_at: number;
/** The epoch at which voting for this proposal will close. */
closes_at: number;
/** The number of invalid votes for this proposal, after tallying.
*/
invalid_votes: string;
}
/**
* A list of governance proposals.
*/
export type ProposalListAllOf = {
proposals: Proposal[];
};
export type ProposalList = List & ProposalListAllOf;
/**
* A consensus epoch.
*/
export interface Epoch {
/** The epoch number. */
id: number;
/** The (inclusive) height at which this epoch started. */
start_height: number;
/** The (inclusive) height at which this epoch ended. Omitted if the epoch is still active. */
end_height?: number;
}
/**
* A list of consensus epochs.
*/
export type EpochListAllOf = {
epochs: Epoch[];
};
export type EpochList = List & EpochListAllOf;
export interface Allowance {
/** The allowed account. */
address: string;
/** The amount allowed for the allowed account. */
amount: string;
}
/**
* A consensus layer account.
*/
export interface Account {
/** The staking address for this account. */
address: string;
/** A nonce used to prevent replay. */
nonce: number;
/** The available balance, in base units. */
available: string;
/** The active escrow balance, in base units. */
escrow: string;
/** The debonding escrow balance, in base units. */
debonding: string;
/** The delegations balance, in base units.
For efficiency, this field is omitted when listing multiple-accounts.
*/
delegations_balance?: string;
/** The debonding delegations balance, in base units.
For efficiency, this field is omitted when listing multiple-accounts.
*/
debonding_delegations_balance?: string;
/** The allowances made by this account. */
allowances: Allowance[];
}
/**
* Balance of an account for a specific runtime and EVM token.
*/
export interface RuntimeEvmBalance {
/** Number of tokens held, in base units. */
balance: string;
/** The EVM address of this token's contract. Encoded as a lowercase hex string. */
token_contract_addr: string;
/** The token ticker symbol. Not guaranteed to be unique across distinct EVM tokens. */
token_symbol?: string;
/** The name of the token. Not guaranteed to be unique across distinct EVM tokens. */
token_name?: string;
token_type?: EvmTokenType;
/** The number of decimals of precision for this token. */
token_decimals: number;
}
/**
* Balance of an account for a specific runtime and oasis-sdk token (e.g. ROSE).
*/
export interface RuntimeSdkBalance {
/** Number of tokens held, in base units. */
balance: string;
/** The token ticker symbol. Unique across all oasis-sdk tokens in the same runtime. */
token_symbol: string;
/** The number of decimals of precision for this token. */
token_decimals: number;
}
export type AddressDerivationContext = typeof AddressDerivationContext[keyof typeof AddressDerivationContext];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const AddressDerivationContext = {
'oasis-core/address:_staking': 'oasis-core/address: staking',
'oasis-runtime-sdk/address:_secp256k1eth': 'oasis-runtime-sdk/address: secp256k1eth',
'oasis-runtime-sdk/address:_sr25519': 'oasis-runtime-sdk/address: sr25519',
'oasis-runtime-sdk/address:_multisig': 'oasis-runtime-sdk/address: multisig',
'oasis-runtime-sdk/address:_module': 'oasis-runtime-sdk/address: module',
'oasis-runtime-sdk/address:_runtime': 'oasis-runtime-sdk/address: runtime',
} as const;
/**
* The data from which a consensus-style address (`oasis1...`)
was derived. Notably, for EVM runtimes like Sapphire,
this links the oasis address and the Ethereum address.
Oasis addresses are derived from a piece of data, such as an ed25519
public key or an Ethereum address. For example, [this](https://github.com/oasisprotocol/oasis-sdk/blob/b37e6da699df331f5a2ac62793f8be099c68469c/client-sdk/go/helpers/address.go#L90-L91)
is how an Ethereum is converted to an oasis address. The type of underlying data usually also
determines how the signatuers for this address are verified.
Consensus supports only "staking addresses" (`context="oasis-core/address: staking"`
below; always ed25519-backed).
Runtimes support all types. This means that every consensus address is also
valid in every runtime. For example, in EVM runtimes, you can use staking
addresses, but only with oasis tools (e.g. a wallet); EVM contracts such as
ERC20 tokens or tools such as Metamask cannot interact with staking addresses.
*/
export interface AddressPreimage {
/** The method by which the oasis address was derived from `address_data`.
*/
context: AddressDerivationContext;
/** Version of the `context`. */
context_version?: number | null;
/** The base64-encoded data from which the oasis address was derived.
When `context = "oasis-runtime-sdk/address: secp256k1eth"`, this
is the Ethereum address (in base64, not hex!).
*/
address_data: string;
}
/**
* A list of consensus layer accounts.
*/
export type AccountListAllOf = {
accounts: Account[];
};
export type AccountList = List & AccountListAllOf;
/**
* A node registered at the consensus layer.
*/