@cypher-zk/sdk 0.6.0 → 0.7.1

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.
@@ -178,8 +178,13 @@ declare const CLUSTERS: Record<ClusterName, ClusterConfig>;
178
178
  declare const ACCOUNT_DISCRIMINATOR_SIZE = 8;
179
179
  /** Minimum bet size: $1 USDC in lamports (1e6 micro-units). */
180
180
  declare const MIN_BET_USDC = 1000000n;
181
- /** Creator bond required to open a market: $10 USDC. */
182
- declare const CREATOR_BOND = 10000000n;
181
+ /**
182
+ * Minimum creator bond: $20 USDC/CSDC.
183
+ * The creator may deposit any amount >= this value at market creation.
184
+ * The actual bond is stored per-market in `MarketAccount.creatorBond`.
185
+ * @deprecated `CREATOR_BOND` (the old $10 fixed constant) is removed upstream — use `MIN_CREATOR_BOND`.
186
+ */
187
+ declare const MIN_CREATOR_BOND = 20000000n;
183
188
  /**
184
189
  * Window after `close_time` during which the designated resolver may submit
185
190
  * an outcome. After this elapses, the market is eligible for refunds.
@@ -1841,6 +1846,10 @@ type Cypher = {
1841
1846
  {
1842
1847
  "name": "challengePeriod";
1843
1848
  "type": "i64";
1849
+ },
1850
+ {
1851
+ "name": "bondAmount";
1852
+ "type": "u64";
1844
1853
  }
1845
1854
  ];
1846
1855
  },
@@ -2010,6 +2019,10 @@ type Cypher = {
2010
2019
  {
2011
2020
  "name": "challengePeriod";
2012
2021
  "type": "i64";
2022
+ },
2023
+ {
2024
+ "name": "bondAmount";
2025
+ "type": "u64";
2013
2026
  }
2014
2027
  ];
2015
2028
  },
@@ -4159,26 +4172,31 @@ type Cypher = {
4159
4172
  },
4160
4173
  {
4161
4174
  "code": 6037;
4175
+ "name": "bondTooSmall";
4176
+ "msg": "Creator bond is below the protocol minimum";
4177
+ },
4178
+ {
4179
+ "code": 6038;
4162
4180
  "name": "notPendingResolution";
4163
4181
  "msg": "Market is not pending resolution";
4164
4182
  },
4165
4183
  {
4166
- "code": 6038;
4184
+ "code": 6039;
4167
4185
  "name": "challengePeriodNotElapsed";
4168
4186
  "msg": "Challenge period has not elapsed yet";
4169
4187
  },
4170
4188
  {
4171
- "code": 6039;
4189
+ "code": 6040;
4172
4190
  "name": "challengePeriodElapsed";
4173
4191
  "msg": "Challenge period has already elapsed";
4174
4192
  },
4175
4193
  {
4176
- "code": 6040;
4194
+ "code": 6041;
4177
4195
  "name": "marketDisputed";
4178
4196
  "msg": "Market resolution is disputed — admin must override";
4179
4197
  },
4180
4198
  {
4181
- "code": 6041;
4199
+ "code": 6042;
4182
4200
  "name": "marketNotDisputed";
4183
4201
  "msg": "Market resolution is not disputed";
4184
4202
  }
@@ -6255,7 +6273,7 @@ declare function buildAllInitCompDefIx(client: CypherClient, params: InitCompDef
6255
6273
  }>>;
6256
6274
 
6257
6275
  interface CreateMarketParams {
6258
- /** Creator (and signer) — also pays the $10 bond. */
6276
+ /** Creator (and signer) — also pays the bond. */
6259
6277
  creator: PublicKey;
6260
6278
  /** Pinned accepted mint — read from `GlobalState.accepted_mint`. */
6261
6279
  acceptedMint: PublicKey;
@@ -6279,6 +6297,13 @@ interface CreateMarketParams {
6279
6297
  * `PendingResolution` for this long, during which anyone can flag.
6280
6298
  */
6281
6299
  challengePeriod: bigint | number;
6300
+ /**
6301
+ * Creator bond in micro-USDC/CSDC (u64). Must be ≥ `MIN_CREATOR_BOND`
6302
+ * ($20 USDC). No upper bound — creators may lock more to signal
6303
+ * commitment. Stored per-market in `MarketAccount.creatorBond` and
6304
+ * returned via `withdrawCreatorFunds` after resolution.
6305
+ */
6306
+ bondAmount: bigint | number;
6282
6307
  }
6283
6308
  /**
6284
6309
  * Build a `create_market` instruction (YesNo).
@@ -6524,16 +6549,19 @@ interface CreateMarketResult {
6524
6549
  market: MarketAccount | null;
6525
6550
  }
6526
6551
  /** Create a YES/NO market end-to-end. */
