Bump util, fix constructors (#393)
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.1.2",
|
||||
"@polkadot/keyring": "^0.32.13",
|
||||
"@polkadot/util": "^0.32.13"
|
||||
"@polkadot/keyring": "^0.32.15",
|
||||
"@polkadot/util": "^0.32.15"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export default class Bytes extends U8a {
|
||||
} else if (isHex(value)) {
|
||||
// FIXME We manually add the length prefix for hex for now
|
||||
// https://github.com/paritytech/substrate/issues/889
|
||||
const u8a = hexToU8a(value as string);
|
||||
const u8a = hexToU8a(value);
|
||||
|
||||
return Bytes.decodeBytes(
|
||||
Compact.addLengthPrefix(u8a)
|
||||
|
||||
@@ -52,7 +52,7 @@ export default class Extrinsic extends Struct {
|
||||
// https://github.com/paritytech/substrate/issues/889
|
||||
// Instead of the block below, it should simply be:
|
||||
// return Extrinsic.decodeExtrinsic(hexToU8a(value as string));
|
||||
const u8a = hexToU8a(value as string);
|
||||
const u8a = hexToU8a(value);
|
||||
|
||||
return Extrinsic.decodeExtrinsic(
|
||||
u8aConcat(
|
||||
|
||||
@@ -331,7 +331,7 @@ export default class RuntimeMetadata extends Struct {
|
||||
}, RuntimeMetadata.decodeMetadata(value));
|
||||
}
|
||||
|
||||
static decodeMetadata (value: any): object | Uint8Array {
|
||||
static decodeMetadata (value: string | Uint8Array | object): object | Uint8Array {
|
||||
if (isHex(value)) {
|
||||
// We receive this as an hex in the JSON output from the Node.
|
||||
// Convert to u8a and use the U8a version to do the actual parsing.
|
||||
|
||||
@@ -24,7 +24,7 @@ export default class Text extends Base<string> {
|
||||
);
|
||||
}
|
||||
|
||||
static decodeText (value: any): string {
|
||||
static decodeText (value: Text | string | AnyU8a | { toString: () => string }): string {
|
||||
if (isString(value)) {
|
||||
return value;
|
||||
} else if (value instanceof Text) {
|
||||
|
||||
@@ -39,7 +39,7 @@ export default class UInt extends Base<BN> {
|
||||
} else if (value instanceof U8a) {
|
||||
return UInt.decodeUInt(value.raw, bitLength);
|
||||
} else if (isHex(value)) {
|
||||
return hexToBn(value as string);
|
||||
return hexToBn(value);
|
||||
} else if (isU8a(value)) {
|
||||
// NOTE When passing u8a in (typically from decoded data), it is always LE
|
||||
return u8aToBn(value.subarray(0, bitLength / 8), true);
|
||||
|
||||
Reference in New Issue
Block a user