@raydium-io/raydium-sdk-v2 0.1.32-alpha → 0.1.33-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raydium-io/raydium-sdk-v2",
3
- "version": "0.1.32-alpha",
3
+ "version": "0.1.33-alpha",
4
4
  "description": "An SDK for building applications on top of Raydium.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "./lib/index.js",
@@ -590,10 +590,25 @@ export default class Farm extends ModuleBase {
590
590
  version,
591
591
  });
592
592
  const ledgerData = await this.scope.connection.getAccountInfo(ledger);
593
- if (!ledgerData) this.logAndCreateError("no lp data", { farmId: farmInfo.id, version, ledgerData });
594
- const ledgerLayout = getFarmLedgerLayout(version)!;
595
- const ledgerInfo = ledgerLayout.decode(ledgerData!.data);
596
- if (ledgerInfo.deposited.isZero()) this.logAndCreateError("no deposited lp", { farmId: farmInfo.id });
593
+ if (!ledgerData) {
594
+ // user has old not ata farm vault and don't have ata vault
595
+ if (version !== 6 && (userAuxiliaryLedgers || []).length > 0) {
596
+ const { instruction, instructionType } = createAssociatedLedgerAccountInstruction({
597
+ id: new PublicKey(farmKeys.id),
598
+ programId: new PublicKey(farmKeys.programId),
599
+ version,
600
+ ledger,
601
+ owner: this.scope.ownerPubKey,
602
+ });
603
+ txBuilder.addInstruction({ instructions: [instruction], instructionTypes: [instructionType] });
604
+ } else {
605
+ this.logAndCreateError("no lp data", { farmId: farmInfo.id, version, ledgerData });
606
+ }
607
+ } else {
608
+ const ledgerLayout = getFarmLedgerLayout(version)!;
609
+ const ledgerInfo = ledgerLayout.decode(ledgerData!.data);
610
+ if (ledgerInfo.deposited.isZero()) this.logAndCreateError("no deposited lp", { farmId: farmInfo.id });
611
+ }
597
612
  } else {
598
613
  if (deposited.isZero()) this.logAndCreateError("no deposited lp", { farmId: farmInfo.id });
599
614
  }