-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: handle wallet connect session request expiry time (#2672)
* cleanup request handler params * add expiration logic to evm transaction popup * add expiration to siwe + sign message popup * fix expiry * cleanup * update locale * remove method from request info * fix empty expirytimetamp * fix empty description --------- Co-authored-by: Nicole O'Brien <[email protected]>
- Loading branch information
1 parent
fabe7af
commit 425fbd2
Showing
18 changed files
with
161 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
...op/views/dashboard/drawers/dapp-config/components/ConnectionRequestExpirationAlert.svelte
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
...ages/desktop/views/dashboard/drawers/dapp-config/components/RequestExpirationAlert.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<script lang="ts"> | ||
import { Text } from '@bloomwalletio/ui' | ||
import { time } from '@core/app/stores' | ||
import { MILLISECONDS_PER_SECOND, SECONDS_PER_MINUTE } from '@core/utils/constants' | ||
import { localize } from '@core/i18n' | ||
import { getTimeDifference } from '@core/utils' | ||
export let expiryTimestamp: number | undefined | ||
const localeKey = 'views.dashboard.drawers.dapps.confirmConnection' | ||
</script> | ||
|
||
{#if expiryTimestamp !== undefined} | ||
{@const expiryTimeDiff = expiryTimestamp * MILLISECONDS_PER_SECOND - $time.getTime()} | ||
{#if expiryTimeDiff <= 0} | ||
<div class="w-full flex gap-4 px-6 py-1 bg-danger/10"> | ||
<Text type="sm" textColor="danger" class="flex items-center">{localize(`${localeKey}.expired`)}</Text> | ||
</div> | ||
{:else} | ||
<div | ||
class=" | ||
w-full flex justify-between gap-4 px-6 py-1 | ||
{expiryTimeDiff < SECONDS_PER_MINUTE ? 'bg-warning/10' : 'bg-neutral/10'} | ||
" | ||
> | ||
<Text | ||
type="sm" | ||
class="flex items-center" | ||
textColor={expiryTimeDiff < SECONDS_PER_MINUTE ? 'warning' : 'primary'} | ||
> | ||
{localize(`${localeKey}.expiresIn`)} | ||
{getTimeDifference(new Date(expiryTimestamp * MILLISECONDS_PER_SECOND), $time, true)} | ||
</Text> | ||
</div> | ||
{/if} | ||
{/if} |
2 changes: 1 addition & 1 deletion
2
packages/desktop/views/dashboard/drawers/dapp-config/components/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.