Return error if transaction not found
MODIFY
dist/index.d.ts
dist/index.d.ts
@@ -22,7 +22,7 @@ export default class Matic extends ContractsBase {
transferERC20Tokens(token: address, to: address, amount: BN | string, options?: SendOptions): Promise<any>;
transferERC721Tokens(token: address, to: address, tokenId: string, options?: SendOptions): Promise<any>;
depositEther(amount: BN | string, options?: SendOptions): Promise<any>;
- depositDataByHash(txHash: string): Promise<import("web3/types").TransactionReceipt | "Transaction hash is not Found" | "Deposit is not processed on Matic chain">;
+ depositDataByHash(txHash: string): Promise<import("web3/types").TransactionReceipt>;
approveERC20TokensForDeposit(token: address, amount: BN | string, options?: SendOptions): Promise<any>;
depositERC20ForUser(token: address, user: address, amount: BN | string, options?: SendOptions): Promise<any>;
safeDepositERC721Tokens(token: address, tokenId: BN, options?: SendOptions): Promise<any>;

MODIFY
src/index.ts
src/index.ts
@@ -128,7 +128,7 @@ export default class Matic extends ContractsBase {
const depositReceipt = await this.web3Client.parentWeb3.eth.getTransactionReceipt(txHash)
if (!depositReceipt) {
- return 'Transaction hash is not Found'
+ throw new Error('Transaction hash is not Found')
}
const newDepositEvent = depositReceipt.logs.find(
l => l.topics[0].toLowerCase() === DepositManager.NEW_DEPOSIT_EVENT_SIG
@@ -138,7 +138,7 @@ export default class Matic extends ContractsBase {
const depositId = parseInt(data.substring(data.length - 64), 16)
const depositExists = await this.depositManager.depositDataByID(depositId, this.childChainAddress)
if (!depositExists) {
- return 'Deposit is not processed on Matic chain'
+ throw new Error('Deposit is not processed on Matic chain')
}
return depositReceipt
}

Return error if transaction not found