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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4f805ca
feat: display immersive bridge assets
JoseRFelix Jun 19, 2024
252e0d0
feat: display selected asset
JoseRFelix Jun 20, 2024
b0f1c8a
Merge remote-tracking branch 'origin/stage' into jose/fe-453-ui-canon…
JoseRFelix Jun 20, 2024
9b462f8
feat: add skeleton loader to amount screen
JoseRFelix Jun 20, 2024
681c4e3
feat: handle back button, and improve amount input
JoseRFelix Jun 20, 2024
c1136b0
fix: pagination test
JoseRFelix Jun 20, 2024
2947d22
Merge remote-tracking branch 'origin/stage' into jose/fe-453-ui-canon…
JoseRFelix Jun 20, 2024
39124f2
fix: type
JoseRFelix Jun 20, 2024
2b8924c
fix: more bridge options
JoseRFelix Jun 20, 2024
f653001
improvement: @jonator feedback
JoseRFelix Jun 24, 2024
9135ad1
improvement: @jonator feedback
JoseRFelix Jun 24, 2024
566e72a
feat: aggregate chains and assets
JoseRFelix Jun 24, 2024
1162d59
feat: merge assets by chain id
JoseRFelix Jun 25, 2024
84e92fa
feat: aggregate assets display them initially on amount screen
JoseRFelix Jun 25, 2024
2e8524e
feat: add local bridge transfer router
JoseRFelix Jun 26, 2024
1e60d72
feat: use supported asset as source asset
JoseRFelix Jun 27, 2024
bb6245b
improvement: type fix
JoseRFelix Jun 27, 2024
acdccec
feat: handle wallets in immersive bridge
JoseRFelix Jun 27, 2024
11e6be5
feat: handle connection edge cases
JoseRFelix Jun 27, 2024
27f7677
feat: set up wallet connection from immersive bridge
JoseRFelix Jun 28, 2024
63570fa
feat: create initial use bridge quote hook
JoseRFelix Jun 28, 2024
c1ceb71
Merge remote-tracking branch 'origin/stage' into jose/fe-453-ui-canon…
JoseRFelix Jun 28, 2024
f29a97b
improvement: @jonator feedback
JoseRFelix Jun 28, 2024
2868eba
feat: remove source denom from minimal asset
JoseRFelix Jun 28, 2024
8be9aa4
test: update snapshots
JoseRFelix Jun 28, 2024
3d5bb06
Merge remote-tracking branch 'origin/jose/fe-453-ui-canonical-asset-s…
JoseRFelix Jun 28, 2024
b838ad5
Merge remote-tracking branch 'origin/stage' into jose/fe-453-ui-canon…
JoseRFelix Jun 28, 2024
0fdeb42
Merge remote-tracking branch 'origin/jose/fe-453-ui-canonical-asset-s…
JoseRFelix Jun 28, 2024
8981144
feat: receive quote from input
JoseRFelix Jun 29, 2024
fb38d8e
fix: build
JoseRFelix Jun 29, 2024
42873d2
Merge remote-tracking branch 'origin/stage' into jose/fe-575-fetch-br…
JoseRFelix Jun 29, 2024
3564c49
feat: display quote remaining time
JoseRFelix Jun 29, 2024
3a42b4b
feat: add provider details
JoseRFelix Jun 30, 2024
9e9541a
test: update snapshot
JoseRFelix Jun 30, 2024
ce88df4
fix: translation
JoseRFelix Jun 30, 2024
0b80ced
feat: add bridge provider dropdown
JoseRFelix Jul 1, 2024
ad185a5
feat: add details icons and tooltips
JoseRFelix Jul 1, 2024
55007b6
fix build
jonator Jul 1, 2024
28192b8
fix tests & build
jonator Jul 1, 2024
1f01db5
feat: add amount and confirmation screen
JoseRFelix Jul 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/bridge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"cachified": "^3.5.4",
"long": "^5.2.3",
"lru-cache": "^10.0.1",
"viem": "2.13.3",
"viem": "2.16.4",
"zod": "^3.22.4"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import {
AxelarQueryAPI,
} from "@axelar-network/axelarjs-sdk";
import { estimateGasFee } from "@osmosis-labs/tx";
import { NativeEVMTokenConstantAddress } from "@osmosis-labs/utils";
import { CacheEntry } from "cachified";
import { LRUCache } from "lru-cache";
// eslint-disable-next-line import/no-extraneous-dependencies
import { rest } from "msw";

