addMultisig for ui-keyring (#311)

* addMultisig for ui-keyring

* Bumps

* Spelling.
This commit is contained in:
Jaco Greeff
2020-04-24 18:02:13 +02:00
committed by GitHub
parent 2e323be1c3
commit e88351e994
12 changed files with 774 additions and 918 deletions
+4
View File
@@ -1,3 +1,7 @@
# 0.53.0-beta.x
- Add `addMultisig` into keyring (with all options to re-create address)
# 0.52.1 Apr 15, 2020 # 0.52.1 Apr 15, 2020
- **Breaking change** (TypeScript only) The `*.d.ts` files now contain TypeScript 3.8 features, `#private`, which is not usable in older versions - **Breaking change** (TypeScript only) The `*.d.ts` files now contain TypeScript 3.8 features, `#private`, which is not usable in older versions
+2 -2
View File
@@ -32,7 +32,7 @@
"devDependencies": { "devDependencies": {
"@babel/core": "^7.9.0", "@babel/core": "^7.9.0",
"@babel/runtime": "^7.9.2", "@babel/runtime": "^7.9.2",
"@polkadot/dev": "^0.52.9", "@polkadot/dev": "^0.52.11",
"@polkadot/ts": "^0.3.18", "@polkadot/ts": "^0.3.18",
"@types/jest": "^25.2.1", "@types/jest": "^25.2.1",
"babel-plugin-transform-vue-template": "^0.4.2", "babel-plugin-transform-vue-template": "^0.4.2",
@@ -40,7 +40,7 @@
"react": "^16.13.1", "react": "^16.13.1",
"react-dom": "^16.13.1", "react-dom": "^16.13.1",
"react-is": "^16.13.1", "react-is": "^16.13.1",
"react-native": "^0.62.1", "react-native": "^0.62.2",
"vue-template-compiler": "^2.6.11", "vue-template-compiler": "^2.6.11",
"webpack-serve": "^3.2.0" "webpack-serve": "^3.2.0"
} }
+7 -7
View File
@@ -27,12 +27,12 @@
"@polkadot/ui-keyring": "0.52.1", "@polkadot/ui-keyring": "0.52.1",
"@polkadot/ui-settings": "0.52.1", "@polkadot/ui-settings": "0.52.1",
"@react-native-community/async-storage": "^1.9.0", "@react-native-community/async-storage": "^1.9.0",
"fast-text-encoding": "^1.0.1", "fast-text-encoding": "^1.0.2",
"get-yarn-workspaces": "^1.0.2", "get-yarn-workspaces": "^1.0.2",
"os-browserify": "^0.3.0", "os-browserify": "^0.3.0",
"process": "^0.11.10", "process": "^0.11.10",
"react": "16.13.1", "react": "16.13.1",
"react-native": "^0.62.1", "react-native": "^0.62.2",
"react-native-crypto": "^2.2.0", "react-native-crypto": "^2.2.0",
"react-native-randombytes": "^3.5.3", "react-native-randombytes": "^3.5.3",
"stream-http": "^3.1.0" "stream-http": "^3.1.0"
@@ -40,12 +40,12 @@
"devDependencies": { "devDependencies": {
"@babel/core": "^7.9.0", "@babel/core": "^7.9.0",
"@babel/runtime": "^7.9.2", "@babel/runtime": "^7.9.2",
"@polkadot/keyring": "^2.8.1", "@polkadot/keyring": "^2.9.0-beta.0",
"@polkadot/util": "^2.8.1", "@polkadot/util": "^2.9.0-beta.0",
"@polkadot/util-crypto": "^2.8.1", "@polkadot/util-crypto": "^2.9.0-beta.0",
"@react-native-community/cli-platform-ios": "^4.5.0", "@react-native-community/cli-platform-ios": "^4.7.0",
"@types/react-test-renderer": "16.9.2", "@types/react-test-renderer": "16.9.2",
"babel-jest": "^25.2.6", "babel-jest": "^25.4.0",
"metro-react-native-babel-preset": "^0.59.0", "metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "16.13.1" "react-test-renderer": "16.13.1"
}, },
+5 -5
View File
@@ -15,7 +15,7 @@
"color": "^3.1.2", "color": "^3.1.2",
"jdenticon": "2.2.0", "jdenticon": "2.2.0",
"react-copy-to-clipboard": "^5.0.2", "react-copy-to-clipboard": "^5.0.2",
"styled-components": "^5.0.1" "styled-components": "^5.1.0"
}, },
"peerDependencies": { "peerDependencies": {
"@polkadot/keyring": "*", "@polkadot/keyring": "*",
@@ -26,12 +26,12 @@
"react-is": "*" "react-is": "*"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^2.8.1", "@polkadot/keyring": "^2.9.0-beta.0",
"@polkadot/util": "^2.8.1", "@polkadot/util": "^2.9.0-beta.0",
"@polkadot/util-crypto": "^2.8.1", "@polkadot/util-crypto": "^2.9.0-beta.0",
"@types/react-copy-to-clipboard": "^4.3.0", "@types/react-copy-to-clipboard": "^4.3.0",
"@types/react-dom": "^16.9.6", "@types/react-dom": "^16.9.6",
"@types/styled-components": "^5.0.1", "@types/styled-components": "^5.1.0",
"xmlserializer": "^0.6.1" "xmlserializer": "^0.6.1"
} }
} }
+2 -2
View File
@@ -14,8 +14,8 @@
"react-qr-reader": "^2.2.1" "react-qr-reader": "^2.2.1"
}, },
"devDependencies": { "devDependencies": {
"@types/react-qr-reader": "^2.1.2", "@types/react-qr-reader": "^2.1.3",
"@types/styled-components": "^5.0.1" "@types/styled-components": "^5.1.0"
}, },
"peerDependencies": { "peerDependencies": {
"@polkadot/util": "*", "@polkadot/util": "*",
+3 -3
View File
@@ -11,7 +11,7 @@
"dependencies": { "dependencies": {
"@babel/runtime": "^7.9.2", "@babel/runtime": "^7.9.2",
"@polkadot/ui-shared": "0.52.1", "@polkadot/ui-shared": "0.52.1",
"react-native-svg": "^12.0.3" "react-native-svg": "^12.1.0"
}, },
"peerDependencies": { "peerDependencies": {
"@polkadot/util-crypto": "*", "@polkadot/util-crypto": "*",
@@ -19,7 +19,7 @@
"react-native": "*" "react-native": "*"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/util-crypto": "^2.8.1", "@polkadot/util-crypto": "^2.9.0-beta.0",
"@types/react-native": "^0.62.1" "@types/react-native": "^0.62.4"
} }
} }
+6 -6
View File
@@ -18,24 +18,24 @@
}, },
"dependencies": { "dependencies": {
"@babel/runtime": "^7.9.2", "@babel/runtime": "^7.9.2",
"@ledgerhq/hw-transport-u2f": "^5.12.0", "@ledgerhq/hw-transport-u2f": "^5.13.1",
"@ledgerhq/hw-transport-webusb": "^5.12.0", "@ledgerhq/hw-transport-webusb": "^5.13.1",
"ledger-polkadot": "^0.7.0", "ledger-polkadot": "^0.7.0",
"mkdirp": "^1.0.4", "mkdirp": "^1.0.4",
"rxjs": "^6.5.5", "rxjs": "^6.5.5",
"store": "^2.0.12" "store": "^2.0.12"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^2.8.1", "@polkadot/keyring": "^2.9.0-beta.0",
"@polkadot/types": "^1.10.1", "@polkadot/types": "^1.12.0-beta.5",
"@polkadot/util": "^2.8.1", "@polkadot/util": "^2.9.0-beta.0",
"@types/ledgerhq__hw-transport-node-hid": "^4.22.1", "@types/ledgerhq__hw-transport-node-hid": "^4.22.1",
"@types/ledgerhq__hw-transport-u2f": "^4.21.1", "@types/ledgerhq__hw-transport-u2f": "^4.21.1",
"@types/mkdirp": "^1.0.0", "@types/mkdirp": "^1.0.0",
"@types/store": "^2.0.2" "@types/store": "^2.0.2"
}, },
"optionalDependencies": { "optionalDependencies": {
"@ledgerhq/hw-transport-node-hid": "^5.12.0" "@ledgerhq/hw-transport-node-hid": "^5.13.1"
}, },
"peerDependencies": { "peerDependencies": {
"@polkadot/keyring": "*", "@polkadot/keyring": "*",
+10 -1
View File
@@ -7,9 +7,11 @@ import { KeypairType } from '@polkadot/util-crypto/types';
import { AddressSubject, SingleAddress } from './observable/types'; import { AddressSubject, SingleAddress } from './observable/types';
import { CreateResult, KeyringAddress, KeyringAddressType, KeyringItemType, KeyringJson, KeyringJson$Meta, KeyringOptions, KeyringStruct } from './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 createPair from '@polkadot/keyring/pair';
import chains from '@polkadot/ui-settings/defaults/chains'; 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 env from './observable/development';
import Base from './Base'; import Base from './Base';
@@ -41,6 +43,13 @@ export class Keyring extends Base implements KeyringStruct {
return this.addExternal(address, { ...meta, hardwareType, isHardware: true }); 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 { public addPair (pair: KeyringPair, password: string): CreateResult {
this.keyring.addPair(pair); this.keyring.addPair(pair);
+1 -1
View File
@@ -14,7 +14,7 @@
"store": "^2.0.12" "store": "^2.0.12"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/util": "^2.8.1", "@polkadot/util": "^2.9.0-beta.0",
"@types/store": "^2.0.2" "@types/store": "^2.0.2"
}, },
"peerDependencies": { "peerDependencies": {
+2 -2
View File
@@ -17,8 +17,8 @@
"@polkadot/util-crypto": "*" "@polkadot/util-crypto": "*"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/util": "^2.8.1", "@polkadot/util": "^2.9.0-beta.0",
"@polkadot/util-crypto": "^2.8.1", "@polkadot/util-crypto": "^2.9.0-beta.0",
"@types/color": "^3.0.1" "@types/color": "^3.0.1"
} }
} }
+1 -1
View File
@@ -18,7 +18,7 @@
"vue": "*" "vue": "*"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/util-crypto": "^2.8.1", "@polkadot/util-crypto": "^2.9.0-beta.0",
"vue": "^2.6.11" "vue": "^2.6.11"
} }
} }
+731 -888
View File
File diff suppressed because it is too large Load Diff