@whetstone-research/doppler-sdk 1.0.37 → 1.0.38

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.
@@ -2213,15 +2213,20 @@ var dopplerLaunchHookV2_exports = {};
2213
2213
  chunkQ7SFCCGT_cjs.__export(dopplerLaunchHookV2_exports, {
2214
2214
  ADD_COSIGNER_DISCRIMINATOR: () => ADD_COSIGNER_DISCRIMINATOR2,
2215
2215
  DEVNET_DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID: () => DEVNET_DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID,
2216
+ DISABLE_COSIGN_GATES_DISCRIMINATOR: () => DISABLE_COSIGN_GATES_DISCRIMINATOR,
2216
2217
  DOPPLER_LAUNCH_HOOK_V2_CONFIG_SEED: () => DOPPLER_LAUNCH_HOOK_V2_CONFIG_SEED,
2218
+ DOPPLER_LAUNCH_HOOK_V2_COSIGN_GATE_CONTROL_SEED: () => DOPPLER_LAUNCH_HOOK_V2_COSIGN_GATE_CONTROL_SEED,
2217
2219
  DOPPLER_LAUNCH_HOOK_V2_ERROR__ARITHMETIC_OVERFLOW: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__ARITHMETIC_OVERFLOW,
2218
2220
  DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_ALREADY_EXISTS: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_ALREADY_EXISTS,
2219
2221
  DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_LIST_FULL: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_LIST_FULL,
2220
2222
  DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_NOT_FOUND: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_NOT_FOUND,
2221
2223
  DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_REQUIRED: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_REQUIRED,
2224
+ DOPPLER_LAUNCH_HOOK_V2_ERROR__DUPLICATE_LAUNCH: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__DUPLICATE_LAUNCH,
2222
2225
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_AUTHORITY: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_AUTHORITY,
2223
2226
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_CONFIG: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_CONFIG,
2224
2227
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGNER: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGNER,
2228
+ DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_CONTROL: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_CONTROL,
2229
+ DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_DISABLE_BATCH: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_DISABLE_BATCH,
2225
2230
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE,
2226
2231
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE_SCHEDULE: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE_SCHEDULE,
2227
2232
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_INSTRUCTION_DATA: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_INSTRUCTION_DATA,
@@ -2229,16 +2234,19 @@ chunkQ7SFCCGT_cjs.__export(dopplerLaunchHookV2_exports, {
2229
2234
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_PAYLOAD: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_PAYLOAD,
2230
2235
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_REHYPE_STATE: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_REHYPE_STATE,
2231
2236
  DOPPLER_LAUNCH_HOOK_V2_ERROR__MISSING_ACCOUNT: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__MISSING_ACCOUNT,
2237
+ DOPPLER_LAUNCH_HOOK_V2_ERROR__SELECTIVE_COSIGN_GATE_DISABLE_UNSUPPORTED: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__SELECTIVE_COSIGN_GATE_DISABLE_UNSUPPORTED,
2232
2238
  DOPPLER_LAUNCH_HOOK_V2_ERROR__SETTLEMENT_INCOMPLETE: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__SETTLEMENT_INCOMPLETE,
2233
2239
  DOPPLER_LAUNCH_HOOK_V2_ERROR__UNEXPECTED_ACCOUNT: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__UNEXPECTED_ACCOUNT,
2234
2240
  DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE: () => DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE,
2235
2241
  DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE: () => DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE,
2236
2242
  DOPPLER_LAUNCH_HOOK_V2_FEATURE_FEE_REHYPOTHECATION: () => DOPPLER_LAUNCH_HOOK_V2_FEATURE_FEE_REHYPOTHECATION,
2243
+ DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE: () => DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE,
2237
2244
  DOPPLER_LAUNCH_HOOK_V2_FEATURE_MASK: () => DOPPLER_LAUNCH_HOOK_V2_FEATURE_MASK,
2238
2245
  DOPPLER_LAUNCH_HOOK_V2_GATE_DISABLED: () => DOPPLER_LAUNCH_HOOK_V2_GATE_DISABLED,
2239
2246
  DOPPLER_LAUNCH_HOOK_V2_GATE_SLOT: () => DOPPLER_LAUNCH_HOOK_V2_GATE_SLOT,
2240
2247
  DOPPLER_LAUNCH_HOOK_V2_GATE_UNIX_TIMESTAMP: () => DOPPLER_LAUNCH_HOOK_V2_GATE_UNIX_TIMESTAMP,
2241
2248
  DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGNERS: () => DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGNERS,
2249
+ DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES: () => DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES,
2242
2250
  DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_LEN: () => DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_LEN,
2243
2251
  DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_MAGIC: () => DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_MAGIC,
2244
2252
  DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_VERSION: () => DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_VERSION,
@@ -2264,10 +2272,20 @@ chunkQ7SFCCGT_cjs.__export(dopplerLaunchHookV2_exports, {
2264
2272
  getAddCosignerInstructionDataCodec: () => getAddCosignerInstructionDataCodec2,
2265
2273
  getAddCosignerInstructionDataDecoder: () => getAddCosignerInstructionDataDecoder2,
2266
2274
  getAddCosignerInstructionDataEncoder: () => getAddCosignerInstructionDataEncoder2,
2275
+ getCosignGateDisabledCodec: () => getCosignGateDisabledCodec,
2276
+ getCosignGateDisabledDecoder: () => getCosignGateDisabledDecoder,
2277
+ getCosignGateDisabledEncoder: () => getCosignGateDisabledEncoder,
2267
2278
  getCosignerArgCodec: () => getCosignerArgCodec2,
2268
2279
  getCosignerArgDecoder: () => getCosignerArgDecoder2,
2269
2280
  getCosignerArgEncoder: () => getCosignerArgEncoder2,
2281
+ getDisableCosignGatesDiscriminatorBytes: () => getDisableCosignGatesDiscriminatorBytes,
2282
+ getDisableCosignGatesInstruction: () => getDisableCosignGatesInstruction,
2283
+ getDisableCosignGatesInstructionAsync: () => getDisableCosignGatesInstructionAsync,
2284
+ getDisableCosignGatesInstructionDataCodec: () => getDisableCosignGatesInstructionDataCodec,
2285
+ getDisableCosignGatesInstructionDataDecoder: () => getDisableCosignGatesInstructionDataDecoder,
2286
+ getDisableCosignGatesInstructionDataEncoder: () => getDisableCosignGatesInstructionDataEncoder,
2270
2287
  getDopplerLaunchHookV2ConfigAddress: () => getDopplerLaunchHookV2ConfigAddress,
2288
+ getDopplerLaunchHookV2CosignGateControlAddress: () => getDopplerLaunchHookV2CosignGateControlAddress,
2271
2289
  getDopplerLaunchHookV2ErrorMessage: () => getDopplerLaunchHookV2ErrorMessage,
2272
2290
  getDopplerLaunchHookV2RemainingAccounts: () => getDopplerLaunchHookV2RemainingAccounts,
2273
2291
  getHookConfigCodec: () => getHookConfigCodec,
@@ -2304,10 +2322,12 @@ chunkQ7SFCCGT_cjs.__export(dopplerLaunchHookV2_exports, {
2304
2322
  isDopplerLaunchHookV2Error: () => isDopplerLaunchHookV2Error,
2305
2323
  isResolvedManagedCosignerGateV2: () => isResolvedManagedCosignerGateV2,
2306
2324
  parseAddCosignerInstruction: () => parseAddCosignerInstruction2,
2325
+ parseDisableCosignGatesInstruction: () => parseDisableCosignGatesInstruction,
2307
2326
  parseDopplerLaunchHookV2Instruction: () => parseDopplerLaunchHookV2Instruction,
2308
2327
  parseInitializeConfigInstruction: () => parseInitializeConfigInstruction3,
2309
2328
  parseRemoveCosignerInstruction: () => parseRemoveCosignerInstruction2,
2310
2329
  parseSetAuthorityInstruction: () => parseSetAuthorityInstruction2,
2330
+ prepareDisableCosignGates: () => prepareDisableCosignGates,
2311
2331
  resolveManagedCosignerGate: () => resolveManagedCosignerGate2
2312
2332
  });
2313
2333
  var HOOK_CONFIG_DISCRIMINATOR = new Uint8Array([
@@ -2513,6 +2533,156 @@ function parseAddCosignerInstruction2(instruction) {
2513
2533
  data: getAddCosignerInstructionDataDecoder2().decode(instruction.data)
2514
2534
  };
2515
2535
  }
2536
+ var DISABLE_COSIGN_GATES_DISCRIMINATOR = new Uint8Array([
2537
+ 104,
2538
+ 91,
2539
+ 161,
2540
+ 218,
2541
+ 150,
2542
+ 123,
2543
+ 48,
2544
+ 243
2545
+ ]);
2546
+ function getDisableCosignGatesDiscriminatorBytes() {
2547
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
2548
+ DISABLE_COSIGN_GATES_DISCRIMINATOR
2549
+ );
2550
+ }
2551
+ function getDisableCosignGatesInstructionDataEncoder() {
2552
+ return kit.transformEncoder(
2553
+ kit.getStructEncoder([
2554
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
2555
+ ["launches", kit.getArrayEncoder(kit.getAddressEncoder())]
2556
+ ]),
2557
+ (value) => ({
2558
+ ...value,
2559
+ discriminator: DISABLE_COSIGN_GATES_DISCRIMINATOR
2560
+ })
2561
+ );
2562
+ }
2563
+ function getDisableCosignGatesInstructionDataDecoder() {
2564
+ return kit.getStructDecoder([
2565
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
2566
+ ["launches", kit.getArrayDecoder(kit.getAddressDecoder())]
2567
+ ]);
2568
+ }
2569
+ function getDisableCosignGatesInstructionDataCodec() {
2570
+ return kit.combineCodec(
2571
+ getDisableCosignGatesInstructionDataEncoder(),
2572
+ getDisableCosignGatesInstructionDataDecoder()
2573
+ );
2574
+ }
2575
+ async function getDisableCosignGatesInstructionAsync(input, config) {
2576
+ const programAddress = config?.programAddress ?? DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ADDRESS;
2577
+ const originalAccounts = {
2578
+ adminAuthority: { value: input.adminAuthority ?? null, isWritable: true },
2579
+ config: { value: input.config ?? null, isWritable: false },
2580
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false }
2581
+ };
2582
+ const accounts = originalAccounts;
2583
+ const args = { ...input };
2584
+ if (!accounts.config.value) {
2585
+ accounts.config.value = await kit.getProgramDerivedAddress({
2586
+ programAddress,
2587
+ seeds: [
2588
+ kit.getBytesEncoder().encode(
2589
+ new Uint8Array([
2590
+ 100,
2591
+ 111,
2592
+ 112,
2593
+ 112,
2594
+ 108,
2595
+ 101,
2596
+ 114,
2597
+ 95,
2598
+ 108,
2599
+ 97,
2600
+ 117,
2601
+ 110,
2602
+ 99,
2603
+ 104,
2604
+ 95,
2605
+ 104,
2606
+ 111,
2607
+ 111,
2608
+ 107,
2609
+ 95,
2610
+ 118,
2611
+ 50
2612
+ ])
2613
+ )
2614
+ ]
2615
+ });
2616
+ }
2617
+ if (!accounts.systemProgram.value) {
2618
+ accounts.systemProgram.value = "11111111111111111111111111111111";
2619
+ }
2620
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2621
+ return Object.freeze({
2622
+ accounts: [
2623
+ getAccountMeta("adminAuthority", accounts.adminAuthority),
2624
+ getAccountMeta("config", accounts.config),
2625
+ getAccountMeta("systemProgram", accounts.systemProgram)
2626
+ ],
2627
+ data: getDisableCosignGatesInstructionDataEncoder().encode(
2628
+ args
2629
+ ),
2630
+ programAddress
2631
+ });
2632
+ }
2633
+ function getDisableCosignGatesInstruction(input, config) {
2634
+ const programAddress = config?.programAddress ?? DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ADDRESS;
2635
+ const originalAccounts = {
2636
+ adminAuthority: { value: input.adminAuthority ?? null, isWritable: true },
2637
+ config: { value: input.config ?? null, isWritable: false },
2638
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false }
2639
+ };
2640
+ const accounts = originalAccounts;
2641
+ const args = { ...input };
2642
+ if (!accounts.systemProgram.value) {
2643
+ accounts.systemProgram.value = "11111111111111111111111111111111";
2644
+ }
2645
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2646
+ return Object.freeze({
2647
+ accounts: [
2648
+ getAccountMeta("adminAuthority", accounts.adminAuthority),
2649
+ getAccountMeta("config", accounts.config),
2650
+ getAccountMeta("systemProgram", accounts.systemProgram)
2651
+ ],
2652
+ data: getDisableCosignGatesInstructionDataEncoder().encode(
2653
+ args
2654
+ ),
2655
+ programAddress
2656
+ });
2657
+ }
2658
+ function parseDisableCosignGatesInstruction(instruction) {
2659
+ if (instruction.accounts.length < 3) {
2660
+ throw new kit.SolanaError(
2661
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2662
+ {
2663
+ actualAccountMetas: instruction.accounts.length,
2664
+ expectedAccountMetas: 3
2665
+ }
2666
+ );
2667
+ }
2668
+ let accountIndex = 0;
2669
+ const getNextAccount = () => {
2670
+ const accountMeta2 = instruction.accounts[accountIndex];
2671
+ accountIndex += 1;
2672
+ return accountMeta2;
2673
+ };
2674
+ return {
2675
+ programAddress: instruction.programAddress,
2676
+ accounts: {
2677
+ adminAuthority: getNextAccount(),
2678
+ config: getNextAccount(),
2679
+ systemProgram: getNextAccount()
2680
+ },
2681
+ data: getDisableCosignGatesInstructionDataDecoder().decode(
2682
+ instruction.data
2683
+ )
2684
+ };
2685
+ }
2516
2686
  var INITIALIZE_CONFIG_DISCRIMINATOR3 = new Uint8Array([
2517
2687
  208,
2518
2688
  127,
@@ -2977,9 +3147,10 @@ function identifyDopplerLaunchHookV2Account(account) {
2977
3147
  }
2978
3148
  var DopplerLaunchHookV2Instruction = /* @__PURE__ */ ((DopplerLaunchHookV2Instruction2) => {
2979
3149
  DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["AddCosigner"] = 0] = "AddCosigner";
2980
- DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["InitializeConfig"] = 1] = "InitializeConfig";
2981
- DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["RemoveCosigner"] = 2] = "RemoveCosigner";
2982
- DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["SetAuthority"] = 3] = "SetAuthority";
3150
+ DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["DisableCosignGates"] = 1] = "DisableCosignGates";
3151
+ DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["InitializeConfig"] = 2] = "InitializeConfig";
3152
+ DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["RemoveCosigner"] = 3] = "RemoveCosigner";
3153
+ DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["SetAuthority"] = 4] = "SetAuthority";
2983
3154
  return DopplerLaunchHookV2Instruction2;
