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
d92a7527
Commit
d92a7527
authored
Nov 11, 2014
by
Marek Kotewicz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merged subprotocol prefix
parent
f5024b49
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
58 deletions
+54
-58
.gitignore
.gitignore
+1
-0
ethereum.js
dist/ethereum.js
+2
-2
ethereum.js.map
dist/ethereum.js.map
+2
-2
ethereum.min.js
dist/ethereum.min.js
+1
-1
main.js
lib/main.js
+48
-53
No files found.
.gitignore
View file @
d92a7527
...
...
@@ -4,6 +4,7 @@
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile ~/.gitignore_global
*.swp
/tmp
*/**/*un~
*un~
...
...
dist/ethereum.js
View file @
d92a7527
This diff is collapsed.
Click to expand it.
dist/ethereum.js.map
View file @
d92a7527
This diff is collapsed.
Click to expand it.
dist/ethereum.min.js
View file @
d92a7527
This diff is collapsed.
Click to expand it.
lib/main.js
View file @
d92a7527
...
...
@@ -15,17 +15,12 @@
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file main.js
* @authors:
* Jeffrey Wilcke <jeff@ethdev.com>
* Marek Kotewicz <marek@ethdev.com>
* Marian Oancea <marian@ethdev.com>
* @date 2014
*/
function
isPromise
(
o
)
{
return
o
instanceof
Promise
;
}
* @authors:
* Jeffrey Wilcke <jeff@ethdev.com>
* Marek Kotewicz <marek@ethdev.com>
* Marian Oancea <marian@ethdev.com>
* @date 2014
*/
function
flattenPromise
(
obj
)
{
if
(
obj
instanceof
Promise
)
{
...
...
@@ -46,7 +41,7 @@
});
});
}
if
(
obj
instanceof
Object
)
{
return
new
Promise
(
function
(
resolve
)
{
var
keys
=
Object
.
keys
(
obj
);
...
...
@@ -68,82 +63,83 @@
var
ethMethods
=
function
()
{
var
blockCall
=
function
(
args
)
{
return
typeof
args
[
0
]
===
"string"
?
"
blockByHash"
:
"
blockByNumber"
;
return
typeof
args
[
0
]
===
"string"
?
"
eth_blockByHash"
:
"eth_
blockByNumber"
;
};
var
transactionCall
=
function
(
args
)
{
return
typeof
args
[
0
]
===
"string"
?
'
transactionByHash'
:
'transactionByNumber'
;
return
typeof
args
[
0
]
===
"string"
?
'
eth_transactionByHash'
:
'eth_transactionByNumber'
;
};
var
uncleCall
=
function
(
args
)
{
return
typeof
args
[
0
]
===
"string"
?
'
uncleByHash'
:
'uncleByNumber'
;
return
typeof
args
[
0
]
===
"string"
?
'
eth_uncleByHash'
:
'eth_uncleByNumber'
;
};
var
methods
=
[
{
name
:
'balanceAt'
,
call
:
'balanceAt'
},
{
name
:
'stateAt'
,
call
:
'stateAt'
},
{
name
:
'countAt'
,
call
:
'countAt'
},
{
name
:
'codeAt'
,
call
:
'codeAt'
},
{
name
:
'transact'
,
call
:
'transact'
},
{
name
:
'call'
,
call
:
'call'
},
{
name
:
'balanceAt'
,
call
:
'
eth_
balanceAt'
},
{
name
:
'stateAt'
,
call
:
'
eth_
stateAt'
},
{
name
:
'countAt'
,
call
:
'
eth_
countAt'
},
{
name
:
'codeAt'
,
call
:
'
eth_
codeAt'
},
{
name
:
'transact'
,
call
:
'
eth_
transact'
},
{
name
:
'call'
,
call
:
'
eth_
call'
},
{
name
:
'block'
,
call
:
blockCall
},
{
name
:
'transaction'
,
call
:
transactionCall
},
{
name
:
'uncle'
,
call
:
uncleCall
},
{
name
:
'compile'
,
call
:
'compile'
}
{
name
:
'compile'
,
call
:
'eth_compile'
},
{
name
:
'lll'
,
call
:
'eth_lll'
}
];
return
methods
;
};
var
ethProperties
=
function
()
{
return
[
{
name
:
'coinbase'
,
getter
:
'
coinbase'
,
setter
:
'
setCoinbase'
},
{
name
:
'listening'
,
getter
:
'
listening'
,
setter
:
'
setListening'
},
{
name
:
'mining'
,
getter
:
'
mining'
,
setter
:
'
setMining'
},
{
name
:
'gasPrice'
,
getter
:
'gasPrice'
},
{
name
:
'account'
,
getter
:
'account'
},
{
name
:
'accounts'
,
getter
:
'accounts'
},
{
name
:
'peerCount'
,
getter
:
'peerCount'
},
{
name
:
'defaultBlock'
,
getter
:
'
defaultBlock'
,
setter
:
'
setDefaultBlock'
},
{
name
:
'number'
,
getter
:
'number'
}
{
name
:
'coinbase'
,
getter
:
'
eth_coinbase'
,
setter
:
'eth_
setCoinbase'
},
{
name
:
'listening'
,
getter
:
'
eth_listening'
,
setter
:
'eth_
setListening'
},
{
name
:
'mining'
,
getter
:
'
eth_mining'
,
setter
:
'eth_
setMining'
},
{
name
:
'gasPrice'
,
getter
:
'
eth_
gasPrice'
},
{
name
:
'account'
,
getter
:
'
eth_
account'
},
{
name
:
'accounts'
,
getter
:
'
eth_
accounts'
},
{
name
:
'peerCount'
,
getter
:
'
eth_
peerCount'
},
{
name
:
'defaultBlock'
,
getter
:
'
eth_defaultBlock'
,
setter
:
'eth_
setDefaultBlock'
},
{
name
:
'number'
,
getter
:
'
eth_
number'
}
];
};
var
dbMethods
=
function
()
{
return
[
{
name
:
'put'
,
call
:
'put'
},
{
name
:
'get'
,
call
:
'get'
},
{
name
:
'putString'
,
call
:
'putString'
},
{
name
:
'getString'
,
call
:
'getString'
}
{
name
:
'put'
,
call
:
'
db_
put'
},
{
name
:
'get'
,
call
:
'
db_
get'
},
{
name
:
'putString'
,
call
:
'
db_
putString'
},
{
name
:
'getString'
,
call
:
'
db_
getString'
}
];
};
var
shhMethods
=
function
()
{
return
[
{
name
:
'post'
,
call
:
'post'
},
{
name
:
'newIdentity'
,
call
:
'newIdentity'
},
{
name
:
'haveIdentity'
,
call
:
'haveIdentity'
},
{
name
:
'newGroup'
,
call
:
'newGroup'
},
{
name
:
'addToGroup'
,
call
:
'addToGroup'
}
{
name
:
'post'
,
call
:
'
shh_
post'
},
{
name
:
'newIdentity'
,
call
:
'
shh_
newIdentity'
},
{
name
:
'haveIdentity'
,
call
:
'
shh_
haveIdentity'
},
{
name
:
'newGroup'
,
call
:
'
shh_
newGroup'
},
{
name
:
'addToGroup'
,
call
:
'
shh_
addToGroup'
}
];
};
var
ethWatchMethods
=
function
()
{
var
newFilter
=
function
(
args
)
{
return
typeof
args
[
0
]
===
'string'
?
'
newFilterString'
:
'
newFilter'
;
return
typeof
args
[
0
]
===
'string'
?
'
eth_newFilterString'
:
'eth_
newFilter'
;
};
return
[
{
name
:
'newFilter'
,
call
:
newFilter
},
{
name
:
'uninstallFilter'
,
call
:
'uninstallFilter'
},
{
name
:
'getMessages'
,
call
:
'getMessages'
}
{
name
:
'uninstallFilter'
,
call
:
'
eth_
uninstallFilter'
},
{
name
:
'getMessages'
,
call
:
'
eth_
getMessages'
}
];
};
var
shhWatchMethods
=
function
()
{
return
[
{
name
:
'newFilter'
,
call
:
'shh
N
ewFilter'
},
{
name
:
'uninstallFilter'
,
call
:
'shh
U
ninstallFilter'
},
{
name
:
'getMessage'
,
call
:
'shh
G
etMessages'
}
{
name
:
'newFilter'
,
call
:
'shh
_n
ewFilter'
},
{
name
:
'uninstallFilter'
,
call
:
'shh
_u
ninstallFilter'
},
{
name
:
'getMessage'
,
call
:
'shh
_g
etMessages'
}
];
};
...
...
@@ -204,7 +200,7 @@
Object
.
defineProperty
(
obj
,
property
.
name
,
proto
);
});
};
var
web3
=
{
_callbacks
:
{},
_events
:
{},
...
...
@@ -223,7 +219,7 @@
// Find termination
var
str
=
""
;
var
i
=
0
,
l
=
hex
.
length
;
if
(
hex
.
substring
(
0
,
2
)
==
'0x'
)
if
(
hex
.
substring
(
0
,
2
)
==
=
'0x'
)
i
=
2
;
for
(;
i
<
l
;
i
+=
2
)
{
var
code
=
hex
.
charCodeAt
(
i
);
...
...
@@ -246,7 +242,6 @@
var
hex
=
this
.
toHex
(
str
);
while
(
hex
.
length
<
pad
*
2
)
hex
+=
"00"
;
return
"0x"
+
hex
;
},
...
...
@@ -302,11 +297,11 @@
setupMethods
(
web3
.
shh
,
shhMethods
());
var
ethWatch
=
{
changed
:
'changed'
changed
:
'
eth_
changed'
};
setupMethods
(
ethWatch
,
ethWatchMethods
());
var
shhWatch
=
{
changed
:
'shh
C
hanged'
changed
:
'shh
_c
hanged'
};
setupMethods
(
shhWatch
,
shhWatchMethods
());
...
...
@@ -447,11 +442,11 @@
if
(
data
.
_id
)
{
var
cb
=
web3
.
_callbacks
[
data
.
_id
];
if
(
cb
)
{
cb
.
call
(
this
,
data
.
error
,
data
.
data
)
cb
.
call
(
this
,
data
.
error
,
data
.
data
)
;
delete
web3
.
_callbacks
[
data
.
_id
];
}
}
}
module
.
exports
=
web3
;
module
.
exports
=
web3
;
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