Skip to content

Conversation

@ethankonk
Copy link
Contributor

@ethankonk ethankonk commented Nov 19, 2025

Summary & Motivation

  • Parallel flagged using signAndSendTransaction with legacy tx structures was ignoring their passed in gas fees, this was due to the way we were chopping the payload up to always try to fit it into a EIP-1559 tx.
  • Now added support for legacy tx

How I Tested These Changes

Did you add a changeset?

If updating one of our packages, you'll likely need to add a changeset to your PR. To do so, run pnpm changeset. pnpm changeset will generate a file where you should write a human friendly message about the changes. Note how this (example) includes the package name (should be auto added by the command) along with the type of semver change (major.minor.patch) (which you should set).

These changes will be used at release time to determine what packages to publish and how to bump their version. For more context see this comment.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 19, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 560338c:

Sandbox Source
@turnkey/example-react-components Configuration

"@turnkey/core": patch
---

Fixed legacy transaction usage in signAndSendTransaction, you can now pass in proper gas fees when using legacy tx
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add some more context on which specific path this affects -- to my understanding this specifically affects the pass-through external wallet signing flow, but not the Turnkey (embedded wallet) flow. Is this accurate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this should only affect connected wallets, will update!

...base,
gasPrice: toHex(tx.gasPrice),
};
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlikely that this happens, but I'd ideally like to add explicit checks for the known tx types: https://reth.rs/run/faq/transactions/

in other words, if it's not in the range of 0-4, we should error that it's an unknown type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, unfortunately there is a bunch to dig into here, mainly differences in how ethers and viem build their transaction objects and how we need to handle it in our sign function so me & Moe O decided its best to table this for now and figure it all out later so we're not blocking customers

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 - I need to dig into this more, but right now it doesn’t seem reasonable for us to reliably handle all cases when going from:
serializedTransaction -> Transaction object

versus the safer direction of:
Transaction object -> serializedTransaction

if (txType === 0 || txType === 1) {
// legacy or EIP-2930 (gasPrice-based)
if (tx.gasPrice == null) {
throw new Error("Legacy or EIP-2930 transaction missing gasPrice");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as an FYI -- while Turnkey supports legacy transactions, they still have to be EIP-155 compliant (https://eips.ethereum.org/EIPS/eip-155). But this only affects transactions signed using Turnkey/embedded wallets. I believe this codepath uses browser wallets, so shouldn't be a huge issue here

Copy link
Contributor

@moeodeh3 moeodeh3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WalletConnect constructs the transaction for EVM the same way (i.e has the same problem)

can we also copy over the logic there as well 🙏
wallet-connect/base.ts

/** @internal */
export type Wallet = EmbeddedWallet | ConnectedWallet;

export type BaseTransactionParams = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two things:

  1. these types are shared between Solana and Evm, so lets make sure we name it in a way we know this is used only for EVM
  2. lets avoid naming things "Base" since that conflicts with Base network

thinking to name it instead something like EvmTransactionParams

maxPriorityFeePerGas: `0x${string}`;
};

export type LegacyTransactionParams = BaseTransactionParams & {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing here, lets make sure to name this in an EVM specific way - so something like LegacyEvmTransactionParams

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or EvmLegacyTransactionParams

"@turnkey/core": patch
---

Fixed legacy transaction usage in signAndSendTransaction for **Connected wallets**. This does not affect Turnkey's embedded wallet flow, previously, connected wallet transactions were all formatted into EIP-1559 transactions, updated to respect legacy + future formats passed in.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Fixed legacy transactions not working in signAndSendTransaction() for Evm connected wallet"

@ethankonk ethankonk merged commit fae0c3d into main Nov 21, 2025
8 checks passed
@ethankonk ethankonk deleted the ethan/fix-gas-fees-for-legacy-tx branch November 21, 2025 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants