synths-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.1.5 • Public • Published

synths-sdk

CI

Documentation

Using the Yam Uma Synths SDK

Official assets: File and Raw file

Install

yarn add synths-sdk

Use

import Synths from "synths-sdk";
import { ethers } from "ethers";

// Create an ethers provider instance
const provider = new ethers.providers.Web3Provider(web3Provider);

// Initialize the sdk with the official yam synths
const synthsSDK = await Synths.create({
  ethersProvider: provider,
});

// Connect the sdk to a synth
const upunksAsset = await synthsSDK.connectAsset("upunks-0921");

// Example method calls
const gcr: any = await upunksAsset.getGCR();
// Alternatively you can pass your own synth object or modify the existing synths for a local test network deployment
const chainId = 1;
const userAssetsConfig: SynthsAssetsConfig = {
  [chainId]: {
    upunks: [
      {
        name: "September",
        cycle: "09",
        year: "21",
        collateral: "WETH",
        token: {
          address: "0x86140A763077155964754968B6F6e243fE809cBe",
          token: 18,
        },
        emp: {
          address: "0xF8eF02C10C473CA5E48b10c62ba4d46115dd2288",
          new: true,
          type: "finlib",
        },
        pool: {
          address: "0x6e01db46b183593374a49c0025e42c4bb7ee3ffa",
          location: "sushiswap",
        },
        expired: false,
      },
    ],
  },
};

const synthsSDK = await Synths.create({
  ethersProvider: provider,
  userAssetsConfig: userAssetsConfig,
});

Development

After cloning the synths repo, copy over the .env.template file and fill in variables.

# Copy over the .env.template file to .env and fill in variables.
yarn install
yarn test

Local testnet deployment

yarn hardhat node
yarn hardhat deploy --network localhost

Package Sidebar

Install

npm i synths-sdk

Weekly Downloads

3

Version

1.1.5

License

MIT

Unpacked Size

724 kB

Total Files

147

Last publish

Collaborators

  • ethedev