@bench.games/conviction-markets 0.1.4 → 0.1.6
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 +0 -292
- package/dist/types/accounts.d.ts +11 -99
- package/dist/types/accounts.d.ts.map +1 -1
- package/dist/types/accounts.js +14 -0
- package/dist/types/accounts.js.map +1 -1
- package/dist/utils/accounts.d.ts +191 -0
- package/dist/utils/accounts.d.ts.map +1 -0
- package/dist/utils/accounts.js +149 -0
- package/dist/utils/accounts.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,297 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
TypeScript SDK for Solana Conviction Markets with encrypted votes using Arcium MPC.
|
|
4
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
5
|
- [GitHub Repository](https://github.com/arcium/solana-conviction-markets)
|
|
298
6
|
- [Arcium](https://arcium.com/)
|
package/dist/types/accounts.d.ts
CHANGED
|
@@ -1,104 +1,16 @@
|
|
|
1
|
-
import type { PublicKey } from "@solana/web3.js";
|
|
2
|
-
import type { BN } from "@coral-xyz/anchor";
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
2
|
+
* Account types are now inferred from the Anchor program and exported from utils/accounts.ts
|
|
5
3
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/** Market creator's public key */
|
|
15
|
-
creator: PublicKey;
|
|
16
|
-
/** Unique market index */
|
|
17
|
-
index: BN;
|
|
18
|
-
/** Current number of options added */
|
|
19
|
-
totalOptions: number;
|
|
20
|
-
/** Maximum number of options allowed */
|
|
21
|
-
maxOptions: number;
|
|
22
|
-
/** Timestamp when market opens for trading */
|
|
23
|
-
openTimestamp?: BN;
|
|
24
|
-
/** Duration of staking period in seconds */
|
|
25
|
-
timeToStake: BN;
|
|
26
|
-
/** Duration of reveal period in seconds */
|
|
27
|
-
timeToReveal: BN;
|
|
28
|
-
/** Selected winning option (if set) */
|
|
29
|
-
selectedOption?: number;
|
|
30
|
-
/** Nonce for encrypted state */
|
|
31
|
-
stateNonce: BN;
|
|
32
|
-
/** Maximum shares available for purchase */
|
|
33
|
-
maxShares: BN;
|
|
34
|
-
/** Reward pool in lamports for winners */
|
|
35
|
-
rewardLamports: BN;
|
|
36
|
-
/** Optional authority that can select winning option */
|
|
37
|
-
selectAuthority?: PublicKey;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Vote Token Account structure
|
|
41
|
-
*
|
|
42
|
-
* Holds a user's encrypted vote token balance.
|
|
43
|
-
* Vote tokens are used to purchase market shares.
|
|
44
|
-
*/
|
|
45
|
-
export interface VoteTokenAccountData {
|
|
46
|
-
/** Encrypted token balance state */
|
|
47
|
-
encryptedState: Uint8Array[][];
|
|
48
|
-
/** PDA bump seed */
|
|
49
|
-
bump: number;
|
|
50
|
-
/** Account owner's public key */
|
|
51
|
-
owner: PublicKey;
|
|
52
|
-
/** Nonce for encrypted state */
|
|
53
|
-
stateNonce: BN;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Share Account structure
|
|
57
|
-
*
|
|
58
|
-
* Represents a user's encrypted position in a specific market,
|
|
59
|
-
* including the amount of shares and selected option.
|
|
60
|
-
*/
|
|
61
|
-
export interface ShareAccountData {
|
|
62
|
-
/** Encrypted state: [share_amount, selected_option] */
|
|
63
|
-
encryptedState: Uint8Array[][];
|
|
64
|
-
/** Nonce for encrypted state */
|
|
65
|
-
stateNonce: BN;
|
|
66
|
-
/** PDA bump seed */
|
|
67
|
-
bump: number;
|
|
68
|
-
/** Account owner's public key */
|
|
69
|
-
owner: PublicKey;
|
|
70
|
-
/** Market this share account is for */
|
|
71
|
-
market: PublicKey;
|
|
72
|
-
/** Encrypted state disclosure for analytics */
|
|
73
|
-
encryptedStateDisclosure: Uint8Array[][];
|
|
74
|
-
/** Nonce for disclosure state */
|
|
75
|
-
stateNonceDisclosure: BN;
|
|
76
|
-
/** Timestamp when shares were purchased */
|
|
77
|
-
boughtAtTimestamp: BN;
|
|
78
|
-
/** Revealed share amount (after reveal) */
|
|
79
|
-
revealedAmount?: BN;
|
|
80
|
-
/** Revealed option choice (after reveal) */
|
|
81
|
-
revealedOption?: number;
|
|
82
|
-
/** Conviction score (amount * time-in-market) */
|
|
83
|
-
revealedScore?: BN;
|
|
84
|
-
/** Whether tally has been incremented for this share */
|
|
85
|
-
totalIncremented: boolean;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Market Option structure
|
|
4
|
+
* Use the following exports:
|
|
5
|
+
* - VoteTokenAccountData
|
|
6
|
+
* - ShareAccountData
|
|
7
|
+
* - ConvictionMarketAccount
|
|
8
|
+
* - ConvictionMarketOptionData
|
|
9
|
+
* - DecryptedVoteTokenBalance
|
|
10
|
+
* - DecryptedShareAccount
|
|
11
|
+
* - DecryptedMarketShares
|
|
89
12
|
*
|
|
90
|
-
*
|
|
13
|
+
* All imported from: @bench.games/conviction-markets (utils/accounts module)
|
|
91
14
|
*/
|
|
92
|
-
export
|
|
93
|
-
/** PDA bump seed */
|
|
94
|
-
bump: number;
|
|
95
|
-
/** Market creator's public key */
|
|
96
|
-
creator: PublicKey;
|
|
97
|
-
/** Human-readable name of the option */
|
|
98
|
-
name: string;
|
|
99
|
-
/** Total shares bought for this option */
|
|
100
|
-
totalShares?: BN;
|
|
101
|
-
/** Total conviction score for this option */
|
|
102
|
-
totalScore?: BN;
|
|
103
|
-
}
|
|
15
|
+
export type { VoteTokenAccountData, ShareAccountData, ConvictionMarketAccount, ConvictionMarketOptionData, DecryptedVoteTokenBalance, DecryptedShareAccount, DecryptedMarketShares, } from "../utils/accounts";
|
|
104
16
|
//# sourceMappingURL=accounts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/types/accounts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/types/accounts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,0BAA0B,EAC1B,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC"}
|
package/dist/types/accounts.js
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account types are now inferred from the Anchor program and exported from utils/accounts.ts
|
|
3
|
+
*
|
|
4
|
+
* Use the following exports:
|
|
5
|
+
* - VoteTokenAccountData
|
|
6
|
+
* - ShareAccountData
|
|
7
|
+
* - ConvictionMarketAccount
|
|
8
|
+
* - ConvictionMarketOptionData
|
|
9
|
+
* - DecryptedVoteTokenBalance
|
|
10
|
+
* - DecryptedShareAccount
|
|
11
|
+
* - DecryptedMarketShares
|
|
12
|
+
*
|
|
13
|
+
* All imported from: @bench.games/conviction-markets (utils/accounts module)
|
|
14
|
+
*/
|
|
1
15
|
export {};
|
|
2
16
|
//# sourceMappingURL=accounts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../src/types/accounts.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../src/types/accounts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { Program, type AnchorProvider } from "@coral-xyz/anchor";
|
|
2
|
+
import type { PublicKey } from "@solana/web3.js";
|
|
3
|
+
import type { ConvictionMarket } from "../idl/conviction_market";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a Program instance for the Conviction Market program
|
|
6
|
+
*
|
|
7
|
+
* @param provider - Anchor provider
|
|
8
|
+
* @returns Program instance
|
|
9
|
+
*/
|
|
10
|
+
export declare function createProgram(provider: AnchorProvider): Program<ConvictionMarket>;
|
|
11
|
+
/**
|
|
12
|
+
* Fetches and decrypts a user's vote token balance
|
|
13
|
+
*
|
|
14
|
+
* @param program - Anchor program instance
|
|
15
|
+
* @param voteTokenAccountPda - PDA of the vote token account
|
|
16
|
+
* @param userX25519Keypair - User's X25519 keypair for decryption
|
|
17
|
+
* @returns Decrypted balance and account data
|
|
18
|
+
* @throws If account doesn't exist or decryption fails
|
|
19
|
+
*/
|
|
20
|
+
export declare function fetchAndDecryptVoteTokenBalance(program: Program<ConvictionMarket>, voteTokenAccountPda: PublicKey, userX25519Keypair: {
|
|
21
|
+
publicKey: Uint8Array;
|
|
22
|
+
secretKey: Uint8Array;
|
|
23
|
+
}): Promise<{
|
|
24
|
+
balance: bigint;
|
|
25
|
+
account: {
|
|
26
|
+
encryptedState: number[][];
|
|
27
|
+
bump: number;
|
|
28
|
+
owner: PublicKey;
|
|
29
|
+
stateNonce: import("bn.js");
|
|
30
|
+
};
|
|
31
|
+
}>;
|
|
32
|
+
export type DecryptedVoteTokenBalance = Awaited<ReturnType<typeof fetchAndDecryptVoteTokenBalance>>;
|
|
33
|
+
/**
|
|
34
|
+
* Fetches and decrypts a user's share account
|
|
35
|
+
*
|
|
36
|
+
* @param program - Anchor program instance
|
|
37
|
+
* @param shareAccountPda - PDA of the share account
|
|
38
|
+
* @param userX25519Keypair - User's X25519 keypair for decryption
|
|
39
|
+
* @returns Decrypted share data and account data
|
|
40
|
+
* @throws If account doesn't exist or decryption fails
|
|
41
|
+
*/
|
|
42
|
+
export declare function fetchAndDecryptShareAccount(program: Program<ConvictionMarket>, shareAccountPda: PublicKey, userX25519Keypair: {
|
|
43
|
+
publicKey: Uint8Array;
|
|
44
|
+
secretKey: Uint8Array;
|
|
45
|
+
}): Promise<{
|
|
46
|
+
amount: bigint;
|
|
47
|
+
selectedOption: bigint;
|
|
48
|
+
account: {
|
|
49
|
+
encryptedState: number[][];
|
|
50
|
+
stateNonce: import("bn.js");
|
|
51
|
+
bump: number;
|
|
52
|
+
owner: PublicKey;
|
|
53
|
+
market: PublicKey;
|
|
54
|
+
encryptedStateDisclosure: number[][];
|
|
55
|
+
stateNonceDisclosure: import("bn.js");
|
|
56
|
+
boughtAtTimestamp: import("bn.js");
|
|
57
|
+
revealedAmount: import("bn.js") | null;
|
|
58
|
+
revealedOption: number | null;
|
|
59
|
+
revealedScore: import("bn.js") | null;
|
|
60
|
+
totalIncremented: boolean;
|
|
61
|
+
};
|
|
62
|
+
}>;
|
|
63
|
+
export type DecryptedShareAccount = Awaited<ReturnType<typeof fetchAndDecryptShareAccount>>;
|
|
64
|
+
/**
|
|
65
|
+
* Fetches and decrypts a market's available shares
|
|
66
|
+
*
|
|
67
|
+
* @param program - Anchor program instance
|
|
68
|
+
* @param marketPda - PDA of the conviction market
|
|
69
|
+
* @param userX25519Keypair - User's X25519 keypair for decryption
|
|
70
|
+
* @returns Decrypted available shares and account data
|
|
71
|
+
* @throws If account doesn't exist or decryption fails
|
|
72
|
+
*/
|
|
73
|
+
export declare function fetchAndDecryptMarketShares(program: Program<ConvictionMarket>, marketPda: PublicKey, userX25519Keypair: {
|
|
74
|
+
publicKey: Uint8Array;
|
|
75
|
+
secretKey: Uint8Array;
|
|
76
|
+
}): Promise<{
|
|
77
|
+
availableShares: bigint;
|
|
78
|
+
account: {
|
|
79
|
+
encryptedAvailableShares: number[][];
|
|
80
|
+
bump: number;
|
|
81
|
+
creator: PublicKey;
|
|
82
|
+
index: import("bn.js");
|
|
83
|
+
totalOptions: number;
|
|
84
|
+
maxOptions: number;
|
|
85
|
+
openTimestamp: import("bn.js") | null;
|
|
86
|
+
timeToStake: import("bn.js");
|
|
87
|
+
timeToReveal: import("bn.js");
|
|
88
|
+
selectedOption: number | null;
|
|
89
|
+
stateNonce: import("bn.js");
|
|
90
|
+
maxShares: import("bn.js");
|
|
91
|
+
rewardLamports: import("bn.js");
|
|
92
|
+
selectAuthority: PublicKey | null;
|
|
93
|
+
};
|
|
94
|
+
}>;
|
|
95
|
+
export type DecryptedMarketShares = Awaited<ReturnType<typeof fetchAndDecryptMarketShares>>;
|
|
96
|
+
/**
|
|
97
|
+
* Fetches a vote token account without decryption
|
|
98
|
+
*
|
|
99
|
+
* @param program - Anchor program instance
|
|
100
|
+
* @param voteTokenAccountPda - PDA of the vote token account
|
|
101
|
+
* @returns Vote token account data
|
|
102
|
+
* @throws If account doesn't exist
|
|
103
|
+
*/
|
|
104
|
+
export declare function fetchVoteTokenAccount(program: Program<ConvictionMarket>, voteTokenAccountPda: PublicKey): Promise<{
|
|
105
|
+
encryptedState: number[][];
|
|
106
|
+
bump: number;
|
|
107
|
+
owner: PublicKey;
|
|
108
|
+
stateNonce: import("bn.js");
|
|
109
|
+
}>;
|
|
110
|
+
export type VoteTokenAccountData = Awaited<ReturnType<typeof fetchVoteTokenAccount>>;
|
|
111
|
+
/**
|
|
112
|
+
* Fetches a share account without decryption
|
|
113
|
+
*
|
|
114
|
+
* @param program - Anchor program instance
|
|
115
|
+
* @param shareAccountPda - PDA of the share account
|
|
116
|
+
* @returns Share account data
|
|
117
|
+
* @throws If account doesn't exist
|
|
118
|
+
*/
|
|
119
|
+
export declare function fetchShareAccount(program: Program<ConvictionMarket>, shareAccountPda: PublicKey): Promise<{
|
|
120
|
+
encryptedState: number[][];
|
|
121
|
+
stateNonce: import("bn.js");
|
|
122
|
+
bump: number;
|
|
123
|
+
owner: PublicKey;
|
|
124
|
+
market: PublicKey;
|
|
125
|
+
encryptedStateDisclosure: number[][];
|
|
126
|
+
stateNonceDisclosure: import("bn.js");
|
|
127
|
+
boughtAtTimestamp: import("bn.js");
|
|
128
|
+
revealedAmount: import("bn.js") | null;
|
|
129
|
+
revealedOption: number | null;
|
|
130
|
+
revealedScore: import("bn.js") | null;
|
|
131
|
+
totalIncremented: boolean;
|
|
132
|
+
}>;
|
|
133
|
+
export type ShareAccountData = Awaited<ReturnType<typeof fetchShareAccount>>;
|
|
134
|
+
/**
|
|
135
|
+
* Fetches a conviction market account
|
|
136
|
+
*
|
|
137
|
+
* @param program - Anchor program instance
|
|
138
|
+
* @param marketPda - PDA of the conviction market
|
|
139
|
+
* @returns Conviction market account data
|
|
140
|
+
* @throws If account doesn't exist
|
|
141
|
+
*/
|
|
142
|
+
export declare function fetchConvictionMarket(program: Program<ConvictionMarket>, marketPda: PublicKey): Promise<{
|
|
143
|
+
encryptedAvailableShares: number[][];
|
|
144
|
+
bump: number;
|
|
145
|
+
creator: PublicKey;
|
|
146
|
+
index: import("bn.js");
|
|
147
|
+
totalOptions: number;
|
|
148
|
+
maxOptions: number;
|
|
149
|
+
openTimestamp: import("bn.js") | null;
|
|
150
|
+
timeToStake: import("bn.js");
|
|
151
|
+
timeToReveal: import("bn.js");
|
|
152
|
+
selectedOption: number | null;
|
|
153
|
+
stateNonce: import("bn.js");
|
|
154
|
+
maxShares: import("bn.js");
|
|
155
|
+
rewardLamports: import("bn.js");
|
|
156
|
+
selectAuthority: PublicKey | null;
|
|
157
|
+
}>;
|
|
158
|
+
export type ConvictionMarketAccount = Awaited<ReturnType<typeof fetchConvictionMarket>>;
|
|
159
|
+
/**
|
|
160
|
+
* Fetches a market option account
|
|
161
|
+
*
|
|
162
|
+
* @param program - Anchor program instance
|
|
163
|
+
* @param optionPda - PDA of the market option
|
|
164
|
+
* @returns Market option account data
|
|
165
|
+
* @throws If account doesn't exist
|
|
166
|
+
*/
|
|
167
|
+
export declare function fetchMarketOption(program: Program<ConvictionMarket>, optionPda: PublicKey): Promise<{
|
|
168
|
+
bump: number;
|
|
169
|
+
creator: PublicKey;
|
|
170
|
+
name: string;
|
|
171
|
+
totalShares: import("bn.js") | null;
|
|
172
|
+
totalScore: import("bn.js") | null;
|
|
173
|
+
}>;
|
|
174
|
+
export type ConvictionMarketOptionData = Awaited<ReturnType<typeof fetchMarketOption>>;
|
|
175
|
+
/**
|
|
176
|
+
* Checks if a vote token account exists
|
|
177
|
+
*
|
|
178
|
+
* @param provider - Anchor provider
|
|
179
|
+
* @param voteTokenAccountPda - PDA of the vote token account
|
|
180
|
+
* @returns True if account exists, false otherwise
|
|
181
|
+
*/
|
|
182
|
+
export declare function voteTokenAccountExists(provider: AnchorProvider, voteTokenAccountPda: PublicKey): Promise<boolean>;
|
|
183
|
+
/**
|
|
184
|
+
* Checks if a share account exists
|
|
185
|
+
*
|
|
186
|
+
* @param provider - Anchor provider
|
|
187
|
+
* @param shareAccountPda - PDA of the share account
|
|
188
|
+
* @returns True if account exists, false otherwise
|
|
189
|
+
*/
|
|
190
|
+
export declare function shareAccountExists(provider: AnchorProvider, shareAccountPda: PublicKey): Promise<boolean>;
|
|
191
|
+
//# sourceMappingURL=accounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/utils/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAIjE;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAKjF;AAED;;;;;;;;GAQG;AACH,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,EAClC,mBAAmB,EAAE,SAAS,EAC9B,iBAAiB,EAAE;IAAE,SAAS,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,UAAU,CAAA;CAAE;;;;;;;;GAwBpE;AAED,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAAC,CAAC;AAEpG;;;;;;;;GAQG;AACH,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,EA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AiB,CACrC,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,EAClC,SAAS,EAAE,SAAS;;;;;;GAGrB;AAED,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC;AAEvF;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,cAAc,EACxB,mBAAmB,EAAE,SAAS,GAC7B,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,cAAc,EACxB,eAAe,EAAE,SAAS,GACzB,OAAO,CAAC,OAAO,CAAC,CAGlB"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { Program } from "@coral-xyz/anchor";
|
|
2
|
+
import { createEncryptionContext, fetchMXEPublicKey } from "./encryption";
|
|
3
|
+
import IDL from "../idl/conviction_market.json";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a Program instance for the Conviction Market program
|
|
6
|
+
*
|
|
7
|
+
* @param provider - Anchor provider
|
|
8
|
+
* @returns Program instance
|
|
9
|
+
*/
|
|
10
|
+
export function createProgram(provider) {
|
|
11
|
+
return new Program(IDL, provider);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Fetches and decrypts a user's vote token balance
|
|
15
|
+
*
|
|
16
|
+
* @param program - Anchor program instance
|
|
17
|
+
* @param voteTokenAccountPda - PDA of the vote token account
|
|
18
|
+
* @param userX25519Keypair - User's X25519 keypair for decryption
|
|
19
|
+
* @returns Decrypted balance and account data
|
|
20
|
+
* @throws If account doesn't exist or decryption fails
|
|
21
|
+
*/
|
|
22
|
+
export async function fetchAndDecryptVoteTokenBalance(program, voteTokenAccountPda, userX25519Keypair) {
|
|
23
|
+
const account = await program.account.voteTokenAccount.fetch(voteTokenAccountPda);
|
|
24
|
+
// Fetch MXE public key and create encryption context
|
|
25
|
+
const mxePublicKey = await fetchMXEPublicKey(program.provider, program.programId);
|
|
26
|
+
const encryptionContext = createEncryptionContext(userX25519Keypair, mxePublicKey);
|
|
27
|
+
const decrypted = encryptionContext.cipher.decrypt(account.encryptedState, Uint8Array.from(account.stateNonce.toArray("le", 16)));
|
|
28
|
+
if (!decrypted[0]) {
|
|
29
|
+
throw new Error("Failed to decrypt balance");
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
balance: decrypted[0],
|
|
33
|
+
account,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Fetches and decrypts a user's share account
|
|
38
|
+
*
|
|
39
|
+
* @param program - Anchor program instance
|
|
40
|
+
* @param shareAccountPda - PDA of the share account
|
|
41
|
+
* @param userX25519Keypair - User's X25519 keypair for decryption
|
|
42
|
+
* @returns Decrypted share data and account data
|
|
43
|
+
* @throws If account doesn't exist or decryption fails
|
|
44
|
+
*/
|
|
45
|
+
export async function fetchAndDecryptShareAccount(program, shareAccountPda, userX25519Keypair) {
|
|
46
|
+
const account = await program.account.shareAccount.fetch(shareAccountPda);
|
|
47
|
+
// Fetch MXE public key and create encryption context
|
|
48
|
+
const mxePublicKey = await fetchMXEPublicKey(program.provider, program.programId);
|
|
49
|
+
const encryptionContext = createEncryptionContext(userX25519Keypair, mxePublicKey);
|
|
50
|
+
const decrypted = encryptionContext.cipher.decrypt(account.encryptedState, Uint8Array.from(account.stateNonce.toArray("le", 16)));
|
|
51
|
+
if (!decrypted[0] || !decrypted[1]) {
|
|
52
|
+
throw new Error("Failed to decrypt share account");
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
amount: decrypted[0],
|
|
56
|
+
selectedOption: decrypted[1],
|
|
57
|
+
account,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Fetches and decrypts a market's available shares
|
|
62
|
+
*
|
|
63
|
+
* @param program - Anchor program instance
|
|
64
|
+
* @param marketPda - PDA of the conviction market
|
|
65
|
+
* @param userX25519Keypair - User's X25519 keypair for decryption
|
|
66
|
+
* @returns Decrypted available shares and account data
|
|
67
|
+
* @throws If account doesn't exist or decryption fails
|
|
68
|
+
*/
|
|
69
|
+
export async function fetchAndDecryptMarketShares(program, marketPda, userX25519Keypair) {
|
|
70
|
+
const account = await program.account.convictionMarket.fetch(marketPda);
|
|
71
|
+
// Fetch MXE public key and create encryption context
|
|
72
|
+
const mxePublicKey = await fetchMXEPublicKey(program.provider, program.programId);
|
|
73
|
+
const encryptionContext = createEncryptionContext(userX25519Keypair, mxePublicKey);
|
|
74
|
+
const decrypted = encryptionContext.cipher.decrypt(account.encryptedAvailableShares, Uint8Array.from(account.stateNonce.toArray("le", 16)));
|
|
75
|
+
if (!decrypted[0]) {
|
|
76
|
+
throw new Error("Failed to decrypt market shares");
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
availableShares: decrypted[0],
|
|
80
|
+
account,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Fetches a vote token account without decryption
|
|
85
|
+
*
|
|
86
|
+
* @param program - Anchor program instance
|
|
87
|
+
* @param voteTokenAccountPda - PDA of the vote token account
|
|
88
|
+
* @returns Vote token account data
|
|
89
|
+
* @throws If account doesn't exist
|
|
90
|
+
*/
|
|
91
|
+
export async function fetchVoteTokenAccount(program, voteTokenAccountPda) {
|
|
92
|
+
return await program.account.voteTokenAccount.fetch(voteTokenAccountPda);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Fetches a share account without decryption
|
|
96
|
+
*
|
|
97
|
+
* @param program - Anchor program instance
|
|
98
|
+
* @param shareAccountPda - PDA of the share account
|
|
99
|
+
* @returns Share account data
|
|
100
|
+
* @throws If account doesn't exist
|
|
101
|
+
*/
|
|
102
|
+
export async function fetchShareAccount(program, shareAccountPda) {
|
|
103
|
+
return await program.account.shareAccount.fetch(shareAccountPda);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Fetches a conviction market account
|
|
107
|
+
*
|
|
108
|
+
* @param program - Anchor program instance
|
|
109
|
+
* @param marketPda - PDA of the conviction market
|
|
110
|
+
* @returns Conviction market account data
|
|
111
|
+
* @throws If account doesn't exist
|
|
112
|
+
*/
|
|
113
|
+
export async function fetchConvictionMarket(program, marketPda) {
|
|
114
|
+
return await program.account.convictionMarket.fetch(marketPda);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Fetches a market option account
|
|
118
|
+
*
|
|
119
|
+
* @param program - Anchor program instance
|
|
120
|
+
* @param optionPda - PDA of the market option
|
|
121
|
+
* @returns Market option account data
|
|
122
|
+
* @throws If account doesn't exist
|
|
123
|
+
*/
|
|
124
|
+
export async function fetchMarketOption(program, optionPda) {
|
|
125
|
+
return await program.account.convictionMarketOption.fetch(optionPda);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Checks if a vote token account exists
|
|
129
|
+
*
|
|
130
|
+
* @param provider - Anchor provider
|
|
131
|
+
* @param voteTokenAccountPda - PDA of the vote token account
|
|
132
|
+
* @returns True if account exists, false otherwise
|
|
133
|
+
*/
|
|
134
|
+
export async function voteTokenAccountExists(provider, voteTokenAccountPda) {
|
|
135
|
+
const accountInfo = await provider.connection.getAccountInfo(voteTokenAccountPda);
|
|
136
|
+
return accountInfo !== null;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Checks if a share account exists
|
|
140
|
+
*
|
|
141
|
+
* @param provider - Anchor provider
|
|
142
|
+
* @param shareAccountPda - PDA of the share account
|
|
143
|
+
* @returns True if account exists, false otherwise
|
|
144
|
+
*/
|
|
145
|
+
export async function shareAccountExists(provider, shareAccountPda) {
|
|
146
|
+
const accountInfo = await provider.connection.getAccountInfo(shareAccountPda);
|
|
147
|
+
return accountInfo !== null;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=accounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../src/utils/accounts.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;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,QAAwB,EACxB,eAA0B;IAE1B,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;IAC9E,OAAO,WAAW,KAAK,IAAI,CAAC;AAC9B,CAAC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
package/dist/utils/index.js
CHANGED
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|