I'm a Ethereum dev, started solana development recently finding it bit confuse due to my previous Eth concepts. I'm developing a NFT marketplace on solana and its a type of P2E model. In Ethereum you mint nfts and approve the smart contract so anyone can buy it. As Solana doesn't store data with code, it stores in accounts eg PDA. I want to be able to have same functionality in solana program eg: owner mints tokens to PDA so buyers can buy directly from marketplace. because PDA's are special accounts and program can sign for them.
PS: I wrote the code for first minting and then transferring nft to PDA in same transaction but it doesn't work. it gives this error: Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 1: Cross-program invocation with unauthorized signer or writable account.
If I remove the transferring nft code minting works fine. any help would be appreciated.