@zemyth/raise-sdk 0.1.2 → 0.1.4

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.
Files changed (47) hide show
  1. package/README.md +9 -7
  2. package/dist/accounts/index.cjs +531 -3
  3. package/dist/accounts/index.cjs.map +1 -1
  4. package/dist/accounts/index.d.cts +307 -2
  5. package/dist/accounts/index.d.ts +307 -2
  6. package/dist/accounts/index.js +503 -4
  7. package/dist/accounts/index.js.map +1 -1
  8. package/dist/constants/index.cjs +41 -3
  9. package/dist/constants/index.cjs.map +1 -1
  10. package/dist/constants/index.d.cts +38 -3
  11. package/dist/constants/index.d.ts +38 -3
  12. package/dist/constants/index.js +40 -4
  13. package/dist/constants/index.js.map +1 -1
  14. package/dist/index.cjs +2309 -353
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +574 -7
  17. package/dist/index.d.ts +574 -7
  18. package/dist/index.js +2284 -377
  19. package/dist/index.js.map +1 -1
  20. package/dist/instructions/index.cjs +783 -40
  21. package/dist/instructions/index.cjs.map +1 -1
  22. package/dist/instructions/index.d.cts +492 -6
  23. package/dist/instructions/index.d.ts +492 -6
  24. package/dist/instructions/index.js +762 -42
  25. package/dist/instructions/index.js.map +1 -1
  26. package/dist/pdas/index.cjs +163 -1
  27. package/dist/pdas/index.cjs.map +1 -1
  28. package/dist/pdas/index.d.cts +131 -1
  29. package/dist/pdas/index.d.ts +131 -1
  30. package/dist/pdas/index.js +151 -2
  31. package/dist/pdas/index.js.map +1 -1
  32. package/dist/types/index.cjs +9 -0
  33. package/dist/types/index.cjs.map +1 -1
  34. package/dist/types/index.d.cts +586 -3
  35. package/dist/types/index.d.ts +586 -3
  36. package/dist/types/index.js +9 -1
  37. package/dist/types/index.js.map +1 -1
  38. package/package.json +7 -2
  39. package/src/__tests__/dynamic-tokenomics.test.ts +358 -0
  40. package/src/accounts/index.ts +852 -1
  41. package/src/client.ts +1145 -1
  42. package/src/constants/index.ts +48 -2
  43. package/src/index.ts +74 -0
  44. package/src/instructions/index.ts +1383 -40
  45. package/src/pdas/index.ts +346 -0
  46. package/src/types/index.ts +698 -2
  47. package/src/utils/index.ts +90 -0
package/dist/index.d.cts CHANGED
@@ -1,15 +1,15 @@
1
+ import { MilestoneWithKey, InvestmentWithKey, VoteWithKey, AllocationProposalWithKey, TierConfig, FundingRoundWithKey } from './types/index.cjs';
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.cjs';
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.cjs';
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.cjs';
8
- import { MilestoneWithKey, InvestmentWithKey, VoteWithKey, TierConfig } from './types/index.cjs';
9
- export { AdminConfigAccount, CreateMilestoneArgs, DepositTokensArgs, InitializeProjectArgs, InvestArgs, InvestmentAccount, InvestmentMadeEvent, MilestoneAccount, MilestoneState, MilestoneVoteCastEvent, MilestoneVoteFinalizedEvent, PivotProposalAccount, PivotState, ProjectAccount, ProjectCreatedEvent, ProjectState, ProposePivotArgs, SetTgeDateArgs, TgeEscrowAccount, Tier, VoteAccount, VoteChoice, VoteOnMilestoneArgs } from './types/index.cjs';
10
- export { GOVERNANCE, InvestmentTier, NFT, SEEDS, TIER_CONSTRAINTS, TIER_MINIMUMS, TIER_TOKEN_MULTIPLIERS, TIER_VOTE_MULTIPLIERS, TIMING, USDC, VALIDATION, findTierIndex, getTierFromAmount, getTokenMultiplier, getVoteMultiplier } from './constants/index.cjs';
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.cjs';
12
- export { accountExists, fetchAdminConfig, fetchAllInvestments, fetchAllMilestones, fetchAllVotes, fetchInvestment, fetchMilestone, fetchPivotProposal, fetchProject, fetchProjectByPda, fetchTgeEscrow, fetchVote } from './accounts/index.cjs';
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';
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
 
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,447 @@ declare class RaiseClient {
347
473
  escrowTokenAccount: PublicKey;
348
474
  milestoneCount?: number;
349
475
  }): Promise<string>;
