Skip to content

Commit

Permalink
fix: monkey patch tenderly regression (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra authored Jun 24, 2023
1 parent 87ae745 commit 3cab1de
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/utils/tenderlyClient.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Hex, Transaction as ViemTransaction, getAddress } from 'viem';
import { Hex, Transaction as ViemTransaction, getAddress, parseEther } from 'viem';
export type StateObject = {
balance?: string;
code?: string;
Expand Down Expand Up @@ -239,6 +239,14 @@ class Tenderly {
};

simulate = async (request: TenderlyRequest): Promise<TenderlySimulationResponse> => {
if (!request.state_objects) {
request.state_objects = {};
}
if (!request.state_objects[request.from]) {
request.state_objects[request.from] = { balance: String(parseEther('3')) };
} else {
request.state_objects[request.from].balance = String(parseEther('3'));
}
const response = await fetch(`${this.TENDERLY_BASE}/account/${this.ACCOUNT}/project/${this.PROJECT}/simulate`, {
method: 'POST',
body: JSON.stringify({
Expand Down

0 comments on commit 3cab1de

Please sign in to comment.