good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
f9264e87
Commit
f9264e87
authored
Jun 29, 2015
by
Bas van Kervel
Browse files
Options
Downloads
Patches
Plain Diff
add json parsing method for resend transaction
parent
a355777f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
rpc/api/eth.go
+0
-1
0 additions, 1 deletion
rpc/api/eth.go
rpc/api/eth_args.go
+76
-1
76 additions, 1 deletion
rpc/api/eth_args.go
with
76 additions
and
2 deletions
rpc/api/eth.go
+
0
−
1
View file @
f9264e87
...
@@ -12,7 +12,6 @@ import (
...
@@ -12,7 +12,6 @@ import (
"github.com/ethereum/go-ethereum/rpc/shared"
"github.com/ethereum/go-ethereum/rpc/shared"
"github.com/ethereum/go-ethereum/xeth"
"github.com/ethereum/go-ethereum/xeth"
"gopkg.in/fatih/set.v0"
"gopkg.in/fatih/set.v0"
"fmt"
)
)
const
(
const
(
...
...
This diff is collapsed.
Click to expand it.
rpc/api/eth_args.go
+
76
−
1
View file @
f9264e87
...
@@ -4,8 +4,8 @@ import (
...
@@ -4,8 +4,8 @@ import (
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"math/big"
"math/big"
"strconv"
"strconv"
"strings"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/state"
...
@@ -899,6 +899,81 @@ type ResendArgs struct {
...
@@ -899,6 +899,81 @@ type ResendArgs struct {
GasLimit
string
GasLimit
string
}
}
func
(
tx
*
tx
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
var
fields
map
[
string
]
interface
{}
if
err
:=
json
.
Unmarshal
(
b
,
&
fields
);
err
!=
nil
{
return
shared
.
NewDecodeParamError
(
err
.
Error
())
}
trans
:=
new
(
types
.
Transaction
)
if
val
,
found
:=
fields
[
"To"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
&&
len
(
strVal
)
>
0
{
tx
.
To
=
strVal
to
:=
common
.
StringToAddress
(
strVal
)
trans
.
Recipient
=
&
to
}
}
if
val
,
found
:=
fields
[
"From"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
{
tx
.
From
=
strVal
}
}
if
val
,
found
:=
fields
[
"Nonce"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
{
tx
.
Nonce
=
strVal
if
trans
.
AccountNonce
,
err
=
strconv
.
ParseUint
(
strVal
,
10
,
64
);
err
!=
nil
{
return
shared
.
NewDecodeParamError
(
fmt
.
Sprintf
(
"Unable to decode tx.Nonce - %v"
,
err
))
}
}
}
var
parseOk
bool
if
val
,
found
:=
fields
[
"Value"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
{
tx
.
Value
=
strVal
if
trans
.
Amount
,
parseOk
=
new
(
big
.
Int
)
.
SetString
(
strVal
,
0
);
!
parseOk
{
return
shared
.
NewDecodeParamError
(
fmt
.
Sprintf
(
"Unable to decode tx.Amount - %v"
,
err
))
}
}
}
if
val
,
found
:=
fields
[
"Data"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
{
tx
.
Data
=
strVal
if
strings
.
HasPrefix
(
strVal
,
"0x"
)
{
trans
.
Payload
=
common
.
Hex2Bytes
(
strVal
[
2
:
])
}
else
{
trans
.
Payload
=
common
.
Hex2Bytes
(
strVal
)
}
}
}
if
val
,
found
:=
fields
[
"GasLimit"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
{
tx
.
GasLimit
=
strVal
if
trans
.
GasLimit
,
parseOk
=
new
(
big
.
Int
)
.
SetString
(
strVal
,
0
);
!
parseOk
{
return
shared
.
NewDecodeParamError
(
fmt
.
Sprintf
(
"Unable to decode tx.GasLimit - %v"
,
err
))
}
}
}
if
val
,
found
:=
fields
[
"GasPrice"
];
found
{
if
strVal
,
ok
:=
val
.
(
string
);
ok
{
tx
.
GasPrice
=
strVal
if
trans
.
Price
,
parseOk
=
new
(
big
.
Int
)
.
SetString
(
strVal
,
0
);
!
parseOk
{
return
shared
.
NewDecodeParamError
(
fmt
.
Sprintf
(
"Unable to decode tx.GasPrice - %v"
,
err
))
}
}
}
tx
.
tx
=
trans
return
nil
}
func
(
args
*
ResendArgs
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
func
(
args
*
ResendArgs
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
var
obj
[]
interface
{}
var
obj
[]
interface
{}
if
err
=
json
.
Unmarshal
(
b
,
&
obj
);
err
!=
nil
{
if
err
=
json
.
Unmarshal
(
b
,
&
obj
);
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment