mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 02:00:31 +08:00
Flatten session store
Signed-off-by: Sebastian Martinez <sebastinez@me.com>
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
if (!amount || amount === "0") { return [false, "Not able to withdraw zero tokens"]; }
|
||||
if (toWei(amount).gt(maxWithdrawAmount)) return [false, `Reduce amount, max withdrawal is ${formatEther(maxWithdrawAmount)}`];
|
||||
let currentTime = new Date().getTime();
|
||||
let timelock = await calculateTimeLock(amount, $session.config.signer, config);
|
||||
let timelock = await calculateTimeLock(amount, $session.signer, config);
|
||||
// Converting a 10 digit to 13 digit timestamp by multiplying by 1000
|
||||
// since JS doesn't display a correct Date string when passing a 10 digit timestamp.
|
||||
let nextAvailableWithdraw = lastWithdrawal.add(timelock).mul(1000);
|
||||
@@ -46,10 +46,10 @@
|
||||
return [false];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$: if ($session) {
|
||||
getMaxWithdrawAmount($session.config.signer, config).then(x => maxWithdrawAmount = x);
|
||||
lastWithdrawalByUser($session.config.signer, config).then(x => lastWithdrawal = x);
|
||||
getMaxWithdrawAmount($session.signer, config).then(x => maxWithdrawAmount = x);
|
||||
lastWithdrawalByUser($session.signer, config).then(x => lastWithdrawal = x);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
try {
|
||||
if ($session) {
|
||||
state.status = Status.Signing;
|
||||
const tx = await withdraw(amount, $session.config.signer, config);
|
||||
const tx = await withdraw(amount, $session.signer, config);
|
||||
state.status = Status.Pending;
|
||||
await tx.wait();
|
||||
state.status = Status.Success;
|
||||
|
||||
Reference in New Issue
Block a user