Files
utxo/secp256k1fx/keychain_wrapper.go
zeekay 8f7179ae0d refactor: move fx packages to root
Drop redundant fx/ directory since packages already have fx suffix:
- github.com/luxfi/utxo/fx/secp256k1fx → github.com/luxfi/utxo/secp256k1fx
- github.com/luxfi/utxo/fx/nftfx → github.com/luxfi/utxo/nftfx
- github.com/luxfi/utxo/fx/propertyfx → github.com/luxfi/utxo/propertyfx

BREAKING CHANGE: Import paths changed
2026-01-10 12:54:02 -08:00

34 lines
915 B
Go

// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package secp256k1fx
import (
"github.com/luxfi/ids"
"github.com/luxfi/keychain"
"github.com/luxfi/math/set"
)
// Ensure Keychain implements keychain.Keychain interface
var _ keychain.Keychain = (*keychainWrapper)(nil)
// keychainWrapper wraps a Keychain to implement the ledger keychain interface
type keychainWrapper struct {
*Keychain
}
// Get implements keychain.Keychain
func (kw *keychainWrapper) Get(addr ids.ShortID) (keychain.Signer, bool) {
return kw.Keychain.Get(addr)
}
// Addresses implements keychain.Keychain
func (kw *keychainWrapper) Addresses() set.Set[ids.ShortID] {
return kw.Keychain.Addresses()
}
// WrapKeychain wraps a Keychain to implement the ledger keychain interface
func WrapKeychain(kc *Keychain) keychain.Keychain {
return &keychainWrapper{Keychain: kc}
}