@@ -14,6 +14,7 @@ import { StorageFunctionMetadata } from './Metadata';
|
||||
export interface StorageFunction {
|
||||
(arg?: any): Uint8Array;
|
||||
meta: StorageFunctionMetadata;
|
||||
toJSON: () => any;
|
||||
}
|
||||
|
||||
// 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
|
||||
.storage([[storage.timestamp.now]])
|
||||
.subscribe((data) => {
|
||||
console.error('subscribe', data);
|
||||
console.error('timestamp.now', data);
|
||||
|
||||
if (++count === 4) {
|
||||
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.toJSON = meta.toJSON;
|
||||
|
||||
return storageFn as StorageFunction;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user