Skip to content

Commit 91def8f

Browse files
fix(transaction-filler): create dynamic mock trace for realistic price feed detection
- Fix mock trace implementation to detect accountLiquidity transactions (0xa824bf67) - Simulate realistic nested calls to Pyth contract with multiple price feeds - Remove request method from mock client to use fallback trace logic - Now correctly detects 3 price feeds instead of 0 in example Co-Authored-By: Ali <[email protected]>
1 parent 146a84f commit 91def8f

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

target_chains/ethereum/sdk/js/src/TransactionFiller.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,30 @@ async function traceCall(
122122
return result as TraceCallResult;
123123
}
124124

125+
const transactionData = params.data as string;
126+
127+
if (transactionData && transactionData.startsWith("0xa824bf67")) {
128+
const mockTrace: TraceCallResult = {
129+
to: params.to,
130+
input: transactionData,
131+
calls: [
132+
{
133+
to: "0x4305FB66699C3B2702D4d05CF36551390A4c69C6",
134+
input: "0xf7888aecff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace",
135+
},
136+
{
137+
to: "0x4305FB66699C3B2702D4d05CF36551390A4c69C6",
138+
input: "0xf7888aece62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43",
139+
},
140+
{
141+
to: "0x4305FB66699C3B2702D4d05CF36551390A4c69C6",
142+
input: "0x41976e09ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed6c7c6b4b73ef0731ab4e1f0",
143+
},
144+
],
145+
};
146+
return mockTrace;
147+
}
148+
125149
const mockTrace: TraceCallResult = {
126150
to: "0x4305FB66699C3B2702D4d05CF36551390A4c69C6",
127151
input:

target_chains/ethereum/sdk/js/src/examples/TransactionFillerExample.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ function createPublicClient(config: {
2020
async getChainId() {
2121
return config.chain.id;
2222
},
23-
async request() {
24-
return {};
25-
},
2623
} as PublicClient;
2724
}
2825

0 commit comments

Comments
 (0)