mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-06-21 22:41:06 +00:00
Bump deps (#315)
This commit is contained in:
+2
-2
@@ -32,8 +32,8 @@
|
|||||||
"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.11",
|
"@polkadot/dev": "^0.52.15",
|
||||||
"@polkadot/ts": "^0.3.18",
|
"@polkadot/ts": "^0.3.19",
|
||||||
"@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",
|
||||||
"empty": "^0.10.1",
|
"empty": "^0.10.1",
|
||||||
|
|||||||
@@ -40,9 +40,9 @@
|
|||||||
"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.9.0-beta.1",
|
"@polkadot/keyring": "^2.9.1",
|
||||||
"@polkadot/util": "^2.9.0-beta.1",
|
"@polkadot/util": "^2.9.1",
|
||||||
"@polkadot/util-crypto": "^2.9.0-beta.1",
|
"@polkadot/util-crypto": "^2.9.1",
|
||||||
"@react-native-community/cli-platform-ios": "^4.7.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.4.0",
|
"babel-jest": "^25.4.0",
|
||||||
|
|||||||
@@ -26,9 +26,9 @@
|
|||||||
"react-is": "*"
|
"react-is": "*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^2.9.0-beta.1",
|
"@polkadot/keyring": "^2.9.1",
|
||||||
"@polkadot/util": "^2.9.0-beta.1",
|
"@polkadot/util": "^2.9.1",
|
||||||
"@polkadot/util-crypto": "^2.9.0-beta.1",
|
"@polkadot/util-crypto": "^2.9.1",
|
||||||
"@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.1.0",
|
"@types/styled-components": "^5.1.0",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
"react-native": "*"
|
"react-native": "*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/util-crypto": "^2.9.0-beta.1",
|
"@polkadot/util-crypto": "^2.9.1",
|
||||||
"@types/react-native": "^0.62.4"
|
"@types/react-native": "^0.62.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,9 @@
|
|||||||
"store": "^2.0.12"
|
"store": "^2.0.12"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^2.9.0-beta.1",
|
"@polkadot/keyring": "^2.9.1",
|
||||||
"@polkadot/types": "^1.12.0-beta.6",
|
"@polkadot/types": "^1.13.0-beta.15",
|
||||||
"@polkadot/util": "^2.9.0-beta.1",
|
"@polkadot/util": "^2.9.1",
|
||||||
"@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",
|
||||||
|
|||||||
@@ -24,42 +24,43 @@ const transports = allNode.concat(allWeb);
|
|||||||
// - it connects automatically, creating an app as required
|
// - it connects automatically, creating an app as required
|
||||||
// - Promises return errors (instead of wrapper errors)
|
// - Promises return errors (instead of wrapper errors)
|
||||||
export default class Ledger {
|
export default class Ledger {
|
||||||
private app: LedgerApp | null = null;
|
#app: LedgerApp | null = null;
|
||||||
private type: LedgerTypes;
|
|
||||||
|
#type: LedgerTypes;
|
||||||
|
|
||||||
constructor (type: LedgerTypes) {
|
constructor (type: LedgerTypes) {
|
||||||
assert(['hid', 'u2f', 'webusb'].includes(type), `Unsupported transport ${type}`);
|
assert(['hid', 'u2f', 'webusb'].includes(type), `Unsupported transport ${type}`);
|
||||||
|
|
||||||
this.type = type;
|
this.#type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getApp (): Promise<LedgerApp> {
|
private async _getApp (): Promise<LedgerApp> {
|
||||||
if (!this.app) {
|
if (!this.#app) {
|
||||||
const def = transports.find(({ type }): boolean => type === this.type);
|
const def = transports.find(({ type }) => type === this.#type);
|
||||||
|
|
||||||
assert(def, `Unable to find a transport for ${this.type}`);
|
assert(def, `Unable to find a transport for ${this.#type}`);
|
||||||
|
|
||||||
const transport = await def.create();
|
const transport = await def.create();
|
||||||
|
|
||||||
this.app = new LedgerApp(transport);
|
this.#app = new LedgerApp(transport);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.app;
|
return this.#app;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async withApp <T> (fn: (app: LedgerApp) => Promise<T>): Promise<T> {
|
private async _withApp <T> (fn: (app: LedgerApp) => Promise<T>): Promise<T> {
|
||||||
try {
|
try {
|
||||||
const app = await this.getApp();
|
const app = await this._getApp();
|
||||||
|
|
||||||
return await fn(app);
|
return await fn(app);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.app = null;
|
this.#app = null;
|
||||||
|
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async wrapError <T extends ResponseBase> (promise: Promise<T>): Promise<T> {
|
private async _wrapError <T extends ResponseBase> (promise: Promise<T>): Promise<T> {
|
||||||
const result = await promise;
|
const result = await promise;
|
||||||
|
|
||||||
assert(result.return_code === SUCCESS_CODE, result.error_message);
|
assert(result.return_code === SUCCESS_CODE, result.error_message);
|
||||||
@@ -68,8 +69,8 @@ export default class Ledger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async getAddress (confirm = false, account = LEDGER_DEFAULT_ACCOUNT, change = LEDGER_DEFAULT_CHANGE, addressIndex = LEDGER_DEFAULT_INDEX): Promise<LedgerAddress> {
|
public async getAddress (confirm = false, account = LEDGER_DEFAULT_ACCOUNT, change = LEDGER_DEFAULT_CHANGE, addressIndex = LEDGER_DEFAULT_INDEX): Promise<LedgerAddress> {
|
||||||
return this.withApp(async (app: LedgerApp): Promise<LedgerAddress> => {
|
return this._withApp(async (app: LedgerApp): Promise<LedgerAddress> => {
|
||||||
const { address, pubKey } = await this.wrapError(app.getAddress(account, change, addressIndex, confirm));
|
const { address, pubKey } = await this._wrapError(app.getAddress(account, change, addressIndex, confirm));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
address,
|
address,
|
||||||
@@ -79,8 +80,8 @@ export default class Ledger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async getVersion (): Promise<LedgerVersion> {
|
public async getVersion (): Promise<LedgerVersion> {
|
||||||
return this.withApp(async (app: LedgerApp): Promise<LedgerVersion> => {
|
return this._withApp(async (app: LedgerApp): Promise<LedgerVersion> => {
|
||||||
const { device_locked: isLocked, major, minor, patch, test_mode: isTestMode } = await this.wrapError(app.getVersion());
|
const { device_locked: isLocked, major, minor, patch, test_mode: isTestMode } = await this._wrapError(app.getVersion());
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isLocked,
|
isLocked,
|
||||||
@@ -91,9 +92,9 @@ export default class Ledger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async sign (message: Uint8Array, account = LEDGER_DEFAULT_ACCOUNT, change = LEDGER_DEFAULT_CHANGE, addressIndex = LEDGER_DEFAULT_INDEX): Promise<LedgerSignature> {
|
public async sign (message: Uint8Array, account = LEDGER_DEFAULT_ACCOUNT, change = LEDGER_DEFAULT_CHANGE, addressIndex = LEDGER_DEFAULT_INDEX): Promise<LedgerSignature> {
|
||||||
return this.withApp(async (app: LedgerApp): Promise<LedgerSignature> => {
|
return this._withApp(async (app: LedgerApp): Promise<LedgerSignature> => {
|
||||||
const buffer = u8aToBuffer(message);
|
const buffer = u8aToBuffer(message);
|
||||||
const { signature } = await this.wrapError(app.sign(account, change, addressIndex, buffer));
|
const { signature } = await this._wrapError(app.sign(account, change, addressIndex, buffer));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
signature: u8aToHex(bufferToU8a(signature))
|
signature: u8aToHex(bufferToU8a(signature))
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
"store": "^2.0.12"
|
"store": "^2.0.12"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/util": "^2.9.0-beta.1",
|
"@polkadot/util": "^2.9.1",
|
||||||
"@types/store": "^2.0.2"
|
"@types/store": "^2.0.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
"@polkadot/util-crypto": "*"
|
"@polkadot/util-crypto": "*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/util": "^2.9.0-beta.1",
|
"@polkadot/util": "^2.9.1",
|
||||||
"@polkadot/util-crypto": "^2.9.0-beta.1",
|
"@polkadot/util-crypto": "^2.9.1",
|
||||||
"@types/color": "^3.0.1"
|
"@types/color": "^3.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
"vue": "*"
|
"vue": "*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/util-crypto": "^2.9.0-beta.1",
|
"@polkadot/util-crypto": "^2.9.1",
|
||||||
"vue": "^2.6.11"
|
"vue": "^2.6.11"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user