Closed altafan closed 2 years ago
Just asking, Why we couldn't keep the tdex fee|market deposit --fragment
UX instead of adding specific commands? @altafan
Since FeeFragmenter and MarketFragmenter became accounts similar to the Fee and Market ones, I thought they needed similar RPCs for consistency. Like for instance to check the balance or to list of all derivated deposit addresses.
At this point, the CLI would have been enriched with new commands anyways, so I decided to deprecate the interactive process of the fee/market account commands.
This updates the fragmentation logic in order to deprecate the usage of ephemeral wallets in favour of reserved accounts of Vault domain.
Daemon
For this, the fragmenter portable interface (ports.Fragmenter) and all other relative types/interfaces have been dropped. Basically, the only thing re-used is the fragmentation logic of the original
FragmentAmount()
method of both fee and market fragmnenter implementations. These methods have been moved to afragmenter_utils.go
file and became internal methods of the app layer.As already introduced, this makes use of 2 Vault reserved accounts that have been named FeeFragmenter and MarketFragmenter accounts. This has the benefit of not taking the risk of loosing funds during a fragmentation as explained in the related ticket.
Several RPCs have been added for these 2 new accounts to look similar to those defined for the Fee and Market ones:
ListFeeFragmenterAddresses
to list all external addresses derived for the accountGetFeeFragmenterBalance
to retrieve the current balance of the accountFeeFragmenterSplitFunds
to perform fragmentation and deposit funds into fee account. The originalFragmentFeeFragmenterDeposits
is dropped.WithdrawFeeFragmenter
to withdraw ALL the funds owned by the account to some addressThe same is done for the MarketFragmenter account.
CLI
On the CLI side, the interactive process originally done with
tdex fee|market deposit --fragment
is deprecated. Instead, 2 new main commands are added:feefragmenter
to manage the fee fragmenter accountmarketfragmenter
to manage the market fragmenter accountBoth commands have the following subcommands:
deposit [--num_of_addresses]
to retrieve address where to send fundsaddresses
to list all deposit (external) addressesbalance
to see the current balance of the accountsplit
to perform fragmentation&deposit into fee/market accountwithdraw
to send ALL the funds owned by the fragmenter to an external addressTherefore, the process is no-longer interactive. The operator needs to call at least
deposit
andsplit
to perform the fragmentation of the funds.BONUS:
UpdateTx()
to subtract fees from some LBTC output that is going to be added to the transaction. This can now be done by setting the new paramSubtractFees
, which is mutually exclusive toWantChangeForFees
, which instead instructs to either subtract the fees from a change LBTC out, or to add one by making a new coinselction.sendToMany
andsendToManyFeeAccount
of the app layer tosendToManyWIthFeeTopup
andsendToManyWithoutFeeTopup
to better understand their purpose.Closes #495.
Please @tiero review this.