exit plasma tokens on the erc20
MODIFY
src/plasma/erc20.ts
src/plasma/erc20.ts
@@ -97,10 +97,14 @@ export class ERC20 extends BaseToken {
});
}
- withdrawChallenge(burnTxHash: string, option?: ITransactionOption) {
+ private withdrawChallenge_(burnTxHash: string, isFast: boolean, option: ITransactionOption) {
return Promise.all([
this.getPredicate(),
- this.contracts_.exitManager.buildPayloadForExit(burnTxHash, Log_Event_Signature.PlasmaErc20WithdrawEventSig, false)
+ this.contracts_.exitManager.buildPayloadForExit(
+ burnTxHash,
+ Log_Event_Signature.PlasmaErc20WithdrawEventSig,
+ isFast
+ )
]).then(result => {
const [predicate, payload] = result;
const method = predicate.method(
@@ -111,9 +115,18 @@ export class ERC20 extends BaseToken {
});
}
- withdrawExit(tokens: string | string[], option?: ITransactionOption) {
- return this.contracts_.withdrawManager.withdrawExit(tokens, option);
+ withdrawChallenge(burnTxHash: string, option?: ITransactionOption) {
+ return this.withdrawChallenge_(burnTxHash, false, option);
+ }
+
+ withdrawChallengeFaster(burnTxHash: string, option?: ITransactionOption) {
+ return this.withdrawChallenge_(burnTxHash, true, option);
}
+ withdrawExit(option?: ITransactionOption) {
+ return this.contracts_.withdrawManager.withdrawExit(
+ this.contractParam.address, option
+ );
+ }
}
\ No newline at end of file

MODIFY
src/plasma/index.ts
src/plasma/index.ts
import { ERC20 } from "./erc20";
import { ERC721 } from "./erc721";
import { Web3SideChainClient } from "../utils";
-import { IPlasmaClientConfig, IPlasmaContracts } from "../interfaces";
+import { IPlasmaClientConfig, IPlasmaContracts, ITransactionOption } from "../interfaces";
import { DepositManager } from "./deposit_manager";
import { LOGGER } from "../constant";
import { RegistryContract } from "./registry";
@@ -83,6 +83,17 @@ export class PlasmaClient {
client.config.depositManager
);
+ this.exitManager = new ExitManager(
+ client.child,
+ this.rootChain,
+ config.requestConcurrency
+ );
+
+ this.withdrawManager = new WithdrawManager(
+ client,
+ client.config.withdrawManager,
+ );
+
return this;
});
}
@@ -91,4 +102,10 @@ export class PlasmaClient {
return new Ether(isParent, this.client_, this.getContracts_());
}
+ withdrawExit(tokens: string | string[], option?: ITransactionOption) {
+ return this.withdrawManager.withdrawExit(
+ tokens, option
+ );
+ }
+
}

MODIFY
test/debug.js
test/debug.js
@@ -38,11 +38,13 @@ const execute = async () => {
// const balance = await mumbaiERC720Token.getBalance(from);
// return console.log("balance", balance);
- const tx = await goerliERC720Token.approve(10, from);
- // // const tx = await goerliERC720Token.withdrawExit('0x454f159823351b24ce0e675e7b308cc8c7ba39e175059a4d2b8f9507c17b5133');
- console.log("txHash", await tx.getTransactionHash());
- console.log("txReceipt", await tx.getReceipt());
+ // const tx = await goerliERC720Token.approve(10, from);
+ // const tx = await goerliERC720Token.withdrawChallenge('0x454f159823351b24ce0e675e7b308cc8c7ba39e175059a4d2b8f9507c17b5133');
+ // console.log("txHash", await tx.getTransactionHash());
+ // console.log("txReceipt", await tx.getReceipt());
+ //txhash to plasma exit - 0x63aa095e0d6ee8698399b871daa202eb5522933e2d94c5929cf0fb86b6b0c628
+ const tx = await goerliERC720Token.withdrawExit()
// const tx = await mumbaiERC720Token.withdrawStart(
// 10,
// {
@@ -51,8 +53,8 @@ const execute = async () => {
// // gas: 100
// }
// );
- // console.log("txHash", await tx.getTransactionHash());
- // console.log("txReceipt", await tx.getReceipt());
+ console.log("txHash", await tx.getTransactionHash());
+ console.log("txReceipt", await tx.getReceipt());
}
execute().then(_ => {

exit plasma tokens on the erc20