@zebec-network/zebec-vault-sdk 1.0.8 → 1.1.0

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/pda.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  import { Address } from "@coral-xyz/anchor";
2
2
  import { PublicKey } from "@solana/web3.js";
3
3
  export declare function deriveVaultSigner(vault: Address, programId: Address): [PublicKey, number];
4
- export declare function deriveWhitelist(programId: Address): [PublicKey, number];
package/dist/pda.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deriveVaultSigner = deriveVaultSigner;
4
- exports.deriveWhitelist = deriveWhitelist;
5
4
  const anchor_1 = require("@coral-xyz/anchor");
6
5
  const web3_js_1 = require("@solana/web3.js");
7
6
  const SEEDS = {
@@ -12,7 +11,3 @@ function deriveVaultSigner(vault, programId) {
12
11
  const addressAndBump = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(SEEDS.VAULT_SIGNER), (0, anchor_1.translateAddress)(vault).toBuffer()], (0, anchor_1.translateAddress)(programId));
13
12
  return addressAndBump;
14
13
  }
15
- function deriveWhitelist(programId) {
16
- const addressAndBump = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(SEEDS.WHITELIST)], (0, anchor_1.translateAddress)(programId));
17
- return addressAndBump;
18
- }
package/dist/service.d.ts CHANGED
@@ -3,7 +3,7 @@ import { AccountMeta, Keypair, PublicKey, Signer, TransactionInstruction } from
3
3
  import { TransactionPayload } from "@zebec-network/solana-common";
4
4
  import { ZebecVaultIdlV1 } from "./artifacts";
5
5
  import { RpcNetwork } from "./constants";
6
- import { Numeric, ProposalAction, ProposalInfo, VaultInfo, WhitelistInfo } from "./types";
6
+ import { Numeric, ProposalAction, ProposalInfo, VaultInfo } from "./types";
7
7
  export declare class ZebecVaultService {
8
8
  readonly provider: Provider;
9
9
  readonly program: Program<ZebecVaultIdlV1>;
@@ -20,7 +20,6 @@ export declare class ZebecVaultService {
20
20
  getDeleteProposalInstruction(proposal: PublicKey): Promise<TransactionInstruction>;
21
21
  getExecuteProposalInstruction(caller: PublicKey, proposal: PublicKey, remainingAccounts: AccountMeta[]): Promise<TransactionInstruction>;
22
22
  getExecuteProposalDirectInstruction(vault: PublicKey, proposer: PublicKey, actions: ProposalAction[], remainingAccounts: AccountMeta[]): Promise<TransactionInstruction>;
23
- getWhitelistTokenInstruction(whitelister: PublicKey, tokenAddresses: PublicKey[]): Promise<TransactionInstruction>;
24
23
  createVault(params: {
25
24
  payer?: Address;
26
25
  vaultKeypair?: Keypair;
@@ -76,15 +75,10 @@ export declare class ZebecVaultService {
76
75
  partialSigners?: Signer[];
77
76
  addressLookupTables?: Address[];
78
77
  }): Promise<TransactionPayload>;
79
- whitelistTokens(params: {
80
- whitelister?: Address;
81
- tokenAddresses: Address[];
82
- }): Promise<TransactionPayload>;
83
78
  private _createTransactionPayload;
84
79
  getVaultsInfoOfUser(user?: Address): Promise<VaultInfo[]>;
85
80
  getAllVaultsInfo(): Promise<VaultInfo[]>;
86
81
  getProposalsInfoOfVault(vault: Address): Promise<ProposalInfo[]>;
87
- getWhitelistInfo(): Promise<WhitelistInfo | null>;
88
82
  get programId(): PublicKey;
89
83
  get connection(): import("@solana/web3.js").Connection;
90
84
  }
package/dist/service.js CHANGED
@@ -140,16 +140,6 @@ class ZebecVaultService {
140
140
  .remainingAccounts(remainingAccounts)
141
141
  .instruction();
142
142
  }
143
- async getWhitelistTokenInstruction(whitelister, tokenAddresses) {
144
- return this.program.methods
145
- .whitelistToken({
146
- tokenAddresses,
147
- })
148
- .accounts({
149
- whitelister,
150
- })
151
- .instruction();
152
- }
153
143
  async createVault(params) {
154
144
  const payer = params.payer ? (0, anchor_1.translateAddress)(params.payer) : this.provider.publicKey;
155
145
  if (!payer) {
@@ -335,15 +325,6 @@ class ZebecVaultService {
335
325
  }
336
326
  return this._createTransactionPayload(proposer, [ix], params.partialSigners, addressLookupTableAccounts);
337
327
  }
338
- async whitelistTokens(params) {
339
- const whitelister = params.whitelister ? (0, anchor_1.translateAddress)(params.whitelister) : this.provider.publicKey;
340
- if (!whitelister) {
341
- throw new Error("Either provide a whitelister or use AnchorProvider for provider in the service");
342
- }
343
- const tokens = params.tokenAddresses.map((address) => (0, anchor_1.translateAddress)(address));
344
- const ix = await this.getWhitelistTokenInstruction(whitelister, tokens);
345
- return this._createTransactionPayload(whitelister, [ix]);
346
- }
347
328
  async _createTransactionPayload(payerKey, instructions, signers, addressLookupTableAccounts) {
348
329
  const errorMap = new Map();
349
330
  this.program.idl.errors.forEach((error) => errorMap.set(error.code, error.msg));
@@ -451,17 +432,6 @@ class ZebecVaultService {
451
432
  });
452
433
  return proposals;
453
434
  }
454
- async getWhitelistInfo() {
455
- const [whitelist] = (0, pda_1.deriveWhitelist)(this.programId);
456
- const whitelistAccount = await this.program.account.whitelist.fetchNullable(whitelist, this.connection.commitment);
457
- if (!whitelistAccount) {
458
- return null;
459
- }
460
- return {
461
- ...whitelistAccount,
462
- whitelist,
463
- };
464
- }
465
435
  get programId() {
466
436
  return this.program.programId;
467
437
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zebec-network/zebec-vault-sdk",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "description": "An SDK for zebec vault solana program",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,7 +21,8 @@
21
21
  "build": "npm run clean && tsc",
22
22
  "clean": "rimraf ./dist",
23
23
  "format": "prettier --write .",
24
- "test": "ts-mocha -p ./tsconfig.json -t 1000000000"
24
+ "test:single": "ts-mocha -p ./tsconfig.json -t 1000000000",
25
+ "test": "ts-mocha -p ./tsconfig.json -t 1000000000 test/**/*.test.ts"
25
26
  },
26
27
  "devDependencies": {
27
28
  "@types/mocha": "^10.0.10",