mirror of
https://github.com/muun/recovery.git
synced 2025-11-11 22:40:16 -05:00
Release v0.3.0
This commit is contained in:
59
vendor/github.com/muun/libwallet/addresses/addresses.go
generated
vendored
Normal file
59
vendor/github.com/muun/libwallet/addresses/addresses.go
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
package addresses
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcutil/hdkeychain"
|
||||
)
|
||||
|
||||
const (
|
||||
V1 = 1
|
||||
V2 = 2
|
||||
V3 = 3
|
||||
V4 = 4
|
||||
SubmarineSwapV1 = 101
|
||||
SubmarineSwapV2 = 102
|
||||
IncomingSwap = 201
|
||||
)
|
||||
|
||||
type WalletAddress struct {
|
||||
version int
|
||||
derivationPath string
|
||||
address string
|
||||
}
|
||||
|
||||
func New(version int, derivationPath string, address string) *WalletAddress {
|
||||
return &WalletAddress{
|
||||
version: version,
|
||||
derivationPath: derivationPath,
|
||||
address: address,
|
||||
}
|
||||
}
|
||||
|
||||
func Create(version int, userKey, muunKey *hdkeychain.ExtendedKey, path string, network *chaincfg.Params) (*WalletAddress, error) {
|
||||
switch version {
|
||||
case V1:
|
||||
return CreateAddressV1(userKey, path, network)
|
||||
case V2:
|
||||
return CreateAddressV2(userKey, muunKey, path, network)
|
||||
case V3:
|
||||
return CreateAddressV3(userKey, muunKey, path, network)
|
||||
case V4:
|
||||
return CreateAddressV4(userKey, muunKey, path, network)
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown or unsupported version %v", version)
|
||||
}
|
||||
}
|
||||
|
||||
func (a *WalletAddress) Version() int {
|
||||
return a.version
|
||||
}
|
||||
|
||||
func (a *WalletAddress) DerivationPath() string {
|
||||
return a.derivationPath
|
||||
}
|
||||
|
||||
func (a *WalletAddress) Address() string {
|
||||
return a.address
|
||||
}
|
||||
Reference in New Issue
Block a user