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
0c132e4c
Commit
0c132e4c
authored
Jul 7, 2014
by
Jeffrey Wilcke
Browse files
Options
Downloads
Patches
Plain Diff
Revert "ethreact - Feature/ethutil refactor"
parent
f9e2e527
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ethereal/ext_app.go
+4
-5
4 additions, 5 deletions
ethereal/ext_app.go
ethereal/gui.go
+52
-55
52 additions, 55 deletions
ethereal/gui.go
ethereum/javascript_runtime.go
+8
-8
8 additions, 8 deletions
ethereum/javascript_runtime.go
with
64 additions
and
68 deletions
ethereal/ext_app.go
+
4
−
5
View file @
0c132e4c
...
@@ -4,7 +4,6 @@ import (
...
@@ -4,7 +4,6 @@ import (
"fmt"
"fmt"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethreact"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/go-qml/qml"
"github.com/go-qml/qml"
)
)
...
@@ -25,8 +24,8 @@ type AppContainer interface {
...
@@ -25,8 +24,8 @@ type AppContainer interface {
type
ExtApplication
struct
{
type
ExtApplication
struct
{
*
ethpub
.
PEthereum
*
ethpub
.
PEthereum
blockChan
chan
eth
react
.
Even
t
blockChan
chan
eth
util
.
Reac
t
changeChan
chan
eth
react
.
Even
t
changeChan
chan
eth
util
.
Reac
t
quitChan
chan
bool
quitChan
chan
bool
watcherQuitChan
chan
bool
watcherQuitChan
chan
bool
...
@@ -38,8 +37,8 @@ type ExtApplication struct {
...
@@ -38,8 +37,8 @@ type ExtApplication struct {
func
NewExtApplication
(
container
AppContainer
,
lib
*
UiLib
)
*
ExtApplication
{
func
NewExtApplication
(
container
AppContainer
,
lib
*
UiLib
)
*
ExtApplication
{
app
:=
&
ExtApplication
{
app
:=
&
ExtApplication
{
ethpub
.
NewPEthereum
(
lib
.
eth
),
ethpub
.
NewPEthereum
(
lib
.
eth
),
make
(
chan
eth
react
.
Event
),
make
(
chan
eth
util
.
React
,
1
),
make
(
chan
eth
react
.
Event
),
make
(
chan
eth
util
.
React
,
1
),
make
(
chan
bool
),
make
(
chan
bool
),
make
(
chan
bool
),
make
(
chan
bool
),
container
,
container
,
...
...
This diff is collapsed.
Click to expand it.
ethereal/gui.go
+
52
−
55
View file @
0c132e4c
...
@@ -8,7 +8,6 @@ import (
...
@@ -8,7 +8,6 @@ import (
"github.com/ethereum/eth-go/ethdb"
"github.com/ethereum/eth-go/ethdb"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethreact"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/go-ethereum/utils"
"github.com/ethereum/go-ethereum/utils"
...
@@ -144,7 +143,7 @@ func (gui *Gui) showWallet(context *qml.Context) (*qml.Window, error) {
...
@@ -144,7 +143,7 @@ func (gui *Gui) showWallet(context *qml.Context) (*qml.Window, error) {
gui
.
readPreviousTransactions
()
gui
.
readPreviousTransactions
()
gui
.
setPeerInfo
()
gui
.
setPeerInfo
()
gui
.
update
()
go
gui
.
update
()
return
win
,
nil
return
win
,
nil
}
}
...
@@ -267,10 +266,20 @@ func (gui *Gui) setWalletValue(amount, unconfirmedFunds *big.Int) {
...
@@ -267,10 +266,20 @@ func (gui *Gui) setWalletValue(amount, unconfirmedFunds *big.Int) {
func
(
gui
*
Gui
)
update
()
{
func
(
gui
*
Gui
)
update
()
{
reactor
:=
gui
.
eth
.
Reactor
()
reactor
:=
gui
.
eth
.
Reactor
()
blockChan
:=
make
(
chan
ethreact
.
Event
)
blockChan
:=
make
(
chan
ethutil
.
React
,
1
)
txChan
:=
make
(
chan
ethreact
.
Event
)
txChan
:=
make
(
chan
ethutil
.
React
,
1
)
objectChan
:=
make
(
chan
ethreact
.
Event
)
objectChan
:=
make
(
chan
ethutil
.
React
,
1
)
peerChan
:=
make
(
chan
ethreact
.
Event
)
peerChan
:=
make
(
chan
ethutil
.
React
,
1
)
reactor
.
Subscribe
(
"newBlock"
,
blockChan
)
reactor
.
Subscribe
(
"newTx:pre"
,
txChan
)
reactor
.
Subscribe
(
"newTx:post"
,
txChan
)
nameReg
:=
ethpub
.
EthereumConfig
(
gui
.
eth
.
StateManager
())
.
NameReg
()
if
nameReg
!=
nil
{
reactor
.
Subscribe
(
"object:"
+
string
(
nameReg
.
Address
()),
objectChan
)
}
reactor
.
Subscribe
(
"peerList"
,
peerChan
)
ticker
:=
time
.
NewTicker
(
5
*
time
.
Second
)
ticker
:=
time
.
NewTicker
(
5
*
time
.
Second
)
...
@@ -279,7 +288,6 @@ func (gui *Gui) update() {
...
@@ -279,7 +288,6 @@ func (gui *Gui) update() {
unconfirmedFunds
:=
new
(
big
.
Int
)
unconfirmedFunds
:=
new
(
big
.
Int
)
gui
.
win
.
Root
()
.
Call
(
"setWalletValue"
,
fmt
.
Sprintf
(
"%v"
,
ethutil
.
CurrencyToString
(
state
.
GetAccount
(
gui
.
address
())
.
Amount
)))
gui
.
win
.
Root
()
.
Call
(
"setWalletValue"
,
fmt
.
Sprintf
(
"%v"
,
ethutil
.
CurrencyToString
(
state
.
GetAccount
(
gui
.
address
())
.
Amount
)))
go
func
()
{
for
{
for
{
select
{
select
{
case
b
:=
<-
blockChan
:
case
b
:=
<-
blockChan
:
...
@@ -292,7 +300,7 @@ func (gui *Gui) update() {
...
@@ -292,7 +300,7 @@ func (gui *Gui) update() {
case
txMsg
:=
<-
txChan
:
case
txMsg
:=
<-
txChan
:
tx
:=
txMsg
.
Resource
.
(
*
ethchain
.
Transaction
)
tx
:=
txMsg
.
Resource
.
(
*
ethchain
.
Transaction
)
if
txMsg
.
Name
==
"newTx:pre"
{
if
txMsg
.
Event
==
"newTx:pre"
{
object
:=
state
.
GetAccount
(
gui
.
address
())
object
:=
state
.
GetAccount
(
gui
.
address
())
if
bytes
.
Compare
(
tx
.
Sender
(),
gui
.
address
())
==
0
{
if
bytes
.
Compare
(
tx
.
Sender
(),
gui
.
address
())
==
0
{
...
@@ -328,17 +336,6 @@ func (gui *Gui) update() {
...
@@ -328,17 +336,6 @@ func (gui *Gui) update() {
gui
.
setPeerInfo
()
gui
.
setPeerInfo
()
}
}
}
}
}()
reactor
.
Subscribe
(
"newBlock"
,
blockChan
)
reactor
.
Subscribe
(
"newTx:pre"
,
txChan
)
reactor
.
Subscribe
(
"newTx:post"
,
txChan
)
nameReg
:=
ethpub
.
EthereumConfig
(
gui
.
eth
.
StateManager
())
.
NameReg
()
if
nameReg
!=
nil
{
reactor
.
Subscribe
(
"object:"
+
string
(
nameReg
.
Address
()),
objectChan
)
}
reactor
.
Subscribe
(
"peerList"
,
peerChan
)
}
}
func
(
gui
*
Gui
)
setPeerInfo
()
{
func
(
gui
*
Gui
)
setPeerInfo
()
{
...
...
This diff is collapsed.
Click to expand it.
ethereum/javascript_runtime.go
+
8
−
8
View file @
0c132e4c
...
@@ -6,7 +6,6 @@ import (
...
@@ -6,7 +6,6 @@ import (
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethreact"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/go-ethereum/utils"
"github.com/ethereum/go-ethereum/utils"
"github.com/obscuren/otto"
"github.com/obscuren/otto"
...
@@ -23,8 +22,8 @@ type JSRE struct {
...
@@ -23,8 +22,8 @@ type JSRE struct {
vm
*
otto
.
Otto
vm
*
otto
.
Otto
lib
*
ethpub
.
PEthereum
lib
*
ethpub
.
PEthereum
blockChan
chan
eth
react
.
Even
t
blockChan
chan
eth
util
.
Reac
t
changeChan
chan
eth
react
.
Even
t
changeChan
chan
eth
util
.
Reac
t
quitChan
chan
bool
quitChan
chan
bool
objectCb
map
[
string
][]
otto
.
Value
objectCb
map
[
string
][]
otto
.
Value
...
@@ -49,8 +48,8 @@ func NewJSRE(ethereum *eth.Ethereum) *JSRE {
...
@@ -49,8 +48,8 @@ func NewJSRE(ethereum *eth.Ethereum) *JSRE {
ethereum
,
ethereum
,
otto
.
New
(),
otto
.
New
(),
ethpub
.
NewPEthereum
(
ethereum
),
ethpub
.
NewPEthereum
(
ethereum
),
make
(
chan
eth
react
.
Event
),
make
(
chan
eth
util
.
React
,
1
),
make
(
chan
eth
react
.
Event
),
make
(
chan
eth
util
.
React
,
1
),
make
(
chan
bool
),
make
(
chan
bool
),
make
(
map
[
string
][]
otto
.
Value
),
make
(
map
[
string
][]
otto
.
Value
),
}
}
...
@@ -64,9 +63,6 @@ func NewJSRE(ethereum *eth.Ethereum) *JSRE {
...
@@ -64,9 +63,6 @@ func NewJSRE(ethereum *eth.Ethereum) *JSRE {
// We have to make sure that, whoever calls this, calls "Stop"
// We have to make sure that, whoever calls this, calls "Stop"
go
re
.
mainLoop
()
go
re
.
mainLoop
()
// Subscribe to events
reactor
:=
ethereum
.
Reactor
()
reactor
.
Subscribe
(
"newBlock"
,
re
.
blockChan
)
re
.
Bind
(
"eth"
,
&
JSEthereum
{
re
.
lib
,
re
.
vm
})
re
.
Bind
(
"eth"
,
&
JSEthereum
{
re
.
lib
,
re
.
vm
})
...
@@ -112,6 +108,10 @@ func (self *JSRE) Stop() {
...
@@ -112,6 +108,10 @@ func (self *JSRE) Stop() {
}
}
func
(
self
*
JSRE
)
mainLoop
()
{
func
(
self
*
JSRE
)
mainLoop
()
{
// Subscribe to events
reactor
:=
self
.
ethereum
.
Reactor
()
reactor
.
Subscribe
(
"newBlock"
,
self
.
blockChan
)
out
:
out
:
for
{
for
{
select
{
select
{
...
...
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