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

View File

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