-
Notifications
You must be signed in to change notification settings - Fork 0
/
coin_types.go
52 lines (43 loc) · 915 Bytes
/
coin_types.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
package util
import "github.com/OpenBazaar/wallet-interface"
type ExtCoinType wallet.CoinType
func ExtendCoinType(coinType wallet.CoinType) ExtCoinType {
return ExtCoinType(uint32(coinType))
}
const (
CoinTypeUzlocoin ExtCoinType = 444
CoinTypeUzlocoinTest = 1000444
)
func (c *ExtCoinType) String() string {
ct := wallet.CoinType(uint32(*c))
str := ct.String()
if str != "" {
return str
}
switch *c {
case CoinTypeUzlocoin:
return "Uzlocoin"
case CoinTypeUzlocoinTest:
return "Testnet Uzlocoin"
default:
return ""
}
}
func (c *ExtCoinType) CurrencyCode() string {
ct := wallet.CoinType(uint32(*c))
str := ct.CurrencyCode()
if str != "" {
return str
}
switch *c {
case CoinTypeUzlocoin:
return "PHR"
case CoinTypeUzlocoinTest:
return "TPHR"
default:
return ""
}
}
func (c ExtCoinType) ToCoinType() wallet.CoinType {
return wallet.CoinType(uint32(c))
}