Skip to content

Commit

Permalink
rpc type definition + enable test net (#458)
Browse files Browse the repository at this point in the history
* rpc type definition + enable test net
  • Loading branch information
KarishmaBothara authored Apr 5, 2022
1 parent eb79aa4 commit 76c92bb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
10 changes: 6 additions & 4 deletions packages/api/src/derives/governance/overview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ export function proposals(instanceId: string, api: ApiInterfaceRx) {
return combineLatest([
api.query.governance.proposalCalls.multi(queryArgsList.map((arg) => [arg.proposalId])),
api.query.governance.proposals.multi(queryArgsList.map((arg) => [arg.proposalId])),
(api.rpc as any).governance.getProposalVotes(),
api.rpc.governance.getProposalVotes(),
]).pipe(
map(
([proposalCalls, proposals, votes]:
| [[], Vec<Option<Proposal>>, Vec<ProposalVotes>]
| [any]): DeriveProposalInfo[] => {
([proposalCalls, proposals, votes]: [
[],
Vec<Option<Proposal>>,
Vec<ProposalVotes>
]): DeriveProposalInfo[] => {
const proposalDetails = proposalCalls.map((call, idx) => {
if (proposals[idx].isSome) {
const proposalDetail = proposals[idx].unwrap().toJSON();
Expand Down
13 changes: 6 additions & 7 deletions packages/api/test/e2e/ethBridge.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,13 @@ describe('Eth bridge test', () => {
});

it( 'Get event id from rpc call', async done => {
// TODO - uncomment the following when rata is healthy again..
// api = await Api.create({network: 'rata'});
// const versionedEventProof = (await api.rpc.ethy.getEventProof('0')).toJSON();
// expect(versionedEventProof.EventProof.eventId.toString()).toEqual('0');
const eventId = api.registry.createType('EthyEventId',1);
const eventProof = await api.derive.ethBridge.eventProof(eventId);
api = await Api.create({network: 'rata'});
const versionedEventProof = (await api.rpc.ethy.getEventProof('1')).toJSON();
expect(versionedEventProof.eventProof.eventId.toString()).toEqual('1');

const eventProof = await api.derive.ethBridge.eventProof('2');
console.log('Proof::',eventProof);
expect(eventProof.eventId).toEqual('1');
expect(eventProof.eventId).toEqual('2');
done();
})

Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@cennznet/types/*": ["packages/types/src/*"],
"@cennznet/types": ["packages/types/src/index"],
"@polkadot/api/augment": ["packages/types/src/interfaces/augment-api.ts"],
"@polkadot/rpc/augment": ["packages/types/src/interfaces/augment-api-rpc.ts"],
"@polkadot/types/augment": ["packages/types/src/interfaces/augment-types.ts"],
"@polkadot/types/lookup": ["packages/types/src/interfaces/types-lookup.ts"]
},
Expand Down

0 comments on commit 76c92bb

Please sign in to comment.