aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api.go
diff options
context:
space:
mode:
authorGustav Simonsson <gustav.simonsson@gmail.com>2015-02-26 20:22:09 +0800
committerFelix Lange <fjl@twurst.com>2015-03-06 21:10:42 +0800
commitbc45e5c6de3052a4c853387dea0af5cd9207f1f7 (patch)
tree3230b89b3bf25eaf53e1b3b164cb72e89d8c4398 /rpc/api.go
parente64f727529287b7414af6d1f482ea5f318cbd2eb (diff)
downloadgo-tangerine-bc45e5c6de3052a4c853387dea0af5cd9207f1f7.tar
go-tangerine-bc45e5c6de3052a4c853387dea0af5cd9207f1f7.tar.gz
go-tangerine-bc45e5c6de3052a4c853387dea0af5cd9207f1f7.tar.bz2
go-tangerine-bc45e5c6de3052a4c853387dea0af5cd9207f1f7.tar.lz
go-tangerine-bc45e5c6de3052a4c853387dea0af5cd9207f1f7.tar.xz
go-tangerine-bc45e5c6de3052a4c853387dea0af5cd9207f1f7.tar.zst
go-tangerine-bc45e5c6de3052a4c853387dea0af5cd9207f1f7.zip
Integrate eth_accounts and eth_transact to use new account manager
* Add from to eth_transact / xeth.Transact and add static pass in lieu of integrating with native Mist window for user passphrase entry * Make eth_accounts return AccountManager.Accounts() * Add a Generate Key menu item in Mist
Diffstat (limited to 'rpc/api.go')
-rw-r--r--rpc/api.go30
1 files changed, 5 insertions, 25 deletions
diff --git a/rpc/api.go b/rpc/api.go
index 28024c206..b622945eb 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -252,38 +252,18 @@ func (p *EthereumApi) GetBlock(args *GetBlockArgs, reply *interface{}) error {
}
func (p *EthereumApi) Transact(args *NewTxArgs, reply *interface{}) error {
- if len(args.Gas) == 0 {
+ // TODO: align default values to have the same type, e.g. not depend on
+ // ethutil.Value conversions later on
+ if ethutil.Big(args.Gas).Cmp(big.NewInt(0)) == 0 {
args.Gas = defaultGas.String()
}
- if len(args.GasPrice) == 0 {
+ if ethutil.Big(args.GasPrice).Cmp(big.NewInt(0)) == 0 {
args.GasPrice = defaultGasPrice.String()
}
- // TODO if no_private_key then
- //if _, exists := p.register[args.From]; exists {
- // p.register[args.From] = append(p.register[args.From], args)
- //} else {
- /*
- account := accounts.Get(fromHex(args.From))
- if account != nil {
- if account.Unlocked() {
- if !unlockAccount(account) {
- return
- }
- }
-
- result, _ := account.Transact(fromHex(args.To), fromHex(args.Value), fromHex(args.Gas), fromHex(args.GasPrice), fromHex(args.Data))
- if len(result) > 0 {
- *reply = toHex(result)
- }
- } else if _, exists := p.register[args.From]; exists {
- p.register[ags.From] = append(p.register[args.From], args)
- }
- */
- result, _ := p.xeth().Transact( /* TODO specify account */ args.To, args.Value, args.Gas, args.GasPrice, args.Data)
+ result, _ := p.xeth().Transact(args.From, args.To, args.Value, args.Gas, args.GasPrice, args.Data)
*reply = result
- //}
return nil
}