476
+ claimExitWindowRefund(args: {
477
+ projectId: BN;
478
+ nftMint: PublicKey;
479
+ investorNftAccount: PublicKey;
480
+ escrowTokenAccount: PublicKey;
481
+ investorTokenAccount: PublicKey;
482
+ milestoneAccounts?: PublicKey[];
483
+ }): Promise<string>;
484
+ /**
485
+ * Initialize sub-allocation vesting after MAE (Market Access Event)
486
+ *
487
+ * Creates SubAllocationVesting PDA for a specific sub-allocation ID.
488
+ * Project must be in Completed state with MAE completed.
489
+ * Permissionless - anyone can pay to initialize.
490
+ */
491
+ initializeSubAllocationVesting(args: {
492
+ projectId: BN;
493
+ subAllocationId: number;
494
+ }): Promise<string>;
495
+ /**
496
+ * Claim vested tokens from a sub-allocation
497
+ *
498
+ * Only the designated recipient wallet can claim tokens.
499
+ * Project must be Completed and MAE must be completed.
500
+ */
501
+ claimSubAllocationTokens(args: {
502
+ projectId: BN;
503
+ subAllocationId: number;
504
+ recipientTokenAccount: PublicKey;
505
+ }): Promise<string>;
506
+ /**
507
+ * Add a sub-allocation from the reserve pool (Draft state only)
508
+ *
509
+ * Allows founders to add named allocations (advisors, marketing, etc.)
510
+ * from their reserve pool before submitting for approval.
511
+ */
512
+ addSubAllocation(args: {
513
+ projectId: BN;
514
+ name: string;
515
+ bps: number;
516
+ recipient: PublicKey;
517
+ vestingMonths: number;
518
+ cliffMonths: number;
519
+ }): Promise<string>;
520
+ /**
521
+ * Propose an allocation change via governance (post-Draft states)
522
+ *
523
+ * Creates a 7-day voting period for investors to approve/reject
524
+ * a new sub-allocation from the reserve pool.
525
+ */
526
+ proposeAllocationChange(args: {
527
+ projectId: BN;
528
+ name: string;
529
+ bps: number;
530
+ recipient: PublicKey;
531
+ vestingMonths: number;
532
+ cliffMonths: number;
533
+ }): Promise<string>;
534
+ /**
535
+ * Vote on an allocation change proposal
536
+ *
537
+ * Investors can vote for/against using their Investment NFT.
538
+ * Must meet 7-day hold period for voting eligibility.
539
+ */
540
+ voteAllocationChange(args: {
541
+ projectId: BN;
542
+ proposalIndex: number;
543
+ nftMint: PublicKey;
544
+ voteFor: boolean;
545
+ }): Promise<string>;
546
+ /**
547
+ * Execute an approved allocation change proposal
548
+ *
549
+ * Permissionless - anyone can call after voting ends.
550
+ * Proposal must have passed (>51% approval).
551
+ */
552
+ executeAllocationChange(args: {
553
+ projectId: BN;
554
+ proposalIndex: number;
555
+ }): Promise<string>;
556
+ /**
557
+ * Get remaining founder pool capacity for sub-allocations in basis points
558
+ *
559
+ * Calculates: founder_allocation_bps - sum(sub_allocations.bps)
560
+ * Sub-allocations (treasury, advisors, marketing) draw from founder's allocation pool.
561
+ */
562
+ getRemainingFounderPool(projectId: BN): Promise<number>;
563
+ /**
564
+ * Get all active (non-executed, non-expired) allocation proposals
565
+ */
566
+ getActiveProposals(projectId: BN): Promise<AllocationProposalWithKey[]>;
567
+ /**
568
+ * Get vesting status for a sub-allocation
569
+ *
570
+ * Returns claimable amount, total vested, and remaining locked tokens.
571
+ */
572
+ getSubAllocationVestingStatus(projectId: BN, subAllocationId: number): Promise<{
573
+ totalAmount: any;
574
+ vestedAmount: any;
575
+ claimedAmount: any;
576
+ claimableAmount: number;
577
+ lockedAmount: number;
578
+ vestingProgress: number;
579
+ cliffPassed: boolean;
580
+ } | null>;
581
+ /** Base price multiplier constant (10000 BPS = 1.0x) */
582
+ static readonly PRICE_MULTIPLIER_BASE = 10000;
583
+ /**
584
+ * Get the current price multiplier for a project
585
+ *
586
+ * Returns the multiplier in BPS (10000 = 1.0x, 15000 = 1.5x)
587
+ *
588
+ * Supports two modes:
589
+ * - Dynamic mode (priceMultipliers[0] === 0): Uses currentPriceMultiplierBps
590
+ * calculated dynamically via ZEMYTH formula at each milestone claim
591
+ * - Static mode (legacy): Uses pre-configured priceMultipliers array lookup
592
+ */
593
+ getCurrentMultiplier(projectId: BN): Promise<number>;
594
+ /**
595
+ * Check if a project uses dynamic price multiplier mode
596
+ */
597
+ isDynamicMultiplierMode(projectId: BN): Promise<boolean>;
598
+ /**
599
+ * Calculate effective tier prices with current multiplier
600
+ *
601
+ * Returns array of tiers with their effective prices after applying
602
+ * the current milestone multiplier.
603
+ */
604
+ getEffectiveTierPrices(projectId: BN): Promise<Array<{
605
+ tierIndex: number;
606
+ baseAmount: BN;
607
+ effectiveAmount: BN;
608
+ multiplierBps: number;
609
+ }>>;
610
+ /**
611
+ * Get price schedule showing multipliers after each milestone
612
+ *
613
+ * Returns array showing what the price multiplier will be
614
+ * after each milestone passes.
615
+ *
616
+ * For dynamic mode projects (priceMultipliers[0] === 0), returns null
617
+ * as multipliers are calculated dynamically based on deadline timing.
618
+ */
619
+ getPriceSchedule(projectId: BN): Promise<Array<{
620
+ afterMilestone: number;
621
+ multiplierBps: number;
622
+ multiplierPercent: number;
623
+ }> | null>;
624
+ /**
625
+ * Preview multiplier calculation for dynamic mode projects
626
+ *
627
+ * Uses the ZEMYTH formula to calculate what the multiplier would be
628
+ * given a specific number of remaining milestones and days to deadline.
629
+ *
630
+ * Formula: totalMultiplier = 1 + (sqrt(n) / sqrt(15)) × (1 / ln(d/7 + e))
631
+ *
632
+ * @param remainingMilestones Number of milestones left (1-10)
633
+ * @param daysToDeadline Days until next milestone deadline (1-365)
634
+ * @returns Preview of the multiplier in BPS (10000 = 1.0x, max 20000 = 2.0x)
635
+ */
636
+ previewDynamicMultiplier(remainingMilestones: number, daysToDeadline: number): number;
637
+ /** Time factor lookup for dynamic multiplier preview (approximates 1/ln(d/7 + e) × 1000) */
638
+ private timeFactorLookup;
639
+ /** Constants for progressive pricing */
640
+ static readonly TIME_ALLOCATION_PERCENT = 50;
641
+ static readonly MILESTONE_ALLOCATION_PERCENT = 50;
642
+ /** DEV MODE: Time acceleration multiplier (10 real seconds = 1 simulated day) */
643
+ static readonly PROGRESSIVE_TIME_MULTIPLIER = 8640;
644
+ /**
645
+ * Check if progressive pricing is active for a project
646
+ *
647
+ * Progressive pricing is active when milestonePeriodStartedAt > 0,
648
+ * meaning the first milestone period has been initialized.
649
+ */
650
+ isProgressivePricingActive(project: {
651
+ milestonePeriodStartedAt: BN;
652
+ }): boolean;
653
+ /**
654
+ * Calculate time progress for a milestone period
655
+ *
656
+ * @param project Project account with progressive pricing fields
657
+ * @param currentTime Current unix timestamp (seconds)
658
+ * @returns Progress as ratio 0-1 (capped at 1.0)
659
+ */
660
+ getTimeProgress(project: {
661
+ milestonePeriodStartedAt: BN;
662
+ expectedMilestoneDeadlineTs: BN;
663
+ }, currentTime: number): number;
664
+ /**
665
+ * Calculate the effective multiplier including time-based component
666
+ *
667
+ * @param project Project account with progressive pricing fields
668
+ * @param currentTime Current unix timestamp (seconds)
669
+ * @returns Effective multiplier in BPS (10000 = 1.0x)
670
+ */
671
+ calculateEffectiveMultiplier(project: {
672
+ milestonePeriodStartedAt: BN;
673
+ expectedMilestoneDeadlineTs: BN;
674
+ milestoneBaseMultiplierBps: number;
675
+ timeAllocationBps: number;
676
+ currentPriceMultiplierBps: number;
677
+ priceMultipliers: number[];
678
+ }, currentTime: number): number;
679
+ /**
680
+ * Preview what the milestone spike will be at a given claim time
681
+ *
682
+ * If founder claims early, unused time allocation accumulates to spike.
683
+ *
684
+ * @param project Project account with progressive pricing fields
685
+ * @param claimTime Unix timestamp when claim will happen
686
+ * @returns Object with spike details
687
+ */
688
+ previewMilestoneSpike(project: {
689
+ milestonePeriodStartedAt: BN;
690
+ expectedMilestoneDeadlineTs: BN;
691
+ milestoneBaseMultiplierBps: number;
692
+ timeAllocationBps: number;
693
+ milestoneAllocationBps: number;
694
+ }, claimTime: number): {
695
+ timeProgress: number;
696
+ consumedTimeBps: number;
697
+ unusedTimeBps: number;
698
+ milestoneSpikeBps: number;
699
+ effectiveMultiplierBps: number;
700
+ newBaseBps: number;
701
+ };
702
+ /**
703
+ * Get effective tier prices with time-based progressive pricing
704
+ *
705
+ * Unlike getEffectiveTierPrices which fetches the project, this takes
706
+ * the project and current time to calculate prices including time component.
707
+ */
708
+ getProgressiveTierPrices(project: {
709
+ tiers: Array<{
710
+ amount: BN;
711
+ }>;
712
+ tierCount: number;
713
+ milestonePeriodStartedAt: BN;
714
+ expectedMilestoneDeadlineTs: BN;
715
+ milestoneBaseMultiplierBps: number;
716
+ timeAllocationBps: number;
717
+ currentPriceMultiplierBps: number;
718
+ priceMultipliers: number[];
719
+ }, currentTime: number): Array<{
720
+ tierIndex: number;
721
+ baseAmount: BN;
722
+ effectiveAmount: BN;
723
+ multiplierBps: number;
724
+ timeProgressPercent: number;
725
+ }>;
726
+ getFundingRoundPDA(projectPda: PublicKey, roundNumber: number): PublicKey;
727
+ getRoundEscrowPDA(projectPda: PublicKey, roundNumber: number): PublicKey;
728
+ getRoundMilestonePDA(projectPda: PublicKey, roundNumber: number, milestoneIndex: number): PublicKey;
729
+ getRoundInvestmentPDA(projectPda: PublicKey, roundNumber: number, nftMint: PublicKey): PublicKey;
730
+ getRoundInvestorMilestoneVestingPDA(projectPda: PublicKey, roundNumber: number, milestoneIndex: number, investmentPda: PublicKey): PublicKey;
731
+ getFutureRoundVaultPDA(projectPda: PublicKey): PublicKey;
732
+ getFutureRoundTokenVaultPDA(projectPda: PublicKey): PublicKey;
733
+ fetchFundingRound(projectId: BN, roundNumber: number): Promise<any>;
734
+ fetchAllFundingRounds(projectId: BN): Promise<FundingRoundWithKey[]>;
735
+ fetchRoundMilestone(projectId: BN, roundNumber: number, milestoneIndex: number): Promise<any>;
736
+ fetchRoundInvestment(projectId: BN, roundNumber: number, nftMint: PublicKey): Promise<any>;
737
+ fetchFutureRoundVault(projectId: BN): Promise<any>;
738
+ /**
739
+ * Open a new funding round (R2, R3, R4...)
740
+ *
741
+ * Multi-Round Fundraising: Creates FundingRound PDA, round escrow,
742
+ * and milestone PDAs for the new round. Tokens come from FutureRoundVault.
743
+ *
744
+ * Prerequisites:
745
+ * - Project must be InProgress or Completed state
746
+ * - At least 1 milestone must have passed (for InProgress projects)
747
+ * - No other round currently Open
748
+ * - Current round must be fully funded before opening next
749
+ * - Must have future_round_allocation configured in tokenomics
750
+ */
751
+ openFundingRound(args: {
752
+ projectId: BN;
753
+ roundAllocationBps: number;
754
+ fundingGoal: BN;
755
+ tiers: Array<{
756
+ amount: BN;
757
+ maxLots: number;
758
+ tokenRatio: BN;
759
+ }>;
760
+ milestones: Array<{
761
+ percentage: number;
762
+ description: string;
763
+ vestingDurationMonths?: number | null;
764
+ cliffMonths?: number | null;
765
+ instantReleaseBps?: number | null;
766
+ }>;
767
+ usdcMint: PublicKey;
768
+ previousFundingRoundPda?: PublicKey | null;
769
+ }): Promise<string>;
770
+ /**
771
+ * Invest in a funding round (R2, R3, R4...)
772
+ *
773
+ * Multi-Round Fundraising: Creates investment NFT and deposits USDC
774
+ * to the round-specific escrow. Tokens come from FutureRoundVault.
775
+ */
776
+ investInRound(args: {
777
+ projectId: BN;
778
+ roundNumber: number;
779
+ amount: BN;
780
+ investorTokenAccount: PublicKey;
781
+ investmentCount: number;
782
+ }): Promise<string>;
783
+ /**
784
+ * Cancel round investment within 24-hour cooling-off period
785
+ *
786
+ * Multi-Round Fundraising: Returns USDC from round escrow,
787
+ * closes investment account.
788
+ */
789
+ cancelRoundInvestment(args: {
790
+ projectId: BN;
791
+ roundNumber: number;
792
+ nftMint: PublicKey;
793
+ investorNftAccount: PublicKey;
794
+ investorUsdcAccount: PublicKey;
795
+ }): Promise<string>;
796
+ /**
797
+ * Submit round milestone for investor review
798
+ *
799
+ * Multi-Round Fundraising: Transitions milestone to UnderReview,
800
+ * sets voting deadline.
801
+ */
802
+ submitRoundMilestone(args: {
803
+ projectId: BN;
804
+ roundNumber: number;
805
+ milestoneIndex: number;
806
+ }): Promise<string>;
807
+ /**
808
+ * Vote on a round milestone (unified voting - ANY investor can vote)
809
+ *
810
+ * Multi-Round Fundraising: R1, R2, R3... investors can all vote
811
+ * on any round's milestones. Investment can be from any round.
812
+ */
813
+ voteOnRoundMilestone(args: {
814
+ projectId: BN;
815
+ roundNumber: number;
816
+ milestoneIndex: number;
817
+ nftMint: PublicKey | string;
818
+ choice: {
819
+ good: object;
820
+ } | {
821
+ bad: object;
822
+ };
823
+ investmentRoundNumber: number;
824
+ }): Promise<string>;
825
+ /**
826
+ * Finalize voting on a round milestone
827
+ *
828
+ * Multi-Round Fundraising: Processes vote results, transitions
829
+ * milestone to Passed or Failed state.
830
+ */
831
+ finalizeRoundVoting(args: {
832
+ projectId: BN;
833
+ roundNumber: number;
834
+ milestoneIndex: number;
835
+ }): Promise<string>;
836
+ /**
837
+ * Claim milestone funds from a round (founder)
838
+ *
839
+ * Multi-Round Fundraising: Transfers USDC from round escrow
840
+ * to founder's account.
841
+ *
842
+ * @param nextMilestoneDeadline - Deadline for next milestone (required for non-final)
843
+ * Set to BN(0) for final milestone claims
844
+ */
845
+ claimRoundMilestoneFunds(args: {
846
+ projectId: BN;
847
+ roundNumber: number;
848
+ milestoneIndex: number;
849
+ founderUsdcAccount: PublicKey;
850
+ nextMilestoneDeadline: BN;
851
+ }): Promise<string>;
852
+ /**
853
+ * Claim instant tokens for a round milestone (investor)
854
+ *
855
+ * Multi-Round Fundraising: R2+ investors claim instant portion
856
+ * when milestone passes. Tokens come from FutureRoundVault.
857
+ */
858
+ claimRoundInstantTokens(args: {
859
+ projectId: BN;
860
+ roundNumber: number;
861
+ milestoneIndex: number;
862
+ nftMint: PublicKey;
863
+ investorTokenAccount: PublicKey;
864
+ }): Promise<string>;
865
+ /**
866
+ * Claim vested tokens for a round milestone (investor)
867
+ *
868
+ * Multi-Round Fundraising: R2+ investors claim vested portion
869
+ * after cliff period. Tokens come from FutureRoundVault.
870
+ */
871
+ claimRoundVestedTokens(args: {
872
+ projectId: BN;
873
+ roundNumber: number;
874
+ milestoneIndex: number;
875
+ nftMint: PublicKey;
876
+ investorTokenAccount: PublicKey;
877
+ }): Promise<string>;
878
+ /**
879
+ * Claim early tokens for a round investment (5% after 24h)
880
+ *
881
+ * Multi-Round Fundraising: R2+ investors claim 5% of token allocation
882
+ * 24 hours after investing. Tokens come from FutureRoundVault.
883
+ */
884
+ claimRoundEarlyTokens(args: {
885
+ projectId: BN;
886
+ roundNumber: number;
887
+ nftMint: PublicKey;
888
+ investorTokenAccount: PublicKey;
889
+ }): Promise<string>;
890
+ /**
891
+ * Check if the next funding round can be opened
892
+ *
893
+ * Returns eligibility status with reason and next round number.
894
+ */
895
+ canOpenNextRound(projectId: BN): Promise<{
896
+ canOpen: boolean;
897
+ reason?: string;
898
+ nextRoundNumber?: number;
899
+ }>;
900
+ /**
901
+ * Get remaining future round allocation in BPS
902
+ */
903
+ getRemainingFutureRoundAllocation(tokenomics: {
904
+ futureRoundAllocationBps: number;
905
+ usedFutureRoundBps?: number;
906
+ }): number;
907
+ /**
908
+ * Check if a specific round is fully funded
909
+ */
910
+ isRoundFullyFunded(projectId: BN, roundNumber: number): Promise<boolean>;
911
+ /**
912
+ * Get round details with computed state
913
+ *
914
+ * Returns funding round data with additional computed fields.
915
+ */
916
+ getRoundDetails(projectId: BN, roundNumber: number): Promise<any>;
350
917
  }
351
918
 
352
919
  /**
@@ -677,4 +1244,4 @@ declare function isValidPublicKey(pubkey: string | PublicKey): boolean;
677
1244
  */
678
1245
  declare function shortenPublicKey(pubkey: PublicKey | string, chars?: number): string;
679
1246
 
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 };
1247
+ 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 };