Skip to content

Commit

Permalink
enhancement: ignoring contracts folder when checking lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dafuga committed Oct 2, 2024
1 parent c42d3fe commit 97930ae
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ export default [
}
},
{
ignores: ['build/', '.svelte-kit/', 'dist/']
ignores: ['build/', '.svelte-kit/', 'dist/', 'src/lib/wharf/contracts/']
}
];
10 changes: 5 additions & 5 deletions src/routes/[network]/(account)/(staking)/staking/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const defaultSymbol = Asset.Symbol.from('0,UNKNOWN');
export const defaultQuantity = Asset.fromUnits(0, defaultSymbol);

export function getStakableBalance(network: NetworkState, account: AccountState): Asset {
let balance = Int64.from(0);
const balance = Int64.from(0);
if (account && account.balance) {
if (account.balance && account.balance.liquid) {
balance.add(account.balance.liquid.units);
Expand All @@ -23,7 +23,7 @@ export function getStakableBalance(network: NetworkState, account: AccountState)
}

export function getStakedBalance(network: NetworkState, account: AccountState): Asset {
let staked = Int64.from(0);
const staked = Int64.from(0);
if (account && account.loaded) {
if (account.account?.data.rex_info) {
staked.add(network.rexToToken(account.account.data.rex_info.rex_balance).units);
Expand All @@ -41,7 +41,7 @@ export function getClaimableBalance(
unstaking: Array<UnstakingRecord> | undefined
): Asset {
// claimable buckets, rex to be sold
let claimable = Int64.from(0);
const claimable = Int64.from(0);

if (!unstaking) {
unstaking = getUnstakingBalances(network, account);
Expand All @@ -58,7 +58,7 @@ export function getClaimableBalance(
}

export function getWithdrawableBalance(network: NetworkState, account: AccountState): Asset {
let withdrawable = Int64.from(0);
const withdrawable = Int64.from(0);
if (account && account.loaded && account.sources.rexfund && account.sources.rexfund.balance) {
withdrawable.add(Asset.from(account.sources.rexfund.balance).units);
}
Expand All @@ -70,7 +70,7 @@ export function getUnstakingBalances(
account: AccountState
): Array<UnstakingRecord> {
// matured_rex + claimable buckets
let records: Array<UnstakingRecord> = [];
const records: Array<UnstakingRecord> = [];
if (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))) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<script lang="ts">
import { ABI } from '@wharfkit/antelope';
import * as m from '$lib/paraglide/messages.js';
import Code from '$lib/components/code.svelte';
import Account from '$lib/components/link/account.svelte';
import Stack from '$lib/components/layout/stack.svelte';
import Pageheader from '$lib/components/pageheader.svelte';
const { data } = $props();
const tableDef = data.abi.tables.find((t: ABI.Table) => t.name === data.table);
const struct = data.abi.structs.find((s: ABI.Struct) => s.name === tableDef?.type);
</script>

<Stack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
interface Action {
account: string;
name: string;
data: any; // Adjust as necessary
// Other properties if needed
data: Record<string, unknown>;
}
// Type guard for account
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export async function GET({ fetch, params }) {
headers
}
);
} catch (_error) {
} catch (error) {
console.error(error);
return json({ error: 'Unable to load account.' }, { status: 500 });
}
}

0 comments on commit 97930ae

Please sign in to comment.