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: redemption widget add handlers #605

Merged
merged 11 commits into from
Nov 17, 2023

Conversation

levalleux-ludo
Copy link
Member

@levalleux-ludo levalleux-ludo commented Nov 16, 2023

Description

this PR adds some properties to the redemption widget react component:

  • sendDeliveryInfoThroughXMTP (required): whether the delivery information shall be sent to the seller via XMTP
  • deliveryInfoHandler (optional): will be called when the delivery information is filled in by the user and before the Redeem transaction is submitted to the blockchain, passing the delivery information + a signature and optionally waiting for a response
  • redemptionSubmittedHandler (optional): will be called when the Redeem transaction is submitted to the blockchain, passing the transaction details. No response expected
  • redemptionConfirmedHandler (optional): will be called when the Redeem transaction is submitted to the blockchain, passing the transaction details. No response expected

Now, the redemption flows progress as follow (in this order):

  • when the user has confirmed the delivery information
  • if sendDeliveryInfoThroughXMTP and the XMTP layer is not initialized, ask the user to initialize (signing with the wallet)
  • if sendDeliveryInfoThroughXMTP sends the delivery information to the seller
  • if deliveryInfoHandler, call deliveryInfoHandler and consider the response. It's possible to interrupt the flow in case the reponse is not accepted, or in case the response 'resume' is set to false
  • if postRedemptionInfo (HTTP callback), call postRedemptionInfo and consider the response. It's possible to interrupt the flow in case the reponse is not accepted, or in case the response 'resume' is set to false
  • send the Redeem transaction to the blockchain
  • if redemptionSubmittedHandler, call redemptionSubmittedHandler
  • if postRedemptionSubmitted (HTTP callback), call postRedemptionSubmitted
  • wait for the transaction to be confirmed
  • if redemptionConfirmedHandler, call redemptionConfirmedHandler
  • if postRedemptionConfirmed (HTTP callback), call postRedemptionConfirmed

How to test

react-kit storybook

@levalleux-ludo levalleux-ludo marked this pull request as ready for review November 16, 2023 18:14
Copy link

codecov bot commented Nov 16, 2023

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (16b69ec) 84.15% compared to head (dfb60af) 69.29%.
Report is 22 commits behind head on main.

❗ Current head dfb60af differs from pull request most recent head a10349b. Consider uploading reports for the commit a10349b to get more accurate results

Files Patch % Lines
packages/core-sdk/src/erc165/handler.ts 33.33% 4 Missing ⚠️
packages/core-sdk/src/erc165/mixin.ts 71.42% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #605       +/-   ##
===========================================
- Coverage   84.15%   69.29%   -14.87%     
===========================================
  Files         134      137        +3     
  Lines        4052     4071       +19     
  Branches      712      713        +1     
===========================================
- Hits         3410     2821      -589     
- Misses        642     1250      +608     
Flag Coverage Δ
common 85.11% <100.00%> (+0.17%) ⬆️
core-sdk 50.14% <64.70%> (+0.07%) ⬆️
e2e 64.56% <64.70%> (-18.64%) ⬇️
eth-connect-sdk 18.30% <ø> (ø)
ethers-sdk 67.63% <ø> (ø)
ipfs-storage 94.02% <ø> (ø)
metadata 94.44% <ø> (ø)
unittests 53.96% <68.42%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

levalleux-ludo and others added 7 commits November 17, 2023 11:18
…irmation/Confirmation.tsx

Co-authored-by: albertfolch-redeemeum <102516373+albertfolch-redeemeum@users.noreply.github.com>
…irmation/Confirmation.tsx

Co-authored-by: albertfolch-redeemeum <102516373+albertfolch-redeemeum@users.noreply.github.com>
…RedemptionContext.tsx

Co-authored-by: albertfolch-redeemeum <102516373+albertfolch-redeemeum@users.noreply.github.com>
…RedemptionContext.tsx

Co-authored-by: albertfolch-redeemeum <102516373+albertfolch-redeemeum@users.noreply.github.com>
@levalleux-ludo levalleux-ludo merged commit a40cd39 into main Nov 17, 2023
4 checks passed
@levalleux-ludo levalleux-ludo deleted the redemption-widget-add-handlers branch November 17, 2023 16:28
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.

2 participants