|
@ -135,8 +135,7 @@ type SendTx struct { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (tx *SendTx) WriteSignBytes(chainID string, w io.Writer, n *int64, err *error) { |
|
|
func (tx *SendTx) WriteSignBytes(chainID string, w io.Writer, n *int64, err *error) { |
|
|
// We hex encode the chain_id so we don't deal with escaping issues.
|
|
|
|
|
|
binary.WriteTo([]byte(Fmt(`{"chain_id":"%X"`, chainID)), w, n, err) |
|
|
|
|
|
|
|
|
binary.WriteTo([]byte(Fmt(`{"chain_id":"%s"`, chainID)), w, n, err) |
|
|
binary.WriteTo([]byte(Fmt(`,"tx":[%v,{"inputs":[`, TxTypeSend)), w, n, err) |
|
|
binary.WriteTo([]byte(Fmt(`,"tx":[%v,{"inputs":[`, TxTypeSend)), w, n, err) |
|
|
for i, in := range tx.Inputs { |
|
|
for i, in := range tx.Inputs { |
|
|
in.WriteSignBytes(w, n, err) |
|
|
in.WriteSignBytes(w, n, err) |
|
@ -169,8 +168,7 @@ type CallTx struct { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (tx *CallTx) WriteSignBytes(chainID string, w io.Writer, n *int64, err *error) { |
|
|
func (tx *CallTx) WriteSignBytes(chainID string, w io.Writer, n *int64, err *error) { |
|
|
// We hex encode the chain_id so we don't deal with escaping issues.
|
|
|
|
|
|
binary.WriteTo([]byte(Fmt(`{"chain_id":"%X"`, chainID)), w, n, err) |
|
|
|
|
|
|
|
|
binary.WriteTo([]byte(Fmt(`{"chain_id":"%s"`, chainID)), 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(`,"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) |
|
|
binary.WriteTo([]byte(Fmt(`,"fee":%v,"gas_limit":%v,"input":`, tx.Fee, tx.GasLimit)), w, n, err) |
|
|
tx.Input.WriteSignBytes(w, n, err) |
|
|
tx.Input.WriteSignBytes(w, n, err) |
|
@ -191,8 +189,7 @@ type NameTx struct { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (tx *NameTx) WriteSignBytes(chainID string, w io.Writer, n *int64, err *error) { |
|
|
func (tx *NameTx) WriteSignBytes(chainID string, 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"`, chainID)), w, n, err) |
|
|
|
|
|
|
|
|
binary.WriteTo([]byte(Fmt(`{"chain_id":"%s"`, chainID)), w, n, err) |
|
|
binary.WriteTo([]byte(Fmt(`,"tx":[%v,{"name":"%s","data":"%s"`, TxTypeName, tx.Name, tx.Data)), w, n, err) |
|
|
binary.WriteTo([]byte(Fmt(`,"tx":[%v,{"name":"%s","data":"%s"`, TxTypeName, tx.Name, tx.Data)), w, n, err) |
|
|
binary.WriteTo([]byte(Fmt(`,"fee":%v,"input":`, tx.Fee)), w, n, err) |
|
|
binary.WriteTo([]byte(Fmt(`,"fee":%v,"input":`, tx.Fee)), w, n, err) |
|
|
tx.Input.WriteSignBytes(w, n, err) |
|
|
tx.Input.WriteSignBytes(w, n, err) |
|
@ -239,8 +236,7 @@ type BondTx struct { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (tx *BondTx) WriteSignBytes(chainID string, w io.Writer, n *int64, err *error) { |
|
|
func (tx *BondTx) WriteSignBytes(chainID string, w io.Writer, n *int64, err *error) { |
|
|
// We hex encode the chain_id so we don't deal with escaping issues.
|
|
|
|
|
|
binary.WriteTo([]byte(Fmt(`{"chain_id":"%X"`, chainID)), w, n, err) |
|
|
|
|
|
|
|
|
binary.WriteTo([]byte(Fmt(`{"chain_id":"%s"`, chainID)), w, n, err) |
|
|
binary.WriteTo([]byte(Fmt(`,"tx":[%v,{"inputs":[`, TxTypeBond)), w, n, err) |
|
|
binary.WriteTo([]byte(Fmt(`,"tx":[%v,{"inputs":[`, TxTypeBond)), w, n, err) |
|
|
for i, in := range tx.Inputs { |
|
|
for i, in := range tx.Inputs { |
|
|
in.WriteSignBytes(w, n, err) |
|
|
in.WriteSignBytes(w, n, err) |
|
@ -273,8 +269,7 @@ type UnbondTx struct { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (tx *UnbondTx) WriteSignBytes(chainID string, w io.Writer, n *int64, err *error) { |
|
|
func (tx *UnbondTx) WriteSignBytes(chainID string, w io.Writer, n *int64, err *error) { |
|
|
// We hex encode the chain_id so we don't deal with escaping issues.
|
|
|
|
|
|
binary.WriteTo([]byte(Fmt(`{"chain_id":"%X"`, chainID)), w, n, err) |
|
|
|
|
|
|
|
|
binary.WriteTo([]byte(Fmt(`{"chain_id":"%s"`, chainID)), w, n, err) |
|
|
binary.WriteTo([]byte(Fmt(`,"tx":[%v,{"address":"%X","height":%v}]}`, TxTypeUnbond, tx.Address, tx.Height)), w, n, err) |
|
|
binary.WriteTo([]byte(Fmt(`,"tx":[%v,{"address":"%X","height":%v}]}`, TxTypeUnbond, tx.Address, tx.Height)), w, n, err) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -291,8 +286,7 @@ type RebondTx struct { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (tx *RebondTx) WriteSignBytes(chainID string, w io.Writer, n *int64, err *error) { |
|
|
func (tx *RebondTx) WriteSignBytes(chainID string, w io.Writer, n *int64, err *error) { |
|
|
// We hex encode the chain_id so we don't deal with escaping issues.
|
|
|
|
|
|
binary.WriteTo([]byte(Fmt(`{"chain_id":"%X"`, chainID)), w, n, err) |
|
|
|
|
|
|
|
|
binary.WriteTo([]byte(Fmt(`{"chain_id":"%s"`, chainID)), w, n, err) |
|
|
binary.WriteTo([]byte(Fmt(`,"tx":[%v,{"address":"%X","height":%v}]}`, TxTypeRebond, tx.Address, tx.Height)), w, n, err) |
|
|
binary.WriteTo([]byte(Fmt(`,"tx":[%v,{"address":"%X","height":%v}]}`, TxTypeRebond, tx.Address, tx.Height)), w, n, err) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|