mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-06-09 20:11:04 +00:00
addMultisig for ui-keyring (#311)
* addMultisig for ui-keyring * Bumps * Spelling.
This commit is contained in:
@@ -18,24 +18,24 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.9.2",
|
||||
"@ledgerhq/hw-transport-u2f": "^5.12.0",
|
||||
"@ledgerhq/hw-transport-webusb": "^5.12.0",
|
||||
"@ledgerhq/hw-transport-u2f": "^5.13.1",
|
||||
"@ledgerhq/hw-transport-webusb": "^5.13.1",
|
||||
"ledger-polkadot": "^0.7.0",
|
||||
"mkdirp": "^1.0.4",
|
||||
"rxjs": "^6.5.5",
|
||||
"store": "^2.0.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.8.1",
|
||||
"@polkadot/types": "^1.10.1",
|
||||
"@polkadot/util": "^2.8.1",
|
||||
"@polkadot/keyring": "^2.9.0-beta.0",
|
||||
"@polkadot/types": "^1.12.0-beta.5",
|
||||
"@polkadot/util": "^2.9.0-beta.0",
|
||||
"@types/ledgerhq__hw-transport-node-hid": "^4.22.1",
|
||||
"@types/ledgerhq__hw-transport-u2f": "^4.21.1",
|
||||
"@types/mkdirp": "^1.0.0",
|
||||
"@types/store": "^2.0.2"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@ledgerhq/hw-transport-node-hid": "^5.12.0"
|
||||
"@ledgerhq/hw-transport-node-hid": "^5.13.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/keyring": "*",
|
||||
|
||||
@@ -7,9 +7,11 @@ import { KeypairType } from '@polkadot/util-crypto/types';
|
||||
import { AddressSubject, SingleAddress } from './observable/types';
|
||||
import { CreateResult, KeyringAddress, KeyringAddressType, KeyringItemType, KeyringJson, KeyringJson$Meta, KeyringOptions, KeyringStruct } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import createPair from '@polkadot/keyring/pair';
|
||||
import chains from '@polkadot/ui-settings/defaults/chains';
|
||||
import { hexToU8a, isHex, isString } from '@polkadot/util';
|
||||
import { bnToBn, hexToU8a, isHex, isString } from '@polkadot/util';
|
||||
import { createKeyMulti } from '@polkadot/util-crypto';
|
||||
|
||||
import env from './observable/development';
|
||||
import Base from './Base';
|
||||
@@ -41,6 +43,13 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
return this.addExternal(address, { ...meta, hardwareType, isHardware: true });
|
||||
}
|
||||
|
||||
public addMultisig (addresses: (string | Uint8Array)[], threshold: BigInt | BN | number, meta: KeyringPair$Meta = {}): CreateResult {
|
||||
const address = createKeyMulti(addresses, threshold);
|
||||
const who = addresses.map((who) => this.encodeAddress(who));
|
||||
|
||||
return this.addExternal(address, { ...meta, isMultisig: true, threshold: bnToBn(threshold).toNumber(), who });
|
||||
}
|
||||
|
||||
public addPair (pair: KeyringPair, password: string): CreateResult {
|
||||
this.keyring.addPair(pair);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user