Skip to content

Commit

Permalink
Merge pull request #386 from greymass/dev
Browse files Browse the repository at this point in the history
Next release
  • Loading branch information
aaroncox authored Feb 24, 2025
2 parents 0127da2 + 5f83e6a commit 004487e
Show file tree
Hide file tree
Showing 49 changed files with 970 additions and 263 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ $(CONTRACTS)/delphioracle.ts:
$(CONTRACTS)/unicove.ts:
bunx @wharfkit/cli generate -u $(CONTRACTS_API) -f $(CONTRACTS)/unicove.ts unicove.gm

codegen: $(CONTRACTS)/system.ts $(CONTRACTS)/token.ts $(CONTRACTS)/msig.ts $(CONTRACTS)/delphioracle.ts $(CONTRACTS)/unicove.ts
$(CONTRACTS)/eosntime.ts:
bunx @wharfkit/cli generate -u $(CONTRACTS_API) -f $(CONTRACTS)/eosntime.ts time.eosn

codegen: $(CONTRACTS)/system.ts $(CONTRACTS)/token.ts $(CONTRACTS)/msig.ts $(CONTRACTS)/delphioracle.ts $(CONTRACTS)/unicove.ts $(CONTRACTS)/eosntime.ts
mkdir -p $(CONTRACTS)

