@voltr/vault-sdk 1.0.7 → 1.0.8

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
@@ -258,6 +258,7 @@ pendingWithdrawals.forEach((withdrawal, index) => {
258
258
  - `createWithdrawStrategyIx(withdrawArgs, params)`
259
259
  - `createInitializeDirectWithdrawStrategyIx(initArgs, params)`
260
260
  - `createDirectWithdrawStrategyIx(withdrawArgs, params)`
261
+ - `createCloseStrategyIx(params)`
261
262
  - `createRemoveAdaptorIx(params)`
262
263
 
263
264
  #### Account Data
package/dist/client.d.ts CHANGED
@@ -124,6 +124,17 @@ export declare class VoltrClient extends AccountUtils {
124
124
  * ```
125
125
  */
126
126
  findRequestWithdrawVaultReceipt(vault: PublicKey, user: PublicKey): PublicKey;
127
+ /**
128
+ * Finds the LP metadata account for a given vault
129
+ * @param vault - Public key of the vault
130
+ * @returns The PDA for the LP metadata account
131
+ *
132
+ * @example
133
+ * ```typescript
134
+ * const lpMetadataAccount = client.findLpMetadataAccount(vaultPubkey);
135
+ * ```
136
+ */
137
+ findLpMetadataAccount(vault: PublicKey): PublicKey;
127
138
  /**
128
139
  * Creates an instruction to initialize a new vault
129
140
  *
@@ -671,6 +682,37 @@ export declare class VoltrClient extends AccountUtils {
671
682
  vault: PublicKey;
672
683
  strategy: PublicKey;
673
684
  }): Promise<TransactionInstruction>;
685
+ /**
686
+ * Creates an instruction to create LP metadata
687
+ * @param {Object} createLpMetadataArgs - Parameters for creating LP metadata
688
+ * @param {string} createLpMetadataArgs.name - Name of the LP
689
+ * @param {string} createLpMetadataArgs.symbol - Symbol of the LP
690
+ * @param {string} createLpMetadataArgs.uri - URI of the LP metadata
691
+ * @param {Object} params - Parameters for creating LP metadata
692
+ * @param {PublicKey} params.payer - Public key of the payer
693
+ * @param {PublicKey} params.admin - Public key of the admin
694
+ * @param {PublicKey} params.vault - Public key of the vault
695
+ * @returns {Promise<TransactionInstruction>} Transaction instruction for creating LP metadata
696
+ * @throws {Error} If instruction creation fails
697
+ *
698
+ * @example
699
+ * ```typescript
700
+ * const ix = await client.createCreateLpMetadataIx({
701
+ * name: "My LP",
702
+ * symbol: "MYLP",
703
+ * uri: "https://mylp.com/metadata",
704
+ * });
705
+ * ```
706
+ */
707
+ createCreateLpMetadataIx({ name, symbol, uri, }: {
708
+ name: string;
709
+ symbol: string;
710
+ uri: string;
711
+ }, { payer, admin, vault, }: {
712
+ payer: PublicKey;
713
+ admin: PublicKey;
714
+ vault: PublicKey;
715
+ }): Promise<TransactionInstruction>;
674
716
  /**
675
717
  * Fetches all strategy init receipt accounts
676
718
  * @returns Promise resolving to an array of strategy init receipt accounts
@@ -791,6 +833,10 @@ export declare class VoltrClient extends AccountUtils {
791
833
  issuanceFee: number;
792
834
  reserved: number[];
793
835
  };
836
+ feeUpdate: {
837
+ lastPerformanceFeeUpdateTs: BN;
838
+ lastManagementFeeUpdateTs: BN;
839
+ };
794
840
  feeState: {
795
841
  accumulatedLpManagerFees: BN;
796
842
  accumulatedLpAdminFees: BN;
package/dist/client.js CHANGED
@@ -247,6 +247,21 @@ class VoltrClient extends AccountUtils {
247
247
  const [requestWithdrawVaultReceipt] = web3_js_1.PublicKey.findProgramAddressSync([constants_1.SEEDS.REQUEST_WITHDRAW_VAULT_RECEIPT, vault.toBuffer(), user.toBuffer()], this.vaultProgram.programId);
248
248
  return requestWithdrawVaultReceipt;
249
249
  }
250
+ /**
251
+ * Finds the LP metadata account for a given vault
252
+ * @param vault - Public key of the vault
253
+ * @returns The PDA for the LP metadata account
254
+ *
255
+ * @example
256
+ * ```typescript
257
+ * const lpMetadataAccount = client.findLpMetadataAccount(vaultPubkey);
258
+ * ```
259
+ */
260
+ findLpMetadataAccount(vault) {
261
+ const lpMint = this.findVaultLpMint(vault);
262
+ const [lpMetadataAccount] = web3_js_1.PublicKey.findProgramAddressSync([constants_1.SEEDS.METADATA, constants_1.METADATA_PROGRAM_ID.toBuffer(), lpMint.toBuffer()], constants_1.METADATA_PROGRAM_ID);
263
+ return lpMetadataAccount;
264
+ }
250
265
  // --------------------------------------- Vault Instructions
251
266
  /**
252
267
  * Creates an instruction to initialize a new vault
@@ -862,6 +877,40 @@ class VoltrClient extends AccountUtils {
862
877
  })
863
878
  .instruction();
864
879
  }
880
+ /**
881
+ * Creates an instruction to create LP metadata
882
+ * @param {Object} createLpMetadataArgs - Parameters for creating LP metadata
883
+ * @param {string} createLpMetadataArgs.name - Name of the LP
884
+ * @param {string} createLpMetadataArgs.symbol - Symbol of the LP
885
+ * @param {string} createLpMetadataArgs.uri - URI of the LP metadata
886
+ * @param {Object} params - Parameters for creating LP metadata
887
+ * @param {PublicKey} params.payer - Public key of the payer
888
+ * @param {PublicKey} params.admin - Public key of the admin
889
+ * @param {PublicKey} params.vault - Public key of the vault
890
+ * @returns {Promise<TransactionInstruction>} Transaction instruction for creating LP metadata
891
+ * @throws {Error} If instruction creation fails
892
+ *
893
+ * @example
894
+ * ```typescript
895
+ * const ix = await client.createCreateLpMetadataIx({
896
+ * name: "My LP",
897
+ * symbol: "MYLP",
898
+ * uri: "https://mylp.com/metadata",
899
+ * });
900
+ * ```
901
+ */
902
+ async createCreateLpMetadataIx({ name, symbol, uri, }, { payer, admin, vault, }) {
903
+ const metadataAccount = this.findLpMetadataAccount(vault);
904
+ return await this.vaultProgram.methods
905
+ .createLpMetadata(name, symbol, uri)
906
+ .accountsPartial({
907
+ payer,
908
+ vault,
909
+ admin,
910
+ metadataAccount,
911
+ })
912
+ .instruction();
913
+ }
865
914
  // --------------------------------------- Account Fetching All
866
915
  /**
867
916
  * Fetches all strategy init receipt accounts
@@ -2,6 +2,7 @@ import { PublicKey } from "@solana/web3.js";
2
2
  export declare const VAULT_PROGRAM_ID: PublicKey;
3
3
  export declare const LENDING_ADAPTOR_PROGRAM_ID: PublicKey;
4
4
  export declare const DRIFT_ADAPTOR_PROGRAM_ID: PublicKey;
5
+ export declare const METADATA_PROGRAM_ID: PublicKey;
5
6
  export declare const SEEDS: {
6
7
  PROTOCOL: Buffer<ArrayBuffer>;
7
8
  VAULT_LP_MINT: Buffer<ArrayBuffer>;
@@ -14,4 +15,5 @@ export declare const SEEDS: {
14
15
  DIRECT_WITHDRAW_INIT_RECEIPT_SEED: Buffer<ArrayBuffer>;
15
16
  REQUEST_WITHDRAW_VAULT_RECEIPT: Buffer<ArrayBuffer>;
16
17
  STRATEGY: Buffer<ArrayBuffer>;
18
+ METADATA: Buffer<ArrayBuffer>;
17
19
  };
package/dist/constants.js CHANGED
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SEEDS = exports.DRIFT_ADAPTOR_PROGRAM_ID = exports.LENDING_ADAPTOR_PROGRAM_ID = exports.VAULT_PROGRAM_ID = void 0;
3
+ exports.SEEDS = exports.METADATA_PROGRAM_ID = exports.DRIFT_ADAPTOR_PROGRAM_ID = exports.LENDING_ADAPTOR_PROGRAM_ID = exports.VAULT_PROGRAM_ID = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
5
  exports.VAULT_PROGRAM_ID = new web3_js_1.PublicKey("vVoLTRjQmtFpiYoegx285Ze4gsLJ8ZxgFKVcuvmG1a8");
6
6
  exports.LENDING_ADAPTOR_PROGRAM_ID = new web3_js_1.PublicKey("aVoLTRCRt3NnnchvLYH6rMYehJHwM5m45RmLBZq7PGz");
7
7
  exports.DRIFT_ADAPTOR_PROGRAM_ID = new web3_js_1.PublicKey("EBN93eXs5fHGBABuajQqdsKRkCgaqtJa8vEFD6vKXiP");
8
+ exports.METADATA_PROGRAM_ID = new web3_js_1.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");
8
9
  exports.SEEDS = {
9
10
  PROTOCOL: Buffer.from("protocol"),
10
11
  VAULT_LP_MINT: Buffer.from("vault_lp_mint"),
@@ -18,4 +19,5 @@ exports.SEEDS = {
18
19
  REQUEST_WITHDRAW_VAULT_RECEIPT: Buffer.from("request_withdraw_vault_receipt"),
19
20
  // TODO: Remove this
20
21
  STRATEGY: Buffer.from("strategy"),
22
+ METADATA: Buffer.from("metadata"),
21
23
  };
@@ -460,6 +460,129 @@
460
460
  ],
461
461
  "args": []
462
462
  },
463
+ {
464
+ "name": "create_lp_metadata",
465
+ "discriminator": [
466
+ 148,
467
+ 193,
468
+ 160,
469
+ 116,
470
+ 87,
471
+ 25,
472
+ 123,
473
+ 103
474
+ ],
475
+ "accounts": [
476
+ {
477
+ "name": "payer",
478
+ "writable": true,
479
+ "signer": true
480
+ },
481
+ {
482
+ "name": "admin",
483
+ "signer": true,
484
+ "relations": [
485
+ "vault"
486
+ ]
487
+ },
488
+ {
489
+ "name": "vault"
490
+ },
491
+ {
492
+ "name": "vault_lp_mint",
493
+ "pda": {
494
+ "seeds": [
495
+ {
496
+ "kind": "const",
497
+ "value": [
498
+ 118,
499
+ 97,
500
+ 117,
501
+ 108,
502
+ 116,
503
+ 95,
504
+ 108,
505
+ 112,
506
+ 95,
507
+ 109,
508
+ 105,
509
+ 110,
510
+ 116
511
+ ]
512
+ },
513
+ {
514
+ "kind": "account",
515
+ "path": "vault"
516
+ }
517
+ ]
518
+ }
519
+ },
520
+ {
521
+ "name": "vault_lp_mint_auth",
522
+ "pda": {
523
+ "seeds": [
524
+ {
525
+ "kind": "const",
526
+ "value": [
527
+ 118,
528
+ 97,
529
+ 117,
530
+ 108,
531
+ 116,
532
+ 95,
533
+ 108,
534
+ 112,
535
+ 95,
536
+ 109,
537
+ 105,
538
+ 110,
539
+ 116,
540
+ 95,
541
+ 97,
542
+ 117,
543
+ 116,
544
+ 104
545
+ ]
546
+ },
547
+ {
548
+ "kind": "account",
549
+ "path": "vault"
550
+ }
551
+ ]
552
+ }
553
+ },
554
+ {
555
+ "name": "metadata_account",
556
+ "writable": true
557
+ },
558
+ {
559
+ "name": "metadata_program",
560
+ "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
561
+ },
562
+ {
563
+ "name": "rent",
564
+ "address": "SysvarRent111111111111111111111111111111111"
565
+ },
566
+ {
567
+ "name": "system_program",
568
+ "address": "11111111111111111111111111111111"
569
+ }
570
+ ],
571
+ "args": [
572
+ {
573
+ "name": "name",
574
+ "type": "string"
575
+ },
576
+ {
577
+ "name": "symbol",
578
+ "type": "string"
579
+ },
580
+ {
581
+ "name": "uri",
582
+ "type": "string"
583
+ }
584
+ ]
585
+ },
463
586
  {
464
587
  "name": "deposit_strategy",
465
588
  "discriminator": [
@@ -4146,41 +4269,46 @@
4146
4269
  },
4147
4270
  {
4148
4271
  "code": 6005,
4272
+ "name": "FeeExceedsTotalAssetValue",
4273
+ "msg": "Fee exceeds total asset value."
4274
+ },
4275
+ {
4276
+ "code": 6006,
4149
4277
  "name": "MaxCapExceeded",
4150
4278
  "msg": "Max cap exceeded."
4151
4279
  },
4152
4280
  {
4153
- "code": 6006,
4281
+ "code": 6007,
4154
4282
  "name": "VaultNotActive",
4155
4283
  "msg": "Vault not active."
4156
4284
  },
4157
4285
  {
4158
- "code": 6007,
4286
+ "code": 6008,
4159
4287
  "name": "ManagerNotAllowed",
4160
4288
  "msg": "Manager not allowed in remaining."
4161
4289
  },
4162
4290
  {
4163
- "code": 6008,
4291
+ "code": 6009,
4164
4292
  "name": "OperationNotAllowed",
4165
4293
  "msg": "Operation not allowed."
4166
4294
  },
4167
4295
  {
4168
- "code": 6009,
4296
+ "code": 6010,
4169
4297
  "name": "AdaptorEpochInvalid",
4170
4298
  "msg": "Adaptor epoch invalid."
4171
4299
  },
4172
4300
  {
4173
- "code": 6010,
4301
+ "code": 6011,
4174
4302
  "name": "InvalidFeeConfiguration",
4175
4303
  "msg": "Fee configuration invalid."
4176
4304
  },
4177
4305
  {
4178
- "code": 6011,
4306
+ "code": 6012,
4179
4307
  "name": "WithdrawalNotYetAvailable",
4180
4308
  "msg": "Withdrawal not yet available."
4181
4309
  },
4182
4310
  {
4183
- "code": 6012,
4311
+ "code": 6013,
4184
4312
  "name": "InvalidInput",
4185
4313
  "msg": "Invalid input."
4186
4314
  }
@@ -4626,7 +4754,7 @@
4626
4754
  "type": {
4627
4755
  "array": [
4628
4756
  "u8",
4629
- 52
4757
+ 36
4630
4758
  ]
4631
4759
  }
4632
4760
  }
@@ -4678,6 +4806,32 @@
4678
4806
  ]
4679
4807
  }
4680
4808
  },
4809
+ {
4810
+ "name": "FeeUpdate",
4811
+ "serialization": "bytemuckunsafe",
4812
+ "repr": {
4813
+ "kind": "c"
4814
+ },
4815
+ "type": {
4816
+ "kind": "struct",
4817
+ "fields": [
4818
+ {
4819
+ "name": "last_performance_fee_update_ts",
4820
+ "docs": [
4821
+ "The timestamp when the performance fees were last updated."
4822
+ ],
4823
+ "type": "u64"
4824
+ },
4825
+ {
4826
+ "name": "last_management_fee_update_ts",
4827
+ "docs": [
4828
+ "The timestamp when the management fees were last updated."
4829
+ ],
4830
+ "type": "u64"
4831
+ }
4832
+ ]
4833
+ }
4834
+ },
4681
4835
  {
4682
4836
  "name": "HarvestFeeEvent",
4683
4837
  "type": {
@@ -5407,6 +5561,17 @@
5407
5561
  }
5408
5562
  }
5409
5563
  },
5564
+ {
5565
+ "name": "fee_update",
5566
+ "docs": [
5567
+ "The fee update state of the vault."
5568
+ ],
5569
+ "type": {
5570
+ "defined": {
5571
+ "name": "FeeUpdate"
5572
+ }
5573
+ }
5574
+ },
5410
5575
  {
5411
5576
  "name": "fee_state",
5412
5577
  "docs": [
@@ -466,6 +466,129 @@ export type VoltrVault = {
466
466
  ];
467
467
  "args": [];
468
468
  },
469
+ {
470
+ "name": "createLpMetadata";
471
+ "discriminator": [
472
+ 148,
473
+ 193,
474
+ 160,
475
+ 116,
476
+ 87,
477
+ 25,
478
+ 123,
479
+ 103
480
+ ];
481
+ "accounts": [
482
+ {
483
+ "name": "payer";
484
+ "writable": true;
485
+ "signer": true;
486
+ },
487
+ {
488
+ "name": "admin";
489
+ "signer": true;
490
+ "relations": [
491
+ "vault"
492
+ ];
493
+ },
494
+ {
495
+ "name": "vault";
496
+ },
497
+ {
498
+ "name": "vaultLpMint";
499
+ "pda": {
500
+ "seeds": [
501
+ {
502
+ "kind": "const";
503
+ "value": [
504
+ 118,
505
+ 97,
506
+ 117,
507
+ 108,
508
+ 116,
509
+ 95,
510
+ 108,
511
+ 112,
512
+ 95,
513
+ 109,
514
+ 105,
515
+ 110,
516
+ 116
517
+ ];
518
+ },
519
+ {
520
+ "kind": "account";
521
+ "path": "vault";
522
+ }
523
+ ];
524
+ };
525
+ },
526
+ {
527
+ "name": "vaultLpMintAuth";
528
+ "pda": {
529
+ "seeds": [
530
+ {
531
+ "kind": "const";
532
+ "value": [
533
+ 118,
534
+ 97,
535
+ 117,
536
+ 108,
537
+ 116,
538
+ 95,
539
+ 108,
540
+ 112,
541
+ 95,
542
+ 109,
543
+ 105,
544
+ 110,
545
+ 116,
546
+ 95,
547
+ 97,
548
+ 117,
549
+ 116,
550
+ 104
551
+ ];
552
+ },
553
+ {
554
+ "kind": "account";
555
+ "path": "vault";
556
+ }
557
+ ];
558
+ };
559
+ },
560
+ {
561
+ "name": "metadataAccount";
562
+ "writable": true;
563
+ },
564
+ {
565
+ "name": "metadataProgram";
566
+ "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
567
+ },
568
+ {
569
+ "name": "rent";
570
+ "address": "SysvarRent111111111111111111111111111111111";
571
+ },
572
+ {
573
+ "name": "systemProgram";
574
+ "address": "11111111111111111111111111111111";
575
+ }
576
+ ];
577
+ "args": [
578
+ {
579
+ "name": "name";
580
+ "type": "string";
581
+ },
582
+ {
583
+ "name": "symbol";
584
+ "type": "string";
585
+ },
586
+ {
587
+ "name": "uri";
588
+ "type": "string";
589
+ }
590
+ ];
591
+ },
469
592
  {
470
593
  "name": "depositStrategy";
471
594
  "discriminator": [
@@ -4152,41 +4275,46 @@ export type VoltrVault = {
4152
4275
  },
4153
4276
  {
4154
4277
  "code": 6005;
4278
+ "name": "feeExceedsTotalAssetValue";
4279
+ "msg": "Fee exceeds total asset value.";
4280
+ },
4281
+ {
4282
+ "code": 6006;
4155
4283
  "name": "maxCapExceeded";
4156
4284
  "msg": "Max cap exceeded.";
4157
4285
  },
4158
4286
  {
4159
- "code": 6006;
4287
+ "code": 6007;
4160
4288
  "name": "vaultNotActive";
4161
4289
  "msg": "Vault not active.";
4162
4290
  },
4163
4291
  {
4164
- "code": 6007;
4292
+ "code": 6008;
4165
4293
  "name": "managerNotAllowed";
4166
4294
  "msg": "Manager not allowed in remaining.";
4167
4295
  },
4168
4296
  {
4169
- "code": 6008;
4297
+ "code": 6009;
4170
4298
  "name": "operationNotAllowed";
4171
4299
  "msg": "Operation not allowed.";
4172
4300
  },
4173
4301
  {
4174
- "code": 6009;
4302
+ "code": 6010;
4175
4303
  "name": "adaptorEpochInvalid";
4176
4304
  "msg": "Adaptor epoch invalid.";
4177
4305
  },
4178
4306
  {
4179
- "code": 6010;
4307
+ "code": 6011;
4180
4308
  "name": "invalidFeeConfiguration";
4181
4309
  "msg": "Fee configuration invalid.";
4182
4310
  },
4183
4311
  {
4184
- "code": 6011;
4312
+ "code": 6012;
4185
4313
  "name": "withdrawalNotYetAvailable";
4186
4314
  "msg": "Withdrawal not yet available.";
4187
4315
  },
4188
4316
  {
4189
- "code": 6012;
4317
+ "code": 6013;
4190
4318
  "name": "invalidInput";
4191
4319
  "msg": "Invalid input.";
4192
4320
  }
@@ -4632,7 +4760,7 @@ export type VoltrVault = {
4632
4760
  "type": {
4633
4761
  "array": [
4634
4762
  "u8",
4635
- 52
4763
+ 36
4636
4764
  ];
4637
4765
  };
4638
4766
  }
@@ -4684,6 +4812,32 @@ export type VoltrVault = {
4684
4812
  ];
4685
4813
  };
4686
4814
  },
4815
+ {
4816
+ "name": "feeUpdate";
4817
+ "serialization": "bytemuckunsafe";
4818
+ "repr": {
4819
+ "kind": "c";
4820
+ };
4821
+ "type": {
4822
+ "kind": "struct";
4823
+ "fields": [
4824
+ {
4825
+ "name": "lastPerformanceFeeUpdateTs";
4826
+ "docs": [
4827
+ "The timestamp when the performance fees were last updated."
4828
+ ];
4829
+ "type": "u64";
4830
+ },
4831
+ {
4832
+ "name": "lastManagementFeeUpdateTs";
4833
+ "docs": [
4834
+ "The timestamp when the management fees were last updated."
4835
+ ];
4836
+ "type": "u64";
4837
+ }
4838
+ ];
4839
+ };
4840
+ },
4687
4841
  {
4688
4842
  "name": "harvestFeeEvent";
4689
4843
  "type": {
@@ -5413,6 +5567,17 @@ export type VoltrVault = {
5413
5567
  };
5414
5568
  };
5415
5569
  },
5570
+ {
5571
+ "name": "feeUpdate";
5572
+ "docs": [
5573
+ "The fee update state of the vault."
5574
+ ];
5575
+ "type": {
5576
+ "defined": {
5577
+ "name": "feeUpdate";
5578
+ };
5579
+ };
5580
+ },
5416
5581
  {
5417
5582
  "name": "feeState";
5418
5583
  "docs": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltr/vault-sdk",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "SDK for interacting with Voltr Protocol",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",