solana-developers / create-solana-dapp

CLI for creating Solana dApps on the fly
https://npmjs.com/package/create-solana-dapp
MIT License
363 stars 108 forks source link

Anchor 0.30.0 #58

Closed 0x0ece closed 7 months ago

0x0ece commented 7 months ago

Hi, has anyone successfully run create-solana-dapp with anchor 0.30.0? With the new IDL, I can't figure out how to fix this line: https://github.com/solana-developers/create-solana-dapp/blob/main/packages/preset-anchor/src/generators/anchor-template/files/counter/src/__fileName__-exports.ts.template#L4

beeman commented 7 months ago

Hi there @0x0ece - we aim to have a version with support for Anchor 0.30.0 out before the end of this week.

0x0ece commented 7 months ago

Awesome, will patiently wait then. Thank you much!

beeman commented 7 months ago

@0x0ece I was just looking into this.

Here are some of the changes I've made to get it working with Anchor 0.30.0.

https://github.com/beeman/solana-dapp-anchor-v030/

Now this is still an early stage, but it successfully runs anchor build and anchor test.

However, this currently leads to issues on the frontend.

I didn't have time to look into this yet and I'm about to take off on a flight.

image
0x0ece commented 7 months ago

Thank you @beeman - this is more or less where I’m at too. anchor works. in web I can load idl from json (as it’s no longer in the ts file), I can type it, but it doesn’t resolve accounts correctly. Anyway no particular rush, I’m not blocked by this. I’ll just wait a bit longer :)

beeman commented 7 months ago

Thank you @beeman - this is more or less where I’m at too. anchor works. in web I can load idl from json (as it’s no longer in the ts file), I can type it, but it doesn’t resolve accounts correctly. Anyway no particular rush, I’m not blocked by this. I’ll just wait a bit longer :)

Thanks for the patience!

In the meanwhile, there is a working version now thanks to this PR: https://github.com/beeman/solana-dapp-anchor-v030/pull/2

0x0ece commented 7 months ago

Thank you, it works! (I was doing the import wrong)

I ended up doing the type in the anchor -exports.ts, but pretty much same thing as in your code.

import type { MyApp } from '../target/types/myapp';
import MyAppIDLUntyped from '../target/idl/myapp.json';

const MyAppIDL = MyAppIDLUntyped as MyApp;
export { MyApp, MyAppIDL };