Easy-to-use module based on the official IOTA-MAM-Library.
To add the library to your project just install it it via npm.
npm install https://github.com/ollibertinho/Simplified-MAM-Lib --save
MAMLib(iota, seed, caching)
- iota iota (instance of the IOTA library)
- seed string (seed of the channel)
- caching boolean (activates message-index-caching)
Sets the channel-mode (public, restricted, private). Default is public.
setChannelMode(mode, restrictedSideKeyTrytes)
- mode string ('public','restricted', 'private')
- restrictedSideKeyTrytes string (optional: side-key)
Asynchronous method for publishing messages. Callback-function will be called, when message is successfully published.
publishMessage(data, callback)
- data string
- callback function(data)
Static method for fetching channel-data. Callback-function will be called, once a message is received.
fetchMessages(mamdata, callback)
- mamdata MAMFetchData
- callback function(data)
function MAMFetchData(iota, root) {
this.root = root;
this.iota = iota;
this.sideKey = null;
this.mode = "public";
}
- iota iota (instance of the IOTA library)
- root string (root-address of the channel)
- ollibertinho - Tangle-Army - Tangle.Army
SLVIISLDJRBKYERQCMDCNMABVKVPNQBGTWJBGXNOU9JGQZNIXMVXKMXSGZHTR9P9BZUH9NEKMKOGYEHFWFDYNPFKGY