Bugfix: extendInstruction should be 'wrap' not 'unwrap'
This commit is contained in:
parent
682aee5182
commit
68f16bf7b6
|
@ -400,11 +400,9 @@ export class LeaseAccount extends Account<types.LeaseAccountData> {
|
||||||
const funderBalance =
|
const funderBalance =
|
||||||
(await this.program.mint.getAssociatedBalance(funderAuthority)) ?? 0;
|
(await this.program.mint.getAssociatedBalance(funderAuthority)) ?? 0;
|
||||||
if (funderBalance < params.loadAmount) {
|
if (funderBalance < params.loadAmount) {
|
||||||
const wrapIxns = await this.program.mint.unwrapInstructions(
|
const wrapIxns = await this.program.mint.wrapInstructions(payer, {
|
||||||
payer,
|
amount: params.loadAmount,
|
||||||
params.loadAmount,
|
});
|
||||||
params.funderAuthority
|
|
||||||
);
|
|
||||||
ixns.push(...wrapIxns.ixns);
|
ixns.push(...wrapIxns.ixns);
|
||||||
signers.push(...wrapIxns.signers);
|
signers.push(...wrapIxns.signers);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
import 'mocha';
|
||||||
|
|
||||||
|
import * as sbv2 from '../src';
|
||||||
|
import { setupTest, TestContext } from './utilts';
|
||||||
|
import { Keypair } from '@solana/web3.js';
|
||||||
|
|
||||||
|
describe('Lease Tests', () => {
|
||||||
|
let ctx: TestContext;
|
||||||
|
|
||||||
|
before(async () => {
|
||||||
|
ctx = await setupTest();
|
||||||
|
});
|
||||||
|
|
||||||
|
const aggregator = Keypair.generate();
|
||||||
|
const queue = Keypair.generate();
|
||||||
|
|
||||||
|
it('Creates a Lease', async () => {
|
||||||
|
const aggregatorAccount = new sbv2.AggregatorAccount(
|
||||||
|
ctx.program,
|
||||||
|
aggregator.publicKey
|
||||||
|
);
|
||||||
|
const queueAccount = new sbv2.QueueAccount(ctx.program, queue.publicKey);
|
||||||
|
const [leaseAccount] = await sbv2.LeaseAccount.create(ctx.program, {
|
||||||
|
aggregatorAccount,
|
||||||
|
queueAccount,
|
||||||
|
loadAmount: 0.01,
|
||||||
|
});
|
||||||
|
await leaseAccount.loadData();
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue