Skip to content

Commit

Permalink
refactor: remove moot handling for local acc in sendTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
roberts-pumpurs committed Dec 28, 2023
1 parent 3e39fc3 commit eabedba
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions src/chains/zksync/actions/sendTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { AccountNotFoundError } from '../../../errors/account.js'
import { BaseError } from '../../../errors/base.js'
import { type Chain } from '../../../types/chain.js'
import type { Hash } from '../../../types/misc.js'
import type { TransactionSerializable } from '../../../types/transaction.js'
import { assertCurrentChain } from '../../../utils/chain/assertCurrentChain.js'
import {
type GetTransactionErrorParameters,
Expand Down Expand Up @@ -117,7 +116,7 @@ export async function sendTransaction<
if (!chainId)
chainId = await getAction(client, getChainId, 'getChainId')({})

// EIP712 sign will be done inside the sign transaction
// EIP712 sign will be done inside the signTransaction
const serializedTransaction = (await signTransaction(client, {
...request,
chainId,
Expand All @@ -132,33 +131,6 @@ export async function sendTransaction<
})
}

if (account.type === 'local') {
// Prepare the request for signing (assign appropriate fees, etc.)
const request = await getAction(
client,
prepareTransactionRequest,
'prepareTransactionRequest',
)({ ...argsIncoming, chainId } as any)

if (!chainId)
chainId = await getAction(client, getChainId, 'getChainId')({})

const serializer = args.chain?.serializers?.transaction
const serializedTransaction = (await account.signTransaction(
{
...request,
chainId,
} as TransactionSerializable,
{ serializer },
)) as Hash
return await getAction(
client,
sendRawTransaction,
'sendRawTransaction',
)({
serializedTransaction,
})
}
return sendTransactionOriginal(client, argsIncoming)
} catch (err) {
throw getTransactionError(err as BaseError, {
Expand Down

0 comments on commit eabedba

Please sign in to comment.