slim

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2018 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Bech32 prefixes
	//Bech32PrefixAccPub = "cosmosaccpub"
	AccountResultType = "local"
)
View Source
const PREF_ADD = "address"

Variables

View Source
var (
	Shost         string
	Mhost         string
	QSCAccounturl string
	QOSAccounturl string
	Accounturl    string
	KVurl         string
	QResulturl    string
)

IP initialization

Functions

func AccountCreateStr

func AccountCreateStr(password string) string

convert the output to json string format

func AccountRecoverStr

func AccountRecoverStr(mncode, password string) string

func AesDecrypt

func AesDecrypt(keystring, cryptoText string) string

func AesEncrypt

func AesEncrypt(keystring, text string) string

func Int2Byte

func Int2Byte(in int64) []byte

函数:int64 转化为 []byte

func JQInvestAd

func JQInvestAd(QOSchainId, QSCchainId, articleHash, coins, privatekey string) string

func PubAddrRetrievalStr

func PubAddrRetrievalStr(s string) string

func QOSCommitResultCheck

func QOSCommitResultCheck(txhash, height string) string

for QOSCommitResultCheck Restful interface

func QOSQueryAccountGet

func QOSQueryAccountGet(addr string) string

for QOS account query function

func QSCKVStoreGetQuery

func QSCKVStoreGetQuery(k string) string

func QSCKVStoreSetPost

func QSCKVStoreSetPost(k, v, privkey, chain string) (result string)

func QSCQueryAccountGet

func QSCQueryAccountGet(addr string) string

func QSCtransferSendStr

func QSCtransferSendStr(addrto, coinstr, privkey, chainid string) string

