-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add input_amount to events #451
Merged
ebma
merged 13 commits into
staging
from
371-add-parameter-to-the-amount_type-event-on-ga
Feb 20, 2025
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3c5dbae
add input_amount to events
gianfra-t 977f579
new form state, add input_amount to wallet event, used delayed fromAm…
gianfra-t af08900
send network id along with wallet_connect event
gianfra-t 7c32c67
Merge branch 'staging' into 371-add-parameter-to-the-amount_type-even…
gianfra-t ae6ac85
Change logic for amount type tracking
ebma b78eea7
Merge branch 'staging' into 371-add-parameter-to-the-amount_type-even…
gianfra-t be59e14
fix some lint issues
gianfra-t 6c4efe2
fix type
gianfra-t 515ddc7
Remove `amount_type` event from list of unique events
ebma 80262d5
Fix bug reintroduced by merge
ebma 66b1eed
Fix some lint warnings
ebma 02eb487
Merge branch 'staging' into 371-add-parameter-to-the-amount_type-even…
ebma 9ef4bde
Prevent tracking of default fromAmount
ebma 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,6 +92,7 @@ function FeeProviderRow({ | |
targetAssetSymbol, | ||
providerPrice, | ||
vortexPrice, | ||
trackQuote, | ||
error, | ||
]); | ||
|
||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { create } from 'zustand'; | ||
import Big from 'big.js'; | ||
import { InputTokenDetails, BaseInputTokenDetails } from '../constants/tokenConfig'; | ||
|
||
interface FormState { | ||
fromAmount?: Big; | ||
fromToken?: InputTokenDetails; | ||
toToken?: BaseInputTokenDetails; | ||
} | ||
|
||
interface FormStoreActions { | ||
setFromAmount: (amount?: Big) => void; | ||
setFromToken: (token?: InputTokenDetails) => void; | ||
setToToken: (token?: BaseInputTokenDetails) => void; | ||
} | ||
|
||
type FormStore = FormState & { | ||
actions: FormStoreActions; | ||
}; | ||
|
||
const useFormStore = create<FormStore>((set) => ({ | ||
fromAmount: undefined, | ||
fromToken: undefined, | ||
toToken: undefined, | ||
|
||
actions: { | ||
setFromAmount: (amount?: Big) => set({ fromAmount: amount }), | ||
setFromToken: (token?: InputTokenDetails) => set({ fromToken: token }), | ||
setToToken: (token?: BaseInputTokenDetails) => set({ toToken: token }), | ||
}, | ||
})); | ||
|
||
export const useFromAmount = () => useFormStore((state) => state.fromAmount); | ||
export const useFromToken = () => useFormStore((state) => state.fromToken); | ||
export const useToToken = () => useFormStore((state) => state.toToken); | ||
|
||
export const useFormStoreActions = () => useFormStore((state) => state.actions); |
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.
@pendulum-chain/devs let me know if you like the addition of this state, if you prefer it to be more minimal (only
fromAmount
) or to avoid this altogether.Although it adds extra code, I found it less confusing than passing
fromAmount
to the event context.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.
I'm fine with keeping it the way you implemented it 👍