Single-Collateral Sai
Installation
import { ScdPlugin } from '@makerdao/dai-plugin-scd';
// or
const { ScdPlugin } = require('@makerdao/dai-plugin-scd');Quick example
import Maker from '@makerdao/dai';
import { ScdPlugin } from '@makerdao/dai-plugin-scd';
async function openLockDraw() {
const maker = await Maker.create("http", {
plugins: [ScdPlugin],
privateKey: YOUR_PRIVATE_KEY,
url: 'https://kovan.infura.io/v3/YOUR_INFURA_PROJECT_ID'
});
await maker.authenticate();
const cdpService = await maker.service('cdp');
const cdp = await cdpService.openCdp();
await cdp.lockEth(0.25);
await cdp.drawSai(50);
const debt = await cdp.getDebtValue();
console.log(debt.toString); // '50.00 SAI'
}
openLockDraw();openCdp()
getCdp(int id)
Last updated