-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbcoin_setWallet.js
More file actions
32 lines (29 loc) · 975 Bytes
/
bcoin_setWallet.js
File metadata and controls
32 lines (29 loc) · 975 Bytes
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
/**
* @name: setWallet()
* @description: Sets bcoin wallet object based on parameters in the process.env
* @usage: require('./setWallet')(); wallet = setWallet()
* @author: Mike Rightmire
* @email: Michael.Rightmire@groenewold-newmedia.de
* @copyright: Groenewold New Media
* @version: 0.9.0.0
* @Licensing: ALl rights reserved
*/
const bcoin = require('bcoin');
module.exports = function() {
this.setWallet = function () { // defaults
/* Set the wallet */
const WalletKey = bcoin.wallet.WalletKey;
const {WalletClient} = require('bclient');
const {Network} = require('bcoin');
const network = Network.get(process.env.net);
const walletOptions = {
network: network.type,
host: process.env.walletHost,
port: network.walletPort,
apiKey: process.env.walletApiKey,
}
const walletClient = new WalletClient(walletOptions);
const wallet = walletClient.wallet(process.env.walletID);
return wallet;
}
}