UNPKG

pumpfun-swap-sdk

Version:

SDK for interacting with the PumpFun AMM on Solana

24 lines (23 loc) 1.24 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const chai = require('chai'); const { expect } = chai; const bn_js_1 = __importDefault(require("bn.js")); const deposit_1 = require("../sdk/deposit"); describe('deposit function', () => { it('should calculate maxInAmount, maxOutAmount, and lpTokenAmount correctly', () => { const token0 = new bn_js_1.default(1000); // Example input token amount const slippage = 1; const token0Reserve = new bn_js_1.default(1000000); // Example input reserve in the pool const token1Reserve = new bn_js_1.default(2000000); // Example output reserve in the pool const totalLpTokens = new bn_js_1.default(50000); // Example total LP token supply const result = (0, deposit_1.depositToken0Internal)(token0, slippage, token0Reserve, token1Reserve, totalLpTokens); expect(result.token1.toString()).eq('2000'); expect(result.lpToken.toString()).eq('50'); expect(result.maxToken0.toString()).eq('1010'); expect(result.maxToken1.toString()).eq('2020'); }); });