UNPKG

@pokt-network/pocket-js

Version:

Pocket-js core package with the main functionalities to interact with the Pocket Network.

254 lines (253 loc) 14 kB
import { IRPCProvider } from "../providers"; import { QueryBlockResponse, RpcError, QueryTXResponse, QueryHeightResponse, QueryBalanceResponse, QueryNodeResponse, QueryNodeParamsResponse, QueryNodeReceiptsResponse, QueryNodeReceiptResponse, QueryAppsResponse, QueryAppResponse, QueryAppParamsResponse, QueryPocketParamsResponse, QuerySupportedChainsResponse, QuerySupplyResponse, QueryAccountResponse, StakingStatus } from ".."; import { ChallengeRequest } from "../models/input/challenge-request"; import { ChallengeResponse } from "../models/output/challenge-response"; import { QueryAccountTxsResponse } from "../models/output/query-account-txs-response"; import { JailedStatus } from "../models/jailed-status"; import { QueryNodesResponse, QueryAllParamsResponse, QueryUpgradeResponse } from "../models"; import { QueryBlockTxsResponse } from "../models/output/query-block-txs-response"; import { QueryNodeClaimResponse } from "../models/output/query-node-claim-response"; import { QueryNodeClaimsResponse } from "../models/output/query-node-claims-response"; export declare class QueryNamespace { readonly rpcProvider: IRPCProvider; /** * @description Query namespace class * @param {IRPCProvider} rpcProvider - RPC Provider interface object. */ constructor(rpcProvider: IRPCProvider); /** * * Query a Block information * @param {BigInt} blockHeight - Block's number. * @param {number} timeout - Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getBlock(blockHeight?: BigInt, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryBlockResponse | RpcError>; /** * * Query a Block transaction list * @param {BigInt} blockHeight - Block's number. * @param {boolean} prove - True or false to include the tx proof. * @param {number} page - Page number, default 1. * @param {number} perPage - Records count per page, default 30. * @param {number} timeout - Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getBlockTxs(blockHeight?: BigInt, prove?: boolean, page?: number, perPage?: number, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryBlockTxsResponse | RpcError>; /** * * Retrieves a transaction information * @param {string} txHash - Transaction hash. * @param {number} timeout - Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getTX(txHash: string, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryTXResponse | RpcError>; /** * * Get the current network block height * @param {number} timeout - Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getHeight(timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryHeightResponse | RpcError>; /** * * Retrieves an account balance * @param {string} address - Account's address. * @param {BigInt} blockHeight - Block's number. * @param {number} timeout - Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getBalance(address: string, blockHeight?: BigInt, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryBalanceResponse | RpcError>; /** * * Retrieves a list of validator nodes * @param {StakingStatus} stakingStatus - Staking status. * @param {JailedStatus} jailedStatus - Jailed status. * @param {BigInt} blockHeight - Block's number. * @param {string} blockchain - (optional) Blockchain Identifier. * @param {number} page - (optional) Page number, default 1. * @param {number} perPage - (optional) Records count per page, default 30. * @param {number} timeout - (optional) Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getNodes(stakingStatus?: StakingStatus, jailedStatus?: JailedStatus, blockHeight?: BigInt, blockchain?: string, page?: number, perPage?: number, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryNodesResponse | RpcError>; /** * * Query a Node information * @param {string} address - Node address. * @param {BigInt} blockHeight - Block's number. * @param {number} timeout - Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getNode(address: string, blockHeight?: BigInt, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryNodeResponse | RpcError>; /** * * Retrieves the node params * @param {BigInt} blockHeight - Block's number. * @param {number} timeout - Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getNodeParams(blockHeight?: BigInt, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryNodeParamsResponse | RpcError>; /** * * Retrieves the node receipts information * @param {string} address - Node's address. * @param {BigInt} blockHeight - Block's number. * @param {number} timeout - Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getNodeReceipts(address: string, blockHeight?: BigInt, page?: number, perPage?: number, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryNodeReceiptsResponse | RpcError>; /** * * Retrieves the node receipt information * @param {string} address - Node's address. * @param {string} appPubKey - Node's address. * @param {string} blockchain - Node's address. * @param {BigInt} height - Node's address. * @param {BigInt} sessionBlockHeight - Node's address. * @param {string} receiptType - Node's address. * @param {number} timeout - Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getNodeReceipt(address: string, appPubKey: string, blockchain: string, height: BigInt, sessionBlockHeight: BigInt, receiptType: string, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryNodeReceiptResponse | RpcError>; /** * * Retrieves a list of apps * @param {StakingStatus} stakingStatus - Staking status. * @param {BigInt} blockHeight - Block's number. * @param {string} blockchain - (optional) Blockchain identifier. * @param {BigInt} page - (optional) Block's number. * @param {BigInt} perPage - (optional) Block's number. * @param {number} timeout - (optional) Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getApps(stakingStatus?: StakingStatus, blockHeight?: BigInt, blockchain?: string, page?: number, perPage?: number, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryAppsResponse | RpcError>; /** * * Retrieves an app information * @param {string} address - Address of the app. * @param {BigInt} blockHeight - Block's number. * @param {number} timeout - Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getApp(address: string, blockHeight?: BigInt, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryAppResponse | RpcError>; /** * * Retrieves app params. * @param {BigInt} blockHeight - Block's number. * @param {number} timeout - Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getAppParams(blockHeight?: BigInt, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryAppParamsResponse | RpcError>; /** * * Retrieves the pocket params. * @param {BigInt} blockHeight - Block's number. * @param {number} timeout - Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getPocketParams(blockHeight?: BigInt, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryPocketParamsResponse | RpcError>; /** * * Retrieves supported chains * @param {BigInt} blockHeight - Block's number. * @param {number} timeout - Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getSupportedChains(blockHeight?: BigInt, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QuerySupportedChainsResponse | RpcError>; /** * * Retrieves current supply information * @param {BigInt} blockHeight - Block's number. * @param {number} timeout - Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getSupply(blockHeight?: BigInt, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QuerySupplyResponse | RpcError>; /** * * Retrieves current Account information * @param {string} address - Account's address. * @param {number} timeout - Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getAccount(address: string, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryAccountResponse | RpcError>; /** * * Retrieves an account transaction list * @param {string} address - Account's address. * @param {boolean} received - Filters for received or sent txs. * @param {boolean} prove - True or false to include the tx proof. * @param {number} page - (optional) Page number, default 1. * @param {number} perPage - (optional) Records count per page, default 30. * @param {number} timeout - (optional) Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getAccountTxs(address: string, received: boolean, prove: boolean, page?: number, perPage?: number, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryAccountTxsResponse | RpcError>; /** * Returns the list of all pending claims submitted by node address at height, height = 0 is used as latest * @param {string} address - Node's address. * @param {BigInt} appPubKey - Application public key. * @param {nuber} blockchain - Blockchain hash. * @param {nuber} height - Block height. * @param {nuber} sessionBlockHeight - Session block height. * @param {nuber} receiptType - Receipt type, can be "relay" or "challenge". * @param {nuber} timeout - (Optional) Request timeout value, default 60000. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getNodeClaim(address: string, appPubKey: string, blockchain: string, height: BigInt, sessionBlockHeight: BigInt, receiptType: string, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryNodeClaimResponse | RpcError>; /** * Returns the node pending claim for specific session * @param {string} address - Node's address. * @param {BigInt} height - Block height. * @param {nuber} page - (Optional) Page number, default 1. * @param {nuber} perPage - (Optional) Per page amount of records, default 30. * @param {nuber} timeout - (Optional) Request timeout value, default 60000. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getNodeClaims(address: string, height: BigInt, page?: number, perPage?: number, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryNodeClaimsResponse | RpcError>; /** * Returns the node parameters at the specified height, height = 0 is used as latest * @param {nuber} height - Block height. * @param {nuber} timeout - (Optional) Request timeout value, default 60000. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getAllParams(height: BigInt, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryAllParamsResponse | RpcError>; /** * Returns the network transaction codec upgrade height from amino to protobuf * @param {nuber} height - Block height. * @param {nuber} timeout - (Optional) Request timeout value, default 60000. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ getUpgrade(timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<QueryUpgradeResponse | RpcError>; /** * * Retrieves a ChallengeResponse object. * @param {ChallengeRequest} request - The ChallengeRequest * @param {number} timeout - Request timeout. * @param {boolean} rejectSelfSignedCertificates - force certificates to come from CAs * @memberof QueryNamespace */ requestChallenge(request: ChallengeRequest, timeout?: number, rejectSelfSignedCertificates?: boolean): Promise<ChallengeResponse | RpcError>; }