Swap And Pool

Swap and Pool APIs support HTTP protocol. It uses point_ namespace.

swap_getPairList

Returns a Pool pair list.

Parameters

None

Return Value

Example

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            [{"pairAddress":"0xC8F12133F7Eb9078666B6ed53e33FBDDE6AC61D3","token0":"0x05cc435514ccaE9ccF282C4f207037965ef41369","token1":"0xe59594F230514C08e4435009F8F67eE0e73AAc35","symbol0":"MYTN1","symbol1":"MYTN2","amount0":1,"amount1":10}]
        }
    }
}

swap_getAmountOut

Returns an expected amountOut value for amountIn.

Parameters

Return Value

Example

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {"amountIn":"0.1","amountOut":"0.808158759822350494"}
    }
}

swap_tokenToToken

Swap ERC20 token to ERC20 token. Before the call, swap_approve must be done for tokenIn by amountIn .

Parameters

In order to perform a transaction, the owner must have a balance of at least 2 GFEI for gas cost.

Return Value

A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net_getTransactionStatus.

Example

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b"
        }
    }
}

swap_getLiquidityRate

Returns a liquidity rate of swap pool for token0 and token1.

Parameters

Return Value

Example

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {"amount0":"0.1","amount1":"0.808158759822350494"}
    }
}

swap_getLiquidityBalance

Returns a liquidity balance of sender.

Parameters

Return Value

Example

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {"balance":"0.216624790355398849"}
    }
}

swap_addLiquidity

Supply liquidity to token0 and token1 Swap Pool. Before the call, swap_approve must be done for tokenIn by amountIn and tokenOut by amountOut.

Parameters

In order to perform a transaction, the owner must have a balance of at least 2 GFEI for gas cost.

Return Value

A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net_getTransactionStatus.

Example

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b"
        }
    }
}

swap_removeLiquidity

Remove liquidity from token0 and token1 Swap Pool. Before the call, swap_approveLiquidity must be done for token0 and token1.

Parameters

In order to perform a transaction, the owner must have a balance of at least 2 GFEI for gas cost.

Return Value

A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net_getTransactionStatus.

Example

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b"
        }   }
}

swap_approve

Approve Token from owner-address to Swap

Parameters

In order to perform a transaction, the from address must have a balance of at least 100 MFEI for gas cost.

Return Value

A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net_getTransactionStatus.

Example

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b"
        }
    }
}

swap_getAllowance

Returns an allowed Token amount from owner address to to spender address.

Parameters

Return Value

Example

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "amount": "100.12"
        }
    }
}

swap_approveLiquidity

Approve liquidity token from owner-address to Swap for remove liquidity.

Parameters

In order to perform a transaction, the from address must have a balance of at least 100 MFEI for gas cost.

Return Value

A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net_getTransactionStatus.

Example

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b"
        }
    }
}

swap_getAllowanceLiquidity

Returns an allowed liquidity token amount from owner address to to spender address.

Parameters

Return Value

Example

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "amount": "100.12"
        }
    }
}

Last updated