Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
e94aa421
Commit
e94aa421
authored
May 08, 2015
by
Daniel A. Nagy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New API call for signatures.
parent
15bfae52
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
0 deletions
+37
-0
api.go
rpc/api.go
+11
-0
args.go
rpc/args.go
+5
-0
xeth.go
xeth/xeth.go
+21
-0
No files found.
rpc/api.go
View file @
e94aa421
...
...
@@ -158,6 +158,17 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
v
:=
api
.
xethAtStateNum
(
args
.
BlockNumber
)
.
CodeAtBytes
(
args
.
Address
)
*
reply
=
newHexData
(
v
)
case
"eth_sign"
:
args
:=
new
(
NewSigArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
return
err
}
v
,
err
:=
api
.
xeth
.
Sign
(
args
.
From
,
args
.
Data
)
if
err
!=
nil
{
return
err
}
*
reply
=
v
case
"eth_sendTransaction"
,
"eth_transact"
:
args
:=
new
(
NewTxArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
...
...
rpc/args.go
View file @
e94aa421
...
...
@@ -166,6 +166,11 @@ type NewTxArgs struct {
BlockNumber
int64
}
type
NewSigArgs
struct
{
From
string
Data
string
}
func
(
args
*
NewTxArgs
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
var
obj
[]
json
.
RawMessage
var
ext
struct
{
...
...
xeth/xeth.go
View file @
e94aa421
...
...
@@ -813,6 +813,27 @@ func (self *XEth) ConfirmTransaction(tx string) bool {
return
self
.
frontend
.
ConfirmTransaction
(
tx
)
}
func
(
self
*
XEth
)
Sign
(
fromStr
,
hashStr
string
)
(
string
,
error
)
{
var
(
from
=
common
.
HexToAddress
(
fromStr
)
hash
=
common
.
HexToHash
(
hashStr
)
)
sig
,
err
:=
self
.
backend
.
AccountManager
()
.
Sign
(
accounts
.
Account
{
Address
:
from
.
Bytes
()},
hash
)
if
err
==
accounts
.
ErrLocked
{
if
didUnlock
{
return
fmt
.
Errorf
(
"signer account still locked after successful unlock"
)
}
if
!
self
.
frontend
.
UnlockAccount
(
from
.
Bytes
())
{
return
fmt
.
Errorf
(
"could not unlock signer account"
)
}
// retry signing, the account should now be unlocked.
return
self
.
Sign
(
fromStr
,
hashStr
)
}
else
if
err
!=
nil
{
return
err
}
return
common
.
toHex
(
sig
)
}
func
(
self
*
XEth
)
Transact
(
fromStr
,
toStr
,
nonceStr
,
valueStr
,
gasStr
,
gasPriceStr
,
codeStr
string
)
(
string
,
error
)
{
// this minimalistic recoding is enough (works for natspec.js)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment