Handle no keysReturn StorageChangeSet with no keys (#2212)

This commit is contained in:
Jaco Greeff
2020-04-27 08:54:02 +02:00
committed by GitHub
parent 1c8bd896e1
commit e3d3a1ff71
+5 -1
View File
@@ -336,7 +336,11 @@ export default class Rpc implements RpcInterface {
throw error;
}
} else if (rpc.type === 'StorageChangeSet') {
return this._formatStorageSet(params[0] as Vec<StorageKey>, result.changes);
const keys = params[0] as Vec<StorageKey>;
return keys
? this._formatStorageSet(keys, result.changes)
: this.registry.createType('StorageChangeSet', result);
} else if (rpc.type === 'Vec<StorageChangeSet>') {
const mapped = result.map(({ block, changes }: { block: string; changes: [string, string | null][] }): [Hash, Codec[]] => [
this.registry.createType('Hash', block),