forked from mito-systems/sol-mem-gen
Add check for phantom wallet before throwing error #1
6
.env.example
Normal file
6
.env.example
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
FAL_AI_KEY=
|
||||||
|
|
||||||
|
NEXT_PUBLIC_MTM_TOKEN_MINT=97RggLo3zV5kFGYW4yoQTxr4Xkz4Vg2WPHzNYXXWpump
|
||||||
|
NEXT_PUBLIC_PAYMENT_RECEIVER_ADDRESS=FFDx3SdAEeXrp6BTmStB4BDHpctGsaasZq4FFcowRobY
|
||||||
|
NEXT_PUBLIC_SOLANA_RPC_URL=https://young-radial-orb.solana-mainnet.quiknode.pro/67612b364664616c29514e551bf5de38447ca3d4
|
||||||
|
NEXT_PUBLIC_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) => {
|
const handleFluxGeneration = (modelId: string, cost: number) => {
|
||||||
return async (prompt: string): Promise<FluxGenerationResult> => {
|
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' }
|
return { error: 'Wallet not connected' }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +100,6 @@ const Page: React.FC = (): React.ReactElement => {
|
|||||||
<span className="text-orange-300 text-sm">TBD</span>
|
<span className="text-orange-300 text-sm">TBD</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mt-6">
|
<div className="mt-6">
|
||||||
<button
|
<button
|
||||||
disabled
|
disabled
|
||||||
|
@ -2,16 +2,15 @@ import { Connection, PublicKey, Transaction, SystemProgram } from '@solana/web3.
|
|||||||
import {
|
import {
|
||||||
TOKEN_PROGRAM_ID,
|
TOKEN_PROGRAM_ID,
|
||||||
createTransferInstruction,
|
createTransferInstruction,
|
||||||
getAssociatedTokenAddress,
|
|
||||||
createAssociatedTokenAccountInstruction,
|
createAssociatedTokenAccountInstruction,
|
||||||
ASSOCIATED_TOKEN_PROGRAM_ID
|
ASSOCIATED_TOKEN_PROGRAM_ID
|
||||||
} from '@solana/spl-token'
|
} from '@solana/spl-token'
|
||||||
import { WalletType } from './types'
|
import { WalletType } from './types'
|
||||||
|
|
||||||
const MTM_TOKEN_MINT: string = '97RggLo3zV5kFGYW4yoQTxr4Xkz4Vg2WPHzNYXXWpump'
|
const MTM_TOKEN_MINT = process.env.NEXT_PUBLIC_MTM_TOKEN_MINT;
|
||||||
const PAYMENT_RECEIVER_ADDRESS: string = 'FFDx3SdAEeXrp6BTmStB4BDHpctGsaasZq4FFcowRobY'
|
const PAYMENT_RECEIVER_ADDRESS = process.env.NEXT_PUBLIC_PAYMENT_RECEIVER_ADDRESS;
|
||||||
const SOLANA_RPC_URL: string = 'https://young-radial-orb.solana-mainnet.quiknode.pro/67612b364664616c29514e551bf5de38447ca3d4'
|
const SOLANA_RPC_URL = process.env.NEXT_PUBLIC_SOLANA_RPC_URL;
|
||||||
const SOLANA_WEBSOCKET_URL: string = 'wss://young-radial-orb.solana-mainnet.quiknode.pro/67612b364664616c29514e551bf5de38447ca3d4'
|
const SOLANA_WEBSOCKET_URL = process.env.NEXT_PUBLIC_SOLANA_WEBSOCKET_URL;
|
||||||
|
|
||||||
const connection = new Connection(
|
const connection = new Connection(
|
||||||
SOLANA_RPC_URL,
|
SOLANA_RPC_URL,
|
||||||
|
Loading…
Reference in New Issue
Block a user