finish all return type

This commit is contained in:
liangping
2023-04-05 10:39:21 +08:00
parent 20099d88d8
commit 727f8ea026
23 changed files with 1534 additions and 122 deletions
-3
View File
@@ -1,3 +0,0 @@
export interface Block {
}
-4
View File
@@ -1,4 +0,0 @@
export interface Coin {
amount: string|number;
denom: string;
}
-3
View File
@@ -1,3 +0,0 @@
export interface NodeInfo {
}
-20
View File
@@ -1,20 +0,0 @@
export interface Pagination {
key?: string;
total?: string;
}
export interface PaginatedResponse {
pagination: Pagination;
}
/*
class PaginatedResponse<T, K extends string> {
[key: string]: T[];
pagination: Pagination;
constructor(data: T[], pagination: Pagination, dataFieldName: K) {
this.pagination = pagination;
this[dataFieldName] = data;
}
}
// */
-5
View File
@@ -1,5 +0,0 @@
export class Proposal {
type: string = '';
title: string = '';
description: string = ''
}
-3
View File
@@ -1,3 +0,0 @@
export interface SlashingSigningInfo {
}
+66 -1
View File
@@ -1,3 +1,68 @@
import type { Coin, Key, PaginatedResponse } from "./common"
export interface Tx {
"@type"?: string,
"body": {
"messages": {"@type": string}[],
"memo": string,
"timeout_height": string,
"extension_options": any[],
"non_critical_extension_options": any[]
},
"auth_info": {
"signer_infos": [
{
"public_key": Key,
"mode_info": {
"single"?: {
"mode": string // "SIGN_MODE_DIRECT"
}
},
"sequence": string
}
],
"fee": {
"amount": Coin[],
"gas_limit": string,
"payer": string,
"granter": string
}
},
"signatures": string[]
}
export interface Attributes {
index?: boolean,
key: string,
value: string
}
export interface TxResponse {
"height": string,
"txhash": string,
"codespace": string,
"code": number,
"data": string,
"raw_log": string,
"logs": [
{
"msg_index": number,
"log": string,
"events": Attributes[]
}
],
"info": "",
"gas_wanted": "204431",
"gas_used": "202682",
"tx": Tx,
"timestamp": "2022-08-13T23:24:54Z",
"events": {
"type": string,
"attributes": Attributes[]
}[]
}
export interface PaginatedTxs extends PaginatedResponse {
txs: Tx[]
tx_responses: TxResponse[]
}
-3
View File
@@ -1,3 +0,0 @@
export interface Txs {
}
+2 -2
View File
@@ -1,5 +1,5 @@
import type { PaginatedResponse } from "./Pagination";
import type { Key } from "./common";
import type { Key, PaginatedResponse } from "./common";
export interface AuthAccount {
"@type": string,
+6 -2
View File
@@ -1,5 +1,5 @@
import type { Coin } from "./Coin";
import type { PaginatedResponse } from "./Pagination";
import type { Coin, PaginatedResponse } from "./common";
export interface BankParams {
params: {
@@ -21,6 +21,10 @@ export interface DenomMetadata {
"symbol": string
}
export interface PaginatedBalances extends PaginatedResponse{
balances: Coin[]
}
export interface PaginatedDenomMetadata extends PaginatedResponse{
metadatas: DenomMetadata[]
}
+53
View File
@@ -0,0 +1,53 @@
import type { Key } from "./common"
export interface NodeInfo {
"default_node_info": {
"protocol_version": {
"p2p": string,
"block": string,
"app": string
},
"default_node_id": string,
"listen_addr": string,
"network": string,
"version": string,
"channels": string,
"moniker": string,
"other": {
"tx_index": string,
"rpc_address": string
}
},
"application_version": {
"name": string,
"app_name": string,
"version": string,
"git_commit": string,
"build_tags": string,
"go_version": string,
"build_deps": [
{
"path": string,
"version": string,
"sum": string,
},
],
"cosmos_sdk_version": string,
}
}
export interface Block {
}
export interface TendermintValidator {
"address": string,
"pub_key": Key,
"voting_power": string,
"proposer_priority": string
}
export interface PaginatedTendermintValidator {
validators: TendermintValidator[],
block_height: string
}
+18
View File
@@ -1,4 +1,22 @@
export interface Key {
"@type": string,
"key": string,
}
export interface Pagination {
key?: string;
total?: string;
}
export interface PaginatedResponse {
pagination: Pagination;
}
export class Response<T> {
[key: string]: T
}
export interface Coin {
amount: string|number;
denom: string;
}
+14
View File
@@ -0,0 +1,14 @@
import type { PaginatedResponse } from "./common"
export interface DistributionParams {
params: {
"community_tax": string,
"base_proposer_reward": string,
"bonus_proposer_reward": string,
"withdraw_addr_enabled": boolean
}
}
export interface PaginatedSlashes extends PaginatedResponse {
slashes: any[]
}
+72
View File
@@ -0,0 +1,72 @@
import type { Coin } from "./Coin"
import type { PaginatedResponse } from "./common"
export interface GovParams {
"voting_params": {
"voting_period": string,
"proposal_voting_periods": any[],
"expedited_voting_period": string
},
"deposit_params": {
"min_deposit": Coin[],
"max_deposit_period": string,
"min_expedited_deposit": Coin[],
"min_initial_deposit_ratio": string
},
"tally_params": {
"quorum": string,
"threshold": string,
"veto_threshold": string,
"expedited_threshold": string
}
}
export interface GovProposal {
"proposal_id": string,
"content": {
"@type": string,
"title": string,
"description": string,
},
"status": string,
"final_tally_result": {
"yes": string,
"abstain": string,
"no": string,
"no_with_veto": string,
},
"submit_time": string,
"deposit_end_time": string,
"total_deposit": Coin[],
"voting_start_time": string,
"voting_end_time": string,
"is_expedited": boolean
}
export interface Tally {
tally: {
yes: string,
abstain: string,
no: string,
no_with_veto: string
}
}
export interface GovVote {
proposal_id: string,
voter: string,
option: string,
options: { "option": string, "weight": string }[]
}
export interface PaginatedProposals extends PaginatedResponse {
proposals: GovProposal[]
}
export interface PaginatedProposalDeposit extends PaginatedResponse {
deposits: Coin[]
}
export interface PaginatedProposalVotes extends PaginatedResponse {
votes: GovVote[]
}
+8 -5
View File
@@ -1,5 +1,8 @@
export * from './Coin'
export * from './Proposal'
export * from './NodeInfo'
export * from './Block'
export * from './SlashingSigningInfo'
export * from './base'
export * from './auth'
export * from './bank'
export * from './common'
export * from './distribution'
export * from './gov'
export * from './staking'
+76
View File
@@ -0,0 +1,76 @@
import type { Key, PaginatedResponse, Coin } from "./common"
export interface Validator {
"operator_address": string,
"consensus_pubkey": Key,
"jailed": boolean,
"status": string,
"tokens": string,
"delegator_shares": string,
"description": {
"moniker": string,
"identity"?: string,
"website"?: string,
"security_contact"?: string,
"details"?: string
},
"unbonding_height": string,
"unbonding_time": string,
"commission": {
"commission_rates": {
"rate": string,
"max_rate": string,
"max_change_rate": string
},
"update_time": string
},
"min_self_delegation": string
}
export interface Delegation {
delegation: {
delegator_address: string,
validator_address: string,
shares: string
},
balance: Coin
}
export interface Redelegation {
}
export interface StakingParam {
params: {
"unbonding_time": string,
"max_validators": number,
"max_entries": number,
"historical_entries": number,
"bond_denom": string,
"min_commission_rate": string,
"min_self_delegation": string
}
}
export interface StakingPool {
pool: {
not_bonded_tokens: string,
bonded_tokens: string
}
}
export interface PaginatedDelegations extends PaginatedResponse {
delegation_responses: Delegation[]
}
export interface PaginatedRedelegations extends PaginatedResponse {
redelegation_responses: Redelegation[]
}
export interface PaginatedUnbonding extends PaginatedResponse {
unbonding_responses: any[]
}
export interface PaginatedValdiators extends PaginatedResponse {
validators: Validator[]
}