Skip to content
Snippets Groups Projects
Unverified Commit 22ed4668 authored by Benjamin Bollen's avatar Benjamin Bollen
Browse files

client: transaction factory expose Bond, Unbond, Rebond signature

parent 480ab113
No related branches found
No related tags found
No related merge requests found
...@@ -184,58 +184,61 @@ func Permissions(nodeClient client.NodeClient, keyClient keys.KeyClient, pubkey, ...@@ -184,58 +184,61 @@ func Permissions(nodeClient client.NodeClient, keyClient keys.KeyClient, pubkey,
return tx, nil return tx, nil
} }
// func Bond(nodeAddr, signAddr, pubkey, unbondAddr, amtS, nonceS string) (*txs.BondTx, error) { func Bond(nodeClient client.NodeClient, keyClient keys.KeyClient, pubkey, unbondAddr, amtS, nonceS string) (*txs.BondTx, error) {
// pub, amt, nonce, err := checkCommon(nodeAddr, signAddr, pubkey, "", amtS, nonceS) return nil, fmt.Errorf("Bond Transaction formation to be implemented on 0.12.0")
// if err != nil { // pub, amt, nonce, err := checkCommon(nodeAddr, signAddr, pubkey, "", amtS, nonceS)
// return nil, err // if err != nil {
// } // return nil, err
// var pubKey crypto.PubKeyEd25519 // }
// var unbondAddrBytes []byte // var pubKey crypto.PubKeyEd25519
// var unbondAddrBytes []byte
// if unbondAddr == "" {
// pkb, _ := hex.DecodeString(pubkey) // if unbondAddr == "" {
// copy(pubKey[:], pkb) // pkb, _ := hex.DecodeString(pubkey)
// unbondAddrBytes = pubKey.Address() // copy(pubKey[:], pkb)
// } else { // unbondAddrBytes = pubKey.Address()
// unbondAddrBytes, err = hex.DecodeString(unbondAddr) // } else {
// if err != nil { // unbondAddrBytes, err = hex.DecodeString(unbondAddr)
// return nil, fmt.Errorf("unbondAddr is bad hex: %v", err) // if err != nil {
// } // return nil, fmt.Errorf("unbondAddr is bad hex: %v", err)
// }
// }
// }
// tx, err := types.NewBondTx(pub)
// if err != nil { // tx, err := types.NewBondTx(pub)
// return nil, err // if err != nil {
// } // return nil, err
// tx.AddInputWithNonce(pub, amt, int(nonce)) // }
// tx.AddOutput(unbondAddrBytes, amt) // tx.AddInputWithNonce(pub, amt, int(nonce))
// tx.AddOutput(unbondAddrBytes, amt)
// return tx, nil
// } // return tx, nil
}
// func Unbond(addrS, heightS string) (*txs.UnbondTx, error) {
// if addrS == "" {
// return nil, fmt.Errorf("Validator address must be given with --addr flag")
// }
// addrBytes, err := hex.DecodeString(addrS)
// if err != nil {
// return nil, fmt.Errorf("addr is bad hex: %v", err)
// }
// height, err := strconv.ParseInt(heightS, 10, 32)
// if err != nil {
// return nil, fmt.Errorf("height is misformatted: %v", err)
// }
// return &types.UnbondTx{ func Unbond(addrS, heightS string) (*txs.UnbondTx, error) {
// Address: addrBytes, return nil, fmt.Errorf("Unbond Transaction formation to be implemented on 0.12.0")
// Height: int(height), // if addrS == "" {
// }, nil // return nil, fmt.Errorf("Validator address must be given with --addr flag")
// } // }
// addrBytes, err := hex.DecodeString(addrS)
// if err != nil {
// return nil, fmt.Errorf("addr is bad hex: %v", err)
// }
// height, err := strconv.ParseInt(heightS, 10, 32)
// if err != nil {
// return nil, fmt.Errorf("height is misformatted: %v", err)
// }
// return &types.UnbondTx{
// Address: addrBytes,
// Height: int(height),
// }, nil
}
// func Rebond(addrS, heightS string) (*txs.RebondTx, error) { func Rebond(addrS, heightS string) (*txs.RebondTx, error) {
return nil, fmt.Errorf("Rebond Transaction formation to be implemented on 0.12.0")
// if addrS == "" { // if addrS == "" {
// return nil, fmt.Errorf("Validator address must be given with --addr flag") // return nil, fmt.Errorf("Validator address must be given with --addr flag")
// } // }
...@@ -254,7 +257,7 @@ func Permissions(nodeClient client.NodeClient, keyClient keys.KeyClient, pubkey, ...@@ -254,7 +257,7 @@ func Permissions(nodeClient client.NodeClient, keyClient keys.KeyClient, pubkey,
// Address: addrBytes, // Address: addrBytes,
// Height: int(height), // Height: int(height),
// }, nil // }, nil
// } }
type TxResult struct { type TxResult struct {
BlockHash []byte // all txs get in a block BlockHash []byte // all txs get in a block
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment