Chat-as-a-library

A SDK library that Harmony apps can integrate and let users to send text message and $ONE to another user.

Send

The SDK takes following parameters from the sender:

  • Receipient address
  • A text message, max 140 bytes
  • A number of ONE tokens
  • A timeout period (min 1 hour)

Once submitted, the Chat smart contact will hold the text message and $ONE for the receipient to receive.

Receive

The SDK can list all the messages of the user, both read and unread. For unread messages, client can receive the $ONE by replying the message:

  • A text message to reply, max 140 bytes

Once receipient replied the message, the $ONE attached by the sender will be transferred to the receipient's address.

Timeout

If the receipient doesn't answer the message within the timeout period set by the sender, the smart contract will return the $ONE to the sender.

Optional Extension

  • Harmony users can set a friendly id (e.g. stephen) which others can use to send message and $ONE
  • Users can set a minimun fee to receive messages. In that case a sender has to attach $ONE equal or more than that amount to be able to send a message