account_sgx

package
v2.0.0-...-d7ce1a4 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Ping    = "/ping"
	Create  = "/create"
	Sign    = "/sign"
	Verify  = "/verify"
	IsExist = "/is-exist"

	PingMethod    = "GET"
	CreateMethod  = "GET"
	SignMethod    = "POST"
	VerifyMethod  = "POST"
	IsExistMethod = "POST"
)

test方便测试 (后期通过配置文件/填写参数形式)

Functions

This section is empty.

Types

type AccountSgx

type AccountSgx struct {
	// 钱包地址
	Address string

	// api client
	APISgx ApiClient
	// contains filtered or unexported fields
}

func CreateAccountSgx

func CreateAccountSgx(url string) (*AccountSgx, error)

创建账号

func RetrieveAccountSgx

func RetrieveAccountSgx(url, addr string) (*AccountSgx, error)

恢复账号

func (*AccountSgx) GetAuthRequire

func (a *AccountSgx) GetAuthRequire() string

GetAuthRequire get this account's authRequire for transaction. If you set contract account, returns $ContractAccount+"/"+$Address, otherwise returns $Address.

func (*AccountSgx) GetContractAccount

func (a *AccountSgx) GetContractAccount() string

GetContractAccount get current contract account, returns an empty string if the contract account is not set.

func (*AccountSgx) HasContractAccount

func (a *AccountSgx) HasContractAccount() bool

HasContractAccount reutrn true if you set contract account, otherwise returns false.

func (*AccountSgx) SetContractAccount

func (a *AccountSgx) SetContractAccount(contractAccount string) error

SetContractAccount set contract account. If you set contract account, this account represents the contract account. In some scenarios, must set contract account, such as deploy contract.

type ApiClient

type ApiClient interface {
	Ping(method string, args map[string]interface{}) (*Response, error)
	Create(method string, args map[string]interface{}) (*Response, error)
	Sign(method string, args map[string]interface{}) (*Response, error)
	Verify(method string, args map[string]interface{}) (*Response, error)
	IsExist(method string, args map[string]interface{}) (*Response, error)
}

通过接口提供相关服务

func NewApiClientXuperchain

func NewApiClientXuperchain(url string) ApiClient

type ApiClientXuperchain

type ApiClientXuperchain struct {
	URL string // 服务地址
}

封装请求api服务的结构体

func (*ApiClientXuperchain) Create

func (c *ApiClientXuperchain) Create(method string, args map[string]interface{}) (*Response, error)

func (*ApiClientXuperchain) IsExist

func (c *ApiClientXuperchain) IsExist(method string, args map[string]interface{}) (*Response, error)

func (*ApiClientXuperchain) Ping

func (c *ApiClientXuperchain) Ping(method string, args map[string]interface{}) (*Response, error)

func (*ApiClientXuperchain) Sign

func (c *ApiClientXuperchain) Sign(method string, args map[string]interface{}) (*Response, error)

func (*ApiClientXuperchain) Verify

func (c *ApiClientXuperchain) Verify(method string, args map[string]interface{}) (*Response, error)

type Response

type Response struct {
	Code int    `json:"code"` // 错误码
	Msg  string `json:"msg"`  // 信息提示
	Data []byte `json:"data"` // 返回数据
}

响应结果

Jump to

Keyboard shortcuts

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