@zemyth/raise-sdk 0.1.6 → 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 +49 -9
- package/dist/constants/index.cjs.map +1 -1
- package/dist/constants/index.d.cts +126 -9
- package/dist/constants/index.d.ts +126 -9
- package/dist/constants/index.js +47 -10
- package/dist/constants/index.js.map +1 -1
- package/dist/index.cjs +78 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +76 -18
- package/dist/index.js.map +1 -1
- package/dist/instructions/index.cjs +25 -6
- package/dist/instructions/index.cjs.map +1 -1
- package/dist/instructions/index.d.cts +1 -1
- package/dist/instructions/index.d.ts +1 -1
- package/dist/instructions/index.js +26 -7
- 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 +6 -2
- package/src/constants/index.ts +56 -9
- package/src/index.ts +4 -0
- package/src/instructions/index.ts +23 -10
- package/src/pdas/index.ts +18 -0
package/dist/index.d.cts
CHANGED
|
@@ -7,8 +7,8 @@ import { Connection, PublicKey, Keypair, TransactionSignature } from '@solana/we
|
|
|
7
7
|
export { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
|
8
8
|
import { TokenomicsInput } from './instructions/index.cjs';
|
|
9
9
|
export { MAX_DEADLINE_DURATION_SECONDS, MIN_DEADLINE_DURATION_SECONDS_DEV, MIN_DEADLINE_DURATION_SECONDS_PROD, acceptAdmin, addSubAllocation, approvePivot, approveProject, calculateDeadline, cancelInvestment, cancelRoundInvestment, checkAbandonment, claimEarlyTokens, claimExitWindowRefund, claimFounderEarlyTokens, claimFounderMilestoneTokens, claimFounderMsInstantTokens, claimFounderMsVestedTokens, claimInvestorTokens, claimMilestoneFunds, claimMilestoneInstantTokens, claimMilestoneVestedTokens, claimMissedUnlock, claimRefund, claimRoundEarlyTokens, claimRoundInstantTokens, claimRoundMilestoneFunds, claimRoundVestedTokens, claimSubAllocationTokens, claimTokens, claimVestedTokens, completeDistribution, createMilestone, depositTokens, distributeTokens, executeAllocationChange, extendMilestoneDeadline, finalizePivot, finalizeRoundVoting, finalizeVoting, forceCompleteDistribution, initializeAdmin, initializeFounderVesting, initializeProject, initializeSubAllocationVesting, invest, investInRound, minDeadline, openFundingRound, proposeAllocationChange, proposePivot, releaseHoldback, reportScam, resubmitMilestone, setMilestoneDeadline, setTgeDate, submitForApproval, submitMilestone, submitRoundMilestone, symbolToBytes, transferAdmin, validateDeadline, voteAllocationChange, voteOnMilestone, voteOnRoundMilestone, withdrawFromPivot } from './instructions/index.cjs';
|
|
10
|
-
export { GOVERNANCE, InvestmentTier, NFT, SEEDS, TIER_CONSTRAINTS, TIER_MINIMUMS, TIER_TOKEN_MULTIPLIERS, TIER_VOTE_MULTIPLIERS, TIMING, TOKENOMICS, USDC, VALIDATION, findTierIndex, getTierFromAmount, getTokenMultiplier, getVoteMultiplier } from './constants/index.cjs';
|
|
11
|
-
export { getAdminConfigPDA, getEscrowPDA, getFounderVaultPDA, getFounderVestingPDA, getFundingRoundPDA, getFutureRoundTokenVaultPDA, getFutureRoundVaultPDA, getInvestmentPDA, getInvestorVaultPDA, getLpTokenVaultPDA, getLpUsdcVaultPDA, getMilestonePDA, getNftMintPDA, getPivotProposalPDA, getProgramAuthorityPDA, getProjectPDA, getProjectPDAs, getRoundEscrowPDA, getRoundInvestmentPDA, getRoundInvestorMilestoneVestingPDA, getRoundMilestonePDA, getRoundNftMintPDA, getScamReportPDA, getTgeEscrowPDA, getTokenMintPDA, getTokenVaultPDA, getTokenomicsPDA, getTreasuryVaultPDA, getVaultAuthorityPDA, getVotePDA } from './pdas/index.cjs';
|
|
10
|
+
export { GOVERNANCE, InvestmentTier, NFT, SEEDS, TIER_CONSTRAINTS, TIER_MINIMUMS, TIER_TOKEN_MULTIPLIERS, TIER_VOTE_MULTIPLIERS, TIMING, TIMING_DEV, TIMING_PRODUCTION, TOKENOMICS, USDC, VALIDATION, findTierIndex, getTierFromAmount, getTimingConstants, getTokenMultiplier, getVoteMultiplier } from './constants/index.cjs';
|
|
11
|
+
export { getAdminConfigPDA, getEscrowPDA, getEscrowTokenAccountPDA, getFounderVaultPDA, getFounderVestingPDA, getFundingRoundPDA, getFutureRoundTokenVaultPDA, getFutureRoundVaultPDA, getInvestmentPDA, getInvestorVaultPDA, getLpTokenVaultPDA, getLpUsdcVaultPDA, getMilestonePDA, getNftMintPDA, getPivotProposalPDA, getProgramAuthorityPDA, getProjectPDA, getProjectPDAs, getRoundEscrowPDA, getRoundInvestmentPDA, getRoundInvestorMilestoneVestingPDA, getRoundMilestonePDA, getRoundNftMintPDA, getScamReportPDA, getTgeEscrowPDA, getTokenMintPDA, getTokenVaultPDA, getTokenomicsPDA, getTreasuryVaultPDA, getVaultAuthorityPDA, getVotePDA } from './pdas/index.cjs';
|
|
12
12
|
export { EARLY_TOKEN_COOLING_PERIOD_SECONDS, EARLY_TOKEN_COOLING_PERIOD_SECONDS_DEV, EARLY_TOKEN_RELEASE_BPS, accountExists, calculateEarlyTokenAmount, calculateRemainingAllocation, canClaimEarlyTokens, canClaimFounderEarlyTokens, canClaimFounderMilestoneTokens, canClaimRoundEarlyTokens, fetchAdminConfig, fetchAllFundingRounds, fetchAllInvestments, fetchAllMilestones, fetchAllVotes, fetchFundingRound, fetchFutureRoundVault, fetchInvestment, fetchMilestone, fetchPivotProposal, fetchProject, fetchProjectByPda, fetchRoundInvestment, fetchRoundInvestorMilestoneVesting, fetchRoundMilestone, fetchTgeEscrow, fetchVote, requiresBurnForRefund } from './accounts/index.cjs';
|
|
13
13
|
export { ERROR_CODES, ERROR_MESSAGES, RaiseError, getErrorMessage, isRaiseError, parseError } from './errors/index.cjs';
|
|
14
14
|
|
|
@@ -90,6 +90,7 @@ declare class RaiseClient {
|
|
|
90
90
|
get walletPublicKey(): PublicKey;
|
|
91
91
|
getProjectPDA(projectId: BN): PublicKey;
|
|
92
92
|
getEscrowPDA(projectId: BN): PublicKey;
|
|
93
|
+
getEscrowTokenAccountPDA(projectPda: PublicKey): PublicKey;
|
|
93
94
|
getMilestonePDA(projectPda: PublicKey, milestoneIndex: number): PublicKey;
|
|
94
95
|
getInvestmentPDA(projectPda: PublicKey, nftMint: PublicKey): PublicKey;
|
|
95
96
|
getVotePDA(milestonePda: PublicKey, voterKey: PublicKey, votingRound: number): PublicKey;
|
|
@@ -140,7 +141,7 @@ declare class RaiseClient {
|
|
|
140
141
|
approveProject(args: {
|
|
141
142
|
projectId: BN;
|
|
142
143
|
usdcMint: PublicKey;
|
|
143
|
-
}, adminKeypair
|
|
144
|
+
}, adminKeypair?: Keypair): Promise<string>;
|
|
144
145
|
createMilestone(args: {
|
|
145
146
|
projectId: BN;
|
|
146
147
|
milestoneIndex: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ import { Connection, PublicKey, Keypair, TransactionSignature } from '@solana/we
|
|
|
7
7
|
export { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
|
8
8
|
import { TokenomicsInput } from './instructions/index.js';
|
|
9
9
|
export { MAX_DEADLINE_DURATION_SECONDS, MIN_DEADLINE_DURATION_SECONDS_DEV, MIN_DEADLINE_DURATION_SECONDS_PROD, acceptAdmin, addSubAllocation, approvePivot, approveProject, calculateDeadline, cancelInvestment, cancelRoundInvestment, checkAbandonment, claimEarlyTokens, claimExitWindowRefund, claimFounderEarlyTokens, claimFounderMilestoneTokens, claimFounderMsInstantTokens, claimFounderMsVestedTokens, claimInvestorTokens, claimMilestoneFunds, claimMilestoneInstantTokens, claimMilestoneVestedTokens, claimMissedUnlock, claimRefund, claimRoundEarlyTokens, claimRoundInstantTokens, claimRoundMilestoneFunds, claimRoundVestedTokens, claimSubAllocationTokens, claimTokens, claimVestedTokens, completeDistribution, createMilestone, depositTokens, distributeTokens, executeAllocationChange, extendMilestoneDeadline, finalizePivot, finalizeRoundVoting, finalizeVoting, forceCompleteDistribution, initializeAdmin, initializeFounderVesting, initializeProject, initializeSubAllocationVesting, invest, investInRound, minDeadline, openFundingRound, proposeAllocationChange, proposePivot, releaseHoldback, reportScam, resubmitMilestone, setMilestoneDeadline, setTgeDate, submitForApproval, submitMilestone, submitRoundMilestone, symbolToBytes, transferAdmin, validateDeadline, voteAllocationChange, voteOnMilestone, voteOnRoundMilestone, withdrawFromPivot } from './instructions/index.js';
|
|
10
|
-
export { GOVERNANCE, InvestmentTier, NFT, SEEDS, TIER_CONSTRAINTS, TIER_MINIMUMS, TIER_TOKEN_MULTIPLIERS, TIER_VOTE_MULTIPLIERS, TIMING, TOKENOMICS, USDC, VALIDATION, findTierIndex, getTierFromAmount, getTokenMultiplier, getVoteMultiplier } from './constants/index.js';
|
|
11
|
-
export { getAdminConfigPDA, getEscrowPDA, getFounderVaultPDA, getFounderVestingPDA, getFundingRoundPDA, getFutureRoundTokenVaultPDA, getFutureRoundVaultPDA, getInvestmentPDA, getInvestorVaultPDA, getLpTokenVaultPDA, getLpUsdcVaultPDA, getMilestonePDA, getNftMintPDA, getPivotProposalPDA, getProgramAuthorityPDA, getProjectPDA, getProjectPDAs, getRoundEscrowPDA, getRoundInvestmentPDA, getRoundInvestorMilestoneVestingPDA, getRoundMilestonePDA, getRoundNftMintPDA, getScamReportPDA, getTgeEscrowPDA, getTokenMintPDA, getTokenVaultPDA, getTokenomicsPDA, getTreasuryVaultPDA, getVaultAuthorityPDA, getVotePDA } from './pdas/index.js';
|
|
10
|
+
export { GOVERNANCE, InvestmentTier, NFT, SEEDS, TIER_CONSTRAINTS, TIER_MINIMUMS, TIER_TOKEN_MULTIPLIERS, TIER_VOTE_MULTIPLIERS, TIMING, TIMING_DEV, TIMING_PRODUCTION, TOKENOMICS, USDC, VALIDATION, findTierIndex, getTierFromAmount, getTimingConstants, getTokenMultiplier, getVoteMultiplier } from './constants/index.js';
|
|
11
|
+
export { getAdminConfigPDA, getEscrowPDA, getEscrowTokenAccountPDA, getFounderVaultPDA, getFounderVestingPDA, getFundingRoundPDA, getFutureRoundTokenVaultPDA, getFutureRoundVaultPDA, getInvestmentPDA, getInvestorVaultPDA, getLpTokenVaultPDA, getLpUsdcVaultPDA, getMilestonePDA, getNftMintPDA, getPivotProposalPDA, getProgramAuthorityPDA, getProjectPDA, getProjectPDAs, getRoundEscrowPDA, getRoundInvestmentPDA, getRoundInvestorMilestoneVestingPDA, getRoundMilestonePDA, getRoundNftMintPDA, getScamReportPDA, getTgeEscrowPDA, getTokenMintPDA, getTokenVaultPDA, getTokenomicsPDA, getTreasuryVaultPDA, getVaultAuthorityPDA, getVotePDA } from './pdas/index.js';
|
|
12
12
|
export { EARLY_TOKEN_COOLING_PERIOD_SECONDS, EARLY_TOKEN_COOLING_PERIOD_SECONDS_DEV, EARLY_TOKEN_RELEASE_BPS, accountExists, calculateEarlyTokenAmount, calculateRemainingAllocation, canClaimEarlyTokens, canClaimFounderEarlyTokens, canClaimFounderMilestoneTokens, canClaimRoundEarlyTokens, fetchAdminConfig, fetchAllFundingRounds, fetchAllInvestments, fetchAllMilestones, fetchAllVotes, fetchFundingRound, fetchFutureRoundVault, fetchInvestment, fetchMilestone, fetchPivotProposal, fetchProject, fetchProjectByPda, fetchRoundInvestment, fetchRoundInvestorMilestoneVesting, fetchRoundMilestone, fetchTgeEscrow, fetchVote, requiresBurnForRefund } from './accounts/index.js';
|
|
13
13
|
export { ERROR_CODES, ERROR_MESSAGES, RaiseError, getErrorMessage, isRaiseError, parseError } from './errors/index.js';
|
|
14
14
|
|
|
@@ -90,6 +90,7 @@ declare class RaiseClient {
|
|
|
90
90
|
get walletPublicKey(): PublicKey;
|
|
91
91
|
getProjectPDA(projectId: BN): PublicKey;
|
|
92
92
|
getEscrowPDA(projectId: BN): PublicKey;
|
|
93
|
+
getEscrowTokenAccountPDA(projectPda: PublicKey): PublicKey;
|
|
93
94
|
getMilestonePDA(projectPda: PublicKey, milestoneIndex: number): PublicKey;
|
|
94
95
|
getInvestmentPDA(projectPda: PublicKey, nftMint: PublicKey): PublicKey;
|
|
95
96
|
getVotePDA(milestonePda: PublicKey, voterKey: PublicKey, votingRound: number): PublicKey;
|
|
@@ -140,7 +141,7 @@ declare class RaiseClient {
|
|
|
140
141
|
approveProject(args: {
|
|
141
142
|
projectId: BN;
|
|
142
143
|
usdcMint: PublicKey;
|
|
143
|
-
}, adminKeypair
|
|
144
|
+
}, adminKeypair?: Keypair): Promise<string>;
|
|
144
145
|
createMilestone(args: {
|
|
145
146
|
projectId: BN;
|
|
146
147
|
milestoneIndex: number;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BN, AnchorError } from '@coral-xyz/anchor';
|
|
2
2
|
export { BN } from '@coral-xyz/anchor';
|
|
3
|
-
import { PublicKey, ComputeBudgetProgram, SystemProgram, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RENT_PUBKEY, SYSVAR_CLOCK_PUBKEY } from '@solana/web3.js';
|
|
3
|
+
import { PublicKey, Keypair, ComputeBudgetProgram, SystemProgram, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RENT_PUBKEY, SYSVAR_CLOCK_PUBKEY } from '@solana/web3.js';
|
|
4
4
|
export { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
|
5
5
|
import { getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
|
6
6
|
|
|
@@ -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
|
PIVOT_PROPOSAL: "pivot_proposal",
|
|
18
19
|
TGE_ESCROW: "tge_escrow",
|
|
@@ -46,10 +47,10 @@ var VALIDATION = {
|
|
|
46
47
|
/** Maximum pivot justification length */
|
|
47
48
|
MAX_PIVOT_JUSTIFICATION_LEN: 512
|
|
48
49
|
};
|
|
49
|
-
var
|
|
50
|
-
/**
|
|
50
|
+
var TIMING_PRODUCTION = {
|
|
51
|
+
/** Voting period (14 days) */
|
|
51
52
|
VOTING_PERIOD_SECONDS: 1209600,
|
|
52
|
-
/**
|
|
53
|
+
/** Hold period (7 days) */
|
|
53
54
|
HOLD_PERIOD_SECONDS: 604800,
|
|
54
55
|
/** Inactivity timeout (90 days) */
|
|
55
56
|
INACTIVITY_TIMEOUT_SECONDS: 7776e3,
|
|
@@ -59,13 +60,49 @@ var TIMING = {
|
|
|
59
60
|
REFUND_WINDOW_SECONDS: 1209600,
|
|
60
61
|
/** Pivot withdrawal window (7 days) */
|
|
61
62
|
PIVOT_WITHDRAWAL_WINDOW_SECONDS: 604800,
|
|
62
|
-
/**
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
|
|
63
|
+
/** Early token cooling period (24 hours) */
|
|
64
|
+
EARLY_TOKEN_COOLING_PERIOD: 86400,
|
|
65
|
+
/** Exit window period (7 days) */
|
|
66
|
+
EXIT_WINDOW_PERIOD: 604800,
|
|
67
|
+
/** Wallet update timelock (7 days) */
|
|
68
|
+
WALLET_UPDATE_TIMELOCK: 604800,
|
|
69
|
+
/** Minimum deadline duration (7 days) */
|
|
70
|
+
MIN_DEADLINE_DURATION_SECONDS: 604800,
|
|
71
|
+
/** Maximum deadline duration (90 days) */
|
|
72
|
+
MAX_DEADLINE_DURATION_SECONDS: 90 * 24 * 60 * 60,
|
|
73
|
+
/** Deadline grace period (90 days) */
|
|
74
|
+
DEADLINE_GRACE_PERIOD_SECONDS: 7776e3
|
|
68
75
|
};
|
|
76
|
+
var TIMING_DEV = {
|
|
77
|
+
/** Voting period (60 seconds) */
|
|
78
|
+
VOTING_PERIOD_SECONDS: 60,
|
|
79
|
+
/** Hold period (1 second) */
|
|
80
|
+
HOLD_PERIOD_SECONDS: 1,
|
|
81
|
+
/** Inactivity timeout (10 seconds) */
|
|
82
|
+
INACTIVITY_TIMEOUT_SECONDS: 10,
|
|
83
|
+
/** Abandonment timeout (60 seconds) */
|
|
84
|
+
ABANDONMENT_TIMEOUT_SECONDS: 60,
|
|
85
|
+
/** Refund window (2 minutes) */
|
|
86
|
+
REFUND_WINDOW_SECONDS: 120,
|
|
87
|
+
/** Pivot withdrawal window (10 seconds) */
|
|
88
|
+
PIVOT_WITHDRAWAL_WINDOW_SECONDS: 10,
|
|
89
|
+
/** Early token cooling period (10 seconds) */
|
|
90
|
+
EARLY_TOKEN_COOLING_PERIOD: 10,
|
|
91
|
+
/** Exit window period (20 seconds) */
|
|
92
|
+
EXIT_WINDOW_PERIOD: 20,
|
|
93
|
+
/** Wallet update timelock (60 seconds) */
|
|
94
|
+
WALLET_UPDATE_TIMELOCK: 60,
|
|
95
|
+
/** Minimum deadline duration (60 seconds) */
|
|
96
|
+
MIN_DEADLINE_DURATION_SECONDS: 60,
|
|
97
|
+
/** Maximum deadline duration (90 days) */
|
|
98
|
+
MAX_DEADLINE_DURATION_SECONDS: 90 * 24 * 60 * 60,
|
|
99
|
+
/** Deadline grace period (5 seconds) */
|
|
100
|
+
DEADLINE_GRACE_PERIOD_SECONDS: 5
|
|
101
|
+
};
|
|
102
|
+
function getTimingConstants(isDev = false) {
|
|
103
|
+
return isDev ? TIMING_DEV : TIMING_PRODUCTION;
|
|
104
|
+
}
|
|
105
|
+
var TIMING = TIMING_PRODUCTION;
|
|
69
106
|
var TIER_CONSTRAINTS = {
|
|
70
107
|
/** Minimum number of tiers */
|
|
71
108
|
MIN_TIERS: 1,
|
|
@@ -210,6 +247,13 @@ function getEscrowPDA(projectId, programId) {
|
|
|
210
247
|
);
|
|
211
248
|
return pda;
|
|
212
249
|
}
|
|
250
|
+
function getEscrowTokenAccountPDA(projectPda, programId) {
|
|
251
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
252
|
+
[Buffer.from(SEEDS.ESCROW_TOKEN), projectPda.toBuffer()],
|
|
253
|
+
programId
|
|
254
|
+
);
|
|
255
|
+
return pda;
|
|
256
|
+
}
|
|
213
257
|
function getMilestonePDA(projectPda, milestoneIndex, programId) {
|
|
214
258
|
const [pda] = PublicKey.findProgramAddressSync(
|
|
215
259
|
[
|
|
@@ -1153,7 +1197,8 @@ async function submitForApproval(program, projectId, founder) {
|
|
|
1153
1197
|
founder
|
|
1154
1198
|
}).rpc();
|
|
1155
1199
|
}
|
|
1156
|
-
async function approveProject(program, args,
|
|
1200
|
+
async function approveProject(program, args, admin) {
|
|
1201
|
+
const adminPubkey = admin instanceof Keypair ? admin.publicKey : admin;
|
|
1157
1202
|
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1158
1203
|
const tokenomicsPda = getTokenomicsPDA(projectPda, program.programId);
|
|
1159
1204
|
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
@@ -1166,10 +1211,12 @@ async function approveProject(program, args, adminKeypair) {
|
|
|
1166
1211
|
const lpUsdcVaultPda = getLpUsdcVaultPDA(projectPda, program.programId);
|
|
1167
1212
|
const futureRoundTokenVaultPda = getFutureRoundTokenVaultPDA(projectPda, program.programId);
|
|
1168
1213
|
const futureRoundVaultPda = getFutureRoundVaultPDA(projectPda, program.programId);
|
|
1214
|
+
const escrowPda = getEscrowPDA(args.projectId, program.programId);
|
|
1215
|
+
const escrowTokenAccountPda = getEscrowTokenAccountPDA(projectPda, program.programId);
|
|
1169
1216
|
const computeBudgetIx = ComputeBudgetProgram.setComputeUnitLimit({
|
|
1170
1217
|
units: 4e5
|
|
1171
1218
|
});
|
|
1172
|
-
|
|
1219
|
+
let builder = getMethods(program).approveProject().accountsPartial({
|
|
1173
1220
|
project: projectPda,
|
|
1174
1221
|
tokenomics: tokenomicsPda,
|
|
1175
1222
|
tokenVault: tokenVaultPda,
|
|
@@ -1183,9 +1230,15 @@ async function approveProject(program, args, adminKeypair) {
|
|
|
1183
1230
|
futureRoundTokenVault: futureRoundTokenVaultPda,
|
|
1184
1231
|
futureRoundVault: futureRoundVaultPda,
|
|
1185
1232
|
usdcMint: args.usdcMint,
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1233
|
+
escrowPda,
|
|
1234
|
+
escrowTokenAccount: escrowTokenAccountPda,
|
|
1235
|
+
authority: adminPubkey,
|
|
1236
|
+
payer: adminPubkey
|
|
1237
|
+
}).preInstructions([computeBudgetIx]);
|
|
1238
|
+
if (admin instanceof Keypair) {
|
|
1239
|
+
builder = builder.signers([admin]);
|
|
1240
|
+
}
|
|
1241
|
+
return builder.rpc();
|
|
1189
1242
|
}
|
|
1190
1243
|
async function createMilestone(program, args, founder) {
|
|
1191
1244
|
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
@@ -1252,7 +1305,8 @@ async function claimMilestoneFunds(program, args, founder) {
|
|
|
1252
1305
|
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
1253
1306
|
const tokenomicsPda = getTokenomicsPDA(projectPda, program.programId);
|
|
1254
1307
|
const lpUsdcVaultPda = getLpUsdcVaultPDA(projectPda, program.programId);
|
|
1255
|
-
const
|
|
1308
|
+
const isFinal = args.nextMilestoneDeadline.eq(new BN(0));
|
|
1309
|
+
const nextMilestonePda = args.nextMilestonePda ?? (!isFinal ? getMilestonePDA(projectPda, args.milestoneIndex + 1, program.programId) : null);
|
|
1256
1310
|
return getMethods(program).claimMilestoneFunds({ nextMilestoneDeadline: args.nextMilestoneDeadline }).accountsPartial({
|
|
1257
1311
|
milestone: milestonePda,
|
|
1258
1312
|
project: projectPda,
|
|
@@ -1264,6 +1318,7 @@ async function claimMilestoneFunds(program, args, founder) {
|
|
|
1264
1318
|
tokenomics: tokenomicsPda,
|
|
1265
1319
|
lpUsdcVault: lpUsdcVaultPda,
|
|
1266
1320
|
nextMilestone: nextMilestonePda,
|
|
1321
|
+
// null for final → Anchor uses programId sentinel
|
|
1267
1322
|
systemProgram: SystemProgram.programId,
|
|
1268
1323
|
tokenProgram: TOKEN_PROGRAM_ID
|
|
1269
1324
|
}).rpc();
|
|
@@ -2303,6 +2358,9 @@ var RaiseClient = class _RaiseClient {
|
|
|
2303
2358
|
getEscrowPDA(projectId) {
|
|
2304
2359
|
return getEscrowPDA(projectId, this.programId);
|
|
2305
2360
|
}
|
|
2361
|
+
getEscrowTokenAccountPDA(projectPda) {
|
|
2362
|
+
return getEscrowTokenAccountPDA(projectPda, this.programId);
|
|
2363
|
+
}
|
|
2306
2364
|
getMilestonePDA(projectPda, milestoneIndex) {
|
|
2307
2365
|
return getMilestonePDA(projectPda, milestoneIndex, this.programId);
|
|
2308
2366
|
}
|
|
@@ -2444,7 +2502,7 @@ var RaiseClient = class _RaiseClient {
|
|
|
2444
2502
|
return approveProject(
|
|
2445
2503
|
this.program,
|
|
2446
2504
|
args,
|
|
2447
|
-
adminKeypair
|
|
2505
|
+
adminKeypair ?? this.walletPublicKey
|
|
2448
2506
|
);
|
|
2449
2507
|
}
|
|
2450
2508
|
// ===========================================================================
|
|
@@ -3828,6 +3886,6 @@ function shortenPublicKey(pubkey, chars = 4) {
|
|
|
3828
3886
|
return `${str.slice(0, chars)}...${str.slice(-chars)}`;
|
|
3829
3887
|
}
|
|
3830
3888
|
|
|
3831
|
-
export { EARLY_TOKEN_COOLING_PERIOD_SECONDS, EARLY_TOKEN_COOLING_PERIOD_SECONDS_DEV, EARLY_TOKEN_RELEASE_BPS, ERROR_CODES, ERROR_MESSAGES, EVENT_NAMES, FundingRoundState, GOVERNANCE, InvestmentTier, MAX_DEADLINE_DURATION_SECONDS, MIN_DEADLINE_DURATION_SECONDS_DEV, MIN_DEADLINE_DURATION_SECONDS_PROD, MilestoneState, NFT, PivotState, ProjectState, RaiseClient, RaiseError, SEEDS, TIER_CONSTRAINTS, TIER_MINIMUMS, TIER_TOKEN_MULTIPLIERS, TIER_VOTE_MULTIPLIERS, TIMING, TOKENOMICS, USDC, VALIDATION, VoteChoice, acceptAdmin, accountExists, addSubAllocation, approvePivot, approveProject, bigIntToBN, bnToBigInt, bnToNumber, bpsToPercent, calculateDeadline, calculateEarlyTokenAmount, calculateRemainingAllocation, canClaimEarlyTokens, canClaimFounderEarlyTokens, canClaimFounderMilestoneTokens, canClaimRoundEarlyTokens, cancelInvestment, cancelRoundInvestment, checkAbandonment, claimEarlyTokens, claimExitWindowRefund, claimFounderEarlyTokens, claimFounderMilestoneTokens, claimFounderMsInstantTokens, claimFounderMsVestedTokens, claimInvestorTokens, claimMilestoneFunds, claimMilestoneInstantTokens, claimMilestoneVestedTokens, claimMissedUnlock, claimRefund, claimRoundEarlyTokens, claimRoundInstantTokens, claimRoundMilestoneFunds, claimRoundVestedTokens, claimSubAllocationTokens, claimTokens, claimVestedTokens, completeDistribution, confirmTransaction, createMilestone, depositTokens, distributeTokens, executeAllocationChange, extendMilestoneDeadline, fetchAdminConfig, fetchAllFundingRounds, fetchAllInvestments, fetchAllMilestones, fetchAllVotes, fetchFundingRound, fetchFutureRoundVault, fetchInvestment, fetchMilestone, fetchPivotProposal, fetchProject, fetchProjectByPda, fetchRoundInvestment, fetchRoundInvestorMilestoneVesting, fetchRoundMilestone, fetchTgeEscrow, fetchVote, filterEventsByName, finalizePivot, finalizeRoundVoting, finalizeVoting, findEvent, findTierIndex, forceCompleteDistribution, formatDuration, getAdminConfigPDA, getCurrentTimestamp, getErrorMessage, getEscrowPDA, getFounderVaultPDA, getFounderVestingPDA, getFundingRoundPDA, getFutureRoundTokenVaultPDA, getFutureRoundVaultPDA, getInvestmentPDA, getInvestorVaultPDA, getLpTokenVaultPDA, getLpUsdcVaultPDA, getMilestonePDA, getNftMintPDA, getPivotProposalPDA, getProgramAuthorityPDA, getProjectPDA, getProjectPDAs, getRoundEscrowPDA, getRoundInvestmentPDA, getRoundInvestorMilestoneVestingPDA, getRoundMilestonePDA, getRoundNftMintPDA, getScamReportPDA, getTgeEscrowPDA, getTierFromAmount, getTokenMintPDA, getTokenMultiplier, getTokenVaultPDA, getTokenomicsPDA, getTransactionWithRetry, getTreasuryVaultPDA, getVaultAuthorityPDA, getVoteMultiplier, getVotePDA, hasTimestampPassed, initializeAdmin, initializeFounderVesting, initializeProject, initializeSubAllocationVesting, invest, investInRound, isRaiseError, isValidPublicKey, minDeadline, openFundingRound, parseError, percentToBps, percentageOf, proposeAllocationChange, proposePivot, releaseHoldback, reportScam, requiresBurnForRefund, resubmitMilestone, setMilestoneDeadline, setTgeDate, shortenPublicKey, submitForApproval, submitMilestone, submitRoundMilestone, symbolToBytes, timeRemaining, timestampToDate, transferAdmin, validateDeadline, validateMetadataUri, validateMilestonePercentages, voteAllocationChange, voteOnMilestone, voteOnRoundMilestone, withdrawFromPivot };
|
|
3889
|
+
export { EARLY_TOKEN_COOLING_PERIOD_SECONDS, EARLY_TOKEN_COOLING_PERIOD_SECONDS_DEV, EARLY_TOKEN_RELEASE_BPS, ERROR_CODES, ERROR_MESSAGES, EVENT_NAMES, FundingRoundState, GOVERNANCE, InvestmentTier, MAX_DEADLINE_DURATION_SECONDS, MIN_DEADLINE_DURATION_SECONDS_DEV, MIN_DEADLINE_DURATION_SECONDS_PROD, MilestoneState, NFT, PivotState, ProjectState, RaiseClient, RaiseError, SEEDS, TIER_CONSTRAINTS, TIER_MINIMUMS, TIER_TOKEN_MULTIPLIERS, TIER_VOTE_MULTIPLIERS, TIMING, TIMING_DEV, TIMING_PRODUCTION, TOKENOMICS, USDC, VALIDATION, VoteChoice, acceptAdmin, accountExists, addSubAllocation, approvePivot, approveProject, bigIntToBN, bnToBigInt, bnToNumber, bpsToPercent, calculateDeadline, calculateEarlyTokenAmount, calculateRemainingAllocation, canClaimEarlyTokens, canClaimFounderEarlyTokens, canClaimFounderMilestoneTokens, canClaimRoundEarlyTokens, cancelInvestment, cancelRoundInvestment, checkAbandonment, claimEarlyTokens, claimExitWindowRefund, claimFounderEarlyTokens, claimFounderMilestoneTokens, claimFounderMsInstantTokens, claimFounderMsVestedTokens, claimInvestorTokens, claimMilestoneFunds, claimMilestoneInstantTokens, claimMilestoneVestedTokens, claimMissedUnlock, claimRefund, claimRoundEarlyTokens, claimRoundInstantTokens, claimRoundMilestoneFunds, claimRoundVestedTokens, claimSubAllocationTokens, claimTokens, claimVestedTokens, completeDistribution, confirmTransaction, createMilestone, depositTokens, distributeTokens, executeAllocationChange, extendMilestoneDeadline, fetchAdminConfig, fetchAllFundingRounds, fetchAllInvestments, fetchAllMilestones, fetchAllVotes, fetchFundingRound, fetchFutureRoundVault, fetchInvestment, fetchMilestone, fetchPivotProposal, fetchProject, fetchProjectByPda, fetchRoundInvestment, fetchRoundInvestorMilestoneVesting, fetchRoundMilestone, fetchTgeEscrow, fetchVote, filterEventsByName, finalizePivot, finalizeRoundVoting, finalizeVoting, findEvent, findTierIndex, forceCompleteDistribution, formatDuration, getAdminConfigPDA, getCurrentTimestamp, getErrorMessage, getEscrowPDA, getEscrowTokenAccountPDA, getFounderVaultPDA, getFounderVestingPDA, getFundingRoundPDA, getFutureRoundTokenVaultPDA, getFutureRoundVaultPDA, getInvestmentPDA, getInvestorVaultPDA, getLpTokenVaultPDA, getLpUsdcVaultPDA, getMilestonePDA, getNftMintPDA, getPivotProposalPDA, getProgramAuthorityPDA, getProjectPDA, getProjectPDAs, getRoundEscrowPDA, getRoundInvestmentPDA, getRoundInvestorMilestoneVestingPDA, getRoundMilestonePDA, getRoundNftMintPDA, getScamReportPDA, getTgeEscrowPDA, getTierFromAmount, getTimingConstants, getTokenMintPDA, getTokenMultiplier, getTokenVaultPDA, getTokenomicsPDA, getTransactionWithRetry, getTreasuryVaultPDA, getVaultAuthorityPDA, getVoteMultiplier, getVotePDA, hasTimestampPassed, initializeAdmin, initializeFounderVesting, initializeProject, initializeSubAllocationVesting, invest, investInRound, isRaiseError, isValidPublicKey, minDeadline, openFundingRound, parseError, percentToBps, percentageOf, proposeAllocationChange, proposePivot, releaseHoldback, reportScam, requiresBurnForRefund, resubmitMilestone, setMilestoneDeadline, setTgeDate, shortenPublicKey, submitForApproval, submitMilestone, submitRoundMilestone, symbolToBytes, timeRemaining, timestampToDate, transferAdmin, validateDeadline, validateMetadataUri, validateMilestonePercentages, voteAllocationChange, voteOnMilestone, voteOnRoundMilestone, withdrawFromPivot };
|
|
3832
3890
|
//# sourceMappingURL=index.js.map
|
|
3833
3891
|
//# sourceMappingURL=index.js.map
|