@defillama/sdk 5.0.98 → 5.0.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -164,7 +164,7 @@ async function getLogs({ chain = 'ethereum', topic, topics, fromBlock, toBlock,
164
164
  if (topic)
165
165
  topic = (0, logs_1.toFilterTopic)(topic);
166
166
  else if (eventAbi)
167
- topic = (0, logs_1.toFilterTopic)(iface);
167
+ topic = (0, logs_1.toFilterTopic)(eventAbi);
168
168
  let hasMore = true;
169
169
  let logs = [];
170
170
  const debugTimeKey = `Indexer-getLogs-${chain}-${topic}-${address}_${Math.random()}`;
@@ -1,4 +1,4 @@
1
- import { EventLog, Interface } from "ethers";
1
+ import { EventLog } from "ethers";
2
2
  import { Address } from "../types";
3
3
  export type GetLogsOptions = {
4
4
  target?: Address;
@@ -24,7 +24,7 @@ export type GetLogsOptions = {
24
24
  debugMode?: boolean;
25
25
  };
26
26
  export declare function getLogs(options: GetLogsOptions): Promise<EventLog[] | EventLog[][] | any[]>;
27
- export declare function toFilterTopic(topic: string | Interface): string;
27
+ export declare function toFilterTopic(topic: string): string;
28
28
  export type logCache = {
29
29
  logs: EventLog[];
30
30
  metadata: {
@@ -58,7 +58,7 @@ async function getLogs(options) {
58
58
  if (topic)
59
59
  topic = toFilterTopic(topic);
60
60
  else if (eventAbi)
61
- topic = toFilterTopic(iface);
61
+ topic = toFilterTopic(eventAbi);
62
62
  else {
63
63
  throw new Error('eventAbi | topic | topics are required');
64
64
  }
@@ -179,15 +179,12 @@ async function getLogs(options) {
179
179
  }
180
180
  }
181
181
  exports.getLogs = getLogs;
182
- // we need to form filter topic with indexed keyword, else it messes up generated topic string
183
182
  function toFilterTopic(topic) {
184
- if (typeof topic === 'string') {
185
- if (topic.startsWith('0x'))
186
- return topic;
187
- topic = new ethers_1.Interface([topic]);
183
+ if (typeof topic === 'string' && topic.startsWith('0x')) {
184
+ return topic;
188
185
  }
189
- const fragment = topic.fragments[0];
190
- return (0, ethers_1.id)(`${fragment.name}(${fragment.inputs.map((i) => i.type).join(',')})`);
186
+ const fragment = ethers_1.EventFragment.from(topic);
187
+ return (0, ethers_1.id)(fragment.format());
191
188
  }
192
189
  exports.toFilterTopic = toFilterTopic;
193
190
  exports.default = getLogs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defillama/sdk",
3
- "version": "5.0.98",
3
+ "version": "5.0.99",
4
4
  "description": "SDK for calculating TVL",
5
5
  "main": "build/index.js",
6
6
  "scripts": {