Skip to content

Commit

Permalink
Merge pull request #96 from yuki-wtf/get-mint-details-from-env
Browse files Browse the repository at this point in the history
Get mint price and token address from env
  • Loading branch information
lorcan-codes authored Feb 15, 2024
2 parents 7c09442 + c019e63 commit 4c3e777
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 3 additions & 7 deletions app/components/Snapshot/SnapshotMint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export const SnapshotMint = ({ generation, nft, refreshPage }: Props) => {
const starkscan = env.USE_MAINNET ? 'https://starkscan.co' : 'https://testnet.starkscan.co'
const { isCorrectNetwork } = useCheckNetwork()
const [_, setDialog] = useDialog()
const { contract: nftContract } = useNftContract()
const isPreMigrationGeneration = Number(generation) <= Number(env.MIGRATION_GENERATION_MARKER)

const addMintToPending = async (generationNumber: number, txHash: string) => {
Expand Down Expand Up @@ -90,18 +89,15 @@ export const SnapshotMint = ({ generation, nft, refreshPage }: Props) => {
}

const mintGame = async (generation: string) => {
if (!account || !nftContract) {
if (!account) {
return
}

const { mint_token_address, mint_price } = nftContract
const price = await mint_price()
const tokenAddress = await mint_token_address()
const calls = [
{
contractAddress: tokenAddress.toString(),
contractAddress: env.NFT_MINT_TOKEN_ADDRESS,
entrypoint: 'increaseAllowance',
calldata: CallData.compile([env.NFT_CONTRACT_ADDRESS!, cairo.uint256(price)]),
calldata: CallData.compile([env.NFT_CONTRACT_ADDRESS!, cairo.uint256(env.NFT_MINT_PRICE!)]),
},
]

Expand Down
2 changes: 2 additions & 0 deletions app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export async function loader({ request }: LoaderArgs) {
USE_MAINNET: process.env.USE_MAINNET === 'true',
CONTRACT_ADDRESS: process.env.CONTRACT_ADDRESS,
NFT_CONTRACT_ADDRESS: process.env.NFT_CONTRACT_ADDRESS,
NFT_MINT_PRICE: process.env.NFT_MINT_PRICE,
NFT_MINT_TOKEN_ADDRESS: process.env.NFT_MINT_TOKEN_ADDRESS,
INFURA_API_KEY: process.env.INFURA_API_KEY,
ALCHEMY_API_KEY: process.env.ALCHEMY_API_KEY,
MIGRATION_GENERATION_MARKER: process.env.MIGRATION_GENERATION_MARKER,
Expand Down

0 comments on commit 4c3e777

Please sign in to comment.