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: Add support for Keplr #938

Merged
merged 2 commits into from
Aug 26, 2024
Merged

feat: Add support for Keplr #938

merged 2 commits into from
Aug 26, 2024

Conversation

rosepuppy
Copy link
Contributor

@rosepuppy rosepuppy commented Aug 20, 2024

Branched off: #449

Add support for Keplr

With fixes and additional changes on top:

  • We decided to simplify the deposit workflow and removed CosmosDepositDialog
  • Fixed deposit flow to check for balance before sending the depositToSubaccount, and send the amount based on balance.
  • Fixed deposit max to account for fees
  • Add Keplr compliance signature signing and store it to local storage to avoid approval on every refresh
  • Fix for auto-connect when Keplr is connected
  • localization to be added

Views

  • New: <ViewComponentName>

  • <ViewComponentName>

    • New: ``
    • Rename:

Components

  • New: <ComponentName>

  • <ComponentName>

    • New: ``
    • Rename:

Styles/Mixins

  • styles/_____
    • New: ``
    • Rename:

Constants/Types

  • constants/_____

Functions

  • lib/_____

Hooks

  • hooks/_____

State

  • state/_____

Packages

  • package-name
    • updated: v__ -> v__

Workflows

  • workflow-name.yml

@rosepuppy rosepuppy requested a review from a team as a code owner August 20, 2024 21:18
Copy link

vercel bot commented Aug 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
v4-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 26, 2024 8:56pm
v4-testnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 26, 2024 8:56pm

@@ -0,0 +1,9 @@
import { isMainnet } from './networks';

export const OSMO_USDC_IBC_DENOM = isMainnet
Copy link
Contributor

Choose a reason for hiding this comment

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

[suggestion] i think right now we have a tokens property in the v1/env config where we define the dydx usdc ibc denom. would probably be worth adding into there in case we need it in other places later?

multiChain: true,
});

const cosmosAddress = useMemo(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

consider moving this to useAccounts

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I see that this requires a chainId to get the desired bech32. I think this does complicate whether we move it to useAccounts. Maybe we only move the grazAccounts hook and rename this to selectedChainAddress instead of cosmosAddress

@@ -412,6 +412,13 @@ const useDydxClientContext = () => {
return compositeClient?.validatorClient.get.getAllValidators();
}, [compositeClient]);

const getAccountBalance = useCallback(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Revisit if I can use the abacus account balance

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also consider renaming this

Comment on lines 97 to 108
const { data: accounts } = useAccountGraz({
chainId: SUPPORTED_COSMOS_CHAINS,
multiChain: true,
});

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should also be moved to the useAccounts hook with cosmosAddress below

src/lib/graz.ts Outdated Show resolved Hide resolved
@@ -473,6 +673,9 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => {
if (depositStep === DepositSteps.Confirm) {
return stringGetter({ key: STRING_KEYS.PENDING_DEPOSIT_CONFIRMATION });
}
if (depositStep === DepositSteps.KEPLR_APPROVAL) {
return 'Pending approval in wallet';
Copy link
Contributor

Choose a reason for hiding this comment

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

todo: for localization

@rosepuppy rosepuppy merged commit 9164232 into main Aug 26, 2024
8 checks passed
@rosepuppy rosepuppy deleted the keplr-alt branch August 26, 2024 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants