mirror of
https://github.com/Permissionless-Software-Foundation/bch-js.git
synced 2026-09-21 16:51:59 -07:00
35 lines
878 B
JavaScript
35 lines
878 B
JavaScript
// import BCHJS from "../bch-js.js"
|
|
// const bchjs = new BCHJS()
|
|
|
|
import BCHJSECPair from '../ecpair.js'
|
|
|
|
import bchaddrjs from 'bchaddrjs-slp'
|
|
|
|
class ECPair extends BCHJSECPair {
|
|
/*
|
|
constructor(restURL) {
|
|
super(restURL)
|
|
this.restURL = restURL
|
|
}
|
|
*/
|
|
/**
|
|
* @api SLP.ECPair.toSLPAddress() toSLPAddress()
|
|
* @apiName toSLPAddress
|
|
* @apiGroup SLP
|
|
* @apiDescription Get slp address of ECPair.
|
|
*
|
|
* @apiExample Example usage:
|
|
* // create ecpair from wif
|
|
* let ecpair = bchjs.SLP.ECPair.fromWIF('cUCSrdhu7mCzx4sWqL6irqzprkofxPmLHYgkSnG2WaWVqJDXtWRS')
|
|
* // to slp address
|
|
* bchjs.SLP.ECPair.toSLPAddress(ecpair);
|
|
* // slptest:qq835u5srlcqwrtwt6xm4efwan30fxg9hcqag6fk03
|
|
*/
|
|
static toSLPAddress (ecpair) {
|
|
const slpAddress = bchaddrjs.toSlpAddress(this.toCashAddress(ecpair))
|
|
return slpAddress
|
|
}
|
|
}
|
|
|
|
export default ECPair
|