Closed karelianpie closed 2 years ago
`TokenInterface#balances()` should return balance, balance in usdc and price for the given token addresses if they are supported in current network. **Technical details** Similar to the work done in `tokens.supported()` \- Fails gracefully when there is an error with zapper; \- Merge balances following same precedence (vaults > iron bank > zapper) and remove dupes \- If a token is not supported it throws an error \- If token addresses list is not provided, return balances for all supported tokens (i.e. `Token.supported()`) Add the following properties on Token so that we know which service supports a particular token: ``` interface Token extends ERC20 { // ... dataSource: TokenDataSource; // new supported: { zapper?: boolean; vaults?: boolean; // new ironBank?: boolean; // new labs?: boolean; // new }; // ... } ``` Token data source is where the token data is coming from (i.e. Vaults, Iron Bank, Zapper or Labs) ``` type TokenDataSource = "vaults" | "ironbank" | "zapper" | "labs"; ```
Path | Size |
---|---|
dist/sdk.cjs.production.min.js | 43.29 KB (+0.31% 🔺) |
dist/sdk.esm.js | 43.51 KB (+0.3% 🔺) |
WEB-1420 (subtask of WEB-1008)
Token.supported()
)Add a new type for token data source, it will be set to the service where the token data came from.
type TokenDataSource = "vaults" | "ironbank" | "zapper" | "labs";
Add a few props to the
Token
interface