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
67e3eff8
Commit
67e3eff8
authored
Nov 10, 2014
by
Marian OANCΞA
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6 from cubedro/develop
Changes from debris
parents
a2d8b892
f5024b49
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
httprpc.js
lib/httprpc.js
+3
-2
main.js
lib/main.js
+19
-12
No files found.
lib/httprpc.js
View file @
67e3eff8
...
@@ -45,7 +45,8 @@ if(process.env.NODE_ENV !== "build") {
...
@@ -45,7 +45,8 @@ if(process.env.NODE_ENV !== "build") {
return
{
return
{
_id
:
object
.
id
,
_id
:
object
.
id
,
data
:
object
.
result
data
:
object
.
result
,
error
:
object
.
error
};
};
}
}
...
@@ -75,7 +76,7 @@ if(process.env.NODE_ENV !== "build") {
...
@@ -75,7 +76,7 @@ if(process.env.NODE_ENV !== "build") {
var
self
=
this
;
var
self
=
this
;
this
.
sendRequest
(
payload
,
function
(
request
)
{
this
.
sendRequest
(
payload
,
function
(
request
)
{
var
parsed
=
JSON
.
parse
(
request
.
responseText
);
var
parsed
=
JSON
.
parse
(
request
.
responseText
);
if
(
parsed
.
result
instanceof
Array
?
parsed
.
result
.
length
===
0
:
!
parsed
.
result
)
{
if
(
parsed
.
error
||
(
parsed
.
result
instanceof
Array
?
parsed
.
result
.
length
===
0
:
!
parsed
.
result
)
)
{
return
;
return
;
}
}
self
.
handlers
.
forEach
(
function
(
handler
)
{
self
.
handlers
.
forEach
(
function
(
handler
)
{
...
...
lib/main.js
View file @
67e3eff8
...
@@ -155,15 +155,15 @@
...
@@ -155,15 +155,15 @@
return
{
call
:
call
,
args
:
args
};
return
{
call
:
call
,
args
:
args
};
}).
then
(
function
(
request
)
{
}).
then
(
function
(
request
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
web3
.
provider
.
send
(
request
,
function
(
result
)
{
web3
.
provider
.
send
(
request
,
function
(
err
,
result
)
{
if
(
result
||
typeof
result
===
"boolean"
)
{
if
(
!
err
)
{
resolve
(
result
);
resolve
(
result
);
return
;
return
;
}
}
reject
(
result
);
reject
(
err
);
});
});
});
});
}).
catch
(
function
(
err
)
{
}).
catch
(
function
(
err
)
{
console
.
error
(
err
);
console
.
error
(
err
);
});
});
};
};
...
@@ -175,8 +175,12 @@
...
@@ -175,8 +175,12 @@
var
proto
=
{};
var
proto
=
{};
proto
.
get
=
function
()
{
proto
.
get
=
function
()
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
web3
.
provider
.
send
({
call
:
property
.
getter
},
function
(
result
)
{
web3
.
provider
.
send
({
call
:
property
.
getter
},
function
(
err
,
result
)
{
resolve
(
result
);
if
(
!
err
)
{
resolve
(
result
);
return
;
}
reject
(
err
);
});
});
});
});
};
};
...
@@ -184,12 +188,12 @@
...
@@ -184,12 +188,12 @@
proto
.
set
=
function
(
val
)
{
proto
.
set
=
function
(
val
)
{
return
flattenPromise
([
val
]).
then
(
function
(
args
)
{
return
flattenPromise
([
val
]).
then
(
function
(
args
)
{
return
new
Promise
(
function
(
resolve
)
{
return
new
Promise
(
function
(
resolve
)
{
web3
.
provider
.
send
({
call
:
property
.
setter
,
args
:
args
},
function
(
result
)
{
web3
.
provider
.
send
({
call
:
property
.
setter
,
args
:
args
},
function
(
err
,
result
)
{
if
(
result
)
{
if
(
!
err
)
{
resolve
(
result
);
resolve
(
result
);
}
else
{
return
;
reject
(
result
);
}
}
reject
(
err
);
});
});
});
});
}).
catch
(
function
(
err
)
{
}).
catch
(
function
(
err
)
{
...
@@ -219,6 +223,8 @@
...
@@ -219,6 +223,8 @@
// Find termination
// Find termination
var
str
=
""
;
var
str
=
""
;
var
i
=
0
,
l
=
hex
.
length
;
var
i
=
0
,
l
=
hex
.
length
;
if
(
hex
.
substring
(
0
,
2
)
==
'0x'
)
i
=
2
;
for
(;
i
<
l
;
i
+=
2
)
{
for
(;
i
<
l
;
i
+=
2
)
{
var
code
=
hex
.
charCodeAt
(
i
);
var
code
=
hex
.
charCodeAt
(
i
);
if
(
code
===
0
)
{
if
(
code
===
0
)
{
...
@@ -240,7 +246,8 @@
...
@@ -240,7 +246,8 @@
var
hex
=
this
.
toHex
(
str
);
var
hex
=
this
.
toHex
(
str
);
while
(
hex
.
length
<
pad
*
2
)
while
(
hex
.
length
<
pad
*
2
)
hex
+=
"00"
;
hex
+=
"00"
;
return
hex
;
return
"0x"
+
hex
;
},
},
eth
:
{
eth
:
{
...
@@ -440,7 +447,7 @@
...
@@ -440,7 +447,7 @@
if
(
data
.
_id
)
{
if
(
data
.
_id
)
{
var
cb
=
web3
.
_callbacks
[
data
.
_id
];
var
cb
=
web3
.
_callbacks
[
data
.
_id
];
if
(
cb
)
{
if
(
cb
)
{
cb
.
call
(
this
,
data
.
data
);
cb
.
call
(
this
,
data
.
error
,
data
.
data
)
delete
web3
.
_callbacks
[
data
.
_id
];
delete
web3
.
_callbacks
[
data
.
_id
];
}
}
}
}
...
...
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