@pryzm-finance/ylaunch-js
v0.1.0
Published
Javascript SDK for yLaunch Contracts
Downloads
73
Keywords
Readme
yLaunch JS
This package provides a javascript SDK to interact with the yLaunch contracts.
Installation
npm install @pryzm-finance/ylaunch-js
Usage
import { contracts } from "@pryzm-finance/ylaunch-js";
const signingClient = await SigningCosmWasmClient.connectWithSigner(rpc, signer);
const factoryMsgClient = new contracts.YlaunchFactory.YlaunchFactoryClient(signingClient, walletAddress, contractAddress);
await factoryMsgClient.instantiateLaunch({..}, "auto", memo, []);
await factoryMsgClient.updateStakingContractCodeInfo({..}, "auto", memo, []);
const stakingMsgClient = new contracts.YlaunchStaking.YlaunchStakingClient(signingClient, walletAddress, contractAddress);
await stakingMsgClient.bond({..}, "auto", memo, []);
await stakingMsgClient.unbond({..}, "auto", memo, []);
await stakingMsgClient.exit({..}, "auto", memo, []);
await stakingMsgClient.claimReward({..}, "auto", memo, []);
await stakingMsgClient.claimYStakingYield({..}, "auto", memo, []);
const cosmWasmClient = await CosmWasmClient.connect(rpc);
const factoryQueryClient = new contracts.YlaunchFactory.YlaunchFactoryQueryClient(cosmWasmClient, contractAddress)
await factoryQueryClient.contracts({ .. })
await factoryQueryClient.stakingContractCodeInfo({ .. })
const stakingQueryClient = new contracts.YlaunchStaking.YlaunchStakingQueryClient(cosmWasmClient, contractAddress)
await stakingQueryClient.pools({ .. })
await stakingQueryClient.positions({ .. })
await stakingQueryClient.claimableYStakingYield()
Development
This project uses @cosmwasm/ts-codegen
tool to generate the typescript code from the contract schema files. The schema
json files are located in the schema
directory. To generate the typescript code from the schema files, follow this:
- Install the dependencies:
pnpm install
- Run the codegen script:
pnpm run codegen