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

(Deposit/Withdrawal) Fetch Bridge Provider Quote #3402

Merged
merged 40 commits into from
Jul 1, 2024

Conversation

JoseRFelix
Copy link
Collaborator

@JoseRFelix JoseRFelix commented Jun 24, 2024

What is the purpose of the change:

Linear Task

Linear Task URL

Copy link

vercel bot commented Jun 24, 2024

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

Name Status Preview Comments Updated (UTC)
osmosis-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 1, 2024 5:41pm
4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
osmosis-frontend-datadog ⬜️ Ignored (Inspect) Visit Preview Jul 1, 2024 5:41pm
osmosis-frontend-dev ⬜️ Ignored (Inspect) Visit Preview Jul 1, 2024 5:41pm
osmosis-frontend-edgenet ⬜️ Ignored (Inspect) Jul 1, 2024 5:41pm
osmosis-testnet ⬜️ Ignored (Inspect) Visit Preview Jul 1, 2024 5:41pm

Copy link
Member

@jonator jonator left a comment

Choose a reason for hiding this comment

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

Some initial thoughts, have not done a thorough deep-dive

address: asset.coinMinimalDenom,
decimals: asset.coinDecimals,
denom: asset.coinDenom,
sourceDenom: asset.sourceDenom,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe update from stage, as I removed sourceDenom

Copy link
Member

Choose a reason for hiding this comment

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

Reminder to run translations

>;
}, [successfulQueries]);

console.log(supportedAssetsByChainId);
Copy link
Member

Choose a reason for hiding this comment

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

Stray log

chain: BridgeChain;
}) => {
const supportedAssetsResults = api.useQueries((t) =>
bridgeKeys.flatMap((bridge) =>
Copy link
Member

Choose a reason for hiding this comment

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

Why the flatMap?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

useQueries requires a single dimension array, so we have to use flatMap to reduce the array


console.log(supportedAssetsByChainId);

const supportedChains = useMemo(() => {
Copy link
Member

Choose a reason for hiding this comment

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

Thoughts on extracting chains from supportedAssetsByChainId instead? The data already has some processing.

Also, we could return that as a tuple from that single useMemo

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 separated them to maintain separation of concerns. I want to avoid complicating supportedAssetsByChainId too much by adding a tuple

Copy link
Member

@jonator jonator left a comment

Choose a reason for hiding this comment

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

Another review

import { SourceChain } from "../chain";
import { EthereumChainInfo } from "../ethereum";
import { AxelarSourceChain, EthereumChainInfo } from "@osmosis-labs/utils";

import { BridgeEnvironment } from "../interface";

export type SourceChainTokenConfig = {
Copy link
Member

Choose a reason for hiding this comment

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

Let's add @deprecated here as we don't need it after we commit to new d/w flow

I thought I did this in a prev PR

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 see that it has been added after merging with stage

packages/utils/src/ethereum.ts Show resolved Hide resolved
bridgeChainSchema.and(bridgeAssetSchema).and(
z.object({
supportedVariants: z.array(z.string()),
supportedProviders: z.array(
Copy link
Member

Choose a reason for hiding this comment

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

I don't see this being used for EVM or Cosmos

import { z } from "zod";

export const localBridgeTransferRouter = createTRPCRouter({
getSupportedAssetsBalances: publicProcedure
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we fetch assets balances for both EVM and Cosmos?

If we don't want to for some reason, I think it'd be simpler to have a 2 separate procedures for EVM & Cosmos

Comment on lines +197 to +206
const bridgeProviders = new BridgeProviders(
process.env.NEXT_PUBLIC_SQUID_INTEGRATOR_ID!,
{
...ctx,
env: IS_TESTNET ? "testnet" : "mainnet",
cache: lruCache,
getTimeoutHeight: ({ destinationAddress }) =>
getTimeoutHeight({ ...ctx, destinationAddress }),
}
);
Copy link
Member

Choose a reason for hiding this comment

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

I've been thinking if we can remove some repeated code by creating a global var with BridgeProviders object. Then we'll pass in the same cache anyways

packages/web/components/bridge/immersive/amount-screen.tsx Outdated Show resolved Hide resolved
const {
price: assetInOsmosisPrice,
isLoading: isLoadingCanonicalAssetPrice,
} = usePrice(
Copy link
Member

Choose a reason for hiding this comment

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

Note, maybe we can also extend usePrice to accept chainID + asset address and it can check the counterparty array. May get more prices from Osmosis that way

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For now, I'll follow your advice and use a representative asset (canonical asset) as the price ID. This simplifies the flow considerably, and it's unlikely that a variant will have a different price

@jonator
Copy link
Member

jonator commented Jun 27, 2024

BTW build is failing with several build errors

@JoseRFelix JoseRFelix changed the title Jose/fe-575-fetch-bridge-providers-quote (Deposit/Withdrawal) Fetch Bridge Provider Quote Jul 1, 2024
@JoseRFelix JoseRFelix requested a review from jonator July 1, 2024 17:33
@vercel vercel bot temporarily deployed to prod_swap_test July 1, 2024 17:41 Inactive
@JoseRFelix JoseRFelix marked this pull request as ready for review July 1, 2024 17:42
Copy link
Contributor

coderabbitai bot commented Jul 1, 2024

Walkthrough

The updates encompass several key adjustments, including modifying import sources for various constants and types, renaming parameters for clarity, enhancing UI components, and adding new functionalities. A notable change is the migration of certain imports from internal paths to the @osmosis-labs/utils package. Additionally, several new TypeScript interfaces and React components were introduced for smoother wallet and transaction management within the bridge application. Updates to schemas and sort logic also ensure improved data handling and validation.

Changes

File(s) Change Summary
packages/bridge/src/axelar/__tests__/axelar-bridge-provider.spec.ts, packages/bridge/src/axelar/index.ts, packages/bridge/src/axelar/tokens.ts, packages/bridge/src/skip/index.ts, packages/bridge/src/squid/index.ts Changed import sources for NativeEVMTokenConstantAddress, EthereumChainInfo, and AxelarSourceChain from internal paths to @osmosis-labs/utils.
packages/bridge/src/index.ts Removed directive for exporting all from "./chain".
packages/bridge/src/interface.ts Converted certain schemas and interfaces to be exported with updates to the schema for bridgeChainSchema.
packages/server/src/queries/complex/assets/__tests__/assets.spec.ts, packages/server/src/queries/complex/assets/ethereum.ts Added and updated import sources in test scripts and introduced the new getEvmBalance function.
packages/trpc/src/assets.ts, packages/web/hooks/evm-wallet.ts Renamed userOsmoAddress to userCosmosAddress in function parameters for clarity across various scripts.
packages/types/src/chain-types.ts Added a new optional logoURIs field with different format properties in the Chain interface.
packages/web/__tests__/index-page.spec.tsx, packages/web/config/generate-lists.ts, packages/web/pages/test-bridge.tsx Adjusted test scripts by adding mocks and handling updated import paths, refining Next.js page components. Scripts now include enhanced logging and debugging capabilities.
packages/web/components/bridge/immersive/amount-and-confirmation-screen.tsx Added a new React component AmountAndConfirmationScreen for managing bridge transaction confirmations.
packages/web/components/bridge/immersive/amount-screen.tsx, packages/web/components/bridge/immersive/bridge-network-select-modal.tsx Refactored components with additional properties and state management for improved user interaction, added WalletDisplay, TransferDetailRow, and ChainSelectorButton components.
packages/web/components/bridge/immersive/asset-select-screen.tsx Updated the structure of JSX elements within AssetSelectScreen component by changing loading spinner container from a fragment to a div element.
packages/web/components/bridge/immersive/bridge-provider-dropdown.tsx Introduced the new BridgeProviderDropdown component to allow selection of bridge providers.
packages/web/components/bridge/immersive/bridge-quote-remaining-time.tsx Added the new BridgeQuoteRemainingTime component to display remaining time for bridge transactions.
packages/web/components/bridge/immersive/bridge-wallet-select-modal.tsx Added new components BridgeWalletSelectModal, BridgeWalletSelectScreen, and WalletButton for managing wallet selection in bridge transactions.
packages/web/components/bridge/immersive/immersive-bridge.tsx Updated AmountScreen component to AmountAndConfirmationScreen and exported ImmersiveBridgeScreens enum.

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ad35972 and 1f01db5.

Files ignored due to path filters (23)
  • packages/bridge/package.json is excluded by !**/*.json
  • packages/server/package.json is excluded by !**/*.json
  • packages/utils/package.json is excluded by !**/*.json
  • packages/web/localizations/de.json is excluded by !**/*.json
  • packages/web/localizations/en.json is excluded by !**/*.json
  • packages/web/localizations/es.json is excluded by !**/*.json
  • packages/web/localizations/fa.json is excluded by !**/*.json
  • packages/web/localizations/fr.json is excluded by !**/*.json
  • packages/web/localizations/gu.json is excluded by !**/*.json
  • packages/web/localizations/hi.json is excluded by !**/*.json
  • packages/web/localizations/ja.json is excluded by !**/*.json
  • packages/web/localizations/ko.json is excluded by !**/*.json
  • packages/web/localizations/pl.json is excluded by !**/*.json
  • packages/web/localizations/pt-br.json is excluded by !**/*.json
  • packages/web/localizations/ro.json is excluded by !**/*.json
  • packages/web/localizations/ru.json is excluded by !**/*.json
  • packages/web/localizations/tr.json is excluded by !**/*.json
  • packages/web/localizations/zh-cn.json is excluded by !**/*.json
  • packages/web/localizations/zh-hk.json is excluded by !**/*.json
  • packages/web/localizations/zh-tw.json is excluded by !**/*.json
  • packages/web/package.json is excluded by !**/*.json
  • packages/web/public/icons/sprite.svg is excluded by !**/*.svg, !**/*.svg
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock, !**/*.lock
Files selected for processing (57)
  • packages/bridge/src/axelar/tests/axelar-bridge-provider.spec.ts (1 hunks)
  • packages/bridge/src/axelar/index.ts (2 hunks)
  • packages/bridge/src/axelar/tokens.ts (1 hunks)
  • packages/bridge/src/index.ts (1 hunks)
  • packages/bridge/src/interface.ts (3 hunks)
  • packages/bridge/src/skip/index.ts (4 hunks)
  • packages/bridge/src/squid/index.ts (2 hunks)
  • packages/server/src/queries/complex/assets/tests/assets.spec.ts (2 hunks)
  • packages/server/src/queries/complex/assets/ethereum.ts (1 hunks)
  • packages/server/src/queries/complex/assets/index.ts (2 hunks)
  • packages/server/src/queries/complex/assets/user.ts (3 hunks)
  • packages/trpc/src/assets.ts (6 hunks)
  • packages/trpc/src/chains.ts (2 hunks)
  • packages/trpc/src/parameter-types.ts (1 hunks)
  • packages/types/src/chain-types.ts (1 hunks)
  • packages/utils/src/ethereum.ts (3 hunks)
  • packages/utils/src/index.ts (1 hunks)
  • packages/web/tests/index-page.spec.tsx (2 hunks)
  • packages/web/components/bridge/immersive/amount-and-confirmation-screen.tsx (1 hunks)
  • packages/web/components/bridge/immersive/amount-screen.tsx (10 hunks)
  • packages/web/components/bridge/immersive/asset-select-screen.tsx (1 hunks)
  • packages/web/components/bridge/immersive/bridge-network-select-modal.tsx (1 hunks)
  • packages/web/components/bridge/immersive/bridge-provider-dropdown.tsx (1 hunks)
  • packages/web/components/bridge/immersive/bridge-quote-remaining-time.tsx (1 hunks)
  • packages/web/components/bridge/immersive/bridge-wallet-select-modal.tsx (1 hunks)
  • packages/web/components/bridge/immersive/immersive-bridge.tsx (4 hunks)
  • packages/web/components/bridge/immersive/more-bridge-options.tsx (4 hunks)
  • packages/web/components/bridge/immersive/use-bridge-quote.ts (1 hunks)
  • packages/web/components/bridge/immersive/use-bridges-supported-assets.ts (1 hunks)
  • packages/web/components/buttons/icon-button.tsx (1 hunks)
  • packages/web/components/drawers/drawer.tsx (3 hunks)
  • packages/web/components/swap-tool/tests/swap-tool.spec.tsx (1 hunks)
  • packages/web/components/wallet-states/switching-network-state.tsx (1 hunks)
  • packages/web/config/generate-lists.ts (1 hunks)
  • packages/web/hooks/evm-wallet.ts (1 hunks)
  • packages/web/hooks/use-feature-flags.ts (1 hunks)
  • packages/web/integrations/axelar/transfer.tsx (2 hunks)
  • packages/web/integrations/axelar/types.ts (4 hunks)
  • packages/web/integrations/axelar/utils.ts (1 hunks)
  • packages/web/integrations/ethereum/types.ts (1 hunks)
  • packages/web/integrations/nomic/transfer.tsx (2 hunks)
  • packages/web/modals/bridge-transfer-v1.tsx (2 hunks)
  • packages/web/modals/bridge-transfer-v2.tsx (5 hunks)
  • packages/web/modals/select-asset-source.tsx (2 hunks)
  • packages/web/modals/transfer-asset-select.tsx (3 hunks)
  • packages/web/modals/wallet-select/cosmos-wallet-state.tsx (1 hunks)
  • packages/web/modals/wallet-select/evm-wallet-state.tsx (1 hunks)
  • packages/web/modals/wallet-select/full-wallet-list.tsx (1 hunks)
  • packages/web/modals/wallet-select/index.tsx (11 hunks)
  • packages/web/modals/wallet-select/simple-wallet-list.tsx (1 hunks)
  • packages/web/modals/wallet-select/use-connect-wallet.ts (1 hunks)
  • packages/web/modals/wallet-select/utils.ts (2 hunks)
  • packages/web/pages/test-bridge.tsx (1 hunks)
  • packages/web/server/api/local-router.ts (2 hunks)
  • packages/web/server/api/routers/bridge-transfer.ts (2 hunks)
  • packages/web/server/api/routers/local-bridge-transfer.ts (1 hunks)
  • packages/web/stores/assets/transfer-ui-config.ts (6 hunks)
Files not processed due to max files limit (1)
  • packages/web/utils/ethereum.ts
Files not reviewed due to errors (2)
  • packages/bridge/src/skip/index.ts (no review received)
  • packages/web/integrations/nomic/transfer.tsx (no review received)
Files skipped from review due to trivial changes (4)
  • packages/server/src/queries/complex/assets/tests/assets.spec.ts
  • packages/utils/src/index.ts
  • packages/web/integrations/axelar/transfer.tsx
  • packages/web/integrations/ethereum/types.ts
Additional context used
Biome
packages/web/components/bridge/immersive/bridge-quote-remaining-time.tsx

[error] 53-53: Alternative text title element cannot be empty

For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.

(lint/a11y/noSvgWithoutTitle)

packages/web/modals/wallet-select/simple-wallet-list.tsx

[error] 65-80: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

packages/web/components/drawers/drawer.tsx

[error] 116-119: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

(lint/a11y/useKeyWithClickEvents)

packages/web/components/bridge/immersive/bridge-provider-dropdown.tsx

[error] 87-96: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

packages/server/src/queries/complex/assets/index.ts

[error] 146-149: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)

packages/web/modals/transfer-asset-select.tsx

[error] 155-167: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

(lint/a11y/useKeyWithClickEvents)

packages/web/components/bridge/immersive/immersive-bridge.tsx

[error] 23-27: The enum declaration should not be const

Const enums are not supported by bundlers and are incompatible with the 'isolatedModules' mode. Their use can lead to import inexistent values.
See TypeScript Docs for more details.
Safe fix: Turn the const enum into a regular enum.

(lint/suspicious/noConstEnum)

packages/web/modals/wallet-select/full-wallet-list.tsx

[error] 122-140: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)


[error] 155-169: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

packages/web/components/bridge/immersive/bridge-network-select-modal.tsx

[error] 130-169: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

packages/web/components/bridge/immersive/asset-select-screen.tsx

[error] 72-72: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)


[error] 145-154: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

packages/server/src/queries/complex/assets/user.ts

[error] 126-126: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)


[error] 126-126: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)


[error] 127-127: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)


[error] 128-128: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)


[error] 137-137: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 138-144: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 143-143: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 136-136: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.

See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.

(lint/suspicious/noGlobalIsNan)


[error] 142-142: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.

See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.

(lint/suspicious/noGlobalIsNan)

packages/web/components/bridge/immersive/bridge-wallet-select-modal.tsx

[error] 254-262: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

(lint/a11y/useKeyWithClickEvents)


[error] 263-263: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

packages/web/modals/wallet-select/cosmos-wallet-state.tsx

[error] 145-145: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)

packages/web/config/generate-lists.ts

[error] 299-301: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)

packages/web/server/api/routers/bridge-transfer.ts

[error] 274-292: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)

packages/web/stores/assets/transfer-ui-config.ts

[error] 192-193: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/trpc/src/assets.ts

[error] 225-247: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 243-246: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)

packages/bridge/src/skip/index.ts

[error] 136-136: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)


[error] 581-581: Unnecessary continue statement

Unsafe fix: Delete the unnecessary continue statement

(lint/correctness/noUnnecessaryContinue)

packages/web/integrations/nomic/transfer.tsx

[error] 455-466: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

(lint/a11y/useKeyWithClickEvents)


[error] 31-31: Use the '**' operator instead of 'Math.pow'.

Unsafe fix: Use the '**' operator instead of 'Math.pow'.

(lint/style/useExponentiationOperator)


[error] 368-376: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)


[error] 439-439: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

packages/bridge/src/axelar/index.ts

[error] 423-425: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 456-466: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)

packages/web/components/bridge/immersive/use-bridge-quote.ts

[error] 596-596: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)

packages/web/modals/bridge-transfer-v2.tsx

[error] 1039-1039: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)

packages/web/components/bridge/immersive/amount-screen.tsx

[error] 616-621: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)


[error] 644-644: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)


[error] 683-693: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)


[error] 715-718: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)


[error] 863-870: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)


[error] 895-902: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)


[error] 1234-1239: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

Additional comments not posted (80)
packages/web/integrations/axelar/utils.ts (1)

1-1: Deprecation Warning: Add note for future removal or replacement.

The function waitByTransferFromSourceChain is marked as deprecated. Consider adding a note to indicate when it will be removed or what will replace it.

packages/web/hooks/evm-wallet.ts (1)

1-13: Consider Adding Usage Examples in Documentation.

The hooks imported from wagmi and exported here are correctly implemented. Consider adding usage examples in the documentation to assist developers in utilizing these hooks effectively.

packages/trpc/src/parameter-types.ts (2)

11-14: Ensure the userCosmosAddress format is validated.

The schema for UserCosmosAddress only checks for an optional string but doesn't validate its format. Consider adding a format validation if applicable.

Is there a specific format for userCosmosAddress that should be validated?


16-19: Good addition of UserEvmAddress schema.

The schema correctly checks for an optional string starting with "0x". This ensures that the address follows the expected format.

packages/web/server/api/local-router.ts (2)

10-10: Ensure the localBridgeTransferRouter is correctly implemented.

The import statement for localBridgeTransferRouter looks good. Verify that the implementation of localBridgeTransferRouter correctly handles all required routes and edge cases.

Ensure the localBridgeTransferRouter implementation is complete and tested.


21-21: Addition of bridgeTransfer route is correct.

The new route bridgeTransfer has been added to the localRouter. Ensure that this route is correctly handled in the localBridgeTransferRouter.

packages/web/components/buttons/icon-button.tsx (1)

13-14: Deprecation notice is clear.

The deprecation notice for the IconButton component is clear and provides guidance to use the iconButton within the ui folder.

packages/web/pages/test-bridge.tsx (3)

1-5: Ensure the imports are necessary and used.

The imports for NextPage, Image, NextSeo, and useMount look good. Verify that all these imports are necessary and used within the component.

Ensure all imported modules are used within the TestBridge component.


9-18: Ensure the bridgeAsset function is correctly implemented.

The useMount hook is used to call the bridgeAsset function with specific parameters. Verify that the bridgeAsset function handles these parameters correctly and performs the expected actions.

Ensure the bridgeAsset function is correctly implemented and handles the parameters as expected.


20-34: UI rendering looks good.

The component renders a full-screen div with a warning icon and a title. The usage of NextSeo for SEO purposes and Image for the warning icon is appropriate.

packages/server/src/queries/complex/assets/ethereum.ts (2)

1-4: Import statement looks good.

The import statement correctly imports necessary modules from @osmosis-labs/utils.


24-27: Verify the reliability of RPC URLs.

Ensure that the RPC URLs are reliable and handle potential network errors.

const publicClient = createPublicClient({
  chain: evmChain,
  transport: http(evmChain.rpcUrls.default.http[0]),
});

try {
  const balance = // fetch balance
} catch (error) {
  console.error(`Failed to fetch balance: ${error.message}`);
  throw error;
}
packages/web/modals/wallet-select/utils.ts (1)

1-1: Import statement looks good.

The import statement correctly imports necessary modules from @cosmos-kit/core.

packages/web/components/wallet-states/switching-network-state.tsx (2)

1-1: Import statement looks good.

The import statement correctly imports necessary modules from @osmosis-labs/utils.


25-27: Ensure the wallet logo is a valid URL.

Ensure that the wallet logo is a valid URL to avoid potential issues.

{!!walletLogo && typeof walletLogo === "string" && (
  <img width={64} height={64} src={walletLogo} alt="Wallet logo" onError={(e) => { e.target.src = 'default-logo.png'; }} />
)}
packages/types/src/chain-types.ts (1)

21-30: Add documentation for logo URIs.

Adding documentation for logoURIs can help developers understand the purpose and usage of each property.

/**
 * Optional logo URIs for the chain.
 */
logoURIs?: {
  /**
   * PNG logo URI.
   */
  png?: string;
  /**
   * SVG logo URI.
   */
  svg?: string;
  /**
   * Layout type for the logo.
   */
  layout?: "logomark";
  /**
   * Theme-related properties for the logo.
   */
  theme?: {
    /**
     * Primary color in hexadecimal format.
     */
    primary_color_hex?: string;
    /**
     * Indicates if dark mode is supported.
     */
    dark_mode?: boolean;
    /**
     * Indicates if the logo is circular.
     */
    circle?: boolean;
  };
};
packages/web/components/bridge/immersive/bridge-quote-remaining-time.tsx (2)

27-27: Verify the interval update frequency.

The interval update frequency is set to 1000 ms, which might be intended to be 1 second. Verify if this is correct.

-      1000 // Update every ms
+      1000 // Update every second

46-77: LGTM!

The RadialProgress component is correctly implemented.

Tools
Biome

[error] 53-53: Alternative text title element cannot be empty

For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.

(lint/a11y/noSvgWithoutTitle)

packages/web/modals/wallet-select/evm-wallet-state.tsx (1)

Line range hint 1-57: LGTM!

The EvmWalletState component is correctly implemented and handles various wallet connection states appropriately.

packages/web/hooks/use-feature-flags.ts (1)

Line range hint 1-62: LGTM!

The useFeatureFlags hook is correctly implemented and provides comprehensive feature flag management.

packages/web/integrations/axelar/types.ts (3)

1-2: Verify the necessity of the imports.

Ensure that SourceChainTokenConfig and AxelarSourceChain are necessary for the functionality in this file.


16-16: Verify the necessity and usage of defaultSourceChainId.

Ensure that defaultSourceChainId of type AxelarSourceChain is required and correctly used in the code.


Line range hint 38-50: Verify the correctness and necessity of the mappings.

Ensure that the mappings for AxelarChainIds_SourceChainMap and EthClientChainIds_SourceChainMap are correct and required for the functionality.

Also applies to: 68-88

packages/web/modals/select-asset-source.tsx (1)

19-19: Verify the necessity and usage of desiredSourceKey.

Ensure that desiredSourceKey of type AxelarSourceChain is required and correctly used in the component.

packages/web/components/bridge/immersive/more-bridge-options.tsx (1)

14-18: Verify the necessity and usage of the new properties.

Ensure that fromAsset, toAsset, fromChain, toChain, and toAddress are required and correctly used in the component.

packages/utils/src/ethereum.ts (3)

24-25: Verify the correctness and necessity of NativeEVMTokenConstantAddress.

Ensure that the constant address 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE is correct and required for the functionality.


32-50: Verify the necessity and usage of AxelarSourceChain.

Ensure that the AxelarSourceChain type is required and correctly used in the code.


Line range hint 89-133: Verify the correctness and necessity of the mappings in EthereumChainInfo.

Ensure that the mappings for EthereumChainInfo are correct and required for the functionality.

packages/web/components/drawers/drawer.tsx (4)

Line range hint 125-144: LGTM!

The DrawerPanel component is well-implemented.


Line range hint 1-33: LGTM!

The Drawer component is well-implemented.


Line range hint 35-43: LGTM!

The DrawerButton component is well-implemented.


Line range hint 45-61: LGTM!

The DrawerContent component is well-implemented.

packages/web/modals/bridge-transfer-v1.tsx (4)

Line range hint 1-25: LGTM!

The imports and type definitions are well-organized.


Line range hint 27-72: LGTM!

The BridgeTransferV1Modal component props and initializations are well-implemented.


Line range hint 74-104: LGTM!

The BridgeTransferV1Modal component logic is well-implemented.


Line range hint 106-140: LGTM!

The BridgeTransferV1Modal component return statement is well-implemented.

packages/web/__tests__/index-page.spec.tsx (6)

16-24: LGTM!

The mock setups for ResizeObserver are well-implemented.


Line range hint 26-36: LGTM!

The beforeEach and afterEach hooks are well-implemented.


Line range hint 38-49: LGTM!

The test case "should display initial tokens when there are no previous trades" is well-implemented.


Line range hint 51-71: LGTM!

The test case "If there's a previous trade and no query params, swap tool should select those tokens" is well-implemented.


Line range hint 73-93: LGTM!

The test case "If the previous trade is not available, swap tool should select default tokens" is well-implemented.


Line range hint 95-122: LGTM!

The test case "If there's no previous trade and no query params, swap tool should select default tokens and can switch between them" is well-implemented.

packages/web/components/bridge/immersive/amount-and-confirmation-screen.tsx (4)

1-27: LGTM!

The imports and type definitions are well-organized.


29-50: LGTM!

The state variables and hooks in AmountAndConfirmationScreen are well-implemented.


51-85: LGTM!

The useBridgeQuote hook usage is well-implemented.


87-126: LGTM!

The return statement in AmountAndConfirmationScreen is well-implemented.

packages/web/modals/wallet-select/use-connect-wallet.ts (1)

1-214: LGTM!

The code changes are well-structured and effectively manage wallet connections.

packages/web/components/bridge/immersive/immersive-bridge.tsx (1)

179-183: LGTM! The usage of AmountAndConfirmationScreen is correct.

The code changes are approved.

packages/web/components/swap-tool/__tests__/swap-tool.spec.tsx (1)

Line range hint 24-219: LGTM! The test setup and assertions are correct.

The code changes are approved.

packages/web/components/bridge/immersive/use-bridges-supported-assets.ts (1)

145-154: Specify button type

Provide an explicit type prop for the button element. The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behavior that you want inside a React application.

-                <button
+                <button type="button"

Likely invalid or redundant comment.

packages/server/src/queries/complex/assets/user.ts (2)

72-72: LGTM!

The function is well-structured and does not contain any obvious issues.


41-41: Remove redundant Boolean call

It is not necessary to use the Boolean call when a value will already be coerced to a boolean.

-  if (!Boolean(userCosmosAddress)) return asset;
+  if (!userCosmosAddress) return asset;

Likely invalid or redundant comment.

packages/web/components/bridge/immersive/bridge-wallet-select-modal.tsx (1)

29-54: LGTM!

The BridgeWalletSelectModal component is well-structured and uses the observer pattern from MobX effectively.

packages/web/modals/wallet-select/index.tsx (2)

Line range hint 1-24: LGTM!

The imports and interface definitions are well-structured.


Line range hint 223-290: LGTM!

The rendering logic is well-structured and handles different modal views effectively.

packages/bridge/src/interface.ts (3)

Line range hint 1-84: LGTM!

The type definitions are well-structured and provide clear documentation.


Line range hint 142-177: LGTM!

The schemas are well-structured and use zod for validation.


Line range hint 177-290: LGTM!

The remaining type definitions and interfaces are well-structured and provide clear documentation.

packages/web/modals/wallet-select/cosmos-wallet-state.tsx (2)

Line range hint 1-27: LGTM!

The imports and interface definitions are well-structured.


Line range hint 29-290: LGTM!

The component logic is well-structured and handles different modal views effectively.

packages/bridge/src/squid/index.ts (13)

11-17: Import statement updates.

Ensure that the updated import paths are correct and the imported entities are used correctly in the code.

Verification successful

Import statement updates verified.

The imported entities from @osmosis-labs/utils are correctly used within packages/bridge/src/squid/index.ts.

  • apiClient is used for making API calls.
  • ApiClientError is used for error handling.
  • EthereumChainInfo is used to find specific chain information.
  • isNil is used for null or undefined checks.
  • NativeEVMTokenConstantAddress is used for address comparisons.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of imported entities from `@osmosis-labs/utils`.

# Test: Search for the usage of imported entities. Expect: Correct usage.
rg --type ts '@osmosis-labs/utils'

Length of output: 15477



Script:

#!/bin/bash
# Description: Verify the usage of imported entities within the specific file `packages/bridge/src/squid/index.ts`.

# Test: Search for the usage of the imported entities in the specified file.
rg 'apiClient|ApiClientError|EthereumChainInfo|isNil|NativeEVMTokenConstantAddress' packages/bridge/src/squid/index.ts

Length of output: 673


11-17: Import statement updates.

Ensure that the updated import paths are correct and the imported entities are used correctly in the code.

Verification successful

Import statement updates.

The imported entities from @osmosis-labs/utils (apiClient, ApiClientError, EthereumChainInfo, isNil, NativeEVMTokenConstantAddress) are correctly used within packages/bridge/src/squid/index.ts.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of imported entities from `@osmosis-labs/utils`.

# Test: Search for the usage of imported entities. Expect: Correct usage.
rg --type ts '@osmosis-labs/utils'

Length of output: 15477



Script:

#!/bin/bash
# Description: Verify the usage of imported entities from `@osmosis-labs/utils` in `packages/bridge/src/squid/index.ts`.

# Test: Search for the usage of each imported entity in `packages/bridge/src/squid/index.ts`.
rg 'apiClient|ApiClientError|EthereumChainInfo|isNil|NativeEVMTokenConstantAddress' packages/bridge/src/squid/index.ts

Length of output: 673


11-17: Import statement updates.

Ensure that the updated import paths are correct and the imported entities are used correctly in the code.

Verification successful

Import statement updates verified.

The imported entities from @osmosis-labs/utils in packages/bridge/src/squid/index.ts are correctly used within the file.

  • apiClient is used multiple times to make API calls.
  • ApiClientError is used for error handling.
  • EthereumChainInfo is used to find EVM chain information.
  • isNil is used for null/undefined checks.
  • NativeEVMTokenConstantAddress is used for address comparison.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of imported entities from `@osmosis-labs/utils`.

# Test: Search for the usage of imported entities. Expect: Correct usage.
rg --type ts '@osmosis-labs/utils'

Length of output: 15477



Script:

#!/bin/bash
# Description: Verify the usage of specific imported entities from `@osmosis-labs/utils` in `packages/bridge/src/squid/index.ts`.

# Test: Search for the usage of each imported entity within the specified file.
rg 'apiClient' packages/bridge/src/squid/index.ts
rg 'ApiClientError' packages/bridge/src/squid/index.ts
rg 'EthereumChainInfo' packages/bridge/src/squid/index.ts
rg 'isNil' packages/bridge/src/squid/index.ts
rg 'NativeEVMTokenConstantAddress' packages/bridge/src/squid/index.ts

Length of output: 831


11-17: Import statement updates.

Ensure that the updated import paths are correct and the imported entities are used correctly in the code.

Verification successful

Import statement updates verified.

The imported entities from @osmosis-labs/utils in packages/bridge/src/squid/index.ts are correctly used within the file.

  • apiClient
  • ApiClientError
  • EthereumChainInfo
  • isNil
  • NativeEVMTokenConstantAddress
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of imported entities from `@osmosis-labs/utils`.

# Test: Search for the usage of imported entities. Expect: Correct usage.
rg --type ts '@osmosis-labs/utils'

Length of output: 15477



Script:

#!/bin/bash
# Description: Verify the usage of imported entities in `packages/bridge/src/squid/index.ts`.

# List of imported entities to check
entities=("apiClient" "ApiClientError" "EthereumChainInfo" "isNil" "NativeEVMTokenConstantAddress")

# Check each entity for usage in the specified file
for entity in "${entities[@]}"; do
  echo "Searching for usage of $entity in packages/bridge/src/squid/index.ts"
  rg "$entity" packages/bridge/src/squid/index.ts
done

Length of output: 1911


11-17: Import statement updates.

Ensure that the updated import paths are correct and the imported entities are used correctly in the code.

Verification successful

Import statement updates.

The updated import paths are correct, and all imported entities from @osmosis-labs/utils are used appropriately in the code.

  • packages/bridge/src/squid/index.ts
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of imported entities from `@osmosis-labs/utils`.

# Test: Search for the usage of imported entities. Expect: Correct usage.
rg --type ts '@osmosis-labs/utils'

Length of output: 15477



Script:

#!/bin/bash
# Description: Verify the usage of imported entities from `@osmosis-labs/utils` in the specified file.

# Test: Search for the usage of the imported entities in `packages/bridge/src/squid/index.ts`.
rg 'apiClient|ApiClientError|EthereumChainInfo|isNil|NativeEVMTokenConstantAddress' packages/bridge/src/squid/index.ts

Length of output: 673


11-17: Import statement updates.

Ensure that the updated import paths are correct and the imported entities are used correctly in the code.

Verification successful

Import statement updates verified.

The updated import paths and the usage of the imported entities from @osmosis-labs/utils in packages/bridge/src/squid/index.ts are correct.

  • apiClient is used in multiple instances for making API calls.
  • ApiClientError is used for error handling.
  • EthereumChainInfo is used to find EVM chains.
  • isNil is used in conditional checks.
  • NativeEVMTokenConstantAddress is used for address comparison.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of imported entities from `@osmosis-labs/utils`.

# Test: Search for the usage of imported entities. Expect: Correct usage.
rg --type ts '@osmosis-labs/utils'

Length of output: 15477



Script:

#!/bin/bash
# Description: Verify the usage of specific imported entities from `@osmosis-labs/utils` in `packages/bridge/src/squid/index.ts`.

# Test: Search for the usage of each imported entity. Expect: Correct usage.

# Define the file to search within.
file="packages/bridge/src/squid/index.ts"

# Search for usage of each imported entity.
rg "apiClient" $file
rg "ApiClientError" $file
rg "EthereumChainInfo" $file
rg "isNil" $file
rg "NativeEVMTokenConstantAddress" $file

Length of output: 873


11-17: Import statement updates.

Ensure that the updated import paths are correct and the imported entities are used correctly in the code.

Verification successful

Import statement updates verified.

The updated import paths are correct, and all imported entities are used appropriately in the code.

  • apiClient
  • ApiClientError
  • EthereumChainInfo
  • isNil
  • NativeEVMTokenConstantAddress
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of imported entities from `@osmosis-labs/utils`.

# Test: Search for the usage of imported entities. Expect: Correct usage.
rg --type ts '@osmosis-labs/utils'

Length of output: 15477



Script:

#!/bin/bash
# Description: Verify the usage of imported entities in `packages/bridge/src/squid/index.ts`.

# Test: Search for the usage of imported entities within the file. Expect: Correct usage.
rg 'apiClient|ApiClientError|EthereumChainInfo|isNil|NativeEVMTokenConstantAddress' packages/bridge/src/squid/index.ts

Length of output: 673


11-17: Import statement updates.

Ensure that the updated import paths are correct and the imported entities are used correctly in the code.

Verification successful

Import statement updates.

