-
Notifications
You must be signed in to change notification settings - Fork 122
Tokenization API Document
{"symbol":"str", "name":"str", "isDAT":bool, "decimal":n, "limit":n, "mintable":bool, "tradeable":bool, "collateralAddress":"str"} ( [{"txid":"hex","vout":n},...] )
Creates (and submits to local node and network) a token creation transaction with given metadata. The first optional argument (may be empty array) is an array of specific UTXOs to spend.
Arguments:
1. metadata (json object)
{
"symbol": "str", (string, required) Token's symbol (unique), no longer than 8
"name": "str", (string) Token's name (optional), no longer than 128
"isDAT": bool, (boolean) Token's 'isDAT' property (bool, optional), default is 'False'
"decimal": n, (numeric) Token's decimal places (optional, fixed to 8 for now, unchecked)
"limit": n, (numeric) Token's total supply limit (optional, zero for now, unchecked)
"mintable": bool, (boolean) Token's 'Mintable' property (bool, optional), fixed to 'True' for now
"tradeable": bool, (boolean) Token's 'Tradeable' property (bool, optional), fixed to 'True' for now
"collateralAddress": "str", (string, required) Any valid destination for keeping collateral amount - used as token's owner auth
}
2. inputs (json array, optional) A json array of json objects
[
{ (json object)
"txid": "hex", (string, required) The transaction id
"vout": n, (numeric, required) The output number
},
...
]
Result:
"hash" (string) The hex-encoded hash of broadcasted transaction
Examples:
> defi-cli createtoken "{\"symbol\":\"MyToken\",\"collateralAddress\":\"address\"}"
> defi-cli createtoken "{\"symbol\":\"MyToken\",\"collateralAddress\":\"address\"}" "[{\"txid\":\"id\",\"vout\":0}]"
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createtoken", "params": ["{\"symbol\":\"MyToken\",\"collateralAddress\":\"address\"}" "[{\"txid\":\"id\",\"vout\":0}]"] }' -H 'content-type: text/plain;' http://127.0.0.1:8554/
"token" ( [{"txid":"hex","vout":n},...] )
Creates (and submits to local node and network) a transaction destroying your token. Collateral will be unlocked. The first optional argument (may be empty array) is an array of specific UTXOs to spend. One of UTXO's must belong to the token's owner (collateral) address
Arguments:
1. token (string, required) The tokens's symbol, id or creation tx
2. inputs (json array, optional) A json array of json objects. Provide it if you want to spent specific UTXOs
[
{ (json object)
"txid": "hex", (string, required) The transaction id
"vout": n, (numeric, required) The output number
},
...
]
Result:
"hash" (string) The hex-encoded hash of broadcasted transaction
Examples:
> defi-cli destroytoken "symbol"
> defi-cli destroytoken "symbol" "[{\"txid\":\"id\",\"vout\":0}]"
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "destroytoken", "params": ["symbol" "[{\"txid\":\"id\",\"vout\":0}]"] }' -H 'content-type: text/plain;' http://127.0.0.1:8554/
{"token":"str","isDAT":bool} ( [{"txid":"hex","vout":n},...] )
Creates (and submits to local node and network) a transaction of token promotion to isDAT or demotion from isDAT. Collateral will be unlocked. The first optional argument (may be empty array) is an array of specific UTXOs to spend. One of UTXO's must belong to the token's owner (collateral) address
Arguments:
1. metadata (json object)
{
"token": "str", (string, required) The tokens's symbol, id or creation tx
"isDAT": bool, (boolean, required) Token's 'isDAT' new property (bool)
}
2. inputs (json array, optional) A json array of json objects. Provide it if you want to spent specific UTXOs
[
{ (json object)
"txid": "hex", (string, required) The transaction id
"vout": n, (numeric, required) The output number
},
...
]
Result:
"hash" (string) The hex-encoded hash of broadcasted transaction
Examples:
> defi-cli updatetoken "{\"token\":\"DFI\", \"isDAT\":true}" "[{\"txid\":\"id\",\"vout\":0}]"
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "updatetoken", "params": ["{\"token\":\"DFI\", \"isDAT\":true}" "[{\"txid\":\"id\",\"vout\":0}]"] }' -H 'content-type: text/plain;' http://127.0.0.1:8554/
( {"start":n,"including_start":bool,"limit":n} verbose )
Returns information about tokens.
Arguments:
1. pagination (json object)
{
"start": n, (numeric) Optional first key to iterate from, in lexicographical order.Typically it's set to last ID from previous request.
"including_start": bool, (boolean) If true, then iterate including starting position. False by default
"limit": n, (numeric) Maximum number of tokens to return, 100 by default
}
2. verbose (boolean) Flag for verbose list (default = true), otherwise only ids, symbols and names are listed
Result:
{id:{...},...} (array) Json object with tokens information
Examples:
> defi-cli listtokens {"start":128} False
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listtokens", "params": [{"start":128} False] }' -H 'content-type: text/plain;' http://127.0.0.1:8554/
( "key" )
Returns information about token.
Arguments:
1. key (string, required) One of the keys may be specified (id/symbol/creationTx)
Result:
{id:{...}} (array) Json object with token information
Examples:
> defi-cli gettoken GOLD
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "gettoken", "params": [GOLD] }' -H 'content-type: text/plain;' http://127.0.0.1:8554/
"amounts" ( [{"txid":"hex","vout":n},...] )
Creates (and submits to local node and network) a transaction minting your token (for accounts and/or UTXOs). The first optional argument (may be empty array) is an array of specific UTXOs to spend. One of UTXO's must belong to the token's owner (collateral) address
Arguments:
1. amounts (string, required) Amount in amount@token format. If multiple tokens are to be minted, specify an array ["amount1@t1", "amount2@t2"]
2. inputs (json array, optional) A json array of json objects. Provide it if you want to spent specific UTXOs
[
{ (json object)
"txid": "hex", (string, required) The transaction id
"vout": n, (numeric, required) The output number
},
...
]
Result:
"hash" (string) The hex-encoded hash of broadcasted transaction
Examples:
> defi-cli minttokens "10@symbol"
> defi-cli minttokens "symbol" "[{\"txid\":\"id\",\"vout\":0}]"
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "minttokens", "params": ["10@symbol" "[{\"txid\":\"id\",\"vout\":0}]"] }' -H 'content-type: text/plain;' http://127.0.0.1:8554/
( {"start":"str","including_start":bool,"limit":n} verbose indexed_amounts )
Returns information about all accounts on chain.
Arguments:
1. pagination (json object)
{
"start": "str", (string) Optional first key to iterate from, in lexicographical order.Typically it's set to last ID from previous request.
"including_start": bool, (boolean) If true, then iterate including starting position. False by default
"limit": n, (numeric) Maximum number of orders to return, 100 by default
}
2. verbose (boolean) Flag for verbose list (default = true), otherwise limited objects are listed
3. indexed_amounts (boolean) Format of amounts output (default = false): (true: {tokenid:amount}, false: "amount@tokenid")
Result:
{id:{...},...} (array) Json object with accounts information
Examples:
> defi-cli listaccounts
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listaccounts", "params": [{} False] }' -H 'content-type: text/plain;' http://127.0.0.1:8554/
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listaccounts", "params": ['{"start":"a914b12ecde1759f792e0228e4fa6d262902687ca7eb87@0","limit":1000}'] }' -H 'content-type: text/plain;' http://127.0.0.1:8554/
"owner" ( {"start":"str","including_start":bool,"limit":n} indexed_amounts )
Returns information about account.
Arguments:
1. owner (string, required) Owner address in base58/bech32/hex encoding
2. pagination (json object)
{
"start": "str", (string) Optional first key to iterate from, in lexicographical order.Typically it's set to last tokenID from previous request.
"including_start": bool, (boolean) If true, then iterate including starting position. False by default
"limit": n, (numeric) Maximum number of orders to return, 100 by default
}
3. indexed_amounts (boolean) Format of amounts output (default = false): (true: obj = {tokenid:amount,...}, false: array = ["amount@tokenid"...])
Result:
{...} (array) Json object with order information
Examples:
> defi-cli getaccount owner_address
{"address":"str"} ( [{"txid":"hex","vout":n},...] )
Creates (and submits to local node and network) a transfer transaction from the wallet UTXOs to specified account. The first optional argument (may be empty array) is an array of specific UTXOs to spend.
Arguments:
1. amounts (json object, required)
{
"address": "str", (string, required) The defi address is the key, the value is amount in amount@token format. If multiple tokens are to be transferred, specify an array ["amount1@t1", "amount2@t2"]
}
2. inputs (json array, optional) A json array of json objects
[
{ (json object)
"txid": "hex", (string, required) The transaction id
"vout": n, (numeric, required) The output number
},
...
]
Result:
"hash" (string) The hex-encoded hash of broadcasted transaction
Examples:
> defi-cli utxostoaccount "{\"address1\":\"1.0@DFI\",\"address2\":[\"2.0@BTC\", \"3.0@ETH\"]}"
"from" {"address":"str"} ( [{"txid":"hex","vout":n},...] )
Creates (and submits to local node and network) a transfer transaction from the specified account to the specfied accounts. The first optional argument (may be empty array) is an array of specific UTXOs to spend.
Arguments:
1. from (string, required) The defi address of sender
2. to (json object, required)
{
"address": "str", (string, required) The defi address is the key, the value is amount in amount@token format. If multiple tokens are to be transferred, specify an array ["amount1@t1", "amount2@t2"]
}
3. inputs (json array, optional) A json array of json objects
[
{ (json object)
"txid": "hex", (string, required) The transaction id
"vout": n, (numeric, required) The output number
},
...
]
Result:
"hash" (string) The hex-encoded hash of broadcasted transaction
Examples:
> defi-cli accounttoaccount sender_address "{\"address1\":\"1.0@DFI\",\"address2\":[\"2.0@BTC\", \"3.0@ETH\"]}"
"from" {"address":"str"} ( [{"txid":"hex","vout":n},...] )
Creates (and submits to local node and network) a transfer transaction from the specified account to UTXOs. The first optional argument (may be empty array) is an array of specific UTXOs to spend.
Arguments:
1. from (string, required) The defi address of sender
2. to (json object, required)
{
"address": "str", (string, required) The defi address is the key, the value is amount in amount@token format. If multiple tokens are to be transferred, specify an array ["amount1@t1", "amount2@t2"]
}
3. inputs (json array, optional) A json array of json objects
[
{ (json object)
"txid": "hex", (string, required) The transaction id
"vout": n, (numeric, required) The output number
},
...
]
Result:
"hash" (string) The hex-encoded hash of broadcasted transaction
Examples:
> defi-cli accounttoutxos sender_address \"{\"address1\":\"100@DFI"}\"
> defi-cli accounttoutxos sender_address "{\"address1\":\"1.0@DFI\",\"address2\":[\"2.0@BTC\", \"3.0@ETH\"]}"
( {"start":"str","including_start":bool,"limit":n} indexed_amounts )
Returns the balances of all accounts that belong to the wallet.
Arguments:
1. pagination (json object)
{
"start": "str", (string) Optional first key to iterate from, in lexicographical order.Typically it's set to last tokenID from previous request.
"including_start": bool, (boolean) If true, then iterate including starting position. False by default
"limit": n, (numeric) Maximum number of tokens to return, 100 by default
}
2. indexed_amounts (boolean) Format of amounts output (default = false): (true: obj = {tokenid:amount,...}, false: array = ["amount@tokenid"...])
Result:
{...} (array) Json object with balances information
Examples:
> defi-cli gettokenbalances