Skip to content
Albert Castellana edited this page Jan 31, 2017 · 6 revisions

Welcome to NEM Nano Snippets

This repository contains several snippets that are common while developing apps for NEM's Nanowallet.

Feel free to add or improve any.

READ

Check if user has proper access
checkAccess()

Check if address owns a mosaic
ownsMosaic(address, namespace, mosaic)

Get all transactions from an address that have a message that contains a string
getTransactionMessagesWithString(address, str, start)

Get last message from an addresses transactions that contains a string
getLastMessagesWithString(address, str, start)

Check if an account can be owned (MultiSig of any combination N-M, N<=M, M<32)
isAvaliableForMultiSig(address)

WRITE

Non transacting

Create a HD account from a seed string. createBrainWallet(seed) This is very useful to create Pointer Accounts and Indexes that receive transaction messages to store information on the blockchain.

MultiSig related

Send a transaction that adds every account in ownerAccounts as a cosignatory of subjectAccount
sendOwnedBy(subjectFullAccount, ownerAccounts)

Transaction related

Send a minimal transaction that contains a message to a receiver (for now, max. 160 chars)
sendMessage(receiver, message, common)

Send a transaction that contains a mosaic. Extra XEM and/or a message can be added as well on the same transaction.
sendMosaic(recipient, namespaceId, mosaics, amount, common, options)

Basic send function that is used by all the above. This function broadcasts entity to the network from the account in common. This is not a standalone function.
send(entity, common)

This function verifies the account contained on the transferData object and fills it with it's missing pieces. This is not a standalone function but used by some of the above.
processTxData(transferData)