mirror of https://github.com/status-im/js-waku.git
cleanup: Migrate from ts-proto to protons
This commit is contained in:
parent
ca11dbf90c
commit
43e9de6fe2
|
@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Published files moved from `build` to `dist/`.
|
- 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
|
## [0.24.0] - 2022-05-27
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,6 @@ To help ensure your PR passes, just run before committing:
|
||||||
To build and test this repository, you need:
|
To build and test this repository, you need:
|
||||||
|
|
||||||
- [Node.js & npm](https://nodejs.org/en/).
|
- [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).
|
- Chrome (for browser testing).
|
||||||
- g++ & make (to build nim-waku)
|
- g++ & make (to build nim-waku)
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import * as version_1 from "./version_1";
|
||||||
|
|
||||||
const DefaultVersion = 0;
|
const DefaultVersion = 0;
|
||||||
const dbg = debug("waku:message");
|
const dbg = debug("waku:message");
|
||||||
|
const OneMillion = BigInt(1_000_000);
|
||||||
|
|
||||||
export enum DecryptionMethod {
|
export enum DecryptionMethod {
|
||||||
Asymmetric = "asymmetric",
|
Asymmetric = "asymmetric",
|
||||||
|
@ -103,7 +104,7 @@ export class WakuMessage {
|
||||||
payload: _payload,
|
payload: _payload,
|
||||||
timestampDeprecated: timestamp.valueOf() / 1000,
|
timestampDeprecated: timestamp.valueOf() / 1000,
|
||||||
// milliseconds 10^-3 to nanoseconds 10^-9
|
// milliseconds 10^-3 to nanoseconds 10^-9
|
||||||
timestamp: BigInt(timestamp.valueOf()) * BigInt(1_000_000),
|
timestamp: BigInt(timestamp.valueOf()) * OneMillion,
|
||||||
version,
|
version,
|
||||||
contentTopic,
|
contentTopic,
|
||||||
},
|
},
|
||||||
|
@ -283,7 +284,7 @@ export class WakuMessage {
|
||||||
try {
|
try {
|
||||||
if (this.proto.timestamp) {
|
if (this.proto.timestamp) {
|
||||||
// nanoseconds 10^-9 to milliseconds 10^-3
|
// 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));
|
return new Date(Number(timestamp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -221,7 +221,6 @@ export class WakuStore {
|
||||||
|
|
||||||
const response = reply.response as protoV2Beta4.HistoryResponse;
|
const response = reply.response as protoV2Beta4.HistoryResponse;
|
||||||
|
|
||||||
console.log("Response", response);
|
|
||||||
if (response.error && response.error !== Error.ERROR_NONE_UNSPECIFIED) {
|
if (response.error && response.error !== Error.ERROR_NONE_UNSPECIFIED) {
|
||||||
throw "History response contains an Error: " + response.error;
|
throw "History response contains an Error: " + response.error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue