fixed from earlier merge

This commit is contained in:
jonesmarvin8 2026-04-28 16:32:42 -04:00
parent 30b96b1aaf
commit 269a1df390
4 changed files with 28 additions and 39 deletions

18
Cargo.lock generated
View File

@ -629,9 +629,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
[[package]]
name = "astral-tokio-tar"
version = "0.6.0"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c23f3af104b40a3430ccb90ed5f7bd877a8dc5c26fc92fde51a22b40890dcf9"
checksum = "4ce73b17c62717c4b6a9af10b43e87c578b0cac27e00666d48304d3b7d2c0693"
dependencies = [
"filetime",
"futures-core",
@ -1959,7 +1959,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ab67060fc6b8ef687992d439ca0fa36e7ed17e9a0b16b25b601e8757df720de"
dependencies = [
"data-encoding",
"syn 2.0.117",
"syn 1.0.109",
]
[[package]]
@ -2108,7 +2108,7 @@ dependencies = [
"libc",
"option-ext",
"redox_users",
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
@ -2409,7 +2409,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@ -5415,7 +5415,7 @@ version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
@ -7164,7 +7164,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@ -8103,7 +8103,7 @@ dependencies = [
"getrandom 0.4.2",
"once_cell",
"rustix",
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@ -9394,7 +9394,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]

View File

@ -1100,7 +1100,7 @@ async fn token_claiming_path_with_private_accounts() -> Result<()> {
else {
anyhow::bail!("Expected RegisterAccount return value");
};
// Create supply account (private)
let result = wallet::cli::execute_subcommand(
ctx.wallet_mut(),

View File

@ -1,24 +0,0 @@
import keycard_wallet as keycard_wallet
import time # For testing
pin = '111111'
path0 = "m/44'/60'/0'/0/0"
path1 = "m/44'/61'/0'/0/0"
path2 = "m/44'/62'/0'/0/0"
path3 = "m/44'/63'/0'/0/0"
path4 = "m/44'/64'/0'/0/0"
my_wallet = keycard_wallet.KeycardWallet()
print("Setup communication with card...", my_wallet.setup_communication(pin))
print("Load mnemonic...", my_wallet.load_mnemonic())
print("Public key", my_wallet.get_public_key_for_path(path0))
print("Public key", my_wallet.get_public_key_for_path(path1))
print("Public key", my_wallet.get_public_key_for_path(path2))
print("Public key", my_wallet.get_public_key_for_path(path3))
print("Public key", my_wallet.get_public_key_for_path(path4))
print("Signature", my_wallet.sign_message_for_path())
print("Disconnection", my_wallet.disconnect())

View File

@ -32,8 +32,6 @@ impl NativeTokenTransfer<'_> {
let account_ids = vec![from, to];
let program_id = Program::authenticated_transfer_program().id();
let sign_ids = self.0.filter_owned_accounts(&[from, to]);
// Fetch nonces for both accounts unconditionally
let nonces = self
.0
@ -43,9 +41,24 @@ impl NativeTokenTransfer<'_> {
let message = Message::try_new(program_id, account_ids, nonces, balance_to_move).unwrap();
// Assumes this now silently skips accounts without signing keys
let witness_set = WalletCore::sign_public_message(self.0, &message, &sign_ids)
.expect("`WalletCore::sign_public_message() failed to produce a signature for a NativeTokenTransfer.");
let witness_set = pin.as_ref().map_or_else(|| {
let sign_ids = self.0.filter_owned_accounts(&[from, to]);
WalletCore::sign_public_message(self.0, &message, &sign_ids)
.expect("`WalletCore::sign_public_message() failed to produce a signature for a NativeTokenTransfer.")
}, |pin| {
let key_path = key_path.as_ref().expect("`NativeTokenTransfer::send_public_transfer() expected a String for `key_path`.");
let pub_key = KeycardWallet::get_public_key_for_path_with_connect(
pin,
key_path,
);
let signature = KeycardWallet::sign_message_for_path_with_connect(
pin,
key_path,
&message.hash_message(),
)
.expect("`NativeTokenTransfer::send_public_transfer() failed to produce a Signature for the given `pin` and `key_path`.");
WitnessSet::from_list(&[signature], &[pub_key])
});
let tx = PublicTransaction::new(message, witness_set);