mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-06-13 01:51:01 +00:00
Add example-{react, vue} (#209)
* Add example-{react, vue}
* Update CHANGELOG.md
* Update README.md
This commit is contained in:
@@ -26,12 +26,12 @@ export default class Base {
|
||||
|
||||
private _keyring?: KeyringInstance;
|
||||
|
||||
private _prefix?: Prefix;
|
||||
|
||||
protected _genesisHash?: string;
|
||||
|
||||
protected _store!: KeyringStore;
|
||||
|
||||
private _ss58Format?: Prefix;
|
||||
|
||||
public constructor () {
|
||||
this._accounts = accounts;
|
||||
this._addresses = addresses;
|
||||
@@ -63,12 +63,16 @@ export default class Base {
|
||||
return this._genesisHash;
|
||||
}
|
||||
|
||||
public decodeAddress = (key: string | Uint8Array, ignoreChecksum?: boolean): Uint8Array => {
|
||||
return this.keyring.decodeAddress(key, ignoreChecksum);
|
||||
public decodeAddress = (key: string | Uint8Array, ignoreChecksum?: boolean, ss58Format?: Prefix): Uint8Array => {
|
||||
// FIXME Tryings are wrong... :()
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return (this.keyring.decodeAddress as any)(key, ignoreChecksum, ss58Format);
|
||||
}
|
||||
|
||||
public encodeAddress = (key: string | Uint8Array): string => {
|
||||
return this.keyring.encodeAddress(key);
|
||||
public encodeAddress = (key: string | Uint8Array, ss58Format?: Prefix): string => {
|
||||
// FIXME Tryings are wrong... :()
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return (this.keyring.encodeAddress as any)(key, ss58Format);
|
||||
}
|
||||
|
||||
public getPair (address: string | Uint8Array): KeyringPair {
|
||||
@@ -96,8 +100,8 @@ export default class Base {
|
||||
return password.length > 0 && password.length <= MAX_PASS_LEN;
|
||||
}
|
||||
|
||||
public setAddressPrefix (prefix: number): void {
|
||||
this._prefix = prefix as Prefix;
|
||||
public setSS58Format (ss58Format: number): void {
|
||||
this._ss58Format = ss58Format as Prefix;
|
||||
}
|
||||
|
||||
public setDevMode (isDevelopment: boolean): void {
|
||||
@@ -105,7 +109,7 @@ export default class Base {
|
||||
}
|
||||
|
||||
protected initKeyring (options: KeyringOptions): void {
|
||||
const keyring = testKeyring({ addressPrefix: this._prefix, ...options }, true);
|
||||
const keyring = testKeyring({ ss58Format: this._ss58Format, ...options }, true);
|
||||
|
||||
if (isBoolean(options.isDevelopment)) {
|
||||
this.setDevMode(options.isDevelopment);
|
||||
|
||||
Reference in New Issue
Block a user