diff --git a/CHANGELOG.md b/CHANGELOG.md index 6476f31ddf..609e4f58e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,7 +75,8 @@ The minor version will be incremented upon a breaking change and the patch versi - syn: Remove `idl-parse` and `seeds` features ([#2824](https://github.com/coral-xyz/anchor/pull/2824)). - ts: Change `accounts` method to no longer accept resolvable accounts ([#2824](https://github.com/coral-xyz/anchor/pull/2824)). - ts: `Program` instances use camelCase for everything ([#2824](https://github.com/coral-xyz/anchor/pull/2824)). -- ts: Remove discriminator functions ([#2824](https://github.com/coral-xyz/anchor/pull/2824)). +- ts: Remove discriminator functions ([#2838](https://github.com/coral-xyz/anchor/pull/2824)). +- ts: Change type of `Provider.publicKey` to `PublicKey | null` for compatibility with `WalletContextState` of `@solana/wallet-adapter-react` ([#2824](https://github.com/coral-xyz/anchor/pull/2838)). ## [0.29.0] - 2023-10-16 diff --git a/ts/packages/anchor/src/program/namespace/account.ts b/ts/packages/anchor/src/program/namespace/account.ts index 87e53e155c..d7d2b94438 100644 --- a/ts/packages/anchor/src/program/namespace/account.ts +++ b/ts/packages/anchor/src/program/namespace/account.ts @@ -344,7 +344,7 @@ export class AccountClient< ): Promise { const size = this.size; - if (this._provider.publicKey === undefined) { + if (!this._provider.publicKey) { throw new Error( "This function requires the Provider interface implementor to have a 'publicKey' field." ); diff --git a/ts/packages/anchor/src/provider.ts b/ts/packages/anchor/src/provider.ts index 0731732ebb..2d66f49073 100644 --- a/ts/packages/anchor/src/provider.ts +++ b/ts/packages/anchor/src/provider.ts @@ -21,7 +21,7 @@ import { export default interface Provider { readonly connection: Connection; - readonly publicKey?: PublicKey; + readonly publicKey: PublicKey | null; send?( tx: Transaction | VersionedTransaction,