The imported entities apiClient, ApiClientError, EthereumChainInfo, isNil, and NativeEVMTokenConstantAddress from @osmosis-labs/utils are correctly used in the code.

  • apiClient is used to make API calls.
  • ApiClientError is used for error handling.
  • EthereumChainInfo is used to get information about Ethereum chains.
  • isNil is used to check for null or undefined values.
  • NativeEVMTokenConstantAddress is used to compare token addresses.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of imported entities from `@osmosis-labs/utils`.

# Test: Search for the usage of imported entities. Expect: Correct usage.
rg --type ts '@osmosis-labs/utils'

Length of output: 15477



Script:

#!/bin/bash
# Description: Verify the usage of imported entities from `@osmosis-labs/utils` in the target file.

# Test: Search for the usage of specific imported entities in the target file. Expect: Correct usage.
rg 'apiClient|ApiClientError|EthereumChainInfo|isNil|NativeEVMTokenConstantAddress' packages/bridge/src/squid/index.ts

Length of output: 673


11-17: Import statement updates.

Ensure that the updated import paths are correct and the imported entities are used correctly in the code.

Verification successful

Import statement updates.

The updated import paths are correct, and the imported entities are used appropriately in the code.

  • apiClient
  • ApiClientError
  • EthereumChainInfo
  • isNil
  • NativeEVMTokenConstantAddress
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of imported entities from `@osmosis-labs/utils`.

# Test: Search for the usage of imported entities. Expect: Correct usage.
rg --type ts '@osmosis-labs/utils'

Length of output: 15477



Script:

#!/bin/bash
# Description: Verify the usage of specific imported entities in packages/bridge/src/squid/index.ts.

# Test: Search for the usage of imported entities. Expect: Correct usage.
rg 'apiClient|ApiClientError|EthereumChainInfo|isNil|NativeEVMTokenConstantAddress' packages/bridge/src/squid/index.ts

Length of output: 673


11-17: Import statement updates.

Ensure that the updated import paths are correct and the imported entities are used correctly in the code.

Verification successful

Import statement updates verified.

The imported entities from @osmosis-labs/utils (apiClient, ApiClientError, EthereumChainInfo, isNil, NativeEVMTokenConstantAddress) are correctly used within the packages/bridge/src/squid/index.ts file.

  • apiClient is used to make API calls.
  • ApiClientError is used for error handling.
  • EthereumChainInfo is used to find chain information.
  • isNil is used for null/undefined checks.
  • NativeEVMTokenConstantAddress is used for address comparison.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of imported entities from `@osmosis-labs/utils`.

# Test: Search for the usage of imported entities. Expect: Correct usage.
rg --type ts '@osmosis-labs/utils'

Length of output: 15477



Script:

#!/bin/bash
# Description: Verify the usage of specific imported entities from `@osmosis-labs/utils` in `packages/bridge/src/squid/index.ts`.

# Test: Search for the usage of each imported entity in the specified file.
rg 'apiClient|ApiClientError|EthereumChainInfo|isNil|NativeEVMTokenConstantAddress' packages/bridge/src/squid/index.ts

Length of output: 673


11-17: Import statement updates.

Ensure that the updated import paths are correct and the imported entities are used correctly in the code.

Verification successful

Verify the usage of imported entities.

Ensure that the entities apiClient, ApiClientError, EthereumChainInfo, isNil, and NativeEVMTokenConstantAddress from @osmosis-labs/utils are used correctly in the packages/bridge/src/squid/index.ts file.


Import statement updates verified.

The updated import paths are correct, and the imported entities are used appropriately within the code.

  • apiClient
  • ApiClientError
  • EthereumChainInfo
  • isNil
  • NativeEVMTokenConstantAddress
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of imported entities from `@osmosis-labs/utils`.

# Test: Search for the usage of imported entities. Expect: Correct usage.
rg --type ts '@osmosis-labs/utils'

Length of output: 15477



Script:

#!/bin/bash
# Description: Verify the usage of specific imported entities from `@osmosis-labs/utils` in `packages/bridge/src/squid/index.ts`.

# Test: Search for the usage of `apiClient`, `ApiClientError`, `EthereumChainInfo`, `isNil`, and `NativeEVMTokenConstantAddress` in the specified file.
rg 'apiClient|ApiClientError|EthereumChainInfo|isNil|NativeEVMTokenConstantAddress' packages/bridge/src/squid/index.ts

Length of output: 673


11-17: Import statement updates.

Ensure that the updated import paths are correct and the imported entities are used correctly in the code.

Verification successful

Import statement updates verified.

The updated import paths are correct, and the imported entities (apiClient, ApiClientError, EthereumChainInfo, isNil, and NativeEVMTokenConstantAddress) are used correctly in the code.

  • packages/bridge/src/squid/index.ts
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of imported entities from `@osmosis-labs/utils`.

# Test: Search for the usage of imported entities. Expect: Correct usage.
rg --type ts '@osmosis-labs/utils'

Length of output: 15477



Script:

#!/bin/bash
# Description: Verify the usage of imported entities in `packages/bridge/src/squid/index.ts`.

# Test: Search for the usage of specific imported entities in the file. Expect: Correct usage.
rg 'apiClient|ApiClientError|EthereumChainInfo|isNil|NativeEVMTokenConstantAddress' packages/bridge/src/squid/index.ts

Length of output: 673


11-17: Import statement updates.

Ensure that the updated import paths are correct and the imported entities are used correctly in the code.

Verification successful

Import statement updates.

The updated import paths are correct and all imported entities are used appropriately in the code.

  • apiClient is used for making API calls.
  • ApiClientError is used for handling API client errors.
  • EthereumChainInfo is used for retrieving Ethereum chain information.
  • isNil is used for checking null or undefined values.
  • NativeEVMTokenConstantAddress is used for address comparison.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of imported entities from `@osmosis-labs/utils`.

# Test: Search for the usage of imported entities. Expect: Correct usage.
rg --type ts '@osmosis-labs/utils'

Length of output: 15477



Script:

#!/bin/bash
# Description: Verify the usage of imported entities from `@osmosis-labs/utils` in `packages/bridge/src/squid/index.ts`.

# Extract the lines where the entities are used in the specific file.
rg 'apiClient|ApiClientError|EthereumChainInfo|isNil|NativeEVMTokenConstantAddress' packages/bridge/src/squid/index.ts

Length of output: 673

packages/bridge/src/axelar/__tests__/axelar-bridge-provider.spec.ts (1)

7-7: LGTM!

The import path update to use @osmosis-labs/utils improves code maintainability and consistency.

packages/bridge/src/axelar/index.ts (1)

10-14: LGTM!

The import path update to use @osmosis-labs/utils improves code maintainability and consistency.

packages/web/components/bridge/immersive/use-bridge-quote.ts (2)

1-26: Good use of imports and initial state setup.

The imports are well-organized and relevant to the functionality. The initial state setup is clear and uses appropriate hooks.


648-673: LGTM!

The return statement is well-structured and provides all necessary data and functions.

packages/web/components/bridge/immersive/amount-screen.tsx (3)

1-50: Imports look good.

The import statements are well-organized and import necessary components, hooks, and utilities.


51-107: Prop definitions and initial state setup look good.

The prop types are correctly defined, and the initial state is properly set up.


1278-1291: Inner components and utility functions look good.

The inner components and utility functions are correctly implemented and follow best practices.


Tip

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI gpt-4o model for code reviews and chat: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are currently opted into early access features by default.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 20

Outside diff range and nitpick comments (21)
packages/web/integrations/axelar/utils.ts (1)

Line range hint 9-15: Refactor switch case for better readability.

Consider using a constant object to map the source chains to wait times for improved readability and maintainability.

export function waitByTransferFromSourceChain(
  sourceChain: AxelarSourceChain | "Osmosis"
) {
  const waitTimes = {
    Ethereum: "15",
    Polygon: "15",
    default: "3",
  };

  return t("assets.transfer.waitTime", {
    minutes: waitTimes[sourceChain] || waitTimes.default,
  });
}
packages/web/modals/wallet-select/simple-wallet-list.tsx (1)

Line range hint 65-80: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behavior that you want inside a React application.

-                <button
+                <button type="button"
packages/server/src/queries/complex/assets/index.ts (2)

[!TIP]
Codebase Verification

Update function calls to match the new signature

The function calls to mapGetAssetsWithUserBalances in packages/trpc/src/assets.ts still use userOsmoAddress. They need to be updated to use userCosmosAddress to match the new signature.

  • packages/trpc/src/assets.ts:
    • Line: 67
      userCosmosAddress: userOsmoAddress,
    • Line: 71
      userCosmosAddress: userOsmoAddress,
    • Line: 75
      // Only get balances for withdraw
Analysis chain

Line range hint 137-138: Verify the function usage in the codebase.

Ensure that all function calls to mapGetAssetsWithUserBalances match the new signature using userCosmosAddress.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all function calls to `mapGetAssetsWithUserBalances` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type typescript $'mapGetAssetsWithUserBalances'

Length of output: 86



Script:

#!/bin/bash
# Description: Verify all function calls to `mapGetAssetsWithUserBalances` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type ts 'mapGetAssetsWithUserBalances'

Length of output: 566



Script:

#!/bin/bash
# Description: Verify that all calls to `mapGetAssetsWithUserBalances` use the new signature with `userCosmosAddress`.

# Display lines around each occurrence to verify the function signature
rg --type ts 'mapGetAssetsWithUserBalances' -A 3 -B 3

Length of output: 3003


[!TIP]
Codebase Verification

Update function calls to match the new signature

The function getAssetWithUserBalance should use userCosmosAddress instead of userOsmoAddress in its calls.

  • File: packages/trpc/src/assets.ts
    • Lines:
      • return await getAssetWithUserBalance({ ...ctx, asset, userCosmosAddress: userOsmoAddress, });
      • const userAsset = await getAssetWithUserBalance({ ...ctx, asset, userCosmosAddress: userOsmoAddress, });

Please update these calls to use the correct parameter.

Analysis chain

Line range hint 135-136: Verify the function usage in the codebase.

Ensure that all function calls to getAssetWithUserBalance match the new signature using userCosmosAddress.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all function calls to `getAssetWithUserBalance` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type typescript $'getAssetWithUserBalance'

Length of output: 81



Script:

#!/bin/bash
# Description: Verify all function calls to `getAssetWithUserBalance` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type ts 'getAssetWithUserBalance'

Length of output: 382



Script:

#!/bin/bash
# Description: Verify function calls to `getAssetWithUserBalance` match the new signature using `userCosmosAddress`.

# Inspect the lines where the function is called in `packages/trpc/src/assets.ts`.
rg --type ts --context 5 'getAssetWithUserBalance' packages/trpc/src/assets.ts

Length of output: 909

packages/web/modals/transfer-asset-select.tsx (1)

Line range hint 155-167: Add corresponding keyboard events for accessibility.

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

