metaplex-foundation / metaplex

A directory of what the Metaplex Foundation works on!
https://metaplex.com
Apache License 2.0
3.32k stars 6.26k forks source link

[Bug]: Compilation error while starting the server #1758

Closed Pixelapesnfts closed 2 years ago

Pixelapesnfts commented 2 years ago

Which package is this bug report for?

candy machine ui

Issue description

I would start my server with the command:

I have already make "Yarn install" in the candy-machine-ui folder.

The local host page also opens, but I can't click the Mint button on it.

Anybody can help me?

Command

PS C:\Users\Thoma\Desktop\v2\metaplex\js\packages\candy-machine-ui> yarn install
yarn install v1.22.17
[1/4] Resolving packages...
Failed to compile.

C:/Users/Thoma/Desktop/v2/metaplex/js/packages/candy-machine-ui/src/candy-machine.ts
TypeScript error in C:/Users/Thoma/Desktop/v2/metaplex/js/packages/candy-machine-ui/src/candy-machine.ts(441,40):
Property 'SYSVAR_SLOT_HASHES_PUBKEY' does not exist on type 'typeof import("@solana/web3.js")'.  TS2339

    439 |         rent: anchor.web3.SYSVAR_RENT_PUBKEY,
    440 |         clock: anchor.web3.SYSVAR_CLOCK_PUBKEY,
  > 441 |         recentBlockhashes: anchor.web3.SYSVAR_SLOT_HASHES_PUBKEY,
        |                                        ^
    442 |         instructionSysvarAccount: anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
    443 |       },
    444 |       remainingAccounts:

Relevant log output

No response

Operating system

Visual Studio

Priority this issue should have

Medium (should be fixed soon)

Check the Docs First

walter-grace commented 2 years ago

Make these changes in the package.json and yarn https://github.com/metaplex-foundation/metaplex/commit/d9a4bbde3cabef5c33f14c3a33d3d72c2938e045

dayshell commented 2 years ago

Make these changes in the package.json and yarn d9a4bbd

same problem. i did it, the error remains the same

limjame28 commented 2 years ago

yeah i have the same problems here

roederw commented 2 years ago

Do a fresh pull. Should be fixed. Make sure to run yarn install

limjame28 commented 2 years ago

fresh pull from what repo ?

Pixelapesnfts commented 2 years ago

Yeah, dont have any idea how to fresh pull?

limjame28 commented 2 years ago

Yeah, dont have any idea how to fresh pull?

yeah mate , it says not a git respitory

how do u do that ? New in here sorry 😁

Pixelapesnfts commented 2 years ago

Do a fresh pull. Should be fixed. Make sure to run yarn install

Why you closed this? Nobody has a solution...

JohnCodePie commented 2 years ago

Got the same error. Fixed the yarn install error by upgrading to version 1.34.0.

BUT! When i try to mint and NFT this error pops-up: Error: Invalid arguments: recentBlockhashes not provided. at common.ts:52:1 at Array.forEach (<anonymous>) at validateAccounts (common.ts:45:1) at Object.ix [as mintNft] (instruction.ts:24:1) at mintOneToken (candy-machine.ts:424:1) at async onMint (Home.tsx:99:1) at async onClick (MintButton.tsx:69:1)

Which comes back to this line recentBlockhashes: anchor.web3.SYSVAR_SLOT_HASHES_PUBKEY,

muhammadaqibmasood commented 2 years ago

Got the same error. Fixed the yarn install error by upgrading to version 1.34.0.

BUT! When i try to mint and NFT this error pops-up: Error: Invalid arguments: recentBlockhashes not provided. at common.ts:52:1 at Array.forEach (<anonymous>) at validateAccounts (common.ts:45:1) at Object.ix [as mintNft] (instruction.ts:24:1) at mintOneToken (candy-machine.ts:424:1) at async onMint (Home.tsx:99:1) at async onClick (MintButton.tsx:69:1)

Which comes back to this line recentBlockhashes: anchor.web3.SYSVAR_SLOT_HASHES_PUBKEY,

please use SYSVAR_RECENT_BLOCKHASHES_PUBKEY instead off SYSVAR_SLOT_HASHES_PUBKEY

command7hero commented 2 years ago

please use SYSVAR_RECENT_BLOCKHASHES_PUBKEY instead off SYSVAR_SLOT_HASHES_PUBKEY

Finally figured it out. Go to ~/metaplex/js/packages/candy-machine-ui/src/candy-machine.ts and change SYSVAR_SLOT_HASHES_PUBKEY to SYSVAR_RECENT_BLOCKHASHES_PUBKEY (line 441 for me):

    recentBlockhashes: anchor.web3.SYSVAR_RECENT_BLOCKHASHES_PUBKEY,
    instructionSysvarAccount: anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
roederw commented 2 years ago

git pull