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
ceb4357a
Commit
ceb4357a
authored
Jan 21, 2015
by
Marek Kotewicz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync api tests running, removed unused pieces of code
parent
fc986a3f
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
9 additions
and
173 deletions
+9
-173
ethereum.js
dist/ethereum.js
+2
-82
ethereum.js.map
dist/ethereum.js.map
+3
-3
ethereum.min.js
dist/ethereum.min.js
+1
-1
providermanager.js
lib/providermanager.js
+2
-1
web3.js
lib/web3.js
+0
-81
db.methods.js
test/db.methods.js
+0
-1
eth.methods.js
test/eth.methods.js
+0
-1
shh.methods.js
test/shh.methods.js
+0
-1
utils.js
test/utils.js
+1
-1
web3.methods.js
test/web3.methods.js
+0
-1
No files found.
dist/ethereum.js
View file @
ceb4357a
...
...
@@ -731,7 +731,8 @@ ProviderManager.prototype.send = function(data) {
this
.
id
++
;
if
(
this
.
provider
===
undefined
)
{
console
.
error
(
"provider is not set"
);
console
.
error
(
'provider is not set'
);
return
JSON
.
stringify
({
result
:
'error, provider is not set'
});
}
return
this
.
provider
.
send
(
data
);
...
...
@@ -808,48 +809,6 @@ module.exports = ProviderManager;
* @date 2014
*/
/// Recursively resolves all promises in given object and replaces the resolved values with promises
/// @param any object/array/promise/anything else..
/// @returns (resolves) object with replaced promises with their result
function
flattenPromise
(
obj
)
{
if
(
obj
instanceof
Promise
)
{
return
Promise
.
resolve
(
obj
);
}
if
(
obj
instanceof
Array
)
{
return
new
Promise
(
function
(
resolve
)
{
var
promises
=
obj
.
map
(
function
(
o
)
{
return
flattenPromise
(
o
);
});
return
Promise
.
all
(
promises
).
then
(
function
(
res
)
{
for
(
var
i
=
0
;
i
<
obj
.
length
;
i
++
)
{
obj
[
i
]
=
res
[
i
];
}
resolve
(
obj
);
});
});
}
if
(
obj
instanceof
Object
)
{
return
new
Promise
(
function
(
resolve
)
{
var
keys
=
Object
.
keys
(
obj
);
var
promises
=
keys
.
map
(
function
(
key
)
{
return
flattenPromise
(
obj
[
key
]);
});
return
Promise
.
all
(
promises
).
then
(
function
(
res
)
{
for
(
var
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
obj
[
keys
[
i
]]
=
res
[
i
];
}
resolve
(
obj
);
});
});
}
return
Promise
.
resolve
(
obj
);
}
/// @returns an array of objects describing web3 api methods
var
web3Methods
=
function
()
{
return
[
...
...
@@ -964,22 +923,6 @@ var setupMethods = function (obj, methods) {
result
=
JSON
.
parse
(
result
);
return
result
.
result
;
//return flattenPromise(Array.prototype.slice.call(arguments)).then(function (args) {
//var call = typeof method.call === "function" ? method.call(args) : method.call;
//return {call: call, args: args};
//}).then(function (request) {
//return new Promise(function (resolve, reject) {
//web3.provider.send(request, function (err, result) {
//if (!err) {
//resolve(result);
//return;
//}
//reject(err);
//});
//});
//}).catch(function(err) {
//console.error(err);
//});
};
});
};
...
...
@@ -997,16 +940,6 @@ var setupProperties = function (obj, properties) {
result
=
JSON
.
parse
(
result
);
return
result
.
result
;
//return new Promise(function(resolve, reject) {
//web3.provider.send({call: property.getter}, function(err, result) {
//if (!err) {
//resolve(result);
//return;
//}
//reject(err);
//});
//});
};
if
(
property
.
setter
)
{
proto
.
set
=
function
(
val
)
{
...
...
@@ -1018,19 +951,6 @@ var setupProperties = function (obj, properties) {
result
=
JSON
.
parse
(
result
);
return
result
.
result
;
//return flattenPromise([val]).then(function (args) {
//return new Promise(function (resolve) {
//web3.provider.send({call: property.setter, args: args}, function (err, result) {
//if (!err) {
//resolve(result);
//return;
//}
//reject(err);
//});
//});
//}).catch(function (err) {
//console.error(err);
//});
};
}
Object
.
defineProperty
(
obj
,
property
.
name
,
proto
);
...
...
dist/ethereum.js.map
View file @
ceb4357a
This diff is collapsed.
Click to expand it.
dist/ethereum.min.js
View file @
ceb4357a
This diff is collapsed.
Click to expand it.
lib/providermanager.js
View file @
ceb4357a
...
...
@@ -63,7 +63,8 @@ ProviderManager.prototype.send = function(data) {
this
.
id
++
;
if
(
this
.
provider
===
undefined
)
{
console
.
error
(
"provider is not set"
);
console
.
error
(
'provider is not set'
);
return
JSON
.
stringify
({
result
:
'error, provider is not set'
});
}
return
this
.
provider
.
send
(
data
);
...
...
lib/web3.js
View file @
ceb4357a
...
...
@@ -23,48 +23,6 @@
* @date 2014
*/
/// Recursively resolves all promises in given object and replaces the resolved values with promises
/// @param any object/array/promise/anything else..
/// @returns (resolves) object with replaced promises with their result
function
flattenPromise
(
obj
)
{
if
(
obj
instanceof
Promise
)
{
return
Promise
.
resolve
(
obj
);
}
if
(
obj
instanceof
Array
)
{
return
new
Promise
(
function
(
resolve
)
{
var
promises
=
obj
.
map
(
function
(
o
)
{
return
flattenPromise
(
o
);
});
return
Promise
.
all
(
promises
).
then
(
function
(
res
)
{
for
(
var
i
=
0
;
i
<
obj
.
length
;
i
++
)
{
obj
[
i
]
=
res
[
i
];
}
resolve
(
obj
);
});
});
}
if
(
obj
instanceof
Object
)
{
return
new
Promise
(
function
(
resolve
)
{
var
keys
=
Object
.
keys
(
obj
);
var
promises
=
keys
.
map
(
function
(
key
)
{
return
flattenPromise
(
obj
[
key
]);
});
return
Promise
.
all
(
promises
).
then
(
function
(
res
)
{
for
(
var
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
obj
[
keys
[
i
]]
=
res
[
i
];
}
resolve
(
obj
);
});
});
}
return
Promise
.
resolve
(
obj
);
}
/// @returns an array of objects describing web3 api methods
var
web3Methods
=
function
()
{
return
[
...
...
@@ -179,22 +137,6 @@ var setupMethods = function (obj, methods) {
result
=
JSON
.
parse
(
result
);
return
result
.
result
;
//return flattenPromise(Array.prototype.slice.call(arguments)).then(function (args) {
//var call = typeof method.call === "function" ? method.call(args) : method.call;
//return {call: call, args: args};
//}).then(function (request) {
//return new Promise(function (resolve, reject) {
//web3.provider.send(request, function (err, result) {
//if (!err) {
//resolve(result);
//return;
//}
//reject(err);
//});
//});
//}).catch(function(err) {
//console.error(err);
//});
};
});
};
...
...
@@ -212,16 +154,6 @@ var setupProperties = function (obj, properties) {
result
=
JSON
.
parse
(
result
);
return
result
.
result
;
//return new Promise(function(resolve, reject) {
//web3.provider.send({call: property.getter}, function(err, result) {
//if (!err) {
//resolve(result);
//return;
//}
//reject(err);
//});
//});
};
if
(
property
.
setter
)
{
proto
.
set
=
function
(
val
)
{
...
...
@@ -233,19 +165,6 @@ var setupProperties = function (obj, properties) {
result
=
JSON
.
parse
(
result
);
return
result
.
result
;
//return flattenPromise([val]).then(function (args) {
//return new Promise(function (resolve) {
//web3.provider.send({call: property.setter, args: args}, function (err, result) {
//if (!err) {
//resolve(result);
//return;
//}
//reject(err);
//});
//});
//}).catch(function (err) {
//console.error(err);
//});
};
}
Object
.
defineProperty
(
obj
,
property
.
name
,
proto
);
...
...
test/db.methods.js
View file @
ceb4357a
...
...
@@ -3,7 +3,6 @@ require('es6-promise').polyfill();
var
assert
=
require
(
'assert'
);
var
web3
=
require
(
'../index.js'
);
var
u
=
require
(
'./utils.js'
);
web3
.
setProvider
(
new
web3
.
providers
.
WebSocketProvider
(
'http://localhost:8080'
));
// TODO: create some mock provider
describe
(
'web3'
,
function
()
{
describe
(
'db'
,
function
()
{
...
...
test/eth.methods.js
View file @
ceb4357a
...
...
@@ -3,7 +3,6 @@ require('es6-promise').polyfill();
var
assert
=
require
(
'assert'
);
var
web3
=
require
(
'../index.js'
);
var
u
=
require
(
'./utils.js'
);
web3
.
setProvider
(
new
web3
.
providers
.
WebSocketProvider
(
'http://localhost:8080'
));
// TODO: create some mock provider
describe
(
'web3'
,
function
()
{
describe
(
'eth'
,
function
()
{
...
...
test/shh.methods.js
View file @
ceb4357a
...
...
@@ -3,7 +3,6 @@ require('es6-promise').polyfill();
var
assert
=
require
(
'assert'
);
var
web3
=
require
(
'../index.js'
);
var
u
=
require
(
'./utils.js'
);
web3
.
setProvider
(
new
web3
.
providers
.
WebSocketProvider
(
'http://localhost:8080'
));
// TODO: create some mock provider
describe
(
'web3'
,
function
()
{
describe
(
'shh'
,
function
()
{
...
...
test/utils.js
View file @
ceb4357a
...
...
@@ -8,7 +8,7 @@ var methodExists = function (object, method) {
var
propertyExists
=
function
(
object
,
property
)
{
it
(
'should have property '
+
property
+
' implemented'
,
function
()
{
assert
.
equal
(
'object
'
,
typeof
object
[
property
],
'property '
+
property
+
' is not implemented'
);
assert
.
notEqual
(
'undefined
'
,
typeof
object
[
property
],
'property '
+
property
+
' is not implemented'
);
});
};
...
...
test/web3.methods.js
View file @
ceb4357a
...
...
@@ -3,7 +3,6 @@ require('es6-promise').polyfill();
var
assert
=
require
(
'assert'
);
var
web3
=
require
(
'../index.js'
);
var
u
=
require
(
'./utils.js'
);
web3
.
setProvider
(
new
web3
.
providers
.
WebSocketProvider
(
'http://localhost:8080'
));
// TODO: create some mock provider
describe
(
'web3'
,
function
()
{
u
.
methodExists
(
web3
,
'sha3'
);
...
...
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