Skip to content

Commit

Permalink
chore(tangle-dapp): Remove unnecessary args when sending tx
Browse files Browse the repository at this point in the history
  • Loading branch information
AtelyPham committed Jan 23, 2025
1 parent b27377d commit 6e480c7
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions apps/tangle-dapp/src/data/rewards/RewardsTx/evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ import {
} from 'viem';
import type { Config } from 'wagmi';
import {
simulateContract,
SimulateContractParameters,
waitForTransactionReceipt,
writeContract,
WriteContractParameters,
} from 'wagmi/actions';
import abi from './abi';
import RewardsTxBase from './base';
Expand Down Expand Up @@ -53,31 +52,13 @@ export default class EVMRewardsTx extends RewardsTxBase {
try {
eventHandlers?.onTxSending?.(context);

const connector = (() => {
if (this.provider.state.current === null) return;

return this.provider.state.connections.get(this.provider.state.current)
?.connector;
})();

const chainId = (() => {
if (this.provider.state.current === null) return;

return this.provider.state.connections.get(this.provider.state.current)
?.chainId;
})();

const { request } = await simulateContract(this.provider, {
const hash = await writeContract(this.provider, {
abi,
address,
functionName,
args,
account: this.activeAccount,
connector,
chainId,
} as SimulateContractParameters);

const hash = await writeContract(this.provider, request);
} as WriteContractParameters);

eventHandlers?.onTxInBlock?.(hash, zeroAddress, context);

Expand Down

0 comments on commit 6e480c7

Please sign in to comment.