add wallet publickey to Provider (#1845)

This commit is contained in:
Tommy Johnson 2022-04-28 18:23:20 -04:00 committed by GitHub
parent 282c394666
commit 0011e22b91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -24,6 +24,7 @@ The minor version will be incremented upon a breaking change and the patch versi
* cli: Move `overflow-checks` into workspace `Cargo.toml` so that it will not be ignored by compiler ([#1806](https://github.com/project-serum/anchor/pull/1806)).
* lang: Fix missing account name information when deserialization fails when using `init` or `zero` ([#1800](https://github.com/project-serum/anchor/pull/1800)).
* ts: Expose the wallet's publickey on the Provider ([#1845](https://github.com/project-serum/anchor/pull/1845)).
## [0.24.2] - 2022-04-13

View File

@ -20,6 +20,7 @@ import {
export default interface Provider {
readonly connection: Connection;
readonly publicKey: PublicKey;
send?(
tx: Transaction,
@ -48,6 +49,8 @@ export default interface Provider {
* by the provider.
*/
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.
@ -57,7 +60,9 @@ export class AnchorProvider implements Provider {
readonly connection: Connection,
readonly wallet: Wallet,
readonly opts: ConfirmOptions
) {}
) {
this.publicKey = wallet.publicKey;
}
static defaultOptions(): ConfirmOptions {
return {