proof-of-take-sdk 2.1.0 → 3.0.1

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/index.d.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  *
6
6
  * @packageDocumentation
7
7
  */
8
+ import { getProgram as _getProgram } from "./utils/programHelpers";
8
9
  export { createMiztake, getMiztakePdaForParams, } from "./instructions/createMiztake";
9
10
  export type { CreateMiztakeOptions, CreateMiztakeResult, } from "./instructions/createMiztake";
10
11
  export { initializeStatistics } from "./instructions/initializeStatistics";
@@ -29,7 +30,7 @@ export { viewCurrentSeason } from "./instructions/viewCurrentSeason";
29
30
  export * from "./utils/pdas";
30
31
  export * from "./utils/constants";
31
32
  export * from "./utils/accountUpdates";
32
- export * from "./utils/programHelpers";
33
+ export declare const getProgram: typeof _getProgram;
33
34
  export * from "./utils/signerHelpers";
34
35
  export * from "./utils/conversions";
35
36
  export * from "./utils/transactionBuilder";
@@ -45,4 +46,6 @@ export type { ProofOfTake } from "./types/proof_of_take";
45
46
  export { IDL } from "./idl/idl";
46
47
  export { createProgram, createProgramWithId, getProgramReadOnly, } from "./client";
47
48
  export * from "./getters";
49
+ export * from "./instructions/closeAuxiliaryAccounts";
50
+ export * from "./types/closeAccountsTypes";
48
51
  export declare const VERSION = "1.0.0";
package/dist/index.js CHANGED
@@ -21,7 +21,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
21
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
22
  };
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.VERSION = exports.getProgramReadOnly = exports.createProgramWithId = exports.createProgram = exports.IDL = exports.PDAManager = exports.viewCurrentSeason = exports.viewWindowStatus = exports.viewSeasonMembershipStatus = exports.updateSeasonAdmin = exports.toggleSeasonPause = exports.withdrawSeasonDeposit = exports.claimReferralPenaltyForWindow = exports.claimWindowRewards = exports.confirmedPostOnX = exports.joinSeason = exports.initializeEscrowVault = exports.initializeSeasonVault = exports.initializeSeasonSettings = exports.initializeStatistics = exports.getMiztakePdaForParams = exports.createMiztake = void 0;
24
+ exports.VERSION = exports.getProgramReadOnly = exports.createProgramWithId = exports.createProgram = exports.IDL = exports.PDAManager = exports.getProgram = exports.viewCurrentSeason = exports.viewWindowStatus = exports.viewSeasonMembershipStatus = exports.updateSeasonAdmin = exports.toggleSeasonPause = exports.withdrawSeasonDeposit = exports.claimReferralPenaltyForWindow = exports.claimWindowRewards = exports.confirmedPostOnX = exports.joinSeason = exports.initializeEscrowVault = exports.initializeSeasonVault = exports.initializeSeasonSettings = exports.initializeStatistics = exports.getMiztakePdaForParams = exports.createMiztake = void 0;
25
+ // NOTE:
26
+ // We intentionally export `getProgram` via a local const assignment (instead of `export * from ...`)
27
+ // so that the compiled CommonJS output uses a writable property. This makes it possible to mock
28
+ // `getProgram` in Jest by reassigning the export in test environments.
29
+ const programHelpers_1 = require("./utils/programHelpers");
25
30
  // Export all instructions
26
31
  // Core miztake instructions
27
32
  var createMiztake_1 = require("./instructions/createMiztake");
