Skip to content

Commit

Permalink
Set type 0 for legacy transaction (#1111)
Browse files Browse the repository at this point in the history
  • Loading branch information
onghwan authored Dec 13, 2023
1 parent 09cd8b3 commit 01483f3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/core-mobile/app/screens/rpc/util/txToCustomEvmTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export async function txToCustomEvmTx(
from: string
to: string
value: BigNumberish | undefined
maxFeePerGas: bigint
gasPrice: bigint
}> {
if (!txParams) {
throw new Error('params is malformed')
Expand All @@ -31,7 +31,7 @@ export async function txToCustomEvmTx(
const gasLimit = Number(gas)

return {
maxFeePerGas: sureGasPrice,
gasPrice: sureGasPrice,
gasLimit: gasLimit,
to,
from,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,13 @@ export default class SeedlessWallet implements Wallet {
{ provider }
)

// seedless signer expects maxFeePerGas instead of gasPrice for EVM transactions
const nomalizedTx = { ...transaction }
if (transaction.gasPrice && !transaction.maxFeePerGas) {
nomalizedTx.maxFeePerGas = transaction.gasPrice
// set type 0 to indicate legacy transaction, since mobile doesn't support EIP-1559 yet
const legacyTx = {
...transaction,
type: 0
}

return signer.signTransaction(nomalizedTx)
return signer.signTransaction(legacyTx)
}

public async getPublicKey(): Promise<PubKeyType> {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-mobile/app/services/send/SendServiceEVM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class SendServiceEVM implements SendServiceHelper {
...unsignedTx,
chainId,
gasLimit,
maxFeePerGas: sendState.gasPrice,
gasPrice: sendState.gasPrice,
nonce
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ describe('eth_sendTransaction handler', () => {
chainId: mockNetwork.chainId,
data: '0x10000',
gasLimit: 256,
maxFeePerGas: BigInt(testData.txParams.gasPrice),
gasPrice: BigInt(testData.txParams.gasPrice),
to: testData.txParams.to,
value: testData.txParams.value
},
Expand Down Expand Up @@ -313,7 +313,7 @@ describe('eth_sendTransaction handler', () => {
chainId: mockNetwork.chainId,
data: '0x10000',
gasLimit: 256,
maxFeePerGas: BigInt(testData.txParams.gasPrice),
gasPrice: BigInt(testData.txParams.gasPrice),
to: testData.txParams.to,
value: testData.txParams.value
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class EthSendTransactionHandler
{
nonce,
chainId: network.chainId,
maxFeePerGas: evmParams.maxFeePerGas,
gasPrice: evmParams.gasPrice,
gasLimit: evmParams.gasLimit,
data: evmParams.data,
to: params.to,
Expand Down

0 comments on commit 01483f3

Please sign in to comment.