UNPKG

@volare.finance/volare.js

Version:
35 lines 1.39 kB
"use strict"; /** * @file apis.ts * @author astra <astra@volare.finance> * @date 2022 */ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const dotenv_1 = require("dotenv"); const src_1 = require("../../src"); (0, dotenv_1.config)({ path: '.env', encoding: 'utf8', }); const URL = String(process.env.API_URL); const CHAIN_ID = Number(process.env.CHAIN_ID); const ENDPOINT = String(process.env.ENDPOINT); (() => tslib_1.__awaiter(void 0, void 0, void 0, function* () { const apis = new src_1.Apis({ config: { DECIMAL_PLACES: 2 }, url: URL, endpoint: ENDPOINT, contracts: (0, src_1.getContractsForChain)(CHAIN_ID), }); console.log(JSON.stringify(yield apis.cash(), undefined, 2)); const longs = yield apis.long.longs(); console.log(JSON.stringify(longs, undefined, 2)); const longPnLs = yield apis.longPnLByOwnerAndVToken('0x77dF10C2e9ecB12E1D811b3291D29cD93D5f7Fa6', '0x3393e4fcb3a39172b13729012f033c726aa641fb'); console.log(JSON.stringify(longPnLs, undefined, 2)); const shorts = yield apis.shorts(); console.log(JSON.stringify(shorts, undefined, 2)); const vaultPnLs = yield apis.vaultPnLByOwnerAndVaultId('0x77dF10C2e9ecB12E1D811b3291D29cD93D5f7Fa6', 1); console.log(JSON.stringify(vaultPnLs, undefined, 2)); }))(); //# sourceMappingURL=apis.js.map