mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-07-04 04:57:28 +00:00
Optional pair type (account-only) (#409)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { KeypairType } from '@polkadot/util-crypto/types';
|
||||
import type { SubjectInfo, AddressSubject, SingleAddress } from './types';
|
||||
import type { KeyringJson, KeyringStore } from '../types';
|
||||
|
||||
@@ -32,12 +33,13 @@ export default function genericSubject (keyCreator: (address: string) => string,
|
||||
development.subject.subscribe(next);
|
||||
|
||||
return {
|
||||
add: (store: KeyringStore, address: string, json: KeyringJson): SingleAddress => {
|
||||
add: (store: KeyringStore, address: string, json: KeyringJson, type?: KeypairType): SingleAddress => {
|
||||
current = { ...current };
|
||||
|
||||
current[address] = {
|
||||
json: { ...json, address },
|
||||
option: createOptionItem(address, json.meta.name)
|
||||
option: createOptionItem(address, json.meta.name),
|
||||
type
|
||||
};
|
||||
|
||||
// we do not store dev accounts, injected or hardware (the latter two are external/transient)
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { BehaviorSubject } from 'rxjs';
|
||||
import type { KeypairType } from '@polkadot/util-crypto/types';
|
||||
import type { KeyringSectionOption } from '../options/types';
|
||||
import type { KeyringJson, KeyringStore } from '../types';
|
||||
|
||||
export interface SingleAddress {
|
||||
json: KeyringJson;
|
||||
option: KeyringSectionOption;
|
||||
type?: KeypairType;
|
||||
}
|
||||
|
||||
export interface SubjectInfo {
|
||||
@@ -15,7 +17,7 @@ export interface SubjectInfo {
|
||||
}
|
||||
|
||||
export interface AddressSubject {
|
||||
add: (store: KeyringStore, address: string, json: KeyringJson) => SingleAddress;
|
||||
add: (store: KeyringStore, address: string, json: KeyringJson, type?: KeypairType) => SingleAddress;
|
||||
remove: (store: KeyringStore, address: string) => void;
|
||||
subject: BehaviorSubject<SubjectInfo>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user