@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
@@ -0,0 +1,229 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ import { BN } from '@coral-xyz/anchor';
3
+
4
+ /**
5
+ * Raise Type Definitions
6
+ *
7
+ * Re-exports types from the IDL and provides additional utility types.
8
+ */
9
+
10
+ declare enum ProjectState {
11
+ Draft = "draft",
12
+ PendingApproval = "pendingApproval",
13
+ Open = "open",
14
+ Funded = "funded",
15
+ InProgress = "inProgress",
16
+ Completed = "completed",
17
+ Abandoned = "abandoned",
18
+ Failed = "failed",
19
+ TGEFailed = "tgeFailed",
20
+ Cancelled = "cancelled"
21
+ }
22
+ declare enum MilestoneState {
23
+ Proposed = "proposed",
24
+ Approved = "approved",
25
+ InProgress = "inProgress",
26
+ UnderReview = "underReview",
27
+ Passed = "passed",
28
+ Failed = "failed",
29
+ Unlocked = "unlocked"
30
+ }
31
+ declare enum VoteChoice {
32
+ Good = "good",
33
+ Bad = "bad"
34
+ }
35
+ declare enum PivotState {
36
+ PendingModeratorApproval = "pendingModeratorApproval",
37
+ ApprovedAwaitingInvestorWindow = "approvedAwaitingInvestorWindow",
38
+ Finalized = "finalized"
39
+ }
40
+ /**
41
+ * Tier configuration stored on-chain (includes filled_lots)
42
+ */
43
+ interface Tier {
44
+ /** USDC amount per lot */
45
+ amount: BN;
46
+ /** Maximum lots available */
47
+ maxLots: number;
48
+ /** Currently filled lots */
49
+ filledLots: number;
50
+ /** Token allocation per $1 invested */
51
+ tokenRatio: BN;
52
+ /** Vote weight multiplier (basis points, 100 = 1.0x) */
53
+ voteMultiplier: number;
54
+ }
55
+ /**
56
+ * Tier configuration input for project initialization
57
+ * Founders pass these when creating a project
58
+ */
59
+ interface TierConfig {
60
+ /** USDC amount per lot (must be >= 10 USDC = 10_000_000 lamports) */
61
+ amount: BN;
62
+ /** Maximum lots available (must be >= 1) */
63
+ maxLots: number;
64
+ /** Token allocation per $1 invested (must be >= 1) */
65
+ tokenRatio: BN;
66
+ /** Vote weight multiplier (basis points, must be >= 100 = 1.0x) */
67
+ voteMultiplier: number;
68
+ }
69
+ interface ProjectAccount {
70
+ founder: PublicKey;
71
+ projectId: BN;
72
+ fundingGoal: BN;
73
+ amountRaised: BN;
74
+ state: ProjectState;
75
+ metadataUri: string;
76
+ escrow: PublicKey;
77
+ currentMilestone: number;
78
+ totalMilestones: number;
79
+ /** Number of active tiers (1-10) */
80
+ tierCount: number;
81
+ /** All tier slots (only first tierCount are active) */
82
+ tiers: Tier[];
83
+ tokenMint: PublicKey | null;
84
+ tgeDate: BN | null;
85
+ tokensDeposited: BN;
86
+ tokenAllocationBps: number;
87
+ totalTokenAllocation: BN;
88
+ consecutiveFailures: number;
89
+ investorCount: number;
90
+ bump: number;
91
+ }
92
+ interface MilestoneAccount {
93
+ project: PublicKey;
94
+ milestoneIndex: number;
95
+ percentage: number;
96
+ description: string;
97
+ state: MilestoneState;
98
+ yesVotes: BN;
99
+ noVotes: BN;
100
+ totalWeight: BN;
101
+ voterCount: number;
102
+ votingEndsAt: BN | null;
103
+ bump: number;
104
+ }
105
+ interface InvestmentAccount {
106
+ project: PublicKey;
107
+ investor: PublicKey;
108
+ nftMint: PublicKey;
109
+ amount: BN;
110
+ voteWeight: BN;
111
+ tokenAllocation: BN;
112
+ tier: number;
113
+ investedAt: BN;
114
+ tokensClaimed: boolean;
115
+ withdrawnFromPivot: boolean;
116
+ refundClaimed: boolean;
117
+ bump: number;
118
+ }
119
+ interface VoteAccount {
120
+ milestone: PublicKey;
121
+ voter: PublicKey;
122
+ choice: VoteChoice;
123
+ weight: BN;
124
+ votedAt: BN;
125
+ bump: number;
126
+ }
127
+ interface AdminConfigAccount {
128
+ admin: PublicKey;
129
+ pendingAdmin: PublicKey | null;
130
+ bump: number;
131
+ }
132
+ interface PivotProposalAccount {
133
+ project: PublicKey;
134
+ newMetadataUri: string;
135
+ newMilestones: Array<{
136
+ percentage: number;
137
+ description: string;
138
+ }>;
139
+ state: PivotState;
140
+ proposedAt: BN;
141
+ approvedAt: BN | null;
142
+ withdrawalWindowEndsAt: BN | null;
143
+ withdrawnAmount: BN;
144
+ withdrawnCount: number;
145
+ bump: number;
146
+ }
147
+ interface TgeEscrowAccount {
148
+ project: PublicKey;
149
+ holdbackAmount: BN;
150
+ scamReports: BN;
151
+ scamWeight: BN;
152
+ scamConfirmed: boolean;
153
+ holdbackReleased: boolean;
154
+ bump: number;
155
+ }
156
+ interface InitializeProjectArgs {
157
+ projectId: BN;
158
+ fundingGoal: BN;
159
+ metadataUri: string;
160
+ /** Founder-configured tiers (1-10 tiers) */
161
+ tiers: TierConfig[];
162
+ }
163
+ interface CreateMilestoneArgs {
164
+ milestoneIndex: number;
165
+ percentage: number;
166
+ description: string;
167
+ }
168
+ interface InvestArgs {
169
+ amount: BN;
170
+ }
171
+ interface VoteOnMilestoneArgs {
172
+ choice: VoteChoice;
173
+ }
174
+ interface SetTgeDateArgs {
175
+ tgeDate: BN;
176
+ tokenMint: PublicKey;
177
+ }
178
+ interface DepositTokensArgs {
179
+ amount: BN;
180
+ }
181
+ interface ProposePivotArgs {
182
+ newMetadataUri: string;
183
+ newMilestones: Array<{
184
+ percentage: number;
185
+ description: string;
186
+ }>;
187
+ }
188
+ interface ProjectCreatedEvent {
189
+ projectId: BN;
190
+ founder: PublicKey;
191
+ fundingGoal: BN;
192
+ metadataUri: string;
193
+ }
194
+ interface InvestmentMadeEvent {
195
+ projectId: BN;
196
+ investor: PublicKey;
197
+ amount: BN;
198
+ nftMint: PublicKey;
199
+ tier: number;
200
+ voteWeight: BN;
201
+ }
202
+ interface MilestoneVoteCastEvent {
203
+ projectId: BN;
204
+ milestoneIndex: number;
205
+ voter: PublicKey;
206
+ choice: VoteChoice;
207
+ weight: BN;
208
+ }
209
+ interface MilestoneVoteFinalizedEvent {
210
+ projectId: BN;
211
+ milestoneIndex: number;
212
+ passed: boolean;
213
+ yesVotes: BN;
214
+ noVotes: BN;
215
+ }
216
+ interface InvestmentWithKey {
217
+ publicKey: PublicKey;
218
+ account: InvestmentAccount;
219
+ }
220
+ interface MilestoneWithKey {
221
+ publicKey: PublicKey;
222
+ account: MilestoneAccount;
223
+ }
224
+ interface VoteWithKey {
225
+ publicKey: PublicKey;
226
+ account: VoteAccount;
227
+ }
228
+
229
+ export { type AdminConfigAccount, type CreateMilestoneArgs, type DepositTokensArgs, type InitializeProjectArgs, type InvestArgs, type InvestmentAccount, type InvestmentMadeEvent, type InvestmentWithKey, type MilestoneAccount, MilestoneState, type MilestoneVoteCastEvent, type MilestoneVoteFinalizedEvent, type MilestoneWithKey, type PivotProposalAccount, PivotState, type ProjectAccount, type ProjectCreatedEvent, ProjectState, type ProposePivotArgs, type SetTgeDateArgs, type TgeEscrowAccount, type Tier, type TierConfig, type VoteAccount, VoteChoice, type VoteOnMilestoneArgs, type VoteWithKey };
@@ -0,0 +1,229 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ import { BN } from '@coral-xyz/anchor';
3
+
4
+ /**
5
+ * Raise Type Definitions
6
+ *
7
+ * Re-exports types from the IDL and provides additional utility types.
8
+ */
9
+
10
+ declare enum ProjectState {
11
+ Draft = "draft",
12
+ PendingApproval = "pendingApproval",
13
+ Open = "open",
14
+ Funded = "funded",
15
+ InProgress = "inProgress",
16
+ Completed = "completed",
17
+ Abandoned = "abandoned",
18
+ Failed = "failed",
19
+ TGEFailed = "tgeFailed",
20
+ Cancelled = "cancelled"
21
+ }
22
+ declare enum MilestoneState {
23
+ Proposed = "proposed",
24
+ Approved = "approved",
25
+ InProgress = "inProgress",
26
+ UnderReview = "underReview",
27
+ Passed = "passed",
28
+ Failed = "failed",
29
+ Unlocked = "unlocked"
30
+ }
31
+ declare enum VoteChoice {
32
+ Good = "good",
33
+ Bad = "bad"
34
+ }
35
+ declare enum PivotState {
36
+ PendingModeratorApproval = "pendingModeratorApproval",
37
+ ApprovedAwaitingInvestorWindow = "approvedAwaitingInvestorWindow",
38
+ Finalized = "finalized"
39
+ }
40
+ /**
41
+ * Tier configuration stored on-chain (includes filled_lots)
42
+ */
43
+ interface Tier {
44
+ /** USDC amount per lot */
45
+ amount: BN;
46
+ /** Maximum lots available */
47
+ maxLots: number;
48
+ /** Currently filled lots */
49
+ filledLots: number;
50
+ /** Token allocation per $1 invested */
51
+ tokenRatio: BN;
52
+ /** Vote weight multiplier (basis points, 100 = 1.0x) */
53
+ voteMultiplier: number;
54
+ }
55
+ /**
56
+ * Tier configuration input for project initialization
57
+ * Founders pass these when creating a project
58
+ */
59
+ interface TierConfig {
60
+ /** USDC amount per lot (must be >= 10 USDC = 10_000_000 lamports) */
61
+ amount: BN;
62
+ /** Maximum lots available (must be >= 1) */
63
+ maxLots: number;
64
+ /** Token allocation per $1 invested (must be >= 1) */
65
+ tokenRatio: BN;
66
+ /** Vote weight multiplier (basis points, must be >= 100 = 1.0x) */
67
+ voteMultiplier: number;
68
+ }
69
+ interface ProjectAccount {
70
+ founder: PublicKey;
71
+ projectId: BN;
72
+ fundingGoal: BN;
73
+ amountRaised: BN;
74
+ state: ProjectState;
75
+ metadataUri: string;
76
+ escrow: PublicKey;
77
+ currentMilestone: number;
78
+ totalMilestones: number;
79
+ /** Number of active tiers (1-10) */
80
+ tierCount: number;
81
+ /** All tier slots (only first tierCount are active) */
82
+ tiers: Tier[];
83
+ tokenMint: PublicKey | null;
84
+ tgeDate: BN | null;
85
+ tokensDeposited: BN;
86
+ tokenAllocationBps: number;
87
+ totalTokenAllocation: BN;
88
+ consecutiveFailures: number;
89
+ investorCount: number;
90
+ bump: number;
91
+ }
92
+ interface MilestoneAccount {
93
+ project: PublicKey;
94
+ milestoneIndex: number;
95
+ percentage: number;
96
+ description: string;
97
+ state: MilestoneState;
98
+ yesVotes: BN;
99
+ noVotes: BN;
100
+ totalWeight: BN;
101
+ voterCount: number;
102
+ votingEndsAt: BN | null;
103
+ bump: number;
104
+ }
105
+ interface InvestmentAccount {
106
+ project: PublicKey;
107
+ investor: PublicKey;
108
+ nftMint: PublicKey;
109
+ amount: BN;
110
+ voteWeight: BN;
111
+ tokenAllocation: BN;
112
+ tier: number;
113
+ investedAt: BN;
114
+ tokensClaimed: boolean;
115
+ withdrawnFromPivot: boolean;
116
+ refundClaimed: boolean;
117
+ bump: number;
118
+ }
119
+ interface VoteAccount {
120
+ milestone: PublicKey;
121
+ voter: PublicKey;
122
+ choice: VoteChoice;
123
+ weight: BN;
124
+ votedAt: BN;
125
+ bump: number;
126
+ }
127
+ interface AdminConfigAccount {
128
+ admin: PublicKey;
129
+ pendingAdmin: PublicKey | null;
130
+ bump: number;
131
+ }
132
+ interface PivotProposalAccount {
133
+ project: PublicKey;
134
+ newMetadataUri: string;
135
+ newMilestones: Array<{
136
+ percentage: number;
137
+ description: string;
138
+ }>;
139
+ state: PivotState;
140
+ proposedAt: BN;
141
+ approvedAt: BN | null;
142
+ withdrawalWindowEndsAt: BN | null;
143
+ withdrawnAmount: BN;
144
+ withdrawnCount: number;
145
+ bump: number;
146
+ }
147
+ interface TgeEscrowAccount {
148
+ project: PublicKey;
149
+ holdbackAmount: BN;
150
+ scamReports: BN;
151
+ scamWeight: BN;
152
+ scamConfirmed: boolean;
153
+ holdbackReleased: boolean;
154
+ bump: number;
155
+ }
156
+ interface InitializeProjectArgs {
157
+ projectId: BN;
158
+ fundingGoal: BN;
159
+ metadataUri: string;
160
+ /** Founder-configured tiers (1-10 tiers) */
161
+ tiers: TierConfig[];
162
+ }
163
+ interface CreateMilestoneArgs {
164
+ milestoneIndex: number;
165
+ percentage: number;
166
+ description: string;
167
+ }
168
+ interface InvestArgs {
169
+ amount: BN;
170
+ }
171
+ interface VoteOnMilestoneArgs {
172
+ choice: VoteChoice;
173
+ }
174
+ interface SetTgeDateArgs {
175
+ tgeDate: BN;
176
+ tokenMint: PublicKey;
177
+ }
178
+ interface DepositTokensArgs {
179
+ amount: BN;
180
+ }
181
+ interface ProposePivotArgs {
182
+ newMetadataUri: string;
183
+ newMilestones: Array<{
184
+ percentage: number;
185
+ description: string;
186
+ }>;
187
+ }
188
+ interface ProjectCreatedEvent {
189
+ projectId: BN;
190
+ founder: PublicKey;
191
+ fundingGoal: BN;
192
+ metadataUri: string;
193
+ }
194
+ interface InvestmentMadeEvent {
195
+ projectId: BN;
196
+ investor: PublicKey;
197
+ amount: BN;
198
+ nftMint: PublicKey;
199
+ tier: number;
200
+ voteWeight: BN;
201
+ }
202
+ interface MilestoneVoteCastEvent {
203
+ projectId: BN;
204
+ milestoneIndex: number;
205
+ voter: PublicKey;
206
+ choice: VoteChoice;
207
+ weight: BN;
208
+ }
209
+ interface MilestoneVoteFinalizedEvent {
210
+ projectId: BN;
211
+ milestoneIndex: number;
212
+ passed: boolean;
213
+ yesVotes: BN;
214
+ noVotes: BN;
215
+ }
216
+ interface InvestmentWithKey {
217
+ publicKey: PublicKey;
218
+ account: InvestmentAccount;
219
+ }
220
+ interface MilestoneWithKey {
221
+ publicKey: PublicKey;
222
+ account: MilestoneAccount;
223
+ }
224
+ interface VoteWithKey {
225
+ publicKey: PublicKey;
226
+ account: VoteAccount;
227
+ }
228
+
229
+ export { type AdminConfigAccount, type CreateMilestoneArgs, type DepositTokensArgs, type InitializeProjectArgs, type InvestArgs, type InvestmentAccount, type InvestmentMadeEvent, type InvestmentWithKey, type MilestoneAccount, MilestoneState, type MilestoneVoteCastEvent, type MilestoneVoteFinalizedEvent, type MilestoneWithKey, type PivotProposalAccount, PivotState, type ProjectAccount, type ProjectCreatedEvent, ProjectState, type ProposePivotArgs, type SetTgeDateArgs, type TgeEscrowAccount, type Tier, type TierConfig, type VoteAccount, VoteChoice, type VoteOnMilestoneArgs, type VoteWithKey };
@@ -0,0 +1,39 @@
1
+ // src/types/index.ts
2
+ var ProjectState = /* @__PURE__ */ ((ProjectState2) => {
3
+ ProjectState2["Draft"] = "draft";
4
+ ProjectState2["PendingApproval"] = "pendingApproval";
5
+ ProjectState2["Open"] = "open";
6
+ ProjectState2["Funded"] = "funded";
7
+ ProjectState2["InProgress"] = "inProgress";
8
+ ProjectState2["Completed"] = "completed";
9
+ ProjectState2["Abandoned"] = "abandoned";
10
+ ProjectState2["Failed"] = "failed";
11
+ ProjectState2["TGEFailed"] = "tgeFailed";
12
+ ProjectState2["Cancelled"] = "cancelled";
13
+ return ProjectState2;
14
+ })(ProjectState || {});
15
+ var MilestoneState = /* @__PURE__ */ ((MilestoneState2) => {
16
+ MilestoneState2["Proposed"] = "proposed";
17
+ MilestoneState2["Approved"] = "approved";
18
+ MilestoneState2["InProgress"] = "inProgress";
19
+ MilestoneState2["UnderReview"] = "underReview";
20
+ MilestoneState2["Passed"] = "passed";
21
+ MilestoneState2["Failed"] = "failed";
22
+ MilestoneState2["Unlocked"] = "unlocked";
23
+ return MilestoneState2;
24
+ })(MilestoneState || {});
25
+ var VoteChoice = /* @__PURE__ */ ((VoteChoice2) => {
26
+ VoteChoice2["Good"] = "good";
27
+ VoteChoice2["Bad"] = "bad";
28
+ return VoteChoice2;
29
+ })(VoteChoice || {});
30
+ var PivotState = /* @__PURE__ */ ((PivotState2) => {
31
+ PivotState2["PendingModeratorApproval"] = "pendingModeratorApproval";
32
+ PivotState2["ApprovedAwaitingInvestorWindow"] = "approvedAwaitingInvestorWindow";
33
+ PivotState2["Finalized"] = "finalized";
34
+ return PivotState2;
35
+ })(PivotState || {});
36
+
37
+ export { MilestoneState, PivotState, ProjectState, VoteChoice };
38
+ //# sourceMappingURL=index.js.map
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/index.ts"],"names":["ProjectState","MilestoneState","VoteChoice","PivotState"],"mappings":";AAaO,IAAK,YAAA,qBAAAA,aAAAA,KAAL;AACL,EAAAA,cAAA,OAAA,CAAA,GAAQ,OAAA;AACR,EAAAA,cAAA,iBAAA,CAAA,GAAkB,iBAAA;AAClB,EAAAA,cAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,cAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,cAAA,YAAA,CAAA,GAAa,YAAA;AACb,EAAAA,cAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,cAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,cAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,cAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,cAAA,WAAA,CAAA,GAAY,WAAA;AAVF,EAAA,OAAAA,aAAAA;AAAA,CAAA,EAAA,YAAA,IAAA,EAAA;AAaL,IAAK,cAAA,qBAAAC,eAAAA,KAAL;AACL,EAAAA,gBAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,gBAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,gBAAA,YAAA,CAAA,GAAa,YAAA;AACb,EAAAA,gBAAA,aAAA,CAAA,GAAc,aAAA;AACd,EAAAA,gBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,gBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,gBAAA,UAAA,CAAA,GAAW,UAAA;AAPD,EAAA,OAAAA,eAAAA;AAAA,CAAA,EAAA,cAAA,IAAA,EAAA;AAUL,IAAK,UAAA,qBAAAC,WAAAA,KAAL;AACL,EAAAA,YAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,YAAA,KAAA,CAAA,GAAM,KAAA;AAFI,EAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA,IAAA,EAAA;AAKL,IAAK,UAAA,qBAAAC,WAAAA,KAAL;AACL,EAAAA,YAAA,0BAAA,CAAA,GAA2B,0BAAA;AAC3B,EAAAA,YAAA,gCAAA,CAAA,GAAiC,gCAAA;AACjC,EAAAA,YAAA,WAAA,CAAA,GAAY,WAAA;AAHF,EAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA,IAAA,EAAA","file":"index.js","sourcesContent":["/**\n * Raise Type Definitions\n *\n * Re-exports types from the IDL and provides additional utility types.\n */\n\nimport { PublicKey } from '@solana/web3.js';\nimport { BN } from '@coral-xyz/anchor';\n\n// =============================================================================\n// Project State Enums\n// =============================================================================\n\nexport enum ProjectState {\n Draft = 'draft',\n PendingApproval = 'pendingApproval',\n Open = 'open',\n Funded = 'funded',\n InProgress = 'inProgress',\n Completed = 'completed',\n Abandoned = 'abandoned',\n Failed = 'failed',\n TGEFailed = 'tgeFailed',\n Cancelled = 'cancelled',\n}\n\nexport enum MilestoneState {\n Proposed = 'proposed',\n Approved = 'approved',\n InProgress = 'inProgress',\n UnderReview = 'underReview',\n Passed = 'passed',\n Failed = 'failed',\n Unlocked = 'unlocked',\n}\n\nexport enum VoteChoice {\n Good = 'good',\n Bad = 'bad',\n}\n\nexport enum PivotState {\n PendingModeratorApproval = 'pendingModeratorApproval',\n ApprovedAwaitingInvestorWindow = 'approvedAwaitingInvestorWindow',\n Finalized = 'finalized',\n}\n\n// =============================================================================\n// Account Types\n// =============================================================================\n\n/**\n * Tier configuration stored on-chain (includes filled_lots)\n */\nexport interface Tier {\n /** USDC amount per lot */\n amount: BN;\n /** Maximum lots available */\n maxLots: number;\n /** Currently filled lots */\n filledLots: number;\n /** Token allocation per $1 invested */\n tokenRatio: BN;\n /** Vote weight multiplier (basis points, 100 = 1.0x) */\n voteMultiplier: number;\n}\n\n/**\n * Tier configuration input for project initialization\n * Founders pass these when creating a project\n */\nexport interface TierConfig {\n /** USDC amount per lot (must be >= 10 USDC = 10_000_000 lamports) */\n amount: BN;\n /** Maximum lots available (must be >= 1) */\n maxLots: number;\n /** Token allocation per $1 invested (must be >= 1) */\n tokenRatio: BN;\n /** Vote weight multiplier (basis points, must be >= 100 = 1.0x) */\n voteMultiplier: number;\n}\n\nexport interface ProjectAccount {\n founder: PublicKey;\n projectId: BN;\n fundingGoal: BN;\n amountRaised: BN;\n state: ProjectState;\n metadataUri: string;\n escrow: PublicKey;\n currentMilestone: number;\n totalMilestones: number;\n /** Number of active tiers (1-10) */\n tierCount: number;\n /** All tier slots (only first tierCount are active) */\n tiers: Tier[];\n tokenMint: PublicKey | null;\n tgeDate: BN | null;\n tokensDeposited: BN;\n tokenAllocationBps: number;\n totalTokenAllocation: BN;\n consecutiveFailures: number;\n investorCount: number;\n bump: number;\n}\n\nexport interface MilestoneAccount {\n project: PublicKey;\n milestoneIndex: number;\n percentage: number;\n description: string;\n state: MilestoneState;\n yesVotes: BN;\n noVotes: BN;\n totalWeight: BN;\n voterCount: number;\n votingEndsAt: BN | null;\n bump: number;\n}\n\nexport interface InvestmentAccount {\n project: PublicKey;\n investor: PublicKey;\n nftMint: PublicKey;\n amount: BN;\n voteWeight: BN;\n tokenAllocation: BN;\n tier: number;\n investedAt: BN;\n tokensClaimed: boolean;\n withdrawnFromPivot: boolean;\n refundClaimed: boolean;\n bump: number;\n}\n\nexport interface VoteAccount {\n milestone: PublicKey;\n voter: PublicKey;\n choice: VoteChoice;\n weight: BN;\n votedAt: BN;\n bump: number;\n}\n\nexport interface AdminConfigAccount {\n admin: PublicKey;\n pendingAdmin: PublicKey | null;\n bump: number;\n}\n\nexport interface PivotProposalAccount {\n project: PublicKey;\n newMetadataUri: string;\n newMilestones: Array<{ percentage: number; description: string }>;\n state: PivotState;\n proposedAt: BN;\n approvedAt: BN | null;\n withdrawalWindowEndsAt: BN | null;\n withdrawnAmount: BN;\n withdrawnCount: number;\n bump: number;\n}\n\nexport interface TgeEscrowAccount {\n project: PublicKey;\n holdbackAmount: BN;\n scamReports: BN;\n scamWeight: BN;\n scamConfirmed: boolean;\n holdbackReleased: boolean;\n bump: number;\n}\n\n// =============================================================================\n// Instruction Arguments\n// =============================================================================\n\nexport interface InitializeProjectArgs {\n projectId: BN;\n fundingGoal: BN;\n metadataUri: string;\n /** Founder-configured tiers (1-10 tiers) */\n tiers: TierConfig[];\n}\n\nexport interface CreateMilestoneArgs {\n milestoneIndex: number;\n percentage: number;\n description: string;\n}\n\nexport interface InvestArgs {\n amount: BN;\n}\n\nexport interface VoteOnMilestoneArgs {\n choice: VoteChoice;\n}\n\nexport interface SetTgeDateArgs {\n tgeDate: BN;\n tokenMint: PublicKey;\n}\n\nexport interface DepositTokensArgs {\n amount: BN;\n}\n\nexport interface ProposePivotArgs {\n newMetadataUri: string;\n newMilestones: Array<{ percentage: number; description: string }>;\n}\n\n// =============================================================================\n// Event Types\n// =============================================================================\n\nexport interface ProjectCreatedEvent {\n projectId: BN;\n founder: PublicKey;\n fundingGoal: BN;\n metadataUri: string;\n}\n\nexport interface InvestmentMadeEvent {\n projectId: BN;\n investor: PublicKey;\n amount: BN;\n nftMint: PublicKey;\n tier: number;\n voteWeight: BN;\n}\n\nexport interface MilestoneVoteCastEvent {\n projectId: BN;\n milestoneIndex: number;\n voter: PublicKey;\n choice: VoteChoice;\n weight: BN;\n}\n\nexport interface MilestoneVoteFinalizedEvent {\n projectId: BN;\n milestoneIndex: number;\n passed: boolean;\n yesVotes: BN;\n noVotes: BN;\n}\n\n// =============================================================================\n// Utility Types\n// =============================================================================\n\nexport interface InvestmentWithKey {\n publicKey: PublicKey;\n account: InvestmentAccount;\n}\n\nexport interface MilestoneWithKey {\n publicKey: PublicKey;\n account: MilestoneAccount;\n}\n\nexport interface VoteWithKey {\n publicKey: PublicKey;\n account: VoteAccount;\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,130 @@
1
+ {
2
+ "name": "@zemyth/raise-sdk",
3
+ "version": "0.1.0",
4
+ "description": "TypeScript SDK for the Raise Solana program - decentralized venture funding platform",
5
+ "author": "Raise Team",
6
+ "license": "MIT",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "type": "module",
11
+ "main": "./dist/index.cjs",
12
+ "module": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "import": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ },
20
+ "require": {
21
+ "types": "./dist/index.d.cts",
22
+ "default": "./dist/index.cjs"
23
+ }
24
+ },
25
+ "./accounts": {
26
+ "import": {
27
+ "types": "./dist/accounts/index.d.ts",
28
+ "default": "./dist/accounts/index.js"
29
+ },
30
+ "require": {
31
+ "types": "./dist/accounts/index.d.cts",
32
+ "default": "./dist/accounts/index.cjs"
33
+ }
34
+ },
35
+ "./instructions": {
36
+ "import": {
37
+ "types": "./dist/instructions/index.d.ts",
38
+ "default": "./dist/instructions/index.js"
39
+ },
40
+ "require": {
41
+ "types": "./dist/instructions/index.d.cts",
42
+ "default": "./dist/instructions/index.cjs"
43
+ }
44
+ },
45
+ "./pdas": {
46
+ "import": {
47
+ "types": "./dist/pdas/index.d.ts",
48
+ "default": "./dist/pdas/index.js"
49
+ },
50
+ "require": {
51
+ "types": "./dist/pdas/index.d.cts",
52
+ "default": "./dist/pdas/index.cjs"
53
+ }
54
+ },
55
+ "./constants": {
56
+ "import": {
57
+ "types": "./dist/constants/index.d.ts",
58
+ "default": "./dist/constants/index.js"
59
+ },
60
+ "require": {
61
+ "types": "./dist/constants/index.d.cts",
62
+ "default": "./dist/constants/index.cjs"
63
+ }
64
+ },
65
+ "./errors": {
66
+ "import": {
67
+ "types": "./dist/errors/index.d.ts",
68
+ "default": "./dist/errors/index.js"
69
+ },
70
+ "require": {
71
+ "types": "./dist/errors/index.d.cts",
72
+ "default": "./dist/errors/index.cjs"
73
+ }
74
+ },
75
+ "./types": {
76
+ "import": {
77
+ "types": "./dist/types/index.d.ts",
78
+ "default": "./dist/types/index.js"
79
+ },
80
+ "require": {
81
+ "types": "./dist/types/index.d.cts",
82
+ "default": "./dist/types/index.cjs"
83
+ }
84
+ }
85
+ },
86
+ "files": [
87
+ "dist",
88
+ "src",
89
+ "README.md"
90
+ ],
91
+ "sideEffects": false,
92
+ "scripts": {
93
+ "build": "tsup",
94
+ "dev": "tsup --watch",
95
+ "clean": "rm -rf dist",
96
+ "typecheck": "tsc --noEmit",
97
+ "prepublishOnly": "npm run build"
98
+ },
99
+ "peerDependencies": {
100
+ "@coral-xyz/anchor": "^0.32.0",
101
+ "@solana/web3.js": "^1.90.0"
102
+ },
103
+ "devDependencies": {
104
+ "@coral-xyz/anchor": "^0.32.1",
105
+ "@solana/web3.js": "^1.98.4",
106
+ "@types/node": "^20.0.0",
107
+ "tsup": "^8.0.0",
108
+ "typescript": "^5.0.0"
109
+ },
110
+ "keywords": [
111
+ "solana",
112
+ "anchor",
113
+ "sdk",
114
+ "raise",
115
+ "crowdfunding",
116
+ "venture",
117
+ "defi",
118
+ "web3"
119
+ ],
120
+ "repository": {
121
+ "type": "git",
122
+ "url": "https://github.com/zemyth/raise"
123
+ },
124
+ "bugs": {
125
+ "url": "https://github.com/zemyth/raise/issues"
126
+ },
127
+ "engines": {
128
+ "node": ">=18"
129
+ }
130
+ }