2984
3155
  })(DopplerLaunchHookV2Instruction || {});
2985
3156
  function identifyDopplerLaunchHookV2Instruction(instruction) {
@@ -2993,6 +3164,15 @@ function identifyDopplerLaunchHookV2Instruction(instruction) {
2993
3164
  )) {
2994
3165
  return 0 /* AddCosigner */;
2995
3166
  }
3167
+ if (kit.containsBytes(
3168
+ data,
3169
+ kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
3170
+ new Uint8Array([104, 91, 161, 218, 150, 123, 48, 243])
3171
+ ),
3172
+ 0
3173
+ )) {
3174
+ return 1 /* DisableCosignGates */;
3175
+ }
2996
3176
  if (kit.containsBytes(
2997
3177
  data,
2998
3178
  kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
@@ -3000,7 +3180,7 @@ function identifyDopplerLaunchHookV2Instruction(instruction) {
3000
3180
  ),
3001
3181
  0
3002
3182
  )) {
3003
- return 1 /* InitializeConfig */;
3183
+ return 2 /* InitializeConfig */;
3004
3184
  }
3005
3185
  if (kit.containsBytes(
3006
3186
  data,
@@ -3009,7 +3189,7 @@ function identifyDopplerLaunchHookV2Instruction(instruction) {
3009
3189
  ),
3010
3190
  0
3011
3191
  )) {
3012
- return 2 /* RemoveCosigner */;
3192
+ return 3 /* RemoveCosigner */;
3013
3193
  }
