Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ts: Change type of Provider.publicKey to PublicKey | null #2838

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion ts/packages/anchor/src/program/namespace/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ export class AccountClient<
): Promise<TransactionInstruction> {
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."
);
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/anchor/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {

export default interface Provider {
readonly connection: Connection;
readonly publicKey?: PublicKey;
readonly publicKey: PublicKey | null;

send?(
tx: Transaction | VersionedTransaction,
Expand Down
Loading