- onClick={() => {
+ onClick={() => {
+   setSelectedSourceChainKey(sourceChain.id);
+   setSourceChainDropdownOpen(false);
+ }}
+ onKeyDown={(e) => {
+   if (e.key === 'Enter' || e.key === ' ') {
+     setSelectedSourceChainKey(sourceChain.id);
+     setSourceChainDropdownOpen(false);
+   }
+ }}
packages/web/components/bridge/immersive/immersive-bridge.tsx (1)

Line range hint 23-27: Change the const enum to a regular enum.

Const enums are not supported by bundlers and are incompatible with the 'isolatedModules' mode. Their use can lead to import inexistent values.

- export const enum ImmersiveBridgeScreens {
+ export enum ImmersiveBridgeScreens {
packages/web/modals/wallet-select/full-wallet-list.tsx (2)

Line range hint 122-140: Add explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behavior that you want inside a React application.

- <button
+ <button type="button"

Line range hint 155-169: Add explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behavior that you want inside a React application.

- <button
+ <button type="button"
packages/web/components/bridge/immersive/asset-select-screen.tsx (1)

Line range hint 145-154: Provide an explicit type prop for the button element.

The default type of a button is submit, which can cause unintended form submissions. Add an explicit type prop to the button element.

-                <button
+                <button type="button"
packages/web/modals/wallet-select/cosmos-wallet-state.tsx (1)

Line range hint 145-145: Remove redundant Boolean call.

The Boolean call is redundant as the value will already be coerced to a boolean.

-          Boolean(downloadInfo)
+          downloadInfo
packages/web/stores/assets/transfer-ui-config.ts (1)

Line range hint 274-292: Fix the optional chain.

Change to an optional chain to simplify the code.

- if (originBridgeInfo && defaultSourceChainId)
-   originBridgeInfo.defaultSourceChainId =
-     (defaultSourceChainId as AxelarSourceChain) ?? undefined;

+ originBridgeInfo?.defaultSourceChainId = defaultSourceChainId ?? undefined;
packages/bridge/src/skip/index.ts (2)

Line range hint 136-136: Remove redundant Boolean call.

The Boolean call is unnecessary as the value will already be coerced to a boolean.

- address: feeAsset.is_evm && !Boolean(feeAsset.token_contract)
+ address: feeAsset.is_evm && !feeAsset.token_contract

Line range hint 581-581: Remove unnecessary continue statement.

The continue statement is unnecessary and can be removed.

- if (!("chainId" in counterparty)) continue;
+ if (!("chainId" in counterparty)) {
+   // Skip unsupported chainId
+ }
packages/bridge/src/axelar/index.ts (2)

Line range hint 423-425: Remove redundant else clause.

The else clause can be omitted because the previous branch breaks early.

-    } else {
-      return await this.createCosmosTransaction(params);
-    }
+    }
+    return await this.createCosmosTransaction(params);

Line range hint 456-466: Remove redundant else clause.

The else clause can be omitted because the previous branch breaks early.

-    } else {
-      return {
-        type: "evm",
-        to: fromAsset.address as Address, // ERC20 token address
-        data: encodeFunctionData({
-          abi: erc20Abi,
-          functionName: "transfer",
-          args: [depositAddress as Address, BigInt(fromAmount)],
-        }),
-      };
-    }
+    }
+    return {
+      type: "evm",
+      to: fromAsset.address as Address, // ERC20 token address
+      data: encodeFunctionData({
+        abi: erc20Abi,
+        functionName: "transfer",
+        args: [depositAddress as Address, BigInt(fromAmount)],
+      }),
+    };
packages/web/modals/bridge-transfer-v2.tsx (2)

Line range hint 1039-1039: Remove redundant Boolean call.

The Boolean call is redundant as the value will already be coerced to a boolean.

- Boolean(selectedQuote?.quote?.transactionRequest?.type === "evm") &&
+ selectedQuote?.quote?.transactionRequest?.type === "evm" &&

Line range hint 1041-1041: Remove redundant Boolean call.

The Boolean call is redundant as the value will already be coerced to a boolean.

- Boolean(selectedQuote?.quote?.transactionRequest?.type === "cosmos") &&
+ selectedQuote?.quote?.transactionRequest?.type === "cosmos" &&
packages/web/components/bridge/immersive/amount-screen.tsx (4)

Line range hint 616-621: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behavior that you want inside a React application. Allowed button types are: submit, button, or reset.

- <button
+ <button type="button"

Line range hint 644-644: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behavior that you want inside a React application. Allowed button types are: submit, button, or reset.

- <button
+ <button type="button"

Line range hint 1234-1239: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behavior that you want inside a React application. Allowed button types are: submit, button, or reset.

- <button
+ <button type="button"

Line range hint 1242-1245: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behavior that you want inside a React application. Allowed button types are: submit, button, or reset.

- <button
+ <button type="button"

buttonErrorMessage = t("assets.transfer.errors.wrongNetworkInWallet", {
walletName: evmConnector?.name ?? "Unknown",
});
} else if (Boolean(someError)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove redundant Boolean call.

It is not necessary to use the Boolean call when a value will already be coerced to a boolean.

-  } else if (Boolean(someError)) {
+  } else if (someError) {
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} else if (Boolean(someError)) {
} else if (someError) {
Tools
Biome

[error] 596-596: Avoid redundant Boolean call

It is not necessary to use Boolean call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant Boolean call

(lint/complexity/noExtraBooleanCast)

export const DrawerOverlay: FunctionComponent<
HTMLProps<HTMLDivElement>
> = () => {
export const DrawerOverlay: FunctionComponent = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure accessibility compliance for DrawerOverlay.

The onClick event should be accompanied by a corresponding keyboard event to ensure accessibility for keyboard-only navigation.

-      <div
-        onClick={() => onClose()}
-        className="absolute inset-0 z-40 bg-osmoverse-1000/40"
-      />
+      <div
+        onClick={() => onClose()}
+        onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') onClose(); }}
+        role="button"
+        tabIndex={0}
+        className="absolute inset-0 z-40 bg-osmoverse-1000/40"
+      />
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const DrawerOverlay: FunctionComponent = () => {
export const DrawerOverlay: FunctionComponent = () => {
<div
onClick={() => onClose()}
onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') onClose(); }}
role="button"
tabIndex={0}
className="absolute inset-0 z-40 bg-osmoverse-1000/40"
/>
}

args: [userAddress as Address],
});

return balance;
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure balance is returned in a consistent format.

Consider ensuring that the returned balance is in a consistent format (e.g., a string or a specific unit) to avoid potential issues in downstream code.

-  return balance;
+  return balance.toString();
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return balance;
return balance.toString();

Comment on lines +37 to +43
return (
<div className={classNames("relative h-7 w-7", className)}>
<div className="absolute top-0 left-0 h-full w-full">
<RadialProgress progress={progress} />
</div>
</div>
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure SVG has alternative text for accessibility.

For accessibility purposes, the SVG should have an alternative text provided via a title element.

-    <svg className="h-full w-full" viewBox="0 0 50 50">
+    <svg className="h-full w-full" viewBox="0 0 50 50" role="img" aria-label="Progress indicator">
+      <title>Progress indicator</title>

Committable suggestion was skipped due to low confidence.

Comment on lines +13 to +15
import { useFeatureFlags, WalletSelectParams } from "~/hooks";
import { useWindowSize } from "~/hooks";
import { useConnectEvmWallet } from "~/hooks/evm-wallet";
import {
CreateOneClickSessionError,
useCreateOneClickTradingSession,
} from "~/hooks/mutations/one-click-trading";
import { useCreateOneClickTradingSession } from "~/hooks/mutations/one-click-trading";
Copy link
Contributor

Choose a reason for hiding this comment

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

Consolidate imports from ~/hooks.

The imports from ~/hooks can be consolidated to improve readability and reduce redundancy.

-import { useFeatureFlags, WalletSelectParams } from "~/hooks";
-import { useWindowSize } from "~/hooks";
-import { useCreateOneClickTradingSession } from "~/hooks/mutations/one-click-trading";
+import { useFeatureFlags, WalletSelectParams, useWindowSize, useCreateOneClickTradingSession, useOneClickTradingParams, useHasInstalledCosmosWallets } from "~/hooks";

Committable suggestion was skipped due to low confidence.

Comment on lines +87 to +96
<button
className={classNames(
"flex w-full justify-between gap-12 rounded-lg py-2 px-3 data-[active]:bg-osmoverse-700",
{
"bg-osmoverse-700": isSelected,
"hover:bg-osmoverse-800": !isSelected,
}
)}
onClick={() => onSelect(provider.id)}
>
Copy link
Contributor

Choose a reason for hiding this comment

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

Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behavior that you want inside a React application.

- <button
+ <button type="button"
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<button
className={classNames(
"flex w-full justify-between gap-12 rounded-lg py-2 px-3 data-[active]:bg-osmoverse-700",
{
"bg-osmoverse-700": isSelected,
"hover:bg-osmoverse-800": !isSelected,
}
)}
onClick={() => onSelect(provider.id)}
>
<button
type="button"
className={classNames(
"flex w-full justify-between gap-12 rounded-lg py-2 px-3 data-[active]:bg-osmoverse-700",
{
"bg-osmoverse-700": isSelected,
"hover:bg-osmoverse-800": !isSelected,
}
)}
onClick={() => onSelect(provider.id)}
>
Tools
Biome

[error] 87-96: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

Comment on lines +274 to +292
} else if (chainType === "cosmos") {
let cosmosChain: ReturnType<typeof getChain> | undefined;
try {
cosmosChain = getChain({
chainList: ctx.chainList,
chainNameOrId: String(chainId),
});
} catch {}

if (!cosmosChain) {
return undefined;
}

return {
prettyName: cosmosChain.chain_name,
chainId: cosmosChain.chain_id,
chainType,
};
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor suggestion: Omit the else clause.

The else clause can be omitted because previous branches break early.

- else if (chainType === "cosmos") {
-   let cosmosChain: ReturnType<typeof getChain> | undefined;
-   try {
-     cosmosChain = getChain({
-       chainList: ctx.chainList,
-       chainNameOrId: String(chainId),
-     });
-   } catch {}
- 
-   if (!cosmosChain) {
-     return undefined;
-   }
- 
-   return {
-     prettyName: cosmosChain.chain_name,
-     chainId: cosmosChain.chain_id,
-     chainType,
-   };
- }
+ if (chainType === "cosmos") {
+   let cosmosChain: ReturnType<typeof getChain> | undefined;
+   try {
+     cosmosChain = getChain({
+       chainList: ctx.chainList,
+       chainNameOrId: String(chainId),
+     });
+   } catch {}
+ 
+   if (!cosmosChain) {
+     return undefined;
+   }
+ 
+   return {
+     prettyName: cosmosChain.chain_name,
+     chainId: cosmosChain.chain_id,
+     chainType,
+   };
+ }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} else if (chainType === "cosmos") {
let cosmosChain: ReturnType<typeof getChain> | undefined;
try {
cosmosChain = getChain({
chainList: ctx.chainList,
chainNameOrId: String(chainId),
});
} catch {}
if (!cosmosChain) {
return undefined;
}
return {
prettyName: cosmosChain.chain_name,
chainId: cosmosChain.chain_id,
chainType,
};
}
if (chainType === "cosmos") {
let cosmosChain: ReturnType<typeof getChain> | undefined;
try {
cosmosChain = getChain({
chainList: ctx.chainList,
chainNameOrId: String(chainId),
});
} catch {}
if (!cosmosChain) {
return undefined;
}
return {
prettyName: cosmosChain.chain_name,
chainId: cosmosChain.chain_id,
chainType,
};
}
Tools
Biome

[error] 274-292: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)

