bean

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MODE_DEFAULT = 0
	MODE_ASYNC   = 1
	MODE_SYNC    = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContractCallTx

type ContractCallTx struct {
	GasLimit        uint64 `json:"gasLimit"` // gas限额
	GasPrice        string `json:"gasPrice"` // gas价格
	Sender          string `json:"sender"`   // 交易发起者公钥
	Privkey         string `json:"privkey"`  // 交易发起者私钥
	Value           string `json:"value"`    // 金额,通常为0
	ContractAddress string `json:"contract"` // 合约地址
	Payload         string `json:"payload"`  // 负载数据,abi.pack(function+参数) hex编码字符串
}

func (*ContractCallTx) Check

func (tx *ContractCallTx) Check() error

type ContractDeployTx

type ContractDeployTx struct {
	GasLimit uint64 `json:"gasLimit"` // gas限额
	GasPrice string `json:"gasPrice"` // gas价格
	Sender   string `json:"sender"`   // 交易发起者公钥
	Privkey  string `json:"privkey"`  // 交易发起者私钥
	Value    string `json:"value"`    // 交易金额,通常为0
	Payload  string `json:"payload"`  // 合约部署字节码
	Memo     string `json:"memo"`     // 备注
}

func (*ContractDeployTx) Check

func (tx *ContractDeployTx) Check() error

type ContractInvokeTx

type ContractInvokeTx struct {
	GasLimit        uint64 `json:"gasLimit"` // gas限额
	GasPrice        string `json:"gasPrice"` // gas价格
	Sender          string `json:"sender"`   // 交易发起者公钥
	Privkey         string `json:"privkey"`  // 交易发起者私钥
	Value           string `json:"value"`    // 交易金额
	ContractAddress string `json:"contract"` // 合约地址
	Payload         string `json:"payload"`  // 合约负载 abi.pack(function+参数)
	Memo            string `json:"memo"`     // 备注
}

func (*ContractInvokeTx) Check

func (tx *ContractInvokeTx) Check() error

type EbuycoinResponse

type EbuycoinResponse struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
	Data Ticker `json:"data"`
}

type EvmCallResult

type EvmCallResult = struct {
	Code    uint32 `json:"code"`    // 错误码
	Msg     string `json:"msg"`     // msg
	Ret     string `json:"ret"`     // 返回数据的hex编码
	GasUsed uint64 `json:"gasUsed"` // 消耗的gas
}

type MultiSignature

type MultiSignature struct {
	PubKey     PubKeyMultisigThreshold `json:"pubKey"`     // 多签公钥
	Signatures []string                `json:"signatures"` // 用户签名列表
}

type Operation

type Operation struct {
	To    string `json:"to"`    // 交易接受方地址,可以是普通用户地址、合约地址、节点账户地址
	Value string `json:"value"` // 交易金额
}

type PubKeyMultisigThreshold

type PubKeyMultisigThreshold struct {
	K       int      `json:"threshold"` // 多签阈值
	PubKeys []string `json:"pubkeys"`   // 多签用户公钥列表
}

type PublicResp

type PublicResp struct {
	IsSuccess bool        `json:"isSuccess"` // 是否成功
	Message   string      `json:"message"`   // 消息提醒
	Result    interface{} `json:"result"`    // 数据对象
}

type SignEvmTx

type SignEvmTx struct {
	CreatedAt uint64 `json:"createdAt"` // 时间戳,可选
	GasLimit  uint64 `json:"gasLimit"`  // gas限额
	GasPrice  string `json:"gasPrice"`  // gas价格,最低为1
	Nonce     uint64 `json:"nonce"`     // 交易发起者nonce
	Sender    string `json:"sender"`    // 交易发起者公钥
	Body      struct {
		To    string `json:"to"`    // 交易接受者地址或合约地址
		Value string `json:"value"` // 交易金额
		Load  string `json:"load"`  // 合约负载,普通原声币转账时为空
		Memo  string `json:"memo"`  // 备注
	} `json:"body"`
	PrivateKey string // 私钥
}

func (*SignEvmTx) Check

func (tx *SignEvmTx) Check() error

type SignedBatchTx

type SignedBatchTx struct {
	Mode      int         `json:"mode"`       // 模式:0-default/commit 1-async 2-sync
	CreatedAt uint64      `json:"createdAt"`  // 时间戳,可选字段,秒/毫秒均可
	GasLimit  uint64      `json:"gasLimit"`   // gas限额
	GasPrice  string      `json:"gasPrice"`   // gas价格,至少为1
	Nonce     uint64      `json:"nonce"`      // 用户nonce,每次交易前从链上获取,每次交易nonce+1
	Sender    string      `json:"sender"`     // 交易发起者公钥
	Ops       []Operation `json:"operations"` // 交易列表,数量不可大于10000笔
	Memo      string      `json:"memo"`       // 备注,必须<256字节
	Signature string      `json:"signature"`  // 交易签名的hex字符串
}