import { MockAssetLists } from "../../__tests__/mock-asset-lists";
import { server } from "../../__tests__/msw";
import { NativeEVMTokenConstantAddress } from "../../ethereum";
import { BridgeProviderContext } from "../../interface";
import { AxelarBridgeProvider } from "../index";
import {
Expand Down
7 changes: 5 additions & 2 deletions packages/bridge/src/axelar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import { CoinPretty, Dec } from "@keplr-wallet/unit";
import { ibcProtoRegistry } from "@osmosis-labs/proto-codecs";
import { estimateGasFee } from "@osmosis-labs/tx";
import type { IbcTransferMethod } from "@osmosis-labs/types";
import { getAssetFromAssetList } from "@osmosis-labs/utils";
import {
EthereumChainInfo,
getAssetFromAssetList,
NativeEVMTokenConstantAddress,
} from "@osmosis-labs/utils";
import { cachified } from "cachified";
import {
Address,
Expand All @@ -19,7 +23,6 @@ import {
} from "viem";

import { BridgeQuoteError } from "../errors";
import { EthereumChainInfo, NativeEVMTokenConstantAddress } from "../ethereum";
import {
BridgeAsset,
BridgeChain,
Expand Down
6 changes: 3 additions & 3 deletions packages/bridge/src/axelar/tokens.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { SourceChain } from "../chain";
import { EthereumChainInfo } from "../ethereum";
import { AxelarSourceChain, EthereumChainInfo } from "@osmosis-labs/utils";
Copy link
Contributor

Choose a reason for hiding this comment

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

Add @deprecated tag for the import.

The import should be marked as deprecated to indicate that it will be removed in the future.

- import { AxelarSourceChain, EthereumChainInfo } from "@osmosis-labs/utils";
+/** @deprecated Prefer using Axelar chain/asset list API via bridge providers instead */
+import { AxelarSourceChain, EthereumChainInfo } from "@osmosis-labs/utils";
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
import { AxelarSourceChain, EthereumChainInfo } from "@osmosis-labs/utils";
/** @deprecated Prefer using Axelar chain/asset list API via bridge providers instead */
import { AxelarSourceChain, EthereumChainInfo } from "@osmosis-labs/utils";


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

/** @deprecated Prefer using Axelar chain/asset list API via bridge providers instead */
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

/** Source Chain identifier. */
id: SourceChain;
id: AxelarSourceChain;
chainId?: number;
/** Address of origin ERC20 token for that origin chain. Leave blank to
* prefer native ETH currency if `id` is not a Cosmos chain in `ChainInfo`.
Expand Down
22 changes: 0 additions & 22 deletions packages/bridge/src/chain.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/bridge/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from "./axelar";
export * from "./bridge-providers";
export * from "./chain";
export * from "./errors";
export * from "./ibc";
export * from "./interface";
Expand Down
9 changes: 6 additions & 3 deletions packages/bridge/src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ const evmChainSchema = z.object({
chainType: z.literal("evm"),
});

const bridgeChainSchema = z.union([cosmosChainSchema, evmChainSchema]);
export const bridgeChainSchema = z.discriminatedUnion("chainType", [
cosmosChainSchema,
evmChainSchema,
]);

export type BridgeChain = z.infer<typeof bridgeChainSchema>;

Expand All @@ -154,7 +157,7 @@ export interface BridgeStatus {
maintenanceMessage?: string;
}

const bridgeAssetSchema = z.object({
export const bridgeAssetSchema = z.object({
/**
* The displayable denomination of the asset.
*/
Expand All @@ -171,7 +174,7 @@ const bridgeAssetSchema = z.object({

export type BridgeAsset = z.infer<typeof bridgeAssetSchema>;

const getBridgeSupportedAssetsParams = z.object({
export const getBridgeSupportedAssetsParams = z.object({
/**
* The originating chain information.
*/
Expand Down
12 changes: 8 additions & 4 deletions packages/bridge/src/skip/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { Registry } from "@cosmjs/proto-signing";
import { ibcProtoRegistry } from "@osmosis-labs/proto-codecs";
import { estimateGasFee } from "@osmosis-labs/tx";
import { CosmosCounterparty, EVMCounterparty } from "@osmosis-labs/types";
import { isNil } from "@osmosis-labs/utils";
import {
EthereumChainInfo,
isNil,
NativeEVMTokenConstantAddress,
} from "@osmosis-labs/utils";
import cachified from "cachified";
import {
Address,
Expand All @@ -18,7 +22,6 @@ import {
} from "viem";

import { BridgeQuoteError } from "../errors";
import { EthereumChainInfo, NativeEVMTokenConstantAddress } from "../ethereum";
import {
BridgeAsset,
BridgeChain,
Expand Down Expand Up @@ -311,6 +314,7 @@ export class SkipBridgeProvider implements BridgeProvider {
...chainInfo,
address: sharedOriginAsset.denom,
denom:
sharedOriginAsset.recommended_symbol ??
sharedOriginAsset.symbol ??
sharedOriginAsset.name ??
sharedOriginAsset.denom,
Expand Down Expand Up @@ -756,9 +760,9 @@ export class SkipBridgeProvider implements BridgeProvider {

const url = new URL("https://ibc.fun/");
url.searchParams.set("src_chain", String(fromChain.chainId));
url.searchParams.set("src_asset", fromAsset.address);
url.searchParams.set("src_asset", fromAsset.address.toLowerCase());
url.searchParams.set("dest_chain", String(toChain.chainId));
url.searchParams.set("dest_asset", toAsset.address);
url.searchParams.set("dest_asset", toAsset.address.toLowerCase());

return { urlProviderName: "IBC.fun", url };
}
Expand Down
9 changes: 7 additions & 2 deletions packages/bridge/src/squid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ import {
} from "@0xsquid/sdk";
import { Dec } from "@keplr-wallet/unit";
import { CosmosCounterparty, EVMCounterparty } from "@osmosis-labs/types";
import { apiClient, ApiClientError, isNil } from "@osmosis-labs/utils";
import {
apiClient,
ApiClientError,
EthereumChainInfo,
isNil,
NativeEVMTokenConstantAddress,
} from "@osmosis-labs/utils";
import { cachified } from "cachified";
import Long from "long";
import {
Expand All @@ -21,7 +27,6 @@ import {
} from "viem";

import { BridgeQuoteError } from "../errors";
import { EthereumChainInfo, NativeEVMTokenConstantAddress } from "../ethereum";
import {
BridgeAsset,
BridgeChain,
Expand Down
3 changes: 2 additions & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"jest-util": "^29.7.0",
"lru-cache": "^10.0.1",
"superjson": "^2.2.1",
"zod": "^3.22.4"
"zod": "^3.22.4",
"viem": "2.16.4"
},
"devDependencies": {
"@types/jest-in-case": "^1.0.6",
Expand Down
22 changes: 11 additions & 11 deletions packages/server/src/queries/complex/assets/__tests__/assets.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,6 @@ describe("getAssetWithVariants", () => {

expect(result).toMatchInlineSnapshot(`
[
{
"coinDecimals": 6,
"coinDenom": "USDC",
"coinGeckoId": "usd-coin",
"coinImageUrl": "/tokens/generated/usdc.svg",
"coinMinimalDenom": "ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4",
"coinName": "USDC",
"isUnstable": false,
"isVerified": true,
"variantGroupKey": "USDC",
},
{
"coinDecimals": 6,
"coinDenom": "USDC.axl",
Expand Down Expand Up @@ -150,6 +139,17 @@ describe("getAssetWithVariants", () => {
"isVerified": true,
"variantGroupKey": "USDC",
},
{
"coinDecimals": 6,
"coinDenom": "USDC",
"coinGeckoId": "usd-coin",
"coinImageUrl": "/tokens/generated/usdc.svg",
"coinMinimalDenom": "ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4",
"coinName": "USDC",
"isUnstable": false,
"isVerified": true,
"variantGroupKey": "USDC",
},
{
"coinDecimals": 6,
"coinDenom": "USDC.wh",
Expand Down
40 changes: 40 additions & 0 deletions packages/server/src/queries/complex/assets/ethereum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import {
EthereumChainInfo,
NativeEVMTokenConstantAddress,
} from "@osmosis-labs/utils";
import { Address, createPublicClient, erc20Abi, http } from "viem";

export async function getEvmBalance({
address,
userAddress,
chainId,
}: {
address: string;
userAddress: string;
chainId: number;
}) {
Comment on lines +7 to +15
Copy link
Contributor

Choose a reason for hiding this comment

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

Improve type safety for function parameters.

The function parameters can be improved by defining a TypeScript interface for the input object.

interface GetEvmBalanceParams {
  address: string;
  userAddress: string;
  chainId: number;
}

export async function getEvmBalance({
  address,
  userAddress,
  chainId,
}: GetEvmBalanceParams) {
  // function body
}

const evmChain = Object.values(EthereumChainInfo).find(
(chain) => String(chain.id) === String(chainId)
);

if (!evmChain) {
throw new Error(`Chain with id ${chainId} not found`);
}
Comment on lines +20 to +22
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure consistent error messages.

The error message should include more context to help with debugging.

- throw new Error(`Chain with id ${chainId} not found`);
+ throw new Error(`Ethereum chain with id ${chainId} not found in EthereumChainInfo`);
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
if (!evmChain) {
throw new Error(`Chain with id ${chainId} not found`);
}
if (!evmChain) {
throw new Error(`Ethereum chain with id ${chainId} not found in EthereumChainInfo`);
}


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

const balance =
address === NativeEVMTokenConstantAddress
? await publicClient.getBalance({ address: userAddress as Address })
: await publicClient.readContract({
abi: erc20Abi,
address: address as Address,
functionName: "balanceOf",
args: [userAddress as Address],
});
Comment on lines +29 to +37
Copy link
Contributor

Choose a reason for hiding this comment

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

Handle potential errors in contract calls.

Ensure that potential errors in contract calls are handled gracefully.

let balance;
try {
  balance =
    address === NativeEVMTokenConstantAddress
      ? await publicClient.getBalance({ address: userAddress as Address })
      : await publicClient.readContract({
          abi: erc20Abi,
          address: address as Address,
          functionName: "balanceOf",
          args: [userAddress as Address],
        });
} catch (error) {
  console.error(`Failed to fetch balance for address ${address}: ${error.message}`);
  throw error;
}


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();

}
3 changes: 2 additions & 1 deletion packages/server/src/queries/complex/assets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function getAssetWithVariants({
return (
variants
// place the canonical asset at the beginning
.sort((a) => (a.coinDenom === asset.variantGroupKey ? -1 : 1))
.sort((a) => (a.coinMinimalDenom === asset.variantGroupKey ? -1 : 1))
Copy link
Contributor

Choose a reason for hiding this comment

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

Omit the redundant else clause in the sort operation.

The else clause is redundant because the previous branch breaks early.

- .sort((a) => (a.coinMinimalDenom === asset.variantGroupKey ? -1 : 1))
+ .sort((a) => a.coinMinimalDenom === asset.variantGroupKey ? -1 : 1)
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
.sort((a) => (a.coinMinimalDenom === asset.variantGroupKey ? -1 : 1))
.sort((a) => a.coinMinimalDenom === asset.variantGroupKey ? -1 : 1)

);
}

Expand Down Expand Up @@ -193,6 +193,7 @@ function filterAssetList(
export * from "./bridge";
export * from "./categories";
export * from "./config";
export * from "./ethereum";
export * from "./gas";
export * from "./market";
export * from "./price";
Expand Down
16 changes: 8 additions & 8 deletions packages/server/src/queries/complex/assets/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ export async function getAssetWithUserBalance<TAsset extends MinimalAsset>({
assetLists,
chainList,
asset,
userOsmoAddress,
userCosmosAddress,
}: {
assetLists: AssetList[];
chainList: Chain[];
asset: TAsset;
userOsmoAddress?: string;
userCosmosAddress?: string;
}): Promise<TAsset & MaybeUserAssetCoin> {
if (!userOsmoAddress) return asset;
if (!userCosmosAddress) return asset;

const userAssets = await mapGetAssetsWithUserBalances({
assetLists,
chainList,
assets: [asset],
userOsmoAddress,
userCosmosAddress: userCosmosAddress,
includePreview: true,
});
return userAssets[0];
Expand All @@ -62,14 +62,14 @@ export async function mapGetAssetsWithUserBalances<
assetLists: AssetList[];
chainList: Chain[];
assets?: TAsset[];
userOsmoAddress?: string;
userCosmosAddress?: string;
sortFiatValueDirection?: SortDirection;
/**
* If poolId is provided, only include assets that are part of the pool.
*/
poolId?: string;
} & AssetFilter): Promise<(TAsset & MaybeUserAssetCoin)[]> {
const { userOsmoAddress, search, sortFiatValueDirection } = params;
const { userCosmosAddress, search, sortFiatValueDirection } = params;
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(userCosmosAddress)) return assets;
+  if (!userCosmosAddress) return assets;

Committable suggestion was skipped due to low confidence.

let { assets } = params;
if (!assets) assets = getAssets(params) as TAsset[];

Expand All @@ -87,11 +87,11 @@ export async function mapGetAssetsWithUserBalances<
) as TAsset[];
}

if (!userOsmoAddress) return assets;
if (!userCosmosAddress) return assets;

const { balances } = await queryBalances({
...params,
bech32Address: userOsmoAddress,
bech32Address: userCosmosAddress,
});

const eventualUserAssets = assets
Expand Down
12 changes: 6 additions & 6 deletions packages/trpc/src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

});
}
),
Expand Down Expand Up @@ -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

onlyVerified,
sortFiatValueDirection: "desc",
includePreview,
Expand Down Expand Up @@ -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

});
const userMarketAsset = await getMarketAsset({
asset: userAsset,
Expand Down Expand Up @@ -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

includePreview,
});

Expand Down Expand Up @@ -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

type === "withdraw" ? userOsmoAddress : undefined,
sortFiatValueDirection: "desc",
includePreview,
Expand Down Expand Up @@ -571,7 +571,7 @@ export const assetsRouter = createTRPCRouter({
asset.variantGroupKey as (typeof variantsNotToBeExcluded)[number]
)
) {
return asset.variantGroupKey === asset.coinDenom;
return asset.variantGroupKey === asset.coinMinimalDenom;
}

return true;
Expand Down
Loading