@zennomi/tokens
v1.0.1
Published
Centralized asset data & utility functions
Readme
@zennomi/tokens
Table of contents
Type aliases
Variables
Functions
- assetAmountInEth
- assetAmountInWei
- getAaveV2MarketInfo
- getAssetInfo
- getAssetInfoByAddress
- getIlkInfo
- ilkToAsset
- set
- tokenFromJoin
- tokenFromMakerJoin
- tokenFromReflexerJoin
Type aliases
AaveMarketData
Ƭ AaveMarketData: Object
Type declaration
| Name | Type |
| :------ | :------ |
| dataProvider | string |
| lendingPool | string |
| lendingPoolAddressProvider | string |
| name | string |
Defined in
AddressMapping
Ƭ AddressMapping: Object
Index signature
▪ [key: number]: string
Defined in
AssetData
Ƭ AssetData: Object
Chain-specific asset info type
Type declaration
| Name | Type |
| :------ | :------ |
| aaveCollateral | boolean |
| address | string |
| addresses | AddressMapping |
| compoundCollateral | boolean |
| decimals | number |
| exchange | boolean |
| feedAvailability | BoolMapping |
| icon | Function |
| isStable | boolean |
| name | string |
| nativeChainId | number |
| symbol | string |
| underlyingAsset | string |
| yearnCollateral | boolean |
Defined in
AssetDataBase
Ƭ AssetDataBase: Object
Chain-agnostic asset info type
Type declaration
| Name | Type |
| :------ | :------ |
| aaveCollateral | boolean |
| addresses | AddressMapping |
| compoundCollateral | boolean |
| decimals | number |
| exchange | boolean |
| feedAvailability | BoolMapping |
| icon | Function |
| isStable | boolean |
| name | string |
| nativeChainId | number |
| symbol | string |
| underlyingAsset | string |
| yearnCollateral | boolean |
Defined in
ExtendedIlkData
Ƭ ExtendedIlkData: IlkData | { assetData: AssetData }
Defined in
IlkData
Ƭ IlkData: Object
Maker ilk info type
Type declaration
| Name | Type |
| :------ | :------ |
| asset | string |
| assetAddress? | string |
| clip? | string |
| clipCalc? | string |
| flip? | string |
| ilkBytes | string |
| ilkLabel | string |
| isCrop | boolean |
| isLP | boolean |
| join | string |
| pip | string |
Defined in
Variables
MAXUINT
• MAXUINT: string = '115792089237316195423570985008687907853269984665640564039457584007913129639935'
Defined in
aaveV2Markets
• aaveV2Markets: AaveMarketData[]
Defined in
assets
• assets: AssetDataBase[]
Defined in
ilks
• ilks: IlkData[]
Defined in
reflexerCollTypes
• reflexerCollTypes: IlkData[]
Defined in
utils
• utils: Object
Type declaration
| Name | Type |
| :------ | :------ |
| bytesToString | (hex: string) => string |
| compare | (a: string, b: string) => boolean |
| stringToBytes | (str: string) => string |
Defined in
Functions
assetAmountInEth
▸ Const assetAmountInEth(amount, asset?): string
Parameters
| Name | Type | Default value | Description |
| :------ | :------ | :------ | :------ |
| amount | string | number | object | undefined | Amount in wei |
| asset | string | 'ETH' | Asset symbol (or MCD-${symbol} for maker asset - always 18dec) |
Returns
string
Defined in
assetAmountInWei
▸ Const assetAmountInWei(amount, asset): string
Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| amount | string | number | object | Amount in eth |
| asset | string | Asset symbol |
Returns
string
Defined in
getAaveV2MarketInfo
▸ Const getAaveV2MarketInfo(name?): void | AaveMarketData
Parameters
| Name | Type | Default value |
| :------ | :------ | :------ |
| name | string | '' |
Returns
void | AaveMarketData
Defined in
getAssetInfo
▸ Const getAssetInfo(symbol?, chainId?): AssetData
Returns asset info. Warning: will not throw if asset not found. Instead, will return a placeholder object.
Parameters
| Name | Type | Default value |
| :------ | :------ | :------ |
| symbol | string | '' |
| chainId? | number | undefined |
Returns
Defined in
getAssetInfoByAddress
▸ Const getAssetInfoByAddress(address?, chainId?): AssetData
Parameters
| Name | Type | Default value |
| :------ | :------ | :------ |
| address | string | '' |
| chainId? | number | undefined |
Returns
Defined in
getIlkInfo
▸ Const getIlkInfo(ilk?): ExtendedIlkData
Returns Maker or Reflexer ilk info, and asset info as assetData attribute.
Warning: will not throw if ilk not found. Instead, will return a placeholder object.
Parameters
| Name | Type | Default value | Description |
| :------ | :------ | :------ | :------ |
| ilk | string | '' | Ilk encoded as string or as hex |
Returns
Defined in
ilkToAsset
▸ Const ilkToAsset(ilk?): string
Parameters
| Name | Type | Default value |
| :------ | :------ | :------ |
| ilk | string | '' |
Returns
string
Defined in
set
▸ Const set(key, value): void
Parameters
| Name | Type |
| :------ | :------ |
| key | string |
| value | any |
Returns
void
Defined in
tokenFromJoin
▸ Const tokenFromJoin(join, fromIlks?): string
Parameters
| Name | Type | Default value | Description |
| :------ | :------ | :------ | :------ |
| join | string | undefined | Maker or Reflexer ilk join |
| fromIlks | IlkData[] | ilks | |
Returns
string
Token symbol
Defined in
tokenFromMakerJoin
▸ Const tokenFromMakerJoin(join): string
Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| join | string | Maker ilk join |
Returns
string
Token symbol
Defined in
tokenFromReflexerJoin
▸ Const tokenFromReflexerJoin(join): string
Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| join | string | Reflexer ilk join |
Returns
string
Token symbol
