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

Fix/liquidity #193

Open
wants to merge 912 commits into
base: main
Choose a base branch
from
Open

Conversation

btcSteven
Copy link

Fix liquidity bug & add balance components

Copy link

@skylinezum skylinezum left a comment

Choose a reason for hiding this comment

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

change the || operator to ?? to allow 0 values in balance components.

<HStack w="256px" py={2} fontSize="13px" justify="space-between">
<Flex gap={1}>
<Text fontWeight="semibold">
Balance: {osmoBalance?.amount || '--'}

Choose a reason for hiding this comment

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

.amount == 0 will set balance to --. Change to ?? coalescing nullish.

Copy link
Author

Choose a reason for hiding this comment

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

ok , {osmoBalance?.amount ?? '--'}

</Flex>
<Flex gap={1}>
<Text fontWeight="semibold">
Staked: {balanceStaked?.amount || '--'}

Choose a reason for hiding this comment

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

Change to ?? coalescing nullish.

Copy link
Author

Choose a reason for hiding this comment

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

ok i ll fix it at stark-tech-space/create-cosmos-app,

@@ -59,6 +67,26 @@ export const WalletSection = () => {
openView();
};

const getBalance = async () => {
const client = await getSigningStargateClient();
const balance = await client?.getBalance(address as string, 'OSMO');
Copy link
Contributor

Choose a reason for hiding this comment

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

OSMO, is this part of the API to use symbols?

Copy link
Contributor

Choose a reason for hiding this comment

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

ideally we can use uosmo, but maybe it's the API. I'm curious for sure ;)

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, denom is uosmo, not OSMO right?

Copy link
Author

Choose a reason for hiding this comment

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

sorry, I made a mistake, it is uosmo,
image

Copy link
Author

Choose a reason for hiding this comment

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

].filter(({ type_asset }) => type_asset !== 'ics20');

export const osmosisAssetsList: AssetList[] = [
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't we just import the assets? Why are we making a new one?

chain_name: 'osmosis',
},
];
// console.log(asset_list, assets, osmosisAssetsList);
export const getOsmoAssetByDenom = (denom: CoinDenom): Asset => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think ideally, we don't rebuild new methods here, we should either

  1. use the chain-registry/utils and pass the word osmosis for chain_name, or use the chain-registry/client ChainRegistryClient class

AND/OR

  1. use https://github.com/osmosis-labs/osmojs/tree/main/packages/math which I think has a lot of these methods, also

Copy link
Author

Choose a reason for hiding this comment

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

e, I tested it.

import { asset_list, assets } from '@chain-registry/osmosis';

export const osmosisAssets: Asset[] = [
  ...assets.assets,
  ...asset_list.assets.filter((item) => item.display != 'usdc'),
].filter(({ type_asset }) => type_asset !== 'ics20');

export const osmosisAssetsList: AssetList[] = [
  {
    assets: osmosisAssets,
    chain_name: 'osmosis',
  },
];

The previous developers had a reason to merge assets and asset_list. If you only use asset_list, some assets might not be found.

if not merge


import { asset_list, assets } from '@chain-registry/osmosis';
export const osmosisAssets: Asset[] =  assets.filter(({ type_asset }) => type_asset !== 'ics20');
const osmosisAssetsList = [asset_list];

image

@btcSteven btcSteven closed this Jul 8, 2024
@btcSteven btcSteven reopened this Jul 8, 2024
@btcSteven
Copy link
Author

btcSteven commented Jul 18, 2024

image

okay, I Fix it @pyramation

stark-tech-space#3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants