1.0.2 • Published 2 years ago

@xeggo/sdk v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Xeggo-SDK Documentation

1. Introduction

1.1 About Xeggo Streaming Service

Xeggo is a Token/ Money streaming platform, built on the Celo blockchain. The user can create, start or schedule money streams which will enable funds to be transferred to the target reciever over a period of time with a defined rate of transfer. This manual provides technical details and instructions of the Xeggo SDK and how to make use of it in your projects.

2. Initial Setup

The following procedure describes how you initialise the setup to use Xeggo functionalities in your project.

To initialise Xeggo SDK without private key

import{framework} from './framework.js'
//Use setContractInstance() and setTokenInstance() if you don't want to use default contract and token.
const xeggo = new framework
xeggo.initialiseWithNetworkName('Alfajores')//Enter name of the network here, *Only for call functions not for sending transactions to the smart contract*

await xeggo.getStreamBalance(streamId,recepient)//Example of call function
await xeggo.getStreamObject(streamId)//Example of call function

To initialise Xeggo SDK with private key( To send transactions to functions )

import { framework } from './framework.js'
const xeggo = new framework
xeggo.initialiseWithKeyNetworkName('privateKey', 'NetworkName');//Enter private key and Network Name.
//You can send functions to the Xeggo contract with this initialisation.
await xeggo.createStream('recepient', deposit, 'tokenAddress', streamTime)//Example of a send function.

3. Available functions

xeggo.getBalance(): Returns the balance of the stream in number of tokens

xeggo.getStream():Returns details of a stream

xeggo.cancelStream():Cancels ongoing/ started streams

xeggo.createStream():Creates/ Starts a new stream

xeggo.withdrawFromStream():Withdraws funds from completed stream (For recipient)

3.1 Some other functions available

To print the ABI of available contracts in the Xeggo SDK

import {getAbi, getAddress} from './kit.js'
console.log(getAbi(contract))//Enter name of contract to get the ABI of contract. 
//[Available Contracts:"xeggo","token"] 
import {getAbi, getAddress} from './kit.js'
console.log(getAddress(networkName, contract))//Enter name of the network and name of contract to get the address of contract in respective network. 
//[Available Neworks:"alfajores","Mainnet","Baklava"]
//[Available Contracts]: "xeggo", "token_address", "xeggo_address"