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

Execute send transaction from Viem client #222

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
7 changes: 6 additions & 1 deletion src/core/EVM/EVMStepExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
} from '@lifi/types'
import type { Client, Hash, SendTransactionParameters } from 'viem'
import { getAddresses, sendTransaction } from 'viem/actions'
import { getAction } from 'viem/utils'
import { config } from '../../config.js'
import { LiFiErrorCode } from '../../errors/constants.js'
import { TransactionError, ValidationError } from '../../errors/errors.js'
Expand Down Expand Up @@ -308,7 +309,11 @@ export class EVMStepExecutor extends BaseStepExecutor {
)
}
} else {
txHash = await sendTransaction(this.client, {
txHash = await getAction(
this.client,
sendTransaction,
'sendTransaction'
)({
to: transactionRequest.to,
account: this.client.account!,
data: transactionRequest.data,
Expand Down
7 changes: 6 additions & 1 deletion src/core/EVM/setAllowance.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Client, Hash, SendTransactionParameters } from 'viem'
import { encodeFunctionData } from 'viem'
import { sendTransaction } from 'viem/actions'
import { getAction } from 'viem/utils'
import { isNativeTokenAddress } from '../../utils/isZeroAddress.js'
import type { ExecutionOptions, TransactionParameters } from '../types.js'
import { approveAbi } from './abi.js'
Expand Down Expand Up @@ -48,7 +49,11 @@ export const setAllowance = async (
}
}

return sendTransaction(client, {
return getAction(
client,
sendTransaction,
'sendTransaction'
)({
to: transactionRequest.to,
account: client.account!,
data: transactionRequest.data,
Expand Down