.PHONY: clean
Expand Down
5 changes: 5 additions & 0 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
"common_about_something": "About {thing}",
"common_account": "Actor",
"common_account_balance": "Account Balance",
"common_account_multisig_using_account": "multisig using {account}",
"common_action": "Action",
"common_actions": "Actions",
"common_actor": "Actor",
"common_add_account": "Add Account",
"common_add_funds": "Add Funds",
"common_amount": "Amount",
"common_amount_exceeds_balance": "Amount exceeds available balance.",
Expand All @@ -41,12 +43,14 @@
"common_breakdown": "Breakdown",
"common_buy": "Buy",
"common_bytes": "Bytes",
"common_cancel": "Cancel",
"common_claim": "Claim",
"common_clear": "Clear",
"common_close": "Close",
"common_complete": "Complete",
"common_confirm": "Confirm",
"common_connect_wallet": "Connect Wallet",
"common_connect_wallet_login": "Connect your wallet to login",
"common_contract": "Contract",
"common_copied_result": "Copied!",
"common_copy": "Copy",
Expand All @@ -73,6 +77,7 @@
"common_labeled_unit_staked": "{unit} Staked",
"common_labeled_unit_value": "{unit} Value",
"common_login": "Login",
"common_login_to_unicove": "Login to Unicove",
"common_market_cap": "Market Cap",
"common_memo": "Memo",
"common_must_be_logged_in": "You must be logged in with an account to use this feature.",
Expand Down
3 changes: 3 additions & 0 deletions scripts/env/default/chains.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"features": {
"delphioracle": true,
"directfunding": true,
"eosntime": true,
"giftedram": false,
"lightapi": true,
"metamask": true,
Expand Down Expand Up @@ -42,6 +43,7 @@
"features": {
"delphioracle": false,
"directfunding": false,
"eosntime": false,
"giftedram": true,
"lightapi": false,
"metamask": true,
Expand Down Expand Up @@ -76,6 +78,7 @@
"features": {
"delphioracle": false,
"directfunding": false,
"eosntime": false,
"lightapi": false,
"metamask": false,
"powerup": true,
Expand Down
2 changes: 1 addition & 1 deletion src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link rel="icon" type="image/svg+xml" href="/favicon.svg" sizes="any" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<meta name="apple-mobile-web-app-title" content="Unicove" />
<link rel="manifest" href="/site.webmanifest" />
<!-- <link rel="manifest" href="/site.webmanifest" /> -->
<style>
@font-face {
font-family: 'Inter';
Expand Down
77 changes: 46 additions & 31 deletions src/lib/components/accountswitch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
import UserCheck from 'lucide-svelte/icons/user-check';
import UserPlus from 'lucide-svelte/icons/user-plus';
import Search from 'lucide-svelte/icons/search';
import { goto } from '$app/navigation';
import { languageTag } from '$lib/paraglide/runtime';
import { goto } from '$lib/utils';
import { cn } from '$lib/utils/style';
import Button from './button/button.svelte';
import Text from './input/text.svelte';
Expand Down Expand Up @@ -84,7 +83,7 @@
function redirect(account: NameType) {
if (!context.settings.data.preventAccountPageSwitching) {
goto(`/${languageTag()}/${network}/account/${account}`);
goto(`/${network}/account/${account}`);
}
}
Expand All @@ -94,17 +93,20 @@
closeDrawer();
}
function removeSession(session?: Session | SerializedSession) {
async function removeSession(session?: Session | SerializedSession) {
if (session) {
context.wharf.logout(session);
await context.wharf.logout(session);
if (currentSession) {
redirect(currentSession.actor);
}
}
}
async function connectWallet(wallet: WalletPlugin) {
const options: LoginOptions = {
walletPlugin: wallet.id
};
if (wallet.id !== 'cleos') {
if (wallet.id !== 'cleos' && wallet.id !== 'wallet-plugin-multisig') {
options.chain = context.network.chain;
}
const session = await context.wharf.login(options);
Expand Down Expand Up @@ -207,7 +209,7 @@
<Button onclick={addAccount} variant="secondary" class="grow-0 text-white">
<div class="flex items-center gap-2">
<UserPlus class="mb-0.5 size-5" />
<span>Add Account</span>
<span>{m.common_add_account()}</span>
</div>
</Button>

Expand All @@ -232,7 +234,9 @@

<ul class="grid gap-2">
{#each chainSessions as session}
{@const isCurrent = currentSession?.actor.toString() === session.actor}
{@const isCurrent =
currentSession?.actor.equals(session.actor) &&
currentSession?.permission.equals(session.permission)}
<li class="grid grid-cols-[1fr_auto] gap-2">
<button
data-current={isCurrent}
Expand All @@ -252,9 +256,16 @@
{/if}
</div>

<span class="font-medium">
{session.actor}@{session.permission}
</span>
<div class="text-left font-medium">
<div>{session.actor}@{session.permission}</div>
{#if session.walletPlugin.id === 'wallet-plugin-multisig'}
<div class="text-xs">
↳ {m.common_account_multisig_using_account({
account: session.walletPlugin.data.session.actor
})}
</div>
{/if}
</div>
</button>
<button
onclick={() => removeSession(session)}
Expand Down Expand Up @@ -285,38 +296,42 @@
<hr class="border-mineShaft-900" />

<header class="grid justify-center gap-2 py-4 text-center">
<span class="h4">Login to Unicove</span>
<span class="text-muted text-sm font-medium">Connect your wallet to login</span>
<span class="h4">{m.common_login_to_unicove()}</span>
<span class="text-muted text-sm font-medium">{m.common_connect_wallet_login()}</span>
</header>

{#if context.wharf.sessionKit}
<ul class="grid grid-cols-[auto_1fr_auto]">
{#each context.wharf.sessionKit?.walletPlugins as wallet}
<li class="table-row-background table-row-border col-span-full grid grid-cols-subgrid">
<button
class="col-span-full grid grid-cols-subgrid gap-4 px-2 py-4 font-semibold text-white"
onclick={() => connectWallet(wallet)}
>
{#if wallet.metadata.logo}
<img
class="size-6"
src={wallet.metadata.logo.toString()}
alt={wallet.metadata.name}
/>
{:else}
<Wallet class="size-6" />
{/if}
<span class="text-left">{wallet.metadata.name}</span>
</button>
</li>
{#if wallet.id !== 'wallet-plugin-multisig'}
<li class="table-row-background table-row-border col-span-full grid grid-cols-subgrid">
<button
class="col-span-full grid grid-cols-subgrid gap-4 px-2 py-4 font-semibold text-white"
onclick={() => connectWallet(wallet)}
>
{#if wallet.metadata.logo}
<img
class="size-6"
src={wallet.metadata.logo.toString()}
alt={wallet.metadata.name}
/>
{:else}
<Wallet class="size-6" />
{/if}
<span class="text-left">{wallet.metadata.name}</span>
</button>
</li>
{/if}
{/each}
</ul>
{/if}
<div class="grid">
<!-- <Button href={`/${network}/signup`} onclick={closeDrawer} variant="primary"> -->
<!-- Create account -->
<!-- </Button> -->
<Button class="text-white" onclick={closeAddingAccount} variant="secondary">Cancel</Button>
<Button class="text-white" onclick={closeAddingAccount} variant="secondary"
>{m.common_cancel()}</Button
>
</div>
</div>
{/snippet}
12 changes: 6 additions & 6 deletions src/lib/components/elements/cpunetresource.svelte
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<script lang="ts">
import type { Int } from '@wharfkit/antelope';
import ResourceCard from './resourceCard.svelte';
interface Props {
cpuAvailable: number;
netAvailable: number;
precision?: number;
cpuAvailable: Int;
netAvailable: Int;
}
const { cpuAvailable, netAvailable, precision = 2 }: Props = $props();
const { cpuAvailable, netAvailable }: Props = $props();
</script>

<div class="flex gap-px *:flex-1 *:bg-mineShaft-900/70 *:p-4 *:pb-2">
<div class="rounded-l-lg">
<ResourceCard type="cpu" value={cpuAvailable.toFixed(precision)} />
<ResourceCard type="cpu" value={cpuAvailable} />
</div>
<div class="rounded-r-lg">
<ResourceCard type="net" value={netAvailable.toFixed(precision)} />
<ResourceCard type="net" value={netAvailable} />
</div>
</div>
27 changes: 27 additions & 0 deletions src/lib/components/elements/link.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<script lang="ts">
import { cn } from '$lib/utils';
import { type Snippet } from 'svelte';
import type { HTMLAnchorAttributes } from 'svelte/elements';
interface Props extends HTMLAnchorAttributes {
href: string;
children?: Snippet;
text?: string;
}
let { href, text = '', children, ...props }: Props = $props();
</script>

<a
{href}
class={cn(
'inline-flex items-center gap-2 text-skyBlue-500 hover:text-skyBlue-400 focus-visible:outline focus-visible:outline-solar-500 ',
props.class
)}
>
{#if children}
{@render children()}
{:else}
{text}
{/if}
</a>
10 changes: 5 additions & 5 deletions src/lib/components/elements/ramresource.svelte
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<script lang="ts">
import { cn } from '$lib/utils';
import type { Int } from '@wharfkit/antelope';
import { cn } from '$lib/utils';
import ResourceCard from './resourceCard.svelte';
interface Props {
ramAvailable: number;
precision?: number;
ramAvailable: Int;
class?: string;
}
const { ramAvailable, precision = 2, ...props }: Props = $props();
const { ramAvailable, ...props }: Props = $props();
</script>

<div class={cn('rounded-xl bg-mineShaft-900/70 p-4 pb-2', props.class)}>
<ResourceCard type="ram" value={ramAvailable.toFixed(precision)} />
<ResourceCard type="ram" value={ramAvailable} />
</div>
10 changes: 8 additions & 2 deletions src/lib/components/elements/resourceCard.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<script lang="ts">
import type { Int } from '@wharfkit/antelope';
import { type Icon } from 'lucide-svelte';
import CpuIcon from 'lucide-svelte/icons/cpu';
import Wifi from 'lucide-svelte/icons/wifi';
import HardDrive from 'lucide-svelte/icons/hard-drive';
import * as m from '$lib/paraglide/messages';
import NumberFormat from '$lib/components/elements/number.svelte';
interface Props {
type: keyof typeof resourceMap;
value: string;
value: Int;
vertical?: boolean;
}
Expand Down Expand Up @@ -53,7 +56,10 @@
</h3>

<p class="*:block">
<span class="font-semibold text-white">{props.value} {unit}</span>
<span class="font-semibold text-white">
<NumberFormat number={props.value.dividing(1000)} />
{unit}
</span>
<span>{m.common_available()}</span>
</p>
</div>
Loading

0 comments on commit 004487e

Please sign in to comment.