Skip to content

Commit

Permalink
Updating environmental vars
Browse files Browse the repository at this point in the history
  • Loading branch information
aaroncox committed Jan 7, 2025
1 parent 867199f commit 36cbbb2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 2 Unicove 2 Furious
# Unicove 2.0

![inspiration](https://i.ibb.co/2nbtvms/image-1.png)

Expand All @@ -9,16 +9,24 @@ Clone this repo and run `bun install` to install the dependencies.
Add a `.env` file to the root of the project with the following content:

```
# Specify environment Unicove is operating in
PUBLIC_ENVIRONMENT="development"
# Optional Private Key of testnet account for use with the WalletPluginPrivateKey
PUBLIC_LOCAL_SIGNER=""
# APIs for supported networks
API_EOS_HISTORY=https://eos.greymass.com
API_EOS_CHAIN=https://eos.greymass.com
API_EOS_LIGHTAPI=https://eos.light-api.net
API_JUNGLE4_HISTORY=https://jungle4.greymass.com
API_JUNGLE4_CHAIN=https://jungle4.greymass.com
API_KYLIN_HISTORY=https://kylintestnet.greymass.com
API_KYLIN_CHAIN=https://kylintestnet.greymass.com
```
Add your private key in there if you want to enable the local Private Key Signer instead of using Anchor for each test transaction.
# EOS Wallet for MetaMask
PUBLIC_METAMASK_SNAP_ORIGIN=npm:@greymass/eos-wallet
PUBLIC_METAMASK_SERVICE_URL=https://dev.account-creation-portal.pages.dev/buy
```

Run `bun dev` to start the development server then visit `http://localhost:5173`
9 changes: 3 additions & 6 deletions src/routes/[network]/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
import { chainLogos } from '@wharfkit/common';
import { onMount, setContext, untrack } from 'svelte';
import X from 'lucide-svelte/icons/circle-x';
import {
PUBLIC_ACCOUNT_UPDATE_INTERVAL,
PUBLIC_NETWORK_UPDATE_INTERVAL
} from '$env/static/public';
import * as env from '$env/static/public';
import type { UnicoveContext } from '$lib/state/client.svelte';
import { AccountState } from '$lib/state/client/account.svelte.js';
Expand Down Expand Up @@ -105,8 +102,8 @@
});
// Number of ms between network updates
const ACCOUNT_UPDATE_INTERVAL = Number(PUBLIC_ACCOUNT_UPDATE_INTERVAL) || 3_000;
const NETWORK_UPDATE_INTERVAL = Number(PUBLIC_NETWORK_UPDATE_INTERVAL) || 3_000;
const ACCOUNT_UPDATE_INTERVAL = Number(env.PUBLIC_ACCOUNT_UPDATE_INTERVAL) || 3_000;
const NETWORK_UPDATE_INTERVAL = Number(env.PUBLIC_NETWORK_UPDATE_INTERVAL) || 3_000;
// Default to not show a banner (avoids flash of banner when hidden)
let showBanner = $state(false);
Expand Down
7 changes: 5 additions & 2 deletions src/routes/[network]/api/metrics/marketprice/ram/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export const GET: RequestHandler = async ({ params }) => {
try {
const chain = getChainDefinitionFromParams(params.network);
const metricsUrl = getMetricsUrl(chain);
if (!metricsUrl) {
return json([]);
}
const response = await fetch(`${metricsUrl}/marketprice/ram/1h/7d`);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
Expand All @@ -39,7 +42,7 @@ export const GET: RequestHandler = async ({ params }) => {
headers: getCacheHeaders(30)
});
} catch (error) {
console.error('Error fetching historical RAM prices:', error);
return json({ error: 'Failed to fetch RAM price history' }, { status: 500 });
console.log(error);
return json([]);
}
};
7 changes: 5 additions & 2 deletions src/routes/[network]/api/metrics/marketprice/token/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export const GET: RequestHandler = async ({ params }) => {
try {
const chain = getChainDefinitionFromParams(params.network);
const metricsUrl = getMetricsUrl(chain);
if (!metricsUrl) {
return json([]);
}
const response = await fetch(`${metricsUrl}/marketprice/eosusd/1h/7d`);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
Expand All @@ -39,7 +42,7 @@ export const GET: RequestHandler = async ({ params }) => {
headers: getCacheHeaders(30)
});
} catch (error) {
console.error('Error fetching historical system token prices:', error);
return json({ error: 'Failed to fetch system token price history' }, { status: 500 });
console.log(error);
return json([]);
}
};

0 comments on commit 36cbbb2

Please sign in to comment.