Support for multi genesisHash in keyring accounts (#481)

* Support for multi genesisHash in keyring accounts

* genesis

* Only single in keyring
This commit is contained in:
Jaco
2021-12-28 08:29:03 +01:00
committed by GitHub
parent 1905a165c4
commit 2904beb171
4 changed files with 37 additions and 16 deletions
+9
View File
@@ -28,6 +28,8 @@ export class Base {
protected _genesisHash?: string;
protected _genesisHashAdd: string[] = [];
constructor () {
this.#accounts = accounts;
this.#addresses = addresses;
@@ -59,6 +61,12 @@ export class Base {
return this._genesisHash;
}
public get genesisHashes (): string[] {
return this._genesisHash
? [this._genesisHash, ...this._genesisHashAdd]
: [...this._genesisHashAdd];
}
public decodeAddress = (key: string | Uint8Array, ignoreChecksum?: boolean, ss58Format?: Prefix): Uint8Array => {
return this.keyring.decodeAddress(key, ignoreChecksum, ss58Format);
};
@@ -115,6 +123,7 @@ export class Base {
? options.genesisHash.toString()
: options.genesisHash.toHex()
);
this._genesisHashAdd = options.genesisHashAdd || [];
this._store = options.store || this._store;
this.addAccountPairs();