http: fix jsonification of objects.

This commit is contained in:
Christopher Jeffrey 2018-08-02 08:01:47 -07:00
parent a27d935dad
commit 4b04d9a2f9
No known key found for this signature in database
GPG key ID: 8962AB9DE6666BBD

View file

@ -239,7 +239,7 @@ class HTTP extends Server {
// Get wallet
this.get('/wallet/:id', async (req, res) => {
const balance = await req.wallet.getBalance();
res.json(200, req.wallet.toJSON(false, balance));
res.json(200, req.wallet.getJSON(false, balance));
});
// Get wallet master key
@ -249,7 +249,7 @@ class HTTP extends Server {
return;
}
res.json(200, req.wallet.master.toJSON(this.network, true));
res.json(200, req.wallet.master.getJSON(this.network, true));
});
// Create wallet
@ -284,7 +284,7 @@ class HTTP extends Server {
const balance = await wallet.getBalance();
res.json(200, wallet.toJSON(false, balance));
res.json(200, wallet.getJSON(false, balance));
});
// List accounts
@ -306,7 +306,7 @@ class HTTP extends Server {
const balance = await req.wallet.getBalance(account.accountIndex);
res.json(200, account.toJSON(balance));
res.json(200, account.getJSON(balance));
});
// Create account
@ -333,7 +333,7 @@ class HTTP extends Server {
const account = await req.wallet.createAccount(options, passphrase);
const balance = await req.wallet.getBalance(account.accountIndex);
res.json(200, account.toJSON(balance));
res.json(200, account.getJSON(balance));
});
// Change passphrase
@ -449,7 +449,7 @@ class HTTP extends Server {
const details = await req.wallet.getDetails(tx.hash());
res.json(200, details.toJSON(this.network, this.wdb.height));
res.json(200, details.getJSON(this.network, this.wdb.height));
});
// Create TX
@ -604,7 +604,7 @@ class HTTP extends Server {
return;
}
res.json(200, key.toJSON(this.network));
res.json(200, key.getJSON(this.network));
});
// Get private key
@ -632,7 +632,7 @@ class HTTP extends Server {
const acct = valid.str('account');
const addr = await req.wallet.createReceive(acct);
res.json(200, addr.toJSON(this.network));
res.json(200, addr.getJSON(this.network));
});
// Create change address
@ -641,7 +641,7 @@ class HTTP extends Server {
const acct = valid.str('account');
const addr = await req.wallet.createChange(acct);
res.json(200, addr.toJSON(this.network));
res.json(200, addr.getJSON(this.network));
});
// Wallet Balance
@ -748,7 +748,7 @@ class HTTP extends Server {
const result = [];
for (const item of details)
result.push(item.toJSON(this.network, this.wdb.height));
result.push(item.getJSON(this.network, this.wdb.height));
res.json(200, result);
});
@ -765,7 +765,7 @@ class HTTP extends Server {
const result = [];
for (const item of details)
result.push(item.toJSON(this.network, this.wdb.height));
result.push(item.getJSON(this.network, this.wdb.height));
res.json(200, result);
});
@ -787,7 +787,7 @@ class HTTP extends Server {
const result = [];
for (const item of details)
result.push(item.toJSON(this.network, this.wdb.height));
result.push(item.getJSON(this.network, this.wdb.height));
res.json(200, result);
});
@ -802,7 +802,7 @@ class HTTP extends Server {
const result = [];
for (const item of details)
result.push(item.toJSON(this.network, this.wdb.height));
result.push(item.getJSON(this.network, this.wdb.height));
res.json(200, result);
});
@ -823,7 +823,7 @@ class HTTP extends Server {
const details = await req.wallet.toDetails(tx);
res.json(200, details.toJSON(this.network, this.wdb.height));
res.json(200, details.getJSON(this.network, this.wdb.height));
});
// Resend
@ -845,7 +845,7 @@ class HTTP extends Server {
if (!this.channel(name) && !this.channel('w:*'))
return;
const json = details.toJSON(this.network, this.wdb.height);
const json = details.getJSON(this.network, this.wdb.height);
if (this.channel(name))
this.to(name, event, wallet.id, json);
@ -894,7 +894,7 @@ class HTTP extends Server {
const json = [];
for (const addr of receive)
json.push(addr.toJSON(this.network));
json.push(addr.getJSON(this.network));
if (this.channel(name))
this.to(name, 'address', wallet.id, json);