Skip to content

Commit 2afb7a1

Browse files
committed
fix(typescript-sdk): submitting cw20 wrapped tokens
1 parent e26d57f commit 2afb7a1

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

typescript-sdk/playground/union-to-babylon.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const cliArgs = parseArgs({
3838

3939
const PRIVATE_KEY = cliArgs.values["private-key"]
4040
const MUNO_DENOM = "muno"
41-
const AMOUNT = 1n
41+
const AMOUNT = 12n
4242
const RECEIVER = toHex("bbn1xe0rnlh3u05qkwytkwmyzl86a0mvpwfxgf2t7u")
4343
const SOURCE_CHAIN_ID = "union-testnet-9"
4444
const DESTINATION_CHAIN_ID = "bbn-test-5"
@@ -56,6 +56,7 @@ if (channel === null) {
5656
consola.info("channel", channel)
5757

5858
consola.info("base token", baseToken)
59+
5960
const quoteToken = await getQuoteToken(SOURCE_CHAIN_ID, baseToken, channel)
6061
if (quoteToken.isErr()) {
6162
consola.info("could not get quote token")

typescript-sdk/src/query/offchain/ucs03-channels.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,12 @@ export const getQuoteToken = async (
108108

109109
let client = publicClient.value
110110

111-
let baseToken = isAddress(base_token) ? base_token : toHex(base_token)
112-
113111
let predictedQuoteToken = await ResultAsync.fromPromise(
114112
client.queryContractSmart(fromHex(`0x${channel.destination_port_id}`, "string"), {
115113
predict_wrapped_token: {
116114
path: "0",
117115
channel: channel.destination_channel_id,
118-
token: baseToken
116+
token: base_token
119117
}
120118
}),
121119
error => {
@@ -143,14 +141,13 @@ export const getQuoteToken = async (
143141

144142
// We need to predict the askToken denom based on the sentToken (denomAddress in the transferAssetFromEvm args)
145143
// we do this by calling the ucs03 instance on the counterparty chain.
146-
let baseToken = isAddress(base_token) ? base_token : toHex(base_token)
147144

148145
const predictedQuoteToken = await ResultAsync.fromPromise(
149146
destinationChainClient.readContract({
150147
address: `0x${channel.destination_port_id}`,
151148
abi: ucs03ZkgmAbi,
152149
functionName: "predictWrappedToken",
153-
args: [0, channel.destination_channel_id, baseToken]
150+
args: [0, channel.destination_channel_id, base_token]
154151
}),
155152
error => {
156153
return new Error("failed to get predict token using evm call", { cause: error })

0 commit comments

Comments
 (0)