Skip to content

feat(app): gas #4625

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

feat(app): gas #4625

wants to merge 2 commits into from

Conversation

ehegnes
Copy link
Contributor

@ehegnes ehegnes commented May 28, 2025

No description provided.

@ehegnes ehegnes requested review from cor and Swepool May 28, 2025 05:08
Copy link

vercel bot commented May 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
site ⬜️ Ignored (Inspect) Visit Preview May 29, 2025 6:58am

Comment on lines +34 to +65
const eff = Effect.gen(function*() {
const oracle = yield* PriceOracle.PriceOracle
const { universal_chain_id: id } = yield* transferData.sourceChain.pipe(
Effect.mapError(() => new Error("no source chain selected")),
)
return yield* oracle.of(id)
})

const fakePrice = runPromiseExit$(eff)

const fakePriceDisplay = $derived(pipe(
fakePrice.current,
Option.map(Exit.match({
onFailure: Cause.prettyErrors,
onSuccess: (x) => JSON.stringify(x, null, 2),
})),
Option.getOrElse(() => "Loading price..."),
))

const realPrice = runPromiseExit$(
Effect.provide(eff, PriceOracle.PriceOracle.Pyth),
)

const realPriceDisplay = $derived(pipe(
realPrice.current,
Option.map(Exit.match({
onFailure: Cause.prettyErrors,
onSuccess: (x) => JSON.stringify(x, null, 2),
})),
Option.getOrElse(() => "Loading price..."),
))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Example usage in a component, leveraging our custom Effect runes.

ehegnes added 2 commits May 29, 2025 02:57
Signed-off-by: Eric Hegnes <eric@hegnes.com>
Signed-off-by: Eric Hegnes <eric@hegnes.com>
))

const realPrice = runPromiseExit$(
Effect.provide(eff, PriceOracle.PriceOracle.Pyth),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Providing a layer or service breaks reactivity such that the effect only runs once (until HMR triggers).

Would be amazing to solve this, but it shouldn't impact us in the short-term given we will only use the global app runtime in practice.

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.

1 participant