@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
|
@@ -13,6 +13,7 @@ var SEEDS = {
|
|
|
13
13
|
INVESTMENT: "investment",
|
|
14
14
|
VOTE: "vote",
|
|
15
15
|
ESCROW: "escrow",
|
|
16
|
+
ESCROW_TOKEN: "escrow_token",
|
|
16
17
|
PIVOT: "pivot",
|
|
17
18
|
TGE_ESCROW: "tge_escrow",
|
|
18
19
|
ADMIN_CONFIG: "admin-config",
|
|
@@ -49,6 +50,13 @@ function getEscrowPDA(projectId, programId) {
|
|
|
49
50
|
);
|
|
50
51
|
return pda;
|
|
51
52
|
}
|
|
53
|
+
function getEscrowTokenAccountPDA(projectPda, programId) {
|
|
54
|
+
const [pda] = web3_js.PublicKey.findProgramAddressSync(
|
|
55
|
+
[Buffer.from(SEEDS.ESCROW_TOKEN), projectPda.toBuffer()],
|
|
56
|
+
programId
|
|
57
|
+
);
|
|
58
|
+
return pda;
|
|
59
|
+
}
|
|
52
60
|
function getMilestonePDA(projectPda, milestoneIndex, programId) {
|
|
53
61
|
const [pda] = web3_js.PublicKey.findProgramAddressSync(
|
|
54
62
|
[
|
|
@@ -461,6 +469,8 @@ async function approveProject(program, args, admin) {
|
|
|
461
469
|
const lpUsdcVaultPda = getLpUsdcVaultPDA(projectPda, program.programId);
|
|
462
470
|
const futureRoundTokenVaultPda = getFutureRoundTokenVaultPDA(projectPda, program.programId);
|
|
463
471
|
const futureRoundVaultPda = getFutureRoundVaultPDA(projectPda, program.programId);
|
|
472
|
+
const escrowPda = getEscrowPDA(args.projectId, program.programId);
|
|
473
|
+
const escrowTokenAccountPda = getEscrowTokenAccountPDA(projectPda, program.programId);
|
|
464
474
|
const computeBudgetIx = web3_js.ComputeBudgetProgram.setComputeUnitLimit({
|
|
465
475
|
units: 4e5
|
|
466
476
|
});
|
|
@@ -478,6 +488,8 @@ async function approveProject(program, args, admin) {
|
|
|
478
488
|
futureRoundTokenVault: futureRoundTokenVaultPda,
|
|
479
489
|
futureRoundVault: futureRoundVaultPda,
|
|
480
490
|
usdcMint: args.usdcMint,
|
|
491
|
+
escrowPda,
|
|
492
|
+
escrowTokenAccount: escrowTokenAccountPda,
|
|
481
493
|
authority: adminPubkey,
|
|
482
494
|
payer: adminPubkey
|
|
483
495
|
}).preInstructions([computeBudgetIx]);
|
|
@@ -551,7 +563,8 @@ async function claimMilestoneFunds(program, args, founder) {
|
|
|
551
563
|
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
552
564
|
const tokenomicsPda = getTokenomicsPDA(projectPda, program.programId);
|
|
553
565
|
const lpUsdcVaultPda = getLpUsdcVaultPDA(projectPda, program.programId);
|
|
554
|
-
const
|
|
566
|
+
const isFinal = args.nextMilestoneDeadline.eq(new anchor.BN(0));
|
|
567
|
+
const nextMilestonePda = args.nextMilestonePda ?? (!isFinal ? getMilestonePDA(projectPda, args.milestoneIndex + 1, program.programId) : null);
|
|
555
568
|
return getMethods(program).claimMilestoneFunds({ nextMilestoneDeadline: args.nextMilestoneDeadline }).accountsPartial({
|
|
556
569
|
milestone: milestonePda,
|
|
557
570
|
project: projectPda,
|
|
@@ -563,6 +576,7 @@ async function claimMilestoneFunds(program, args, founder) {
|
|
|
563
576
|
tokenomics: tokenomicsPda,
|
|
564
577
|
lpUsdcVault: lpUsdcVaultPda,
|
|
565
578
|
nextMilestone: nextMilestonePda,
|
|
579
|
+
// null for final → Anchor uses programId sentinel
|
|
566
580
|
systemProgram: web3_js.SystemProgram.programId,
|
|
567
581
|
tokenProgram: splToken.TOKEN_PROGRAM_ID
|
|
568
582
|
}).rpc();
|