update payload creation
This commit is contained in:
parent
6b04c467f1
commit
af8f6e0dca
19
src/index.js
19
src/index.js
|
@ -6,16 +6,13 @@ const TTL = 10;
|
||||||
const POW_TARGET = 0.002;
|
const POW_TARGET = 0.002;
|
||||||
const CHANNEL = Web3.utils.sha3("status").slice(0, 10);
|
const CHANNEL = Web3.utils.sha3("status").slice(0, 10);
|
||||||
|
|
||||||
function createStatusPayload(
|
function createStatusPayload() {
|
||||||
{
|
let tag = '~#c4';
|
||||||
tag = '~#c4',
|
let content = 'Hello everyone';
|
||||||
content = 'Hello everyone',
|
let messageType = '~:public-group-user-message';
|
||||||
messageType = '~:public-group-user-message',
|
let clockValue = (new Date().getTime()) * 100;
|
||||||
clockValue = (new Date().getTime()) * 100,
|
let contentType = 'text/plain';
|
||||||
contentType = 'text/plain',
|
let timestamp = new Date().getTime();
|
||||||
timestamp = new Date().getTime(),
|
|
||||||
} = {},
|
|
||||||
) {
|
|
||||||
return asciiToHex(
|
return asciiToHex(
|
||||||
JSON.stringify([
|
JSON.stringify([
|
||||||
tag,
|
tag,
|
||||||
|
@ -61,7 +58,7 @@ function createStatusPayload(
|
||||||
sig: keys.sig, // signs the message using the keyPair ID
|
sig: keys.sig, // signs the message using the keyPair ID
|
||||||
ttl: TTL,
|
ttl: TTL,
|
||||||
topic: CHANNEL,
|
topic: CHANNEL,
|
||||||
payload: createStatusPayload("hello there"),
|
payload: createStatusPayload(),
|
||||||
powTime: POW_TIME,
|
powTime: POW_TIME,
|
||||||
powTarget: POW_TARGET
|
powTarget: POW_TARGET
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
|
Loading…
Reference in New Issue