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

NameTypeDescription

pairAddress

String

Pair address

token0

String

Address of token 0

token1

String

Address of token 1

symbol0

String

Symbol of token 0

symbol1

String

Symbol of token 1

amount0

BigDecimal

Liquidity ratio of token 0 at the time of creation

amount1

BigDecimal

Liquidity ratio of token 1 at the time of creation

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

NameTypeDescription

amountIn

BigDecimal

Amount In of token 0

tokenIn

String

Address of token in

tokenOut

String

Address of token out

sender

String

Address of sender

Return Value

NameTypeDescription

amountIn

BigDecimal

Amount in of token in

amountOut

BigDecimal

Amount out of token out

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

NameTypeDescription

amountIn

BigDecimal

Amount In

tokenIn

String

Address of token in

tokenOut

String

Address of token out

sender

String

Address of sender

comment

String

Comment Max length : 200

tempKey

String

tempKey for "swap"

hashKey

String

hash(tempKey | secretKey)

signature

String

sign( hash( amountIn | amountOut | tokenIn | sender | tempKey | hashKey ) ) by sender's privateKey using signData API

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

Return Value

NameTypeDescription

transactionId

String

Transaction Id

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

NameTypeDescription

token0

String

Address of token 0

token1

String

Address of token 1

sender

String

Address of sender

Return Value

NameTypeDescription

amount0

BigDecimal

Amount in of token 0

amount1

BigDecimal

Amount out of token 1

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

NameTypeDescription

token0

String

Address of token 0

token1

String

Address of token 1

sender

String

Address of sender

Return Value

NameTypeDescription

balance

BigDecimal

Liquidity balance of sender

amount1

BigDecimal

Amount out of token 1

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

NameTypeDescription

amount0

BigDecimal

Amount of token 0

amount1

BigDecimal

Amount of token 1

token0

String

Address of token 0

token1

String

Address of token 1

sender

String

Address of sender

comment

String

Comment Max length : 200

tempKey

String

tempKey for "addLiquidity"

hashKey

String

hash(tempKey | secretKey)

signature

String

sign( hash( amount0 | amount1 | token0 | token1 | sender | tempKey | hashKey ) ) by sender's privateKey using signData API

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

Return Value

NameTypeDescription

transactionId

String

Transaction Id

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

NameTypeDescription

liquidity

BigDecimal

Amount of remove

token0

String

Address of token 0

token1

String

Address of token 1

sender

String

Address of sender

comment

String

Comment Max length : 200

tempKey

String

tempKey for "removeLiquidity"

hashKey

String

hash(tempKey | secretKey)

signature

String

sign( hash( liquidity | token0 | token1 | sender | tempKey | hashKey ) ) by sender's privateKey using signData API

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

Return Value

NameTypeDescription

transactionId

String

Transaction Id

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

NameTypeDescription

contractAddress

String

Contract address of token

sender

String

Sender address

amount

BigDecimal

Approve amount.

comment

String

Comment Max length : 200

tempKey

String

tempKey for "approve"

hashKey

String

hash(tempKey | fromAddress' secretKey)

signature

String

sign( hash ( contractAddress | sender | amount | tempKey | hashKey ) ) by sender's privateKey using signData API

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

Return Value

NameTypeDescription

transactionId

String

Transaction Id

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

NameTypeDescription

contractAddress

String

Contract address of token.

address

String

Allower address

spender

String

Spender address

Return Value

NameTypeDescription

amount

BigDecimal

Allowed Token amount.

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

NameTypeDescription

token0

String

Address of token0

token1

String

Address of token1

sender

String

Sender address

amount

BigDecimal

Approve amount.

comment

String

Comment Max length : 200

tempKey

String

tempKey for "approve"

hashKey

String

hash(tempKey | fromAddress' secretKey)

signature

String

sign( hash ( token0 | token1 | sender | amount | tempKey | hashKey ) ) by sender's privateKey using signData API

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

Return Value

NameTypeDescription

transactionId

String

Transaction Id

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

NameTypeDescription

token0

String

Address of token0

token1

String

Address of token1

address

String

Allower address

spender

String

Spender address

Return Value

NameTypeDescription

amount

BigDecimal

Allowed Token amount.

Example

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

Last updated