3014
3194
  if (kit.containsBytes(
3015
3195
  data,
@@ -3018,7 +3198,7 @@ function identifyDopplerLaunchHookV2Instruction(instruction) {
3018
3198
  ),
3019
3199
  0
3020
3200
  )) {
3021
- return 3 /* SetAuthority */;
3201
+ return 4 /* SetAuthority */;
3022
3202
  }
3023
3203
  throw new kit.SolanaError(
3024
3204
  kit.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
@@ -3035,24 +3215,31 @@ function parseDopplerLaunchHookV2Instruction(instruction) {
3035
3215
  ...parseAddCosignerInstruction2(instruction)
3036
3216
  };
3037
3217
  }
3038
- case 1 /* InitializeConfig */: {
3218
+ case 1 /* DisableCosignGates */: {
3039
3219
  kit.assertIsInstructionWithAccounts(instruction);
3040
3220
  return {
3041
- instructionType: 1 /* InitializeConfig */,
3221
+ instructionType: 1 /* DisableCosignGates */,
3222
+ ...parseDisableCosignGatesInstruction(instruction)
3223
+ };
3224
+ }
3225
+ case 2 /* InitializeConfig */: {
3226
+ kit.assertIsInstructionWithAccounts(instruction);
3227
+ return {
3228
+ instructionType: 2 /* InitializeConfig */,
3042
3229
  ...parseInitializeConfigInstruction3(instruction)
3043
3230
  };
3044
3231
  }
3045
- case 2 /* RemoveCosigner */: {
3232
+ case 3 /* RemoveCosigner */: {
3046
3233
  kit.assertIsInstructionWithAccounts(instruction);
3047
3234
  return {
3048
- instructionType: 2 /* RemoveCosigner */,
3235
+ instructionType: 3 /* RemoveCosigner */,
3049
3236
  ...parseRemoveCosignerInstruction2(instruction)
3050
3237
  };
3051
3238
  }
3052
- case 3 /* SetAuthority */: {
3239
+ case 4 /* SetAuthority */: {
3053
3240
  kit.assertIsInstructionWithAccounts(instruction);
3054
3241
  return {
3055
- instructionType: 3 /* SetAuthority */,
3242
+ instructionType: 4 /* SetAuthority */,
3056
3243
  ...parseSetAuthorityInstruction2(instruction)
3057
3244
  };
3058
3245
  }
@@ -3079,6 +3266,10 @@ function dopplerLaunchHookV2Program() {
3079
3266
  client,
3080
3267
  getAddCosignerInstructionAsync2(input)
3081
3268
  ),
3269
+ disableCosignGates: (input) => programClientCore.addSelfPlanAndSendFunctions(
3270
+ client,
3271
+ getDisableCosignGatesInstructionAsync(input)
3272
+ ),
3082
3273
  initializeConfig: (input) => programClientCore.addSelfPlanAndSendFunctions(
3083
3274
  client,
3084
3275
  getInitializeConfigInstructionAsync3({
@@ -3118,6 +3309,10 @@ var DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_LAUNCH_CONTEXT = 6013;
3118
3309
  var DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_REHYPE_STATE = 6014;
3119
3310
  var DOPPLER_LAUNCH_HOOK_V2_ERROR__SETTLEMENT_INCOMPLETE = 6015;
3120
3311
  var DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_REQUIRED = 6016;
3312
+ var DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_DISABLE_BATCH = 6017;
3313
+ var DOPPLER_LAUNCH_HOOK_V2_ERROR__DUPLICATE_LAUNCH = 6018;
3314
+ var DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_CONTROL = 6019;
3315
+ var DOPPLER_LAUNCH_HOOK_V2_ERROR__SELECTIVE_COSIGN_GATE_DISABLE_UNSUPPORTED = 6020;
3121
3316
  var dopplerLaunchHookV2ErrorMessages;
3122
3317
  if (process.env.NODE_ENV !== "production") {
3123
3318
  dopplerLaunchHookV2ErrorMessages = {
@@ -3126,9 +3321,12 @@ if (process.env.NODE_ENV !== "production") {
3126
3321
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_LIST_FULL]: `Cosigner list is full`,
3127
3322
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_NOT_FOUND]: `Cosigner not found`,
3128
3323
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_REQUIRED]: `Cosigner approval is required`,
3324
+ [DOPPLER_LAUNCH_HOOK_V2_ERROR__DUPLICATE_LAUNCH]: `Cosign gate disable batch contains a duplicate launch`,
3129
3325
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_AUTHORITY]: `Invalid hook authority`,
3130
3326
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_CONFIG]: `Invalid hook config`,
3131
3327
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGNER]: `Invalid cosigner`,
3328
+ [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_CONTROL]: `Invalid cosign gate control account`,
3329
+ [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_DISABLE_BATCH]: `Cosign gate disable batch must contain between 1 and 8 launches`,
3132
3330
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE]: `Invalid swap fee`,
3133
3331
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE_SCHEDULE]: `Invalid dynamic fee schedule`,
3134
3332
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_INSTRUCTION_DATA]: `Invalid instruction data`,
@@ -3136,6 +3334,7 @@ if (process.env.NODE_ENV !== "production") {
3136
3334
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_PAYLOAD]: `Invalid hook payload`,
3137
3335
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_REHYPE_STATE]: `Invalid Rehype state`,
3138
3336
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__MISSING_ACCOUNT]: `Missing hook account`,
3337
+ [DOPPLER_LAUNCH_HOOK_V2_ERROR__SELECTIVE_COSIGN_GATE_DISABLE_UNSUPPORTED]: `Launch does not support selective cosign gate disablement`,
3139
3338
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__SETTLEMENT_INCOMPLETE]: `Rehype settlement is incomplete`,
3140
3339
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__UNEXPECTED_ACCOUNT]: `Unexpected hook account`
3141
3340
  };
