Skip to content
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
19 changes: 18 additions & 1 deletion common/protob/messages-management.proto
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ enum OneKeySEState {
APP = 0x01;
}

// enum PinKeyboardLayout {
// LAYOUT_NORMAL = 0;
// LAYOUT_RANDOMIZED = 1;
// }
/**
* Response: Reports various information about the device
* @end
Expand Down Expand Up @@ -144,6 +148,7 @@ message Features {
optional uint32 auto_lock_delay_ms = 38; // number of milliseconds after which the device locks itself
optional uint32 display_rotation = 39; // in degrees from North
optional bool experimental_features = 40; // are experimental message types enabled?
optional bool busy = 41; // is the device busy, showing "Do not disconnect"?

optional uint32 offset = 500;
optional string ble_name = 501; // OneKey BLE name
Expand All @@ -166,7 +171,12 @@ message Features {
optional uint32 coin_switch = 517;
optional bytes build_id = 518;
optional string boardloader_version = 519;
optional bool busy = 41; // is the device busy, showing "Do not disconnect"?
reserved 520, 521, 530, 531; // used by battery_level(520) product(521) se_build_id(530) se_hash(531) in another device type
optional uint32 brightness_percent = 522; // current brightness of device
optional bool haptic_feedback = 523; // is the vibration & haptic enabled
optional uint32 auto_shutdown_delay_ms = 524; // number of milliseconds after which the device will poweroff
// optional PinKeyboardLayout pin_keyboard_layout = 524; // the layout of the pin input keyboard
// optional bool usb_lock = 525; // the device will auto lock when usb plug/ununplug with usb lock enabled

optional OneKeyDeviceType onekey_device_type = 600;
optional OneKeySeType onekey_se_type = 601;
Expand Down Expand Up @@ -292,6 +302,13 @@ message ApplySettings {
optional bool passphrase_always_on_device = 8; // do not prompt for passphrase, enforce device entry
optional SafetyCheckLevel safety_checks = 9; // Safety check level, set to Prompt to limit path namespace enforcement
optional bool experimental_features = 10; // enable experimental message types

reserved 11 to 499;
optional uint32 auto_shutdown_delay_ms = 500;
optional bool change_brightness = 501;
optional bool haptic_feedback = 502;
// optional PinKeyboardLayout keybaord_layout = 503;
// optional bool usb_lock = 504;
}

/**
Expand Down
16 changes: 16 additions & 0 deletions common/protob/messages-solana.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ message SolanaAddress {
required string address = 1; // Address in Solana format (base58 of a pubkey)
}

/**
* @embed
*/
message SolanaTxATADetails {
required string owner_address = 1;
required string program_id = 2;
required string mint_address = 3;
required string associated_token_address = 4;
}
/**
* @embed
*/
message SolanaTxExtraInfo {
repeated SolanaTxATADetails ata_details = 1;
}
/**
* Request: ask device to sign Solana transaction
* @start
Expand All @@ -46,6 +61,7 @@ message SolanaAddress {
message SolanaSignTx {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
required bytes raw_tx = 2; // serialized raw transaction
optional SolanaTxExtraInfo extra_info = 3; // extra information for the transaction
}

/**
Expand Down
2 changes: 2 additions & 0 deletions core/src/all_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,8 @@
import apps.solana.spl.spl_token_program
apps.solana.spl.spl_tokens
import apps.solana.spl.spl_tokens
apps.solana.spl.token_account
import apps.solana.spl.token_account
apps.solana.stake.program
import apps.solana.stake.program
apps.solana.system._layouts
Expand Down
10 changes: 8 additions & 2 deletions core/src/apps/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def busy_expiry_ms() -> int:


def get_features() -> Features:
import storage.recovery
# import storage.recovery
import storage.sd_salt
import storage # workaround for https://github.com/microsoft/pyright/issues/2685

Expand All @@ -87,6 +87,7 @@ def get_features() -> Features:
from trezor.messages import Features
from trezor import uart
from apps.common import mnemonic, safety_checks
from trezor.ui import style

storage_serial_no = storage.device.get_serial()
serial_no = storage_serial_no
Expand Down Expand Up @@ -125,6 +126,12 @@ def get_features() -> Features:
onekey_serial_no=storage_serial_no,
onekey_ble_name=uart.get_ble_name(),
onekey_ble_version=uart.get_ble_version(),
haptic_feedback=storage.device.haptic_enabled(),
auto_lock_delay_ms=storage.device.get_autolock_delay_ms(),
auto_shutdown_delay_ms=storage.device.get_autoshutdown_delay_ms(),
brightness_percent=int(
storage.device.get_brightness() / style.BACKLIGHT_MAX * 100
),
)

if utils.BITCOIN_ONLY:
Expand Down Expand Up @@ -188,7 +195,6 @@ def get_features() -> Features:
f.wipe_code_protection = config.has_wipe_code()
f.passphrase_always_on_device = storage.device.get_passphrase_always_on_device()
f.safety_checks = safety_checks.read_setting()
f.auto_lock_delay_ms = storage.device.get_autolock_delay_ms()
f.display_rotation = storage.device.get_rotation()
f.experimental_features = storage.device.get_experimental_features()

Expand Down
3 changes: 2 additions & 1 deletion core/src/apps/bitcoin/get_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ async def get_address(
ctx,
keychain,
msg.address_n,
not msg.multisig,
validate_path_against_script_type(coin, msg),
)

node = keychain.derive(msg.address_n)
node = keychain.derive(msg.address_n, force_strict=not msg.multisig)

address = addresses.get_address(msg.script_type, coin, node, msg.multisig)
address_short = addresses.address_short(coin, address)
Expand Down
18 changes: 11 additions & 7 deletions core/src/apps/bitcoin/sign_tx/bitcoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ async def step1_process_inputs(self) -> None:
writers.write_tx_input_check(h_presigned_inputs_check, txi)
await self.process_external_input(txi)
else:
node = self.keychain.derive(txi.address_n)
node = self.keychain.derive(
txi.address_n, force_strict=not txi.multisig
)
await self.process_internal_input(txi, node)

script_pubkey = self.input_derive_script(txi, node)
Expand Down Expand Up @@ -585,7 +587,7 @@ async def serialize_segwit_input(self, i: int) -> None:
self.tx_info.check_input(txi)

if txi.script_type == InputScriptType.SPENDP2SHWITNESS:
node = self.keychain.derive(txi.address_n)
node = self.keychain.derive(txi.address_n, force_strict=not txi.multisig)
key_sign_pub = node.public_key()
else:
# Native SegWit has an empty scriptSig. Public key is not needed.
Expand All @@ -599,7 +601,7 @@ def sign_bip143_input(self, i: int, txi: TxInput) -> tuple[bytes, bytes]:
# script type than the one that was provided during the confirmation phase.
raise wire.ProcessError("Transaction has changed during signing")

node = self.keychain.derive(txi.address_n)
node = self.keychain.derive(txi.address_n, force_strict=not txi.multisig)
public_key = node.public_key()

if txi.multisig:
Expand Down Expand Up @@ -629,7 +631,7 @@ def sign_taproot_input(self, i: int, txi: TxInput) -> bytes:
self.get_sighash_type(txi),
)

node = self.keychain.derive(txi.address_n)
node = self.keychain.derive(txi.address_n, not txi.multisig)
return bip340_sign(node, sigmsg_digest)

async def sign_segwit_input(self, i: int) -> None:
Expand Down Expand Up @@ -699,7 +701,9 @@ async def get_legacy_tx_digest(
txi_sign = txi
if not script_pubkey:
self.tx_info.check_input(txi)
node = self.keychain.derive(txi.address_n)
node = self.keychain.derive(
txi.address_n, force_strict=not txi.multisig
)
key_sign_pub = node.public_key()
if txi.multisig:
# Sanity check to ensure we are signing with a key that is included in the multisig.
Expand Down Expand Up @@ -917,7 +921,7 @@ def input_derive_script(
return txi.script_pubkey

if node is None:
node = self.keychain.derive(txi.address_n)
node = self.keychain.derive(txi.address_n, force_strict=not txi.multisig)

address = addresses.get_address(txi.script_type, self.coin, node, txi.multisig)
return scripts.output_derive_script(address, self.coin)
Expand All @@ -935,7 +939,7 @@ def output_derive_script(self, txo: TxOutput) -> bytes:
]
except KeyError:
raise wire.DataError("Invalid script type")
node = self.keychain.derive(txo.address_n)
node = self.keychain.derive(txo.address_n, force_strict=not txo.multisig)
txo.address = addresses.get_address(
input_script_type, self.coin, node, txo.multisig
)
Expand Down
8 changes: 8 additions & 0 deletions core/src/apps/ethereum/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1860,3 +1860,11 @@ def _networks_iterator() -> Iterator[NetworkInfoTuple]:
"evm-dtt.png", # icon
0x1A2A5F, # primary_color
)
yield (
1672, # chain_id
1672, # slip44
"PROS", # symbol
"Pharos", # name
"evm-pros.png", # icon
0x00FF33, # primary_color
)
8 changes: 8 additions & 0 deletions core/src/apps/ethereum/networks.py.mako
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,11 @@ def _networks_iterator() -> Iterator[NetworkInfoTuple]:
"evm-dtt.png", # icon
0x1A2A5F, # primary_color
)
yield (
1672, # chain_id
1672, # slip44
"PROS", # symbol
"Pharos", # name
"evm-pros.png", # icon
0x00FF33, # primary_color
)
Loading
Loading