fromAscii fix

This commit is contained in:
alwx
2017-05-16 22:08:16 +03:00
parent 4a6a224c9d
commit ea816c30b1
3 changed files with 9 additions and 11 deletions
+4 -2
View File
@@ -83,9 +83,11 @@ function getCurrentPackageData() {
}
function getPackageData(contact) {
var contactData = contact;
var contactData;
if (!contact) {
contactData = getCurrentPackageData();
contactData = JSON.stringify(getCurrentPackageData());
} else {
contactData = contact;
}
return contactData;
}
+4 -8
View File
@@ -10,10 +10,6 @@ function fromAscii(str) {
return "0x" + hex;
};
function encodeObject(obj) {
return fromAscii(JSON.stringify(obj));
}
var StatusDev = function(options) {
this.url = "http://" + options.ip + ":5561";
};
@@ -23,7 +19,7 @@ StatusDev.prototype.addContact = function(contactData, cb) {
url: this.url + "/add-dapp",
method: "POST",
json: true,
body: { encoded: encodeObject(contactData) }
body: { encoded: fromAscii(contactData) }
}, function (error, response, body) {
if (cb === undefined) { return }
cb(error, response);
@@ -35,7 +31,7 @@ StatusDev.prototype.removeContact = function(contactData, cb) {
url: this.url + "/remove-dapp",
method: "POST",
json: true,
body: { encoded: encodeObject(contactData) }
body: { encoded: fromAscii(contactData) }
}, function (error, response, body) {
if (cb === undefined) { return }
cb(error, response);
@@ -47,7 +43,7 @@ StatusDev.prototype.refreshContact = function(contactData, cb) {
url: this.url + "/dapp-changed",
method: "POST",
json: true,
body: { encoded: encodeObject(contactData) }
body: { encoded: fromAscii(contactData) }
}, function (error, response, body) {
if (cb === undefined) { return }
cb(error, response);
@@ -59,7 +55,7 @@ StatusDev.prototype.switchNode = function(rpcUrl, cb) {
url: this.url + "/switch-node",
method: "POST",
json: true,
body: {encoded: encodeObject({"url": rpcUrl})}
body: {encoded: fromAscii({"url": rpcUrl})}
}, function (error, response, body) {
if (cb === undefined) { return }
cb(error, response);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "status-dev-cli",
"version": "3.0.0",
"version": "3.0.1",
"description": "CLI for Status",
"main": "index.js",
"bin": {