@@ -14,6 +14,7 @@ import { StorageFunctionMetadata } from './Metadata';
|
|||||||
export interface StorageFunction {
|
export interface StorageFunction {
|
||||||
(arg?: any): Uint8Array;
|
(arg?: any): Uint8Array;
|
||||||
meta: StorageFunctionMetadata;
|
meta: StorageFunctionMetadata;
|
||||||
|
toJSON: () => any;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A representation of a storage key (typically hashed) in the system. It can be constructed
|
// A representation of a storage key (typically hashed) in the system. It can be constructed
|
||||||
|
|||||||
+17
-1
@@ -22,11 +22,27 @@ describe.skip('e2e subscriptions', () => {
|
|||||||
api.state
|
api.state
|
||||||
.storage([[storage.timestamp.now]])
|
.storage([[storage.timestamp.now]])
|
||||||
.subscribe((data) => {
|
.subscribe((data) => {
|
||||||
console.error('subscribe', data);
|
console.error('timestamp.now', data);
|
||||||
|
|
||||||
if (++count === 4) {
|
if (++count === 4) {
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('retrieves multiple values', (done) => {
|
||||||
|
api.state
|
||||||
|
.storage([
|
||||||
|
[storage.timestamp.now],
|
||||||
|
[storage.session.sessionLength],
|
||||||
|
[storage.staking.sessionsPerEra]
|
||||||
|
])
|
||||||
|
.subscribe((data) => {
|
||||||
|
console.error('multiples', data);
|
||||||
|
|
||||||
|
if (data !== undefined && data.filter((item) => item).length === 3) {
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
@@ -65,6 +65,7 @@ export default function createFunction (
|
|||||||
}
|
}
|
||||||
|
|
||||||
storageFn.meta = meta;
|
storageFn.meta = meta;
|
||||||
|
storageFn.toJSON = meta.toJSON;
|
||||||
|
|
||||||
return storageFn as StorageFunction;
|
return storageFn as StorageFunction;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user