-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend BITBOX's HDNode class to add
toSLPAddress
.
- Loading branch information
Gabriel Cardona
committed
Apr 28, 2019
1 parent
8370d33
commit bdb7d01
Showing
8 changed files
with
132 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var BITBOXHDNode = require("bitbox-sdk/lib/HDNode").default; | ||
var BITBOXSDK = require("bitbox-sdk"); | ||
var BITBOX = new BITBOXSDK(); | ||
var utils = require("slpjs").Utils; | ||
var HDNode = /** @class */ (function (_super) { | ||
__extends(HDNode, _super); | ||
function HDNode(restURL) { | ||
var _this = _super.call(this, restURL) || this; | ||
_this.restURL = restURL; | ||
return _this; | ||
} | ||
HDNode.prototype.toLegacyAddress = function (hdNode) { | ||
return BITBOX.HDNode.toLegacyAddress(hdNode); | ||
}; | ||
HDNode.prototype.toCashAddress = function (hdNode, regtest) { | ||
if (regtest === void 0) { regtest = false; } | ||
return BITBOX.HDNode.toCashAddress(hdNode, regtest); | ||
}; | ||
HDNode.prototype.toSLPAddress = function (hdNode) { | ||
var cashAddr = BITBOX.HDNode.toCashAddress(hdNode); | ||
return utils.toSlpAddress(cashAddr); | ||
}; | ||
return HDNode; | ||
}(BITBOXHDNode)); | ||
exports.default = HDNode; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,27 @@ | ||
const BITBOXHDNode = require("bitbox-sdk/lib/HDNode").default | ||
const BITBOXSDK = require("bitbox-sdk") | ||
const BITBOX = new BITBOXSDK() | ||
const utils = require("slpjs").Utils | ||
|
||
class HDNode extends BITBOXHDNode { | ||
restURL: string | ||
constructor(restURL?: string) { | ||
super(restURL) | ||
this.restURL = restURL | ||
} | ||
|
||
toLegacyAddress(hdNode: any): string { | ||
return BITBOX.HDNode.toLegacyAddress(hdNode) | ||
} | ||
|
||
toCashAddress(hdNode: any, regtest = false): string { | ||
return BITBOX.HDNode.toCashAddress(hdNode, regtest) | ||
} | ||
|
||
toSLPAddress(hdNode: any): string { | ||
const cashAddr = BITBOX.HDNode.toCashAddress(hdNode) | ||
return utils.toSlpAddress(cashAddr) | ||
} | ||
} | ||
|
||
export default HDNode |
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