Move internal decoding to top-level-functions (#1818)

* Move internal decoding to top-level-functions

* Cleanup imports
This commit is contained in:
Jaco Greeff
2020-02-07 14:12:30 +01:00
committed by GitHub
parent f6490217ec
commit faa12a68f7
23 changed files with 170 additions and 181 deletions
+4 -4
View File
@@ -40,10 +40,10 @@ async function query (api: ApiPromise, keyring: TestKeyringMap): Promise<void> {
// api.query.*.* is well-typed
const bar = await api.query.foo.bar(); // bar is Codec (unknown module)
const bal = await api.query.balances.freeBalance(keyring.alice.address); // bal is Balance
const bal2 = await api.query.balances.freeBalance(keyring.alice.address, 'WRONG_ARG'); // bal2 is Codec (wrong args)
const override = await api.query.balances.freeBalance<Header>(keyring.alice.address); // override is still available
const oldBal = await api.query.balances.freeBalance.at('abcd', keyring.alice.address);
const bal = await api.query.balances.totalIssuance(); // bal is Balance
const bal2 = await api.query.balances.totalIssuance('WRONG_ARG'); // bal2 is Codec (wrong args)
const override = await api.query.balances.totalIssuance<Header>(); // override is still available
const oldBal = await api.query.balances.totalIssuance.at('abcd');
// It's hard to correctly type .multi. Expected: `Balance[]`, actual: Codec[].
// In the meantime, we can case with `<Balance>`
const multi = await api.query.balances.freeBalance.multi<Balance>([keyring.alice.address, keyring.bob.address]);