-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
base: main
Are you sure you want to change the base?
feat(app): gas #4625
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
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..."), | ||
)) | ||
|
There was a problem hiding this comment.
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.
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), |
There was a problem hiding this comment.
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.
No description provided.