Closed lewilewilewi closed 2 years ago
I'm having issues running this on my local - does it work properly on your fork? We might have to update the IDL using Anchor 25 for this upgrade to work.
~~~ Error: TypeError: Cannot read properties of null (reading 'publicKey')
at new AnchorProvider (/home/michael/Workspace/lewi-factory/node_modules/@project-serum/anchor/src/provider.ts:63:29)
at /home/michael/Workspace/lewi-factory/dist/marketplace/pda_getters/pda_getters.js:100:26
at Generator.next (<anonymous>)
at /home/michael/Workspace/lewi-factory/dist/marketplace/pda_getters/pda_getters.js:31:71
at new Promise (<anonymous>)
at __awaiter (/home/michael/Workspace/lewi-factory/dist/marketplace/pda_getters/pda_getters.js:27:12)
at getAllRegisteredCurrencies (/home/michael/Workspace/lewi-factory/dist/marketplace/pda_getters/pda_getters.js:99:12)
at GmClientService.<anonymous> (/home/michael/Workspace/lewi-factory/dist/marketplace/services/GmClientService.js:41:85)
at Generator.next (<anonymous>)
at /home/michael/Workspace/lewi-factory/dist/marketplace/services/GmClientService.js:8:71
at new Promise (<anonymous>)
at __awaiter (/home/michael/Workspace/lewi-factory/dist/marketplace/services/GmClientService.js:4:12)
at GmClientService.getRegisteredCurrencies (/home/michael/Workspace/lewi-factory/dist/marketplace/services/GmClientService.js:37:16)
at GmEventService.<anonymous> (/home/michael/Workspace/lewi-factory/dist/marketplace/services/GmEventService.js:68:66)
at Generator.next (<anonymous>)
at /home/michael/Workspace/lewi-factory/dist/marketplace/services/GmEventService.js:8:71```
Yep I see another breaking change from https://github.com/staratlasmeta/anchor/commit/0011e22b91b1cb3f3dcafab43312b46fcfac4476
export class AnchorProvider implements Provider {
readonly publicKey: PublicKey;
/**
* @param connection The cluster connection where the program is deployed.
* @param wallet The wallet used to pay for and sign all transactions.
* @param opts Transaction confirmation options to use by default.
*/
constructor(
readonly connection: Connection,
readonly wallet: Wallet,
readonly opts: ConfirmOptions
) {
this.publicKey = wallet.publicKey;
}
Means any line like const provider = new AnchorProvider(connection, null, null);
will break. There are 43 such lines in this codebase, so I suspect this is a bigger job than should be done right now.
In this commit they made the publicKey variable optional: https://github.com/staratlasmeta/anchor/commit/ee14a884f769dd098213b79d700ceda54cd0242d
So I'll propose a change to Anchor where they change the line in the constructor to this.publicKey = wallet?.publicKey;
and see what they think!
Changes
Updating anchor to latest version in order to get the transaction signature passed through to the event handlers
Checklist