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

not asserting withdrawals to be strictly local + tagged cbor sets #3781

Merged
merged 7 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,37 @@ function formatLedgerWithdrawals(
for (const [rewardAddress, withdrawalAmount] of iterateLenGetMap(withdrawals).nonNullValue()) {
const rewardAddressPayload = rewardAddress.to_address().to_hex();
const addressing = addressingMap(rewardAddressPayload);
if (addressing == null) {
throw new Error(`${nameof(formatLedgerWithdrawals)} Ledger can only withdraw from own address ${rewardAddressPayload}`);
let stakeCredential;
if (addressing != null) {
stakeCredential = {
type: CredentialParamsType.KEY_PATH,
keyPath: addressing.path,
};
} else {
const cred = rewardAddress.payment_cred();
const maybeKeyHash = cred.to_keyhash();
const maybeScriptHash = cred.to_scripthash();
if (maybeKeyHash) {
stakeCredential = {
type: CredentialParamsType.KEY_HASH,
keyHashHex: maybeKeyHash.to_hex(),
};
} else if (maybeScriptHash) {
stakeCredential = {
type: CredentialParamsType.SCRIPT_HASH,
keyHashHex: maybeScriptHash.to_hex(),
};
}
}
if (stakeCredential == null) {
throw new Error('Failed to resolve credential type for reward address: ' + rewardAddressPayload);
}
result.push({
amount: withdrawalAmount.to_str(),
stakeCredential: {
type: CredentialParamsType.KEY_PATH,
keyPath: addressing.path,
},
stakeCredential,
});
}
// $FlowIgnore[incompatible-return]
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,8 @@ export default class ConnectorStore extends Store<StoresMap, ActionsMap> {
s => ownAddressMap[s],
addressedUtxos,
);
} catch {
} catch (e) {
console.error('toTrezorSignRequest failed: ', e);
runInAction(() => {
this.hwWalletError = unsupportedTransactionError;
this.isHwWalletErrorRecoverable = false;
Expand Down
Loading