From 35006ee49f3a83702e8f374d31ce9fe62583929e Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Thu, 18 Jun 2015 18:49:27 -0400 Subject: [PATCH] unbond, rebond utils --- types/tx_utils.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/types/tx_utils.go b/types/tx_utils.go index 0c878e314..b0f87f029 100644 --- a/types/tx_utils.go +++ b/types/tx_utils.go @@ -194,3 +194,31 @@ func (tx *BondTx) SignInput(chainID string, i int, privAccount *account.PrivAcco tx.Inputs[i].Signature = privAccount.Sign(chainID, tx) return nil } + +//---------------------------------------------------------------------- +// UnbondTx interface for creating tx + +func NewUnbondTx(addr []byte, height uint) *UnbondTx { + return &UnbondTx{ + Address: addr, + Height: height, + } +} + +func (tx *UnbondTx) Sign(chainID string, privAccount *account.PrivAccount) { + tx.Signature = privAccount.Sign(chainID, tx) +} + +//---------------------------------------------------------------------- +// RebondTx interface for creating tx + +func NewRebondTx(addr []byte, height uint) *RebondTx { + return &RebondTx{ + Address: addr, + Height: height, + } +} + +func (tx *RebondTx) Sign(chainID string, privAccount *account.PrivAccount) { + tx.Signature = privAccount.Sign(chainID, tx) +}