Skip to content
/ sdk Public

Another way to interact to Respont smart contract. Respont is fully decentralized app for secure communication for each people.

License

Notifications You must be signed in to change notification settings

therespont/sdk

Repository files navigation

Respont SDK

Website npm (tag) Twitter Follow

Another way to interact to Respont smart contract. Respont is fully decentralized app for secure communication for each people.

Installing

Using Node.js

npm install @respont/app

Usage

Import

import * as Respont from "@respont/app";

Connection

const respont = new Respont.Connect(walletKey, JSON_RPC);

Note: Connect() first parameter can be filled with private key or mnemonic phrases. We are now only supported mumbai polygon testnet (80001 / 13881)

Interactions

const interact = new Interactions(respont);

What can do:

GetKeyLocation

Function to get key location in Oasis Privacy Layer with confidential contract. Return Address

AMessage

Function to get one last message from/to an address. Parameter: Address Return Message

Opponents

Function to get interlocutors. Parameters: BeforeHeight and Limit Return array of Message

Message

Function to get messages from a interlocutor. Parameters: BeforeHeight and Limit Return array of Message

SendMessage

Function to send a message to a interlocutor. Parameters: To (Address), message (string), and Media Return: Please refer to ethers transaction return in their documentation

GetPicture

Function to get profile picture of a address. Parameters: Address Return: String with format https url format.

ChangePicture

Function to get change profile picture of connected address. Parameters: Media Return: Please refer to ethers transaction return in their documentation

GetBlocked

Function to get interlocutors address blocked by connected address. Return: Array Address

AddBlockList

Function to block a interlocutor address. Parameter: Address Return: Please refer to ethers transaction return in their documentation

RemoveBlockList

Function to unblock a interlocutor address. Parameter: Address Return: Please refer to ethers transaction return in their documentation

Parameters

Address

Parameter basically is a string but with 42-character hexadecimal. Please refer to ethers.js documentation.

BeforeHeight

Parameter with type data integer. The functional is for cursor due to resource efficiency. Example of use is last BlockHeight from Message return

Media

Parameter with type data array contain string which the urls of media (image, file, etc). Note the media urls accepted format is https url.

Return

Return Address

It is a string with 42-character hexadecimal. Please refer to ethers.js documentation.

Return Message

It is human-read message object. Object contents:

  • FromAddress: Address
  • ToAddress: Address
  • MessageText: string
  • MediaLink: Array Media
  • MessageTimestamp: Integer
  • BlockHeight: Integer

Return Media

It is a string with https urls format.

Events

const listen = new Respont.Listen(respont);
listen.on(eventName, functionEventHandler);
Event Name Argument Description
PictureChanged Owner(Address), MediaLink(Media) Notify every address changed their profile picture.
Sent Sender(Address), Receiver(Address) Notify a new message from/to connected address.
BlockListAdded Owner(Address), BlockedAddress(Array Address) Notify every blocked interlocutor by connected address.
BlockListRemoved Owner(Address), BlockedAddress(Address) Notify every ubblocked interlocutor by connected address.
block blockNumber(Integer) Notify every new generated block.

Detail: Github / SDK Documentation / Architecture Documentation

About

Another way to interact to Respont smart contract. Respont is fully decentralized app for secure communication for each people.

Resources

License

Stars

Watchers

Forks

Packages

No packages published