Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -187,6 +187,10 @@ export const testDepositContract = async ({

const validatorData = generateValidatorData()

const initialAccountBalance = await publicClient.getBalance({
address: account.address,
})

const depositTx = await walletClient.deposit({
address: deployedContractAddress,
nodePubkey: validatorData.nodePubkey,
Expand All @@ -206,6 +210,21 @@ export const testDepositContract = async ({

expect(depositReceipt.logs.length).toBeGreaterThan(0)

const finalAccountBalance = await publicClient.getBalance({
address: account.address,
})

const contractBalance = await publicClient.getBalance({
address: deployedContractAddress,
})

const balanceDifference = initialAccountBalance - finalAccountBalance
const expectedDeposit = parseEther(VALIDATOR_MINIMUM_STAKE.toString())

expect(contractBalance).toBe(expectedDeposit)

expect(balanceDifference).toBeGreaterThanOrEqual(expectedDeposit)

const newDepositCount = await publicClient.getDepositCount({
address: deployedContractAddress,
})
Expand All @@ -226,5 +245,8 @@ export const testDepositContract = async ({
newDepositCount,
newDepositRoot,
validatorData,
initialAccountBalance,
finalAccountBalance,
contractBalance,
}
}
2 changes: 1 addition & 1 deletion packages/seismic-viem/src/actions/depositContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const depositContractWalletActions = <
client: WalletClient<TTransport, TChain, TAccount>
): DepositContractWalletActions => ({
deposit: async (args) =>
writeContract(client, {
client.writeContract({
Copy link

Choose a reason for hiding this comment

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

Bug: Deposit now uses shielded instead of transparent transactions

The change from writeContract(client, {...}) to client.writeContract({...}) alters transaction behavior. The standalone writeContract from viem/actions sends standard (unencrypted) transactions. However, due to the client extension order in client.ts, client.writeContract is the shielded version (from shieldedWalletActions) that encrypts calldata. This means deposits now use encrypted transactions instead of transparent ones, which may not be intended for this deposit contract functionality. The transparent version is available as twriteContract.

Fix in Cursor Fix in Web

abi: depositContractAbi,
address: args.address || DEPOSIT_CONTRACT_ADDRESS,
functionName: 'deposit',
Expand Down
Loading