@vercora-protocol/sdk 0.2.3 → 0.3.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/CHANGELOG.md +22 -0
- package/README.md +8 -8
- package/agents/skill.md +3 -3
- package/dist/client.d.ts +21 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +81 -4
- package/dist/client.js.map +1 -1
- package/dist/generated/vercora.d.ts +49 -2
- package/dist/generated/vercora.d.ts.map +1 -1
- package/dist/idl/vercora.json +49 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/resolverDecode.d.ts +40 -0
- package/dist/resolverDecode.d.ts.map +1 -1
- package/dist/resolverDecode.js +92 -0
- package/dist/resolverDecode.js.map +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,28 @@ All notable changes to `@vercora-protocol/sdk` are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
### [0.3.0](https://github.com/vercora/vercora-anchor/compare/v0.2.4...v0.3.0) (2026-04-24)
|
|
8
|
+
|
|
9
|
+
### ⚠️ Breaking changes
|
|
10
|
+
|
|
11
|
+
* **anchor:** `resolve_refute` args include **`accept: bool`** and a **`disputer_collateral`** account (refuter ATA). `resolve_refute` global authorization is **primary/secondary** only (not `dispute_resolution_authority`).
|
|
12
|
+
* **anchor:** `void_market` requires **`resolution_state`**; void is rejected while **`dispute_active`** (**`CannotVoidWithOpenDispute`**).
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **anchor:** Accept refute path — refund bond and set **`winning_outcome_index`** to disputed outcome without **`confirm_resolution`**.
|
|
17
|
+
|
|
18
|
+
### [0.2.4](https://github.com/vercora/vercora-anchor/compare/v0.2.3...v0.2.4) (2026-04-23)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* **web:** removing market example ([4072b5b](https://github.com/vercora/vercora-anchor/commit/4072b5b8d91916ee9312e5f32aaa90b5f21bc5f2))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* **sdk:** update resolution pda and vote ([1e59f7a](https://github.com/vercora/vercora-anchor/commit/1e59f7a53215f1f633436aba29ce75f03daec910))
|
|
7
29
|
|
|
8
30
|
### [0.2.3](https://github.com/vercora/vercora-anchor/compare/v0.2.2...v0.2.3) (2026-04-22)
|
|
9
31
|
|
package/README.md
CHANGED
|
@@ -117,11 +117,11 @@ When **`isEarlyWithdrawAllowed`** is **`false`**, early **`parimutuelWithdraw`**
|
|
|
117
117
|
| `finalizeResolution(marketPda, params)` | When M-of-N agree on one outcome, **proposes** that outcome — sets `ResolutionState.proposed_outcome` + `proposal_ts`; does **not** set `Market.winning_outcome_index` yet. |
|
|
118
118
|
| `confirmResolution(marketPda, params)` | After the **challenge window** elapses with **no open dispute**, anyone can call this to set **`Market.winning_outcome_index`** (final approval / settlement). |
|
|
119
119
|
| `openRefute(marketPda, params)` | During the challenge window: post a **refute bond** and name an alternative winning outcome (dispute). |
|
|
120
|
-
| `resolveRefute(marketPda, params)` |
|
|
121
|
-
| `claimResolverStake(marketPda, params)` | After resolution:
|
|
120
|
+
| `resolveRefute(marketPda, params)` | `params.accept === false`: slash refute bond to treasury. `accept === true`: refund bond to refuter and set **`winning_outcome_index`** to disputed outcome (no **`confirmResolution`**). Signer: global **primary or secondary** authority, or platform **`profileAuthority`**. |
|
|
121
|
+
| `claimResolverStake(marketPda, params)` | After resolution: matching vote → stake returned to resolver; otherwise stake **slashed** to platform treasury. |
|
|
122
122
|
| `fetchResolutionState(marketPda)` | Read proposal, dispute, refute bond locked (`ResolutionState`). Challenge length and resolver stake size come from **`fetchPlatformProfile`**. |
|
|
123
123
|
| `closeMarketEarly(marketPda, params)` | Creator / config authority before `close_at`. |
|
|
124
|
-
| `voidMarket(marketPda, params)` | Void market. **Creator** cannot void while pari **outcome pools** (active stakes) or complete-set outstanding is non-zero — use a **global config** authority to cancel live markets. Parimutuel: then **`parimutuelWithdraw`** for full net refunds. |
|
|
124
|
+
| `voidMarket(marketPda, params)` | Void market. **Creator** cannot void while pari **outcome pools** (active stakes) or complete-set outstanding is non-zero — use a **global config** authority to cancel live markets. **Cannot void while a refute dispute is open.** Parimutuel: then **`parimutuelWithdraw`** for full net refunds. |
|
|
125
125
|
| `claimVoidedParimutuelSurplus(marketPda, params)` | **Global config authority only.** After void, if pari **outcome pools** are zero but **`total_pool`** still holds early-exit **pool-keep** (no stakers left), sweeps that amount from the vault to the platform treasury. |
|
|
126
126
|
| `abandonMarket(marketPda, params)` | Creator abandons empty market (reclaim rent). |
|
|
127
127
|
|
|
@@ -466,17 +466,17 @@ Settlement is **two-phase**: first a **proposal** is recorded on `ResolutionStat
|
|
|
466
466
|
|
|
467
467
|
3. **Propose (`finalizeResolution`)** — When at least **`resolution_threshold`** resolvers agree on the **same** outcome, anyone may call **`finalizeResolution`**. On-chain this **does not** immediately set `Market.winning_outcome_index`. It sets **`ResolutionState.proposed_outcome`**, **`proposal_ts`**, and starts the **challenge window** (duration from **`PlatformProfile.challenge_window_secs`**).
|
|
468
468
|
|
|
469
|
-
4. **Challenge window** — Until **`proposal_ts + challenge_window_secs`** elapses, a participant may **`openRefute`** with **exactly** **`platform_profile.refute_bond`**: lock that collateral and assert a **different** winning outcome. An authorized party (global **
|
|
469
|
+
4. **Challenge window** — Until **`proposal_ts + challenge_window_secs`** elapses, a participant may **`openRefute`** with **exactly** **`platform_profile.refute_bond`**: lock that collateral and assert a **different** winning outcome. An authorized party (global **primary or secondary** authority, or platform **`profileAuthority`**) may **`resolveRefute`**: **`accept: false`** dismisses (bond → treasury), **`accept: true`** accepts (bond refunded, **`winning_outcome_index`** set immediately). While a dispute is active, **`confirmResolution`** is rejected. **`voidMarket`** is rejected while a dispute is open.
|
|
470
470
|
|
|
471
|
-
5. **Confirm (final approval)** — After **`proposal_ts + challenge_window`**, if there is **no** blocking dispute
|
|
471
|
+
5. **Confirm (final approval)** — After **`proposal_ts + challenge_window`**, if there is **no** blocking dispute and the market was not already finalized by **`resolveRefute(accept: true)`**, anyone calls **`confirmResolution`**. This writes **`Market.winning_outcome_index`** — the outcome is now final for **`redeemWinning`** / **`parimutuelClaim`**.
|
|
472
472
|
|
|
473
|
-
6. **Resolver stake** — After settlement, resolvers use **`claimResolverStake
|
|
473
|
+
6. **Resolver stake** — After settlement, resolvers use **`claimResolverStake`**: stake returns to the resolver if their vote matched the final winner; otherwise it is transferred to the platform treasury.
|
|
474
474
|
|
|
475
475
|
**Reads**
|
|
476
476
|
|
|
477
477
|
- **`fetchResolutionState(marketPda)`** — `proposed_outcome`, `proposal_ts`, `dispute_active`, `refute_bond_amount`, etc.
|
|
478
478
|
- **`fetchPlatformProfile(platformId)`** — `challenge_window_secs`, `resolver_stake`, `refute_bond` (challenge length and stake are not stored on `ResolutionState`).
|
|
479
|
-
- **`fetchMarket(marketPda)`** — `winningOutcomeIndex` is **`null`** until **`confirmResolution`** succeeds.
|
|
479
|
+
- **`fetchMarket(marketPda)`** — `winningOutcomeIndex` is **`null`** until **`confirmResolution`** or **`resolveRefute({ accept: true })`** succeeds.
|
|
480
480
|
|
|
481
481
|
**UI / agent logic**
|
|
482
482
|
|
|
@@ -582,7 +582,7 @@ Start from **`agents/skill.md`** in this package for a stable entrypoint; the fu
|
|
|
582
582
|
- Create: `createMarketFull` **or** `createMarket` + resolver / outcome / mint **or** pari init.
|
|
583
583
|
- Complete-set: `mintCompleteSet` → `redeemCompleteSet` → `redeemWinning`.
|
|
584
584
|
- Parimutuel: `parimutuelStake` → optional `parimutuelWithdraw` (if `isEarlyWithdrawAllowed`, or after `voidMarket` for full refunds) → `parimutuelClaim`; creator may change penalty split, early withdraw, and per-wallet caps (`maxWalletOutcomeInvestment`, `isWalletOutcomeStakeExact`) with `updateParimutuelState` (pass full params from `fetchMarket` / `fetchParimutuelState` when only changing some fields).
|
|
585
|
-
- Resolution: `voteResolution` → `finalizeResolution` (proposal) → challenge window → optional `openRefute` / `resolveRefute` → `confirmResolution`
|
|
585
|
+
- Resolution: `voteResolution` → `finalizeResolution` (proposal) → challenge window → optional `openRefute` / `resolveRefute` (dismiss or accept) → `confirmResolution` if not already finalized by accept → `claimResolverStake`; then redeem/claim for traders.
|
|
586
586
|
4. **Discovery**: `fetchAllMarkets`, `getUsersMarkets`, `fetchMarketsByCreator`, `fetchVoidedMarkets`, `fetchVoidedParimutuelSurplusCandidates`.
|
|
587
587
|
5. **Safety**: verify signers, PDAs, ATAs, and RPC limits on `getProgramAccounts`.
|
|
588
588
|
|
package/agents/skill.md
CHANGED
|
@@ -73,7 +73,7 @@ Paths are under `node_modules/@vercora-protocol/sdk/` after install.
|
|
|
73
73
|
- After `fetchMarket(marketPda)`, read **`isEarlyWithdrawAllowed`**. If `false`, do not propose early-exit **`parimutuelWithdraw`** until close/resolution (**`EarlyWithdrawNotAllowed`**), **unless `isVoided`** — then **`parimutuelWithdraw`** refunds full net stakes (no penalty / withdraw fees).
|
|
74
74
|
- Also read **`maxWalletOutcomeInvestment`** (`BN`, `0` = unlimited) and **`isWalletOutcomeStakeExact`**. When proposing **`parimutuelStake`**, enforce per-wallet caps and exact-stake rules (**`WalletOutcomeInvestmentCapExceeded`**, **`WalletOutcomeExactStakeMismatch`**).
|
|
75
75
|
- **Creators** (open pari market, not resolved/voided): **`updateParimutuelState`** updates penalty bps, **`isEarlyWithdrawAllowed`**, **`maxWalletOutcomeInvestment`**, and **`isWalletOutcomeStakeExact`** in one instruction — pass **full** params (current values from **`fetchMarket`** + **`fetchParimutuelState`** for fields you keep unchanged). If **`isWalletOutcomeStakeExact`** is `true`, **`maxWalletOutcomeInvestment`** must be **> 0** (**`InvalidWalletOutcomeStakeExactConfig`** otherwise).
|
|
76
|
-
- **`voidMarket`:** the **creator** cannot void while pari **outcome pools** (active stakes) or complete-set outstanding is non-zero (**`CreatorCannotVoidWithActiveLiquidity`**). Propose a **global config authority** wallet to cancel live markets; SDK passes **`parimutuelState`**
|
|
76
|
+
- **`voidMarket`:** the **creator** cannot void while pari **outcome pools** (active stakes) or complete-set outstanding is non-zero (**`CreatorCannotVoidWithActiveLiquidity`**). **Cannot void while an `openRefute` dispute is active** (**`CannotVoidWithOpenDispute`**). Propose a **global config authority** wallet to cancel live markets; SDK passes **`resolutionState`** and **`parimutuelState`** (pari) or `null` (complete-set).
|
|
77
77
|
- **`claimVoidedParimutuelSurplus`:** **global authority only** — if a voided pari market has **zero outcome stakes** but **`total_pool` > 0** (early-exit pool-keep left in the vault), sweep that surplus to the platform treasury. Call after users have finished void refunds.
|
|
78
78
|
- Use **`isClosedEarly`**, **`isVoided`**, **`winningOutcomeIndex`** for lifecycle — not legacy `closed` / `voided` / `resolvedOutcomeIndex` names.
|
|
79
79
|
|
|
@@ -82,5 +82,5 @@ Paths are under `node_modules/@vercora-protocol/sdk/` after install.
|
|
|
82
82
|
- **`create_market`** requires **`platform_id > 0`**: register a platform, **`upsert_platform_profile`** (global config primary or secondary authority signs), and pass **`platform_registry`**, **`platform_profile`**, **`resolution_state`**, **`resolver_stake_vault`** (SDK methods wire PDAs when you use `PredictionMarketClient`).
|
|
83
83
|
- Settlement is **two-phase**: **`finalizeResolution`** records a **proposal** on **`fetchResolutionState`** (`proposed_outcome`, `proposal_ts`). It does **not** set **`winningOutcomeIndex`** on the market.
|
|
84
84
|
- After **`challenge_window_secs`** from **`fetchPlatformProfile(platformId)`** (same value used on-chain for the challenge window), call **`confirmResolution`** to finalize **`Market.winningOutcomeIndex`**. Until then, traders cannot **`redeemWinning`** / **`parimutuelClaim`** as “resolved.”
|
|
85
|
-
- Optional dispute: **`openRefute`**
|
|
86
|
-
- After final winner is set, resolvers may **`claimResolverStake
|
|
85
|
+
- Optional dispute: **`openRefute`** during the window; **`resolveRefute`** with **`accept: false`** slashes the bond to treasury, **`accept: true`** refunds the refuter and sets **`winningOutcomeIndex`** immediately. Signers: global **primary/secondary** or platform **`profileAuthority`**. **`confirmResolution`** fails while a dispute blocks it; skip **`confirmResolution`** if accept already finalized the market.
|
|
86
|
+
- After final winner is set, resolvers may **`claimResolverStake`** (wrong outcome → slash to treasury). Read **`fetchResolutionState`** + **`fetchMarket`** together for UI (proposal vs final).
|
package/dist/client.d.ts
CHANGED
|
@@ -146,11 +146,16 @@ export declare class PredictionMarketClient {
|
|
|
146
146
|
disputedOutcome: number;
|
|
147
147
|
}, opts?: anchor.web3.ConfirmOptions): Promise<string>;
|
|
148
148
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
149
|
+
* Resolve an open refute: **dismiss** (`accept: false`) slashes the bond to the platform treasury ATA;
|
|
150
|
+
* **accept** (`accept: true`) refunds the bond to the disputer and sets `winningOutcomeIndex` to the disputed outcome
|
|
151
|
+
* (no `confirmResolution` step).
|
|
152
|
+
*
|
|
153
|
+
* Signer must be **global primary or secondary** (`GlobalConfig`) or the platform **`profileAuthority`** on registry.
|
|
151
154
|
*/
|
|
152
155
|
resolveRefute(marketPda: PublicKey, params: {
|
|
153
156
|
marketId: BN;
|
|
157
|
+
accept: boolean;
|
|
158
|
+
disputerCollateral?: PublicKey;
|
|
154
159
|
}, opts?: anchor.web3.ConfirmOptions): Promise<string>;
|
|
155
160
|
/** After resolution: claim staked collateral back if correct, or slash to treasury if wrong. */
|
|
156
161
|
claimResolverStake(marketPda: PublicKey, params: {
|
|
@@ -174,6 +179,7 @@ export declare class PredictionMarketClient {
|
|
|
174
179
|
*
|
|
175
180
|
* **Creator** cannot void while pari **outcome pools** (active stakes) or **complete-set outstanding**
|
|
176
181
|
* is non-zero (`CreatorCannotVoidWithActiveLiquidity`). Use a **global config** wallet to cancel live markets.
|
|
182
|
+
* Cannot void while an **open refute** dispute is active (`CannotVoidWithOpenDispute`).
|
|
177
183
|
* Passes **`parimutuelState`** for pari markets (`null` for complete-set).
|
|
178
184
|
*/
|
|
179
185
|
voidMarket(marketPda: PublicKey, params: VoidMarketParams, opts?: anchor.web3.ConfirmOptions): Promise<string>;
|
|
@@ -263,6 +269,19 @@ export declare class PredictionMarketClient {
|
|
|
263
269
|
/**
|
|
264
270
|
* Fetch the `ResolutionVote` PDA for a specific resolver slot.
|
|
265
271
|
* Returns `null` if the account does not exist (resolver has not voted).
|
|
272
|
+
*
|
|
273
|
+
* Decode is tolerant of IDL drift: if `coder.accounts.decode('ResolutionVote',
|
|
274
|
+
* …)` throws (e.g. the deployed program added/changed padding and the
|
|
275
|
+
* bundled IDL hasn't been re-released yet), this falls back to a raw
|
|
276
|
+
* byte-offset decode via {@link decodeResolutionVoteFromAccountData} — but
|
|
277
|
+
* only when the account is owned by this program id, since only the
|
|
278
|
+
* program's own `vote_resolution` / `revoke_resolution_vote` instructions
|
|
279
|
+
* can write to a PDA derived from `[market, "vote", resolver_index]`.
|
|
280
|
+
*
|
|
281
|
+
* Without this fallback a successful `vote_resolution` tx would leave
|
|
282
|
+
* `hasVoted: false` in any caller that silently treats a decode throw as
|
|
283
|
+
* "no vote" (the most common pattern), leaving the UI stuck on the
|
|
284
|
+
* "Submit vote" form.
|
|
266
285
|
*/
|
|
267
286
|
fetchResolutionVote(marketPda: PublicKey, resolverIndex: number): Promise<ResolutionVoteAccount | null>;
|
|
268
287
|
/**
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,UAAU,EACV,SAAS,EAOV,MAAM,iBAAiB,CAAC;AASzB,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AE,EAAE,CAAC;YAyL5C,WAAW;CA2B1B"}
|
package/dist/client.js
CHANGED
|
@@ -867,25 +867,33 @@ class PredictionMarketClient {
|
|
|
867
867
|
.rpc(opts ?? { skipPreflight: true });
|
|
868
868
|
}
|
|
869
869
|
/**
|
|
870
|
-
*
|
|
871
|
-
*
|
|
870
|
+
* Resolve an open refute: **dismiss** (`accept: false`) slashes the bond to the platform treasury ATA;
|
|
871
|
+
* **accept** (`accept: true`) refunds the bond to the disputer and sets `winningOutcomeIndex` to the disputed outcome
|
|
872
|
+
* (no `confirmResolution` step).
|
|
873
|
+
*
|
|
874
|
+
* Signer must be **global primary or secondary** (`GlobalConfig`) or the platform **`profileAuthority`** on registry.
|
|
872
875
|
*/
|
|
873
876
|
async resolveRefute(marketPda, params, opts) {
|
|
874
877
|
const market = await this.fetchMarket(marketPda);
|
|
875
878
|
const collateralMint = market.collateralMint;
|
|
876
879
|
const collateralTokenProgram = await this.collateralTokenProgramForMint(collateralMint);
|
|
880
|
+
const rs = await this.fetchResolutionState(marketPda);
|
|
881
|
+
const disputerKey = rs.disputer;
|
|
882
|
+
const disputerCollateral = params.disputerCollateral ??
|
|
883
|
+
(0, spl_token_1.getAssociatedTokenAddressSync)(collateralMint, disputerKey, false, collateralTokenProgram, spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID);
|
|
877
884
|
const gc = await this.fetchGlobalConfig();
|
|
878
885
|
const treasuryWallet = gc.platformTreasury;
|
|
879
886
|
const treasuryAta = (0, spl_token_1.getAssociatedTokenAddressSync)(collateralMint, treasuryWallet, false, collateralTokenProgram, spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID);
|
|
880
887
|
const pid = (0, pda_1.bnToU32)((0, pda_1.bnLike)(market.platformId));
|
|
881
888
|
return this.program.methods
|
|
882
|
-
.resolveRefute({ marketId: params.marketId })
|
|
889
|
+
.resolveRefute({ marketId: params.marketId, accept: params.accept })
|
|
883
890
|
.accounts({
|
|
884
891
|
authority: this.walletKey,
|
|
885
892
|
market: marketPda,
|
|
886
893
|
resolutionState: (0, pda_1.deriveResolutionState)(this.program.programId, marketPda),
|
|
887
894
|
resolverStakeVault: (0, pda_1.deriveResolverStakeVault)(this.program.programId, marketPda),
|
|
888
895
|
collateralMint,
|
|
896
|
+
disputerCollateral,
|
|
889
897
|
globalConfig: this.globalConfig,
|
|
890
898
|
platformRegistry: (0, pda_1.derivePlatformRegistry)(this.program.programId, pid),
|
|
891
899
|
platformTreasuryWallet: treasuryWallet,
|
|
@@ -1009,6 +1017,7 @@ class PredictionMarketClient {
|
|
|
1009
1017
|
*
|
|
1010
1018
|
* **Creator** cannot void while pari **outcome pools** (active stakes) or **complete-set outstanding**
|
|
1011
1019
|
* is non-zero (`CreatorCannotVoidWithActiveLiquidity`). Use a **global config** wallet to cancel live markets.
|
|
1020
|
+
* Cannot void while an **open refute** dispute is active (`CannotVoidWithOpenDispute`).
|
|
1012
1021
|
* Passes **`parimutuelState`** for pari markets (`null` for complete-set).
|
|
1013
1022
|
*/
|
|
1014
1023
|
async voidMarket(marketPda, params, opts) {
|
|
@@ -1025,6 +1034,7 @@ class PredictionMarketClient {
|
|
|
1025
1034
|
signer: this.walletKey,
|
|
1026
1035
|
globalConfig: this.globalConfig,
|
|
1027
1036
|
market: marketPda,
|
|
1037
|
+
resolutionState: (0, pda_1.deriveResolutionState)(this.program.programId, marketPda),
|
|
1028
1038
|
parimutuelState,
|
|
1029
1039
|
})
|
|
1030
1040
|
.rpc(opts ?? { skipPreflight: true });
|
|
@@ -1363,13 +1373,48 @@ class PredictionMarketClient {
|
|
|
1363
1373
|
/**
|
|
1364
1374
|
* Fetch the `ResolutionVote` PDA for a specific resolver slot.
|
|
1365
1375
|
* Returns `null` if the account does not exist (resolver has not voted).
|
|
1376
|
+
*
|
|
1377
|
+
* Decode is tolerant of IDL drift: if `coder.accounts.decode('ResolutionVote',
|
|
1378
|
+
* …)` throws (e.g. the deployed program added/changed padding and the
|
|
1379
|
+
* bundled IDL hasn't been re-released yet), this falls back to a raw
|
|
1380
|
+
* byte-offset decode via {@link decodeResolutionVoteFromAccountData} — but
|
|
1381
|
+
* only when the account is owned by this program id, since only the
|
|
1382
|
+
* program's own `vote_resolution` / `revoke_resolution_vote` instructions
|
|
1383
|
+
* can write to a PDA derived from `[market, "vote", resolver_index]`.
|
|
1384
|
+
*
|
|
1385
|
+
* Without this fallback a successful `vote_resolution` tx would leave
|
|
1386
|
+
* `hasVoted: false` in any caller that silently treats a decode throw as
|
|
1387
|
+
* "no vote" (the most common pattern), leaving the UI stuck on the
|
|
1388
|
+
* "Submit vote" form.
|
|
1366
1389
|
*/
|
|
1367
1390
|
async fetchResolutionVote(marketPda, resolverIndex) {
|
|
1368
1391
|
const pda = (0, pda_1.deriveResolutionVote)(this.program.programId, marketPda, resolverIndex);
|
|
1369
1392
|
const info = await this.connection.getAccountInfo(pda);
|
|
1370
1393
|
if (!info)
|
|
1371
1394
|
return null;
|
|
1372
|
-
|
|
1395
|
+
const buf = Buffer.from(info.data);
|
|
1396
|
+
try {
|
|
1397
|
+
return this.program.coder.accounts.decode('ResolutionVote', buf);
|
|
1398
|
+
}
|
|
1399
|
+
catch (e) {
|
|
1400
|
+
const ownerMatchesProgram = info.owner.equals(this.program.programId);
|
|
1401
|
+
const decoded = (0, resolverDecode_1.decodeResolutionVoteFromAccountData)(this.program, buf, {
|
|
1402
|
+
trustOwner: ownerMatchesProgram,
|
|
1403
|
+
});
|
|
1404
|
+
if (decoded) {
|
|
1405
|
+
// eslint-disable-next-line no-console
|
|
1406
|
+
console.warn('[vercora:fetchResolutionVote] Anchor coder decode failed — returning raw byte-offset decode (likely IDL drift after redeploy).', {
|
|
1407
|
+
pda: pda.toBase58(),
|
|
1408
|
+
owner: info.owner.toBase58(),
|
|
1409
|
+
programId: this.program.programId.toBase58(),
|
|
1410
|
+
dataLen: buf.length,
|
|
1411
|
+
rpc: this.connection.rpcEndpoint,
|
|
1412
|
+
coderError: e instanceof Error ? e.message : String(e),
|
|
1413
|
+
});
|
|
1414
|
+
return decoded;
|
|
1415
|
+
}
|
|
1416
|
+
throw e;
|
|
1417
|
+
}
|
|
1373
1418
|
}
|
|
1374
1419
|
/**
|
|
1375
1420
|
* Decode all 8 `MarketOutcome` PDAs via chunked `getMultipleAccounts` (QuickNode Discover: max 5 keys/call).
|
|
@@ -1663,6 +1708,38 @@ class PredictionMarketClient {
|
|
|
1663
1708
|
rpc: this.connection.rpcEndpoint,
|
|
1664
1709
|
});
|
|
1665
1710
|
}
|
|
1711
|
+
// Per-PDA `getAccountInfo` fallback. Some RPC / validator combinations
|
|
1712
|
+
// (observed on `solana-test-validator`) have returned `null` entries from
|
|
1713
|
+
// `getMultipleAccountsInfo` for PDAs that a subsequent single
|
|
1714
|
+
// `getAccountInfo` fetches fine. Rather than silently dropping those
|
|
1715
|
+
// slots (which caused the app to believe "no resolver PDAs yet" for live
|
|
1716
|
+
// markets), re-fetch any null slot individually before the decode pass.
|
|
1717
|
+
const nullSlotIndices = [];
|
|
1718
|
+
for (let i = 0; i < numResolvers; i++) {
|
|
1719
|
+
if (!infos[i])
|
|
1720
|
+
nullSlotIndices.push(i);
|
|
1721
|
+
}
|
|
1722
|
+
if (nullSlotIndices.length > 0) {
|
|
1723
|
+
const rechecked = await Promise.all(nullSlotIndices.map((i) => this.connection.getAccountInfo(pdas[i])));
|
|
1724
|
+
let recoveredCount = 0;
|
|
1725
|
+
nullSlotIndices.forEach((slotIdx, k) => {
|
|
1726
|
+
const info = rechecked[k];
|
|
1727
|
+
if (info) {
|
|
1728
|
+
infos[slotIdx] = info;
|
|
1729
|
+
recoveredCount += 1;
|
|
1730
|
+
}
|
|
1731
|
+
});
|
|
1732
|
+
if (recoveredCount > 0) {
|
|
1733
|
+
// eslint-disable-next-line no-console
|
|
1734
|
+
console.warn('[vercora:fetchAllResolvers] getMultipleAccountsInfo returned null for slots that getAccountInfo found — using the single-account results (RPC batch inconsistency).', {
|
|
1735
|
+
market: market.toBase58(),
|
|
1736
|
+
programId: expectedProgram.toBase58(),
|
|
1737
|
+
rpc: this.connection.rpcEndpoint,
|
|
1738
|
+
recoveredSlots: nullSlotIndices.filter((_, k) => !!rechecked[k]),
|
|
1739
|
+
stillMissingSlots: nullSlotIndices.filter((_, k) => !rechecked[k]),
|
|
1740
|
+
});
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1666
1743
|
const results = [];
|
|
1667
1744
|
const debugRows = [];
|
|
1668
1745
|
for (let i = 0; i < numResolvers; i++) {
|