Remove explicit any

This commit is contained in:
Shreerang Kale
2025-07-21 15:15:39 +05:30
parent f7fd972516
commit d3d6c2c24d
9 changed files with 29 additions and 20 deletions
+3 -7
View File
@@ -107,10 +107,10 @@ const fetchLatestCommitHash = async (repoUrl: string, provider: string): Promise
// Registry transaction retry helper
export const registryTransactionWithRetry = async (
txFn: () => Promise<any>,
txFn: () => Promise<unknown>,
maxRetries = 3,
delay = 1000
): Promise<any> => {
): Promise<unknown> => {
let lastError;
for (let attempt = 0; attempt < maxRetries; attempt++) {
@@ -161,7 +161,7 @@ export async function POST(request: NextRequest) {
// Verify Solana payment
console.log('Step 0: Verifying Solana token payment...');
const paymentAmount = parseInt(process.env.NEXT_PUBLIC_MIN_SOLANA_PAYMENT_AMOUNT || '400000000');
const paymentAmount = parseInt(process.env.NEXT_PUBLIC_MIN_SOLANA_PAYMENT_AMOUNT!);
const tokenAmount = new BN(paymentAmount);
const solanaPaymentResult = await verifyUnusedSolanaPayment(connection, txHash, tokenAmount);
@@ -202,10 +202,6 @@ export async function POST(request: NextRequest) {
'REGISTRY_AUTHORITY',
'REGISTRY_USER_KEY', // This is the same as the prefilled account for LNT transfers
'DEPLOYER_LRN',
// LNT transfer variables
'LACONIC_TRANSFER_AMOUNT',
// Solana specific variables
'NEXT_PUBLIC_SOLANA_RPC_URL',
'NEXT_PUBLIC_SOLANA_TOKEN_MINT_ADDRESS',
'NEXT_PUBLIC_SOLANA_TOKEN_RECIPIENT_ADDRESS'
];
+2 -1
View File
@@ -54,6 +54,7 @@ export default function Home() {
try {
// Create the Laconic Registry record (payment verification is done in the API)
const result = await createApplicationDeploymentRequest(url, hash, solanaWalletState.publicKey);
if (result.status === 'success') {
setRecordId(result.id);
if (result.applicationRecordId) {
@@ -110,7 +111,7 @@ export default function Home() {
<div className="text-center">
<p className="mb-4" style={{ color: 'var(--muted-foreground)' }}>
Payment method: <span className="font-semibold" style={{ color: 'var(--foreground)' }}>
GOR (Solana)
{process.env.NEXT_PUBLIC_SOLANA_TOKEN_SYMBOL} (Solana)
</span>
</p>
<button
+12 -2
View File
@@ -25,7 +25,17 @@ export default function PaymentModal({
const connection = useMemo(() => new Connection(SOLANA_RPC_URL), [])
// Get configuration from environment variables directly
const amount = parseInt(process.env.NEXT_PUBLIC_MIN_SOLANA_PAYMENT_AMOUNT || '400000000');
const amount = parseInt(process.env.NEXT_PUBLIC_MIN_SOLANA_PAYMENT_AMOUNT!);
const divisor = useMemo(() => {
const decimalsEnv = process.env.NEXT_PUBLIC_MIN_SOLANA_TOKEN_DECIMALS;
const decimals = parseInt(decimalsEnv!, 10);
if (isNaN(decimals)) {
console.warn("Invalid NEXT_PUBLIC_MIN_SOLANA_TOKEN_DECIMALS; defaulting to 6.");
return 1e6;
}
return 10 ** decimals;
}, []);
const recipientAddress = process.env.NEXT_PUBLIC_SOLANA_TOKEN_RECIPIENT_ADDRESS;
@@ -84,7 +94,7 @@ export default function PaymentModal({
<input
id="amount"
type="number"
value={amount / 1e6} // Token decimals for GOR token
value={amount / divisor}
disabled={true} // Fixed amount for Solana tokens
className="w-full p-3 pr-12 rounded-md"
style={{
+2 -1
View File
@@ -49,7 +49,8 @@ export default function URLForm({ onSubmit, disabled }: URLFormProps) {
// All validations passed
setError('');
onSubmit(trimmedUrl);
} catch (_) {
} catch (error) {
console.error(error);
setError('Please enter a valid URL (e.g., https://example.com)');
}
};
+2 -2
View File
@@ -57,7 +57,7 @@ export const transferLNTTokens = async (): Promise<LaconicTransferResult> => {
console.log('LNT transfer result:', transferResult);
if (!transferResult || !(transferResult as any).transactionHash) {
if (!transferResult.transactionHash) {
return {
success: false,
error: 'LNT transfer failed - no transaction hash returned'
@@ -66,7 +66,7 @@ export const transferLNTTokens = async (): Promise<LaconicTransferResult> => {
return {
success: true,
transactionHash: (transferResult as any).transactionHash
transactionHash: transferResult.transactionHash
};
} catch (error) {
console.error('Failed to transfer LNT tokens:', error);
+1 -1
View File
@@ -53,7 +53,7 @@ export const connectSolanaWallet = async (walletType: SolanaWalletType): Promise
export const disconnectSolanaWallet = async (walletType: SolanaWalletType): Promise<void> => {
try {
let wallet: any = null;
let wallet = null;
if (walletType === 'phantom') {
wallet = window.phantom?.solana;
+4 -2
View File
@@ -1,16 +1,18 @@
import { Transaction } from "@solana/web3.js";
// extend the global Window interface to include Solana wallets
declare global {
interface Window {
phantom?: {
solana?: {
signAndSendTransaction(transaction: any): Promise<{ signature: string }>;
signAndSendTransaction(transaction: Transaction): Promise<{ signature: string }>;
connect(): Promise<{ publicKey: { toString(): string } }>;
disconnect(): Promise<void>;
isConnected: boolean;
};
};
solflare?: {
signAndSendTransaction(transaction: any): Promise<{ signature: string }>;
signAndSendTransaction(transaction: Transaction): Promise<{ signature: string }>;
connect(): Promise<{ publicKey: { toString(): string } }>;
disconnect(): Promise<void>;
isConnected: boolean;