mirror of
https://github.com/status-im/status-dev-cli.git
synced 2026-08-30 21:11:13 +00:00
fromAscii fix
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "status-dev-cli",
|
||||
"version": "3.0.0",
|
||||
"version": "3.0.1",
|
||||
"description": "CLI for Status",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
|
||||
Reference in New Issue
Block a user