-
Notifications
You must be signed in to change notification settings - Fork 4
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: swap ui #42
feat: swap ui #42
Conversation
</div> | ||
</div> | ||
<div className="daisyui-divider lg:daisyui-divider-horizontal"></div> | ||
<IncomingOffers /> |
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.
<IncomingOffers />
wondering if this component could be reused in our ui-kit. Seems it would be very useful for many dapps 🚀
const IncomingOffers = () => { | ||
const { instances } = useContractStore(); | ||
const swaparooInstance = instances?.['swaparoo']; | ||
const invitationPurse = usePurse('Invitation'); |
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.
if swaparooInstance
instance, and invitationPurse
these are parameterized, i can def see this as a reusable component. Maybe we already have something like this in ui-kit? Would love your thoughts. The UI is nice & elegant too 🚀
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 think a component for showing proposals (give and want) could definitely be useful. However, the thing about these invitations is they're specifically crafted by the contract to have the proposal data. Most invitations from other contracts won't have an explicit "give" and "want" encoded in them, so I don't think a component could work with just an instance and purse, unless we assume it will only be used for the swaparoo contract.
We've thought about putting this swaparoo functionality directly into wallet-app and launching the contract on mainnet, so maybe if swaparoo becomes so well known a component could be useful.
There's some other components like in DisplayAmount.tsx
and PurseAmountInput.tsx
that I think would be good for ui-kit, I'd need to think through more how to design them more portably though.
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.
LGTM, awesome demo. I think there may be several reusable components that can be valuable in UI-kit if they don't already exist 😎
Thanks! Yea this stuff makes full use of the existing ui-kit, so whatever I wrote in this PR doesn't already exist as a component. I just edited the PR to disable invitation swaps due to Agoric/agoric-sdk#9378, will merge now. |
Allows giving any assets (set, copyBag, or nat) in your purse and getting any assets in a recipient's purse.
One wrinkle is that all swap invitations have the same description, "matchOffer", so for offer specs to work correctly when you have multiple, we'll have to change the contract to make them unique (like "matchOffer-[x]").
Screenshots