Skip to content

Commit

Permalink
fix hexbytes
Browse files Browse the repository at this point in the history
  • Loading branch information
dix975 committed Apr 27, 2018
1 parent 0247d3c commit 53bb90c
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 103 deletions.
23 changes: 13 additions & 10 deletions cmd/eos-mega-tx/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type transferChannel chan *eos.Action
func main() {

//api := eos.New("http://testnet-dawn3.eosio.ca", "0000000000000000000000000000000000000000000000000000000000000000")
api := eos.New(&url.URL{Scheme: "http", Host: "localhost:18888"}, bytes.Repeat([]byte{0}, 32))
api := eos.New(&url.URL{Scheme: "http", Host: "localhost:8888"}, bytes.Repeat([]byte{0}, 32))

keyBag := eos.NewKeyBag()
if err := keyBag.Add("5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"); err != nil {
Expand All @@ -31,19 +31,22 @@ func main() {
if err := keyBag.Add("5KYZdUEo39z3FPrtuX2QbbwGnNP5zTd7yyr2SC1j299sBCnWjss"); err != nil {
log.Fatalln("Couldn't load private key:", err)
}

//Connect to proxy ...
resp, err := api.NetConnect("192.168.1.147:29876")
if err != nil {
panic(err)
} else {
fmt.Println("Connect to proxy reponse: ", resp)
if err := keyBag.Add("5KM4eQC2SU6e5MEWtMQKHwSLN4dr2zC7zxv5igVSMsfbjsuFhsZ"); err != nil {
log.Fatalln("Couldn't load private key:", err)
}

////Connect to proxy ...
//resp, err := api.NetConnect("Charless-MacBook-Pro-2.local:8888")
//if err != nil {
// panic(err)
//} else {
// fmt.Println("Connect to proxy reponse: ", resp)
//}

api.SetSigner(keyBag)

walletAPI := eos.New(&url.URL{Scheme: "http", Host: "localhost:16666"}, bytes.Repeat([]byte{0}, 32))
api.SetSigner(eos.NewWalletSigner(walletAPI, "default"))
//walletAPI := eos.New(&url.URL{Scheme: "http", Host: "localhost:16666"}, bytes.Repeat([]byte{0}, 32))
//api.SetSigner(eos.NewWalletSigner(walletAPI, "default"))

accountActions, err := generateAccountActions(10)
if err != nil {
Expand Down
20 changes: 20 additions & 0 deletions cmd/eos-p2p-ui/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,26 @@ var UILoggerHandler = func(processable p2p.PostProcessable) {
))
})
break
case eos.PackedTransactionMessageType:

ui.Update(func() {
//m := p2pMsg.(*eos.PackedTransactionMessage)
//transactionLog.Append(tui.NewHBox(
// tui.NewLabel("PackedTransactionMessage"),
// tui.NewSpacer(),
//))
})
break
case eos.SignedTransactionMessageType:

ui.Update(func() {
//m := p2pMsg.(*eos.PackedTransactionMessage)
//transactionLog.Append(tui.NewHBox(
// tui.NewLabel("SignedTransactionMessageType"),
// tui.NewSpacer(),
//))
})
break
}

}
20 changes: 10 additions & 10 deletions cmd/eosapi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import (
"fmt"

"github.com/eoscanada/eos-go"
"github.com/eoscanada/eos-go/ecc"
"github.com/eoscanada/eos-go/system"
"github.com/eoscanada/eos-go/token"
)

func main() {
Expand All @@ -21,6 +20,7 @@ func main() {

keyBag := eos.NewKeyBag()
for _, key := range []string{
"5KM4eQC2SU6e5MEWtMQKHwSLN4dr2zC7zxv5igVSMsfbjsuFhsZ",
"5Jd9CCuMGENFJTk1RGiCWCtLhCzkHcDLBnc8vnhGMArFu5dBfYF",
"5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3",
"5J77j8KYX33cgVPMQZ82zD967VNA9SPcXWnjRkb27z9M2suaZNn",
Expand Down Expand Up @@ -106,16 +106,16 @@ func main() {
//system.NewNewAccount(AC("eosio"), AC("eosio.msig"), ecc.MustNewPublicKey("EOS8ju96GnaKaYAs7b5EvvtwWqTVPepSCciDHvDCjiEhGb5joYtjk")),
//system.NewNewAccount(AC("eosio"), AC("eosio.token"), ecc.MustNewPublicKey("EOS8ju96GnaKaYAs7b5EvvtwWqTVPepSCciDHvDCjiEhGb5joYtjk")),
//system.NewNewAccount(AC("eosio"), AC("bilcproducer"), ecc.MustNewPublicKey("EOS8ju96GnaKaYAs7b5EvvtwWqTVPepSCciDHvDCjiEhGb5joYtjk")),
system.NewNewAccount(AC("eosio"), AC("cbillett"), ecc.MustNewPublicKey("EOS7NN9yupWhGctWp6KBG2ziCue5weNJyDChHtFkjAXDDm999ubdB")),
//system.NewNewAccount(AC("eosio"), AC("cbillett"), ecc.MustNewPublicKey("EOS66MfGpiepzs46DudrpSQw6GEn2QywFYVMWc18hBFVVVehdbKdi")),

//bios
//system.NewSetPriv(AC("eosio")),
//system.NewSetPriv(AC("eosio.msig")),
//system.NewSetPriv(AC("eosio.token")),
//token.NewCreate(AC("eosio"), eos.NewEOSAsset(1000000000.0000), false, false, false),
//token.NewIssue(AC("eosio"), eos.NewEOSAsset(1000000000.0000), ""),
//bios
//system.NewSetPriv(AC("eosio")),
//system.NewSetPriv(AC("eosio.msig")),
//system.NewSetPriv(AC("eosio.token")),
//token.NewCreate(AC("eosio"), eos.NewEOSAsset(1000000000.0000), false, false, false),
//token.NewIssue(AC("eosio"), eos.NewEOSAsset(1000000000.0000), ""),

//token.NewTransfer(eos.AccountName("eosio"), eos.AccountName("cbillett"), eos.NewEOSAsset(100000), ""),
token.NewTransfer(eos.AccountName("eosio"), eos.AccountName("cbillett"), eos.NewEOSAsset(100000), ""),

//system.NewRegProducer(
// AC("bilcproducer"),
Expand Down
144 changes: 72 additions & 72 deletions p2p_test.go

Large diffs are not rendered by default.

14 changes: 3 additions & 11 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"strings"
"time"

"bytes"

"github.com/eoscanada/eos-go/ecc"
)

Expand Down Expand Up @@ -328,16 +330,6 @@ func (t *HexBytes) UnmarshalJSON(data []byte) (err error) {
return
}

func (t *HexBytes) UnmarshalBinary(data []byte) error {

*t = HexBytes(data)
return nil
}

func (h HexBytes) MarshalBinary() ([]byte, error) {
return h, nil
}

// SHA256Bytes

type SHA256Bytes []byte // should always be 32 bytes
Expand Down Expand Up @@ -366,7 +358,7 @@ func (t *SHA256Bytes) UnmarshalBinary(data []byte) error {
func (a SHA256Bytes) MarshalBinary() ([]byte, error) {

if len(a) == 0 {
a = []byte{0}
a = bytes.Repeat([]byte{0}, 32)
}

return a, nil
Expand Down

0 comments on commit 53bb90c

Please sign in to comment.