The task::withdraw::init method generates, signs, and returns a transaction that transfers the amount of coin to the address indicated in the to argument. The status of this method can be queried via the task::withdraw::status method.
It will return the transaction hex (via task::withdraw::status), which then needs to be broadcast with the sendrawtransaction to complete the withdrawal. This method is uses the same input fields as the standard v2 withdraw method, with additional optional fields to specify the from address when using a hardware or HD wallet. There are two way to indicate which HD address to send funds from:
Using derivation_path as a single input. E.g m/44'/20'/0'/0/2
Using account_id (0), chain (External) & address_id (2) inputs. The bracketed values are the equavalent of the derivation path above.
To cancel the transaction generation, use the withdraw_cancel method.
When used for ZHTLC coins like ARRR or ZOMBIE, it may take some time to complete.
SIA protocol coins should use the v1 withdraw method, or the non-task v2 withdraw method.
The amount the user desires to withdraw, ignored when max=true
memo
string
Optional, used for ZHTLC and Tendermint coins only. Attaches a memo to the transaction.
from
string
Optional, used only for transactions using a hardware wallet. For more information, see the Trezor Integration guide
from.derivation_path
string
Optional, HD wallets only. Follows the format m/44'/COIN_ID'/ACCOUNT_ID'/CHAIN/ADDRESS_ID
from.account_id
integer
Optional, HD wallets only. Generally this will be 0 unless you have multiple accounts registered on your HD wallet
from.chain
string
Optional, HD wallets only. Internal, or External. External is used for addresses that are intended to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used to return the leftover change from a transaction.
from.address_id
integer
Optional, HD wallets only. Check the output from coin activation to find the ID of an address with balance.
max
bool
Optional. Withdraw the maximum available amount. Defaults to false
fee
object
Optional. Used only to set a custom fee, otherwise fee value will be derived from a deamon's estimatefee (or similar) RPC method
fee.type
string
Type of transaction fee; possible values: UtxoFixed or UtxoPerKbyte
fee.amount
string (numeric)
Fee amount in coin units, used only when type is UtxoFixed (fixed amount not depending on tx size) or UtxoPerKbyte (amount per Kbyte)
To get the status of your withdrawal transaction generation, use the task::withdraw::status method. Once ready, it will provide the raw hex used to broadcast your transaction with sendrawtransaction. The response returned is the same as what is returned from the standard v2 withdraw method
A short indication of how the withdrawal is progressing.
details
object
Depending on the state of withdrawal progress, this will contain different information as shown in the responses below.
details.to
array of strings
Coins are withdrawn to these addresses; this may contain the my_address address, where change from UTXO coins is sent.
details.from
array of strings
Coins are withdrawn from this address; the array contains a single element, but transactions may be sent from several addresses (UTXO coins)
details.my_balance_change
string (numeric)
the expected balance of change in my_address after the transaction broadcasts
details.received_by_me
string (numeric)
the amount of coins received by my_address after the transaction broadcasts; the value may be above zero when the transaction requires that the Komodo DeFi Framework API send change to my_address
details.spent_by_me
string (numeric)
the amount of coins spent by my_address; this value differ from the request amount, as the transaction fee is added here
details.total_amount
string (numeric)
the total amount of coins transferred
details.fee_details
object
the fee details of the generated transaction; fee_details.type is "Utxo" for Z coins. fee_details.coin will be the same as details.coin, and fee_details.amount will be a numeric value.
details.tx_hash
string
the hash of the generated transaction
details.tx_hex
string
transaction bytes in hexadecimal format; use this value as input for the send_raw_transaction
details.coin
string
the name of the coin the user wants to withdraw
details.transaction_type
string
Transaction type will be StandardTransfer for Z coin transactions.
details.kmd_rewards
object (optional)
If supported (e.g. when withdrawing KMD), an object containing information about accrued rewards.