Closed adityanithariya closed 2 months ago
I would like to propose that if we want to sign a transaction we need wallet, but when reading accounts, we only need connection, so wallet can be made optional or something like that. Otherwise, adding a constructor to
Wallet
class constructable from Keypair object would be better.
Wallet
is not a class, it's just an interface, so you can just pass {} as Wallet
and it should work as long as you never use wallet functionality.
I would like to propose that if we want to sign a transaction we need wallet, but when reading accounts, we only need connection, so wallet can be made optional or something like that. Otherwise, adding a constructor to
Wallet
class constructable from Keypair object would be better.
Wallet
is not a class, it's just an interface, so you can just pass{} as Wallet
and it should work as long as you never use wallet functionality.
Thanks, it worked!
For fetching program accounts, provider must be there, but in server side, there's no transaction being made, and only connection should be sufficient in that case, question arises is what should be the best way to fetch program accounts data in anchor on server side in Next.js
Tried using
AnchorProvider.env()
, and ANCHOR_WALLET points to./config/id.json
, but when deployed on vercel, it's unable to find it even when it's there. Apart from this, triedAnchorProvider.local()
, but same issue with it.For using
new AnchorProvider(connection, wallet)
, we need wallet object which can be fetched fromuseAnchorWallet()
, but unusable on server side.I would like to propose that if we want to sign a transaction we need wallet, but when reading accounts, we only need connection, so wallet can be made optional or something like that. Otherwise, adding a constructor to
Wallet
class constructable from Keypair object would be better.Let me know if you have better solution than this, or we have anything already implemented on it. I would love to raise a PR for implementing a solution for this! Thanks in Advance!!