@whetstone-research/doppler-sdk 1.0.37 → 1.0.39

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())]
@@ -9063,10 +9288,12 @@ function getRehypeStateEncoder() {
9063
9288
  ["beneficiaryCount", getU8Encoder()],
9064
9289
  ["inflightKind", getU8Encoder()],
9065
9290
  ["inflightDirection", getU8Encoder()],
9066
- ["settlementAuthority", getAddressEncoder()],
9291
+ ["reservedSettlementAuthority", fixEncoderSize(getBytesEncoder(), 32)],
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
  );
@@ -9108,10 +9335,12 @@ function getRehypeStateDecoder() {
9108
9335
  ["beneficiaryCount", getU8Decoder()],
9109
9336
  ["inflightKind", getU8Decoder()],
9110
9337
  ["inflightDirection", getU8Decoder()],
9111
- ["settlementAuthority", getAddressDecoder()],
9338
+ ["reservedSettlementAuthority", fixDecoderSize(getBytesDecoder(), 32)],
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())]
@@ -9969,10 +10196,7 @@ function getSettleFeesInstructionDataCodec() {
9969
10196
  async function getSettleFeesInstructionAsync(input, config) {
9970
10197
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
9971
10198
  const originalAccounts = {
9972
- settlementAuthority: {
9973
- value: input.settlementAuthority ?? null,
9974
- isWritable: true
9975
- },
10199
+ payer: { value: input.payer ?? null, isWritable: true },
9976
10200
  initializerProgram: {
9977
10201
  value: input.initializerProgram ?? null,
9978
10202
  isWritable: false
@@ -10190,7 +10414,7 @@ async function getSettleFeesInstructionAsync(input, config) {
10190
10414
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
10191
10415
  return Object.freeze({
10192
10416
  accounts: [
10193
- getAccountMeta("settlementAuthority", accounts.settlementAuthority),
10417
+ getAccountMeta("payer", accounts.payer),
10194
10418
  getAccountMeta("initializerProgram", accounts.initializerProgram),
10195
10419
  getAccountMeta("initializerConfig", accounts.initializerConfig),
10196
10420
  getAccountMeta("launch", accounts.launch),
@@ -10227,10 +10451,7 @@ async function getSettleFeesInstructionAsync(input, config) {
10227
10451
  function getSettleFeesInstruction(input, config) {
10228
10452
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
10229
10453
  const originalAccounts = {
10230
- settlementAuthority: {
10231
- value: input.settlementAuthority ?? null,
10232
- isWritable: true
10233
- },
10454
+ payer: { value: input.payer ?? null, isWritable: true },
10234
10455
  initializerProgram: {
10235
10456
  value: input.initializerProgram ?? null,
10236
10457
  isWritable: false
@@ -10302,7 +10523,7 @@ function getSettleFeesInstruction(input, config) {
10302
10523
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
10303
10524
  return Object.freeze({
10304
10525
  accounts: [
10305
- getAccountMeta("settlementAuthority", accounts.settlementAuthority),
10526
+ getAccountMeta("payer", accounts.payer),
10306
10527
  getAccountMeta("initializerProgram", accounts.initializerProgram),
10307
10528
  getAccountMeta("initializerConfig", accounts.initializerConfig),
10308
10529
  getAccountMeta("launch", accounts.launch),
@@ -10359,7 +10580,7 @@ function parseSettleFeesInstruction(instruction) {
10359
10580
  return {
10360
10581
  programAddress: instruction.programAddress,
10361
10582
  accounts: {
10362
- settlementAuthority: getNextAccount(),
10583
+ payer: getNextAccount(),
10363
10584
  initializerProgram: getNextAccount(),
10364
10585
  initializerConfig: getNextAccount(),
10365
10586
  launch: getNextAccount(),
@@ -10438,10 +10659,7 @@ function getSettleMigratedFeesInstructionDataCodec() {
10438
10659
  async function getSettleMigratedFeesInstructionAsync(input, config) {
10439
10660
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
10440
10661
  const originalAccounts = {
10441
- settlementAuthority: {
10442
- value: input.settlementAuthority ?? null,
10443
- isWritable: true
10444
- },
10662
+ payer: { value: input.payer ?? null, isWritable: true },
10445
10663
  initializerProgram: {
10446
10664
  value: input.initializerProgram ?? null,
10447
10665
  isWritable: false
@@ -10634,7 +10852,7 @@ async function getSettleMigratedFeesInstructionAsync(input, config) {
10634
10852
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
10635
10853
  return Object.freeze({
10636
10854
  accounts: [
10637
- getAccountMeta("settlementAuthority", accounts.settlementAuthority),
10855
+ getAccountMeta("payer", accounts.payer),
10638
10856
  getAccountMeta("initializerProgram", accounts.initializerProgram),
10639
10857
  getAccountMeta("initializerConfig", accounts.initializerConfig),
10640
10858
  getAccountMeta("launch", accounts.launch),
@@ -10674,10 +10892,7 @@ async function getSettleMigratedFeesInstructionAsync(input, config) {
10674
10892
  function getSettleMigratedFeesInstruction(input, config) {
10675
10893
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
10676
10894
  const originalAccounts = {
10677
- settlementAuthority: {
10678
- value: input.settlementAuthority ?? null,
10679
- isWritable: true
10680
- },
10895
+ payer: { value: input.payer ?? null, isWritable: true },
10681
10896
  initializerProgram: {
10682
10897
  value: input.initializerProgram ?? null,
10683
10898
  isWritable: false
@@ -10758,7 +10973,7 @@ function getSettleMigratedFeesInstruction(input, config) {
10758
10973
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
10759
10974
  return Object.freeze({
10760
10975
  accounts: [
10761
- getAccountMeta("settlementAuthority", accounts.settlementAuthority),
10976
+ getAccountMeta("payer", accounts.payer),
10762
10977
  getAccountMeta("initializerProgram", accounts.initializerProgram),
10763
10978
  getAccountMeta("initializerConfig", accounts.initializerConfig),
10764
10979
  getAccountMeta("launch", accounts.launch),
@@ -10818,7 +11033,7 @@ function parseSettleMigratedFeesInstruction(instruction) {
10818
11033
  return {
10819
11034
  programAddress: instruction.programAddress,
10820
11035
  accounts: {
10821
- settlementAuthority: getNextAccount(),
11036
+ payer: getNextAccount(),
10822
11037
  initializerProgram: getNextAccount(),
10823
11038
  initializerConfig: getNextAccount(),
10824
11039
  launch: getNextAccount(),
@@ -11083,11 +11298,17 @@ function dopplerRehypeRouterV1Program() {
11083
11298
  ),
11084
11299
  settleFees: (input) => addSelfPlanAndSendFunctions(
11085
11300
  client,
11086
- getSettleFeesInstructionAsync(input)
11301
+ getSettleFeesInstructionAsync({
11302
+ ...input,
11303
+ payer: input.payer ?? client.payer
11304
+ })
11087
11305
  ),
11088
11306
  settleMigratedFees: (input) => addSelfPlanAndSendFunctions(
11089
11307
  client,
11090
- getSettleMigratedFeesInstructionAsync(input)
11308
+ getSettleMigratedFeesInstructionAsync({
11309
+ ...input,
11310
+ payer: input.payer ?? client.payer
11311
+ })
11091
11312
  )
11092
11313
  }
11093
11314
  }
@@ -11166,7 +11387,9 @@ function isDopplerRehypeRouterV1Error(error, transactionMessage, code) {
11166
11387
  var DEVNET_DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID = DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ADDRESS;
11167
11388
  var DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID = DEVNET_DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID;
11168
11389
  var DOPPLER_LAUNCH_HOOK_V2_CONFIG_SEED = "doppler_launch_hook_v2";
11390
+ var DOPPLER_LAUNCH_HOOK_V2_COSIGN_GATE_CONTROL_SEED = "cosign_gate_control";
11169
11391
  var DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGNERS = 32;
11392
+ var DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES = 8;
11170
11393
  var DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_MAGIC = new Uint8Array([
11171
11394
  68,
11172
11395
  76,
@@ -11182,7 +11405,8 @@ var DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_LEN = 112;
11182
11405
  var DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE = 1 << 0;
11183
11406
  var DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE = 1 << 1;
11184
11407
  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;
11408
+ var DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE = 1 << 3;
11409
+ 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
11410
  var DOPPLER_LAUNCH_HOOK_V2_GATE_DISABLED = 0;
11187
11411
  var DOPPLER_LAUNCH_HOOK_V2_GATE_UNIX_TIMESTAMP = 1;
11188
11412
  var DOPPLER_LAUNCH_HOOK_V2_GATE_SLOT = 2;
@@ -11193,6 +11417,15 @@ async function getDopplerLaunchHookV2ConfigAddress(programId = DOPPLER_LAUNCH_HO
11193
11417
  seeds: [textEncoder7.encode(DOPPLER_LAUNCH_HOOK_V2_CONFIG_SEED)]
11194
11418
  });
11195
11419
  }
11420
+ async function getDopplerLaunchHookV2CosignGateControlAddress(launch, programId = DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID) {
11421
+ return getProgramDerivedAddress({
11422
+ programAddress: programId,
11423
+ seeds: [
11424
+ textEncoder7.encode(DOPPLER_LAUNCH_HOOK_V2_COSIGN_GATE_CONTROL_SEED),
11425
+ getAddressEncoder().encode(launch)
11426
+ ]
11427
+ });
11428
+ }
11196
11429
 
11197
11430
  // src/solana/dopplerLaunchHookV2/config.ts
11198
11431
  var resolvedManagedCosignerGateV2Brand = Symbol(
@@ -11263,6 +11496,48 @@ async function resolveManagedCosignerGate2(rpc, input = {}) {
11263
11496
  });
11264
11497
  return Object.freeze(resolvedGate);
11265
11498
  }
11499
+ async function prepareDisableCosignGates(input) {
11500
+ if (input.launches.length === 0 || input.launches.length > DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES) {
11501
+ throw new Error(
11502
+ `cosign gate disable batch must contain between 1 and ${DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES} launches`
11503
+ );
11504
+ }
11505
+ if (new Set(input.launches).size !== input.launches.length) {
11506
+ throw new Error("cosign gate disable batch contains a duplicate launch");
11507
+ }
11508
+ const programId = input.programId ?? DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID;
11509
+ const cosignGateControls = await Promise.all(
11510
+ input.launches.map(async (launch) => {
11511
+ const [control] = await getDopplerLaunchHookV2CosignGateControlAddress(
11512
+ launch,
11513
+ programId
11514
+ );
11515
+ return control;
11516
+ })
11517
+ );
11518
+ const generatedInstruction = await getDisableCosignGatesInstructionAsync(
11519
+ {
11520
+ adminAuthority: input.adminAuthority,
11521
+ config: input.config,
11522
+ launches: [...input.launches]
11523
+ },
11524
+ { programAddress: programId }
11525
+ );
11526
+ const remainingAccounts = input.launches.flatMap((launch, index) => [
11527
+ { address: launch, role: AccountRole.READONLY },
11528
+ {
11529
+ address: cosignGateControls[index],
11530
+ role: AccountRole.WRITABLE
11531
+ }
11532
+ ]);
11533
+ return {
11534
+ instruction: Object.freeze({
11535
+ ...generatedInstruction,
11536
+ accounts: [...generatedInstruction.accounts, ...remainingAccounts]
11537
+ }),
11538
+ cosignGateControls
11539
+ };
11540
+ }
11266
11541
  var MAX_U643 = (1n << 64n) - 1n;
11267
11542
  var ZERO_ADDRESS = "11111111111111111111111111111111";
11268
11543
  function toBigInt3(value) {
@@ -11312,7 +11587,7 @@ function encodeDopplerLaunchHookV2Payload(args = {}) {
11312
11587
  throw new Error("invalid Doppler launch hook v2 cosigner gate mode");
11313
11588
  }
11314
11589
  const gateValue = assertU64("cosigner gate value", args.cosignerGate.value);
11315
- featureFlags |= DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE;
11590
+ featureFlags |= DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE | DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE;
11316
11591
  payload[32] = args.cosignerGate.mode;
11317
11592
  view.setBigUint64(40, gateValue, true);
11318
11593
  writeAddress(payload, 48, args.cosignerGate.cosigner);
@@ -11342,6 +11617,10 @@ function decodeDopplerLaunchHookV2Payload(payload) {
11342
11617
  const hasDynamicFee = (featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE) !== 0;
11343
11618
  const hasCosignerGate = (featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE) !== 0;
11344
11619
  const hasFeeRehypothecation = (featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_FEE_REHYPOTHECATION) !== 0;
11620
+ const hasManualCosignDisable = (featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE) !== 0;
11621
+ if (hasManualCosignDisable && !hasCosignerGate) {
11622
+ throw new Error("invalid Doppler launch hook v2 manual cosigner disable");
11623
+ }
11345
11624
  const dynamicFee = hasDynamicFee ? {
11346
11625
  startingTime: view.getBigInt64(16, true),
11347
11626
  startFeeBps: view.getUint16(24, true),
@@ -11386,6 +11665,7 @@ function getDopplerLaunchHookV2RemainingAccounts({
11386
11665
  config,
11387
11666
  feeRehypothecationState,
11388
11667
  settlementSigner,
11668
+ cosignGateControl,
11389
11669
  cosigner
11390
11670
  }) {
11391
11671
  if (Boolean(feeRehypothecationState) !== Boolean(settlementSigner)) {
@@ -11393,12 +11673,15 @@ function getDopplerLaunchHookV2RemainingAccounts({
11393
11673
  "feeRehypothecationState and settlementSigner must be provided together"
11394
11674
  );
11395
11675
  }
11676
+ if (Boolean(cosignGateControl) !== Boolean(cosigner)) {
11677
+ throw new Error("cosignGateControl and cosigner must be provided together");
11678
+ }
11396
11679
  const signedHookRemainingAccounts = [namespace, config];
11397
11680
  if (feeRehypothecationState && settlementSigner) {
11398
11681
  signedHookRemainingAccounts.push(feeRehypothecationState, settlementSigner);
11399
11682
  }
11400
- if (cosigner) {
11401
- signedHookRemainingAccounts.push(cosigner);
11683
+ if (cosignGateControl && cosigner) {
11684
+ signedHookRemainingAccounts.push(cosignGateControl, cosigner);
11402
11685
  }
11403
11686
  const unsignedHookRemainingAccounts = signedHookRemainingAccounts.map(
11404
11687
  getAddressFromRemainingAccount
@@ -13238,11 +13521,16 @@ async function prepareLaunch(input) {
13238
13521
  if (gate && (gate.programId !== deployment.dopplerLaunchHookV2Program || gate.config !== deployment.dopplerLaunchHookV2Config)) {
13239
13522
  throw new Error("cosignerGate does not match the selected deployment");
13240
13523
  }
13524
+ const cosignGateControl = gate ? (await getDopplerLaunchHookV2CosignGateControlAddress(
13525
+ launchAddresses.launch,
13526
+ deployment.dopplerLaunchHookV2Program
13527
+ ))[0] : void 0;
13241
13528
  const remainingAccounts = getDopplerLaunchHookV2RemainingAccounts({
13242
13529
  namespace,
13243
13530
  config: deployment.dopplerLaunchHookV2Config,
13244
13531
  feeRehypothecationState: routingAddresses.state,
13245
13532
  settlementSigner: routingAddresses.settlementSigner,
13533
+ cosignGateControl,
13246
13534
  cosigner: gate?.cosigner
13247
13535
  });
13248
13536
  const payload = encodeDopplerLaunchHookV2Payload({
@@ -13267,7 +13555,6 @@ async function prepareLaunch(input) {
13267
13555
  namespace,
13268
13556
  launchId,
13269
13557
  buybackDestination: input.buybackDestination,
13270
- settlementAuthority: input.settlementAuthority,
13271
13558
  routingMode: input.strategy.routingMode,
13272
13559
  feeRouting: input.strategy.feeRouting,
13273
13560
  beneficiaries
@@ -13324,6 +13611,7 @@ async function prepareLaunch(input) {
13324
13611
  config: deployment.dopplerLaunchHookV2Config,
13325
13612
  feeRehypothecationState: routingAddresses.state,
13326
13613
  settlementSigner: routingAddresses.settlementSigner,
13614
+ cosignGateControl,
13327
13615
  cosigner: cosigner ?? gate?.cosigner
13328
13616
  });
13329
13617
  return {
@@ -13411,9 +13699,13 @@ async function prepareSettlement(input) {
13411
13699
  if (payload.feeRehypothecationState !== routingAddresses.state) {
13412
13700
  throw new Error("launch payload does not match its router state");
13413
13701
  }
13702
+ const cosignGateControl = (payload.featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE) !== 0 ? (await getDopplerLaunchHookV2CosignGateControlAddress(
13703
+ input.launch,
13704
+ deployment.dopplerLaunchHookV2Program
13705
+ ))[0] : void 0;
13414
13706
  const feeState = feeStateAccount.data;
13415
13707
  const routingState = routingStateAccount.data;
13416
- 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) {
13708
+ 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 || 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) {
13417
13709
  throw new Error("fee rehypothecation state does not match the launch");
13418
13710
  }
13419
13711
  if (routingState.pendingCrossBase !== 0n || routingState.pendingCrossQuote !== 0n || routingState.pendingLpBase !== 0n || routingState.pendingLpQuote !== 0n || routingState.inflightKind !== 0 || routingState.inflightAmountIn !== 0n || routingState.inflightExpectedAmountOut !== 0n) {
@@ -13520,7 +13812,7 @@ async function prepareSettlement(input) {
13520
13812
  });
13521
13813
  const instruction = await getSettleFeesInstructionAsync(
13522
13814
  {
13523
- settlementAuthority: input.settlementAuthority,
13815
+ payer: input.payer,
13524
13816
  initializerProgram: deployment.initializerProgram,
13525
13817
  initializerConfig: deployment.initializerConfig,
13526
13818
  launch: input.launch,
@@ -13543,6 +13835,7 @@ async function prepareSettlement(input) {
13543
13835
  hookProgram: deployment.dopplerLaunchHookV2Program,
13544
13836
  baseTokenProgram,
13545
13837
  quoteTokenProgram,
13838
+ cosignGateControl,
13546
13839
  gateCosigner: payload.cosignerGate?.cosigner,
13547
13840
  minBaseToQuoteOut,
13548
13841
  minQuoteToBaseOut
@@ -13980,6 +14273,7 @@ __export(predictionMigrator_exports, {
13980
14273
  getPayloadBufCodec: () => getPayloadBufCodec,
13981
14274
  getPayloadBufDecoder: () => getPayloadBufDecoder2,
13982
14275
  getPayloadBufEncoder: () => getPayloadBufEncoder2,
14276
+ getPredictionClaimReceiptAddress: () => getPredictionClaimReceiptAddress,
13983
14277
  getPredictionEntryAddress: () => getPredictionEntryAddress,
13984
14278
  getPredictionEntryByMintAddress: () => getPredictionEntryByMintAddress,
13985
14279
  getPredictionMarketAddress: () => getPredictionMarketAddress,
@@ -14014,7 +14308,8 @@ __export(predictionMigrator_exports, {
14014
14308
  parsePredictionMigratorInstruction: () => parsePredictionMigratorInstruction,
14015
14309
  parsePreviewPayoutIfWinnerInstruction: () => parsePreviewPayoutIfWinnerInstruction,
14016
14310
  parseRegisterEntryInstruction: () => parseRegisterEntryInstruction,
14017
- predictionMigratorProgram: () => predictionMigratorProgram
14311
+ predictionMigratorProgram: () => predictionMigratorProgram,
14312
+ prepareClaimAndClose: () => prepareClaimAndClose
14018
14313
  });
14019
14314
  var PREDICTION_MIGRATOR_ERROR__UNAUTHORIZED = 6e3;
14020
14315
  var PREDICTION_MIGRATOR_ERROR__QUOTE_MINT_MISMATCH = 6001;
@@ -14071,6 +14366,101 @@ function isPredictionMigratorError(error, transactionMessage, code) {
14071
14366
  code
14072
14367
  );
14073
14368
  }
14369
+ var MAX_U647 = (1n << 64n) - 1n;
14370
+ async function prepareClaimAndClose(input) {
14371
+ if (input.outcomeTokenBalance < 0n || input.outcomeTokenBalance > MAX_U647) {
14372
+ throw new Error("outcomeTokenBalance must fit in a u64");
14373
+ }
14374
+ const baseTokenProgram = input.baseTokenProgram ?? TOKEN_PROGRAM_ADDRESS$1;
14375
+ const quoteTokenProgram = input.quoteTokenProgram ?? TOKEN_PROGRAM_ADDRESS$1;
14376
+ const associatedTokenProgram = input.associatedTokenProgram ?? ASSOCIATED_TOKEN_PROGRAM_ADDRESS;
14377
+ const systemProgram = input.systemProgram ?? SYSTEM_PROGRAM_ADDRESS$1;
14378
+ const predictionMigratorProgram2 = input.predictionMigratorProgram ?? PREDICTION_MIGRATOR_PROGRAM_ADDRESS;
14379
+ const rentDestination = input.rentDestination ?? input.payer.address;
14380
+ const [
14381
+ [outcomeTokenAccount],
14382
+ [quoteTokenAccount],
14383
+ [marketAuthority],
14384
+ [entryByMint],
14385
+ [receipt]
14386
+ ] = await Promise.all([
14387
+ findAssociatedTokenPda({
14388
+ owner: input.claimer.address,
14389
+ mint: input.winnerMint,
14390
+ tokenProgram: baseTokenProgram
14391
+ }),
14392
+ findAssociatedTokenPda({
14393
+ owner: input.claimer.address,
14394
+ mint: input.quoteMint,
14395
+ tokenProgram: quoteTokenProgram
14396
+ }),
14397
+ getPredictionMarketAuthorityAddress(
14398
+ input.market,
14399
+ predictionMigratorProgram2
14400
+ ),
14401
+ getPredictionEntryByMintAddress(
14402
+ input.market,
14403
+ input.winnerMint,
14404
+ predictionMigratorProgram2
14405
+ ),
14406
+ getPredictionClaimReceiptAddress(
14407
+ input.market,
14408
+ input.claimer.address,
14409
+ predictionMigratorProgram2
14410
+ )
14411
+ ]);
14412
+ const createQuoteTokenAccountInstruction = getCreateAssociatedTokenIdempotentInstruction(
14413
+ {
14414
+ payer: input.payer,
14415
+ ata: quoteTokenAccount,
14416
+ owner: input.claimer.address,
14417
+ mint: input.quoteMint,
14418
+ systemProgram,
14419
+ tokenProgram: quoteTokenProgram
14420
+ },
14421
+ { programAddress: associatedTokenProgram }
14422
+ );
14423
+ const claimInstruction = await getClaimInstructionAsync(
14424
+ {
14425
+ market: input.market,
14426
+ marketAuthority,
14427
+ potVault: input.potVault,
14428
+ winnerMint: input.winnerMint,
14429
+ quoteMint: input.quoteMint,
14430
+ entryByMint,
14431
+ claimerWinnerAta: outcomeTokenAccount,
14432
+ claimerQuoteAta: quoteTokenAccount,
14433
+ claimer: input.claimer,
14434
+ receipt,
14435
+ payer: input.payer,
14436
+ baseTokenProgram,
14437
+ quoteTokenProgram,
14438
+ systemProgram,
14439
+ burnAmount: input.outcomeTokenBalance
14440
+ },
14441
+ { programAddress: predictionMigratorProgram2 }
14442
+ );
14443
+ const closeOutcomeTokenAccountInstruction = getCloseAccountInstruction(
14444
+ {
14445
+ account: outcomeTokenAccount,
14446
+ destination: rentDestination,
14447
+ owner: input.claimer
14448
+ },
14449
+ { programAddress: baseTokenProgram }
14450
+ );
14451
+ return {
14452
+ outcomeTokenAccount,
14453
+ quoteTokenAccount,
14454
+ createQuoteTokenAccountInstruction,
14455
+ claimInstruction,
14456
+ closeOutcomeTokenAccountInstruction,
14457
+ instructions: [
14458
+ createQuoteTokenAccountInstruction,
14459
+ claimInstruction,
14460
+ closeOutcomeTokenAccountInstruction
14461
+ ]
14462
+ };
14463
+ }
14074
14464
 
14075
14465
  // src/solana/trustedOracle/index.ts
14076
14466
  var trustedOracle_exports = {};