choosing AccountId20 type if the address is 20 bytes (#5991)
This commit is contained in:
@@ -24,7 +24,7 @@ export function accountId (instanceId: string, api: DeriveApi): (address?: Addre
|
||||
: decodeAddress((address || '').toString());
|
||||
|
||||
if (decoded.length > 8) {
|
||||
return of(api.registry.createType('AccountId', decoded));
|
||||
return of(api.registry.createType(decoded.length === 20 ? 'AccountId20' : 'AccountId', decoded));
|
||||
}
|
||||
|
||||
const accountIndex = api.registry.createType('AccountIndex', decoded);
|
||||
|
||||
@@ -34,7 +34,7 @@ export function idAndIndex (instanceId: string, api: DeriveApi): (address?: Addr
|
||||
: decodeAddress((address || '').toString());
|
||||
|
||||
if (decoded.length > 8) {
|
||||
const accountId = api.registry.createType('AccountId', decoded);
|
||||
const accountId = api.registry.createType(decoded.length === 20 ? 'AccountId20' : 'AccountId', decoded);
|
||||
|
||||
return api.derive.accounts.idToIndex(accountId).pipe(
|
||||
map((accountIndex): AccountIdAndIndex => [accountId, accountIndex])
|
||||
|
||||
Reference in New Issue
Block a user