Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bridge-ui-v2): env vars #14034

Merged
merged 18 commits into from
Jun 23, 2023
Merged
13 changes: 7 additions & 6 deletions .github/workflows/bridge-ui-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ jobs:
- name: Install pnpm dependencies
uses: ./.github/actions/install-pnpm-dependencies

# This step is needed because the .env file is not committed to the repository
# and the Svelte check complains about not finding the exports from $env/static/public,
# which will be generated based on the .env file when running `svelte-kit sync`
- name: Copy .env.example to .env
working-directory: ./packages/bridge-ui-v2
run: cp .env.example .env

- name: Svelte check
working-directory: ./packages/bridge-ui-v2
run: pnpm svelte:check
Expand All @@ -37,9 +44,3 @@ jobs:
run: pnpm test:unit

# TODO: Playwright tests?

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
directory: ./packages/bridge-ui-v2/coverage
flags: bridge-ui
66 changes: 66 additions & 0 deletions packages/bridge-ui-v2/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Chain Names
jscriptcoder marked this conversation as resolved.
Show resolved Hide resolved
export export PUBLIC_L1_CHAIN_NAME=""
export export PUBLIC_L2_CHAIN_NAME=""
export PUBLIC_L3_CHAIN_NAME=""


# Chain Ids
export PUBLIC_L1_CHAIN_ID=
export PUBLIC_L2_CHAIN_ID=
export PUBLIC_L3_CHAIN_ID=


# RPC Urls
export PUBLIC_L1_RPC_URL=https://
export PUBLIC_L2_RPC_URL=https://
export PUBLIC_L3_RPC_URL=https://


# Explorer Urls
export PUBLIC_L1_EXPLORER_URL=https://
export PUBLIC_L2_EXPLORER_URL=https://
export PUBLIC_L3_EXPLORER_URL=https://


# Relayer API
export PUBLIC_RELAYER_URL=https://


# Use the bridge guide Urls
export PUBLIC_GUIDE_URL=https://


# Cross Chain (Taiko) Contract address
export PUBLIC_L1_CROSS_CHAIN_SYNC_ADDRESS=0x
export PUBLIC_L2_CROSS_CHAIN_SYNC_ADDRESS=0x
export PUBLIC_L3_CROSS_CHAIN_SYNC_ADDRESS=0x


# Token Vault Contract address
export PUBLIC_L1_TOKEN_VAULT_ADDRESS=0x
export PUBLIC_L2_TOKEN_VAULT_ADDRESS=0x
export PUBLIC_L3_TOKEN_VAULT_ADDRESS=0x


# Bridge Contract address
export PUBLIC_L1_BRIDGE_ADDRESS=0x
export PUBLIC_L2_BRIDGE_ADDRESS=0x
export PUBLIC_L3_BRIDGE_ADDRESS=0x


# Signal Service Contract address
export PUBLIC_L1_SIGNAL_SERVICE_ADDRESS=0x
export PUBLIC_L2_SIGNAL_SERVICE_ADDRESS=0x
export PUBLIC_L3_SIGNAL_SERVICE_ADDRESS=0x


# Test token List
export PUBLIC_TEST_ERC20=[]


# Sentry
export PUBLIC_SENTRY_DSN=https://

export SENTRY_ORG=
export SENTRY_PROJECT=
export SENTRY_AUTH_TOKEN=
2 changes: 2 additions & 0 deletions packages/bridge-ui-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"devDependencies": {
"@playwright/test": "^1.28.1",
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/adapter-static": "^2.0.2",
"@sveltejs/kit": "^1.5.0",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
Expand All @@ -37,6 +38,7 @@
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^4.3.0",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^0.32.2"
},
"type": "module",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
</script>

<script lang="ts">
import { PUBLIC_GUIDE_URL, PUBLIC_L2_EXPLORER_URL } from '$env/static/public';

import Icon from '../Icon';
import LinkButton from '../LinkButton';
import { LogoWithText } from '../Logo';

// TODO: env vars
let explorerUrl = 'https://explorer.internal.taiko.xyz/';
let guideUrl = 'https://taiko.xyz/docs/guides/use-the-bridge';
</script>

<div class="drawer md:drawer-open">
Expand Down Expand Up @@ -46,13 +44,13 @@
</LinkButton>
</li>
<li>
<LinkButton href={explorerUrl} target="_blank">
<LinkButton href={PUBLIC_L2_EXPLORER_URL} target="_blank">
<Icon type="explorer" />
<span>Exploreer</span>
</LinkButton>
</li>
<li>
<LinkButton href={guideUrl} target="_blank">
<LinkButton href={PUBLIC_GUIDE_URL} target="_blank">
<Icon type="guide" />
<span>Guide</span>
</LinkButton>
Expand Down
3 changes: 2 additions & 1 deletion packages/bridge-ui-v2/src/routes/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Entry point
*/

// Setting this to false turns your app into an SPA
// When setting this to false your entire app will only be rendered on the client,
// which essentially means you turn your app into an SPA.
// See https://kit.svelte.dev/docs/page-options#ssr
export const ssr = false;
10 changes: 5 additions & 5 deletions packages/bridge-ui-v2/svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import adapter from '@sveltejs/adapter-auto';
import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/kit/vite';

/** @type {import('@sveltejs/kit').Config} */
Expand All @@ -8,10 +8,10 @@ const config = {
preprocess: vitePreprocess(),

kit: {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter(),
// https://kit.svelte.dev/docs/single-page-apps
adapter: adapter({
fallback: 'index.html',
}),
},
};

Expand Down
2 changes: 1 addition & 1 deletion packages/bridge-ui-v2/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default {
utils: true, // adds responsive and modifier utility classes
rtl: false, // rotate style direction from left-to-right to right-to-left. You also need to add dir="rtl" to your html tag and install `tailwindcss-flip` plugin for Tailwind CSS.
prefix: '', // prefix for daisyUI classnames (components, modifiers and responsive class names. Not colors)
logs: true, // Shows info about daisyUI version and used config in the console when building your CSS
logs: false, // Shows info about daisyUI version and used config in the console when building your CSS
themes: [
{
dark: {
Expand Down
9 changes: 8 additions & 1 deletion packages/bridge-ui-v2/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { sveltekit } from '@sveltejs/kit/vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import { defineConfig } from 'vitest/config';

export default defineConfig({
plugins: [sveltekit()],
plugins: [
sveltekit(),

// This plugin gives vite the ability to resolve imports using TypeScript's path mapping.
// https://www.npmjs.com/package/vite-tsconfig-paths
tsconfigPaths(),
],
test: {
globals: true,
include: ['src/**/*.{test,spec}.{js,ts}'],
Expand Down
45 changes: 44 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.