Bump common (#3690)

This commit is contained in:
Jaco
2021-06-23 16:18:49 +02:00
committed by GitHub
parent 7c2048bc6b
commit 7b1400e238
17 changed files with 149 additions and 149 deletions
+1 -1
View File
@@ -99,7 +99,7 @@ function decodeStructFromObject <T> (registry: Registry, Types: ConstructorDef,
*/
function decodeStruct <T> (registry: Registry, Types: ConstructorDef, value: unknown, jsonMap: Map<any, string>): T {
if (isHex(value)) {
return decodeStruct(registry, Types, hexToU8a(value.toString()), jsonMap);
return decodeStruct(registry, Types, hexToU8a(value), jsonMap);
} else if (isU8a(value)) {
const keys = Object.keys(Types);
const values = decodeU8a(registry, value, Object.values(Types), keys);
+1 -1
View File
@@ -40,7 +40,7 @@ function initType<T extends Codec = Codec, K extends string = string> (registry:
if (isU8a(value)) {
checkInstance(value, created);
} else if (isHex(value)) {
checkInstance(u8aToU8a(value.toString()), created);
checkInstance(u8aToU8a(value), created);
}
}
+2 -2
View File
@@ -13,9 +13,9 @@ function decodeAccountId (value: AnyU8a | AnyString): AnyU8a {
if (isU8a(value) || Array.isArray(value)) {
return u8aToU8a(value);
} else if (isHex(value) || isEthereumAddress(value)) {
return hexToU8a(value.toString());
return hexToU8a(value);
} else if (isString(value)) {
return u8aToU8a((value as string).toString());
return u8aToU8a(value);
}
return value;
+3 -3
View File
@@ -14,10 +14,10 @@ function decodeAccountId (value?: AnyU8a | AnyString): Uint8Array {
return new Uint8Array();
} else if (isU8a(value) || Array.isArray(value)) {
return u8aToU8a(value);
} else if (isHex(value)) {
return hexToU8a(value);
} else if (isString(value)) {
return isHex(value)
? hexToU8a(value.toString())
: decodeAddress((value as string).toString());
return decodeAddress(value);
}
throw new Error(`Unknown type passed to AccountId constructor, found typeof ${typeof value}`);
+1 -1
View File
@@ -93,7 +93,7 @@ function decodeCallViaU8a (registry: Registry, value: Uint8Array, _meta?: Functi
*/
function decodeCall (registry: Registry, value: unknown | DecodedMethod | Uint8Array | string = new Uint8Array(), _meta?: FunctionMetadataLatest): DecodedMethod {
if (isHex(value) || isU8a(value)) {
return decodeCallViaU8a(registry, u8aToU8a(value as string), _meta);
return decodeCallViaU8a(registry, u8aToU8a(value), _meta);
} else if (isObject(value) && value.callIndex && value.args) {
return decodeCallViaObject(registry, value as DecodedMethod, _meta);
}
+1 -1
View File
@@ -13,7 +13,7 @@ const MAX_LENGTH = 128 * 1024;
/** @internal */
function decodeText (value?: null | Text | string | AnyU8a | { toString: () => string }): string {
if (isHex(value)) {
return u8aToString(hexToU8a(value.toString()));
return u8aToString(hexToU8a(value));
} else if (value instanceof Uint8Array) {
if (!value.length) {
return '';