-
Notifications
You must be signed in to change notification settings - Fork 33
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/input quotes #1412
Merged
Merged
Feat/input quotes #1412
Changes from 91 commits
Commits
Show all changes
108 commits
Select commit
Hold shift + click to select a range
3e74cff
Initialize fetchBridgeQuotes in utils, add BridgeQuoteRequest data type
bigboydiamonds aaa28fd
Basic useBridgeQuote that continuously provides back bridge quote amount
bigboydiamonds 58cd2ff
Simple async fetchBridgeQuote function
bigboydiamonds 83f03ec
Adjust fetchBridgeQuote function to accept synapseSDK as a param
bigboydiamonds f1d1986
fetchBridgeQuotes can return multiple bridge quotes via SDK in single…
bigboydiamonds 72d35c3
static typing
bigboydiamonds 0a80886
Init Bridge Updater component to allow for refreshing toTokens quotes
bigboydiamonds dcc693b
Bridge Updater component can access bridge quotes based on current to…
bigboydiamonds a7c5a7e
Remove test code in ToTokenListOverlay
bigboydiamonds 1b3cc2e
Return token Token type in fetchBridgeQuote() call to match possibleT…
bigboydiamonds 96479d1
Update
bigboydiamonds 9cea209
Add comment
bigboydiamonds bd50221
init fechAndStoreBridgeQuotes async thunk
bigboydiamonds 09dc065
fetchAndStoreBridgeQuotes
bigboydiamonds 1adaacd
add fetchAndStoreBridgeQuote to use for current bridge selections
bigboydiamonds c9d9993
Update BridgeQuoteRequest to include originToken
bigboydiamonds f2e086e
...
bigboydiamonds 102e9a3
port getAndSetBridgeQuote logic into fetchBridgeQuote
bigboydiamonds aee1e6c
Extend BridgeQuote type into BridgeQuoteResponse to include destinati…
bigboydiamonds 9093214
Add typing to thunks
bigboydiamonds ab13f33
Add store state and reducer for fetchAndStoerBridgeQuotes
bigboydiamonds 7a8e570
Bridge Updater to dispatch fetched bridge quotes for toTokens when avail
bigboydiamonds b696385
Update fetchBridgeQuotes to return array of objects
bigboydiamonds f3bbd99
Pass in formatted exchangeRate string into SelectSpecificTokenButton
bigboydiamonds c93a0c4
Add OptionDetails component that displays exchangeRate for now
bigboydiamonds 1c222d9
Prefetch exchange rates without fromValue
bigboydiamonds 0caac53
Add state/reducer for fetchAndStoreBridgeQuotes status
bigboydiamonds f133d9e
Show exchangeRates only after fetch status is valid
bigboydiamonds e60778a
Add action and reducer to resetFetchedBridgeQuotes
bigboydiamonds 4d93c72
Reset fetched bridge quotes if fromToken is reset or is null
bigboydiamonds 2c2ede7
Reset fetched bridge quotes if no toChainId exists
bigboydiamonds 605af4d
calculateEstimatedTransactionTime util function
bigboydiamonds ea6b3c6
Pass in estimatedDuration prop to SelectSpecificTokenButton to popula…
bigboydiamonds c00a458
Add comments
bigboydiamonds f2cdd29
Add estimatedDurationInSeconds as prop in OptionDetails component, di…
bigboydiamonds f2aaee6
Style estimated duration in token selection
bigboydiamonds 96e6bbc
Add util function locateBestExchangeRateIndex
bigboydiamonds f31746b
Add isBestExchangeRate bool prop to SelectSpecificTokenButton
bigboydiamonds fc6b9ee
...
bigboydiamonds 065dcbc
Create OptionTag with BestOptionType interface to create multiple opt…
bigboydiamonds b590781
Basic unstyled OptionTag is working
bigboydiamonds 72b7fcb
Add gradient
bigboydiamonds a46fb3b
Style tag
bigboydiamonds 40687dd
Render tag only if exchangeRate available
bigboydiamonds 998a34d
Add destinationChainId in response for fetchBridgeQuotes
bigboydiamonds ddf9852
Ensure quote does not show unless destinationChainId matches, solve f…
bigboydiamonds 66fc512
Style OptionTag
bigboydiamonds e8479af
Match bridgeQuotes based on destinationToken and not array positioning
bigboydiamonds 873f2d6
Init getDefaultBridgeAmount util function
bigboydiamonds 9148118
Create required enums to construct respective getDefaultBridgeAmount …
bigboydiamonds 673e557
...
bigboydiamonds b57ad1f
Update locateBestExchangeRateToken to match best rate by Token
bigboydiamonds fa491d7
Proprogate bestExchangeRateToken changes to ToTokenListOverlay
bigboydiamonds 1134490
clean
bigboydiamonds 1ab1da8
Fix NaN bug
bigboydiamonds ee39e42
...
bigboydiamonds 8bba04a
Clean
bigboydiamonds 6590171
Add maxConcurrentRequests and requestDelay to limit single overload +…
bigboydiamonds b000008
Debounce user input in Bridge updater to prevent alternative quote fe…
bigboydiamonds 64fce40
updateDebouncedFromValue action
bigboydiamonds 55f6393
Add reducer
bigboydiamonds ff3ab45
Lift debouncedFromValue to store
bigboydiamonds 3133d1c
Utilize debouncedFromValue throughout bridge experience
bigboydiamonds 4036485
Create orderedPossibleTokens to create ordered list based on fetched …
bigboydiamonds c0b3647
Merge branch 'master' into feat/input-quotes
bigboydiamonds 3c3dc5c
Debounce 400
bigboydiamonds cf36911
Debounce 300ms
bigboydiamonds 78d2eda
400ms debounce works
bigboydiamonds a9a58ca
Ensure loader activates when fromValue updates, not based on debounce…
bigboydiamonds 05c17bf
..
bigboydiamonds 0e8d636
Sort Best Rate selection and place at top
bigboydiamonds e0f21d6
Add delay on bridge loading animation
bigboydiamonds 13ada28
Add default case for getDefaultBridgeAmount switch statement
bigboydiamonds 163e3bc
Ensure loader not triggered until debouncedFromValue populated
bigboydiamonds 29631f9
Add isLoadingExchangeRate prop to SelectSpecificTokenButton
bigboydiamonds a276d9a
Show loading spinner when fetching bridge quote exchange rates
bigboydiamonds cf1bd9e
...
bigboydiamonds e0c11b8
Update name from LoadingSpinner to LoadingDots to be more descriptive'
bigboydiamonds c235df6
Update ButtonLoadingSpinner to ButtonLoadingDots
bigboydiamonds cc0f32a
Add debouncedToTokensFromValue action and reducer
bigboydiamonds d8d3fae
Setup debounce for alternative bridge quotes
bigboydiamonds 9ccd385
Utilize debouncedToTokensFromValue to fetch alternate bridge quotes
bigboydiamonds 08354e3
Separate debouncing for primary quote and alternate quotes
bigboydiamonds 3c64605
Update semantic naming, add comments
bigboydiamonds bc86a5c
Update debounce times between primary/alternative
bigboydiamonds 2519be0
Tweak debouncer for alternative quote
bigboydiamonds 2a9ed4e
Update debounce and maxConcurrentRequests to make alternative bridge …
bigboydiamonds 5c3ecc7
Tighten up alternative bridge quotes fetching conditions for stability
bigboydiamonds 2b7e837
update naming
bigboydiamonds 2599ed4
Clear quotes if user input does not exist
bigboydiamonds 1f342be
Allow input to be zerod
bigboydiamonds bdfb3c2
Update trigger for useEffect updating alternative bridge quotes
bigboydiamonds 73256d5
hasOnlyZeroes shared utils function
bigboydiamonds 730a21d
Add try catch around fetchBridgeQuote action
bigboydiamonds e9bf7ca
clean
bigboydiamonds b6d1578
clean
bigboydiamonds 5638ee9
Example with fetching with default values
bigboydiamonds be51adb
Only fetch alternative bridge quotes when user input exists and is no…
bigboydiamonds b292e40
Increase bridge qutoe fetching reliability after setting default to s…
bigboydiamonds 0168ec8
Update loading status when fetching default exchange rates
bigboydiamonds 701a22c
Only show best rate if more than one option
bigboydiamonds 9700b57
Fix lint
bigboydiamonds e4e69ba
..
bigboydiamonds 0a996b1
Disable integration tests for iniitally settting bridge origin and de…
bigboydiamonds 8a89a87
Test max 2 concurrent requests
bigboydiamonds 8754335
Merge branch 'master' into feat/input-quotes
bigboydiamonds b77650f
Set loading to false in useEffect cleanup
bigboydiamonds 2d35210
Add error handling for when fetchBridgeQuote does not have request or…
bigboydiamonds File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/synapse-interface/components/buttons/ButtonLoadingDots.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import LoadingDots from '@/components/ui/tailwind/LoadingDots' | ||
|
||
export default function ButtonLoadingDots({ | ||
className, | ||
}: { | ||
className?: string | ||
}) { | ||
return <LoadingDots className={`opacity-50 ${className}`} /> | ||
} |
9 changes: 0 additions & 9 deletions
9
packages/synapse-interface/components/buttons/ButtonLoadingSpinner.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This hunk introduces logic to calculate the best exchange rate token and order possible tokens based on their exchange rates. The use of
useMemo
here is appropriate as it prevents unnecessary recalculations when the dependencies haven't changed. However, there's a console log statement at line 224 which should be removed before merging to avoid exposing potentially sensitive information in production.- 224: console.log('orderedPossibleTokens: ', orderedPossibleTokens)