Skip to content

Commit 40f5c44

Browse files
committed
Add a test case for getting WCCC tx by tracker
The added test case succeeds on this branch but fails on current master branch because current master doesn't store WrapCCC tracker in body_db and invoice_db.
1 parent 76ab889 commit 40f5c44

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/src/e2e/wrap.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,36 @@ describe("WrapCCC", function() {
198198
).to.be.rejected;
199199
}).timeout(30_000);
200200

201+
it("WCCC tracker should return the corresponding transaction", async function() {
202+
const wrapCCC = node.sdk.core.createWrapCCCTransaction({
203+
shardId: 0,
204+
recipient: await node.createP2PKHBurnAddress(),
205+
quantity: 30,
206+
payer: PlatformAddress.fromAccountId(faucetAccointId, {
207+
networkId: "tc"
208+
})
209+
});
210+
const seq = (await node.sdk.rpc.chain.getSeq(faucetAddress))!;
211+
expect(seq).not.to.be.null;
212+
const signedWrapCCC = wrapCCC.sign({
213+
secret: faucetSecret,
214+
seq,
215+
fee: 10
216+
});
217+
218+
const hash = await node.sdk.rpc.chain.sendSignedTransaction(
219+
signedWrapCCC
220+
);
221+
const tracker = wrapCCC.tracker();
222+
223+
expect(await node.sdk.rpc.chain.containsTransaction(hash)).be.true;
224+
expect(await node.sdk.rpc.chain.getTransactionByTracker(tracker)).not
225+
.null;
226+
expect(
227+
await node.sdk.rpc.chain.getTransactionResultsByTracker(tracker)
228+
).deep.equal([true]);
229+
});
230+
201231
afterEach(async function() {
202232
await node.clean();
203233
});

0 commit comments

Comments
 (0)