Skip to content

Commit

Permalink
Merge pull request #379 from greymass/dev
Browse files Browse the repository at this point in the history
Next release
  • Loading branch information
aaroncox authored Feb 22, 2025
2 parents bbe60d1 + a8cb2a6 commit 0127da2
Show file tree
Hide file tree
Showing 46 changed files with 652 additions and 476 deletions.
15 changes: 2 additions & 13 deletions bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
"@fontsource/jetbrains-mono": "^5.1.0",
"@sveltejs/enhanced-img": "^0.4.4",
"@tailwindcss/container-queries": "^0.1.1",
"@wharfkit/account": "^1.4.0",
"@wharfkit/account-creation-plugin-metamask": "^1.2.1",
"@wharfkit/common": "^1.4.2",
"@wharfkit/contract": "^1.2.1",
"@wharfkit/resources": "^1.3.1",
"@wharfkit/roborovski": "^1.1.0",
"@wharfkit/session": "^1.4.0",
"@wharfkit/session": "^1.5.0",
"@wharfkit/transact-plugin-resource-provider": "^1.1.1",
"@wharfkit/wallet-plugin-anchor": "^1.4.0",
"@wharfkit/wallet-plugin-cleos": "^1.2.0",
Expand Down Expand Up @@ -480,8 +479,6 @@

"@wharfkit/abicache": ["@wharfkit/[email protected]", "", { "dependencies": { "@wharfkit/antelope": "^1.0.2", "@wharfkit/signing-request": "^3.1.0", "pako": "^2.0.4", "tslib": "^2.1.0" } }, "sha512-yOsYz2qQpQy7Nb8XZj62pZqp8YnmWDqFlrenYksBb9jl+1aWIpFhWd+14VEez4tUAezRH4UWW+w1SX5vhmUY9A=="],

"@wharfkit/account": ["@wharfkit/[email protected]", "", { "dependencies": { "@wharfkit/antelope": "^1.0.7", "@wharfkit/common": "^1.2.0", "@wharfkit/contract": "^1.2.1", "@wharfkit/resources": "^1.2.3", "@wharfkit/token": "^1.1.2", "tslib": "^2.1.0" } }, "sha512-A/G7wHRCg/WYO4itd6Hm5BcIn2bNJssXzU/AnbQ5zF2ky6gx+Zd37/G/oIoBdZLvaDhinVHXUBfUzpBtp4bqEA=="],

"@wharfkit/account-creation-plugin-metamask": ["@wharfkit/[email protected]", "", { "dependencies": { "@greymass/create-account": "^1.1.0", "@metamask/providers": "^17.0.0", "tslib": "^2.1.0" }, "peerDependencies": { "@wharfkit/session": "^1.4.0" } }, "sha512-7wLIsnxa+iVEy9+fomzE6Ba8ZJC4Xuuon5o3Vb4XjluETNpXwuVjiwXSI+EapxCE3qhxC78VayN8OmdX0fyf0g=="],

"@wharfkit/antelope": ["@wharfkit/[email protected]", "", { "dependencies": { "bn.js": "^4.11.9", "brorand": "^1.1.0", "elliptic": "^6.5.4", "hash.js": "^1.0.0", "pako": "^2.1.0", "tslib": "^2.0.3" } }, "sha512-f4O5O8+6Bd5BHpMUHTmlWQmlhX5xYb4AfzT2NJweyqIPqQOstm+aInF42AtUhSALDa8fvoY80YZoqwM0L8TUyw=="],
Expand All @@ -498,12 +495,10 @@

"@wharfkit/roborovski": ["@wharfkit/[email protected]", "", { "dependencies": { "@wharfkit/antelope": "^1.0.0", "tslib": "^2.0.3" } }, "sha512-UPZgkW+fLKcXlI4sNA8vzS/qTQoAZiFudnXhQScNHNalGTKTy3c5WEN4RPicbwcmGNUO3JVXMtKgwgrqRrUaVA=="],

