diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..63c3bfc8 --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +release: + GOOS=linux GOARCH=amd64 go build -o ~/Downloads/janus-linux-amd64 github.com/dcb9/janus/cli/janus + GOOS=darwin GOARCH=amd64 go build -o ~/Downloads/janus-darwin-amd64 github.com/dcb9/janus/cli/janus diff --git a/pkg/qtum/rpc_types.go b/pkg/qtum/rpc_types.go index b07d228f..028cbf90 100644 --- a/pkg/qtum/rpc_types.go +++ b/pkg/qtum/rpc_types.go @@ -195,9 +195,10 @@ func (r *SendToContractRequest) MarshalJSON() ([]byte, error) { type ( CreateContractRequest struct { - ByteCode string - GasLimit *big.Int - GasPrice string + ByteCode string + GasLimit *big.Int + GasPrice string + SenderAddress string } /* { @@ -228,6 +229,7 @@ func (r *CreateContractRequest) MarshalJSON() ([]byte, error) { r.ByteCode, r.GasLimit, r.GasPrice, + r.SenderAddress, }) } diff --git a/pkg/transformer/eth_sendTransaction.go b/pkg/transformer/eth_sendTransaction.go index 9aa3b01f..0f2e05bd 100644 --- a/pkg/transformer/eth_sendTransaction.go +++ b/pkg/transformer/eth_sendTransaction.go @@ -124,6 +124,18 @@ func (p *ProxyETHSendTransaction) requestCreateContract(req *eth.SendTransaction GasPrice: gasPrice, } + if req.From != "" { + from := req.From + if utils.IsEthHexAddress(from) { + from, err = p.FromHexAddress(from) + if err != nil { + return nil, err + } + } + + qtumreq.SenderAddress = from + } + var resp *qtum.CreateContractResponse if err := p.Qtum.Request(qtum.MethodCreateContract, qtumreq, &resp); err != nil { return nil, err diff --git a/playground/myToken.js b/playground/myToken.js index c7981d83..803dad15 100644 --- a/playground/myToken.js +++ b/playground/myToken.js @@ -1,5 +1,5 @@ // YOUR_QTUM_ACCOUNT -const qtumAccount = "0xcb3cb8375fe457a11f041f9ff55373e1a5a78d19" +const qtumAccount = "0x2352be3db3177f0a07efbe6da5857615b8c9901d" // assume: node 8 or above const ora = require("ora") diff --git a/playground/test-SimpleStore.js b/playground/test-SimpleStore.js index 6bb4977a..914b5019 100644 --- a/playground/test-SimpleStore.js +++ b/playground/test-SimpleStore.js @@ -1,5 +1,5 @@ // YOUR_QTUM_ACCOUNT -const qtumAccount = "0xcb3cb8375fe457a11f041f9ff55373e1a5a78d19" +const qtumAccount = "0x2352be3db3177f0a07efbe6da5857615b8c9901d" const qtum = require("qtumjs") const rpc = new qtum.EthRPC(`http://${qtumAccount}:@localhost:23889`, qtumAccount)