mirror of
https://github.com/muun/recovery.git
synced 2025-11-12 14:51:37 -05:00
Update project structure and build process
This commit is contained in:
35
libwallet/network.go
Executable file
35
libwallet/network.go
Executable file
@@ -0,0 +1,35 @@
|
||||
package libwallet
|
||||
|
||||
import (
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
)
|
||||
|
||||
// Network has the parameters for operating in a given Bitcoin network
|
||||
type Network struct {
|
||||
network *chaincfg.Params
|
||||
}
|
||||
|
||||
// Mainnet returns an instance of the Bitcoin Main Network
|
||||
func Mainnet() *Network {
|
||||
return &Network{network: &chaincfg.MainNetParams}
|
||||
}
|
||||
|
||||
// Testnet returns an instance of the Bitcoin Test Network
|
||||
func Testnet() *Network {
|
||||
return &Network{network: &chaincfg.TestNet3Params}
|
||||
}
|
||||
|
||||
// Regtest returns an instance of the Bitcoin Regression Network
|
||||
func Regtest() *Network {
|
||||
return &Network{network: &chaincfg.RegressionNetParams}
|
||||
}
|
||||
|
||||
// Name returns the Network's name
|
||||
func (n *Network) Name() string {
|
||||
return n.network.Name
|
||||
}
|
||||
|
||||
// ToParams returns the chaincfg.Params associated with this network (only available via Go code)
|
||||
func (n *Network) ToParams() *chaincfg.Params {
|
||||
return n.network
|
||||
}
|
||||
Reference in New Issue
Block a user