@zemyth/raise-sdk 0.1.7 → 0.3.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 +2 -14
- package/dist/accounts/index.cjs.map +1 -1
- package/dist/accounts/index.d.cts +2 -1
- package/dist/accounts/index.d.ts +2 -1
- package/dist/accounts/index.js +2 -14
- 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 +26 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +26 -8
- package/dist/index.js.map +1 -1
- package/dist/instructions/index.cjs +17 -15
- package/dist/instructions/index.cjs.map +1 -1
- package/dist/instructions/index.d.cts +4 -0
- package/dist/instructions/index.d.ts +4 -0
- package/dist/instructions/index.js +17 -15
- 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 +15 -1
- package/dist/pdas/index.d.ts +15 -1
- package/dist/pdas/index.js +9 -1
- package/dist/pdas/index.js.map +1 -1
- package/package.json +1 -1
- package/src/accounts/index.ts +3 -2
- package/src/client.ts +9 -2
- package/src/constants/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/instructions/index.ts +17 -6
- package/src/pdas/index.ts +21 -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
|
[
|
|
@@ -228,18 +236,6 @@ function getSubAllocationVestingPDA(projectPda, subAllocationId, programId) {
|
|
|
228
236
|
);
|
|
229
237
|
return pda;
|
|
230
238
|
}
|
|
231
|
-
function getInvestorMilestoneVestingPDA(projectPda, milestoneIndex, investmentPda, programId) {
|
|
232
|
-
const [pda] = web3_js.PublicKey.findProgramAddressSync(
|
|
233
|
-
[
|
|
234
|
-
Buffer.from("investor_ms_vesting"),
|
|
235
|
-
projectPda.toBuffer(),
|
|
236
|
-
Buffer.from([milestoneIndex]),
|
|
237
|
-
investmentPda.toBuffer()
|
|
238
|
-
],
|
|
239
|
-
programId
|
|
240
|
-
);
|
|
241
|
-
return pda;
|
|
242
|
-
}
|
|
243
239
|
function getFounderMilestoneVestingPDA(projectPda, milestoneIndex, programId) {
|
|
244
240
|
const [pda] = web3_js.PublicKey.findProgramAddressSync(
|
|
245
241
|
[
|
|
@@ -461,6 +457,8 @@ async function approveProject(program, args, admin) {
|
|
|
461
457
|
const lpUsdcVaultPda = getLpUsdcVaultPDA(projectPda, program.programId);
|
|
462
458
|
const futureRoundTokenVaultPda = getFutureRoundTokenVaultPDA(projectPda, program.programId);
|
|
463
459
|
const futureRoundVaultPda = getFutureRoundVaultPDA(projectPda, program.programId);
|
|
460
|
+
const escrowPda = getEscrowPDA(args.projectId, program.programId);
|
|
461
|
+
const escrowTokenAccountPda = getEscrowTokenAccountPDA(projectPda, program.programId);
|
|
464
462
|
const computeBudgetIx = web3_js.ComputeBudgetProgram.setComputeUnitLimit({
|
|
465
463
|
units: 4e5
|
|
466
464
|
});
|
|
@@ -478,6 +476,8 @@ async function approveProject(program, args, admin) {
|
|
|
478
476
|
futureRoundTokenVault: futureRoundTokenVaultPda,
|
|
479
477
|
futureRoundVault: futureRoundVaultPda,
|
|
480
478
|
usdcMint: args.usdcMint,
|
|
479
|
+
escrowPda,
|
|
480
|
+
escrowTokenAccount: escrowTokenAccountPda,
|
|
481
481
|
authority: adminPubkey,
|
|
482
482
|
payer: adminPubkey
|
|
483
483
|
}).preInstructions([computeBudgetIx]);
|
|
@@ -551,7 +551,8 @@ async function claimMilestoneFunds(program, args, founder) {
|
|
|
551
551
|
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
552
552
|
const tokenomicsPda = getTokenomicsPDA(projectPda, program.programId);
|
|
553
553
|
const lpUsdcVaultPda = getLpUsdcVaultPDA(projectPda, program.programId);
|
|
554
|
-
const
|
|
554
|
+
const isFinal = args.nextMilestoneDeadline.eq(new anchor.BN(0));
|
|
555
|
+
const nextMilestonePda = args.nextMilestonePda ?? (!isFinal ? getMilestonePDA(projectPda, args.milestoneIndex + 1, program.programId) : null);
|
|
555
556
|
return getMethods(program).claimMilestoneFunds({ nextMilestoneDeadline: args.nextMilestoneDeadline }).accountsPartial({
|
|
556
557
|
milestone: milestonePda,
|
|
557
558
|
project: projectPda,
|
|
@@ -563,6 +564,7 @@ async function claimMilestoneFunds(program, args, founder) {
|
|
|
563
564
|
tokenomics: tokenomicsPda,
|
|
564
565
|
lpUsdcVault: lpUsdcVaultPda,
|
|
565
566
|
nextMilestone: nextMilestonePda,
|
|
567
|
+
// null for final → Anchor uses programId sentinel
|
|
566
568
|
systemProgram: web3_js.SystemProgram.programId,
|
|
567
569
|
tokenProgram: splToken.TOKEN_PROGRAM_ID
|
|
568
570
|
}).rpc();
|
|
@@ -1143,7 +1145,7 @@ async function claimMilestoneInstantTokens(program, args, investor) {
|
|
|
1143
1145
|
const milestonePda = getMilestonePDA(projectPda, args.milestoneIndex, program.programId);
|
|
1144
1146
|
const investmentPda = getInvestmentPDA(projectPda, nftMintPubkey, program.programId);
|
|
1145
1147
|
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
1146
|
-
const vestingPda =
|
|
1148
|
+
const vestingPda = getRoundInvestorMilestoneVestingPDA(projectPda, args.roundNumber, args.milestoneIndex, investmentPda, program.programId);
|
|
1147
1149
|
const investorVaultPda = getInvestorVaultPDA(projectPda, program.programId);
|
|
1148
1150
|
const vaultAuthorityPda = getVaultAuthorityPDA(projectPda, program.programId);
|
|
1149
1151
|
const investorNftAccount = splToken.getAssociatedTokenAddressSync(
|
|
@@ -1174,7 +1176,7 @@ async function claimMilestoneVestedTokens(program, args, investor) {
|
|
|
1174
1176
|
const milestonePda = getMilestonePDA(projectPda, args.milestoneIndex, program.programId);
|
|
1175
1177
|
const investmentPda = getInvestmentPDA(projectPda, nftMintPubkey, program.programId);
|
|
1176
1178
|
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
1177
|
-
const vestingPda =
|
|
1179
|
+
const vestingPda = getRoundInvestorMilestoneVestingPDA(projectPda, args.roundNumber, args.milestoneIndex, investmentPda, program.programId);
|
|
1178
1180
|
const investorVaultPda = getInvestorVaultPDA(projectPda, program.programId);
|
|
1179
1181
|
const vaultAuthorityPda = getVaultAuthorityPDA(projectPda, program.programId);
|
|
1180
1182
|
const investorNftAccount = splToken.getAssociatedTokenAddressSync(
|