@pylon-protocol/sdk
TypeScript icon, indicating that this package has built-in type declarations

1.3.16 • Public • Published

@pylon-protocol/sdk

Github Actions Status NPM

Official Javascript & Typescript SDK to interact with Pylon Protocol.

Getting Started

Installing Pylon Protocol SDK

 $ yarn add @pylon-protocol/sdk

Using Pylon SDK

You need to provide a LCDClient instance on Pylon constructor.

import { LCDClient } from '@terra-money/terra.js';
import { Pylon } from '@pylon-protocol/sdk';

const lcd = new LCDClient({
  URL: 'https://columbus-lcd.terra.dev',
  chainID: 'columbus-5',
  isClassic: true,
});

const pylon = new Pylon(lcd);

Interacting with Pylon Gateway

Listing Projects in Pylon Gateway

const projects = await pylon.gateway.listProjects();

const mine = projects.find((project) => project.symbol === 'MINE');
console.log(mine);

// {
//   "type": "token",
//   "symbol": "MINE",
//   "name": "Pylon Protocol",
//   ...

Deposit into Project

const mine = await pylon.gateway.getProject('MINE');
const { transactions } = await mine.pools['A'].deposit(myWallet.address, 10_000 /* UST */);

console.log(await mine.pools['A'].statusOf(myWallet.address)]);
// {
//   "stakedUst": 10000,
//   "rewardTokens": 1.3233,
//   ...

Participating on the Governance

const polls = await pylon.governance.listPolls();
const transactions = await pylon.governance.createPoll(myAddress, '[General] Example poll', ...)

References

License: MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @pylon-protocol/sdk

Weekly Downloads

3

Version

1.3.16

License

MIT

Unpacked Size

379 kB

Total Files

141

Last publish

Collaborators

  • pylon-protocol