forked from blockchain/My-Wallet-V3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuy-sell.js
55 lines (48 loc) · 1.19 KB
/
buy-sell.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
module.exports = BuySell;
// var buySell = new Blockchain.BuySell(Blockchain.MyWallet.wallet);
function BuySell (wallet, debug) {
this._wallet = wallet;
// Stop if 2nd password is enabled
if (wallet.external === null) {
console.info("2nd password enabled, don't initialize BuySell");
return;
}
// Stop if meta data failed to load;
if (wallet.external === null) {
return;
}
this.debug = Boolean(debug);
}
Object.defineProperties(BuySell.prototype, {
'debug': {
configurable: false,
get: function () { return this._debug; },
set: function (val) {
this._debug = val;
this._wallet.external.coinify.debug = val;
this._wallet.external.sfox.debug = val;
/* istanbul ignore if */
if (this.debug) {
console.info('BuySell debug enabled');
}
}
},
'status': {
configurable: false,
get: function () {
return {
metaDataService: this._wallet.external
};
}
},
'exchanges': {
configurable: false,
get: function () {
if (this._wallet.external === null) return;
return {
coinify: this._wallet.external.coinify,
sfox: this._wallet.external.sfox
};
}
}
});