@voltr/vault-sdk 1.0.18 → 1.0.20
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/client.d.ts +307 -19
- package/dist/client.js +376 -28
- package/dist/constants.d.ts +0 -2
- package/dist/constants.js +1 -3
- package/dist/idl/voltr_vault.json +1783 -94
- package/dist/types/vault.d.ts +19 -0
- package/dist/types/vault.js +11 -1
- package/dist/types/voltr_vault.d.ts +1784 -95
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Program, AnchorProvider, Idl } from "@coral-xyz/anchor";
|
|
2
2
|
import BN from "bn.js";
|
|
3
3
|
import { ConfirmOptions, Connection, Keypair, PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
4
|
-
import { VaultParams, VoltrVault, InitializeStrategyArgs, DepositStrategyArgs, WithdrawStrategyArgs, InitializeDirectWithdrawStrategyArgs, RequestWithdrawVaultArgs, VaultConfigField } from "./types";
|
|
4
|
+
import { VaultParams, VoltrVault, InitializeStrategyArgs, DepositStrategyArgs, WithdrawStrategyArgs, InitializeDirectWithdrawStrategyArgs, RequestWithdrawVaultArgs, InstantWithdrawVaultArgs, InstantWithdrawStrategyArgs, VaultConfigField, ProtocolConfigField, ProtocolFeeField } from "./types";
|
|
5
5
|
declare class AccountUtils {
|
|
6
6
|
conn: Connection;
|
|
7
7
|
constructor(conn: Connection);
|
|
@@ -135,6 +135,92 @@ export declare class VoltrClient extends AccountUtils {
|
|
|
135
135
|
* ```
|
|
136
136
|
*/
|
|
137
137
|
findLpMetadataAccount(vault: PublicKey): PublicKey;
|
|
138
|
+
/**
|
|
139
|
+
* Finds the protocol PDA address
|
|
140
|
+
* @returns The PDA for the protocol account
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```typescript
|
|
144
|
+
* const protocol = client.findProtocol();
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
findProtocol(): PublicKey;
|
|
148
|
+
/**
|
|
149
|
+
* Creates an instruction to initialize the protocol
|
|
150
|
+
*
|
|
151
|
+
* @param {number} operationalState - Bitflags for allowed operations (e.g., CREATE_VAULT = 1, DEPOSIT_VAULT = 2, etc.)
|
|
152
|
+
* @param {Object} params - Parameters for initializing the protocol
|
|
153
|
+
* @param {PublicKey} params.payer - Public key of the fee payer
|
|
154
|
+
* @param {PublicKey} params.admin - Public key of the protocol admin
|
|
155
|
+
* @returns {Promise<TransactionInstruction>} Transaction instruction for initializing the protocol
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* const ix = await client.createInitProtocolIx(
|
|
160
|
+
* 0xFFFF, // enable all operations
|
|
161
|
+
* {
|
|
162
|
+
* payer: payerPubkey,
|
|
163
|
+
* admin: adminPubkey,
|
|
164
|
+
* }
|
|
165
|
+
* );
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
createInitProtocolIx(operationalState: number, { payer, admin, }: {
|
|
169
|
+
payer: PublicKey;
|
|
170
|
+
admin: PublicKey;
|
|
171
|
+
}): Promise<TransactionInstruction>;
|
|
172
|
+
/**
|
|
173
|
+
* Creates an instruction to update the protocol configuration
|
|
174
|
+
*
|
|
175
|
+
* @param {ProtocolConfigField} field - The protocol configuration field to update
|
|
176
|
+
* @param {Buffer} data - The serialized data for the new value
|
|
177
|
+
* @param {Object} params - Parameters for updating the protocol
|
|
178
|
+
* @param {PublicKey} params.admin - Public key of the protocol admin
|
|
179
|
+
* @returns {Promise<TransactionInstruction>} Transaction instruction for updating the protocol
|
|
180
|
+
*
|
|
181
|
+
* @throws {Error} If the field is unknown
|
|
182
|
+
*
|
|
183
|
+
* @example Update operational state
|
|
184
|
+
* ```typescript
|
|
185
|
+
* const data = Buffer.alloc(2);
|
|
186
|
+
* data.writeUInt16LE(0xFFFF, 0);
|
|
187
|
+
* const ix = await client.createUpdateProtocolIx(
|
|
188
|
+
* ProtocolConfigField.OperationalState,
|
|
189
|
+
* data,
|
|
190
|
+
* { admin: adminPubkey }
|
|
191
|
+
* );
|
|
192
|
+
* ```
|
|
193
|
+
*
|
|
194
|
+
* @example Set pending admin for 2-step transfer
|
|
195
|
+
* ```typescript
|
|
196
|
+
* const data = newAdmin.toBuffer();
|
|
197
|
+
* const ix = await client.createUpdateProtocolIx(
|
|
198
|
+
* ProtocolConfigField.PendingAdmin,
|
|
199
|
+
* data,
|
|
200
|
+
* { admin: adminPubkey }
|
|
201
|
+
* );
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
createUpdateProtocolIx(field: ProtocolConfigField, data: Buffer, { admin, }: {
|
|
205
|
+
admin: PublicKey;
|
|
206
|
+
}): Promise<TransactionInstruction>;
|
|
207
|
+
/**
|
|
208
|
+
* Creates an instruction to accept a protocol admin transfer (2-step admin transfer)
|
|
209
|
+
*
|
|
210
|
+
* @param {Object} params - Parameters for accepting protocol admin
|
|
211
|
+
* @param {PublicKey} params.pendingAdmin - Public key of the pending admin (must be signer)
|
|
212
|
+
* @returns {Promise<TransactionInstruction>} Transaction instruction for accepting protocol admin
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```typescript
|
|
216
|
+
* const ix = await client.createAcceptProtocolAdminIx({
|
|
217
|
+
* pendingAdmin: pendingAdminPubkey,
|
|
218
|
+
* });
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
createAcceptProtocolAdminIx({ pendingAdmin, }: {
|
|
222
|
+
pendingAdmin: PublicKey;
|
|
223
|
+
}): Promise<TransactionInstruction>;
|
|
138
224
|
/**
|
|
139
225
|
* Creates an instruction to initialize a new vault
|
|
140
226
|
*
|
|
@@ -399,6 +485,45 @@ export declare class VoltrClient extends AccountUtils {
|
|
|
399
485
|
vaultAssetMint: PublicKey;
|
|
400
486
|
assetTokenProgram: PublicKey;
|
|
401
487
|
}): Promise<TransactionInstruction>;
|
|
488
|
+
/**
|
|
489
|
+
* Creates an instant withdraw instruction for a vault (no waiting period required)
|
|
490
|
+
*
|
|
491
|
+
* @param {InstantWithdrawVaultArgs} args - Instant withdrawal arguments
|
|
492
|
+
* @param {BN} args.amount - Amount to withdraw (in LP tokens or asset, depending on isAmountInLp)
|
|
493
|
+
* @param {boolean} args.isAmountInLp - Whether the amount is denominated in LP tokens
|
|
494
|
+
* @param {boolean} args.isWithdrawAll - Whether to withdraw all user's LP tokens
|
|
495
|
+
* @param {Object} params - Instant withdraw parameters
|
|
496
|
+
* @param {PublicKey} params.userTransferAuthority - Public key of the user's transfer authority
|
|
497
|
+
* @param {PublicKey} params.vault - Public key of the vault
|
|
498
|
+
* @param {PublicKey} params.vaultAssetMint - Public key of the vault asset mint
|
|
499
|
+
* @param {PublicKey} params.assetTokenProgram - Public key of the asset token program
|
|
500
|
+
* @returns {Promise<TransactionInstruction>} Transaction instruction for instant withdrawal
|
|
501
|
+
*
|
|
502
|
+
* @throws {Error} If the vault's withdrawal waiting period is not zero
|
|
503
|
+
*
|
|
504
|
+
* @example
|
|
505
|
+
* ```typescript
|
|
506
|
+
* const ix = await client.createInstantWithdrawVaultIx(
|
|
507
|
+
* {
|
|
508
|
+
* amount: new BN('1000000000'),
|
|
509
|
+
* isAmountInLp: true,
|
|
510
|
+
* isWithdrawAll: false,
|
|
511
|
+
* },
|
|
512
|
+
* {
|
|
513
|
+
* userTransferAuthority: userPubkey,
|
|
514
|
+
* vault: vaultPubkey,
|
|
515
|
+
* vaultAssetMint: mintPubkey,
|
|
516
|
+
* assetTokenProgram: tokenProgramPubkey,
|
|
517
|
+
* }
|
|
518
|
+
* );
|
|
519
|
+
* ```
|
|
520
|
+
*/
|
|
521
|
+
createInstantWithdrawVaultIx({ amount, isAmountInLp, isWithdrawAll }: InstantWithdrawVaultArgs, { userTransferAuthority, vault, vaultAssetMint, assetTokenProgram, }: {
|
|
522
|
+
userTransferAuthority: PublicKey;
|
|
523
|
+
vault: PublicKey;
|
|
524
|
+
vaultAssetMint: PublicKey;
|
|
525
|
+
assetTokenProgram: PublicKey;
|
|
526
|
+
}): Promise<TransactionInstruction>;
|
|
402
527
|
/**
|
|
403
528
|
* Creates an instruction to add an adaptor to a vault
|
|
404
529
|
* @param {Object} params - Parameters for adding adaptor to vault
|
|
@@ -424,7 +549,7 @@ export declare class VoltrClient extends AccountUtils {
|
|
|
424
549
|
vault: PublicKey;
|
|
425
550
|
payer: PublicKey;
|
|
426
551
|
admin: PublicKey;
|
|
427
|
-
adaptorProgram
|
|
552
|
+
adaptorProgram: PublicKey;
|
|
428
553
|
}): Promise<TransactionInstruction>;
|
|
429
554
|
/**
|
|
430
555
|
* Creates an instruction to initialize a strategy to a vault
|
|
@@ -464,7 +589,7 @@ export declare class VoltrClient extends AccountUtils {
|
|
|
464
589
|
vault: PublicKey;
|
|
465
590
|
manager: PublicKey;
|
|
466
591
|
strategy: PublicKey;
|
|
467
|
-
adaptorProgram
|
|
592
|
+
adaptorProgram: PublicKey;
|
|
468
593
|
remainingAccounts: Array<{
|
|
469
594
|
pubkey: PublicKey;
|
|
470
595
|
isSigner: boolean;
|
|
@@ -515,7 +640,7 @@ export declare class VoltrClient extends AccountUtils {
|
|
|
515
640
|
vaultAssetMint: PublicKey;
|
|
516
641
|
strategy: PublicKey;
|
|
517
642
|
assetTokenProgram: PublicKey;
|
|
518
|
-
adaptorProgram
|
|
643
|
+
adaptorProgram: PublicKey;
|
|
519
644
|
remainingAccounts: Array<{
|
|
520
645
|
pubkey: PublicKey;
|
|
521
646
|
isSigner: boolean;
|
|
@@ -564,7 +689,7 @@ export declare class VoltrClient extends AccountUtils {
|
|
|
564
689
|
vaultAssetMint: PublicKey;
|
|
565
690
|
strategy: PublicKey;
|
|
566
691
|
assetTokenProgram: PublicKey;
|
|
567
|
-
adaptorProgram
|
|
692
|
+
adaptorProgram: PublicKey;
|
|
568
693
|
remainingAccounts: Array<{
|
|
569
694
|
pubkey: PublicKey;
|
|
570
695
|
isSigner: boolean;
|
|
@@ -592,7 +717,7 @@ export declare class VoltrClient extends AccountUtils {
|
|
|
592
717
|
createRemoveAdaptorIx({ vault, admin, adaptorProgram, }: {
|
|
593
718
|
vault: PublicKey;
|
|
594
719
|
admin: PublicKey;
|
|
595
|
-
adaptorProgram
|
|
720
|
+
adaptorProgram: PublicKey;
|
|
596
721
|
}): Promise<TransactionInstruction>;
|
|
597
722
|
/**
|
|
598
723
|
* Creates an instruction to initialize a direct withdraw strategy
|
|
@@ -632,7 +757,7 @@ export declare class VoltrClient extends AccountUtils {
|
|
|
632
757
|
admin: PublicKey;
|
|
633
758
|
vault: PublicKey;
|
|
634
759
|
strategy: PublicKey;
|
|
635
|
-
adaptorProgram
|
|
760
|
+
adaptorProgram: PublicKey;
|
|
636
761
|
}): Promise<TransactionInstruction>;
|
|
637
762
|
/**
|
|
638
763
|
* Creates an instruction to withdraw assets from a direct withdraw strategy
|
|
@@ -675,7 +800,7 @@ export declare class VoltrClient extends AccountUtils {
|
|
|
675
800
|
strategy: PublicKey;
|
|
676
801
|
vaultAssetMint: PublicKey;
|
|
677
802
|
assetTokenProgram: PublicKey;
|
|
678
|
-
adaptorProgram
|
|
803
|
+
adaptorProgram: PublicKey;
|
|
679
804
|
remainingAccounts: Array<{
|
|
680
805
|
pubkey: PublicKey;
|
|
681
806
|
isSigner: boolean;
|
|
@@ -683,19 +808,20 @@ export declare class VoltrClient extends AccountUtils {
|
|
|
683
808
|
}>;
|
|
684
809
|
}): Promise<TransactionInstruction>;
|
|
685
810
|
/**
|
|
686
|
-
* Creates an instruction to withdraw assets from a
|
|
687
|
-
*
|
|
688
|
-
* @param {
|
|
689
|
-
* @param {
|
|
811
|
+
* Creates an instruction to withdraw assets from a direct withdraw strategy with slippage tolerance
|
|
812
|
+
*
|
|
813
|
+
* @param {Object} directWithdrawArgs - Withdrawal arguments
|
|
814
|
+
* @param {Buffer | null} [directWithdrawArgs.userArgs] - Optional user arguments for the instruction
|
|
815
|
+
* @param {BN} directWithdrawArgs.tolerance - Slippage tolerance in asset amount (max difference between requested and actual)
|
|
690
816
|
* @param {Object} params - Parameters for withdrawing assets from direct withdraw strategy
|
|
691
817
|
* @param {PublicKey} params.user - Public key of the user
|
|
692
818
|
* @param {PublicKey} params.vault - Public key of the vault
|
|
693
819
|
* @param {PublicKey} params.strategy - Public key of the strategy
|
|
694
820
|
* @param {PublicKey} params.vaultAssetMint - Public key of the vault asset mint
|
|
695
821
|
* @param {PublicKey} params.assetTokenProgram - Public key of the asset token program
|
|
696
|
-
* @param {PublicKey} params.adaptorProgram - Public key of the adaptor program
|
|
822
|
+
* @param {PublicKey} [params.adaptorProgram] - Public key of the adaptor program (defaults to lending adaptor)
|
|
697
823
|
* @param {Array<{ pubkey: PublicKey, isSigner: boolean, isWritable: boolean }>} params.remainingAccounts - Remaining accounts for the instruction
|
|
698
|
-
* @returns {Promise<TransactionInstruction>} Transaction instruction for
|
|
824
|
+
* @returns {Promise<TransactionInstruction>} Transaction instruction for direct withdraw with tolerance
|
|
699
825
|
* @throws {Error} If instruction creation fails
|
|
700
826
|
*
|
|
701
827
|
* @example
|
|
@@ -703,7 +829,7 @@ export declare class VoltrClient extends AccountUtils {
|
|
|
703
829
|
* const ix = await client.createDirectWithdrawStrategyWithToleranceIx(
|
|
704
830
|
* {
|
|
705
831
|
* userArgs: Buffer.from('...'),
|
|
706
|
-
* tolerance: new BN(
|
|
832
|
+
* tolerance: new BN(1000),
|
|
707
833
|
* },
|
|
708
834
|
* {
|
|
709
835
|
* user: userPubkey,
|
|
@@ -711,8 +837,7 @@ export declare class VoltrClient extends AccountUtils {
|
|
|
711
837
|
* strategy: strategyPubkey,
|
|
712
838
|
* vaultAssetMint: mintPubkey,
|
|
713
839
|
* assetTokenProgram: tokenProgramPubkey,
|
|
714
|
-
*
|
|
715
|
-
* remainingAccounts: []
|
|
840
|
+
* remainingAccounts: [],
|
|
716
841
|
* }
|
|
717
842
|
* );
|
|
718
843
|
* ```
|
|
@@ -726,7 +851,113 @@ export declare class VoltrClient extends AccountUtils {
|
|
|
726
851
|
strategy: PublicKey;
|
|
727
852
|
vaultAssetMint: PublicKey;
|
|
728
853
|
assetTokenProgram: PublicKey;
|
|
729
|
-
adaptorProgram
|
|
854
|
+
adaptorProgram: PublicKey;
|
|
855
|
+
remainingAccounts: Array<{
|
|
856
|
+
pubkey: PublicKey;
|
|
857
|
+
isSigner: boolean;
|
|
858
|
+
isWritable: boolean;
|
|
859
|
+
}>;
|
|
860
|
+
}): Promise<TransactionInstruction>;
|
|
861
|
+
/**
|
|
862
|
+
* Creates an instant withdraw instruction for a strategy (no waiting period, withdraws directly from strategy)
|
|
863
|
+
*
|
|
864
|
+
* @param {InstantWithdrawStrategyArgs} args - Instant withdrawal arguments
|
|
865
|
+
* @param {BN} args.amount - Amount to withdraw (in LP tokens or asset, depending on isAmountInLp)
|
|
866
|
+
* @param {boolean} args.isAmountInLp - Whether the amount is denominated in LP tokens
|
|
867
|
+
* @param {boolean} args.isWithdrawAll - Whether to withdraw all user's LP tokens
|
|
868
|
+
* @param {Buffer | null} [args.userArgs] - Optional user arguments passed to the adaptor
|
|
869
|
+
* @param {Object} params - Instant withdraw strategy parameters
|
|
870
|
+
* @param {PublicKey} params.userTransferAuthority - Public key of the user's transfer authority
|
|
871
|
+
* @param {PublicKey} params.vault - Public key of the vault
|
|
872
|
+
* @param {PublicKey} params.strategy - Public key of the strategy
|
|
873
|
+
* @param {PublicKey} params.vaultAssetMint - Public key of the vault asset mint
|
|
874
|
+
* @param {PublicKey} params.assetTokenProgram - Public key of the asset token program
|
|
875
|
+
* @param {PublicKey} [params.adaptorProgram] - Public key of the adaptor program (defaults to lending adaptor)
|
|
876
|
+
* @param {Array<{ pubkey: PublicKey, isSigner: boolean, isWritable: boolean }>} params.remainingAccounts - Remaining accounts for the instruction
|
|
877
|
+
* @returns {Promise<TransactionInstruction>} Transaction instruction for instant strategy withdrawal
|
|
878
|
+
* @throws {Error} If the vault's withdrawal waiting period is not zero
|
|
879
|
+
*
|
|
880
|
+
* @example
|
|
881
|
+
* ```typescript
|
|
882
|
+
* const ix = await client.createInstantWithdrawStrategyIx(
|
|
883
|
+
* {
|
|
884
|
+
* amount: new BN('1000000000'),
|
|
885
|
+
* isAmountInLp: true,
|
|
886
|
+
* isWithdrawAll: false,
|
|
887
|
+
* },
|
|
888
|
+
* {
|
|
889
|
+
* userTransferAuthority: userPubkey,
|
|
890
|
+
* vault: vaultPubkey,
|
|
891
|
+
* strategy: strategyPubkey,
|
|
892
|
+
* vaultAssetMint: mintPubkey,
|
|
893
|
+
* assetTokenProgram: tokenProgramPubkey,
|
|
894
|
+
* remainingAccounts: [],
|
|
895
|
+
* }
|
|
896
|
+
* );
|
|
897
|
+
* ```
|
|
898
|
+
*/
|
|
899
|
+
createInstantWithdrawStrategyIx({ amount, isAmountInLp, isWithdrawAll, userArgs, }: InstantWithdrawStrategyArgs, { userTransferAuthority, vault, strategy, vaultAssetMint, assetTokenProgram, adaptorProgram, remainingAccounts, }: {
|
|
900
|
+
userTransferAuthority: PublicKey;
|
|
901
|
+
vault: PublicKey;
|
|
902
|
+
strategy: PublicKey;
|
|
903
|
+
vaultAssetMint: PublicKey;
|
|
904
|
+
assetTokenProgram: PublicKey;
|
|
905
|
+
adaptorProgram: PublicKey;
|
|
906
|
+
remainingAccounts: Array<{
|
|
907
|
+
pubkey: PublicKey;
|
|
908
|
+
isSigner: boolean;
|
|
909
|
+
isWritable: boolean;
|
|
910
|
+
}>;
|
|
911
|
+
}): Promise<TransactionInstruction>;
|
|
912
|
+
/**
|
|
913
|
+
* Creates an instant withdraw instruction for a strategy with slippage tolerance
|
|
914
|
+
*
|
|
915
|
+
* @param {InstantWithdrawStrategyArgs & { tolerance: BN }} args - Instant withdrawal arguments with tolerance
|
|
916
|
+
* @param {BN} args.amount - Amount to withdraw (in LP tokens or asset, depending on isAmountInLp)
|
|
917
|
+
* @param {boolean} args.isAmountInLp - Whether the amount is denominated in LP tokens
|
|
918
|
+
* @param {boolean} args.isWithdrawAll - Whether to withdraw all user's LP tokens
|
|
919
|
+
* @param {Buffer | null} [args.userArgs] - Optional user arguments passed to the adaptor
|
|
920
|
+
* @param {BN} args.tolerance - Slippage tolerance in asset amount (max difference between requested and actual)
|
|
921
|
+
* @param {Object} params - Instant withdraw strategy parameters
|
|
922
|
+
* @param {PublicKey} params.userTransferAuthority - Public key of the user's transfer authority
|
|
923
|
+
* @param {PublicKey} params.vault - Public key of the vault
|
|
924
|
+
* @param {PublicKey} params.strategy - Public key of the strategy
|
|
925
|
+
* @param {PublicKey} params.vaultAssetMint - Public key of the vault asset mint
|
|
926
|
+
* @param {PublicKey} params.assetTokenProgram - Public key of the asset token program
|
|
927
|
+
* @param {PublicKey} [params.adaptorProgram] - Public key of the adaptor program (defaults to lending adaptor)
|
|
928
|
+
* @param {Array<{ pubkey: PublicKey, isSigner: boolean, isWritable: boolean }>} params.remainingAccounts - Remaining accounts for the instruction
|
|
929
|
+
* @returns {Promise<TransactionInstruction>} Transaction instruction for instant strategy withdrawal with tolerance
|
|
930
|
+
* @throws {Error} If the vault's withdrawal waiting period is not zero
|
|
931
|
+
*
|
|
932
|
+
* @example
|
|
933
|
+
* ```typescript
|
|
934
|
+
* const ix = await client.createInstantWithdrawStrategyWithToleranceIx(
|
|
935
|
+
* {
|
|
936
|
+
* amount: new BN('1000000000'),
|
|
937
|
+
* isAmountInLp: true,
|
|
938
|
+
* isWithdrawAll: false,
|
|
939
|
+
* tolerance: new BN(1000),
|
|
940
|
+
* },
|
|
941
|
+
* {
|
|
942
|
+
* userTransferAuthority: userPubkey,
|
|
943
|
+
* vault: vaultPubkey,
|
|
944
|
+
* strategy: strategyPubkey,
|
|
945
|
+
* vaultAssetMint: mintPubkey,
|
|
946
|
+
* assetTokenProgram: tokenProgramPubkey,
|
|
947
|
+
* remainingAccounts: [],
|
|
948
|
+
* }
|
|
949
|
+
* );
|
|
950
|
+
* ```
|
|
951
|
+
*/
|
|
952
|
+
createInstantWithdrawStrategyWithToleranceIx({ amount, isAmountInLp, isWithdrawAll, userArgs, tolerance, }: InstantWithdrawStrategyArgs & {
|
|
953
|
+
tolerance: BN;
|
|
954
|
+
}, { userTransferAuthority, vault, strategy, vaultAssetMint, assetTokenProgram, adaptorProgram, remainingAccounts, }: {
|
|
955
|
+
userTransferAuthority: PublicKey;
|
|
956
|
+
vault: PublicKey;
|
|
957
|
+
strategy: PublicKey;
|
|
958
|
+
vaultAssetMint: PublicKey;
|
|
959
|
+
assetTokenProgram: PublicKey;
|
|
960
|
+
adaptorProgram: PublicKey;
|
|
730
961
|
remainingAccounts: Array<{
|
|
731
962
|
pubkey: PublicKey;
|
|
732
963
|
isSigner: boolean;
|
|
@@ -839,6 +1070,34 @@ export declare class VoltrClient extends AccountUtils {
|
|
|
839
1070
|
admin: PublicKey;
|
|
840
1071
|
vault: PublicKey;
|
|
841
1072
|
}): Promise<TransactionInstruction>;
|
|
1073
|
+
/**
|
|
1074
|
+
* Creates an instruction to update per-vault protocol fees (admin-only, protocol level)
|
|
1075
|
+
*
|
|
1076
|
+
* @param {ProtocolFeeField} field - The protocol fee field to update
|
|
1077
|
+
* @param {number} feeBps - The new fee value in basis points
|
|
1078
|
+
* @param {Object} params - Parameters for updating the protocol fee
|
|
1079
|
+
* @param {PublicKey} params.admin - Public key of the protocol admin
|
|
1080
|
+
* @param {PublicKey} params.vault - Public key of the vault
|
|
1081
|
+
* @returns {Promise<TransactionInstruction>} Transaction instruction for updating the protocol fee
|
|
1082
|
+
*
|
|
1083
|
+
* @throws {Error} If the total fee (protocol + admin + manager) exceeds 10000 BPS
|
|
1084
|
+
*
|
|
1085
|
+
* @example
|
|
1086
|
+
* ```typescript
|
|
1087
|
+
* const ix = await client.createUpdateVaultProtocolFeeIx(
|
|
1088
|
+
* ProtocolFeeField.ProtocolPerformanceFee,
|
|
1089
|
+
* 500, // 5%
|
|
1090
|
+
* {
|
|
1091
|
+
* admin: protocolAdminPubkey,
|
|
1092
|
+
* vault: vaultPubkey,
|
|
1093
|
+
* }
|
|
1094
|
+
* );
|
|
1095
|
+
* ```
|
|
1096
|
+
*/
|
|
1097
|
+
createUpdateVaultProtocolFeeIx(field: ProtocolFeeField, feeBps: number, { admin, vault, }: {
|
|
1098
|
+
admin: PublicKey;
|
|
1099
|
+
vault: PublicKey;
|
|
1100
|
+
}): Promise<TransactionInstruction>;
|
|
842
1101
|
/**
|
|
843
1102
|
* Fetches all strategy init receipt accounts
|
|
844
1103
|
* @returns Promise resolving to an array of strategy init receipt accounts
|
|
@@ -925,6 +1184,24 @@ export declare class VoltrClient extends AccountUtils {
|
|
|
925
1184
|
* @param vault - Public key of the vault
|
|
926
1185
|
* @returns Promise resolving to the vault account data
|
|
927
1186
|
*/
|
|
1187
|
+
/**
|
|
1188
|
+
* Fetches the protocol account's data
|
|
1189
|
+
* @returns Promise resolving to the protocol account data
|
|
1190
|
+
*
|
|
1191
|
+
* @example
|
|
1192
|
+
* ```typescript
|
|
1193
|
+
* const protocolAccount = await client.fetchProtocolAccount();
|
|
1194
|
+
* ```
|
|
1195
|
+
*/
|
|
1196
|
+
fetchProtocolAccount(): Promise<{
|
|
1197
|
+
admin: PublicKey;
|
|
1198
|
+
operationalState: number;
|
|
1199
|
+
padding1: number[];
|
|
1200
|
+
bump: number;
|
|
1201
|
+
padding0: number[];
|
|
1202
|
+
pendingAdmin: PublicKey;
|
|
1203
|
+
reserved: number[];
|
|
1204
|
+
}>;
|
|
928
1205
|
fetchVaultAccount(vault: PublicKey): Promise<{
|
|
929
1206
|
name: number[];
|
|
930
1207
|
description: number[];
|
|
@@ -1087,6 +1364,17 @@ export declare class VoltrClient extends AccountUtils {
|
|
|
1087
1364
|
* ```
|
|
1088
1365
|
*/
|
|
1089
1366
|
getAccumulatedManagerFeesForVault(vault: PublicKey): Promise<BN>;
|
|
1367
|
+
/**
|
|
1368
|
+
* Fetches the accumulated protocol fees for a vault
|
|
1369
|
+
* @param vault - Public key of the vault
|
|
1370
|
+
* @returns Promise resolving to the accumulated protocol fees
|
|
1371
|
+
*
|
|
1372
|
+
* @example
|
|
1373
|
+
* ```typescript
|
|
1374
|
+
* const accumulatedProtocolFees = await client.getAccumulatedProtocolFeesForVault(vaultPubkey);
|
|
1375
|
+
* ```
|
|
1376
|
+
*/
|
|
1377
|
+
getAccumulatedProtocolFeesForVault(vault: PublicKey): Promise<BN>;
|
|
1090
1378
|
/**
|
|
1091
1379
|
* Fetches the current asset per LP for a vault
|
|
1092
1380
|
* @param vault - Public key of the vault
|
|
@@ -1175,7 +1463,7 @@ export declare class VoltrClient extends AccountUtils {
|
|
|
1175
1463
|
* Helper to calculate only the pending (unrealised) LP fees based on time elapsed.
|
|
1176
1464
|
*/
|
|
1177
1465
|
private calculateUnrealisedLpFees;
|
|
1178
|
-
calculateAssetsForWithdrawHelper(vaultTotalValue: BN, vaultLastUpdatedLockedProfit: BN, vaultLockedProfitDegradationDuration: BN, vaultAccumulatedLpAdminFees: BN, vaultAccumulatedLpManagerFees: BN, vaultAccumulatedLpProtocolFees: BN, vaultRedemptionFeeBps: number, vaultManagementFeeBps: number, vaultLastManagementFeeUpdateTs: BN, lpSupply: BN, lpAmount: BN): BN;
|
|
1466
|
+
calculateAssetsForWithdrawHelper(vaultTotalValue: BN, vaultLastUpdatedLockedProfit: BN, vaultLockedProfitDegradationDuration: BN, vaultAccumulatedLpAdminFees: BN, vaultAccumulatedLpManagerFees: BN, vaultAccumulatedLpProtocolFees: BN, vaultRedemptionFeeBps: number, vaultManagementFeeBps: number, vaultLastManagementFeeUpdateTs: BN, lpSupply: BN, lpAmount: BN, deadWeight?: BN): BN;
|
|
1179
1467
|
/**
|
|
1180
1468
|
* Calculates the amount of assets that would be received for a given LP token amount
|
|
1181
1469
|
*
|