npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

test-tcv-platform-sdk

v0.0.23

Published

- [Table of contents](#table-of-contents) - [TCV PLATFORM SDK](#tcv-platform-sdk) - [TCV](#tcv) - [getPoolTCV](#get-pool-tcv) - [getInfoVaultToken](#get-info-vault-token) - [getInfoVaultManager](#get-info-vault-manager) - [getInfoVaultRa

Downloads

36

Readme

Table of contents

TCV PLATFORM SDK

import {TCV} from "tcv-platform-sdk"

Information about one vault

TCV

const tcv = new TCV(_wallet, _TCVAddress);

get pool TCV

const poolsInVault = await tcv.getPoolTCV();

get info vault token

const token0AndToken1InVault = await tcv.getInfoVaultToken();

get info vault manager

const manager = await tcv.getInfoVaultManager();

get info vault ranges

const rangesSetInVault = await tcv.getInfoVaultRanges();

TCV Factory

Information about vaults have been deployed

const tcvFactory = new TCVFactory( _wallet, _chainId );

deploy vault

const deployVault = await tcvFactory.deployVault(
    feeTier,
    token0,
    token1,
    owner,
    init0,
    init1,
    manager,
    routers,
    isBeacon
    )

get vaults

const getVaults = await tcvFactory.getVaults(startIndex, endIndex);

get num vaults

const numVaults = await tcvFactory.getNumVaults();

UniswapV3

Get info Vault when addLiqudity or removeLiquidity in a pool in uniswap v3 Function amountsForAddLiquidity return amount of token0 and token1 when addLiquidity ( display amount when adding )

Function liquidityForAmounts will return amount of liquidity when add with amount of token0, and token1

Function getPoolAddress to get address the pool which vault add liquidity

Functon getPosition get liquidity, token0Owed, token1Owed in pool address with positionId is id of vault with range

Function getAmountInOther return amount of token1 in token0 when token0 is base Assest( ust or wbnb) ( for example meaning 1 cake = 10 usdt )

Function PriceInOther wil get price of token1 in token0(base Assest token (usdt, wbnb))

Function getPriceLp => get price of lp token in usdt

Function get getTVL => get amount tvl in usdt

Function get amountsForRemoveLiquidity when proving amountMin0, amountMin1 it will return the amount liquidity to burn and amount0, amount1

=> if funcitons require lowertick, uppertick, feetier, you need to get information about range in funciton getInfoVaultRanges, if range is a array all this do with for loop

const uniswapv3 = new UniswapV3(_wallet, _chainId );

amounts for add liquidity

Get amount0, amount1 when provide amount of one token

const amountReturn = await uniswapv3.amountsForAddLiquidity(
    slippage: number, 
    zeroToOne: boolean, // mean what token input first
    amountMax: uint256, 
    token0: EthAddress, 
    token1: EthAddress, 
    lowerTick: uint256, 
    upperTick: uint256, 
    feeTier: uint256
    )

get position

const getTVLTokens = await uniswapv3.getPosition(
    addressPool: EthAddress, 
    addressTCVVault: EthAddress, 
    lowerTick: uint256, 
    upperTick: uint256)

get pool address

const poolAddress = await uniswapv3.getPoolAddress( token0, token1, feeTier);

liquidity for amounts

Function return amount of liquidity, token0, token1, feeTier, lowerTick, upperTick, you can get from vault info amount0, amount1 is return of funciton amountsForAddLiquidity

const amount = await uniswapv3.liquidityForAmounts(
  token0: EthAddress, 
  token1: EthAddress, 
  feeTier: uint256, 
  lowerTick: uint256, 
  upperTick: uint256, 
  amount0: uint256, 
  amount1: uint256)

get amount in other

input token0 is base assest token wanted to change token1 into token0

  const amount = await uniswap.getAmountInOther(
    amountIn: uint256, 
    slippage: number, 
    token0: EthAddress, 
    token1: EthAddress,
     feeTier: uint256)

get price in other

input token0 is base assest token wanted to change token1 into token0

  const price = await uniswap.getPriceInOther(
    slippage: number, 
    token0: EthAddress, 
    token1: EthAddress, 
    feeTier: uint256)

get price LP

  const priceLP = await uniswap.getPriceLP(
    tcvVault:EthAddress, 
    feeTier: uint256, 
    lowerTick:uint256, 
    upperTick: uint256)

get TVL

const tvl = await uniswap.getTVL(
  tcvVault:EthAddress, 
  feeTier: uint256, 
  lowerTick:uint256, 
  upperTick: uint256)

amounts for remove liquidity

return amount of liquidity to remove with provide of amount0Min, amount1Min

const amountBurn = await uniswap.(
  amount0Min: uint256, 
  amount1Min: uint256, 
  token0: EthAddress, 
  token1: EthAddress, 
  lowerTick: uint256, 
  upperTick: uint256, 
  feeTier: uint256)

TCV Router

Router for user to add liquidity, remove liquidity receiver address is zero_address if you won't stake to vault if stake, it will be address of vault stake

Function removeLiquidity provide amountBurn, this amount you need to get in first element of array from function amountsForRemoveLiquidity in uniswap

const tcvRouter = new TCVRouter( _wallet, _chainId);

add liquidity

const addLiqudity = tcvRouter.addLiquidity(
    amount0Max:uint256, 
    amount1Max:uint256, 
    vaultAddress:EthAddress, 
    receiver:EthAddress
    )

remove liquidity

const removeLiqudity = tcvRouter.removeLiquidity(
    amountBurn:uint256, 
    amount0Min:EthAddress, 
    amount1Min:EthAddress, 
    vaultAddress:EthAddress, 
    receiver:EthAddress
    )