-
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
ibc: transparent address support #1950
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
3180970
add t-addr support to view service
TalDerei 899b176
backwards compatibility with existing frontends
TalDerei 640fbd1
changeset
TalDerei 10ffb2c
fix inbound / outbound ibc transfers
TalDerei 564951e
linting
TalDerei 326c11a
remove deprecated useCompatAddress field
TalDerei 9dba728
fix wasm test
TalDerei c8e434a
Merge branch 'main' into t-addr
TalDerei d8236ca
use ephemeral address format for ibc-in
TalDerei b854f69
bech32 shared helper
TalDerei 1b6a45e
comment: bech32, rather thana bech32m
TalDerei b6cd1fa
timeout msg
TalDerei 28054ef
remove compat address format from bech32 and types package
TalDerei ef1f212
use t-addr field in ics20 withdrawal component
TalDerei ec1c370
update changeset
TalDerei 486e9a8
add compat and t-addr bech32 encoding
TalDerei 472a542
preprocessing the transaction view
TalDerei a654938
linting
TalDerei 2e58a15
appease linter
TalDerei 8712343
linting rule
TalDerei 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
28 changes: 28 additions & 0 deletions
28
packages/services/src/view-service/util/transaction-view.ts
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,28 @@ | ||
import { TransactionView } from '@penumbra-zone/protobuf/penumbra/core/transaction/v1/transaction_pb'; | ||
import { getTransmissionKeyByAddress } from '@penumbra-zone/wasm/keys'; | ||
|
||
// Some transaction views (TXVs) require additional preprocessing before being rendered | ||
// in the UI component library. For example, when handling IBC withdrawals with transparent | ||
// addresses, this component transforms ephemeral addresses into their bech32-encoded | ||
// transparent form to ensure the proper data is being displayed. | ||
export const txvTranslator = async (view: TransactionView): Promise<TransactionView> => { | ||
// 'Ics20Withdrawal' action view | ||
const withdrawalAction = view?.bodyView?.actionViews?.find( | ||
Check failure on line 10 in packages/services/src/view-service/util/transaction-view.ts GitHub Actions / Lint
|
||
action => action.actionView.case === 'ics20Withdrawal', | ||
); | ||
|
||
if (withdrawalAction?.actionView.case === 'ics20Withdrawal') { | ||
const withdrawal = withdrawalAction.actionView.value; | ||
// Create 80-byte array initialized to zeros, then set first 32 bytes to transmission key. | ||
// This constructs a valid address format where: | ||
// - First 32 bytes: transmission key | ||
// - Remaining 48 bytes: zeroed (16-byte diversifier + 32-byte clue key) | ||
if (withdrawal.returnAddress && withdrawal.useTransparentAddress) { | ||
const newInner = new Uint8Array(80).fill(0); | ||
newInner.set(getTransmissionKeyByAddress(withdrawal.returnAddress), 0); | ||
withdrawal.returnAddress.inner = newInner; | ||
} | ||
} | ||
|
||
return view; | ||
}; |
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.
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.
renders the proper address format in the transaction view that's passed to the UI component library