return types

This commit is contained in:
liangping 2023-04-05 10:45:49 +08:00
parent 727f8ea026
commit 8e3c9eea0c
4 changed files with 22 additions and 9 deletions

View File

@ -1,11 +1,10 @@
import type { Block, Coin, NodeInfo, PaginatedTendermintValidator, SlashingSigningInfo } from "@/types"; import type { AuthAccount, Block, Coin, NodeInfo, PaginabledAccounts, PaginatedTendermintValidator,} from "@/types";
import type { AuthAccount, PaginabledAccounts } from "@/types/Auth";
import type { PaginatedTxs, Tx, TxResponse } from "@/types/Tx";
import type { Txs } from "@/types/Txs";
import type { BankParams, PaginatedBalances, PaginatedDenomMetadata, PaginatedSupply } from "@/types/bank"; import type { BankParams, PaginatedBalances, PaginatedDenomMetadata, PaginatedSupply } from "@/types/bank";
import type { DistributionParams, PaginatedSlashes } from "@/types/distribution"; import type { DistributionParams, PaginatedSlashes } from "@/types/distribution";
import type { GovParams, GovProposal, GovVote, PaginatedProposalDeposit, PaginatedProposalVotes, PaginatedProposals, Tally } from "@/types/gov"; import type { GovParams, GovProposal, GovVote, PaginatedProposalDeposit, PaginatedProposalVotes, PaginatedProposals, Tally } from "@/types/gov";
import type { PaginatedSigningInfo } from "@/types/slashing";
import type { Delegation, PaginatedDelegations, PaginatedRedelegations, PaginatedUnbonding, PaginatedValdiators, StakingParam, StakingPool, Validator } from "@/types/staking"; import type { Delegation, PaginatedDelegations, PaginatedRedelegations, PaginatedUnbonding, PaginatedValdiators, StakingParam, StakingPool, Validator } from "@/types/staking";
import type { PaginatedTxs, Tx, TxResponse } from "@/types/tx";
import semver from "semver"; import semver from "semver";
@ -32,7 +31,7 @@ export interface RequestRegistry {
distribution_validator_slashes: Request<PaginatedSlashes>; distribution_validator_slashes: Request<PaginatedSlashes>;
slashing_params: Request<any>; slashing_params: Request<any>;
slashing_signing_info: Request<SlashingSigningInfo>; slashing_signing_info: Request<PaginatedSigningInfo>;
gov_params_voting: Request<GovParams>; gov_params_voting: Request<GovParams>;
gov_params_tally: Request<GovParams>; gov_params_tally: Request<GovParams>;
@ -64,7 +63,7 @@ export interface RequestRegistry {
base_tendermint_validatorsets_height: Request<PaginatedTendermintValidator>; base_tendermint_validatorsets_height: Request<PaginatedTendermintValidator>;
tx_txs: Request<PaginatedTxs>; tx_txs: Request<PaginatedTxs>;
tx_txs_block: Request<Txs>; tx_txs_block: Request<Tx>;
tx_hash: Request<{tx: Tx, tx_response: TxResponse}>; tx_hash: Request<{tx: Tx, tx_response: TxResponse}>;
} }

View File

@ -5,7 +5,7 @@ async function tt() {
const address = "echelon1uattqtrtv8944qkmh44ll97qjacj6tgrekqzm9" const address = "echelon1uattqtrtv8944qkmh44ll97qjacj6tgrekqzm9"
const validator = "echelonvaloper1uattqtrtv8944qkmh44ll97qjacj6tgr2cupk4" const validator = "echelonvaloper1uattqtrtv8944qkmh44ll97qjacj6tgr2cupk4"
const client = new CosmosRestClient("https://api.ech.network") const client = new CosmosRestClient("https://api.ech.network")
let response = await client.getTx("EFF175AF4D46532CFACA4A0F0748DFF1EF8CC1C96DA967D8AFB794EFE048461C"); let response = await client.getSlashingSigningInfos();
console.log('response:', response) console.log('response:', response)
} }
tt() tt()

View File

@ -1,5 +1,5 @@
import type { Coin } from "./Coin"
import type { PaginatedResponse } from "./common" import type { Coin, PaginatedResponse } from "./common"
export interface GovParams { export interface GovParams {
"voting_params": { "voting_params": {

14
src/types/slashing.ts Normal file
View File

@ -0,0 +1,14 @@
import type { PaginatedResponse } from "./common";
export interface SigningInfo {
"address": string,
"start_height": string,
"index_offset": string,
"jailed_until": string,
"tombstoned": boolean,
"missed_blocks_counter": string
}
export interface PaginatedSigningInfo extends PaginatedResponse {
info: SigningInfo[]
}