1
1
import { AssetAVAX , Client as AvaxClient , defaultAvaxParams } from '@xchainjs/xchain-avax'
2
- import { AssetBNB , Client as BnbClient } from '@xchainjs/xchain-binance'
2
+ import { AssetBNB , BNBChain , Client as BnbClient } from '@xchainjs/xchain-binance'
3
3
import {
4
4
AssetBTC ,
5
5
BTC_DECIMAL ,
@@ -143,6 +143,17 @@ describe('ThorchainAmm e2e tests', () => {
143
143
console . log ( errors )
144
144
} )
145
145
146
+ it ( `Should validate swap from synth BNB to BNB without errors` , async ( ) => {
147
+ const errors = await thorchainAmm . validateSwap ( {
148
+ fromAsset : assetFromStringEx ( 'BNB/BNB' ) ,
149
+ amount : new CryptoAmount ( assetToBase ( assetAmount ( '1' ) ) , assetFromStringEx ( 'BNB/BNB' ) ) ,
150
+ destinationAddress : await wallet . getAddress ( BNBChain ) ,
151
+ destinationAsset : assetFromStringEx ( 'BNB.BNB' ) ,
152
+ } )
153
+
154
+ console . log ( errors )
155
+ } )
156
+
146
157
it ( `Should validate swap from ATOM to synth ATOM with destination address error` , async ( ) => {
147
158
const errors = await thorchainAmm . validateSwap ( {
148
159
fromAsset : AssetATOM ,
@@ -200,6 +211,17 @@ describe('ThorchainAmm e2e tests', () => {
200
211
printQuoteSwap ( quoteSwap )
201
212
} )
202
213
214
+ it ( `Should estimate swap from synth BNB to BNB without errors` , async ( ) => {
215
+ const estimatedSwap = await thorchainAmm . estimateSwap ( {
216
+ fromAsset : assetFromStringEx ( 'BNB/BNB' ) ,
217
+ amount : new CryptoAmount ( assetToBase ( assetAmount ( '1' ) ) , assetFromStringEx ( 'BNB/BNB' ) ) ,
218
+ destinationAddress : await wallet . getAddress ( BNBChain ) ,
219
+ destinationAsset : assetFromStringEx ( 'BNB.BNB' ) ,
220
+ } )
221
+
222
+ printQuoteSwap ( estimatedSwap )
223
+ } )
224
+
203
225
it ( 'Should do non protocol asset swap. ATOM -> BNB' , async ( ) => {
204
226
const txSubmitted = await thorchainAmm . doSwap ( {
205
227
fromAsset : AssetATOM ,
@@ -222,6 +244,17 @@ describe('ThorchainAmm e2e tests', () => {
222
244
console . log ( txSubmitted )
223
245
} )
224
246
247
+ it ( `Should do swap from synth BNB to BNB without errors` , async ( ) => {
248
+ const txSubmitted = await thorchainAmm . doSwap ( {
249
+ fromAsset : assetFromStringEx ( 'BNB/BNB' ) ,
250
+ amount : new CryptoAmount ( assetToBase ( assetAmount ( '1' ) ) , assetFromStringEx ( 'BNB/BNB' ) ) ,
251
+ destinationAddress : await wallet . getAddress ( BNBChain ) ,
252
+ destinationAsset : assetFromStringEx ( 'BNB.BNB' ) ,
253
+ } )
254
+
255
+ console . log ( txSubmitted )
256
+ } )
257
+
225
258
it ( 'Should check if Thorchain router is allowed to spend' , async ( ) => {
226
259
const asset = assetFromStringEx ( 'AVAX.USDC-0XB97EF9EF8734C71904D8002F8B6BC66DD9C48A6E' )
227
260
0 commit comments