ContractRegistry always has own registry instance (#2705)
* ContractRegistry always has own registry instance * Hacky Bytes notation * Revert Bytes (for now, keep it simple) * Apply suggestions from code review * Expand on found error
This commit is contained in:
@@ -5,7 +5,6 @@ import { ApiTypes, DecorateMethod } from '@polkadot/api/types';
|
||||
import { AnyJson, Registry } from '@polkadot/types/types';
|
||||
import { ApiObject } from '../types';
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import Abi from '../Abi';
|
||||
@@ -20,11 +19,11 @@ export default abstract class Base<ApiType extends ApiTypes> {
|
||||
protected readonly _decorateMethod: DecorateMethod<ApiType>;
|
||||
|
||||
constructor (api: ApiObject<ApiType>, abi: AnyJson | Abi, decorateMethod: DecorateMethod<ApiType>) {
|
||||
this.registry = new TypeRegistry();
|
||||
this.abi = abi instanceof Abi
|
||||
? abi
|
||||
: new Abi(this.registry, abi);
|
||||
: new Abi(abi);
|
||||
this.api = api;
|
||||
this.registry = this.abi.registry;
|
||||
this._decorateMethod = decorateMethod;
|
||||
|
||||
assert(this.api.rx.tx.contracts && this.api.rx.tx.contracts.putCode, 'You need to connect to a node with the contracts module, the metadata does not enable api.tx.contracts on this instance');
|
||||
|
||||
Reference in New Issue
Block a user