@star-factory/sdk-launchpad 0.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/README.md +343 -0
- package/dist/claims/accounts.d.ts +49 -0
- package/dist/claims/accounts.d.ts.map +1 -0
- package/dist/claims/accounts.js +118 -0
- package/dist/claims/accounts.js.map +1 -0
- package/dist/claims/eligibility.d.ts +67 -0
- package/dist/claims/eligibility.d.ts.map +1 -0
- package/dist/claims/eligibility.js +275 -0
- package/dist/claims/eligibility.js.map +1 -0
- package/dist/claims/index.d.ts +5 -0
- package/dist/claims/index.d.ts.map +1 -0
- package/dist/claims/index.js +41 -0
- package/dist/claims/index.js.map +1 -0
- package/dist/claims/pdas.d.ts +24 -0
- package/dist/claims/pdas.d.ts.map +1 -0
- package/dist/claims/pdas.js +43 -0
- package/dist/claims/pdas.js.map +1 -0
- package/dist/claims/tx.d.ts +47 -0
- package/dist/claims/tx.d.ts.map +1 -0
- package/dist/claims/tx.js +126 -0
- package/dist/claims/tx.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/instructions/cancel-launch.d.ts +16 -0
- package/dist/instructions/cancel-launch.d.ts.map +1 -0
- package/dist/instructions/cancel-launch.js +72 -0
- package/dist/instructions/cancel-launch.js.map +1 -0
- package/dist/instructions/configure-launch.d.ts +16 -0
- package/dist/instructions/configure-launch.d.ts.map +1 -0
- package/dist/instructions/configure-launch.js +50 -0
- package/dist/instructions/configure-launch.js.map +1 -0
- package/dist/instructions/constants.d.ts +8 -0
- package/dist/instructions/constants.d.ts.map +1 -0
- package/dist/instructions/constants.js +14 -0
- package/dist/instructions/constants.js.map +1 -0
- package/dist/instructions/create-launch-token.d.ts +18 -0
- package/dist/instructions/create-launch-token.d.ts.map +1 -0
- package/dist/instructions/create-launch-token.js +65 -0
- package/dist/instructions/create-launch-token.js.map +1 -0
- package/dist/instructions/execute-launch.d.ts +68 -0
- package/dist/instructions/execute-launch.d.ts.map +1 -0
- package/dist/instructions/execute-launch.js +190 -0
- package/dist/instructions/execute-launch.js.map +1 -0
- package/dist/instructions/index.d.ts +8 -0
- package/dist/instructions/index.d.ts.map +1 -0
- package/dist/instructions/index.js +57 -0
- package/dist/instructions/index.js.map +1 -0
- package/dist/instructions/initialize-launch.d.ts +15 -0
- package/dist/instructions/initialize-launch.d.ts.map +1 -0
- package/dist/instructions/initialize-launch.js +71 -0
- package/dist/instructions/initialize-launch.js.map +1 -0
- package/dist/instructions/pdas.d.ts +95 -0
- package/dist/instructions/pdas.d.ts.map +1 -0
- package/dist/instructions/pdas.js +168 -0
- package/dist/instructions/pdas.js.map +1 -0
- package/dist/pdas.d.ts +19 -0
- package/dist/pdas.d.ts.map +1 -0
- package/dist/pdas.js +40 -0
- package/dist/pdas.js.map +1 -0
- package/dist/sdk.d.ts +274 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/sdk.js +505 -0
- package/dist/sdk.js.map +1 -0
- package/dist/types.d.ts +578 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/zc/client.d.ts +69 -0
- package/dist/zc/client.d.ts.map +1 -0
- package/dist/zc/client.js +121 -0
- package/dist/zc/client.js.map +1 -0
- package/dist/zc/constants.d.ts +49 -0
- package/dist/zc/constants.d.ts.map +1 -0
- package/dist/zc/constants.js +64 -0
- package/dist/zc/constants.js.map +1 -0
- package/dist/zc/index.d.ts +4 -0
- package/dist/zc/index.d.ts.map +1 -0
- package/dist/zc/index.js +7 -0
- package/dist/zc/index.js.map +1 -0
- package/dist/zc/types.d.ts +65 -0
- package/dist/zc/types.d.ts.map +1 -0
- package/dist/zc/types.js +3 -0
- package/dist/zc/types.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TIER_VESTING_WEEKS = exports.TIER_VESTING_SECONDS = exports.MAX_TIER = exports.NUM_TIERS = void 0;
|
|
4
|
+
exports.computeUserTokens = computeUserTokens;
|
|
5
|
+
exports.computeVestedAmount = computeVestedAmount;
|
|
6
|
+
exports.computeAllocatedAmount = computeAllocatedAmount;
|
|
7
|
+
exports.computeClaimEligibility = computeClaimEligibility;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const bn_js_1 = tslib_1.__importDefault(require("bn.js"));
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Vesting Constants (mirrors programs/launchpad/src/constants.rs)
|
|
12
|
+
// ============================================================================
|
|
13
|
+
/** Number of vesting tiers (0–6 inclusive). */
|
|
14
|
+
exports.NUM_TIERS = 7;
|
|
15
|
+
/** Maximum valid tier index. */
|
|
16
|
+
exports.MAX_TIER = 6;
|
|
17
|
+
/**
|
|
18
|
+
* Tier vesting durations in seconds.
|
|
19
|
+
*
|
|
20
|
+
* - Tier 0: immediate at activation
|
|
21
|
+
* - Tier 1: 2 weeks = 1,209,600s
|
|
22
|
+
* - Tier 2: 4 weeks = 2,419,200s
|
|
23
|
+
* - Tier 3: 6 weeks = 3,628,800s
|
|
24
|
+
* - Tier 4: 8 weeks = 4,838,400s
|
|
25
|
+
* - Tier 5: 10 weeks = 6,048,000s
|
|
26
|
+
* - Tier 6: 12 weeks = 7,257,600s
|
|
27
|
+
*/
|
|
28
|
+
exports.TIER_VESTING_SECONDS = [
|
|
29
|
+
0,
|
|
30
|
+
2 * 7 * 24 * 60 * 60,
|
|
31
|
+
4 * 7 * 24 * 60 * 60,
|
|
32
|
+
6 * 7 * 24 * 60 * 60,
|
|
33
|
+
8 * 7 * 24 * 60 * 60,
|
|
34
|
+
10 * 7 * 24 * 60 * 60,
|
|
35
|
+
12 * 7 * 24 * 60 * 60,
|
|
36
|
+
];
|
|
37
|
+
/** Tier vesting durations in weeks (for display). */
|
|
38
|
+
exports.TIER_VESTING_WEEKS = [0, 2, 4, 6, 8, 10, 12];
|
|
39
|
+
// ============================================================================
|
|
40
|
+
// Pure Math (mirrors programs/launchpad/src/math/mod.rs)
|
|
41
|
+
// ============================================================================
|
|
42
|
+
/**
|
|
43
|
+
* Compute the user's total token entitlement from their vault allocation.
|
|
44
|
+
*
|
|
45
|
+
* Formula: `tokens_to_participants × user_allocated / total_allocated`
|
|
46
|
+
*
|
|
47
|
+
* Uses BN for precision. Returns `null` if `total_allocated == 0`.
|
|
48
|
+
*/
|
|
49
|
+
function computeUserTokens(tokensToParticipants, userAllocated, totalAllocated) {
|
|
50
|
+
if (totalAllocated.isZero()) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
return tokensToParticipants.mul(userAllocated).div(totalAllocated);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Compute the total vested amount at a given time.
|
|
57
|
+
*
|
|
58
|
+
* - Tier 0: 100% immediately at pool activation time
|
|
59
|
+
* - Tier 1–6: Linear vesting from pool_activation_time over tier duration
|
|
60
|
+
*
|
|
61
|
+
* Returns the total vested (caller subtracts `already_claimed`).
|
|
62
|
+
*/
|
|
63
|
+
function computeVestedAmount(totalTokens, tier, poolActivationTime, currentTime) {
|
|
64
|
+
// Tier 0: immediate full unlock
|
|
65
|
+
if (tier === 0) {
|
|
66
|
+
return new bn_js_1.default(totalTokens.toString());
|
|
67
|
+
}
|
|
68
|
+
if (tier < 0 || tier >= exports.NUM_TIERS) {
|
|
69
|
+
return new bn_js_1.default(0);
|
|
70
|
+
}
|
|
71
|
+
const vestingDuration = exports.TIER_VESTING_SECONDS[tier];
|
|
72
|
+
const elapsed = currentTime - poolActivationTime;
|
|
73
|
+
if (elapsed <= 0) {
|
|
74
|
+
return new bn_js_1.default(0);
|
|
75
|
+
}
|
|
76
|
+
// Fully vested
|
|
77
|
+
if (elapsed >= vestingDuration) {
|
|
78
|
+
return new bn_js_1.default(totalTokens.toString());
|
|
79
|
+
}
|
|
80
|
+
// Linear vesting: total_tokens * elapsed / duration
|
|
81
|
+
return totalTokens.muln(elapsed).divn(vestingDuration);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Compute the user's allocated amount from their depositor record and vault data.
|
|
85
|
+
*
|
|
86
|
+
* Mirrors `DepositorRecord::allocated_amount(&self, vault)` on-chain:
|
|
87
|
+
* - If allocations not yet calculated → return raw `amount`
|
|
88
|
+
* - If tier_totals_at_allocation[tier] == 0 → return 0
|
|
89
|
+
* - Otherwise → `amount × tier_allocated[tier] / tier_totals_at_allocation[tier]`
|
|
90
|
+
*
|
|
91
|
+
* IMPORTANT: This uses vault tier-level allocation data for accuracy.
|
|
92
|
+
* The `finalAmount` field on `DepositorRecord` only reflects the correct
|
|
93
|
+
* allocation AFTER the user claims their excess refund. Before that,
|
|
94
|
+
* `finalAmount == amount` (the full deposit), which over-estimates
|
|
95
|
+
* allocation in oversubscribed tiers.
|
|
96
|
+
*/
|
|
97
|
+
function computeAllocatedAmount(depositor, vaultData) {
|
|
98
|
+
if (!vaultData.allocationsCalculated) {
|
|
99
|
+
return depositor.amount;
|
|
100
|
+
}
|
|
101
|
+
const tierIdx = depositor.tier;
|
|
102
|
+
if (tierIdx < 0 || tierIdx >= exports.NUM_TIERS) {
|
|
103
|
+
return new bn_js_1.default(0);
|
|
104
|
+
}
|
|
105
|
+
const tierTotal = vaultData.tierTotalsAtAllocation[tierIdx];
|
|
106
|
+
const tierAllocated = vaultData.tierAllocated[tierIdx];
|
|
107
|
+
if (!tierTotal || tierTotal.isZero()) {
|
|
108
|
+
return new bn_js_1.default(0);
|
|
109
|
+
}
|
|
110
|
+
// user_allocated = amount × tier_allocated / tier_total
|
|
111
|
+
return depositor.amount.mul(tierAllocated).div(tierTotal);
|
|
112
|
+
}
|
|
113
|
+
// ============================================================================
|
|
114
|
+
// Eligibility Check
|
|
115
|
+
// ============================================================================
|
|
116
|
+
/**
|
|
117
|
+
* Compute full claim eligibility for a user.
|
|
118
|
+
*
|
|
119
|
+
* This is a **pure function** — no RPC calls. It takes pre-fetched account
|
|
120
|
+
* data and returns a comprehensive eligibility result. Works identically
|
|
121
|
+
* on client and server.
|
|
122
|
+
*
|
|
123
|
+
* @param launchConfigData - Decoded LaunchConfig account
|
|
124
|
+
* @param depositorRecord - Decoded DepositorRecord (from vault program), or `null` if not found
|
|
125
|
+
* @param claimRecord - Decoded ClaimRecord, or `null` if user hasn't claimed yet
|
|
126
|
+
* @param currentTime - Current unix timestamp in seconds (from `Date.now() / 1000` or RPC clock)
|
|
127
|
+
* @param vaultData - Vault allocation data (tier arrays + total_allocated + flag)
|
|
128
|
+
*/
|
|
129
|
+
function computeClaimEligibility(launchConfigData, depositorRecord, claimRecord, currentTime, vaultData) {
|
|
130
|
+
// --- State gate ---
|
|
131
|
+
const stateKey = Object.keys(launchConfigData.state)[0];
|
|
132
|
+
if (stateKey !== 'launched') {
|
|
133
|
+
return {
|
|
134
|
+
canClaim: false,
|
|
135
|
+
reason: 'launch_not_executed',
|
|
136
|
+
claimableNow: new bn_js_1.default(0),
|
|
137
|
+
totalTokens: new bn_js_1.default(0),
|
|
138
|
+
totalClaimed: new bn_js_1.default(0),
|
|
139
|
+
totalVested: new bn_js_1.default(0),
|
|
140
|
+
tier: null,
|
|
141
|
+
vestingSchedule: null,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
// --- Allocations gate ---
|
|
145
|
+
if (!vaultData.allocationsCalculated) {
|
|
146
|
+
return {
|
|
147
|
+
canClaim: false,
|
|
148
|
+
reason: 'allocations_not_calculated',
|
|
149
|
+
claimableNow: new bn_js_1.default(0),
|
|
150
|
+
totalTokens: new bn_js_1.default(0),
|
|
151
|
+
totalClaimed: new bn_js_1.default(0),
|
|
152
|
+
totalVested: new bn_js_1.default(0),
|
|
153
|
+
tier: null,
|
|
154
|
+
vestingSchedule: null,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
// --- Pool activation time gate ---
|
|
158
|
+
const poolActivationTime = launchConfigData.poolActivationTime;
|
|
159
|
+
if (poolActivationTime === null || poolActivationTime === undefined) {
|
|
160
|
+
return {
|
|
161
|
+
canClaim: false,
|
|
162
|
+
reason: 'pool_activation_time_not_set',
|
|
163
|
+
claimableNow: new bn_js_1.default(0),
|
|
164
|
+
totalTokens: new bn_js_1.default(0),
|
|
165
|
+
totalClaimed: new bn_js_1.default(0),
|
|
166
|
+
totalVested: new bn_js_1.default(0),
|
|
167
|
+
tier: null,
|
|
168
|
+
vestingSchedule: null,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
const activationTimestamp = typeof poolActivationTime === 'number'
|
|
172
|
+
? poolActivationTime
|
|
173
|
+
: poolActivationTime.toNumber();
|
|
174
|
+
// --- Depositor record gate ---
|
|
175
|
+
if (!depositorRecord) {
|
|
176
|
+
return {
|
|
177
|
+
canClaim: false,
|
|
178
|
+
reason: 'no_depositor_record',
|
|
179
|
+
claimableNow: new bn_js_1.default(0),
|
|
180
|
+
totalTokens: new bn_js_1.default(0),
|
|
181
|
+
totalClaimed: new bn_js_1.default(0),
|
|
182
|
+
totalVested: new bn_js_1.default(0),
|
|
183
|
+
tier: null,
|
|
184
|
+
vestingSchedule: null,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
// Use vault tier data for accurate allocation (mirrors on-chain allocated_amount())
|
|
188
|
+
const userAllocated = computeAllocatedAmount(depositorRecord, vaultData);
|
|
189
|
+
if (userAllocated.isZero()) {
|
|
190
|
+
return {
|
|
191
|
+
canClaim: false,
|
|
192
|
+
reason: 'no_allocation',
|
|
193
|
+
claimableNow: new bn_js_1.default(0),
|
|
194
|
+
totalTokens: new bn_js_1.default(0),
|
|
195
|
+
totalClaimed: new bn_js_1.default(0),
|
|
196
|
+
totalVested: new bn_js_1.default(0),
|
|
197
|
+
tier: depositorRecord.tier,
|
|
198
|
+
vestingSchedule: null,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
// --- Timing gate ---
|
|
202
|
+
if (currentTime < activationTimestamp) {
|
|
203
|
+
// Pre-compute what they'll get so the UI can show it
|
|
204
|
+
const totalTokens = claimRecord?.totalTokens && !claimRecord.totalTokens.isZero()
|
|
205
|
+
? claimRecord.totalTokens
|
|
206
|
+
: computeUserTokens(launchConfigData.tokensToParticipants, userAllocated, vaultData.totalAllocated) ?? new bn_js_1.default(0);
|
|
207
|
+
const tier = depositorRecord.tier;
|
|
208
|
+
const vestingDurationSecs = exports.TIER_VESTING_SECONDS[tier] ?? 0;
|
|
209
|
+
return {
|
|
210
|
+
canClaim: false,
|
|
211
|
+
reason: 'claims_not_yet_active',
|
|
212
|
+
claimableNow: new bn_js_1.default(0),
|
|
213
|
+
totalTokens,
|
|
214
|
+
totalClaimed: claimRecord?.totalClaimed ?? new bn_js_1.default(0),
|
|
215
|
+
totalVested: new bn_js_1.default(0),
|
|
216
|
+
tier,
|
|
217
|
+
vestingSchedule: {
|
|
218
|
+
tier,
|
|
219
|
+
vestingDurationSeconds: vestingDurationSecs,
|
|
220
|
+
vestingStartTimestamp: activationTimestamp,
|
|
221
|
+
vestingEndTimestamp: activationTimestamp + vestingDurationSecs,
|
|
222
|
+
percentVested: 0,
|
|
223
|
+
fullyVested: tier === 0,
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
// --- Compute entitlements ---
|
|
228
|
+
const tier = depositorRecord.tier;
|
|
229
|
+
const vestingDurationSecs = exports.TIER_VESTING_SECONDS[tier] ?? 0;
|
|
230
|
+
// Use cached total_tokens if claim record exists, otherwise compute
|
|
231
|
+
const totalTokens = claimRecord?.totalTokens && !claimRecord.totalTokens.isZero()
|
|
232
|
+
? claimRecord.totalTokens
|
|
233
|
+
: computeUserTokens(launchConfigData.tokensToParticipants, userAllocated, vaultData.totalAllocated) ?? new bn_js_1.default(0);
|
|
234
|
+
if (totalTokens.isZero()) {
|
|
235
|
+
return {
|
|
236
|
+
canClaim: false,
|
|
237
|
+
reason: 'no_allocation',
|
|
238
|
+
claimableNow: new bn_js_1.default(0),
|
|
239
|
+
totalTokens: new bn_js_1.default(0),
|
|
240
|
+
totalClaimed: claimRecord?.totalClaimed ?? new bn_js_1.default(0),
|
|
241
|
+
totalVested: new bn_js_1.default(0),
|
|
242
|
+
tier,
|
|
243
|
+
vestingSchedule: null,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
const totalClaimed = claimRecord?.totalClaimed ?? new bn_js_1.default(0);
|
|
247
|
+
const totalVested = computeVestedAmount(totalTokens, tier, activationTimestamp, currentTime);
|
|
248
|
+
const claimableNow = bn_js_1.default.max(totalVested.sub(totalClaimed), new bn_js_1.default(0));
|
|
249
|
+
const vestingEndTimestamp = activationTimestamp + vestingDurationSecs;
|
|
250
|
+
const fullyVested = tier === 0 || currentTime >= vestingEndTimestamp;
|
|
251
|
+
const percentVested = fullyVested
|
|
252
|
+
? 100
|
|
253
|
+
: vestingDurationSecs > 0
|
|
254
|
+
? Math.min(100, Math.floor(((currentTime - activationTimestamp) / vestingDurationSecs) * 100))
|
|
255
|
+
: 100;
|
|
256
|
+
const vestingSchedule = {
|
|
257
|
+
tier,
|
|
258
|
+
vestingDurationSeconds: vestingDurationSecs,
|
|
259
|
+
vestingStartTimestamp: activationTimestamp,
|
|
260
|
+
vestingEndTimestamp,
|
|
261
|
+
percentVested,
|
|
262
|
+
fullyVested,
|
|
263
|
+
};
|
|
264
|
+
return {
|
|
265
|
+
canClaim: claimableNow.gtn(0),
|
|
266
|
+
reason: claimableNow.gtn(0) ? null : (fullyVested ? 'fully_claimed' : 'nothing_new_vested'),
|
|
267
|
+
claimableNow,
|
|
268
|
+
totalTokens,
|
|
269
|
+
totalClaimed,
|
|
270
|
+
totalVested,
|
|
271
|
+
tier,
|
|
272
|
+
vestingSchedule,
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
//# sourceMappingURL=eligibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eligibility.js","sourceRoot":"","sources":["../../src/claims/eligibility.ts"],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AAC,CAAC,mBAAmB,GAAG,CAAC;YACvB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,GAAG,mBAAmB,CAAC,GAAG,mBAAmB,CAAC,GAAG,GAAG,CAAC,CAAC;YAC9F,CAAC,CAAC,GAAG,CAAC;IAEV,MAAM,eAAe,GAAoB;QACvC,IAAI;QACJ,sBAAsB,EAAE,mBAAmB;QAC3C,qBAAqB,EAAE,mBAAmB;QAC1C,mBAAmB;QACnB,aAAa;QACb,WAAW;KACZ,CAAC;IAEF,OAAO;QACL,QAAQ,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7B,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,oBAAoB,CAAC;QAC3F,YAAY;QACZ,WAAW;QACX,YAAY;QACZ,WAAW;QACX,IAAI;QACJ,eAAe;KAChB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { deriveClaimRecordPda, deriveLaunchConfigPda, deriveLaunchpadSignerPda } from './pdas';
|
|
2
|
+
export { deriveDepositorRecordPda, fetchClaimRecord, fetchDepositorRecord, fetchLaunchConfig, resolveClaimAccounts } from './accounts';
|
|
3
|
+
export { computeAllocatedAmount, computeClaimEligibility, computeUserTokens, computeVestedAmount, MAX_TIER, NUM_TIERS, TIER_VESTING_SECONDS, TIER_VESTING_WEEKS } from './eligibility';
|
|
4
|
+
export { buildBatchClaimTransactions, buildClaimTransaction } from './tx';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/claims/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACH,oBAAoB,EAAE,qBAAqB,EAC3C,wBAAwB,EAC3B,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACH,wBAAwB,EAAE,gBAAgB,EAC1C,oBAAoB,EAAE,iBAAiB,EAAE,oBAAoB,EAChE,MAAM,YAAY,CAAC;AAGpB,OAAO,EACH,sBAAsB,EAAE,uBAAuB,EAAE,iBAAiB,EAClE,mBAAmB,EAAE,QAAQ,EAAE,SAAS,EAAE,oBAAoB,EAC9D,kBAAkB,EACrB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACH,2BAA2B,EAAE,qBAAqB,EACrD,MAAM,MAAM,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// Claims Module
|
|
4
|
+
//
|
|
5
|
+
// Client-facing token claim functionality for the Star Launchpad.
|
|
6
|
+
//
|
|
7
|
+
// Architecture:
|
|
8
|
+
// pdas.ts — Deterministic PDA derivation (pure, no RPC)
|
|
9
|
+
// accounts.ts — Account fetching + resolution
|
|
10
|
+
// eligibility.ts — Claim eligibility computation (pure, no RPC)
|
|
11
|
+
// tx.ts — Transaction builder (returns unsigned TX)
|
|
12
|
+
// ============================================================================
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.buildClaimTransaction = exports.buildBatchClaimTransactions = exports.TIER_VESTING_WEEKS = exports.TIER_VESTING_SECONDS = exports.NUM_TIERS = exports.MAX_TIER = exports.computeVestedAmount = exports.computeUserTokens = exports.computeClaimEligibility = exports.computeAllocatedAmount = exports.resolveClaimAccounts = exports.fetchLaunchConfig = exports.fetchDepositorRecord = exports.fetchClaimRecord = exports.deriveDepositorRecordPda = exports.deriveLaunchpadSignerPda = exports.deriveLaunchConfigPda = exports.deriveClaimRecordPda = void 0;
|
|
15
|
+
// PDAs
|
|
16
|
+
var pdas_1 = require("./pdas");
|
|
17
|
+
Object.defineProperty(exports, "deriveClaimRecordPda", { enumerable: true, get: function () { return pdas_1.deriveClaimRecordPda; } });
|
|
18
|
+
Object.defineProperty(exports, "deriveLaunchConfigPda", { enumerable: true, get: function () { return pdas_1.deriveLaunchConfigPda; } });
|
|
19
|
+
Object.defineProperty(exports, "deriveLaunchpadSignerPda", { enumerable: true, get: function () { return pdas_1.deriveLaunchpadSignerPda; } });
|
|
20
|
+
// Account helpers
|
|
21
|
+
var accounts_1 = require("./accounts");
|
|
22
|
+
Object.defineProperty(exports, "deriveDepositorRecordPda", { enumerable: true, get: function () { return accounts_1.deriveDepositorRecordPda; } });
|
|
23
|
+
Object.defineProperty(exports, "fetchClaimRecord", { enumerable: true, get: function () { return accounts_1.fetchClaimRecord; } });
|
|
24
|
+
Object.defineProperty(exports, "fetchDepositorRecord", { enumerable: true, get: function () { return accounts_1.fetchDepositorRecord; } });
|
|
25
|
+
Object.defineProperty(exports, "fetchLaunchConfig", { enumerable: true, get: function () { return accounts_1.fetchLaunchConfig; } });
|
|
26
|
+
Object.defineProperty(exports, "resolveClaimAccounts", { enumerable: true, get: function () { return accounts_1.resolveClaimAccounts; } });
|
|
27
|
+
// Eligibility (pure computation)
|
|
28
|
+
var eligibility_1 = require("./eligibility");
|
|
29
|
+
Object.defineProperty(exports, "computeAllocatedAmount", { enumerable: true, get: function () { return eligibility_1.computeAllocatedAmount; } });
|
|
30
|
+
Object.defineProperty(exports, "computeClaimEligibility", { enumerable: true, get: function () { return eligibility_1.computeClaimEligibility; } });
|
|
31
|
+
Object.defineProperty(exports, "computeUserTokens", { enumerable: true, get: function () { return eligibility_1.computeUserTokens; } });
|
|
32
|
+
Object.defineProperty(exports, "computeVestedAmount", { enumerable: true, get: function () { return eligibility_1.computeVestedAmount; } });
|
|
33
|
+
Object.defineProperty(exports, "MAX_TIER", { enumerable: true, get: function () { return eligibility_1.MAX_TIER; } });
|
|
34
|
+
Object.defineProperty(exports, "NUM_TIERS", { enumerable: true, get: function () { return eligibility_1.NUM_TIERS; } });
|
|
35
|
+
Object.defineProperty(exports, "TIER_VESTING_SECONDS", { enumerable: true, get: function () { return eligibility_1.TIER_VESTING_SECONDS; } });
|
|
36
|
+
Object.defineProperty(exports, "TIER_VESTING_WEEKS", { enumerable: true, get: function () { return eligibility_1.TIER_VESTING_WEEKS; } });
|
|
37
|
+
// Transaction builders
|
|
38
|
+
var tx_1 = require("./tx");
|
|
39
|
+
Object.defineProperty(exports, "buildBatchClaimTransactions", { enumerable: true, get: function () { return tx_1.buildBatchClaimTransactions; } });
|
|
40
|
+
Object.defineProperty(exports, "buildClaimTransaction", { enumerable: true, get: function () { return tx_1.buildClaimTransaction; } });
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/claims/index.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,gBAAgB;AAChB,EAAE;AACF,kEAAkE;AAClE,EAAE;AACF,gBAAgB;AAChB,iEAAiE;AACjE,mDAAmD;AACnD,kEAAkE;AAClE,+DAA+D;AAC/D,+EAA+E;;;AAE/E,OAAO;AACP,+BAGgB;AAFZ,4GAAA,oBAAoB,OAAA;AAAE,6GAAA,qBAAqB,OAAA;AAC3C,gHAAA,wBAAwB,OAAA;AAG5B,kBAAkB;AAClB,uCAGoB;AAFhB,oHAAA,wBAAwB,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAC1C,gHAAA,oBAAoB,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAAE,gHAAA,oBAAoB,OAAA;AAGjE,iCAAiC;AACjC,6CAIuB;AAHnB,qHAAA,sBAAsB,OAAA;AAAE,sHAAA,uBAAuB,OAAA;AAAE,gHAAA,iBAAiB,OAAA;AAClE,kHAAA,mBAAmB,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAAE,wGAAA,SAAS,OAAA;AAAE,mHAAA,oBAAoB,OAAA;AAC9D,iHAAA,kBAAkB,OAAA;AAGtB,uBAAuB;AACvB,2BAEc;AADV,iHAAA,2BAA2B,OAAA;AAAE,2GAAA,qBAAqB,OAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
|
2
|
+
/**
|
|
3
|
+
* Derive the launch config PDA.
|
|
4
|
+
*
|
|
5
|
+
* Seeds: `["launch", creator, seed_le_bytes]`
|
|
6
|
+
*/
|
|
7
|
+
export declare function deriveLaunchConfigPda(creator: PublicKey, seed: bigint | number, programId: PublicKey): [PublicKey, number];
|
|
8
|
+
/**
|
|
9
|
+
* Derive the launchpad signer PDA.
|
|
10
|
+
*
|
|
11
|
+
* Seeds: `["signer", launch_config]`
|
|
12
|
+
*
|
|
13
|
+
* This PDA has authority over the token vault and signs transfers to users.
|
|
14
|
+
*/
|
|
15
|
+
export declare function deriveLaunchpadSignerPda(launchConfig: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
16
|
+
/**
|
|
17
|
+
* Derive the per-user claim record PDA.
|
|
18
|
+
*
|
|
19
|
+
* Seeds: `["claim", launch_config, user]`
|
|
20
|
+
*
|
|
21
|
+
* Created on first claim (init_if_needed). Tracks vesting progress.
|
|
22
|
+
*/
|
|
23
|
+
export declare function deriveClaimRecordPda(launchConfig: PublicKey, user: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
24
|
+
//# sourceMappingURL=pdas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdas.d.ts","sourceRoot":"","sources":["../../src/claims/pdas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAU5C;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,SAAS,EAClB,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,SAAS,EAAE,SAAS,GACnB,CAAC,SAAS,EAAE,MAAM,CAAC,CAQrB;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,SAAS,EACvB,SAAS,EAAE,SAAS,GACnB,CAAC,SAAS,EAAE,MAAM,CAAC,CAKrB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,SAAS,EACvB,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,SAAS,GACnB,CAAC,SAAS,EAAE,MAAM,CAAC,CAKrB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deriveLaunchConfigPda = deriveLaunchConfigPda;
|
|
4
|
+
exports.deriveLaunchpadSignerPda = deriveLaunchpadSignerPda;
|
|
5
|
+
exports.deriveClaimRecordPda = deriveClaimRecordPda;
|
|
6
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Launchpad PDA Seeds (must match programs/launchpad/src/constants.rs)
|
|
9
|
+
// ============================================================================
|
|
10
|
+
const LAUNCH_SEED = Buffer.from('launch');
|
|
11
|
+
const SIGNER_SEED = Buffer.from('signer');
|
|
12
|
+
const CLAIM_SEED = Buffer.from('claim');
|
|
13
|
+
/**
|
|
14
|
+
* Derive the launch config PDA.
|
|
15
|
+
*
|
|
16
|
+
* Seeds: `["launch", creator, seed_le_bytes]`
|
|
17
|
+
*/
|
|
18
|
+
function deriveLaunchConfigPda(creator, seed, programId) {
|
|
19
|
+
const seedBuf = Buffer.alloc(8);
|
|
20
|
+
seedBuf.writeBigUInt64LE(BigInt(seed));
|
|
21
|
+
return web3_js_1.PublicKey.findProgramAddressSync([LAUNCH_SEED, creator.toBuffer(), seedBuf], programId);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Derive the launchpad signer PDA.
|
|
25
|
+
*
|
|
26
|
+
* Seeds: `["signer", launch_config]`
|
|
27
|
+
*
|
|
28
|
+
* This PDA has authority over the token vault and signs transfers to users.
|
|
29
|
+
*/
|
|
30
|
+
function deriveLaunchpadSignerPda(launchConfig, programId) {
|
|
31
|
+
return web3_js_1.PublicKey.findProgramAddressSync([SIGNER_SEED, launchConfig.toBuffer()], programId);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Derive the per-user claim record PDA.
|
|
35
|
+
*
|
|
36
|
+
* Seeds: `["claim", launch_config, user]`
|
|
37
|
+
*
|
|
38
|
+
* Created on first claim (init_if_needed). Tracks vesting progress.
|
|
39
|
+
*/
|
|
40
|
+
function deriveClaimRecordPda(launchConfig, user, programId) {
|
|
41
|
+
return web3_js_1.PublicKey.findProgramAddressSync([CLAIM_SEED, launchConfig.toBuffer(), user.toBuffer()], programId);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=pdas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdas.js","sourceRoot":"","sources":["../../src/claims/pdas.ts"],"names":[],"mappings":";;AAeA,sDAYC;AASD,4DAQC;AASD,oDASC;AA9DD,6CAA4C;AAE5C,+EAA+E;AAC/E,uEAAuE;AACvE,+EAA+E;AAE/E,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC1C,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC1C,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAExC;;;;GAIG;AACH,SAAgB,qBAAqB,CACnC,OAAkB,EAClB,IAAqB,EACrB,SAAoB;IAEpB,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAChC,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvC,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,WAAW,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,EAC1C,SAAS,CACV,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,wBAAwB,CACtC,YAAuB,EACvB,SAAoB;IAEpB,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,WAAW,EAAE,YAAY,CAAC,QAAQ,EAAE,CAAC,EACtC,SAAS,CACV,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAClC,YAAuB,EACvB,IAAe,EACf,SAAoB;IAEpB,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,UAAU,EAAE,YAAY,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,EACtD,SAAS,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Idl, Program } from '@coral-xyz/anchor';
|
|
2
|
+
import { Connection, PublicKey, Transaction } from '@solana/web3.js';
|
|
3
|
+
import type { ClaimTransactionOptions, LaunchConfigAccount } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Build an unsigned `claim_tokens` transaction.
|
|
6
|
+
*
|
|
7
|
+
* Returns a `Transaction` with the correct fee payer and recent blockhash.
|
|
8
|
+
* The caller is responsible for signing (wallet adapter, keypair, or relay).
|
|
9
|
+
*
|
|
10
|
+
* **Client-side usage:**
|
|
11
|
+
* ```ts
|
|
12
|
+
* const tx = await buildClaimTransaction(connection, program, { ... });
|
|
13
|
+
* const sig = await wallet.sendTransaction(tx, connection);
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* **Server-side / relay usage:**
|
|
17
|
+
* ```ts
|
|
18
|
+
* const tx = await buildClaimTransaction(connection, program, {
|
|
19
|
+
* ...params,
|
|
20
|
+
* feePayer: relayPubkey, // sponsor pays fees
|
|
21
|
+
* });
|
|
22
|
+
* // Serialize → send to user for signing → relay adds sponsor sig → submit
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @param connection - Solana RPC connection (for blockhash)
|
|
26
|
+
* @param launchpadProgram - Anchor program instance for the launchpad
|
|
27
|
+
* @param opts - Claim transaction options
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildClaimTransaction(connection: Connection, launchpadProgram: Program<Idl>, opts: ClaimTransactionOptions): Promise<Transaction>;
|
|
30
|
+
/**
|
|
31
|
+
* Build claim transactions for multiple users in batch.
|
|
32
|
+
*
|
|
33
|
+
* Useful for server-side batch processing (e.g. airdrop-style claim on behalf)
|
|
34
|
+
* or building multiple TXs for a UI that processes them sequentially.
|
|
35
|
+
*
|
|
36
|
+
* Each transaction is independent and can be signed/submitted individually.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildBatchClaimTransactions(connection: Connection, launchpadProgram: Program<Idl>, opts: {
|
|
39
|
+
users: PublicKey[];
|
|
40
|
+
launchConfig: PublicKey;
|
|
41
|
+
launchConfigData: LaunchConfigAccount;
|
|
42
|
+
vaultProgramId: PublicKey;
|
|
43
|
+
tokenProgramId?: PublicKey;
|
|
44
|
+
computeUnits?: number;
|
|
45
|
+
priorityFee?: number;
|
|
46
|
+
}): Promise<Map<string, Transaction>>;
|
|
47
|
+
//# sourceMappingURL=tx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../../src/claims/tx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAEL,UAAU,EACV,SAAS,EAET,WAAW,EAEZ,MAAM,iBAAiB,CAAC;AAOzB,OAAO,KAAK,EAEV,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAYlB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,EAC9B,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,WAAW,CAAC,CAqEtB;AAED;;;;;;;GAOG;AACH,wBAAsB,2BAA2B,CAC/C,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,EAC9B,IAAI,EAAE;IACJ,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,YAAY,EAAE,SAAS,CAAC;IACxB,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,cAAc,EAAE,SAAS,CAAC;IAC1B,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GACA,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAyDnC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildClaimTransaction = buildClaimTransaction;
|
|
4
|
+
exports.buildBatchClaimTransactions = buildBatchClaimTransactions;
|
|
5
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
6
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
7
|
+
const accounts_1 = require("./accounts");
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Transaction Builder
|
|
10
|
+
// ============================================================================
|
|
11
|
+
/**
|
|
12
|
+
* Build an unsigned `claim_tokens` transaction.
|
|
13
|
+
*
|
|
14
|
+
* Returns a `Transaction` with the correct fee payer and recent blockhash.
|
|
15
|
+
* The caller is responsible for signing (wallet adapter, keypair, or relay).
|
|
16
|
+
*
|
|
17
|
+
* **Client-side usage:**
|
|
18
|
+
* ```ts
|
|
19
|
+
* const tx = await buildClaimTransaction(connection, program, { ... });
|
|
20
|
+
* const sig = await wallet.sendTransaction(tx, connection);
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* **Server-side / relay usage:**
|
|
24
|
+
* ```ts
|
|
25
|
+
* const tx = await buildClaimTransaction(connection, program, {
|
|
26
|
+
* ...params,
|
|
27
|
+
* feePayer: relayPubkey, // sponsor pays fees
|
|
28
|
+
* });
|
|
29
|
+
* // Serialize → send to user for signing → relay adds sponsor sig → submit
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @param connection - Solana RPC connection (for blockhash)
|
|
33
|
+
* @param launchpadProgram - Anchor program instance for the launchpad
|
|
34
|
+
* @param opts - Claim transaction options
|
|
35
|
+
*/
|
|
36
|
+
async function buildClaimTransaction(connection, launchpadProgram, opts) {
|
|
37
|
+
const { user, launchConfig, launchConfigData, vaultProgramId, feePayer, tokenProgramId, computeUnits, priorityFee, } = opts;
|
|
38
|
+
const launchpadProgramId = launchpadProgram.programId;
|
|
39
|
+
// Resolve all accounts deterministically
|
|
40
|
+
const accounts = (0, accounts_1.resolveClaimAccounts)(launchConfig, launchConfigData, user, vaultProgramId, launchpadProgramId);
|
|
41
|
+
const tokenProgram = tokenProgramId ?? spl_token_1.TOKEN_PROGRAM_ID;
|
|
42
|
+
// Build the claim_tokens instruction via Anchor
|
|
43
|
+
const methods = launchpadProgram.methods;
|
|
44
|
+
const claimIx = await methods
|
|
45
|
+
.claimTokens()
|
|
46
|
+
.accountsPartial({
|
|
47
|
+
user: accounts.user,
|
|
48
|
+
launchConfig: accounts.launchConfig,
|
|
49
|
+
fundraiseState: accounts.fundraiseState,
|
|
50
|
+
userRecord: accounts.userRecord,
|
|
51
|
+
claimRecord: accounts.claimRecord,
|
|
52
|
+
baseMint: accounts.baseMint,
|
|
53
|
+
tokenVault: accounts.tokenVault,
|
|
54
|
+
userTokenAta: accounts.userTokenAta,
|
|
55
|
+
launchpadSigner: accounts.launchpadSigner,
|
|
56
|
+
tokenProgram,
|
|
57
|
+
associatedTokenProgram: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
58
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
59
|
+
})
|
|
60
|
+
.instruction();
|
|
61
|
+
// Assemble transaction with optional compute budget
|
|
62
|
+
const tx = new web3_js_1.Transaction();
|
|
63
|
+
if (computeUnits) {
|
|
64
|
+
tx.add(web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: computeUnits }));
|
|
65
|
+
}
|
|
66
|
+
if (priorityFee) {
|
|
67
|
+
tx.add(web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: priorityFee }));
|
|
68
|
+
}
|
|
69
|
+
tx.add(claimIx);
|
|
70
|
+
// Set fee payer (user by default, or sponsor for relay flow)
|
|
71
|
+
tx.feePayer = feePayer ?? user;
|
|
72
|
+
// Fetch recent blockhash
|
|
73
|
+
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash('confirmed');
|
|
74
|
+
tx.recentBlockhash = blockhash;
|
|
75
|
+
tx.lastValidBlockHeight = lastValidBlockHeight;
|
|
76
|
+
return tx;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Build claim transactions for multiple users in batch.
|
|
80
|
+
*
|
|
81
|
+
* Useful for server-side batch processing (e.g. airdrop-style claim on behalf)
|
|
82
|
+
* or building multiple TXs for a UI that processes them sequentially.
|
|
83
|
+
*
|
|
84
|
+
* Each transaction is independent and can be signed/submitted individually.
|
|
85
|
+
*/
|
|
86
|
+
async function buildBatchClaimTransactions(connection, launchpadProgram, opts) {
|
|
87
|
+
const results = new Map();
|
|
88
|
+
// Pre-fetch blockhash once for the batch
|
|
89
|
+
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash('confirmed');
|
|
90
|
+
for (const user of opts.users) {
|
|
91
|
+
const accounts = (0, accounts_1.resolveClaimAccounts)(opts.launchConfig, opts.launchConfigData, user, opts.vaultProgramId, launchpadProgram.programId);
|
|
92
|
+
const tokenProgram = opts.tokenProgramId ?? spl_token_1.TOKEN_PROGRAM_ID;
|
|
93
|
+
const methods = launchpadProgram.methods;
|
|
94
|
+
const claimIx = await methods
|
|
95
|
+
.claimTokens()
|
|
96
|
+
.accountsPartial({
|
|
97
|
+
user: accounts.user,
|
|
98
|
+
launchConfig: accounts.launchConfig,
|
|
99
|
+
fundraiseState: accounts.fundraiseState,
|
|
100
|
+
userRecord: accounts.userRecord,
|
|
101
|
+
claimRecord: accounts.claimRecord,
|
|
102
|
+
baseMint: accounts.baseMint,
|
|
103
|
+
tokenVault: accounts.tokenVault,
|
|
104
|
+
userTokenAta: accounts.userTokenAta,
|
|
105
|
+
launchpadSigner: accounts.launchpadSigner,
|
|
106
|
+
tokenProgram,
|
|
107
|
+
associatedTokenProgram: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
108
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
109
|
+
})
|
|
110
|
+
.instruction();
|
|
111
|
+
const tx = new web3_js_1.Transaction();
|
|
112
|
+
if (opts.computeUnits) {
|
|
113
|
+
tx.add(web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: opts.computeUnits }));
|
|
114
|
+
}
|
|
115
|
+
if (opts.priorityFee) {
|
|
116
|
+
tx.add(web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: opts.priorityFee }));
|
|
117
|
+
}
|
|
118
|
+
tx.add(claimIx);
|
|
119
|
+
tx.feePayer = user;
|
|
120
|
+
tx.recentBlockhash = blockhash;
|
|
121
|
+
tx.lastValidBlockHeight = lastValidBlockHeight;
|
|
122
|
+
results.set(user.toBase58(), tx);
|
|
123
|
+
}
|
|
124
|
+
return results;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=tx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tx.js","sourceRoot":"","sources":["../../src/claims/tx.ts"],"names":[],"mappings":";;AAwDA,sDAyEC;AAUD,kEAqEC;AA/MD,6CAOyB;AACzB,iDAG2B;AAE3B,yCAAkD;AAalD,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACI,KAAK,UAAU,qBAAqB,CACzC,UAAsB,EACtB,gBAA8B,EAC9B,IAA6B;IAE7B,MAAM,EACJ,IAAI,EACJ,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,QAAQ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AAW;YACjC,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,YAAY,EAAE,QAAQ,CAAC,YAAY;YACnC,eAAe,EAAE,QAAQ,CAAC,eAAe;YACzC,YAAY;YACZ,sBAAsB,EAAE,uCAA2B;YACnD,aAAa,EAAE,uBAAa,CAAC,SAAS;SACvC,CAAC;aACD,WAAW,EAAE,CAAC;QAEjB,MAAM,EAAE,GAAG,IAAI,qBAAW,EAAE,CAAC;QAE7B,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,EAAE,CAAC,GAAG,CAAC,8BAAoB,CAAC,mBAAmB,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;QACjF,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,EAAE,CAAC,GAAG,CAAC,8BAAoB,CAAC,mBAAmB,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QACxF,CAAC;QAED,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAChB,EAAE,CAAC,QAAQ,GAAG,IAAI,CAAC;QACnB,EAAE,CAAC,eAAe,GAAG,SAAS,CAAC;QAC/B,EAAE,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;QAE/C,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Star Launchpad SDK
|
|
3
|
+
*
|
|
4
|
+
* Full lifecycle SDK for the Star Launchpad program:
|
|
5
|
+
*
|
|
6
|
+
* Admin / launch flow:
|
|
7
|
+
* 1. Initialize launch (creates vault via CPI)
|
|
8
|
+
* 2. Configure launch (set vanity mint + metadata)
|
|
9
|
+
* 3. Create launch token (mint total supply)
|
|
10
|
+
* 4. Reserve admin (off-chain ZC API call)
|
|
11
|
+
* 5. Execute launch (pool + DAO + authority transfer)
|
|
12
|
+
* 6. Cancel launch (pre-Launched states only)
|
|
13
|
+
*
|
|
14
|
+
* Client / claim flow:
|
|
15
|
+
* 7. Check claim eligibility
|
|
16
|
+
* 8. Build claim transactions
|
|
17
|
+
*
|
|
18
|
+
* @see https://docs.combinator.trade/llms.txt
|
|
19
|
+
* @see programs/launchpad/spec/09-zc-dao-creation.md
|
|
20
|
+
*/
|
|
21
|
+
export { LaunchpadSDK } from './sdk';
|
|
22
|
+
export * from './types';
|
|
23
|
+
export { derivePoolAddress, sortMints } from './pdas';
|
|
24
|
+
export * from './instructions';
|
|
25
|
+
export * from './claims';
|
|
26
|
+
export * from './zc';
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGtD,cAAc,gBAAgB,CAAC;AAG/B,cAAc,UAAU,CAAC;AAGzB,cAAc,MAAM,CAAC"}
|