@voltr/vault-sdk 1.0.2 → 1.0.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/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');
@@ -179,7 +179,7 @@ export declare class VoltrClient extends AccountUtils {
179
179
  * ```
180
180
  */
181
181
  createInitializeVaultIx(vaultParams: VaultParams, { vault, vaultAssetMint, admin, manager, payer, }: {
182
- vault: Keypair;
182
+ vault: PublicKey;
183
183
  vaultAssetMint: PublicKey;
184
184
  admin: PublicKey;
185
185
  manager: PublicKey;
@@ -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,32 @@ 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 the accumulated admin fees for a vault
838
+ * @param vault - Public key of the vault
839
+ * @returns Promise resolving to the accumulated admin fees
840
+ *
841
+ * @example
842
+ * ```typescript
843
+ * const accumulatedAdminFees = await client.getAccumulatedAdminFeesForVault(vaultPubkey);
844
+ * ```
845
+ */
846
+ getAccumulatedAdminFeesForVault(vault: PublicKey): Promise<BN>;
847
+ /**
848
+ * Fetches the accumulated manager fees for a vault
849
+ * @param vault - Public key of the vault
850
+ * @returns Promise resolving to the accumulated manager fees
851
+ *
852
+ * @example
853
+ * ```typescript
854
+ * const accumulatedManagerFees = await client.getAccumulatedManagerFeesForVault(vaultPubkey);
855
+ * ```
856
+ */
857
+ getAccumulatedManagerFeesForVault(vault: PublicKey): Promise<BN>;
809
858
  /**
810
859
  * Fetches all pending withdrawals for a vault
811
860
  * @param vault - Public key of the vault
@@ -817,10 +866,14 @@ export declare class VoltrClient extends AccountUtils {
817
866
  * ```
818
867
  */
819
868
  getAllPendingWithdrawalsForVault(vault: PublicKey): Promise<{
820
- amountAssetToWithdraw: number;
869
+ amountAssetToWithdrawEffective: number;
870
+ amountAssetToWithdrawAtRequest: number;
871
+ amountAssetToWithdrawAtPresent: number;
872
+ amountLpEscrowed: number;
821
873
  withdrawableFromTs: number;
822
874
  }[]>;
823
875
  calculateLockedProfit(lastUpdatedLockedProfit: BN, lockedProfitDegradationDuration: BN, currentTime: BN): BN;
876
+ calculateAssetsForWithdrawHelper(vaultTotalValue: BN, vaultLastUpdatedLockedProfit: BN, vaultLockedProfitDegradationDuration: BN, vaultAccumulatedLpAdminFees: BN, vaultAccumulatedLpManagerFees: BN, vaultAccumulatedLpProtocolFees: BN, vaultRedemptionFee: number, lpSupply: BN, lpAmount: BN): BN;
824
877
  /**
825
878
  * Calculates the amount of assets that would be received for a given LP token amount
826
879
  *
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');
@@ -303,18 +303,23 @@ class VoltrClient extends AccountUtils {
303
303
  * ```
304
304
  */
305
305
  async createInitializeVaultIx(vaultParams, { vault, vaultAssetMint, admin, manager, payer, }) {
306
- const addresses = this.findVaultAddresses(vault.publicKey);
306
+ const addresses = this.findVaultAddresses(vault);
307
307
  const vaultAssetIdleAta = (0, spl_token_1.getAssociatedTokenAddressSync)(vaultAssetMint, addresses.vaultAssetIdleAuth, true);
308
+ const vaultAssetMintAccount = await this.provider.connection.getAccountInfo(vaultAssetMint);
309
+ const assetTokenProgram = vaultAssetMintAccount?.owner;
310
+ if (!assetTokenProgram) {
311
+ throw new Error("Vault asset mint not found");
312
+ }
308
313
  return await this.vaultProgram.methods
309
314
  .initializeVault(vaultParams.config, vaultParams.name, vaultParams.description)
310
315
  .accounts({
311
316
  payer,
312
317
  admin,
313
318
  manager,
314
- vault: vault.publicKey,
319
+ vault,
315
320
  vaultAssetMint,
316
321
  vaultAssetIdleAta,
317
- assetTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
322
+ assetTokenProgram,
318
323
  })
319
324
  .instruction();
320
325
  }
@@ -792,6 +797,40 @@ class VoltrClient extends AccountUtils {
792
797
  .remainingAccounts(remainingAccounts)
793
798
  .instruction();
794
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
+ }
795
834
  // --------------------------------------- Account Fetching All
796
835
  /**
797
836
  * Fetches all strategy init receipt accounts
@@ -914,6 +953,34 @@ class VoltrClient extends AccountUtils {
914
953
  return await this.vaultProgram.account.adaptorAddReceipt.fetch(adaptorAddReceipt, "confirmed");
915
954
  }
916
955
  // --------------------------------------- Helpers
956
+ /**
957
+ * Fetches the accumulated admin fees for a vault
958
+ * @param vault - Public key of the vault
959
+ * @returns Promise resolving to the accumulated admin fees
960
+ *
961
+ * @example
962
+ * ```typescript
963
+ * const accumulatedAdminFees = await client.getAccumulatedAdminFeesForVault(vaultPubkey);
964
+ * ```
965
+ */
966
+ async getAccumulatedAdminFeesForVault(vault) {
967
+ const vaultAccount = await this.fetchVaultAccount(vault);
968
+ return vaultAccount.feeState.accumulatedLpAdminFees;
969
+ }
970
+ /**
971
+ * Fetches the accumulated manager fees for a vault
972
+ * @param vault - Public key of the vault
973
+ * @returns Promise resolving to the accumulated manager fees
974
+ *
975
+ * @example
976
+ * ```typescript
977
+ * const accumulatedManagerFees = await client.getAccumulatedManagerFeesForVault(vaultPubkey);
978
+ * ```
979
+ */
980
+ async getAccumulatedManagerFeesForVault(vault) {
981
+ const vaultAccount = await this.fetchVaultAccount(vault);
982
+ return vaultAccount.feeState.accumulatedLpManagerFees;
983
+ }
917
984
  /**
918
985
  * Fetches all pending withdrawals for a vault
919
986
  * @param vault - Public key of the vault
@@ -926,11 +993,24 @@ class VoltrClient extends AccountUtils {
926
993
  */
927
994
  async getAllPendingWithdrawalsForVault(vault) {
928
995
  const requestWithdrawVaultReceipts = await this.fetchAllRequestWithdrawVaultReceiptsOfVault(vault);
996
+ const vaultAccount = await this.fetchVaultAccount(vault);
997
+ const lpMint = this.findVaultLpMint(vault);
998
+ const lp = await (0, spl_token_1.getMint)(this.conn, lpMint);
929
999
  return requestWithdrawVaultReceipts.map((receipt) => {
930
1000
  const amountAssetToWithdrawDecimal = (0, decimals_1.convertDecimalBitsToDecimal)(receipt.account.amountAssetToWithdrawDecimalBits);
931
- const amountAssetToWithdraw = amountAssetToWithdrawDecimal.toNumber();
1001
+ const amountAssetToWithdrawAtRequest = amountAssetToWithdrawDecimal.toNumber();
1002
+ const amountLpEscrowed = receipt.account.amountLpEscrowed;
1003
+ 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();
1004
+ // Get the capped amount of asset to withdraw
1005
+ // If the latest amount of asset to withdraw is greater than the initial amount of asset to withdraw,
1006
+ // then return the initial amount of asset to withdraw
1007
+ // Otherwise, return the latest amount of asset to withdraw
1008
+ const amountAssetToWithdrawEffective = Math.min(amountAssetToWithdrawAtPresent, amountAssetToWithdrawAtRequest);
932
1009
  return {
933
- amountAssetToWithdraw,
1010
+ amountAssetToWithdrawEffective,
1011
+ amountAssetToWithdrawAtRequest,
1012
+ amountAssetToWithdrawAtPresent,
1013
+ amountLpEscrowed: amountLpEscrowed.toNumber(),
934
1014
  withdrawableFromTs: receipt.account.withdrawableFromTs.toNumber(),
935
1015
  };
936
1016
  });
@@ -947,6 +1027,26 @@ class VoltrClient extends AccountUtils {
947
1027
  else
948
1028
  return lockedProfit;
949
1029
  }
1030
+ calculateAssetsForWithdrawHelper(vaultTotalValue, vaultLastUpdatedLockedProfit, vaultLockedProfitDegradationDuration, vaultAccumulatedLpAdminFees, vaultAccumulatedLpManagerFees, vaultAccumulatedLpProtocolFees, vaultRedemptionFee, lpSupply, lpAmount) {
1031
+ if (lpSupply <= new bn_js_1.default(0))
1032
+ throw new Error("Invalid LP supply");
1033
+ if (vaultTotalValue <= new bn_js_1.default(0))
1034
+ throw new Error("Invalid total assets");
1035
+ const lockedProfit = this.calculateLockedProfit(vaultLastUpdatedLockedProfit, vaultLockedProfitDegradationDuration, new bn_js_1.default(Date.now() / 1000));
1036
+ const totalUnlockedValue = vaultTotalValue.sub(lockedProfit);
1037
+ const unharvestedFeesLp = vaultAccumulatedLpAdminFees
1038
+ .add(vaultAccumulatedLpManagerFees)
1039
+ .add(vaultAccumulatedLpProtocolFees);
1040
+ const lpSupplyInclFees = lpSupply.add(unharvestedFeesLp);
1041
+ // asset_to_redeem_pre_fee = amount * (total_asset_pre_withdraw / total_lp_supply_pre_withdraw)
1042
+ // asset_to_redeem_post_fee = asset_to_redeem_pre_fee * (10000 - redemption_fee_bps) / 10000
1043
+ const assetToRedeemNumerator = lpAmount
1044
+ .mul(totalUnlockedValue)
1045
+ .mul(new bn_js_1.default(10000 - vaultRedemptionFee));
1046
+ const assetToRedeemDenominator = lpSupplyInclFees.mul(new bn_js_1.default(10000));
1047
+ const amount = assetToRedeemNumerator.div(assetToRedeemDenominator);
1048
+ return amount;
1049
+ }
950
1050
  /**
951
1051
  * Calculates the amount of assets that would be received for a given LP token amount
952
1052
  *
@@ -968,28 +1068,9 @@ class VoltrClient extends AccountUtils {
968
1068
  async calculateAssetsForWithdraw(vaultPk, lpAmount) {
969
1069
  try {
970
1070
  const vault = await this.fetchVaultAccount(vaultPk);
971
- const totalValue = vault.asset.totalValue;
972
- const lockedProfit = this.calculateLockedProfit(vault.lockedProfitState.lastUpdatedLockedProfit, vault.vaultConfiguration.lockedProfitDegradationDuration, new bn_js_1.default(Date.now() / 1000));
973
- const totalUnlockedValue = totalValue.sub(lockedProfit);
974
1071
  const lpMint = this.findVaultLpMint(vaultPk);
975
1072
  const lp = await (0, spl_token_1.getMint)(this.conn, lpMint);
976
- const lpSupply = new bn_js_1.default(lp.supply.toString());
977
- // Validate inputs
978
- if (lpSupply <= new bn_js_1.default(0))
979
- throw new Error("Invalid LP supply");
980
- if (totalValue <= new bn_js_1.default(0))
981
- throw new Error("Invalid total assets");
982
- const unharvestedFeesLp = vault.feeState.accumulatedLpAdminFees
983
- .add(vault.feeState.accumulatedLpManagerFees)
984
- .add(vault.feeState.accumulatedLpProtocolFees);
985
- const lpSupplyInclFees = lpSupply.add(unharvestedFeesLp);
986
- // asset_to_redeem_pre_fee = amount * (total_asset_pre_withdraw / total_lp_supply_pre_withdraw)
987
- // asset_to_redeem_post_fee = asset_to_redeem_pre_fee * (10000 - redemption_fee_bps) / 10000
988
- const assetToRedeemNumerator = lpAmount
989
- .mul(totalUnlockedValue)
990
- .mul(new bn_js_1.default(10000 - vault.feeConfiguration.redemptionFee));
991
- const assetToRedeemDenominator = lpSupplyInclFees.mul(new bn_js_1.default(10000));
992
- const amount = assetToRedeemNumerator.div(assetToRedeemDenominator);
1073
+ const amount = this.calculateAssetsForWithdrawHelper(vault.asset.totalValue, vault.lockedProfitState.lastUpdatedLockedProfit, vault.vaultConfiguration.lockedProfitDegradationDuration, vault.feeState.accumulatedLpAdminFees, vault.feeState.accumulatedLpManagerFees, vault.feeState.accumulatedLpProtocolFees, vault.feeConfiguration.redemptionFee, new bn_js_1.default(lp.supply.toString()), lpAmount);
993
1074
  return amount;
994
1075
  }
995
1076
  catch (e) {
@@ -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.2",
3
+ "version": "1.0.4",
4
4
  "description": "SDK for interacting with Voltr Protocol",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",