-
Notifications
You must be signed in to change notification settings - Fork 415
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
Conversation
…ical-asset-selection
…ical-asset-selection
The latest updates on your projects. Learn more about Vercel for Git ↗︎
4 Ignored Deployments
|
There was a problem hiding this 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, |
There was a problem hiding this comment.
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
packages/web/localizations/en.json
Outdated
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the flatMap
?
There was a problem hiding this comment.
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(() => { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this 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 = { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
bridgeChainSchema.and(bridgeAssetSchema).and( | ||
z.object({ | ||
supportedVariants: z.array(z.string()), | ||
supportedProviders: z.array( |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
const bridgeProviders = new BridgeProviders( | ||
process.env.NEXT_PUBLIC_SQUID_INTEGRATOR_ID!, | ||
{ | ||
...ctx, | ||
env: IS_TESTNET ? "testnet" : "mainnet", | ||
cache: lruCache, | ||
getTimeoutHeight: ({ destinationAddress }) => | ||
getTimeoutHeight({ ...ctx, destinationAddress }), | ||
} | ||
); |
There was a problem hiding this comment.
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
const { | ||
price: assetInOsmosisPrice, | ||
isLoading: isLoadingCanonicalAssetPrice, | ||
} = usePrice( |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
BTW build is failing with several build errors |
WalkthroughThe 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 Changes
Recent review detailsConfiguration used: CodeRabbit UI Files ignored due to path filters (23)
Files selected for processing (57)
Files not processed due to max files limit (1)
Files not reviewed due to errors (2)
Files skipped from review due to trivial changes (4)
Additional context usedBiome
Additional comments not posted (80)
Tip Early access features: enabledWe are currently testing the following features in early access:
Note:
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this 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 aform
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 VerificationUpdate function calls to match the new signature
The function calls to
mapGetAssetsWithUserBalances
inpackages/trpc/src/assets.ts
still useuserOsmoAddress
. They need to be updated to useuserCosmosAddress
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 usinguserCosmosAddress
.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 3Length of output: 3003
[!TIP]
Codebase VerificationUpdate function calls to match the new signature
The function
getAssetWithUserBalance
should useuserCosmosAddress
instead ofuserOsmoAddress
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 usinguserCosmosAddress
.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.tsLength 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 redundantBoolean
call.The
Boolean
call is redundant as the value will already be coerced to a boolean.- Boolean(downloadInfo) + downloadInfopackages/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 redundantBoolean
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 unnecessarycontinue
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 redundantelse
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 redundantelse
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 redundantBoolean
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 redundantBoolean
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)) { |
There was a problem hiding this comment.
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.
} else if (Boolean(someError)) { | |
} else if (someError) { |
Tools
Biome
[error] 596-596: Avoid redundant
Boolean
callIt is not necessary to use
Boolean
call when a value will already be coerced to a boolean.
Unsafe fix: Remove redundantBoolean
call(lint/complexity/noExtraBooleanCast)
export const DrawerOverlay: FunctionComponent< | ||
HTMLProps<HTMLDivElement> | ||
> = () => { | ||
export const DrawerOverlay: FunctionComponent = () => { |
There was a problem hiding this comment.
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.
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; |
There was a problem hiding this comment.
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.
return balance; | |
return balance.toString(); |
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> | ||
); |
There was a problem hiding this comment.
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.
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"; |
There was a problem hiding this comment.
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.
<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)} | ||
> |
There was a problem hiding this comment.
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.
<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)
} 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, | ||
}; | ||
} |
There was a problem hiding this comment.
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.
} 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)
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 }), | ||
} | ||
); |
There was a problem hiding this comment.
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.
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"> |
There was a problem hiding this comment.
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.
<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)
<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} | ||
> |
There was a problem hiding this comment.
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.
<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)
There was a problem hiding this 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 forgetChain
Function.The
getChain
function call within thequery
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 callIt 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 typeProvide 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. UseNumber.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 redundantBoolean
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
: OptimizeuseEffect
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 redundantBoolean
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)} ...>
<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)} | ||
> |
There was a problem hiding this comment.
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.
<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"> |
There was a problem hiding this comment.
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.
<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, |
There was a problem hiding this comment.
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.
* "chainId": 1, | |
* "chainId": 1, | |
search: search |
coinMinimalDenom: asset.denom, | ||
}, | ||
new Dec(0) | ||
), |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 occurrencespackages/trpc/src/staking.ts
: bech32Address: input.userOsmoAddress,packages/trpc/src/pools.ts
: Multiple occurrencespackages/trpc/src/one-click-trading.ts
: Multiple occurrencespackages/trpc/src/earn.ts
: Multiple occurrencespackages/trpc/src/concentrated-liquidity.ts
: Multiple occurrencespackages/web/pages/earn/index.tsx
: Multiple occurrencespackages/web/modals/one-click-trading-intro-modal.tsx
: account?.address !== oneClickTradingInfo?.userOsmoAddresspackages/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 occurrencespackages/web/components/pool-detail/share.tsx
: Multiple occurrencespackages/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 occurrencespackages/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 occurrencespackages/web/components/navbar/index.tsx
: userOsmoAddress: wallet?.address as string,packages/web/hooks/use-get-earn-strategies.ts
: Multiple occurrencespackages/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 occurrencespackages/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?.addresspackages/web/hooks/mutations/one-click-trading/use-create-one-click-trading-session.tsx
: Multiple occurrencespackages/web/hooks/mutations/one-click-trading/__tests__/use-create-one-click-trading-session.spec.ts
: Multiple occurrencespackages/server/src/queries/data-services/earn.ts
: Multiple occurrencespackages/server/src/queries/complex/authenticators.ts
: Multiple occurrencespackages/server/src/queries/complex/staking/user.ts
: Multiple occurrencespackages/server/src/queries/complex/concentrated-liquidity/index.ts
: Multiple occurrencespackages/server/src/queries/complex/earn/strategies.ts
: Multiple occurrencespackages/server/src/queries/complex/assets/user.ts
: Multiple occurrencespackages/server/src/queries/complex/__tests__/authenticators.spec.ts
: Multiple occurrencespackages/stores/src/account/types.ts
: readonly userOsmoAddress: string;packages/stores/src/account/message-composers/osmosis/poolmanager.ts
: Multiple occurrencespackages/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
What is the purpose of the change:
Linear Task
Linear Task URL