Why merkleTreeData is promise when I awaited? const merkleTree =…
- User
Why merkleTreeData is promise when I awaited?
const merkleTree = publicKey("F3cH9viZBm8SXmt8FwbMSafrAZgvetUDYhVHSfcjUe9Q"); const merkleTreeData = async () => { return await fetchTreeConfigFromSeeds(umi, { merkleTree }); }; let nftMinted = merkleTreeData.numMinted; let lastUpdated = Date.now();
Assistant
The issue here is that
merkleTreeDatais defined as an async function, not the result of calling that function. When you define an async function, it doesn't automatically execute. Instead, it returns a Promise that will resolve to the function's return value when the function is called and completes.To fix this, you need to call the
merkleTreeDatafunction and await its result. Here's how you can modify your code:javascript
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.