6527
- declare function createMarketAction(client: CypherClient, inputs: Omit<CreateMarketParams, "expectedMarketId" | "acceptedMint" | "challengePeriod"> & {
6552
+ declare function createMarketAction(client: CypherClient, inputs: Omit<CreateMarketParams, "expectedMarketId" | "acceptedMint" | "challengePeriod" | "bondAmount"> & {
6528
6553
  acceptedMint?: PublicKey;
6529
6554
  /** v0.2+: defaults to MIN_CHALLENGE_PERIOD_SECS (24h) if omitted. */
6530
6555
  challengePeriod?: bigint | number;
6556
+ /** Defaults to MIN_CREATOR_BOND ($20 USDC). Pass a larger value to signal stronger commitment. */
6557
+ bondAmount?: bigint | number;
6531
6558
  onProgress?: ProgressCallback;
6532
6559
  }): Promise<CreateMarketResult>;
6533
6560
  /** Create a multi-outcome market (2–4 outcomes) end-to-end. */
6534
- declare function createMarketMultiAction(client: CypherClient, inputs: Omit<CreateMarketMultiParams, "expectedMarketId" | "acceptedMint" | "challengePeriod"> & {
6561
+ declare function createMarketMultiAction(client: CypherClient, inputs: Omit<CreateMarketMultiParams, "expectedMarketId" | "acceptedMint" | "challengePeriod" | "bondAmount"> & {
6535
6562
  acceptedMint?: PublicKey;
6536
6563
  challengePeriod?: bigint | number;
6564
+ bondAmount?: bigint | number;
6537
6565
  onProgress?: ProgressCallback;
6538
6566
  }): Promise<CreateMarketResult>;
6539
6567
  /** Cancel a market that has no bets. Returns the post-cancel `Market`. */
@@ -6930,15 +6958,18 @@ declare class CypherClient {
6930
6958
  */
6931
6959
  readonly actions: {
6932
6960
  /** Create a YES/NO market. Fetches GlobalState for marketId + mint automatically. */
6933
- createMarket: (inputs: Omit<CreateMarketParams, "expectedMarketId" | "acceptedMint" | "challengePeriod"> & {
6961
+ createMarket: (inputs: Omit<CreateMarketParams, "expectedMarketId" | "acceptedMint" | "challengePeriod" | "bondAmount"> & {
6934
6962
  acceptedMint?: PublicKey;
6935
6963
  /** v0.2+: defaults to MIN_CHALLENGE_PERIOD_SECS (24h) if omitted. */
6936
6964
  challengePeriod?: bigint | number;
6965
+ /** Defaults to MIN_CREATOR_BOND ($20 USDC). Pass a larger amount to signal commitment. */
6966
+ bondAmount?: bigint | number;
6937
6967
  }) => Promise<CreateMarketResult>;
6938
6968
  /** Create a multi-outcome market (2–4 outcomes). */
6939
- createMarketMulti: (inputs: Omit<CreateMarketMultiParams, "expectedMarketId" | "acceptedMint" | "challengePeriod"> & {
6969
+ createMarketMulti: (inputs: Omit<CreateMarketMultiParams, "expectedMarketId" | "acceptedMint" | "challengePeriod" | "bondAmount"> & {
6940
6970
  acceptedMint?: PublicKey;
6941
6971
  challengePeriod?: bigint | number;
6972
+ bondAmount?: bigint | number;
6942
6973
  }) => Promise<CreateMarketResult>;
6943
6974
  /** Cancel a market with zero bets. Returns bond to creator. */
6944
6975
  cancelMarket: (inputs: Omit<CancelMarketParams, "acceptedMint"> & {
@@ -7046,4 +7077,4 @@ declare class CypherClient {
7046
7077
  constructor(opts: CypherClientOptions);
7047
7078
  }
7048
7079
 
7049
- export { KNOWN_MINTS as $, type AdminOverrideResolutionInputs as A, BPS_DENOMINATOR as B, CypherClient as C, type ClusterName as D, type EncryptedPositionAccount as E, type FinalizeResolutionInputs as F, type GlobalStateAccount as G, type ComputationResult as H, type CreateMarketMultiParams as I, type CreatorWithdrawnEvent as J, type CypherClientOptions as K, type CypherEventName as L, type MarketAccount as M, DEFAULT_CLAIM_PERIOD_SECS as N, DEFAULT_REFUND_PERIOD_SECS as O, type PlaceBetResult as P, DEFAULT_RESOLUTION_WINDOW_SECS as Q, type ResolutionActionResult as R, type SubscribeOptions as S, type EventCallback as T, type EventSubscription as U, type FinalizeResolutionParams as V, type FlagResolutionParams as W, INIT_COMP_DEF_INSTRUCTIONS as X, type InitCompDefMethodName as Y, type InitCompDefParams as Z, type InitializeParams as _, type CancelMarketParams as a, fetchMarketsByState as a$, type LpPositionAccount as a0, MAX_CHALLENGE_PERIOD_SECS as a1, MAX_LP_FEE_BPS as a2, MAX_OUTCOMES_MULTI as a3, MAX_PROTOCOL_FEE_BPS as a4, MAX_QUESTION_BYTES as a5, MIN_BET_USDC as a6, MIN_CHALLENGE_PERIOD_SECS as a7, MIN_OUTCOMES_MULTI as a8, type MarketCancelledEvent as a9, adminOverrideResolutionAction as aA, adminOverrideResolutionIx as aB, awaitComputation as aC, buildAllInitCompDefIx as aD, cancelMarketAction as aE, cancelMarketIx as aF, claimPayoutAction as aG, claimPayoutMultiIx as aH, claimPayoutYesnoIx as aI, claimRefundAction as aJ, claimRefundMultiIx as aK, claimRefundYesnoIx as aL, compDefOffsetBytes as aM, compDefOffsetU32 as aN, createCipher as aO, createMarketAction as aP, createMarketIx as aQ, createMarketMultiAction as aR, createMarketMultiIx as aS, createUserKeypair as aT, deriveSharedSecret as aU, fetchAllMarkets as aV, fetchGlobalState as aW, fetchLpPosition as aX, fetchLpPositionsByProvider as aY, fetchMarket as aZ, fetchMarketsByCreator as a_, MarketCategory as aa, type MarketCategoryValue as ab, type MarketCreatedEvent as ac, type MarketFinalizedEvent as ad, type MarketResolvedEvent as ae, MarketState as af, type MarketStateValue as ag, MarketType as ah, type MarketTypeValue as ai, ODDS_SCALE as aj, PROGRAM_ID as ak, type PayoutClaimedEvent as al, type PlacePrivateBetParams as am, type PollEventsOptions as an, type PolledEvent as ao, type ProgressCallback as ap, type RefundClaimedEvent as aq, type ResolutionFlaggedEvent as ar, type ResolutionOverriddenEvent as as, type ResolveMarketParams as at, type SendIxOptions as au, type UpdateAcceptedMintParams as av, type UserCryptoKeypair as aw, type Wallet as ax, type WithdrawCreatorFundsParams as ay, adminClaimRemainingIx as az, type ClaimResult as b, fetchMxePublicKey as b0, fetchPosition as b1, fetchPositionsForMarket as b2, fetchUserPositions as b3, finalizeResolutionAction as b4, finalizeResolutionIx as b5, flagResolutionAction as b6, flagResolutionIx as b7, freshNonce as b8, initCompDefIx as b9, subscribeAll as bA, subscribeEvent as bB, updateAcceptedMintIx as bC, withdrawCreatorFundsAction as bD, withdrawCreatorFundsIx as bE, initializeIx as ba, keypairToWallet as bb, leBytesToBigInt as bc, onBetPlaced as bd, onCreatorWithdrawn as be, onMarketCancelled as bf, onMarketCreated as bg, onMarketFinalized as bh, onMarketResolved as bi, onPayoutClaimed as bj, onRefundClaimed as bk, onResolutionFlagged as bl, onResolutionOverridden as bm, parseLogs as bn, parseLogsFor as bo, placeBetAction as bp, placePrivateBetMultiIx as bq, placePrivateBetYesnoIx as br, pollEvents as bs, randomComputationOffset as bt, readonlyWallet as bu, resolveMarketAction as bv, resolveMarketMultiIx as bw, resolveMarketYesnoIx as bx, sendIx as by, sendIxAndAwaitArcium as bz, type ClaimInputs as c, type CreateMarketResult as d, type CreateMarketParams as e, type FlagResolutionInputs as f, type PlaceBetInputs as g, type ResolveMarketResult as h, type ResolveMarketInputs as i, type CypherEvent as j, type Cypher as k, type CircuitName as l, ACCOUNT_DISCRIMINATOR_SIZE as m, ALL_CIRCUITS as n, ALL_EVENT_NAMES as o, type ActionProgressEvent as p, type ActionStage as q, type AdminClaimRemainingParams as r, type AdminOverrideResolutionParams as s, type AwaitComputationOptions as t, type BetPlacedEvent as u, CIRCUITS as v, CLUSTERS as w, CREATOR_BOND as x, type ClaimParams as y, type ClusterConfig as z };
7080
+ export { type LpPositionAccount as $, type AdminOverrideResolutionInputs as A, BPS_DENOMINATOR as B, CypherClient as C, type ComputationResult as D, type EncryptedPositionAccount as E, type FinalizeResolutionInputs as F, type GlobalStateAccount as G, type CreateMarketMultiParams as H, type CreatorWithdrawnEvent as I, type CypherClientOptions as J, type CypherEventName as K, DEFAULT_CLAIM_PERIOD_SECS as L, type MarketAccount as M, DEFAULT_REFUND_PERIOD_SECS as N, DEFAULT_RESOLUTION_WINDOW_SECS as O, type PlaceBetResult as P, type EventCallback as Q, type ResolutionActionResult as R, type SubscribeOptions as S, type EventSubscription as T, type FinalizeResolutionParams as U, type FlagResolutionParams as V, INIT_COMP_DEF_INSTRUCTIONS as W, type InitCompDefMethodName as X, type InitCompDefParams as Y, type InitializeParams as Z, KNOWN_MINTS as _, type CancelMarketParams as a, fetchMarketsByState as a$, MAX_CHALLENGE_PERIOD_SECS as a0, MAX_LP_FEE_BPS as a1, MAX_OUTCOMES_MULTI as a2, MAX_PROTOCOL_FEE_BPS as a3, MAX_QUESTION_BYTES as a4, MIN_BET_USDC as a5, MIN_CHALLENGE_PERIOD_SECS as a6, MIN_CREATOR_BOND as a7, MIN_OUTCOMES_MULTI as a8, type MarketCancelledEvent as a9, adminOverrideResolutionAction as aA, adminOverrideResolutionIx as aB, awaitComputation as aC, buildAllInitCompDefIx as aD, cancelMarketAction as aE, cancelMarketIx as aF, claimPayoutAction as aG, claimPayoutMultiIx as aH, claimPayoutYesnoIx as aI, claimRefundAction as aJ, claimRefundMultiIx as aK, claimRefundYesnoIx as aL, compDefOffsetBytes as aM, compDefOffsetU32 as aN, createCipher as aO, createMarketAction as aP, createMarketIx as aQ, createMarketMultiAction as aR, createMarketMultiIx as aS, createUserKeypair as aT, deriveSharedSecret as aU, fetchAllMarkets as aV, fetchGlobalState as aW, fetchLpPosition as aX, fetchLpPositionsByProvider as aY, fetchMarket as aZ, fetchMarketsByCreator as a_, MarketCategory as aa, type MarketCategoryValue as ab, type MarketCreatedEvent as ac, type MarketFinalizedEvent as ad, type MarketResolvedEvent as ae, MarketState as af, type MarketStateValue as ag, MarketType as ah, type MarketTypeValue as ai, ODDS_SCALE as aj, PROGRAM_ID as ak, type PayoutClaimedEvent as al, type PlacePrivateBetParams as am, type PollEventsOptions as an, type PolledEvent as ao, type ProgressCallback as ap, type RefundClaimedEvent as aq, type ResolutionFlaggedEvent as ar, type ResolutionOverriddenEvent as as, type ResolveMarketParams as at, type SendIxOptions as au, type UpdateAcceptedMintParams as av, type UserCryptoKeypair as aw, type Wallet as ax, type WithdrawCreatorFundsParams as ay, adminClaimRemainingIx as az, type ClaimResult as b, fetchMxePublicKey as b0, fetchPosition as b1, fetchPositionsForMarket as b2, fetchUserPositions as b3, finalizeResolutionAction as b4, finalizeResolutionIx as b5, flagResolutionAction as b6, flagResolutionIx as b7, freshNonce as b8, initCompDefIx as b9, subscribeAll as bA, subscribeEvent as bB, updateAcceptedMintIx as bC, withdrawCreatorFundsAction as bD, withdrawCreatorFundsIx as bE, initializeIx as ba, keypairToWallet as bb, leBytesToBigInt as bc, onBetPlaced as bd, onCreatorWithdrawn as be, onMarketCancelled as bf, onMarketCreated as bg, onMarketFinalized as bh, onMarketResolved as bi, onPayoutClaimed as bj, onRefundClaimed as bk, onResolutionFlagged as bl, onResolutionOverridden as bm, parseLogs as bn, parseLogsFor as bo, placeBetAction as bp, placePrivateBetMultiIx as bq, placePrivateBetYesnoIx as br, pollEvents as bs, randomComputationOffset as bt, readonlyWallet as bu, resolveMarketAction as bv, resolveMarketMultiIx as bw, resolveMarketYesnoIx as bx, sendIx as by, sendIxAndAwaitArcium as bz, type ClaimInputs as c, type CreateMarketResult as d, type CreateMarketParams as e, type FlagResolutionInputs as f, type PlaceBetInputs as g, type ResolveMarketResult as h, type ResolveMarketInputs as i, type CypherEvent as j, type Cypher as k, type CircuitName as l, ACCOUNT_DISCRIMINATOR_SIZE as m, ALL_CIRCUITS as n, ALL_EVENT_NAMES as o, type ActionProgressEvent as p, type ActionStage as q, type AdminClaimRemainingParams as r, type AdminOverrideResolutionParams as s, type AwaitComputationOptions as t, type BetPlacedEvent as u, CIRCUITS as v, CLUSTERS as w, type ClaimParams as x, type ClusterConfig as y, type ClusterName as z };
@@ -1577,6 +1577,10 @@
1577
1577
  {
1578
1578
  "name": "challenge_period",
1579
1579
  "type": "i64"
1580
+ },
1581
+ {
1582
+ "name": "bond_amount",
1583
+ "type": "u64"
1580
1584
  }
1581
1585
  ]
1582
1586
  },
@@ -1746,6 +1750,10 @@
1746
1750
  {
1747
1751
  "name": "challenge_period",
1748
1752
  "type": "i64"
1753
+ },
1754
+ {
1755
+ "name": "bond_amount",
1756
+ "type": "u64"
1749
1757
  }
1750
1758
  ]
1751
1759
  },
@@ -3895,26 +3903,31 @@
3895
3903
  },
3896
3904
  {
3897
3905
  "code": 6037,
3906
+ "name": "BondTooSmall",
3907
+ "msg": "Creator bond is below the protocol minimum"
3908
+ },
3909
+ {
3910
+ "code": 6038,
3898
3911
  "name": "NotPendingResolution",
3899
3912
  "msg": "Market is not pending resolution"
3900
3913
  },
3901
3914
  {
3902
- "code": 6038,
3915
+ "code": 6039,
3903
3916
  "name": "ChallengePeriodNotElapsed",
3904
3917
  "msg": "Challenge period has not elapsed yet"
3905
3918
  },
3906
3919
  {
3907
- "code": 6039,
3920
+ "code": 6040,
3908
3921
  "name": "ChallengePeriodElapsed",
3909
3922
  "msg": "Challenge period has already elapsed"
3910
3923
  },
3911
3924
  {
3912
- "code": 6040,
3925
+ "code": 6041,
3913
3926
  "name": "MarketDisputed",
3914
3927
  "msg": "Market resolution is disputed — admin must override"
3915
3928
  },
3916
3929
  {
3917
- "code": 6041,
3930
+ "code": 6042,
3918
3931
  "name": "MarketNotDisputed",
3919
3932
  "msg": "Market resolution is not disputed"
3920
3933
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { k as Cypher, C as CypherClient, l as CircuitName } from './client-B0EueahJ.js';
2
- export { m as ACCOUNT_DISCRIMINATOR_SIZE, n as ALL_CIRCUITS, o as ALL_EVENT_NAMES, p as ActionProgressEvent, q as ActionStage, r as AdminClaimRemainingParams, A as AdminOverrideResolutionInputs, s as AdminOverrideResolutionParams, t as AwaitComputationOptions, B as BPS_DENOMINATOR, u as BetPlacedEvent, v as CIRCUITS, w as CLUSTERS, x as CREATOR_BOND, a as CancelMarketParams, c as ClaimInputs, y as ClaimParams, b as ClaimResult, z as ClusterConfig, D as ClusterName, H as ComputationResult, I as CreateMarketMultiParams, e as CreateMarketParams, d as CreateMarketResult, J as CreatorWithdrawnEvent, K as CypherClientOptions, j as CypherEvent, L as CypherEventName, N as DEFAULT_CLAIM_PERIOD_SECS, O as DEFAULT_REFUND_PERIOD_SECS, Q as DEFAULT_RESOLUTION_WINDOW_SECS, E as EncryptedPositionAccount, T as EventCallback, U as EventSubscription, F as FinalizeResolutionInputs, V as FinalizeResolutionParams, f as FlagResolutionInputs, W as FlagResolutionParams, G as GlobalStateAccount, X as INIT_COMP_DEF_INSTRUCTIONS, Y as InitCompDefMethodName, Z as InitCompDefParams, _ as InitializeParams, $ as KNOWN_MINTS, a0 as LpPositionAccount, a1 as MAX_CHALLENGE_PERIOD_SECS, a2 as MAX_LP_FEE_BPS, a3 as MAX_OUTCOMES_MULTI, a4 as MAX_PROTOCOL_FEE_BPS, a5 as MAX_QUESTION_BYTES, a6 as MIN_BET_USDC, a7 as MIN_CHALLENGE_PERIOD_SECS, a8 as MIN_OUTCOMES_MULTI, M as MarketAccount, a9 as MarketCancelledEvent, aa as MarketCategory, ab as MarketCategoryValue, ac as MarketCreatedEvent, ad as MarketFinalizedEvent, ae as MarketResolvedEvent, af as MarketState, ag as MarketStateValue, ah as MarketType, ai as MarketTypeValue, aj as ODDS_SCALE, ak as PROGRAM_ID, al as PayoutClaimedEvent, g as PlaceBetInputs, P as PlaceBetResult, am as PlacePrivateBetParams, an as PollEventsOptions, ao as PolledEvent, ap as ProgressCallback, aq as RefundClaimedEvent, R as ResolutionActionResult, ar as ResolutionFlaggedEvent, as as ResolutionOverriddenEvent, i as ResolveMarketInputs, at as ResolveMarketParams, h as ResolveMarketResult, au as SendIxOptions, S as SubscribeOptions, av as UpdateAcceptedMintParams, aw as UserCryptoKeypair, ax as Wallet, ay as WithdrawCreatorFundsParams, az as adminClaimRemainingIx, aA as adminOverrideResolutionAction, aB as adminOverrideResolutionIx, aC as awaitComputation, aD as buildAllInitCompDefIx, aE as cancelMarketAction, aF as cancelMarketIx, aG as claimPayoutAction, aH as claimPayoutMultiIx, aI as claimPayoutYesnoIx, aJ as claimRefundAction, aK as claimRefundMultiIx, aL as claimRefundYesnoIx, aM as compDefOffsetBytes, aN as compDefOffsetU32, aO as createCipher, aP as createMarketAction, aQ as createMarketIx, aR as createMarketMultiAction, aS as createMarketMultiIx, aT as createUserKeypair, aU as deriveSharedSecret, aV as fetchAllMarkets, aW as fetchGlobalState, aX as fetchLpPosition, aY as fetchLpPositionsByProvider, aZ as fetchMarket, a_ as fetchMarketsByCreator, a$ as fetchMarketsByState, b0 as fetchMxePublicKey, b1 as fetchPosition, b2 as fetchPositionsForMarket, b3 as fetchUserPositions, b4 as finalizeResolutionAction, b5 as finalizeResolutionIx, b6 as flagResolutionAction, b7 as flagResolutionIx, b8 as freshNonce, b9 as initCompDefIx, ba as initializeIx, bb as keypairToWallet, bc as leBytesToBigInt, bd as onBetPlaced, be as onCreatorWithdrawn, bf as onMarketCancelled, bg as onMarketCreated, bh as onMarketFinalized, bi as onMarketResolved, bj as onPayoutClaimed, bk as onRefundClaimed, bl as onResolutionFlagged, bm as onResolutionOverridden, bn as parseLogs, bo as parseLogsFor, bp as placeBetAction, bq as placePrivateBetMultiIx, br as placePrivateBetYesnoIx, bs as pollEvents, bt as randomComputationOffset, bu as readonlyWallet, bv as resolveMarketAction, bw as resolveMarketMultiIx, bx as resolveMarketYesnoIx, by as sendIx, bz as sendIxAndAwaitArcium, bA as subscribeAll, bB as subscribeEvent, bC as updateAcceptedMintIx, bD as withdrawCreatorFundsAction, bE as withdrawCreatorFundsIx } from './client-B0EueahJ.js';
1
+ import { k as Cypher, C as CypherClient, l as CircuitName } from './client-sr7mY_Wj.js';
2
+ export { m as ACCOUNT_DISCRIMINATOR_SIZE, n as ALL_CIRCUITS, o as ALL_EVENT_NAMES, p as ActionProgressEvent, q as ActionStage, r as AdminClaimRemainingParams, A as AdminOverrideResolutionInputs, s as AdminOverrideResolutionParams, t as AwaitComputationOptions, B as BPS_DENOMINATOR, u as BetPlacedEvent, v as CIRCUITS, w as CLUSTERS, a as CancelMarketParams, c as ClaimInputs, x as ClaimParams, b as ClaimResult, y as ClusterConfig, z as ClusterName, D as ComputationResult, H as CreateMarketMultiParams, e as CreateMarketParams, d as CreateMarketResult, I as CreatorWithdrawnEvent, J as CypherClientOptions, j as CypherEvent, K as CypherEventName, L as DEFAULT_CLAIM_PERIOD_SECS, N as DEFAULT_REFUND_PERIOD_SECS, O as DEFAULT_RESOLUTION_WINDOW_SECS, E as EncryptedPositionAccount, Q as EventCallback, T as EventSubscription, F as FinalizeResolutionInputs, U as FinalizeResolutionParams, f as FlagResolutionInputs, V as FlagResolutionParams, G as GlobalStateAccount, W as INIT_COMP_DEF_INSTRUCTIONS, X as InitCompDefMethodName, Y as InitCompDefParams, Z as InitializeParams, _ as KNOWN_MINTS, $ as LpPositionAccount, a0 as MAX_CHALLENGE_PERIOD_SECS, a1 as MAX_LP_FEE_BPS, a2 as MAX_OUTCOMES_MULTI, a3 as MAX_PROTOCOL_FEE_BPS, a4 as MAX_QUESTION_BYTES, a5 as MIN_BET_USDC, a6 as MIN_CHALLENGE_PERIOD_SECS, a7 as MIN_CREATOR_BOND, a8 as MIN_OUTCOMES_MULTI, M as MarketAccount, a9 as MarketCancelledEvent, aa as MarketCategory, ab as MarketCategoryValue, ac as MarketCreatedEvent, ad as MarketFinalizedEvent, ae as MarketResolvedEvent, af as MarketState, ag as MarketStateValue, ah as MarketType, ai as MarketTypeValue, aj as ODDS_SCALE, ak as PROGRAM_ID, al as PayoutClaimedEvent, g as PlaceBetInputs, P as PlaceBetResult, am as PlacePrivateBetParams, an as PollEventsOptions, ao as PolledEvent, ap as ProgressCallback, aq as RefundClaimedEvent, R as ResolutionActionResult, ar as ResolutionFlaggedEvent, as as ResolutionOverriddenEvent, i as ResolveMarketInputs, at as ResolveMarketParams, h as ResolveMarketResult, au as SendIxOptions, S as SubscribeOptions, av as UpdateAcceptedMintParams, aw as UserCryptoKeypair, ax as Wallet, ay as WithdrawCreatorFundsParams, az as adminClaimRemainingIx, aA as adminOverrideResolutionAction, aB as adminOverrideResolutionIx, aC as awaitComputation, aD as buildAllInitCompDefIx, aE as cancelMarketAction, aF as cancelMarketIx, aG as claimPayoutAction, aH as claimPayoutMultiIx, aI as claimPayoutYesnoIx, aJ as claimRefundAction, aK as claimRefundMultiIx, aL as claimRefundYesnoIx, aM as compDefOffsetBytes, aN as compDefOffsetU32, aO as createCipher, aP as createMarketAction, aQ as createMarketIx, aR as createMarketMultiAction, aS as createMarketMultiIx, aT as createUserKeypair, aU as deriveSharedSecret, aV as fetchAllMarkets, aW as fetchGlobalState, aX as fetchLpPosition, aY as fetchLpPositionsByProvider, aZ as fetchMarket, a_ as fetchMarketsByCreator, a$ as fetchMarketsByState, b0 as fetchMxePublicKey, b1 as fetchPosition, b2 as fetchPositionsForMarket, b3 as fetchUserPositions, b4 as finalizeResolutionAction, b5 as finalizeResolutionIx, b6 as flagResolutionAction, b7 as flagResolutionIx, b8 as freshNonce, b9 as initCompDefIx, ba as initializeIx, bb as keypairToWallet, bc as leBytesToBigInt, bd as onBetPlaced, be as onCreatorWithdrawn, bf as onMarketCancelled, bg as onMarketCreated, bh as onMarketFinalized, bi as onMarketResolved, bj as onPayoutClaimed, bk as onRefundClaimed, bl as onResolutionFlagged, bm as onResolutionOverridden, bn as parseLogs, bo as parseLogsFor, bp as placeBetAction, bq as placePrivateBetMultiIx, br as placePrivateBetYesnoIx, bs as pollEvents, bt as randomComputationOffset, bu as readonlyWallet, bv as resolveMarketAction, bw as resolveMarketMultiIx, bx as resolveMarketYesnoIx, by as sendIx, bz as sendIxAndAwaitArcium, bA as subscribeAll, bB as subscribeEvent, bC as updateAcceptedMintIx, bD as withdrawCreatorFundsAction, bE as withdrawCreatorFundsIx } from './client-sr7mY_Wj.js';
3
3
  import { GetProgramAccountsFilter, PublicKey } from '@solana/web3.js';
4
4
  import { BN } from '@anchor-lang/core';
5
5
  import { RescueCipher } from '@arcium-hq/client';
@@ -401,11 +401,12 @@ declare const CypherErrorCode: {
401
401
  readonly NotAcceptedMint: 6034;
402
402
  readonly InvalidCategory: 6035;
403
403
  readonly InvalidChallengePeriod: 6036;
404
- readonly NotPendingResolution: 6037;
405
- readonly ChallengePeriodNotElapsed: 6038;
406
- readonly ChallengePeriodElapsed: 6039;
407
- readonly MarketDisputed: 6040;
408
- readonly MarketNotDisputed: 6041;
404
+ readonly BondTooSmall: 6037;
405
+ readonly NotPendingResolution: 6038;
406
+ readonly ChallengePeriodNotElapsed: 6039;
407
+ readonly ChallengePeriodElapsed: 6040;
408
+ readonly MarketDisputed: 6041;
409
+ readonly MarketNotDisputed: 6042;
409
410
  };
410
411
  type CypherErrorName = keyof typeof CypherErrorCode;
411
412
  type CypherErrorCodeValue = (typeof CypherErrorCode)[keyof typeof CypherErrorCode];
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { __commonJS, __toESM } from './chunk-5WRI5ZAA.js';
2
- import idlJson from './cypher-M5PH6UM5.json';
2
+ import idlJson from './cypher-G57ZWFM3.json';
3
3
  import { PublicKey, AddressLookupTableProgram, SystemProgram, Transaction } from '@solana/web3.js';
4
4
  import { BN, AnchorProvider, Program, BorshCoder, EventParser } from '@anchor-lang/core';
5
- import { getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID } from '@solana/spl-token';
5
+ import { getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID, createAssociatedTokenAccountIdempotentInstruction } from '@solana/spl-token';
6
6
  export { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync } from '@solana/spl-token';
7
7
  import { getCompDefAccOffset, getMXEAccAddress, getCompDefAccAddress, getArciumProgramId, getLookupTableAddress, getClockAccAddress, getFeePoolAccAddress, getExecutingPoolAccAddress, getMempoolAccAddress, getClusterAccAddress, getComputationAccAddress, awaitComputationFinalization, x25519, RescueCipher, getMXEPublicKey } from '@arcium-hq/client';
8
8
 
@@ -2009,7 +2009,7 @@ var CLUSTERS = {
2009
2009
  };
2010
2010
  var ACCOUNT_DISCRIMINATOR_SIZE = 8;
2011
2011
  var MIN_BET_USDC = 1000000n;
2012
- var CREATOR_BOND = 10000000n;
2012
+ var MIN_CREATOR_BOND = 20000000n;
2013
2013
  var DEFAULT_RESOLUTION_WINDOW_SECS = 7 * 24 * 3600;
2014
2014
  var DEFAULT_CLAIM_PERIOD_SECS = 14 * 24 * 3600;
2015
2015
  var DEFAULT_REFUND_PERIOD_SECS = 14 * 24 * 3600;
@@ -2224,11 +2224,12 @@ var CypherErrorCode = {
2224
2224
  NotAcceptedMint: 6034,
2225
2225
  InvalidCategory: 6035,
2226
2226
  InvalidChallengePeriod: 6036,
2227
- NotPendingResolution: 6037,
2228
- ChallengePeriodNotElapsed: 6038,
2229
- ChallengePeriodElapsed: 6039,
2230
- MarketDisputed: 6040,
2231
- MarketNotDisputed: 6041
2227
+ BondTooSmall: 6037,
2228
+ NotPendingResolution: 6038,
2229
+ ChallengePeriodNotElapsed: 6039,
2230
+ ChallengePeriodElapsed: 6040,
2231
+ MarketDisputed: 6041,
2232
+ MarketNotDisputed: 6042
2232
2233
  };
2233
2234
  var CYPHER_ERROR_MESSAGES = Object.freeze(
2234
2235
  Object.fromEntries(
@@ -2679,6 +2680,11 @@ function validateMarketDraft(params) {
2679
2680
  `createMarketIx: challengePeriod must be in [${MIN_CHALLENGE_PERIOD_SECS}, ${MAX_CHALLENGE_PERIOD_SECS}] seconds`
2680
2681
  );
2681
2682
  }
2683
+ if (BigInt(params.bondAmount) < MIN_CREATOR_BOND) {
2684
+ throw new Error(
2685
+ `createMarketIx: bondAmount must be >= ${MIN_CREATOR_BOND} (MIN_CREATOR_BOND = $20 USDC)`
2686
+ );
2687
+ }
2682
2688
  }
2683
2689
  async function createMarketIx(client, params) {
2684
2690
  validateMarketDraft(params);
@@ -2691,7 +2697,8 @@ async function createMarketIx(client, params) {
2691
2697
  params.question,
2692
2698
  toBN(params.closeTime),
2693
2699
  params.category,
2694
- toBN(params.challengePeriod)
2700
+ toBN(params.challengePeriod),
2701
+ toBN(params.bondAmount)
2695
2702
  ).accountsPartial({
2696
2703
  creator: params.creator,
2697
2704
  globalState: gsPda,
@@ -2721,7 +2728,8 @@ async function createMarketMultiIx(client, params) {
2721
2728
  toBN(params.closeTime),
2722
2729
  params.category,
2723
2730
  params.numOutcomes,
2724
- toBN(params.challengePeriod)
2731
+ toBN(params.challengePeriod),
2732
+ toBN(params.bondAmount)
2725
2733
  ).accountsPartial({
2726
2734
  creator: params.creator,
2727
2735
  globalState: gsPda,
@@ -3085,8 +3093,6 @@ function rethrowCypher(err) {
3085
3093
  }
3086
3094
  throw err;
3087
3095
  }
3088
-
3089
- // src/actions/createMarket.ts
3090
3096
  async function createMarketCommon(client, inputs) {
3091
3097
  emitProgress(inputs.onProgress, "validating", {
3092
3098
  message: "Validating market draft"
@@ -3101,16 +3107,41 @@ async function createMarketCommon(client, inputs) {
3101
3107
  const acceptedMint = inputs.acceptedMint ?? gs.acceptedMint;
3102
3108
  const expectedMarketId = gs.marketCounter;
3103
3109
  const challengePeriod = inputs.challengePeriod ?? MIN_CHALLENGE_PERIOD_SECS;
3110
+ const bondAmount = inputs.bondAmount ?? MIN_CREATOR_BOND;
3111
+ const creatorAta = getAssociatedTokenAddressSync(
3112
+ acceptedMint,
3113
+ inputs.creator,
3114
+ false,
3115
+ TOKEN_PROGRAM_ID,
3116
+ ASSOCIATED_TOKEN_PROGRAM_ID
3117
+ );
3118
+ const ataInfo = await client.connection.getAccountInfo(creatorAta);
3119
+ if (!ataInfo) {
3120
+ emitProgress(inputs.onProgress, "validating", {
3121
+ message: "Initializing token account for accepted mint..."
3122
+ });
3123
+ const createAtaIx = createAssociatedTokenAccountIdempotentInstruction(
3124
+ inputs.creator,
3125
+ creatorAta,
3126
+ inputs.creator,
3127
+ acceptedMint,
3128
+ TOKEN_PROGRAM_ID,
3129
+ ASSOCIATED_TOKEN_PROGRAM_ID
3130
+ );
3131
+ await sendIx(client, createAtaIx);
3132
+ }
3104
3133
  const ix = inputs.kind === "yesno" ? await createMarketIx(client, {
3105
3134
  ...inputs,
3106
3135
  acceptedMint,
3107
3136
  expectedMarketId,
3108
- challengePeriod
3137
+ challengePeriod,
3138
+ bondAmount
3109
3139
  }) : await createMarketMultiIx(client, {
3110
3140
  ...inputs,
3111
3141
  acceptedMint,
3112
3142
  expectedMarketId,
3113
- challengePeriod
3143
+ challengePeriod,
3144
+ bondAmount
3114
3145
  });
3115
3146
  emitProgress(inputs.onProgress, "submitting", {
3116
3147
  message: "Submitting create-market transaction"
@@ -3927,6 +3958,6 @@ safe-buffer/index.js:
3927
3958
  (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
3928
3959
  */
3929
3960
 
3930
- export { ACCOUNT_DISCRIMINATOR_SIZE, ADDRESS_LOOKUP_TABLE_PROGRAM_ID, ALL_CIRCUITS, ALL_EVENT_NAMES, BPS_DENOMINATOR, CIRCUITS, CLUSTERS, CREATOR_BOND, CYPHER_ERROR_MESSAGES, CypherClient, CypherErrorCode, DEFAULT_CLAIM_PERIOD_SECS, DEFAULT_REFUND_PERIOD_SECS, DEFAULT_RESOLUTION_WINDOW_SECS, ENCRYPTED_POSITION_OFFSETS, GLOBAL_STATE_OFFSETS, IDL, IDL_PROGRAM_ID, INIT_COMP_DEF_INSTRUCTIONS, KNOWN_MINTS, LP_POSITION_OFFSETS, MARKET_OFFSETS, MAX_CHALLENGE_PERIOD_SECS, MAX_LP_FEE_BPS, MAX_OUTCOMES_MULTI, MAX_PROTOCOL_FEE_BPS, MAX_QUESTION_BYTES, MIN_BET_USDC, MIN_CHALLENGE_PERIOD_SECS, MIN_OUTCOMES_MULTI, MarketCategory, MarketState, MarketType, ODDS_SCALE, PROGRAM_ID, adminClaimRemainingIx, adminOverrideResolutionAction, adminOverrideResolutionIx, arciumSignerPda, awaitComputation, bigIntToLeBytes, buildAllInitCompDefIx, buildArciumQueueAccounts, cancelMarketAction, cancelMarketIx, claimPayoutAction, claimPayoutMultiIx, claimPayoutYesnoIx, claimRefundAction, claimRefundMultiIx, claimRefundYesnoIx, compDefOffsetBytes, compDefOffsetU32, computeFees, createCipher, createMarketAction, createMarketIx, createMarketMultiAction, createMarketMultiIx, createUserKeypair, cypherErrorName, decryptBetInput, deriveSharedSecret, discriminatorFilter, encryptBetInput, encryptRefundInput, fetchAllMarkets, fetchGlobalState, fetchLpPosition, fetchLpPositionsByProvider, fetchMarket, fetchMarketsByCreator, fetchMarketsByState, fetchMxeLookupTable, fetchMxePublicKey, fetchPosition, fetchPositionsForMarket, fetchUserPositions, finalizeResolutionAction, finalizeResolutionIx, flagResolutionAction, flagResolutionIx, freshNonce, globalStatePda, initCompDefIx, initializeIx, isBetAmountValid, isValidCloseTime, keypairToWallet, leBytesToBigInt, lpPositionFilters, lpPositionPda, marketFilters, marketPda, marketPhase, marketVaultPda, onBetPlaced, onCreatorWithdrawn, onMarketCancelled, onMarketCreated, onMarketFinalized, onMarketResolved, onPayoutClaimed, onRefundClaimed, onResolutionFlagged, onResolutionOverridden, parseCypherError, parseLogs, parseLogsFor, placeBetAction, placePrivateBetMultiIx, placePrivateBetYesnoIx, pollEvents, positionFilters, positionPda, projectDeadlines, randomComputationOffset, readonlyWallet, resolveMarketAction, resolveMarketMultiIx, resolveMarketYesnoIx, sendIx, sendIxAndAwaitArcium, subscribeAll, subscribeEvent, toBN, updateAcceptedMintIx, userAta, withdrawCreatorFundsAction, withdrawCreatorFundsIx };
3961
+ export { ACCOUNT_DISCRIMINATOR_SIZE, ADDRESS_LOOKUP_TABLE_PROGRAM_ID, ALL_CIRCUITS, ALL_EVENT_NAMES, BPS_DENOMINATOR, CIRCUITS, CLUSTERS, CYPHER_ERROR_MESSAGES, CypherClient, CypherErrorCode, DEFAULT_CLAIM_PERIOD_SECS, DEFAULT_REFUND_PERIOD_SECS, DEFAULT_RESOLUTION_WINDOW_SECS, ENCRYPTED_POSITION_OFFSETS, GLOBAL_STATE_OFFSETS, IDL, IDL_PROGRAM_ID, INIT_COMP_DEF_INSTRUCTIONS, KNOWN_MINTS, LP_POSITION_OFFSETS, MARKET_OFFSETS, MAX_CHALLENGE_PERIOD_SECS, MAX_LP_FEE_BPS, MAX_OUTCOMES_MULTI, MAX_PROTOCOL_FEE_BPS, MAX_QUESTION_BYTES, MIN_BET_USDC, MIN_CHALLENGE_PERIOD_SECS, MIN_CREATOR_BOND, MIN_OUTCOMES_MULTI, MarketCategory, MarketState, MarketType, ODDS_SCALE, PROGRAM_ID, adminClaimRemainingIx, adminOverrideResolutionAction, adminOverrideResolutionIx, arciumSignerPda, awaitComputation, bigIntToLeBytes, buildAllInitCompDefIx, buildArciumQueueAccounts, cancelMarketAction, cancelMarketIx, claimPayoutAction, claimPayoutMultiIx, claimPayoutYesnoIx, claimRefundAction, claimRefundMultiIx, claimRefundYesnoIx, compDefOffsetBytes, compDefOffsetU32, computeFees, createCipher, createMarketAction, createMarketIx, createMarketMultiAction, createMarketMultiIx, createUserKeypair, cypherErrorName, decryptBetInput, deriveSharedSecret, discriminatorFilter, encryptBetInput, encryptRefundInput, fetchAllMarkets, fetchGlobalState, fetchLpPosition, fetchLpPositionsByProvider, fetchMarket, fetchMarketsByCreator, fetchMarketsByState, fetchMxeLookupTable, fetchMxePublicKey, fetchPosition, fetchPositionsForMarket, fetchUserPositions, finalizeResolutionAction, finalizeResolutionIx, flagResolutionAction, flagResolutionIx, freshNonce, globalStatePda, initCompDefIx, initializeIx, isBetAmountValid, isValidCloseTime, keypairToWallet, leBytesToBigInt, lpPositionFilters, lpPositionPda, marketFilters, marketPda, marketPhase, marketVaultPda, onBetPlaced, onCreatorWithdrawn, onMarketCancelled, onMarketCreated, onMarketFinalized, onMarketResolved, onPayoutClaimed, onRefundClaimed, onResolutionFlagged, onResolutionOverridden, parseCypherError, parseLogs, parseLogsFor, placeBetAction, placePrivateBetMultiIx, placePrivateBetYesnoIx, pollEvents, positionFilters, positionPda, projectDeadlines, randomComputationOffset, readonlyWallet, resolveMarketAction, resolveMarketMultiIx, resolveMarketYesnoIx, sendIx, sendIxAndAwaitArcium, subscribeAll, subscribeEvent, toBN, updateAcceptedMintIx, userAta, withdrawCreatorFundsAction, withdrawCreatorFundsIx };
3931
3962
  //# sourceMappingURL=index.js.map
3932
3963
  //# sourceMappingURL=index.js.map