Skip to content

Commit

Permalink
fix(nats): Adds status checks for failed registration events
Browse files Browse the repository at this point in the history
Closes #72
  • Loading branch information
mango-habanero committed May 28, 2023
1 parent d94ee49 commit 2a115ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/custodail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export enum TxType {
export interface CustodialEvent {
block: number;
contractAddress: string;
success: boolean;
timestamp: number;
to: string;
transactionHash: string;
Expand All @@ -33,7 +34,6 @@ interface RegistrationResponse {

export interface TransferEvent extends CustodialEvent {
from: string;
success: boolean;
value: number;
}

Expand Down
5 changes: 5 additions & 0 deletions src/lib/nats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ async function processRegistrationEvent(
redis: RedisClient,
notifier?: Notifier
): Promise<void> {
if(!data.success){
logger.error(`Registration failed: ${data.transactionHash}`);
return;
}

const phoneNumber = await getPhoneNumberFromAddress(data.to, db, redis)
if (!phoneNumber) {
throw new SystemError(`Could not find phone number for address: ${data.to}`)
Expand Down

0 comments on commit 2a115ee

Please sign in to comment.