fix: 0 is falsey for arg filling (#2258)

This commit is contained in:
Noah Prince 2022-11-13 13:33:04 +00:00 committed by GitHub
parent 7a0a37e0f8
commit 91a2b7ec96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -335,7 +335,7 @@ export class AccountsResolver<IDL extends Idl, I extends AllInstructions<IDL>> {
private async toBufferArg(seedDesc: IdlSeed): Promise<Buffer | undefined> {
const argValue = this.argValue(seedDesc);
if (!argValue) {
if (typeof argValue === "undefined") {
return;
}
return this.toBufferValue(

View File

@ -173,6 +173,17 @@ export class MethodsBuilder<IDL extends Idl, I extends AllInstructions<IDL>> {
});
}
public async rpcAndKeys(options?: ConfirmOptions): Promise<{
pubkeys: Partial<InstructionAccountAddresses<IDL, I>>;
signature: TransactionSignature;
}> {
const pubkeys = await this.pubkeys();
return {
pubkeys,
signature: await this.rpc(options),
};
}
public async view(options?: ConfirmOptions): Promise<any> {
if (this._autoResolveAccounts) {
await this._accountsResolver.resolve();