Skip to content

Conversation

@waynebruce0x
Copy link
Collaborator

No description provided.

@waynebruce0x
Copy link
Collaborator Author

@@ -1,7 +1,7 @@
import fetch from "node-fetch";
import { cachedFetch } from "@defillama/sdk/build/util/cache";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, no. Lets not use this path @defillama/sdk/build/... in the future, once the sdk is published, you can get it via sdk.cache.cachedFetch

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for the runInPromisePool in the next file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks - I'll change these when the SDK is out


export async function fetchAdaTokens(): Promise<any[]> {
const res = await fetch(`https://api.muesliswap.com/token-list`).then((r) => r.json());
const res = await cachedFetch({key: "muesliswap-token-list", endpoint: "https://api.muesliswap.com/token-list"})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can skip the key here if you want, it gets computed from endpoint as hash if key is missing for get requests

@@ -1,4 +1,4 @@
import { getPrices } from "./utils";
import { getPrices } from "@defillama/sdk/build/util/coinsApi";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check if this function works the same as the one you are replacing, also, same comment about using the build/..

The reason is, if something is not exposed by the SDK, we assume it is not used anywhere and can nuke it by mistake

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this here with the SDK branch and it works the same - I was planning on replacing the relevant code in other parts of the repo once the SDK changes have been released

@waynebruce0x waynebruce0x marked this pull request as ready for review October 27, 2025 13:14
@waynebruce0x waynebruce0x marked this pull request as draft October 27, 2025 13:17
@waynebruce0x waynebruce0x marked this pull request as ready for review November 3, 2025 14:57
defi/l2/tvl.ts Outdated
import { verifyChanges } from "./verifyChanges";
import { getExcludedTvl } from "./excluded";
import { saveRawBridgedTvls } from "./raw";
import { getMcaps } from "@defillama/sdk/build/util/coinsApi";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this is not there in my sdk pr, but in yours?

try {
process.env.TRON_RPC = process.env.TRON_RPC?.substring(process.env.TRON_RPC.indexOf(",") + 1);
await PromisePool.withConcurrency(2)
await PromisePool.withConcurrency(5)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

editing tron config via env variable wont really work of provider object is already created and also, it is not really needed?

const j = Object.keys(incomingAssets).indexOf(chain);
try {
const tokens: Address[] = j == -1 ? [] : await Object.values(incomingAssets)[j]();
const tokens: Address[] = incomingAssets[chain as keyof typeof incomingAssets] ? await incomingAssets[chain as keyof typeof incomingAssets]() : []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one of the reasons why I hate typescript, it makes to code unreadable, no need to change, personally I prefer any over this

async function fetchAllTokens() {
await initializePriceQueryFilter();

whitelistedTokenSetRawPids.forEach((t) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not build a chain level set from the start, instead of a common set, and then split by chain, only use of whitelistedTokenSetRawPids is here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants