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

[TAS-182] Feat/web3 #21

Merged
merged 20 commits into from
Aug 29, 2023
Merged

[TAS-182] Feat/web3 #21

merged 20 commits into from
Aug 29, 2023

Conversation

toniocodo
Copy link
Collaborator

  • Proposal of restructure of lib folders per page/feature: libs/defi/oeth/src/components/Swap becomes /libs/oeth/swap
  • Add app level client contexts for wagmi, rainbowkit and react-query
  • Add web3 connection feature, Connect Button and AccountModal still WIP🚧
  • Add contracts lib for exposing tokens and contracts in a wagmi friendly format
  • Add base inputs components for bigint and tokens structure, styling still WIP 🚧
  • Add connected modal tokens selection
  • Add state for swap, connect base components
  • Add utils and misc helpers

- add wagmi, viem, rainbowKit
- add providers lib for wagmi context
- add .env for wallet connect project id, add to gitignore
- update eslint imports rule
- add browserlistrc for bigint support
- add providers for wagmi connected and prices
- add generic inputs WIP🚧
- integration in Swap module
- add token icons
- add infura key env
- eslint fix
@toniocodo toniocodo requested review from smitch88 and dcodes05 August 28, 2023 21:20
@toniocodo toniocodo self-assigned this Aug 28, 2023
@github-actions
Copy link

github-actions bot commented Aug 28, 2023

Messages
📖 ✅ task id: TAS-182

Generated by 🚫 dangerJS against 190806f

@toniocodo toniocodo changed the title Feat/web3 [TAS-182] Feat/web3 Aug 28, 2023
@notion-workspace
Copy link

Add web3 integration

toniocodo and others added 7 commits August 29, 2023 09:06
- add theme module override
- inject theme declarations in libs/app
- update sx props to use mui theme
- remove typescript strict
@toniocodo toniocodo marked this pull request as ready for review August 29, 2023 13:27
@@ -0,0 +1,108 @@
import { formatUnits, parseUnits } from 'viem';
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice utility lib

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm still not sure if we should use it... I think this kind of abstraction would root deeply in the code base and might not be sustainable... Anyway, I'll leave it there for now, it's not used anywhere, let's see if we want to keep it or not

import type { Token } from '@origin/shared/contracts';

export const { Provider: SwapProvider, useTracked: useSwapState } =
createContainer(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is interesting, never used react-tracked but I like the interface

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

very cool library made by the creator of Zustand, Jotai and Valtio. Super clean and lean api, just a small wrapper around context api that provides proxy support. It allows for granular re-renders of children of context providers and this kind of pattern for "subscribing" to state changes.

import { useState } from 'react';

import { SwapCard } from '@origin/shared/components';
import random from 'lodash/random';
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we switching to ramda still?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will, but not in this PR. I'll update right after

if (onChange && num !== value) {
onChange(num);
}
} catch {}
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need to do anything on error state?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, this is something to discuss with Matt, I used to change color to palette.error.main but it could also be the focus frame... anyway, it's there for now, to be refined

@@ -57,7 +58,7 @@ export function ConnectedButton({
height: (theme) => theme.spacing(3),
}}
/>
<UserId userId={userId} />
<MiddleTruncated>{userId}</MiddleTruncated>
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a component or just a function that acts on string?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it needs to be a component because you don't know in advance where the ellipsis will happen. This component allows for having a "resizable" label that always keep the end digits visible

Copy link
Contributor

@smitch88 smitch88 left a comment

Choose a reason for hiding this comment

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

Minor nitpick things but overall LGTM, will approve as most comments are just suggestions that can also be revisited later.

@toniocodo toniocodo merged commit 4290245 into main Aug 29, 2023
2 checks passed
@toniocodo toniocodo deleted the feat/web3 branch August 29, 2023 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants