new: methods to check if exit is processed
MODIFY
src/index.ts
src/index.ts
@@ -86,6 +86,13 @@ export class MaticPOSClient extends SDKClient {
}
}
+ isERC20ExitProcessed(txHash: string) {
+ if (!txHash) {
+ throw new Error(`txHash not provided`)
+ }
+ return this.posRootChainManager.isERC20ExitProcessed(txHash)
+ }
+
approveERC721ForDeposit(rootToken: address, tokenId: BN | string, options?: SendOptions) {
if (options && (!options.from || !tokenId || !rootToken)) {
throw new Error('options.from, rootToken or tokenId is missing')
@@ -149,6 +156,13 @@ export class MaticPOSClient extends SDKClient {
}
}
+ isERC721ExitProcessed(txHash: string) {
+ if (!txHash) {
+ throw new Error(`txHash not provided`)
+ }
+ return this.posRootChainManager.isERC721ExitProcessed(txHash)
+ }
+
approveERC1155ForDeposit(rootToken: address, options?: SendOptions) {
if (options && (!options.from || !rootToken)) {
throw new Error('options.from or rootToken is missing')
@@ -220,6 +234,13 @@ export class MaticPOSClient extends SDKClient {
return this.posRootChainManager.exitSingleERC1155(txHash, options)
}
+ isSingleERC1155ExitProcessed(txHash: string) {
+ if (!txHash) {
+ throw new Error(`txHash not provided`)
+ }
+ return this.posRootChainManager.isSingleERC1155ExitProcessed(txHash)
+ }
+
exitBatchERC1155(txHash: string, options?: SendOptions) {
if (!txHash) {
throw new Error(`txHash not provided`)
@@ -229,6 +250,13 @@ export class MaticPOSClient extends SDKClient {
}
return this.posRootChainManager.exitBatchERC1155(txHash, options)
}
+
+ isBatchERC1155ExitProcessed(txHash: string) {
+ if (!txHash) {
+ throw new Error(`txHash not provided`)
+ }
+ return this.posRootChainManager.isBatchERC1155ExitProcessed(txHash)
+ }
}
export default class Matic extends SDKClient {

MODIFY
src/root/POSRootChainManager.ts
src/root/POSRootChainManager.ts
@@ -87,6 +87,11 @@ export default class POSRootChainManager extends ContractsBase {
return this.web3Client.send(txObject, web3Options, options)
}
+ async isExitProcessed(burnTxHash: string, logSignature: string) {
+ const exitHash = await this.exitManager.getExitHash(burnTxHash, logSignature)
+ return this.posRootChainManager.methods.processedExits(exitHash).call()
+ }
+
async approveERC20(rootToken: address, amount: BN | string, options?: SendOptions) {
if (!this.erc20Predicate) {
throw new Error('posERC20Predicate address not found. Set it while constructing MaticPOSClient.')
@@ -151,6 +156,10 @@ export default class POSRootChainManager extends ContractsBase {
return this.exitHermoine(burnTxHash, ERC20_TRANSFER_EVENT_SIG, options)
}
+ async isERC20ExitProcessed(burnTxHash: string) {
+ return this.isExitProcessed(burnTxHash, ERC20_TRANSFER_EVENT_SIG)
+ }
+
async approveERC721(rootToken: address, tokenId: BN | string, options?: SendOptions) {
if (!this.erc721Predicate) {
throw new Error('posERC721Predicate address not found. Set it while constructing MaticPOSClient.')
@@ -226,6 +235,10 @@ export default class POSRootChainManager extends ContractsBase {
return this.exitHermoine(burnTxHash, ERC721_TRANSFER_EVENT_SIG, options)
}
+ async isERC721ExitProcessed(burnTxHash: string) {
+ return this.isExitProcessed(burnTxHash, ERC721_TRANSFER_EVENT_SIG)
+ }
+
async approveERC1155(rootToken: address, options?: SendOptions) {
if (!this.erc1155Predicate) {
throw new Error('posERC1155Predicate address not found. Set it while constructing MaticPOSClient.')
@@ -303,7 +316,15 @@ export default class POSRootChainManager extends ContractsBase {
return this.exit(burnTxHash, ERC1155_TRANSFER_SINGLE_EVENT_SIG, options)
}
+ async isSingleERC1155ExitProcessed(burnTxHash: string) {
+ return this.isExitProcessed(burnTxHash, ERC1155_TRANSFER_SINGLE_EVENT_SIG)
+ }
+
async exitBatchERC1155(burnTxHash: string, options?: SendOptions) {
return this.exit(burnTxHash, ERC1155_TRANSFER_BATCH_EVENT_SIG, options)
}
+
+ async isBatchERC1155ExitProcessed(burnTxHash: string) {
+ return this.isExitProcessed(burnTxHash, ERC1155_TRANSFER_BATCH_EVENT_SIG)
+ }
}

new: methods to check if exit is processed