Skip to content

Commit a488a23

Browse files
committed
cleanup
1 parent 0921f66 commit a488a23

File tree

1 file changed

+106
-111
lines changed

1 file changed

+106
-111
lines changed

ts-relayer-tests/src/ics721.spec.ts

Lines changed: 106 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -244,119 +244,114 @@ test.serial("transfer NFT: wasmd -> osmo", async (t) => {
244244
t.is(osmoAddr, tokenOwner.owner);
245245
});
246246

247-
test.serial.only(
248-
"transfer NFT with incoming proxy: osmo -> wasmd",
249-
async (t) => {
250-
await standardSetup(t);
251-
252-
const {
253-
wasmClient,
254-
wasmAddr,
255-
wasmIcs721,
256-
osmoClient,
257-
osmoAddr,
258-
osmoCw721,
259-
osmoIcs721,
260-
channel,
261-
otherChannel,
262-
} = t.context;
263-
264-
// test 1: transfer using WLed channel by incoming proxy
265-
let tokenId = "1";
266-
t.log(`transferring NFT #${tokenId} from osmo to wasmd chain`);
267-
await mint(osmoClient, osmoCw721, tokenId, osmoAddr, undefined);
268-
// assert token is minted
269-
let tokenOwner = await ownerOf(osmoClient, osmoCw721, tokenId);
270-
t.is(osmoAddr, tokenOwner.owner);
271-
272-
let ibcMsg = {
273-
receiver: wasmAddr,
274-
channel_id: channel.channel.dest.channelId,
275-
timeout: {
276-
block: {
277-
revision: 1,
278-
height: 90000,
279-
},
247+
test.serial("transfer NFT with incoming proxy: osmo -> wasmd", async (t) => {
248+
await standardSetup(t);
249+
250+
const {
251+
wasmClient,
252+
wasmAddr,
253+
wasmIcs721,
254+
osmoClient,
255+
osmoAddr,
256+
osmoCw721,
257+
osmoIcs721,
258+
channel,
259+
otherChannel,
260+
} = t.context;
261+
262+
// test 1: transfer using WLed channel by incoming proxy
263+
let tokenId = "1";
264+
t.log(`transferring NFT #${tokenId} from osmo to wasmd chain`);
265+
await mint(osmoClient, osmoCw721, tokenId, osmoAddr, undefined);
266+
// assert token is minted
267+
let tokenOwner = await ownerOf(osmoClient, osmoCw721, tokenId);
268+
t.is(osmoAddr, tokenOwner.owner);
269+
270+
let ibcMsg = {
271+
receiver: wasmAddr,
272+
channel_id: channel.channel.dest.channelId,
273+
timeout: {
274+
block: {
275+
revision: 1,
276+
height: 90000,
280277
},
281-
};
282-
283-
t.log(`transfering to wasm chain via ${channel.channel.dest.channelId}`);
284-
285-
let transferResponse = await sendNft(
286-
osmoClient,
287-
osmoCw721,
288-
osmoIcs721,
289-
ibcMsg,
290-
tokenId
291-
);
292-
t.truthy(transferResponse);
293-
294-
t.log("relaying packets");
295-
296-
let info = await channel.link.relayAll();
297-
298-
// Verify we got a success
299-
assertAckSuccess(info.acksFromA);
300-
301-
// assert NFT on chain A is locked/owned by ICS contract
302-
tokenOwner = await ownerOf(osmoClient, osmoCw721, tokenId);
303-
t.is(osmoIcs721, tokenOwner.owner);
304-
t.log(`NFT #${tokenId} locked by ICS721 contract`);
305-
306-
const wasmClassId = `${t.context.channel.channel.src.portId}/${t.context.channel.channel.src.channelId}/${t.context.osmoCw721}`;
307-
const wasmCw721 = await wasmClient.sign.queryContractSmart(wasmIcs721, {
308-
nft_contract: { class_id: wasmClassId },
309-
});
310-
311-
tokenOwner = await ownerOf(wasmClient, wasmCw721, tokenId);
312-
t.is(wasmAddr, tokenOwner.owner);
313-
t.log(`NFT #${tokenId} transferred to ${wasmAddr}`);
314-
315-
// test 2: transfer using WLed channel by incoming proxy
316-
tokenId = "2";
317-
t.log(`transferring NFT #${tokenId} from osmo to wasmd chain`);
318-
await mint(osmoClient, osmoCw721, tokenId, osmoAddr, undefined);
319-
// assert token is minted
320-
tokenOwner = await ownerOf(osmoClient, osmoCw721, tokenId);
321-
t.is(osmoAddr, tokenOwner.owner);
322-
323-
ibcMsg = {
324-
receiver: wasmAddr,
325-
channel_id: otherChannel.channel.dest.channelId,
326-
timeout: {
327-
block: {
328-
revision: 1,
329-
height: 90000,
330-
},
278+
},
279+
};
280+
281+
t.log(`transfering to wasm chain via ${channel.channel.dest.channelId}`);
282+
283+
let transferResponse = await sendNft(
284+
osmoClient,
285+
osmoCw721,
286+
osmoIcs721,
287+
ibcMsg,
288+
tokenId
289+
);
290+
t.truthy(transferResponse);
291+
292+
t.log("relaying packets");
293+
294+
let info = await channel.link.relayAll();
295+
296+
// Verify we got a success
297+
assertAckSuccess(info.acksFromA);
298+
299+
// assert NFT on chain A is locked/owned by ICS contract
300+
tokenOwner = await ownerOf(osmoClient, osmoCw721, tokenId);
301+
t.is(osmoIcs721, tokenOwner.owner);
302+
t.log(`NFT #${tokenId} locked by ICS721 contract`);
303+
304+
const wasmClassId = `${t.context.channel.channel.src.portId}/${t.context.channel.channel.src.channelId}/${t.context.osmoCw721}`;
305+
const wasmCw721 = await wasmClient.sign.queryContractSmart(wasmIcs721, {
306+
nft_contract: { class_id: wasmClassId },
307+
});
308+
309+
tokenOwner = await ownerOf(wasmClient, wasmCw721, tokenId);
310+
t.is(wasmAddr, tokenOwner.owner);
311+
t.log(`NFT #${tokenId} transferred to ${wasmAddr}`);
312+
313+
// test 2: transfer using WLed channel by incoming proxy
314+
tokenId = "2";
315+
t.log(`transferring NFT #${tokenId} from osmo to wasmd chain`);
316+
await mint(osmoClient, osmoCw721, tokenId, osmoAddr, undefined);
317+
// assert token is minted
318+
tokenOwner = await ownerOf(osmoClient, osmoCw721, tokenId);
319+
t.is(osmoAddr, tokenOwner.owner);
320+
321+
ibcMsg = {
322+
receiver: wasmAddr,
323+
channel_id: otherChannel.channel.dest.channelId,
324+
timeout: {
325+
block: {
326+
revision: 1,
327+
height: 90000,
331328
},
332-
};
333-
334-
t.log(
335-
`transfering to wasm chain via ${otherChannel.channel.dest.channelId}`
336-
);
337-
338-
transferResponse = await sendNft(
339-
osmoClient,
340-
osmoCw721,
341-
osmoIcs721,
342-
ibcMsg,
343-
tokenId
344-
);
345-
t.truthy(transferResponse);
346-
347-
t.log("relaying packets");
348-
349-
info = await otherChannel.link.relayAll();
350-
351-
// Verify we got a success
352-
assertAckErrors(info.acksFromA);
353-
354-
// assert NFT on chain A is returned to owner
355-
tokenOwner = await ownerOf(osmoClient, osmoCw721, tokenId);
356-
t.is(osmoClient.senderAddress, tokenOwner.owner);
357-
t.log(`NFT #${tokenId} returned to owner`);
358-
}
359-
);
329+
},
330+
};
331+
332+
t.log(`transfering to wasm chain via ${otherChannel.channel.dest.channelId}`);
333+
334+
transferResponse = await sendNft(
335+
osmoClient,
336+
osmoCw721,
337+
osmoIcs721,
338+
ibcMsg,
339+
tokenId
340+
);
341+
t.truthy(transferResponse);
342+
343+
t.log("relaying packets");
344+
345+
info = await otherChannel.link.relayAll();
346+
347+
// Verify we got a success
348+
assertAckErrors(info.acksFromA);
349+
350+
// assert NFT on chain A is returned to owner
351+
tokenOwner = await ownerOf(osmoClient, osmoCw721, tokenId);
352+
t.is(osmoClient.senderAddress, tokenOwner.owner);
353+
t.log(`NFT #${tokenId} returned to owner`);
354+
});
360355

361356
test.serial("malicious NFT", async (t) => {
362357
await standardSetup(t);

0 commit comments

Comments
 (0)