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: allow exiting offers #62

Merged
merged 9 commits into from
Mar 28, 2023
Merged

feat: allow exiting offers #62

merged 9 commits into from
Mar 28, 2023

Conversation

samsiegart
Copy link
Contributor

@samsiegart samsiegart commented Feb 22, 2023

fixes: #61

  • Adds exit button to currently-seated offers
  • Adds refunded status for offers with 0 wants satisfied

Tested making liquidation bids from CLI and exiting them from UI

image

image

@cloudflare-pages
Copy link

cloudflare-pages bot commented Feb 22, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1a1e82c
Status:⚡️  Build in progress...

View logs

Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

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

Will review again after the contract lands

@@ -206,45 +207,95 @@ export const getOfferService = (
return signSpendAction(offer.spendAction);
};

const cancelOffer = _id => {
console.log('TODO: cancel offer');
const cancelOffer = async (id: number) => {
Copy link
Member

Choose a reason for hiding this comment

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

let's be consistent in terminology:

Suggested change
const cancelOffer = async (id: number) => {
const tryExitOffer = async (id: number) => {

"cancel" suggests that it'll always work

@samsiegart samsiegart requested a review from turadg March 28, 2023 20:06
<div className="OfferOrigin" style={{ wordBreak: 'break-word' }}>
<PetnameSpan name={sourceDescription} />
<i> via </i>
<span className="Blue">{dappOrigin || origin}</span>
{(dappOrigin || origin) && (
Copy link
Member

Choose a reason for hiding this comment

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

consider const actualOrigin = dappOrigin || origin so the condition doesn't need to be repeated on line 142

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice done.

pendingOffersNotifier,
)) {
console.log('pending offers', pendingOffers);
pendingOffers?.forEach(([_, o]) => {
Copy link
Member

Choose a reason for hiding this comment

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

prefer control structures when available. for loop allows continue e.g.,

Suggested change
pendingOffers?.forEach(([_, o]) => {
if (!pendingOffers) continue;
for (const [_, o] of pendingOffers) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -201,8 +190,8 @@ test('renders the controls', () => {
expect(controls.find(Chip).at(1).text()).toContain('Decline');
});

test.skip('renders the exit button while pending', () => {
const pendingOffer = { ...offer };
test('renders the exit button while seated', () => {
Copy link
Member

Choose a reason for hiding this comment

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

glad to see these tests

@samsiegart samsiegart merged commit 784a586 into main Mar 28, 2023
@samsiegart samsiegart deleted the exit-offer branch March 28, 2023 23:04
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.

Support "exit" for pending smart wallet offers
2 participants