Skip to content

Commit

Permalink
Merge branch 'main' into major_protocol_upgrade_rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik committed Apr 23, 2023
2 parents 913f17f + 4812950 commit 7f84e77
Show file tree
Hide file tree
Showing 96 changed files with 2,214 additions and 1,017 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,6 @@ __pycache__/

# whitepaper
.pdf

# Ignoring new Bridge UI work for the moment
packages/bridge-ui-v2
14 changes: 7 additions & 7 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
".": "0.9.0",
".": "0.10.0",
"packages/branding": "0.1.1",
"packages/bridge-ui": "0.4.0",
"packages/eventindexer": "0.2.0",
"packages/protocol": "0.6.0",
"packages/relayer": "0.4.0",
"packages/status-page": "0.5.0",
"packages/bridge-ui": "0.5.0",
"packages/eventindexer": "0.2.1",
"packages/protocol": "0.6.1",
"packages/relayer": "0.4.1",
"packages/status-page": "0.6.0",
"packages/tokenomics": "0.1.0",
"packages/website": "0.5.0",
"packages/website": "0.6.0",
"packages/whitepaper": "1.3.0"
}
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## [0.10.0](https://github.com/taikoxyz/taiko-mono/compare/taiko-mono-v0.9.0...taiko-mono-v0.10.0) (2023-04-08)


### Features

* **bridge-ui:** more informative processing fee ([#13488](https://github.com/taikoxyz/taiko-mono/issues/13488)) ([f5f7b7e](https://github.com/taikoxyz/taiko-mono/commit/f5f7b7ee2a99ec940a73e263fb12e9378d139734))
* **status-page:** order the provers by count descending ([#13504](https://github.com/taikoxyz/taiko-mono/issues/13504)) ([49db97d](https://github.com/taikoxyz/taiko-mono/commit/49db97d75019d71beb8466c646934bfabba5b13d))
* **website:** add index sections to reference and resources ([#13490](https://github.com/taikoxyz/taiko-mono/issues/13490)) ([d1768d4](https://github.com/taikoxyz/taiko-mono/commit/d1768d4224cce4b2148b0b467203c164b86ea238))


### Bug Fixes

* **bridge-ui:** fix issue with claim notice modal ([#13507](https://github.com/taikoxyz/taiko-mono/issues/13507)) ([a3e38fa](https://github.com/taikoxyz/taiko-mono/commit/a3e38faff37f01669e6be6878d35431cb24e40bb))
* **bridge-ui:** fix relayer ([#13548](https://github.com/taikoxyz/taiko-mono/issues/13548)) ([5f60fd7](https://github.com/taikoxyz/taiko-mono/commit/5f60fd711c71ead82c7c147b4ff8dd12eab02c43))
* **bridge-ui:** improve notice modal ([#13530](https://github.com/taikoxyz/taiko-mono/issues/13530)) ([3944ca8](https://github.com/taikoxyz/taiko-mono/commit/3944ca8bc5282c2ab0c4b11b2bb1b5f102329d59))
* **bridge-ui:** NETWORK_ERROR exception ([#13562](https://github.com/taikoxyz/taiko-mono/issues/13562)) ([a779cdb](https://github.com/taikoxyz/taiko-mono/commit/a779cdb3433ea6cc2e0d203cecebde3d9c121f5a))
* **bridge-ui:** only request connect if require ([#13519](https://github.com/taikoxyz/taiko-mono/issues/13519)) ([92e9032](https://github.com/taikoxyz/taiko-mono/commit/92e9032e88fb997db5e9e9801089671604f0a9bc))
* **bridge-ui:** Typos in Update ProcessingFee.svelte ([#13518](https://github.com/taikoxyz/taiko-mono/issues/13518)) ([8edd302](https://github.com/taikoxyz/taiko-mono/commit/8edd302fc2ea0764c3fb96bbcc2454f154556167))
* **bridge-ui:** URL change won't update activeTab ([#13485](https://github.com/taikoxyz/taiko-mono/issues/13485)) ([884e782](https://github.com/taikoxyz/taiko-mono/commit/884e78283d8f98f20b15ff7e3e5e371df30fcd13))
* **repo:** fix multiple typos ([#13558](https://github.com/taikoxyz/taiko-mono/issues/13558)) ([f54242a](https://github.com/taikoxyz/taiko-mono/commit/f54242aa95e5c5563f8f0a7f9af0a1eab20ab67b))
* **starter-dapp:** check network.chain non null ([#13515](https://github.com/taikoxyz/taiko-mono/issues/13515)) ([02eb83b](https://github.com/taikoxyz/taiko-mono/commit/02eb83b0b1e0d275627c000b00c20931727e619f))
* **starter-dapp:** update some wrong style ([#13517](https://github.com/taikoxyz/taiko-mono/issues/13517)) ([728b8ad](https://github.com/taikoxyz/taiko-mono/commit/728b8ade74e5802066a43f0782ba7af169cafbbf))
* **status-page:** add max height and scrollable to prover details popup ([#13498](https://github.com/taikoxyz/taiko-mono/issues/13498)) ([d126791](https://github.com/taikoxyz/taiko-mono/commit/d126791775bbaa59a107975077b9d32811bd09ea))
* **status-page:** latest proof time ([#13511](https://github.com/taikoxyz/taiko-mono/issues/13511)) ([c0bc671](https://github.com/taikoxyz/taiko-mono/commit/c0bc671572a13b48d33ea567fc884a72e51f2be0))

## [0.9.0](https://github.com/taikoxyz/taiko-mono/compare/taiko-mono-v0.8.0...taiko-mono-v0.9.0) (2023-03-29)


Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Here are some ways you can contribute:
# Claim a Taiko Contributor GitPOAP

A Taiko Contributor GitPOAP is rewarded to anyone that merges in a pull request to one of Taiko's GitHub repositories (for example: [2023 Taiko Contributor GitPOAP](https://www.gitpoap.io/gp/893)).
A Taiko Contributor GitPOAP is rewarded to anyone that merges in a pull request to one of Taiko's GitHub repositories (you can see which repositories here: [2023 Taiko Contributor GitPOAP](https://www.gitpoap.io/gp/893)).

After your pull request is merged, a bot will automatically leave a comment with instructions to receive your GitPOAP. You only receive a Taiko Contributor GitPOAP for the first pull request you merge in a given year.

Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ require (
gorm.io/datatypes v1.0.7
gorm.io/driver/mysql v1.4.3
gorm.io/gorm v1.24.6
gotest.tools v2.2.0+incompatible
)

require (
Expand Down Expand Up @@ -57,6 +58,7 @@ require (
github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-containerregistry v0.5.1/go.mod h1:Ct15B4yir3PLOP5jsy0GNeYVaIZs/MK/Jz5any1wFW0=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "taiko-mono",
"version": "0.9.0",
"version": "0.10.0",
"private": true,
"scripts": {
"prepare": "husky install"
Expand Down
1 change: 0 additions & 1 deletion packages/bridge-ui/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ module.exports = {
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/unbound-method': 'off',
'jest/unbound-method': 'error',
},
},
],
Expand Down
19 changes: 19 additions & 0 deletions packages/bridge-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## [0.5.0](https://github.com/taikoxyz/taiko-mono/compare/bridge-ui-v0.4.0...bridge-ui-v0.5.0) (2023-04-08)


### Features

* **bridge-ui:** more informative processing fee ([#13488](https://github.com/taikoxyz/taiko-mono/issues/13488)) ([f5f7b7e](https://github.com/taikoxyz/taiko-mono/commit/f5f7b7ee2a99ec940a73e263fb12e9378d139734))


### Bug Fixes

* **bridge-ui:** fix issue with claim notice modal ([#13507](https://github.com/taikoxyz/taiko-mono/issues/13507)) ([a3e38fa](https://github.com/taikoxyz/taiko-mono/commit/a3e38faff37f01669e6be6878d35431cb24e40bb))
* **bridge-ui:** fix relayer ([#13548](https://github.com/taikoxyz/taiko-mono/issues/13548)) ([5f60fd7](https://github.com/taikoxyz/taiko-mono/commit/5f60fd711c71ead82c7c147b4ff8dd12eab02c43))
* **bridge-ui:** improve notice modal ([#13530](https://github.com/taikoxyz/taiko-mono/issues/13530)) ([3944ca8](https://github.com/taikoxyz/taiko-mono/commit/3944ca8bc5282c2ab0c4b11b2bb1b5f102329d59))
* **bridge-ui:** NETWORK_ERROR exception ([#13562](https://github.com/taikoxyz/taiko-mono/issues/13562)) ([a779cdb](https://github.com/taikoxyz/taiko-mono/commit/a779cdb3433ea6cc2e0d203cecebde3d9c121f5a))
* **bridge-ui:** only request connect if require ([#13519](https://github.com/taikoxyz/taiko-mono/issues/13519)) ([92e9032](https://github.com/taikoxyz/taiko-mono/commit/92e9032e88fb997db5e9e9801089671604f0a9bc))
* **bridge-ui:** Typos in Update ProcessingFee.svelte ([#13518](https://github.com/taikoxyz/taiko-mono/issues/13518)) ([8edd302](https://github.com/taikoxyz/taiko-mono/commit/8edd302fc2ea0764c3fb96bbcc2454f154556167))
* **bridge-ui:** URL change won't update activeTab ([#13485](https://github.com/taikoxyz/taiko-mono/issues/13485)) ([884e782](https://github.com/taikoxyz/taiko-mono/commit/884e78283d8f98f20b15ff7e3e5e371df30fcd13))
* **repo:** fix multiple typos ([#13558](https://github.com/taikoxyz/taiko-mono/issues/13558)) ([f54242a](https://github.com/taikoxyz/taiko-mono/commit/f54242aa95e5c5563f8f0a7f9af0a1eab20ab67b))

## [0.4.0](https://github.com/taikoxyz/taiko-mono/compare/bridge-ui-v0.3.0...bridge-ui-v0.4.0) (2023-03-29)


Expand Down
8 changes: 4 additions & 4 deletions packages/bridge-ui/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ export default {
],
coverageThreshold: {
global: {
statements: 92,
branches: 72,
functions: 88,
lines: 92,
statements: 95,
branches: 85, // TODO: increase to 90
functions: 93,
lines: 95,
},
},
modulePathIgnorePatterns: ['<rootDir>/public/build/'],
Expand Down
2 changes: 1 addition & 1 deletion packages/bridge-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@taiko/bridge-ui",
"version": "0.4.0",
"version": "0.5.0",
"private": true,
"type": "module",
"scripts": {
Expand Down
46 changes: 18 additions & 28 deletions packages/bridge-ui/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
import { MetaMaskConnector } from '@wagmi/core/connectors/metaMask';
import { setupI18n } from './i18n';
import {
pendingTransactions,
transactioner,
transactions,
} from './store/transactions';
import { transactioner, transactions } from './store/transactions';
import Navbar from './components/Navbar.svelte';
import Toast, { successToast } from './components/Toast.svelte';
import { signer } from './store/signer';
Expand All @@ -29,8 +25,16 @@
import { CustomTokenService } from './storage/CustomTokenService';
import { userTokens, tokenService } from './store/userToken';
import { RelayerAPIService } from './relayer-api/RelayerAPIService';
import type { RelayerAPI } from './domain/relayerApi';
import { relayerApi, relayerBlockInfoMap } from './store/relayerApi';
import {
DEFAULT_PAGE,
MAX_PAGE_SIZE,
type RelayerAPI,
} from './domain/relayerApi';
import {
paginationInfo,
relayerApi,
relayerBlockInfoMap,
} from './store/relayerApi';
import { chains, mainnetWagmiChain, taikoWagmiChain } from './chain/chains';
import { providers } from './provider/providers';
import { RELAYER_URL } from './constants/envVars';
Expand Down Expand Up @@ -91,9 +95,13 @@
if (store) {
const userAddress = await store.getAddress();
const apiTxs = await $relayerApi.getAllBridgeTransactionByAddress(
userAddress,
);
const { txs: apiTxs, paginationInfo: info } =
await $relayerApi.getAllBridgeTransactionByAddress(userAddress, {
page: DEFAULT_PAGE,
size: MAX_PAGE_SIZE,
});
paginationInfo.set(info);
const blockInfoMap = await $relayerApi.getBlockInfo();
relayerBlockInfoMap.set(blockInfoMap);
Expand All @@ -118,24 +126,6 @@
}
});
pendingTransactions.subscribe((store) => {
(async () => {
const confirmedPendingTxIndex = await Promise.race(
store.map((tx, index) => {
return new Promise<number>((resolve) => {
$signer.provider
.waitForTransaction(tx.hash, 1)
.then(() => resolve(index));
});
}),
);
successToast('Transaction completed!');
let s = store;
s.splice(confirmedPendingTxIndex, 1);
pendingTransactions.set(s);
})();
});
const transactionToIntervalMap = new Map();
transactions.subscribe((store) => {
Expand Down
93 changes: 93 additions & 0 deletions packages/bridge-ui/src/components/Pagination.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<script lang="ts">
export let totalPages: number;
export let page: number;
const DISABLED_BUTTON_LABEL = '...';
function getPageButtons(pages: number) {
if (pages <= 5) {
return new Array(pages).fill(0).map((_, index) => ({
label: index + 1,
onClick: () => (page = index + 1),
value: index + 1,
}));
} else {
return [
{
label: 1,
onClick: () => (page = 1),
value: 1,
},
{
label: 2,
onClick: () => (page = 2),
value: 2,
},
{
label: DISABLED_BUTTON_LABEL,
onClick: () => {
// do nothing
},
},
{
label: pages - 1,
onClick: () => (page = pages - 2),
value: pages - 1,
},
{
label: pages,
onClick: () => (page = pages - 1),
value: pages,
},
];
}
}
function makeButtons(pages) {
return [
{
label: '<<',
onClick: () => (page = 1),
},
{
label: '<',
onClick: () => {
if (page > 1) {
page -= 1;
}
},
},
...getPageButtons(pages),
{
label: '>',
onClick: () => {
if (page < totalPages) {
page += 1;
}
},
},
{
label: '>>',
onClick: () => (page = pages),
},
];
}
$: buttons = makeButtons(totalPages);
</script>

<div class="btn-group pagination justify-center mt-4">
{#each buttons as button}
<button
class={`btn btn-xs md:btn-md ${
button.value === page ? 'btn-active text-white' : ''
} ${button.label === DISABLED_BUTTON_LABEL ? 'btn-disabled' : ''}`}
on:click={button.onClick}>{button.label}</button>
{/each}
</div>

<style>
.pagination .btn-active {
color: white;
background-color: hsla(var(--af) / var(--tw-bg-opacity, 1));
}
</style>
21 changes: 11 additions & 10 deletions packages/bridge-ui/src/components/Transactions/Transaction.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,16 @@
srcBridgeAddress: chains[bridgeTx.fromChainId].bridgeAddress,
});
pendingTransactions.update((store) => {
store.push(tx);
return store;
});
successToast($_('toast.transactionSent'));
await pendingTransactions.add(tx, $signer);
// TODO: keep the MessageStatus as contract and use another way.
transaction.status = MessageStatus.ClaimInProgress;
successToast('Transaction completed!');
} catch (e) {
// TODO: handle potential transaction failure
console.error(e);
errorToast($_('toast.errorSendingTransaction'));
} finally {
Expand Down Expand Up @@ -153,13 +154,13 @@
srcTokenVaultAddress: tokenVaults[bridgeTx.fromChainId],
});
pendingTransactions.update((store) => {
store.push(tx);
return store;
});
successToast($_('toast.transactionSent'));
pendingTransactions.add(tx, $signer);
successToast('Transaction completed!');
} catch (e) {
// TODO: handle potential transaction failure
console.error(e);
errorToast($_('toast.errorSendingTransaction'));
} finally {
Expand Down
Loading

0 comments on commit 7f84e77

Please sign in to comment.