proof-of-take-sdk 3.0.9 → 3.0.10
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/idl/proof_of_take.json +612 -20
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/instructions/claimSignupRewards.d.ts +28 -0
- package/dist/instructions/claimSignupRewards.js +49 -0
- package/dist/instructions/joinSeason.d.ts +1 -1
- package/dist/instructions/joinSeason.js +2 -2
- package/dist/types/accountTypes.d.ts +11 -0
- package/dist/types/proof_of_take.d.ts +608 -16
- package/dist/utils/constants.d.ts +5 -4
- package/dist/utils/constants.js +7 -5
- package/dist/utils/pdaManager.d.ts +11 -0
- package/dist/utils/pdaManager.js +10 -0
- package/dist/utils/pdas.d.ts +7 -0
- package/dist/utils/pdas.js +15 -0
- package/dist/utils/remainingAccounts.d.ts +2 -1
- package/dist/utils/remainingAccounts.js +11 -3
- package/dist/utils/seedRegistry.d.ts +12 -0
- package/dist/utils/seedRegistry.js +15 -0
- package/package.json +1 -1
|
@@ -6,10 +6,11 @@ export declare const PROGRAM_ID: PublicKey;
|
|
|
6
6
|
export declare const ADMIN_PUBLIC_KEY: PublicKey;
|
|
7
7
|
export declare const MIZD_TOKEN_MINT: PublicKey;
|
|
8
8
|
export declare const DEFAULT_FEE_RECIPIENT: PublicKey;
|
|
9
|
-
export declare const MIZTAKE_STATISTICS_SEED
|
|
10
|
-
export declare const USER_STATS_SEED
|
|
11
|
-
export declare const MIZTAKE_SEED
|
|
12
|
-
export declare const REFERRAL_PENALTY_CLAIM_SEED
|
|
9
|
+
export declare const MIZTAKE_STATISTICS_SEED: "miztake_statistics";
|
|
10
|
+
export declare const USER_STATS_SEED: "user_stats";
|
|
11
|
+
export declare const MIZTAKE_SEED: "miztake";
|
|
12
|
+
export declare const REFERRAL_PENALTY_CLAIM_SEED: "referral_penalty_claim";
|
|
13
|
+
export declare const SIGNUP_REWARDS_SEED: "signup_rewards";
|
|
13
14
|
export declare const DEFAULT_MIZTAKE_FEE = 100000;
|
|
14
15
|
export declare const DEFAULT_MAX_CLAIMABLE = 10000000000;
|
|
15
16
|
export declare const MIN_FEE = 10000;
|
package/dist/utils/constants.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MIN_HASH_LENGTH = exports.MAX_USERNAME_LENGTH = exports.MAX_MAX_CLAIMABLE = exports.MIN_MAX_CLAIMABLE = exports.MAX_FEE = exports.MIN_FEE = exports.DEFAULT_MAX_CLAIMABLE = exports.DEFAULT_MIZTAKE_FEE = exports.REFERRAL_PENALTY_CLAIM_SEED = exports.MIZTAKE_SEED = exports.USER_STATS_SEED = exports.MIZTAKE_STATISTICS_SEED = exports.DEFAULT_FEE_RECIPIENT = exports.MIZD_TOKEN_MINT = exports.ADMIN_PUBLIC_KEY = exports.PROGRAM_ID = void 0;
|
|
3
|
+
exports.MIN_HASH_LENGTH = exports.MAX_USERNAME_LENGTH = exports.MAX_MAX_CLAIMABLE = exports.MIN_MAX_CLAIMABLE = exports.MAX_FEE = exports.MIN_FEE = exports.DEFAULT_MAX_CLAIMABLE = exports.DEFAULT_MIZTAKE_FEE = exports.SIGNUP_REWARDS_SEED = exports.REFERRAL_PENALTY_CLAIM_SEED = exports.MIZTAKE_SEED = exports.USER_STATS_SEED = exports.MIZTAKE_STATISTICS_SEED = exports.DEFAULT_FEE_RECIPIENT = exports.MIZD_TOKEN_MINT = exports.ADMIN_PUBLIC_KEY = exports.PROGRAM_ID = void 0;
|
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
const seedRegistry_1 = require("./seedRegistry");
|
|
5
6
|
/**
|
|
6
7
|
* Proof of Miztake Program Constants
|
|
7
8
|
*/
|
|
@@ -14,10 +15,11 @@ exports.MIZD_TOKEN_MINT = new web3_js_1.PublicKey("mizdS9fDNUKWZcXBeRhJoJQHJJmsT
|
|
|
14
15
|
// Default fee recipient
|
|
15
16
|
exports.DEFAULT_FEE_RECIPIENT = new web3_js_1.PublicKey("Dkhu2VgGPfvXPVuohG2fPfryRacWMpNBJXvRGF1dhzUh");
|
|
16
17
|
// Seeds for PDAs
|
|
17
|
-
exports.MIZTAKE_STATISTICS_SEED =
|
|
18
|
-
exports.USER_STATS_SEED =
|
|
19
|
-
exports.MIZTAKE_SEED =
|
|
20
|
-
exports.REFERRAL_PENALTY_CLAIM_SEED =
|
|
18
|
+
exports.MIZTAKE_STATISTICS_SEED = seedRegistry_1.SEEDS.MIZTAKE_STATISTICS;
|
|
19
|
+
exports.USER_STATS_SEED = seedRegistry_1.SEEDS.USER_STATS;
|
|
20
|
+
exports.MIZTAKE_SEED = seedRegistry_1.SEEDS.MIZTAKE;
|
|
21
|
+
exports.REFERRAL_PENALTY_CLAIM_SEED = seedRegistry_1.SEEDS.REFERRAL_PENALTY_CLAIM;
|
|
22
|
+
exports.SIGNUP_REWARDS_SEED = seedRegistry_1.SEEDS.SIGNUP_REWARDS;
|
|
21
23
|
// Default values
|
|
22
24
|
exports.DEFAULT_MIZTAKE_FEE = 100000; // 0.0001 SOL in lamports
|
|
23
25
|
exports.DEFAULT_MAX_CLAIMABLE = 10000000000; // 1000 tokens with 7 decimals
|
|
@@ -104,4 +104,15 @@ export declare class PDAManager {
|
|
|
104
104
|
referralPenaltyClaim: PublicKey;
|
|
105
105
|
seasonDepositVault: PublicKey;
|
|
106
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* Derive PDAs for claim_signup_rewards instruction
|
|
109
|
+
*/
|
|
110
|
+
static deriveClaimSignupRewardsPdas(params: {
|
|
111
|
+
user: PublicKey;
|
|
112
|
+
seasonNumber: SeasonNumberLike;
|
|
113
|
+
tier: TierNumber;
|
|
114
|
+
}): {
|
|
115
|
+
seasonMembership: PublicKey;
|
|
116
|
+
signupRewardsPda: PublicKey;
|
|
117
|
+
};
|
|
107
118
|
}
|
package/dist/utils/pdaManager.js
CHANGED
|
@@ -92,5 +92,15 @@ class PDAManager {
|
|
|
92
92
|
seasonDepositVault: (0, pdas_1.getSeasonDepositVaultPda)(seasonNumber)[0],
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Derive PDAs for claim_signup_rewards instruction
|
|
97
|
+
*/
|
|
98
|
+
static deriveClaimSignupRewardsPdas(params) {
|
|
99
|
+
const seasonNumber = (0, conversions_1.toSeasonNumberBn)(params.seasonNumber);
|
|
100
|
+
return {
|
|
101
|
+
seasonMembership: (0, pdas_1.getSeasonMembershipPda)(seasonNumber, params.user, params.tier)[0],
|
|
102
|
+
signupRewardsPda: (0, pdas_1.getSignupRewardsPda)(seasonNumber, params.user)[0],
|
|
103
|
+
};
|
|
104
|
+
}
|
|
95
105
|
}
|
|
96
106
|
exports.PDAManager = PDAManager;
|
package/dist/utils/pdas.d.ts
CHANGED
|
@@ -76,3 +76,10 @@ export declare function getSeasonEscrowVaultPda(seasonNumber: SeasonNumberLike):
|
|
|
76
76
|
* @param windowNumber - The window number
|
|
77
77
|
*/
|
|
78
78
|
export declare function getReferralPenaltyClaimPda(seasonNumber: SeasonNumberLike, referredUser: PublicKey, tier: TierNumber, windowNumber: BN): [PublicKey, number];
|
|
79
|
+
/**
|
|
80
|
+
* Derive the SignupRewards PDA for a given (season, referrer).
|
|
81
|
+
*
|
|
82
|
+
* PDA model:
|
|
83
|
+
* seeds = ["signup_rewards", season_number_le_u64, referrer_pubkey_bytes]
|
|
84
|
+
*/
|
|
85
|
+
export declare function getSignupRewardsPda(seasonNumber: SeasonNumberLike, referrer: PublicKey): [PublicKey, number];
|
package/dist/utils/pdas.js
CHANGED
|
@@ -11,6 +11,7 @@ exports.getUserWindowParticipationPda = getUserWindowParticipationPda;
|
|
|
11
11
|
exports.getSeasonDepositVaultPda = getSeasonDepositVaultPda;
|
|
12
12
|
exports.getSeasonEscrowVaultPda = getSeasonEscrowVaultPda;
|
|
13
13
|
exports.getReferralPenaltyClaimPda = getReferralPenaltyClaimPda;
|
|
14
|
+
exports.getSignupRewardsPda = getSignupRewardsPda;
|
|
14
15
|
const web3_js_1 = require("@solana/web3.js");
|
|
15
16
|
const constants_1 = require("./constants");
|
|
16
17
|
const conversions_1 = require("./conversions");
|
|
@@ -147,3 +148,17 @@ function getReferralPenaltyClaimPda(seasonNumber, referredUser, tier, windowNumb
|
|
|
147
148
|
windowNumber.toArrayLike(Buffer, "le", 8),
|
|
148
149
|
], constants_1.PROGRAM_ID);
|
|
149
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Derive the SignupRewards PDA for a given (season, referrer).
|
|
153
|
+
*
|
|
154
|
+
* PDA model:
|
|
155
|
+
* seeds = ["signup_rewards", season_number_le_u64, referrer_pubkey_bytes]
|
|
156
|
+
*/
|
|
157
|
+
function getSignupRewardsPda(seasonNumber, referrer) {
|
|
158
|
+
const seasonBn = (0, conversions_2.toSeasonNumberBn)(seasonNumber);
|
|
159
|
+
return web3_js_1.PublicKey.findProgramAddressSync([
|
|
160
|
+
Buffer.from(constants_1.SIGNUP_REWARDS_SEED),
|
|
161
|
+
seasonBn.toArrayLike(Buffer, "le", 8),
|
|
162
|
+
referrer.toBuffer(),
|
|
163
|
+
], constants_1.PROGRAM_ID);
|
|
164
|
+
}
|
|
@@ -8,7 +8,8 @@ import type { TierNumber } from "../types";
|
|
|
8
8
|
* On-chain expects (when referrer != PublicKey.default):
|
|
9
9
|
* - remaining_accounts[0]: referrer SeasonMembership PDA (writable)
|
|
10
10
|
* - remaining_accounts[1]: referrer authority wallet (readonly)
|
|
11
|
-
* - remaining_accounts[2]:
|
|
11
|
+
* - remaining_accounts[2]: signup rewards PDA (readonly; derived per (referrer, season))
|
|
12
|
+
* - remaining_accounts[3]: signup rewards PDA MIZD ATA (writable; may be uninitialized and will be created)
|
|
12
13
|
*/
|
|
13
14
|
export declare function getJoinSeasonRemainingAccounts(params: {
|
|
14
15
|
seasonNumber: BN;
|
|
@@ -11,13 +11,16 @@ const constants_1 = require("./constants");
|
|
|
11
11
|
* On-chain expects (when referrer != PublicKey.default):
|
|
12
12
|
* - remaining_accounts[0]: referrer SeasonMembership PDA (writable)
|
|
13
13
|
* - remaining_accounts[1]: referrer authority wallet (readonly)
|
|
14
|
-
* - remaining_accounts[2]:
|
|
14
|
+
* - remaining_accounts[2]: signup rewards PDA (readonly; derived per (referrer, season))
|
|
15
|
+
* - remaining_accounts[3]: signup rewards PDA MIZD ATA (writable; may be uninitialized and will be created)
|
|
15
16
|
*/
|
|
16
17
|
function getJoinSeasonRemainingAccounts(params) {
|
|
17
18
|
if (params.referrer.equals(web3_js_1.PublicKey.default))
|
|
18
19
|
return [];
|
|
19
20
|
const [referrerSeasonMembership] = (0, pdas_1.getSeasonMembershipPda)(params.seasonNumber, params.referrer, params.tier);
|
|
20
|
-
const
|
|
21
|
+
const [signupRewardsPda] = (0, pdas_1.getSignupRewardsPda)(params.seasonNumber, params.referrer);
|
|
22
|
+
// IMPORTANT: PDA owners are off-curve; allowOwnerOffCurve must be true.
|
|
23
|
+
const signupRewardsMizdAta = (0, spl_token_1.getAssociatedTokenAddressSync)(constants_1.MIZD_TOKEN_MINT, signupRewardsPda, true);
|
|
21
24
|
return [
|
|
22
25
|
{
|
|
23
26
|
pubkey: referrerSeasonMembership,
|
|
@@ -30,7 +33,12 @@ function getJoinSeasonRemainingAccounts(params) {
|
|
|
30
33
|
isSigner: false,
|
|
31
34
|
},
|
|
32
35
|
{
|
|
33
|
-
pubkey:
|
|
36
|
+
pubkey: signupRewardsPda,
|
|
37
|
+
isWritable: false,
|
|
38
|
+
isSigner: false,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
pubkey: signupRewardsMizdAta,
|
|
34
42
|
isWritable: true,
|
|
35
43
|
isSigner: false,
|
|
36
44
|
},
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PDA seed registry (single source of truth for seed strings within the SDK).
|
|
3
|
+
*
|
|
4
|
+
* Keep these in sync with `programs/proof_of_take/src/constants.rs`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const SEEDS: {
|
|
7
|
+
readonly MIZTAKE_STATISTICS: "miztake_statistics";
|
|
8
|
+
readonly USER_STATS: "user_stats";
|
|
9
|
+
readonly MIZTAKE: "miztake";
|
|
10
|
+
readonly REFERRAL_PENALTY_CLAIM: "referral_penalty_claim";
|
|
11
|
+
readonly SIGNUP_REWARDS: "signup_rewards";
|
|
12
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SEEDS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* PDA seed registry (single source of truth for seed strings within the SDK).
|
|
6
|
+
*
|
|
7
|
+
* Keep these in sync with `programs/proof_of_take/src/constants.rs`.
|
|
8
|
+
*/
|
|
9
|
+
exports.SEEDS = {
|
|
10
|
+
MIZTAKE_STATISTICS: "miztake_statistics",
|
|
11
|
+
USER_STATS: "user_stats",
|
|
12
|
+
MIZTAKE: "miztake",
|
|
13
|
+
REFERRAL_PENALTY_CLAIM: "referral_penalty_claim",
|
|
14
|
+
SIGNUP_REWARDS: "signup_rewards",
|
|
15
|
+
};
|