@zemyth/raise-sdk 0.1.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accounts/index.cjs.map +1 -1
- package/dist/accounts/index.js.map +1 -1
- package/dist/constants/index.cjs +1 -0
- package/dist/constants/index.cjs.map +1 -1
- package/dist/constants/index.d.cts +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +1 -0
- package/dist/constants/index.js.map +1 -1
- package/dist/index.cjs +19 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/dist/instructions/index.cjs +15 -1
- package/dist/instructions/index.cjs.map +1 -1
- package/dist/instructions/index.js +15 -1
- package/dist/instructions/index.js.map +1 -1
- package/dist/pdas/index.cjs +9 -0
- package/dist/pdas/index.cjs.map +1 -1
- package/dist/pdas/index.d.cts +12 -1
- package/dist/pdas/index.d.ts +12 -1
- package/dist/pdas/index.js +9 -1
- package/dist/pdas/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +4 -0
- package/src/constants/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/instructions/index.ts +11 -3
- package/src/pdas/index.ts +18 -0
|
@@ -11,6 +11,7 @@ var SEEDS = {
|
|
|
11
11
|
INVESTMENT: "investment",
|
|
12
12
|
VOTE: "vote",
|
|
13
13
|
ESCROW: "escrow",
|
|
14
|
+
ESCROW_TOKEN: "escrow_token",
|
|
14
15
|
PIVOT: "pivot",
|
|
15
16
|
TGE_ESCROW: "tge_escrow",
|
|
16
17
|
ADMIN_CONFIG: "admin-config",
|
|
@@ -47,6 +48,13 @@ function getEscrowPDA(projectId, programId) {
|
|
|
47
48
|
);
|
|
48
49
|
return pda;
|
|
49
50
|
}
|
|
51
|
+
function getEscrowTokenAccountPDA(projectPda, programId) {
|
|
52
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
53
|
+
[Buffer.from(SEEDS.ESCROW_TOKEN), projectPda.toBuffer()],
|
|
54
|
+
programId
|
|
55
|
+
);
|
|
56
|
+
return pda;
|
|
57
|
+
}
|
|
50
58
|
function getMilestonePDA(projectPda, milestoneIndex, programId) {
|
|
51
59
|
const [pda] = PublicKey.findProgramAddressSync(
|
|
52
60
|
[
|
|
@@ -459,6 +467,8 @@ async function approveProject(program, args, admin) {
|
|
|
459
467
|
const lpUsdcVaultPda = getLpUsdcVaultPDA(projectPda, program.programId);
|
|
460
468
|
const futureRoundTokenVaultPda = getFutureRoundTokenVaultPDA(projectPda, program.programId);
|
|
461
469
|
const futureRoundVaultPda = getFutureRoundVaultPDA(projectPda, program.programId);
|
|
470
|
+
const escrowPda = getEscrowPDA(args.projectId, program.programId);
|
|
471
|
+
const escrowTokenAccountPda = getEscrowTokenAccountPDA(projectPda, program.programId);
|
|
462
472
|
const computeBudgetIx = ComputeBudgetProgram.setComputeUnitLimit({
|
|
463
473
|
units: 4e5
|
|
464
474
|
});
|
|
@@ -476,6 +486,8 @@ async function approveProject(program, args, admin) {
|
|
|
476
486
|
futureRoundTokenVault: futureRoundTokenVaultPda,
|
|
477
487
|
futureRoundVault: futureRoundVaultPda,
|
|
478
488
|
usdcMint: args.usdcMint,
|
|
489
|
+
escrowPda,
|
|
490
|
+
escrowTokenAccount: escrowTokenAccountPda,
|
|
479
491
|
authority: adminPubkey,
|
|
480
492
|
payer: adminPubkey
|
|
481
493
|
}).preInstructions([computeBudgetIx]);
|
|
@@ -549,7 +561,8 @@ async function claimMilestoneFunds(program, args, founder) {
|
|
|
549
561
|
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
550
562
|
const tokenomicsPda = getTokenomicsPDA(projectPda, program.programId);
|
|
551
563
|
const lpUsdcVaultPda = getLpUsdcVaultPDA(projectPda, program.programId);
|
|
552
|
-
const
|
|
564
|
+
const isFinal = args.nextMilestoneDeadline.eq(new BN(0));
|
|
565
|
+
const nextMilestonePda = args.nextMilestonePda ?? (!isFinal ? getMilestonePDA(projectPda, args.milestoneIndex + 1, program.programId) : null);
|
|
553
566
|
return getMethods(program).claimMilestoneFunds({ nextMilestoneDeadline: args.nextMilestoneDeadline }).accountsPartial({
|
|
554
567
|
milestone: milestonePda,
|
|
555
568
|
project: projectPda,
|
|
@@ -561,6 +574,7 @@ async function claimMilestoneFunds(program, args, founder) {
|
|
|
561
574
|
tokenomics: tokenomicsPda,
|
|
562
575
|
lpUsdcVault: lpUsdcVaultPda,
|
|
563
576
|
nextMilestone: nextMilestonePda,
|
|
577
|
+
// null for final → Anchor uses programId sentinel
|
|
564
578
|
systemProgram: SystemProgram.programId,
|
|
565
579
|
tokenProgram: TOKEN_PROGRAM_ID
|
|
566
580
|
}).rpc();
|