This project is an API for trading on the Lunes DEX using the Uniswap V2 protocol. The API is built with TypeScript and uses the Polkadot.js library for interacting with smart contracts on the blockchain.
The API provides the following features:
addLiquidityNative
: Adds liquidity using the native token of the blockchain.addLiquidityAsset
: Adds liquidity using specific tokens.
removeLiquidityNative
: Removes liquidity and retrieves the native token.removeLiquidityToken
: Removes liquidity and retrieves specific tokens.
reservesLPToken
: Queries the liquidity reserves for a specific token pair.
priceTokenInt
: Gets the price of one token in terms of another within the liquidity pair.priceTokenOut
: Calculates the amount of tokens received after a swap.
swapTokensForExactTokens
: Executes a swap between specific tokens.swapNativeForExactToken
: Executes a swap using the native token of the blockchain.
balanceToken
: Retrieves the balance of a specific token in the wallet.myBalanceLiquidity
: Retrieves the liquidity balance for a specific token pair.
@polkadot/api
: Polkadot.js library for blockchain interactions.chai
: Assertion library for testing.typescript
: Superset of JavaScript that adds static types.
-
Clone the repository:
git clone https://github.com/seu-usuario/dex-trade-api.git
-
Install dependencies::
yarn
-
Compile TypeScript::
yarn run build