pnp-sdk 0.2.3 → 0.2.5

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.
@@ -39,7 +39,7 @@ var ProgramError = class extends SdkError {
39
39
  };
40
40
 
41
41
  // src/platform/client.ts
42
- import { Connection } from "@solana/web3.js";
42
+ import { Connection, PublicKey as PublicKey2 } from "@solana/web3.js";
43
43
 
44
44
  // src/idl/index.ts
45
45
  import { PublicKey, TransactionInstruction } from "@solana/web3.js";
@@ -9663,7 +9663,7 @@ var PNP_PROGRAM_ID = new PublicKey(
9663
9663
  })()
9664
9664
  );
9665
9665
  var idlCoder = new BorshCoder(PNP_IDL);
9666
- function buildIdlIx(ixName, accounts, args = []) {
9666
+ function buildIdlIx(ixName, accounts, args = [], programId) {
9667
9667
  const ixDef = PNP_IDL.instructions?.find((ix) => ix.name === ixName);
9668
9668
  if (!ixDef) throw new Error(`Instruction not found in IDL: ${ixName}`);
9669
9669
  if (DEBUG) {
@@ -9773,7 +9773,8 @@ function buildIdlIx(ixName, accounts, args = []) {
9773
9773
  } catch (e) {
9774
9774
  if (DEBUG) console.warn(`[buildIdlIx:${ixName}] Post-encode field inspection failed:`, e?.message ?? String(e));
9775
9775
  }
9776
- return new TransactionInstruction({ programId: PNP_PROGRAM_ID, keys: constructAccountMetas(ixDef, accounts), data });
9776
+ const programIdToUse = programId || PNP_PROGRAM_ID;
9777
+ return new TransactionInstruction({ programId: programIdToUse, keys: constructAccountMetas(ixDef, accounts), data });
9777
9778
  } catch (err) {
9778
9779
  if (DEBUG) console.error(`Failed to encode instruction data: ${err.message || err}`);
9779
9780
  throw err;
@@ -9803,19 +9804,30 @@ function decodeAccount(accountName, data) {
9803
9804
  }
9804
9805
 
9805
9806
  // src/platform/client.ts
9807
+ var MAINNET_PROGRAM_ID = PNP_PROGRAM_ID;
9808
+ var DEVNET_PROGRAM_ID = new PublicKey2("pnpkv2qnh4bfpGvTugGDSEhvZC7DP4pVxTuDykV3BGz");
9809
+ function isDevnetRpc(rpcUrl) {
9810
+ const url = rpcUrl.toLowerCase();
9811
+ return url.includes("devnet") || url.includes("dev.") || url.includes(":8899");
9812
+ }
9806
9813
  var Client = class {
9807
9814
  connection;
9808
9815
  programId;
9809
9816
  commitment;
9810
9817
  logger;
9818
+ isDevnet;
9811
9819
  constructor(cfg) {
9812
9820
  this.commitment = cfg.commitment ?? "confirmed";
9813
9821
  this.connection = new Connection(cfg.rpcUrl, {
9814
9822
  commitment: this.commitment,
9815
9823
  httpHeaders: cfg.httpHeaders
9816
9824
  });
9817
- this.programId = PNP_PROGRAM_ID;
9825
+ this.isDevnet = isDevnetRpc(cfg.rpcUrl);
9826
+ this.programId = this.isDevnet ? DEVNET_PROGRAM_ID : MAINNET_PROGRAM_ID;
9818
9827
  this.logger = cfg.logger ?? console;
9828
+ if (this.isDevnet) {
9829
+ this.logger.info?.(`[PNP SDK] Using DEVNET program: ${DEVNET_PROGRAM_ID.toBase58()}`);
9830
+ }
9819
9831
  }
9820
9832
  fail(code, message, details) {
9821
9833
  this.logger.error?.(code, message, details);
@@ -9914,7 +9926,7 @@ import { z } from "zod";
9914
9926
  // src/instructions/idl_builders.ts
9915
9927
  import BN from "bn.js";
9916
9928
  var DEBUG2 = process.env.PNP_DEBUG === "1";
9917
- function buildCreateMarketIxIdl(accounts, args) {
9929
+ function buildCreateMarketIxIdl(accounts, args, programId) {
9918
9930
  if (DEBUG2) {
9919
9931
  console.log("Building create_market_v2 instruction with args:", JSON.stringify({
9920
9932
  question: args.question,
@@ -9943,9 +9955,9 @@ function buildCreateMarketIxIdl(accounts, args) {
9943
9955
  if (DEBUG2) {
9944
9956
  console.log(` creator: ${creator.toBase58()} (type: ${typeof creator})`);
9945
9957
  }
9946
- return buildIdlIx("create_market_v2", accounts, [question, initial_liquidity, end_time, creator]);
9958
+ return buildIdlIx("create_market_v2", accounts, [question, initial_liquidity, end_time, creator], programId);
9947
9959
  }
9948
- function buildMintDecisionTokensIx(accounts, args) {
9960
+ function buildMintDecisionTokensIx(accounts, args, programId) {
9949
9961
  const amount = new BN(args.amount.toString());
9950
9962
  const minimum_out = new BN(args.minimum_out.toString());
9951
9963
  try {
@@ -9957,9 +9969,9 @@ function buildMintDecisionTokensIx(accounts, args) {
9957
9969
  }
9958
9970
  } catch {
9959
9971
  }
9960
- return buildIdlIx("mint_decision_tokens", accounts, [amount, args.buy_yes_token, minimum_out]);
9972
+ return buildIdlIx("mint_decision_tokens", accounts, [amount, args.buy_yes_token, minimum_out], programId);
9961
9973
  }
9962
- function buildBurnDecisionTokensIx(accounts, args) {
9974
+ function buildBurnDecisionTokensIx(accounts, args, programId) {
9963
9975
  const amount = new BN(args.amount.toString());
9964
9976
  try {
9965
9977
  if (DEBUG2) {
@@ -9968,25 +9980,35 @@ function buildBurnDecisionTokensIx(accounts, args) {
9968
9980
  }
9969
9981
  } catch {
9970
9982
  }
9971
- return buildIdlIx("burn_decision_tokens", accounts, [amount, args.burn_yes_token]);
9983
+ return buildIdlIx("burn_decision_tokens", accounts, [amount, args.burn_yes_token], programId);
9984
+ }
9985
+ function buildClaimCreatorFeeIx(accounts, programId) {
9986
+ return buildIdlIx("claim_creator_fee", accounts, [], programId);
9972
9987
  }
9973
- function buildClaimCreatorFeeIx(accounts) {
9974
- return buildIdlIx("claim_creator_fee", accounts, []);
9988
+ function buildCreatorRefundIx(accounts, programId) {
9989
+ return buildIdlIx("creator_refund", accounts, [], programId);
9975
9990
  }
9976
- function buildCreatorRefundIx(accounts) {
9977
- return buildIdlIx("creator_refund", accounts, []);
9991
+ function buildCreatorRefundV2Ix(accounts, programId) {
9992
+ return buildIdlIx("creator_refund_v2", accounts, [], programId);
9978
9993
  }
9979
- function buildCreatorRefundV2Ix(accounts) {
9980
- return buildIdlIx("creator_refund_v2", accounts, []);
9994
+ function buildCreatorRefundV3Ix(accounts, programId) {
9995
+ return buildIdlIx("creator_refund_v3", accounts, [], programId);
9981
9996
  }
9982
- function buildCreatorRefundV3Ix(accounts) {
9983
- return buildIdlIx("creator_refund_v3", accounts, []);
9997
+ function buildRedeemPositionV2Ix(accounts, programId) {
9998
+ return buildIdlIx("redeem_position_v2", accounts, [], programId);
9984
9999
  }
9985
- function buildRedeemPositionV2Ix(accounts) {
9986
- return buildIdlIx("redeem_position_v2", accounts, []);
10000
+ function buildRedeemV3PositionIx(accounts, programId) {
10001
+ return buildIdlIx("redeem_v3_position", accounts, [], programId);
9987
10002
  }
9988
- function buildRedeemV3PositionIx(accounts) {
9989
- return buildIdlIx("redeem_v3_position", accounts, []);
10003
+ function buildSetMarketResolvableV2Ix(accounts, args, programId) {
10004
+ const market_id = new BN(args.market_id.toString());
10005
+ const resolvable = args.resolvable;
10006
+ const force_resolve = args.force_resolve !== void 0 ? args.force_resolve : null;
10007
+ return buildIdlIx("set_market_resolvable_v2", accounts, [market_id, resolvable, force_resolve], programId);
10008
+ }
10009
+ function buildSetMarketResolvableV3Ix(accounts, args, programId) {
10010
+ const resolvable = args.resolvable;
10011
+ return buildIdlIx("set_market_resolvable_v3", accounts, [resolvable], programId);
9990
10012
  }
9991
10013
 
9992
10014
  // src/platform/tx.ts
@@ -10016,7 +10038,7 @@ async function buildAndSendV0(client, signer, ixs, opts = {}) {
10016
10038
  }
10017
10039
 
10018
10040
  // src/modules/market.ts
10019
- import { TOKEN_PROGRAM_ID as TOKEN_PROGRAM_ID2, ASSOCIATED_TOKEN_PROGRAM_ID as ASSOCIATED_TOKEN_PROGRAM_ID2 } from "@solana/spl-token";
10041
+ import { TOKEN_PROGRAM_ID as TOKEN_PROGRAM_ID2, TOKEN_2022_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID as ASSOCIATED_TOKEN_PROGRAM_ID2 } from "@solana/spl-token";
10020
10042
  var DEBUG3 = process.env.PNP_DEBUG === "1";
10021
10043
  var DEFAULT_COLLATERAL_MINT = new PublicKey5("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
10022
10044
  var CreateMarketSchema = z.object({
@@ -10048,7 +10070,7 @@ var MarketModule = class {
10048
10070
  }
10049
10071
  // IDL-backed create market allowing explicit accounts from the pnp.exchange IDL
10050
10072
  async createMarketIdl(accounts, args) {
10051
- const ix = buildCreateMarketIxIdl(accounts, args);
10073
+ const ix = buildCreateMarketIxIdl(accounts, args, this.client.programId);
10052
10074
  const res = await buildAndSendV0(this.client, this.signer, [ix], {
10053
10075
  computeUnitLimit: 8e5
10054
10076
  });
@@ -10116,7 +10138,7 @@ var MarketModule = class {
10116
10138
  end_time: endTime,
10117
10139
  creator
10118
10140
  // Pass the creator explicitly
10119
- });
10141
+ }, this.client.programId);
10120
10142
  const res = await buildAndSendV0(this.client, this.signer, [ix], {
10121
10143
  computeUnitLimit: 4e5
10122
10144
  });
@@ -10139,6 +10161,109 @@ var MarketModule = class {
10139
10161
  const acc = decodeAccount("Market", ai.data);
10140
10162
  return { publicKey: market, account: acc };
10141
10163
  }
10164
+ // ===== Set Market Resolvable (V2) =====
10165
+ async setMarketResolvableIdl(accounts, args) {
10166
+ const ix = buildSetMarketResolvableV2Ix(accounts, args);
10167
+ const res = await buildAndSendV0(this.client, this.signer, [ix], {
10168
+ computeUnitLimit: 8e5
10169
+ });
10170
+ if (!res.signature) {
10171
+ throw new Error("Transaction failed: No signature returned");
10172
+ }
10173
+ return { signature: res.signature };
10174
+ }
10175
+ async setMarketResolvable(params) {
10176
+ const { market, resolvable, forceResolve } = params;
10177
+ const { account: marketAccount } = await this.fetchMarket(market);
10178
+ let marketId;
10179
+ if (marketAccount.id !== void 0 && marketAccount.id !== null) {
10180
+ marketId = BigInt(marketAccount.id.toString());
10181
+ } else if (marketAccount.market_id !== void 0) {
10182
+ marketId = BigInt(marketAccount.market_id.toString());
10183
+ } else {
10184
+ throw new Error("Could not extract market_id from market account. Market account missing 'id' field.");
10185
+ }
10186
+ if (marketId === 0n) {
10187
+ throw new Error("Market ID is zero, which is invalid");
10188
+ }
10189
+ const [globalConfig] = deriveGlobalConfigPda(this.client.programId);
10190
+ const globalConfigInfo = await this.client.connection.getAccountInfo(globalConfig, this.client.commitment);
10191
+ if (!globalConfigInfo) throw new Error("global_config not initialized on-chain");
10192
+ const collateralTokenMint = new PublicKey5(marketAccount.collateral_token || marketAccount.collateralToken);
10193
+ const creator = new PublicKey5(marketAccount.creator);
10194
+ const [yesTokenMint] = deriveYesTokenMint(marketId, this.client.programId);
10195
+ const [noTokenMint] = deriveNoTokenMint(marketId, this.client.programId);
10196
+ const creatorYesTokenAccount = deriveAta(creator, yesTokenMint);
10197
+ const creatorNoTokenAccount = deriveAta(creator, noTokenMint);
10198
+ const TOKEN_METADATA_PROGRAM_ID = new PublicKey5("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");
10199
+ const [yesMetadata] = deriveTokenMetadataPda(yesTokenMint, TOKEN_METADATA_PROGRAM_ID);
10200
+ const [noMetadata] = deriveTokenMetadataPda(noTokenMint, TOKEN_METADATA_PROGRAM_ID);
10201
+ const collateralMintInfo = await this.client.connection.getAccountInfo(collateralTokenMint, this.client.commitment);
10202
+ if (!collateralMintInfo) throw new Error("collateral_token_mint not found");
10203
+ const tokenProgram = collateralMintInfo.owner.equals(TOKEN_2022_PROGRAM_ID) ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID2;
10204
+ const accounts = {
10205
+ authority: this.signer.publicKey,
10206
+ global_config: globalConfig,
10207
+ market,
10208
+ collateral_token_mint: collateralTokenMint,
10209
+ yes_token_mint: yesTokenMint,
10210
+ no_token_mint: noTokenMint,
10211
+ creator,
10212
+ creator_yes_token_account: creatorYesTokenAccount,
10213
+ creator_no_token_account: creatorNoTokenAccount,
10214
+ token_metadata_program: TOKEN_METADATA_PROGRAM_ID,
10215
+ yes_metadata: yesMetadata,
10216
+ no_metadata: noMetadata,
10217
+ token_program: tokenProgram,
10218
+ associated_token_program: ASSOCIATED_TOKEN_PROGRAM_ID2,
10219
+ system_program: SystemProgram2.programId,
10220
+ rent: new PublicKey5("SysvarRent111111111111111111111111111111111")
10221
+ };
10222
+ const ix = buildSetMarketResolvableV2Ix(accounts, {
10223
+ market_id: marketId,
10224
+ resolvable,
10225
+ force_resolve: forceResolve
10226
+ }, this.client.programId);
10227
+ const res = await buildAndSendV0(this.client, this.signer, [ix], {
10228
+ computeUnitLimit: 8e5
10229
+ });
10230
+ if (!res.signature) {
10231
+ throw new Error("Transaction failed: No signature returned");
10232
+ }
10233
+ return { signature: res.signature };
10234
+ }
10235
+ // ===== Set Market Resolvable (V3/P2P) =====
10236
+ async setMarketResolvableP2pIdl(accounts, args) {
10237
+ const ix = buildSetMarketResolvableV3Ix(accounts, args);
10238
+ const res = await buildAndSendV0(this.client, this.signer, [ix], {
10239
+ computeUnitLimit: 8e5
10240
+ });
10241
+ if (!res.signature) {
10242
+ throw new Error("Transaction failed: No signature returned");
10243
+ }
10244
+ return { signature: res.signature };
10245
+ }
10246
+ async setMarketResolvableP2p(params) {
10247
+ const { market, resolvable } = params;
10248
+ const [globalConfig] = deriveGlobalConfigPda(this.client.programId);
10249
+ const globalConfigInfo = await this.client.connection.getAccountInfo(globalConfig, this.client.commitment);
10250
+ if (!globalConfigInfo) throw new Error("global_config not initialized on-chain");
10251
+ const accounts = {
10252
+ authority: this.signer.publicKey,
10253
+ global_config: globalConfig,
10254
+ market
10255
+ };
10256
+ const ix = buildSetMarketResolvableV3Ix(accounts, {
10257
+ resolvable
10258
+ }, this.client.programId);
10259
+ const res = await buildAndSendV0(this.client, this.signer, [ix], {
10260
+ computeUnitLimit: 8e5
10261
+ });
10262
+ if (!res.signature) {
10263
+ throw new Error("Transaction failed: No signature returned");
10264
+ }
10265
+ return { signature: res.signature };
10266
+ }
10142
10267
  };
10143
10268
 
10144
10269
  // src/modules/trading.ts
@@ -10160,7 +10285,7 @@ function buildTradeIx(params) {
10160
10285
  }
10161
10286
 
10162
10287
  // src/modules/trading.ts
10163
- import { TOKEN_PROGRAM_ID as TOKEN_PROGRAM_ID3, TOKEN_2022_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID as ASSOCIATED_TOKEN_PROGRAM_ID3, createAssociatedTokenAccountInstruction, getMint } from "@solana/spl-token";
10288
+ import { TOKEN_PROGRAM_ID as TOKEN_PROGRAM_ID3, TOKEN_2022_PROGRAM_ID as TOKEN_2022_PROGRAM_ID2, ASSOCIATED_TOKEN_PROGRAM_ID as ASSOCIATED_TOKEN_PROGRAM_ID3, createAssociatedTokenAccountInstruction, getMint } from "@solana/spl-token";
10164
10289
  var TradeSchema = z2.object({
10165
10290
  market: z2.instanceof(PublicKey7),
10166
10291
  side: z2.union([z2.literal("buy"), z2.literal("sell")]),
@@ -10209,7 +10334,7 @@ var TradingModule = class _TradingModule {
10209
10334
  }
10210
10335
  // IDL-backed mint of decision tokens (YES/NO) using explicit accounts per IDL
10211
10336
  async mintDecisionTokens(accounts, args) {
10212
- const ix = buildMintDecisionTokensIx(accounts, args);
10337
+ const ix = buildMintDecisionTokensIx(accounts, args, this.client.programId);
10213
10338
  const res = await buildAndSendV0(this.client, this.signer, [ix], {
10214
10339
  computeUnitLimit: 8e5
10215
10340
  });
@@ -10217,7 +10342,7 @@ var TradingModule = class _TradingModule {
10217
10342
  }
10218
10343
  // IDL-backed burn of decision tokens for collateral redemption
10219
10344
  async burnDecisionTokens(accounts, args) {
10220
- const ix = buildBurnDecisionTokensIx(accounts, args);
10345
+ const ix = buildBurnDecisionTokensIx(accounts, args, this.client.programId);
10221
10346
  const res = await buildAndSendV0(this.client, this.signer, [ix], {
10222
10347
  computeUnitLimit: 8e5
10223
10348
  });
@@ -10283,7 +10408,7 @@ var TradingModule = class _TradingModule {
10283
10408
  this.client.connection.getAccountInfo(collateralMint, this.client.commitment)
10284
10409
  ]);
10285
10410
  if (!yesAi || !noAi || !colAi) throw new Error("one or more mint accounts not found");
10286
- const tokenProgramId = yesAi.owner.equals(TOKEN_2022_PROGRAM_ID) ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID3;
10411
+ const tokenProgramId = yesAi.owner.equals(TOKEN_2022_PROGRAM_ID2) ? TOKEN_2022_PROGRAM_ID2 : TOKEN_PROGRAM_ID3;
10287
10412
  const ataProgramId = ASSOCIATED_TOKEN_PROGRAM_ID3;
10288
10413
  const owners = [yesAi.owner.toBase58(), noAi.owner.toBase58(), colAi.owner.toBase58()];
10289
10414
  if (!(yesAi.owner.equals(noAi.owner) && yesAi.owner.equals(colAi.owner))) {
@@ -10348,7 +10473,7 @@ var TradingModule = class _TradingModule {
10348
10473
  amount,
10349
10474
  buy_yes_token: buyYesToken,
10350
10475
  minimum_out: minimumOut
10351
- });
10476
+ }, this.client.programId);
10352
10477
  const ixs = [...preIxs, ix];
10353
10478
  const res = await buildAndSendV0(this.client, this.signer, ixs, { computeUnitLimit: 6e5 });
10354
10479
  return { signature: res.signature };
@@ -10375,7 +10500,7 @@ var TradingModule = class _TradingModule {
10375
10500
  this.client.connection.getAccountInfo(collateralMint, this.client.commitment)
10376
10501
  ]);
10377
10502
  if (!yesAi || !noAi || !colAi) throw new Error("one or more mint accounts not found");
10378
- const tokenProgramId = yesAi.owner.equals(TOKEN_2022_PROGRAM_ID) ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID3;
10503
+ const tokenProgramId = yesAi.owner.equals(TOKEN_2022_PROGRAM_ID2) ? TOKEN_2022_PROGRAM_ID2 : TOKEN_PROGRAM_ID3;
10379
10504
  const ataProgramId = ASSOCIATED_TOKEN_PROGRAM_ID3;
10380
10505
  if (!(yesAi.owner.equals(noAi.owner) && yesAi.owner.equals(colAi.owner))) {
10381
10506
  const owners = [yesAi.owner.toBase58(), noAi.owner.toBase58(), colAi.owner.toBase58()];
@@ -10408,7 +10533,7 @@ var TradingModule = class _TradingModule {
10408
10533
  const ix = buildBurnDecisionTokensIx(accounts, {
10409
10534
  amount,
10410
10535
  burn_yes_token: burnYesToken
10411
- });
10536
+ }, this.client.programId);
10412
10537
  const res = await buildAndSendV0(this.client, this.signer, [ix], { computeUnitLimit: 6e5 });
10413
10538
  return { signature: res.signature };
10414
10539
  }
@@ -10512,8 +10637,8 @@ var TradingModule = class _TradingModule {
10512
10637
  const collateralMint = info.collateralToken;
10513
10638
  const mintAi = await this.client.connection.getAccountInfo(collateralMint, this.client.commitment);
10514
10639
  if (!mintAi) throw new Error("collateral mint account not found");
10515
- const is2022 = mintAi.owner.equals(TOKEN_2022_PROGRAM_ID);
10516
- const tokenProgram = is2022 ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID3;
10640
+ const is2022 = mintAi.owner.equals(TOKEN_2022_PROGRAM_ID2);
10641
+ const tokenProgram = is2022 ? TOKEN_2022_PROGRAM_ID2 : TOKEN_PROGRAM_ID3;
10517
10642
  const mintInfo = await getMint(this.client.connection, collateralMint, this.client.commitment, tokenProgram);
10518
10643
  const decimals = mintInfo.decimals ?? 6;
10519
10644
  const scaleBI = 10n ** BigInt(decimals);
@@ -10667,7 +10792,7 @@ var RedemptionModule = class {
10667
10792
  }
10668
10793
  // IDL-backed creator fee claim
10669
10794
  async claimCreatorFee(accounts) {
10670
- const ix = buildClaimCreatorFeeIx(accounts);
10795
+ const ix = buildClaimCreatorFeeIx(accounts, this.client.programId);
10671
10796
  const res = await buildAndSendV0(this.client, this.signer, [ix], {
10672
10797
  computeUnitLimit: 8e5
10673
10798
  });
@@ -10675,7 +10800,7 @@ var RedemptionModule = class {
10675
10800
  }
10676
10801
  // IDL-backed creator refund
10677
10802
  async creatorRefund(accounts) {
10678
- const ix = buildCreatorRefundIx(accounts);
10803
+ const ix = buildCreatorRefundIx(accounts, this.client.programId);
10679
10804
  const res = await buildAndSendV0(this.client, this.signer, [ix], {
10680
10805
  computeUnitLimit: 8e5
10681
10806
  });
@@ -10683,7 +10808,7 @@ var RedemptionModule = class {
10683
10808
  }
10684
10809
  // IDL-backed creator refund V2
10685
10810
  async creatorRefundV2(accounts) {
10686
- const ix = buildCreatorRefundV2Ix(accounts);
10811
+ const ix = buildCreatorRefundV2Ix(accounts, this.client.programId);
10687
10812
  const res = await buildAndSendV0(this.client, this.signer, [ix], {
10688
10813
  computeUnitLimit: 8e5
10689
10814
  });
@@ -10691,7 +10816,7 @@ var RedemptionModule = class {
10691
10816
  }
10692
10817
  // IDL-backed creator refund V3
10693
10818
  async creatorRefundV3(accounts) {
10694
- const ix = buildCreatorRefundV3Ix(accounts);
10819
+ const ix = buildCreatorRefundV3Ix(accounts, this.client.programId);
10695
10820
  const res = await buildAndSendV0(this.client, this.signer, [ix], {
10696
10821
  computeUnitLimit: 8e5
10697
10822
  });
@@ -10703,7 +10828,7 @@ var RedemptionModule = class {
10703
10828
  * @returns Transaction signature
10704
10829
  */
10705
10830
  async redeemPositionV2(accounts) {
10706
- const ix = buildRedeemPositionV2Ix(accounts);
10831
+ const ix = buildRedeemPositionV2Ix(accounts, this.client.programId);
10707
10832
  const res = await buildAndSendV0(this.client, this.signer, [ix], {
10708
10833
  computeUnitLimit: 8e5
10709
10834
  });
@@ -10715,7 +10840,7 @@ var RedemptionModule = class {
10715
10840
  * @returns Transaction signature
10716
10841
  */
10717
10842
  async redeemV3Position(accounts) {
10718
- const ix = buildRedeemV3PositionIx(accounts);
10843
+ const ix = buildRedeemV3PositionIx(accounts, this.client.programId);
10719
10844
  const res = await buildAndSendV0(this.client, this.signer, [ix], {
10720
10845
  computeUnitLimit: 8e5
10721
10846
  });
@@ -10724,7 +10849,7 @@ var RedemptionModule = class {
10724
10849
  };
10725
10850
 
10726
10851
  // src/sdk.ts
10727
- import { PublicKey as PublicKey13, Keypair as Keypair2, SystemProgram as SystemProgram6 } from "@solana/web3.js";
10852
+ import { PublicKey as PublicKey14, Keypair as Keypair3, SystemProgram as SystemProgram6 } from "@solana/web3.js";
10728
10853
  import bs58 from "bs58";
10729
10854
 
10730
10855
  // src/platform/wallet.ts
@@ -10747,13 +10872,17 @@ var NodeKeypairSigner = class {
10747
10872
  };
10748
10873
 
10749
10874
  // src/lib/anchor-client.ts
10875
+ import { PublicKey as PublicKey11 } from "@solana/web3.js";
10750
10876
  import { BN as BN2 } from "bn.js";
10751
10877
  import * as anchor from "@coral-xyz/anchor";
10878
+ var MAINNET_PROGRAM_ID2 = new PublicKey11("6fnYZUSyp3vJxTNnayq5S62d363EFaGARnqYux5bqrxb");
10879
+ var DEVNET_PROGRAM_ID2 = new PublicKey11("pnpkv2qnh4bfpGvTugGDSEhvZC7DP4pVxTuDykV3BGz");
10752
10880
  var AnchorClient = class _AnchorClient {
10753
- constructor(connection, signer, idlOverride) {
10881
+ constructor(connection, signer, idlOverride, programIdOverride) {
10754
10882
  this.connection = connection;
10755
10883
  this.signer = signer;
10756
10884
  this.idlOverride = idlOverride;
10885
+ this.programIdOverride = programIdOverride;
10757
10886
  this.wallet = new anchor.Wallet(signer);
10758
10887
  this.provider = new anchor.AnchorProvider(connection, this.wallet, { commitment: "confirmed" });
10759
10888
  anchor.setProvider(this.provider);
@@ -10762,8 +10891,14 @@ var AnchorClient = class _AnchorClient {
10762
10891
  if (verbose) {
10763
10892
  console.log("Initializing Anchor program with IDL");
10764
10893
  }
10765
- const idlToUse = this.idlOverride ?? PNP_IDL;
10766
- this.program = new anchor.Program(idlToUse, this.provider);
10894
+ const baseIdl = this.idlOverride ?? PNP_IDL;
10895
+ const programId = this.programIdOverride;
10896
+ if (programId) {
10897
+ const idlWithAddress = { ...baseIdl, address: programId.toBase58() };
10898
+ this.program = new anchor.Program(idlWithAddress, this.provider);
10899
+ } else {
10900
+ this.program = new anchor.Program(baseIdl, this.provider);
10901
+ }
10767
10902
  if (verbose) {
10768
10903
  console.log("Program loaded successfully");
10769
10904
  console.log(`Program ID: ${this.program.programId.toString()}`);
@@ -10800,7 +10935,7 @@ var AnchorClient = class _AnchorClient {
10800
10935
  };
10801
10936
 
10802
10937
  // src/modules/anchor-market.ts
10803
- import { PublicKey as PublicKey11, SystemProgram as SystemProgram4, ComputeBudgetProgram as ComputeBudgetProgram2 } from "@solana/web3.js";
10938
+ import { PublicKey as PublicKey12, SystemProgram as SystemProgram4, ComputeBudgetProgram as ComputeBudgetProgram2 } from "@solana/web3.js";
10804
10939
  import {
10805
10940
  TOKEN_PROGRAM_ID as TOKEN_PROGRAM_ID4,
10806
10941
  ASSOCIATED_TOKEN_PROGRAM_ID as ASSOCIATED_TOKEN_PROGRAM_ID4,
@@ -10825,7 +10960,7 @@ var AnchorMarketModule = class {
10825
10960
  console.log(" End Time:", new Date(Number(endTime) * 1e3).toISOString());
10826
10961
  console.log(" Collateral Token Mint:", collateralTokenMint.toString());
10827
10962
  console.log(" Creator (for fees/ownership):", creatorOverride.toBase58());
10828
- const [globalConfig] = PublicKey11.findProgramAddressSync(
10963
+ const [globalConfig] = PublicKey12.findProgramAddressSync(
10829
10964
  [Buffer.from("global_config")],
10830
10965
  this.anchorClient.program.programId
10831
10966
  );
@@ -10833,7 +10968,7 @@ var AnchorMarketModule = class {
10833
10968
  const globalConfigAccount = await this.anchorClient.program.account.globalConfig.fetch(globalConfig);
10834
10969
  const currentGlobalId = globalConfigAccount.globalId;
10835
10970
  console.log("Current Global ID:", currentGlobalId.toString());
10836
- const [market] = PublicKey11.findProgramAddressSync(
10971
+ const [market] = PublicKey12.findProgramAddressSync(
10837
10972
  [Buffer.from("market-v2"), currentGlobalId.toArrayLike(Buffer, "le", 8)],
10838
10973
  this.anchorClient.program.programId
10839
10974
  );
@@ -10848,7 +10983,7 @@ var AnchorMarketModule = class {
10848
10983
  true
10849
10984
  // allowOwnerOffCurve
10850
10985
  );
10851
- const [creatorFeeTreasury] = PublicKey11.findProgramAddressSync(
10986
+ const [creatorFeeTreasury] = PublicKey12.findProgramAddressSync(
10852
10987
  [Buffer.from("creator_fee_treasury"), creatorOverride.toBuffer(), collateralTokenMint.toBuffer()],
10853
10988
  this.anchorClient.program.programId
10854
10989
  );
@@ -10906,7 +11041,7 @@ var AnchorMarketModule = class {
10906
11041
  };
10907
11042
 
10908
11043
  // src/modules/anchor-market-v3.ts
10909
- import { PublicKey as PublicKey12, SystemProgram as SystemProgram5, ComputeBudgetProgram as ComputeBudgetProgram3 } from "@solana/web3.js";
11044
+ import { PublicKey as PublicKey13, SystemProgram as SystemProgram5, ComputeBudgetProgram as ComputeBudgetProgram3 } from "@solana/web3.js";
10910
11045
  import {
10911
11046
  TOKEN_PROGRAM_ID as TOKEN_PROGRAM_ID5,
10912
11047
  ASSOCIATED_TOKEN_PROGRAM_ID as ASSOCIATED_TOKEN_PROGRAM_ID5,
@@ -10944,23 +11079,23 @@ var AnchorMarketV3Module = class {
10944
11079
  console.log(" End Time:", new Date(Number(endTime) * 1e3).toISOString());
10945
11080
  console.log(" Collateral Token Mint:", collateralTokenMint.toString());
10946
11081
  console.log(" Creator (for fees/ownership):", creatorOverride.toBase58());
10947
- const [globalConfig] = PublicKey12.findProgramAddressSync(
11082
+ const [globalConfig] = PublicKey13.findProgramAddressSync(
10948
11083
  [Buffer.from("global_config")],
10949
11084
  this.anchorClient.program.programId
10950
11085
  );
10951
11086
  const globalConfigAccount = await this.anchorClient.program.account.globalConfig.fetch(globalConfig);
10952
11087
  const currentGlobalId = globalConfigAccount.globalId;
10953
11088
  console.log("Current Global ID:", currentGlobalId.toString());
10954
- const [market] = PublicKey12.findProgramAddressSync(
11089
+ const [market] = PublicKey13.findProgramAddressSync(
10955
11090
  [Buffer.from("market-v3"), currentGlobalId.toArrayLike(Buffer, "le", 8)],
10956
11091
  this.anchorClient.program.programId
10957
11092
  );
10958
11093
  console.log("Market PDA:", market.toBase58());
10959
- const [yesTokenMint] = PublicKey12.findProgramAddressSync(
11094
+ const [yesTokenMint] = PublicKey13.findProgramAddressSync(
10960
11095
  [Buffer.from("v3-yes-token"), currentGlobalId.toArrayLike(Buffer, "le", 8)],
10961
11096
  this.anchorClient.program.programId
10962
11097
  );
10963
- const [noTokenMint] = PublicKey12.findProgramAddressSync(
11098
+ const [noTokenMint] = PublicKey13.findProgramAddressSync(
10964
11099
  [Buffer.from("v3-no-token"), currentGlobalId.toArrayLike(Buffer, "le", 8)],
10965
11100
  this.anchorClient.program.programId
10966
11101
  );
@@ -10982,7 +11117,7 @@ var AnchorMarketV3Module = class {
10982
11117
  noTokenMint,
10983
11118
  creatorOverride
10984
11119
  );
10985
- const [creatorFeeTreasury] = PublicKey12.findProgramAddressSync(
11120
+ const [creatorFeeTreasury] = PublicKey13.findProgramAddressSync(
10986
11121
  [Buffer.from("creator_fee_treasury"), creatorOverride.toBuffer(), collateralTokenMint.toBuffer()],
10987
11122
  this.anchorClient.program.programId
10988
11123
  );
@@ -11037,7 +11172,7 @@ var AnchorMarketV3Module = class {
11037
11172
  // src/sdk.ts
11038
11173
  import {
11039
11174
  ASSOCIATED_TOKEN_PROGRAM_ID as ASSOCIATED_TOKEN_PROGRAM_ID6,
11040
- TOKEN_2022_PROGRAM_ID as TOKEN_2022_PROGRAM_ID2,
11175
+ TOKEN_2022_PROGRAM_ID as TOKEN_2022_PROGRAM_ID3,
11041
11176
  TOKEN_PROGRAM_ID as TOKEN_PROGRAM_ID6,
11042
11177
  getAssociatedTokenAddressSync as getAssociatedTokenAddressSync3
11043
11178
  } from "@solana/spl-token";
@@ -11095,13 +11230,20 @@ var PNPClient = class _PNPClient {
11095
11230
  secretKey = privateKey.secretKey;
11096
11231
  }
11097
11232
  if (!secretKey) throw new Error("Unsupported privateKey format");
11098
- const keypair = Keypair2.fromSecretKey(secretKey);
11233
+ const keypair = Keypair3.fromSecretKey(secretKey);
11099
11234
  this.signer = new NodeKeypairSigner(keypair);
11100
11235
  this.market = new MarketModule(this.client, this.signer);
11101
11236
  this.trading = new TradingModule(this.client, this.signer);
11102
11237
  this.redemption = new RedemptionModule(this.client, this.signer);
11103
11238
  try {
11104
- this.anchorClient = new AnchorClient(this.client.connection, keypair);
11239
+ this.anchorClient = new AnchorClient(
11240
+ this.client.connection,
11241
+ keypair,
11242
+ void 0,
11243
+ // idlOverride
11244
+ this.client.programId
11245
+ // Use the network-detected program ID
11246
+ );
11105
11247
  this.anchorMarket = new AnchorMarketModule(this.anchorClient);
11106
11248
  this.anchorMarketV3 = new AnchorMarketV3Module(this.anchorClient);
11107
11249
  } catch (err) {
@@ -11151,7 +11293,7 @@ var PNPClient = class _PNPClient {
11151
11293
  if (!["yes", "no"].includes(side)) {
11152
11294
  throw new Error("side must be 'yes' or 'no'");
11153
11295
  }
11154
- const defaultUsdcMint = new PublicKey13(
11296
+ const defaultUsdcMint = new PublicKey14(
11155
11297
  "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
11156
11298
  );
11157
11299
  const collateralMintPk = collateralTokenMint ?? defaultUsdcMint;
@@ -11233,7 +11375,7 @@ var PNPClient = class _PNPClient {
11233
11375
  if (!["yes", "no"].includes(side)) {
11234
11376
  throw new Error("side must be 'yes' or 'no'");
11235
11377
  }
11236
- const defaultUsdcMint = new PublicKey13(
11378
+ const defaultUsdcMint = new PublicKey14(
11237
11379
  "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
11238
11380
  );
11239
11381
  const collateralMintPk = collateralTokenMint ?? defaultUsdcMint;
@@ -11419,7 +11561,7 @@ var PNPClient = class _PNPClient {
11419
11561
  if (!["yes", "no"].includes(side)) {
11420
11562
  throw new Error("side must be 'yes' or 'no'");
11421
11563
  }
11422
- const defaultUsdcMint = new PublicKey13(
11564
+ const defaultUsdcMint = new PublicKey14(
11423
11565
  "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
11424
11566
  );
11425
11567
  const collateralMintPk = collateralTokenMint ?? defaultUsdcMint;
@@ -11467,7 +11609,7 @@ var PNPClient = class _PNPClient {
11467
11609
  if (!["yes", "no"].includes(side)) {
11468
11610
  throw new Error("side must be 'yes' or 'no'");
11469
11611
  }
11470
- const defaultUsdcMint = new PublicKey13(
11612
+ const defaultUsdcMint = new PublicKey14(
11471
11613
  "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
11472
11614
  );
11473
11615
  const collateralMintPk = collateralTokenMint ?? defaultUsdcMint;
@@ -11651,10 +11793,10 @@ var PNPClient = class _PNPClient {
11651
11793
  try {
11652
11794
  const program = this.anchorClient?.program;
11653
11795
  const marketAccount = await program.account.marketV3.fetch(market);
11654
- const yesTokenMint = new PublicKey13(marketAccount.yesTokenMint);
11655
- const noTokenMint = new PublicKey13(marketAccount.noTokenMint);
11656
- const collateralTokenMint = new PublicKey13(marketAccount.collateralToken);
11657
- const globalConfig = PublicKey13.findProgramAddressSync(
11796
+ const yesTokenMint = new PublicKey14(marketAccount.yesTokenMint);
11797
+ const noTokenMint = new PublicKey14(marketAccount.noTokenMint);
11798
+ const collateralTokenMint = new PublicKey14(marketAccount.collateralToken);
11799
+ const globalConfig = PublicKey14.findProgramAddressSync(
11658
11800
  [Buffer.from("global_config")],
11659
11801
  this.anchorClient.program.programId
11660
11802
  )[0];
@@ -11733,12 +11875,12 @@ Cause: ${err.message}`);
11733
11875
  const marketData = await this.fetchMarket(market);
11734
11876
  const { account: marketAccount } = marketData;
11735
11877
  const { publicKey: globalConfigPDA } = await this.fetchGlobalConfig();
11736
- const yesTokenMint = new PublicKey13(marketAccount.yes_token_mint);
11737
- const noTokenMint = new PublicKey13(marketAccount.no_token_mint);
11738
- const collateralTokenMint = new PublicKey13(marketAccount.collateral_token);
11739
- const marketCreator = new PublicKey13(marketAccount.creator);
11878
+ const yesTokenMint = new PublicKey14(marketAccount.yes_token_mint);
11879
+ const noTokenMint = new PublicKey14(marketAccount.no_token_mint);
11880
+ const collateralTokenMint = new PublicKey14(marketAccount.collateral_token);
11881
+ const marketCreator = new PublicKey14(marketAccount.creator);
11740
11882
  const { account: globalConfigAccount } = await this.fetchGlobalConfig();
11741
- const admin = options?.admin || new PublicKey13(globalConfigAccount.admin);
11883
+ const admin = options?.admin || new PublicKey14(globalConfigAccount.admin);
11742
11884
  const [yesAi, noAi, colAi] = await Promise.all([
11743
11885
  this.client.connection.getAccountInfo(yesTokenMint),
11744
11886
  this.client.connection.getAccountInfo(noTokenMint),
@@ -11747,9 +11889,9 @@ Cause: ${err.message}`);
11747
11889
  if (!yesAi || !noAi || !colAi) {
11748
11890
  throw new Error("One or more token mints are invalid");
11749
11891
  }
11750
- const yesTokenProgram = yesAi.owner.equals(TOKEN_2022_PROGRAM_ID2) ? TOKEN_2022_PROGRAM_ID2 : TOKEN_PROGRAM_ID6;
11751
- const noTokenProgram = noAi.owner.equals(TOKEN_2022_PROGRAM_ID2) ? TOKEN_2022_PROGRAM_ID2 : TOKEN_PROGRAM_ID6;
11752
- const collateralTokenProgram = colAi.owner.equals(TOKEN_2022_PROGRAM_ID2) ? TOKEN_2022_PROGRAM_ID2 : TOKEN_PROGRAM_ID6;
11892
+ const yesTokenProgram = yesAi.owner.equals(TOKEN_2022_PROGRAM_ID3) ? TOKEN_2022_PROGRAM_ID3 : TOKEN_PROGRAM_ID6;
11893
+ const noTokenProgram = noAi.owner.equals(TOKEN_2022_PROGRAM_ID3) ? TOKEN_2022_PROGRAM_ID3 : TOKEN_PROGRAM_ID6;
11894
+ const collateralTokenProgram = colAi.owner.equals(TOKEN_2022_PROGRAM_ID3) ? TOKEN_2022_PROGRAM_ID3 : TOKEN_PROGRAM_ID6;
11753
11895
  const buyer = this.signer.publicKey;
11754
11896
  const buyerYesTokenAccount = getAssociatedTokenAddressSync3(
11755
11897
  yesTokenMint,
@@ -11775,7 +11917,7 @@ Cause: ${err.message}`);
11775
11917
  true,
11776
11918
  collateralTokenProgram
11777
11919
  );
11778
- const creatorFeeTreasury = options?.creatorFeeTreasury ? new PublicKey13(options.creatorFeeTreasury) : getAssociatedTokenAddressSync3(
11920
+ const creatorFeeTreasury = options?.creatorFeeTreasury ? new PublicKey14(options.creatorFeeTreasury) : getAssociatedTokenAddressSync3(
11779
11921
  collateralTokenMint,
11780
11922
  marketCreator,
11781
11923
  false,
@@ -11826,16 +11968,16 @@ Cause: ${err.message}`);
11826
11968
  throw new Error("Anchor client is not initialized. Cannot perform redemption.");
11827
11969
  }
11828
11970
  const marketAccount = await this.anchorClient.program.account.marketV3.fetch(market);
11829
- const [globalConfigPDA] = PublicKey13.findProgramAddressSync(
11971
+ const [globalConfigPDA] = PublicKey14.findProgramAddressSync(
11830
11972
  [Buffer.from("global_config")],
11831
11973
  this.client.programId
11832
11974
  );
11833
11975
  const globalConfigAccount = await this.anchorClient.program.account.globalConfig.fetch(globalConfigPDA);
11834
- const admin = new PublicKey13(globalConfigAccount.admin);
11835
- const creator = new PublicKey13(marketAccount.creator);
11836
- const yesTokenMint = new PublicKey13(marketAccount.yesTokenMint);
11837
- const noTokenMint = new PublicKey13(marketAccount.noTokenMint);
11838
- const collateralTokenMint = new PublicKey13(marketAccount.collateralToken);
11976
+ const admin = new PublicKey14(globalConfigAccount.admin);
11977
+ const creator = new PublicKey14(marketAccount.creator);
11978
+ const yesTokenMint = new PublicKey14(marketAccount.yesTokenMint);
11979
+ const noTokenMint = new PublicKey14(marketAccount.noTokenMint);
11980
+ const collateralTokenMint = new PublicKey14(marketAccount.collateralToken);
11839
11981
  const redeemer = this.signer.publicKey;
11840
11982
  const redeemerYesTokenAccount = getAssociatedTokenAddressSync3(
11841
11983
  yesTokenMint,
@@ -11867,7 +12009,7 @@ Cause: ${err.message}`);
11867
12009
  false,
11868
12010
  TOKEN_PROGRAM_ID6
11869
12011
  );
11870
- const [creatorFeeTreasury] = PublicKey13.findProgramAddressSync(
12012
+ const [creatorFeeTreasury] = PublicKey14.findProgramAddressSync(
11871
12013
  [Buffer.from("creator_fee_treasury"), creator.toBuffer(), collateralTokenMint.toBuffer()],
11872
12014
  this.client.programId
11873
12015
  );
@@ -11901,12 +12043,12 @@ Cause: ${err.message}`);
11901
12043
  * Thin wrapper around redeemV3Position that accepts either a string or PublicKey.
11902
12044
  */
11903
12045
  async redeemP2PPosition(market) {
11904
- const marketPk = typeof market === "string" ? new PublicKey13(market) : market;
12046
+ const marketPk = typeof market === "string" ? new PublicKey14(market) : market;
11905
12047
  return this.redeemV3Position(marketPk);
11906
12048
  }
11907
12049
  // ===== Read-only helpers (no signer required) =====
11908
12050
  async fetchGlobalConfig() {
11909
- const [pk] = PublicKey13.findProgramAddressSync(
12051
+ const [pk] = PublicKey14.findProgramAddressSync(
11910
12052
  [Buffer.from("global_config")],
11911
12053
  this.client.programId
11912
12054
  );
@@ -11918,6 +12060,44 @@ Cause: ${err.message}`);
11918
12060
  const acc = decodeAccount("GlobalConfig", ai.data);
11919
12061
  return { publicKey: pk, account: acc };
11920
12062
  }
12063
+ /**
12064
+ * Set market resolvable status (V2 markets)
12065
+ * @param market - Market public key or address string
12066
+ * @param resolvable - New resolvable status
12067
+ * @param forceResolve - Optional: force resolve (allow immediate refunds)
12068
+ * @returns Transaction signature
12069
+ */
12070
+ async setMarketResolvable(market, resolvable, forceResolve) {
12071
+ if (!this.market) {
12072
+ throw new Error(
12073
+ "MarketModule not available. Initialize client with a signer."
12074
+ );
12075
+ }
12076
+ const marketPk = typeof market === "string" ? new PublicKey14(market) : market;
12077
+ return this.market.setMarketResolvable({
12078
+ market: marketPk,
12079
+ resolvable,
12080
+ forceResolve
12081
+ });
12082
+ }
12083
+ /**
12084
+ * Set market resolvable status (V3/P2P markets)
12085
+ * @param market - Market public key or address string
12086
+ * @param resolvable - New resolvable status
12087
+ * @returns Transaction signature
12088
+ */
12089
+ async setMarketResolvableP2p(market, resolvable) {
12090
+ if (!this.market) {
12091
+ throw new Error(
12092
+ "MarketModule not available. Initialize client with a signer."
12093
+ );
12094
+ }
12095
+ const marketPk = typeof market === "string" ? new PublicKey14(market) : market;
12096
+ return this.market.setMarketResolvableP2p({
12097
+ market: marketPk,
12098
+ resolvable
12099
+ });
12100
+ }
11921
12101
  async fetchMarket(market) {
11922
12102
  const ai = await this.client.connection.getAccountInfo(
11923
12103
  market,
@@ -12124,7 +12304,7 @@ Cause: ${err.message}`);
12124
12304
  * @returns Combined market info with both on-chain data and settlement criteria
12125
12305
  */
12126
12306
  async getP2PMarketInfo(marketAddress, options) {
12127
- const marketKey = typeof marketAddress === "string" ? new PublicKey13(marketAddress) : marketAddress;
12307
+ const marketKey = typeof marketAddress === "string" ? new PublicKey14(marketAddress) : marketAddress;
12128
12308
  let marketAccount;
12129
12309
  if (this.anchorClient) {
12130
12310
  try {
@@ -12198,7 +12378,7 @@ Cause: ${err.message}`);
12198
12378
  * @returns Combined market info with both on-chain data and settlement criteria
12199
12379
  */
12200
12380
  async getV2MarketInfo(marketAddress, options) {
12201
- const marketKey = typeof marketAddress === "string" ? new PublicKey13(marketAddress) : marketAddress;
12381
+ const marketKey = typeof marketAddress === "string" ? new PublicKey14(marketAddress) : marketAddress;
12202
12382
  const { account: marketAccount } = await this.fetchMarket(marketKey);
12203
12383
  const settlementCriteria = await this.fetchSettlementCriteria(marketKey.toString(), options?.baseUrl).catch(() => null);
12204
12384
  let yesMultiplier = 1;
@@ -12301,8 +12481,8 @@ Cause: ${err.message}`);
12301
12481
  if (!yesAi || !noAi || !colAi)
12302
12482
  throw new Error("One or more market mint accounts are missing");
12303
12483
  const hasUniformTokenProgram = yesAi.owner.equals(noAi.owner) && yesAi.owner.equals(colAi.owner);
12304
- const collateralTokenProgram = colAi.owner.equals(TOKEN_2022_PROGRAM_ID2) ? TOKEN_2022_PROGRAM_ID2 : TOKEN_PROGRAM_ID6;
12305
- const [globalConfig] = PublicKey13.findProgramAddressSync(
12484
+ const collateralTokenProgram = colAi.owner.equals(TOKEN_2022_PROGRAM_ID3) ? TOKEN_2022_PROGRAM_ID3 : TOKEN_PROGRAM_ID6;
12485
+ const [globalConfig] = PublicKey14.findProgramAddressSync(
12306
12486
  [Buffer.from("global_config")],
12307
12487
  this.client.programId
12308
12488
  );
@@ -12394,10 +12574,10 @@ Cause: ${err.message}`);
12394
12574
  "Signer not available. Initialize PNPClient with a valid private key."
12395
12575
  );
12396
12576
  }
12397
- const market = typeof marketAddress === "string" ? new PublicKey13(marketAddress) : marketAddress;
12577
+ const market = typeof marketAddress === "string" ? new PublicKey14(marketAddress) : marketAddress;
12398
12578
  const marketInfo = await this.getP2PMarketInfo(market);
12399
- const collateralTokenMint = new PublicKey13(marketInfo.collateralMint);
12400
- const [globalConfig] = PublicKey13.findProgramAddressSync(
12579
+ const collateralTokenMint = new PublicKey14(marketInfo.collateralMint);
12580
+ const [globalConfig] = PublicKey14.findProgramAddressSync(
12401
12581
  [Buffer.from("global_config")],
12402
12582
  this.anchorClient.program.programId
12403
12583
  );
@@ -12409,7 +12589,7 @@ Cause: ${err.message}`);
12409
12589
  "MarketV3",
12410
12590
  accountInfo.data
12411
12591
  );
12412
- const creator = marketData.creator instanceof PublicKey13 ? marketData.creator : new PublicKey13(marketData.creator);
12592
+ const creator = marketData.creator instanceof PublicKey14 ? marketData.creator : new PublicKey14(marketData.creator);
12413
12593
  if (!this.signer.publicKey.equals(creator)) {
12414
12594
  throw new Error("Signer is not the creator of this P2P market");
12415
12595
  }
@@ -12419,7 +12599,7 @@ Cause: ${err.message}`);
12419
12599
  if (!mintInfo) {
12420
12600
  throw new Error("Collateral mint account not found");
12421
12601
  }
12422
- const tokenProgramId = mintInfo.owner.equals(TOKEN_2022_PROGRAM_ID2) ? TOKEN_2022_PROGRAM_ID2 : TOKEN_PROGRAM_ID6;
12602
+ const tokenProgramId = mintInfo.owner.equals(TOKEN_2022_PROGRAM_ID3) ? TOKEN_2022_PROGRAM_ID3 : TOKEN_PROGRAM_ID6;
12423
12603
  const marketReserveVault = getAssociatedTokenAddressSync3(
12424
12604
  collateralTokenMint,
12425
12605
  market,
@@ -12459,4 +12639,4 @@ export {
12459
12639
  RedemptionModule,
12460
12640
  PNPClient
12461
12641
  };
12462
- //# sourceMappingURL=chunk-RJ2IJGCX.js.map
12642
+ //# sourceMappingURL=chunk-HZV67E3Z.js.map