@zemyth/raise-sdk 0.1.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.
Files changed (54) hide show
  1. package/README.md +416 -0
  2. package/dist/accounts/index.cjs +258 -0
  3. package/dist/accounts/index.cjs.map +1 -0
  4. package/dist/accounts/index.d.cts +115 -0
  5. package/dist/accounts/index.d.ts +115 -0
  6. package/dist/accounts/index.js +245 -0
  7. package/dist/accounts/index.js.map +1 -0
  8. package/dist/constants/index.cjs +174 -0
  9. package/dist/constants/index.cjs.map +1 -0
  10. package/dist/constants/index.d.cts +143 -0
  11. package/dist/constants/index.d.ts +143 -0
  12. package/dist/constants/index.js +158 -0
  13. package/dist/constants/index.js.map +1 -0
  14. package/dist/errors/index.cjs +177 -0
  15. package/dist/errors/index.cjs.map +1 -0
  16. package/dist/errors/index.d.cts +83 -0
  17. package/dist/errors/index.d.ts +83 -0
  18. package/dist/errors/index.js +170 -0
  19. package/dist/errors/index.js.map +1 -0
  20. package/dist/index.cjs +2063 -0
  21. package/dist/index.cjs.map +1 -0
  22. package/dist/index.d.cts +680 -0
  23. package/dist/index.d.ts +680 -0
  24. package/dist/index.js +1926 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/instructions/index.cjs +852 -0
  27. package/dist/instructions/index.cjs.map +1 -0
  28. package/dist/instructions/index.d.cts +452 -0
  29. package/dist/instructions/index.d.ts +452 -0
  30. package/dist/instructions/index.js +809 -0
  31. package/dist/instructions/index.js.map +1 -0
  32. package/dist/pdas/index.cjs +241 -0
  33. package/dist/pdas/index.cjs.map +1 -0
  34. package/dist/pdas/index.d.cts +171 -0
  35. package/dist/pdas/index.d.ts +171 -0
  36. package/dist/pdas/index.js +217 -0
  37. package/dist/pdas/index.js.map +1 -0
  38. package/dist/types/index.cjs +44 -0
  39. package/dist/types/index.cjs.map +1 -0
  40. package/dist/types/index.d.cts +229 -0
  41. package/dist/types/index.d.ts +229 -0
  42. package/dist/types/index.js +39 -0
  43. package/dist/types/index.js.map +1 -0
  44. package/package.json +130 -0
  45. package/src/accounts/index.ts +329 -0
  46. package/src/client.ts +715 -0
  47. package/src/constants/index.ts +205 -0
  48. package/src/errors/index.ts +222 -0
  49. package/src/events/index.ts +256 -0
  50. package/src/index.ts +253 -0
  51. package/src/instructions/index.ts +1504 -0
  52. package/src/pdas/index.ts +404 -0
  53. package/src/types/index.ts +267 -0
  54. package/src/utils/index.ts +277 -0
