-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alexander Diemand <codieplusplus@apax.net>
- Loading branch information
Showing
3 changed files
with
67 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<script lang="ts"> | ||
// import { onMount } from 'svelte'; | ||
// import { Web3 } from 'web3'; | ||
import { WalletInformation, get_wallet_addr, wallet_logout } from '$lib/wallet' | ||
export let wallet = new WalletInformation() | ||
// onMount ( async () => { | ||
// if (window.ethereum && ! window.web3) { | ||
// window.web3 = new Web3(window.ethereum); | ||
// } | ||
// }) | ||
async function login_wallet(ev) { | ||
wallet = await get_wallet_addr(wallet, ev) | ||
} | ||
async function logout_wallet() { | ||
await wallet_logout(wallet) | ||
} | ||
</script> | ||
|
||
<div class=""> | ||
{#if wallet.walletaddr} | ||
<div class="w3-dropdown-hover"> | ||
<button class="w3-btn w3-small" id="address">{wallet.walletaddr.substring(0,6)}..{wallet.walletaddr.substring(wallet.walletaddr.length - 5)}</button> | ||
<div class="w3-dropdown-content w3-bar-block w3-border"> | ||
<a href="#" class="w3-bar-item w3-button w3-small">{wallet.walletaddr}</a> | ||
<a href="#" class="w3-bar-item w3-button">network: {wallet.networkname ? wallet.networkname : '' } {wallet.walletnetwork}</a> | ||
</div> | ||
</div> | ||
<button type="button" class="w3-btn" on:click={() => logout_wallet()}><i class="w3-tooltip fa fa-sign-out"> <span class="w3-text">disconnect wallet</span></i></button> | ||
{:else} | ||
<button type="button" class="w3-btn" on:click={ev => login_wallet(ev)}><i class="w3-tooltip fa fa-sign-in"> <span class="w3-text">connect wallet</span></i></button> | ||
{/if} | ||
</div> | ||
|
||
<style> | ||
</style> |
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