Use source registry in clones (#2597)

This commit is contained in:
Jaco Greeff
2020-09-10 02:38:07 +02:00
committed by GitHub
parent e5b7e7f16f
commit b59b60ae1f
3 changed files with 4 additions and 4 deletions
+2 -1
View File
@@ -4,8 +4,9 @@
Changes: Changes:
- When cloning an API instance the runtimeChain is now properly set from source
- Allow `paymentInfo` on any extrinsic (already signed) with optional `{ blockHash: <hash> }` param for historic queries - Allow `paymentInfo` on any extrinsic (already signed) with optional `{ blockHash: <hash> }` param for historic queries
- When cloning an API instance the runtimeChain is now properly set from source
- When cloning an API instance the registry is shared with the source
- Optimize derive `receivedHeartbeats` to not re-create the full object - Optimize derive `receivedHeartbeats` to not re-create the full object
- Add `staking.stakerPrefs` derive to retrieve validatorPrefs over a range of eras - Add `staking.stakerPrefs` derive to retrieve validatorPrefs over a range of eras
+1 -1
View File
@@ -132,7 +132,7 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
super(); super();
this.#instanceId = `${++instanceCounter}`; this.#instanceId = `${++instanceCounter}`;
this.#registry = options.registry || new TypeRegistry(); this.#registry = options.source?.registry || options.registry || new TypeRegistry();
const thisProvider = options.source const thisProvider = options.source
? options.source._rpcCore.provider.clone() ? options.source._rpcCore.provider.clone()
+1 -2
View File
@@ -45,7 +45,7 @@ export default abstract class Init<ApiType extends ApiTypes> extends Decorate<Ap
if (!options.source) { if (!options.source) {
this.registerTypes(options.types); this.registerTypes(options.types);
} else { } else {
this.registry.setKnownTypes(options.source.registry.knownTypes); this.#registries = options.source.#registries;
} }
this._rpc = this._decorateRpc(this._rpcCore, this._decorateMethod); this._rpc = this._decorateRpc(this._rpcCore, this._decorateMethod);
@@ -164,7 +164,6 @@ export default abstract class Init<ApiType extends ApiTypes> extends Decorate<Ap
this._runtimeChain = source.runtimeChain; this._runtimeChain = source.runtimeChain;
this._runtimeVersion = source.runtimeVersion; this._runtimeVersion = source.runtimeVersion;
this._genesisHash = source.genesisHash; this._genesisHash = source.genesisHash;
this.registry.setChainProperties(source.registry.getChainProperties());
const methods: string[] = []; const methods: string[] = [];