@xitadel-fi/sdk 0.1.1 → 0.1.3
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.
|
@@ -26,6 +26,13 @@ export declare class XitadelProgram {
|
|
|
26
26
|
* @returns Transaction instruction for initializing the program configuration
|
|
27
27
|
*/
|
|
28
28
|
initConfig(manager: PublicKey, payer?: PublicKey): Promise<TransactionInstruction>;
|
|
29
|
+
/**
|
|
30
|
+
* Transfer manager authority to a new manager
|
|
31
|
+
* @param currentManager The current manager's public key (must sign)
|
|
32
|
+
* @param newManager The new manager's public key
|
|
33
|
+
* @returns Transaction instruction for transferring manager authority
|
|
34
|
+
*/
|
|
35
|
+
transferManager(currentManager: PublicKey, newManager: PublicKey): Promise<TransactionInstruction>;
|
|
29
36
|
/**
|
|
30
37
|
* Helper method to get LTT configuration PDA
|
|
31
38
|
* @param lttId The LTT ID (Pubkey)
|
|
@@ -388,7 +395,12 @@ export declare class XitadelProgram {
|
|
|
388
395
|
stableCoinAmount: BN;
|
|
389
396
|
cpAmmProgramId: PublicKey;
|
|
390
397
|
collateralTokenMint: PublicKey;
|
|
391
|
-
}): Promise<
|
|
398
|
+
}): Promise<{
|
|
399
|
+
activateLttIx: TransactionInstruction[];
|
|
400
|
+
createLookupTableIx: TransactionInstruction;
|
|
401
|
+
extendLookupTableIx: TransactionInstruction;
|
|
402
|
+
lookupTableAddress: PublicKey;
|
|
403
|
+
}>;
|
|
392
404
|
/**
|
|
393
405
|
* Maturate an LTT
|
|
394
406
|
* @param signer
|
package/dist/sdk/src/program.js
CHANGED
|
@@ -61,6 +61,24 @@ class XitadelProgram {
|
|
|
61
61
|
})
|
|
62
62
|
.instruction();
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Transfer manager authority to a new manager
|
|
66
|
+
* @param currentManager The current manager's public key (must sign)
|
|
67
|
+
* @param newManager The new manager's public key
|
|
68
|
+
* @returns Transaction instruction for transferring manager authority
|
|
69
|
+
*/
|
|
70
|
+
async transferManager(currentManager, newManager) {
|
|
71
|
+
const configPda = this.getConfigPda();
|
|
72
|
+
return this.program.methods
|
|
73
|
+
.transferManager()
|
|
74
|
+
.accountsPartial({
|
|
75
|
+
config: configPda,
|
|
76
|
+
currentManager,
|
|
77
|
+
newManager,
|
|
78
|
+
systemProgram: web3_js_2.SystemProgram.programId,
|
|
79
|
+
})
|
|
80
|
+
.instruction();
|
|
81
|
+
}
|
|
64
82
|
/**
|
|
65
83
|
* Helper method to get LTT configuration PDA
|
|
66
84
|
* @param lttId The LTT ID (Pubkey)
|
|
@@ -488,6 +506,8 @@ class XitadelProgram {
|
|
|
488
506
|
const lpAuthority = this.getLpAuthority();
|
|
489
507
|
const lttConfigPda = this.getLTTConfigPda(params.lttId);
|
|
490
508
|
const lttTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(params.lttId, lpAuthority, true);
|
|
509
|
+
const lpUsdcAta = (0, spl_token_1.getAssociatedTokenAddressSync)(params.stableCoinMint, lpAuthority, true);
|
|
510
|
+
const fundingVaultAta = (0, spl_token_1.getAssociatedTokenAddressSync)(params.stableCoinMint, lttConfigPda, true);
|
|
491
511
|
// console.log("lpAuthority", lpAuthority.toBase58());
|
|
492
512
|
const instructions = [];
|
|
493
513
|
// Create stable coin token account if it doesn't exist
|
|
@@ -546,6 +566,44 @@ class XitadelProgram {
|
|
|
546
566
|
const [poolAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('pool_authority')], params.cpAmmProgramId);
|
|
547
567
|
const [eventAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('__event_authority')], params.cpAmmProgramId);
|
|
548
568
|
const collateralVaultAta = (0, spl_token_1.getAssociatedTokenAddressSync)(params.collateralTokenMint, lttConfigPda, true);
|
|
569
|
+
const [createLookupTableIx, lookupTableAddress] = web3_js_1.AddressLookupTableProgram.createLookupTable({
|
|
570
|
+
authority: signer,
|
|
571
|
+
payer: signer,
|
|
572
|
+
recentSlot: await this.program.provider.connection.getSlot(),
|
|
573
|
+
});
|
|
574
|
+
const addresses = [
|
|
575
|
+
lttConfigPda,
|
|
576
|
+
lpAuthority,
|
|
577
|
+
poolAuthority,
|
|
578
|
+
lpMint,
|
|
579
|
+
ammConfig,
|
|
580
|
+
ammConfigB,
|
|
581
|
+
params.lttId,
|
|
582
|
+
params.stableCoinMint,
|
|
583
|
+
fundingVaultAta,
|
|
584
|
+
lttVaultAta,
|
|
585
|
+
stableVaultAta,
|
|
586
|
+
lttTokenAccount,
|
|
587
|
+
lpUsdcAta,
|
|
588
|
+
lttVaultAta,
|
|
589
|
+
stableVaultAta,
|
|
590
|
+
lttVaultAtaB,
|
|
591
|
+
stableVaultAtaB,
|
|
592
|
+
collateralVaultAta,
|
|
593
|
+
eventAuthority,
|
|
594
|
+
spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
595
|
+
web3_js_2.SystemProgram.programId,
|
|
596
|
+
spl_token_1.TOKEN_PROGRAM_ID,
|
|
597
|
+
spl_token_1.TOKEN_2022_PROGRAM_ID,
|
|
598
|
+
params.cpAmmProgramId,
|
|
599
|
+
web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
600
|
+
];
|
|
601
|
+
const extendLookupTableIx = web3_js_1.AddressLookupTableProgram.extendLookupTable({
|
|
602
|
+
payer: signer,
|
|
603
|
+
authority: signer,
|
|
604
|
+
lookupTable: lookupTableAddress,
|
|
605
|
+
addresses,
|
|
606
|
+
});
|
|
549
607
|
instructions.push(await this.program.methods
|
|
550
608
|
.activateLtt()
|
|
551
609
|
.accountsPartial({
|
|
@@ -584,7 +642,12 @@ class XitadelProgram {
|
|
|
584
642
|
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
585
643
|
})
|
|
586
644
|
.instruction());
|
|
587
|
-
return
|
|
645
|
+
return {
|
|
646
|
+
activateLttIx: instructions,
|
|
647
|
+
createLookupTableIx,
|
|
648
|
+
extendLookupTableIx,
|
|
649
|
+
lookupTableAddress,
|
|
650
|
+
};
|
|
588
651
|
}
|
|
589
652
|
/**
|
|
590
653
|
* Maturate an LTT
|
|
@@ -3750,6 +3750,53 @@
|
|
|
3750
3750
|
}
|
|
3751
3751
|
]
|
|
3752
3752
|
},
|
|
3753
|
+
{
|
|
3754
|
+
"name": "transfer_manager",
|
|
3755
|
+
"discriminator": [
|
|
3756
|
+
183,
|
|
3757
|
+
122,
|
|
3758
|
+
218,
|
|
3759
|
+
241,
|
|
3760
|
+
4,
|
|
3761
|
+
151,
|
|
3762
|
+
156,
|
|
3763
|
+
120
|
|
3764
|
+
],
|
|
3765
|
+
"accounts": [
|
|
3766
|
+
{
|
|
3767
|
+
"name": "config",
|
|
3768
|
+
"writable": true,
|
|
3769
|
+
"pda": {
|
|
3770
|
+
"seeds": [
|
|
3771
|
+
{
|
|
3772
|
+
"kind": "const",
|
|
3773
|
+
"value": [
|
|
3774
|
+
99,
|
|
3775
|
+
111,
|
|
3776
|
+
110,
|
|
3777
|
+
102,
|
|
3778
|
+
105,
|
|
3779
|
+
103
|
|
3780
|
+
]
|
|
3781
|
+
}
|
|
3782
|
+
]
|
|
3783
|
+
}
|
|
3784
|
+
},
|
|
3785
|
+
{
|
|
3786
|
+
"name": "current_manager",
|
|
3787
|
+
"writable": true,
|
|
3788
|
+
"signer": true
|
|
3789
|
+
},
|
|
3790
|
+
{
|
|
3791
|
+
"name": "new_manager"
|
|
3792
|
+
},
|
|
3793
|
+
{
|
|
3794
|
+
"name": "system_program",
|
|
3795
|
+
"address": "11111111111111111111111111111111"
|
|
3796
|
+
}
|
|
3797
|
+
],
|
|
3798
|
+
"args": []
|
|
3799
|
+
},
|
|
3753
3800
|
{
|
|
3754
3801
|
"name": "update_ltt_status",
|
|
3755
3802
|
"discriminator": [
|
|
@@ -4703,6 +4750,26 @@
|
|
|
4703
4750
|
"code": 6032,
|
|
4704
4751
|
"name": "InvalidAccount",
|
|
4705
4752
|
"msg": "Invalid Account"
|
|
4753
|
+
},
|
|
4754
|
+
{
|
|
4755
|
+
"code": 6033,
|
|
4756
|
+
"name": "InvalidAccessController",
|
|
4757
|
+
"msg": "Invalid access controller account"
|
|
4758
|
+
},
|
|
4759
|
+
{
|
|
4760
|
+
"code": 6034,
|
|
4761
|
+
"name": "InvalidConfigAccount",
|
|
4762
|
+
"msg": "Invalid config account"
|
|
4763
|
+
},
|
|
4764
|
+
{
|
|
4765
|
+
"code": 6035,
|
|
4766
|
+
"name": "InvalidPriceFeedId",
|
|
4767
|
+
"msg": "Invalid price feed ID"
|
|
4768
|
+
},
|
|
4769
|
+
{
|
|
4770
|
+
"code": 6036,
|
|
4771
|
+
"name": "InvalidVerifierAccount",
|
|
4772
|
+
"msg": "Invalid verifier account"
|
|
4706
4773
|
}
|
|
4707
4774
|
],
|
|
4708
4775
|
"types": [
|
|
@@ -3756,6 +3756,53 @@ export type Xitadel = {
|
|
|
3756
3756
|
}
|
|
3757
3757
|
];
|
|
3758
3758
|
},
|
|
3759
|
+
{
|
|
3760
|
+
"name": "transferManager";
|
|
3761
|
+
"discriminator": [
|
|
3762
|
+
183,
|
|
3763
|
+
122,
|
|
3764
|
+
218,
|
|
3765
|
+
241,
|
|
3766
|
+
4,
|
|
3767
|
+
151,
|
|
3768
|
+
156,
|
|
3769
|
+
120
|
|
3770
|
+
];
|
|
3771
|
+
"accounts": [
|
|
3772
|
+
{
|
|
3773
|
+
"name": "config";
|
|
3774
|
+
"writable": true;
|
|
3775
|
+
"pda": {
|
|
3776
|
+
"seeds": [
|
|
3777
|
+
{
|
|
3778
|
+
"kind": "const";
|
|
3779
|
+
"value": [
|
|
3780
|
+
99,
|
|
3781
|
+
111,
|
|
3782
|
+
110,
|
|
3783
|
+
102,
|
|
3784
|
+
105,
|
|
3785
|
+
103
|
|
3786
|
+
];
|
|
3787
|
+
}
|
|
3788
|
+
];
|
|
3789
|
+
};
|
|
3790
|
+
},
|
|
3791
|
+
{
|
|
3792
|
+
"name": "currentManager";
|
|
3793
|
+
"writable": true;
|
|
3794
|
+
"signer": true;
|
|
3795
|
+
},
|
|
3796
|
+
{
|
|
3797
|
+
"name": "newManager";
|
|
3798
|
+
},
|
|
3799
|
+
{
|
|
3800
|
+
"name": "systemProgram";
|
|
3801
|
+
"address": "11111111111111111111111111111111";
|
|
3802
|
+
}
|
|
3803
|
+
];
|
|
3804
|
+
"args": [];
|
|
3805
|
+
},
|
|
3759
3806
|
{
|
|
3760
3807
|
"name": "updateLttStatus";
|
|
3761
3808
|
"discriminator": [
|
|
@@ -4709,6 +4756,26 @@ export type Xitadel = {
|
|
|
4709
4756
|
"code": 6032;
|
|
4710
4757
|
"name": "invalidAccount";
|
|
4711
4758
|
"msg": "Invalid Account";
|
|
4759
|
+
},
|
|
4760
|
+
{
|
|
4761
|
+
"code": 6033;
|
|
4762
|
+
"name": "invalidAccessController";
|
|
4763
|
+
"msg": "Invalid access controller account";
|
|
4764
|
+
},
|
|
4765
|
+
{
|
|
4766
|
+
"code": 6034;
|
|
4767
|
+
"name": "invalidConfigAccount";
|
|
4768
|
+
"msg": "Invalid config account";
|
|
4769
|
+
},
|
|
4770
|
+
{
|
|
4771
|
+
"code": 6035;
|
|
4772
|
+
"name": "invalidPriceFeedId";
|
|
4773
|
+
"msg": "Invalid price feed ID";
|
|
4774
|
+
},
|
|
4775
|
+
{
|
|
4776
|
+
"code": 6036;
|
|
4777
|
+
"name": "invalidVerifierAccount";
|
|
4778
|
+
"msg": "Invalid verifier account";
|
|
4712
4779
|
}
|
|
4713
4780
|
];
|
|
4714
4781
|
"types": [
|