1
1
import anyTest from '@endo/ses-ava/prepare-endo.js' ;
2
2
import type { TestFn } from 'ava' ;
3
- import { makeDoOffer } from '../../tools/e2e-tools.js' ;
4
- import {
5
- commonSetup ,
6
- type SetupContextWithWallets ,
7
- } from '../support.js' ;
8
3
import { AmountMath } from '@agoric/ertp' ;
4
+ import { makeDoOffer } from '../../tools/e2e-tools.js' ;
5
+ import { commonSetup , type SetupContextWithWallets } from '../support.js' ;
9
6
import { makeQueryClient } from '../../tools/query.js' ;
7
+ import starshipChainInfo from '../../starship-chain-info.js' ;
10
8
11
9
const test = anyTest as TestFn < SetupContextWithWallets > ;
12
10
@@ -43,11 +41,11 @@ test('BLD for OSMO, receiver on Agoric', async t => {
43
41
} ) ;
44
42
t . log ( `Provisioned Agoric smart wallet for ${ agoricAddr } ` ) ;
45
43
46
- // const osmosisChainId = useChain('osmosis').chain.chain_id;
44
+ const osmosisChainId = useChain ( 'osmosis' ) . chain . chain_id ;
47
45
48
- // const {
49
- // transferChannel: { counterPartyChannelId, channelId },
50
- // } = starshipChainInfo.agoric.connections[osmosisChainId];
46
+ const {
47
+ transferChannel : { channelId } ,
48
+ } = starshipChainInfo . agoric . connections [ osmosisChainId ] ;
51
49
52
50
const doOffer = makeDoOffer ( wdUser ) ;
53
51
@@ -72,7 +70,9 @@ test('BLD for OSMO, receiver on Agoric', async t => {
72
70
callPipe : [ [ 'makeSendInvitation' ] ] ,
73
71
} ,
74
72
offerArgs : {
75
- destAddr : 'osmo1ufs3tlq4umljk0qfe8k5ya0x6hpavn897u2cnf9k0en9jr7qarqq7fzxcr' ,
73
+ // TODO: get the contract address dynamically
74
+ destAddr :
75
+ 'osmo17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgs5yczr8' ,
76
76
receiverAddr : wallets . agoricReceiver ,
77
77
outDenom : 'uosmo' ,
78
78
slippage : { slippagePercentage : '20' , windowSeconds : 10 } ,
@@ -81,14 +81,26 @@ test('BLD for OSMO, receiver on Agoric', async t => {
81
81
proposal : { give : { Send : swapInAmount } } ,
82
82
} ) ;
83
83
84
- const agoricReceiverBalance = await retryUntilCondition (
84
+ const { balances : agoricReceiverBalances } = await retryUntilCondition (
85
85
( ) => queryClient . queryBalances ( wallets . agoricReceiver ) ,
86
86
( { balances } ) => balances . length > balancesBefore . length ,
87
87
'Deposit reflected in localOrchAccount balance' ,
88
88
) ;
89
- t . log ( agoricReceiverBalance ) ;
89
+ t . log ( agoricReceiverBalances ) ;
90
90
91
- t . pass ( ) ;
91
+ const { hash : expectedHash } = await queryClient . queryDenom (
92
+ `transfer/${ channelId } ` ,
93
+ 'uosmo' ,
94
+ ) ;
95
+
96
+ t . log ( 'Expected denom hash:' , expectedHash ) ;
97
+
98
+ t . regex ( agoricReceiverBalances [ 0 ] ?. denom , / ^ i b c / ) ;
99
+ t . is (
100
+ agoricReceiverBalances [ 0 ] ?. denom . split ( 'ibc/' ) [ 1 ] ,
101
+ expectedHash ,
102
+ 'got expected ibc denom hash' ,
103
+ ) ;
92
104
} ) ;
93
105
94
106
test . after ( async t => {
0 commit comments