Transaction Configuration
Getting transaction parts and maximum amount to transfer/withdraw
Getting Transaction Parts
The user's request to send or withdraw money may produce several transactions to the privacy pool in the common case. It depends on both a local account/notes configuration and transfer destinations amount as well. The following method is used to evaluate transactions needed to process request
Parameters
txType
is transaction type (a member of TxType enum)
This method supports just a TxType.Transfer
and TxType.Withdraw
transaction types only (deposits are always performed within single transaction). The internal error will thrown for other tx types
transfers
- a set of transfer requests (use single request with requested amount for withdrawal as well)
The request's destination
field is ignored in this method
relayerFee
- a raw relayer fee object which will be used to estimate total transaction fee (will requested under the hood when undefined)
withdrawSwap
is an optional amount of tokens which should swap in withdraw transaction. It may influence the typical withdraw transaction cost due to extra fee component (ignored for other transaction types)
updateState
- update the state before parts evaluating
allowPartial
- try to build result even in case of insufficient balance
Returns
Promise
returns array of TransferConfigs which describe all transactions needed to process input request, or a void array if request cannot be processed (e.g. in case of insufficient funds)
Example
Getting Maximum Available Outgoing Transaction
Calculating maximum available amount for transfers and withdrawals. This estimation doesn't take into account pool contract limits
Parameters
txType
is transaction type (a member of TxType enum)
This method supports just a TxType.Transfer
and TxType.Withdraw
transaction types only (you can deposit any amount in the limit boundaries). The internal error will thrown for other tx types
relayerFee
- a raw relayer fee object which will be used to estimate total transaction fee (will requested under the hood when undefined)
withdrawSwap
is an optional amount of tokens which should swap in withdraw transaction. It may influence the typical withdraw transaction cost due to extra fee component (ignored for other transaction types)
updateState
- update the state before parts evaluating
Returns
Promise
returns token amount in the pool dimension
Example
Last updated