@@ -63,7 +68,7 @@ Object.defineProperty(exports, "viewCurrentSeason", { enumerable: true, get: fun
63
68
  __exportStar(require("./utils/pdas"), exports);
64
69
  __exportStar(require("./utils/constants"), exports);
65
70
  __exportStar(require("./utils/accountUpdates"), exports);
66
- __exportStar(require("./utils/programHelpers"), exports);
71
+ exports.getProgram = programHelpers_1.getProgram;
67
72
  __exportStar(require("./utils/signerHelpers"), exports);
68
73
  __exportStar(require("./utils/conversions"), exports);
69
74
  __exportStar(require("./utils/transactionBuilder"), exports);
@@ -88,5 +93,8 @@ Object.defineProperty(exports, "createProgramWithId", { enumerable: true, get: f
88
93
  Object.defineProperty(exports, "getProgramReadOnly", { enumerable: true, get: function () { return client_1.getProgramReadOnly; } });
89
94
  // Export getters
90
95
  __exportStar(require("./getters"), exports);
96
+ // Export close instructions
97
+ __exportStar(require("./instructions/closeAuxiliaryAccounts"), exports);
98
+ __exportStar(require("./types/closeAccountsTypes"), exports);
91
99
  // Version
92
100
  exports.VERSION = "1.0.0";
@@ -0,0 +1,74 @@
1
+ import { Connection, PublicKey, TransactionInstruction } from "@solana/web3.js";
2
+ import { SignerInfo } from "../utils/signerHelpers";
3
+ /**
4
+ * Close a Miztake account
5
+ */
6
+ export declare function closeMiztake(options: {
7
+ connection: Connection;
8
+ admin: PublicKey;
9
+ accountToClose: PublicKey;
10
+ feePayer?: PublicKey;
11
+ }): Promise<{
12
+ instructions: TransactionInstruction[];
13
+ signers: SignerInfo[];
14
+ }>;
15
+ /**
16
+ * Close a UserStats account
17
+ */
18
+ export declare function closeUserStats(options: {
19
+ connection: Connection;
20
+ admin: PublicKey;
21
+ accountToClose: PublicKey;
22
+ feePayer?: PublicKey;
23
+ }): Promise<{
24
+ instructions: TransactionInstruction[];
25
+ signers: SignerInfo[];
26
+ }>;
27
+ /**
28
+ * Close a SeasonMembership account
29
+ */
30
+ export declare function closeSeasonMembership(options: {
31
+ connection: Connection;
32
+ admin: PublicKey;
33
+ accountToClose: PublicKey;
34
+ feePayer?: PublicKey;
35
+ }): Promise<{
36
+ instructions: TransactionInstruction[];
37
+ signers: SignerInfo[];
38
+ }>;
39
+ /**
40
+ * Close a RewardWindow account
41
+ */
42
+ export declare function closeRewardWindow(options: {
43
+ connection: Connection;
44
+ admin: PublicKey;
45
+ accountToClose: PublicKey;
46
+ feePayer?: PublicKey;
47
+ }): Promise<{
48
+ instructions: TransactionInstruction[];
49
+ signers: SignerInfo[];
50
+ }>;
51
+ /**
52
+ * Close a UserWindowParticipation account
53
+ */
54
+ export declare function closeUserWindowParticipation(options: {
55
+ connection: Connection;
56
+ admin: PublicKey;
57
+ accountToClose: PublicKey;
58
+ feePayer?: PublicKey;
59
+ }): Promise<{
60
+ instructions: TransactionInstruction[];
61
+ signers: SignerInfo[];
62
+ }>;
63
+ /**
64
+ * Close a ReferralPenaltyClaim account
65
+ */
66
+ export declare function closeReferralPenaltyClaim(options: {
67
+ connection: Connection;
68
+ admin: PublicKey;
69
+ accountToClose: PublicKey;
70
+ feePayer?: PublicKey;
71
+ }): Promise<{
72
+ instructions: TransactionInstruction[];
73
+ signers: SignerInfo[];
74
+ }>;
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.closeMiztake = closeMiztake;
4
+ exports.closeUserStats = closeUserStats;
5
+ exports.closeSeasonMembership = closeSeasonMembership;
6
+ exports.closeRewardWindow = closeRewardWindow;
7
+ exports.closeUserWindowParticipation = closeUserWindowParticipation;
8
+ exports.closeReferralPenaltyClaim = closeReferralPenaltyClaim;
9
+ const programHelpers_1 = require("../utils/programHelpers");
10
+ const signerHelpers_1 = require("../utils/signerHelpers");
11
+ /**
12
+ * Close a Miztake account
13
+ */
14
+ async function closeMiztake(options) {
15
+ const program = (0, programHelpers_1.getProgram)(options.connection);
16
+ const accounts = {
17
+ admin: options.admin,
18
+ accountToClose: options.accountToClose,
19
+ };
20
+ const instruction = await program.methods
21
+ .closeMiztake()
22
+ .accounts(accounts)
23
+ .instruction();
24
+ const signers = (0, signerHelpers_1.buildSigners)([{ publicKey: options.admin, role: "admin" }], options.feePayer);
25
+ return { instructions: [instruction], signers };
26
+ }
27
+ /**
28
+ * Close a UserStats account
29
+ */
30
+ async function closeUserStats(options) {
31
+ const program = (0, programHelpers_1.getProgram)(options.connection);
32
+ const accounts = {
33
+ admin: options.admin,
34
+ accountToClose: options.accountToClose,
35
+ };
36
+ const instruction = await program.methods
37
+ .closeUserStats()
38
+ .accounts(accounts)
39
+ .instruction();
40
+ const signers = (0, signerHelpers_1.buildSigners)([{ publicKey: options.admin, role: "admin" }], options.feePayer);
41
+ return { instructions: [instruction], signers };
42
+ }
43
+ /**
44
+ * Close a SeasonMembership account
45
+ */
46
+ async function closeSeasonMembership(options) {
47
+ const program = (0, programHelpers_1.getProgram)(options.connection);
48
+ const accounts = {
49
+ admin: options.admin,
50
+ accountToClose: options.accountToClose,
51
+ };
52
+ const instruction = await program.methods
53
+ .closeSeasonMembership()
54
+ .accounts(accounts)
55
+ .instruction();
56
+ const signers = (0, signerHelpers_1.buildSigners)([{ publicKey: options.admin, role: "admin" }], options.feePayer);
57
+ return { instructions: [instruction], signers };
58
+ }
59
+ /**
60
+ * Close a RewardWindow account
61
+ */
62
+ async function closeRewardWindow(options) {
63
+ const program = (0, programHelpers_1.getProgram)(options.connection);
64
+ const accounts = {
65
+ admin: options.admin,
66
+ accountToClose: options.accountToClose,
67
+ };
68
+ const instruction = await program.methods
69
+ .closeRewardWindow()
70
+ .accounts(accounts)
71
+ .instruction();
72
+ const signers = (0, signerHelpers_1.buildSigners)([{ publicKey: options.admin, role: "admin" }], options.feePayer);
73
+ return { instructions: [instruction], signers };
74
+ }
75
+ /**
76
+ * Close a UserWindowParticipation account
77
+ */
78
+ async function closeUserWindowParticipation(options) {
79
+ const program = (0, programHelpers_1.getProgram)(options.connection);
80
+ const accounts = {
81
+ admin: options.admin,
82
+ accountToClose: options.accountToClose,
83
+ };
84
+ const instruction = await program.methods
85
+ .closeUserWindowParticipation()
86
+ .accounts(accounts)
87
+ .instruction();
88
+ const signers = (0, signerHelpers_1.buildSigners)([{ publicKey: options.admin, role: "admin" }], options.feePayer);
89
+ return { instructions: [instruction], signers };
90
+ }
91
+ /**
92
+ * Close a ReferralPenaltyClaim account
93
+ */
94
+ async function closeReferralPenaltyClaim(options) {
95
+ const program = (0, programHelpers_1.getProgram)(options.connection);
96
+ const accounts = {
97
+ admin: options.admin,
98
+ accountToClose: options.accountToClose,
99
+ };
100
+ const instruction = await program.methods
101
+ .closeReferralPenaltyClaim()
102
+ .accounts(accounts)
103
+ .instruction();
104
+ const signers = (0, signerHelpers_1.buildSigners)([{ publicKey: options.admin, role: "admin" }], options.feePayer);
105
+ return { instructions: [instruction], signers };
106
+ }
@@ -1,12 +1,13 @@
1
1
  import { Connection, PublicKey, TransactionInstruction } from "@solana/web3.js";
2
2
  import { SignerInfo } from "../utils/signerHelpers";
3
+ import { BN } from "@coral-xyz/anchor";
3
4
  /**
4
5
  * Initialize season escrow vault
5
6
  *
6
7
  * Single signer: admin (pays for account creation)
7
8
  * This initializes the token vault for escrowed (protected) deposits.
8
9
  */
9
- export declare function initializeEscrowVault(connection: Connection, admin: PublicKey, feePayer?: PublicKey): Promise<{
10
+ export declare function initializeEscrowVault(connection: Connection, admin: PublicKey, seasonNumber: BN, feePayer?: PublicKey): Promise<{
10
11
  instructions: TransactionInstruction[];
11
12
  signers: SignerInfo[];
12
13
  pdas: {
@@ -13,9 +13,9 @@ const signerHelpers_1 = require("../utils/signerHelpers");
13
13
  * Single signer: admin (pays for account creation)
14
14
  * This initializes the token vault for escrowed (protected) deposits.
15
15
  */
16
- async function initializeEscrowVault(connection, admin, feePayer) {
16
+ async function initializeEscrowVault(connection, admin, seasonNumber, feePayer) {
17
17
  const program = (0, programHelpers_1.getProgram)(connection);
18
- const [vaultPda] = (0, pdas_1.getSeasonEscrowVaultPda)();
18
+ const [vaultPda] = (0, pdas_1.getSeasonEscrowVaultPda)(seasonNumber);
19
19
  const accounts = {
20
20
  seasonEscrowVault: vaultPda,
21
21
  mizdMint: constants_1.MIZD_TOKEN_MINT,
@@ -24,7 +24,7 @@ async function initializeEscrowVault(connection, admin, feePayer) {
24
24
  systemProgram: web3_js_1.SystemProgram.programId,
25
25
  };
26
26
  const instruction = await program.methods
27
- .initializeEscrowVault()
27
+ .initializeEscrowVault(seasonNumber)
28
28
  .accounts(accounts)
29
29
  .instruction();
30
30
  const signers = (0, signerHelpers_1.buildSigners)([{ publicKey: admin, role: "admin" }], feePayer);
@@ -1,5 +1,6 @@
1
1
  import { Connection, PublicKey, TransactionInstruction } from "@solana/web3.js";
2
2
  import { SignerInfo } from "../utils/signerHelpers";
3
+ import { BN } from "@coral-xyz/anchor";
3
4
  /**
4
5
  * Initialize season deposit vault
5
6
  *
@@ -11,7 +12,7 @@ import { SignerInfo } from "../utils/signerHelpers";
11
12
  * @param feePayer - Optional separate fee payer for transaction fees
12
13
  * @returns Instructions, signers array, and vault PDA
13
14
  */
14
- export declare function initializeSeasonVault(connection: Connection, admin: PublicKey, feePayer?: PublicKey): Promise<{
15
+ export declare function initializeSeasonVault(connection: Connection, admin: PublicKey, seasonNumber: BN, feePayer?: PublicKey): Promise<{
15
16
  instructions: TransactionInstruction[];
16
17
  signers: SignerInfo[];
17
18
  pdas: {
@@ -18,9 +18,9 @@ const signerHelpers_1 = require("../utils/signerHelpers");
18
18
  * @param feePayer - Optional separate fee payer for transaction fees
19
19
  * @returns Instructions, signers array, and vault PDA
20
20
  */
21
- async function initializeSeasonVault(connection, admin, feePayer) {
21
+ async function initializeSeasonVault(connection, admin, seasonNumber, feePayer) {
22
22
  const program = (0, programHelpers_1.getProgram)(connection);
23
- const [vaultPda] = (0, pdas_1.getSeasonDepositVaultPda)();
23
+ const [vaultPda] = (0, pdas_1.getSeasonDepositVaultPda)(seasonNumber);
24
24
  const accounts = {
25
25
  seasonDepositVault: vaultPda,
26
26
  mizdMint: constants_1.MIZD_TOKEN_MINT,
@@ -29,7 +29,7 @@ async function initializeSeasonVault(connection, admin, feePayer) {
29
29
  systemProgram: web3_js_1.SystemProgram.programId,
30
30
  };
31
31
  const instruction = await program.methods
32
- .initializeSeasonVault()
32
+ .initializeSeasonVault(seasonNumber)
33
33
  .accounts(accounts)
34
34
  .instruction();
35
35
  const signers = (0, signerHelpers_1.buildSigners)([{ publicKey: admin, role: "admin" }], feePayer);
@@ -0,0 +1,28 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ /**
3
+ * Typed account interfaces for closing auxiliary accounts
4
+ */
5
+ export interface CloseMiztakeAccounts {
6
+ admin: PublicKey;
7
+ accountToClose: PublicKey;
8
+ }
9
+ export interface CloseUserStatsAccounts {
10
+ admin: PublicKey;
11
+ accountToClose: PublicKey;
12
+ }
13
+ export interface CloseSeasonMembershipAccounts {
14
+ admin: PublicKey;
15
+ accountToClose: PublicKey;
16
+ }
17
+ export interface CloseRewardWindowAccounts {
18
+ admin: PublicKey;
19
+ accountToClose: PublicKey;
20
+ }
21
+ export interface CloseUserWindowParticipationAccounts {
22
+ admin: PublicKey;
23
+ accountToClose: PublicKey;
24
+ }
25
+ export interface CloseReferralPenaltyClaimAccounts {
26
+ admin: PublicKey;
27
+ accountToClose: PublicKey;
28
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });