mirror of
https://github.com/muun/recovery.git
synced 2025-11-10 22:10:14 -05:00
Release v0.3.0
This commit is contained in:
24
vendor/github.com/muun/libwallet/addresses/v1.go
generated
vendored
Normal file
24
vendor/github.com/muun/libwallet/addresses/v1.go
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
package addresses
|
||||
|
||||
import (
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcutil/hdkeychain"
|
||||
)
|
||||
|
||||
// CreateAddressV1 returns a P2PKH WalletAddress from a publicKey for use in TransactionSchemeV1
|
||||
func CreateAddressV1(userKey *hdkeychain.ExtendedKey, path string, network *chaincfg.Params) (*WalletAddress, error) {
|
||||
pubKey, err := userKey.ECPubKey()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
address, err := btcutil.NewAddressPubKey(pubKey.SerializeCompressed(), network)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &WalletAddress{
|
||||
address: address.EncodeAddress(),
|
||||
version: V1,
|
||||
derivationPath: path,
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user