Allow any type of asset fields for the isERC20Asset type guard (#322)
This commit is contained in:
parent
448e0ec78f
commit
8ebb2ee81c
@ -7,8 +7,10 @@ export interface ERC20Asset extends AssetFields {
|
||||
};
|
||||
}
|
||||
|
||||
type UnknownAssset = Pick<AssetFields, '__typename' | 'source'>;
|
||||
|
||||
// Type guard to ensure an asset is an ERC20 token
|
||||
export const isERC20Asset = (asset: AssetFields): asset is ERC20Asset => {
|
||||
export const isERC20Asset = (asset: UnknownAssset): asset is ERC20Asset => {
|
||||
if (asset.source.__typename === 'ERC20') {
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user