UNPKG

@indigo-labs/indigo-sdk

Version:

Indigo SDK for interacting with Indigo endpoints via lucid-evolution

43 lines (34 loc) 1.64 kB
import { Blockfrost, Lucid, OutRef } from "@lucid-evolution/lucid"; import { balance, CDPContract, loadSystemParamsFromUrl } from "../src"; async function main() { const lucid = await Lucid( new Blockfrost( 'https://cardano-mainnet.blockfrost.io/api/v0', 'mainnetpb1Y1PczllObhmQKFMO6wm3la39p70k5' ), 'Mainnet' ); lucid.selectWallet.fromSeed('helmet coconut robot path message library verb lobster rigid taxi recall ribbon vacuum uniform horse thumb praise sibling wise frown cattle settle century sad'); const systemParams = await loadSystemParamsFromUrl('https://config.indigoprotocol.io/mainnet/mainnet-system-params-v21.json') const address = await lucid.wallet().address(); const utxos = await lucid.wallet().getUtxos(); const walletBalance = balance(utxos); console.log('Wallet Address', address); console.log('Wallet Balance', walletBalance); // const cdpOutRef: OutRef = {txHash: '70b09ded453b6122688d3cd51e2c75a007f2d801d1104eae734d8f5314b2b393', outputIndex: 0}; const cdpTx = await CDPContract.openPosition('iUSD', 10_000_000n, 7_820_000n, systemParams, lucid); const cdpBTx = await cdpTx.complete(); const cdpBsTx = await cdpBTx.sign.withWallet().complete(); console.log(cdpBsTx.toCBOR()); // const cdpTx = await CDPContract.openPosition( // 'iUSD', // 10_000_000n, // 1_000_000n, // systemParams, // lucid // ); // const cdpBTx = await cdpTx.complete() // const cdpBsTx = await cdpBTx.sign.withWallet().complete() // console.log(cdpBsTx.toCBOR()); } main();