@bench.games/conviction-markets 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.
- package/README.md +298 -0
- package/dist/constants.d.ts +29 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +29 -0
- package/dist/constants.js.map +1 -0
- package/dist/idl/conviction_market.d.ts +3760 -0
- package/dist/idl/conviction_market.d.ts.map +1 -0
- package/dist/idl/conviction_market.js +2 -0
- package/dist/idl/conviction_market.js.map +1 -0
- package/dist/idl/conviction_market.json +3753 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/instructions/addMarketOption.d.ts +38 -0
- package/dist/instructions/addMarketOption.d.ts.map +1 -0
- package/dist/instructions/addMarketOption.js +30 -0
- package/dist/instructions/addMarketOption.js.map +1 -0
- package/dist/instructions/buyMarketShares.d.ts +47 -0
- package/dist/instructions/buyMarketShares.d.ts.map +1 -0
- package/dist/instructions/buyMarketShares.js +63 -0
- package/dist/instructions/buyMarketShares.js.map +1 -0
- package/dist/instructions/claimVoteTokens.d.ts +40 -0
- package/dist/instructions/claimVoteTokens.d.ts.map +1 -0
- package/dist/instructions/claimVoteTokens.js +49 -0
- package/dist/instructions/claimVoteTokens.js.map +1 -0
- package/dist/instructions/closeShareAccount.d.ts +36 -0
- package/dist/instructions/closeShareAccount.d.ts.map +1 -0
- package/dist/instructions/closeShareAccount.js +28 -0
- package/dist/instructions/closeShareAccount.js.map +1 -0
- package/dist/instructions/createMarket.d.ts +48 -0
- package/dist/instructions/createMarket.d.ts.map +1 -0
- package/dist/instructions/createMarket.js +64 -0
- package/dist/instructions/createMarket.js.map +1 -0
- package/dist/instructions/incrementOptionTally.d.ts +35 -0
- package/dist/instructions/incrementOptionTally.d.ts.map +1 -0
- package/dist/instructions/incrementOptionTally.js +27 -0
- package/dist/instructions/incrementOptionTally.js.map +1 -0
- package/dist/instructions/index.d.ts +13 -0
- package/dist/instructions/index.d.ts.map +1 -0
- package/dist/instructions/index.js +16 -0
- package/dist/instructions/index.js.map +1 -0
- package/dist/instructions/initShareAccount.d.ts +34 -0
- package/dist/instructions/initShareAccount.d.ts.map +1 -0
- package/dist/instructions/initShareAccount.js +33 -0
- package/dist/instructions/initShareAccount.js.map +1 -0
- package/dist/instructions/initVoteTokenAccount.d.ts +37 -0
- package/dist/instructions/initVoteTokenAccount.d.ts.map +1 -0
- package/dist/instructions/initVoteTokenAccount.js +48 -0
- package/dist/instructions/initVoteTokenAccount.js.map +1 -0
- package/dist/instructions/mintVoteTokens.d.ts +40 -0
- package/dist/instructions/mintVoteTokens.d.ts.map +1 -0
- package/dist/instructions/mintVoteTokens.js +49 -0
- package/dist/instructions/mintVoteTokens.js.map +1 -0
- package/dist/instructions/openMarket.d.ts +34 -0
- package/dist/instructions/openMarket.d.ts.map +1 -0
- package/dist/instructions/openMarket.js +29 -0
- package/dist/instructions/openMarket.js.map +1 -0
- package/dist/instructions/revealShares.d.ts +43 -0
- package/dist/instructions/revealShares.d.ts.map +1 -0
- package/dist/instructions/revealShares.js +47 -0
- package/dist/instructions/revealShares.js.map +1 -0
- package/dist/instructions/selectOption.d.ts +36 -0
- package/dist/instructions/selectOption.d.ts.map +1 -0
- package/dist/instructions/selectOption.js +28 -0
- package/dist/instructions/selectOption.js.map +1 -0
- package/dist/types/accounts.d.ts +104 -0
- package/dist/types/accounts.d.ts.map +1 -0
- package/dist/types/accounts.js +2 -0
- package/dist/types/accounts.js.map +1 -0
- package/dist/types/common.d.ts +21 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +2 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/arcium.d.ts +3 -0
- package/dist/utils/arcium.d.ts.map +1 -0
- package/dist/utils/arcium.js +6 -0
- package/dist/utils/arcium.js.map +1 -0
- package/dist/utils/awaitComputationFinalization.d.ts +37 -0
- package/dist/utils/awaitComputationFinalization.d.ts.map +1 -0
- package/dist/utils/awaitComputationFinalization.js +32 -0
- package/dist/utils/awaitComputationFinalization.js.map +1 -0
- package/dist/utils/computations.d.ts +27 -0
- package/dist/utils/computations.d.ts.map +1 -0
- package/dist/utils/computations.js +35 -0
- package/dist/utils/computations.js.map +1 -0
- package/dist/utils/encryption.d.ts +46 -0
- package/dist/utils/encryption.d.ts.map +1 -0
- package/dist/utils/encryption.js +53 -0
- package/dist/utils/encryption.js.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/keypairs.d.ts +20 -0
- package/dist/utils/keypairs.d.ts.map +1 -0
- package/dist/utils/keypairs.js +29 -0
- package/dist/utils/keypairs.js.map +1 -0
- package/dist/utils/pdas.d.ts +38 -0
- package/dist/utils/pdas.d.ts.map +1 -0
- package/dist/utils/pdas.js +57 -0
- package/dist/utils/pdas.js.map +1 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
# @bench/conviction-markets
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for Solana Conviction Markets with encrypted votes using Arcium MPC.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Conviction Markets allow users to influence decision-making by staking capital on their preferred option. Vote choices and stake amounts are encrypted on-chain and only revealed when the market creator announces the winning option. Winners can claim yield from the reward pool.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @bench/conviction-markets @solana/web3.js @coral-xyz/anchor @arcium-hq/client
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
or with Bun:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
bun add @bench/conviction-markets @solana/web3.js @coral-xyz/anchor @arcium-hq/client
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- **Encrypted Voting**: User votes and stake amounts remain private using Arcium MPC
|
|
24
|
+
- **Ergonomic API**: Auto-generates computation offsets, nonces, and handles encryption
|
|
25
|
+
- **Type-Safe**: Full TypeScript support with IDL-generated types
|
|
26
|
+
- **Comprehensive**: All program instructions with helper utilities
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import {
|
|
32
|
+
createMarket,
|
|
33
|
+
addMarketOption,
|
|
34
|
+
openMarket,
|
|
35
|
+
initVoteTokenAccount,
|
|
36
|
+
mintVoteTokens,
|
|
37
|
+
buyMarketShares,
|
|
38
|
+
generateSolanaKeypair,
|
|
39
|
+
generateX25519Keypair,
|
|
40
|
+
PROGRAM_ID,
|
|
41
|
+
} from "@bench/conviction-markets";
|
|
42
|
+
import { Connection } from "@solana/web3.js";
|
|
43
|
+
import { AnchorProvider, Wallet } from "@coral-xyz/anchor";
|
|
44
|
+
|
|
45
|
+
// Setup connection and provider
|
|
46
|
+
const connection = new Connection("https://api.devnet.solana.com");
|
|
47
|
+
const creator = generateSolanaKeypair(); // Or load from file
|
|
48
|
+
const wallet = new Wallet(creator);
|
|
49
|
+
const provider = new AnchorProvider(connection, wallet, {
|
|
50
|
+
commitment: "confirmed",
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Create a market
|
|
54
|
+
const { signature, marketPda, computationOffset } = await createMarket(
|
|
55
|
+
provider,
|
|
56
|
+
{
|
|
57
|
+
creator,
|
|
58
|
+
marketIndex: Date.now(), // Use unique index
|
|
59
|
+
maxOptions: 3,
|
|
60
|
+
maxShares: 1000,
|
|
61
|
+
rewardLamports: 1_000_000, // 0.001 SOL
|
|
62
|
+
timeToStake: 3600, // 1 hour
|
|
63
|
+
timeToReveal: 600, // 10 minutes
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
// Wait for MPC computation to finalize
|
|
68
|
+
await awaitComputationFinalization(provider, computationOffset);
|
|
69
|
+
console.log("Market created:", marketPda.toBase58());
|
|
70
|
+
|
|
71
|
+
// Add options
|
|
72
|
+
await addMarketOption(provider, {
|
|
73
|
+
creator,
|
|
74
|
+
market: marketPda,
|
|
75
|
+
optionIndex: 1,
|
|
76
|
+
name: "Option A",
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Open market for trading
|
|
80
|
+
const now = Math.floor(Date.now() / 1000);
|
|
81
|
+
await openMarket(provider, {
|
|
82
|
+
creator,
|
|
83
|
+
market: marketPda,
|
|
84
|
+
openTimestamp: now + 60, // Opens in 60 seconds
|
|
85
|
+
});
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## User Participation
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import {
|
|
92
|
+
initVoteTokenAccount,
|
|
93
|
+
mintVoteTokens,
|
|
94
|
+
initShareAccount,
|
|
95
|
+
buyMarketShares,
|
|
96
|
+
awaitComputationFinalization,
|
|
97
|
+
generateSolanaKeypair,
|
|
98
|
+
generateX25519Keypair,
|
|
99
|
+
} from "@bench/conviction-markets";
|
|
100
|
+
|
|
101
|
+
// Create user keypairs
|
|
102
|
+
const user = generateSolanaKeypair();
|
|
103
|
+
const userX25519 = generateX25519Keypair();
|
|
104
|
+
|
|
105
|
+
// Initialize vote token account
|
|
106
|
+
const { computationOffset: initOffset } = await initVoteTokenAccount(provider, {
|
|
107
|
+
signer: user,
|
|
108
|
+
userX25519Keypair: userX25519,
|
|
109
|
+
});
|
|
110
|
+
await awaitComputationFinalization(provider, initOffset);
|
|
111
|
+
|
|
112
|
+
// Buy vote tokens with SOL
|
|
113
|
+
const { computationOffset: mintOffset } = await mintVoteTokens(provider, {
|
|
114
|
+
signer: user,
|
|
115
|
+
userX25519Keypair: userX25519,
|
|
116
|
+
amount: 100, // Buy 100 vote tokens
|
|
117
|
+
});
|
|
118
|
+
await awaitComputationFinalization(provider, mintOffset);
|
|
119
|
+
|
|
120
|
+
// Initialize share account
|
|
121
|
+
await initShareAccount(provider, {
|
|
122
|
+
signer: user,
|
|
123
|
+
market: marketPda,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// Buy market shares (amount and option encrypted automatically!)
|
|
127
|
+
const { computationOffset: buyOffset } = await buyMarketShares(provider, {
|
|
128
|
+
signer: user,
|
|
129
|
+
userX25519Keypair: userX25519,
|
|
130
|
+
market: marketPda,
|
|
131
|
+
amount: 50, // Spend 50 vote tokens
|
|
132
|
+
selectedOption: 1, // Vote for option 1
|
|
133
|
+
});
|
|
134
|
+
await awaitComputationFinalization(provider, buyOffset);
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Market Resolution & Claims
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
import {
|
|
141
|
+
selectOption,
|
|
142
|
+
revealShares,
|
|
143
|
+
incrementOptionTally,
|
|
144
|
+
closeShareAccount,
|
|
145
|
+
awaitComputationFinalization,
|
|
146
|
+
} from "@bench/conviction-markets";
|
|
147
|
+
|
|
148
|
+
// Market creator selects winning option
|
|
149
|
+
await selectOption(provider, {
|
|
150
|
+
authority: creator,
|
|
151
|
+
market: marketPda,
|
|
152
|
+
optionIndex: 1,
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// Anyone can reveal shares (permissionless)
|
|
156
|
+
const { computationOffset: revealOffset } = await revealShares(provider, {
|
|
157
|
+
signer: anyKeypair, // Can be anyone
|
|
158
|
+
owner: user.publicKey,
|
|
159
|
+
market: marketPda,
|
|
160
|
+
ownerX25519Keypair: userX25519,
|
|
161
|
+
});
|
|
162
|
+
await awaitComputationFinalization(provider, revealOffset);
|
|
163
|
+
|
|
164
|
+
// Increment option tally (permissionless)
|
|
165
|
+
await incrementOptionTally(provider, {
|
|
166
|
+
market: marketPda,
|
|
167
|
+
owner: user.publicKey,
|
|
168
|
+
optionIndex: 1,
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// User claims yield and closes share account
|
|
172
|
+
await closeShareAccount(provider, {
|
|
173
|
+
owner: user,
|
|
174
|
+
market: marketPda,
|
|
175
|
+
optionIndex: 1, // Option they voted for
|
|
176
|
+
});
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## API Reference
|
|
180
|
+
|
|
181
|
+
### Market Lifecycle
|
|
182
|
+
|
|
183
|
+
- **`createMarket()`** - Creates a new market with encrypted state
|
|
184
|
+
- **`addMarketOption()`** - Adds a named voting option
|
|
185
|
+
- **`openMarket()`** - Opens market for trading at specified timestamp
|
|
186
|
+
- **`selectOption()`** - Selects the winning option (creator or authority)
|
|
187
|
+
|
|
188
|
+
### Vote Tokens
|
|
189
|
+
|
|
190
|
+
- **`initVoteTokenAccount()`** - Initializes encrypted balance account
|
|
191
|
+
- **`mintVoteTokens()`** - Buys vote tokens with SOL (0.001 SOL per token)
|
|
192
|
+
- **`claimVoteTokens()`** - Sells unused vote tokens back for SOL
|
|
193
|
+
|
|
194
|
+
### Market Shares
|
|
195
|
+
|
|
196
|
+
- **`initShareAccount()`** - Initializes share account for a market
|
|
197
|
+
- **`buyMarketShares()`** - Purchases shares with encrypted input
|
|
198
|
+
- **`revealShares()`** - Reveals encrypted shares (after staking ends)
|
|
199
|
+
- **`incrementOptionTally()`** - Increments option tally after reveal
|
|
200
|
+
- **`closeShareAccount()`** - Closes account and claims yield (if winner)
|
|
201
|
+
|
|
202
|
+
### Utilities
|
|
203
|
+
|
|
204
|
+
- **`generateSolanaKeypair()`** - Generates Solana keypair for signing
|
|
205
|
+
- **`generateX25519Keypair()`** - Generates X25519 keypair for encryption
|
|
206
|
+
- **`deriveMarketPda()`** - Derives market PDA
|
|
207
|
+
- **`deriveVoteTokenAccountPda()`** - Derives vote token account PDA
|
|
208
|
+
- **`deriveShareAccountPda()`** - Derives share account PDA
|
|
209
|
+
- **`deriveOptionPda()`** - Derives option PDA
|
|
210
|
+
|
|
211
|
+
## Key Concepts
|
|
212
|
+
|
|
213
|
+
### Two Types of Keypairs
|
|
214
|
+
|
|
215
|
+
1. **Solana Keypair**: Used for transaction signing and account ownership
|
|
216
|
+
```typescript
|
|
217
|
+
const solanaKeypair = generateSolanaKeypair();
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
2. **X25519 Keypair**: Used for MPC encryption with Arcium
|
|
221
|
+
```typescript
|
|
222
|
+
const x25519Keypair = generateX25519Keypair();
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### MPC Instructions
|
|
226
|
+
|
|
227
|
+
Instructions that use encrypted computations return a `computationOffset`. Use the `awaitComputationFinalization` helper to wait for the computation to complete:
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
import { mintVoteTokens, awaitComputationFinalization } from "@bench/conviction-markets";
|
|
231
|
+
|
|
232
|
+
const { signature, computationOffset } = await mintVoteTokens(provider, {
|
|
233
|
+
signer: user,
|
|
234
|
+
userX25519Keypair,
|
|
235
|
+
amount: 100,
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
// Wait for MPC computation to complete
|
|
239
|
+
await awaitComputationFinalization(provider, computationOffset);
|
|
240
|
+
|
|
241
|
+
// With options
|
|
242
|
+
await awaitComputationFinalization(provider, computationOffset, {
|
|
243
|
+
commitment: "finalized",
|
|
244
|
+
programId: customProgramId,
|
|
245
|
+
});
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Automatic Encryption
|
|
249
|
+
|
|
250
|
+
The SDK handles encryption automatically for `buyMarketShares()`:
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
// Just pass plain values - SDK encrypts them!
|
|
254
|
+
await buyMarketShares(provider, {
|
|
255
|
+
signer: user,
|
|
256
|
+
userX25519Keypair,
|
|
257
|
+
market: marketPda,
|
|
258
|
+
amount: 50, // Plain value
|
|
259
|
+
selectedOption: 1, // Plain value
|
|
260
|
+
});
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Program Information
|
|
264
|
+
|
|
265
|
+
- **Devnet Program ID**: `bnchXx34qGANGyEL6MxTYdG8iXmUmSPyQFAGhxj1VKn`
|
|
266
|
+
- **Vote Token Price**: 0.001 SOL per token
|
|
267
|
+
- **Arcium Version**: v0.6.3
|
|
268
|
+
|
|
269
|
+
## Market Flow
|
|
270
|
+
|
|
271
|
+
1. **Create** market with parameters
|
|
272
|
+
2. **Add** named options (1-indexed)
|
|
273
|
+
3. **Fund** market with SOL for rewards
|
|
274
|
+
4. **Open** market at specified timestamp
|
|
275
|
+
5. **Users mint** vote tokens and buy shares
|
|
276
|
+
6. **Creator selects** winning option
|
|
277
|
+
7. **Shares revealed** and tallied
|
|
278
|
+
8. **Winners claim** proportional yield
|
|
279
|
+
|
|
280
|
+
## Examples
|
|
281
|
+
|
|
282
|
+
See the `/scripts` and `/tests` directories in the main repository for complete examples:
|
|
283
|
+
|
|
284
|
+
- `scripts/test-open-market.ts` - Full market creation flow
|
|
285
|
+
- `tests/conviction.ts` - Comprehensive integration tests
|
|
286
|
+
|
|
287
|
+
## License
|
|
288
|
+
|
|
289
|
+
MIT
|
|
290
|
+
|
|
291
|
+
## Contributing
|
|
292
|
+
|
|
293
|
+
Contributions are welcome! Please see the main repository for guidelines.
|
|
294
|
+
|
|
295
|
+
## Links
|
|
296
|
+
|
|
297
|
+
- [GitHub Repository](https://github.com/arcium/solana-conviction-markets)
|
|
298
|
+
- [Arcium](https://arcium.com/)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
/**
|
|
3
|
+
* Program ID for the Conviction Markets program on Solana devnet
|
|
4
|
+
*/
|
|
5
|
+
export declare const PROGRAM_ID: PublicKey;
|
|
6
|
+
/**
|
|
7
|
+
* Price per vote token in lamports (0.001 SOL)
|
|
8
|
+
*/
|
|
9
|
+
export declare const PRICE_PER_VOTE_TOKEN_LAMPORTS = 1000000;
|
|
10
|
+
/**
|
|
11
|
+
* PDA seed strings for account derivation
|
|
12
|
+
*/
|
|
13
|
+
export declare const CONVICTION_MARKET_SEED = "conviction_market";
|
|
14
|
+
export declare const VOTE_TOKEN_ACCOUNT_SEED = "vote_token_account";
|
|
15
|
+
export declare const SHARE_ACCOUNT_SEED = "share_account";
|
|
16
|
+
export declare const OPTION_SEED = "option";
|
|
17
|
+
/**
|
|
18
|
+
* Computation definition offsets for MPC circuits
|
|
19
|
+
* These match the offsets defined in the on-chain program
|
|
20
|
+
*/
|
|
21
|
+
export declare const COMP_DEF_OFFSETS: {
|
|
22
|
+
readonly INIT_VOTE_TOKEN_ACCOUNT: "init_vote_token_account";
|
|
23
|
+
readonly BUY_VOTE_TOKENS: "buy_vote_tokens";
|
|
24
|
+
readonly CLAIM_VOTE_TOKENS: "claim_vote_tokens";
|
|
25
|
+
readonly BUY_CONVICTION_MARKET_SHARES: "buy_conviction_market_shares";
|
|
26
|
+
readonly INIT_MARKET_SHARES: "init_market_shares";
|
|
27
|
+
readonly REVEAL_SHARES: "reveal_shares";
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,UAAU,WAEtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B,UAAY,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AAC1D,eAAO,MAAM,uBAAuB,uBAAuB,CAAC;AAC5D,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAClD,eAAO,MAAM,WAAW,WAAW,CAAC;AAEpC;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;CAOnB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
/**
|
|
3
|
+
* Program ID for the Conviction Markets program on Solana devnet
|
|
4
|
+
*/
|
|
5
|
+
export const PROGRAM_ID = new PublicKey("bnchXx34qGANGyEL6MxTYdG8iXmUmSPyQFAGhxj1VKn");
|
|
6
|
+
/**
|
|
7
|
+
* Price per vote token in lamports (0.001 SOL)
|
|
8
|
+
*/
|
|
9
|
+
export const PRICE_PER_VOTE_TOKEN_LAMPORTS = 1_000_000;
|
|
10
|
+
/**
|
|
11
|
+
* PDA seed strings for account derivation
|
|
12
|
+
*/
|
|
13
|
+
export const CONVICTION_MARKET_SEED = "conviction_market";
|
|
14
|
+
export const VOTE_TOKEN_ACCOUNT_SEED = "vote_token_account";
|
|
15
|
+
export const SHARE_ACCOUNT_SEED = "share_account";
|
|
16
|
+
export const OPTION_SEED = "option";
|
|
17
|
+
/**
|
|
18
|
+
* Computation definition offsets for MPC circuits
|
|
19
|
+
* These match the offsets defined in the on-chain program
|
|
20
|
+
*/
|
|
21
|
+
export const COMP_DEF_OFFSETS = {
|
|
22
|
+
INIT_VOTE_TOKEN_ACCOUNT: "init_vote_token_account",
|
|
23
|
+
BUY_VOTE_TOKENS: "buy_vote_tokens",
|
|
24
|
+
CLAIM_VOTE_TOKENS: "claim_vote_tokens",
|
|
25
|
+
BUY_CONVICTION_MARKET_SHARES: "buy_conviction_market_shares",
|
|
26
|
+
INIT_MARKET_SHARES: "init_market_shares",
|
|
27
|
+
REVEAL_SHARES: "reveal_shares",
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,SAAS,CACrC,6CAA6C,CAC9C,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,SAAS,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAC1D,MAAM,CAAC,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AAC5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAClD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC;AAEpC;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,uBAAuB,EAAE,yBAAyB;IAClD,eAAe,EAAE,iBAAiB;IAClC,iBAAiB,EAAE,mBAAmB;IACtC,4BAA4B,EAAE,8BAA8B;IAC5D,kBAAkB,EAAE,oBAAoB;IACxC,aAAa,EAAE,eAAe;CACtB,CAAC"}
|