"@wharfkit/session": ["@wharfkit/session@1.4.0", "", { "dependencies": { "@wharfkit/abicache": "^1.2.1", "@wharfkit/account": "^1.0.0", "@wharfkit/antelope": "^1.0.11", "@wharfkit/common": "^1.2.0", "@wharfkit/signing-request": "^3.1.0", "pako": "^2.0.4", "tslib": "^2.1.0" } }, "sha512-U+K9eWbYzFeDshYwgrhyNoF47kYToKFpTe6xFAwaJO+2w0kIkP0vtJFl7ygd06muh7Hu3K1BqrZ3j6+FyyuIyA=="],
"@wharfkit/session": ["@wharfkit/session@1.5.0", "", { "dependencies": { "@wharfkit/abicache": "^1.2.1", "@wharfkit/antelope": "^1.0.11", "@wharfkit/common": "^1.2.0", "@wharfkit/signing-request": "^3.1.0", "pako": "^2.0.4", "tslib": "^2.1.0" } }, "sha512-J+tHn7GayLL0NNVTjSlVW3s3EbaON3n/xHJE/RLwL/9Awft4rdV+O9BmTnlwYC6lScKiIN+bDYAJ3W2GE90T+Q=="],

"@wharfkit/signing-request": ["@wharfkit/[email protected]", "", { "dependencies": { "@wharfkit/antelope": "^1.0.7", "tslib": "^2.0.3" } }, "sha512-rIMzqwAKA5vb09+1BI+9fUXbj73JIkYcD1XT/Tom+k/+bqi51JcmC0trjCOjTUOK9UYDabpxYFixrf1ZvQymKw=="],

"@wharfkit/token": ["@wharfkit/[email protected]", "", { "dependencies": { "@wharfkit/antelope": "^1.0.4", "@wharfkit/contract": "^1.1.4", "bn.js": "^4.11.9", "tslib": "^2.1.0" } }, "sha512-LYAGB7LnE3hxwjNsYYwpxbJ8APi0Y8pmh7i1SeKv13HaPVjuHisTnuPxJm3ndwU7pX9GT3hPyo/By0l3CEuLfw=="],

"@wharfkit/transact-plugin-resource-provider": ["@wharfkit/[email protected]", "", { "dependencies": { "tslib": "^2.1.0" }, "peerDependencies": { "@wharfkit/session": "^1.1.0" } }, "sha512-y1VyXPyiO2ihPBej1FKhkuVh3UN5li+Bvjp5CIeNkL6XtmYw4Vdax9hO31qem3zs84YE+vB8WvogoSSICAU10Q=="],

"@wharfkit/wallet-plugin-anchor": ["@wharfkit/[email protected]", "", { "dependencies": { "@wharfkit/antelope": "^1.0.5", "@wharfkit/protocol-esr": "^1.3.2", "isomorphic-ws": "^5.0.0", "ws": "^8.13.0" }, "peerDependencies": { "@wharfkit/session": "^1.2.7" } }, "sha512-4BHWmxTk/wYRwUfATTbxOY3WYvmURkaQojvmm6HM6PB4PRQqTVcl5F/DBJQHgwu83SW7wsQ+g01U+dSpEZ0a/A=="],
Expand Down Expand Up @@ -1388,10 +1383,6 @@

"@typescript-eslint/visitor-keys/eslint-visitor-keys": ["[email protected]", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],

"@wharfkit/session/@wharfkit/account": ["@wharfkit/[email protected]", "", { "dependencies": { "@wharfkit/antelope": "^1.0.7", "@wharfkit/common": "^1.2.0", "@wharfkit/contract": "^1.0.0", "@wharfkit/resources": "^1.2.3", "@wharfkit/token": "^1.1.2", "tslib": "^2.1.0" } }, "sha512-qPW6tH/XkCnWRp1ZpVVHoSYv4S34bt6pAKx6ByCto/w6BvZ3ns+cJionmnxDFMhdAmxnCplD22Va1MeX3iQLJQ=="],

"@wharfkit/token/@wharfkit/contract": ["@wharfkit/[email protected]", "", { "dependencies": { "@wharfkit/abicache": "^1.2.0", "@wharfkit/antelope": "^1.0.4", "@wharfkit/signing-request": "^3.1.0", "tslib": "^2.1.0" } }, "sha512-I4w2QFvD/zb4uj5z0U4uQJLRCiZEbrT+AJ9/5goGm6SU42fsRud/k55qSBzW8Ij00OAv2h1+e8rR7xzUruXC9g=="],