Comment on lines +204 to +216
getSupportedAssetsByBridge: publicProcedure
.input(getBridgeSupportedAssetsParams.extend({ bridge: z.string() }))
.query(async ({ input, ctx }) => {
const bridgeProviders = new BridgeProviders(
process.env.NEXT_PUBLIC_SQUID_INTEGRATOR_ID!,
{
...ctx,
env: IS_TESTNET ? "testnet" : "mainnet",
cache: lruCache,
getTimeoutHeight: ({ destinationAddress }) =>
getTimeoutHeight({ ...ctx, destinationAddress }),
}
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor suggestion: Remove repeated code by creating a global variable for BridgeProviders object.

The repeated code for creating the BridgeProviders object can be refactored into a global variable.

- const bridgeProviders = new BridgeProviders(
-   process.env.NEXT_PUBLIC_SQUID_INTEGRATOR_ID!,
-   {
-     ...ctx,
-     env: IS_TESTNET ? "testnet" : "mainnet",
-     cache: lruCache,
-     getTimeoutHeight: ({ destinationAddress }) =>
-       getTimeoutHeight({ ...ctx, destinationAddress }),
-   }
- );

+ const bridgeProviders = createBridgeProviders(ctx);

+ function createBridgeProviders(ctx) {
+   return new BridgeProviders(
+     process.env.NEXT_PUBLIC_SQUID_INTEGRATOR_ID!,
+     {
+       ...ctx,
+       env: IS_TESTNET ? "testnet" : "mainnet",
+       cache: lruCache,
+       getTimeoutHeight: ({ destinationAddress }) =>
+         getTimeoutHeight({ ...ctx, destinationAddress }),
+     }
+   );
+ }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
getSupportedAssetsByBridge: publicProcedure
.input(getBridgeSupportedAssetsParams.extend({ bridge: z.string() }))
.query(async ({ input, ctx }) => {
const bridgeProviders = new BridgeProviders(
process.env.NEXT_PUBLIC_SQUID_INTEGRATOR_ID!,
{
...ctx,
env: IS_TESTNET ? "testnet" : "mainnet",
cache: lruCache,
getTimeoutHeight: ({ destinationAddress }) =>
getTimeoutHeight({ ...ctx, destinationAddress }),
}
);
getSupportedAssetsByBridge: publicProcedure
.input(getBridgeSupportedAssetsParams.extend({ bridge: z.string() }))
.query(async ({ input, ctx }) => {
const bridgeProviders = createBridgeProviders(ctx);
+ function createBridgeProviders(ctx) {
+ return new BridgeProviders(
+ process.env.NEXT_PUBLIC_SQUID_INTEGRATOR_ID!,
+ {
+ ...ctx,
+ env: IS_TESTNET ? "testnet" : "mainnet",
+ cache: lruCache,
+ getTimeoutHeight: ({ destinationAddress }) =>
+ getTimeoutHeight({ ...ctx, destinationAddress }),
+ }
+ );
+ }

)}
onClick={onClick}
>
<button className="subtitle1 flex items-center gap-3">
Copy link
Contributor

Choose a reason for hiding this comment

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

Provide an explicit type prop for the button element.

The default type of a button is submit, which can cause unintended form submissions. Add an explicit type prop to the button element.

-      <button className="subtitle1 flex items-center gap-3">
+      <button type="button" className="subtitle1 flex items-center gap-3">
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<button className="subtitle1 flex items-center gap-3">
<button type="button" className="subtitle1 flex items-center gap-3">
Tools
Biome

[error] 263-263: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

Comment on lines +254 to +262
<div
className={classNames(
"flex w-full cursor-pointer items-center justify-between rounded-xl px-3 transition-colors hover:bg-osmoverse-700 active:bg-osmoverse-700/50",
"col-span-2 py-3 font-normal",
"sm:w-fit sm:flex-col",
"disabled:opacity-70"
)}
onClick={onClick}
>
Copy link
Contributor

Choose a reason for hiding this comment

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

Add keyboard event handlers for accessibility.

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

-    <div
+    <div
+      onKeyDown={onClick}
+      onKeyPress={onClick}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div
className={classNames(
"flex w-full cursor-pointer items-center justify-between rounded-xl px-3 transition-colors hover:bg-osmoverse-700 active:bg-osmoverse-700/50",
"col-span-2 py-3 font-normal",
"sm:w-fit sm:flex-col",
"disabled:opacity-70"
)}
onClick={onClick}
>
<div
className={classNames(
"flex w-full cursor-pointer items-center justify-between rounded-xl px-3 transition-colors hover:bg-osmoverse-700 active:bg-osmoverse-700/50",
"col-span-2 py-3 font-normal",
"sm:w-fit sm:flex-col",
"disabled:opacity-70"
)}
onClick={onClick}
onKeyDown={onClick}
onKeyPress={onClick}
>
Tools
Biome

[error] 254-262: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

(lint/a11y/useKeyWithClickEvents)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 40

Outside diff range and nitpick comments (24)
packages/trpc/src/chains.ts (1)

Line range hint 1-11: Consider Adding Error Handling for getChain Function.

The getChain function call within the query method should include error handling to manage potential failures gracefully.

- .query(async ({ input: { findChainNameOrId }, ctx }) =>
-   getChain({
-     ...ctx,
-     chainNameOrId: findChainNameOrId,
-   })
- ),
+ .query(async ({ input: { findChainNameOrId }, ctx }) => {
+   try {
+     return await getChain({
+       ...ctx,
+       chainNameOrId: findChainNameOrId,
+     });
+   } catch (error) {
+     // Handle error appropriately, e.g., log it and return a user-friendly message
+     console.error(error);
+     throw new Error("Failed to fetch chain information. Please try again later.");
+   }
+ }),
packages/web/modals/wallet-select/utils.ts (1)

Line range hint 5-18: Consider using a switch statement for better readability.

Using a switch statement can improve readability and maintainability of the code.

export function getModalView({
  qrState,
  isInitializingOneClickTrading,
  hasOneClickTradingError,
  hasBroadcastedTx,
  walletStatus,
}: {
  qrState: State;
  isInitializingOneClickTrading: boolean;
  hasOneClickTradingError: boolean;
  hasBroadcastedTx: boolean;
  walletStatus?: WalletStatus;
}): ModalView {
  switch (walletStatus) {
    case WalletStatus.Connecting:
      return qrState === State.Init ? ModalView.Connecting : ModalView.QrCode;
    case WalletStatus.Connected:
      if (hasOneClickTradingError) return ModalView.InitializeOneClickTradingError;
      if (isInitializingOneClickTrading) {
        return hasBroadcastedTx
          ? ModalView.BroadcastedOneClickTrading
          : ModalView.InitializingOneClickTrading;
      }
      return ModalView.Connected;
    case WalletStatus.Error:
      return qrState === State.Init ? ModalView.Error : ModalView.QrCode;
    case WalletStatus.Rejected:
      return ModalView.Rejected;
    case WalletStatus.NotExist:
      return ModalView.DoesNotExist;
    default:
      return ModalView.List;
  }
}
packages/web/modals/wallet-select/simple-wallet-list.tsx (1)

Line range hint 65-80: Add a type prop to the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behavior that you want inside a React application.

-                <button
+                <button
+                  type="button"
packages/web/components/drawers/drawer.tsx (1)

Line range hint 103-119: Add keyboard event handlers for accessibility.

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

-  onClick={() => onClose()}
+  onClick={() => onClose()}
+  onKeyUp={(e) => e.key === 'Enter' && onClose()}
+  role="button"
+  tabIndex={0}
packages/server/src/queries/complex/assets/index.ts (1)

Line range hint 146-149: Remove the unnecessary else clause.

The else clause is unnecessary because the previous branch already returns a value.

-    } else {
-      const symbolOrNameMatches = search(
-        assetListAssets,
-        /** Search is performed on the raw asset list data, instead of `Asset` type. */
-        ["symbol", "name"] as (keyof AssetListAsset)[],
-        params.search
-      );
-      assetListAssets = symbolOrNameMatches;
-    }
+    const symbolOrNameMatches = search(
+      assetListAssets,
+      /** Search is performed on the raw asset list data, instead of `Asset` type. */
+      ["symbol", "name"] as (keyof AssetListAsset)[],
+      params.search
+    );
+    assetListAssets = symbolOrNameMatches;
packages/web/modals/transfer-asset-select.tsx (1)

Line range hint 155-167: Add keyboard event handler for accessibility.

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

-  onClick={() => {
+  onClick={() => {
+    // handle click event
+  }}
+  onKeyDown={(e) => {
+    if (e.key === 'Enter' || e.key === ' ') {
+      // handle keyboard event
+    }
+  }}
packages/web/components/bridge/immersive/immersive-bridge.tsx (1)

Line range hint 23-27: Remove the const from the enum declaration.

Const enums are not supported by bundlers and are incompatible with the 'isolatedModules' mode.

- export const enum ImmersiveBridgeScreens {
+ export enum ImmersiveBridgeScreens {
packages/web/modals/wallet-select/full-wallet-list.tsx (2)

Line range hint 122-140: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.

- <button
+ <button type="button"

Line range hint 155-169: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.

- <button
+ <button type="button"
packages/web/components/bridge/immersive/asset-select-screen.tsx (2)

Line range hint 72-72: Remove redundant Boolean call

It is not necessary to use the Boolean call when a value will already be coerced to a boolean.

-          search: Boolean(search)
+          search: search

Line range hint 145-154: Specify button type

Provide an explicit type prop for the button element. The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behavior that you want inside a React application.

-                <button
+                <button type="button"
packages/server/src/queries/complex/assets/user.ts (1)

Line range hint 136-136: Use Number.isNaN instead of isNaN

isNaN is unsafe as it attempts a type coercion. Use Number.isNaN instead.

-      if (isNaN(n)) return 0;
+      if (Number.isNaN(n)) return 0;
packages/web/modals/wallet-select/index.tsx (1)

Line range hint 145-145: Avoid redundant Boolean call.

It is not necessary to use Boolean call when a value will already be coerced to a boolean.

-  return Boolean(downloadInfo) && (
+  return downloadInfo && (
packages/web/stores/assets/transfer-ui-config.ts (1)

Line range hint 274-292: Change to an optional chain.

Use optional chaining to handle undefined values.

-            (defaultSourceChainId as AxelarSourceChain) ?? undefined;
+            defaultSourceChainId as AxelarSourceChain ?? undefined;
packages/bridge/src/axelar/index.ts (2)

Line range hint 423-425: Omit the else clause for better readability.

The else clause is redundant after a return statement and can be omitted.

-    } else {
-      return await this.createCosmosTransaction(params);
-    }
+    }
+    return await this.createCosmosTransaction(params);

Line range hint 456-466: Omit the else clause for better readability.

The else clause is redundant after a return statement and can be omitted.

-    } else {
-      return await this.createCosmosTransaction(params);
-    }
+    }
+    return await this.createCosmosTransaction(params);
packages/web/modals/bridge-transfer-v2.tsx (4)

Line range hint 84-90: Improve error handling for unconfigured IBC balance/asset.

Consider providing a user-friendly message or fallback UI instead of just logging an error.

-  console.error("BridgeTransferModal given unconfigured IBC balance/asset");
-  return null;
+  displayToast("The selected asset is not configured for bridge transfer.", ToastType.ERROR);
+  return <FallbackUI />;

Line range hint 159-179: Optimize useEffect for notifying ETH wallet of preferred chain.

Consider moving the logic to a separate function to improve readability.

-  useEffect(() => {
-    let ethClientChainName: string | undefined =
-      getKeyByValue(EthClientChainIds_SourceChainMap, sourceChainKey) ??
-      sourceChainKey;
-
-    let hexChainId: string | undefined = getKeyByValue(
-      ChainNames,
-      ethClientChainName
-    )
-      ? ethClientChainName
-      : undefined;
-
-    if (!hexChainId || !ethWalletClient) return;
-
-    ethWalletClient.setPreferredSourceChain(hexChainId);
-  }, [ethWalletClient, sourceChainKey, walletClient]);
+  const notifyPreferredChain = useCallback(() => {
+    const ethClientChainName = getKeyByValue(EthClientChainIds_SourceChainMap, sourceChainKey) ?? sourceChainKey;
+    const hexChainId = getKeyByValue(ChainNames, ethClientChainName) ? ethClientChainName : undefined;
+    if (hexChainId && ethWalletClient) {
+      ethWalletClient.setPreferredSourceChain(hexChainId);
+    }
+  }, [ethWalletClient, sourceChainKey]);
+  useEffect(notifyPreferredChain, [notifyPreferredChain, walletClient]);

Line range hint 246-248: Improve error handling for unsupported chain types.

Consider providing a user-friendly message or fallback UI instead of throwing an error.

-  if (props.chainType !== "evm") throw new Error("Unsupported chain type");
+  if (props.chainType !== "evm") {
+    displayToast("The selected chain type is not supported.", ToastType.ERROR);
+    return <FallbackUI />;
+  }

Line range hint 1039-1039: Remove redundant Boolean calls.

The use of Boolean for error checks is redundant and can be removed.

-  } else if (Boolean(someError)) {
+  } else if (someError) {
packages/web/components/bridge/immersive/amount-screen.tsx (4)

Line range hint 616-621: Provide an explicit type for the button element.

The default type of a button is "submit", which may cause unintended form submissions. Specify the type explicitly.

- <button onClick={() => { ... }}>
+ <button type="button" onClick={() => { ... }}>

Line range hint 644-644: Provide an explicit type for the button element.

The default type of a button is "submit", which may cause unintended form submissions. Specify the type explicitly.

- <button onClick={() => setInputUnit(inputUnit === "fiat" ? "crypto" : "fiat")}>
+ <button type="button" onClick={() => setInputUnit(inputUnit === "fiat" ? "crypto" : "fiat")}>

Line range hint 1234-1239: Provide an explicit type for the button element.

The default type of a button is "submit", which may cause unintended form submissions. Specify the type explicitly.

- <button onClick={() => { setIsNetworkSelectVisible(true); }} ...>
+ <button type="button" onClick={() => { setIsNetworkSelectVisible(true); }} ...>

Line range hint 1208-1259: Ensure explicit button types for inner components.

The ChainSelectorButton component should also specify explicit button types to avoid unintended form submissions.

- <button onClick={() => setIsNetworkSelectVisible(true)} ...>
+ <button type="button" onClick={() => setIsNetworkSelectVisible(true)} ...>

Comment on lines +87 to +96
<button
className={classNames(
"flex w-full justify-between gap-12 rounded-lg py-2 px-3 data-[active]:bg-osmoverse-700",
{
"bg-osmoverse-700": isSelected,
"hover:bg-osmoverse-800": !isSelected,
}
)}
onClick={() => onSelect(provider.id)}
>
Copy link
Contributor

Choose a reason for hiding this comment

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

Add type attribute to the button element.

The default type of a button is submit, which may cause unintended form submissions. Specify the type attribute to avoid this issue.

-  <button
+  <button type="button"
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<button
className={classNames(
"flex w-full justify-between gap-12 rounded-lg py-2 px-3 data-[active]:bg-osmoverse-700",
{
"bg-osmoverse-700": isSelected,
"hover:bg-osmoverse-800": !isSelected,
}
)}
onClick={() => onSelect(provider.id)}
>
<button
type="button"
className={classNames(
"flex w-full justify-between gap-12 rounded-lg py-2 px-3 data-[active]:bg-osmoverse-700",
{
"bg-osmoverse-700": isSelected,
"hover:bg-osmoverse-800": !isSelected,
}
)}
onClick={() => onSelect(provider.id)}
>
Tools
Biome

[error] 87-96: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

const circumference = 2 * Math.PI * radius;
const offset = (progress / 100) * circumference;
return (
<svg className="h-full w-full" viewBox="0 0 50 50">
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a title to the SVG for accessibility.

For accessibility purposes, SVGs should have an alternative text provided via a title element.

-    <svg className="h-full w-full" viewBox="0 0 50 50">
+    <svg className="h-full w-full" viewBox="0 0 50 50">
+      <title>Progress Indicator</title>
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<svg className="h-full w-full" viewBox="0 0 50 50">
<svg className="h-full w-full" viewBox="0 0 50 50">
<title>Progress Indicator</title>
Tools
Biome

[error] 53-53: Alternative text title element cannot be empty

For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.

(lint/a11y/noSvgWithoutTitle)

* {
* 1: [
* {
* "chainId": 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove redundant Boolean call

It is not necessary to use the Boolean call when a value will already be coerced to a boolean.

-          search: Boolean(search)
+          search: search
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* "chainId": 1,
* "chainId": 1,
search: search

coinMinimalDenom: asset.denom,
},
new Dec(0)
),
Copy link
Contributor

Choose a reason for hiding this comment

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

Use Number.isNaN instead of isNaN

isNaN is unsafe as it attempts a type coercion. Use Number.isNaN instead.

-              if (isNaN(n)) return 0;
+              if (Number.isNaN(n)) return 0;

Committable suggestion was skipped due to low confidence.

}

if (input.type === "cosmos") {
if (!input.userCosmosAddress) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove redundant Boolean call

It is not necessary to use the Boolean call when a value will already be coerced to a boolean.

-              if (!Boolean(asset.usdValue) && !Boolean(b.usdValue)) return 0;
-              if (Boolean(asset.usdValue) && !Boolean(b.usdValue)) return -1;
-              if (!Boolean(asset.usdValue) && Boolean(b.usdValue)) return 1;
+              if (!asset.usdValue && !b.usdValue) return 0;
+              if (asset.usdValue && !b.usdValue) return -1;
+              if (!asset.usdValue && b.usdValue) return 1;

Committable suggestion was skipped due to low confidence.

@@ -290,7 +290,7 @@ export const assetsRouter = createTRPCRouter({
...ctx,
search,
categories,
userOsmoAddress,
userCosmosAddress: userOsmoAddress,
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Inconsistent parameter name change detected

The parameter userOsmoAddress was not uniformly updated to userCosmosAddress. The following occurrences of userOsmoAddress were found:

  • packages/trpc/src/assets.ts
  • packages/trpc/src/parameter-types.ts
  • packages/stores/src/account/types.ts
  • packages/stores/src/account/osmosis/index.ts
  • packages/stores/src/account/message-composers/osmosis/poolmanager.ts
  • packages/web/modals/lock-tokens.tsx
  • packages/web/modals/profile.tsx
  • packages/web/modals/one-click-trading-intro-modal.tsx
  • packages/web/modals/superfluid-validator.tsx
  • packages/web/pages/earn/index.tsx
  • packages/web/hooks/ui-config/use-superfluid-pool.ts
  • packages/web/hooks/use-swap.tsx
  • packages/web/hooks/use-get-earn-strategies.ts
  • packages/web/hooks/one-click-trading/use-one-click-trading-session.ts
  • packages/web/hooks/mutations/one-click-trading/use-create-one-click-trading-session.tsx
  • packages/web/hooks/mutations/one-click-trading/__tests__/use-create-one-click-trading-session.spec.ts
  • packages/web/components/complex/my-pools-card-grid.tsx
  • packages/web/components/complex/my-positions-section.tsx
  • packages/web/components/your-balance/your-balance.tsx
  • packages/web/components/complex/portfolio-page.tsx
  • packages/web/components/table/asset-balances.tsx
  • packages/web/components/navbar/index.tsx
  • packages/web/components/one-click-trading/profile-one-click-trading-settings.tsx
  • packages/web/components/one-click-trading/one-click-trading-settings.tsx
  • packages/web/components/pool-detail/share.tsx
  • packages/web/components/pool-detail/concentrated.tsx
  • packages/web/components/one-click-trading/screens/spend-limit-screen.tsx
  • packages/web/components/earn/rewards/index.tsx
  • packages/web/components/bridge/immersive/asset-select-screen.tsx
  • packages/web/components/cards/my-position/index.tsx
  • packages/server/src/queries/data-services/earn.ts
  • packages/server/src/queries/complex/authenticators.ts
  • packages/server/src/queries/complex/staking/user.ts
  • packages/server/src/queries/complex/earn/strategies.ts
  • packages/server/src/queries/complex/concentrated-liquidity/index.ts
  • packages/server/src/queries/complex/assets/user.ts
  • packages/server/src/queries/complex/__tests__/authenticators.spec.ts
  • packages/trpc/src/staking.ts
  • packages/trpc/src/pools.ts
  • packages/trpc/src/one-click-trading.ts
  • packages/trpc/src/earn.ts
  • packages/trpc/src/concentrated-liquidity.ts

Please ensure that all references to userOsmoAddress are updated to userCosmosAddress to maintain consistency throughout the codebase.

Analysis chain

Verify the parameter name change.

Ensure that all references to userOsmoAddress have been updated to userCosmosAddress throughout the codebase.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all references to `userOsmoAddress` have been updated to `userCosmosAddress`.

# Test: Search for the old parameter name. Expect: No occurrences.
rg --type ts 'userOsmoAddress'

Length of output: 12383


Tip

Codebase Verification

Update all references to userOsmoAddress to userCosmosAddress.

The following files still contain references to userOsmoAddress and need to be updated accordingly:

  • packages/trpc/src/parameter-types.ts
  • packages/trpc/src/pools.ts
  • packages/web/modals/one-click-trading-intro-modal.tsx
  • packages/web/modals/profile.tsx
  • packages/web/modals/superfluid-validator.tsx
  • packages/web/modals/lock-tokens.tsx
  • packages/stores/src/account/types.ts
  • packages/stores/src/account/message-composers/osmosis/poolmanager.ts
  • packages/stores/src/account/osmosis/index.ts
  • packages/trpc/src/assets.ts
  • packages/web/pages/earn/index.tsx
  • packages/trpc/src/one-click-trading.ts
  • packages/trpc/src/staking.ts
  • packages/trpc/src/earn.ts
  • packages/trpc/src/concentrated-liquidity.ts
  • packages/web/hooks/one-click-trading/use-one-click-trading-session.ts
  • packages/web/hooks/use-get-earn-strategies.ts
  • packages/web/hooks/use-swap.tsx
  • packages/web/hooks/mutations/one-click-trading/use-create-one-click-trading-session.tsx
  • packages/web/hooks/ui-config/use-superfluid-pool.ts
  • packages/web/hooks/mutations/one-click-trading/__tests__/use-create-one-click-trading-session.spec.ts
  • packages/web/components/cards/my-position/index.tsx
  • packages/web/components/your-balance/your-balance.tsx
  • packages/web/components/table/asset-balances.tsx
  • packages/web/components/pool-detail/concentrated.tsx
  • packages/web/components/pool-detail/share.tsx
  • packages/web/components/one-click-trading/one-click-trading-settings.tsx
  • packages/web/components/one-click-trading/profile-one-click-trading-settings.tsx
  • packages/web/components/one-click-trading/screens/spend-limit-screen.tsx
  • packages/web/components/navbar/index.tsx
  • packages/web/components/complex/portfolio-page.tsx
  • packages/web/components/earn/rewards/index.tsx
  • packages/web/components/complex/my-pools-card-grid.tsx
  • packages/web/components/bridge/immersive/asset-select-screen.tsx
  • packages/server/src/queries/data-services/earn.ts
  • packages/server/src/queries/complex/authenticators.ts
  • packages/server/src/queries/complex/earn/strategies.ts
  • packages/server/src/queries/complex/staking/user.ts
  • packages/server/src/queries/complex/concentrated-liquidity/index.ts
  • packages/server/src/queries/complex/__tests__/authenticators.spec.ts
  • packages/server/src/queries/complex/assets/user.ts

Please ensure that all occurrences are updated to maintain consistency across the codebase.

Analysis chain

Verify the parameter name change.

Ensure that all references to userOsmoAddress have been updated to userCosmosAddress throughout the codebase.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all references to `userOsmoAddress` have been updated to `userCosmosAddress`.

# Test: Search for the old parameter name. Expect: No occurrences.
rg --type ts 'userOsmoAddress'

Length of output: 12383

@@ -87,7 +87,7 @@ export const assetsRouter = createTRPCRouter({
mapGetAssetsWithUserBalances({
...ctx,
search,
userOsmoAddress,
userCosmosAddress: userOsmoAddress,
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Update all references to userOsmoAddress to userCosmosAddress.

The parameter name change from userOsmoAddress to userCosmosAddress has not been applied consistently. Please update the following files:

  • packages/trpc/src/parameter-types.ts
  • packages/trpc/src/assets.ts
  • packages/trpc/src/staking.ts
  • packages/trpc/src/pools.ts
  • packages/trpc/src/one-click-trading.ts
  • packages/trpc/src/concentrated-liquidity.ts
  • packages/trpc/src/earn.ts
  • packages/web/pages/earn/index.tsx
  • packages/server/src/queries/complex/concentrated-liquidity/index.ts
  • packages/server/src/queries/complex/assets/user.ts
  • packages/server/src/queries/complex/staking/user.ts
  • packages/server/src/queries/complex/earn/strategies.ts
  • packages/server/src/queries/complex/authenticators.ts
  • packages/server/src/queries/data-services/earn.ts
  • packages/server/src/queries/complex/__tests__/authenticators.spec.ts
  • packages/stores/src/account/types.ts
  • packages/stores/src/account/osmosis/index.ts
  • packages/stores/src/account/message-composers/osmosis/poolmanager.ts
  • packages/web/modals/profile.tsx
  • packages/web/modals/superfluid-validator.tsx
  • packages/web/modals/one-click-trading-intro-modal.tsx
  • packages/web/modals/lock-tokens.tsx
  • packages/web/components/pool-detail/share.tsx
  • packages/web/hooks/ui-config/use-superfluid-pool.ts
  • packages/web/components/your-balance/your-balance.tsx
  • packages/web/components/pool-detail/concentrated.tsx
  • packages/web/components/table/asset-balances.tsx
  • packages/web/hooks/use-swap.tsx
  • packages/web/components/one-click-trading/one-click-trading-settings.tsx
  • packages/web/components/one-click-trading/profile-one-click-trading-settings.tsx
  • packages/web/components/navbar/index.tsx
  • packages/web/components/one-click-trading/screens/spend-limit-screen.tsx
  • packages/web/hooks/use-get-earn-strategies.ts
  • packages/web/components/earn/rewards/index.tsx
  • packages/web/components/complex/my-positions-section.tsx
  • packages/web/components/complex/portfolio-page.tsx
  • packages/web/components/complex/my-pools-card-grid.tsx
  • packages/web/components/cards/my-position/index.tsx
  • packages/web/components/bridge/immersive/asset-select-screen.tsx
  • packages/web/hooks/one-click-trading/use-one-click-trading-session.ts
  • packages/web/hooks/mutations/one-click-trading/use-create-one-click-trading-session.tsx
  • packages/web/hooks/mutations/one-click-trading/__tests__/use-create-one-click-trading-session.spec.ts

Please ensure that all instances of userOsmoAddress are updated to userCosmosAddress to maintain consistency and avoid potential issues.

Analysis chain

Verify the parameter name change.

Ensure that all references to userOsmoAddress have been updated to userCosmosAddress throughout the codebase.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all references to `userOsmoAddress` have been updated to `userCosmosAddress`.

# Test: Search for the old parameter name. Expect: No occurrences.
rg --type ts 'userOsmoAddress'

Length of output: 12383

@@ -543,7 +543,7 @@ export const assetsRouter = createTRPCRouter({
...ctx,
search,
// Only get balances for withdraw
userOsmoAddress:
userCosmosAddress:
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Update all occurrences of userOsmoAddress to userCosmosAddress.

The parameter name change has not been fully propagated throughout the codebase. Here are the locations that still reference userOsmoAddress:

  • packages/trpc/src/parameter-types.ts
  • packages/trpc/src/assets.ts
  • packages/trpc/src/staking.ts
  • packages/trpc/src/pools.ts
  • packages/trpc/src/one-click-trading.ts
  • packages/trpc/src/earn.ts
  • packages/trpc/src/concentrated-liquidity.ts
  • packages/web/pages/earn/index.tsx
  • packages/web/hooks/use-swap.tsx
  • packages/web/hooks/ui-config/use-superfluid-pool.ts
  • packages/web/modals/superfluid-validator.tsx
  • packages/web/hooks/use-get-earn-strategies.ts
  • packages/web/hooks/one-click-trading/use-one-click-trading-session.ts
  • packages/web/hooks/mutations/one-click-trading/use-create-one-click-trading-session.tsx
  • packages/web/hooks/mutations/one-click-trading/__tests__/use-create-one-click-trading-session.spec.ts
  • packages/web/modals/profile.tsx
  • packages/web/modals/one-click-trading-intro-modal.tsx
  • packages/web/modals/lock-tokens.tsx
  • packages/web/components/pool-detail/concentrated.tsx
  • packages/web/components/pool-detail/share.tsx
  • packages/web/components/your-balance/your-balance.tsx
  • packages/web/components/table/asset-balances.tsx
  • packages/web/components/navbar/index.tsx
  • packages/web/components/one-click-trading/profile-one-click-trading-settings.tsx
  • packages/web/components/one-click-trading/one-click-trading-settings.tsx
  • packages/web/components/one-click-trading/screens/spend-limit-screen.tsx
  • packages/web/components/earn/rewards/index.tsx
  • packages/web/components/complex/my-positions-section.tsx
  • packages/web/components/cards/my-position/index.tsx
  • packages/web/components/complex/portfolio-page.tsx
  • packages/web/components/bridge/immersive/asset-select-screen.tsx
  • packages/web/components/complex/my-pools-card-grid.tsx
  • packages/server/src/queries/data-services/earn.ts
  • packages/server/src/queries/complex/__tests__/authenticators.spec.ts
  • packages/server/src/queries/complex/staking/user.ts
  • packages/server/src/queries/complex/concentrated-liquidity/index.ts
  • packages/server/src/queries/complex/earn/strategies.ts
  • packages/server/src/queries/complex/authenticators.ts
  • packages/server/src/queries/complex/assets/user.ts
  • packages/stores/src/account/types.ts
  • packages/stores/src/account/osmosis/index.ts
  • packages/stores/src/account/message-composers/osmosis/poolmanager.ts

Please ensure that all instances of userOsmoAddress are updated to userCosmosAddress.

Analysis chain

Verify the parameter name change.

Ensure that all references to userOsmoAddress have been updated to userCosmosAddress throughout the codebase.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all references to `userOsmoAddress` have been updated to `userCosmosAddress`.

# Test: Search for the old parameter name. Expect: No occurrences.
rg --type ts 'userOsmoAddress'

Length of output: 12383

@@ -55,7 +55,7 @@ export const assetsRouter = createTRPCRouter({
return await getAssetWithUserBalance({
...ctx,
asset,
userOsmoAddress,
userCosmosAddress: userOsmoAddress,
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Update all occurrences of userOsmoAddress to userCosmosAddress.

The parameter name userOsmoAddress has not been fully updated to userCosmosAddress throughout the codebase. Please ensure that all instances are updated accordingly.

Files to update:

  • packages/web/modals/lock-tokens.tsx
  • packages/web/modals/superfluid-validator.tsx
  • packages/web/modals/profile.tsx
  • packages/web/modals/one-click-trading-intro-modal.tsx
  • packages/web/pages/earn/index.tsx
  • packages/web/hooks/use-swap.tsx
  • packages/web/hooks/one-click-trading/use-one-click-trading-session.ts
  • packages/web/hooks/use-get-earn-strategies.ts
  • packages/web/hooks/mutations/one-click-trading/__tests__/use-create-one-click-trading-session.spec.ts
  • packages/web/hooks/ui-config/use-superfluid-pool.ts
  • packages/web/hooks/mutations/one-click-trading/use-create-one-click-trading-session.tsx
  • packages/web/components/table/asset-balances.tsx
  • packages/web/components/your-balance/your-balance.tsx
  • packages/web/components/cards/my-position/index.tsx
  • packages/web/components/navbar/index.tsx
  • packages/web/components/one-click-trading/profile-one-click-trading-settings.tsx
  • packages/web/components/one-click-trading/one-click-trading-settings.tsx
  • packages/web/components/pool-detail/share.tsx
  • packages/web/components/pool-detail/concentrated.tsx
  • packages/web/components/earn/rewards/index.tsx
  • packages/web/components/complex/my-positions-section.tsx
  • packages/web/components/complex/portfolio-page.tsx
  • packages/web/components/complex/my-pools-card-grid.tsx
  • packages/web/components/bridge/immersive/asset-select-screen.tsx
  • packages/trpc/src/earn.ts
  • packages/trpc/src/assets.ts
  • packages/trpc/src/parameter-types.ts
  • packages/trpc/src/staking.ts
  • packages/trpc/src/pools.ts
  • packages/trpc/src/concentrated-liquidity.ts
  • packages/trpc/src/one-click-trading.ts
  • packages/server/src/queries/data-services/earn.ts
  • packages/server/src/queries/complex/earn/strategies.ts
  • packages/server/src/queries/complex/concentrated-liquidity/index.ts
  • packages/server/src/queries/complex/staking/user.ts
  • packages/server/src/queries/complex/authenticators.ts
  • packages/server/src/queries/complex/assets/user.ts
  • packages/server/src/queries/complex/__tests__/authenticators.spec.ts
  • packages/stores/src/account/types.ts
  • packages/stores/src/account/message-composers/osmosis/poolmanager.ts
  • packages/stores/src/account/osmosis/index.ts
Analysis chain

Verify the parameter name change.

Ensure that all references to userOsmoAddress have been updated to userCosmosAddress throughout the codebase.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all references to `userOsmoAddress` have been updated to `userCosmosAddress`.

# Test: Search for the old parameter name. Expect: No occurrences.
rg --type ts 'userOsmoAddress'

Length of output: 12383

@@ -165,7 +165,7 @@ export const assetsRouter = createTRPCRouter({
const userAsset = await getAssetWithUserBalance({
...ctx,
asset,
userOsmoAddress,
userCosmosAddress: userOsmoAddress,
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Update all references to userOsmoAddress

The following instances of userOsmoAddress still exist in the codebase and need to be updated to userCosmosAddress:

  • packages/trpc/src/parameter-types.ts: userOsmoAddress: z.string().startsWith("osmo").optional(),
  • packages/trpc/src/assets.ts: Multiple occurrences
  • packages/trpc/src/staking.ts: bech32Address: input.userOsmoAddress,
  • packages/trpc/src/pools.ts: Multiple occurrences
  • packages/trpc/src/one-click-trading.ts: Multiple occurrences
  • packages/trpc/src/earn.ts: Multiple occurrences
  • packages/trpc/src/concentrated-liquidity.ts: Multiple occurrences
  • packages/web/pages/earn/index.tsx: Multiple occurrences
  • packages/web/modals/one-click-trading-intro-modal.tsx: account?.address !== oneClickTradingInfo?.userOsmoAddress
  • packages/web/modals/superfluid-validator.tsx: userOsmoAddress: account?.address ?? "",
  • packages/web/modals/profile.tsx: userOsmoAddress: wallet?.address ?? "",
  • packages/web/modals/lock-tokens.tsx: userOsmoAddress: address,
  • packages/web/components/your-balance/your-balance.tsx: Multiple occurrences
  • packages/web/components/pool-detail/share.tsx: Multiple occurrences
  • packages/web/components/pool-detail/concentrated.tsx: userOsmoAddress: account?.address ?? "",
  • packages/web/components/table/asset-balances.tsx: userOsmoAddress: account?.address,
  • packages/web/hooks/use-swap.tsx: Multiple occurrences
  • packages/web/components/one-click-trading/screens/spend-limit-screen.tsx: userOsmoAddress: account?.address as string,
  • packages/web/components/one-click-trading/profile-one-click-trading-settings.tsx: userOsmoAddress: account?.address ?? "",
  • packages/web/components/one-click-trading/one-click-trading-settings.tsx: Multiple occurrences
  • packages/web/components/navbar/index.tsx: userOsmoAddress: wallet?.address as string,
  • packages/web/hooks/use-get-earn-strategies.ts: Multiple occurrences
  • packages/web/components/bridge/immersive/asset-select-screen.tsx: userOsmoAddress: wallet?.address,
  • packages/web/components/complex/my-positions-section.tsx: userOsmoAddress: account?.address ?? "",
  • packages/web/components/complex/portfolio-page.tsx: Multiple occurrences
  • packages/web/components/complex/my-pools-card-grid.tsx: userOsmoAddress: account?.address ?? "",
  • packages/web/components/cards/my-position/index.tsx: userOsmoAddress: account?.address ?? "",
  • packages/web/components/earn/rewards/index.tsx: userOsmoAddress: account.address ?? "",
  • packages/web/hooks/ui-config/use-superfluid-pool.ts: userOsmoAddress: address,
  • packages/web/hooks/one-click-trading/use-one-click-trading-session.ts: info?.userOsmoAddress !== account?.address
  • packages/web/hooks/mutations/one-click-trading/use-create-one-click-trading-session.tsx: Multiple occurrences
  • packages/web/hooks/mutations/one-click-trading/__tests__/use-create-one-click-trading-session.spec.ts: Multiple occurrences
  • packages/server/src/queries/data-services/earn.ts: Multiple occurrences
  • packages/server/src/queries/complex/authenticators.ts: Multiple occurrences
  • packages/server/src/queries/complex/staking/user.ts: Multiple occurrences
  • packages/server/src/queries/complex/concentrated-liquidity/index.ts: Multiple occurrences
  • packages/server/src/queries/complex/earn/strategies.ts: Multiple occurrences
  • packages/server/src/queries/complex/assets/user.ts: Multiple occurrences
  • packages/server/src/queries/complex/__tests__/authenticators.spec.ts: Multiple occurrences
  • packages/stores/src/account/types.ts: readonly userOsmoAddress: string;
  • packages/stores/src/account/message-composers/osmosis/poolmanager.ts: Multiple occurrences
  • packages/stores/src/account/osmosis/index.ts: Multiple occurrences

Please update all the above references to userCosmosAddress.

Analysis chain

Verify the parameter name change.

Ensure that all references to userOsmoAddress have been updated to userCosmosAddress throughout the codebase.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all references to `userOsmoAddress` have been updated to `userCosmosAddress`.

# Test: Search for the old parameter name. Expect: No occurrences.
rg --type ts 'userOsmoAddress'

Length of output: 12383

@JoseRFelix JoseRFelix merged commit 2147cc3 into stage Jul 1, 2024
28 checks passed
@JoseRFelix JoseRFelix deleted the jose/fe-575-fetch-bridge-providers-quote branch July 1, 2024 22:16
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