Skip to content

Commit 86658ff

Browse files
authored
Use new CW20 quote token prediction endpoint (#3700)
- **feat(typescript-sdk): log basetoken for holesky -> sepolia** - **feat(typescript-sdk): fetch cw20 quotetokens on cosmos**
2 parents 26ce5a6 + f574a76 commit 86658ff

File tree

4 files changed

+38
-31
lines changed

4 files changed

+38
-31
lines changed

typescript-sdk/playground/holesky-to-sepolia.ts

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ if (channel === null) {
3535

3636
consola.info("channel", channel)
3737

38+
consola.info("base token", BASE_TOKEN)
39+
3840
const quoteToken = await getQuoteToken(SOURCE_CHAIN_ID, BASE_TOKEN, channel)
3941

4042
if (quoteToken.isErr()) {

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

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { fromHex, http } from "viem"
1+
import { fromHex, http, toHex } from "viem"
22
import { parseArgs } from "node:util"
33
import { consola } from "scripts/logger"
44
import { createUnionClient, hexToBytes } from "#mod.ts"
@@ -36,12 +36,14 @@ const cliArgs = parseArgs({
3636
})
3737

3838
const PRIVATE_KEY = cliArgs.values["private-key"]
39-
const STARS_DENOM = "muno"
40-
const AMOUNT = 1n
41-
const RECEIVER = "0xE6831e169d77a861A0E71326AFA6d80bCC8Bc6aA"
39+
const MUNO_DENOM = "muno"
40+
const AMOUNT = 12n
41+
const RECEIVER = toHex("bbn1xe0rnlh3u05qkwytkwmyzl86a0mvpwfxgf2t7u")
4242
const SOURCE_CHAIN_ID = "union-testnet-9"
4343
const DESTINATION_CHAIN_ID = "bbn-test-5"
4444

45+
const baseToken = toHex(MUNO_DENOM)
46+
4547
const channels = await getRecommendedChannels()
4648

4749
const channel = getChannelInfo(SOURCE_CHAIN_ID, DESTINATION_CHAIN_ID, channels)
@@ -52,7 +54,9 @@ if (channel === null) {
5254

5355
consola.info("channel", channel)
5456

55-
const quoteToken = await getQuoteToken(SOURCE_CHAIN_ID, STARS_DENOM, channel)
57+
consola.info("base token", baseToken)
58+
59+
const quoteToken = await getQuoteToken(SOURCE_CHAIN_ID, baseToken, channel)
5660
if (quoteToken.isErr()) {
5761
consola.info("could not get quote token")
5862
consola.error(quoteToken.error)
@@ -78,7 +82,7 @@ const unionClient = createUnionClient({
7882
})
7983

8084
const transfer = await unionClient.transferAsset({
81-
baseToken: STARS_DENOM,
85+
baseToken: MUNO_DENOM,
8286
baseAmount: AMOUNT,
8387
quoteToken: quoteToken.value.quote_token,
8488
quoteAmount: AMOUNT,

0 commit comments

Comments
 (0)