solana.js: fix lease fund logic

This commit is contained in:
Conner Gallagher 2022-12-05 21:43:34 -07:00
parent 1695adf6f8
commit 395a6b8656
2 changed files with 11 additions and 4 deletions

View File

@ -506,8 +506,8 @@ export class QueueAccount extends Account<types.OracleQueueAccountData> {
const leaseInit = (
await LeaseAccount.createInstructions(this.program, payer, {
loadAmount: params.fundAmount,
funderTokenAccount: params.funderTokenAccount,
funderAuthority: params.funderAuthority,
funderTokenAccount: params.funderTokenAccount ?? userTokenAddress,
funderAuthority: params.funderAuthority ?? undefined,
aggregatorAccount: aggregatorAccount,
queueAccount: this,
jobAuthorities: [], // create lease before adding jobs to skip this step
@ -646,7 +646,9 @@ export class QueueAccount extends Account<types.OracleQueueAccountData> {
params
);
const signatures = await this.program.signAndSendAll(txns);
const signatures = await this.program.signAndSendAll(txns, {
skipPreflight: true,
});
return [aggregatorAccount, signatures];
}

View File

@ -243,10 +243,15 @@ export class TransactionObject implements ITransactionObject {
): Transaction {
const txn = this.toTxn(blockhash);
const allSigners = [...this.signers];
if (signers) {
allSigners.push(...signers);
}
if (allSigners.length) {
txn.sign(...allSigners);
}
return txn;
}