fix: bigint
This commit is contained in:
parent
f7022b9c7b
commit
a32ebd6bd2
|
@ -1,10 +1,6 @@
|
||||||
pre-commit:
|
pre-commit:
|
||||||
parallel: true
|
parallel: true
|
||||||
commands:
|
commands:
|
||||||
lint:
|
|
||||||
files: git diff --name-only @{push}
|
|
||||||
glob: "*.{js,ts,jsx,tsx}"
|
|
||||||
run: npx eslint {files}
|
|
||||||
types:
|
types:
|
||||||
files: git diff --name-only @{push}
|
files: git diff --name-only @{push}
|
||||||
glob: "*.{js,ts, jsx, tsx}"
|
glob: "*.{js,ts, jsx, tsx}"
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
"version": "0.0.9",
|
"version": "0.0.9",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"base-64": "^1.0.0"
|
"base-64": "^1.0.0",
|
||||||
|
"big-integer": "^1.6.51"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@arkweid/lefthook": "^0.7.7",
|
"@arkweid/lefthook": "^0.7.7",
|
||||||
|
@ -5212,8 +5213,8 @@
|
||||||
},
|
},
|
||||||
"node_modules/big-integer": {
|
"node_modules/big-integer": {
|
||||||
"version": "1.6.51",
|
"version": "1.6.51",
|
||||||
"dev": true,
|
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz",
|
||||||
"license": "Unlicense",
|
"integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.6"
|
"node": ">=0.6"
|
||||||
}
|
}
|
||||||
|
@ -19921,7 +19922,8 @@
|
||||||
},
|
},
|
||||||
"big-integer": {
|
"big-integer": {
|
||||||
"version": "1.6.51",
|
"version": "1.6.51",
|
||||||
"dev": true
|
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz",
|
||||||
|
"integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg=="
|
||||||
},
|
},
|
||||||
"bl": {
|
"bl": {
|
||||||
"version": "5.0.0",
|
"version": "5.0.0",
|
||||||
|
|
55
package.json
55
package.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@waku/react-native",
|
"name": "@waku/react-native",
|
||||||
"version": "0.0.9",
|
"version": "0.0.10",
|
||||||
"description": "Waku React Native",
|
"description": "Waku React Native",
|
||||||
"author": "Status Research & Development GMBH",
|
"author": "Status Research & Development GMBH",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
@ -54,31 +54,31 @@
|
||||||
"registry": "https://registry.npmjs.org/"
|
"registry": "https://registry.npmjs.org/"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@arkweid/lefthook": "^0.7.7",
|
"@arkweid/lefthook": "^0.7.7",
|
||||||
"@babel/eslint-parser": "^7.18.2",
|
"@babel/eslint-parser": "^7.18.2",
|
||||||
"@commitlint/config-conventional": "^17.0.2",
|
"@commitlint/config-conventional": "^17.0.2",
|
||||||
"@react-native-community/eslint-config": "^3.0.2",
|
"@react-native-community/eslint-config": "^3.0.2",
|
||||||
"@release-it/conventional-changelog": "^5.0.0",
|
"@release-it/conventional-changelog": "^5.0.0",
|
||||||
"@types/base-64": "^1.0.0",
|
"@types/base-64": "^1.0.0",
|
||||||
"@types/jest": "^28.1.2",
|
"@types/jest": "^28.1.2",
|
||||||
"@types/react": "~17.0.21",
|
"@types/react": "~17.0.21",
|
||||||
"@types/react-native": "0.68.0",
|
"@types/react-native": "0.68.0",
|
||||||
"commitlint": "^17.0.2",
|
"commitlint": "^17.0.2",
|
||||||
"eslint": "^8.4.1",
|
"eslint": "^8.4.1",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
"jest": "^28.1.1",
|
"jest": "^28.1.1",
|
||||||
"pod-install": "^0.1.0",
|
"pod-install": "^0.1.0",
|
||||||
"prettier": "^2.0.5",
|
"prettier": "^2.0.5",
|
||||||
"react": "17.0.2",
|
"react": "17.0.2",
|
||||||
"react-native": "0.68.2",
|
"react-native": "0.68.2",
|
||||||
"react-native-builder-bob": "^0.18.3",
|
"react-native-builder-bob": "^0.18.3",
|
||||||
"release-it": "^15.0.0",
|
"release-it": "^15.0.0",
|
||||||
"typescript": "^4.5.2"
|
"typescript": "^4.5.2"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"@types/react": "17.0.21"
|
"@types/react": "17.0.21"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "*",
|
"react": "*",
|
||||||
"react-native": "*"
|
"react-native": "*"
|
||||||
|
@ -158,6 +158,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"base-64": "^1.0.0"
|
"base-64": "^1.0.0",
|
||||||
|
"big-integer": "^1.6.51"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { NativeModules, Platform, NativeEventEmitter } from 'react-native';
|
import { NativeModules, Platform, NativeEventEmitter } from 'react-native';
|
||||||
import { decode, encode } from 'base-64';
|
import { decode, encode } from 'base-64';
|
||||||
|
import bigInt from 'big-integer';
|
||||||
|
|
||||||
const LINKING_ERROR =
|
const LINKING_ERROR =
|
||||||
`The package '@waku/react-native' doesn't seem to be linked. Make sure: \n\n` +
|
`The package '@waku/react-native' doesn't seem to be linked. Make sure: \n\n` +
|
||||||
|
@ -22,7 +23,7 @@ export function multiply(a: number, b: number): Promise<number> {
|
||||||
return ReactNative.multiply(a, b);
|
return ReactNative.multiply(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
const OneMillion = BigInt(1_000_000);
|
const OneMillion = bigInt(1_000_000);
|
||||||
|
|
||||||
export class WakuMessage {
|
export class WakuMessage {
|
||||||
payload: Uint8Array = new Uint8Array();
|
payload: Uint8Array = new Uint8Array();
|
||||||
|
@ -36,7 +37,7 @@ export class WakuMessage {
|
||||||
contentTopic: this.contentTopic,
|
contentTopic: this.contentTopic,
|
||||||
version: this.version,
|
version: this.version,
|
||||||
timestamp: this.timestamp
|
timestamp: this.timestamp
|
||||||
? (BigInt(this.timestamp.valueOf()) * OneMillion).toString(10)
|
? bigInt(this.timestamp.valueOf()).multiply(OneMillion).toString(10)
|
||||||
: 0,
|
: 0,
|
||||||
payload: b64encoded,
|
payload: b64encoded,
|
||||||
};
|
};
|
||||||
|
@ -715,10 +716,10 @@ export function storeQuery(
|
||||||
pubsubTopic: query.pubsubTopic,
|
pubsubTopic: query.pubsubTopic,
|
||||||
contentFilters: query.contentFilters,
|
contentFilters: query.contentFilters,
|
||||||
startTime: query.startTime
|
startTime: query.startTime
|
||||||
? (BigInt(query.startTime.valueOf()) * OneMillion).toString(10)
|
? bigInt(query.startTime.valueOf()).multiply(OneMillion).toString(10)
|
||||||
: 0,
|
: 0,
|
||||||
endTime: query.endTime
|
endTime: query.endTime
|
||||||
? (BigInt(query.endTime.valueOf()) * OneMillion).toString(10)
|
? bigInt(query.endTime.valueOf()).multiply(OneMillion).toString(10)
|
||||||
: 0,
|
: 0,
|
||||||
pagingOptions: query.pagingOptions,
|
pagingOptions: query.pagingOptions,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue