parent
50861eb019
commit
ec4a607dbe
@ -0,0 +1,24 @@
|
||||
syntax = "proto2";
|
||||
package hw.trezor.messages.solana;
|
||||
|
||||
import "messages-common.proto";
|
||||
|
||||
/**
|
||||
* Request: Ask device for public key corresponding to address_n path
|
||||
* @start
|
||||
* @next SolanaPublicKey
|
||||
* @next Failure
|
||||
*/
|
||||
message SolanaGetPublicKey {
|
||||
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
||||
optional bool show_display = 2; // optionally show on display before sending the result
|
||||
}
|
||||
|
||||
/**
|
||||
* Response: Contains public key derived from device private seed
|
||||
* @end
|
||||
*/
|
||||
message SolanaPublicKey {
|
||||
required bytes public_key = 1;
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
{
|
||||
"setup": {
|
||||
"mnemonic": "all all all all all all all all all all all all",
|
||||
"passphrase": ""
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"parameters": {
|
||||
"path": "m/44'/501'"
|
||||
},
|
||||
"result": {
|
||||
"expected_public_key": "0ebf3b4a5e8efc65c508f1c813377a650f655814db3b23472bdcde5f2aeaa7a3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"path": "m/44'/501'/0'"
|
||||
},
|
||||
"result": {
|
||||
"expected_public_key": "3398f0abc4f8ec2f62435a78d8f4f3219b47b04f268798d2ed2260da0b4de45f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"path": "m/44'/501'/0'/0'"
|
||||
},
|
||||
"result": {
|
||||
"expected_public_key": "00d1699dcb1811b50bb0055f13044463128242e37a463b52f6c97a1f6eef88ad"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
CURVE = "ed25519"
|
||||
SLIP44_ID = 501
|
||||
PATTERNS = (
|
||||
"m/44'/coin_type'", # Ledger compatibility
|
||||
"m/44'/coin_type'/account'", # Ledger compatibility
|
||||
"m/44'/coin_type'/account'/address_index'",
|
||||
)
|
@ -0,0 +1,36 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from trezor.crypto import base58
|
||||
|
||||
from apps.common import seed
|
||||
from apps.common.keychain import with_slip44_keychain
|
||||
|
||||
from . import CURVE, PATTERNS, SLIP44_ID
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from trezor.messages import SolanaGetPublicKey, SolanaPublicKey
|
||||
|
||||
from apps.common.keychain import Keychain
|
||||
|
||||
|
||||
@with_slip44_keychain(*PATTERNS, slip44_id=SLIP44_ID, curve=CURVE)
|
||||
async def get_public_key(
|
||||
msg: SolanaGetPublicKey, keychain: Keychain
|
||||
) -> SolanaPublicKey:
|
||||
from trezor.messages import SolanaPublicKey
|
||||
from trezor.ui.layouts import show_pubkey
|
||||
|
||||
public_key = derive_public_key(keychain, msg.address_n)
|
||||
|
||||
if msg.show_display:
|
||||
from apps.common.paths import address_n_to_str
|
||||
|
||||
path = address_n_to_str(msg.address_n)
|
||||
await show_pubkey(base58.encode(public_key), path=path)
|
||||
|
||||
return SolanaPublicKey(public_key=public_key)
|
||||
|
||||
|
||||
def derive_public_key(keychain: Keychain, address_n: list[int]) -> bytes:
|
||||
node = keychain.derive(address_n)
|
||||
return seed.remove_ed25519_prefix(node.public_key())
|
@ -0,0 +1,31 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import click
|
||||
|
||||
from .. import messages, solana, tools
|
||||
from . import with_client
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..client import TrezorClient
|
||||
|
||||
PATH_HELP = "BIP-32 path to key, e.g. m/44h/501h/0h/0h"
|
||||
DEFAULT_PATH = "m/44h/501h/0h/0h"
|
||||
|
||||
|
||||
@click.group(name="solana")
|
||||
def cli() -> None:
|
||||
"""Solana commands."""
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option("-n", "--address", default=DEFAULT_PATH, help=PATH_HELP)
|
||||
@click.option("-d", "--show-display", is_flag=True)
|
||||
@with_client
|
||||
def get_public_key(
|
||||
client: "TrezorClient",
|
||||
address: str,
|
||||
show_display: bool,
|
||||
) -> messages.SolanaPublicKey:
|
||||
"""Get Solana public key."""
|
||||
address_n = tools.parse_path(address)
|
||||
return solana.get_public_key(client, address_n, show_display)
|
@ -0,0 +1,19 @@
|
||||
from typing import TYPE_CHECKING, List
|
||||
|
||||
from . import messages
|
||||
from .tools import expect
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .client import TrezorClient
|
||||
from .protobuf import MessageType
|
||||
|
||||
|
||||
@expect(messages.SolanaPublicKey)
|
||||
def get_public_key(
|
||||
client: "TrezorClient",
|
||||
address_n: List[int],
|
||||
show_display: bool,
|
||||
) -> "MessageType":
|
||||
return client.call(
|
||||
messages.SolanaGetPublicKey(address_n=address_n, show_display=show_display)
|
||||
)
|
@ -0,0 +1,388 @@
|
||||
// This file is generated by rust-protobuf 3.3.0. Do not edit
|
||||
// .proto file is parsed by protoc 3.19.6
|
||||
// @generated
|
||||
|
||||
// https://github.com/rust-lang/rust-clippy/issues/702
|
||||
#![allow(unknown_lints)]
|
||||
#![allow(clippy::all)]
|
||||
|
||||
#![allow(unused_attributes)]
|
||||
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||
|
||||
#![allow(box_pointers)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(missing_docs)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(trivial_casts)]
|
||||
#![allow(unused_results)]
|
||||
#![allow(unused_mut)]
|
||||
|
||||
//! Generated file from `messages-solana.proto`
|
||||
|
||||
/// Generated files are compatible only with the same version
|
||||
/// of protobuf runtime.
|
||||
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0;
|
||||
|
||||
// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaGetPublicKey)
|
||||
#[derive(PartialEq,Clone,Default,Debug)]
|
||||
pub struct SolanaGetPublicKey {
|
||||
// message fields
|
||||
// @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaGetPublicKey.address_n)
|
||||
pub address_n: ::std::vec::Vec<u32>,
|
||||
// @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaGetPublicKey.show_display)
|
||||
pub show_display: ::std::option::Option<bool>,
|
||||
// special fields
|
||||
// @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaGetPublicKey.special_fields)
|
||||
pub special_fields: ::protobuf::SpecialFields,
|
||||
}
|
||||
|
||||
impl<'a> ::std::default::Default for &'a SolanaGetPublicKey {
|
||||
fn default() -> &'a SolanaGetPublicKey {
|
||||
<SolanaGetPublicKey as ::protobuf::Message>::default_instance()
|
||||
}
|
||||
}
|
||||
|
||||
impl SolanaGetPublicKey {
|
||||
pub fn new() -> SolanaGetPublicKey {
|
||||
::std::default::Default::default()
|
||||
}
|
||||
|
||||
// optional bool show_display = 2;
|
||||
|
||||
pub fn show_display(&self) -> bool {
|
||||
self.show_display.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn clear_show_display(&mut self) {
|
||||
self.show_display = ::std::option::Option::None;
|
||||
}
|
||||
|
||||
pub fn has_show_display(&self) -> bool {
|
||||
self.show_display.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_show_display(&mut self, v: bool) {
|
||||
self.show_display = ::std::option::Option::Some(v);
|
||||
}
|
||||
|
||||
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
|
||||
let mut fields = ::std::vec::Vec::with_capacity(2);
|
||||
let mut oneofs = ::std::vec::Vec::with_capacity(0);
|
||||
fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>(
|
||||
"address_n",
|
||||
|m: &SolanaGetPublicKey| { &m.address_n },
|
||||
|m: &mut SolanaGetPublicKey| { &mut m.address_n },
|
||||
));
|
||||
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
|
||||
"show_display",
|
||||
|m: &SolanaGetPublicKey| { &m.show_display },
|
||||
|m: &mut SolanaGetPublicKey| { &mut m.show_display },
|
||||
));
|
||||
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<SolanaGetPublicKey>(
|
||||
"SolanaGetPublicKey",
|
||||
fields,
|
||||
oneofs,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::Message for SolanaGetPublicKey {
|
||||
const NAME: &'static str = "SolanaGetPublicKey";
|
||||
|
||||
fn is_initialized(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> {
|
||||
while let Some(tag) = is.read_raw_tag_or_eof()? {
|
||||
match tag {
|
||||
10 => {
|
||||
is.read_repeated_packed_uint32_into(&mut self.address_n)?;
|
||||
},
|
||||
8 => {
|
||||
self.address_n.push(is.read_uint32()?);
|
||||
},
|
||||
16 => {
|
||||
self.show_display = ::std::option::Option::Some(is.read_bool()?);
|
||||
},
|
||||
tag => {
|
||||
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
|
||||
},
|
||||
};
|
||||
}
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
// Compute sizes of nested messages
|
||||
#[allow(unused_variables)]
|
||||
fn compute_size(&self) -> u64 {
|
||||
let mut my_size = 0;
|
||||
for value in &self.address_n {
|
||||
my_size += ::protobuf::rt::uint32_size(1, *value);
|
||||
};
|
||||
if let Some(v) = self.show_display {
|
||||
my_size += 1 + 1;
|
||||
}
|
||||
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
|
||||
self.special_fields.cached_size().set(my_size as u32);
|
||||
my_size
|
||||
}
|
||||
|
||||
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
|
||||
for v in &self.address_n {
|
||||
os.write_uint32(1, *v)?;
|
||||
};
|
||||
if let Some(v) = self.show_display {
|
||||
os.write_bool(2, v)?;
|
||||
}
|
||||
os.write_unknown_fields(self.special_fields.unknown_fields())?;
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
fn special_fields(&self) -> &::protobuf::SpecialFields {
|
||||
&self.special_fields
|
||||
}
|
||||
|
||||
fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields {
|
||||
&mut self.special_fields
|
||||
}
|
||||
|
||||
fn new() -> SolanaGetPublicKey {
|
||||
SolanaGetPublicKey::new()
|
||||
}
|
||||
|
||||
fn clear(&mut self) {
|
||||
self.address_n.clear();
|
||||
self.show_display = ::std::option::Option::None;
|
||||
self.special_fields.clear();
|
||||
}
|
||||
|
||||
fn default_instance() -> &'static SolanaGetPublicKey {
|
||||
static instance: SolanaGetPublicKey = SolanaGetPublicKey {
|
||||
address_n: ::std::vec::Vec::new(),
|
||||
show_display: ::std::option::Option::None,
|
||||
special_fields: ::protobuf::SpecialFields::new(),
|
||||
};
|
||||
&instance
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::MessageFull for SolanaGetPublicKey {
|
||||
fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
|
||||
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
|
||||
descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaGetPublicKey").unwrap()).clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::fmt::Display for SolanaGetPublicKey {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||
::protobuf::text_format::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::reflect::ProtobufValue for SolanaGetPublicKey {
|
||||
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(message:hw.trezor.messages.solana.SolanaPublicKey)
|
||||
#[derive(PartialEq,Clone,Default,Debug)]
|
||||
pub struct SolanaPublicKey {
|
||||
// message fields
|
||||
// @@protoc_insertion_point(field:hw.trezor.messages.solana.SolanaPublicKey.public_key)
|
||||
pub public_key: ::std::option::Option<::std::vec::Vec<u8>>,
|
||||
// special fields
|
||||
// @@protoc_insertion_point(special_field:hw.trezor.messages.solana.SolanaPublicKey.special_fields)
|
||||
pub special_fields: ::protobuf::SpecialFields,
|
||||
}
|
||||
|
||||
impl<'a> ::std::default::Default for &'a SolanaPublicKey {
|
||||
fn default() -> &'a SolanaPublicKey {
|
||||
<SolanaPublicKey as ::protobuf::Message>::default_instance()
|
||||
}
|
||||
}
|
||||
|
||||
impl SolanaPublicKey {
|
||||
pub fn new() -> SolanaPublicKey {
|
||||
::std::default::Default::default()
|
||||
}
|
||||
|
||||
// required bytes public_key = 1;
|
||||
|
||||
pub fn public_key(&self) -> &[u8] {
|
||||
match self.public_key.as_ref() {
|
||||
Some(v) => v,
|
||||
None => &[],
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clear_public_key(&mut self) {
|
||||
self.public_key = ::std::option::Option::None;
|
||||
}
|
||||
|
||||
pub fn has_public_key(&self) -> bool {
|
||||
self.public_key.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_public_key(&mut self, v: ::std::vec::Vec<u8>) {
|
||||
self.public_key = ::std::option::Option::Some(v);
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec<u8> {
|
||||
if self.public_key.is_none() {
|
||||
self.public_key = ::std::option::Option::Some(::std::vec::Vec::new());
|
||||
}
|
||||
self.public_key.as_mut().unwrap()
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_public_key(&mut self) -> ::std::vec::Vec<u8> {
|
||||
self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new())
|
||||
}
|
||||
|
||||
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
|
||||
let mut fields = ::std::vec::Vec::with_capacity(1);
|
||||
let mut oneofs = ::std::vec::Vec::with_capacity(0);
|
||||
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
|
||||
"public_key",
|
||||
|m: &SolanaPublicKey| { &m.public_key },
|
||||
|m: &mut SolanaPublicKey| { &mut m.public_key },
|
||||
));
|
||||
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<SolanaPublicKey>(
|
||||
"SolanaPublicKey",
|
||||
fields,
|
||||
oneofs,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::Message for SolanaPublicKey {
|
||||
const NAME: &'static str = "SolanaPublicKey";
|
||||
|
||||
fn is_initialized(&self) -> bool {
|
||||
if self.public_key.is_none() {
|
||||
return false;
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> {
|
||||
while let Some(tag) = is.read_raw_tag_or_eof()? {
|
||||
match tag {
|
||||
10 => {
|
||||
self.public_key = ::std::option::Option::Some(is.read_bytes()?);
|
||||
},
|
||||
tag => {
|
||||
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
|
||||
},
|
||||
};
|
||||
}
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
// Compute sizes of nested messages
|
||||
#[allow(unused_variables)]
|
||||
fn compute_size(&self) -> u64 {
|
||||
let mut my_size = 0;
|
||||
if let Some(v) = self.public_key.as_ref() {
|
||||
my_size += ::protobuf::rt::bytes_size(1, &v);
|
||||
}
|
||||
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
|
||||
self.special_fields.cached_size().set(my_size as u32);
|
||||
my_size
|
||||
}
|
||||
|
||||
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
|
||||
if let Some(v) = self.public_key.as_ref() {
|
||||
os.write_bytes(1, v)?;
|
||||
}
|
||||
os.write_unknown_fields(self.special_fields.unknown_fields())?;
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
fn special_fields(&self) -> &::protobuf::SpecialFields {
|
||||
&self.special_fields
|
||||
}
|
||||
|
||||
fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields {
|
||||
&mut self.special_fields
|
||||
}
|
||||
|
||||
fn new() -> SolanaPublicKey {
|
||||
SolanaPublicKey::new()
|
||||
}
|
||||
|
||||
fn clear(&mut self) {
|
||||
self.public_key = ::std::option::Option::None;
|
||||
self.special_fields.clear();
|
||||
}
|
||||
|
||||
fn default_instance() -> &'static SolanaPublicKey {
|
||||
static instance: SolanaPublicKey = SolanaPublicKey {
|
||||
public_key: ::std::option::Option::None,
|
||||
special_fields: ::protobuf::SpecialFields::new(),
|
||||
};
|
||||
&instance
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::MessageFull for SolanaPublicKey {
|
||||
fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
|
||||
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
|
||||
descriptor.get(|| file_descriptor().message_by_package_relative_name("SolanaPublicKey").unwrap()).clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::fmt::Display for SolanaPublicKey {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||
::protobuf::text_format::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::reflect::ProtobufValue for SolanaPublicKey {
|
||||
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
|
||||
}
|
||||
|
||||
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||
\n\x15messages-solana.proto\x12\x19hw.trezor.messages.solana\x1a\x15mess\
|
||||
ages-common.proto\"T\n\x12SolanaGetPublicKey\x12\x1b\n\taddress_n\x18\
|
||||
\x01\x20\x03(\rR\x08addressN\x12!\n\x0cshow_display\x18\x02\x20\x01(\x08\
|
||||
R\x0bshowDisplay\"0\n\x0fSolanaPublicKey\x12\x1d\n\npublic_key\x18\x01\
|
||||
\x20\x02(\x0cR\tpublicKey\
|
||||
";
|
||||
|
||||
/// `FileDescriptorProto` object which was a source for this generated file
|
||||
fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
|
||||
static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new();
|
||||
file_descriptor_proto_lazy.get(|| {
|
||||
::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap()
|
||||
})
|
||||
}
|
||||
|
||||
/// `FileDescriptor` object which allows dynamic access to files
|
||||
pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
|
||||
static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new();
|
||||
static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new();
|
||||
file_descriptor.get(|| {
|
||||
let generated_file_descriptor = generated_file_descriptor_lazy.get(|| {
|
||||
let mut deps = ::std::vec::Vec::with_capacity(1);
|
||||
deps.push(super::messages_common::file_descriptor().clone());
|
||||
let mut messages = ::std::vec::Vec::with_capacity(2);
|
||||
messages.push(SolanaGetPublicKey::generated_message_descriptor_data());
|
||||
messages.push(SolanaPublicKey::generated_message_descriptor_data());
|
||||
let mut enums = ::std::vec::Vec::with_capacity(0);
|
||||
::protobuf::reflect::GeneratedFileDescriptor::new_generated(
|
||||
file_descriptor_proto(),
|
||||
deps,
|
||||
messages,
|
||||
enums,
|
||||
)
|
||||
});
|
||||
::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor)
|
||||
})
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
# This file is part of the Trezor project.
|
||||
#
|
||||
# Copyright (C) 2012-2023 SatoshiLabs and contributors
|
||||
#
|
||||
# This library is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License version 3
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the License along with this library.
|
||||
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
||||
|
||||
import pytest
|
||||
|
||||
from trezorlib.debuglink import TrezorClientDebugLink as Client
|
||||
from trezorlib.solana import get_public_key
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from ...common import parametrize_using_common_fixtures
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.altcoin,
|
||||
pytest.mark.solana,
|
||||
pytest.mark.skip_t1,
|
||||
]
|
||||
|
||||
|
||||
@parametrize_using_common_fixtures(
|
||||
"solana/get_public_key.json",
|
||||
)
|
||||
def test_solana_get_public_key(client: Client, parameters, result):
|
||||
actual_result = get_public_key(
|
||||
client, address_n=parse_path(parameters["path"]), show_display=True
|
||||
)
|
||||
|
||||
assert actual_result.public_key.hex() == result["expected_public_key"]
|
Loading…
Reference in new issue