cleanup: Migrate from ts-proto to protons

This commit is contained in:
Franck Royer 2022-06-15 21:17:46 +10:00
parent ca11dbf90c
commit 43e9de6fe2
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
4 changed files with 5 additions and 5 deletions

View File

@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Published files moved from `build` to `dist/`.
- Migrate from ts-proto to protons;
the latter does not bring Buffer/Long deps, is ESM compatible and remove the need for bufbuild and protoc.
## [0.24.0] - 2022-05-27

View File

@ -20,8 +20,6 @@ To help ensure your PR passes, just run before committing:
To build and test this repository, you need:
- [Node.js & npm](https://nodejs.org/en/).
- [bufbuild](https://github.com/bufbuild/buf) (only if changing protobuf files).
- [protoc](https://grpc.io/docs/protoc-installation/) (only if changing protobuf files).
- Chrome (for browser testing).
- g++ & make (to build nim-waku)

View File

@ -7,6 +7,7 @@ import * as version_1 from "./version_1";
const DefaultVersion = 0;
const dbg = debug("waku:message");
const OneMillion = BigInt(1_000_000);
export enum DecryptionMethod {
Asymmetric = "asymmetric",
@ -103,7 +104,7 @@ export class WakuMessage {
payload: _payload,
timestampDeprecated: timestamp.valueOf() / 1000,
// milliseconds 10^-3 to nanoseconds 10^-9
timestamp: BigInt(timestamp.valueOf()) * BigInt(1_000_000),
timestamp: BigInt(timestamp.valueOf()) * OneMillion,
version,
contentTopic,
},
@ -283,7 +284,7 @@ export class WakuMessage {
try {
if (this.proto.timestamp) {
// nanoseconds 10^-9 to milliseconds 10^-3
const timestamp = this.proto.timestamp / BigInt(1_000_000);
const timestamp = this.proto.timestamp / OneMillion;
return new Date(Number(timestamp));
}

View File

@ -221,7 +221,6 @@ export class WakuStore {
const response = reply.response as protoV2Beta4.HistoryResponse;
console.log("Response", response);
if (response.error && response.error !== Error.ERROR_NONE_UNSPECIFIED) {
throw "History response contains an Error: " + response.error;
}