@voltr/vault-sdk 1.0.3 → 1.0.5

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/README.md CHANGED
@@ -244,9 +244,11 @@ pendingWithdrawals.forEach((withdrawal, index) => {
244
244
 
245
245
  - `createInitializeVaultIx(vaultParams, params)`
246
246
  - `createUpdateVaultIx(vaultConfig, params)`
247
+ - `createDepositVaultIx(amount, params)`
247
248
  - `createRequestWithdrawVaultIx(requestWithdrawArgs, params)`
248
249
  - `createCancelRequestWithdrawVaultIx(params)`
249
250
  - `createWithdrawVaultIx(params)`
251
+ - `createHarvestFeeIx(params)`
250
252
 
251
253
  #### Strategy Management
252
254
 
@@ -261,10 +263,16 @@ pendingWithdrawals.forEach((withdrawal, index) => {
261
263
  #### Account Data
262
264
 
263
265
  - `fetchVaultAccount(vault)`
266
+ - `fetchStrategyInitReceiptAccount(strategyInitReceipt)`
267
+ - `fetchAdaptorAddReceiptAccount(adaptorAddReceipt)`
264
268
  - `fetchAllStrategyInitReceiptAccounts()`
265
269
  - `fetchAllStrategyInitReceiptAccountsOfVault(vault)`
266
270
  - `fetchAllAdaptorAddReceiptAccountsOfVault(vault)`
271
+ - `fetchAllRequestWithdrawVaultReceiptsOfVault(vault)`
267
272
  - `getPositionAndTotalValuesForVault(vault)`
273
+ - `getAccumulatedAdminFeesForVault(vault)`
274
+ - `getAccumulatedManagerFeesForVault(vault)`
275
+ - `getAllPendingWithdrawalsForVault(vault)`
268
276
 
269
277
  #### PDA Finding
270
278
 
@@ -274,6 +282,8 @@ pendingWithdrawals.forEach((withdrawal, index) => {
274
282
  - `findVaultStrategyAuth(vault, strategy)`
275
283
  - `findStrategyInitReceipt(vault, strategy)`
276
284
  - `findDirectWithdrawInitReceipt(vault, strategy)`
285
+ - `findVaultStrategyAddresses(vault, strategy)`
286
+ - `findRequestWithdrawVaultReceipt(vault, user)`
277
287
 
278
288
  #### Calculations
279
289
 
package/dist/client.d.ts CHANGED
@@ -23,7 +23,7 @@ declare class AccountUtils {
23
23
  *
24
24
  * @example
25
25
  * ```typescript
26
- * import { VoltrClient } from '@voltr/sdk';
26
+ * import { VoltrClient } from '@voltr/vault-sdk';
27
27
  * import { Connection } from '@solana/web3.js';
28
28
  *
29
29
  * const connection = new Connection('https://api.mainnet-beta.solana.com');
@@ -616,6 +616,35 @@ export declare class VoltrClient extends AccountUtils {
616
616
  isWritable: boolean;
617
617
  }>;
618
618
  }): Promise<TransactionInstruction>;
619
+ /**
620
+ * Creates an instruction to harvest fees from a vault
621
+ * @param {Object} params - Parameters for harvesting fees
622
+ * @param {PublicKey} params.harvester - Public key of the harvester
623
+ * @param {PublicKey} params.vaultManager - Public key of the vault manager
624
+ * @param {PublicKey} params.vaultAdmin - Public key of the vault admin
625
+ * @param {PublicKey} params.protocolAdmin - Public key of the protocol admin
626
+ * @param {PublicKey} params.vault - Public key of the vault
627
+ * @returns {Promise<TransactionInstruction>} Transaction instruction for harvesting fees
628
+ * @throws {Error} If instruction creation fails
629
+ *
630
+ * @example
631
+ * ```typescript
632
+ * const ix = await client.createHarvestFeeIx({
633
+ * harvester: harvesterPubkey,
634
+ * vaultManager: vaultManagerPubkey,
635
+ * vaultAdmin: vaultAdminPubkey,
636
+ * protocolAdmin: protocolAdminPubkey,
637
+ * vault: vaultPubkey,
638
+ * });
639
+ * ```
640
+ */
641
+ createHarvestFeeIx({ harvester, vaultManager, vaultAdmin, protocolAdmin, vault, }: {
642
+ harvester: PublicKey;
643
+ vaultManager: PublicKey;
644
+ vaultAdmin: PublicKey;
645
+ protocolAdmin: PublicKey;
646
+ vault: PublicKey;
647
+ }): Promise<TransactionInstruction>;
619
648
  /**
620
649
  * Fetches all strategy init receipt accounts
621
650
  * @returns Promise resolving to an array of strategy init receipt accounts
@@ -693,7 +722,6 @@ export declare class VoltrClient extends AccountUtils {
693
722
  adaptorProgram: PublicKey;
694
723
  version: number;
695
724
  bump: number;
696
- isActive: boolean;
697
725
  padding0: number[];
698
726
  lastUpdatedEpoch: BN;
699
727
  reserved: number[];
@@ -801,11 +829,75 @@ export declare class VoltrClient extends AccountUtils {
801
829
  adaptorProgram: PublicKey;
802
830
  version: number;
803
831
  bump: number;
804
- isActive: boolean;
805
832
  padding0: number[];
806
833
  lastUpdatedEpoch: BN;
807
834
  reserved: number[];
808
835
  }>;
836
+ /**
837
+ * Fetches a request withdraw vault receipt account's data
838
+ * @param requestWithdrawVaultReceipt - Public key of the request withdraw vault receipt account
839
+ * @returns Promise resolving to the request withdraw vault receipt account data
840
+ *
841
+ * @example
842
+ * ```typescript
843
+ * const requestWithdrawVaultReceiptAccount = await client.fetchRequestWithdrawVaultReceiptAccount(requestWithdrawVaultReceiptPubkey);
844
+ * ```
845
+ */
846
+ fetchRequestWithdrawVaultReceiptAccount(requestWithdrawVaultReceipt: PublicKey): Promise<{
847
+ vault: PublicKey;
848
+ user: PublicKey;
849
+ amountLpEscrowed: BN;
850
+ amountAssetToWithdrawDecimalBits: BN;
851
+ withdrawableFromTs: BN;
852
+ bump: number;
853
+ version: number;
854
+ }>;
855
+ /**
856
+ * Fetches the accumulated admin fees for a vault
857
+ * @param vault - Public key of the vault
858
+ * @returns Promise resolving to the accumulated admin fees
859
+ *
860
+ * @example
861
+ * ```typescript
862
+ * const accumulatedAdminFees = await client.getAccumulatedAdminFeesForVault(vaultPubkey);
863
+ * ```
864
+ */
865
+ getAccumulatedAdminFeesForVault(vault: PublicKey): Promise<BN>;
866
+ /**
867
+ * Fetches the accumulated manager fees for a vault
868
+ * @param vault - Public key of the vault
869
+ * @returns Promise resolving to the accumulated manager fees
870
+ *
871
+ * @example
872
+ * ```typescript
873
+ * const accumulatedManagerFees = await client.getAccumulatedManagerFeesForVault(vaultPubkey);
874
+ * ```
875
+ */
876
+ getAccumulatedManagerFeesForVault(vault: PublicKey): Promise<BN>;
877
+ /**
878
+ * Processes a withdrawal receipt into a standardized withdrawal info object
879
+ * @private
880
+ */
881
+ private processWithdrawalReceipt;
882
+ /**
883
+ * Fetches the pending withdrawal for a user
884
+ * @param vault - Public key of the vault
885
+ * @param user - Public key of the user
886
+ * @returns Promise resolving to the pending withdrawal
887
+ *
888
+ * @example
889
+ * ```typescript
890
+ * const pendingWithdrawal = await client.getPendingWithdrawalForUser(vaultPubkey, userPubkey);
891
+ * ```
892
+ */
893
+ getPendingWithdrawalForUser(vault: PublicKey, user: PublicKey): Promise<{
894
+ user: PublicKey;
895
+ amountAssetToWithdrawEffective: number;
896
+ amountAssetToWithdrawAtRequest: number;
897
+ amountAssetToWithdrawAtPresent: number;
898
+ amountLpEscrowed: number;
899
+ withdrawableFromTs: number;
900
+ }>;
809
901
  /**
810
902
  * Fetches all pending withdrawals for a vault
811
903
  * @param vault - Public key of the vault
@@ -817,6 +909,7 @@ export declare class VoltrClient extends AccountUtils {
817
909
  * ```
818
910
  */
819
911
  getAllPendingWithdrawalsForVault(vault: PublicKey): Promise<{
912
+ user: PublicKey;
820
913
  amountAssetToWithdrawEffective: number;
821
914
  amountAssetToWithdrawAtRequest: number;
822
915
  amountAssetToWithdrawAtPresent: number;
package/dist/client.js CHANGED
@@ -92,7 +92,7 @@ class AccountUtils {
92
92
  *
93
93
  * @example
94
94
  * ```typescript
95
- * import { VoltrClient } from '@voltr/sdk';
95
+ * import { VoltrClient } from '@voltr/vault-sdk';
96
96
  * import { Connection } from '@solana/web3.js';
97
97
  *
98
98
  * const connection = new Connection('https://api.mainnet-beta.solana.com');
@@ -797,6 +797,40 @@ class VoltrClient extends AccountUtils {
797
797
  .remainingAccounts(remainingAccounts)
798
798
  .instruction();
799
799
  }
800
+ /**
801
+ * Creates an instruction to harvest fees from a vault
802
+ * @param {Object} params - Parameters for harvesting fees
803
+ * @param {PublicKey} params.harvester - Public key of the harvester
804
+ * @param {PublicKey} params.vaultManager - Public key of the vault manager
805
+ * @param {PublicKey} params.vaultAdmin - Public key of the vault admin
806
+ * @param {PublicKey} params.protocolAdmin - Public key of the protocol admin
807
+ * @param {PublicKey} params.vault - Public key of the vault
808
+ * @returns {Promise<TransactionInstruction>} Transaction instruction for harvesting fees
809
+ * @throws {Error} If instruction creation fails
810
+ *
811
+ * @example
812
+ * ```typescript
813
+ * const ix = await client.createHarvestFeeIx({
814
+ * harvester: harvesterPubkey,
815
+ * vaultManager: vaultManagerPubkey,
816
+ * vaultAdmin: vaultAdminPubkey,
817
+ * protocolAdmin: protocolAdminPubkey,
818
+ * vault: vaultPubkey,
819
+ * });
820
+ * ```
821
+ */
822
+ async createHarvestFeeIx({ harvester, vaultManager, vaultAdmin, protocolAdmin, vault, }) {
823
+ return await this.vaultProgram.methods
824
+ .harvestFee()
825
+ .accounts({
826
+ harvester,
827
+ vaultManager,
828
+ vaultAdmin,
829
+ vault,
830
+ protocolAdmin,
831
+ })
832
+ .instruction();
833
+ }
800
834
  // --------------------------------------- Account Fetching All
801
835
  /**
802
836
  * Fetches all strategy init receipt accounts
@@ -918,7 +952,88 @@ class VoltrClient extends AccountUtils {
918
952
  async fetchAdaptorAddReceiptAccount(adaptorAddReceipt) {
919
953
  return await this.vaultProgram.account.adaptorAddReceipt.fetch(adaptorAddReceipt, "confirmed");
920
954
  }
955
+ /**
956
+ * Fetches a request withdraw vault receipt account's data
957
+ * @param requestWithdrawVaultReceipt - Public key of the request withdraw vault receipt account
958
+ * @returns Promise resolving to the request withdraw vault receipt account data
959
+ *
960
+ * @example
961
+ * ```typescript
962
+ * const requestWithdrawVaultReceiptAccount = await client.fetchRequestWithdrawVaultReceiptAccount(requestWithdrawVaultReceiptPubkey);
963
+ * ```
964
+ */
965
+ async fetchRequestWithdrawVaultReceiptAccount(requestWithdrawVaultReceipt) {
966
+ return await this.vaultProgram.account.requestWithdrawVaultReceipt.fetch(requestWithdrawVaultReceipt, "confirmed");
967
+ }
921
968
  // --------------------------------------- Helpers
969
+ /**
970
+ * Fetches the accumulated admin fees for a vault
971
+ * @param vault - Public key of the vault
972
+ * @returns Promise resolving to the accumulated admin fees
973
+ *
974
+ * @example
975
+ * ```typescript
976
+ * const accumulatedAdminFees = await client.getAccumulatedAdminFeesForVault(vaultPubkey);
977
+ * ```
978
+ */
979
+ async getAccumulatedAdminFeesForVault(vault) {
980
+ const vaultAccount = await this.fetchVaultAccount(vault);
981
+ return vaultAccount.feeState.accumulatedLpAdminFees;
982
+ }
983
+ /**
984
+ * Fetches the accumulated manager fees for a vault
985
+ * @param vault - Public key of the vault
986
+ * @returns Promise resolving to the accumulated manager fees
987
+ *
988
+ * @example
989
+ * ```typescript
990
+ * const accumulatedManagerFees = await client.getAccumulatedManagerFeesForVault(vaultPubkey);
991
+ * ```
992
+ */
993
+ async getAccumulatedManagerFeesForVault(vault) {
994
+ const vaultAccount = await this.fetchVaultAccount(vault);
995
+ return vaultAccount.feeState.accumulatedLpManagerFees;
996
+ }
997
+ /**
998
+ * Processes a withdrawal receipt into a standardized withdrawal info object
999
+ * @private
1000
+ */
1001
+ async processWithdrawalReceipt(receipt, vaultAccount, lpSupply) {
1002
+ const amountAssetToWithdrawDecimal = (0, decimals_1.convertDecimalBitsToDecimal)(receipt.account.amountAssetToWithdrawDecimalBits);
1003
+ const amountAssetToWithdrawAtRequest = amountAssetToWithdrawDecimal.toNumber();
1004
+ const amountLpEscrowed = receipt.account.amountLpEscrowed;
1005
+ const amountAssetToWithdrawAtPresent = this.calculateAssetsForWithdrawHelper(vaultAccount.asset.totalValue, vaultAccount.lockedProfitState.lastUpdatedLockedProfit, vaultAccount.vaultConfiguration.lockedProfitDegradationDuration, vaultAccount.feeState.accumulatedLpAdminFees, vaultAccount.feeState.accumulatedLpManagerFees, vaultAccount.feeState.accumulatedLpProtocolFees, vaultAccount.feeConfiguration.redemptionFee, lpSupply, amountLpEscrowed).toNumber();
1006
+ // Cap the withdrawal amount to the initial request amount
1007
+ const amountAssetToWithdrawEffective = Math.min(amountAssetToWithdrawAtPresent, amountAssetToWithdrawAtRequest);
1008
+ return {
1009
+ user: receipt.account.user,
1010
+ amountAssetToWithdrawEffective,
1011
+ amountAssetToWithdrawAtRequest,
1012
+ amountAssetToWithdrawAtPresent,
1013
+ amountLpEscrowed: amountLpEscrowed.toNumber(),
1014
+ withdrawableFromTs: receipt.account.withdrawableFromTs.toNumber(),
1015
+ };
1016
+ }
1017
+ /**
1018
+ * Fetches the pending withdrawal for a user
1019
+ * @param vault - Public key of the vault
1020
+ * @param user - Public key of the user
1021
+ * @returns Promise resolving to the pending withdrawal
1022
+ *
1023
+ * @example
1024
+ * ```typescript
1025
+ * const pendingWithdrawal = await client.getPendingWithdrawalForUser(vaultPubkey, userPubkey);
1026
+ * ```
1027
+ */
1028
+ async getPendingWithdrawalForUser(vault, user) {
1029
+ const [vaultAccount, lp] = await Promise.all([
1030
+ this.fetchVaultAccount(vault),
1031
+ (0, spl_token_1.getMint)(this.conn, this.findVaultLpMint(vault)),
1032
+ ]);
1033
+ const requestWithdrawVaultReceiptAddress = this.findRequestWithdrawVaultReceipt(vault, user);
1034
+ const receipt = await this.fetchRequestWithdrawVaultReceiptAccount(requestWithdrawVaultReceiptAddress);
1035
+ return this.processWithdrawalReceipt({ account: receipt }, vaultAccount, new bn_js_1.default(lp.supply.toString()));
1036
+ }
922
1037
  /**
923
1038
  * Fetches all pending withdrawals for a vault
924
1039
  * @param vault - Public key of the vault
@@ -930,28 +1045,13 @@ class VoltrClient extends AccountUtils {
930
1045
  * ```
931
1046
  */
932
1047
  async getAllPendingWithdrawalsForVault(vault) {
933
- const requestWithdrawVaultReceipts = await this.fetchAllRequestWithdrawVaultReceiptsOfVault(vault);
934
- const vaultAccount = await this.fetchVaultAccount(vault);
935
- const lpMint = this.findVaultLpMint(vault);
936
- const lp = await (0, spl_token_1.getMint)(this.conn, lpMint);
937
- return requestWithdrawVaultReceipts.map((receipt) => {
938
- const amountAssetToWithdrawDecimal = (0, decimals_1.convertDecimalBitsToDecimal)(receipt.account.amountAssetToWithdrawDecimalBits);
939
- const amountAssetToWithdrawAtRequest = amountAssetToWithdrawDecimal.toNumber();
940
- const amountLpEscrowed = receipt.account.amountLpEscrowed;
941
- const amountAssetToWithdrawAtPresent = this.calculateAssetsForWithdrawHelper(vaultAccount.asset.totalValue, vaultAccount.lockedProfitState.lastUpdatedLockedProfit, vaultAccount.vaultConfiguration.lockedProfitDegradationDuration, vaultAccount.feeState.accumulatedLpAdminFees, vaultAccount.feeState.accumulatedLpManagerFees, vaultAccount.feeState.accumulatedLpProtocolFees, vaultAccount.feeConfiguration.redemptionFee, new bn_js_1.default(lp.supply.toString()), amountLpEscrowed).toNumber();
942
- // Get the capped amount of asset to withdraw
943
- // If the latest amount of asset to withdraw is greater than the initial amount of asset to withdraw,
944
- // then return the initial amount of asset to withdraw
945
- // Otherwise, return the latest amount of asset to withdraw
946
- const amountAssetToWithdrawEffective = Math.min(amountAssetToWithdrawAtPresent, amountAssetToWithdrawAtRequest);
947
- return {
948
- amountAssetToWithdrawEffective,
949
- amountAssetToWithdrawAtRequest,
950
- amountAssetToWithdrawAtPresent,
951
- amountLpEscrowed: amountLpEscrowed.toNumber(),
952
- withdrawableFromTs: receipt.account.withdrawableFromTs.toNumber(),
953
- };
954
- });
1048
+ const [requestWithdrawVaultReceipts, vaultAccount, lp] = await Promise.all([
1049
+ this.fetchAllRequestWithdrawVaultReceiptsOfVault(vault),
1050
+ this.fetchVaultAccount(vault),
1051
+ (0, spl_token_1.getMint)(this.conn, this.findVaultLpMint(vault)),
1052
+ ]);
1053
+ const lpSupply = new bn_js_1.default(lp.supply.toString());
1054
+ return Promise.all(requestWithdrawVaultReceipts.map((receipt) => this.processWithdrawalReceipt(receipt, vaultAccount, lpSupply)));
955
1055
  }
956
1056
  calculateLockedProfit(lastUpdatedLockedProfit, lockedProfitDegradationDuration, currentTime) {
957
1057
  if (lockedProfitDegradationDuration.eq(new bn_js_1.default(0)))
@@ -1592,6 +1592,298 @@
1592
1592
  }
1593
1593
  ]
1594
1594
  },
1595
+ {
1596
+ "name": "harvest_fee",
1597
+ "discriminator": [
1598
+ 32,
1599
+ 59,
1600
+ 42,
1601
+ 128,
1602
+ 246,
1603
+ 73,
1604
+ 255,
1605
+ 47
1606
+ ],
1607
+ "accounts": [
1608
+ {
1609
+ "name": "harvester",
1610
+ "signer": true
1611
+ },
1612
+ {
1613
+ "name": "vault_manager"
1614
+ },
1615
+ {
1616
+ "name": "vault_admin"
1617
+ },
1618
+ {
1619
+ "name": "protocol_admin"
1620
+ },
1621
+ {
1622
+ "name": "protocol",
1623
+ "pda": {
1624
+ "seeds": [
1625
+ {
1626
+ "kind": "const",
1627
+ "value": [
1628
+ 112,
1629
+ 114,
1630
+ 111,
1631
+ 116,
1632
+ 111,
1633
+ 99,
1634
+ 111,
1635
+ 108
1636
+ ]
1637
+ }
1638
+ ]
1639
+ }
1640
+ },
1641
+ {
1642
+ "name": "vault",
1643
+ "writable": true
1644
+ },
1645
+ {
1646
+ "name": "vault_lp_mint",
1647
+ "writable": true,
1648
+ "pda": {
1649
+ "seeds": [
1650
+ {
1651
+ "kind": "const",
1652
+ "value": [
1653
+ 118,
1654
+ 97,
1655
+ 117,
1656
+ 108,
1657
+ 116,
1658
+ 95,
1659
+ 108,
1660
+ 112,
1661
+ 95,
1662
+ 109,
1663
+ 105,
1664
+ 110,
1665
+ 116
1666
+ ]
1667
+ },
1668
+ {
1669
+ "kind": "account",
1670
+ "path": "vault"
1671
+ }
1672
+ ]
1673
+ }
1674
+ },
1675
+ {
1676
+ "name": "vault_lp_mint_auth",
1677
+ "pda": {
1678
+ "seeds": [
1679
+ {
1680
+ "kind": "const",
1681
+ "value": [
1682
+ 118,
1683
+ 97,
1684
+ 117,
1685
+ 108,
1686
+ 116,
1687
+ 95,
1688
+ 108,
1689
+ 112,
1690
+ 95,
1691
+ 109,
1692
+ 105,
1693
+ 110,
1694
+ 116,
1695
+ 95,
1696
+ 97,
1697
+ 117,
1698
+ 116,
1699
+ 104
1700
+ ]
1701
+ },
1702
+ {
1703
+ "kind": "account",
1704
+ "path": "vault"
1705
+ }
1706
+ ]
1707
+ }
1708
+ },
1709
+ {
1710
+ "name": "vault_manager_lp_ata",
1711
+ "writable": true,
1712
+ "pda": {
1713
+ "seeds": [
1714
+ {
1715
+ "kind": "account",
1716
+ "path": "vault_manager"
1717
+ },
1718
+ {
1719
+ "kind": "account",
1720
+ "path": "lp_token_program"
1721
+ },
1722
+ {
1723
+ "kind": "account",
1724
+ "path": "vault_lp_mint"
1725
+ }
1726
+ ],
1727
+ "program": {
1728
+ "kind": "const",
1729
+ "value": [
1730
+ 140,
1731
+ 151,
1732
+ 37,
1733
+ 143,
1734
+ 78,
1735
+ 36,
1736
+ 137,
1737
+ 241,
1738
+ 187,
1739
+ 61,
1740
+ 16,
1741
+ 41,
1742
+ 20,
1743
+ 142,
1744
+ 13,
1745
+ 131,
1746
+ 11,
1747
+ 90,
1748
+ 19,
1749
+ 153,
1750
+ 218,
1751
+ 255,
1752
+ 16,
1753
+ 132,
1754
+ 4,
1755
+ 142,
1756
+ 123,
1757
+ 216,
1758
+ 219,
1759
+ 233,
1760
+ 248,
1761
+ 89
1762
+ ]
1763
+ }
1764
+ }
1765
+ },
1766
+ {
1767
+ "name": "vault_admin_lp_ata",
1768
+ "writable": true,
1769
+ "pda": {
1770
+ "seeds": [
1771
+ {
1772
+ "kind": "account",
1773
+ "path": "vault_admin"
1774
+ },
1775
+ {
1776
+ "kind": "account",
1777
+ "path": "lp_token_program"
1778
+ },
1779
+ {
1780
+ "kind": "account",
1781
+ "path": "vault_lp_mint"
1782
+ }
1783
+ ],
1784
+ "program": {
1785
+ "kind": "const",
1786
+ "value": [
1787
+ 140,
1788
+ 151,
1789
+ 37,
1790
+ 143,
1791
+ 78,
1792
+ 36,
1793
+ 137,
1794
+ 241,
1795
+ 187,
1796
+ 61,
1797
+ 16,
1798
+ 41,
1799
+ 20,
1800
+ 142,
1801
+ 13,
1802
+ 131,
1803
+ 11,
1804
+ 90,
1805
+ 19,
1806
+ 153,
1807
+ 218,
1808
+ 255,
1809
+ 16,
1810
+ 132,
1811
+ 4,
1812
+ 142,
1813
+ 123,
1814
+ 216,
1815
+ 219,
1816
+ 233,
1817
+ 248,
1818
+ 89
1819
+ ]
1820
+ }
1821
+ }
1822
+ },
1823
+ {
1824
+ "name": "protocol_admin_lp_ata",
1825
+ "writable": true,
1826
+ "pda": {
1827
+ "seeds": [
1828
+ {
1829
+ "kind": "account",
1830
+ "path": "protocol_admin"
1831
+ },
1832
+ {
1833
+ "kind": "account",
1834
+ "path": "lp_token_program"
1835
+ },
1836
+ {
1837
+ "kind": "account",
1838
+ "path": "vault_lp_mint"
1839
+ }
1840
+ ],
1841
+ "program": {
1842
+ "kind": "const",
1843
+ "value": [
1844
+ 140,
1845
+ 151,
1846
+ 37,
1847
+ 143,
1848
+ 78,
1849
+ 36,
1850
+ 137,
1851
+ 241,
1852
+ 187,
1853
+ 61,
1854
+ 16,
1855
+ 41,
1856
+ 20,
1857
+ 142,
1858
+ 13,
1859
+ 131,
1860
+ 11,
1861
+ 90,
1862
+ 19,
1863
+ 153,
1864
+ 218,
1865
+ 255,
1866
+ 16,
1867
+ 132,
1868
+ 4,
1869
+ 142,
1870
+ 123,
1871
+ 216,
1872
+ 219,
1873
+ 233,
1874
+ 248,
1875
+ 89
1876
+ ]
1877
+ }
1878
+ }
1879
+ },
1880
+ {
1881
+ "name": "lp_token_program",
1882
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
1883
+ }
1884
+ ],
1885
+ "args": []
1886
+ },
1595
1887
  {
1596
1888
  "name": "init_or_update_protocol",
1597
1889
  "discriminator": [
@@ -3514,78 +3806,63 @@
3514
3806
  },
3515
3807
  {
3516
3808
  "code": 6001,
3517
- "name": "InvalidAccountOwner",
3518
- "msg": "Invalid account owner."
3519
- },
3520
- {
3521
- "code": 6002,
3522
- "name": "AlreadyInitialized",
3523
- "msg": "Already initialized."
3524
- },
3525
- {
3526
- "code": 6003,
3527
3809
  "name": "InvalidTokenMint",
3528
3810
  "msg": "Invalid token mint."
3529
3811
  },
3530
3812
  {
3531
- "code": 6004,
3813
+ "code": 6002,
3532
3814
  "name": "InvalidTokenAccount",
3533
3815
  "msg": "Invalid token account."
3534
3816
  },
3535
3817
  {
3536
- "code": 6005,
3818
+ "code": 6003,
3537
3819
  "name": "InvalidAccountInput",
3538
3820
  "msg": "Invalid account input."
3539
3821
  },
3540
3822
  {
3541
- "code": 6006,
3542
- "name": "NotRentExempt",
3543
- "msg": "Not rent exempt."
3544
- },
3545
- {
3546
- "code": 6007,
3823
+ "code": 6004,
3547
3824
  "name": "MathOverflow",
3548
3825
  "msg": "Math overflow."
3549
3826
  },
3550
3827
  {
3551
- "code": 6008,
3828
+ "code": 6005,
3552
3829
  "name": "MaxCapExceeded",
3553
3830
  "msg": "Max cap exceeded."
3554
3831
  },
3555
3832
  {
3556
- "code": 6009,
3557
- "name": "StrategyNotEmpty",
3558
- "msg": "Strategy not empty."
3559
- },
3560
- {
3561
- "code": 6010,
3833
+ "code": 6006,
3562
3834
  "name": "VaultNotActive",
3563
3835
  "msg": "Vault not active."
3564
3836
  },
3565
3837
  {
3566
- "code": 6011,
3838
+ "code": 6007,
3567
3839
  "name": "ManagerNotAllowed",
3568
3840
  "msg": "Manager not allowed in remaining."
3569
3841
  },
3570
3842
  {
3571
- "code": 6012,
3843
+ "code": 6008,
3572
3844
  "name": "OperationNotAllowed",
3573
3845
  "msg": "Operation not allowed."
3574
3846
  },
3575
3847
  {
3576
- "code": 6013,
3848
+ "code": 6009,
3577
3849
  "name": "AdaptorEpochInvalid",
3578
3850
  "msg": "Adaptor epoch invalid."
3579
3851
  },
3580
3852
  {
3581
- "code": 6014,
3853
+ "code": 6010,
3582
3854
  "name": "InvalidFeeConfiguration",
3583
3855
  "msg": "Fee configuration invalid."
3584
3856
  },
3585
3857
  {
3586
- "code": 6015,
3858
+ "code": 6011,
3587
3859
  "name": "WithdrawalNotYetAvailable",
3588
3860
  "msg": "Withdrawal not yet available."
3861
+ },
3862
+ {
3863
+ "code": 6012,
3864
+ "name": "InvalidInput",
3865
+ "msg": "Invalid input."
3589
3866
  }
3590
3867
  ],
3591
3868
  "types": [
@@ -3626,19 +3903,15 @@
3626
3903
  ],
3627
3904
  "type": "u8"
3628
3905
  },
3629
- {
3630
- "name": "is_active",
3631
- "type": "bool"
3632
- },
3633
3906
  {
3634
3907
  "name": "_padding0",
3635
3908
  "docs": [
3636
- "6 bytes of padding to align future 8-byte fields on 8-byte boundaries."
3909
+ "7 bytes of padding to align future 8-byte fields on 8-byte boundaries."
3637
3910
  ],
3638
3911
  "type": {
3639
3912
  "array": [
3640
3913
  "u8",
3641
- 6
3914
+ 7
3642
3915
  ]
3643
3916
  }
3644
3917
  },
@@ -1598,6 +1598,298 @@ export type VoltrVault = {
1598
1598
  }
1599
1599
  ];
1600
1600
  },
1601
+ {
1602
+ "name": "harvestFee";
1603
+ "discriminator": [
1604
+ 32,
1605
+ 59,
1606
+ 42,
1607
+ 128,
1608
+ 246,
1609
+ 73,
1610
+ 255,
1611
+ 47
1612
+ ];
1613
+ "accounts": [
1614
+ {
1615
+ "name": "harvester";
1616
+ "signer": true;
1617
+ },
1618
+ {
1619
+ "name": "vaultManager";
1620
+ },
1621
+ {
1622
+ "name": "vaultAdmin";
1623
+ },
1624
+ {
1625
+ "name": "protocolAdmin";
1626
+ },
1627
+ {
1628
+ "name": "protocol";
1629
+ "pda": {
1630
+ "seeds": [
1631
+ {
1632
+ "kind": "const";
1633
+ "value": [
1634
+ 112,
1635
+ 114,
1636
+ 111,
1637
+ 116,
1638
+ 111,
1639
+ 99,
1640
+ 111,
1641
+ 108
1642
+ ];
1643
+ }
1644
+ ];
1645
+ };
1646
+ },
1647
+ {
1648
+ "name": "vault";
1649
+ "writable": true;
1650
+ },
1651
+ {
1652
+ "name": "vaultLpMint";
1653
+ "writable": true;
1654
+ "pda": {
1655
+ "seeds": [
1656
+ {
1657
+ "kind": "const";
1658
+ "value": [
1659
+ 118,
1660
+ 97,
1661
+ 117,
1662
+ 108,
1663
+ 116,
1664
+ 95,
1665
+ 108,
1666
+ 112,
1667
+ 95,
1668
+ 109,
1669
+ 105,
1670
+ 110,
1671
+ 116
1672
+ ];
1673
+ },
1674
+ {
1675
+ "kind": "account";
1676
+ "path": "vault";
1677
+ }
1678
+ ];
1679
+ };
1680
+ },
1681
+ {
1682
+ "name": "vaultLpMintAuth";
1683
+ "pda": {
1684
+ "seeds": [
1685
+ {
1686
+ "kind": "const";
1687
+ "value": [
1688
+ 118,
1689
+ 97,
1690
+ 117,
1691
+ 108,
1692
+ 116,
1693
+ 95,
1694
+ 108,
1695
+ 112,
1696
+ 95,
1697
+ 109,
1698
+ 105,
1699
+ 110,
1700
+ 116,
1701
+ 95,
1702
+ 97,
1703
+ 117,
1704
+ 116,
1705
+ 104
1706
+ ];
1707
+ },
1708
+ {
1709
+ "kind": "account";
1710
+ "path": "vault";
1711
+ }
1712
+ ];
1713
+ };
1714
+ },
1715
+ {
1716
+ "name": "vaultManagerLpAta";
1717
+ "writable": true;
1718
+ "pda": {
1719
+ "seeds": [
1720
+ {
1721
+ "kind": "account";
1722
+ "path": "vaultManager";
1723
+ },
1724
+ {
1725
+ "kind": "account";
1726
+ "path": "lpTokenProgram";
1727
+ },
1728
+ {
1729
+ "kind": "account";
1730
+ "path": "vaultLpMint";
1731
+ }
1732
+ ];
1733
+ "program": {
1734
+ "kind": "const";
1735
+ "value": [
1736
+ 140,
1737
+ 151,
1738
+ 37,
1739
+ 143,
1740
+ 78,
1741
+ 36,
1742
+ 137,
1743
+ 241,
1744
+ 187,
1745
+ 61,
1746
+ 16,
1747
+ 41,
1748
+ 20,
1749
+ 142,
1750
+ 13,
1751
+ 131,
1752
+ 11,
1753
+ 90,
1754
+ 19,
1755
+ 153,
1756
+ 218,
1757
+ 255,
1758
+ 16,
1759
+ 132,
1760
+ 4,
1761
+ 142,
1762
+ 123,
1763
+ 216,
1764
+ 219,
1765
+ 233,
1766
+ 248,
1767
+ 89
1768
+ ];
1769
+ };
1770
+ };
1771
+ },
1772
+ {
1773
+ "name": "vaultAdminLpAta";
1774
+ "writable": true;
1775
+ "pda": {
1776
+ "seeds": [
1777
+ {
1778
+ "kind": "account";
1779
+ "path": "vaultAdmin";
1780
+ },
1781
+ {
1782
+ "kind": "account";
1783
+ "path": "lpTokenProgram";
1784
+ },
1785
+ {
1786
+ "kind": "account";
1787
+ "path": "vaultLpMint";
1788
+ }
1789
+ ];
1790
+ "program": {
1791
+ "kind": "const";
1792
+ "value": [
1793
+ 140,
1794
+ 151,
1795
+ 37,
1796
+ 143,
1797
+ 78,
1798
+ 36,
1799
+ 137,
1800
+ 241,
1801
+ 187,
1802
+ 61,
1803
+ 16,
1804
+ 41,
1805
+ 20,
1806
+ 142,
1807
+ 13,
1808
+ 131,
1809
+ 11,
1810
+ 90,
1811
+ 19,
1812
+ 153,
1813
+ 218,
1814
+ 255,
1815
+ 16,
1816
+ 132,
1817
+ 4,
1818
+ 142,
1819
+ 123,
1820
+ 216,
1821
+ 219,
1822
+ 233,
1823
+ 248,
1824
+ 89
1825
+ ];
1826
+ };
1827
+ };
1828
+ },
1829
+ {
1830
+ "name": "protocolAdminLpAta";
1831
+ "writable": true;
1832
+ "pda": {
1833
+ "seeds": [
1834
+ {
1835
+ "kind": "account";
1836
+ "path": "protocolAdmin";
1837
+ },
1838
+ {
1839
+ "kind": "account";
1840
+ "path": "lpTokenProgram";
1841
+ },
1842
+ {
1843
+ "kind": "account";
1844
+ "path": "vaultLpMint";
1845
+ }
1846
+ ];
1847
+ "program": {
1848
+ "kind": "const";
1849
+ "value": [
1850
+ 140,
1851
+ 151,
1852
+ 37,
1853
+ 143,
1854
+ 78,
1855
+ 36,
1856
+ 137,
1857
+ 241,
1858
+ 187,
1859
+ 61,
1860
+ 16,
1861
+ 41,
1862
+ 20,
1863
+ 142,
1864
+ 13,
1865
+ 131,
1866
+ 11,
1867
+ 90,
1868
+ 19,
1869
+ 153,
1870
+ 218,
1871
+ 255,
1872
+ 16,
1873
+ 132,
1874
+ 4,
1875
+ 142,
1876
+ 123,
1877
+ 216,
1878
+ 219,
1879
+ 233,
1880
+ 248,
1881
+ 89
1882
+ ];
1883
+ };
1884
+ };
1885
+ },
1886
+ {
1887
+ "name": "lpTokenProgram";
1888
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1889
+ }
1890
+ ];
1891
+ "args": [];
1892
+ },
1601
1893
  {
1602
1894
  "name": "initOrUpdateProtocol";
1603
1895
  "discriminator": [
@@ -3520,78 +3812,63 @@ export type VoltrVault = {
3520
3812
  },
3521
3813
  {
3522
3814
  "code": 6001;
3523
- "name": "invalidAccountOwner";
3524
- "msg": "Invalid account owner.";
3525
- },
3526
- {
3527
- "code": 6002;
3528
- "name": "alreadyInitialized";
3529
- "msg": "Already initialized.";
3530
- },
3531
- {
3532
- "code": 6003;
3533
3815
  "name": "invalidTokenMint";
3534
3816
  "msg": "Invalid token mint.";
3535
3817
  },
3536
3818
  {
3537
- "code": 6004;
3819
+ "code": 6002;
3538
3820
  "name": "invalidTokenAccount";
3539
3821
  "msg": "Invalid token account.";
3540
3822
  },
3541
3823
  {
3542
- "code": 6005;
3824
+ "code": 6003;
3543
3825
  "name": "invalidAccountInput";
3544
3826
  "msg": "Invalid account input.";
3545
3827
  },
3546
3828
  {
3547
- "code": 6006;
3548
- "name": "notRentExempt";
3549
- "msg": "Not rent exempt.";
3550
- },
3551
- {
3552
- "code": 6007;
3829
+ "code": 6004;
3553
3830
  "name": "mathOverflow";
3554
3831
  "msg": "Math overflow.";
3555
3832
  },
3556
3833
  {
3557
- "code": 6008;
3834
+ "code": 6005;
3558
3835
  "name": "maxCapExceeded";
3559
3836
  "msg": "Max cap exceeded.";
3560
3837
  },
3561
3838
  {
3562
- "code": 6009;
3563
- "name": "strategyNotEmpty";
3564
- "msg": "Strategy not empty.";
3565
- },
3566
- {
3567
- "code": 6010;
3839
+ "code": 6006;
3568
3840
  "name": "vaultNotActive";
3569
3841
  "msg": "Vault not active.";
3570
3842
  },
3571
3843
  {
3572
- "code": 6011;
3844
+ "code": 6007;
3573
3845
  "name": "managerNotAllowed";
3574
3846
  "msg": "Manager not allowed in remaining.";
3575
3847
  },
3576
3848
  {
3577
- "code": 6012;
3849
+ "code": 6008;
3578
3850
  "name": "operationNotAllowed";
3579
3851
  "msg": "Operation not allowed.";
3580
3852
  },
3581
3853
  {
3582
- "code": 6013;
3854
+ "code": 6009;
3583
3855
  "name": "adaptorEpochInvalid";
3584
3856
  "msg": "Adaptor epoch invalid.";
3585
3857
  },
3586
3858
  {
3587
- "code": 6014;
3859
+ "code": 6010;
3588
3860
  "name": "invalidFeeConfiguration";
3589
3861
  "msg": "Fee configuration invalid.";
3590
3862
  },
3591
3863
  {
3592
- "code": 6015;
3864
+ "code": 6011;
3593
3865
  "name": "withdrawalNotYetAvailable";
3594
3866
  "msg": "Withdrawal not yet available.";
3867
+ },
3868
+ {
3869
+ "code": 6012;
3870
+ "name": "invalidInput";
3871
+ "msg": "Invalid input.";
3595
3872
  }
3596
3873
  ];
3597
3874
  "types": [
@@ -3632,19 +3909,15 @@ export type VoltrVault = {
3632
3909
  ];
3633
3910
  "type": "u8";
3634
3911
  },
3635
- {
3636
- "name": "isActive";
3637
- "type": "bool";
3638
- },
3639
3912
  {
3640
3913
  "name": "padding0";
3641
3914
  "docs": [
3642
- "6 bytes of padding to align future 8-byte fields on 8-byte boundaries."
3915
+ "7 bytes of padding to align future 8-byte fields on 8-byte boundaries."
3643
3916
  ];
3644
3917
  "type": {
3645
3918
  "array": [
3646
3919
  "u8",
3647
- 6
3920
+ 7
3648
3921
  ];
3649
3922
  };
3650
3923
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltr/vault-sdk",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "SDK for interacting with Voltr Protocol",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",