@@ -3163,6 +3362,24 @@ function getCosignerArgDecoder2() {
3163
3362
  function getCosignerArgCodec2() {
3164
3363
  return kit.combineCodec(getCosignerArgEncoder2(), getCosignerArgDecoder2());
3165
3364
  }
3365
+ function getCosignGateDisabledEncoder() {
3366
+ return kit.getStructEncoder([
3367
+ ["launch", kit.getAddressEncoder()],
3368
+ ["control", kit.getAddressEncoder()]
3369
+ ]);
3370
+ }
3371
+ function getCosignGateDisabledDecoder() {
3372
+ return kit.getStructDecoder([
3373
+ ["launch", kit.getAddressDecoder()],
3374
+ ["control", kit.getAddressDecoder()]
3375
+ ]);
3376
+ }
3377
+ function getCosignGateDisabledCodec() {
3378
+ return kit.combineCodec(
3379
+ getCosignGateDisabledEncoder(),
3380
+ getCosignGateDisabledDecoder()
3381
+ );
3382
+ }
3166
3383
  function getInitializeConfigArgsEncoder2() {
3167
3384
  return kit.getStructEncoder([
3168
3385
  ["cosigners", kit.getArrayEncoder(kit.getAddressEncoder())]
@@ -6575,6 +6792,16 @@ async function getPredictionEntryByMintAddress(market, mint, programId = PREDICT
6575
6792
  ]
6576
6793
  });
6577
6794
  }
6795
+ async function getPredictionClaimReceiptAddress(market, claimer, programId = PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
6796
+ return kit.getProgramDerivedAddress({
6797
+ programAddress: programId,
6798
+ seeds: [
6799
+ textEncoder5.encode("receipt"),
6800
+ addressCodec4.encode(market),
6801
+ addressCodec4.encode(claimer)
6802
+ ]
6803
+ });
6804
+ }
6578
6805
 
6579
6806
  // src/solana/initializer/instructions/initializeLaunch.ts
6580
6807
  async function getTokenMetadataAddress(mint) {
@@ -8370,7 +8597,6 @@ function getInitializeRehypeArgsEncoder() {
8370
8597
  ["namespace", kit.getAddressEncoder()],
8371
8598
  ["launchId", kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
8372
8599
  ["buybackDestination", kit.getAddressEncoder()],
8373
- ["settlementAuthority", kit.getAddressEncoder()],
8374
8600
  ["routingMode", kit.getU8Encoder()],
8375
8601
  ["feeRouting", getFeeRoutingMatrixEncoder()],
8376
8602
  ["beneficiaries", kit.getArrayEncoder(getRehypeBeneficiaryInputEncoder())]
@@ -8381,7 +8607,6 @@ function getInitializeRehypeArgsDecoder() {
8381
8607
  ["namespace", kit.getAddressDecoder()],
8382
8608
  ["launchId", kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
8383
8609
  ["buybackDestination", kit.getAddressDecoder()],
8384
- ["settlementAuthority", kit.getAddressDecoder()],
8385
8610
  ["routingMode", kit.getU8Decoder()],
8386
8611
  ["feeRouting", getFeeRoutingMatrixDecoder()],
8387
8612
  ["beneficiaries", kit.getArrayDecoder(getRehypeBeneficiaryInputDecoder())]
@@ -9068,7 +9293,9 @@ function getRehypeStateEncoder() {
9068
9293
  ["settlementAuthority", kit.getAddressEncoder()],
9069
9294
  ["cumulativeRoutedBaseFees", kit.getU64Encoder()],
9070
9295
  ["cumulativeRoutedQuoteFees", kit.getU64Encoder()],
9071
- ["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 24)]
9296
+ ["settledInitializerBaseFees", kit.getU64Encoder()],
9297
+ ["settledInitializerQuoteFees", kit.getU64Encoder()],
9298
+ ["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 8)]
9072
9299
  ]),
9073
9300
  (value) => ({ ...value, discriminator: REHYPE_STATE_DISCRIMINATOR })
9074
9301
  );
@@ -9113,7 +9340,9 @@ function getRehypeStateDecoder() {
9113
9340
  ["settlementAuthority", kit.getAddressDecoder()],
9114
9341
  ["cumulativeRoutedBaseFees", kit.getU64Decoder()],
9115
9342
  ["cumulativeRoutedQuoteFees", kit.getU64Decoder()],
9116
- ["reserved", kit.fixDecoderSize(kit.getBytesDecoder(), 24)]
9343
+ ["settledInitializerBaseFees", kit.getU64Decoder()],
9344
+ ["settledInitializerQuoteFees", kit.getU64Decoder()],
9345
+ ["reserved", kit.fixDecoderSize(kit.getBytesDecoder(), 8)]
9117
9346
  ]);
9118
9347
  }
9119
9348
  function getRehypeStateCodec() {
@@ -9537,7 +9766,6 @@ function getInitializeRehypeInstructionDataEncoder() {
9537
9766
  ["namespace", kit.getAddressEncoder()],
9538
9767
  ["launchId", kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
9539
9768
  ["buybackDestination", kit.getAddressEncoder()],
9540
- ["settlementAuthority", kit.getAddressEncoder()],
9541
9769
  ["routingMode", kit.getU8Encoder()],
9542
9770
  ["feeRouting", getFeeRoutingMatrixEncoder()],
9543
9771
  ["beneficiaries", kit.getArrayEncoder(getRehypeBeneficiaryInputEncoder())]
@@ -9551,7 +9779,6 @@ function getInitializeRehypeInstructionDataDecoder() {
9551
9779
  ["namespace", kit.getAddressDecoder()],
9552
9780
  ["launchId", kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
9553
9781
  ["buybackDestination", kit.getAddressDecoder()],
9554
- ["settlementAuthority", kit.getAddressDecoder()],
9555
9782
  ["routingMode", kit.getU8Decoder()],
9556
9783
  ["feeRouting", getFeeRoutingMatrixDecoder()],
9557
9784
  ["beneficiaries", kit.getArrayDecoder(getRehypeBeneficiaryInputDecoder())]
@@ -9567,6 +9794,10 @@ async function getInitializeRehypeInstructionAsync(input, config) {
9567
9794
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
9568
9795
  const originalAccounts = {
9569
9796
  payer: { value: input.payer ?? null, isWritable: true },
9797
+ settlementAuthority: {
9798
+ value: input.settlementAuthority ?? null,
9799
+ isWritable: false
9800
+ },
9570
9801
  baseMint: { value: input.baseMint ?? null, isWritable: false },
9571
9802
  quoteMint: { value: input.quoteMint ?? null, isWritable: false },
9572
9803
  hookProgram: { value: input.hookProgram ?? null, isWritable: false },
@@ -9693,6 +9924,7 @@ async function getInitializeRehypeInstructionAsync(input, config) {
9693
9924
  return Object.freeze({
9694
9925
  accounts: [
9695
9926
  getAccountMeta("payer", accounts.payer),
9927
+ getAccountMeta("settlementAuthority", accounts.settlementAuthority),
9696
9928
  getAccountMeta("baseMint", accounts.baseMint),
9697
9929
  getAccountMeta("quoteMint", accounts.quoteMint),
9698
9930
  getAccountMeta("hookProgram", accounts.hookProgram),
@@ -9712,6 +9944,10 @@ function getInitializeRehypeInstruction(input, config) {
9712
9944
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
9713
9945
  const originalAccounts = {
9714
9946
  payer: { value: input.payer ?? null, isWritable: true },
9947
+ settlementAuthority: {
9948
+ value: input.settlementAuthority ?? null,
9949
+ isWritable: false
9950
+ },
9715
9951
  baseMint: { value: input.baseMint ?? null, isWritable: false },
9716
9952
  quoteMint: { value: input.quoteMint ?? null, isWritable: false },
9717
9953
  hookProgram: { value: input.hookProgram ?? null, isWritable: false },
@@ -9742,6 +9978,7 @@ function getInitializeRehypeInstruction(input, config) {
9742
9978
  return Object.freeze({
9743
9979
  accounts: [
9744
9980
  getAccountMeta("payer", accounts.payer),
9981
+ getAccountMeta("settlementAuthority", accounts.settlementAuthority),
9745
9982
  getAccountMeta("baseMint", accounts.baseMint),
9746
9983
  getAccountMeta("quoteMint", accounts.quoteMint),
9747
9984
  getAccountMeta("hookProgram", accounts.hookProgram),
@@ -9758,12 +9995,12 @@ function getInitializeRehypeInstruction(input, config) {
9758
9995
  });
9759
9996
  }
9760
9997
  function parseInitializeRehypeInstruction(instruction) {
9761
- if (instruction.accounts.length < 9) {
9998
+ if (instruction.accounts.length < 10) {
9762
9999
  throw new kit.SolanaError(
9763
10000
  kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
9764
10001
  {
9765
10002
  actualAccountMetas: instruction.accounts.length,
9766
- expectedAccountMetas: 9
10003
+ expectedAccountMetas: 10
9767
10004
  }
9768
10005
  );
9769
10006
  }
@@ -9777,6 +10014,7 @@ function parseInitializeRehypeInstruction(instruction) {
9777
10014
  programAddress: instruction.programAddress,
9778
10015
  accounts: {
9779
10016
  payer: getNextAccount(),
10017
+ settlementAuthority: getNextAccount(),
9780
10018
  baseMint: getNextAccount(),
9781
10019
  quoteMint: getNextAccount(),
9782
10020
  hookProgram: getNextAccount(),
@@ -11168,7 +11406,9 @@ function isDopplerRehypeRouterV1Error(error, transactionMessage, code) {
11168
11406
  var DEVNET_DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID = DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ADDRESS;
11169
11407
  var DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID = DEVNET_DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID;
11170
11408
  var DOPPLER_LAUNCH_HOOK_V2_CONFIG_SEED = "doppler_launch_hook_v2";
11409
+ var DOPPLER_LAUNCH_HOOK_V2_COSIGN_GATE_CONTROL_SEED = "cosign_gate_control";
11171
11410
  var DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGNERS = 32;
11411
+ var DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES = 8;
11172
11412
  var DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_MAGIC = new Uint8Array([
11173
11413
  68,
11174
11414
  76,
@@ -11184,7 +11424,8 @@ var DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_LEN = 112;
11184
11424
  var DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE = 1 << 0;
11185
11425
  var DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE = 1 << 1;
11186
11426
  var DOPPLER_LAUNCH_HOOK_V2_FEATURE_FEE_REHYPOTHECATION = 1 << 2;
11187
- var DOPPLER_LAUNCH_HOOK_V2_FEATURE_MASK = DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE | DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE | DOPPLER_LAUNCH_HOOK_V2_FEATURE_FEE_REHYPOTHECATION;
11427
+ var DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE = 1 << 3;
11428
+ var DOPPLER_LAUNCH_HOOK_V2_FEATURE_MASK = DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE | DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE | DOPPLER_LAUNCH_HOOK_V2_FEATURE_FEE_REHYPOTHECATION | DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE;
11188
11429
  var DOPPLER_LAUNCH_HOOK_V2_GATE_DISABLED = 0;
11189
11430
  var DOPPLER_LAUNCH_HOOK_V2_GATE_UNIX_TIMESTAMP = 1;
11190
11431
  var DOPPLER_LAUNCH_HOOK_V2_GATE_SLOT = 2;
@@ -11195,6 +11436,15 @@ async function getDopplerLaunchHookV2ConfigAddress(programId = DOPPLER_LAUNCH_HO
11195
11436
  seeds: [textEncoder7.encode(DOPPLER_LAUNCH_HOOK_V2_CONFIG_SEED)]
11196
11437
  });
11197
11438
  }
11439
+ async function getDopplerLaunchHookV2CosignGateControlAddress(launch, programId = DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID) {
11440
+ return kit.getProgramDerivedAddress({
11441
+ programAddress: programId,
11442
+ seeds: [
11443
+ textEncoder7.encode(DOPPLER_LAUNCH_HOOK_V2_COSIGN_GATE_CONTROL_SEED),
11444
+ kit.getAddressEncoder().encode(launch)
11445
+ ]
11446
+ });
11447
+ }
11198
11448
 
11199
11449
  // src/solana/dopplerLaunchHookV2/config.ts
11200
11450
  var resolvedManagedCosignerGateV2Brand = Symbol(
@@ -11265,6 +11515,48 @@ async function resolveManagedCosignerGate2(rpc, input = {}) {
11265
11515
  });
11266
11516
  return Object.freeze(resolvedGate);
11267
11517
  }
11518
+ async function prepareDisableCosignGates(input) {
11519
+ if (input.launches.length === 0 || input.launches.length > DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES) {
11520
+ throw new Error(
11521
+ `cosign gate disable batch must contain between 1 and ${DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES} launches`
11522
+ );
11523
+ }
11524
+ if (new Set(input.launches).size !== input.launches.length) {
11525
+ throw new Error("cosign gate disable batch contains a duplicate launch");
11526
+ }
11527
+ const programId = input.programId ?? DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID;
11528
+ const cosignGateControls = await Promise.all(
11529
+ input.launches.map(async (launch) => {
11530
+ const [control] = await getDopplerLaunchHookV2CosignGateControlAddress(
11531
+ launch,
11532
+ programId
11533
+ );
11534
+ return control;
11535
+ })
11536
+ );
11537
+ const generatedInstruction = await getDisableCosignGatesInstructionAsync(
11538
+ {
11539
+ adminAuthority: input.adminAuthority,
11540
+ config: input.config,
11541
+ launches: [...input.launches]
11542
+ },
11543
+ { programAddress: programId }
11544
+ );
11545
+ const remainingAccounts = input.launches.flatMap((launch, index) => [
11546
+ { address: launch, role: kit.AccountRole.READONLY },
11547
+ {
11548
+ address: cosignGateControls[index],
11549
+ role: kit.AccountRole.WRITABLE
11550
+ }
11551
+ ]);
11552
+ return {
11553
+ instruction: Object.freeze({
11554
+ ...generatedInstruction,
11555
+ accounts: [...generatedInstruction.accounts, ...remainingAccounts]
11556
+ }),
11557
+ cosignGateControls
11558
+ };
11559
+ }
11268
11560
  var MAX_U643 = (1n << 64n) - 1n;
11269
11561
  var ZERO_ADDRESS = "11111111111111111111111111111111";
11270
11562
  function toBigInt3(value) {
@@ -11314,7 +11606,7 @@ function encodeDopplerLaunchHookV2Payload(args = {}) {
11314
11606
  throw new Error("invalid Doppler launch hook v2 cosigner gate mode");
11315
11607
  }
11316
11608
  const gateValue = assertU64("cosigner gate value", args.cosignerGate.value);
11317
- featureFlags |= DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE;
11609
+ featureFlags |= DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE | DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE;
11318
11610
  payload[32] = args.cosignerGate.mode;
11319
11611
  view.setBigUint64(40, gateValue, true);
11320
11612
  writeAddress(payload, 48, args.cosignerGate.cosigner);
@@ -11344,6 +11636,10 @@ function decodeDopplerLaunchHookV2Payload(payload) {
11344
11636
  const hasDynamicFee = (featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE) !== 0;
11345
11637
  const hasCosignerGate = (featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE) !== 0;
11346
11638
  const hasFeeRehypothecation = (featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_FEE_REHYPOTHECATION) !== 0;
11639
+ const hasManualCosignDisable = (featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE) !== 0;
11640
+ if (hasManualCosignDisable && !hasCosignerGate) {
11641
+ throw new Error("invalid Doppler launch hook v2 manual cosigner disable");
11642
+ }
11347
11643
  const dynamicFee = hasDynamicFee ? {
11348
11644
  startingTime: view.getBigInt64(16, true),
11349
11645
  startFeeBps: view.getUint16(24, true),
@@ -11388,6 +11684,7 @@ function getDopplerLaunchHookV2RemainingAccounts({
11388
11684
  config,
11389
11685
  feeRehypothecationState,
11390
11686
  settlementSigner,
11687
+ cosignGateControl,
11391
11688
  cosigner
11392
11689
  }) {
11393
11690
  if (Boolean(feeRehypothecationState) !== Boolean(settlementSigner)) {
@@ -11395,12 +11692,15 @@ function getDopplerLaunchHookV2RemainingAccounts({
11395
11692
  "feeRehypothecationState and settlementSigner must be provided together"
11396
11693
  );
11397
11694
  }
11695
+ if (Boolean(cosignGateControl) !== Boolean(cosigner)) {
11696
+ throw new Error("cosignGateControl and cosigner must be provided together");
11697
+ }
11398
11698
  const signedHookRemainingAccounts = [namespace, config];
11399
11699
  if (feeRehypothecationState && settlementSigner) {
11400
11700
  signedHookRemainingAccounts.push(feeRehypothecationState, settlementSigner);
11401
11701
  }
11402
- if (cosigner) {
11403
- signedHookRemainingAccounts.push(cosigner);
11702
+ if (cosignGateControl && cosigner) {
11703
+ signedHookRemainingAccounts.push(cosignGateControl, cosigner);
11404
11704
  }
11405
11705
  const unsignedHookRemainingAccounts = signedHookRemainingAccounts.map(
11406
11706
  chunkAANZBN5X_cjs.getAddressFromRemainingAccount
@@ -13240,11 +13540,16 @@ async function prepareLaunch(input) {
13240
13540
  if (gate && (gate.programId !== deployment.dopplerLaunchHookV2Program || gate.config !== deployment.dopplerLaunchHookV2Config)) {
13241
13541
  throw new Error("cosignerGate does not match the selected deployment");
13242
13542
  }
13543
+ const cosignGateControl = gate ? (await getDopplerLaunchHookV2CosignGateControlAddress(
13544
+ launchAddresses.launch,
13545
+ deployment.dopplerLaunchHookV2Program
13546
+ ))[0] : void 0;
13243
13547
  const remainingAccounts = getDopplerLaunchHookV2RemainingAccounts({
13244
13548
  namespace,
13245
13549
  config: deployment.dopplerLaunchHookV2Config,
13246
13550
  feeRehypothecationState: routingAddresses.state,
13247
13551
  settlementSigner: routingAddresses.settlementSigner,
13552
+ cosignGateControl,
13248
13553
  cosigner: gate?.cosigner
13249
13554
  });
13250
13555
  const payload = encodeDopplerLaunchHookV2Payload({
@@ -13326,6 +13631,7 @@ async function prepareLaunch(input) {
13326
13631
  config: deployment.dopplerLaunchHookV2Config,
13327
13632
  feeRehypothecationState: routingAddresses.state,
13328
13633
  settlementSigner: routingAddresses.settlementSigner,
13634
+ cosignGateControl,
13329
13635
  cosigner: cosigner ?? gate?.cosigner
13330
13636
  });
13331
13637
  return {
@@ -13413,6 +13719,10 @@ async function prepareSettlement(input) {
13413
13719
  if (payload.feeRehypothecationState !== routingAddresses.state) {
13414
13720
  throw new Error("launch payload does not match its router state");
13415
13721
  }
13722
+ const cosignGateControl = (payload.featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE) !== 0 ? (await getDopplerLaunchHookV2CosignGateControlAddress(
13723
+ input.launch,
13724
+ deployment.dopplerLaunchHookV2Program
13725
+ ))[0] : void 0;
13416
13726
  const feeState = feeStateAccount.data;
13417
13727
  const routingState = routingStateAccount.data;
13418
13728
  if (feeState.launch !== input.launch || feeState.beneficiaryLen !== 1 || feeState.beneficiaries[0]?.wallet !== routingAddresses.authority || feeState.beneficiaries[0]?.shareBps !== 1e4 || routingState.launch !== input.launch || routingState.baseMint !== launch.baseMint || routingState.quoteMint !== launch.quoteMint || routingState.hookProgram !== launch.hookProgram || routingState.settlementAuthority !== input.settlementAuthority.address || baseMintAccount.address !== launch.baseMint || quoteMintAccount.address !== launch.quoteMint || baseVaultAccount.address !== launch.baseVault || quoteVaultAccount.address !== launch.quoteVault || baseVaultAccount.programAddress !== baseTokenProgram || quoteVaultAccount.programAddress !== quoteTokenProgram || baseVaultAccount.data.mint !== launch.baseMint || quoteVaultAccount.data.mint !== launch.quoteMint || baseVaultAccount.data.owner !== launchAuthority || quoteVaultAccount.data.owner !== launchAuthority) {
@@ -13545,6 +13855,7 @@ async function prepareSettlement(input) {
13545
13855
  hookProgram: deployment.dopplerLaunchHookV2Program,
13546
13856
  baseTokenProgram,
13547
13857
  quoteTokenProgram,
13858
+ cosignGateControl,
13548
13859
  gateCosigner: payload.cosignerGate?.cosigner,
13549
13860
  minBaseToQuoteOut,
13550
13861
  minQuoteToBaseOut
@@ -13982,6 +14293,7 @@ chunkQ7SFCCGT_cjs.__export(predictionMigrator_exports, {
13982
14293
  getPayloadBufCodec: () => getPayloadBufCodec,
13983
14294
  getPayloadBufDecoder: () => getPayloadBufDecoder2,
13984
14295
  getPayloadBufEncoder: () => getPayloadBufEncoder2,
14296
+ getPredictionClaimReceiptAddress: () => getPredictionClaimReceiptAddress,
13985
14297
  getPredictionEntryAddress: () => getPredictionEntryAddress,
13986
14298
  getPredictionEntryByMintAddress: () => getPredictionEntryByMintAddress,
13987
14299
  getPredictionMarketAddress: () => getPredictionMarketAddress,
@@ -14016,7 +14328,8 @@ chunkQ7SFCCGT_cjs.__export(predictionMigrator_exports, {
14016
14328
  parsePredictionMigratorInstruction: () => parsePredictionMigratorInstruction,
14017
14329
  parsePreviewPayoutIfWinnerInstruction: () => parsePreviewPayoutIfWinnerInstruction,
14018
14330
  parseRegisterEntryInstruction: () => parseRegisterEntryInstruction,
14019
- predictionMigratorProgram: () => predictionMigratorProgram
14331
+ predictionMigratorProgram: () => predictionMigratorProgram,
14332
+ prepareClaimAndClose: () => prepareClaimAndClose
14020
14333
  });
14021
14334
  var PREDICTION_MIGRATOR_ERROR__UNAUTHORIZED = 6e3;
14022
14335
  var PREDICTION_MIGRATOR_ERROR__QUOTE_MINT_MISMATCH = 6001;
@@ -14073,6 +14386,101 @@ function isPredictionMigratorError(error, transactionMessage, code) {
14073
14386
  code
14074
14387
  );
14075
14388
  }
14389
+ var MAX_U647 = (1n << 64n) - 1n;
14390
+ async function prepareClaimAndClose(input) {
14391
+ if (input.outcomeTokenBalance < 0n || input.outcomeTokenBalance > MAX_U647) {
14392
+ throw new Error("outcomeTokenBalance must fit in a u64");
14393
+ }
14394
+ const baseTokenProgram = input.baseTokenProgram ?? token.TOKEN_PROGRAM_ADDRESS;
14395
+ const quoteTokenProgram = input.quoteTokenProgram ?? token.TOKEN_PROGRAM_ADDRESS;
14396
+ const associatedTokenProgram = input.associatedTokenProgram ?? token.ASSOCIATED_TOKEN_PROGRAM_ADDRESS;
14397
+ const systemProgram = input.systemProgram ?? chunkO2Z5ORGF_cjs.SYSTEM_PROGRAM_ADDRESS;
14398
+ const predictionMigratorProgram2 = input.predictionMigratorProgram ?? PREDICTION_MIGRATOR_PROGRAM_ADDRESS;
14399
+ const rentDestination = input.rentDestination ?? input.payer.address;
14400
+ const [
14401
+ [outcomeTokenAccount],
14402
+ [quoteTokenAccount],
14403
+ [marketAuthority],
14404
+ [entryByMint],
14405
+ [receipt]
14406
+ ] = await Promise.all([
14407
+ token.findAssociatedTokenPda({
14408
+ owner: input.claimer.address,
14409
+ mint: input.winnerMint,
14410
+ tokenProgram: baseTokenProgram
14411
+ }),
14412
+ token.findAssociatedTokenPda({
14413
+ owner: input.claimer.address,
14414
+ mint: input.quoteMint,
14415
+ tokenProgram: quoteTokenProgram
14416
+ }),
14417
+ getPredictionMarketAuthorityAddress(
14418
+ input.market,
14419
+ predictionMigratorProgram2
14420
+ ),
14421
+ getPredictionEntryByMintAddress(
14422
+ input.market,
14423
+ input.winnerMint,
14424
+ predictionMigratorProgram2
14425
+ ),
14426
+ getPredictionClaimReceiptAddress(
14427
+ input.market,
14428
+ input.claimer.address,
14429
+ predictionMigratorProgram2
14430
+ )
14431
+ ]);
14432
+ const createQuoteTokenAccountInstruction = token.getCreateAssociatedTokenIdempotentInstruction(
14433
+ {
14434
+ payer: input.payer,
14435
+ ata: quoteTokenAccount,
14436
+ owner: input.claimer.address,
14437
+ mint: input.quoteMint,
14438
+ systemProgram,
14439
+ tokenProgram: quoteTokenProgram
14440
+ },
14441
+ { programAddress: associatedTokenProgram }
14442
+ );
14443
+ const claimInstruction = await getClaimInstructionAsync(
14444
+ {
14445
+ market: input.market,
14446
+ marketAuthority,
14447
+ potVault: input.potVault,
14448
+ winnerMint: input.winnerMint,
14449
+ quoteMint: input.quoteMint,
14450
+ entryByMint,
14451
+ claimerWinnerAta: outcomeTokenAccount,
14452
+ claimerQuoteAta: quoteTokenAccount,
14453
+ claimer: input.claimer,
14454
+ receipt,
14455
+ payer: input.payer,
14456
+ baseTokenProgram,
14457
+ quoteTokenProgram,
14458
+ systemProgram,
14459
+ burnAmount: input.outcomeTokenBalance
14460
+ },
14461
+ { programAddress: predictionMigratorProgram2 }
14462
+ );
14463
+ const closeOutcomeTokenAccountInstruction = token.getCloseAccountInstruction(
14464
+ {
14465
+ account: outcomeTokenAccount,
14466
+ destination: rentDestination,
14467
+ owner: input.claimer
14468
+ },
14469
+ { programAddress: baseTokenProgram }
14470
+ );
14471
+ return {
14472
+ outcomeTokenAccount,
14473
+ quoteTokenAccount,
14474
+ createQuoteTokenAccountInstruction,
14475
+ claimInstruction,
14476
+ closeOutcomeTokenAccountInstruction,
14477
+ instructions: [
14478
+ createQuoteTokenAccountInstruction,
14479
+ claimInstruction,
14480
+ closeOutcomeTokenAccountInstruction
14481
+ ]
14482
+ };
14483
+ }
14076
14484
 
14077
14485
  // src/solana/trustedOracle/index.ts
14078
14486
  var trustedOracle_exports = {};