UNPKG

@mercurial-finance/dynamic-amm-sdk

Version:

Mercurial Vaults SDK is a typescript library that allows you to interact with Mercurial v2's AMM.

26 lines 1.23 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const web3_js_1 = require("@solana/web3.js"); const anchor_1 = require("@coral-xyz/anchor"); const amm_1 = __importDefault(require("../amm")); const mainnetConnection = new web3_js_1.Connection('https://api.mainnet-beta.solana.com'); const provider = new anchor_1.AnchorProvider(mainnetConnection, new anchor_1.Wallet(web3_js_1.Keypair.generate()), { commitment: 'confirmed', }); async function getClaimableFee(poolAddress, owner) { const pool = await amm_1.default.create(provider.connection, poolAddress); let result = await pool.getUserLockEscrow(owner); console.log('unClaimed: %s', result?.fee.unClaimed.lp?.toString()); console.log(result); } async function main() { // mainnet-beta, SOL-USDC const poolAddress = 'FRd5CJfLU2TDAUK2m3onvwqXs5md3y96Ad1RUMB5fyii'; const owner = '3CCocQighVbWdoav1Fhp6t2K6v7kWtUEd6Sp59UU77Vt'; await getClaimableFee(new web3_js_1.PublicKey(poolAddress), new web3_js_1.PublicKey(owner)); } main(); //# sourceMappingURL=get_claimable_fee.js.map