-
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.
- Loading branch information
Showing
33 changed files
with
761 additions
and
218 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,35 @@ | ||
name: Deploy to GitHub Pages | ||
on: | ||
push: | ||
branches: ["main"] | ||
jobs: | ||
build_site: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: oven-sh/setup-bun@v2 | ||
- name: Install dependencies | ||
run: bun install | ||
- name: build | ||
env: | ||
BASE_PATH: "/${{ github.event.repository.name }}" | ||
run: | | ||
npm bun run build | ||
- name: Upload Artifacts | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: "build/" | ||
deploy: | ||
needs: build_site | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pages: write | ||
id-token: write | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
steps: | ||
- name: Deploy | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<script lang="ts"> | ||
import { getTransportableAccount } from "$lib/transport"; | ||
import { getVault } from "$lib/vault"; | ||
import QRCode from "@castlenine/svelte-qrcode"; | ||
import { type Writable, derived } from "svelte/store"; | ||
export let accountId: Writable<string>; | ||
const vault = getVault(); | ||
const account = derived([vault, accountId], ([$vault, $accountId]) => { | ||
return $vault.accounts.find((account) => account.id === $accountId); | ||
}); | ||
const transportableAccount = derived(account, ($account) => { | ||
if (!$account) return ""; | ||
return getTransportableAccount({ | ||
address: $account.address, | ||
signer: $account.signer, | ||
derivationPath: $account.derivationPath, | ||
}); | ||
}); | ||
</script> | ||
|
||
<dialog id="qr_modal" class="modal"> | ||
{#key $accountId} | ||
<div class="modal-box"> | ||
{#if $account} | ||
<QRCode data={$transportableAccount} isResponsive /> | ||
{/if} | ||
</div> | ||
<form method="dialog" class="modal-backdrop"> | ||
<button>close</button> | ||
</form> | ||
{/key} | ||
</dialog> |
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,46 @@ | ||
<script lang="ts"> | ||
import { goto } from "$app/navigation"; | ||
import { arrayToPath, truncateString } from "$lib/utils"; | ||
import { type Account, getVault } from "$lib/vault"; | ||
import { MoreVerticalIcon } from "lucide-svelte"; | ||
const vault = getVault(); | ||
export let account: Account; | ||
export let exportQr: () => void; | ||
const removeAccount = async () => { | ||
$vault.removeAccount(account.id); | ||
goto("/accounts"); | ||
}; | ||
</script> | ||
|
||
<div class="card bg-neutral"> | ||
<div class="card-body flex-row"> | ||
<div class="flex flex-col flex-1"> | ||
<p> | ||
{truncateString({ | ||
value: account.address, | ||
endCharCount: 5, | ||
firstCharCount: 5, | ||
})} | ||
</p> | ||
<p>{arrayToPath(account.derivationPath)}</p> | ||
<p>{account.signer}</p> | ||
</div> | ||
<div class="flex flex-col items-end gap-2"> | ||
<div class="dropdown dropdown-end"> | ||
<button tabindex="0" class="btn btn-square" | ||
><MoreVerticalIcon size={16} /></button | ||
> | ||
<ul | ||
tabindex="0" | ||
class="dropdown-content menu bg-gray-800 rounded-box z-[1] w-52 p-2 shadow" | ||
> | ||
<li><button on:click={removeAccount}>Remove</button></li> | ||
</ul> | ||
</div> | ||
<button class="btn" on:click={exportQr}>Export QR</button> | ||
</div> | ||
</div> | ||
</div> |
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
<script lang="ts"> | ||
export const href = ""; | ||
export const label = ""; | ||
export let href = ""; | ||
export let label = ""; | ||
</script> | ||
|
||
<a {href} class="flex flex-col items-center justify-center gap-1"> | ||
<slot size={28} /> | ||
<span class="text-sm">{label}</span> | ||
<span class="text-sm text-white">{label}</span> | ||
</a> |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<script lang="ts"> | ||
export const title = ""; | ||
export let title = ""; | ||
</script> | ||
|
||
<header | ||
|
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 |
---|---|---|
@@ -1,38 +1,19 @@ | ||
export type DerivationPath = string; | ||
export type PublicKey = string; | ||
export type PrivateKey = string; | ||
import type { DerivationPath, PrivateKey, PublicKey } from "$lib/types"; | ||
|
||
export type CommonSigner<T> = { | ||
export type CommonSignArgs = { | ||
childPrivateKey: PrivateKey; | ||
type: number; | ||
}; | ||
|
||
type Sign<T extends CommonSignArgs> = (args: T) => Promise<string>; | ||
|
||
export type CommonSigner<T extends CommonSignArgs> = { | ||
name: string; | ||
slug: string; | ||
getPublicKey: ({ | ||
privateKey, | ||
}: { | ||
privateKey: PrivateKey; | ||
}) => Promise<PublicKey>; | ||
deriveChildPrivateKey: ({ | ||
rootPrivateKey, | ||
derivationPath, | ||
}: { | ||
getPublicKey: (args: { privateKey: PrivateKey }) => Promise<PublicKey>; | ||
deriveChildPrivateKey: (args: { | ||
rootPrivateKey: PrivateKey; | ||
derivationPath: DerivationPath; | ||
}) => Promise<string>; | ||
signTransaction: ({ | ||
unsignedTransaction, | ||
childPrivateKey, | ||
options, | ||
}: { | ||
unsignedTransaction: T; | ||
childPrivateKey: PrivateKey; | ||
options?: Record<string, string>; | ||
}) => Promise<string>; | ||
signMessage: ({ | ||
message, | ||
childPrivateKey, | ||
options, | ||
}: { | ||
message: string; | ||
childPrivateKey: PrivateKey; | ||
options?: Record<string, string>; | ||
}) => Promise<string>; | ||
sign: Sign<T>; | ||
}; |
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.