Function getQueryClient

Use getRestQueryClient or getRpcQueryClient instead.

  • Gets a client used to query the Sei chain via the REST API.

    Note: the EVM queries are non-functional via the REST API at the time of writing. Try using the RPC Query client instead

    Parameters

    • restEndpoint: string

      The endpoint of the REST node used to interact to the Sei chain.

    Returns Promise<{
        cosmos: {
            accesscontrol_x: {
                v1beta1: LCDQueryClient;
            };
            auth: {
                v1beta1: LCDQueryClient;
            };
            bank: {
                v1beta1: LCDQueryClient;
            };
            distribution: {
                v1beta1: LCDQueryClient;
            };
            feegrant: {
                v1beta1: LCDQueryClient;
            };
            gov: {
                v1beta1: LCDQueryClient;
            };
            staking: {
                v1beta1: LCDQueryClient;
            };
            tx: {
                v1beta1: LCDQueryClient;
            };
            upgrade: {
                v1beta1: LCDQueryClient;
            };
        };
        seiprotocol: {
            seichain: {
                dex: LCDQueryClient;
                epoch: LCDQueryClient;
                evm: LCDQueryClient;
                mint: LCDQueryClient;
                oracle: LCDQueryClient;
                tokenfactory: LCDQueryClient;
            };
        };
    }>

    An LCD client object that can be used to query the Sei chain.

    import { getQueryClient } from '@crownfi/sei-js-core';

    const queryClient = await getQueryClient(REST_URL);

    // Getting the market summary from the Sei dex module
    const dexMarketSummary = await queryClient.seiprotocol.seichain.dex.getMarketSummary(params);

    // Query the bank balance of a given address
    const balances = await queryClient.cosmos.bank.v1beta1.allBalances({ address });

    // Query a specific transaction hash
    const txInfo = await queryClient.cosmos.tx.v1beta1.getTx({ hash });