コード例 #1
0
ファイル: tx.go プロジェクト: jaekwon/GuppyCamp
func (tx *CallTx) WriteSignBytes(w io.Writer, n *int64, err *error) {
	// We hex encode the network name so we don't deal with escaping issues.
	binary.WriteTo([]byte(Fmt(`{"network":"%X"`, config.GetString("network"))), w, n, err)
	binary.WriteTo([]byte(Fmt(`,"tx":[%v,{"address":"%X","data":"%X"`, TxTypeCall, tx.Address, tx.Data)), w, n, err)
	binary.WriteTo([]byte(Fmt(`,"fee":%v,"gas_limit":%v,"input":`, tx.Fee, tx.GasLimit)), w, n, err)
	tx.Input.WriteSignBytes(w, n, err)
	binary.WriteTo([]byte(`}]}`), w, n, err)
}
コード例 #2
0
ファイル: proposal.go プロジェクト: jaekwon/GuppyCamp
func (p *Proposal) WriteSignBytes(w io.Writer, n *int64, err *error) {
	// We hex encode the network name so we don't deal with escaping issues.
	binary.WriteTo([]byte(Fmt(`{"network":"%X"`, config.GetString("network"))), w, n, err)
	binary.WriteTo([]byte(`,"proposal":{"block_parts":`), w, n, err)
	p.BlockParts.WriteSignBytes(w, n, err)
	binary.WriteTo([]byte(Fmt(`,"height":%v,"pol_parts":`, p.Height)), w, n, err)
	p.POLParts.WriteSignBytes(w, n, err)
	binary.WriteTo([]byte(Fmt(`,"round":%v}}`, p.Round)), w, n, err)
}
コード例 #3
0
ファイル: tx.go プロジェクト: jaekwon/GuppyCamp
func (tx *BondTx) WriteSignBytes(w io.Writer, n *int64, err *error) {
	// We hex encode the network name so we don't deal with escaping issues.
	binary.WriteTo([]byte(Fmt(`{"network":"%X"`, config.GetString("network"))), w, n, err)
	binary.WriteTo([]byte(Fmt(`,"tx":[%v,{"inputs":[`, TxTypeBond)), w, n, err)
	for i, in := range tx.Inputs {
		in.WriteSignBytes(w, n, err)
		if i != len(tx.Inputs)-1 {
			binary.WriteTo([]byte(","), w, n, err)
		}
	}
	binary.WriteTo([]byte(Fmt(`],"pub_key":`)), w, n, err)
	binary.WriteTo(binary.JSONBytes(tx.PubKey), w, n, err)
	binary.WriteTo([]byte(`,"unbond_to":[`), w, n, err)
	for i, out := range tx.UnbondTo {
		out.WriteSignBytes(w, n, err)
		if i != len(tx.UnbondTo)-1 {
			binary.WriteTo([]byte(","), w, n, err)
		}
	}
	binary.WriteTo([]byte(`]}]}`), w, n, err)
}
コード例 #4
0
ファイル: tx.go プロジェクト: jaekwon/GuppyCamp
func (txIn *TxInput) WriteSignBytes(w io.Writer, n *int64, err *error) {
	binary.WriteTo([]byte(Fmt(`{"address":"%X","amount":%v,"sequence":%v}`, txIn.Address, txIn.Amount, txIn.Sequence)), w, n, err)
}
コード例 #5
0
ファイル: tx.go プロジェクト: jaekwon/GuppyCamp
func (tx *RebondTx) WriteSignBytes(w io.Writer, n *int64, err *error) {
	// We hex encode the network name so we don't deal with escaping issues.
	binary.WriteTo([]byte(Fmt(`{"network":"%X"`, config.GetString("network"))), w, n, err)
	binary.WriteTo([]byte(Fmt(`,"tx":[%v,{"address":"%X","height":%v}]}`, TxTypeRebond, tx.Address, tx.Height)), w, n, err)
}
コード例 #6
0
ファイル: tx.go プロジェクト: jaekwon/GuppyCamp
func (txOut *TxOutput) WriteSignBytes(w io.Writer, n *int64, err *error) {
	binary.WriteTo([]byte(Fmt(`{"address":"%X","amount":%v}`, txOut.Address, txOut.Amount)), w, n, err)
}
コード例 #7
0
ファイル: vote.go プロジェクト: jaekwon/GuppyCamp
func (vote *Vote) WriteSignBytes(w io.Writer, n *int64, err *error) {
	// We hex encode the network name so we don't deal with escaping issues.
	binary.WriteTo([]byte(Fmt(`{"network":"%X"`, config.GetString("network"))), w, n, err)
	binary.WriteTo([]byte(Fmt(`,"vote":{"block_hash":"%X","block_parts":%v`, vote.BlockHash, vote.BlockParts)), w, n, err)
	binary.WriteTo([]byte(Fmt(`,"height":%v,"round":%v,"type":%v}}`, vote.Height, vote.Round, vote.Type)), w, n, err)
}