0.1.28 • Published 2 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 build
To 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
2 years ago
0.1.28
2 years ago
0.1.25
2 years ago
0.1.26
2 years ago
0.1.22
2 years ago
0.1.23
2 years ago
0.1.24
2 years ago
0.1.20
3 years ago
0.1.21
3 years ago
0.1.19
3 years ago
0.1.17
3 years ago
0.1.18
3 years ago
0.1.16
3 years ago
0.1.10
3 years ago
0.1.11
3 years ago
0.1.12
3 years ago
0.1.13
3 years ago
0.1.14
3 years ago
0.1.15
3 years ago
0.1.9
3 years ago
0.1.8
3 years ago
0.1.7
3 years ago
0.1.6
3 years ago
0.1.5
3 years ago
0.1.1
3 years ago
0.1.0
3 years ago