-
Notifications
You must be signed in to change notification settings - Fork 2
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
[WIP] Unify pool state #383
base: master
Are you sure you want to change the base?
Conversation
✨ Deployment complete! Take a peek over at https://8fa2bafb.ui-storybook.pages.dev |
Deploying with Cloudflare Pages
|
3463cac
to
2d74210
Compare
7e37f59
to
68da6cc
Compare
68da6cc
to
611eb34
Compare
8c58bc9
to
1b6c2a3
Compare
1b6c2a3
to
015649c
Compare
interface DecimalBN { | ||
readonly value: BN; | ||
readonly decimals: number; | ||
} | ||
|
||
const decimal = (property = "decimal"): Layout<DecimalBN> => | ||
struct([u64("value"), u8("decimals")], property); | ||
|
||
interface AmpFactor { | ||
readonly initialValue: DecimalBN; | ||
readonly initialTs: BN; | ||
readonly targetValue: DecimalBN; | ||
readonly targetTs: BN; | ||
} | ||
|
||
const ampFactor = (property = "ampFactor"): Layout<AmpFactor> => | ||
struct( | ||
[ | ||
decimal("initialValue"), | ||
i64("initialTs"), | ||
decimal("targetValue"), | ||
i64("targetTs"), | ||
], | ||
property, | ||
); |
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.
@nicomiicro I had to copy-paste these from the @swim-io/solana
package because otherwise borsh complained that they weren't instances of Layout
. Any ideas why? I thought the peer dependencies adjustment was supposed to prevent this kind of issue.
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.
I don't get a type error locally 🤔
I pushed 14b5fe3
Let's see the output of the CI https://github.com/swim-io/swim/actions/runs/3323839509/jobs/5494688131
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.
oh now I see it, it's a runtime error. Checking...
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.
oh yes, it's just because you are using the package from the workspace and not a published one. Thus it will load the one from its own node_modules
. This should go away once it gets published.
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.
Another (good) reason to move to pre-releases for PRs?
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.
Ahh. Hmm, I don't really want to have to publish twice as often as I do currently.
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.
yeah I meant when we automate this...
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.
Looks good! Just a couple of questions
({ id }) => id === lpTokenId, | ||
); | ||
const poolTokens = tokenIds.map((tokenId) => | ||
findOrThrow(this.chainConfig.tokens, ({ id }) => id === tokenId), |
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.
Won't this have the same issue I had with swimUSD
not being present in this tokens
list?
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.
Yes, nice catch, thanks!
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.
const poolTokenDetails = tokenIds.map((tokenId) => { | ||
const tokenConfig = findOrThrow( | ||
this.chainConfig.tokens, | ||
(token) => token.id === tokenId, |
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.
same question about swimUSD
A step towards creating a generic
Client
interface. I'd be interested to hear suggestions on how to combine this approach with the current usage of React query/caching.Checklist