index.js
/**
     * Post a whisper
     * 
     * @param {*} payload optional payload serializable with JSON.stringify
     * @param {Object} options see web3.shh.post docs
     * @param {boolean} useSymKey optional, if true set undefined the pubKey else set undefined the symKeyID. Default to !this.options.pubKey.
     * @return {Promise<string>} the hash of the message
     */
Post a whisper

@param {*} payload optional payload serializable with JSON.stringify
@param {Object} options see web3.shh.post docs
@param {boolean} useSymKey optional, if true set undefined the pubKey else set undefined the symKeyID.
Post a whisper @param { * } payload optional payload serializable with JSON . stringify @param { Object } options see web3 . shh . post docs @param { boolean } useSymKey optional if true set undefined the pubKey else set undefined the symKeyID .
post(payload, options = {}) {
        const mergedOptions = Object.assign({}, {
            symKeyID: options.useSymKey ? this.options.symKeyID : undefined,
            pubKey: options.useSymKey ? undefined : this.options.pubKey,
            sig: this.options.sig,
            ttl: this.options.ttl,
            topic: this.options.topic,
            payload: this.web3.utils.toHex(JSON.stringify(payload)),
            padding: this.options.padding,
            powTime: this.options.powTime,
            powTarget: this.options.powTarget,
            targetPeer: this.options.targetPeer
        }, options);
        return this.web3.shh.post(mergedOptions);
    }
post ( payload , options = { } ) { const mergedOptions = Object . assign ( { } , { symKeyID : options . useSymKey ? this . options . symKeyID : undefined , pubKey : options . useSymKey ? undefined : this . options . pubKey , sig : this . options . sig , ttl : this . options . ttl , topic : this . options . topic , payload : this . web3 . utils . toHex ( JSON . stringify ( payload ) ) , padding : this . options . padding , powTime : this . options . powTime , powTarget : this . options . powTarget , targetPeer : this . options . targetPeer } , options ) ; return this . web3 . shh . post ( mergedOptions ) ; }
Post a whisper
Post a whisper