Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/sdk/src/constants/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ export const solDeadAddress =
export const eclipseDeadAddress =
'CrfbABN2sSvmoZLu9eDDfXpaC2nHg42R7AXbHs9eg4S9' as const
export const bitcoinDeadAddress = 'bc1q4vxn43l44h30nkluqfxd9eckf45vr2awz38lwa'
export const tronDeadAddress = 'T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb'
export const zeroDeadAddress = '0x03508bB71268BBA25ECaCC8F620e01866650532c'

export const getDeadAddress = (vmType?: ChainVM, chainId?: number) => {
if (vmType === 'svm') {
return chainId === 9286185 ? eclipseDeadAddress : solDeadAddress
} else if (vmType === 'bvm') {
return bitcoinDeadAddress
} else if (vmType === 'tvm') {
return tronDeadAddress
} else if (chainId === 543210) {
return zeroDeadAddress
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/types/RelayChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type Erc20Currencies = NonNullable<
paths['/chains']['get']['responses']['200']['content']['application/json']['chains']
>['0']['erc20Currencies']

export type ChainVM = 'evm' | 'svm' | 'bvm'
export type ChainVM = 'evm' | 'svm' | 'bvm' | 'tvm'

export type RelayChain = {
id: number
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/src/utils/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
} from '@reservoir0x/relay-sdk'
import { isAddress } from 'viem'
import { isBitcoinAddress } from '../utils/bitcoin.js'
import { isTronAddress } from '../utils/tron.js'
import {
eclipse,
eclipseWallets,
Expand Down Expand Up @@ -50,6 +51,8 @@ export const isValidAddress = (
return isSolanaAddress(address)
} else if (vmType === 'bvm') {
return isBitcoinAddress(address)
} else if (vmType === 'tvm') {
return isTronAddress(address)
}
}
return false
Expand Down
9 changes: 9 additions & 0 deletions packages/ui/src/utils/tron.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const tron = {
id: 0 // TODO: Confirm correct chain ID for Tron
}

export const tronAddressRegex = /^(T|3)[a-zA-Z0-9]{34}$/

export function isTronAddress(address: string): boolean {
return tronAddressRegex.test(address)
}
Loading
Loading