forked from mito-systems/sol-mem-gen
26 lines
720 B
TypeScript
26 lines
720 B
TypeScript
import assert from 'assert';
|
|
|
|
import { AppDataSource } from '../data-source';
|
|
import { Payment } from '../entity/Payment';
|
|
import { Tweet } from '../entity/Tweets';
|
|
|
|
assert(process.env.NEXT_PUBLIC_SOLANA_RPC_URL, 'SOLANA_RPC_URL is required');
|
|
|
|
export async function verifySignatureInTweet(transactionSignature: string): Promise<boolean> {
|
|
const paymentRepository = AppDataSource.getRepository(Payment);
|
|
const payment = await paymentRepository.findOneBy({ transactionSignature });
|
|
|
|
const tweetRepository = AppDataSource.getRepository(Tweet);
|
|
const tweet = await tweetRepository.findOneBy({ transactionSignature });
|
|
|
|
if (!payment) {
|
|
return false;
|
|
}
|
|
|
|
if (tweet) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|