Skip to content

Commit

Permalink
Merge pull request #464 from terra-money/ST-596-fix-ics20-send-back
Browse files Browse the repository at this point in the history
ST-596: fix ics20 send back
  • Loading branch information
terran6 authored Jul 10, 2023
2 parents c29e7bf + 15644a1 commit efee91d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/data/queries/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ export function useIBCChannels() {

if (
icsChannel &&
networks[to]?.icsChannels?.[from]?.otherChannel === icsChannel
networks[to]?.icsChannels?.[from]?.channel === icsChannel
) {
return icsChannel
return networks[to]?.icsChannels?.[from]?.otherChannel
}

return networks[from]?.channels?.[to]
Expand Down
6 changes: 5 additions & 1 deletion src/data/queries/ibc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useInterchainLCDClient } from "./lcdClient"
import { useNetwork } from "data/wallet"
import axios from "axios"
import crypto from "crypto"
import { AccAddress } from "@terra-money/feather.js"

export const useIBCBaseDenom = (
denom: Denom,
Expand Down Expand Up @@ -111,7 +112,10 @@ export const useIBCBaseDenoms = (data: { denom: Denom; chainID: string }[]) => {
export function calculateIBCDenom(baseDenom: string, path: string) {
if (!path) return baseDenom

const assetString = [path, baseDenom].join("/")
const assetString = [
path,
AccAddress.validate(baseDenom) ? `cw20:${baseDenom}` : baseDenom,
].join("/")
const hash = crypto.createHash("sha256")
hash.update(assetString)
return `ibc/${hash.digest("hex").toUpperCase()}`
Expand Down

0 comments on commit efee91d

Please sign in to comment.