Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add KeyFile associated type to SigningKeyPair trait #3568

Merged
merged 1 commit into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/relayer/src/keyring/ed25519_key_pair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ impl Ed25519KeyPair {

impl SigningKeyPair for Ed25519KeyPair {
const KEY_TYPE: KeyType = KeyType::Ed25519;
type KeyFile = KeyFile;

fn from_key_file(key_file: KeyFile, hd_path: &StandardHDPath) -> Result<Self, Error> {
use ed25519_dalek::PUBLIC_KEY_LENGTH;
Expand Down
1 change: 1 addition & 0 deletions crates/relayer/src/keyring/secp256k1_key_pair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ impl Secp256k1KeyPair {

impl SigningKeyPair for Secp256k1KeyPair {
const KEY_TYPE: KeyType = KeyType::Secp256k1;
type KeyFile = KeyFile;

fn from_key_file(key_file: KeyFile, hd_path: &StandardHDPath) -> Result<Self, Error> {
// Decode the Bech32-encoded address from the key file
Expand Down
5 changes: 3 additions & 2 deletions crates/relayer/src/keyring/signing_key_pair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ use core::any::Any;
use hdpath::StandardHDPath;
use serde::{de::DeserializeOwned, Serialize};

use super::{errors::Error, KeyFile, KeyType};
use super::{errors::Error, KeyType};
use crate::config::AddressType;

pub trait SigningKeyPair {
const KEY_TYPE: KeyType;
type KeyFile: DeserializeOwned;

fn from_key_file(key_file: KeyFile, hd_path: &StandardHDPath) -> Result<Self, Error>
fn from_key_file(key_file: Self::KeyFile, hd_path: &StandardHDPath) -> Result<Self, Error>
where
Self: Sized;

Expand Down
Loading