Skip to content

Commit

Permalink
Merge pull request #381 from greymass/remove-account-kit
Browse files Browse the repository at this point in the history
Removed Account Kit
  • Loading branch information
aaroncox authored Feb 20, 2025
2 parents 266e60c + 450bbfe commit fedcc77
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 36 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
10 changes: 2 additions & 8 deletions src/lib/state/client/account.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
type NameType
} from '@wharfkit/antelope';
import type { REXState } from '@wharfkit/resources';
import { Account } from '@wharfkit/account';
import { TokenMeta, TokenBalance, TokenIdentifier } from '@wharfkit/common';

import type { NetworkState } from '$lib/state/network.svelte';
Expand All @@ -34,7 +33,6 @@ export class AccountState {
public network: NetworkState;
private sources: AccountDataSources = $state(defaultAccountDataSources);

public account: Account | undefined = $state();
public name: Name = $state(Name.from(''));
public last_update: Date = $state(new Date());
public contract: boolean = $derived(
Expand All @@ -59,8 +57,8 @@ export class AccountState {
public delegations = $derived(getDelegations(this.sources));

public resources = $derived.by(() => getResources(this.sources, this.network));

public permissions = $derived.by(() => (this.account ? this.account.permissions : undefined));
public rex = $derived(SystemContract.Types.rex_balance.from(this.sources.rexbal));
public permissions = $derived(API.v1.AccountObject.from(this.sources.get_account).permissions);
public proposals = $derived.by(() => this.sources.proposals);
public refundRequest = $derived.by(() => this.sources.refund_request);
public value = $derived.by(() => {
Expand Down Expand Up @@ -116,10 +114,6 @@ export class AccountState {
rexbal: data.rexbal,
rexfund: data.rexfund
};
this.account = new Account({
client: this.network.client,
data: API.v1.AccountObject.from(this.sources.get_account)
});
if (data.get_account && data.get_account.voter_info) {
this.voter = {
isProxy: data.get_account.voter_info.is_proxy,
Expand Down
17 changes: 8 additions & 9 deletions src/lib/utils/staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,34 +91,33 @@ export function getUnstakingBalances(
): Array<UnstakingRecord> {
// matured_rex + claimable buckets
const records: Array<UnstakingRecord> = [];
if (network && account && account.loaded && account.account?.data.rex_info) {
const rexInfo = account.account.data.rex_info;
if (rexInfo.matured_rex && rexInfo.matured_rex.gt(Int64.from(0))) {
if (network && account && account.loaded && account.rex) {
if (account.rex.matured_rex && account.rex.matured_rex.gt(Int64.from(0))) {
// construct matured as one rex bucket
records.push({
date: undefined,
balance: network.rexToToken(
Asset.fromUnits(rexInfo.matured_rex, rexInfo.rex_balance.symbol)
Asset.fromUnits(account.rex.matured_rex, account.rex.rex_balance.symbol)
),
rex: Asset.fromUnits(rexInfo.matured_rex, rexInfo.rex_balance.symbol),
rex: Asset.fromUnits(account.rex.matured_rex, account.rex.rex_balance.symbol),
claimable: true,
savings: false
});
}

if (rexInfo.rex_maturities) {
if (account.rex.rex_maturities) {
// transform real rex buckets
const fiveYearsFromNow = new Date().getTime() + 1000 * 60 * 60 * 24 * 365 * 5;
const now = new Date();
for (const maturity of rexInfo.rex_maturities) {
for (const maturity of account.rex.rex_maturities) {
if (maturity.first && maturity.second) {
const date = new Date(maturity.first.toString() + 'Z');
records.push({
date,
balance: network.rexToToken(
Asset.fromUnits(maturity.second, rexInfo.rex_balance.symbol)
Asset.fromUnits(maturity.second, account.rex.rex_balance.symbol)
),
rex: Asset.fromUnits(maturity.second, rexInfo.rex_balance.symbol),
rex: Asset.fromUnits(maturity.second, account.rex.rex_balance.symbol),
claimable: date < now,
savings: +date > +fiveYearsFromNow
});
Expand Down
3 changes: 2 additions & 1 deletion src/routes/[network]/(account)/(send)/send/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
});
const allValid = $derived(toValid && assetValid && memoValid);
const ready = $derived(allValid && !context.wharf.transacting);
const progress = $derived.by(() => {
switch (f.current) {
Expand Down Expand Up @@ -424,7 +425,7 @@
{/if}

{#if f.current === 'memo'}
<Button class="col-end-3" onclick={transact} disabled={!allValid}>{m.common_submit()}</Button>
<Button class="col-end-3" onclick={transact} disabled={!ready}>{m.common_submit()}</Button>
{:else if f.current !== 'complete'}
<Button class="col-end-3" type="submit" onclick={preventDefault(next)} disabled={!nextValid}>
{m.common_next()}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type { Permission } from '@wharfkit/account';
import type { PageLoad } from './$types';
import { Name } from '@wharfkit/antelope';
import { API, Name } from '@wharfkit/antelope';
import * as m from '$lib/paraglide/messages';

export interface TreePermission {
permission: Permission;
permission: API.v1.AccountPermission;
children?: TreePermission[];
}

Expand Down

0 comments on commit fedcc77

Please sign in to comment.