yearn-sdk icon indicating copy to clipboard operation
yearn-sdk copied to clipboard

feat: Change Context configuration dynamically

Open karelianpie opened this issue 2 years ago • 1 comments

Description

Add a config setter to be able to change configurations (chainId, context and assetServiceState) dynamically after initialisation. Usage:

// Initialise a Yearn instance
const sdkInstance = new Yearn(1, {
  provider,
  zapper: ZAPPER_API_KEY,
  // ...
});
// then we can dynamically change the config by
sdkInstance.config = {
  chainId: 250,
  context: {
    anotherProvider,
    zapper: 'anotherZapperKey',
    // ...
  },
};

Related Issue

N/A

Motivation and Context

Currently after initialisation it is not possible to change the configs in the context

How Has This Been Tested?

Ran locally with yalc

karelianpie avatar Jun 03 '22 02:06 karelianpie

size-limit report 📦

Path Size
dist/sdk.cjs.production.min.js 47.67 KB (+0.38% 🔺)
dist/sdk.esm.js 48 KB (+0.37% 🔺)

github-actions[bot] avatar Jun 03 '22 04:06 github-actions[bot]

@xgambitox shall we close this?

karelianpie avatar Jan 10 '23 13:01 karelianpie

Closing for now as it's stalled, reopen if to be continued

karelianpie avatar Jan 20 '23 07:01 karelianpie