Use assertReturn to cleanup (#2804)
* Use assertReturn to cleanup * Remove Uint/Int duplication * Adjust * ws errors, part 2 * . * Adj. manual * adj * switchMap * Revert "switchMap" This reverts commit edfa4a2258f09042b61a27fd3812f0c53039fe4f. * Revert. * Revert. * protected constructor * Correct isHexJson flag * Remove isHexJson (always detect) * Adjust * Flags
This commit is contained in:
@@ -32,13 +32,13 @@
|
||||
"@polkadot/rpc-core": "^2.4.2-12",
|
||||
"@polkadot/rpc-provider": "^2.4.2-12",
|
||||
"@polkadot/types": "^2.4.2-12",
|
||||
"@polkadot/util": "^3.6.2-8",
|
||||
"@polkadot/util-crypto": "^3.6.2-8",
|
||||
"@polkadot/util": "^3.6.2-10",
|
||||
"@polkadot/util-crypto": "^3.6.2-10",
|
||||
"bn.js": "^5.1.3",
|
||||
"memoizee": "^0.4.14",
|
||||
"rxjs": "^6.6.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^3.6.2-8"
|
||||
"@polkadot/keyring": "^3.6.2-10"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import { isU8a, assert } from '@polkadot/util';
|
||||
import { isU8a, assertReturn } from '@polkadot/util';
|
||||
import { decodeAddress } from '@polkadot/util-crypto';
|
||||
|
||||
import { memo } from '../util';
|
||||
@@ -23,11 +23,7 @@ function retrieve (api: ApiInterfaceRx, address: Address | AccountId | AccountIn
|
||||
const accountIndex = api.registry.createType('AccountIndex', decoded);
|
||||
|
||||
return api.derive.accounts.indexToId(accountIndex.toString()).pipe(
|
||||
map((accountId) => {
|
||||
assert(accountId, 'Unable to retrieve accountId');
|
||||
|
||||
return accountId;
|
||||
})
|
||||
map((accountId) => assertReturn(accountId, 'Unable to retrieve accountId'))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user