get_locked_amount
The get_locked_amount method returns the amount of a coin which is currently locked by a swap which is in progress. If the coin is not activated, a NoSuchCoin error will be returned.
Arguments
| Parameter | Type | Description |
|---|---|---|
| coin | string | The ticker of the coin you want to query. |
Response
| Parameter | Type | Description |
|---|---|---|
| coin | string | The ticker of the coin you queried. |
| locked_amount | object | An object cointaining the locked amount in decimal, fraction and rational formats. |
| locked_amount.decimal | numeric string | The locked amount in decimal format. |
| locked_amount.rational | rational object | The locked amount in rational format. |
| locked_amount.fraction | fraction object | The locked amount in fraction format. |
📌 Examples
Command
POST get_locked_amount
{
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"method": "get_locked_amount",
"params": {
"coin": "DOC"
},
"id": 42
} curl --url "http://127.0.0.1:7783" --data '{
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"method": "get_locked_amount",
"params": {
"coin": "DOC"
},
"id": 42
}' import requests
import json
url = "http://127.0.0.1:7783"
payload = {
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"method": "get_locked_amount",
"params": {
"coin": "DOC"
},
"id": 42
}
response = requests.post(url, json=payload)
print(json.dumps(response.json(), indent=2)) const payload = {
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"method": "get_locked_amount",
"params": {
"coin": "DOC"
},
"id": 42
};
const response = await fetch("http://127.0.0.1:7783", {
method: "POST",
body: JSON.stringify(payload),
});
console.log(await response.json()); <?php
$payload = <<<'JSON'
{
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"method": "get_locked_amount",
"params": {
"coin": "DOC"
},
"id": 42
}
JSON;
$ch = curl_init("http://127.0.0.1:7783");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response; package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{"userpass":"RPC_UserP@SSW0RD","mmrpc":"2.0","method":"get_locked_amount","params":{"coin":"DOC"},"id":42}`)
resp, err := http.Post("http://127.0.0.1:7783", "application/json", bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
} require 'net/http'
require 'json'
require 'uri'
uri = URI("http://127.0.0.1:7783")
payload = {
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"method": "get_locked_amount",
"params": {
"coin": "DOC"
},
"id": 42
}
response = Net::HTTP.post(uri, payload.to_json, 'Content-Type' => 'application/json')
puts JSON.pretty_generate(JSON.parse(response.body)) Show Response
Response (success)
{
"mmrpc": "2.0",
"result": {
"coin": "DOC",
"locked_amount": {
"decimal": "0.77803",
"rational": [
[1, [77803]],
[1, [100000]]
],
"fraction": {
"numer": "77803",
"denom": "100000"
}
}
},
"id": 42
}Response (error)
{
"mmrpc": "2.0",
"error": "No such coin: TIME",
"error_path": "lp_swap.lp_coins",
"error_trace": "lp_swap:486] lp_coins:2894]",
"error_type": "NoSuchCoin",
"error_data": {
"coin": "TIME"
},
"id": 42
}