package/src/index.ts ADDED
@@ -0,0 +1,253 @@
1
+ /**
2
+ * @raise/sdk
3
+ *
4
+ * TypeScript SDK for the Raise Solana program.
5
+ * A decentralized venture funding platform with milestone-based releases.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+
10
+ // =============================================================================
11
+ // Main Client
12
+ // =============================================================================
13
+
14
+ export { RaiseClient } from './client.js';
15
+ export type { Wallet } from './client.js';
16
+
17
+ // =============================================================================
18
+ // Constants
19
+ // =============================================================================
20
+
21
+ export {
22
+ SEEDS,
23
+ VALIDATION,
24
+ TIMING,
25
+ TIER_CONSTRAINTS,
26
+ InvestmentTier,
27
+ TIER_MINIMUMS,
28
+ TIER_VOTE_MULTIPLIERS,
29
+ TIER_TOKEN_MULTIPLIERS,
30
+ getTierFromAmount,
31
+ getVoteMultiplier,
32
+ getTokenMultiplier,
33
+ findTierIndex,
34
+ GOVERNANCE,
35
+ NFT,
36
+ USDC,
37
+ } from './constants/index.js';
38
+
39
+ // =============================================================================
40
+ // PDAs
41
+ // =============================================================================
42
+
43
+ export {
44
+ getProjectPDA,
45
+ getEscrowPDA,
46
+ getMilestonePDA,
47
+ getInvestmentPDA,
48
+ getVotePDA,
49
+ getPivotProposalPDA,
50
+ getTgeEscrowPDA,
51
+ getTokenVaultPDA,
52
+ getScamReportPDA,
53
+ getAdminConfigPDA,
54
+ getNftMintPDA,
55
+ getProgramAuthorityPDA,
56
+ getProjectPDAs,
57
+ // ZTM v2.0 PDAs
58
+ getTokenomicsPDA,
59
+ getTokenMintPDA,
60
+ getVaultAuthorityPDA,
61
+ getInvestorVaultPDA,
62
+ getFounderVaultPDA,
63
+ getLpTokenVaultPDA,
64
+ getTreasuryVaultPDA,
65
+ getLpUsdcVaultPDA,
66
+ getFounderVestingPDA,
67
+ } from './pdas/index.js';
68
+
69
+ // =============================================================================
70
+ // Account Fetchers
71
+ // =============================================================================
72
+
73
+ export {
74
+ fetchProject,
75
+ fetchProjectByPda,
76
+ fetchMilestone,
77
+ fetchAllMilestones,
78
+ fetchInvestment,
79
+ fetchAllInvestments,
80
+ fetchVote,
81
+ fetchAllVotes,
82
+ fetchPivotProposal,
83
+ fetchTgeEscrow,
84
+ fetchAdminConfig,
85
+ accountExists,
86
+ } from './accounts/index.js';
87
+
88
+ // =============================================================================
89
+ // Instructions
90
+ // =============================================================================
91
+
92
+ export {
93
+ // Admin
94
+ initializeAdmin,
95
+ transferAdmin,
96
+ acceptAdmin,
97
+ // Project
98
+ initializeProject,
99
+ submitForApproval,
100
+ approveProject,
101
+ // Milestone
102
+ createMilestone,
103
+ submitMilestone,
104
+ voteOnMilestone,
105
+ finalizeVoting,
106
+ claimMilestoneFunds,
107
+ resubmitMilestone,
108
+ // Investment
109
+ invest,
110
+ cancelInvestment,
111
+ // Pivot
112
+ proposePivot,
113
+ approvePivot,
114
+ withdrawFromPivot,
115
+ finalizePivot,
116
+ // TGE (legacy)
117
+ setTgeDate,
118
+ depositTokens,
119
+ claimTokens,
120
+ reportScam,
121
+ releaseHoldback,
122
+ // Abandonment
123
+ checkAbandonment,
124
+ claimRefund,
125
+ // Exit Window
126
+ claimExitWindowRefund,
127
+ // ZTM v2.0 Token Distribution
128
+ claimInvestorTokens,
129
+ distributeTokens,
130
+ completeDistribution,
131
+ // ZTM v2.0 Founder Vesting
132
+ initializeFounderVesting,
133
+ claimVestedTokens,
134
+ // ZTM v2.0 Circuit Breaker
135
+ forceCompleteDistribution,
136
+ claimMissedUnlock,
137
+ // ZTM v2.0 Helpers
138
+ symbolToBytes,
139
+ type TokenomicsInput,
140
+ // Milestone Deadline Helpers
141
+ setMilestoneDeadline,
142
+ extendMilestoneDeadline,
143
+ calculateDeadline,
144
+ minDeadline,
145
+ validateDeadline,
146
+ MIN_DEADLINE_DURATION_SECONDS_PROD,
147
+ MIN_DEADLINE_DURATION_SECONDS_DEV,
148
+ MAX_DEADLINE_DURATION_SECONDS,
149
+ } from './instructions/index.js';
150
+
151
+ // =============================================================================
152
+ // Types
153
+ // =============================================================================
154
+
155
+ export {
156
+ // Enums
157
+ ProjectState,
158
+ MilestoneState,
159
+ VoteChoice,
160
+ PivotState,
161
+ // Account types
162
+ type Tier,
163
+ type TierConfig,
164
+ type ProjectAccount,
165
+ type MilestoneAccount,
166
+ type InvestmentAccount,
167
+ type VoteAccount,
168
+ type AdminConfigAccount,
169
+ type PivotProposalAccount,
170
+ type TgeEscrowAccount,
171
+ // Instruction args
172
+ type InitializeProjectArgs,
173
+ type CreateMilestoneArgs,
174
+ type InvestArgs,
175
+ type VoteOnMilestoneArgs,
176
+ type SetTgeDateArgs,
177
+ type DepositTokensArgs,
178
+ type ProposePivotArgs,
179
+ // Events
180
+ type ProjectCreatedEvent,
181
+ type InvestmentMadeEvent,
182
+ type MilestoneVoteCastEvent,
183
+ type MilestoneVoteFinalizedEvent,
184
+ // Utility types
185
+ type InvestmentWithKey,
186
+ type MilestoneWithKey,
187
+ type VoteWithKey,
188
+ } from './types/index.js';
189
+
190
+ // =============================================================================
191
+ // Errors
192
+ // =============================================================================
193
+
194
+ export {
195
+ ERROR_CODES,
196
+ ERROR_MESSAGES,
197
+ RaiseError,
198
+ parseError,
199
+ isRaiseError,
200
+ getErrorMessage,
201
+ } from './errors/index.js';
202
+
203
+ // =============================================================================
204
+ // Events
205
+ // =============================================================================
206
+
207
+ export {
208
+ EVENT_NAMES,
209
+ filterEventsByName,
210
+ findEvent,
211
+ type RaiseEvent,
212
+ type ProjectCreatedEvent as ProjectCreatedEventType,
213
+ type InvestmentMadeEvent as InvestmentMadeEventType,
214
+ type MilestoneVoteFinalizedEvent as MilestoneVoteFinalizedEventType,
215
+ type MilestoneReworkedEvent as MilestoneReworkedEventType,
216
+ } from './events/index.js';
217
+
218
+ // =============================================================================
219
+ // Utilities
220
+ // =============================================================================
221
+
222
+ export {
223
+ // Transaction utilities
224
+ confirmTransaction,
225
+ getTransactionWithRetry,
226
+ // BN utilities
227
+ bnToNumber,
228
+ bnToBigInt,
229
+ bigIntToBN,
230
+ // Time utilities
231
+ getCurrentTimestamp,
232
+ timestampToDate,
233
+ hasTimestampPassed,
234
+ timeRemaining,
235
+ formatDuration,
236
+ // Percentage utilities
237
+ bpsToPercent,
238
+ percentToBps,
239
+ percentageOf,
240
+ // Validation utilities
241
+ validateMilestonePercentages,
242
+ validateMetadataUri,
243
+ // Account utilities
244
+ isValidPublicKey,
245
+ shortenPublicKey,
246
+ } from './utils/index.js';
247
+
248
+ // =============================================================================
249
+ // Re-export Anchor/Solana types for convenience
250
+ // =============================================================================
251
+
252
+ export { BN } from '@coral-xyz/anchor';
253
+ export { PublicKey, Keypair, Connection } from '@solana/web3.js';