proof-of-take-sdk 3.0.5 → 3.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/dist/idl/proof_of_take.json +132 -12
- package/dist/index.d.ts +8 -5
- package/dist/index.js +16 -2
- package/dist/instructions/claimReferralPenaltyForWindow.d.ts +1 -1
- package/dist/instructions/claimReferralPenaltyForWindow.js +2 -1
- package/dist/instructions/claimWindowRewards.d.ts +1 -1
- package/dist/instructions/claimWindowRewards.js +2 -1
- package/dist/instructions/closeAuxiliaryAccounts.js +19 -12
- package/dist/instructions/confirmedPostOnX.d.ts +1 -1
- package/dist/instructions/confirmedPostOnX.js +5 -1
- package/dist/instructions/createMiztake.d.ts +1 -1
- package/dist/instructions/createMiztake.js +7 -3
- package/dist/instructions/initializeEscrowVault.js +5 -4
- package/dist/instructions/initializeRewardWindow.js +5 -4
- package/dist/instructions/initializeSeasonSettings.js +6 -7
- package/dist/instructions/initializeSeasonVault.js +6 -7
- package/dist/instructions/initializeStatistics.js +5 -5
- package/dist/instructions/joinSeason.d.ts +1 -1
- package/dist/instructions/joinSeason.js +20 -5
- package/dist/instructions/toggleSeasonPause.js +6 -7
- package/dist/instructions/updateSeasonAdmin.js +6 -7
- package/dist/instructions/viewSeasonMembershipStatus.d.ts +1 -1
- package/dist/instructions/viewSeasonMembershipStatus.js +1 -1
- package/dist/instructions/withdrawSeasonDeposit.d.ts +1 -1
- package/dist/instructions/withdrawSeasonDeposit.js +2 -1
- package/dist/types/accountTypes.d.ts +3 -0
- package/dist/types/proof_of_take.d.ts +132 -12
- package/dist/types.d.ts +4 -2
- package/dist/utils/accountConverters.js +1 -0
- package/dist/utils/accountUpdates.d.ts +3 -3
- package/dist/utils/accountUpdates.js +4 -3
- package/dist/utils/instructionResultHelpers.d.ts +7 -0
- package/dist/utils/instructionResultHelpers.js +9 -0
- package/dist/utils/pdas.d.ts +4 -4
- package/dist/utils/pdas.js +8 -7
- package/dist/utils/programErrors.d.ts +13 -0
- package/dist/utils/programErrors.js +47 -0
- package/dist/utils/remainingAccounts.d.ts +17 -0
- package/dist/utils/remainingAccounts.js +38 -0
- package/dist/utils/signerHelpers.d.ts +20 -0
- package/dist/utils/signerHelpers.js +64 -5
- package/dist/utils/tierPenalty.d.ts +2 -2
- package/dist/utils/tierPenalty.js +9 -9
- package/dist/utils/tierSeeds.d.ts +8 -0
- package/dist/utils/tierSeeds.js +14 -0
- package/dist/utils/transactionBuilder.d.ts +1 -0
- package/dist/utils/transactionBuilder.js +11 -9
- package/package.json +1 -1
|
@@ -1596,6 +1596,100 @@
|
|
|
1596
1596
|
"name": "mizd_mint",
|
|
1597
1597
|
"address": "mizdS9fDNUKWZcXBeRhJoJQHJJmsTeF4fFRyPdXWv99"
|
|
1598
1598
|
},
|
|
1599
|
+
{
|
|
1600
|
+
"name": "root_admin",
|
|
1601
|
+
"address": "Lude4DE3jDXVViJ3s7bUfPXdXy8Zq7G1stMwHNQrc2s"
|
|
1602
|
+
},
|
|
1603
|
+
{
|
|
1604
|
+
"name": "root_admin_token_account",
|
|
1605
|
+
"writable": true,
|
|
1606
|
+
"pda": {
|
|
1607
|
+
"seeds": [
|
|
1608
|
+
{
|
|
1609
|
+
"kind": "account",
|
|
1610
|
+
"path": "root_admin"
|
|
1611
|
+
},
|
|
1612
|
+
{
|
|
1613
|
+
"kind": "const",
|
|
1614
|
+
"value": [
|
|
1615
|
+
6,
|
|
1616
|
+
221,
|
|
1617
|
+
246,
|
|
1618
|
+
225,
|
|
1619
|
+
215,
|
|
1620
|
+
101,
|
|
1621
|
+
161,
|
|
1622
|
+
147,
|
|
1623
|
+
217,
|
|
1624
|
+
203,
|
|
1625
|
+
225,
|
|
1626
|
+
70,
|
|
1627
|
+
206,
|
|
1628
|
+
235,
|
|
1629
|
+
121,
|
|
1630
|
+
172,
|
|
1631
|
+
28,
|
|
1632
|
+
180,
|
|
1633
|
+
133,
|
|
1634
|
+
237,
|
|
1635
|
+
95,
|
|
1636
|
+
91,
|
|
1637
|
+
55,
|
|
1638
|
+
145,
|
|
1639
|
+
58,
|
|
1640
|
+
140,
|
|
1641
|
+
245,
|
|
1642
|
+
133,
|
|
1643
|
+
126,
|
|
1644
|
+
255,
|
|
1645
|
+
0,
|
|
1646
|
+
169
|
|
1647
|
+
]
|
|
1648
|
+
},
|
|
1649
|
+
{
|
|
1650
|
+
"kind": "account",
|
|
1651
|
+
"path": "mizd_mint"
|
|
1652
|
+
}
|
|
1653
|
+
],
|
|
1654
|
+
"program": {
|
|
1655
|
+
"kind": "const",
|
|
1656
|
+
"value": [
|
|
1657
|
+
140,
|
|
1658
|
+
151,
|
|
1659
|
+
37,
|
|
1660
|
+
143,
|
|
1661
|
+
78,
|
|
1662
|
+
36,
|
|
1663
|
+
137,
|
|
1664
|
+
241,
|
|
1665
|
+
187,
|
|
1666
|
+
61,
|
|
1667
|
+
16,
|
|
1668
|
+
41,
|
|
1669
|
+
20,
|
|
1670
|
+
142,
|
|
1671
|
+
13,
|
|
1672
|
+
131,
|
|
1673
|
+
11,
|
|
1674
|
+
90,
|
|
1675
|
+
19,
|
|
1676
|
+
153,
|
|
1677
|
+
218,
|
|
1678
|
+
255,
|
|
1679
|
+
16,
|
|
1680
|
+
132,
|
|
1681
|
+
4,
|
|
1682
|
+
142,
|
|
1683
|
+
123,
|
|
1684
|
+
216,
|
|
1685
|
+
219,
|
|
1686
|
+
233,
|
|
1687
|
+
248,
|
|
1688
|
+
89
|
|
1689
|
+
]
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
},
|
|
1599
1693
|
{
|
|
1600
1694
|
"name": "user_token_account",
|
|
1601
1695
|
"writable": true
|
|
@@ -1605,6 +1699,10 @@
|
|
|
1605
1699
|
"writable": true,
|
|
1606
1700
|
"signer": true
|
|
1607
1701
|
},
|
|
1702
|
+
{
|
|
1703
|
+
"name": "associated_token_program",
|
|
1704
|
+
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
1705
|
+
},
|
|
1608
1706
|
{
|
|
1609
1707
|
"name": "token_program",
|
|
1610
1708
|
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
@@ -2831,43 +2929,58 @@
|
|
|
2831
2929
|
},
|
|
2832
2930
|
{
|
|
2833
2931
|
"code": 6035,
|
|
2932
|
+
"name": "InvalidReferrerMembership",
|
|
2933
|
+
"msg": "Invalid referrer season membership account"
|
|
2934
|
+
},
|
|
2935
|
+
{
|
|
2936
|
+
"code": 6036,
|
|
2834
2937
|
"name": "ReferralPenaltyAlreadyClaimed",
|
|
2835
2938
|
"msg": "Referral penalty already claimed for this user/window"
|
|
2836
2939
|
},
|
|
2837
2940
|
{
|
|
2838
|
-
"code":
|
|
2941
|
+
"code": 6037,
|
|
2839
2942
|
"name": "ReferralPenaltyClaimNotAvailableYet",
|
|
2840
2943
|
"msg": "Referral penalty claim not available yet (must wait until window end + claim buffer)"
|
|
2841
2944
|
},
|
|
2842
2945
|
{
|
|
2843
|
-
"code":
|
|
2946
|
+
"code": 6038,
|
|
2844
2947
|
"name": "ReferralPenaltyNotEligibleForWindow",
|
|
2845
2948
|
"msg": "Referred user was not eligible for this window"
|
|
2846
2949
|
},
|
|
2847
2950
|
{
|
|
2848
|
-
"code":
|
|
2951
|
+
"code": 6039,
|
|
2849
2952
|
"name": "ReferralPenaltyNoMissedPenalty",
|
|
2850
2953
|
"msg": "Referred user posted successfully (no penalty to claim)"
|
|
2851
2954
|
},
|
|
2852
2955
|
{
|
|
2853
|
-
"code":
|
|
2956
|
+
"code": 6040,
|
|
2854
2957
|
"name": "WindowAlreadyFinalized",
|
|
2855
2958
|
"msg": "Window is already finalized"
|
|
2856
2959
|
},
|
|
2857
2960
|
{
|
|
2858
|
-
"code":
|
|
2961
|
+
"code": 6041,
|
|
2859
2962
|
"name": "WindowNotEmpty",
|
|
2860
2963
|
"msg": "Window is not empty (has successful posters)"
|
|
2861
2964
|
},
|
|
2862
2965
|
{
|
|
2863
|
-
"code":
|
|
2966
|
+
"code": 6042,
|
|
2864
2967
|
"name": "CalculationError",
|
|
2865
2968
|
"msg": "Calculation error"
|
|
2866
2969
|
},
|
|
2867
2970
|
{
|
|
2868
|
-
"code":
|
|
2971
|
+
"code": 6043,
|
|
2869
2972
|
"name": "InsufficientFunds",
|
|
2870
2973
|
"msg": "Insufficient funds"
|
|
2974
|
+
},
|
|
2975
|
+
{
|
|
2976
|
+
"code": 6044,
|
|
2977
|
+
"name": "NoWindowRewardsToClaim",
|
|
2978
|
+
"msg": "Nothing to claim for this window (reward amount is 0)"
|
|
2979
|
+
},
|
|
2980
|
+
{
|
|
2981
|
+
"code": 6045,
|
|
2982
|
+
"name": "NoReferralPenaltyToClaim",
|
|
2983
|
+
"msg": "Nothing to claim for this window (referral penalty amount is 0)"
|
|
2871
2984
|
}
|
|
2872
2985
|
],
|
|
2873
2986
|
"types": [
|
|
@@ -3044,7 +3157,7 @@
|
|
|
3044
3157
|
{
|
|
3045
3158
|
"name": "tier",
|
|
3046
3159
|
"docs": [
|
|
3047
|
-
"Tier number used for the membership PDA (
|
|
3160
|
+
"Tier number used for the membership PDA (0..=4)"
|
|
3048
3161
|
],
|
|
3049
3162
|
"type": "u8"
|
|
3050
3163
|
},
|
|
@@ -3097,7 +3210,7 @@
|
|
|
3097
3210
|
{
|
|
3098
3211
|
"name": "tier",
|
|
3099
3212
|
"docs": [
|
|
3100
|
-
"Tier number used for the membership PDA (
|
|
3213
|
+
"Tier number used for the membership PDA (0..=4)"
|
|
3101
3214
|
],
|
|
3102
3215
|
"type": "u8"
|
|
3103
3216
|
},
|
|
@@ -3204,7 +3317,7 @@
|
|
|
3204
3317
|
{
|
|
3205
3318
|
"name": "tier",
|
|
3206
3319
|
"docs": [
|
|
3207
|
-
"Tier number used for the membership PDA (
|
|
3320
|
+
"Tier number used for the membership PDA (0..=4)"
|
|
3208
3321
|
],
|
|
3209
3322
|
"type": "u8"
|
|
3210
3323
|
},
|
|
@@ -3554,7 +3667,7 @@
|
|
|
3554
3667
|
{
|
|
3555
3668
|
"name": "tier",
|
|
3556
3669
|
"docs": [
|
|
3557
|
-
"Tier number used for the membership PDA (
|
|
3670
|
+
"Tier number used for the membership PDA (0..=4)"
|
|
3558
3671
|
],
|
|
3559
3672
|
"type": "u8"
|
|
3560
3673
|
},
|
|
@@ -3645,7 +3758,7 @@
|
|
|
3645
3758
|
{
|
|
3646
3759
|
"name": "tier",
|
|
3647
3760
|
"docs": [
|
|
3648
|
-
"Tier number used for the membership PDA (
|
|
3761
|
+
"Tier number used for the membership PDA (0..=4)"
|
|
3649
3762
|
],
|
|
3650
3763
|
"type": "u8"
|
|
3651
3764
|
},
|
|
@@ -3691,6 +3804,13 @@
|
|
|
3691
3804
|
],
|
|
3692
3805
|
"type": "pubkey"
|
|
3693
3806
|
},
|
|
3807
|
+
{
|
|
3808
|
+
"name": "referral_count",
|
|
3809
|
+
"docs": [
|
|
3810
|
+
"Total number of successful referrals for this membership (incremented when others join with this member as referrer)"
|
|
3811
|
+
],
|
|
3812
|
+
"type": "u64"
|
|
3813
|
+
},
|
|
3694
3814
|
{
|
|
3695
3815
|
"name": "season_number",
|
|
3696
3816
|
"docs": [
|
package/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { getProgram as _getProgram } from "./utils/programHelpers";
|
|
9
9
|
export { createMiztake, getMiztakePdaForParams, } from "./instructions/createMiztake";
|
|
10
|
-
export type { CreateMiztakeOptions, CreateMiztakeResult, } from "./instructions/createMiztake";
|
|
11
|
-
export { initializeStatistics } from "./instructions/initializeStatistics";
|
|
10
|
+
export type { CreateMiztakeOptions, CreateMiztakeResult, CreateMiztakePdas, CreateMiztakeUpdatedAccounts, } from "./instructions/createMiztake";
|
|
11
|
+
export { initializeStatistics, isInitialized, } from "./instructions/initializeStatistics";
|
|
12
12
|
export { initializeSeasonSettings } from "./instructions/initializeSeasonSettings";
|
|
13
13
|
export { initializeSeasonVault } from "./instructions/initializeSeasonVault";
|
|
14
14
|
export { initializeEscrowVault } from "./instructions/initializeEscrowVault";
|
|
@@ -44,6 +44,7 @@ export * from "./utils/conversions";
|
|
|
44
44
|
export * from "./utils/transactionBuilder";
|
|
45
45
|
export * from "./utils/simulationHelpers";
|
|
46
46
|
export * from "./utils/enumHelpers";
|
|
47
|
+
export * from "./utils/programErrors";
|
|
47
48
|
export { PDAManager } from "./utils/pdaManager";
|
|
48
49
|
export * from "./optimistic";
|
|
49
50
|
export * from "./constants/season";
|
|
@@ -52,12 +53,14 @@ export * from "./types/instructionResults";
|
|
|
52
53
|
export * from "./types/accountTypes";
|
|
53
54
|
export * from "./types/anchorAccounts";
|
|
54
55
|
export * from "./types/anchorViews";
|
|
55
|
-
export type { ProofOfTakeIdlAccounts, AnchorMiztake, AnchorMiztakeStatistics, AnchorUserStats, AnchorSeasonSettings, AnchorSeason, AnchorSeasonMembership, AnchorRewardWindow, AnchorUserWindowParticipation, AnchorReferralPenaltyClaim, ProofOfTakeIdlTypes, AnchorCurrentSeasonView, AnchorSeasonMembershipStatusView, AnchorWindowStatusView, TierNumber, Sha256HexString, Bytes32, WindowIndex, WindowNumberLike, SeasonNumberLike, DepositTierName, SeasonDepositTier, SeasonStateAnchor, WindowStateAnchor, SeasonStateLike, WindowStateLike, FixedLengthArray, EligibleStakePerWindow, } from "./types";
|
|
56
|
-
export
|
|
56
|
+
export type { ProofOfTakeIdlAccounts, AnchorMiztake, AnchorMiztakeStatistics, AnchorUserStats, AnchorSeasonSettings, AnchorSeason, AnchorSeasonMembership, AnchorRewardWindow, AnchorUserWindowParticipation, AnchorReferralPenaltyClaim, ProofOfTakeIdlTypes, AnchorCurrentSeasonView, AnchorSeasonMembershipStatusView, AnchorWindowStatusView, TierNumber, Sha256HexString, Bytes32, WindowIndex, WindowNumberLike, SeasonNumberLike, DepositTierName, SeasonDepositTier, SeasonStateAnchor, WindowStateAnchor, SeasonStateLike, WindowStateLike, FixedLengthArray, EligibleStakePerWindow, CreateMiztakeParams, ClaimRewardParams, DepositTokensParams, WithdrawTokensParams, UpdateConfigParams, MiztakeStatistics, UserStats, Miztake, SeasonSettings, Season, SeasonMembership, RewardWindow, UserWindowParticipation, ReferralPenaltyClaim, CurrentSeasonView, SeasonMembershipStatusView, WindowStatusView, } from "./types";
|
|
57
|
+
export { SeasonState, WindowState } from "./types";
|
|
58
|
+
export type { InstructionResult, StandardInstructionResult, StandardInstructionResultWithPdas, StandardInstructionResultWithPdasAndAccounts, InstructionResultWithPdas, InstructionResultWithAccounts, FullInstructionResult, } from "./types/instructionResults";
|
|
57
59
|
export type { ProofOfTake } from "./types/proof_of_take";
|
|
58
60
|
export { IDL, ANCHOR_IDL } from "./idl/idl";
|
|
59
61
|
export { createProgram, createProgramWithId, getProgramReadOnly, } from "./client";
|
|
60
62
|
export * from "./getters";
|
|
61
|
-
export
|
|
63
|
+
export { getUserStatsByPda } from "./getters/getUserStats";
|
|
64
|
+
export { closeMiztake, closeUserStats, closeSeasonMembership, closeRewardWindow, closeUserWindowParticipation, closeReferralPenaltyClaim, } from "./instructions/closeAuxiliaryAccounts";
|
|
62
65
|
export * from "./types/closeAccountsTypes";
|
|
63
66
|
export declare const VERSION = "1.0.0";
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ 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.ANCHOR_IDL = exports.IDL = exports.PDAManager = exports.getProgram = exports.viewCurrentSeason = exports.viewWindowStatus = exports.viewSeasonMembershipStatus = exports.updateSeasonAdmin = exports.toggleSeasonPause = exports.initializeRewardWindow = 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.closeReferralPenaltyClaim = exports.closeUserWindowParticipation = exports.closeRewardWindow = exports.closeSeasonMembership = exports.closeUserStats = exports.closeMiztake = exports.getUserStatsByPda = exports.getProgramReadOnly = exports.createProgramWithId = exports.createProgram = exports.ANCHOR_IDL = exports.IDL = exports.WindowState = exports.SeasonState = exports.PDAManager = exports.getProgram = exports.viewCurrentSeason = exports.viewWindowStatus = exports.viewSeasonMembershipStatus = exports.updateSeasonAdmin = exports.toggleSeasonPause = exports.initializeRewardWindow = exports.withdrawSeasonDeposit = exports.claimReferralPenaltyForWindow = exports.claimWindowRewards = exports.confirmedPostOnX = exports.joinSeason = exports.initializeEscrowVault = exports.initializeSeasonVault = exports.initializeSeasonSettings = exports.isInitialized = exports.initializeStatistics = exports.getMiztakePdaForParams = exports.createMiztake = void 0;
|
|
25
25
|
// NOTE:
|
|
26
26
|
// We intentionally export `getProgram` via a local const assignment (instead of `export * from ...`)
|
|
27
27
|
// so that the compiled CommonJS output uses a writable property. This makes it possible to mock
|
|
@@ -34,6 +34,7 @@ Object.defineProperty(exports, "createMiztake", { enumerable: true, get: functio
|
|
|
34
34
|
Object.defineProperty(exports, "getMiztakePdaForParams", { enumerable: true, get: function () { return createMiztake_1.getMiztakePdaForParams; } });
|
|
35
35
|
var initializeStatistics_1 = require("./instructions/initializeStatistics");
|
|
36
36
|
Object.defineProperty(exports, "initializeStatistics", { enumerable: true, get: function () { return initializeStatistics_1.initializeStatistics; } });
|
|
37
|
+
Object.defineProperty(exports, "isInitialized", { enumerable: true, get: function () { return initializeStatistics_1.isInitialized; } });
|
|
37
38
|
// Season initialization instructions
|
|
38
39
|
var initializeSeasonSettings_1 = require("./instructions/initializeSeasonSettings");
|
|
39
40
|
Object.defineProperty(exports, "initializeSeasonSettings", { enumerable: true, get: function () { return initializeSeasonSettings_1.initializeSeasonSettings; } });
|
|
@@ -82,6 +83,7 @@ __exportStar(require("./utils/conversions"), exports);
|
|
|
82
83
|
__exportStar(require("./utils/transactionBuilder"), exports);
|
|
83
84
|
__exportStar(require("./utils/simulationHelpers"), exports);
|
|
84
85
|
__exportStar(require("./utils/enumHelpers"), exports);
|
|
86
|
+
__exportStar(require("./utils/programErrors"), exports);
|
|
85
87
|
var pdaManager_1 = require("./utils/pdaManager");
|
|
86
88
|
Object.defineProperty(exports, "PDAManager", { enumerable: true, get: function () { return pdaManager_1.PDAManager; } });
|
|
87
89
|
// Export optimistic updates
|
|
@@ -94,6 +96,10 @@ __exportStar(require("./types/instructionResults"), exports);
|
|
|
94
96
|
__exportStar(require("./types/accountTypes"), exports);
|
|
95
97
|
__exportStar(require("./types/anchorAccounts"), exports);
|
|
96
98
|
__exportStar(require("./types/anchorViews"), exports);
|
|
99
|
+
// Export enums (cannot use type-only export for enums)
|
|
100
|
+
var types_1 = require("./types");
|
|
101
|
+
Object.defineProperty(exports, "SeasonState", { enumerable: true, get: function () { return types_1.SeasonState; } });
|
|
102
|
+
Object.defineProperty(exports, "WindowState", { enumerable: true, get: function () { return types_1.WindowState; } });
|
|
97
103
|
var idl_1 = require("./idl/idl");
|
|
98
104
|
Object.defineProperty(exports, "IDL", { enumerable: true, get: function () { return idl_1.IDL; } });
|
|
99
105
|
Object.defineProperty(exports, "ANCHOR_IDL", { enumerable: true, get: function () { return idl_1.ANCHOR_IDL; } });
|
|
@@ -104,8 +110,16 @@ Object.defineProperty(exports, "createProgramWithId", { enumerable: true, get: f
|
|
|
104
110
|
Object.defineProperty(exports, "getProgramReadOnly", { enumerable: true, get: function () { return client_1.getProgramReadOnly; } });
|
|
105
111
|
// Export getters
|
|
106
112
|
__exportStar(require("./getters"), exports);
|
|
113
|
+
var getUserStats_1 = require("./getters/getUserStats");
|
|
114
|
+
Object.defineProperty(exports, "getUserStatsByPda", { enumerable: true, get: function () { return getUserStats_1.getUserStatsByPda; } });
|
|
107
115
|
// Export close instructions
|
|
108
|
-
|
|
116
|
+
var closeAuxiliaryAccounts_1 = require("./instructions/closeAuxiliaryAccounts");
|
|
117
|
+
Object.defineProperty(exports, "closeMiztake", { enumerable: true, get: function () { return closeAuxiliaryAccounts_1.closeMiztake; } });
|
|
118
|
+
Object.defineProperty(exports, "closeUserStats", { enumerable: true, get: function () { return closeAuxiliaryAccounts_1.closeUserStats; } });
|
|
119
|
+
Object.defineProperty(exports, "closeSeasonMembership", { enumerable: true, get: function () { return closeAuxiliaryAccounts_1.closeSeasonMembership; } });
|
|
120
|
+
Object.defineProperty(exports, "closeRewardWindow", { enumerable: true, get: function () { return closeAuxiliaryAccounts_1.closeRewardWindow; } });
|
|
121
|
+
Object.defineProperty(exports, "closeUserWindowParticipation", { enumerable: true, get: function () { return closeAuxiliaryAccounts_1.closeUserWindowParticipation; } });
|
|
122
|
+
Object.defineProperty(exports, "closeReferralPenaltyClaim", { enumerable: true, get: function () { return closeAuxiliaryAccounts_1.closeReferralPenaltyClaim; } });
|
|
109
123
|
__exportStar(require("./types/closeAccountsTypes"), exports);
|
|
110
124
|
// Version
|
|
111
125
|
exports.VERSION = "1.0.0";
|
|
@@ -11,7 +11,7 @@ export interface ClaimReferralPenaltyForWindowOptions {
|
|
|
11
11
|
referredUser: PublicKey;
|
|
12
12
|
seasonNumber: BN;
|
|
13
13
|
windowNumber: WindowNumberLike;
|
|
14
|
-
/** Tier number:
|
|
14
|
+
/** Tier number: 0=copper, 1=silver, 2=gold, 3=platinum, 4=mithril */
|
|
15
15
|
tier: TierNumber;
|
|
16
16
|
feePayer?: PublicKey;
|
|
17
17
|
/**
|
|
@@ -39,7 +39,8 @@ async function claimReferralPenaltyForWindow(options) {
|
|
|
39
39
|
options.seasonNumber, windowNumber, options.referredUser, options.tier)
|
|
40
40
|
.accounts(accounts)
|
|
41
41
|
.instruction();
|
|
42
|
-
const
|
|
42
|
+
const feePayer = (0, signerHelpers_1.getDefaultFeePayer)(options.feePayer);
|
|
43
|
+
const signers = (0, signerHelpers_1.buildSigners)([(0, signerHelpers_1.asClaimantSigner)(options.claimant)], feePayer);
|
|
43
44
|
// OPTIMISTIC UPDATES
|
|
44
45
|
let updatedAccounts = undefined;
|
|
45
46
|
const curr = options.currentAccounts;
|
|
@@ -28,7 +28,7 @@ export interface ClaimWindowRewardsOptions {
|
|
|
28
28
|
referrerTokenAccount?: PublicKey;
|
|
29
29
|
seasonNumber: BN;
|
|
30
30
|
windowNumber: WindowNumberLike;
|
|
31
|
-
/** Tier number:
|
|
31
|
+
/** Tier number: 0=copper, 1=silver, 2=gold, 3=platinum, 4=mithril */
|
|
32
32
|
tier: TierNumber;
|
|
33
33
|
feePayer?: PublicKey;
|
|
34
34
|
currentAccounts?: {
|
|
@@ -49,7 +49,8 @@ async function claimWindowRewards(options) {
|
|
|
49
49
|
.claimWindowRewards(options.seasonNumber, windowNumber, options.tier)
|
|
50
50
|
.accounts(accounts)
|
|
51
51
|
.instruction();
|
|
52
|
-
const
|
|
52
|
+
const feePayer = (0, signerHelpers_1.getDefaultFeePayer)(options.feePayer);
|
|
53
|
+
const signers = (0, signerHelpers_1.buildSigners)([(0, signerHelpers_1.asUserSigner)(options.user)], feePayer);
|
|
53
54
|
// OPTIMISTIC UPDATES
|
|
54
55
|
const curr = options.currentAccounts || {};
|
|
55
56
|
let updatedAccounts = undefined;
|
|
@@ -8,6 +8,7 @@ exports.closeUserWindowParticipation = closeUserWindowParticipation;
|
|
|
8
8
|
exports.closeReferralPenaltyClaim = closeReferralPenaltyClaim;
|
|
9
9
|
const programHelpers_1 = require("../utils/programHelpers");
|
|
10
10
|
const signerHelpers_1 = require("../utils/signerHelpers");
|
|
11
|
+
const instructionResultHelpers_1 = require("../utils/instructionResultHelpers");
|
|
11
12
|
/**
|
|
12
13
|
* Close a Miztake account
|
|
13
14
|
*/
|
|
@@ -21,8 +22,9 @@ async function closeMiztake(options) {
|
|
|
21
22
|
.closeMiztake()
|
|
22
23
|
.accounts(accounts)
|
|
23
24
|
.instruction();
|
|
24
|
-
const
|
|
25
|
-
|
|
25
|
+
const feePayer = (0, signerHelpers_1.resolveFeePayer)({ feePayer: options.feePayer, admin: options.admin });
|
|
26
|
+
const signers = (0, signerHelpers_1.buildSigners)([(0, signerHelpers_1.asAdminSigner)(options.admin)], feePayer);
|
|
27
|
+
return (0, instructionResultHelpers_1.singleInstruction)(instruction, { signers });
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
30
|
* Close a UserStats account
|
|
@@ -37,8 +39,9 @@ async function closeUserStats(options) {
|
|
|
37
39
|
.closeUserStats()
|
|
38
40
|
.accounts(accounts)
|
|
39
41
|
.instruction();
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
+
const feePayer = (0, signerHelpers_1.resolveFeePayer)({ feePayer: options.feePayer, admin: options.admin });
|
|
43
|
+
const signers = (0, signerHelpers_1.buildSigners)([(0, signerHelpers_1.asAdminSigner)(options.admin)], feePayer);
|
|
44
|
+
return (0, instructionResultHelpers_1.singleInstruction)(instruction, { signers });
|
|
42
45
|
}
|
|
43
46
|
/**
|
|
44
47
|
* Close a SeasonMembership account
|
|
@@ -53,8 +56,9 @@ async function closeSeasonMembership(options) {
|
|
|
53
56
|
.closeSeasonMembership()
|
|
54
57
|
.accounts(accounts)
|
|
55
58
|
.instruction();
|
|
56
|
-
const
|
|
57
|
-
|
|
59
|
+
const feePayer = (0, signerHelpers_1.resolveFeePayer)({ feePayer: options.feePayer, admin: options.admin });
|
|
60
|
+
const signers = (0, signerHelpers_1.buildSigners)([(0, signerHelpers_1.asAdminSigner)(options.admin)], feePayer);
|
|
61
|
+
return (0, instructionResultHelpers_1.singleInstruction)(instruction, { signers });
|
|
58
62
|
}
|
|
59
63
|
/**
|
|
60
64
|
* Close a RewardWindow account
|
|
@@ -69,8 +73,9 @@ async function closeRewardWindow(options) {
|
|
|
69
73
|
.closeRewardWindow()
|
|
70
74
|
.accounts(accounts)
|
|
71
75
|
.instruction();
|
|
72
|
-
const
|
|
73
|
-
|
|
76
|
+
const feePayer = (0, signerHelpers_1.resolveFeePayer)({ feePayer: options.feePayer, admin: options.admin });
|
|
77
|
+
const signers = (0, signerHelpers_1.buildSigners)([(0, signerHelpers_1.asAdminSigner)(options.admin)], feePayer);
|
|
78
|
+
return (0, instructionResultHelpers_1.singleInstruction)(instruction, { signers });
|
|
74
79
|
}
|
|
75
80
|
/**
|
|
76
81
|
* Close a UserWindowParticipation account
|
|
@@ -85,8 +90,9 @@ async function closeUserWindowParticipation(options) {
|
|
|
85
90
|
.closeUserWindowParticipation()
|
|
86
91
|
.accounts(accounts)
|
|
87
92
|
.instruction();
|
|
88
|
-
const
|
|
89
|
-
|
|
93
|
+
const feePayer = (0, signerHelpers_1.resolveFeePayer)({ feePayer: options.feePayer, admin: options.admin });
|
|
94
|
+
const signers = (0, signerHelpers_1.buildSigners)([(0, signerHelpers_1.asAdminSigner)(options.admin)], feePayer);
|
|
95
|
+
return (0, instructionResultHelpers_1.singleInstruction)(instruction, { signers });
|
|
90
96
|
}
|
|
91
97
|
/**
|
|
92
98
|
* Close a ReferralPenaltyClaim account
|
|
@@ -101,6 +107,7 @@ async function closeReferralPenaltyClaim(options) {
|
|
|
101
107
|
.closeReferralPenaltyClaim()
|
|
102
108
|
.accounts(accounts)
|
|
103
109
|
.instruction();
|
|
104
|
-
const
|
|
105
|
-
|
|
110
|
+
const feePayer = (0, signerHelpers_1.resolveFeePayer)({ feePayer: options.feePayer, admin: options.admin });
|
|
111
|
+
const signers = (0, signerHelpers_1.buildSigners)([(0, signerHelpers_1.asAdminSigner)(options.admin)], feePayer);
|
|
112
|
+
return (0, instructionResultHelpers_1.singleInstruction)(instruction, { signers });
|
|
106
113
|
}
|
|
@@ -18,7 +18,7 @@ export interface ConfirmedPostOnXOptions {
|
|
|
18
18
|
adminKey: PublicKey;
|
|
19
19
|
user: PublicKey;
|
|
20
20
|
seasonNumber: BN;
|
|
21
|
-
/** Tier number:
|
|
21
|
+
/** Tier number: 0=copper, 1=silver, 2=gold, 3=platinum, 4=mithril */
|
|
22
22
|
tier: TierNumber;
|
|
23
23
|
windowNumber: WindowNumberLike;
|
|
24
24
|
/** SHA-256 hex string (64 chars). On-chain expects the raw 32-byte digest. */
|
|
@@ -42,7 +42,11 @@ async function confirmedPostOnX(options) {
|
|
|
42
42
|
.confirmedPostOnX(options.user, options.tier, windowNumber, Array.from((0, conversions_1.sha256HexToBytes32)(options.miztakeShaHash)))
|
|
43
43
|
.accounts(accounts)
|
|
44
44
|
.instruction();
|
|
45
|
-
const
|
|
45
|
+
const feePayer = (0, signerHelpers_1.resolveFeePayer)({
|
|
46
|
+
feePayer: options.feePayer,
|
|
47
|
+
admin: options.adminKey,
|
|
48
|
+
});
|
|
49
|
+
const signers = (0, signerHelpers_1.buildSigners)([(0, signerHelpers_1.asAdminSigner)(options.adminKey)], feePayer);
|
|
46
50
|
// OPTIMISTIC UPDATES
|
|
47
51
|
let updatedAccounts = undefined;
|
|
48
52
|
if (options.isOnTime !== undefined &&
|
|
@@ -12,7 +12,7 @@ export interface CreateMiztakeOptions {
|
|
|
12
12
|
admin: PublicKey;
|
|
13
13
|
seasonNumber: BN;
|
|
14
14
|
windowNumber: WindowNumberLike;
|
|
15
|
-
/** Tier number:
|
|
15
|
+
/** Tier number: 0=copper, 1=silver, 2=gold, 3=platinum, 4=mithril */
|
|
16
16
|
tier: TierNumber;
|
|
17
17
|
/** Optional injected timestamp (seconds) for optimistic state calculation */
|
|
18
18
|
now?: BN;
|
|
@@ -77,10 +77,14 @@ async function createMiztake(options) {
|
|
|
77
77
|
.accounts(accounts)
|
|
78
78
|
.instruction();
|
|
79
79
|
// Build signers
|
|
80
|
+
const feePayer = (0, signerHelpers_1.resolveFeePayer)({
|
|
81
|
+
feePayer: options.feePayer,
|
|
82
|
+
admin: options.admin,
|
|
83
|
+
});
|
|
80
84
|
const signers = (0, signerHelpers_1.buildSigners)([
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
],
|
|
85
|
+
(0, signerHelpers_1.asUserSigner)(options.user),
|
|
86
|
+
(0, signerHelpers_1.asAdminSigner)(options.admin),
|
|
87
|
+
], feePayer);
|
|
84
88
|
// OPTIMISTIC UPDATES
|
|
85
89
|
const now = (0, optimistic_1.getCurrentTimestamp)(options.now);
|
|
86
90
|
const curr = options.currentAccounts || {};
|
|
@@ -7,6 +7,7 @@ const pdas_1 = require("../utils/pdas");
|
|
|
7
7
|
const constants_1 = require("../utils/constants");
|
|
8
8
|
const programHelpers_1 = require("../utils/programHelpers");
|
|
9
9
|
const signerHelpers_1 = require("../utils/signerHelpers");
|
|
10
|
+
const instructionResultHelpers_1 = require("../utils/instructionResultHelpers");
|
|
10
11
|
/**
|
|
11
12
|
* Initialize season escrow vault
|
|
12
13
|
*
|
|
@@ -27,10 +28,10 @@ async function initializeEscrowVault(connection, admin, seasonNumber, feePayer)
|
|
|
27
28
|
.initializeEscrowVault(seasonNumber)
|
|
28
29
|
.accounts(accounts)
|
|
29
30
|
.instruction();
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const actualFeePayer = (0, signerHelpers_1.resolveFeePayer)({ feePayer, admin });
|
|
32
|
+
const signers = (0, signerHelpers_1.buildSigners)([(0, signerHelpers_1.asAdminSigner)(admin)], actualFeePayer);
|
|
33
|
+
return (0, instructionResultHelpers_1.singleInstruction)(instruction, {
|
|
33
34
|
signers,
|
|
34
35
|
pdas: { vault: vaultPda },
|
|
35
|
-
};
|
|
36
|
+
});
|
|
36
37
|
}
|
|
@@ -5,6 +5,7 @@ const web3_js_1 = require("@solana/web3.js");
|
|
|
5
5
|
const pdas_1 = require("../utils/pdas");
|
|
6
6
|
const programHelpers_1 = require("../utils/programHelpers");
|
|
7
7
|
const signerHelpers_1 = require("../utils/signerHelpers");
|
|
8
|
+
const instructionResultHelpers_1 = require("../utils/instructionResultHelpers");
|
|
8
9
|
const conversions_1 = require("../utils/conversions");
|
|
9
10
|
/**
|
|
10
11
|
* Initialize (materialize) a missing RewardWindow PDA (root-admin only).
|
|
@@ -30,10 +31,10 @@ async function initializeRewardWindow(options) {
|
|
|
30
31
|
.initializeRewardWindow(seasonNumberBn, windowNumberBn)
|
|
31
32
|
.accounts(accounts)
|
|
32
33
|
.instruction();
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const feePayer = (0, signerHelpers_1.resolveFeePayer)({ feePayer: options.feePayer, admin: options.admin });
|
|
35
|
+
const signers = (0, signerHelpers_1.buildSigners)([(0, signerHelpers_1.asAdminSigner)(options.admin)], feePayer);
|
|
36
|
+
return (0, instructionResultHelpers_1.singleInstruction)(instruction, {
|
|
36
37
|
signers,
|
|
37
38
|
pdas: { seasonSettings, season, rewardWindow },
|
|
38
|
-
};
|
|
39
|
+
});
|
|
39
40
|
}
|
|
@@ -5,6 +5,7 @@ const web3_js_1 = require("@solana/web3.js");
|
|
|
5
5
|
const pdas_1 = require("../utils/pdas");
|
|
6
6
|
const programHelpers_1 = require("../utils/programHelpers");
|
|
7
7
|
const signerHelpers_1 = require("../utils/signerHelpers");
|
|
8
|
+
const instructionResultHelpers_1 = require("../utils/instructionResultHelpers");
|
|
8
9
|
/**
|
|
9
10
|
* Initialize season settings
|
|
10
11
|
*
|
|
@@ -28,12 +29,10 @@ async function initializeSeasonSettings(connection, admin, feePayer) {
|
|
|
28
29
|
.initializeSeasonSettings()
|
|
29
30
|
.accounts(accounts)
|
|
30
31
|
.instruction();
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const actualFeePayer = (0, signerHelpers_1.resolveFeePayer)({ feePayer, admin });
|
|
33
|
+
const signers = (0, signerHelpers_1.buildSigners)([(0, signerHelpers_1.asAdminSigner)(admin)], actualFeePayer);
|
|
34
|
+
return (0, instructionResultHelpers_1.singleInstruction)(instruction, {
|
|
34
35
|
signers,
|
|
35
|
-
pdas: {
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
};
|
|
36
|
+
pdas: { seasonSettings: seasonSettingsPda },
|
|
37
|
+
});
|
|
39
38
|
}
|
|
@@ -7,6 +7,7 @@ const pdas_1 = require("../utils/pdas");
|
|
|
7
7
|
const constants_1 = require("../utils/constants");
|
|
8
8
|
const programHelpers_1 = require("../utils/programHelpers");
|
|
9
9
|
const signerHelpers_1 = require("../utils/signerHelpers");
|
|
10
|
+
const instructionResultHelpers_1 = require("../utils/instructionResultHelpers");
|
|
10
11
|
/**
|
|
11
12
|
* Initialize season deposit vault
|
|
12
13
|
*
|
|
@@ -32,12 +33,10 @@ async function initializeSeasonVault(connection, admin, seasonNumber, feePayer)
|
|
|
32
33
|
.initializeSeasonVault(seasonNumber)
|
|
33
34
|
.accounts(accounts)
|
|
34
35
|
.instruction();
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const actualFeePayer = (0, signerHelpers_1.resolveFeePayer)({ feePayer, admin });
|
|
37
|
+
const signers = (0, signerHelpers_1.buildSigners)([(0, signerHelpers_1.asAdminSigner)(admin)], actualFeePayer);
|
|
38
|
+
return (0, instructionResultHelpers_1.singleInstruction)(instruction, {
|
|
38
39
|
signers,
|
|
39
|
-
pdas: {
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
};
|
|
40
|
+
pdas: { vault: vaultPda },
|
|
41
|
+
});
|
|
43
42
|
}
|
|
@@ -8,6 +8,7 @@ const pdas_1 = require("../utils/pdas");
|
|
|
8
8
|
const idl_1 = require("../idl/idl");
|
|
9
9
|
const anchorHelpers_1 = require("../utils/anchorHelpers");
|
|
10
10
|
const signerHelpers_1 = require("../utils/signerHelpers");
|
|
11
|
+
const instructionResultHelpers_1 = require("../utils/instructionResultHelpers");
|
|
11
12
|
/**
|
|
12
13
|
* Initialize the global statistics PDA
|
|
13
14
|
*
|
|
@@ -46,17 +47,16 @@ async function initializeStatistics(connection, admin, payer) {
|
|
|
46
47
|
.accounts(accounts)
|
|
47
48
|
.instruction();
|
|
48
49
|
// Build signers list (admin always; payer if distinct)
|
|
49
|
-
const required = [
|
|
50
|
+
const required = [(0, signerHelpers_1.asAdminSigner)(admin)];
|
|
50
51
|
if (!actualPayer.equals(admin)) {
|
|
51
|
-
required.push(
|
|
52
|
+
required.push((0, signerHelpers_1.asPayerSigner)(actualPayer));
|
|
52
53
|
}
|
|
53
54
|
const signers = (0, signerHelpers_1.buildSigners)(required);
|
|
54
|
-
return {
|
|
55
|
-
instructions: [instruction],
|
|
55
|
+
return (0, instructionResultHelpers_1.singleInstruction)(instruction, {
|
|
56
56
|
signers,
|
|
57
57
|
pdas: { miztakeStatistics: miztakeStatisticsPda },
|
|
58
58
|
miztakeStatisticsPda, // Back-compat alias
|
|
59
|
-
};
|
|
59
|
+
});
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Check if statistics are already initialized
|
|
@@ -10,7 +10,7 @@ export interface JoinSeasonOptions {
|
|
|
10
10
|
user: PublicKey;
|
|
11
11
|
userTokenAccount: PublicKey;
|
|
12
12
|
seasonNumber: BN;
|
|
13
|
-
/** Tier number:
|
|
13
|
+
/** Tier number: 0=copper, 1=silver, 2=gold, 3=platinum, 4=mithril */
|
|
14
14
|
tier: TierNumber;
|
|
15
15
|
/** Optional referrer (PublicKey.default means no referrer) */
|
|
16
16
|
referrer?: PublicKey;
|