Skip to content

Commit

Permalink
Merge pull request #1300 from xchainjs/do-swap-example
Browse files Browse the repository at this point in the history
DoSwap example bug fix
  • Loading branch information
0xp3gasus authored Oct 14, 2024
2 parents 4df7cf9 + b093235 commit 74292f0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/friendly-falcons-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'xchainjs-do-swap': patch
---

Bug fix with toChain
3 changes: 2 additions & 1 deletion examples/do-swap/doStreamingSwap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
assetToString,
delay,
isSynthAsset,
isTradeAsset,
register9Rheader,
} from '@xchainjs/xchain-util'
import { Wallet } from '@xchainjs/xchain-wallet'
Expand Down Expand Up @@ -81,7 +82,7 @@ const doStreamingSwap = async (tcAmm: ThorchainAMM, wallet: Wallet) => {
const streamingInterval = Number(process.argv[8])
const streamingQuantity = Number(process.argv[9])

const toChain = isSynthAsset(toAsset) ? THORChain : toAsset.chain
const toChain = isSynthAsset(toAsset) || isTradeAsset(toAsset) ? THORChain : toAsset.chain

const swapParams: QuoteSwapParams = {
fromAddress: await wallet.getAddress(fromAsset.chain),
Expand Down
3 changes: 2 additions & 1 deletion examples/do-swap/doSwap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
assetToString,
delay,
isSynthAsset,
isTradeAsset,
register9Rheader,
} from '@xchainjs/xchain-util'
import { Wallet } from '@xchainjs/xchain-wallet'
Expand Down Expand Up @@ -82,7 +83,7 @@ const doSingleSwap = async (tcAmm: ThorchainAMM, wallet: Wallet) => {
const fromAsset = assetFromString(`${process.argv[6]}`)
const toAsset = assetFromString(`${process.argv[7]}`)

const toChain = isSynthAsset(toAsset) ? THORChain : toAsset.chain
const toChain = isSynthAsset(toAsset) || isTradeAsset(toAsset) ? THORChain : toAsset.chain

const swapParams: QuoteSwapParams = {
fromAsset,
Expand Down

0 comments on commit 74292f0

Please sign in to comment.