-
Notifications
You must be signed in to change notification settings - Fork 49
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
base: main
Are you sure you want to change the base?
Fix/liquidity #193
Conversation
- @cosmology/[email protected]
- @cosmology/[email protected] - @cosmology/[email protected]
update copy for templates
add build:dev and docs
…e-multi-chain-style fix: upgrade deps and fix multi chain dropdown
…mos-kit-cosmjs upgrades
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.
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 || '--'} |
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.
.amount
== 0
will set balance to --
. Change to ?? coalescing nullish.
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.
ok , {osmoBalance?.amount ?? '--'}
</Flex> | ||
<Flex gap={1}> | ||
<Text fontWeight="semibold"> | ||
Staked: {balanceStaked?.amount || '--'} |
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.
Change to ?? coalescing nullish.
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.
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'); |
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.
OSMO
, is this part of the API to use symbols?
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.
ideally we can use uosmo
, but maybe it's the API. I'm curious for sure ;)
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.
https://cosmos.github.io/cosmjs/latest/stargate/classes/StargateClient.html#getBalanceStaked
getBalance function use denom not symbol
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.
yes, denom is uosmo
, not OSMO
right?
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.
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.
].filter(({ type_asset }) => type_asset !== 'ics20'); | ||
|
||
export const osmosisAssetsList: AssetList[] = [ |
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.
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 => { |
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 think ideally, we don't rebuild new methods here, we should either
- use the chain-registry/utils and pass the word osmosis for chain_name, or use the chain-registry/client ChainRegistryClient class
AND/OR
- use https://github.com/osmosis-labs/osmojs/tree/main/packages/math which I think has a lot of these methods, also
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.
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];
okay, I Fix it @pyramation |
3e288bd
to
50c5a2a
Compare
Fix liquidity bug & add balance components