-
Notifications
You must be signed in to change notification settings - Fork 0
/
manager.go
54 lines (48 loc) · 1.6 KB
/
manager.go
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
/*
* Copyright 2018 The OpenWallet Authors
* This file is part of the OpenWallet library.
*
* The OpenWallet library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The OpenWallet library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
package barc
import (
"github.com/blocktree/bitshares-adapter/bitshares"
"github.com/blocktree/openwallet/log"
bts "github.com/denkhaus/bitshares"
"github.com/denkhaus/bitshares/config"
)
const (
ChainIDBAR = "8ac5756ab6f78c1ae92d9654072eecf7fc81b418a05073ad067095061067e3c9"
)
type WalletManager struct {
*bitshares.WalletManager
}
func NewWalletManager() *WalletManager {
wm := WalletManager{}
wm.WalletManager = bitshares.NewWalletManager(nil)
wm.Config = bitshares.NewConfig(Symbol)
wm.Decoder = NewAddressDecoder(&wm)
wm.DecoderV2 = NewAddressDecoder(&wm)
wm.Log = log.NewOWLogger(wm.Symbol())
wm.Api = bitshares.NewWalletClient(wm.Config.ServerAPI, wm.Config.WalletAPI, false)
wm.WebsocketAPI = NewWebsocketAPI(wm.Config.ServerWS)
return &wm
}
func NewWebsocketAPI(api string) bts.WebsocketAPI {
config.Add(config.ChainConfig{
Name: "BAR",
CoreAsset: "BAR",
Prefix: "BAR",
ID: ChainIDBAR,
})
config.SetCurrent(ChainIDBAR)
return bts.NewWebsocketAPI(api)
}