-
Notifications
You must be signed in to change notification settings - Fork 17
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
fees: ux for multi-asset fees #1268
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
f0b146f
add index for spendable notes table in idb
TalDerei 1f44143
scaffolding planner support for multi-asset fees
TalDerei c92ddfa
filter for alt fee asset id
TalDerei 837d72b
fix fee rendering
TalDerei e8e0538
full multi-asset fee support ~
TalDerei 6f0244e
attempt to pass CI
TalDerei 45bfe51
Merge branch 'main' into ux-multi-fees
TalDerei c1b2aee
partially address comments
TalDerei 23b6e19
valentine + jesse feedback
TalDerei fbc25cb
merge main
TalDerei d9b7373
fix broken lockfile, update deps, update db version
TalDerei f53027a
remove dangling minifront_url
TalDerei 6532dbc
co-locate idb version with storage package
TalDerei f11da6a
remove idb version from extension .env
TalDerei 89a24c1
support actions for alt fees
TalDerei ccfe1cf
linting and organization cleanup
TalDerei 81e04bb
merge main post prax migration
TalDerei 92e3dbd
update lockfile
TalDerei 12afb80
Merge branch 'main' into ux-multi-fees
TalDerei 1c8a6a4
remove extension dir trace
TalDerei 2b60977
fix lockfile?
TalDerei b20ea66
address valentine comments
TalDerei 0717d90
merge main
TalDerei 04a0d65
fix test suite
TalDerei 8721bc2
try fixing rust tests
Valentine1898 e570f2e
rust lint
Valentine1898 71ce2d3
rust lint
Valentine1898 3e9101f
add TODOs for #1310
Valentine1898 5de82b8
fix lint
Valentine1898 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { BalancesResponse } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/view/v1/view_pb'; | ||
import { Metadata } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/asset/v1/asset_pb'; | ||
import { getAssetIdFromValueView } from '@penumbra-zone/getters/value-view'; | ||
import { getAssetId } from '@penumbra-zone/getters/metadata'; | ||
|
||
export const hasStakingToken = ( | ||
assetBalances: BalancesResponse[], | ||
stakingAssetMetadata: Metadata, | ||
): boolean => { | ||
return assetBalances.some(asset => | ||
getAssetIdFromValueView(asset.balanceView).equals(getAssetId(stakingAssetMetadata)), | ||
); | ||
}; |
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
TalDerei marked this conversation as resolved.
Show resolved
Hide resolved
|
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,49 @@ | ||
import { AssetId } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/asset/v1/asset_pb'; | ||
import { | ||
TransactionPlannerRequest, | ||
TransactionPlannerRequest_ActionDutchAuctionEnd, | ||
TransactionPlannerRequest_ActionDutchAuctionSchedule, | ||
TransactionPlannerRequest_ActionDutchAuctionWithdraw, | ||
TransactionPlannerRequest_Output, | ||
TransactionPlannerRequest_Swap, | ||
} from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/view/v1/view_pb'; | ||
import { Code, ConnectError } from '@connectrpc/connect'; | ||
|
||
export const extractAltFee = (request: TransactionPlannerRequest): AssetId | undefined => { | ||
TalDerei marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Note: expand the possible types as we expand our support to more actions in the future. | ||
const fields = [ | ||
{ name: 'outputs', value: request.outputs }, | ||
{ name: 'swaps', value: request.swaps }, | ||
{ name: 'dutchAuctionScheduleActions', value: request.dutchAuctionScheduleActions }, | ||
{ name: 'dutchAuctionEndActions', value: request.dutchAuctionEndActions }, | ||
{ name: 'dutchAuctionWithdrawActions', value: request.dutchAuctionWithdrawActions }, | ||
]; | ||
|
||
const nonEmptyField = fields.find(field => field.value.length > 0); | ||
|
||
if (!nonEmptyField) { | ||
throw new ConnectError('No non-empty field found in the request.', Code.InvalidArgument); | ||
} | ||
|
||
const action = nonEmptyField.value[0]!; | ||
|
||
switch (nonEmptyField.name) { | ||
case 'outputs': | ||
return (action as TransactionPlannerRequest_Output).value?.assetId; | ||
case 'swaps': | ||
return (action as TransactionPlannerRequest_Swap).value?.assetId; | ||
case 'dutchAuctionScheduleActions': | ||
return (action as TransactionPlannerRequest_ActionDutchAuctionSchedule).description?.outputId; | ||
case 'dutchAuctionEndActions': | ||
return new AssetId({ | ||
inner: (action as TransactionPlannerRequest_ActionDutchAuctionEnd).auctionId?.inner, | ||
}); | ||
case 'dutchAuctionWithdrawActions': | ||
return new AssetId({ | ||
inner: (action as TransactionPlannerRequest_ActionDutchAuctionWithdraw).auctionId?.inner, | ||
}); | ||
default: | ||
console.warn('Unsupported action type.'); | ||
throw new ConnectError('Unsupported action type.', Code.InvalidArgument); | ||
} | ||
}; |
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
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.
it makes sense to make this a separate component to avoid duplication
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.
will cleanup the remaining suggestions in separately