soter-sdk-go

module
v0.0.0-...-c07167e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2020 License: MIT

README

soter-sdk-go

This is an unofficial go interface to soter HTTP API.

Install

go get -u github.com/TRON-US/soter-sdk-go

Usage

Soter provides a list of HTTP endpoints/services for users to store files in BTFS, but it could be kind of complex if a user is not familiar with Soter. This soter-sdk-go provides users with a handy way to interact with Soter.

Example
Add a file

Add a file named as "hello.txt"

package main

import (
	"fmt"

	"github.com/TRON-US/soter-sdk-go/soter"
)

func main() {
	url := "http://127.0.0.1:8101"
	privateKey := "c8f0884e706c761e80a9227736a4a595f56b43660041920a5e6765a9b8ac3ab7"
	userAddress := "TTCXimHXjen9BdTFW5JvcLKGWNm3SSuECF"

	sh := soter.NewShell(privateKey, userAddress, url)

	out, err := sh.AddFile(userAddress, "go.mod")
	if err != nil {
		panic(err)
	}
	fmt.Printf("%v\n", out)
}
Query user balance
package main

import (
	"fmt"

	"github.com/TRON-US/soter-sdk-go/soter"
)

func main() {
	url := "http://127.0.0.1:8101"
	privateKey := "c8f0884e706c761e80a9227736a4a595f56b43660041920a5e6765a9b8ac3ab7"
	userAddress := "TTCXimHXjen9BdTFW5JvcLKGWNm3SSuECF"

	sh := soter.NewShell(privateKey, userAddress, url)

	out, err := sh.Balance()
	if err != nil {
		panic(err)
	}
	fmt.Printf("%v\n", out)
}
Set autopay subscription

An example about how to set autopay subscription can be checked here.

Update user information

An example about how to update user information can be checked here.

Query user deposit history

An example about how to query user deposit history can be checked here.

Query user order list

An example about how to query user order list can be checked here.

Query user uploaded files

An example about how to query user uploaded files can be checked here.

Query order details

An example about how to query order details can be checked here.

Query user profile

An example about how to query user profile can be checked here.

License

MIT

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL