Skip to content

Commit

Permalink
fix: remove forced simulateContract on write
Browse files Browse the repository at this point in the history
  • Loading branch information
kinrezC committed Dec 9, 2024
1 parent a004185 commit 7f92d69
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/witty-glasses-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@delvtech/drift-viem": minor
---

Remove forced `simulateContract` from viem adapter `write`
11 changes: 2 additions & 9 deletions packages/drift-viem/src/ViemReadWriteAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,9 @@ export class ViemReadWriteAdapter<
TAbi extends Abi,
TFunctionName extends FunctionName<TAbi, "nonpayable" | "payable">,
>(params: AdapterWriteParams<TAbi, TFunctionName>) {
const viemParams = createSimulateContractParameters(
Object.assign({}, params, {
from: params.from || (await this.getSignerAddress()),
}),
const writePromise = this.walletClient.writeContract(
params
);
const writePromise = this.publicClient
.simulateContract(viemParams)
.then(({ request }) =>
this.walletClient.writeContract(request as WriteContractParameters),
);

if (params.onMined) {
writePromise.then((hash) => {
Expand Down

0 comments on commit 7f92d69

Please sign in to comment.