@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.
@@ -5,7 +5,7 @@ import { getAddressCodec, getProgramDerivedAddress, createNoopSigner, fixEncoder
5
5
  import { getAccountMetaFactory, addSelfPlanAndSendFunctions, addSelfFetchFunctions, getAddressFromResolvedInstructionAccount } from '@solana/program-client-core';
6
6
  import { SYSTEM_PROGRAM_ADDRESS, getTransferSolInstruction } from '@solana-program/system';
7
7
  import { keccak_256 } from '@noble/hashes/sha3.js';
8
- import { TOKEN_PROGRAM_ADDRESS as TOKEN_PROGRAM_ADDRESS$1, findAssociatedTokenPda, decodeToken, getCreateAssociatedTokenIdempotentInstruction, getSyncNativeInstruction } from '@solana-program/token';
8
+ import { TOKEN_PROGRAM_ADDRESS as TOKEN_PROGRAM_ADDRESS$1, findAssociatedTokenPda, decodeToken, ASSOCIATED_TOKEN_PROGRAM_ADDRESS, getCreateAssociatedTokenIdempotentInstruction, getCloseAccountInstruction, getSyncNativeInstruction } from '@solana-program/token';
9
9
  import { SYSVAR_RENT_ADDRESS } from '@solana/sysvars';
10
10
  import { findAddressLookupTablePda, getCreateLookupTableInstruction, getExtendLookupTableInstruction } from '@solana-program/address-lookup-table';
11
11
 
@@ -2211,15 +2211,20 @@ var dopplerLaunchHookV2_exports = {};
2211
2211
  __export(dopplerLaunchHookV2_exports, {
2212
2212
  ADD_COSIGNER_DISCRIMINATOR: () => ADD_COSIGNER_DISCRIMINATOR2,
2213
2213
  DEVNET_DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID: () => DEVNET_DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID,
2214
+ DISABLE_COSIGN_GATES_DISCRIMINATOR: () => DISABLE_COSIGN_GATES_DISCRIMINATOR,
2214
2215
  DOPPLER_LAUNCH_HOOK_V2_CONFIG_SEED: () => DOPPLER_LAUNCH_HOOK_V2_CONFIG_SEED,
2216
+ DOPPLER_LAUNCH_HOOK_V2_COSIGN_GATE_CONTROL_SEED: () => DOPPLER_LAUNCH_HOOK_V2_COSIGN_GATE_CONTROL_SEED,
2215
2217
  DOPPLER_LAUNCH_HOOK_V2_ERROR__ARITHMETIC_OVERFLOW: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__ARITHMETIC_OVERFLOW,
2216
2218
  DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_ALREADY_EXISTS: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_ALREADY_EXISTS,
2217
2219
  DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_LIST_FULL: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_LIST_FULL,
2218
2220
  DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_NOT_FOUND: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_NOT_FOUND,
2219
2221
  DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_REQUIRED: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_REQUIRED,
2222
+ DOPPLER_LAUNCH_HOOK_V2_ERROR__DUPLICATE_LAUNCH: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__DUPLICATE_LAUNCH,
2220
2223
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_AUTHORITY: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_AUTHORITY,
2221
2224
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_CONFIG: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_CONFIG,
2222
2225
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGNER: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGNER,
2226
+ DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_CONTROL: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_CONTROL,
2227
+ DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_DISABLE_BATCH: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_DISABLE_BATCH,
2223
2228
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE,
2224
2229
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE_SCHEDULE: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE_SCHEDULE,
2225
2230
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_INSTRUCTION_DATA: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_INSTRUCTION_DATA,
@@ -2227,16 +2232,19 @@ __export(dopplerLaunchHookV2_exports, {
2227
2232
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_PAYLOAD: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_PAYLOAD,
2228
2233
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_REHYPE_STATE: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_REHYPE_STATE,
2229
2234
  DOPPLER_LAUNCH_HOOK_V2_ERROR__MISSING_ACCOUNT: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__MISSING_ACCOUNT,
2235
+ DOPPLER_LAUNCH_HOOK_V2_ERROR__SELECTIVE_COSIGN_GATE_DISABLE_UNSUPPORTED: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__SELECTIVE_COSIGN_GATE_DISABLE_UNSUPPORTED,
2230
2236
  DOPPLER_LAUNCH_HOOK_V2_ERROR__SETTLEMENT_INCOMPLETE: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__SETTLEMENT_INCOMPLETE,
2231
2237
  DOPPLER_LAUNCH_HOOK_V2_ERROR__UNEXPECTED_ACCOUNT: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__UNEXPECTED_ACCOUNT,
2232
2238
  DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE: () => DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE,
2233
2239
  DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE: () => DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE,
2234
2240
  DOPPLER_LAUNCH_HOOK_V2_FEATURE_FEE_REHYPOTHECATION: () => DOPPLER_LAUNCH_HOOK_V2_FEATURE_FEE_REHYPOTHECATION,
2241
+ DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE: () => DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE,
2235
2242
  DOPPLER_LAUNCH_HOOK_V2_FEATURE_MASK: () => DOPPLER_LAUNCH_HOOK_V2_FEATURE_MASK,
2236
2243
  DOPPLER_LAUNCH_HOOK_V2_GATE_DISABLED: () => DOPPLER_LAUNCH_HOOK_V2_GATE_DISABLED,
2237
2244
  DOPPLER_LAUNCH_HOOK_V2_GATE_SLOT: () => DOPPLER_LAUNCH_HOOK_V2_GATE_SLOT,
2238
2245
  DOPPLER_LAUNCH_HOOK_V2_GATE_UNIX_TIMESTAMP: () => DOPPLER_LAUNCH_HOOK_V2_GATE_UNIX_TIMESTAMP,
2239
2246
  DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGNERS: () => DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGNERS,
2247
+ DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES: () => DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES,
2240
2248
  DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_LEN: () => DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_LEN,
2241
2249
  DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_MAGIC: () => DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_MAGIC,
2242
2250
  DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_VERSION: () => DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_VERSION,
@@ -2262,10 +2270,20 @@ __export(dopplerLaunchHookV2_exports, {
2262
2270
  getAddCosignerInstructionDataCodec: () => getAddCosignerInstructionDataCodec2,
2263
2271
  getAddCosignerInstructionDataDecoder: () => getAddCosignerInstructionDataDecoder2,
2264
2272
  getAddCosignerInstructionDataEncoder: () => getAddCosignerInstructionDataEncoder2,
2273
+ getCosignGateDisabledCodec: () => getCosignGateDisabledCodec,
2274
+ getCosignGateDisabledDecoder: () => getCosignGateDisabledDecoder,
2275
+ getCosignGateDisabledEncoder: () => getCosignGateDisabledEncoder,
2265
2276
  getCosignerArgCodec: () => getCosignerArgCodec2,
2266
2277
  getCosignerArgDecoder: () => getCosignerArgDecoder2,
2267
2278
  getCosignerArgEncoder: () => getCosignerArgEncoder2,
2279
+ getDisableCosignGatesDiscriminatorBytes: () => getDisableCosignGatesDiscriminatorBytes,
2280
+ getDisableCosignGatesInstruction: () => getDisableCosignGatesInstruction,
2281
+ getDisableCosignGatesInstructionAsync: () => getDisableCosignGatesInstructionAsync,
2282
+ getDisableCosignGatesInstructionDataCodec: () => getDisableCosignGatesInstructionDataCodec,
2283
+ getDisableCosignGatesInstructionDataDecoder: () => getDisableCosignGatesInstructionDataDecoder,
2284
+ getDisableCosignGatesInstructionDataEncoder: () => getDisableCosignGatesInstructionDataEncoder,
2268
2285
  getDopplerLaunchHookV2ConfigAddress: () => getDopplerLaunchHookV2ConfigAddress,
2286
+ getDopplerLaunchHookV2CosignGateControlAddress: () => getDopplerLaunchHookV2CosignGateControlAddress,
2269
2287
  getDopplerLaunchHookV2ErrorMessage: () => getDopplerLaunchHookV2ErrorMessage,
2270
2288
  getDopplerLaunchHookV2RemainingAccounts: () => getDopplerLaunchHookV2RemainingAccounts,
2271
2289
  getHookConfigCodec: () => getHookConfigCodec,
@@ -2302,10 +2320,12 @@ __export(dopplerLaunchHookV2_exports, {
2302
2320
  isDopplerLaunchHookV2Error: () => isDopplerLaunchHookV2Error,
2303
2321
  isResolvedManagedCosignerGateV2: () => isResolvedManagedCosignerGateV2,
2304
2322
  parseAddCosignerInstruction: () => parseAddCosignerInstruction2,
2323
+ parseDisableCosignGatesInstruction: () => parseDisableCosignGatesInstruction,
2305
2324
  parseDopplerLaunchHookV2Instruction: () => parseDopplerLaunchHookV2Instruction,
2306
2325
  parseInitializeConfigInstruction: () => parseInitializeConfigInstruction3,
2307
2326
  parseRemoveCosignerInstruction: () => parseRemoveCosignerInstruction2,
2308
2327
  parseSetAuthorityInstruction: () => parseSetAuthorityInstruction2,
2328
+ prepareDisableCosignGates: () => prepareDisableCosignGates,
2309
2329
  resolveManagedCosignerGate: () => resolveManagedCosignerGate2
2310
2330
  });
2311
2331
  var HOOK_CONFIG_DISCRIMINATOR = new Uint8Array([
@@ -2511,6 +2531,156 @@ function parseAddCosignerInstruction2(instruction) {
2511
2531
  data: getAddCosignerInstructionDataDecoder2().decode(instruction.data)
2512
2532
  };
2513
2533
  }
2534
+ var DISABLE_COSIGN_GATES_DISCRIMINATOR = new Uint8Array([
2535
+ 104,
2536
+ 91,
2537
+ 161,
2538
+ 218,
2539
+ 150,
2540
+ 123,
2541
+ 48,
2542
+ 243
2543
+ ]);
2544
+ function getDisableCosignGatesDiscriminatorBytes() {
2545
+ return fixEncoderSize(getBytesEncoder(), 8).encode(
2546
+ DISABLE_COSIGN_GATES_DISCRIMINATOR
2547
+ );
2548
+ }
2549
+ function getDisableCosignGatesInstructionDataEncoder() {
2550
+ return transformEncoder(
2551
+ getStructEncoder([
2552
+ ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
2553
+ ["launches", getArrayEncoder(getAddressEncoder())]
2554
+ ]),
2555
+ (value) => ({
2556
+ ...value,
2557
+ discriminator: DISABLE_COSIGN_GATES_DISCRIMINATOR
2558
+ })
2559
+ );
2560
+ }
2561
+ function getDisableCosignGatesInstructionDataDecoder() {
2562
+ return getStructDecoder([
2563
+ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
2564
+ ["launches", getArrayDecoder(getAddressDecoder())]
2565
+ ]);
2566
+ }
2567
+ function getDisableCosignGatesInstructionDataCodec() {
2568
+ return combineCodec(
2569
+ getDisableCosignGatesInstructionDataEncoder(),
2570
+ getDisableCosignGatesInstructionDataDecoder()
2571
+ );
2572
+ }
2573
+ async function getDisableCosignGatesInstructionAsync(input, config) {
2574
+ const programAddress = config?.programAddress ?? DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ADDRESS;
2575
+ const originalAccounts = {
2576
+ adminAuthority: { value: input.adminAuthority ?? null, isWritable: true },
2577
+ config: { value: input.config ?? null, isWritable: false },
2578
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false }
2579
+ };
2580
+ const accounts = originalAccounts;
2581
+ const args = { ...input };
2582
+ if (!accounts.config.value) {
2583
+ accounts.config.value = await getProgramDerivedAddress({
2584
+ programAddress,
2585
+ seeds: [
2586
+ getBytesEncoder().encode(
2587
+ new Uint8Array([
2588
+ 100,
2589
+ 111,
2590
+ 112,
2591
+ 112,
2592
+ 108,
2593
+ 101,
2594
+ 114,
2595
+ 95,
2596
+ 108,
2597
+ 97,
2598
+ 117,
2599
+ 110,
2600
+ 99,
2601
+ 104,
2602
+ 95,
2603
+ 104,
2604
+ 111,
2605
+ 111,
2606
+ 107,
2607
+ 95,
2608
+ 118,
2609
+ 50
2610
+ ])
2611
+ )
2612
+ ]
2613
+ });
2614
+ }
2615
+ if (!accounts.systemProgram.value) {
2616
+ accounts.systemProgram.value = "11111111111111111111111111111111";
2617
+ }
2618
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2619
+ return Object.freeze({
2620
+ accounts: [
2621
+ getAccountMeta("adminAuthority", accounts.adminAuthority),
2622
+ getAccountMeta("config", accounts.config),
2623
+ getAccountMeta("systemProgram", accounts.systemProgram)
2624
+ ],
2625
+ data: getDisableCosignGatesInstructionDataEncoder().encode(
2626
+ args
2627
+ ),
2628
+ programAddress
2629
+ });
2630
+ }
2631
+ function getDisableCosignGatesInstruction(input, config) {
2632
+ const programAddress = config?.programAddress ?? DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ADDRESS;
2633
+ const originalAccounts = {
2634
+ adminAuthority: { value: input.adminAuthority ?? null, isWritable: true },
2635
+ config: { value: input.config ?? null, isWritable: false },
2636
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false }
2637
+ };
2638
+ const accounts = originalAccounts;
2639
+ const args = { ...input };
2640
+ if (!accounts.systemProgram.value) {
2641
+ accounts.systemProgram.value = "11111111111111111111111111111111";
2642
+ }
2643
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2644
+ return Object.freeze({
2645
+ accounts: [
2646
+ getAccountMeta("adminAuthority", accounts.adminAuthority),
2647
+ getAccountMeta("config", accounts.config),
2648
+ getAccountMeta("systemProgram", accounts.systemProgram)
2649
+ ],
2650
+ data: getDisableCosignGatesInstructionDataEncoder().encode(
2651
+ args
2652
+ ),
2653
+ programAddress
2654
+ });
2655
+ }
2656
+ function parseDisableCosignGatesInstruction(instruction) {
2657
+ if (instruction.accounts.length < 3) {
2658
+ throw new SolanaError(
2659
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2660
+ {
2661
+ actualAccountMetas: instruction.accounts.length,
2662
+ expectedAccountMetas: 3
2663
+ }
2664
+ );
2665
+ }
2666
+ let accountIndex = 0;
2667
+ const getNextAccount = () => {
2668
+ const accountMeta2 = instruction.accounts[accountIndex];
2669
+ accountIndex += 1;
2670
+ return accountMeta2;
2671
+ };
2672
+ return {
2673
+ programAddress: instruction.programAddress,
2674
+ accounts: {
2675
+ adminAuthority: getNextAccount(),
2676
+ config: getNextAccount(),
2677
+ systemProgram: getNextAccount()
2678
+ },
2679
+ data: getDisableCosignGatesInstructionDataDecoder().decode(
2680
+ instruction.data
2681
+ )
2682
+ };
2683
+ }
2514
2684
  var INITIALIZE_CONFIG_DISCRIMINATOR3 = new Uint8Array([
2515
2685
  208,
2516
2686
  127,
@@ -2975,9 +3145,10 @@ function identifyDopplerLaunchHookV2Account(account) {
2975
3145
  }
2976
3146
  var DopplerLaunchHookV2Instruction = /* @__PURE__ */ ((DopplerLaunchHookV2Instruction2) => {
2977
3147
  DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["AddCosigner"] = 0] = "AddCosigner";
2978
- DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["InitializeConfig"] = 1] = "InitializeConfig";
2979
- DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["RemoveCosigner"] = 2] = "RemoveCosigner";
2980
- DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["SetAuthority"] = 3] = "SetAuthority";
3148
+ DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["DisableCosignGates"] = 1] = "DisableCosignGates";
3149
+ DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["InitializeConfig"] = 2] = "InitializeConfig";
3150
+ DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["RemoveCosigner"] = 3] = "RemoveCosigner";
3151
+ DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["SetAuthority"] = 4] = "SetAuthority";
2981
3152
  return DopplerLaunchHookV2Instruction2;
2982
3153
  })(DopplerLaunchHookV2Instruction || {});
2983
3154
  function identifyDopplerLaunchHookV2Instruction(instruction) {
@@ -2991,6 +3162,15 @@ function identifyDopplerLaunchHookV2Instruction(instruction) {
2991
3162
  )) {
2992
3163
  return 0 /* AddCosigner */;
2993
3164
  }
3165
+ if (containsBytes(
3166
+ data,
3167
+ fixEncoderSize(getBytesEncoder(), 8).encode(
3168
+ new Uint8Array([104, 91, 161, 218, 150, 123, 48, 243])
3169
+ ),
3170
+ 0
3171
+ )) {
3172
+ return 1 /* DisableCosignGates */;
3173
+ }
2994
3174
  if (containsBytes(
2995
3175
  data,
2996
3176
  fixEncoderSize(getBytesEncoder(), 8).encode(
@@ -2998,7 +3178,7 @@ function identifyDopplerLaunchHookV2Instruction(instruction) {
2998
3178
  ),
2999
3179
  0
3000
3180
  )) {
3001
- return 1 /* InitializeConfig */;
3181
+ return 2 /* InitializeConfig */;
3002
3182
  }
3003
3183
  if (containsBytes(
3004
3184
  data,
@@ -3007,7 +3187,7 @@ function identifyDopplerLaunchHookV2Instruction(instruction) {
3007
3187
  ),
3008
3188
  0
3009
3189
  )) {
3010
- return 2 /* RemoveCosigner */;
3190
+ return 3 /* RemoveCosigner */;
3011
3191
  }
3012
3192
  if (containsBytes(
3013
3193
  data,
@@ -3016,7 +3196,7 @@ function identifyDopplerLaunchHookV2Instruction(instruction) {
3016
3196
  ),
3017
3197
  0
3018
3198
  )) {
3019
- return 3 /* SetAuthority */;
3199
+ return 4 /* SetAuthority */;
3020
3200
  }
3021
3201
  throw new SolanaError(
3022
3202
  SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
@@ -3033,24 +3213,31 @@ function parseDopplerLaunchHookV2Instruction(instruction) {
3033
3213
  ...parseAddCosignerInstruction2(instruction)
3034
3214
  };
3035
3215
  }
3036
- case 1 /* InitializeConfig */: {
3216
+ case 1 /* DisableCosignGates */: {
3037
3217
  assertIsInstructionWithAccounts(instruction);
3038
3218
  return {
3039
- instructionType: 1 /* InitializeConfig */,
3219
+ instructionType: 1 /* DisableCosignGates */,
3220
+ ...parseDisableCosignGatesInstruction(instruction)
3221
+ };
3222
+ }
3223
+ case 2 /* InitializeConfig */: {
3224
+ assertIsInstructionWithAccounts(instruction);
3225
+ return {
3226
+ instructionType: 2 /* InitializeConfig */,
3040
3227
  ...parseInitializeConfigInstruction3(instruction)
3041
3228
  };
3042
3229
  }
3043
- case 2 /* RemoveCosigner */: {
3230
+ case 3 /* RemoveCosigner */: {
3044
3231
  assertIsInstructionWithAccounts(instruction);
3045
3232
  return {
3046
- instructionType: 2 /* RemoveCosigner */,
3233
+ instructionType: 3 /* RemoveCosigner */,
3047
3234
  ...parseRemoveCosignerInstruction2(instruction)
3048
3235
  };
3049
3236
  }
3050
- case 3 /* SetAuthority */: {
3237
+ case 4 /* SetAuthority */: {
3051
3238
  assertIsInstructionWithAccounts(instruction);
3052
3239
  return {
3053
- instructionType: 3 /* SetAuthority */,
3240
+ instructionType: 4 /* SetAuthority */,
3054
3241
  ...parseSetAuthorityInstruction2(instruction)
3055
3242
  };
3056
3243
  }
@@ -3077,6 +3264,10 @@ function dopplerLaunchHookV2Program() {
3077
3264
  client,
3078
3265
  getAddCosignerInstructionAsync2(input)
3079
3266
  ),
3267
+ disableCosignGates: (input) => addSelfPlanAndSendFunctions(
3268
+ client,
3269
+ getDisableCosignGatesInstructionAsync(input)
3270
+ ),
3080
3271
  initializeConfig: (input) => addSelfPlanAndSendFunctions(
3081
3272
  client,
3082
3273
  getInitializeConfigInstructionAsync3({
@@ -3116,6 +3307,10 @@ var DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_LAUNCH_CONTEXT = 6013;
3116
3307
  var DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_REHYPE_STATE = 6014;
3117
3308
  var DOPPLER_LAUNCH_HOOK_V2_ERROR__SETTLEMENT_INCOMPLETE = 6015;
3118
3309
  var DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_REQUIRED = 6016;
3310
+ var DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_DISABLE_BATCH = 6017;
3311
+ var DOPPLER_LAUNCH_HOOK_V2_ERROR__DUPLICATE_LAUNCH = 6018;
3312
+ var DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_CONTROL = 6019;
3313
+ var DOPPLER_LAUNCH_HOOK_V2_ERROR__SELECTIVE_COSIGN_GATE_DISABLE_UNSUPPORTED = 6020;
3119
3314
  var dopplerLaunchHookV2ErrorMessages;
3120
3315
  if (process.env.NODE_ENV !== "production") {
3121
3316
  dopplerLaunchHookV2ErrorMessages = {
@@ -3124,9 +3319,12 @@ if (process.env.NODE_ENV !== "production") {
3124
3319
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_LIST_FULL]: `Cosigner list is full`,
3125
3320
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_NOT_FOUND]: `Cosigner not found`,
3126
3321
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_REQUIRED]: `Cosigner approval is required`,
3322
+ [DOPPLER_LAUNCH_HOOK_V2_ERROR__DUPLICATE_LAUNCH]: `Cosign gate disable batch contains a duplicate launch`,
3127
3323
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_AUTHORITY]: `Invalid hook authority`,
3128
3324
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_CONFIG]: `Invalid hook config`,
3129
3325
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGNER]: `Invalid cosigner`,
3326
+ [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_CONTROL]: `Invalid cosign gate control account`,
3327
+ [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_DISABLE_BATCH]: `Cosign gate disable batch must contain between 1 and 8 launches`,
3130
3328
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE]: `Invalid swap fee`,
3131
3329
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE_SCHEDULE]: `Invalid dynamic fee schedule`,
3132
3330
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_INSTRUCTION_DATA]: `Invalid instruction data`,
@@ -3134,6 +3332,7 @@ if (process.env.NODE_ENV !== "production") {
3134
3332
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_PAYLOAD]: `Invalid hook payload`,
3135
3333
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_REHYPE_STATE]: `Invalid Rehype state`,
3136
3334
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__MISSING_ACCOUNT]: `Missing hook account`,
3335
+ [DOPPLER_LAUNCH_HOOK_V2_ERROR__SELECTIVE_COSIGN_GATE_DISABLE_UNSUPPORTED]: `Launch does not support selective cosign gate disablement`,
3137
3336
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__SETTLEMENT_INCOMPLETE]: `Rehype settlement is incomplete`,
3138
3337
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__UNEXPECTED_ACCOUNT]: `Unexpected hook account`
3139
3338
  };
