File tree Expand file tree Collapse file tree
packages/devtools/src/transactions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,23 +3,24 @@ import { formatEid } from '@/omnigraph/format'
33import { ChainType , endpointIdToChainType } from '@layerzerolabs/lz-definitions'
44import bs58 from 'bs58'
55
6- /**
7- * Helper to check if an endpoint ID is for Solana
8- */
9- const isSolanaEid = ( eid : number ) : boolean => endpointIdToChainType ( eid ) === ChainType . SOLANA
10-
116/**
127 * Format transaction data for display.
138 * Converts hex to base58 for Solana transactions.
149 */
1510const formatTransactionData = ( data : string , eid : number ) : string => {
16- if ( ! isSolanaEid ( eid ) ) {
17- return data
11+ const chainType = endpointIdToChainType ( eid )
12+
13+ switch ( chainType ) {
14+ case ChainType . SOLANA :
15+ return hexToBase58 ( data )
16+ default :
17+ return data // default to hex string
1818 }
19+ }
1920
20- // Convert hex string to base58 for Solana
21+ export const hexToBase58 = ( hexString : string ) : string => {
2122 // Remove '0x' prefix if present
22- const hexData = data . startsWith ( '0x' ) ? data . slice ( 2 ) : data
23+ const hexData = hexString . startsWith ( '0x' ) ? hexString . slice ( 2 ) : hexString
2324 const bytes = Uint8Array . from ( Buffer . from ( hexData , 'hex' ) )
2425 return bs58 . encode ( bytes )
2526}
You can’t perform that action at this time.
0 commit comments