trufflesuite / ganache

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_
MIT License
2.62k stars 676 forks source link

NFT minting simulation #4163

Closed benams closed 1 year ago

benams commented 1 year ago

Hey, I use ganache in an attempt to simulate an NFT raw transaction:

const provider = ganache.provider({
        fork: { network: "mainnet", blockNumber: 16409359 },
        wallet: {
            unlockedAccounts: [
                "0x041d4f20857d5667a8ff0165fe5e492089becfb7"
            ]
        },
        chain: {
            chainId: 1
        }
});

await provider.on("connect", async () => {
        console.log('connected');
        provider.on("ganache:vm:tx:before", (event: any) => {
            console.log('Transaction about to start!')
        })
        provider.on("ganache:vm:tx:step", (event: any) => {
            console.log('Transaction step!')
        })
        provider.on("ganache:vm:tx:after", (event: any) => {
            console.log('Transaction done!')
        })
        // When connected, send the transaction to the provider
        const transactionHash = await provider.request({
            method: "eth_sendRawTransaction",
            params: ["0xf8aa148503c25e6b808302cdd8941cf41fca322df19af9a3433305dc901ab961a98380b844bc63f02e0000000000000000000000000000000000000000000000000000000000000032000000000000000000000000041d4f20857d5667a8ff0165fe5e492089becfb726a0ef35cf88512370c4e338458c538fcb82290dc44bfb41c2eceda8e143a7a47d87a01b1fb1c5c2953fa6fc9b673a23a9688e4043daa6669fe9283361595aa6ba75d0"]
        });
        console.log(`Transaction ${transactionHash} Done!`)
    });

It looks like the transaction is never started. The only logs I can see are:

connected eth_sendRawTransaction

Did I miss something in the provider configuration? Can ganache event simulate an NFT transaction?