forked from mito-systems/sol-mem-gen
Add check for phantom wallet before throwing error
This commit is contained in:
parent
6c9c5a4063
commit
88242a90e6
5
.env.example
Normal file
5
.env.example
Normal file
@ -0,0 +1,5 @@
|
||||
FAL_AI_KEY=
|
||||
REACT_APP_MTM_TOKEN_MINT=97RggLo3zV5kFGYW4yoQTxr4Xkz4Vg2WPHzNYXXWpump
|
||||
REACT_APP_PAYMENT_RECEIVER_ADDRESS=3kKzrJ7KQ67bKZGffcutwK5797hqGA4dAreeBYuXCnad
|
||||
REACT_APP_SOLANA_RPC_URL=https://young-radial-orb.solana-mainnet.quiknode.pro/67612b364664616c29514e551bf5de38447ca3d4
|
||||
REACT_APP_SOLANA_WEBSOCKET_URL=wss://young-radial-orb.solana-mainnet.quiknode.pro/67612b364664616c29514e551bf5de38447ca3d4
|
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
node_modules
|
||||
.next
|
||||
|
||||
.env
|
@ -29,10 +29,12 @@ const Page: React.FC = (): React.ReactElement => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const handleFluxGeneration = (modelId: string, cost: number) => {
|
||||
return async (prompt: string): Promise<FluxGenerationResult> => {
|
||||
if (!walletState.connected || !walletState.publicKey || !window.solflare) {
|
||||
const type = walletState.type;
|
||||
if (!walletState.connected || !walletState.publicKey ||
|
||||
(type === 'phantom' && !window.phantom) ||
|
||||
(type === 'solflare' && !window.solflare)) {
|
||||
return { error: 'Wallet not connected' }
|
||||
}
|
||||
|
||||
@ -63,7 +65,6 @@ const Page: React.FC = (): React.ReactElement => {
|
||||
<p className="text-gray-400 text-lg mb-8">
|
||||
Use MTM to generate memes
|
||||
</p>
|
||||
|
||||
<WalletHeader
|
||||
walletState={walletState}
|
||||
onConnect={handleConnect}
|
||||
@ -82,7 +83,6 @@ const Page: React.FC = (): React.ReactElement => {
|
||||
onGenerate={handleFluxGeneration(model.modelId, model.cost)}
|
||||
/>
|
||||
))}
|
||||
|
||||
{/* Coming Soon Card */}
|
||||
<div className="relative bg-gray-800/50 backdrop-blur-lg rounded-2xl shadow-xl border border-gray-700/50 overflow-hidden group">
|
||||
<div className="absolute inset-0 bg-gradient-to-br from-yellow-500/10 to-orange-500/10 opacity-50"></div>
|
||||
@ -98,7 +98,6 @@ const Page: React.FC = (): React.ReactElement => {
|
||||
<span className="text-orange-300 text-sm">TBD</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-6">
|
||||
<button
|
||||
disabled
|
||||
|
@ -2,16 +2,15 @@ import { Connection, PublicKey, Transaction, SystemProgram } from '@solana/web3.
|
||||
import {
|
||||
TOKEN_PROGRAM_ID,
|
||||
createTransferInstruction,
|
||||
getAssociatedTokenAddress,
|
||||
createAssociatedTokenAccountInstruction,
|
||||
ASSOCIATED_TOKEN_PROGRAM_ID
|
||||
} from '@solana/spl-token'
|
||||
import { WalletType } from './types'
|
||||
|
||||
const MTM_TOKEN_MINT: string = '97RggLo3zV5kFGYW4yoQTxr4Xkz4Vg2WPHzNYXXWpump'
|
||||
const PAYMENT_RECEIVER_ADDRESS: string = 'FFDx3SdAEeXrp6BTmStB4BDHpctGsaasZq4FFcowRobY'
|
||||
const SOLANA_RPC_URL: string = 'https://young-radial-orb.solana-mainnet.quiknode.pro/67612b364664616c29514e551bf5de38447ca3d4'
|
||||
const SOLANA_WEBSOCKET_URL: string = 'wss://young-radial-orb.solana-mainnet.quiknode.pro/67612b364664616c29514e551bf5de38447ca3d4'
|
||||
const MTM_TOKEN_MINT = process.env.REACT_APP_MTM_TOKEN_MINT;
|
||||
const PAYMENT_RECEIVER_ADDRESS = process.env.REACT_APP_PAYMENT_RECEIVER_ADDRESS;
|
||||
const SOLANA_RPC_URL = process.env.REACT_APP_SOLANA_RPC_URL;
|
||||
const SOLANA_WEBSOCKET_URL = process.env.REACT_APP_SOLANA_WEBSOCKET_URL;
|
||||
|
||||
const connection = new Connection(
|
||||
SOLANA_RPC_URL,
|
||||
|
Loading…
Reference in New Issue
Block a user