Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redeem widget #216

Merged
merged 8 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions web-portal/backend/src/utils/utils.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Injectable, Inject, HttpException, HttpStatus } from '@nestjs/common';
import { CustomPrismaService } from 'nestjs-prisma';
import { PrismaClient, TransactionType } from '@/.generated/client';
import { Cron, CronExpression } from '@nestjs/schedule';
import { Log, parseAbiItem } from 'viem';
import { Log, parseAbiItem, fromHex } from 'viem';
import { viemClient } from './viemClient';
import web3 from 'web3';


interface IParsedLog {
tenantId: string;
Expand Down Expand Up @@ -151,8 +151,7 @@ export class UtilsService {
});

const parsedLogs: IParsedLog[] = logs.map((log: any) => ({
tenantId: web3.utils
.toAscii(log?.args?._identifier!)
tenantId: fromHex(log?.args?._identifier!, 'string')
.replaceAll(`\x00`, ''),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I thought of here is what happens if there are zeros in the identifier that get removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't work that way for un-padded zeroes! (hopefully)

amount: Number(log?.args?._amount!),
referenceId: log.transactionHash!,
Expand Down
Loading
Loading