add erc721 read test
MODIFY
src/pos/index.ts
src/pos/index.ts
@@ -14,11 +14,8 @@ export * from "./root_chain";
export class POSClient extends BridgeClient {
rootChainManager: RootChainManager;
- rootChain: RootChain;
private client_: Web3SideChainClient<IPOSClientConfig>;
-
-
constructor(config: IPOSClientConfig) {
super();
this.client_ = new Web3SideChainClient(config);
@@ -44,14 +41,14 @@ export class POSClient extends BridgeClient {
config.rootChainManager,
);
- this.rootChain = new RootChain(
+ const rootChain = new RootChain(
this.client_,
config.rootChain,
);
this.exitUtil = new ExitUtil(
this.client_.child,
- this.rootChain,
+ rootChain,
config.requestConcurrency
);

MODIFY
test/debug.js
test/debug.js
@@ -8,8 +8,8 @@ const from = user1.address;
const execute = async () => {
const privateKey = user1.privateKey;
- const mumbaiERC720 = pos.child.erc721;
- const goerliERC720 = pos.parent.erc721;
+ const mumbaiERC20 = pos.child.erc20;
+ const goerliERC20 = pos.parent.erc20;
const client = new POSClient({
log: true,
@@ -33,10 +33,10 @@ const execute = async () => {
await client.init();
console.log("init called");
- // const mumbaiERC720Token = client.erc721('0x33fc58f12a56280503b04ac7911d1eceebce179c');
- const goerliERC20Token = client.erc20(pos.parent.erc20, true);
+ const mumbaiERC720Token = client.erc20(mumbaiERC20);
+ const goerliERC20Token = client.erc20(goerliERC20, true);
- return console.log(await goerliERC20Token.getAllowance(from));
+ // return console.log(await goerliERC20Token.getAllowance(from));
// const balance = await mumbaiERC720Token.getBalance(
@@ -50,9 +50,9 @@ const execute = async () => {
// return console.log("tokens", tokens);
// const tx = await goerliERC720Token.safeDeposit(104, from);
- // // const tx = await goerliERC720Token.withdrawChallenge('0x454f159823351b24ce0e675e7b308cc8c7ba39e175059a4d2b8f9507c17b5133');
- // console.log("txHash", await tx.getTransactionHash());
- // console.log("txReceipt", await tx.getReceipt());
+ const tx = await mumbaiERC720Token.withdrawStart(10);
+ console.log("txHash", await tx.getTransactionHash());
+ console.log("txReceipt", await tx.getReceipt());
//txhash to plasma exit - 0x63aa095e0d6ee8698399b871daa202eb5522933e2d94c5929cf0fb86b6b0c628
const tokenId = '60399350241383852757821046101235634991156913804166740995010931519407953501076'

MODIFY
test/specs/client.ts
test/specs/client.ts
@@ -8,6 +8,10 @@ export const erc20 = {
parent: pos.parent.erc20,
child: pos.child.erc20
}
+export const erc721 = {
+ parent: pos.parent.erc721,
+ child: pos.child.erc721
+}
export const posClient = new POSClient({
log: true,

MODIFY
test/specs/erc20.spec.ts
test/specs/erc20.spec.ts
@@ -30,4 +30,14 @@ describe('ERC20', () => {
expect(allowance).to.be.an('string');
expect(Number(allowance)).gte(0);
})
+
+ it('is check pointed', async () => {
+ const isCheckPointed = await posClient.isCheckPointed('0xd6f7f4c6052611761946519076de28fbd091693af974e7d4abc1b17fd7926fd7');
+ expect(isCheckPointed).to.be.an('boolean').equal(true);
+ })
+
+ // it('isWithdrawExited', async () => {
+ // const isExited = await erc20Parent.isWithdrawExited('0xd6f7f4c6052611761946519076de28fbd091693af974e7d4abc1b17fd7926fd7');
+ // expect(isExited).to.be.an('boolean').equal(true);
+ // })
});
\ No newline at end of file

ADD
test/specs/erc721.spec.ts
+import { erc721, from, posClient } from "./client";
+import { expect } from 'chai'
+
+
+describe('ERC721', () => {
+
+ let erc721Child = posClient.erc721(erc721.child);
+ let erc721Parent = posClient.erc721(erc721.parent, true);
+
+ before(() => {
+ return posClient.init();
+ });
+
+ it('getTokensCounts child', async () => {
+ const tokensCount = await erc721Child.getTokensCount(from);
+ console.log('tokensCount', tokensCount);
+ expect(tokensCount).to.be.an('string');
+ expect(Number(tokensCount)).gte(0);
+ })
+
+ it('getTokensCount parent', async () => {
+ const tokensCount = await erc721Parent.getTokensCount(from);
+ console.log('tokensCount', tokensCount);
+ expect(tokensCount).to.be.an('string');
+ expect(Number(tokensCount)).gte(0);
+ })
+
+ it('getAllTokens child', async () => {
+ const tokensCount = await erc721Child.getTokensCount(from);
+ const allTokens = await erc721Child.getAllTokens(from);
+ expect(allTokens).to.be.an('array').length(tokensCount);
+ })
+
+ it('getAllTokens parent', async () => {
+ const tokensCount = await erc721Parent.getTokensCount(from);
+ const allTokens = await erc721Parent.getAllTokens(from);
+ expect(allTokens).to.be.an('array').length(tokensCount);
+ })
+});
\ No newline at end of file

MODIFY
test/specs/index.ts
test/specs/index.ts
@@ -5,4 +5,5 @@ use(Web3ClientPlugin);
import './map_promise.spec'
import './erc20.spec'
+import './erc721.spec'
// import './pos_bridge'

add erc721 read test