JavaScript

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 / 0x13881)

The returns:

  • address: To get connected EVM wallet address.

  • publicKey: To get connected EVM public key.

  • privateKey(): To get connected EVM private key.

  • mnemonic(): To get connected EVM mnemonic phrases, if the return is null means should be use privateKey() function.

Interactions

const interact = new Respont.Interactions(respont);

What can be done:

GetKeyLocation

Function to get a 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 an interlocutor. Parameters: BeforeHeight and Limit. Return array of Message

SendMessage

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

GetPicture

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

ChangePicture

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

GetBlocked

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

AddBlockList

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

RemoveBlockList

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

Parameters

Address

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

BeforeHeight

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

Media

The Parameter with type data array contains a string which the URLs of media (image, file, etc). Note the media URL's accepted format is https URL.

Return

Return Address

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

Return Message

It is a 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 that changed their profile picture.

Sent

Sender(Address), Receiver(Address)

Notify a new message from/to the connected address.

BlockListAdded

Owner(Address), BlockedAddress(Array Address)

Notify every blocked interlocutor by connected address.

BlockListRemoved

Owner(Address), BlockedAddress(Address)

Notify every unblocked interlocutor by connected address.

block

blockNumber(Integer)

Notify every newly generated block.

Detail: Github / SDK Documentation / Architecture Documentation

Last updated