Closed bvotteler closed 8 months ago
No integration test case sadly, because all the spun up and funded vaults end up with some tokens issued or to-be-issued left over from previous non-idempotent test cases. Could you not do a selfredeem? (there is a special tx for selfredeem that doesn't involve any btc payments)
Could you not do a selfredeem? (there is a special tx for selfredeem that doesn't involve any btc payments)
I tried a few angles with the existing test redeem utility code but had no luck. Or at least it didn't settle immediately. I can give self redeem a try, I'd expect that requires the vault to get enough tokens issued from somewhere else, right?
lgtm. Would it be useful to provide a
canWithdrawAll
or something for the UI? Or can UI easily detect that already?
There are a few methods that should do the trick already. The two first that come to mind are:
vaultsAPI.getVaultCollateralization()
(link) returns undefined
if no tokens have been issued, orVaultExt
instance, then query for backed tokens which includes both issued and to-be-issued tokens:
const vaultExt = await vaultsApi.get(vaultAccountId, collateralCurrency));
const issuedAmount = vaultExt.getBackedTokens(); // includes to-be-issued
(Link to signature for get, and link to getBackedTokens)
Could you not do a selfredeem? (there is a special tx for selfredeem that doesn't involve any btc payments)
I tried a few angles with the existing test redeem utility code but had no luck. Or at least it didn't settle immediately. I can give self redeem a try, I'd expect that requires the vault to get enough tokens issued from somewhere else, right?
Yea that's right (but u could just sudo-mint some if you don't mind some state inconsistencies)
Could you not do a selfredeem? (there is a special tx for selfredeem that doesn't involve any btc payments)
I tried a few angles with the existing test redeem utility code but had no luck. Or at least it didn't settle immediately. I can give self redeem a try, I'd expect that requires the vault to get enough tokens issued from somewhere else, right?
Yea that's right (but u could just sudo-mint some if you don't mind some state inconsistencies)
Thanks for the self redeem tip! That helped in adding a test: commit 252682f
Resolves #725
Added new endpoints to easier withdraw all collateral for vaults.
Note: Tested manually. No integration test case sadly, because all the spun up and funded vaults end up with some tokens issued or to-be-issued left over from previous non-idempotent test cases.