@xitadel-fi/sdk 0.2.3 → 0.2.4
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/dist/sdk/src/program.d.ts +6 -1
- package/dist/sdk/src/program.js +59 -2
- package/package.json +1 -1
|
@@ -454,7 +454,12 @@ export declare class XitadelProgram {
|
|
|
454
454
|
verifier: PublicKey;
|
|
455
455
|
accessController: PublicKey;
|
|
456
456
|
config: PublicKey;
|
|
457
|
-
}): Promise<
|
|
457
|
+
}): Promise<{
|
|
458
|
+
maturateIx: TransactionInstruction;
|
|
459
|
+
createLookupTableIx: TransactionInstruction;
|
|
460
|
+
extendLookupTableIx: TransactionInstruction[];
|
|
461
|
+
lookupTableAddress: PublicKey;
|
|
462
|
+
}>;
|
|
458
463
|
/**
|
|
459
464
|
* Stop liquidation
|
|
460
465
|
* @param lttId The LTT ID
|
package/dist/sdk/src/program.js
CHANGED
|
@@ -709,7 +709,9 @@ class XitadelProgram {
|
|
|
709
709
|
}));
|
|
710
710
|
}
|
|
711
711
|
const signedReport = params.signedReport ?? Buffer.alloc(0);
|
|
712
|
-
const signedReportBuf = Buffer.isBuffer(signedReport)
|
|
712
|
+
const signedReportBuf = Buffer.isBuffer(signedReport)
|
|
713
|
+
? signedReport
|
|
714
|
+
: Buffer.from(signedReport);
|
|
713
715
|
const configPda = this.getConfigPda();
|
|
714
716
|
instructions.push(await this.program.methods
|
|
715
717
|
.activateLtt(signedReportBuf)
|
|
@@ -809,6 +811,56 @@ class XitadelProgram {
|
|
|
809
811
|
const [positionNftAccountB] = web3_js_1.PublicKey.findProgramAddressSync([constants_1.POSITION_NFT_ACCOUNT_SEED, positionNftMintB.toBuffer()], cpAmmProgramId);
|
|
810
812
|
const collateralVaultAta = (0, spl_token_1.getAssociatedTokenAddressSync)(lttConfig.collateralTokenMint, lttConfigPda, true);
|
|
811
813
|
const fundingVaultAta = (0, spl_token_1.getAssociatedTokenAddressSync)(lttConfig.fundingTokenMint, lttConfigPda, true);
|
|
814
|
+
const [createLookupTableIx, lookupTableAddress] = web3_js_1.AddressLookupTableProgram.createLookupTable({
|
|
815
|
+
authority: signer,
|
|
816
|
+
payer: signer,
|
|
817
|
+
recentSlot: await this.program.provider.connection.getSlot(),
|
|
818
|
+
});
|
|
819
|
+
const allAddresses = [
|
|
820
|
+
lttConfigPda,
|
|
821
|
+
lpAuthority,
|
|
822
|
+
poolAuthority,
|
|
823
|
+
pool,
|
|
824
|
+
position,
|
|
825
|
+
poolB,
|
|
826
|
+
positionB,
|
|
827
|
+
fundingVaultAta,
|
|
828
|
+
collateralVaultAta,
|
|
829
|
+
lttConfig.collateralTokenMint,
|
|
830
|
+
priceFeed,
|
|
831
|
+
chainLinkProgram,
|
|
832
|
+
verifierAccounts.verifier,
|
|
833
|
+
verifierAccounts.accessController,
|
|
834
|
+
verifierAccounts.config,
|
|
835
|
+
lttTokenAccount,
|
|
836
|
+
stableCoinTokenAccount,
|
|
837
|
+
lttVault,
|
|
838
|
+
stableVault,
|
|
839
|
+
lttVaultB,
|
|
840
|
+
stableVaultB,
|
|
841
|
+
lttId,
|
|
842
|
+
lttConfig.fundingTokenMint,
|
|
843
|
+
positionNftMint,
|
|
844
|
+
positionNftAccount,
|
|
845
|
+
positionNftMintB,
|
|
846
|
+
positionNftAccountB,
|
|
847
|
+
spl_token_1.TOKEN_PROGRAM_ID,
|
|
848
|
+
spl_token_1.TOKEN_PROGRAM_ID,
|
|
849
|
+
eventAuthority,
|
|
850
|
+
cpAmmProgramId,
|
|
851
|
+
];
|
|
852
|
+
const uniqueAddressesStr = new Set(allAddresses.map(a => a.toBase58()));
|
|
853
|
+
const uniqueAddresses = Array.from(uniqueAddressesStr).map(a => new web3_js_1.PublicKey(a));
|
|
854
|
+
const extendLookupTableIxs = [];
|
|
855
|
+
const chunkSize = 15;
|
|
856
|
+
for (let i = 0; i < uniqueAddresses.length; i += chunkSize) {
|
|
857
|
+
extendLookupTableIxs.push(web3_js_1.AddressLookupTableProgram.extendLookupTable({
|
|
858
|
+
payer: signer,
|
|
859
|
+
authority: signer,
|
|
860
|
+
lookupTable: lookupTableAddress,
|
|
861
|
+
addresses: uniqueAddresses.slice(i, i + chunkSize),
|
|
862
|
+
}));
|
|
863
|
+
}
|
|
812
864
|
const configPda = this.getConfigPda();
|
|
813
865
|
const maturateIx = await this.program.methods
|
|
814
866
|
.maturate(Buffer.from(reportBuffer))
|
|
@@ -848,7 +900,12 @@ class XitadelProgram {
|
|
|
848
900
|
cpAmmProgram: cpAmmProgramId,
|
|
849
901
|
})
|
|
850
902
|
.instruction();
|
|
851
|
-
return
|
|
903
|
+
return {
|
|
904
|
+
maturateIx,
|
|
905
|
+
createLookupTableIx,
|
|
906
|
+
extendLookupTableIx: extendLookupTableIxs,
|
|
907
|
+
lookupTableAddress,
|
|
908
|
+
};
|
|
852
909
|
}
|
|
853
910
|
/**
|
|
854
911
|
* Stop liquidation
|