@@ -3161,6 +3360,24 @@ function getCosignerArgDecoder2() {
3161
3360
  function getCosignerArgCodec2() {
3162
3361
  return combineCodec(getCosignerArgEncoder2(), getCosignerArgDecoder2());
3163
3362
  }
3363
+ function getCosignGateDisabledEncoder() {
3364
+ return getStructEncoder([
3365
+ ["launch", getAddressEncoder()],
3366
+ ["control", getAddressEncoder()]
3367
+ ]);
3368
+ }
3369
+ function getCosignGateDisabledDecoder() {
3370
+ return getStructDecoder([
3371
+ ["launch", getAddressDecoder()],
3372
+ ["control", getAddressDecoder()]
3373
+ ]);
3374
+ }
3375
+ function getCosignGateDisabledCodec() {
3376
+ return combineCodec(
3377
+ getCosignGateDisabledEncoder(),
3378
+ getCosignGateDisabledDecoder()
3379
+ );
3380
+ }
3164
3381
  function getInitializeConfigArgsEncoder2() {
3165
3382
  return getStructEncoder([
3166
3383
  ["cosigners", getArrayEncoder(getAddressEncoder())]
@@ -6573,6 +6790,16 @@ async function getPredictionEntryByMintAddress(market, mint, programId = PREDICT
6573
6790
  ]
6574
6791
  });
6575
6792
  }
6793
+ async function getPredictionClaimReceiptAddress(market, claimer, programId = PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
6794
+ return getProgramDerivedAddress({
6795
+ programAddress: programId,
6796
+ seeds: [
6797
+ textEncoder5.encode("receipt"),
6798
+ addressCodec4.encode(market),
6799
+ addressCodec4.encode(claimer)
6800
+ ]
6801
+ });
6802
+ }
6576
6803
 
6577
6804
  // src/solana/initializer/instructions/initializeLaunch.ts
6578
6805
  async function getTokenMetadataAddress(mint) {
@@ -8368,7 +8595,6 @@ function getInitializeRehypeArgsEncoder() {
8368
8595
  ["namespace", getAddressEncoder()],
8369
8596
  ["launchId", fixEncoderSize(getBytesEncoder(), 32)],
8370
8597
  ["buybackDestination", getAddressEncoder()],
8371
- ["settlementAuthority", getAddressEncoder()],
8372
8598
  ["routingMode", getU8Encoder()],
8373
8599
  ["feeRouting", getFeeRoutingMatrixEncoder()],
8374
8600
  ["beneficiaries", getArrayEncoder(getRehypeBeneficiaryInputEncoder())]
@@ -8379,7 +8605,6 @@ function getInitializeRehypeArgsDecoder() {
8379
8605
  ["namespace", getAddressDecoder()],
8380
8606
  ["launchId", fixDecoderSize(getBytesDecoder(), 32)],
8381
8607
  ["buybackDestination", getAddressDecoder()],
8382
- ["settlementAuthority", getAddressDecoder()],
8383
8608
  ["routingMode", getU8Decoder()],
8384
8609
  ["feeRouting", getFeeRoutingMatrixDecoder()],
8385
8610
  ["beneficiaries", getArrayDecoder(getRehypeBeneficiaryInputDecoder())]
@@ -9066,7 +9291,9 @@ function getRehypeStateEncoder() {
9066
9291
  ["settlementAuthority", getAddressEncoder()],
9067
9292
  ["cumulativeRoutedBaseFees", getU64Encoder()],
9068
9293
  ["cumulativeRoutedQuoteFees", getU64Encoder()],
9069
- ["reserved", fixEncoderSize(getBytesEncoder(), 24)]
9294
+ ["settledInitializerBaseFees", getU64Encoder()],
9295
+ ["settledInitializerQuoteFees", getU64Encoder()],
9296
+ ["reserved", fixEncoderSize(getBytesEncoder(), 8)]
9070
9297
  ]),
9071
9298
  (value) => ({ ...value, discriminator: REHYPE_STATE_DISCRIMINATOR })
9072
9299
  );
@@ -9111,7 +9338,9 @@ function getRehypeStateDecoder() {
9111
9338
  ["settlementAuthority", getAddressDecoder()],
9112
9339
  ["cumulativeRoutedBaseFees", getU64Decoder()],
9113
9340
  ["cumulativeRoutedQuoteFees", getU64Decoder()],
9114
- ["reserved", fixDecoderSize(getBytesDecoder(), 24)]
9341
+ ["settledInitializerBaseFees", getU64Decoder()],
9342
+ ["settledInitializerQuoteFees", getU64Decoder()],
9343
+ ["reserved", fixDecoderSize(getBytesDecoder(), 8)]
9115
9344
  ]);
9116
9345
  }
