-
Notifications
You must be signed in to change notification settings - Fork 106
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
feat: use namada registry + IBC decoding fixes #1240
Conversation
357ccf1
to
338041f
Compare
338041f
to
a3adf75
Compare
@@ -189,13 +189,16 @@ export type ChainRegistryEntry = { | |||
ibc: IBCInfo[]; | |||
}; | |||
|
|||
export type AddressWithAssetAndBalance = { | |||
address: string; | |||
export type AddressWithAsset = { |
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.
To simplify some names, I think we could call this as Token
, wdyt?
My reference is the tokens.toml
files that is used by the cli, that is basically the tnam...
address plus some properties
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.
Not sure if Token should be the best name for it, but I agree we should simplify this name. What about AssetRegistry
?
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 definitely agree the names I used are not very good. I'm not sure about Token
since I think we have other things named similar to Token (but maybe those are not needed now, I have to check). AssetRegistry
makes me think more of the full registry, like cosmos/chain-registry.
For now, I created #1244 to track this and I think it should be fairly easy to change the names when we settle on something.
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 ChatGPT recommendations:
- AssetRecord (address and asset only) and AssetAmountRecord (address, asset, and amount)
- AssetReference (address and asset only) and AssetAmountEntry (address, asset, and amount)
- ResolvedAsset (address and asset only) and ResolvedAssetAmount (address, asset, and amount)
- TokenEntry (address and asset only) and TokenAmountEntry (address, asset, and amount)
I'm not sure about these since they don't indicate that there is an original address, but maybe they're OK.
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.
Amazing PR! Just a few comments on variables / property names! Great work 🚀
export type AddressWithAssetAndBalanceMap = Record< | ||
string, | ||
AddressWithAssetAndBalance | ||
export type AddressWithAssetAndAmount = AddressWithAsset & { |
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.
Still on names, maybe this one could be something like FungibleAsset
(?) . We will need to differentiate this in the future for nfts
@@ -189,13 +189,16 @@ export type ChainRegistryEntry = { | |||
ibc: IBCInfo[]; | |||
}; | |||
|
|||
export type AddressWithAssetAndBalance = { | |||
address: string; | |||
export type AddressWithAsset = { |
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.
Not sure if Token should be the best name for it, but I agree we should simplify this name. What about AssetRegistry
?
@@ -44,7 +44,8 @@ export const getTransactionFee = ( | |||
if (typeof asset !== "undefined") { | |||
return { | |||
amount: BigNumber(0.003), // TODO: remove hardcoding | |||
token: asset, | |||
asset, | |||
address: asset.base, |
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.
Sorry, reading the code, this property name seems to be more suitable to something like denom
or base
, once it's not handling the asset address. We might get confused in the future
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 have added this to #1244 for tracking. I think one problem is that denom
, base
and address
all exist on the Asset
type, but what we are calling the address might actually be none of those things. The intention of the property is to be "the thing we pass to Namada/Cosmos SDK to tell it what to transfer", but I have no idea what to call that 😄
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 make this originalAddress
so it's hopefully less confusing, but this can just be a placeholder until we get something better.
fb265df
to
799e84c
Compare
This PR integrates Namadillo with Namada registry, as well as fixing some other things related to decoding addresses to assets. This adds support for holding the same asset from multiple chains. To test, you can transfer some NAM from the internal devnet to cosmoshub testnet to housefire, and you should see both your housefire NAM and your internal devnet NAM listed on your account.
The package.json points to a specific branch of namada-chain-registry, but I can update this as soon as anoma/namada-chain-registry#3 is merged. The code integrating the registry is a bit clunky, but this can be improved as the registry develops.
Added
Fixed