feat(crypto/keyring): expose db keyring used in the keystore (#24040)

Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io>
Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com>
This commit is contained in:
Đông Liều 2025-03-21 22:04:30 +07:00 committed by GitHub
parent f6fa4f25bd
commit 454467d081
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 2 deletions

View File

@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Features
* (crypto/keyring) [#24040](https://github.com/cosmos/cosmos-sdk/pull/24040) Expose the db keyring used in the keystore.
* (types) [#23919](https://github.com/cosmos/cosmos-sdk/pull/23919) Add MustValAddressFromBech32 function.
* (all) [#23708](https://github.com/cosmos/cosmos-sdk/pull/23708) Add unordered transaction support.
* Adds a `--timeout-timestamp` flag that allows users to specify a block time at which the unordered transactions should expire from the mempool.

View File

@ -50,8 +50,9 @@ const (
)
var (
_ Keyring = &keystore{}
maxPassphraseEntryAttempts = 3
_ Keyring = &keystore{}
_ KeyringWithDB = &keystore{}
maxPassphraseEntryAttempts = 3
)
// Keyring exposes operations over a backend supported by github.com/99designs/keyring.
@ -104,6 +105,13 @@ type Keyring interface {
Migrator
}
type KeyringWithDB interface {
Keyring
// Get the db keyring used in the keystore.
DB() keyring.Keyring
}
// Signer is implemented by key stores that want to provide signing capabilities.
type Signer interface {
// Sign sign byte messages with a user key.
@ -258,6 +266,11 @@ func (ks keystore) ExportPubKeyArmor(uid string) (string, error) {
return crypto.ArmorPubKeyBytes(bz, key.Type()), nil
}
// DB returns the db keyring used in the keystore
func (ks keystore) DB() keyring.Keyring {
return ks.db
}
func (ks keystore) ExportPubKeyArmorByAddress(address sdk.Address) (string, error) {
k, err := ks.KeyByAddress(address)
if err != nil {