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): allow bridging to all layers #14525

Merged
merged 74 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
2f3df42
feat(bridge-ui-v2): enable L3 chain selection
KorbinianK Aug 15, 2023
57cb45a
add address mapping for multiple layer configs
KorbinianK Aug 16, 2023
65787ba
Merge remote-tracking branch 'origin/main' into feat/bridge-ui-v2--mu…
KorbinianK Aug 16, 2023
5756d28
additional logic of finding the crosschain address
KorbinianK Aug 16, 2023
810c37d
linting
KorbinianK Aug 16, 2023
ecef0be
feat(bridge-ui-v2): added custom vite plugin to generate config
KorbinianK Aug 21, 2023
a55eb1d
linting
KorbinianK Aug 21, 2023
369d447
add chainIcon
KorbinianK Aug 21, 2023
275d612
gitignore
KorbinianK Aug 21, 2023
2450745
gitignore
KorbinianK Aug 21, 2023
7ff589f
add dynamic chainicons
KorbinianK Aug 21, 2023
745b7d3
update readme
KorbinianK Aug 21, 2023
636d7a7
fix: network change updating the store when there is no change
KorbinianK Aug 22, 2023
2e6bb3f
only enable valid combinations in chainselector
KorbinianK Aug 23, 2023
582ad91
separate configs, begin on relayer config
KorbinianK Aug 24, 2023
5341e44
Merge remote-tracking branch 'origin/main' into feat/bridge-ui-v2--mu…
KorbinianK Aug 24, 2023
45e29b5
add relayer config
KorbinianK Aug 24, 2023
24ae89b
added preconfigured token via new config, removed more env variable uses
KorbinianK Aug 25, 2023
0cefd46
make only preconfigured tokens mintable
KorbinianK Aug 25, 2023
b46a991
cleanup types for config generation
KorbinianK Aug 25, 2023
bd7a542
fix using layertype
KorbinianK Aug 25, 2023
0d97efa
add fetching from all relayers
KorbinianK Aug 25, 2023
f2e4095
add schema validation, export config as base64 to .env
KorbinianK Aug 28, 2023
9d6e974
linting
KorbinianK Aug 28, 2023
9d37efc
update readme and example .env
KorbinianK Aug 29, 2023
6d82a24
linting
KorbinianK Aug 29, 2023
d75bff7
Merge remote-tracking branch 'origin/main' into feat/bridge-ui-v2--mu…
KorbinianK Aug 30, 2023
2c6f1b5
Merge remote-tracking branch 'origin/main' into feat/bridge-ui-v2--mu…
KorbinianK Aug 30, 2023
8376131
fix merge
KorbinianK Aug 30, 2023
c2ccb3a
revert auto lint to match main
KorbinianK Aug 30, 2023
7302232
revert auto lint to match main
KorbinianK Aug 30, 2023
969f25f
refactor config plugins
KorbinianK Aug 30, 2023
57bac32
prep for new contracts
KorbinianK Aug 30, 2023
01b32ea
adjustments for new contracts
KorbinianK Aug 30, 2023
799e26e
trimming whitespace for export, style fix for amount alert
KorbinianK Aug 30, 2023
83f2ecc
update readme
KorbinianK Aug 30, 2023
6fe5aac
fix token dropdown for custom tokens
KorbinianK Aug 30, 2023
172bf9b
fix claiming
KorbinianK Aug 30, 2023
53953c6
fix status, fix fetching correct addresses
KorbinianK Aug 31, 2023
d7117c6
update pnpm-lock.yaml
KorbinianK Aug 31, 2023
e750324
change tsconfig paths
KorbinianK Aug 31, 2023
23016ae
fix icons
KorbinianK Aug 31, 2023
a56efe1
adjust custom token dialog
KorbinianK Aug 31, 2023
39dfa87
fix balance color
KorbinianK Aug 31, 2023
c2b2697
fix crosschain address detection
KorbinianK Sep 1, 2023
c46899a
tsconfig push
KorbinianK Sep 1, 2023
da20edc
tsconfig
KorbinianK Sep 1, 2023
2828eff
fix processable check using wrong bridge
KorbinianK Sep 1, 2023
772c73c
Merge remote-tracking branch 'origin/main' into feat/bridge-ui-v2--mu…
KorbinianK Sep 1, 2023
3e5927c
updated mobile dialog on activities, some design fixes
KorbinianK Sep 4, 2023
29b13dd
export config via js now, fix chrosschain address search
KorbinianK Sep 4, 2023
31a10b3
revert switching chains for proof
KorbinianK Sep 4, 2023
73bba4f
Merge remote-tracking branch 'origin/main' into feat/bridge-ui-v2--mu…
KorbinianK Sep 4, 2023
8905825
update config export script
KorbinianK Sep 5, 2023
437f96e
catching offline relayer
KorbinianK Sep 5, 2023
3c7198f
fix(bridge-ui-v2): fix dest chain issues (#14650)
jscriptcoder Sep 5, 2023
57378af
Merge branch 'main' into feat/bridge-ui-v2--multi-layer-bridging
KorbinianK Sep 5, 2023
18849c8
fix chainselector colors
KorbinianK Sep 5, 2023
9b5c31d
cleanup
KorbinianK Sep 5, 2023
45b7493
Merge branch 'main' into feat/bridge-ui-v2--multi-layer-bridging
KorbinianK Sep 6, 2023
c3857c7
update lockfile
KorbinianK Sep 6, 2023
517484e
remove repeated declaration
jscriptcoder Sep 6, 2023
1377718
i18n
jscriptcoder Sep 6, 2023
e0327b9
fix relayer using old message params
KorbinianK Sep 6, 2023
aa1db75
Merge branch 'feat/bridge-ui-v2--multi-layer-bridging' of https://git…
KorbinianK Sep 6, 2023
7a4af7a
sorting
KorbinianK Sep 6, 2023
818e220
relayerAPI mapping wrong contracts for tokentype
KorbinianK Sep 6, 2023
6311b38
style for bridge button and spinner
KorbinianK Sep 6, 2023
f0584b9
fix mobile status dialog not being full width
KorbinianK Sep 6, 2023
703c968
fix erc20 claiming by corretly using the decoded hex data
KorbinianK Sep 6, 2023
e7593ef
adjust dialog loading mask, catching error
KorbinianK Sep 6, 2023
bcb209a
re-added relayer baseurl
KorbinianK Sep 6, 2023
f653149
fix chainselector colors
KorbinianK Sep 6, 2023
3f2ea48
Merge branch 'main' into feat/bridge-ui-v2--multi-layer-bridging
dantaik Sep 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
77 changes: 8 additions & 69 deletions packages/bridge-ui-v2/.env.example
Original file line number Diff line number Diff line change
@@ -1,84 +1,23 @@
# Chain Names
export PUBLIC_L1_CHAIN_NAME=""
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://

# Default explorer as fallback for the sidebar
export PUBLIC_DEFAULT_EXPLORER=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

# ERC721 Token Vault Contract address
export PUBLIC_L1_ERC721_VAULT_ADDRESS=
export PUBLIC_L2_ERC721_VAULT_ADDRESS=
export PUBLIC_L3_ERC721_VAULT_ADDRESS=


# ERC1155 Token Vault Contract address
export PUBLIC_L1_ERC1155_VAULT_ADDRESS=
export PUBLIC_L2_ERC1155_VAULT_ADDRESS=
export PUBLIC_L3_ERC1155_VAULT_ADDRESS=


# 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=[]


# WalletConnect Project ID
export PUBLIC_WALLETCONNECT_PROJECT_ID=""

# Enable NFT Bridge ("true" or "false")
export PUBLIC_NFT_BRIDGE_ENABLED=""


# Sentry
export PUBLIC_SENTRY_DSN=https://

export SENTRY_ORG=
export SENTRY_PROJECT=
export SENTRY_AUTH_TOKEN=

# Config jsons in base64 (see ReadMe, these are generated via a script)
export CONFIGURED_BRIDGES=
export CONFIGURED_CHAINS=
export CONFIGURED_CUSTOM_TOKEN=
export CONFIGURED_RELAYER=
2 changes: 2 additions & 0 deletions packages/bridge-ui-v2/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ CHANGELOG.md
pnpm-lock.yaml
package-lock.json
yarn.lock

src/generated/*
2 changes: 1 addition & 1 deletion packages/bridge-ui-v2/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ vite.config.ts.timestamp-*
!/config/sample/
!/config/schemas/

src/generated/*
src/generated/*
82 changes: 74 additions & 8 deletions packages/bridge-ui-v2/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,92 @@
# Bridge UI v2

## Developing
This package contains the Bridge UI built with svelte and wagmi

Installed dependencies with `pnpm install`
- [Bridge UI v2](#bridge-ui-v2)
- [Development setup](#development-setup)
- [Set up environment variables](#set-up-environment-variables)
- [Set up configurations](#set-up-configurations)
- [Start a development server:](#start-a-development-server)
- [Building](#building)

Set up environment variables
## Development setup

Install all dependencies with

```bash
pnpm install
```

### Set up environment variables

```bash
cp .env.example .env
```

# update environment variables in .env
Then update environment variables in .env

```bash
source .env
```

start a development server:
### Set up configurations

**High-level flow:**

1. Prepare .json config files
2. Export as base64 to .env
3. build/serve creates typescript configs for the app

<br/>

**Detailed process**

These are are the additional configuration files that have to be filled in:

| Name | Description |
| --------------------------------------- | ---------------------------------------------------------------------------------------- |
| **/config/configuredBridges.json** | Defines the chains that are connected via taiko bridges and lists the contract addresses |
| **/config/configuredChains.json** | Defines some metadata for the chains, such as name, icons, explorer URL, etc. |
| **/config/configuredRelayer.json** | If chains have a relayer, the URL and the chain IDs it covers are entered here |
| **/config/configuredCustomTokens.json** | Defines a list of tokens that should be availabe in the token dropdowns |

---

<br>

To get started, open your terminal in `/packages/bridge-ui-v2/`

1. Copy the config examples
```bash
cp config/sample/configuredBridges.example config/configuredBridges.json
cp config/sample/configuredChains.example config/configuredChains.json
cp config/sample/configuredRelayer.example config/configuredRelayer.json
cp config/sample/configuredCustomTokens.example config/configuredCustomTokens.json
```
2. Change or fill in all the information that will be used by the bridge UI inside these files.

3. As the configurations are not committed directly, they will be loaded from the .env. <br>For that they need to be encoded and appended to the .env file:

```bash
pnpm export:config
```

This command exports the json as base64 string to your .env file

4. Now whenver a build is triggered it will generate the config files based on the .env file in `src/generated/`
<br>**Note: In the** `config/schemas` **folder are schemas that will validate the correct json format and report any errors in your initial json configurations, so check the log output for any errors!**
<br>

**Beware**, that if you make changes to the json files, you need to export them to the .env again via script.
<br>

### Start a development server:

```bash
pnpm run dev
pnpm dev

# or start the server and open the app in a new browser tab
pnpm run dev -- --open
pnpm dev -- --open
```

## Building
Expand All @@ -33,4 +99,4 @@ npm run build

You can preview the production build with `npm run preview`.

> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
52 changes: 52 additions & 0 deletions packages/bridge-ui-v2/config/sample/configuredBridges.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"configuredBridges": [
{
"source": "",
"destination": "",
"addresses": {
"bridgeAddress": "",
"erc20VaultAddress": "",
"erc721VaultAddress": "",
"erc1155VaultAddress": "",
"crossChainSyncAddress": "",
"signalServiceAddress": ""
}
},
{
"source": "",
"destination": "",
"addresses": {
"bridgeAddress": "",
"erc20VaultAddress": "",
"erc721VaultAddress": "",
"erc1155VaultAddress": "",
"crossChainSyncAddress": "",
"signalServiceAddress": ""
}
},
{
"source": "",
"destination": "",
"addresses": {
"bridgeAddress": "",
"erc20VaultAddress": "",
"erc721VaultAddress": "",
"erc1155VaultAddress": "",
"crossChainSyncAddress": "",
"signalServiceAddress": ""
}
},
{
"source": "",
"destination": "",
"addresses": {
"bridgeAddress": "",
"erc20VaultAddress": "",
"erc721VaultAddress": "",
"erc1155VaultAddress": "",
"crossChainSyncAddress": "",
"signalServiceAddress": ""
}
}
]
}
37 changes: 37 additions & 0 deletions packages/bridge-ui-v2/config/sample/configuredChains.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"configuredChains": [
{
"123456": {
"name": "",
"type": "L1",
"icon": "path/or/url/to/icon",
"urls": {
"rpc": "",
"explorer": ""
}
}
},
{
"78910": {
"name": "",
"type": "L2",
"icon": "path/or/url/to/icon",
"urls": {
"rpc": "",
"explorer": ""
}
}
},
{
"98765": {
"name": "",
"type": "L3",
"icon": "path/or/url/to/icon",
"urls": {
"rpc": "",
"explorer": ""
}
}
}
]
}
26 changes: 26 additions & 0 deletions packages/bridge-ui-v2/config/sample/configuredCustomToken.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"name": "Bull Token",
"addresses": {
"1234": "0x00...",
"4567": "0x00...",
"8910": "0x00..."
},
"symbol": "BLL",
"decimals": 18,
"type": "ERC20",
"logoURI": "http://example.com/logo.png"
},
{
"name": "Horse Token",
"addresses": {
"1234": "0x00...",
"4567": "0x00...",
"8910": "0x00..."
},
"symbol": "HORSE",
"decimals": 18,
"type": "ERC20",
"logoURI": "http://example.com/logo.png"
}
]
12 changes: 12 additions & 0 deletions packages/bridge-ui-v2/config/sample/configuredRelayer.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"configuredRelayer": [
{
"chainIds": [123456, 654321],
"url": "https://some/url.example"
},
{
"chainIds": [1, 11155111],
"url": "https://some/other/url.example"
}
]
}