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
a8a2e323
Commit
a8a2e323
authored
Jan 31, 2015
by
Marek Kotewicz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
constants separated to const.js file
parent
4bdf52fc
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
58 deletions
+104
-58
ethereum.js
dist/ethereum.js
+56
-33
ethereum.js.map
dist/ethereum.js.map
+5
-3
ethereum.min.js
dist/ethereum.min.js
+1
-1
abi.js
lib/abi.js
+5
-15
const.js
lib/const.js
+33
-0
formatters.js
lib/formatters.js
+4
-6
No files found.
dist/ethereum.js
View file @
a8a2e323
...
...
@@ -22,22 +22,12 @@ require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof requ
* @date 2014
*/
if
(
"build"
!==
'build'
)
{
/*
var BigNumber = require('bignumber.js'); // jshint ignore:line
*/
}
var
web3
=
require
(
'./web3'
);
var
utils
=
require
(
'./utils'
);
var
types
=
require
(
'./types'
);
var
c
=
require
(
'./const'
);
var
f
=
require
(
'./formatters'
);
BigNumber
.
config
({
ROUNDING_MODE
:
BigNumber
.
ROUND_DOWN
});
var
ETH_PADDING
=
32
;
/// method signature length in bytes
var
ETH_METHOD_SIGNATURE_LENGTH
=
4
;
/// Filters all function from input abi
/// @returns abi array with filtered objects of type 'function'
var
filterFunctions
=
function
(
json
)
{
...
...
@@ -75,7 +65,7 @@ var inputTypes = types.inputTypes();
/// @returns bytes representation of input params
var
toAbiInput
=
function
(
method
,
params
)
{
var
bytes
=
""
;
var
padding
=
ETH_PADDING
*
2
;
var
padding
=
c
.
ETH_PADDING
*
2
;
/// first we iterate in search for dynamic
method
.
inputs
.
forEach
(
function
(
input
,
index
)
{
...
...
@@ -108,7 +98,7 @@ var toAbiInput = function (method, params) {
var
dynamicBytesLength
=
function
(
type
)
{
if
(
arrayType
(
type
)
||
type
===
'string'
)
// only string itself that is dynamic; stringX is static length.
return
ETH_PADDING
*
2
;
return
c
.
ETH_PADDING
*
2
;
return
0
;
};
...
...
@@ -122,7 +112,7 @@ var fromAbiOutput = function (method, output) {
output
=
output
.
slice
(
2
);
var
result
=
[];
var
padding
=
ETH_PADDING
*
2
;
var
padding
=
c
.
ETH_PADDING
*
2
;
var
dynamicPartLength
=
method
.
outputs
.
reduce
(
function
(
acc
,
curr
)
{
return
acc
+
dynamicBytesLength
(
curr
.
type
);
...
...
@@ -228,7 +218,7 @@ var outputParser = function (json) {
/// @param method name for which we want to get method signature
/// @returns (promise) contract method signature for method with given name
var
methodSignature
=
function
(
name
)
{
return
web3
.
sha3
(
web3
.
fromAscii
(
name
)).
slice
(
0
,
2
+
ETH_METHOD_SIGNATURE_LENGTH
*
2
);
return
web3
.
sha3
(
web3
.
fromAscii
(
name
)).
slice
(
0
,
2
+
c
.
ETH_METHOD_SIGNATURE_LENGTH
*
2
);
};
module
.
exports
=
{
...
...
@@ -242,7 +232,42 @@ module.exports = {
};
},{
"./formatters"
:
5
,
"./types"
:
9
,
"./utils"
:
10
,
"./web3"
:
11
}],
2
:[
function
(
require
,
module
,
exports
){
},{
"./const"
:
2
,
"./formatters"
:
6
,
"./types"
:
10
,
"./utils"
:
11
,
"./web3"
:
12
}],
2
:[
function
(
require
,
module
,
exports
){
/*
This file is part of ethereum.js.
ethereum.js is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ethereum.js is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file const.js
* @authors:
* Marek Kotewicz <marek@ethdev.com>
* @date 2015
*/
/// required to define ETH_BIGNUMBER_ROUNDING_MODE
if
(
"build"
!==
'build'
)
{
/*
var BigNumber = require('bignumber.js'); // jshint ignore:line
*/
}
module
.
exports
=
{
ETH_PADDING
:
32
,
ETH_METHOD_SIGNATURE_LENGTH
:
4
,
ETH_BIGNUMBER_ROUNDING_MODE
:
{
ROUNDING_MODE
:
BigNumber
.
ROUND_DOWN
}
};
},{}],
3
:[
function
(
require
,
module
,
exports
){
/*
This file is part of ethereum.js.
...
...
@@ -451,7 +476,7 @@ var contract = function (address, desc) {
module
.
exports
=
contract
;
},{
"./abi"
:
1
,
"./event"
:
3
,
"./web3"
:
11
}],
3
:[
function
(
require
,
module
,
exports
){
},{
"./abi"
:
1
,
"./event"
:
4
,
"./web3"
:
12
}],
4
:[
function
(
require
,
module
,
exports
){
/*
This file is part of ethereum.js.
...
...
@@ -526,7 +551,7 @@ var implementationOfEvent = function (address, signature, event) {
module
.
exports
=
implementationOfEvent
;
},{
"./abi"
:
1
,
"./utils"
:
1
0
}],
4
:[
function
(
require
,
module
,
exports
){
},{
"./abi"
:
1
,
"./utils"
:
1
1
}],
5
:[
function
(
require
,
module
,
exports
){
/*
This file is part of ethereum.js.
...
...
@@ -623,7 +648,7 @@ Filter.prototype.logs = function () {
module
.
exports
=
Filter
;
},{
"./web3"
:
1
1
}],
5
:[
function
(
require
,
module
,
exports
){
},{
"./web3"
:
1
2
}],
6
:[
function
(
require
,
module
,
exports
){
/*
This file is part of ethereum.js.
...
...
@@ -651,10 +676,7 @@ if ("build" !== 'build') {/*
*/
}
var
utils
=
require
(
'./utils'
);
BigNumber
.
config
({
ROUNDING_MODE
:
BigNumber
.
ROUND_DOWN
});
var
ETH_PADDING
=
32
;
var
c
=
require
(
'./const'
);
/// @param string string to be padded
/// @param number of characters that result string should have
...
...
@@ -669,10 +691,11 @@ var padLeft = function (string, chars, sign) {
/// If the value is floating point, round it down
/// @returns right-aligned byte representation of int
var
formatInputInt
=
function
(
value
)
{
var
padding
=
ETH_PADDING
*
2
;
var
padding
=
c
.
ETH_PADDING
*
2
;
if
(
value
instanceof
BigNumber
||
typeof
value
===
'number'
)
{
if
(
typeof
value
===
'number'
)
value
=
new
BigNumber
(
value
);
BigNumber
.
config
(
c
.
ETH_BIGNUMBER_ROUNDING_MODE
);
value
=
value
.
round
();
if
(
value
.
lessThan
(
0
))
...
...
@@ -691,7 +714,7 @@ var formatInputInt = function (value) {
/// Formats input value to byte representation of string
/// @returns left-algined byte representation of string
var
formatInputString
=
function
(
value
)
{
return
utils
.
fromAscii
(
value
,
ETH_PADDING
).
substr
(
2
);
return
utils
.
fromAscii
(
value
,
c
.
ETH_PADDING
).
substr
(
2
);
};
/// Formats input value to byte representation of bool
...
...
@@ -781,7 +804,7 @@ module.exports = {
};
},{
"./
utils"
:
10
}],
6
:[
function
(
require
,
module
,
exports
){
},{
"./
const"
:
2
,
"./utils"
:
11
}],
7
:[
function
(
require
,
module
,
exports
){
/*
This file is part of ethereum.js.
...
...
@@ -853,7 +876,7 @@ HttpSyncProvider.prototype.send = function (payload) {
module
.
exports
=
HttpSyncProvider
;
},{}],
7
:[
function
(
require
,
module
,
exports
){
},{}],
8
:[
function
(
require
,
module
,
exports
){
/*
This file is part of ethereum.js.
...
...
@@ -965,7 +988,7 @@ ProviderManager.prototype.stopPolling = function (pollId) {
module
.
exports
=
ProviderManager
;
},{
"./web3"
:
1
1
}],
8
:[
function
(
require
,
module
,
exports
){
},{
"./web3"
:
1
2
}],
9
:[
function
(
require
,
module
,
exports
){
/*
This file is part of ethereum.js.
...
...
@@ -999,7 +1022,7 @@ QtSyncProvider.prototype.send = function (payload) {
module
.
exports
=
QtSyncProvider
;
},{}],
9
:[
function
(
require
,
module
,
exports
){
},{}],
10
:[
function
(
require
,
module
,
exports
){
/*
This file is part of ethereum.js.
...
...
@@ -1080,7 +1103,7 @@ module.exports = {
};
},{
"./formatters"
:
5
}],
10
:[
function
(
require
,
module
,
exports
){
},{
"./formatters"
:
6
}],
11
:[
function
(
require
,
module
,
exports
){
/*
This file is part of ethereum.js.
...
...
@@ -1163,7 +1186,7 @@ module.exports = {
};
},{}],
1
1
:[
function
(
require
,
module
,
exports
){
},{}],
1
2
:[
function
(
require
,
module
,
exports
){
/*
This file is part of ethereum.js.
...
...
@@ -1470,7 +1493,7 @@ web3.setProvider = function(provider) {
module
.
exports
=
web3
;
},{
"./utils"
:
1
0
}],
"web3"
:[
function
(
require
,
module
,
exports
){
},{
"./utils"
:
1
1
}],
"web3"
:[
function
(
require
,
module
,
exports
){
var
web3
=
require
(
'./lib/web3'
);
var
ProviderManager
=
require
(
'./lib/providermanager'
);
web3
.
provider
=
new
ProviderManager
();
...
...
@@ -1483,7 +1506,7 @@ web3.abi = require('./lib/abi');
module
.
exports
=
web3
;
},{
"./lib/abi"
:
1
,
"./lib/contract"
:
2
,
"./lib/filter"
:
4
,
"./lib/httpsync"
:
6
,
"./lib/providermanager"
:
7
,
"./lib/qtsync"
:
8
,
"./lib/web3"
:
11
}]},{},[
"web3"
])
},{
"./lib/abi"
:
1
,
"./lib/contract"
:
3
,
"./lib/filter"
:
5
,
"./lib/httpsync"
:
7
,
"./lib/providermanager"
:
8
,
"./lib/qtsync"
:
9
,
"./lib/web3"
:
12
}]},{},[
"web3"
])
//# sourceMappingURL=ethereum.js.map
\ No newline at end of file
dist/ethereum.js.map
View file @
a8a2e323
This diff is collapsed.
Click to expand it.
dist/ethereum.min.js
View file @
a8a2e323
This diff is collapsed.
Click to expand it.
lib/abi.js
View file @
a8a2e323
...
...
@@ -21,22 +21,12 @@
* @date 2014
*/
if
(
process
.
env
.
NODE_ENV
!==
'build'
)
{
var
BigNumber
=
require
(
'bignumber.js'
);
// jshint ignore:line
}
var
web3
=
require
(
'./web3'
);
var
utils
=
require
(
'./utils'
);
var
types
=
require
(
'./types'
);
var
c
=
require
(
'./const'
);
var
f
=
require
(
'./formatters'
);
BigNumber
.
config
({
ROUNDING_MODE
:
BigNumber
.
ROUND_DOWN
});
var
ETH_PADDING
=
32
;
/// method signature length in bytes
var
ETH_METHOD_SIGNATURE_LENGTH
=
4
;
/// Filters all function from input abi
/// @returns abi array with filtered objects of type 'function'
var
filterFunctions
=
function
(
json
)
{
...
...
@@ -74,7 +64,7 @@ var inputTypes = types.inputTypes();
/// @returns bytes representation of input params
var
toAbiInput
=
function
(
method
,
params
)
{
var
bytes
=
""
;
var
padding
=
ETH_PADDING
*
2
;
var
padding
=
c
.
ETH_PADDING
*
2
;
/// first we iterate in search for dynamic
method
.
inputs
.
forEach
(
function
(
input
,
index
)
{
...
...
@@ -107,7 +97,7 @@ var toAbiInput = function (method, params) {
var
dynamicBytesLength
=
function
(
type
)
{
if
(
arrayType
(
type
)
||
type
===
'string'
)
// only string itself that is dynamic; stringX is static length.
return
ETH_PADDING
*
2
;
return
c
.
ETH_PADDING
*
2
;
return
0
;
};
...
...
@@ -121,7 +111,7 @@ var fromAbiOutput = function (method, output) {
output
=
output
.
slice
(
2
);
var
result
=
[];
var
padding
=
ETH_PADDING
*
2
;
var
padding
=
c
.
ETH_PADDING
*
2
;
var
dynamicPartLength
=
method
.
outputs
.
reduce
(
function
(
acc
,
curr
)
{
return
acc
+
dynamicBytesLength
(
curr
.
type
);
...
...
@@ -227,7 +217,7 @@ var outputParser = function (json) {
/// @param method name for which we want to get method signature
/// @returns (promise) contract method signature for method with given name
var
methodSignature
=
function
(
name
)
{
return
web3
.
sha3
(
web3
.
fromAscii
(
name
)).
slice
(
0
,
2
+
ETH_METHOD_SIGNATURE_LENGTH
*
2
);
return
web3
.
sha3
(
web3
.
fromAscii
(
name
)).
slice
(
0
,
2
+
c
.
ETH_METHOD_SIGNATURE_LENGTH
*
2
);
};
module
.
exports
=
{
...
...
lib/const.js
0 → 100644
View file @
a8a2e323
/*
This file is part of ethereum.js.
ethereum.js is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ethereum.js is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file const.js
* @authors:
* Marek Kotewicz <marek@ethdev.com>
* @date 2015
*/
/// required to define ETH_BIGNUMBER_ROUNDING_MODE
if
(
process
.
env
.
NODE_ENV
!==
'build'
)
{
var
BigNumber
=
require
(
'bignumber.js'
);
// jshint ignore:line
}
module
.
exports
=
{
ETH_PADDING
:
32
,
ETH_METHOD_SIGNATURE_LENGTH
:
4
,
ETH_BIGNUMBER_ROUNDING_MODE
:
{
ROUNDING_MODE
:
BigNumber
.
ROUND_DOWN
}
};
lib/formatters.js
View file @
a8a2e323
...
...
@@ -25,10 +25,7 @@ if (process.env.NODE_ENV !== 'build') {
}
var
utils
=
require
(
'./utils'
);
BigNumber
.
config
({
ROUNDING_MODE
:
BigNumber
.
ROUND_DOWN
});
var
ETH_PADDING
=
32
;
var
c
=
require
(
'./const'
);
/// @param string string to be padded
/// @param number of characters that result string should have
...
...
@@ -43,10 +40,11 @@ var padLeft = function (string, chars, sign) {
/// If the value is floating point, round it down
/// @returns right-aligned byte representation of int
var
formatInputInt
=
function
(
value
)
{
var
padding
=
ETH_PADDING
*
2
;
var
padding
=
c
.
ETH_PADDING
*
2
;
if
(
value
instanceof
BigNumber
||
typeof
value
===
'number'
)
{
if
(
typeof
value
===
'number'
)
value
=
new
BigNumber
(
value
);
BigNumber
.
config
(
c
.
ETH_BIGNUMBER_ROUNDING_MODE
);
value
=
value
.
round
();
if
(
value
.
lessThan
(
0
))
...
...
@@ -65,7 +63,7 @@ var formatInputInt = function (value) {
/// Formats input value to byte representation of string
/// @returns left-algined byte representation of string
var
formatInputString
=
function
(
value
)
{
return
utils
.
fromAscii
(
value
,
ETH_PADDING
).
substr
(
2
);
return
utils
.
fromAscii
(
value
,
c
.
ETH_PADDING
).
substr
(
2
);
};
/// Formats input value to byte representation of bool
...
...
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