implement withdrawExitFasterWithMetaData
MODIFY
src/pos/erc721.ts
src/pos/erc721.ts
@@ -247,9 +247,8 @@ export class ERC721 extends POSToken {
});
}
- withdrawExitWithMetadata(burnTransactionHash: string, option?: ITransactionOption) {
- this.checkForRoot("withdrawExitWithMetadata");
-
+ withdrawExitWithMetaData(burnTransactionHash: string, option?: ITransactionOption) {
+ this.checkForRoot("withdrawExitWithMetaData");
return this.exitUtil.buildPayloadForExit(
burnTransactionHash,
@@ -307,13 +306,27 @@ export class ERC721 extends POSToken {
});
}
+ withdrawExitFasterWithMetaData(burnTransactionHash: string, option?: ITransactionOption) {
+ this.checkForRoot("withdrawExitFasterWithMetaData");
+
+ return this.exitUtil.buildPayloadForExit(
+ burnTransactionHash,
+ Log_Event_Signature.Erc721TransferWithMetadata,
+ true
+ ).then(payload => {
+ return this.rootChainManager.exit(
+ payload, option
+ );
+ });
+ }
+
isWithdrawExited(txHash: string) {
return this.isWithdrawn(
txHash, Log_Event_Signature.Erc721Transfer
);
}
- isWithdrawWithMetadaExited(txHash: string) {
+ isWithdrawWithMetaDataExited(txHash: string) {
return this.isWithdrawn(
txHash, Log_Event_Signature.Erc721TransferWithMetadata
);

MODIFY
test/specs/erc721.spec.ts
test/specs/erc721.spec.ts
@@ -47,6 +47,12 @@ describe('ERC721', () => {
expect(isExited).equal(true);
})
+ // it('isDeposited for deposit many', async () => {
+ // const depositTxhash = '0x2ae0f5073e0c0f96f622268ef8bc61ecec7349ffc97c61412e4f5cc157cb418e';
+ // const isExited = await erc721Parent.isDeposited(depositTxhash);
+ // expect(isExited).equal(true);
+ // })
+
it('transfer return tx', async () => {
const allTokensFrom = await erc721Child.getAllTokens(from);
const targetToken = allTokensFrom[0];
@@ -109,6 +115,20 @@ describe('ERC721', () => {
expect(result['to'].toLowerCase()).equal(erc721.child.toLowerCase());
})
+ it('iswithdrawExitWithMetaData return tx', async () => {
+ const txHash = `0x0600732ea675d8e63a4fed0a267a261a9e0d1728e805fda4884adb7c75454e7b`
+ const result = await erc721Child.isWithdrawWithMetaDataExited(txHash);
+ expect(result).equal(false);
+ })
+
+ it('withdrawExitWithMetaData return tx', async () => {
+ const txHash = `0x0600732ea675d8e63a4fed0a267a261a9e0d1728e805fda4884adb7c75454e7b`
+ const result = await erc721Child.withdrawExitWithMetaData(txHash, {
+ returnTransaction: true
+ });
+ expect(result['to'].toLowerCase()).equal(erc721.child.toLowerCase());
+ })
+
it('transfer write', async () => {
const allTokensFrom = await erc721Child.getAllTokens(from);
// console.log('allTokensFrom', allTokensFrom);

implement withdrawExitFasterWithMetaData