9117
9346
  function getRehypeStateCodec() {
@@ -9535,7 +9764,6 @@ function getInitializeRehypeInstructionDataEncoder() {
9535
9764
  ["namespace", getAddressEncoder()],
9536
9765
  ["launchId", fixEncoderSize(getBytesEncoder(), 32)],
9537
9766
  ["buybackDestination", getAddressEncoder()],
9538
- ["settlementAuthority", getAddressEncoder()],
9539
9767
  ["routingMode", getU8Encoder()],
9540
9768
  ["feeRouting", getFeeRoutingMatrixEncoder()],
9541
9769
  ["beneficiaries", getArrayEncoder(getRehypeBeneficiaryInputEncoder())]
@@ -9549,7 +9777,6 @@ function getInitializeRehypeInstructionDataDecoder() {
9549
9777
  ["namespace", getAddressDecoder()],
9550
9778
  ["launchId", fixDecoderSize(getBytesDecoder(), 32)],
9551
9779
  ["buybackDestination", getAddressDecoder()],
9552
- ["settlementAuthority", getAddressDecoder()],
9553
9780
  ["routingMode", getU8Decoder()],
9554
9781
  ["feeRouting", getFeeRoutingMatrixDecoder()],
9555
9782
  ["beneficiaries", getArrayDecoder(getRehypeBeneficiaryInputDecoder())]
@@ -9565,6 +9792,10 @@ async function getInitializeRehypeInstructionAsync(input, config) {
9565
9792
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
9566
9793
  const originalAccounts = {
9567
9794
  payer: { value: input.payer ?? null, isWritable: true },
9795
+ settlementAuthority: {
9796
+ value: input.settlementAuthority ?? null,
9797
+ isWritable: false
9798
+ },
9568
9799
  baseMint: { value: input.baseMint ?? null, isWritable: false },
9569
9800
  quoteMint: { value: input.quoteMint ?? null, isWritable: false },
9570
9801
  hookProgram: { value: input.hookProgram ?? null, isWritable: false },
@@ -9691,6 +9922,7 @@ async function getInitializeRehypeInstructionAsync(input, config) {
9691
9922
  return Object.freeze({
9692
9923
  accounts: [
9693
9924
  getAccountMeta("payer", accounts.payer),
9925
+ getAccountMeta("settlementAuthority", accounts.settlementAuthority),
9694
9926
  getAccountMeta("baseMint", accounts.baseMint),
9695
9927
  getAccountMeta("quoteMint", accounts.quoteMint),
9696
9928
  getAccountMeta("hookProgram", accounts.hookProgram),
@@ -9710,6 +9942,10 @@ function getInitializeRehypeInstruction(input, config) {
9710
9942
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
9711
9943
  const originalAccounts = {
9712
9944
  payer: { value: input.payer ?? null, isWritable: true },
9945
+ settlementAuthority: {
9946
+ value: input.settlementAuthority ?? null,
9947
+ isWritable: false
9948
+ },
9713
9949
  baseMint: { value: input.baseMint ?? null, isWritable: false },
9714
9950
  quoteMint: { value: input.quoteMint ?? null, isWritable: false },
9715
9951
  hookProgram: { value: input.hookProgram ?? null, isWritable: false },
@@ -9740,6 +9976,7 @@ function getInitializeRehypeInstruction(input, config) {
9740
9976
  return Object.freeze({
9741
9977
  accounts: [
9742
9978
  getAccountMeta("payer", accounts.payer),
9979
+ getAccountMeta("settlementAuthority", accounts.settlementAuthority),
9743
9980
  getAccountMeta("baseMint", accounts.baseMint),
9744
9981
  getAccountMeta("quoteMint", accounts.quoteMint),
9745
9982
  getAccountMeta("hookProgram", accounts.hookProgram),
@@ -9756,12 +9993,12 @@ function getInitializeRehypeInstruction(input, config) {
9756
9993
  });
9757
9994
  }
9758
9995
  function parseInitializeRehypeInstruction(instruction) {
9759
- if (instruction.accounts.length < 9) {
9996
+ if (instruction.accounts.length < 10) {
9760
9997
  throw new SolanaError(
9761
9998
  SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
9762
9999
  {
9763
10000
  actualAccountMetas: instruction.accounts.length,
9764
- expectedAccountMetas: 9
10001
+ expectedAccountMetas: 10
9765
10002
  }
9766
10003
  );
9767
10004
  }
@@ -9775,6 +10012,7 @@ function parseInitializeRehypeInstruction(instruction) {
9775
10012
  programAddress: instruction.programAddress,
9776
10013
  accounts: {
9777
10014
  payer: getNextAccount(),
10015
+ settlementAuthority: getNextAccount(),
9778
10016
  baseMint: getNextAccount(),
9779
10017
  quoteMint: getNextAccount(),
9780
10018
  hookProgram: getNextAccount(),
@@ -11166,7 +11404,9 @@ function isDopplerRehypeRouterV1Error(error, transactionMessage, code) {
11166
11404
  var DEVNET_DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID = DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ADDRESS;
11167
11405
  var DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID = DEVNET_DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID;
11168
11406
  var DOPPLER_LAUNCH_HOOK_V2_CONFIG_SEED = "doppler_launch_hook_v2";
11407
+ var DOPPLER_LAUNCH_HOOK_V2_COSIGN_GATE_CONTROL_SEED = "cosign_gate_control";
11169
11408
  var DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGNERS = 32;
11409
+ var DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES = 8;
11170
11410
  var DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_MAGIC = new Uint8Array([
11171
11411
  68,
11172
11412
  76,
@@ -11182,7 +11422,8 @@ var DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_LEN = 112;
11182
11422
  var DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE = 1 << 0;
11183
11423
  var DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE = 1 << 1;
11184
11424
  var DOPPLER_LAUNCH_HOOK_V2_FEATURE_FEE_REHYPOTHECATION = 1 << 2;
11185
- 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;
11425
+ var DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE = 1 << 3;
11426
+ 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;
11186
11427
  var DOPPLER_LAUNCH_HOOK_V2_GATE_DISABLED = 0;
11187
11428
  var DOPPLER_LAUNCH_HOOK_V2_GATE_UNIX_TIMESTAMP = 1;
11188
11429
  var DOPPLER_LAUNCH_HOOK_V2_GATE_SLOT = 2;
@@ -11193,6 +11434,15 @@ async function getDopplerLaunchHookV2ConfigAddress(programId = DOPPLER_LAUNCH_HO
11193
11434
  seeds: [textEncoder7.encode(DOPPLER_LAUNCH_HOOK_V2_CONFIG_SEED)]
11194
11435
  });
11195
11436
  }
11437
+ async function getDopplerLaunchHookV2CosignGateControlAddress(launch, programId = DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID) {
11438
+ return getProgramDerivedAddress({
11439
+ programAddress: programId,
11440
+ seeds: [
11441
+ textEncoder7.encode(DOPPLER_LAUNCH_HOOK_V2_COSIGN_GATE_CONTROL_SEED),
11442
+ getAddressEncoder().encode(launch)
11443
+ ]
11444
+ });
11445
+ }
11196
11446
 
11197
11447
  // src/solana/dopplerLaunchHookV2/config.ts
11198
11448
  var resolvedManagedCosignerGateV2Brand = Symbol(
@@ -11263,6 +11513,48 @@ async function resolveManagedCosignerGate2(rpc, input = {}) {
11263
11513
  });
11264
11514
  return Object.freeze(resolvedGate);
11265
11515
  }
11516
+ async function prepareDisableCosignGates(input) {
11517
+ if (input.launches.length === 0 || input.launches.length > DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES) {
11518
+ throw new Error(
11519
+ `cosign gate disable batch must contain between 1 and ${DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES} launches`
11520
+ );
11521
+ }
11522
+ if (new Set(input.launches).size !== input.launches.length) {
11523
+ throw new Error("cosign gate disable batch contains a duplicate launch");
11524
+ }
11525
+ const programId = input.programId ?? DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID;
11526
+ const cosignGateControls = await Promise.all(
11527
+ input.launches.map(async (launch) => {
11528
+ const [control] = await getDopplerLaunchHookV2CosignGateControlAddress(
11529
+ launch,
11530
+ programId
11531
+ );
11532
+ return control;
11533
+ })
11534
+ );
11535
+ const generatedInstruction = await getDisableCosignGatesInstructionAsync(
11536
+ {
11537
+ adminAuthority: input.adminAuthority,
11538
+ config: input.config,
11539
+ launches: [...input.launches]
11540
+ },
11541
+ { programAddress: programId }
11542
+ );
11543
+ const remainingAccounts = input.launches.flatMap((launch, index) => [
11544
+ { address: launch, role: AccountRole.READONLY },
11545
+ {
11546
+ address: cosignGateControls[index],
11547
+ role: AccountRole.WRITABLE
11548
+ }
11549
+ ]);
11550
+ return {
11551
+ instruction: Object.freeze({
11552
+ ...generatedInstruction,
11553
+ accounts: [...generatedInstruction.accounts, ...remainingAccounts]
11554
+ }),
11555
+ cosignGateControls
11556
+ };
11557
+ }
11266
11558
  var MAX_U643 = (1n << 64n) - 1n;
11267
11559
  var ZERO_ADDRESS = "11111111111111111111111111111111";
11268
11560
  function toBigInt3(value) {
@@ -11312,7 +11604,7 @@ function encodeDopplerLaunchHookV2Payload(args = {}) {
11312
11604
  throw new Error("invalid Doppler launch hook v2 cosigner gate mode");
11313
11605
  }
11314
11606
  const gateValue = assertU64("cosigner gate value", args.cosignerGate.value);
11315
- featureFlags |= DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE;
11607
+ featureFlags |= DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE | DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE;
11316
11608
  payload[32] = args.cosignerGate.mode;
11317
11609
  view.setBigUint64(40, gateValue, true);
11318
11610
  writeAddress(payload, 48, args.cosignerGate.cosigner);
@@ -11342,6 +11634,10 @@ function decodeDopplerLaunchHookV2Payload(payload) {
11342
11634
  const hasDynamicFee = (featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE) !== 0;
11343
11635
  const hasCosignerGate = (featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE) !== 0;
11344
11636
  const hasFeeRehypothecation = (featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_FEE_REHYPOTHECATION) !== 0;
11637
+ const hasManualCosignDisable = (featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE) !== 0;
11638
+ if (hasManualCosignDisable && !hasCosignerGate) {
11639
+ throw new Error("invalid Doppler launch hook v2 manual cosigner disable");
11640
+ }
11345
11641
  const dynamicFee = hasDynamicFee ? {
11346
11642
  startingTime: view.getBigInt64(16, true),
11347
11643
  startFeeBps: view.getUint16(24, true),
@@ -11386,6 +11682,7 @@ function getDopplerLaunchHookV2RemainingAccounts({
11386
11682
  config,
11387
11683
  feeRehypothecationState,
11388
11684
  settlementSigner,
11685
+ cosignGateControl,
11389
11686
  cosigner
11390
11687
  }) {
11391
11688
  if (Boolean(feeRehypothecationState) !== Boolean(settlementSigner)) {
@@ -11393,12 +11690,15 @@ function getDopplerLaunchHookV2RemainingAccounts({
11393
11690
  "feeRehypothecationState and settlementSigner must be provided together"
11394
11691
  );
11395
11692
  }
11693
+ if (Boolean(cosignGateControl) !== Boolean(cosigner)) {
11694
+ throw new Error("cosignGateControl and cosigner must be provided together");
11695
+ }
11396
11696
  const signedHookRemainingAccounts = [namespace, config];
11397
11697
  if (feeRehypothecationState && settlementSigner) {
11398
11698
  signedHookRemainingAccounts.push(feeRehypothecationState, settlementSigner);
11399
11699
  }
11400
- if (cosigner) {
11401
- signedHookRemainingAccounts.push(cosigner);
11700
+ if (cosignGateControl && cosigner) {
11701
+ signedHookRemainingAccounts.push(cosignGateControl, cosigner);
11402
11702
  }
11403
11703
  const unsignedHookRemainingAccounts = signedHookRemainingAccounts.map(
11404
11704
  getAddressFromRemainingAccount
@@ -13238,11 +13538,16 @@ async function prepareLaunch(input) {
13238
13538
  if (gate && (gate.programId !== deployment.dopplerLaunchHookV2Program || gate.config !== deployment.dopplerLaunchHookV2Config)) {
13239
13539
  throw new Error("cosignerGate does not match the selected deployment");
13240
13540
  }
13541
+ const cosignGateControl = gate ? (await getDopplerLaunchHookV2CosignGateControlAddress(
13542
+ launchAddresses.launch,
13543
+ deployment.dopplerLaunchHookV2Program
13544
+ ))[0] : void 0;
13241
13545
  const remainingAccounts = getDopplerLaunchHookV2RemainingAccounts({
13242
13546
  namespace,
13243
13547
  config: deployment.dopplerLaunchHookV2Config,
13244
13548
  feeRehypothecationState: routingAddresses.state,
13245
13549
  settlementSigner: routingAddresses.settlementSigner,
13550
+ cosignGateControl,
13246
13551
  cosigner: gate?.cosigner
13247
13552
  });
13248
13553
  const payload = encodeDopplerLaunchHookV2Payload({
@@ -13324,6 +13629,7 @@ async function prepareLaunch(input) {
13324
13629
  config: deployment.dopplerLaunchHookV2Config,
13325
13630
  feeRehypothecationState: routingAddresses.state,
13326
13631
  settlementSigner: routingAddresses.settlementSigner,
13632
+ cosignGateControl,
13327
13633
  cosigner: cosigner ?? gate?.cosigner
13328
13634
  });
13329
13635
  return {
@@ -13411,6 +13717,10 @@ async function prepareSettlement(input) {
13411
13717
  if (payload.feeRehypothecationState !== routingAddresses.state) {
13412
13718
  throw new Error("launch payload does not match its router state");
13413
13719
  }
13720
+ const cosignGateControl = (payload.featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE) !== 0 ? (await getDopplerLaunchHookV2CosignGateControlAddress(
13721
+ input.launch,
13722
+ deployment.dopplerLaunchHookV2Program
13723
+ ))[0] : void 0;
13414
13724
  const feeState = feeStateAccount.data;
13415
13725
  const routingState = routingStateAccount.data;
13416
13726
  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) {
@@ -13543,6 +13853,7 @@ async function prepareSettlement(input) {
13543
13853
  hookProgram: deployment.dopplerLaunchHookV2Program,
13544
13854
  baseTokenProgram,
13545
13855
  quoteTokenProgram,
13856
+ cosignGateControl,
13546
13857
  gateCosigner: payload.cosignerGate?.cosigner,
13547
13858
  minBaseToQuoteOut,
13548
13859
  minQuoteToBaseOut
@@ -13980,6 +14291,7 @@ __export(predictionMigrator_exports, {
13980
14291
  getPayloadBufCodec: () => getPayloadBufCodec,
13981
14292
  getPayloadBufDecoder: () => getPayloadBufDecoder2,
13982
14293
  getPayloadBufEncoder: () => getPayloadBufEncoder2,
14294
+ getPredictionClaimReceiptAddress: () => getPredictionClaimReceiptAddress,
13983
14295
  getPredictionEntryAddress: () => getPredictionEntryAddress,
13984
14296
  getPredictionEntryByMintAddress: () => getPredictionEntryByMintAddress,
13985
14297
  getPredictionMarketAddress: () => getPredictionMarketAddress,
@@ -14014,7 +14326,8 @@ __export(predictionMigrator_exports, {
14014
14326
  parsePredictionMigratorInstruction: () => parsePredictionMigratorInstruction,
14015
14327
  parsePreviewPayoutIfWinnerInstruction: () => parsePreviewPayoutIfWinnerInstruction,
14016
14328
  parseRegisterEntryInstruction: () => parseRegisterEntryInstruction,
14017
- predictionMigratorProgram: () => predictionMigratorProgram
14329
+ predictionMigratorProgram: () => predictionMigratorProgram,
14330
+ prepareClaimAndClose: () => prepareClaimAndClose
14018
14331
  });
14019
14332
  var PREDICTION_MIGRATOR_ERROR__UNAUTHORIZED = 6e3;
14020
14333
  var PREDICTION_MIGRATOR_ERROR__QUOTE_MINT_MISMATCH = 6001;
@@ -14071,6 +14384,101 @@ function isPredictionMigratorError(error, transactionMessage, code) {
14071
14384
  code
14072
14385
  );
14073
14386
  }
14387
+ var MAX_U647 = (1n << 64n) - 1n;
14388
+ async function prepareClaimAndClose(input) {
14389
+ if (input.outcomeTokenBalance < 0n || input.outcomeTokenBalance > MAX_U647) {
14390
+ throw new Error("outcomeTokenBalance must fit in a u64");
14391
+ }
14392
+ const baseTokenProgram = input.baseTokenProgram ?? TOKEN_PROGRAM_ADDRESS$1;
14393
+ const quoteTokenProgram = input.quoteTokenProgram ?? TOKEN_PROGRAM_ADDRESS$1;
14394
+ const associatedTokenProgram = input.associatedTokenProgram ?? ASSOCIATED_TOKEN_PROGRAM_ADDRESS;
14395
+ const systemProgram = input.systemProgram ?? SYSTEM_PROGRAM_ADDRESS$1;
14396
+ const predictionMigratorProgram2 = input.predictionMigratorProgram ?? PREDICTION_MIGRATOR_PROGRAM_ADDRESS;
14397
+ const rentDestination = input.rentDestination ?? input.payer.address;
14398
+ const [
14399
+ [outcomeTokenAccount],
14400
+ [quoteTokenAccount],
14401
+ [marketAuthority],
14402
+ [entryByMint],
14403
+ [receipt]
14404
+ ] = await Promise.all([
14405
+ findAssociatedTokenPda({
14406
+ owner: input.claimer.address,
14407
+ mint: input.winnerMint,
14408
+ tokenProgram: baseTokenProgram
14409
+ }),
14410
+ findAssociatedTokenPda({
14411
+ owner: input.claimer.address,
14412
+ mint: input.quoteMint,
14413
+ tokenProgram: quoteTokenProgram
14414
+ }),
14415
+ getPredictionMarketAuthorityAddress(
14416
+ input.market,
14417
+ predictionMigratorProgram2
14418
+ ),
14419
+ getPredictionEntryByMintAddress(
14420
+ input.market,
14421
+ input.winnerMint,
14422
+ predictionMigratorProgram2
14423
+ ),
14424
+ getPredictionClaimReceiptAddress(
14425
+ input.market,
14426
+ input.claimer.address,
14427
+ predictionMigratorProgram2
14428
+ )
14429
+ ]);
14430
+ const createQuoteTokenAccountInstruction = getCreateAssociatedTokenIdempotentInstruction(
14431
+ {
14432
+ payer: input.payer,
14433
+ ata: quoteTokenAccount,
14434
+ owner: input.claimer.address,
14435
+ mint: input.quoteMint,
14436
+ systemProgram,
14437
+ tokenProgram: quoteTokenProgram
14438
+ },
14439
+ { programAddress: associatedTokenProgram }
14440
+ );
14441
+ const claimInstruction = await getClaimInstructionAsync(
14442
+ {
14443
+ market: input.market,
14444
+ marketAuthority,
14445
+ potVault: input.potVault,
14446
+ winnerMint: input.winnerMint,
14447
+ quoteMint: input.quoteMint,
14448
+ entryByMint,
14449
+ claimerWinnerAta: outcomeTokenAccount,
14450
+ claimerQuoteAta: quoteTokenAccount,
14451
+ claimer: input.claimer,
14452
+ receipt,
14453
+ payer: input.payer,
14454
+ baseTokenProgram,
14455
+ quoteTokenProgram,
14456
+ systemProgram,
14457
+ burnAmount: input.outcomeTokenBalance
14458
+ },
14459
+ { programAddress: predictionMigratorProgram2 }
14460
+ );
14461
+ const closeOutcomeTokenAccountInstruction = getCloseAccountInstruction(
14462
+ {
14463
+ account: outcomeTokenAccount,
14464
+ destination: rentDestination,
14465
+ owner: input.claimer
14466
+ },
14467
+ { programAddress: baseTokenProgram }
14468
+ );
14469
+ return {
14470
+ outcomeTokenAccount,
14471
+ quoteTokenAccount,
14472
+ createQuoteTokenAccountInstruction,
14473
+ claimInstruction,
14474
+ closeOutcomeTokenAccountInstruction,
14475
+ instructions: [
14476
+ createQuoteTokenAccountInstruction,
14477
+ claimInstruction,
14478
+ closeOutcomeTokenAccountInstruction
14479
+ ]
14480
+ };
14481
+ }
14074
14482
 
14075
14483
  // src/solana/trustedOracle/index.ts
14076
14484
  var trustedOracle_exports = {};