only need the following arguments, it`s enough!

func RegisterAmino

func RegisterAmino(cdc *amino.Codec)

RegisterAmino registers all crypto related types in the given (amino) codec.

func RegisterCodec

func RegisterCodec(cdc *amino.Codec)

func SetBlockchainEntrance

func SetBlockchainEntrance(qstarshost, qmoonhost string)

set Block Chain entrance hosts for both Qstars and Qmoon

Types

type Address

type Address []byte

func (Address) Bytes

func (add Address) Bytes() []byte

func (Address) MarshalJSON

func (add Address) MarshalJSON() ([]byte, error)

func (Address) String

func (add Address) String() string

func (*Address) UnmarshalJSON

func (add *Address) UnmarshalJSON(bech32Addr []byte) error

将Bech32编码的地址Json进行UnMarshal

type BaseAccount

type BaseAccount struct {
	AccountAddress Address             `json:"account_address"` // account address
	Publickey      ed25519local.PubKey `json:"public_key"`      // public key
	Nonce          int64               `json:"nonce"`           // identifies tx_status of an account
}

type BaseCoin

type BaseCoin struct {
	Name   string `json:"coin_name"`
	Amount BigInt `json:"amount"`
}

func (*BaseCoin) String

func (coin *BaseCoin) String() string

type BaseCoins

type BaseCoins []*BaseCoin

func (BaseCoins) String

func (coins BaseCoins) String() string

type BigInt

type BigInt struct {
	// contains filtered or unexported fields
}

func NewBigInt

func NewBigInt(n int64) BigInt

func ZeroInt

func ZeroInt() BigInt

ZeroInt returns BigInt value with zero

func (BigInt) Add

func (i BigInt) Add(i2 BigInt) (res BigInt)

Add adds BigInt from another

func (BigInt) Int64

func (i BigInt) Int64() int64

func (BigInt) IsNil

func (bi BigInt) IsNil() bool

func (BigInt) MarshalAmino

func (i BigInt) MarshalAmino() (string, error)

MarshalAmino defines custom encoding scheme

func (BigInt) MarshalJSON

func (i BigInt) MarshalJSON() ([]byte, error)

MarshalJSON defines custom encoding scheme

func (BigInt) NilToZero

func (i BigInt) NilToZero() BigInt

func (BigInt) String

func (i BigInt) String() string

func (*BigInt) UnmarshalAmino

func (i *BigInt) UnmarshalAmino(text string) error

UnmarshalAmino defines custom decoding scheme

func (*BigInt) UnmarshalJSON

func (i *BigInt) UnmarshalJSON(bz []byte) error

UnmarshalJSON defines custom decoding scheme

type Codec

type Codec = amino.Codec

import (

"github.com/QOSGroup/qbase/account"
"github.com/QOSGroup/qbase/baseabci"
"github.com/QOSGroup/qbase/context"
"github.com/QOSGroup/qbase/mapper"
"github.com/QOSGroup/qbase/txs"
"github.com/tendermint/go-amino"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519"
cmn "github.com/tendermint/tendermint/libs/common"
"log"
"reflect"

)

var Cdc *Codec

func NewCodec

func NewCodec() *Codec

type Coin

type Coin struct {
	Denom  string `json:"denom"`
	Amount Int    `json:"amount"`
}

func ParseCoin

func ParseCoin(coinStr string) (coin Coin, err error)

func (Coin) IsZero

func (coin Coin) IsZero() bool

type Coins

type Coins []Coin

func ParseCoins

func ParseCoins(coinsStr string) (coins Coins, err error)

func (Coins) IsValid

func (coins Coins) IsValid() bool

func (Coins) IsZero

func (coins Coins) IsZero() bool

func (Coins) Len

func (coins Coins) Len() int

func (Coins) Less

func (coins Coins) Less(i, j int) bool

func (Coins) Sort

func (coins Coins) Sort() Coins

func (Coins) Swap

func (coins Coins) Swap(i, j int)

type ITx

type ITx interface {
	GetSignData() []byte //获取签名字段
}

func NewTransfer

func NewTransfer(sender Address, receiver Address, coin []BaseCoin) ITx

NewTransfer ...

type Int

type Int struct {
	// contains filtered or unexported fields
}

func NewInt

func NewInt(n int64) Int

genStdSendTx for the Tx send operation NewInt constructs BigInt from int64

func (Int) Int64

func (i Int) Int64() int64

func (Int) IsZero

func (i Int) IsZero() bool

type InvestTx

type InvestTx struct {
	Std         *TxStd
	ArticleHash []byte `json:"articleHash"` // 文章hash
}

func (InvestTx) GetSignData

func (it InvestTx) GetSignData() []byte

type PrivkeyAmino

type PrivkeyAmino struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

type PubAddrRetrieval

type PubAddrRetrieval struct {
	PubKey string `json:"pubKey"`
	Addr   string `json:"addr"`
}

type PubkeyAmino

type PubkeyAmino struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

type QOSAccount

type QOSAccount struct {
	BaseAccount `json:"base_account"`
	QOS         BigInt `json:"qos"`  // coins in public chain
	QSCs        QSCs   `json:"qscs"` // varied QSCs
}

type QSCs

type QSCs = BaseCoins

type ResultCreateAccount

type ResultCreateAccount struct {
	PubKey   string `json:"pubKey"`
	PrivKey  string `json:"privKey"`
	Addr     string `json:"addr"`
	Mnemonic string `json:"mnemonic"`
	Type     string `json:"type"`
}

func AccountCreate

func AccountCreate(password string) *ResultCreateAccount

type ResultInvest

type ResultInvest struct {
	Code   string          `json:"code"`
	Reason string          `json:"reason,omitempty"`
	Result json.RawMessage `json:"result,omitempty"`
}

func InternalError

func InternalError(reason string) ResultInvest

func (ResultInvest) Marshal

func (ri ResultInvest) Marshal() string

type Signature

type Signature struct {
	Pubkey    ed25519local.PubKey `json:"pubkey"`    //可选
	Signature []byte              `json:"signature"` //签名内容
	Nonce     int64               `json:"nonce"`     //nonce的值
}

type TransItem

type TransItem struct {
	Address Address `json:"addr"` // 账户地址
	QOS     BigInt  `json:"qos"`  // QOS
	QSCs    QSCs    `json:"qscs"` // QSCs
}

type TxStd

type TxStd struct {
	ITx       ITx         `json:"itx"`      //ITx接口,将被具体Tx结构实例化
	Signature []Signature `json:"sigature"` //签名数组
	ChainID   string      `json:"chainid"`  //ChainID: 执行ITx.exec方法的链ID
	MaxGas    BigInt      `json:"maxgas"`   //Gas消耗的最大值
}

func NewTxStd

func NewTxStd(itx ITx, cid string, mgas BigInt) (rTx *TxStd)

调用 NewTxStd后,需调用TxStd.SignTx填充TxStd.Signature(每个TxStd.Signer())

func (*TxStd) BuildSignatureBytes

func (tx *TxStd) BuildSignatureBytes(nonce int64, qcpFromChainID string) []byte

func (*TxStd) GetSignData

func (tx *TxStd) GetSignData() []byte

func (*TxStd) SignTx

func (tx *TxStd) SignTx(privkey ed25519local.PrivKey, nonce int64, fromChainID string) (signedbyte []byte, err error)

签名:每个签名者外部调用此方法

type TxTransfer

type TxTransfer struct {
	Senders   []TransItem `json:"senders"`   // 发送集合
	Receivers []TransItem `json:"receivers"` // 接收集合
}

func (TxTransfer) GetSignData

func (tx TxTransfer) GetSignData() (ret []byte)

签名字节

Directories

Path Synopsis
funcInlocal

Jump to

Keyboard shortcuts

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