Update erc721 batchExit example
MODIFY
examples/pos/erc721/withdraw_exit_many.js
examples/pos/erc721/withdraw_exit_many.js
-const { pos } = require('../../config');
-const { getPOSClient, from } = require('../../utils');
+const { pos } = require('../../config')
+const { getPOSClient, from } = require('../../utils')
const execute = async () => {
- const client = await getPOSClient();
- const erc721Token = client.erc721(pos.parent.erc721, true);
-
- const result = await erc721Token.withdrawExitMany('0x54f47c891b460369661e22e27eeb4afbbb5dd792c7c8b48cab758892c14ffe85');
-
- const txHash = await result.getTransactionHash();
- console.log("txHash", txHash);
- const receipt = await result.getReceipt();
- console.log("receipt", receipt);
+ const client = await getPOSClient()
+ const erc721Token = client.erc721(pos.parent.erc721, true)
+ const result = await erc721Token.withdrawExitMany(
+ '0x54f47c891b460369661e22e27eeb4afbbb5dd792c7c8b48cab758892c14ffe85'
+ )
+ for (tx of result) {
+ const txHash = await tx.getTransactionHash()
+ console.log('txHash', txHash)
+ const receipt = await tx.getReceipt()
+ console.log('receipt', receipt)
}
-execute().then(() => {
-}).catch(err => {
- console.error("err", err);
-}).finally(_ => {
- process.exit(0);
+}
+execute()
+ .then(() => {})
+ .catch(err => {
+ console.error('err', err)
+ })
+ .finally(_ => {
+ process.exit(0)
})

MODIFY
src/pos/erc721.ts
src/pos/erc721.ts
@@ -250,17 +250,15 @@ export class ERC721 extends POSToken {
withdrawExitMany(burnTransactionHash: string, option?: ITransactionOption) {
this.checkForRoot("withdrawExitMany");
-
return this.exitUtil.buildMultiplePayloadsForExit(
burnTransactionHash,
Log_Event_Signature.Erc721BatchTransfer,
false
).then(payloads => {
- for (const payload of payloads) {
- this.rootChainManager.exit(
+ return payloads.map(payload => this.rootChainManager.exit(
payload, option
+ )
);
- }
});
}

MODIFY
src/pos/exit_util.ts
src/pos/exit_util.ts
@@ -346,7 +346,7 @@ export class ExitUtil {
const logIndices = this.getAllLogIndices_(
logEventSig, receipt
);
- const payloads = [];
+ const payloads:string[] = [];
// step 6 - encode payloads, convert into hex
for (const logIndex of logIndices){

Update erc721 batchExit example