rpc all the things

This commit is contained in:
ansuz
2017-04-03 19:24:57 +02:00
parent 4f7e25eeb9
commit a5e5ddae08
4 changed files with 158 additions and 38 deletions

View File

@@ -17,15 +17,12 @@ define([
var edPrivate = proxy.edPrivate;
var edPublic = proxy.edPublic;
var rpc = RPC.create(network, edPrivate, edPublic);
var payload = {
a: Math.floor(Math.random() * 1000),
b: 7,
};
rpc.ready(function () {
RPC.create(network, edPrivate, edPublic, function (e, rpc) {
// console.log(payload);
rpc.send('ECHO', payload, function (e, msg) {
if (e) { return void console.error(e); }
@@ -68,6 +65,25 @@ define([
console.log(msg);
});
(function () {
// compute what you think the hash should be
// then ask the server if what it has matches your records
rpc.send('GET_HASH', edPublic, function (e, hash) {
if (e) { return void console.error(e); }
console.log("user pins hash is [%s]", hash);
// if it does, awesome!
// you should be able to pin and unpin things easily
// if it doesn't, send a reset, and start re-pinning
});
}());
if (false) {
(function () {
var bytes = 0;