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
bbe8b186
Commit
bbe8b186
authored
Mar 10, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added unmarshalState
parent
53f8f297
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2002 additions
and
1509 deletions
+2002
-1509
coin.html
cmd/mist/assets/examples/coin.html
+1
-1
ethereum.js
cmd/mist/assets/ext/ethereum.js/dist/ethereum.js
+1964
-1495
args.go
rpc/args.go
+37
-13
No files found.
cmd/mist/assets/examples/coin.html
View file @
bbe8b186
...
...
@@ -35,7 +35,7 @@
var
web3
=
require
(
'web3'
);
var
eth
=
web3
.
eth
;
web3
.
setProvider
(
new
web3
.
providers
.
Http
Sync
Provider
(
'http://localhost:8545'
));
web3
.
setProvider
(
new
web3
.
providers
.
HttpProvider
(
'http://localhost:8545'
));
var
desc
=
[{
"name"
:
"balance(address)"
,
"type"
:
"function"
,
...
...
cmd/mist/assets/ext/ethereum.js/dist/ethereum.js
View file @
bbe8b186
This source diff could not be displayed because it is too large. You can
view the blob
instead.
rpc/args.go
View file @
bbe8b186
...
...
@@ -8,6 +8,30 @@ import (
"github.com/ethereum/go-ethereum/ethutil"
)
// Unmarshal state is a helper method which has the ability to decode messsages
// that use the `defaultBlock` (https://github.com/ethereum/wiki/wiki/JSON-RPC#the-default-block-parameter)
// For example a `call`: [{to: "0x....", data:"0x..."}, "latest"]. The first argument is the transaction
// message and the second one refers to the block height (or state) to which to apply this `call`.
func
unmarshalState
(
b
[]
byte
,
iface
interface
{},
str
*
string
)
(
err
error
)
{
var
data
[]
json
.
RawMessage
if
err
=
json
.
Unmarshal
(
b
,
&
data
);
err
!=
nil
&&
len
(
data
)
==
0
{
return
errDecodeArgs
}
if
err
=
json
.
Unmarshal
(
data
[
0
],
iface
);
err
!=
nil
{
return
errDecodeArgs
}
// Second argument is optional (transact doesn't require it)
if
len
(
data
)
>
1
{
if
err
=
json
.
Unmarshal
(
data
[
1
],
str
);
err
!=
nil
{
return
errDecodeArgs
}
}
return
nil
}
type
GetBlockByHashArgs
struct
{
BlockHash
string
Transactions
bool
...
...
@@ -63,10 +87,12 @@ type NewTxArgs struct {
Gas
*
big
.
Int
GasPrice
*
big
.
Int
Data
string
BlockHeight
string
}
func
(
args
*
NewTxArgs
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
var
obj
[]
struct
{
var
obj
struct
{
From
string
`json:"from"`
To
string
`json:"to"`
Value
string
`json:"value"`
...
...
@@ -74,20 +100,18 @@ func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) {
GasPrice
string
`json:"gasPrice"`
Data
string
`json:"data"`
}
if
err
=
json
.
Unmarshal
(
b
,
&
obj
);
err
!=
nil
{
return
err
DecodeArgs
var
height
string
if
err
=
unmarshalState
(
b
,
&
obj
,
&
height
);
err
!=
nil
{
return
err
}
if
len
(
obj
)
<
1
{
return
errArguments
}
args
.
From
=
obj
[
0
]
.
From
args
.
To
=
obj
[
0
]
.
To
args
.
Value
=
ethutil
.
Big
(
obj
[
0
]
.
Value
)
args
.
Gas
=
ethutil
.
Big
(
obj
[
0
]
.
Gas
)
args
.
GasPrice
=
ethutil
.
Big
(
obj
[
0
]
.
GasPrice
)
args
.
Data
=
obj
[
0
]
.
Data
args
.
From
=
obj
.
From
args
.
To
=
obj
.
To
args
.
Value
=
ethutil
.
Big
(
obj
.
Value
)
args
.
Gas
=
ethutil
.
Big
(
obj
.
Gas
)
args
.
GasPrice
=
ethutil
.
Big
(
obj
.
GasPrice
)
args
.
Data
=
obj
.
Data
args
.
BlockHeight
=
height
return
nil
}
...
...
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