Skip to content

Commit

Permalink
Merge pull request #110 from handshake-org/mirror-rpc
Browse files Browse the repository at this point in the history
wallet: support the creation of unsigned auction txs
  • Loading branch information
boymanjor committed Mar 15, 2019
2 parents 8c40453 + 45a332f commit 405aa76
Show file tree
Hide file tree
Showing 4 changed files with 424 additions and 73 deletions.
25 changes: 22 additions & 3 deletions lib/primitives/mtx.js
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,12 @@ class MTX extends TX {
*/

format() {
return super.format(this.view);
const mtx = super.format(this.view);

if (this.paths)
mtx.paths = this.paths;

return mtx;
}

/**
Expand All @@ -1309,7 +1314,12 @@ class MTX extends TX {
*/

toJSON() {
return super.getJSON(null, this.view);
const json = super.getJSON(null, this.view);

if (this.paths)
json.paths = this.paths;

return json;
}

/**
Expand All @@ -1319,7 +1329,12 @@ class MTX extends TX {
*/

getJSON(network) {
return super.getJSON(network, this.view);
const json = super.getJSON(network, this.view);

if (this.paths)
json.paths = this.paths;

return json;
}

/**
Expand All @@ -1330,6 +1345,9 @@ class MTX extends TX {
fromJSON(json) {
super.fromJSON(json);

if (json.paths)
this.paths = json.paths;

for (let i = 0; i < json.inputs.length; i++) {
const input = json.inputs[i];
const {prevout} = input;
Expand All @@ -1343,6 +1361,7 @@ class MTX extends TX {
coin.index = prevout.index;

this.view.addCoin(coin);
this.inputs[i].coin = coin;
}

return this;
Expand Down
2 changes: 1 addition & 1 deletion lib/wallet/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const bdb = require('bdb');
* D -> wallet id depth
* p[addr-hash] -> wallet ids
* P[wid][addr-hash] -> path data
* r[wid][index][hash] -> path account index
* r[wid][index][hash] -> dummy
* w[wid] -> wallet
* W[wid] -> wallet id
* l[id] -> wid
Expand Down
Loading

0 comments on commit 405aa76

Please sign in to comment.