批量交易

func (*SignedBatchTx) Check

func (tx *SignedBatchTx) Check() error

type SignedEvmTx

type SignedEvmTx struct {
	Mode      int    `json:"mode"`      // 交易模式,默认为0;0-同步模式 1-全异步 2-半异步;如果tx执行时间较长、网络不稳定、出块慢,建议使用半异步模式。
	CreatedAt uint64 `json:"createdAt"` // 时间戳,可选
	GasLimit  uint64 `json:"gasLimit"`  // gas限额
	GasPrice  string `json:"gasPrice"`  // gas价格,最低为1
	Nonce     uint64 `json:"nonce"`     // 交易发起者nonce
	Sender    string `json:"sender"`    // 交易发起者公钥
	Body      struct {
		To    string `json:"to"`    // 交易接受者地址或合约地址
		Value string `json:"value"` // 交易金额
		Load  string `json:"load"`  // 合约负载,普通原声币转账时为空
		Memo  string `json:"memo"`  // 备注
	} `json:"body"`
	Signature string `json:"signature"` // 交易签名
}

----合约相关

func (*SignedEvmTx) Check

func (tx *SignedEvmTx) Check() error

type SignedMultisigEvmTx

type SignedMultisigEvmTx struct {
	Mode     int    `json:"mode"`     // 交易模式,默认为0;0-同步模式 1-全异步 2-半异步;如果tx执行时间较长、网络不稳定、出块慢,建议使用半异步模式。
	Deadline uint64 `json:"deadline"` // 有效截止时间
	GasLimit uint64 `json:"gasLimit"` // gas限额
	GasPrice string `json:"gasPrice"` // gas价格,最低为1
	From     string `json:"from"`     // 多签账户地址
	Nonce    uint64 `json:"nonce"`    // 多签账户nonce
	To       string `json:"to"`       // 交易接受者地址或合约地址
	Value    string `json:"value"`    // 交易金额
	Load     string `json:"load"`     // 合约负载,普通原声币转账时为空
	Memo     string `json:"memo"`     // 备注

	Signature MultiSignature `json:"signature"` // 交易签名
}

----合约相关

func (*SignedMultisigEvmTx) Check

func (tx *SignedMultisigEvmTx) Check() error

type Ticker

type Ticker struct {
	Amount string  `json:"amount"` // 交易金额
	High   string  `json:"high"`   // 最高价
	Vol    string  `json:"vol"`    // 成交量
	Last   float64 `json:"last"`   // 最新成交价
	Low    string  `json:"low"`    // 最低价
	Buy    float64 `json:"buy"`    // 买入价
	Sell   float64 `json:"sell"`   // 卖出价
	Rose   string  `json:"rose"`   // 振幅
	Time   int64   `json:"time"`   // 时间戳 ms
}

type V2AccountResult

type V2AccountResult struct {
	Address string `json:"address"` // 地址
	Balance string `json:"balance"` // 余额
	Nonce   uint64 `json:"nonce"`   // nonce
}

type V2ContractActResult

type V2ContractActResult struct {
	Address  string `json:"address"`  // 地址
	Balance  string `json:"balance"`  // 余额
	Nonce    uint64 `json:"nonce"`    // nonce
	Code     string `json:"code"`     // 合约字节码
	Suicided bool   `json:"suicided"` // 合约是否已自杀
}

type V2ConvertResult

type V2ConvertResult struct {
	OldAddress string `json:"old_address"` // 旧地址,原公钥
	PublicKey  string `json:"public_key"`  // 公钥,同上
	Address    string `json:"address"`     // 地址
}

type V2EvmLog

type V2EvmLog struct {
	Address     common.Address `json:"address"`          // 合约地址
	Topics      []common.Hash  `json:"topics"`           // 事件主题
	Data        []byte         `json:"data"`             // 数据
	BlockNumber uint64         `json:"blockNumber"`      // 区块高度
	TxHash      common.Hash    `json:"transactionHash"`  // 交易hash
	TxIndex     uint           `json:"transactionIndex"` // 交易索引
	BlockHash   common.Hash    `json:"blockHash"`        // 区块hash
	Index       uint           `json:"logIndex"`         // 日志索引
	Removed     bool           `json:"removed"`          // 是否已移除
}

EVM事件日志

type V2GenKeyResult

type V2GenKeyResult struct {
	Privkey string `json:"privkey"` // 私钥
	Pubkey  string `json:"pubkey"`  // 公钥(压缩公钥)
	Address string `json:"address"` // 地址
}

Jump to

Keyboard shortcuts

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