Skip to content

Commit

Permalink
specific assethub prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
jvonasek committed Dec 20, 2024
1 parent 9981e19 commit cc0b4f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
11 changes: 10 additions & 1 deletion src/sections/deposit/steps/DepositAsset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const DepositAsset: React.FC<DepositAssetProps> = ({
/>
<AccountBox
{...account}
ss58Format={chain && isAnyParachain(chain) ? chain.ss58Format : 0}
ss58Format={getAddressPrefix(dstChain)}
error={
!isAccountAllowed
? t("deposit.cex.account.evmError", {
Expand Down Expand Up @@ -177,3 +177,12 @@ export const DepositAsset: React.FC<DepositAssetProps> = ({
</div>
)
}

function getAddressPrefix(chainKey: string) {
const chain = chainsMap.get(chainKey)
if (chain && isAnyParachain(chain)) {
return chain.key === "assethub" ? 0 : chain.ss58Format
}

return 0
}
9 changes: 6 additions & 3 deletions src/sections/deposit/steps/DepositTransfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { useZodSchema } from "sections/deposit/steps/DepositTransfer.utills"
import { WalletTransferAccountInput } from "sections/wallet/transfer/WalletTransferAccountInput"
import { useAccount } from "sections/web3-connect/Web3Connect.utils"
import { BN_NAN } from "utils/constants"
import { H160, isEvmAddress } from "utils/evm"
import { FormValues } from "utils/helpers"

export type DepositTransferProps = {
Expand Down Expand Up @@ -91,11 +92,13 @@ export const DepositTransfer: React.FC<DepositTransferProps> = ({
if (!asset) return

await sendTx({
asset: asset.data.asset.key,
wallet,
asset: asset.data.asset.key,
amount: values.amount,
srcAddr: address,
dstAddr: dstAddress,
srcAddr: isEvmAddress(address) ? new H160(address).toAccount() : address,
dstAddr: isEvmAddress(dstAddress)
? new H160(dstAddress).toAccount()
: dstAddress,
srcChain: srcChain,
dstChain: "hydration",
})
Expand Down

0 comments on commit cc0b4f1

Please sign in to comment.