"capnp-ts/debug": ["[email protected]", "", { "dependencies": { "ms": "2.1.2" } }, "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg=="],

"chokidar/glob-parent": ["[email protected]", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],
Expand Down Expand Up @@ -1504,8 +1495,6 @@

"@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="],

"@wharfkit/session/@wharfkit/account/@wharfkit/contract": ["@wharfkit/[email protected]", "", { "dependencies": { "@wharfkit/abicache": "^1.2.0", "@wharfkit/antelope": "^1.0.4", "@wharfkit/signing-request": "^3.1.0", "tslib": "^2.1.0" } }, "sha512-I4w2QFvD/zb4uj5z0U4uQJLRCiZEbrT+AJ9/5goGm6SU42fsRud/k55qSBzW8Ij00OAv2h1+e8rR7xzUruXC9g=="],

"capnp-ts/debug/ms": ["[email protected]", "", {}, "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="],

"eslint/debug/ms": ["[email protected]", "", {}, "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="],
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,12 @@
"@fontsource/jetbrains-mono": "^5.1.0",
"@sveltejs/enhanced-img": "^0.4.4",
"@tailwindcss/container-queries": "^0.1.1",
"@wharfkit/account": "^1.4.0",
"@wharfkit/account-creation-plugin-metamask": "^1.2.1",
"@wharfkit/common": "^1.4.2",
"@wharfkit/contract": "^1.2.1",
"@wharfkit/resources": "^1.3.1",
"@wharfkit/roborovski": "^1.1.0",
"@wharfkit/session": "^1.4.0",
"@wharfkit/session": "^1.5.0",
"@wharfkit/transact-plugin-resource-provider": "^1.1.1",
"@wharfkit/wallet-plugin-anchor": "^1.4.0",
"@wharfkit/wallet-plugin-cleos": "^1.2.0",
Expand Down
11 changes: 3 additions & 8 deletions src/lib/components/button/account.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script lang="ts">
import { browser } from '$app/environment';
import { goto } from '$app/navigation';
import { cn } from '$lib/utils';
import User from 'lucide-svelte/icons/user';
Expand All @@ -11,10 +10,6 @@
let { slop = true, ...props }: Props = $props();
function goToContract() {
goto(`/${props.data}`);
}
let buttonSize = $derived(slop ? 'size-12' : 'size-4');
</script>

Expand All @@ -23,15 +18,15 @@
<div
class="relative inline-flex text-skyBlue-500 hover:text-skyBlue-400 focus-visible:text-skyBlue-400 has-[:focus-visible]:text-solar-500"
>
<button
onclick={goToContract}
<a
href={props.data}
class={cn(
'peer absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 focus-visible:outline-none',
buttonSize
)}
>
<!-- Button is done this way with absolute positioning so we can maintain a decent hit slop on mobile without affecting layout -->
</button>
</a>
<User class="pointer-events-none z-50 inline size-4 align-baseline peer-active:scale-95" />
</div>
{/if}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script lang="ts">
import { browser } from '$app/environment';
import { goto } from '$app/navigation';
import { cn } from '$lib/utils';
import Code from 'lucide-svelte/icons/code';
Expand All @@ -11,10 +10,6 @@
let { slop = true, ...props }: Props = $props();
function goToContract() {
goto(`/${props.data}`);
}
let buttonSize = $derived(slop ? 'size-12' : 'size-4');
</script>

