@cypher-zk/sdk 0.1.0 → 0.2.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 +35 -32
- package/dist/{client-CO5-Gpyu.d.ts → client-hOLBWshA.d.ts} +90 -21
- package/dist/index.d.ts +4 -37
- package/dist/index.js +129 -11
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js.map +1 -1
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -28,11 +28,11 @@ bun add @cypher-zk/sdk
|
|
|
28
28
|
|
|
29
29
|
### Peer dependencies
|
|
30
30
|
|
|
31
|
-
| Package
|
|
32
|
-
|
|
|
33
|
-
| `react` ^18/^19
|
|
31
|
+
| Package | Required for |
|
|
32
|
+
| -------------------------- | --------------------------------- |
|
|
33
|
+
| `react` ^18/^19 | `@cypher-zk/sdk/react` hooks only |
|
|
34
34
|
| `@tanstack/react-query` ^5 | `@cypher-zk/sdk/react` hooks only |
|
|
35
|
-
| `typescript` ^5
|
|
35
|
+
| `typescript` ^5 | Type checking |
|
|
36
36
|
|
|
37
37
|
## Quick Start
|
|
38
38
|
|
|
@@ -69,7 +69,7 @@ const result = await client.actions.placeBet({
|
|
|
69
69
|
user: wallet.publicKey,
|
|
70
70
|
marketId: 0n,
|
|
71
71
|
marketType: MarketType.YesNo,
|
|
72
|
-
side: 0,
|
|
72
|
+
side: 0, // 0=YES, 1=NO
|
|
73
73
|
amountUsdc: 5_000_000n, // $5 USDC (6 decimals)
|
|
74
74
|
});
|
|
75
75
|
|
|
@@ -152,14 +152,16 @@ function MarketView() {
|
|
|
152
152
|
<h1>{market?.question}</h1>
|
|
153
153
|
<button
|
|
154
154
|
disabled={isPending}
|
|
155
|
-
onClick={() =>
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
155
|
+
onClick={() =>
|
|
156
|
+
placeBet({
|
|
157
|
+
payer: wallet.publicKey,
|
|
158
|
+
user: wallet.publicKey,
|
|
159
|
+
marketId: 0n,
|
|
160
|
+
marketType: 0,
|
|
161
|
+
side: 0,
|
|
162
|
+
amountUsdc: 1_000_000n,
|
|
163
|
+
})
|
|
164
|
+
}
|
|
163
165
|
>
|
|
164
166
|
Bet YES ($1)
|
|
165
167
|
</button>
|
|
@@ -170,19 +172,19 @@ function MarketView() {
|
|
|
170
172
|
|
|
171
173
|
### Available Hooks
|
|
172
174
|
|
|
173
|
-
| Hook
|
|
174
|
-
|
|
|
175
|
-
| `useGlobalState()`
|
|
176
|
-
| `useMarket(id)`
|
|
177
|
-
| `useMarkets(filter?)`
|
|
178
|
-
| `useUserPositions(user)` | Query
|
|
179
|
-
| `usePlaceBet()`
|
|
180
|
-
| `useResolveMarket()`
|
|
181
|
-
| `useClaimPayout()`
|
|
182
|
-
| `useClaimRefund()`
|
|
183
|
-
| `useCreateMarket()`
|
|
184
|
-
| `useCancelMarket()`
|
|
185
|
-
| `useMarketEvents()`
|
|
175
|
+
| Hook | Type | Description |
|
|
176
|
+
| ------------------------ | ------------ | ----------------------------------- |
|
|
177
|
+
| `useGlobalState()` | Query | Protocol config (fees, mint, admin) |
|
|
178
|
+
| `useMarket(id)` | Query | Single market by ID |
|
|
179
|
+
| `useMarkets(filter?)` | Query | All/filtered markets |
|
|
180
|
+
| `useUserPositions(user)` | Query | User's bet positions |
|
|
181
|
+
| `usePlaceBet()` | Mutation | End-to-end private bet |
|
|
182
|
+
| `useResolveMarket()` | Mutation | Resolve a market |
|
|
183
|
+
| `useClaimPayout()` | Mutation | Claim winning payout |
|
|
184
|
+
| `useClaimRefund()` | Mutation | Claim refund on unresolved market |
|
|
185
|
+
| `useCreateMarket()` | Mutation | Create a new market |
|
|
186
|
+
| `useCancelMarket()` | Mutation | Cancel a zero-bet market |
|
|
187
|
+
| `useMarketEvents()` | Subscription | Live event stream |
|
|
186
188
|
|
|
187
189
|
## Architecture
|
|
188
190
|
|
|
@@ -220,11 +222,11 @@ cypher-sdk/
|
|
|
220
222
|
|
|
221
223
|
The SDK is **cluster-agnostic** — it reads `GlobalState.accepted_mint` on-chain at runtime:
|
|
222
224
|
|
|
223
|
-
| Cluster
|
|
224
|
-
|
|
|
225
|
-
| `devnet`
|
|
226
|
-
| `mainnet`
|
|
227
|
-
| `localnet` | CSDC (same as devnet) | `1116522022`
|
|
225
|
+
| Cluster | Accepted Mint | Arcium Cluster Offset |
|
|
226
|
+
| ---------- | --------------------- | --------------------- |
|
|
227
|
+
| `devnet` | CSDC (`8AF9BABN…`) | `456` |
|
|
228
|
+
| `mainnet` | USDC (`EPjFWdd5…`) | TBD |
|
|
229
|
+
| `localnet` | CSDC (same as devnet) | `1116522022` |
|
|
228
230
|
|
|
229
231
|
Override cluster detection:
|
|
230
232
|
|
|
@@ -234,7 +236,8 @@ const client = new CypherClient({ connection, wallet, cluster: "devnet" });
|
|
|
234
236
|
|
|
235
237
|
// Fully custom
|
|
236
238
|
const client = new CypherClient({
|
|
237
|
-
connection,
|
|
239
|
+
connection,
|
|
240
|
+
wallet,
|
|
238
241
|
cluster: {
|
|
239
242
|
name: "devnet",
|
|
240
243
|
rpc: "https://my-helius-rpc.com",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublicKey, Transaction, VersionedTransaction, Keypair, TransactionInstruction, Finality, Connection, Commitment
|
|
1
|
+
import { PublicKey, Transaction, VersionedTransaction, Keypair, TransactionInstruction, Finality, Signer, ConfirmOptions, Connection, Commitment } from '@solana/web3.js';
|
|
2
2
|
import { BN, AnchorProvider, Program } from '@anchor-lang/core';
|
|
3
3
|
import { RescueCipher } from '@arcium-hq/client';
|
|
4
4
|
|
|
@@ -92,23 +92,11 @@ type CypherEventName = CypherEvent["name"];
|
|
|
92
92
|
* completeness assertions in tests.
|
|
93
93
|
*/
|
|
94
94
|
declare const ALL_EVENT_NAMES: ReadonlySet<CypherEventName>;
|
|
95
|
-
/**
|
|
96
|
-
* Decode raw Solana program logs into typed Cypher events.
|
|
97
|
-
*
|
|
98
|
-
* @param logs Array of strings from a transaction's `meta.logMessages`.
|
|
99
|
-
* @returns Typed events found in the logs (may be empty).
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* ```ts
|
|
103
|
-
* const txInfo = await connection.getTransaction(sig, { commitment: "confirmed" });
|
|
104
|
-
* const events = parseLogs(txInfo.meta?.logMessages ?? []);
|
|
105
|
-
* for (const evt of events) {
|
|
106
|
-
* if (evt.name === "BetPlacedEvent") console.log(evt.data.entryOdds);
|
|
107
|
-
* }
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
95
|
declare function parseLogs(logs: string[]): CypherEvent[];
|
|
111
|
-
|
|
96
|
+
type DataFor$1<N extends CypherEventName> = N extends CypherEventName ? Extract<CypherEvent, {
|
|
97
|
+
name: N;
|
|
98
|
+
}>["data"] : never;
|
|
99
|
+
declare function parseLogsFor<N extends CypherEventName>(logs: string[], name: N): Array<DataFor$1<N>>;
|
|
112
100
|
|
|
113
101
|
/**
|
|
114
102
|
* Cypher program ID. Sourced from the synced IDL so it can never drift
|
|
@@ -5961,6 +5949,62 @@ declare function awaitComputation(client: CypherClient, computationOffset: bigin
|
|
|
5961
5949
|
*/
|
|
5962
5950
|
declare function randomComputationOffset(): bigint;
|
|
5963
5951
|
|
|
5952
|
+
/**
|
|
5953
|
+
* Lifecycle stages that an end-to-end action passes through. Surfaces via
|
|
5954
|
+
* the optional `onProgress` callback on every multi-step action helper so
|
|
5955
|
+
* frontends can render fine-grained progress UI ("Encrypting your bet…",
|
|
5956
|
+
* "Submitting transaction…", "Waiting for MPC nodes…", "Confirmed!").
|
|
5957
|
+
*/
|
|
5958
|
+
type ActionStage = "validating" | "fetching-state" | "encrypting" | "submitting" | "awaiting-callback" | "refetching" | "done";
|
|
5959
|
+
/**
|
|
5960
|
+
* Progress event payload. The shape stays minimal on purpose — frontends
|
|
5961
|
+
* typically map `stage` to a copy string and use `signature` /
|
|
5962
|
+
* `computationOffset` as the "we've reached the chain" handoff for any
|
|
5963
|
+
* progress-bar logic.
|
|
5964
|
+
*/
|
|
5965
|
+
interface ActionProgressEvent {
|
|
5966
|
+
stage: ActionStage;
|
|
5967
|
+
/** Optional human-friendly message — populated for noteworthy stages. */
|
|
5968
|
+
message?: string;
|
|
5969
|
+
/** Signature once the queue tx lands ("submitting" → "awaiting-callback"). */
|
|
5970
|
+
signature?: string;
|
|
5971
|
+
/** Random u64 used for the Arcium computation, available after submit. */
|
|
5972
|
+
computationOffset?: bigint;
|
|
5973
|
+
}
|
|
5974
|
+
type ProgressCallback = (event: ActionProgressEvent) => void;
|
|
5975
|
+
interface SendIxOptions {
|
|
5976
|
+
/** Additional Keypair signers (most flows only need the wallet's signer). */
|
|
5977
|
+
signers?: Signer[];
|
|
5978
|
+
/** Anchor confirmation options override. */
|
|
5979
|
+
confirmOptions?: ConfirmOptions;
|
|
5980
|
+
}
|
|
5981
|
+
/**
|
|
5982
|
+
* Wrap a single instruction in a legacy `Transaction`, sign with the
|
|
5983
|
+
* provider's wallet (plus any extra `signers`), and send via the Anchor
|
|
5984
|
+
* provider. Returns the confirmed signature.
|
|
5985
|
+
*
|
|
5986
|
+
* Errors are reshaped through `parseCypherError` so the caller gets a
|
|
5987
|
+
* `ParsedCypherError` (when the program rejected the call) instead of
|
|
5988
|
+
* Anchor's nested error objects.
|
|
5989
|
+
*/
|
|
5990
|
+
declare function sendIx(client: CypherClient, ix: TransactionInstruction, opts?: SendIxOptions): Promise<string>;
|
|
5991
|
+
/**
|
|
5992
|
+
* Send an instruction that queues an Arcium computation, then block until
|
|
5993
|
+
* the MPC nodes finalize the callback. Returns both the queue tx
|
|
5994
|
+
* signature and the computation finalization details.
|
|
5995
|
+
*
|
|
5996
|
+
* Used by every action that touches the bet / resolve / claim path.
|
|
5997
|
+
*/
|
|
5998
|
+
declare function sendIxAndAwaitArcium(client: CypherClient, ix: TransactionInstruction, params: {
|
|
5999
|
+
computationOffset: bigint;
|
|
6000
|
+
timeoutMs?: number;
|
|
6001
|
+
signers?: Signer[];
|
|
6002
|
+
confirmOptions?: ConfirmOptions;
|
|
6003
|
+
}): Promise<{
|
|
6004
|
+
signature: string;
|
|
6005
|
+
computation: ComputationResult;
|
|
6006
|
+
}>;
|
|
6007
|
+
|
|
5964
6008
|
/**
|
|
5965
6009
|
* Result returned by the `createMarket` action.
|
|
5966
6010
|
*
|
|
@@ -5977,10 +6021,12 @@ interface CreateMarketResult {
|
|
|
5977
6021
|
/** Create a YES/NO market end-to-end. */
|
|
5978
6022
|
declare function createMarketAction(client: CypherClient, inputs: Omit<CreateMarketParams, "expectedMarketId" | "acceptedMint"> & {
|
|
5979
6023
|
acceptedMint?: PublicKey;
|
|
6024
|
+
onProgress?: ProgressCallback;
|
|
5980
6025
|
}): Promise<CreateMarketResult>;
|
|
5981
6026
|
/** Create a multi-outcome market (2–4 outcomes) end-to-end. */
|
|
5982
6027
|
declare function createMarketMultiAction(client: CypherClient, inputs: Omit<CreateMarketMultiParams, "expectedMarketId" | "acceptedMint"> & {
|
|
5983
6028
|
acceptedMint?: PublicKey;
|
|
6029
|
+
onProgress?: ProgressCallback;
|
|
5984
6030
|
}): Promise<CreateMarketResult>;
|
|
5985
6031
|
/** Cancel a market that has no bets. Returns the post-cancel `Market`. */
|
|
5986
6032
|
declare function cancelMarketAction(client: CypherClient, inputs: Omit<CancelMarketParams, "acceptedMint"> & {
|
|
@@ -6063,6 +6109,13 @@ interface PlaceBetInputs {
|
|
|
6063
6109
|
computationOffset?: bigint;
|
|
6064
6110
|
/** Override timeout for the Arcium finalization wait. */
|
|
6065
6111
|
timeoutMs?: number;
|
|
6112
|
+
/**
|
|
6113
|
+
* Optional fine-grained progress callback. Fires with stage events the
|
|
6114
|
+
* action passes through (validating → fetching-state → encrypting →
|
|
6115
|
+
* submitting → awaiting-callback → refetching → done). Use this to
|
|
6116
|
+
* drive multi-step UI ("Encrypting…", "Awaiting MPC nodes…", etc.).
|
|
6117
|
+
*/
|
|
6118
|
+
onProgress?: ProgressCallback;
|
|
6066
6119
|
}
|
|
6067
6120
|
interface PlaceBetResult {
|
|
6068
6121
|
signature: string;
|
|
@@ -6106,6 +6159,8 @@ interface ResolveMarketInputs {
|
|
|
6106
6159
|
outcomeValue: number;
|
|
6107
6160
|
computationOffset?: bigint;
|
|
6108
6161
|
timeoutMs?: number;
|
|
6162
|
+
/** Optional progress callback (validating → submitting → awaiting-callback → done). */
|
|
6163
|
+
onProgress?: ProgressCallback;
|
|
6109
6164
|
}
|
|
6110
6165
|
interface ResolveMarketResult {
|
|
6111
6166
|
signature: string;
|
|
@@ -6129,6 +6184,8 @@ interface ClaimInputs {
|
|
|
6129
6184
|
marketId: bigint | number;
|
|
6130
6185
|
computationOffset?: bigint;
|
|
6131
6186
|
timeoutMs?: number;
|
|
6187
|
+
/** Optional progress callback (validating → submitting → awaiting-callback → done). */
|
|
6188
|
+
onProgress?: ProgressCallback;
|
|
6132
6189
|
}
|
|
6133
6190
|
interface ClaimResult {
|
|
6134
6191
|
signature: string;
|
|
@@ -6174,12 +6231,19 @@ interface EventSubscription {
|
|
|
6174
6231
|
* ```
|
|
6175
6232
|
*/
|
|
6176
6233
|
declare function subscribeAll(connection: Connection, callback: (event: CypherEvent) => void, opts?: SubscribeOptions): EventSubscription;
|
|
6234
|
+
/** Distributive helper — picks the `data` payload type for a given event name. */
|
|
6235
|
+
type DataFor<N extends CypherEventName> = N extends CypherEventName ? Extract<CypherEvent, {
|
|
6236
|
+
name: N;
|
|
6237
|
+
}>["data"] : never;
|
|
6177
6238
|
/**
|
|
6178
6239
|
* Subscribe to a specific named event. The callback only fires for
|
|
6179
6240
|
* events whose name matches — other events from the same tx are
|
|
6180
6241
|
* silently dropped.
|
|
6242
|
+
*
|
|
6243
|
+
* Generic over `N extends CypherEventName` so the `data` parameter is
|
|
6244
|
+
* narrowed to the matching event's payload type at the callsite.
|
|
6181
6245
|
*/
|
|
6182
|
-
declare function subscribeEvent(connection: Connection, name:
|
|
6246
|
+
declare function subscribeEvent<N extends CypherEventName>(connection: Connection, name: N, callback: EventCallback<DataFor<N>>, opts?: SubscribeOptions): EventSubscription;
|
|
6183
6247
|
|
|
6184
6248
|
/** Subscribe to `MarketCreatedEvent` emissions. */
|
|
6185
6249
|
declare function onMarketCreated(connection: Connection, callback: EventCallback<MarketCreatedEvent>, opts?: SubscribeOptions): EventSubscription;
|
|
@@ -6351,8 +6415,13 @@ declare class CypherClient {
|
|
|
6351
6415
|
readonly events: {
|
|
6352
6416
|
/** Subscribe to all Cypher program events. */
|
|
6353
6417
|
subscribeAll: (callback: (event: CypherEvent) => void, opts?: SubscribeOptions) => EventSubscription;
|
|
6354
|
-
/**
|
|
6355
|
-
|
|
6418
|
+
/**
|
|
6419
|
+
* Subscribe to a specific event by name. The `data` callback parameter
|
|
6420
|
+
* is narrowed to the matching event's payload type via the generic.
|
|
6421
|
+
*/
|
|
6422
|
+
subscribe: <N extends CypherEventName>(name: N, callback: (data: Extract<CypherEvent, {
|
|
6423
|
+
name: N;
|
|
6424
|
+
}>["data"], raw: CypherEvent) => void, opts?: SubscribeOptions) => EventSubscription;
|
|
6356
6425
|
/** Convenience: subscribe to MarketCreatedEvent. */
|
|
6357
6426
|
onMarketCreated: (callback: (data: MarketCreatedEvent) => void, opts?: SubscribeOptions) => EventSubscription;
|
|
6358
6427
|
/** Convenience: subscribe to BetPlacedEvent. */
|
|
@@ -6411,4 +6480,4 @@ declare class CypherClient {
|
|
|
6411
6480
|
constructor(opts: CypherClientOptions);
|
|
6412
6481
|
}
|
|
6413
6482
|
|
|
6414
|
-
export {
|
|
6483
|
+
export { MIN_OUTCOMES_MULTI as $, ACCOUNT_DISCRIMINATOR_SIZE as A, BPS_DENOMINATOR as B, CypherClient as C, type CypherClientOptions as D, type EncryptedPositionAccount as E, type CypherEventName as F, type GlobalStateAccount as G, DEFAULT_CLAIM_PERIOD_SECS as H, DEFAULT_REFUND_PERIOD_SECS as I, DEFAULT_RESOLUTION_WINDOW_SECS as J, type EventCallback as K, type EventSubscription as L, type MarketAccount as M, INIT_COMP_DEF_INSTRUCTIONS as N, type InitCompDefMethodName as O, type PlaceBetResult as P, type InitCompDefParams as Q, type ResolveMarketResult as R, type SubscribeOptions as S, type InitializeParams as T, KNOWN_MINTS as U, type LpPositionAccount as V, MAX_LP_FEE_BPS as W, MAX_OUTCOMES_MULTI as X, MAX_PROTOCOL_FEE_BPS as Y, MAX_QUESTION_BYTES as Z, MIN_BET_USDC as _, type CancelMarketParams as a, onMarketResolved as a$, type MarketCancelledEvent as a0, MarketCategory as a1, type MarketCategoryValue as a2, type MarketCreatedEvent as a3, type MarketResolvedEvent as a4, MarketState as a5, type MarketStateValue as a6, MarketType as a7, type MarketTypeValue as a8, ODDS_SCALE as a9, createCipher as aA, createMarketAction as aB, createMarketIx as aC, createMarketMultiAction as aD, createMarketMultiIx as aE, createUserKeypair as aF, deriveSharedSecret as aG, fetchAllMarkets as aH, fetchGlobalState as aI, fetchLpPosition as aJ, fetchLpPositionsByProvider as aK, fetchMarket as aL, fetchMarketsByCreator as aM, fetchMarketsByState as aN, fetchMxePublicKey as aO, fetchPosition as aP, fetchPositionsForMarket as aQ, fetchUserPositions as aR, freshNonce as aS, initCompDefIx as aT, initializeIx as aU, keypairToWallet as aV, leBytesToBigInt as aW, onBetPlaced as aX, onCreatorWithdrawn as aY, onMarketCancelled as aZ, onMarketCreated as a_, PROGRAM_ID as aa, type PayoutClaimedEvent as ab, type PlacePrivateBetParams as ac, type PollEventsOptions as ad, type PolledEvent as ae, type ProgressCallback as af, type RefundClaimedEvent as ag, type ResolveMarketParams as ah, type SendIxOptions as ai, type UpdateAcceptedMintParams as aj, type UserCryptoKeypair as ak, type Wallet as al, type WithdrawCreatorFundsParams as am, adminClaimRemainingIx as an, awaitComputation as ao, buildAllInitCompDefIx as ap, cancelMarketAction as aq, cancelMarketIx as ar, claimPayoutAction as as, claimPayoutMultiIx as at, claimPayoutYesnoIx as au, claimRefundAction as av, claimRefundMultiIx as aw, claimRefundYesnoIx as ax, compDefOffsetBytes as ay, compDefOffsetU32 as az, type ClaimResult as b, onPayoutClaimed as b0, onRefundClaimed as b1, parseLogs as b2, parseLogsFor as b3, placeBetAction as b4, placePrivateBetMultiIx as b5, placePrivateBetYesnoIx as b6, pollEvents as b7, randomComputationOffset as b8, readonlyWallet as b9, resolveMarketAction as ba, resolveMarketMultiIx as bb, resolveMarketYesnoIx as bc, sendIx as bd, sendIxAndAwaitArcium as be, subscribeAll as bf, subscribeEvent as bg, updateAcceptedMintIx as bh, withdrawCreatorFundsAction as bi, withdrawCreatorFundsIx as bj, type ClaimInputs as c, type CreateMarketResult as d, type CreateMarketParams as e, type PlaceBetInputs as f, type ResolveMarketInputs as g, type CypherEvent as h, type Cypher as i, type CircuitName as j, ALL_CIRCUITS as k, ALL_EVENT_NAMES as l, type ActionProgressEvent as m, type ActionStage as n, type AdminClaimRemainingParams as o, type AwaitComputationOptions as p, type BetPlacedEvent as q, CIRCUITS as r, CLUSTERS as s, CREATOR_BOND as t, type ClaimParams as u, type ClusterConfig as v, type ClusterName as w, type ComputationResult as x, type CreateMarketMultiParams as y, type CreatorWithdrawnEvent as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as Cypher, C as CypherClient, j as
|
|
2
|
-
export { A as ACCOUNT_DISCRIMINATOR_SIZE,
|
|
3
|
-
import { GetProgramAccountsFilter, PublicKey
|
|
1
|
+
import { i as Cypher, C as CypherClient, j as CircuitName } from './client-hOLBWshA.js';
|
|
2
|
+
export { A as ACCOUNT_DISCRIMINATOR_SIZE, k as ALL_CIRCUITS, l as ALL_EVENT_NAMES, m as ActionProgressEvent, n as ActionStage, o as AdminClaimRemainingParams, p as AwaitComputationOptions, B as BPS_DENOMINATOR, q as BetPlacedEvent, r as CIRCUITS, s as CLUSTERS, t as CREATOR_BOND, a as CancelMarketParams, c as ClaimInputs, u as ClaimParams, b as ClaimResult, v as ClusterConfig, w as ClusterName, x as ComputationResult, y as CreateMarketMultiParams, e as CreateMarketParams, d as CreateMarketResult, z as CreatorWithdrawnEvent, D as CypherClientOptions, h as CypherEvent, F as CypherEventName, H as DEFAULT_CLAIM_PERIOD_SECS, I as DEFAULT_REFUND_PERIOD_SECS, J as DEFAULT_RESOLUTION_WINDOW_SECS, E as EncryptedPositionAccount, K as EventCallback, L as EventSubscription, G as GlobalStateAccount, N as INIT_COMP_DEF_INSTRUCTIONS, O as InitCompDefMethodName, Q as InitCompDefParams, T as InitializeParams, U as KNOWN_MINTS, V as LpPositionAccount, W as MAX_LP_FEE_BPS, X as MAX_OUTCOMES_MULTI, Y as MAX_PROTOCOL_FEE_BPS, Z as MAX_QUESTION_BYTES, _ as MIN_BET_USDC, $ as MIN_OUTCOMES_MULTI, M as MarketAccount, a0 as MarketCancelledEvent, a1 as MarketCategory, a2 as MarketCategoryValue, a3 as MarketCreatedEvent, a4 as MarketResolvedEvent, a5 as MarketState, a6 as MarketStateValue, a7 as MarketType, a8 as MarketTypeValue, a9 as ODDS_SCALE, aa as PROGRAM_ID, ab as PayoutClaimedEvent, f as PlaceBetInputs, P as PlaceBetResult, ac as PlacePrivateBetParams, ad as PollEventsOptions, ae as PolledEvent, af as ProgressCallback, ag as RefundClaimedEvent, g as ResolveMarketInputs, ah as ResolveMarketParams, R as ResolveMarketResult, ai as SendIxOptions, S as SubscribeOptions, aj as UpdateAcceptedMintParams, ak as UserCryptoKeypair, al as Wallet, am as WithdrawCreatorFundsParams, an as adminClaimRemainingIx, ao as awaitComputation, ap as buildAllInitCompDefIx, aq as cancelMarketAction, ar as cancelMarketIx, as as claimPayoutAction, at as claimPayoutMultiIx, au as claimPayoutYesnoIx, av as claimRefundAction, aw as claimRefundMultiIx, ax as claimRefundYesnoIx, ay as compDefOffsetBytes, az as compDefOffsetU32, aA as createCipher, aB as createMarketAction, aC as createMarketIx, aD as createMarketMultiAction, aE as createMarketMultiIx, aF as createUserKeypair, aG as deriveSharedSecret, aH as fetchAllMarkets, aI as fetchGlobalState, aJ as fetchLpPosition, aK as fetchLpPositionsByProvider, aL as fetchMarket, aM as fetchMarketsByCreator, aN as fetchMarketsByState, aO as fetchMxePublicKey, aP as fetchPosition, aQ as fetchPositionsForMarket, aR as fetchUserPositions, aS as freshNonce, aT as initCompDefIx, aU as initializeIx, aV as keypairToWallet, aW as leBytesToBigInt, aX as onBetPlaced, aY as onCreatorWithdrawn, aZ as onMarketCancelled, a_ as onMarketCreated, a$ as onMarketResolved, b0 as onPayoutClaimed, b1 as onRefundClaimed, b2 as parseLogs, b3 as parseLogsFor, b4 as placeBetAction, b5 as placePrivateBetMultiIx, b6 as placePrivateBetYesnoIx, b7 as pollEvents, b8 as randomComputationOffset, b9 as readonlyWallet, ba as resolveMarketAction, bb as resolveMarketMultiIx, bc as resolveMarketYesnoIx, bd as sendIx, be as sendIxAndAwaitArcium, bf as subscribeAll, bg as subscribeEvent, bh as updateAcceptedMintIx, bi as withdrawCreatorFundsAction, bj as withdrawCreatorFundsIx } from './client-hOLBWshA.js';
|
|
3
|
+
import { GetProgramAccountsFilter, PublicKey } from '@solana/web3.js';
|
|
4
4
|
import { BN } from '@anchor-lang/core';
|
|
5
5
|
import { RescueCipher } from '@arcium-hq/client';
|
|
6
6
|
export { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync } from '@solana/spl-token';
|
|
@@ -118,39 +118,6 @@ declare function toBN(v: bigint | number | BN): BN;
|
|
|
118
118
|
/** The default ATA derivation for `(owner, mint)`. */
|
|
119
119
|
declare function userAta(owner: PublicKey, mint: PublicKey): PublicKey;
|
|
120
120
|
|
|
121
|
-
interface SendIxOptions {
|
|
122
|
-
/** Additional Keypair signers (most flows only need the wallet's signer). */
|
|
123
|
-
signers?: Signer[];
|
|
124
|
-
/** Anchor confirmation options override. */
|
|
125
|
-
confirmOptions?: ConfirmOptions;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Wrap a single instruction in a legacy `Transaction`, sign with the
|
|
129
|
-
* provider's wallet (plus any extra `signers`), and send via the Anchor
|
|
130
|
-
* provider. Returns the confirmed signature.
|
|
131
|
-
*
|
|
132
|
-
* Errors are reshaped through `parseCypherError` so the caller gets a
|
|
133
|
-
* `ParsedCypherError` (when the program rejected the call) instead of
|
|
134
|
-
* Anchor's nested error objects.
|
|
135
|
-
*/
|
|
136
|
-
declare function sendIx(client: CypherClient, ix: TransactionInstruction, opts?: SendIxOptions): Promise<string>;
|
|
137
|
-
/**
|
|
138
|
-
* Send an instruction that queues an Arcium computation, then block until
|
|
139
|
-
* the MPC nodes finalize the callback. Returns both the queue tx
|
|
140
|
-
* signature and the computation finalization details.
|
|
141
|
-
*
|
|
142
|
-
* Used by every action that touches the bet / resolve / claim path.
|
|
143
|
-
*/
|
|
144
|
-
declare function sendIxAndAwaitArcium(client: CypherClient, ix: TransactionInstruction, params: {
|
|
145
|
-
computationOffset: bigint;
|
|
146
|
-
timeoutMs?: number;
|
|
147
|
-
signers?: Signer[];
|
|
148
|
-
confirmOptions?: ConfirmOptions;
|
|
149
|
-
}): Promise<{
|
|
150
|
-
signature: string;
|
|
151
|
-
computation: ComputationResult;
|
|
152
|
-
}>;
|
|
153
|
-
|
|
154
121
|
/**
|
|
155
122
|
* A user's plaintext bet input as the circuits expect it.
|
|
156
123
|
*
|
|
@@ -504,4 +471,4 @@ declare function fetchMxeLookupTable(client: CypherClient): Promise<{
|
|
|
504
471
|
slot: BN;
|
|
505
472
|
}>;
|
|
506
473
|
|
|
507
|
-
export { ADDRESS_LOOKUP_TABLE_PROGRAM_ID, type ArciumQueueAccounts, type BetInput, CYPHER_ERROR_MESSAGES, CircuitName,
|
|
474
|
+
export { ADDRESS_LOOKUP_TABLE_PROGRAM_ID, type ArciumQueueAccounts, type BetInput, CYPHER_ERROR_MESSAGES, CircuitName, Cypher, CypherClient, CypherErrorCode, type CypherErrorCodeValue, type CypherErrorName, ENCRYPTED_POSITION_OFFSETS, type EncryptedBetInput, type EncryptedRefundInput, type FeeBreakdown, type FeeRates, GLOBAL_STATE_OFFSETS, IDL, IDL_PROGRAM_ID, LP_POSITION_OFFSETS, MARKET_OFFSETS, type MarketDeadlineInputs, type MarketPhase, type ParsedCypherError, type RefundInput, arciumSignerPda, bigIntToLeBytes, buildArciumQueueAccounts, computeFees, cypherErrorName, decryptBetInput, discriminatorFilter, encryptBetInput, encryptRefundInput, fetchMxeLookupTable, globalStatePda, isBetAmountValid, isValidCloseTime, lpPositionFilters, lpPositionPda, marketFilters, marketPda, marketPhase, marketVaultPda, parseCypherError, positionFilters, positionPda, projectDeadlines, toBN, userAta };
|
package/dist/index.js
CHANGED
|
@@ -2986,6 +2986,13 @@ function randomComputationOffset() {
|
|
|
2986
2986
|
}
|
|
2987
2987
|
|
|
2988
2988
|
// src/actions/common.ts
|
|
2989
|
+
function emitProgress(cb, stage, extra) {
|
|
2990
|
+
if (!cb) return;
|
|
2991
|
+
try {
|
|
2992
|
+
cb({ stage, ...extra });
|
|
2993
|
+
} catch {
|
|
2994
|
+
}
|
|
2995
|
+
}
|
|
2989
2996
|
async function sendIx(client, ix, opts = {}) {
|
|
2990
2997
|
const tx = new Transaction().add(ix);
|
|
2991
2998
|
try {
|
|
@@ -3023,11 +3030,15 @@ function rethrowCypher(err) {
|
|
|
3023
3030
|
|
|
3024
3031
|
// src/actions/createMarket.ts
|
|
3025
3032
|
async function createMarketCommon(client, inputs) {
|
|
3033
|
+
emitProgress(inputs.onProgress, "validating", {
|
|
3034
|
+
message: "Validating market draft"
|
|
3035
|
+
});
|
|
3026
3036
|
if (!isValidCloseTime(BigInt(inputs.closeTime))) {
|
|
3027
3037
|
throw new Error(
|
|
3028
3038
|
"createMarket: closeTime must be at least 60 seconds in the future"
|
|
3029
3039
|
);
|
|
3030
3040
|
}
|
|
3041
|
+
emitProgress(inputs.onProgress, "fetching-state");
|
|
3031
3042
|
const gs = await client.globalState.fetch({ refresh: true });
|
|
3032
3043
|
const acceptedMint = inputs.acceptedMint ?? gs.acceptedMint;
|
|
3033
3044
|
const expectedMarketId = gs.marketCounter;
|
|
@@ -3040,9 +3051,14 @@ async function createMarketCommon(client, inputs) {
|
|
|
3040
3051
|
acceptedMint,
|
|
3041
3052
|
expectedMarketId
|
|
3042
3053
|
});
|
|
3054
|
+
emitProgress(inputs.onProgress, "submitting", {
|
|
3055
|
+
message: "Submitting create-market transaction"
|
|
3056
|
+
});
|
|
3043
3057
|
const signature = await sendIx(client, ix);
|
|
3058
|
+
emitProgress(inputs.onProgress, "refetching");
|
|
3044
3059
|
const [marketPdaKey] = marketPda(expectedMarketId, client.programId);
|
|
3045
3060
|
const market = await client.markets.fetchByPda(marketPdaKey);
|
|
3061
|
+
emitProgress(inputs.onProgress, "done", { signature });
|
|
3046
3062
|
return {
|
|
3047
3063
|
signature,
|
|
3048
3064
|
marketId: expectedMarketId,
|
|
@@ -3171,6 +3187,9 @@ function bigIntToLeBytes(value, byteLength) {
|
|
|
3171
3187
|
|
|
3172
3188
|
// src/actions/placeBet.ts
|
|
3173
3189
|
async function placeBetAction(client, inputs) {
|
|
3190
|
+
emitProgress(inputs.onProgress, "validating", {
|
|
3191
|
+
message: "Validating bet inputs"
|
|
3192
|
+
});
|
|
3174
3193
|
const market = await client.markets.fetch(inputs.marketId);
|
|
3175
3194
|
if (!market) {
|
|
3176
3195
|
throw new Error(`placeBet: market ${inputs.marketId} not found`);
|
|
@@ -3187,6 +3206,9 @@ async function placeBetAction(client, inputs) {
|
|
|
3187
3206
|
if (grossAmount < MIN_BET_USDC) {
|
|
3188
3207
|
throw new Error(`placeBet: amount ${grossAmount} < protocol MIN_BET_USDC`);
|
|
3189
3208
|
}
|
|
3209
|
+
emitProgress(inputs.onProgress, "fetching-state", {
|
|
3210
|
+
message: "Fetching protocol state"
|
|
3211
|
+
});
|
|
3190
3212
|
const gs = await client.globalState.fetch();
|
|
3191
3213
|
const { netAmount } = computeFees(grossAmount, {
|
|
3192
3214
|
protocolFeeRateBps: gs.protocolFeeRate,
|
|
@@ -3203,6 +3225,9 @@ async function placeBetAction(client, inputs) {
|
|
|
3203
3225
|
);
|
|
3204
3226
|
}
|
|
3205
3227
|
const { lut } = await fetchMxeLookupTable(client);
|
|
3228
|
+
emitProgress(inputs.onProgress, "encrypting", {
|
|
3229
|
+
message: "Encrypting your bet"
|
|
3230
|
+
});
|
|
3206
3231
|
const userKeypair = inputs.userKeypair ?? createUserKeypair();
|
|
3207
3232
|
const cipher = createCipher(userKeypair.privateKey, mxePubkey);
|
|
3208
3233
|
const encrypted = encryptBetInput({ amount: netAmount, side: inputs.side }, cipher);
|
|
@@ -3223,12 +3248,31 @@ async function placeBetAction(client, inputs) {
|
|
|
3223
3248
|
nonce: encrypted.nonce,
|
|
3224
3249
|
addressLookupTable: lut
|
|
3225
3250
|
});
|
|
3226
|
-
|
|
3227
|
-
|
|
3251
|
+
emitProgress(inputs.onProgress, "submitting", {
|
|
3252
|
+
message: "Submitting transaction",
|
|
3253
|
+
computationOffset
|
|
3254
|
+
});
|
|
3255
|
+
const signature = await sendIx(client, ix);
|
|
3256
|
+
emitProgress(inputs.onProgress, "awaiting-callback", {
|
|
3257
|
+
message: "Waiting for Arcium MPC nodes to finalize",
|
|
3258
|
+
signature,
|
|
3259
|
+
computationOffset
|
|
3260
|
+
});
|
|
3261
|
+
const computation = await awaitComputation(client, computationOffset, {
|
|
3228
3262
|
timeoutMs: inputs.timeoutMs
|
|
3229
3263
|
});
|
|
3264
|
+
emitProgress(inputs.onProgress, "refetching", {
|
|
3265
|
+
message: "Refreshing position",
|
|
3266
|
+
signature,
|
|
3267
|
+
computationOffset
|
|
3268
|
+
});
|
|
3230
3269
|
const [marketPdaKey] = marketPda(inputs.marketId, client.programId);
|
|
3231
3270
|
const position = await client.positions.fetch(marketPdaKey, inputs.user);
|
|
3271
|
+
emitProgress(inputs.onProgress, "done", {
|
|
3272
|
+
message: "Bet placed",
|
|
3273
|
+
signature,
|
|
3274
|
+
computationOffset
|
|
3275
|
+
});
|
|
3232
3276
|
return {
|
|
3233
3277
|
signature,
|
|
3234
3278
|
computation,
|
|
@@ -3251,6 +3295,9 @@ function validateSide(side, marketType, numOutcomes) {
|
|
|
3251
3295
|
|
|
3252
3296
|
// src/actions/resolveMarket.ts
|
|
3253
3297
|
async function resolveMarketAction(client, inputs) {
|
|
3298
|
+
emitProgress(inputs.onProgress, "validating", {
|
|
3299
|
+
message: "Validating resolve inputs"
|
|
3300
|
+
});
|
|
3254
3301
|
const market = await client.markets.fetch(inputs.marketId);
|
|
3255
3302
|
if (!market) throw new Error(`resolveMarket: market ${inputs.marketId} not found`);
|
|
3256
3303
|
if (market.state === MarketState.Resolved) {
|
|
@@ -3260,6 +3307,7 @@ async function resolveMarketAction(client, inputs) {
|
|
|
3260
3307
|
throw new Error("resolveMarket: market was cancelled");
|
|
3261
3308
|
}
|
|
3262
3309
|
validateOutcome(inputs.outcomeValue, market.marketType, market.numOutcomes);
|
|
3310
|
+
emitProgress(inputs.onProgress, "fetching-state");
|
|
3263
3311
|
const { lut } = await fetchMxeLookupTable(client);
|
|
3264
3312
|
const computationOffset = inputs.computationOffset ?? randomComputationOffset();
|
|
3265
3313
|
const isMulti = market.marketType === MarketType.MultiOutcome;
|
|
@@ -3272,17 +3320,29 @@ async function resolveMarketAction(client, inputs) {
|
|
|
3272
3320
|
outcomeValue: inputs.outcomeValue,
|
|
3273
3321
|
addressLookupTable: lut
|
|
3274
3322
|
});
|
|
3275
|
-
|
|
3276
|
-
|
|
3323
|
+
emitProgress(inputs.onProgress, "submitting", {
|
|
3324
|
+
message: "Submitting resolve transaction",
|
|
3325
|
+
computationOffset
|
|
3326
|
+
});
|
|
3327
|
+
const signature = await sendIx(client, ix);
|
|
3328
|
+
emitProgress(inputs.onProgress, "awaiting-callback", {
|
|
3329
|
+
message: "Waiting for MPC nodes to reveal the outcome",
|
|
3330
|
+
signature,
|
|
3331
|
+
computationOffset
|
|
3332
|
+
});
|
|
3333
|
+
const computation = await awaitComputation(client, computationOffset, {
|
|
3277
3334
|
timeoutMs: inputs.timeoutMs
|
|
3278
3335
|
});
|
|
3336
|
+
emitProgress(inputs.onProgress, "refetching");
|
|
3279
3337
|
const [pda] = marketPda(inputs.marketId, client.programId);
|
|
3280
|
-
|
|
3338
|
+
const out = {
|
|
3281
3339
|
signature,
|
|
3282
3340
|
computation,
|
|
3283
3341
|
computationOffset,
|
|
3284
3342
|
market: await client.markets.fetchByPda(pda)
|
|
3285
3343
|
};
|
|
3344
|
+
emitProgress(inputs.onProgress, "done", { signature, computationOffset });
|
|
3345
|
+
return out;
|
|
3286
3346
|
}
|
|
3287
3347
|
function validateOutcome(outcome, marketType, numOutcomes) {
|
|
3288
3348
|
if (!Number.isInteger(outcome) || outcome < 0) {
|
|
@@ -3298,6 +3358,9 @@ function validateOutcome(outcome, marketType, numOutcomes) {
|
|
|
3298
3358
|
|
|
3299
3359
|
// src/actions/claim.ts
|
|
3300
3360
|
async function commonClaim(client, inputs, flavor) {
|
|
3361
|
+
emitProgress(inputs.onProgress, "validating", {
|
|
3362
|
+
message: `Validating claim${cap(flavor)} inputs`
|
|
3363
|
+
});
|
|
3301
3364
|
const market = await client.markets.fetch(inputs.marketId);
|
|
3302
3365
|
if (!market) throw new Error(`claim${cap(flavor)}: market not found`);
|
|
3303
3366
|
const [pda] = marketPda(inputs.marketId, client.programId);
|
|
@@ -3324,6 +3387,7 @@ async function commonClaim(client, inputs, flavor) {
|
|
|
3324
3387
|
if (flavor === "payout" && market.state !== MarketState.Resolved) {
|
|
3325
3388
|
throw new Error("claimPayout: market is not resolved");
|
|
3326
3389
|
}
|
|
3390
|
+
emitProgress(inputs.onProgress, "fetching-state");
|
|
3327
3391
|
const { acceptedMint } = await client.globalState.fetch();
|
|
3328
3392
|
const { lut } = await fetchMxeLookupTable(client);
|
|
3329
3393
|
const computationOffset = inputs.computationOffset ?? randomComputationOffset();
|
|
@@ -3337,17 +3401,29 @@ async function commonClaim(client, inputs, flavor) {
|
|
|
3337
3401
|
computationOffset,
|
|
3338
3402
|
addressLookupTable: lut
|
|
3339
3403
|
});
|
|
3340
|
-
|
|
3341
|
-
|
|
3404
|
+
emitProgress(inputs.onProgress, "submitting", {
|
|
3405
|
+
message: `Submitting ${flavor} claim`,
|
|
3406
|
+
computationOffset
|
|
3407
|
+
});
|
|
3408
|
+
const signature = await sendIx(client, ix);
|
|
3409
|
+
emitProgress(inputs.onProgress, "awaiting-callback", {
|
|
3410
|
+
message: "Waiting for MPC nodes to compute and disburse",
|
|
3411
|
+
signature,
|
|
3412
|
+
computationOffset
|
|
3413
|
+
});
|
|
3414
|
+
const computation = await awaitComputation(client, computationOffset, {
|
|
3342
3415
|
timeoutMs: inputs.timeoutMs
|
|
3343
3416
|
});
|
|
3344
|
-
|
|
3417
|
+
emitProgress(inputs.onProgress, "refetching");
|
|
3418
|
+
const out = {
|
|
3345
3419
|
signature,
|
|
3346
3420
|
computation,
|
|
3347
3421
|
computationOffset,
|
|
3348
3422
|
position: await client.positions.fetch(pda, inputs.user),
|
|
3349
3423
|
market: await client.markets.fetchByPda(pda)
|
|
3350
3424
|
};
|
|
3425
|
+
emitProgress(inputs.onProgress, "done", { signature, computationOffset });
|
|
3426
|
+
return out;
|
|
3351
3427
|
}
|
|
3352
3428
|
function claimPayoutAction(client, inputs) {
|
|
3353
3429
|
return commonClaim(client, inputs, "payout");
|
|
@@ -3376,16 +3452,49 @@ function getParser() {
|
|
|
3376
3452
|
}
|
|
3377
3453
|
return _parser;
|
|
3378
3454
|
}
|
|
3455
|
+
function camelizeKey(k) {
|
|
3456
|
+
return k.replace(/_([a-z0-9])/g, (_m, c) => c.toUpperCase());
|
|
3457
|
+
}
|
|
3458
|
+
function normalizeValue(v) {
|
|
3459
|
+
if (v == null) return v;
|
|
3460
|
+
if (typeof v === "object" && "toString" in v && "toArrayLike" in v) {
|
|
3461
|
+
return BigInt(v.toString());
|
|
3462
|
+
}
|
|
3463
|
+
if (Array.isArray(v) && v.length > 0 && typeof v[0] === "number") {
|
|
3464
|
+
return Uint8Array.from(v);
|
|
3465
|
+
}
|
|
3466
|
+
return v;
|
|
3467
|
+
}
|
|
3468
|
+
function camelizeObject(obj) {
|
|
3469
|
+
if (obj == null || typeof obj !== "object") return obj;
|
|
3470
|
+
if (Array.isArray(obj)) return obj;
|
|
3471
|
+
const out = {};
|
|
3472
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
3473
|
+
out[camelizeKey(k)] = normalizeValue(v);
|
|
3474
|
+
}
|
|
3475
|
+
return out;
|
|
3476
|
+
}
|
|
3379
3477
|
function parseLogs(logs) {
|
|
3380
3478
|
const parser = getParser();
|
|
3381
3479
|
const results = [];
|
|
3382
3480
|
for (const event of parser.parseLogs(logs)) {
|
|
3383
|
-
|
|
3481
|
+
const camelized = {
|
|
3482
|
+
name: event.name,
|
|
3483
|
+
data: camelizeObject(event.data)
|
|
3484
|
+
};
|
|
3485
|
+
results.push(camelized);
|
|
3384
3486
|
}
|
|
3385
3487
|
return results;
|
|
3386
3488
|
}
|
|
3489
|
+
function parseLogsForRaw(logs, name) {
|
|
3490
|
+
const out = [];
|
|
3491
|
+
for (const e of parseLogs(logs)) {
|
|
3492
|
+
if (e.name === name) out.push(e.data);
|
|
3493
|
+
}
|
|
3494
|
+
return out;
|
|
3495
|
+
}
|
|
3387
3496
|
function parseLogsFor(logs, name) {
|
|
3388
|
-
return
|
|
3497
|
+
return parseLogsForRaw(logs, name);
|
|
3389
3498
|
}
|
|
3390
3499
|
|
|
3391
3500
|
// src/events/subscribe.ts
|
|
@@ -3562,7 +3671,16 @@ var CypherClient = class {
|
|
|
3562
3671
|
};
|
|
3563
3672
|
this.events = {
|
|
3564
3673
|
subscribeAll: (cb, opts2) => subscribeAll(this.connection, cb, opts2),
|
|
3565
|
-
|
|
3674
|
+
// Cast the whole wiring through `unknown` to bridge the generic
|
|
3675
|
+
// signature — TS can't see through `Extract<>` when `N` is bound
|
|
3676
|
+
// outside its own generic scope. The external client.events.subscribe
|
|
3677
|
+
// field still narrows the callback payload via its own <N> generic.
|
|
3678
|
+
subscribe: ((name, cb, opts2) => subscribeEvent(
|
|
3679
|
+
this.connection,
|
|
3680
|
+
name,
|
|
3681
|
+
cb,
|
|
3682
|
+
opts2
|
|
3683
|
+
)),
|
|
3566
3684
|
onMarketCreated: (cb, opts2) => onMarketCreated(this.connection, cb, opts2),
|
|
3567
3685
|
onBetPlaced: (cb, opts2) => onBetPlaced(this.connection, cb, opts2),
|
|
3568
3686
|
onMarketResolved: (cb, opts2) => onMarketResolved(this.connection, cb, opts2),
|