|
@@ -9,6 +9,7 @@ import {
|
|
TransactionInstruction,
|
|
TransactionInstruction,
|
|
Commitment,
|
|
Commitment,
|
|
GetProgramAccountsFilter,
|
|
GetProgramAccountsFilter,
|
|
|
|
+ AccountInfo,
|
|
} from "@solana/web3.js";
|
|
} from "@solana/web3.js";
|
|
import Provider, { getProvider } from "../../provider.js";
|
|
import Provider, { getProvider } from "../../provider.js";
|
|
import { Idl, IdlTypeDef } from "../../idl.js";
|
|
import { Idl, IdlTypeDef } from "../../idl.js";
|
|
@@ -136,9 +137,7 @@ export class AccountClient<
|
|
* @param address The address of the account to fetch.
|
|
* @param address The address of the account to fetch.
|
|
*/
|
|
*/
|
|
async fetchNullable(address: Address): Promise<T | null> {
|
|
async fetchNullable(address: Address): Promise<T | null> {
|
|
- const accountInfo = await this._provider.connection.getAccountInfo(
|
|
|
|
- translateAddress(address)
|
|
|
|
- );
|
|
|
|
|
|
+ const accountInfo = await this.getAccountInfo(address);
|
|
if (accountInfo === null) {
|
|
if (accountInfo === null) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
@@ -344,6 +343,16 @@ export class AccountClient<
|
|
): Promise<PublicKey> {
|
|
): Promise<PublicKey> {
|
|
return await pubkeyUtil.associated(this._programId, ...args);
|
|
return await pubkeyUtil.associated(this._programId, ...args);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ async getAccountInfo(
|
|
|
|
+ address: Address,
|
|
|
|
+ commitment?: Commitment
|
|
|
|
+ ): Promise<AccountInfo<Buffer> | null> {
|
|
|
|
+ return await this._provider.connection.getAccountInfo(
|
|
|
|
+ translateAddress(address),
|
|
|
|
+ commitment
|
|
|
|
+ );
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|