cosmosTransaction

package
v1.1.13 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: GPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorInvalidAddress = errors.New("Invalid address!")

	ATOMBech32Alphabet = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"

	CHARSET_REV = []int8{}/* 128 elements not displayed */

)
View Source
var (
	CurveOrder     = []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xBA, 0xAE, 0xDC, 0xE6, 0xAF, 0x48, 0xA0, 0x3B, 0xBF, 0xD2, 0x5E, 0x8C, 0xD0, 0x36, 0x41, 0x41}
	HalfCurveOrder = []byte{0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x5D, 0x57, 0x6E, 0x73, 0x57, 0xA4, 0x50, 0x1D, 0xDF, 0xE9, 0x2F, 0x46, 0x68, 0x1B, 0x20, 0xA0}
)

Functions

func Bech32Decode

func Bech32Decode(address string) ([]byte, error)

func Bech32Encode

func Bech32Encode(prefix, alphabet string, payload []byte) string

func SignTransactionHash

func SignTransactionHash(txHash string, prikey []byte) (string, error)

func VerifyTransactionSig

func VerifyTransactionSig(emptyTrans, signature string, pubkey []byte) bool

Types

type Coin

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

func NewCoin

func NewCoin(denom string, amount int64) Coin

type Coins

type Coins []Coin

type FeeStruct

type FeeStruct struct {
	Amount Coins  `json:"amount"`
	Gas    string `json:"gas"`
}

func NewStdFee

func NewStdFee(gas int64, amount Coins) FeeStruct

type Int

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

func NewInt

func NewInt(n int64) Int

func NewIntFromBigInt

func NewIntFromBigInt(i *big.Int) Int

func ZeroInt

func ZeroInt() Int

func (Int) LT

func (i Int) LT(i2 Int) bool

type Message

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

func NewMessage

func NewMessage(msgType string, value MsgSend) Message

type MsgSend

type MsgSend struct {
	Amount      Coins  `json:"amount"`
	FromAddress string `json:"from_address"`
	ToAddress   string `json:"to_address"`
}

func NewMsgSend

func NewMsgSend(fromAddr, toAddr string, amount Coins) MsgSend

type Pub

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

func NewPub

func NewPub(pubkey []byte, curveType string) Pub

type Sig

type Sig struct {
	Signature     string `json:"signature"`
	Pubkey        Pub    `json:"pub_key"`
	AccountNumber string `json:"account_number"`
	Sequence      string `json:"sequence"`
}

func NewSig

func NewSig(signature []byte, accountNumber, sequence string, pubkey Pub) Sig

type Tx

type Tx struct {
	Message   []Message `json:"msg"`
	Fee       FeeStruct `json:"fee"`
	Memo      string    `json:"memo"`
	Signature []Sig     `json:"signatures"`
}

func NewTx

func NewTx(message []Message, memo string, fee FeeStruct, signature []Sig) Tx

type TxSend

type TxSend struct {
	Tx   Tx     `json:"tx"`
	Mode string `json:"mode"`
}

func NewTxSend

func NewTxSend(tx Tx, mode string) TxSend

type TxStruct

type TxStruct struct {
	AccountNumber string    `json:"account_number"`
	ChainID       string    `json:"chain_id"`
	Fee           FeeStruct `json:"fee"`
	Memo          string    `json:"memo"`
	Message       []Message `json:"msgs"`
	Sequence      string    `json:"sequence"`
}

func NewTxStruct

func NewTxStruct(chainID, memo string, accountNumber, sequence int, fee *FeeStruct, message []Message) TxStruct

func (TxStruct) CreateEmptyTransactionAndHash

func (tx TxStruct) CreateEmptyTransactionAndHash() (string, string, error)

func (TxStruct) CreateJsonForSend

func (ts TxStruct) CreateJsonForSend(signature string, pubkey []byte, keyType, sendMode string) (*gjson.Result, error)

Jump to

Keyboard shortcuts

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