-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #145 from handshake-org/create-rpcs
wallet: support alternative signers This PR introduces new RPC calls which create unsigned txs for each covenant type. It also adds a new WalletCoinView class that extends CoinView and stores HD paths. These paths allow alternative, HD wallets to create valid input signatures. The MTX class has also been updated to persist coin information during de/serialization. Finally, this commit adds support for unsigned auction transactions to the HTTP API.
- Loading branch information
Showing
24 changed files
with
1,571 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/*! | ||
* paths.js - paths object for hsd | ||
* Copyright (c) 2019, Boyma Fahnbulleh (MIT License). | ||
* https://github.com/handshake-org/hsd | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const assert = require('bsert'); | ||
|
||
/** | ||
* Paths | ||
* Represents the HD paths for coins in a single transaction. | ||
* @alias module:wallet.Paths | ||
* @property {Map[]} outputs - Paths. | ||
*/ | ||
|
||
class Paths { | ||
/** | ||
* Create paths | ||
* @constructor | ||
*/ | ||
|
||
constructor() { | ||
this.paths = new Map(); | ||
} | ||
|
||
/** | ||
* Add a single entry to the collection. | ||
* @param {Number} index | ||
* @param {Path} path | ||
* @returns {Path} | ||
*/ | ||
|
||
add(index, path) { | ||
assert((index >>> 0) === index); | ||
assert(path); | ||
this.paths.set(index, path); | ||
return path; | ||
} | ||
|
||
/** | ||
* Test whether the collection has a path. | ||
* @param {Number} index | ||
* @returns {Boolean} | ||
*/ | ||
|
||
has(index) { | ||
return this.paths.has(index); | ||
} | ||
|
||
/** | ||
* Get a path. | ||
* @param {Number} index | ||
* @returns {Path|null} | ||
*/ | ||
|
||
get(index) { | ||
return this.paths.get(index) || null; | ||
} | ||
|
||
/** | ||
* Remove a path and return it. | ||
* @param {Number} index | ||
* @returns {Path|null} | ||
*/ | ||
|
||
remove(index) { | ||
const path = this.get(index); | ||
|
||
if (!path) | ||
return null; | ||
|
||
this.paths.delete(index); | ||
|
||
return path; | ||
} | ||
|
||
/** | ||
* Test whether there are paths. | ||
* @returns {Boolean} | ||
*/ | ||
|
||
isEmpty() { | ||
return this.paths.size === 0; | ||
} | ||
} | ||
|
||
/* | ||
* Expose | ||
*/ | ||
|
||
module.exports = Paths; |
Oops, something went wrong.