Last active
February 5, 2017 19:46
-
-
Save acastellana/11a3390f8cb11806ad020c64f249af46 to your computer and use it in GitHub Desktop.
sendMessage(receiver, message, common)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* REQUIRES: | |
* - https://gist.github.com/acastellana/995326e3a41b5f690db50a17153af312 | |
* - https://gist.github.com/acastellana/607a47838e842417d80622568543eb74 | |
*/ | |
/** | |
* sendMessage(recipientAccount, message, common) Sends a minimal transaction containing a message to poin | |
* | |
* @param {object} receiver - Transaction receiver's account | |
* @param {string} message - Message to be sent | |
* @param {object} common - password/privateKey object | |
* | |
* @return {promise} - An announce transaction promise of the NetworkRequests service | |
*/ | |
sendMessage(receiver, message, common) { | |
var transferData = {} | |
// Check that the receiver is a valid account and process it's public key | |
transferData.recipient = receiver; | |
this.processTxData(transferData); | |
// transferData.receiverPubKey is set now | |
transferData.amount = 0; | |
transferData.message = message; | |
transferData.encryptMessage = false; // Maybe better to encrypt? | |
transferData.isMultisig = false; | |
transferData.isMosaicTransfer = false; | |
// Build the entity to be sent | |
let entity = this._Transactions.prepareTransfer(common, transferData, this.mosaicsMetaData); | |
return this.send(entity, common); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment