Adjust AnyBool & AnyString typings (#4850)
* Adjust AnyBool & AnyString typings * Fix AnyString typing
This commit is contained in:
@@ -11,8 +11,8 @@ import { ethereumEncode, isEthereumAddress } from '@polkadot/util-crypto';
|
||||
function decodeAccountId (value: AnyU8a | AnyString): AnyU8a {
|
||||
if (isU8a(value) || Array.isArray(value)) {
|
||||
return u8aToU8a(value);
|
||||
} else if (isHex(value) || isEthereumAddress(value)) {
|
||||
return hexToU8a(value);
|
||||
} else if (isHex(value) || isEthereumAddress(value.toString())) {
|
||||
return hexToU8a(value.toString());
|
||||
} else if (isString(value)) {
|
||||
return u8aToU8a(value);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ function decodeAccountId (value?: AnyU8a | AnyString): Uint8Array {
|
||||
} else if (isHex(value)) {
|
||||
return hexToU8a(value);
|
||||
} else if (isString(value)) {
|
||||
return decodeAddress(value);
|
||||
return decodeAddress(value.toString());
|
||||
}
|
||||
|
||||
throw new Error(`Unknown type passed to AccountId constructor, found typeof ${typeof value}`);
|
||||
|
||||
Reference in New Issue
Block a user