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(tangle-dapp): Bridge revamp & Router integration #2677

Closed
wants to merge 13 commits into from

Conversation

devpavan04
Copy link
Member

@devpavan04 devpavan04 commented Nov 28, 2024

Summary of changes

  • Bridge revamp & Router integration

Proposed area of change

  • apps/tangle-dapp
  • apps/tangle-cloud
  • libs/tangle-shared-ui
  • libs/webb-ui-components

Associated issue(s)

Screenshots

CleanShot 2024-12-11 at 10 47 09

CleanShot 2024-12-11 at 10 47 34

CleanShot 2024-12-11 at 10 48 08

CleanShot 2024-12-11 at 10 46 25

CleanShot 2024-12-11 at 10 50 16

Screen Recording

CleanShot.2024-12-11.at.10.38.29.mp4

@devpavan04 devpavan04 self-assigned this Nov 28, 2024
@devpavan04 devpavan04 marked this pull request as draft November 28, 2024 11:58
Copy link

netlify bot commented Nov 28, 2024

Deploy Preview for tangle-dapp ready!

Name Link
🔨 Latest commit f5a208f
🔍 Latest deploy log https://app.netlify.com/sites/tangle-dapp/deploys/675a4dbb34f3850008201c4b
😎 Deploy Preview https://deploy-preview-2677--tangle-dapp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Nov 28, 2024

Deploy Preview for tangle-cloud ready!

Name Link
🔨 Latest commit f5a208f
🔍 Latest deploy log https://app.netlify.com/sites/tangle-cloud/deploys/675a4dbb7e2f8200089ba9e5
😎 Deploy Preview https://deploy-preview-2677--tangle-cloud.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@devpavan04 devpavan04 added the wip 🚧 Work in-progress label Nov 28, 2024
@devpavan04 devpavan04 added tangle-dapp and removed wip 🚧 Work in-progress labels Dec 11, 2024
@devpavan04 devpavan04 marked this pull request as ready for review December 11, 2024 19:15
tokenType: EVMTokenEnum;
bridgeType: EVMTokenBridgeEnum;
address: AddressType;
abi: any;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have a type for ABI: Abi from viem. Should avoid using any type whenever possible to reduce future logic bugs

@@ -81,7 +82,9 @@ export type LocalStorageValueOf<T extends LocalStorageKey> =
? LiquidStakingTableData
: T extends LocalStorageKey.ONBOARDING_MODALS_SEEN
? OnboardingPageKey[]
: never;
: T extends LocalStorageKey.EVM_TOKEN_BALANCES
? Record<string, any>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a concrete structure for the EVM token balances? Should avoid using any as much as possible

Comment on lines +43 to +45
{/* <head>
<script src="https://unpkg.com/react-scan/dist/auto.global.js" async />
</head> */}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you tell me more about this and why it was removed/commented out?

Comment on lines +113 to +114
sourceAmount: sendingAmount?.toString() ?? '',
destinationAmount: receivingAmount?.toString() ?? '',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should avoid defaulting to empty strings to circumvent the type system, this will lead to logic bugs. Instead I think it may be better to handle the undefined case directly

Comment on lines +139 to +142
notificationApi({
message: 'Transfer failed',
variant: 'error',
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better if the toast shows the error message as a description/secondary message, otherwise the user will be forced to look on the console to debug the issue

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the ensureError utility function to convert the unknown error into Error type then get its .message

/>

<div className="flex flex-col gap-1">
<Typography
variant="h5"
fw="bold"
className="block cursor-default text-mono-200 dark:text-mono-0"
className="cursor-default text-mono-200 dark:text-mono-0 flex items-center gap-1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why flex and gap here? Is asset.symbol composed of various parts or components?

Comment on lines +356 to +359
const actionButtonLoadingText = useMemo(
() => (isRouterQuoteLoading ? 'Fetching bridge fee...' : ''),
[isRouterQuoteLoading],
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No useMemo required here 👍🏼

Comment on lines +351 to +354
const actionButtonIsLoading = useMemo(
() => isRouterQuoteLoading,
[isRouterQuoteLoading],
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No useMemo required here 👍🏼

Comment on lines +266 to +271
const tokenExplorerUrl = makeExplorerUrl(
selectedChainExplorerUrl?.url ?? '',
token.address,
'address',
'web3',
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this call work as intended with an empty string for the first argument?

@devpavan04 devpavan04 marked this pull request as draft December 12, 2024 06:40
@devpavan04
Copy link
Member Author

New PR here - #2698

@devpavan04 devpavan04 closed this Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK] Integrate Router Bridge
3 participants