From efb016c7b200d0126e7ca8b3acc09967c5555440 Mon Sep 17 00:00:00 2001 From: Francisco Tobar Date: Wed, 24 Jan 2024 06:15:52 -0600 Subject: [PATCH] refactor: test --- src/RelayServer.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/RelayServer.ts b/src/RelayServer.ts index 127965b..0dceabc 100644 --- a/src/RelayServer.ts +++ b/src/RelayServer.ts @@ -341,7 +341,7 @@ export class RelayServer extends EventEmitter { tokenContract != constants.AddressZero ) { verifierContract = IDeployVerifier__factory.connect(verifier, provider); - } else { + } else if (!isDeployTransaction(envelopingTransaction)) { verifierContract = IRelayVerifier__factory.connect(verifier, provider); } } catch (e) { @@ -361,23 +361,26 @@ export class RelayServer extends EventEmitter { try { let verifyMethod: PopulatedTransaction; - if (isDeployTransaction(envelopingTransaction)) { + if ( + isDeployTransaction(envelopingTransaction) && + tokenContract != constants.AddressZero + ) { verifyMethod = await ( - verifierContract as IDeployVerifier + verifierContract! as IDeployVerifier ).populateTransaction.verifyRelayedCall( envelopingTransaction.relayRequest, envelopingTransaction.metadata.signature, { from: this.workerAddress } ); - } else { + } else if (!isDeployTransaction(envelopingTransaction)) { verifyMethod = await ( - verifierContract as IRelayVerifier + verifierContract! as IRelayVerifier ).populateTransaction.verifyRelayedCall( envelopingTransaction.relayRequest as RelayRequest, envelopingTransaction.metadata.signature ); } - await provider.call(verifyMethod, 'pending'); + await provider.call(verifyMethod!, 'pending'); } catch (e) { const error = e as Error; throw new Error(`Verification by verifier failed: ${error.message}`);