Skip to content

Instantly share code, notes, and snippets.

@acastellana
Created January 27, 2017 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acastellana/5b203c74ae895778c7bf268521818814 to your computer and use it in GitHub Desktop.
Save acastellana/5b203c74ae895778c7bf268521818814 to your computer and use it in GitHub Desktop.
getLastMessagesWithString(address,str,start)
/*
* REQUIRES:
* - https://gist.github.com/acastellana/320c2e0fa722d9526e98f021d2e5a3b2
*/
/**
* getLastMessagesWithString(address,str,start) Obtains the last Message that contains string after position start
*
* @param {string} address - NEM Address to explore
* @param {string} str - String to find on addresses txs
* @param {integer} start - Starting position in the transaction message to search
*
* @return {promise} - A promise of the NetworkRequests service that returns a string with the filtered message
*/
getLastMessagesWithString(address,str,start){
var deferred = this._q.defer();
var promise = deferred.promise;
this.getTransactionMessagesWithString(address,str,start).then((result)=>{
deferred.resolve(result[result.length-1]);
});
return deferred.promise;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment