@@ -56,7 +56,9 @@ let channelId1 = "";
56
56
let channelId2 = "" ;
57
57
58
58
beforeAll ( async ( ) => {
59
- const linkPromise = createIbcConnection ( ) ;
59
+ const link = await createIbcConnection ( ) ;
60
+
61
+ await sleep ( 300 )
60
62
61
63
const mnemonics = [
62
64
"grant rice replace explain federal release fix clever romance raise often wild taxi quarter soccer fiber love must tape steak together observe swap guitar" ,
@@ -93,7 +95,7 @@ beforeAll(async () => {
93
95
walletAmino,
94
96
walletProto,
95
97
secretjs : new SecretNetworkClient ( {
96
- url : "http://localhost:3317 " ,
98
+ url : "http://localhost:2317 " ,
97
99
wallet : walletProto ,
98
100
walletAddress : walletProto . address ,
99
101
chainId : "secretdev-2" ,
@@ -102,7 +104,7 @@ beforeAll(async () => {
102
104
}
103
105
104
106
await waitForBlocks ( "secretdev-1" , "http://localhost:1317" ) ;
105
- await waitForBlocks ( "secretdev-2" , "http://localhost:3317 " ) ;
107
+ await waitForBlocks ( "secretdev-2" , "http://localhost:2317 " ) ;
106
108
107
109
contracts . snip20 . wasm = fs . readFileSync ( `${ __dirname } /snip20.wasm` ) as Uint8Array ;
108
110
contracts . ics20 . wasm = fs . readFileSync ( `${ __dirname } /../contract.wasm` ) as Uint8Array ;
@@ -129,13 +131,17 @@ beforeAll(async () => {
129
131
] ,
130
132
{ gasLimit : 5_000_000 }
131
133
) ;
134
+ await sleep ( 1000 ) ;
132
135
if ( tx . code !== TxResultCode . Success ) {
133
136
console . error ( tx . rawLog ) ;
134
137
}
135
138
expect ( tx . code ) . toBe ( TxResultCode . Success ) ;
136
139
140
+
137
141
contracts . snip20 . codeId = Number ( tx . arrayLog . find ( ( x ) => x . key === "code_id" ) . value ) ;
142
+ await sleep ( 1000 ) ;
138
143
contracts . ics20 . codeId = Number ( tx . arrayLog . reverse ( ) . find ( ( x ) => x . key === "code_id" ) . value ) ;
144
+ await sleep ( 1000 ) ;
139
145
140
146
console . log ( "Instantiating snip20 on secretdev-1..." ) ;
141
147
@@ -165,6 +171,8 @@ beforeAll(async () => {
165
171
{ gasLimit : 300_000 }
166
172
) ;
167
173
174
+ await sleep ( 1000 ) ;
175
+
168
176
contracts . snip20 . address = MsgInstantiateContractResponse . decode ( tx . data [ 0 ] ) . address ;
169
177
contracts . snip20 . ibcPortId = "wasm." + contracts . snip20 . address ;
170
178
@@ -196,8 +204,12 @@ beforeAll(async () => {
196
204
contracts . ics20 . address = MsgInstantiateContractResponse . decode ( tx . data [ 0 ] ) . address ;
197
205
contracts . ics20 . ibcPortId = "wasm." + contracts . ics20 . address ;
198
206
207
+ await sleep ( 1000 ) ;
208
+
199
209
console . log ( "Waiting for IBC connection..." ) ;
200
- const link = await linkPromise ;
210
+ // const link = await createIbcConnection();
211
+
212
+ await sleep ( 1000 ) ;
201
213
202
214
console . log ( "Creating IBC channel..." ) ;
203
215
const channels = await createIbcChannel ( link , contracts . ics20 . ibcPortId ) ;
@@ -215,6 +227,7 @@ test(
215
227
// register snip20 on ics20, then send tokens from secretdev-1
216
228
console . log ( "Sending tokens from secretdev-1..." ) ;
217
229
230
+ const memo1 = "test memo from secretdev-1" ;
218
231
let tx = await accounts1 [ 0 ] . secretjs . tx . broadcast (
219
232
[
220
233
new MsgExecuteContract ( {
@@ -245,7 +258,9 @@ test(
245
258
} )
246
259
)
247
260
) ,
261
+ memo : memo1 ,
248
262
} ,
263
+ // memo: "test2 memo from secretdev-1",
249
264
} ,
250
265
} ) ,
251
266
] ,
@@ -258,6 +273,10 @@ test(
258
273
}
259
274
expect ( tx . code ) . toBe ( TxResultCode . Success ) ;
260
275
276
+ let res = tx . arrayLog . find ( element => element . key === 'memo' ) ;
277
+ let receivedMemo = res ? res . value : undefined ;
278
+ expect ( receivedMemo ) . toBe ( memo1 ) ;
279
+
261
280
let snip20Balance : any = await accounts1 [ 0 ] . secretjs . query . compute . queryContract ( {
262
281
contract_address : contracts . snip20 . address ,
263
282
code_hash : contracts . snip20 . code_hash ,
@@ -304,7 +323,7 @@ test(
304
323
} ,
305
324
receiver : accounts1 [ 0 ] . address ,
306
325
timeout_timestamp : String ( Math . floor ( Date . now ( ) / 1000 ) + 10 * 60 ) /* 10 minutes */ ,
307
- memo : "memo"
326
+ memo : "test memo from secretdev-2 "
308
327
} ) ;
309
328
310
329
if ( tx . code !== TxResultCode . Success ) {
0 commit comments