Skip to main content

Melt tokens

Melting tokens.

Parameters

  • x-wallet-id: Wallet identifier.
  • token: UID of the token to melt.
  • amount: The amount of tokens to melt. It must be an integer with the value in cents, i.e., 123 means 1.23.

Optional Parameters

  • change_address: Address to receive the unmelted tokens from the UTXO spent on the melt operation, i. e, it will receive the difference between the total amount of the UTXO used to fulfill the request and the amount of melted tokens.
  • deposit_address: Address to receive the HTRs used to mint the tokens being melted.

Request

curl -X POST -H "X-Wallet-Id: default-wallet" -H "Content-type: application/json" \
--data '{"token": "008a62793ccd07bd21c7d9b2c20f718d1545911130e74da2c78b932f5fec6904", "amount": 50}' \
http://localhost:8000/wallet/melt-tokens

Response

The data attribute value has been replaced by the "+" symbol to make the JSON easier to visualize.

{
"success":true,
"inputs":[
{
"hash":"008a62793ccd07bd21c7d9b2c20f718d1545911130e74da2c78b932f5fec6904",
"index":2,
"data":{
"type":"Buffer",
"data":[+]
},
"tx_id":"008a62793ccd07bd21c7d9b2c20f718d1545911130e74da2c78b932f5fec6904"
},
{
"hash":"008a62793ccd07bd21c7d9b2c20f718d1545911130e74da2c78b932f5fec6904",
"index":0,
"data":{
"type":"Buffer",
"data":[+]
},
"tx_id":"008a62793ccd07bd21c7d9b2c20f718d1545911130e74da2c78b932f5fec6904"
}
],
"outputs":[
{
"value":50,
"script":{
"type":"Buffer",
"data":[+]
},
"tokenData":1,
"decodedScript":null,
"token_data":1
},
{
"value":2,
"script":{
"type":"Buffer",
"data":[+]
},
"tokenData":129,
"decodedScript":null,
"token_data":129
}
],
"version":1,
"weight":8.000001,
"nonce":36,
"timestamp":1659465181,
"parents":[
"005844898b5f1e5f953d1a45ccbb41afc0d200b4e4a3b45d7f177f692b1a6c91",
"0048dbfce484d6b2bf210637b4ff8e9220bafd21fa7b86cd2221490edd6bca23"
],
"tokens":[
"008a62793ccd07bd21c7d9b2c20f718d1545911130e74da2c78b932f5fec6904"
],
"hash":"00db90754c8330720475657f349b1536ea597f26899ed3c3f32f913696ce21c6",
"_dataToSignCache":null
}