Expand All @@ -23,15 +18,15 @@
<div
class="relative inline-flex text-skyBlue-500 hover:text-skyBlue-400 focus-visible:text-skyBlue-400 has-[:focus-visible]:text-solar-500"
>
<button
onclick={goToContract}
<a
href={props.data}
class={cn(
'peer absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 focus-visible:outline-none',
buttonSize
)}
>
<!-- Button is done this way with absolute positioning so we can maintain a decent hit slop on mobile without affecting layout -->
</button>
</a>
<Code class="pointer-events-none z-50 inline size-4 align-baseline peer-active:scale-95" />
</div>
{/if}
2 changes: 1 addition & 1 deletion src/lib/components/button/copy.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
async function copyToClipboard() {
try {
await navigator.clipboard.writeText(props.data);
if (context.settings.data.debugMode) console.log(props.data, 'copied to clipboard');
if (context.settings.data.debugMode) console.info(props.data, 'copied to clipboard');
hint = true;
setTimeout(() => (hint = false), 300);
} catch (err) {
Expand Down
32 changes: 11 additions & 21 deletions src/lib/components/elements/action.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Action,
Name,
PermissionLevel,
Serializer,
type ABISerializable,
type Checksum256Type
} from '@wharfkit/antelope';
Expand All @@ -15,15 +14,15 @@
import Transaction from './transaction.svelte';
import type { UnicoveContext } from '$lib/state/client.svelte';
import { getContext, type Component } from 'svelte';
import type { ActionSummaryProps, DecodedActionData } from '$lib/types/transaction';
import type { ActionSummaryProps, ObjectifiedActionData } from '$lib/types/transaction';
import SquareTerminal from 'lucide-svelte/icons/square-terminal';
const context = getContext<UnicoveContext>('state');
interface Props {
action: Action;
datetime?: Date;
decoded?: DecodedActionData;
objectified?: ObjectifiedActionData;
id?: Checksum256Type;
notified?: Name[];
summary?: Component<ActionSummaryProps, object>;
Expand All @@ -33,22 +32,13 @@
let {
action,
datetime,
decoded,
objectified,
id,
notified,
summary: ActionSummary,
variant = 'pretty'
}: Props = $props();
async function decode() {
const abi = await context.network.abis?.getAbi(action.account);
return Serializer.decode({
data: action.data,
type: String(action.name),
abi: abi
});
}
let advancedMode = $derived(context.settings.data.advancedMode);
</script>

Expand Down Expand Up @@ -97,17 +87,17 @@
{/snippet}

{#snippet Decoded()}
{#await decode()}
{#await context.network.decodeAction(action)}
{@render CodeBox('Loading...')}
{:then decoded}
{@render CodeBox(decoded)}
{:then result}
{@render CodeBox(result)}
{:catch error}
{error.message}
{@render CodeBox(action)}
{/await}
{/snippet}

{#snippet Pretty(data: DecodedActionData | undefined)}
{#snippet Pretty(data: ObjectifiedActionData | undefined)}
<Code>
<div class="overflow-auto rounded bg-shark-950 p-4">
{#if data}
Expand All @@ -130,10 +120,10 @@
{/snippet}

{#snippet Summary()}
{#if typeof decoded === 'object' && ActionSummary}
<ActionSummary data={decoded} />
{#if typeof objectified === 'object' && ActionSummary}
<ActionSummary data={objectified} />
{:else}
{@render Pretty(decoded)}
{@render Pretty(objectified)}
{/if}
{/snippet}

Expand Down Expand Up @@ -201,7 +191,7 @@
{:else if variant === 'ricardian'}
{@render Ricardian()}
{:else if variant === 'pretty'}
{@render Pretty(decoded)}
{@render Pretty(objectified)}
{:else if variant === 'decoded'}
{@render Decoded()}
{:else if variant === 'json'}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/elements/datetime.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { languageTag } from '$lib/paraglide/runtime';
import { formatDateTime } from '$lib/utils/date';
import { formatDateTime } from '$lib/utils/intl';
interface Props {
datetime: Date;
Expand Down
18 changes: 18 additions & 0 deletions src/lib/components/elements/number.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<script lang="ts">
import { formatNumber, type IntlNumberTypes } from '$lib/utils/intl';
import { languageTag } from '$lib/paraglide/runtime';
interface Props {
number: IntlNumberTypes;
class?: string;
prefix?: boolean;
}
let { number, class: className = '', prefix = false }: Props = $props();
const symbol = $derived(Number(number) > 0 ? '+' : '');
</script>

<span class={className}>
{#if prefix}{symbol}{/if}{formatNumber(number, languageTag())}
</span>
24 changes: 24 additions & 0 deletions src/lib/components/elements/ramdelta.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<script lang="ts">
import { Int64, type Int } from '@wharfkit/antelope';
import NumberText from '$lib/components/elements/number.svelte';
interface Props {
number: Int;
colored: boolean;
}
let { number, colored = false }: Props = $props();
const positiveClasses = colored ? 'text-green-500' : '';
const negativeClasses = colored ? 'text-red-500' : '';
const neutralClasses = '';
</script>

{#if number.lt(Int64.from(0))}
<NumberText number={Number(number) * -1} class={positiveClasses} prefix />
{:else if number.gt(Int64.from(0))}
<NumberText number={-number} class={negativeClasses} />
{:else}
<NumberText {number} class={neutralClasses} />
{/if}
2 changes: 1 addition & 1 deletion src/lib/components/elements/trace.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<ActionElement
action={trace.action}
datetime={date ? trace.block_time.toDate() : undefined}
decoded={trace.act.data}
objectified={trace.act.data}
id={trxid ? trace.trx_id : undefined}
notified={trace.notifications}
{summary}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/input/name.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
const name: Name = $derived(Name.from(input));
/** Validation states */
const satisfiesLength = $derived(String(name).length > 0 && String(name).length <= 13);
const satisfiesLength = $derived(String(name).length > 0 && String(name).length <= 12);
const satisfiesNameMatch = $derived(String(name) === input);
/** Whether or not the input value is valid */
Expand Down
17 changes: 8 additions & 9 deletions src/lib/components/pageheader.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { page } from '$app/state';
import AccountButton from '$lib/components/button/account.svelte';
import CodeButton from '$lib/components/button/code.svelte';
import ContractButton from '$lib/components/button/contract.svelte';
import CopyButton from '$lib/components/button/copy.svelte';
import { languageTag } from '$lib/paraglide/runtime';
import { type NetworkState } from '$lib/state/network.svelte';
import { chainLogos } from '@wharfkit/common';
import ChevronLeft from 'lucide-svelte/icons/chevron-left';
Expand All @@ -29,11 +28,9 @@
let logo = $derived(chainLogos.get(String(props.network.chain.id)) || '');
let routePath = $derived($page.url.pathname.split('/')[3]);
let contractPath = $derived(
`${languageTag()}/${props.network.shortname}/contract/${props.title}`
);
let accountPath = $derived(`${languageTag()}/${props.network.shortname}/account/${props.title}`);
let routePath = $derived(page.url.pathname.split('/')[3]);
let contractPath = $derived(`/${props.network.shortname}/contract/${props.title}`);
let accountPath = $derived(`/${props.network.shortname}/account/${props.title}`);
</script>

<header class="col-span-full flex min-h-16 items-center gap-4">
Expand All @@ -60,10 +57,12 @@
{#if routePath === 'account'}
<CopyButton data={props.title} slop={false} />
{#if props.contract}
<CodeButton data={contractPath} slop={false} />
<ContractButton data={contractPath} slop={false} />
{/if}
{/if}

{#if routePath === 'contract'}
<CopyButton data={props.title} slop={false} />
<AccountButton data={accountPath} slop={false} />
{/if}
</h1>
Expand Down
23 changes: 23 additions & 0 deletions src/lib/components/transact/error.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script lang="ts">
import CircleX from 'lucide-svelte/icons/circle-x';
import * as m from '$lib/paraglide/messages';
interface Props {
error?: string;
hidden?: boolean;
}
const { error, hidden }: Props = $props();
</script>

<div class="space-y-6 rounded-lg" class:hidden>
<div class="flex flex-col items-center gap-6">
<picture class="size-24">
<CircleX class="size-full text-red-300" />
</picture>
<h2 class="h3">{m.common_transaction_error()}</h2>
</div>
<p class="py-4">
{error}
</p>
</div>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { transactions } from '$lib/wharf/transact.svelte';
import type { Checksum256 } from '@wharfkit/antelope';
import Transaction from './elements/transaction.svelte';
import Transaction from '../elements/transaction.svelte';
import CircleCheckBig from 'lucide-svelte/icons/circle-check-big';
import * as m from '$lib/paraglide/messages';
Expand Down
Loading

0 comments on commit 0127da2

Please sign in to comment.