@xitadel-fi/sdk 0.1.1 → 0.1.2

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.
@@ -388,7 +388,12 @@ export declare class XitadelProgram {
388
388
  stableCoinAmount: BN;
389
389
  cpAmmProgramId: PublicKey;
390
390
  collateralTokenMint: PublicKey;
391
- }): Promise<TransactionInstruction[]>;
391
+ }): Promise<{
392
+ activateLttIx: TransactionInstruction[];
393
+ createLookupTableIx: TransactionInstruction;
394
+ extendLookupTableIx: TransactionInstruction;
395
+ lookupTableAddress: PublicKey;
396
+ }>;
392
397
  /**
393
398
  * Maturate an LTT
394
399
  * @param signer
@@ -488,6 +488,8 @@ class XitadelProgram {
488
488
  const lpAuthority = this.getLpAuthority();
489
489
  const lttConfigPda = this.getLTTConfigPda(params.lttId);
490
490
  const lttTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(params.lttId, lpAuthority, true);
491
+ const lpUsdcAta = (0, spl_token_1.getAssociatedTokenAddressSync)(params.stableCoinMint, lpAuthority, true);
492
+ const fundingVaultAta = (0, spl_token_1.getAssociatedTokenAddressSync)(params.stableCoinMint, lttConfigPda, true);
491
493
  // console.log("lpAuthority", lpAuthority.toBase58());
492
494
  const instructions = [];
493
495
  // Create stable coin token account if it doesn't exist
@@ -546,6 +548,44 @@ class XitadelProgram {
546
548
  const [poolAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('pool_authority')], params.cpAmmProgramId);
547
549
  const [eventAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('__event_authority')], params.cpAmmProgramId);
548
550
  const collateralVaultAta = (0, spl_token_1.getAssociatedTokenAddressSync)(params.collateralTokenMint, lttConfigPda, true);
551
+ const [createLookupTableIx, lookupTableAddress] = web3_js_1.AddressLookupTableProgram.createLookupTable({
552
+ authority: signer,
553
+ payer: signer,
554
+ recentSlot: await this.program.provider.connection.getSlot(),
555
+ });
556
+ const addresses = [
557
+ lttConfigPda,
558
+ lpAuthority,
559
+ poolAuthority,
560
+ lpMint,
561
+ ammConfig,
562
+ ammConfigB,
563
+ params.lttId,
564
+ params.stableCoinMint,
565
+ fundingVaultAta,
566
+ lttVaultAta,
567
+ stableVaultAta,
568
+ lttTokenAccount,
569
+ lpUsdcAta,
570
+ lttVaultAta,
571
+ stableVaultAta,
572
+ lttVaultAtaB,
573
+ stableVaultAtaB,
574
+ collateralVaultAta,
575
+ eventAuthority,
576
+ spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
577
+ web3_js_2.SystemProgram.programId,
578
+ spl_token_1.TOKEN_PROGRAM_ID,
579
+ spl_token_1.TOKEN_2022_PROGRAM_ID,
580
+ params.cpAmmProgramId,
581
+ web3_js_1.SYSVAR_RENT_PUBKEY,
582
+ ];
583
+ const extendLookupTableIx = web3_js_1.AddressLookupTableProgram.extendLookupTable({
584
+ payer: signer,
585
+ authority: signer,
586
+ lookupTable: lookupTableAddress,
587
+ addresses,
588
+ });
549
589
  instructions.push(await this.program.methods
550
590
  .activateLtt()
551
591
  .accountsPartial({
@@ -584,7 +624,12 @@ class XitadelProgram {
584
624
  rent: web3_js_1.SYSVAR_RENT_PUBKEY,
585
625
  })
586
626
  .instruction());
587
- return instructions;
627
+ return {
628
+ activateLttIx: instructions,
629
+ createLookupTableIx,
630
+ extendLookupTableIx,
631
+ lookupTableAddress,
632
+ };
588
633
  }
589
634
  /**
590
635
  * Maturate an LTT
@@ -4703,6 +4703,26 @@
4703
4703
  "code": 6032,
4704
4704
  "name": "InvalidAccount",
4705
4705
  "msg": "Invalid Account"
4706
+ },
4707
+ {
4708
+ "code": 6033,
4709
+ "name": "InvalidAccessController",
4710
+ "msg": "Invalid access controller account"
4711
+ },
4712
+ {
4713
+ "code": 6034,
4714
+ "name": "InvalidConfigAccount",
4715
+ "msg": "Invalid config account"
4716
+ },
4717
+ {
4718
+ "code": 6035,
4719
+ "name": "InvalidPriceFeedId",
4720
+ "msg": "Invalid price feed ID"
4721
+ },
4722
+ {
4723
+ "code": 6036,
4724
+ "name": "InvalidVerifierAccount",
4725
+ "msg": "Invalid verifier account"
4706
4726
  }
4707
4727
  ],
4708
4728
  "types": [
@@ -4709,6 +4709,26 @@ export type Xitadel = {
4709
4709
  "code": 6032;
4710
4710
  "name": "invalidAccount";
4711
4711
  "msg": "Invalid Account";
4712
+ },
4713
+ {
4714
+ "code": 6033;
4715
+ "name": "invalidAccessController";
4716
+ "msg": "Invalid access controller account";
4717
+ },
4718
+ {
4719
+ "code": 6034;
4720
+ "name": "invalidConfigAccount";
4721
+ "msg": "Invalid config account";
4722
+ },
4723
+ {
4724
+ "code": 6035;
4725
+ "name": "invalidPriceFeedId";
4726
+ "msg": "Invalid price feed ID";
4727
+ },
4728
+ {
4729
+ "code": 6036;
4730
+ "name": "invalidVerifierAccount";
4731
+ "msg": "Invalid verifier account";
4712
4732
  }
4713
4733
  ];
4714
4734
  "types": [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@xitadel-fi/sdk",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "description": "SDK for interacting with the Xitadel program",
6
6
  "main": "dist/sdk/src/index.js",
7
7
  "types": "dist/sdk/src/index.d.ts",