项目作者: TRON-US

项目描述 :
soter-sdk-go
高级语言: Go
项目地址: git://github.com/TRON-US/soter-sdk-go.git
创建时间: 2020-01-07T07:10:01Z
项目社区:https://github.com/TRON-US/soter-sdk-go

开源协议:MIT License

下载


soter-sdk-go

This is an unofficial go interface to soter HTTP API.

Install

  1. 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”

  1. package main
  2. import (
  3. "fmt"
  4. "github.com/TRON-US/soter-sdk-go/soter"
  5. )
  6. func main() {
  7. url := "http://127.0.0.1:8101"
  8. privateKey := "c8f0884e706c761e80a9227736a4a595f56b43660041920a5e6765a9b8ac3ab7"
  9. userAddress := "TTCXimHXjen9BdTFW5JvcLKGWNm3SSuECF"
  10. sh := soter.NewShell(privateKey, userAddress, url)
  11. out, err := sh.AddFile(userAddress, "go.mod")
  12. if err != nil {
  13. panic(err)
  14. }
  15. fmt.Printf("%v\n", out)
  16. }

Query user balance

  1. package main
  2. import (
  3. "fmt"
  4. "github.com/TRON-US/soter-sdk-go/soter"
  5. )
  6. func main() {
  7. url := "http://127.0.0.1:8101"
  8. privateKey := "c8f0884e706c761e80a9227736a4a595f56b43660041920a5e6765a9b8ac3ab7"
  9. userAddress := "TTCXimHXjen9BdTFW5JvcLKGWNm3SSuECF"
  10. sh := soter.NewShell(privateKey, userAddress, url)
  11. out, err := sh.Balance()
  12. if err != nil {
  13. panic(err)
  14. }
  15. fmt.Printf("%v\n", out)
  16. }

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