Closed karelianpie closed 2 years ago
### Elevator Pitch: **SDK should provide information if a vault is supported to zap in/out** ### Customer Value: **Frontends can display just the supported tokens for a given vault** ### Agreed upon Acceptance Criteria (definition of Done): * Refactor VaultMetadata interface to: ``` export interface VaultMetadata { ... allowZapIn?: boolean; // to be deprecated in a later version allowZapOut?: boolean; // to be deprecated in a later version zapInWith?: string; // This is a zapIn contract alias zapOutWith?: string; // This is a zapOut contract alias } ``` \*Also refactor yearn-meta schema accordingly [https://github.com/yearn/yearn-meta/blob/master/schema/vault.json](https://github.com/yearn/yearn-meta/blob/master/schema/vault.json) ### Design Approach: Hardcode in SDK all available zap contract addresses by alias. Use zappers api [~https://docs.zapper.fi/zapper-api/api-guides/vault-stats~](https://docs.zapper.fi/zapper-api/api-guides/vault-stats) [https://api.zapper.fi/v1/protocols/yearn/token-market-data?network=ethereum&type=vault](https://api.zapper.fi/v1/protocols/yearn/token-market-data?network=ethereum&type=vault) to set `zapInWith === 'zapperZapIn' and zapOutWith === 'zapperZapOut'` for supported vaults on eth mainnet. Override from yearn-meta to sdk for all vaults. ### Design review: xgambitox
Path | Size |
---|---|
dist/sdk.cjs.production.min.js | 44.29 KB (+0.66% 🔺) |
dist/sdk.esm.js | 44.65 KB (+0.65% 🔺) |
Description
Provide information if a vault is supported to zap in/out
Metadata properties added in the following PR https://github.com/yearn/yearn-meta/pull/235
Related Issue
https://linear.app/yearn/issue/WEB-1424/supported-zap-vaults
Motivation and Context
We should get the if a vault is supported by zapper from https://api.zapper.fi/v1/protocols/yearn/token-market-data rather than assume it's supported
How Has This Been Tested?
Added tests:
Tested locally with the frontend running the yalc'ed sdk
Screenshots:
Frontend running locally, you can see that we have all the old/new zapper props (i.e.
allowZapIn
,allowZapOut
,zapInWith
,zapOutWith
) set correctly for a "zappable" vault: