Doc links, typos, publish (#1977)

This commit is contained in:
Jaco Greeff
2020-02-29 10:28:47 +01:00
committed by GitHub
parent 8af58fcea3
commit bc2b0d513c
7 changed files with 375 additions and 115 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ The typical error that you would see is `Verification Error: Execution(ApiError(
All data transferred between the API and the Node is in a SCALE-encoded binary format, so the [definition of the types](types.extend.md) between the API and the node needs to match 100%. When you find the above, it would mean the definition of the types on the API side does not match what is on the node. Specifically the API encodes against the definition, but since there is a mismatch the Node cannot parse the data correctly.
To fix this, you should look at the specific `api.tx.*` params and adjust the type definitions for those param types to match what is found on the node side. In some rare cases the cause could be extrinsic formatting related, to track these make an `api.tx.system.remark(data: Bytes)` call, if it fails, the API and node cannot agree on an extrinsic format. (Ensure that there are no signed extension warnings in the API itself)
To fix this, you should look at the specific `api.tx.*` params and adjust the type definitions for those param types to match what is found on the node side. In some rare cases the cause could be extrinsic formatting related, to track these make an `api.tx.system.remark(data: Bytes)` call, if it fails, the API and node cannot agree on [an extrinsic format and adjustments are required](types.extend.md#impact-on-extrinsics).
## I would like to sign transactions offline
+2 -1
View File
@@ -21,6 +21,7 @@ import type { Balance } from '@polkadot/types/interfaces';
...
// unwrap out option into a zero Balance whn not found
// (This can be done via `.unwrapOrDefault()`, which does the same underlying)
const balance: Balance = balanceOpt.unwrapOr(api.createType('Balance'));
```
@@ -45,7 +46,7 @@ api.createType('Balance', 123);
// via registry (`.registry` is on all API and Codec objects)
api.registry.createType('Balance', 123n);
// via the low-level approach
// via the low-level approach (not recommended)
createType(api.registry, 'Balance', '123');
```
+4 -4
View File
@@ -133,7 +133,7 @@ In the same way `typesChain` can be used to match on the actual chain name, i.e.
const api = await ApiPromise.create({
...,
typesChain: {
'Kusama CC1': {
Kusama: {
BlockNumber: 'u32',
Index: 'u32'
}
@@ -163,9 +163,9 @@ const api = await ApiPromise.create({
## Impact on extrinsics
When configuring your chain, be cognizant of the types you are using, and always ensure that any changes are replicated back to the API. In an earlier example we configures `Balance` as `u64` - the same changes needs to be applied on the API when there are mismatches to Substrate master, otherwise failures will occur.
When configuring your chain, be cognizant of the types you are using, and always ensure that any changes are replicated back to the API. In an earlier example we configures `Balance` as `u64` - the same changes needs to be applied on the API when there are mismatches to Substrate master, otherwise failures will occur. The same would happen when your own types have mismatched fields types or miss fields on structs or enums.
This also applies to any other chain-specific configured types, for instance you can customize `Lookup` and `Address` on your chain. A real example of this is the Substrate master node vs the Substrate master node-template -
Mismatches also applies to any other chain-specific configured types, for instance you can customize `Lookup` and `Address` on your chain. A real example of this is the Substrate master node vs the Substrate master node-template -
```rust
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
@@ -203,4 +203,4 @@ Always look at customization and understand the impacts, replicating these chang
## Type creation
While the API always converts all the inputs into the underlying type required by the operation, in some cases you may want to [cret an instance of a type](types.create.md) yourself.
While the API always converts all the inputs into the underlying type required by the operation, in some cases you may want to [create an instance of a type](types.create.md) yourself.