Skip to content

Client Methods

Xane’s client is currently a server that stores the state and generates proofs.

Users of Xane will interact with Xane’s client using methods.

You can check the schema of methods inside this file in the repo.

Read Methods

Below are the methods that only read some data from Xane’s client.

Those methods don’t modify the state itself and seperated by categories.

Balances

getAllBalances

Takes: Nothing.

Returns: All users’ balances in each token.

getBalancesByOwner

Takes: A user address.

Returns: The user’s balances in each token.

getBalancesByTokenId

Takes: A token ID.

Returns: All users’ balances in the given token.

getBalance

Takes: A user address and a token ID.

Returns: The user’s balance in the given token.

Pools

getAllPools

Takes: Nothing.

Returns: All AMM pools.

getPoolsByBaseTokenId

Takes: A token ID.

Returns: All AMM pools where the given token is the base currency.

getPoolsByQuoteTokenId

Takes: A token ID.

Returns: All AMM pools where the given token is the quote currency.

getPool

Takes: Two token IDs.

Returns: All AMM pools where the given tokens are the base and quote currencies.

Liquidities

getAllLiquidities

Takes: Nothing.

Returns: All users’ liquidities in each pool.

getLiquiditiesByProvider

Takes: A user address.

Returns: The user’s liquidities in each pool.

getLiquiditiesByPool

Takes: Two token IDs.

Returns: All users’ liquidities in the pool where the given tokens are the base and quote currencies.

getLiquidity

Takes: A user address and two token IDs.

Returns: The user’s liquidity in the pool where the given tokens are the base and quote currencies.

Write Methods

Below are the methods that write some data to Xane’s client.

Those methods try to modify the state and seperated by categories.

Pools

createPool

Takes: The user’s address, signature, two token IDs and amounts for those tokens.

Returns: Creates an AMM pool, if the user has enough balance and the same pool isn’t created before.

Liquidities

addLiquidity

Takes: The user’s address, signature, two token IDs, amount of the base currency and a maximum limit for the quote currency.

Returns: Adds liquidity to the AMM pool where the given tokens are the base and quote currencies based on the amount and the maximum limit given, if the user has enough balance and the maximum limit isn’t exceeded.

removeLiquidity

Takes: The user’s address, signature, two token IDs, amount of the LP points to be removed, and minimum limits for the base and quote currencies.

Returns: Removes liquidity from the AMM pool where the given tokens are the base and quote currencies based on the amount of LP points and the minimum limits given, if the user has enough LP points and the minimums limits aren’t missed.

Swaps

buy

Takes: The user’s address, signature, two token IDs, amount of the base currency and a maximum limit for the quote currency.

Returns: Buys the given amount of base currency from the AMM pool where the given tokens are the base and quote currencies based on the maximum limit given, if the user has enough balance in the quote currency and the maximum limit isn’t exceeded.

sell

Takes: The user’s address, signature, two token IDs, amount of the base currency and a minimum limit for the quote currency.

Returns: Sells the given amount of base currency to the AMM pool where the given tokens are the base and quote currencies based on the minimum limit given, if the user has enough balance in the base currency and the minimum limit isn’t exceeded.