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: swap ui #42

Merged
merged 3 commits into from
May 20, 2024
Merged

feat: swap ui #42

merged 3 commits into from
May 20, 2024

Conversation

samsiegart
Copy link
Contributor

@samsiegart samsiegart commented May 17, 2024

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

image

image

image

</div>
</div>
<div className="daisyui-divider lg:daisyui-divider-horizontal"></div>
<IncomingOffers />
Copy link

@Jovonni Jovonni May 17, 2024

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');
Copy link

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 🚀

Copy link
Contributor Author

@samsiegart samsiegart May 20, 2024

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.

Copy link

@Jovonni Jovonni left a 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 😎

@samsiegart
Copy link
Contributor Author

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.

@samsiegart samsiegart merged commit dfda549 into main May 20, 2024
2 checks passed
@samsiegart samsiegart deleted the swap-ui branch May 20, 2024 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants