Skip to content

Commit

Permalink
refactor all packages according to new proto
Browse files Browse the repository at this point in the history
  • Loading branch information
danisharora099 committed Mar 16, 2023
1 parent 1532083 commit b3e5e41
Show file tree
Hide file tree
Showing 21 changed files with 458 additions and 185 deletions.
266 changes: 264 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions packages/core/src/lib/filter/filter_rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ export class FilterRpc {
contentFilters: ContentFilter[],
requestId?: string,
subscribe = true
): FilterRpc {
return new FilterRpc({
): proto.FilterRpc {
const request = new proto.FilterRequest({
subscribe,
topic,
contentFilters: contentFilters.map((f) =>
proto.FilterRequest_ContentFilter.fromJsonString(f.contentTopic)
),
});
return new proto.FilterRpc({
requestId: requestId || uuid(),
request: {
subscribe,
topic,
contentFilters,
},
push: undefined,
request,
});
}

Expand All @@ -34,7 +36,7 @@ export class FilterRpc {
* @returns FilterRpc
*/
static decode(bytes: Uint8Array): FilterRpc {
const res = proto.FilterRpc.decode(bytes);
const res = proto.FilterRpc.fromBinary(bytes);
return new FilterRpc(res);
}

Expand All @@ -43,7 +45,7 @@ export class FilterRpc {
* @returns Uint8Array
*/
encode(): Uint8Array {
return proto.FilterRpc.encode(this.proto);
return new proto.FilterRpc(this.proto).toBinary();
}

get push(): proto.MessagePush | undefined {
Expand Down
Loading

0 comments on commit b3e5e41

Please sign in to comment.