/** * @packageDocumentation * @module API-GraphVM */ import LuxCore from "../../lux"; import { RESTAPI } from "../../common/restapi"; import { GraphBlock, GraphTransaction, GraphAccount, ChainInfo, KeyValue } from "./interfaces"; /** * Class for interacting with the G-Chain (Graph Chain) GraphVM API. * * @category RPCAPIs * * @remarks This extends the [[RESTAPI]] class. The G-Chain exposes a GraphQL * interface rather than JSON-RPC. Use [[Lux.addAPI]] to register this * interface with Lux. */ export declare class GraphVMAPI extends RESTAPI { /** * Sends a GraphQL query to the G-Chain endpoint and returns the data * portion of the response. * * @param q The GraphQL query string * * @returns The `data` field from the GraphQL response */ protected query: (q: string) => Promise; /** * Fetches a block by hash or height. * * @param hash Optional block hash * @param height Optional block height * * @returns A Promise for a [[GraphBlock]] */ getBlock: (hash?: string, height?: number) => Promise; /** * Fetches the latest block on the G-Chain. * * @returns A Promise for a [[GraphBlock]] */ getLatestBlock: () => Promise; /** * Fetches a list of recent blocks. * * @param limit Maximum number of blocks to return (default 10) * * @returns A Promise for an array of [[GraphBlock]] */ getBlocks: (limit?: number) => Promise; /** * Fetches a transaction by hash. * * @param hash The transaction hash * * @returns A Promise for a [[GraphTransaction]] */ getTransaction: (hash: string) => Promise; /** * Fetches a list of recent transactions. * * @param limit Maximum number of transactions to return (default 10) * * @returns A Promise for an array of [[GraphTransaction]] */ getTransactions: (limit?: number) => Promise; /** * Fetches account information for a given address. * * @param address The account address * * @returns A Promise for a [[GraphAccount]] */ getAccount: (address: string) => Promise; /** * Fetches the balance of a given address. * * @param address The account address * * @returns A Promise string of the balance */ getBalance: (address: string) => Promise; /** * Fetches information about the current chain. * * @returns A Promise for a [[ChainInfo]] */ getChainInfo: () => Promise; /** * Fetches information about all tracked chains. * * @returns A Promise for an array of [[ChainInfo]] */ getChains: () => Promise; /** * Gets a value from the key-value store. * * @param key The key to look up * * @returns A Promise string of the stored value */ getValue: (key: string) => Promise; /** * Checks whether a key exists in the key-value store. * * @param key The key to check * * @returns A Promise boolean indicating existence */ hasKey: (key: string) => Promise; /** * Iterates over key-value pairs matching a prefix. * * @param prefix The key prefix to match * @param limit Maximum number of results (default 100) * * @returns A Promise for an array of [[KeyValue]] */ iterate: (prefix: string, limit?: number) => Promise; /** * This class should not be instantiated directly. Instead use the * [[Lux.addAPI]] method. * * @param core A reference to the Lux class * @param baseURL Defaults to the string "/ext/bc/G/rpc" as the path to * the G-Chain GraphQL endpoint */ constructor(core: LuxCore, baseURL?: string); } //# sourceMappingURL=api.d.ts.map