Skip to content

Commit

Permalink
Merge c1b8c77 into 3f997a1
Browse files Browse the repository at this point in the history
  • Loading branch information
jacogr committed Oct 1, 2018
2 parents 3f997a1 + c1b8c77 commit 3c68f8f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/api-codec/src/StorageKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});
});
});
1 change: 1 addition & 0 deletions packages/type-storage/src/utils/createFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export default function createFunction (
}

storageFn.meta = meta;
storageFn.toJSON = meta.toJSON;

return storageFn as StorageFunction;
}

0 comments on commit 3c68f8f

Please sign in to comment.