0.1.28 • Published 4 years ago
@gyrostable/sdk v0.1.28
Gyro SDK
TypeScript/JavaScript SDK to interact with Gyro.
Development
Follow the installation instructions of https://github.com/stablecoin-labs/core
including starting the node and linking the package.
Then run the following
yarn install
yarn link @gyrostable/core
yarn link
yarn buildTo make sure everything is working, try running the tests using yarn test.
To compile automatically when changing something, run yarn build --watch instead of yarn build.
Usage
The SDK is based around the Gyro class, which can be instantiated as follows:
import { Gyro } from "@gyrostable/sdk";
import { ethers } from "ethers";
const provider = new ethers.providers.Web3Provider(window.ethereum);
const gyro = await Gyro.create(provider);
const tokens = await gyro.getSupportedTokens();
const usdt = tokens.find((t) => t.symbol === "USDT");
const weth = tokens.find((t) => t.symbol === "WETH");
const inputs = [
{ token: usdt.address, amount: MonetaryAmount.fromNormalized(2500, usdc.decimals) }
{ token: weth.address, amount: MonetaryAmount.fromNormalized(2, weth.decimals) }
];
const mintResult = await gyro.mint(inputs);
console.log(`Minted ${mintResult} tokens`);
const currentBalance = await gyro.balance();
console.log(`Gyro balance: ${currentBalance.toNormalizedString()}`);0.1.27
4 years ago
0.1.28
4 years ago
0.1.25
4 years ago
0.1.26
4 years ago
0.1.22
4 years ago
0.1.23
4 years ago
0.1.24
4 years ago
0.1.20
5 years ago
0.1.21
5 years ago
0.1.19
5 years ago
0.1.17
5 years ago
0.1.18
5 years ago
0.1.16
5 years ago
0.1.10
5 years ago
0.1.11
5 years ago
0.1.12
5 years ago
0.1.13
5 years ago
0.1.14
5 years ago
0.1.15
5 years ago
0.1.9
5 years ago
0.1.8
5 years ago
0.1.7
5 years ago
0.1.6
5 years ago
0.1.5
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago