4.1.0 • Published 11 months ago

@nktkas/levana-perps-types v4.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

LevanaPerpsTypes

Types from Rust documentation of Levana Perps in TypeScript

Installation

NPM

npm i @nktkas/levana-perps-types

Deno, Yarn, pnpm, Bun from JSR

deno add @nktkas/levana-perps-types
yarn dlx jsr add @nktkas/levana-perps-types
pnpm dlx jsr add @nktkas/levana-perps-types
bunx jsr add @nktkas/levana-perps-types

Usage

Query to Levana

import type { LevanaCosmWasmClient } from "@nktkas/levana-perps-types";
import { CosmWasmClient } from "@cosmjs/cosmwasm-stargate";

// Testnet factory address
const FACTORY_ADDRESS = "osmo1ymuvx9nydujjghgxxug28w48ptzcu9ysvnynqdw78qgteafj0syq247w5u";

// Osmosis testnet RPC endpoint
const RPC_ENDPOINT = "https://rpc.osmotest5.osmosis.zone";

// TypeScript automatically recognizes a query, offers certain hints, and returns the appropriate response type for the query
const levanaCosmWasmClient = await CosmWasmClient.connect(RPC_ENDPOINT) as LevanaCosmWasmClient;

const marketsResp = await levanaCosmWasmClient.queryContractSmart(FACTORY_ADDRESS, {
    markets: {},
});
console.log("Markets maintained by this factory:", marketsResp);

const marketInfoResponse = await levanaCosmWasmClient.queryContractSmart(FACTORY_ADDRESS, {
    market_info: {
        market_id: marketsResp.markets[0],
    },
});
console.log("Information about a specific market:", marketInfoResponse);

const statusResp = await levanaCosmWasmClient.queryContractSmart(marketInfoResponse.market_addr, {
    status: {},
});
console.log("Overall market status information:", statusResp);

const nftContractInfo = await levanaCosmWasmClient.queryContractSmart(marketInfoResponse.market_addr, {
    nft_proxy: {
        nft_msg: {
            contract_info: {},
        },
    },
});
console.log("Top-level metadata about the position contract:", nftContractInfo);

License

This project is licensed under the MIT License. Check the License file for more info.

4.1.0

11 months ago

4.0.0

11 months ago

3.1.0

11 months ago

3.0.6

11 months ago

3.0.5

11 months ago

3.0.4

11 months ago

3.0.3

11 months ago