Skip to content

Commit

Permalink
Merge pull request #326 from delta-hq/lynex-adapter-add-condition
Browse files Browse the repository at this point in the history
[Lynex] adapter add condition
  • Loading branch information
0xroll authored Nov 14, 2024
2 parents 8c3386c + ca97bdf commit 74b94ad
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
20 changes: 12 additions & 8 deletions adapters/lynex/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,19 @@ readBlocksFromCSV('hourly_blocks.csv').then(async (blocks: any[]) => {
console.log(blocks);
const allCsvRows: any[] = []; // Array to accumulate CSV rows for all blocks

for (const block of blocks) {
try {
const result = await getUserTVLByBlock(block);
for(let i = 0; i < result.length; i++){
allCsvRows.push(result[i])
}
} catch (error) {
console.error(`An error occurred for block ${block}:`, error);
for (let block of blocks) {
try {
if (block.blockNumber <= 12028521) {
block.blockNumber = 12030222
block.blockTimestamp = 1731545998
}
const result = await getUserTVLByBlock(block);
for (let i = 0; i < result.length; i++) {
allCsvRows.push(result[i]);
}
} catch (error) {
console.error(`An error occurred for block ${block}:`, error);
}
}
await new Promise((resolve, reject) => {
const ws = fs.createWriteStream(`outputData.csv`, { flags: 'w' });
Expand Down
2 changes: 1 addition & 1 deletion adapters/lynex/src/sdk/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const V3_SUBGRAPH_URL =

export const client = createPublicClient({
chain: linea,
transport: http(`https://linea-mainnet.infura.io/v3/${process.env.OPENBLOCK_LINEA_INFURA_API_KEY}`, {
transport: http(`https://linea-mainnet.infura.io/v3/${process.env.OPENBLOCK_LINEA_INFURA_API_KEY2}`, {
retryCount: 5,
timeout: 60_000,
}),
Expand Down
12 changes: 6 additions & 6 deletions adapters/lynex/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
lodash.isundefined "^3.0.1"
lodash.uniq "^4.5.0"

"@noble/[email protected]", "@noble/curves@~1.2.0":
"@noble/curves@~1.2.0", "@noble/[email protected]":
version "1.2.0"
resolved "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz"
integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==
dependencies:
"@noble/hashes" "1.3.2"

"@noble/[email protected].2", "@noble/hashes@~1.3.0", "@noble/hashes@~1.3.2":
"@noble/hashes@~1.3.0", "@noble/hashes@~1.3.2", "@noble/[email protected]":
version "1.3.2"
resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz"
integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==
Expand Down Expand Up @@ -71,7 +71,7 @@

"@types/lodash@^4.17.13":
version "4.17.13"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.13.tgz#786e2d67cfd95e32862143abe7463a7f90c300eb"
resolved "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.13.tgz"
integrity sha512-lfx+dftrEZcdBPczf9d0Qv0x+j/rfNCMuC6OcfXmO8gkfeNAY88PgKUbvG56whcN23gc27yenwF6oJZXGFpYxg==

"@types/node@^20.11.17":
Expand Down Expand Up @@ -168,7 +168,7 @@ lodash.uniq@^4.5.0:

lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

minimist@^1.2.0:
Expand All @@ -186,7 +186,7 @@ toformat@^2.0.0:
resolved "https://registry.npmjs.org/toformat/-/toformat-2.0.0.tgz"
integrity sha512-03SWBVop6nU8bpyZCx7SodpYznbZF5R4ljwNLBcTQzKOD9xuihRo/psX58llS1BMFhhAI08H3luot5GoXJz2pQ==

typescript@^5.3.3:
typescript@^5.3.3, typescript@>=5.0.4:
version "5.4.3"
resolved "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz"
integrity sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==
Expand All @@ -210,7 +210,7 @@ viem@^2.8.13:
isows "1.0.3"
ws "8.13.0"

[email protected]:
ws@*, ws@8.13.0:
version "8.13.0"
resolved "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz"
integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==

0 comments on commit 74b94ad

Please sign in to comment.