Files
radicle-explorer/src/SiweConnect.svelte
T
2022-05-18 15:45:47 +02:00

35 lines
777 B
Svelte

<script lang="ts">
import type { Seed } from "@app/base/seeds/Seed";
import type { Config } from "@app/config";
import { signInWithEthereum } from "@app/siwe";
import Loading from "@app/Loading.svelte";
import { Connection } from "@app/session";
export let seed: Seed;
export let config: Config;
export let caption = "Sign in";
let connection: Connection = Connection.Disconnected;
</script>
<style>
button {
min-height: 32px;
}
</style>
<button
class="tiny secondary"
disabled={connection === Connection.Connecting}
on:click={async () => {
connection = Connection.Connecting;
await signInWithEthereum(seed, config);
}}
>
{#if connection === Connection.Connecting}
<Loading small />
{:else}
{caption}
{/if}
</button>