Adapt 'ledger_app_clients'
- Add 'send_raw' function - Add error code 'EXCEPTION_OVERFLOW'
This commit is contained in:
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.4.1] - 2024-04-05
|
||||
|
||||
### Added
|
||||
|
||||
- Add new function `send_raw`, allowing to send a raw payload APDU
|
||||
- Add new error code definition
|
||||
|
||||
## [0.4.0] - 2024-04-03
|
||||
|
||||
### Added
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
try:
|
||||
from ledger_app_clients.ethereum.__version__ import __version__ # noqa
|
||||
from __version__ import __version__ # noqa
|
||||
except ImportError:
|
||||
__version__ = "unknown version" # noqa
|
||||
|
||||
@@ -21,6 +21,7 @@ class StatusWord(IntEnum):
|
||||
INVALID_P1_P2 = 0x6b00
|
||||
CONDITION_NOT_SATISFIED = 0x6985
|
||||
REF_DATA_NOT_FOUND = 0x6a88
|
||||
EXCEPTION_OVERFLOW = 0x6807
|
||||
|
||||
|
||||
class DomainNameTag(IntEnum):
|
||||
@@ -49,6 +50,15 @@ class EthAppClient:
|
||||
def response(self) -> Optional[RAPDU]:
|
||||
return self._client.last_async_response
|
||||
|
||||
def send_raw(self, cla: int, ins: int, p1: int, p2: int, payload: bytes):
|
||||
header = bytearray()
|
||||
header.append(cla)
|
||||
header.append(ins)
|
||||
header.append(p1)
|
||||
header.append(p2)
|
||||
header.append(len(payload))
|
||||
return self._exchange(header + payload)
|
||||
|
||||
def eip712_send_struct_def_struct_name(self, name: str):
|
||||
return self._exchange_async(self._cmd_builder.eip712_send_struct_def_struct_name(name))
|
||||
|
||||
@@ -131,6 +141,12 @@ class EthAppClient:
|
||||
bip32_path,
|
||||
chain_id))
|
||||
|
||||
def get_eth2_public_addr(self,
|
||||
display: bool = True,
|
||||
bip32_path: str = "m/12381/3600/0/0"):
|
||||
return self._exchange_async(self._cmd_builder.get_eth2_public_addr(display,
|
||||
bip32_path))
|
||||
|
||||
def provide_domain_name(self, challenge: int, name: str, addr: bytes) -> RAPDU:
|
||||
payload = format_tlv(DomainNameTag.STRUCTURE_TYPE, 3) # TrustedDomainName
|
||||
payload += format_tlv(DomainNameTag.STRUCTURE_VERSION, 1)
|
||||
|
||||
@@ -11,6 +11,7 @@ from .eip712 import EIP712FieldType
|
||||
|
||||
class InsType(IntEnum):
|
||||
GET_PUBLIC_ADDR = 0x02
|
||||
GET_ETH2_PUBLIC_ADDR = 0x0e
|
||||
SIGN = 0x04
|
||||
PERSONAL_SIGN = 0x08
|
||||
PROVIDE_ERC20_TOKEN_INFORMATION = 0x0a
|
||||
@@ -250,6 +251,15 @@ class CommandBuilder:
|
||||
int(chaincode),
|
||||
payload)
|
||||
|
||||
def get_eth2_public_addr(self,
|
||||
display: bool,
|
||||
bip32_path: str) -> bytes:
|
||||
payload = pack_derivation_path(bip32_path)
|
||||
return self._serialize(InsType.GET_ETH2_PUBLIC_ADDR,
|
||||
int(display),
|
||||
0x00,
|
||||
payload)
|
||||
|
||||
def set_plugin(self,
|
||||
type_: int,
|
||||
version: int,
|
||||
|
||||
@@ -6,8 +6,8 @@ import sys
|
||||
import copy
|
||||
from typing import Any, Callable, Optional
|
||||
|
||||
from ledger_app_clients.ethereum import keychain
|
||||
from ledger_app_clients.ethereum.client import EthAppClient, EIP712FieldType
|
||||
from client import keychain
|
||||
from client.client import EthAppClient, EIP712FieldType
|
||||
|
||||
|
||||
# global variables
|
||||
|
||||
Reference in New Issue
Block a user