Parse derivation paths via BN (#1130)
* Parse derivation paths via BN * Direct to u8a for numbers * CHANGELOG
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
|
||||
import { BN, bnToHex, compactAddLength, hexToU8a, isBigInt, isBn, isHex, isNumber, isString, stringToU8a } from '@polkadot/util';
|
||||
import { BN, bnToU8a, compactAddLength, hexToU8a, isBigInt, isBn, isHex, isNumber, isString, stringToU8a } from '@polkadot/util';
|
||||
|
||||
import { blake2AsU8a } from '../blake2/asU8a';
|
||||
|
||||
@@ -28,7 +28,7 @@ export class DeriveJunction {
|
||||
|
||||
result.soft(
|
||||
RE_NUMBER.test(code)
|
||||
? parseInt(code, 10)
|
||||
? new BN(code, 10)
|
||||
: code
|
||||
);
|
||||
|
||||
@@ -61,7 +61,7 @@ export class DeriveJunction {
|
||||
|
||||
public soft (value: HexString | number | string | bigint | BN | Uint8Array): DeriveJunction {
|
||||
if (isNumber(value) || isBn(value) || isBigInt(value)) {
|
||||
return this.soft(bnToHex(value, BN_OPTIONS));
|
||||
return this.soft(bnToU8a(value, BN_OPTIONS));
|
||||
} else if (isHex(value)) {
|
||||
return this.soft(hexToU8a(value));
|
||||
} else if (isString(value)) {
|
||||
|
||||
Reference in New Issue
Block a user