Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat add pool with hook consider flag #1142

Draft
wants to merge 8 commits into
base: v3-canary
Choose a base branch
from

Conversation

mkflow27
Copy link
Contributor

@mkflow27 mkflow27 commented Nov 6, 2024

This pr adds optionality for pools with hooks to be either considered or not considered when the api uses the sor

Copy link

changeset-bot bot commented Nov 6, 2024

🦋 Changeset detected

Latest commit: d200415

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
backend Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@johngrantuk johngrantuk left a comment

Choose a reason for hiding this comment

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

LGTM!

@mkflow27 mkflow27 marked this pull request as ready for review November 6, 2024 14:13
@mkflow27 mkflow27 requested a review from franzns November 6, 2024 14:15
@franzns franzns marked this pull request as draft November 12, 2024 06:49
@@ -66,6 +66,7 @@ export class SorService {
wethIsEth: wethIsEth,
}
: undefined,
considerPoolsWithHooks: args.considerPoolsWithHooks ? args.considerPoolsWithHooks : false,
Copy link
Member

Choose a reason for hiding this comment

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

This works, but just sharing that there are simpler ways of doing this, such as:

args.considerPoolsWithHooks ?? false // this returns the first argument if defined, otherwise false

or

!!args.considerPoolsWithHooks // this is called falsy, which returns false if undefined

@@ -391,7 +391,7 @@ export const prismaPoolBatchSwapWithSwaps = Prisma.validator<Prisma.PrismaPoolBa

export type PrismaPoolBatchSwapWithSwaps = Prisma.PrismaPoolBatchSwapGetPayload<typeof prismaPoolBatchSwapWithSwaps>;

export const prismaPoolWithDynamic = Prisma.validator<Prisma.PrismaPoolArgs>()({
export const prismaPoolWithDynamicAndHook = Prisma.validator<Prisma.PrismaPoolArgs>()({
Copy link
Member

Choose a reason for hiding this comment

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

I'd say prismaPoolAndHookWithDynamic follows the existing pattern a bit better.
@franzns - since this is more of a backend/db thing than an SOR thing, do you have a preference?

Copy link
Collaborator

Choose a reason for hiding this comment

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

No strong opinion

)) as PathWithAmount[];
expect(paths.length).toBeGreaterThan(0);
});
test('SOR does not consider pools with hooks - when hook available', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

These tests are not yet done, right?

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.

4 participants