From 6c6089e75e3bb418bced2f230d481580971929e3 Mon Sep 17 00:00:00 2001 From: Francisco Ramos Date: Wed, 26 Jul 2023 14:38:47 +0200 Subject: [PATCH] feat(bridge-ui-v2): Claim & Release (#14267) --- packages/bridge-ui-v2/src/app.config.ts | 18 +-- .../src/components/Bridge/Actions.svelte | 2 +- .../src/components/Bridge/AddressInput.svelte | 6 +- .../src/components/Bridge/NFTBridge.svelte | 4 +- .../src/components/Bridge/NFTIdInput.svelte | 3 +- .../src/components/Bridge/Recipient.svelte | 2 +- .../ChainSelector/ChainSelector.svelte | 4 +- .../bridge-ui-v2/src/libs/bridge/Bridge.ts | 115 ++++++++++++++++++ .../src/libs/bridge/ERC1155Bridge.ts | 14 ++- .../src/libs/bridge/ERC20Bridge.ts | 86 ++++++++++++- .../src/libs/bridge/ERC721Bridge.ts | 14 ++- .../bridge-ui-v2/src/libs/bridge/ETHBridge.ts | 75 +++++++++++- .../bridge-ui-v2/src/libs/bridge/bridges.ts | 13 +- .../src/libs/bridge/estimateCostOfBridging.ts | 3 +- .../bridge-ui-v2/src/libs/bridge/types.ts | 20 ++- .../bridge-ui-v2/src/libs/error/errors.ts | 20 +++ .../src/libs/proof/BridgeProver.ts | 80 ++++++++++++ .../bridge-ui-v2/src/libs/proof/Prover.ts | 73 +++++++++++ packages/bridge-ui-v2/src/libs/proof/index.ts | 2 + packages/bridge-ui-v2/src/libs/proof/types.ts | 37 ++++++ .../src/libs/token/detectContractType.ts | 11 +- packages/bridge-ui-v2/src/stores/nfts.ts | 4 +- 22 files changed, 555 insertions(+), 51 deletions(-) create mode 100644 packages/bridge-ui-v2/src/libs/bridge/Bridge.ts create mode 100644 packages/bridge-ui-v2/src/libs/proof/BridgeProver.ts create mode 100644 packages/bridge-ui-v2/src/libs/proof/Prover.ts create mode 100644 packages/bridge-ui-v2/src/libs/proof/index.ts create mode 100644 packages/bridge-ui-v2/src/libs/proof/types.ts diff --git a/packages/bridge-ui-v2/src/app.config.ts b/packages/bridge-ui-v2/src/app.config.ts index 64e9bd3fb03..3cd6c95a50c 100644 --- a/packages/bridge-ui-v2/src/app.config.ts +++ b/packages/bridge-ui-v2/src/app.config.ts @@ -1,19 +1,21 @@ export const recommentProcessingFee = { - ethGasLimit: BigInt(900000), - erc20NotDeployedGasLimit: BigInt(3100000), - erc20DeployedGasLimit: BigInt(1100000), + ethGasLimit: BigInt(900_000), + erc20NotDeployedGasLimit: BigInt(3_100_000), + erc20DeployedGasLimit: BigInt(1_100_000), }; export const processingFeeComponent = { closingDelayOptionClick: 300, - intervalComputeRecommendedFee: 20000, + intervalComputeRecommendedFee: 20_000, }; -export const bridge = { - noOwnerGasLimit: BigInt(140000), - noTokenDeployedGasLimit: BigInt(3000000), +export const bridgeService = { + noOwnerGasLimit: BigInt(140_000), + noTokenDeployedGasLimit: BigInt(3_000_000), + erc20GasLimitThreshold: BigInt(2_500_000), + unpredictableGasLimit: BigInt(1_000_000), }; export const pendingTransaction = { - waitTimeout: 300000, + waitTimeout: 300_000, }; diff --git a/packages/bridge-ui-v2/src/components/Bridge/Actions.svelte b/packages/bridge-ui-v2/src/components/Bridge/Actions.svelte index a815a4cb17b..5a59a5300c4 100644 --- a/packages/bridge-ui-v2/src/components/Bridge/Actions.svelte +++ b/packages/bridge-ui-v2/src/components/Bridge/Actions.svelte @@ -56,7 +56,7 @@ $: disableBridge = canDoNothing || $insufficientAllowance || $insufficientBalance || bridging; // General loading state - $: loading = approving || bridging; + // $: loading = approving || bridging;
diff --git a/packages/bridge-ui-v2/src/components/Bridge/AddressInput.svelte b/packages/bridge-ui-v2/src/components/Bridge/AddressInput.svelte index 0e940331f1c..2212f985edb 100644 --- a/packages/bridge-ui-v2/src/components/Bridge/AddressInput.svelte +++ b/packages/bridge-ui-v2/src/components/Bridge/AddressInput.svelte @@ -1,10 +1,9 @@