Don't use wallet object for account.createInstruction function 2112 (#2116)
* Don't use wallet object for account.createInstruction function 2112 * added publicKey type check * yarn test pass * Don't use wallet object for account.createInstruction function 2112 * added publicKey type check * yarn test pass Co-authored-by: henrye <henry@notanemail>
This commit is contained in:
parent
b6ad53f628
commit
57434279fd
|
@ -346,16 +346,14 @@ export class AccountClient<
|
|||
): Promise<TransactionInstruction> {
|
||||
const size = this.size;
|
||||
|
||||
// @ts-expect-error
|
||||
if (this._provider.wallet === undefined) {
|
||||
if (this._provider.publicKey === undefined) {
|
||||
throw new Error(
|
||||
"This function requires the Provider interface implementor to have a 'wallet' field."
|
||||
"This function requires the Provider interface implementor to have a 'publicKey' field."
|
||||
);
|
||||
}
|
||||
|
||||
return SystemProgram.createAccount({
|
||||
// @ts-expect-error
|
||||
fromPubkey: this._provider.wallet.publicKey,
|
||||
fromPubkey: this._provider.publicKey,
|
||||
newAccountPubkey: signer.publicKey,
|
||||
space: sizeOverride ?? size,
|
||||
lamports:
|
||||
|
|
Loading…
Reference in New Issue