@zemyth/raise-sdk 0.1.1 → 0.1.3
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 +11 -9
- package/dist/accounts/index.cjs +531 -3
- package/dist/accounts/index.cjs.map +1 -1
- package/dist/accounts/index.d.cts +307 -2
- package/dist/accounts/index.d.ts +307 -2
- package/dist/accounts/index.js +503 -4
- package/dist/accounts/index.js.map +1 -1
- package/dist/constants/index.cjs +41 -3
- package/dist/constants/index.cjs.map +1 -1
- package/dist/constants/index.d.cts +38 -3
- package/dist/constants/index.d.ts +38 -3
- package/dist/constants/index.js +40 -4
- package/dist/constants/index.js.map +1 -1
- package/dist/index.cjs +2297 -361
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +566 -7
- package/dist/index.d.ts +566 -7
- package/dist/index.js +2279 -379
- package/dist/index.js.map +1 -1
- package/dist/instructions/index.cjs +783 -40
- package/dist/instructions/index.cjs.map +1 -1
- package/dist/instructions/index.d.cts +492 -6
- package/dist/instructions/index.d.ts +492 -6
- package/dist/instructions/index.js +762 -42
- package/dist/instructions/index.js.map +1 -1
- package/dist/pdas/index.cjs +163 -1
- package/dist/pdas/index.cjs.map +1 -1
- package/dist/pdas/index.d.cts +131 -1
- package/dist/pdas/index.d.ts +131 -1
- package/dist/pdas/index.js +151 -2
- package/dist/pdas/index.js.map +1 -1
- package/dist/types/index.cjs +9 -0
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +586 -3
- package/dist/types/index.d.ts +586 -3
- package/dist/types/index.js +9 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +5 -3
- package/src/__tests__/dynamic-tokenomics.test.ts +358 -0
- package/src/accounts/index.ts +852 -1
- package/src/client.ts +1130 -1
- package/src/constants/index.ts +48 -2
- package/src/index.ts +58 -0
- package/src/instructions/index.ts +1383 -40
- package/src/pdas/index.ts +346 -0
- package/src/types/index.ts +698 -2
- package/src/utils/index.ts +90 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { MilestoneWithKey, InvestmentWithKey, VoteWithKey, AllocationProposalWithKey, TierConfig, FundingRoundWithKey } from './types/index.js';
|
|
2
|
+
export { AdminConfigAccount, ClaimRoundInstantTokensArgs, ClaimRoundVestedTokensArgs, CreateMilestoneArgs, DepositTokensArgs, FundingRoundAccount, FundingRoundOpenedEvent, FundingRoundState, FutureRoundVaultAccount, FutureRoundVaultWithKey, InitializeProjectArgs, InvestArgs, InvestInRoundArgs, InvestmentAccount, InvestmentMadeEvent, MilestoneAccount, MilestoneState, MilestoneVoteCastEvent, MilestoneVoteFinalizedEvent, OpenFundingRoundArgs, PivotProposalAccount, PivotState, ProjectAccount, ProjectCreatedEvent, ProjectState, ProposePivotArgs, RoundEarlyTokensClaimedEvent, RoundInstantTokensClaimedEvent, RoundInvestmentMadeEvent, RoundMilestoneConfig, RoundMilestoneFinalizedEvent, RoundMilestoneVoteEvent, RoundVestedTokensClaimedEvent, SetTgeDateArgs, TgeEscrowAccount, Tier, VoteAccount, VoteChoice, VoteOnMilestoneArgs, VoteOnRoundMilestoneArgs } from './types/index.js';
|
|
1
3
|
import { Program, AnchorProvider, BN } from '@coral-xyz/anchor';
|
|
2
4
|
export { BN } from '@coral-xyz/anchor';
|
|
3
5
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
4
6
|
import { Connection, PublicKey, Keypair, TransactionSignature } from '@solana/web3.js';
|
|
5
7
|
export { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
|
6
8
|
import { TokenomicsInput } from './instructions/index.js';
|
|
7
|
-
export { MAX_DEADLINE_DURATION_SECONDS, MIN_DEADLINE_DURATION_SECONDS_DEV, MIN_DEADLINE_DURATION_SECONDS_PROD, acceptAdmin, approvePivot, approveProject, calculateDeadline, cancelInvestment, checkAbandonment, claimExitWindowRefund, claimInvestorTokens, claimMilestoneFunds, claimMissedUnlock, claimRefund, claimTokens, claimVestedTokens, completeDistribution, createMilestone, depositTokens, distributeTokens, extendMilestoneDeadline, finalizePivot, finalizeVoting, forceCompleteDistribution, initializeAdmin, initializeFounderVesting, initializeProject, invest, minDeadline, proposePivot, releaseHoldback, reportScam, resubmitMilestone, setMilestoneDeadline, setTgeDate, submitForApproval, submitMilestone, symbolToBytes, transferAdmin, validateDeadline, voteOnMilestone, withdrawFromPivot } from './instructions/index.js';
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export { getAdminConfigPDA, getEscrowPDA, getFounderVaultPDA, getFounderVestingPDA, getInvestmentPDA, getInvestorVaultPDA, getLpTokenVaultPDA, getLpUsdcVaultPDA, getMilestonePDA, getNftMintPDA, getPivotProposalPDA, getProgramAuthorityPDA, getProjectPDA, getProjectPDAs, getScamReportPDA, getTgeEscrowPDA, getTokenMintPDA, getTokenVaultPDA, getTokenomicsPDA, getTreasuryVaultPDA, getVaultAuthorityPDA, getVotePDA } from './pdas/index.js';
|
|
12
|
-
export { accountExists, fetchAdminConfig, fetchAllInvestments, fetchAllMilestones, fetchAllVotes, fetchInvestment, fetchMilestone, fetchPivotProposal, fetchProject, fetchProjectByPda, fetchTgeEscrow, fetchVote } from './accounts/index.js';
|
|
9
|
+
export { MAX_DEADLINE_DURATION_SECONDS, MIN_DEADLINE_DURATION_SECONDS_DEV, MIN_DEADLINE_DURATION_SECONDS_PROD, acceptAdmin, approvePivot, approveProject, calculateDeadline, cancelInvestment, cancelRoundInvestment, checkAbandonment, claimExitWindowRefund, claimInvestorTokens, claimMilestoneFunds, claimMissedUnlock, claimRefund, claimRoundEarlyTokens, claimRoundInstantTokens, claimRoundMilestoneFunds, claimRoundVestedTokens, claimTokens, claimVestedTokens, completeDistribution, createMilestone, depositTokens, distributeTokens, extendMilestoneDeadline, finalizePivot, finalizeRoundVoting, finalizeVoting, forceCompleteDistribution, initializeAdmin, initializeFounderVesting, initializeProject, invest, investInRound, minDeadline, openFundingRound, proposePivot, releaseHoldback, reportScam, resubmitMilestone, setMilestoneDeadline, setTgeDate, submitForApproval, submitMilestone, submitRoundMilestone, symbolToBytes, transferAdmin, validateDeadline, 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';
|
|
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
|
|
|
15
15
|
/**
|
|
@@ -97,6 +97,12 @@ declare class RaiseClient {
|
|
|
97
97
|
getTgeEscrowPDA(projectPda: PublicKey): PublicKey;
|
|
98
98
|
getTgeEscrowVaultPDA(projectPda: PublicKey): PublicKey;
|
|
99
99
|
getAdminConfigPDA(): PublicKey;
|
|
100
|
+
getAllocationProposalPDA(projectPda: PublicKey, proposalIndex: number): PublicKey;
|
|
101
|
+
getAllocationVotePDA(proposalPda: PublicKey, nftMint: PublicKey): PublicKey;
|
|
102
|
+
getSubAllocationVestingPDA(projectPda: PublicKey, subAllocationId: number): PublicKey;
|
|
103
|
+
getTokenomicsPDA(projectPda: PublicKey): PublicKey;
|
|
104
|
+
getInvestorMilestoneVestingPDA(projectPda: PublicKey, milestoneIndex: number, investmentPda: PublicKey): PublicKey;
|
|
105
|
+
getFounderMilestoneVestingPDA(projectPda: PublicKey, milestoneIndex: number): PublicKey;
|
|
100
106
|
fetchProject(projectId: BN): Promise<any>;
|
|
101
107
|
fetchMilestone(projectId: BN, milestoneIndex: number): Promise<any>;
|
|
102
108
|
fetchAllMilestones(projectId: BN): Promise<MilestoneWithKey[]>;
|
|
@@ -107,6 +113,14 @@ declare class RaiseClient {
|
|
|
107
113
|
fetchPivotProposal(projectId: BN): Promise<any>;
|
|
108
114
|
fetchTgeEscrow(projectId: BN): Promise<any>;
|
|
109
115
|
fetchAdminConfig(): Promise<any>;
|
|
116
|
+
fetchTokenVault(projectId: BN): Promise<any>;
|
|
117
|
+
fetchTokenomics(projectId: BN): Promise<any>;
|
|
118
|
+
fetchAllocationProposal(projectId: BN, proposalIndex: number): Promise<any>;
|
|
119
|
+
fetchAllAllocationProposals(projectId: BN): Promise<AllocationProposalWithKey[]>;
|
|
120
|
+
fetchAllocationVote(projectId: BN, proposalIndex: number, nftMint: PublicKey): Promise<any>;
|
|
121
|
+
fetchSubAllocationVesting(projectId: BN, subAllocationId: number): Promise<any>;
|
|
122
|
+
fetchInvestorMilestoneVesting(projectId: BN, milestoneIndex: number, nftMint: PublicKey): Promise<any>;
|
|
123
|
+
fetchFounderMilestoneVesting(projectId: BN, milestoneIndex: number): Promise<any>;
|
|
110
124
|
initializeAdmin(admin: PublicKey): Promise<string>;
|
|
111
125
|
transferAdmin(newAdmin: PublicKey, adminKeypair: Keypair): Promise<string>;
|
|
112
126
|
acceptAdmin(): Promise<string>;
|
|
@@ -119,6 +133,8 @@ declare class RaiseClient {
|
|
|
119
133
|
tokenomics: TokenomicsInput;
|
|
120
134
|
/** Milestone 1 deadline - Unix timestamp (required) */
|
|
121
135
|
milestone1Deadline: BN;
|
|
136
|
+
/** Milestone Price Increases: Price multipliers in BPS (optional, defaults to all 10000) */
|
|
137
|
+
priceMultipliers?: number[];
|
|
122
138
|
}): Promise<string>;
|
|
123
139
|
submitForApproval(projectId: BN): Promise<string>;
|
|
124
140
|
approveProject(args: {
|
|
@@ -130,6 +146,9 @@ declare class RaiseClient {
|
|
|
130
146
|
milestoneIndex: number;
|
|
131
147
|
percentage: number;
|
|
132
148
|
description: string;
|
|
149
|
+
vestingDurationMonths?: number | null;
|
|
150
|
+
cliffMonths?: number | null;
|
|
151
|
+
instantReleaseBps?: number | null;
|
|
133
152
|
}): Promise<string>;
|
|
134
153
|
submitMilestone(projectId: BN, milestoneIndex: number): Promise<string>;
|
|
135
154
|
voteOnMilestone(args: {
|
|
@@ -338,6 +357,113 @@ declare class RaiseClient {
|
|
|
338
357
|
milestoneIndex: number;
|
|
339
358
|
claimerTokenAccount: PublicKey;
|
|
340
359
|
}): Promise<string>;
|
|
360
|
+
/**
|
|
361
|
+
* Claim early tokens as an investor (5% of token allocation)
|
|
362
|
+
*
|
|
363
|
+
* Early Token Release: Investors can claim 5% of their token allocation
|
|
364
|
+
* 24 hours after investing. These tokens are fully liquid immediately.
|
|
365
|
+
*
|
|
366
|
+
* Prerequisites:
|
|
367
|
+
* - 24h cooling period must have passed since investment
|
|
368
|
+
* - Investment must not have already claimed early tokens
|
|
369
|
+
* - Investment must have active voting rights
|
|
370
|
+
*/
|
|
371
|
+
claimEarlyTokens(args: {
|
|
372
|
+
projectId: BN;
|
|
373
|
+
nftMint: PublicKey;
|
|
374
|
+
investorTokenAccount: PublicKey;
|
|
375
|
+
}): Promise<string>;
|
|
376
|
+
/**
|
|
377
|
+
* Claim early tokens as a founder (5% of founder allocation)
|
|
378
|
+
*
|
|
379
|
+
* Early Token Release: Founders can claim 5% of their token allocation
|
|
380
|
+
* when the project becomes Funded. These tokens are fully liquid immediately.
|
|
381
|
+
*
|
|
382
|
+
* Prerequisites:
|
|
383
|
+
* - Project must be in Funded, InProgress, or Completed state
|
|
384
|
+
* - Founder must not have already claimed early tokens
|
|
385
|
+
*/
|
|
386
|
+
claimFounderEarlyTokens(args: {
|
|
387
|
+
projectId: BN;
|
|
388
|
+
founderTokenAccount: PublicKey;
|
|
389
|
+
}): Promise<string>;
|
|
390
|
+
/**
|
|
391
|
+
* Claim founder milestone-based tokens for a specific milestone
|
|
392
|
+
*
|
|
393
|
+
* Early Token Release: Founders can claim their milestone-based portion
|
|
394
|
+
* (default 47.5% of founder allocation) when milestones are unlocked.
|
|
395
|
+
*
|
|
396
|
+
* Prerequisites:
|
|
397
|
+
* - Milestone must be in Unlocked state
|
|
398
|
+
* - Founder must not have already claimed tokens for this milestone
|
|
399
|
+
*/
|
|
400
|
+
claimFounderMilestoneTokens(args: {
|
|
401
|
+
projectId: BN;
|
|
402
|
+
milestoneIndex: number;
|
|
403
|
+
founderTokenAccount: PublicKey;
|
|
404
|
+
}): Promise<string>;
|
|
405
|
+
/**
|
|
406
|
+
* Claim instant tokens for a passed milestone (investor)
|
|
407
|
+
*
|
|
408
|
+
* Per-milestone vesting: Investors claim the instant portion (e.g., 5-50%)
|
|
409
|
+
* immediately when a milestone passes. Creates vesting PDA on first claim.
|
|
410
|
+
*
|
|
411
|
+
* @param milestoneIndex - The milestone index to claim tokens from
|
|
412
|
+
* @param nftMint - The NFT mint proving investment ownership
|
|
413
|
+
* @param investorTokenAccount - Investor's token account to receive claimed tokens
|
|
414
|
+
*/
|
|
415
|
+
claimMilestoneInstantTokens(args: {
|
|
416
|
+
projectId: BN;
|
|
417
|
+
milestoneIndex: number;
|
|
418
|
+
nftMint: PublicKey;
|
|
419
|
+
investorTokenAccount: PublicKey;
|
|
420
|
+
}): Promise<string>;
|
|
421
|
+
/**
|
|
422
|
+
* Claim vested tokens for a milestone after cliff period (investor)
|
|
423
|
+
*
|
|
424
|
+
* Per-milestone vesting: Investors claim vested tokens linearly after
|
|
425
|
+
* the cliff period passes. Must have already claimed instant tokens
|
|
426
|
+
* to initialize the vesting PDA.
|
|
427
|
+
*
|
|
428
|
+
* @param milestoneIndex - The milestone index to claim vested tokens from
|
|
429
|
+
* @param nftMint - The NFT mint proving investment ownership
|
|
430
|
+
* @param investorTokenAccount - Investor's token account to receive claimed tokens
|
|
431
|
+
*/
|
|
432
|
+
claimMilestoneVestedTokens(args: {
|
|
433
|
+
projectId: BN;
|
|
434
|
+
milestoneIndex: number;
|
|
435
|
+
nftMint: PublicKey;
|
|
436
|
+
investorTokenAccount: PublicKey;
|
|
437
|
+
}): Promise<string>;
|
|
438
|
+
/**
|
|
439
|
+
* Claim instant tokens for a passed milestone (founder)
|
|
440
|
+
*
|
|
441
|
+
* Per-milestone vesting: Founders claim the instant portion (e.g., 5-50%)
|
|
442
|
+
* of their milestone-based allocation when a milestone passes.
|
|
443
|
+
*
|
|
444
|
+
* @param milestoneIndex - The milestone index to claim tokens from
|
|
445
|
+
* @param founderTokenAccount - Founder's token account to receive claimed tokens
|
|
446
|
+
*/
|
|
447
|
+
claimFounderMsInstantTokens(args: {
|
|
448
|
+
projectId: BN;
|
|
449
|
+
milestoneIndex: number;
|
|
450
|
+
founderTokenAccount: PublicKey;
|
|
451
|
+
}): Promise<string>;
|
|
452
|
+
/**
|
|
453
|
+
* Claim vested tokens for a milestone after cliff period (founder)
|
|
454
|
+
*
|
|
455
|
+
* Per-milestone vesting: Founders claim vested tokens linearly after
|
|
456
|
+
* the cliff period passes. Must have already claimed instant tokens
|
|
457
|
+
* to initialize the vesting PDA.
|
|
458
|
+
*
|
|
459
|
+
* @param milestoneIndex - The milestone index to claim vested tokens from
|
|
460
|
+
* @param founderTokenAccount - Founder's token account to receive claimed tokens
|
|
461
|
+
*/
|
|
462
|
+
claimFounderMsVestedTokens(args: {
|
|
463
|
+
projectId: BN;
|
|
464
|
+
milestoneIndex: number;
|
|
465
|
+
founderTokenAccount: PublicKey;
|
|
466
|
+
}): Promise<string>;
|
|
341
467
|
checkAbandonment(projectId: BN, milestoneIndex?: number): Promise<string>;
|
|
342
468
|
claimRefund(args: {
|
|
343
469
|
projectId: BN;
|
|
@@ -347,6 +473,439 @@ declare class RaiseClient {
|
|
|
347
473
|
escrowTokenAccount: PublicKey;
|
|
348
474
|
milestoneCount?: number;
|
|
349
475
|
}): Promise<string>;
|
|
476
|
+
/**
|
|
477
|
+
* Initialize sub-allocation vesting after MAE (Market Access Event)
|
|
478
|
+
*
|
|
479
|
+
* Creates SubAllocationVesting PDA for a specific sub-allocation ID.
|
|
480
|
+
* Project must be in Completed state with MAE completed.
|
|
481
|
+
* Permissionless - anyone can pay to initialize.
|
|
482
|
+
*/
|
|
483
|
+
initializeSubAllocationVesting(args: {
|
|
484
|
+
projectId: BN;
|
|
485
|
+
subAllocationId: number;
|
|
486
|
+
}): Promise<string>;
|
|
487
|
+
/**
|
|
488
|
+
* Claim vested tokens from a sub-allocation
|
|
489
|
+
*
|
|
490
|
+
* Only the designated recipient wallet can claim tokens.
|
|
491
|
+
* Project must be Completed and MAE must be completed.
|
|
492
|
+
*/
|
|
493
|
+
claimSubAllocationTokens(args: {
|
|
494
|
+
projectId: BN;
|
|
495
|
+
subAllocationId: number;
|
|
496
|
+
recipientTokenAccount: PublicKey;
|
|
497
|
+
}): Promise<string>;
|
|
498
|
+
/**
|
|
499
|
+
* Add a sub-allocation from the reserve pool (Draft state only)
|
|
500
|
+
*
|
|
501
|
+
* Allows founders to add named allocations (advisors, marketing, etc.)
|
|
502
|
+
* from their reserve pool before submitting for approval.
|
|
503
|
+
*/
|
|
504
|
+
addSubAllocation(args: {
|
|
505
|
+
projectId: BN;
|
|
506
|
+
name: string;
|
|
507
|
+
bps: number;
|
|
508
|
+
recipient: PublicKey;
|
|
509
|
+
vestingMonths: number;
|
|
510
|
+
cliffMonths: number;
|
|
511
|
+
}): Promise<string>;
|
|
512
|
+
/**
|
|
513
|
+
* Propose an allocation change via governance (post-Draft states)
|
|
514
|
+
*
|
|
515
|
+
* Creates a 7-day voting period for investors to approve/reject
|
|
516
|
+
* a new sub-allocation from the reserve pool.
|
|
517
|
+
*/
|
|
518
|
+
proposeAllocationChange(args: {
|
|
519
|
+
projectId: BN;
|
|
520
|
+
name: string;
|
|
521
|
+
bps: number;
|
|
522
|
+
recipient: PublicKey;
|
|
523
|
+
vestingMonths: number;
|
|
524
|
+
cliffMonths: number;
|
|
525
|
+
}): Promise<string>;
|
|
526
|
+
/**
|
|
527
|
+
* Vote on an allocation change proposal
|
|
528
|
+
*
|
|
529
|
+
* Investors can vote for/against using their Investment NFT.
|
|
530
|
+
* Must meet 7-day hold period for voting eligibility.
|
|
531
|
+
*/
|
|
532
|
+
voteAllocationChange(args: {
|
|
533
|
+
projectId: BN;
|
|
534
|
+
proposalIndex: number;
|
|
535
|
+
nftMint: PublicKey;
|
|
536
|
+
voteFor: boolean;
|
|
537
|
+
}): Promise<string>;
|
|
538
|
+
/**
|
|
539
|
+
* Execute an approved allocation change proposal
|
|
540
|
+
*
|
|
541
|
+
* Permissionless - anyone can call after voting ends.
|
|
542
|
+
* Proposal must have passed (>51% approval).
|
|
543
|
+
*/
|
|
544
|
+
executeAllocationChange(args: {
|
|
545
|
+
projectId: BN;
|
|
546
|
+
proposalIndex: number;
|
|
547
|
+
}): Promise<string>;
|
|
548
|
+
/**
|
|
549
|
+
* Get remaining founder pool capacity for sub-allocations in basis points
|
|
550
|
+
*
|
|
551
|
+
* Calculates: founder_allocation_bps - sum(sub_allocations.bps)
|
|
552
|
+
* Sub-allocations (treasury, advisors, marketing) draw from founder's allocation pool.
|
|
553
|
+
*/
|
|
554
|
+
getRemainingFounderPool(projectId: BN): Promise<number>;
|
|
555
|
+
/**
|
|
556
|
+
* Get all active (non-executed, non-expired) allocation proposals
|
|
557
|
+
*/
|
|
558
|
+
getActiveProposals(projectId: BN): Promise<AllocationProposalWithKey[]>;
|
|
559
|
+
/**
|
|
560
|
+
* Get vesting status for a sub-allocation
|
|
561
|
+
*
|
|
562
|
+
* Returns claimable amount, total vested, and remaining locked tokens.
|
|
563
|
+
*/
|
|
564
|
+
getSubAllocationVestingStatus(projectId: BN, subAllocationId: number): Promise<{
|
|
565
|
+
totalAmount: any;
|
|
566
|
+
vestedAmount: any;
|
|
567
|
+
claimedAmount: any;
|
|
568
|
+
claimableAmount: number;
|
|
569
|
+
lockedAmount: number;
|
|
570
|
+
vestingProgress: number;
|
|
571
|
+
cliffPassed: boolean;
|
|
572
|
+
} | null>;
|
|
573
|
+
/** Base price multiplier constant (10000 BPS = 1.0x) */
|
|
574
|
+
static readonly PRICE_MULTIPLIER_BASE = 10000;
|
|
575
|
+
/**
|
|
576
|
+
* Get the current price multiplier for a project
|
|
577
|
+
*
|
|
578
|
+
* Returns the multiplier in BPS (10000 = 1.0x, 15000 = 1.5x)
|
|
579
|
+
*
|
|
580
|
+
* Supports two modes:
|
|
581
|
+
* - Dynamic mode (priceMultipliers[0] === 0): Uses currentPriceMultiplierBps
|
|
582
|
+
* calculated dynamically via ZEMYTH formula at each milestone claim
|
|
583
|
+
* - Static mode (legacy): Uses pre-configured priceMultipliers array lookup
|
|
584
|
+
*/
|
|
585
|
+
getCurrentMultiplier(projectId: BN): Promise<number>;
|
|
586
|
+
/**
|
|
587
|
+
* Check if a project uses dynamic price multiplier mode
|
|
588
|
+
*/
|
|
589
|
+
isDynamicMultiplierMode(projectId: BN): Promise<boolean>;
|
|
590
|
+
/**
|
|
591
|
+
* Calculate effective tier prices with current multiplier
|
|
592
|
+
*
|
|
593
|
+
* Returns array of tiers with their effective prices after applying
|
|
594
|
+
* the current milestone multiplier.
|
|
595
|
+
*/
|
|
596
|
+
getEffectiveTierPrices(projectId: BN): Promise<Array<{
|
|
597
|
+
tierIndex: number;
|
|
598
|
+
baseAmount: BN;
|
|
599
|
+
effectiveAmount: BN;
|
|
600
|
+
multiplierBps: number;
|
|
601
|
+
}>>;
|
|
602
|
+
/**
|
|
603
|
+
* Get price schedule showing multipliers after each milestone
|
|
604
|
+
*
|
|
605
|
+
* Returns array showing what the price multiplier will be
|
|
606
|
+
* after each milestone passes.
|
|
607
|
+
*
|
|
608
|
+
* For dynamic mode projects (priceMultipliers[0] === 0), returns null
|
|
609
|
+
* as multipliers are calculated dynamically based on deadline timing.
|
|
610
|
+
*/
|
|
611
|
+
getPriceSchedule(projectId: BN): Promise<Array<{
|
|
612
|
+
afterMilestone: number;
|
|
613
|
+
multiplierBps: number;
|
|
614
|
+
multiplierPercent: number;
|
|
615
|
+
}> | null>;
|
|
616
|
+
/**
|
|
617
|
+
* Preview multiplier calculation for dynamic mode projects
|
|
618
|
+
*
|
|
619
|
+
* Uses the ZEMYTH formula to calculate what the multiplier would be
|
|
620
|
+
* given a specific number of remaining milestones and days to deadline.
|
|
621
|
+
*
|
|
622
|
+
* Formula: totalMultiplier = 1 + (sqrt(n) / sqrt(15)) × (1 / ln(d/7 + e))
|
|
623
|
+
*
|
|
624
|
+
* @param remainingMilestones Number of milestones left (1-10)
|
|
625
|
+
* @param daysToDeadline Days until next milestone deadline (1-365)
|
|
626
|
+
* @returns Preview of the multiplier in BPS (10000 = 1.0x, max 20000 = 2.0x)
|
|
627
|
+
*/
|
|
628
|
+
previewDynamicMultiplier(remainingMilestones: number, daysToDeadline: number): number;
|
|
629
|
+
/** Time factor lookup for dynamic multiplier preview (approximates 1/ln(d/7 + e) × 1000) */
|
|
630
|
+
private timeFactorLookup;
|
|
631
|
+
/** Constants for progressive pricing */
|
|
632
|
+
static readonly TIME_ALLOCATION_PERCENT = 50;
|
|
633
|
+
static readonly MILESTONE_ALLOCATION_PERCENT = 50;
|
|
634
|
+
/** DEV MODE: Time acceleration multiplier (10 real seconds = 1 simulated day) */
|
|
635
|
+
static readonly PROGRESSIVE_TIME_MULTIPLIER = 8640;
|
|
636
|
+
/**
|
|
637
|
+
* Check if progressive pricing is active for a project
|
|
638
|
+
*
|
|
639
|
+
* Progressive pricing is active when milestonePeriodStartedAt > 0,
|
|
640
|
+
* meaning the first milestone period has been initialized.
|
|
641
|
+
*/
|
|
642
|
+
isProgressivePricingActive(project: {
|
|
643
|
+
milestonePeriodStartedAt: BN;
|
|
644
|
+
}): boolean;
|
|
645
|
+
/**
|
|
646
|
+
* Calculate time progress for a milestone period
|
|
647
|
+
*
|
|
648
|
+
* @param project Project account with progressive pricing fields
|
|
649
|
+
* @param currentTime Current unix timestamp (seconds)
|
|
650
|
+
* @returns Progress as ratio 0-1 (capped at 1.0)
|
|
651
|
+
*/
|
|
652
|
+
getTimeProgress(project: {
|
|
653
|
+
milestonePeriodStartedAt: BN;
|
|
654
|
+
expectedMilestoneDeadlineTs: BN;
|
|
655
|
+
}, currentTime: number): number;
|
|
656
|
+
/**
|
|
657
|
+
* Calculate the effective multiplier including time-based component
|
|
658
|
+
*
|
|
659
|
+
* @param project Project account with progressive pricing fields
|
|
660
|
+
* @param currentTime Current unix timestamp (seconds)
|
|
661
|
+
* @returns Effective multiplier in BPS (10000 = 1.0x)
|
|
662
|
+
*/
|
|
663
|
+
calculateEffectiveMultiplier(project: {
|
|
664
|
+
milestonePeriodStartedAt: BN;
|
|
665
|
+
expectedMilestoneDeadlineTs: BN;
|
|
666
|
+
milestoneBaseMultiplierBps: number;
|
|
667
|
+
timeAllocationBps: number;
|
|
668
|
+
currentPriceMultiplierBps: number;
|
|
669
|
+
priceMultipliers: number[];
|
|
670
|
+
}, currentTime: number): number;
|
|
671
|
+
/**
|
|
672
|
+
* Preview what the milestone spike will be at a given claim time
|
|
673
|
+
*
|
|
674
|
+
* If founder claims early, unused time allocation accumulates to spike.
|
|
675
|
+
*
|
|
676
|
+
* @param project Project account with progressive pricing fields
|
|
677
|
+
* @param claimTime Unix timestamp when claim will happen
|
|
678
|
+
* @returns Object with spike details
|
|
679
|
+
*/
|
|
680
|
+
previewMilestoneSpike(project: {
|
|
681
|
+
milestonePeriodStartedAt: BN;
|
|
682
|
+
expectedMilestoneDeadlineTs: BN;
|
|
683
|
+
milestoneBaseMultiplierBps: number;
|
|
684
|
+
timeAllocationBps: number;
|
|
685
|
+
milestoneAllocationBps: number;
|
|
686
|
+
}, claimTime: number): {
|
|
687
|
+
timeProgress: number;
|
|
688
|
+
consumedTimeBps: number;
|
|
689
|
+
unusedTimeBps: number;
|
|
690
|
+
milestoneSpikeBps: number;
|
|
691
|
+
effectiveMultiplierBps: number;
|
|
692
|
+
newBaseBps: number;
|
|
693
|
+
};
|
|
694
|
+
/**
|
|
695
|
+
* Get effective tier prices with time-based progressive pricing
|
|
696
|
+
*
|
|
697
|
+
* Unlike getEffectiveTierPrices which fetches the project, this takes
|
|
698
|
+
* the project and current time to calculate prices including time component.
|
|
699
|
+
*/
|
|
700
|
+
getProgressiveTierPrices(project: {
|
|
701
|
+
tiers: Array<{
|
|
702
|
+
amount: BN;
|
|
703
|
+
}>;
|
|
704
|
+
tierCount: number;
|
|
705
|
+
milestonePeriodStartedAt: BN;
|
|
706
|
+
expectedMilestoneDeadlineTs: BN;
|
|
707
|
+
milestoneBaseMultiplierBps: number;
|
|
708
|
+
timeAllocationBps: number;
|
|
709
|
+
currentPriceMultiplierBps: number;
|
|
710
|
+
priceMultipliers: number[];
|
|
711
|
+
}, currentTime: number): Array<{
|
|
712
|
+
tierIndex: number;
|
|
713
|
+
baseAmount: BN;
|
|
714
|
+
effectiveAmount: BN;
|
|
715
|
+
multiplierBps: number;
|
|
716
|
+
timeProgressPercent: number;
|
|
717
|
+
}>;
|
|
718
|
+
getFundingRoundPDA(projectPda: PublicKey, roundNumber: number): PublicKey;
|
|
719
|
+
getRoundEscrowPDA(projectPda: PublicKey, roundNumber: number): PublicKey;
|
|
720
|
+
getRoundMilestonePDA(projectPda: PublicKey, roundNumber: number, milestoneIndex: number): PublicKey;
|
|
721
|
+
getRoundInvestmentPDA(projectPda: PublicKey, roundNumber: number, nftMint: PublicKey): PublicKey;
|
|
722
|
+
getRoundInvestorMilestoneVestingPDA(projectPda: PublicKey, roundNumber: number, milestoneIndex: number, investmentPda: PublicKey): PublicKey;
|
|
723
|
+
getFutureRoundVaultPDA(projectPda: PublicKey): PublicKey;
|
|
724
|
+
getFutureRoundTokenVaultPDA(projectPda: PublicKey): PublicKey;
|
|
725
|
+
fetchFundingRound(projectId: BN, roundNumber: number): Promise<any>;
|
|
726
|
+
fetchAllFundingRounds(projectId: BN): Promise<FundingRoundWithKey[]>;
|
|
727
|
+
fetchRoundMilestone(projectId: BN, roundNumber: number, milestoneIndex: number): Promise<any>;
|
|
728
|
+
fetchRoundInvestment(projectId: BN, roundNumber: number, nftMint: PublicKey): Promise<any>;
|
|
729
|
+
fetchFutureRoundVault(projectId: BN): Promise<any>;
|
|
730
|
+
/**
|
|
731
|
+
* Open a new funding round (R2, R3, R4...)
|
|
732
|
+
*
|
|
733
|
+
* Multi-Round Fundraising: Creates FundingRound PDA, round escrow,
|
|
734
|
+
* and milestone PDAs for the new round. Tokens come from FutureRoundVault.
|
|
735
|
+
*
|
|
736
|
+
* Prerequisites:
|
|
737
|
+
* - Project must be InProgress or Completed state
|
|
738
|
+
* - At least 1 milestone must have passed (for InProgress projects)
|
|
739
|
+
* - No other round currently Open
|
|
740
|
+
* - Current round must be fully funded before opening next
|
|
741
|
+
* - Must have future_round_allocation configured in tokenomics
|
|
742
|
+
*/
|
|
743
|
+
openFundingRound(args: {
|
|
744
|
+
projectId: BN;
|
|
745
|
+
roundAllocationBps: number;
|
|
746
|
+
fundingGoal: BN;
|
|
747
|
+
tiers: Array<{
|
|
748
|
+
amount: BN;
|
|
749
|
+
maxLots: number;
|
|
750
|
+
tokenRatio: BN;
|
|
751
|
+
}>;
|
|
752
|
+
milestones: Array<{
|
|
753
|
+
percentage: number;
|
|
754
|
+
description: string;
|
|
755
|
+
vestingDurationMonths?: number | null;
|
|
756
|
+
cliffMonths?: number | null;
|
|
757
|
+
instantReleaseBps?: number | null;
|
|
758
|
+
}>;
|
|
759
|
+
usdcMint: PublicKey;
|
|
760
|
+
previousFundingRoundPda?: PublicKey | null;
|
|
761
|
+
}): Promise<string>;
|
|
762
|
+
/**
|
|
763
|
+
* Invest in a funding round (R2, R3, R4...)
|
|
764
|
+
*
|
|
765
|
+
* Multi-Round Fundraising: Creates investment NFT and deposits USDC
|
|
766
|
+
* to the round-specific escrow. Tokens come from FutureRoundVault.
|
|
767
|
+
*/
|
|
768
|
+
investInRound(args: {
|
|
769
|
+
projectId: BN;
|
|
770
|
+
roundNumber: number;
|
|
771
|
+
amount: BN;
|
|
772
|
+
investorTokenAccount: PublicKey;
|
|
773
|
+
investmentCount: number;
|
|
774
|
+
}): Promise<string>;
|
|
775
|
+
/**
|
|
776
|
+
* Cancel round investment within 24-hour cooling-off period
|
|
777
|
+
*
|
|
778
|
+
* Multi-Round Fundraising: Returns USDC from round escrow,
|
|
779
|
+
* closes investment account.
|
|
780
|
+
*/
|
|
781
|
+
cancelRoundInvestment(args: {
|
|
782
|
+
projectId: BN;
|
|
783
|
+
roundNumber: number;
|
|
784
|
+
nftMint: PublicKey;
|
|
785
|
+
investorNftAccount: PublicKey;
|
|
786
|
+
investorUsdcAccount: PublicKey;
|
|
787
|
+
}): Promise<string>;
|
|
788
|
+
/**
|
|
789
|
+
* Submit round milestone for investor review
|
|
790
|
+
*
|
|
791
|
+
* Multi-Round Fundraising: Transitions milestone to UnderReview,
|
|
792
|
+
* sets voting deadline.
|
|
793
|
+
*/
|
|
794
|
+
submitRoundMilestone(args: {
|
|
795
|
+
projectId: BN;
|
|
796
|
+
roundNumber: number;
|
|
797
|
+
milestoneIndex: number;
|
|
798
|
+
}): Promise<string>;
|
|
799
|
+
/**
|
|
800
|
+
* Vote on a round milestone (unified voting - ANY investor can vote)
|
|
801
|
+
*
|
|
802
|
+
* Multi-Round Fundraising: R1, R2, R3... investors can all vote
|
|
803
|
+
* on any round's milestones. Investment can be from any round.
|
|
804
|
+
*/
|
|
805
|
+
voteOnRoundMilestone(args: {
|
|
806
|
+
projectId: BN;
|
|
807
|
+
roundNumber: number;
|
|
808
|
+
milestoneIndex: number;
|
|
809
|
+
nftMint: PublicKey | string;
|
|
810
|
+
choice: {
|
|
811
|
+
good: object;
|
|
812
|
+
} | {
|
|
813
|
+
bad: object;
|
|
814
|
+
};
|
|
815
|
+
investmentRoundNumber: number;
|
|
816
|
+
}): Promise<string>;
|
|
817
|
+
/**
|
|
818
|
+
* Finalize voting on a round milestone
|
|
819
|
+
*
|
|
820
|
+
* Multi-Round Fundraising: Processes vote results, transitions
|
|
821
|
+
* milestone to Passed or Failed state.
|
|
822
|
+
*/
|
|
823
|
+
finalizeRoundVoting(args: {
|
|
824
|
+
projectId: BN;
|
|
825
|
+
roundNumber: number;
|
|
826
|
+
milestoneIndex: number;
|
|
827
|
+
}): Promise<string>;
|
|
828
|
+
/**
|
|
829
|
+
* Claim milestone funds from a round (founder)
|
|
830
|
+
*
|
|
831
|
+
* Multi-Round Fundraising: Transfers USDC from round escrow
|
|
832
|
+
* to founder's account.
|
|
833
|
+
*
|
|
834
|
+
* @param nextMilestoneDeadline - Deadline for next milestone (required for non-final)
|
|
835
|
+
* Set to BN(0) for final milestone claims
|
|
836
|
+
*/
|
|
837
|
+
claimRoundMilestoneFunds(args: {
|
|
838
|
+
projectId: BN;
|
|
839
|
+
roundNumber: number;
|
|
840
|
+
milestoneIndex: number;
|
|
841
|
+
founderUsdcAccount: PublicKey;
|
|
842
|
+
nextMilestoneDeadline: BN;
|
|
843
|
+
}): Promise<string>;
|
|
844
|
+
/**
|
|
845
|
+
* Claim instant tokens for a round milestone (investor)
|
|
846
|
+
*
|
|
847
|
+
* Multi-Round Fundraising: R2+ investors claim instant portion
|
|
848
|
+
* when milestone passes. Tokens come from FutureRoundVault.
|
|
849
|
+
*/
|
|
850
|
+
claimRoundInstantTokens(args: {
|
|
851
|
+
projectId: BN;
|
|
852
|
+
roundNumber: number;
|
|
853
|
+
milestoneIndex: number;
|
|
854
|
+
nftMint: PublicKey;
|
|
855
|
+
investorTokenAccount: PublicKey;
|
|
856
|
+
}): Promise<string>;
|
|
857
|
+
/**
|
|
858
|
+
* Claim vested tokens for a round milestone (investor)
|
|
859
|
+
*
|
|
860
|
+
* Multi-Round Fundraising: R2+ investors claim vested portion
|
|
861
|
+
* after cliff period. Tokens come from FutureRoundVault.
|
|
862
|
+
*/
|
|
863
|
+
claimRoundVestedTokens(args: {
|
|
864
|
+
projectId: BN;
|
|
865
|
+
roundNumber: number;
|
|
866
|
+
milestoneIndex: number;
|
|
867
|
+
nftMint: PublicKey;
|
|
868
|
+
investorTokenAccount: PublicKey;
|
|
869
|
+
}): Promise<string>;
|
|
870
|
+
/**
|
|
871
|
+
* Claim early tokens for a round investment (5% after 24h)
|
|
872
|
+
*
|
|
873
|
+
* Multi-Round Fundraising: R2+ investors claim 5% of token allocation
|
|
874
|
+
* 24 hours after investing. Tokens come from FutureRoundVault.
|
|
875
|
+
*/
|
|
876
|
+
claimRoundEarlyTokens(args: {
|
|
877
|
+
projectId: BN;
|
|
878
|
+
roundNumber: number;
|
|
879
|
+
nftMint: PublicKey;
|
|
880
|
+
investorTokenAccount: PublicKey;
|
|
881
|
+
}): Promise<string>;
|
|
882
|
+
/**
|
|
883
|
+
* Check if the next funding round can be opened
|
|
884
|
+
*
|
|
885
|
+
* Returns eligibility status with reason and next round number.
|
|
886
|
+
*/
|
|
887
|
+
canOpenNextRound(projectId: BN): Promise<{
|
|
888
|
+
canOpen: boolean;
|
|
889
|
+
reason?: string;
|
|
890
|
+
nextRoundNumber?: number;
|
|
891
|
+
}>;
|
|
892
|
+
/**
|
|
893
|
+
* Get remaining future round allocation in BPS
|
|
894
|
+
*/
|
|
895
|
+
getRemainingFutureRoundAllocation(tokenomics: {
|
|
896
|
+
futureRoundAllocationBps: number;
|
|
897
|
+
usedFutureRoundBps?: number;
|
|
898
|
+
}): number;
|
|
899
|
+
/**
|
|
900
|
+
* Check if a specific round is fully funded
|
|
901
|
+
*/
|
|
902
|
+
isRoundFullyFunded(projectId: BN, roundNumber: number): Promise<boolean>;
|
|
903
|
+
/**
|
|
904
|
+
* Get round details with computed state
|
|
905
|
+
*
|
|
906
|
+
* Returns funding round data with additional computed fields.
|
|
907
|
+
*/
|
|
908
|
+
getRoundDetails(projectId: BN, roundNumber: number): Promise<any>;
|
|
350
909
|
}
|
|
351
910
|
|
|
352
911
|
/**
|
|
@@ -677,4 +1236,4 @@ declare function isValidPublicKey(pubkey: string | PublicKey): boolean;
|
|
|
677
1236
|
*/
|
|
678
1237
|
declare function shortenPublicKey(pubkey: PublicKey | string, chars?: number): string;
|
|
679
1238
|
|
|
680
|
-
export { EVENT_NAMES, type InvestmentMadeEvent as InvestmentMadeEventType, InvestmentWithKey, type MilestoneReworkedEvent as MilestoneReworkedEventType, type MilestoneVoteFinalizedEvent as MilestoneVoteFinalizedEventType, MilestoneWithKey, type ProjectCreatedEvent as ProjectCreatedEventType, RaiseClient, type RaiseEvent, TierConfig, TokenomicsInput, VoteWithKey, type Wallet, bigIntToBN, bnToBigInt, bnToNumber, bpsToPercent, confirmTransaction, filterEventsByName, findEvent, formatDuration, getCurrentTimestamp, getTransactionWithRetry, hasTimestampPassed, isValidPublicKey, percentToBps, percentageOf, shortenPublicKey, timeRemaining, timestampToDate, validateMetadataUri, validateMilestonePercentages };
|
|
1239
|
+
export { EVENT_NAMES, FundingRoundWithKey, type InvestmentMadeEvent as InvestmentMadeEventType, InvestmentWithKey, type MilestoneReworkedEvent as MilestoneReworkedEventType, type MilestoneVoteFinalizedEvent as MilestoneVoteFinalizedEventType, MilestoneWithKey, type ProjectCreatedEvent as ProjectCreatedEventType, RaiseClient, type RaiseEvent, TierConfig, TokenomicsInput, VoteWithKey, type Wallet, bigIntToBN, bnToBigInt, bnToNumber, bpsToPercent, confirmTransaction, filterEventsByName, findEvent, formatDuration, getCurrentTimestamp, getTransactionWithRetry, hasTimestampPassed, isValidPublicKey, percentToBps, percentageOf, shortenPublicKey, timeRemaining, timestampToDate, validateMetadataUri, validateMilestonePercentages };
|