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

[NO-CHANGELOG] Adds Smart Checkout to state and flow of Sale Widget #1005

Merged
merged 24 commits into from
Oct 19, 2023

Conversation

jwhardwick
Copy link
Contributor

@jwhardwick jwhardwick commented Oct 17, 2023

Summary

  • adding smart checkout to the flow + to the context provider
  • smart checkout balance check happens after user tries to pay with coins

NOTE: swaps are geo blocked, so to see this with swaps you'll need to modify packages/checkout/sdk/src/smartCheckout/routing/routingOptions.ts

 if (availableRoutingOptions.swap) {
    // geoBlockingChecks.push({ id: 'swap', promise: isSwapGeoBlocked(config) });
    geoBlockingChecks.push({ id: 'swap', promise: Promise.resolve(false) });
  }

Flows

(All urls will be specific for my wallet balance)

1 - SC balance is !sufficient - no funding routes available

Show user error and try again.
http://localhost:3001/sale?amount=100000000.023&env=sandbox&fromContractAddress=0x12739A8f1A8035F439092D016DAE19A2874F30d2&environmentId=43c50b21-97e3-4d15-a67f-c37db28ac086

SC.Insufficient.mov

2 - SC balance is !sufficient- funding routes available

Show FundingRouteSelect for user to select from
http://localhost:3001/sale?amount=0.023&env=sandbox&fromContractAddress=0x12739A8f1A8035F439092D016DAE19A2874F30d2&environmentId=43c50b21-97e3-4d15-a67f-c37db28ac086

SC.Insufficient.Available.Routes.mov

3 SC balance is sufficient

Send user to PayWithCoins
http://localhost:3001/sale?amount=0.0023&env=sandbox&fromContractAddress=0x21B51Ec6fB7654B7e59e832F9e9687f29dF94Fb8&environmentId=4dfc4bec-1867-49aa-ad35-d8a13b206c94

SC.Sufficient.mov

@jhesgodi jhesgodi self-requested a review October 17, 2023 23:42
return result;
}, [smartCheckout]);

useEffect(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved all the SC logic stuff here, including calling sign before moving to PayWithCoins.

If there are funding routes, they get set here setFundingRoutes(). Then FundWithSmartCheckout only cares about two things globally:

  1. calling querySmartCheckout on INIT
  2. once FundingRoutes are set, showing these to user and letting them complete each step

@jwhardwick jwhardwick changed the title Gpr 210/add smart checkout shared context pr branch [NO-CHANGELOG] Adds Smart Checkout to state and flow of Sale Widget Oct 18, 2023
@jwhardwick jwhardwick marked this pull request as ready for review October 18, 2023 04:00
@jwhardwick jwhardwick requested a review from a team as a code owner October 18, 2023 04:00
@jwhardwick jwhardwick merged commit e4b8b11 into main Oct 19, 2023
6 checks passed
@jwhardwick jwhardwick deleted the gpr-210/add-smart-checkout-shared-context-pr-branch branch October 19, 2023 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants