@onekeyfe/hd-core
Advanced tools
Comparing version 1.0.18 to 1.0.19-alpha.0
@@ -6,2 +6,4 @@ import { ChangeOutputScriptType, InputScriptType } from '@onekeyfe/hd-transport'; | ||
export declare const getHDPath: (path: string) => Array<number>; | ||
export declare const isEqualBip44CoinType: (path: Array<number>, coinType: number) => boolean; | ||
export declare const isBip44Path: (path: Array<number>) => boolean; | ||
export declare const isMultisigPath: (path: Array<number>) => boolean; | ||
@@ -8,0 +10,0 @@ export declare const isSegwitPath: (path: Array<number>) => boolean; |
{ | ||
"name": "@onekeyfe/hd-core", | ||
"version": "1.0.18", | ||
"version": "1.0.19-alpha.0", | ||
"description": "> TODO: description", | ||
@@ -28,4 +28,4 @@ "author": "OneKey", | ||
"dependencies": { | ||
"@onekeyfe/hd-shared": "^1.0.18", | ||
"@onekeyfe/hd-transport": "^1.0.18", | ||
"@onekeyfe/hd-shared": "^1.0.19-alpha.0", | ||
"@onekeyfe/hd-transport": "^1.0.19-alpha.0", | ||
"axios": "^0.27.2", | ||
@@ -48,3 +48,3 @@ "bignumber.js": "^9.0.2", | ||
}, | ||
"gitHead": "dbe656b9724dc0a55d64abaf8081ea57aecedcf7" | ||
"gitHead": "52a172d49441026b8f6531c38d6edfaf84029464" | ||
} |
@@ -12,2 +12,3 @@ import { AptosGetAddress as HardwareAptosGetAddress } from '@onekeyfe/hd-transport'; | ||
import { hexToBytes } from '../helpers/hexUtils'; | ||
import { batchGetPublickeys } from '../helpers/batchGetPublickeys'; | ||
@@ -71,10 +72,3 @@ export default class AptosGetAddress extends BaseMethod<HardwareAptosGetAddress[]> { | ||
if (supportsBatchPublicKey) { | ||
const publicKeyRes = await this.device.commands.typedCall( | ||
'BatchGetPublickeys', | ||
'EcdsaPublicKeys', | ||
{ | ||
paths: this.params, | ||
ecdsa_curve_name: 'ed25519', | ||
} | ||
); | ||
const publicKeyRes = await batchGetPublickeys(this.device, this.params, 'ed25519', 637); | ||
@@ -81,0 +75,0 @@ for (let i = 0; i < this.params.length; i++) { |
@@ -6,2 +6,3 @@ import { UI_REQUEST } from '../../constants/ui-request'; | ||
import { AptosGetAddressParams, AptosPublicKey } from '../../types'; | ||
import { batchGetPublickeys } from '../helpers/batchGetPublickeys'; | ||
@@ -49,6 +50,3 @@ export default class AptosGetPublicKey extends BaseMethod<any> { | ||
async run() { | ||
const res = await this.device.commands.typedCall('BatchGetPublickeys', 'EcdsaPublicKeys', { | ||
paths: this.params, | ||
ecdsa_curve_name: 'ed25519', | ||
}); | ||
const res = await batchGetPublickeys(this.device, this.params, 'ed25519', 637); | ||
@@ -55,0 +53,0 @@ const responses: AptosPublicKey[] = res.message.public_keys.map( |
@@ -10,2 +10,3 @@ import { BenfenGetAddress as HardwareBenfenGetAddress } from '@onekeyfe/hd-transport'; | ||
import { supportBatchPublicKey } from '../../utils/deviceFeaturesUtils'; | ||
import { batchGetPublickeys } from '../helpers/batchGetPublickeys'; | ||
@@ -66,11 +67,3 @@ export default class BenfenGetAddress extends BaseMethod<HardwareBenfenGetAddress[]> { | ||
if (supportsBatchPublicKey) { | ||
const publicKeyRes = await this.device.commands.typedCall( | ||
'BatchGetPublickeys', | ||
'EcdsaPublicKeys', | ||
{ | ||
paths: this.params, | ||
ecdsa_curve_name: 'ed25519', | ||
} | ||
); | ||
const publicKeyRes = await batchGetPublickeys(this.device, this.params, 'ed25519', 728); | ||
for (let i = 0; i < this.params.length; i++) { | ||
@@ -77,0 +70,0 @@ const param = this.params[i]; |
@@ -6,2 +6,3 @@ import { BaseMethod } from '../BaseMethod'; | ||
import { BenfenPublicKey, BenfenGetPublicKeyParams } from '../../types'; | ||
import { batchGetPublickeys } from '../helpers/batchGetPublickeys'; | ||
@@ -52,6 +53,3 @@ export default class BenfenGetPublicKey extends BaseMethod<any> { | ||
async run() { | ||
const res = await this.device.commands.typedCall('BatchGetPublickeys', 'EcdsaPublicKeys', { | ||
paths: this.params, | ||
ecdsa_curve_name: 'ed25519', | ||
}); | ||
const res = await batchGetPublickeys(this.device, this.params, 'ed25519', 728); | ||
@@ -58,0 +56,0 @@ const responses: BenfenPublicKey[] = res.message.public_keys.map( |
@@ -6,2 +6,3 @@ import { UI_REQUEST } from '../../constants/ui-request'; | ||
import { CosmosAddress, CosmosGetPublicKeyParams } from '../../types'; | ||
import { batchGetPublickeys } from '../helpers/batchGetPublickeys'; | ||
@@ -63,7 +64,3 @@ export default class CosmosGetPublicKey extends BaseMethod<any> { | ||
async run() { | ||
const res = await this.device.commands.typedCall('BatchGetPublickeys', 'EcdsaPublicKeys', { | ||
paths: this.params, | ||
ecdsa_curve_name: this.params[0].curve, | ||
}); | ||
const res = await batchGetPublickeys(this.device, this.params, this.params[0].curve, 118); | ||
const responses: CosmosAddress[] = res.message.public_keys.map( | ||
@@ -70,0 +67,0 @@ (publicKey: string, index: number) => ({ |
@@ -45,2 +45,8 @@ /* eslint-disable no-bitwise */ | ||
export const isEqualBip44CoinType = (path: Array<number>, coinType: number): boolean => | ||
isBip44Path(path) && path[1] === toHardened(coinType); | ||
export const isBip44Path = (path: Array<number>): boolean => | ||
Array.isArray(path) && path[0] === toHardened(44); | ||
export const isMultisigPath = (path: Array<number>): boolean => | ||
@@ -47,0 +53,0 @@ Array.isArray(path) && path[0] === toHardened(48); |
@@ -10,2 +10,3 @@ import { SuiGetAddress as HardwareSuiGetAddress } from '@onekeyfe/hd-transport'; | ||
import { publicKeyToAddress } from './normalize'; | ||
import { batchGetPublickeys } from '../helpers/batchGetPublickeys'; | ||
@@ -65,14 +66,7 @@ export default class SuiGetAddress extends BaseMethod<HardwareSuiGetAddress[]> { | ||
if (supportsBatchPublicKey) { | ||
const publicKeyRes = await this.device.commands.typedCall( | ||
'BatchGetPublickeys', | ||
'EcdsaPublicKeys', | ||
{ | ||
paths: this.params, | ||
ecdsa_curve_name: 'ed25519', | ||
} | ||
); | ||
const publicKeyRes = await batchGetPublickeys(this.device, this.params, 'ed25519', 784); | ||
for (let i = 0; i < this.params.length; i++) { | ||
const param = this.params[i]; | ||
const publicKey = publicKeyRes.message.public_keys[i]; | ||
let address: string; | ||
let address: string | undefined; | ||
@@ -79,0 +73,0 @@ if (this.shouldConfirm) { |
@@ -6,2 +6,3 @@ import { UI_REQUEST } from '../../constants/ui-request'; | ||
import { SuiGetAddressParams, SuiPublicKey } from '../../types'; | ||
import { batchGetPublickeys } from '../helpers/batchGetPublickeys'; | ||
@@ -52,7 +53,3 @@ export default class SuiGetPublicKey extends BaseMethod<any> { | ||
async run() { | ||
const res = await this.device.commands.typedCall('BatchGetPublickeys', 'EcdsaPublicKeys', { | ||
paths: this.params, | ||
ecdsa_curve_name: 'ed25519', | ||
}); | ||
const res = await batchGetPublickeys(this.device, this.params, 'ed25519', 784); | ||
const responses: SuiPublicKey[] = res.message.public_keys.map( | ||
@@ -59,0 +56,0 @@ (publicKey: string, index: number) => ({ |
@@ -8,2 +8,3 @@ import { deriveAddress } from 'ripple-keypairs'; | ||
import { serializedPath, validatePath } from '../helpers/pathUtils'; | ||
import { batchGetPublickeys } from '../helpers/batchGetPublickeys'; | ||
@@ -61,6 +62,3 @@ export default class XrpGetAddress extends BaseMethod< | ||
if (this.hasBundle && supportBatchPublicKey(this.device?.features) && !this.shouldConfirm) { | ||
const res = await this.device.commands.typedCall('BatchGetPublickeys', 'EcdsaPublicKeys', { | ||
paths: this.params, | ||
ecdsa_curve_name: 'secp256k1', | ||
}); | ||
const res = await batchGetPublickeys(this.device, this.params, 'secp256k1', 144); | ||
const result = res.message.public_keys.map((publicKey: string, index: number) => ({ | ||
@@ -67,0 +65,0 @@ path: serializedPath((this.params as unknown as any[])[index].address_n), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2978341
1054
89090
1