@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.
@@ -2213,15 +2213,20 @@ var dopplerLaunchHookV2_exports = {};
2213
2213
  chunkQ7SFCCGT_cjs.__export(dopplerLaunchHookV2_exports, {
2214
2214
  ADD_COSIGNER_DISCRIMINATOR: () => ADD_COSIGNER_DISCRIMINATOR2,
2215
2215
  DEVNET_DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID: () => DEVNET_DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID,
2216
+ DISABLE_COSIGN_GATES_DISCRIMINATOR: () => DISABLE_COSIGN_GATES_DISCRIMINATOR,
2216
2217
  DOPPLER_LAUNCH_HOOK_V2_CONFIG_SEED: () => DOPPLER_LAUNCH_HOOK_V2_CONFIG_SEED,
2218
+ DOPPLER_LAUNCH_HOOK_V2_COSIGN_GATE_CONTROL_SEED: () => DOPPLER_LAUNCH_HOOK_V2_COSIGN_GATE_CONTROL_SEED,
2217
2219
  DOPPLER_LAUNCH_HOOK_V2_ERROR__ARITHMETIC_OVERFLOW: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__ARITHMETIC_OVERFLOW,
2218
2220
  DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_ALREADY_EXISTS: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_ALREADY_EXISTS,
2219
2221
  DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_LIST_FULL: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_LIST_FULL,
2220
2222
  DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_NOT_FOUND: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_NOT_FOUND,
2221
2223
  DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_REQUIRED: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_REQUIRED,
2224
+ DOPPLER_LAUNCH_HOOK_V2_ERROR__DUPLICATE_LAUNCH: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__DUPLICATE_LAUNCH,
2222
2225
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_AUTHORITY: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_AUTHORITY,
2223
2226
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_CONFIG: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_CONFIG,
2224
2227
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGNER: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGNER,
2228
+ DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_CONTROL: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_CONTROL,
2229
+ DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_DISABLE_BATCH: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_DISABLE_BATCH,
2225
2230
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE,
2226
2231
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE_SCHEDULE: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE_SCHEDULE,
2227
2232
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_INSTRUCTION_DATA: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_INSTRUCTION_DATA,
@@ -2229,16 +2234,19 @@ chunkQ7SFCCGT_cjs.__export(dopplerLaunchHookV2_exports, {
2229
2234
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_PAYLOAD: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_PAYLOAD,
2230
2235
  DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_REHYPE_STATE: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_REHYPE_STATE,
2231
2236
  DOPPLER_LAUNCH_HOOK_V2_ERROR__MISSING_ACCOUNT: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__MISSING_ACCOUNT,
2237
+ DOPPLER_LAUNCH_HOOK_V2_ERROR__SELECTIVE_COSIGN_GATE_DISABLE_UNSUPPORTED: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__SELECTIVE_COSIGN_GATE_DISABLE_UNSUPPORTED,
2232
2238
  DOPPLER_LAUNCH_HOOK_V2_ERROR__SETTLEMENT_INCOMPLETE: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__SETTLEMENT_INCOMPLETE,
2233
2239
  DOPPLER_LAUNCH_HOOK_V2_ERROR__UNEXPECTED_ACCOUNT: () => DOPPLER_LAUNCH_HOOK_V2_ERROR__UNEXPECTED_ACCOUNT,
2234
2240
  DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE: () => DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE,
2235
2241
  DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE: () => DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE,
2236
2242
  DOPPLER_LAUNCH_HOOK_V2_FEATURE_FEE_REHYPOTHECATION: () => DOPPLER_LAUNCH_HOOK_V2_FEATURE_FEE_REHYPOTHECATION,
2243
+ DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE: () => DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE,
2237
2244
  DOPPLER_LAUNCH_HOOK_V2_FEATURE_MASK: () => DOPPLER_LAUNCH_HOOK_V2_FEATURE_MASK,
2238
2245
  DOPPLER_LAUNCH_HOOK_V2_GATE_DISABLED: () => DOPPLER_LAUNCH_HOOK_V2_GATE_DISABLED,
2239
2246
  DOPPLER_LAUNCH_HOOK_V2_GATE_SLOT: () => DOPPLER_LAUNCH_HOOK_V2_GATE_SLOT,
2240
2247
  DOPPLER_LAUNCH_HOOK_V2_GATE_UNIX_TIMESTAMP: () => DOPPLER_LAUNCH_HOOK_V2_GATE_UNIX_TIMESTAMP,
2241
2248
  DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGNERS: () => DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGNERS,
2249
+ DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES: () => DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES,
2242
2250
  DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_LEN: () => DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_LEN,
2243
2251
  DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_MAGIC: () => DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_MAGIC,
2244
2252
  DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_VERSION: () => DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_VERSION,
@@ -2264,10 +2272,20 @@ chunkQ7SFCCGT_cjs.__export(dopplerLaunchHookV2_exports, {
2264
2272
  getAddCosignerInstructionDataCodec: () => getAddCosignerInstructionDataCodec2,
2265
2273
  getAddCosignerInstructionDataDecoder: () => getAddCosignerInstructionDataDecoder2,
2266
2274
  getAddCosignerInstructionDataEncoder: () => getAddCosignerInstructionDataEncoder2,
2275
+ getCosignGateDisabledCodec: () => getCosignGateDisabledCodec,
2276
+ getCosignGateDisabledDecoder: () => getCosignGateDisabledDecoder,
2277
+ getCosignGateDisabledEncoder: () => getCosignGateDisabledEncoder,
2267
2278
  getCosignerArgCodec: () => getCosignerArgCodec2,
2268
2279
  getCosignerArgDecoder: () => getCosignerArgDecoder2,
2269
2280
  getCosignerArgEncoder: () => getCosignerArgEncoder2,
2281
+ getDisableCosignGatesDiscriminatorBytes: () => getDisableCosignGatesDiscriminatorBytes,
2282
+ getDisableCosignGatesInstruction: () => getDisableCosignGatesInstruction,
2283
+ getDisableCosignGatesInstructionAsync: () => getDisableCosignGatesInstructionAsync,
2284
+ getDisableCosignGatesInstructionDataCodec: () => getDisableCosignGatesInstructionDataCodec,
2285
+ getDisableCosignGatesInstructionDataDecoder: () => getDisableCosignGatesInstructionDataDecoder,
2286
+ getDisableCosignGatesInstructionDataEncoder: () => getDisableCosignGatesInstructionDataEncoder,
2270
2287
  getDopplerLaunchHookV2ConfigAddress: () => getDopplerLaunchHookV2ConfigAddress,
2288
+ getDopplerLaunchHookV2CosignGateControlAddress: () => getDopplerLaunchHookV2CosignGateControlAddress,
2271
2289
  getDopplerLaunchHookV2ErrorMessage: () => getDopplerLaunchHookV2ErrorMessage,
2272
2290
  getDopplerLaunchHookV2RemainingAccounts: () => getDopplerLaunchHookV2RemainingAccounts,
2273
2291
  getHookConfigCodec: () => getHookConfigCodec,
@@ -2304,10 +2322,12 @@ chunkQ7SFCCGT_cjs.__export(dopplerLaunchHookV2_exports, {
2304
2322
  isDopplerLaunchHookV2Error: () => isDopplerLaunchHookV2Error,
2305
2323
  isResolvedManagedCosignerGateV2: () => isResolvedManagedCosignerGateV2,
2306
2324
  parseAddCosignerInstruction: () => parseAddCosignerInstruction2,
2325
+ parseDisableCosignGatesInstruction: () => parseDisableCosignGatesInstruction,
2307
2326
  parseDopplerLaunchHookV2Instruction: () => parseDopplerLaunchHookV2Instruction,
2308
2327
  parseInitializeConfigInstruction: () => parseInitializeConfigInstruction3,
2309
2328
  parseRemoveCosignerInstruction: () => parseRemoveCosignerInstruction2,
2310
2329
  parseSetAuthorityInstruction: () => parseSetAuthorityInstruction2,
2330
+ prepareDisableCosignGates: () => prepareDisableCosignGates,
2311
2331
  resolveManagedCosignerGate: () => resolveManagedCosignerGate2
2312
2332
  });
2313
2333
  var HOOK_CONFIG_DISCRIMINATOR = new Uint8Array([
@@ -2513,6 +2533,156 @@ function parseAddCosignerInstruction2(instruction) {
2513
2533
  data: getAddCosignerInstructionDataDecoder2().decode(instruction.data)
2514
2534
  };
2515
2535
  }
2536
+ var DISABLE_COSIGN_GATES_DISCRIMINATOR = new Uint8Array([
2537
+ 104,
2538
+ 91,
2539
+ 161,
2540
+ 218,
2541
+ 150,
2542
+ 123,
2543
+ 48,
2544
+ 243
2545
+ ]);
2546
+ function getDisableCosignGatesDiscriminatorBytes() {
2547
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
2548
+ DISABLE_COSIGN_GATES_DISCRIMINATOR
2549
+ );
2550
+ }
2551
+ function getDisableCosignGatesInstructionDataEncoder() {
2552
+ return kit.transformEncoder(
2553
+ kit.getStructEncoder([
2554
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
2555
+ ["launches", kit.getArrayEncoder(kit.getAddressEncoder())]
2556
+ ]),
2557
+ (value) => ({
2558
+ ...value,
2559
+ discriminator: DISABLE_COSIGN_GATES_DISCRIMINATOR
2560
+ })
2561
+ );
2562
+ }
2563
+ function getDisableCosignGatesInstructionDataDecoder() {
2564
+ return kit.getStructDecoder([
2565
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
2566
+ ["launches", kit.getArrayDecoder(kit.getAddressDecoder())]
2567
+ ]);
2568
+ }
2569
+ function getDisableCosignGatesInstructionDataCodec() {
2570
+ return kit.combineCodec(
2571
+ getDisableCosignGatesInstructionDataEncoder(),
2572
+ getDisableCosignGatesInstructionDataDecoder()
2573
+ );
2574
+ }
2575
+ async function getDisableCosignGatesInstructionAsync(input, config) {
2576
+ const programAddress = config?.programAddress ?? DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ADDRESS;
2577
+ const originalAccounts = {
2578
+ adminAuthority: { value: input.adminAuthority ?? null, isWritable: true },
2579
+ config: { value: input.config ?? null, isWritable: false },
2580
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false }
2581
+ };
2582
+ const accounts = originalAccounts;
2583
+ const args = { ...input };
2584
+ if (!accounts.config.value) {
2585
+ accounts.config.value = await kit.getProgramDerivedAddress({
2586
+ programAddress,
2587
+ seeds: [
2588
+ kit.getBytesEncoder().encode(
2589
+ new Uint8Array([
2590
+ 100,
2591
+ 111,
2592
+ 112,
2593
+ 112,
2594
+ 108,
2595
+ 101,
2596
+ 114,
2597
+ 95,
2598
+ 108,
2599
+ 97,
2600
+ 117,
2601
+ 110,
2602
+ 99,
2603
+ 104,
2604
+ 95,
2605
+ 104,
2606
+ 111,
2607
+ 111,
2608
+ 107,
2609
+ 95,
2610
+ 118,
2611
+ 50
2612
+ ])
2613
+ )
2614
+ ]
2615
+ });
2616
+ }
2617
+ if (!accounts.systemProgram.value) {
2618
+ accounts.systemProgram.value = "11111111111111111111111111111111";
2619
+ }
2620
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2621
+ return Object.freeze({
2622
+ accounts: [
2623
+ getAccountMeta("adminAuthority", accounts.adminAuthority),
2624
+ getAccountMeta("config", accounts.config),
2625
+ getAccountMeta("systemProgram", accounts.systemProgram)
2626
+ ],
2627
+ data: getDisableCosignGatesInstructionDataEncoder().encode(
2628
+ args
2629
+ ),
2630
+ programAddress
2631
+ });
2632
+ }
2633
+ function getDisableCosignGatesInstruction(input, config) {
2634
+ const programAddress = config?.programAddress ?? DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ADDRESS;
2635
+ const originalAccounts = {
2636
+ adminAuthority: { value: input.adminAuthority ?? null, isWritable: true },
2637
+ config: { value: input.config ?? null, isWritable: false },
2638
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false }
2639
+ };
2640
+ const accounts = originalAccounts;
2641
+ const args = { ...input };
2642
+ if (!accounts.systemProgram.value) {
2643
+ accounts.systemProgram.value = "11111111111111111111111111111111";
2644
+ }
2645
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2646
+ return Object.freeze({
2647
+ accounts: [
2648
+ getAccountMeta("adminAuthority", accounts.adminAuthority),
2649
+ getAccountMeta("config", accounts.config),
2650
+ getAccountMeta("systemProgram", accounts.systemProgram)
2651
+ ],
2652
+ data: getDisableCosignGatesInstructionDataEncoder().encode(
2653
+ args
2654
+ ),
2655
+ programAddress
2656
+ });
2657
+ }
2658
+ function parseDisableCosignGatesInstruction(instruction) {
2659
+ if (instruction.accounts.length < 3) {
2660
+ throw new kit.SolanaError(
2661
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2662
+ {
2663
+ actualAccountMetas: instruction.accounts.length,
2664
+ expectedAccountMetas: 3
2665
+ }
2666
+ );
2667
+ }
2668
+ let accountIndex = 0;
2669
+ const getNextAccount = () => {
2670
+ const accountMeta2 = instruction.accounts[accountIndex];
2671
+ accountIndex += 1;
2672
+ return accountMeta2;
2673
+ };
2674
+ return {
2675
+ programAddress: instruction.programAddress,
2676
+ accounts: {
2677
+ adminAuthority: getNextAccount(),
2678
+ config: getNextAccount(),
2679
+ systemProgram: getNextAccount()
2680
+ },
2681
+ data: getDisableCosignGatesInstructionDataDecoder().decode(
2682
+ instruction.data
2683
+ )
2684
+ };
2685
+ }
2516
2686
  var INITIALIZE_CONFIG_DISCRIMINATOR3 = new Uint8Array([
2517
2687
  208,
2518
2688
  127,
@@ -2977,9 +3147,10 @@ function identifyDopplerLaunchHookV2Account(account) {
2977
3147
  }
2978
3148
  var DopplerLaunchHookV2Instruction = /* @__PURE__ */ ((DopplerLaunchHookV2Instruction2) => {
2979
3149
  DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["AddCosigner"] = 0] = "AddCosigner";
2980
- DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["InitializeConfig"] = 1] = "InitializeConfig";
2981
- DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["RemoveCosigner"] = 2] = "RemoveCosigner";
2982
- DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["SetAuthority"] = 3] = "SetAuthority";
3150
+ DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["DisableCosignGates"] = 1] = "DisableCosignGates";
3151
+ DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["InitializeConfig"] = 2] = "InitializeConfig";
3152
+ DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["RemoveCosigner"] = 3] = "RemoveCosigner";
3153
+ DopplerLaunchHookV2Instruction2[DopplerLaunchHookV2Instruction2["SetAuthority"] = 4] = "SetAuthority";
2983
3154
  return DopplerLaunchHookV2Instruction2;
2984
3155
  })(DopplerLaunchHookV2Instruction || {});
2985
3156
  function identifyDopplerLaunchHookV2Instruction(instruction) {
@@ -2993,6 +3164,15 @@ function identifyDopplerLaunchHookV2Instruction(instruction) {
2993
3164
  )) {
2994
3165
  return 0 /* AddCosigner */;
2995
3166
  }
3167
+ if (kit.containsBytes(
3168
+ data,
3169
+ kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
3170
+ new Uint8Array([104, 91, 161, 218, 150, 123, 48, 243])
3171
+ ),
3172
+ 0
3173
+ )) {
3174
+ return 1 /* DisableCosignGates */;
3175
+ }
2996
3176
  if (kit.containsBytes(
2997
3177
  data,
2998
3178
  kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
@@ -3000,7 +3180,7 @@ function identifyDopplerLaunchHookV2Instruction(instruction) {
3000
3180
  ),
3001
3181
  0
3002
3182
  )) {
3003
- return 1 /* InitializeConfig */;
3183
+ return 2 /* InitializeConfig */;
3004
3184
  }
3005
3185
  if (kit.containsBytes(
3006
3186
  data,
@@ -3009,7 +3189,7 @@ function identifyDopplerLaunchHookV2Instruction(instruction) {
3009
3189
  ),
3010
3190
  0
3011
3191
  )) {
3012
- return 2 /* RemoveCosigner */;
3192
+ return 3 /* RemoveCosigner */;
3013
3193
  }
3014
3194
  if (kit.containsBytes(
3015
3195
  data,
@@ -3018,7 +3198,7 @@ function identifyDopplerLaunchHookV2Instruction(instruction) {
3018
3198
  ),
3019
3199
  0
3020
3200
  )) {
3021
- return 3 /* SetAuthority */;
3201
+ return 4 /* SetAuthority */;
3022
3202
  }
3023
3203
  throw new kit.SolanaError(
3024
3204
  kit.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
@@ -3035,24 +3215,31 @@ function parseDopplerLaunchHookV2Instruction(instruction) {
3035
3215
  ...parseAddCosignerInstruction2(instruction)
3036
3216
  };
3037
3217
  }
3038
- case 1 /* InitializeConfig */: {
3218
+ case 1 /* DisableCosignGates */: {
3039
3219
  kit.assertIsInstructionWithAccounts(instruction);
3040
3220
  return {
3041
- instructionType: 1 /* InitializeConfig */,
3221
+ instructionType: 1 /* DisableCosignGates */,
3222
+ ...parseDisableCosignGatesInstruction(instruction)
3223
+ };
3224
+ }
3225
+ case 2 /* InitializeConfig */: {
3226
+ kit.assertIsInstructionWithAccounts(instruction);
3227
+ return {
3228
+ instructionType: 2 /* InitializeConfig */,
3042
3229
  ...parseInitializeConfigInstruction3(instruction)
3043
3230
  };
3044
3231
  }
3045
- case 2 /* RemoveCosigner */: {
3232
+ case 3 /* RemoveCosigner */: {
3046
3233
  kit.assertIsInstructionWithAccounts(instruction);
3047
3234
  return {
3048
- instructionType: 2 /* RemoveCosigner */,
3235
+ instructionType: 3 /* RemoveCosigner */,
3049
3236
  ...parseRemoveCosignerInstruction2(instruction)
3050
3237
  };
3051
3238
  }
3052
- case 3 /* SetAuthority */: {
3239
+ case 4 /* SetAuthority */: {
3053
3240
  kit.assertIsInstructionWithAccounts(instruction);
3054
3241
  return {
3055
- instructionType: 3 /* SetAuthority */,
3242
+ instructionType: 4 /* SetAuthority */,
3056
3243
  ...parseSetAuthorityInstruction2(instruction)
3057
3244
  };
3058
3245
  }
@@ -3079,6 +3266,10 @@ function dopplerLaunchHookV2Program() {
3079
3266
  client,
3080
3267
  getAddCosignerInstructionAsync2(input)
3081
3268
  ),
3269
+ disableCosignGates: (input) => programClientCore.addSelfPlanAndSendFunctions(
3270
+ client,
3271
+ getDisableCosignGatesInstructionAsync(input)
3272
+ ),
3082
3273
  initializeConfig: (input) => programClientCore.addSelfPlanAndSendFunctions(
3083
3274
  client,
3084
3275
  getInitializeConfigInstructionAsync3({
@@ -3118,6 +3309,10 @@ var DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_LAUNCH_CONTEXT = 6013;
3118
3309
  var DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_REHYPE_STATE = 6014;
3119
3310
  var DOPPLER_LAUNCH_HOOK_V2_ERROR__SETTLEMENT_INCOMPLETE = 6015;
3120
3311
  var DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_REQUIRED = 6016;
3312
+ var DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_DISABLE_BATCH = 6017;
3313
+ var DOPPLER_LAUNCH_HOOK_V2_ERROR__DUPLICATE_LAUNCH = 6018;
3314
+ var DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_CONTROL = 6019;
3315
+ var DOPPLER_LAUNCH_HOOK_V2_ERROR__SELECTIVE_COSIGN_GATE_DISABLE_UNSUPPORTED = 6020;
3121
3316
  var dopplerLaunchHookV2ErrorMessages;
3122
3317
  if (process.env.NODE_ENV !== "production") {
3123
3318
  dopplerLaunchHookV2ErrorMessages = {
@@ -3126,9 +3321,12 @@ if (process.env.NODE_ENV !== "production") {
3126
3321
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_LIST_FULL]: `Cosigner list is full`,
3127
3322
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_NOT_FOUND]: `Cosigner not found`,
3128
3323
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__COSIGNER_REQUIRED]: `Cosigner approval is required`,
3324
+ [DOPPLER_LAUNCH_HOOK_V2_ERROR__DUPLICATE_LAUNCH]: `Cosign gate disable batch contains a duplicate launch`,
3129
3325
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_AUTHORITY]: `Invalid hook authority`,
3130
3326
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_CONFIG]: `Invalid hook config`,
3131
3327
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGNER]: `Invalid cosigner`,
3328
+ [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_CONTROL]: `Invalid cosign gate control account`,
3329
+ [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_COSIGN_GATE_DISABLE_BATCH]: `Cosign gate disable batch must contain between 1 and 8 launches`,
3132
3330
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE]: `Invalid swap fee`,
3133
3331
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_FEE_SCHEDULE]: `Invalid dynamic fee schedule`,
3134
3332
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_INSTRUCTION_DATA]: `Invalid instruction data`,
@@ -3136,6 +3334,7 @@ if (process.env.NODE_ENV !== "production") {
3136
3334
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_PAYLOAD]: `Invalid hook payload`,
3137
3335
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__INVALID_REHYPE_STATE]: `Invalid Rehype state`,
3138
3336
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__MISSING_ACCOUNT]: `Missing hook account`,
3337
+ [DOPPLER_LAUNCH_HOOK_V2_ERROR__SELECTIVE_COSIGN_GATE_DISABLE_UNSUPPORTED]: `Launch does not support selective cosign gate disablement`,
3139
3338
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__SETTLEMENT_INCOMPLETE]: `Rehype settlement is incomplete`,
3140
3339
  [DOPPLER_LAUNCH_HOOK_V2_ERROR__UNEXPECTED_ACCOUNT]: `Unexpected hook account`
3141
3340
  };
@@ -3163,6 +3362,24 @@ function getCosignerArgDecoder2() {
3163
3362
  function getCosignerArgCodec2() {
3164
3363
  return kit.combineCodec(getCosignerArgEncoder2(), getCosignerArgDecoder2());
3165
3364
  }
3365
+ function getCosignGateDisabledEncoder() {
3366
+ return kit.getStructEncoder([
3367
+ ["launch", kit.getAddressEncoder()],
3368
+ ["control", kit.getAddressEncoder()]
3369
+ ]);
3370
+ }
3371
+ function getCosignGateDisabledDecoder() {
3372
+ return kit.getStructDecoder([
3373
+ ["launch", kit.getAddressDecoder()],
3374
+ ["control", kit.getAddressDecoder()]
3375
+ ]);
3376
+ }
3377
+ function getCosignGateDisabledCodec() {
3378
+ return kit.combineCodec(
3379
+ getCosignGateDisabledEncoder(),
3380
+ getCosignGateDisabledDecoder()
3381
+ );
3382
+ }
3166
3383
  function getInitializeConfigArgsEncoder2() {
3167
3384
  return kit.getStructEncoder([
3168
3385
  ["cosigners", kit.getArrayEncoder(kit.getAddressEncoder())]
@@ -6575,6 +6792,16 @@ async function getPredictionEntryByMintAddress(market, mint, programId = PREDICT
6575
6792
  ]
6576
6793
  });
6577
6794
  }
6795
+ async function getPredictionClaimReceiptAddress(market, claimer, programId = PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
6796
+ return kit.getProgramDerivedAddress({
6797
+ programAddress: programId,
6798
+ seeds: [
6799
+ textEncoder5.encode("receipt"),
6800
+ addressCodec4.encode(market),
6801
+ addressCodec4.encode(claimer)
6802
+ ]
6803
+ });
6804
+ }
6578
6805
 
6579
6806
  // src/solana/initializer/instructions/initializeLaunch.ts
6580
6807
  async function getTokenMetadataAddress(mint) {
@@ -8370,7 +8597,6 @@ function getInitializeRehypeArgsEncoder() {
8370
8597
  ["namespace", kit.getAddressEncoder()],
8371
8598
  ["launchId", kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
8372
8599
  ["buybackDestination", kit.getAddressEncoder()],
8373
- ["settlementAuthority", kit.getAddressEncoder()],
8374
8600
  ["routingMode", kit.getU8Encoder()],
8375
8601
  ["feeRouting", getFeeRoutingMatrixEncoder()],
8376
8602
  ["beneficiaries", kit.getArrayEncoder(getRehypeBeneficiaryInputEncoder())]
@@ -8381,7 +8607,6 @@ function getInitializeRehypeArgsDecoder() {
8381
8607
  ["namespace", kit.getAddressDecoder()],
8382
8608
  ["launchId", kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
8383
8609
  ["buybackDestination", kit.getAddressDecoder()],
8384
- ["settlementAuthority", kit.getAddressDecoder()],
8385
8610
  ["routingMode", kit.getU8Decoder()],
8386
8611
  ["feeRouting", getFeeRoutingMatrixDecoder()],
8387
8612
  ["beneficiaries", kit.getArrayDecoder(getRehypeBeneficiaryInputDecoder())]
@@ -9065,10 +9290,12 @@ function getRehypeStateEncoder() {
9065
9290
  ["beneficiaryCount", kit.getU8Encoder()],
9066
9291
  ["inflightKind", kit.getU8Encoder()],
9067
9292
  ["inflightDirection", kit.getU8Encoder()],
9068
- ["settlementAuthority", kit.getAddressEncoder()],
9293
+ ["reservedSettlementAuthority", kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
9069
9294
  ["cumulativeRoutedBaseFees", kit.getU64Encoder()],
9070
9295
  ["cumulativeRoutedQuoteFees", kit.getU64Encoder()],
9071
- ["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 24)]
9296
+ ["settledInitializerBaseFees", kit.getU64Encoder()],
9297
+ ["settledInitializerQuoteFees", kit.getU64Encoder()],
9298
+ ["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 8)]
9072
9299
  ]),
9073
9300
  (value) => ({ ...value, discriminator: REHYPE_STATE_DISCRIMINATOR })
9074
9301
  );
@@ -9110,10 +9337,12 @@ function getRehypeStateDecoder() {
9110
9337
  ["beneficiaryCount", kit.getU8Decoder()],
9111
9338
  ["inflightKind", kit.getU8Decoder()],
9112
9339
  ["inflightDirection", kit.getU8Decoder()],
9113
- ["settlementAuthority", kit.getAddressDecoder()],
9340
+ ["reservedSettlementAuthority", kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
9114
9341
  ["cumulativeRoutedBaseFees", kit.getU64Decoder()],
9115
9342
  ["cumulativeRoutedQuoteFees", kit.getU64Decoder()],
9116
- ["reserved", kit.fixDecoderSize(kit.getBytesDecoder(), 24)]
9343
+ ["settledInitializerBaseFees", kit.getU64Decoder()],
9344
+ ["settledInitializerQuoteFees", kit.getU64Decoder()],
9345
+ ["reserved", kit.fixDecoderSize(kit.getBytesDecoder(), 8)]
9117
9346
  ]);
9118
9347
  }
9119
9348
  function getRehypeStateCodec() {
@@ -9537,7 +9766,6 @@ function getInitializeRehypeInstructionDataEncoder() {
9537
9766
  ["namespace", kit.getAddressEncoder()],
9538
9767
  ["launchId", kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
9539
9768
  ["buybackDestination", kit.getAddressEncoder()],
9540
- ["settlementAuthority", kit.getAddressEncoder()],
9541
9769
  ["routingMode", kit.getU8Encoder()],
9542
9770
  ["feeRouting", getFeeRoutingMatrixEncoder()],
9543
9771
  ["beneficiaries", kit.getArrayEncoder(getRehypeBeneficiaryInputEncoder())]
@@ -9551,7 +9779,6 @@ function getInitializeRehypeInstructionDataDecoder() {
9551
9779
  ["namespace", kit.getAddressDecoder()],
9552
9780
  ["launchId", kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
9553
9781
  ["buybackDestination", kit.getAddressDecoder()],
9554
- ["settlementAuthority", kit.getAddressDecoder()],
9555
9782
  ["routingMode", kit.getU8Decoder()],
9556
9783
  ["feeRouting", getFeeRoutingMatrixDecoder()],
9557
9784
  ["beneficiaries", kit.getArrayDecoder(getRehypeBeneficiaryInputDecoder())]
@@ -9971,10 +10198,7 @@ function getSettleFeesInstructionDataCodec() {
9971
10198
  async function getSettleFeesInstructionAsync(input, config) {
9972
10199
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
9973
10200
  const originalAccounts = {
9974
- settlementAuthority: {
9975
- value: input.settlementAuthority ?? null,
9976
- isWritable: true
9977
- },
10201
+ payer: { value: input.payer ?? null, isWritable: true },
9978
10202
  initializerProgram: {
9979
10203
  value: input.initializerProgram ?? null,
9980
10204
  isWritable: false
@@ -10192,7 +10416,7 @@ async function getSettleFeesInstructionAsync(input, config) {
10192
10416
  const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
10193
10417
  return Object.freeze({
10194
10418
  accounts: [
10195
- getAccountMeta("settlementAuthority", accounts.settlementAuthority),
10419
+ getAccountMeta("payer", accounts.payer),
10196
10420
  getAccountMeta("initializerProgram", accounts.initializerProgram),
10197
10421
  getAccountMeta("initializerConfig", accounts.initializerConfig),
10198
10422
  getAccountMeta("launch", accounts.launch),
@@ -10229,10 +10453,7 @@ async function getSettleFeesInstructionAsync(input, config) {
10229
10453
  function getSettleFeesInstruction(input, config) {
10230
10454
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
10231
10455
  const originalAccounts = {
10232
- settlementAuthority: {
10233
- value: input.settlementAuthority ?? null,
10234
- isWritable: true
10235
- },
10456
+ payer: { value: input.payer ?? null, isWritable: true },
10236
10457
  initializerProgram: {
10237
10458
  value: input.initializerProgram ?? null,
10238
10459
  isWritable: false
@@ -10304,7 +10525,7 @@ function getSettleFeesInstruction(input, config) {
10304
10525
  const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
10305
10526
  return Object.freeze({
10306
10527
  accounts: [
10307
- getAccountMeta("settlementAuthority", accounts.settlementAuthority),
10528
+ getAccountMeta("payer", accounts.payer),
10308
10529
  getAccountMeta("initializerProgram", accounts.initializerProgram),
10309
10530
  getAccountMeta("initializerConfig", accounts.initializerConfig),
10310
10531
  getAccountMeta("launch", accounts.launch),
@@ -10361,7 +10582,7 @@ function parseSettleFeesInstruction(instruction) {
10361
10582
  return {
10362
10583
  programAddress: instruction.programAddress,
10363
10584
  accounts: {
10364
- settlementAuthority: getNextAccount(),
10585
+ payer: getNextAccount(),
10365
10586
  initializerProgram: getNextAccount(),
10366
10587
  initializerConfig: getNextAccount(),
10367
10588
  launch: getNextAccount(),
@@ -10440,10 +10661,7 @@ function getSettleMigratedFeesInstructionDataCodec() {
10440
10661
  async function getSettleMigratedFeesInstructionAsync(input, config) {
10441
10662
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
10442
10663
  const originalAccounts = {
10443
- settlementAuthority: {
10444
- value: input.settlementAuthority ?? null,
10445
- isWritable: true
10446
- },
10664
+ payer: { value: input.payer ?? null, isWritable: true },
10447
10665
  initializerProgram: {
10448
10666
  value: input.initializerProgram ?? null,
10449
10667
  isWritable: false
@@ -10636,7 +10854,7 @@ async function getSettleMigratedFeesInstructionAsync(input, config) {
10636
10854
  const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
10637
10855
  return Object.freeze({
10638
10856
  accounts: [
10639
- getAccountMeta("settlementAuthority", accounts.settlementAuthority),
10857
+ getAccountMeta("payer", accounts.payer),
10640
10858
  getAccountMeta("initializerProgram", accounts.initializerProgram),
10641
10859
  getAccountMeta("initializerConfig", accounts.initializerConfig),
10642
10860
  getAccountMeta("launch", accounts.launch),
@@ -10676,10 +10894,7 @@ async function getSettleMigratedFeesInstructionAsync(input, config) {
10676
10894
  function getSettleMigratedFeesInstruction(input, config) {
10677
10895
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
10678
10896
  const originalAccounts = {
10679
- settlementAuthority: {
10680
- value: input.settlementAuthority ?? null,
10681
- isWritable: true
10682
- },
10897
+ payer: { value: input.payer ?? null, isWritable: true },
10683
10898
  initializerProgram: {
10684
10899
  value: input.initializerProgram ?? null,
10685
10900
  isWritable: false
@@ -10760,7 +10975,7 @@ function getSettleMigratedFeesInstruction(input, config) {
10760
10975
  const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
10761
10976
  return Object.freeze({
10762
10977
  accounts: [
10763
- getAccountMeta("settlementAuthority", accounts.settlementAuthority),
10978
+ getAccountMeta("payer", accounts.payer),
10764
10979
  getAccountMeta("initializerProgram", accounts.initializerProgram),
10765
10980
  getAccountMeta("initializerConfig", accounts.initializerConfig),
10766
10981
  getAccountMeta("launch", accounts.launch),
@@ -10820,7 +11035,7 @@ function parseSettleMigratedFeesInstruction(instruction) {
10820
11035
  return {
10821
11036
  programAddress: instruction.programAddress,
10822
11037
  accounts: {
10823
- settlementAuthority: getNextAccount(),
11038
+ payer: getNextAccount(),
10824
11039
  initializerProgram: getNextAccount(),
10825
11040
  initializerConfig: getNextAccount(),
10826
11041
  launch: getNextAccount(),
@@ -11085,11 +11300,17 @@ function dopplerRehypeRouterV1Program() {
11085
11300
  ),
11086
11301
  settleFees: (input) => programClientCore.addSelfPlanAndSendFunctions(
11087
11302
  client,
11088
- getSettleFeesInstructionAsync(input)
11303
+ getSettleFeesInstructionAsync({
11304
+ ...input,
11305
+ payer: input.payer ?? client.payer
11306
+ })
11089
11307
  ),
11090
11308
  settleMigratedFees: (input) => programClientCore.addSelfPlanAndSendFunctions(
11091
11309
  client,
11092
- getSettleMigratedFeesInstructionAsync(input)
11310
+ getSettleMigratedFeesInstructionAsync({
11311
+ ...input,
11312
+ payer: input.payer ?? client.payer
11313
+ })
11093
11314
  )
11094
11315
  }
11095
11316
  }
@@ -11168,7 +11389,9 @@ function isDopplerRehypeRouterV1Error(error, transactionMessage, code) {
11168
11389
  var DEVNET_DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID = DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ADDRESS;
11169
11390
  var DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID = DEVNET_DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID;
11170
11391
  var DOPPLER_LAUNCH_HOOK_V2_CONFIG_SEED = "doppler_launch_hook_v2";
11392
+ var DOPPLER_LAUNCH_HOOK_V2_COSIGN_GATE_CONTROL_SEED = "cosign_gate_control";
11171
11393
  var DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGNERS = 32;
11394
+ var DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES = 8;
11172
11395
  var DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_MAGIC = new Uint8Array([
11173
11396
  68,
11174
11397
  76,
@@ -11184,7 +11407,8 @@ var DOPPLER_LAUNCH_HOOK_V2_PAYLOAD_LEN = 112;
11184
11407
  var DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE = 1 << 0;
11185
11408
  var DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE = 1 << 1;
11186
11409
  var DOPPLER_LAUNCH_HOOK_V2_FEATURE_FEE_REHYPOTHECATION = 1 << 2;
11187
- var DOPPLER_LAUNCH_HOOK_V2_FEATURE_MASK = DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE | DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE | DOPPLER_LAUNCH_HOOK_V2_FEATURE_FEE_REHYPOTHECATION;
11410
+ var DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE = 1 << 3;
11411
+ var DOPPLER_LAUNCH_HOOK_V2_FEATURE_MASK = DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE | DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE | DOPPLER_LAUNCH_HOOK_V2_FEATURE_FEE_REHYPOTHECATION | DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE;
11188
11412
  var DOPPLER_LAUNCH_HOOK_V2_GATE_DISABLED = 0;
11189
11413
  var DOPPLER_LAUNCH_HOOK_V2_GATE_UNIX_TIMESTAMP = 1;
11190
11414
  var DOPPLER_LAUNCH_HOOK_V2_GATE_SLOT = 2;
@@ -11195,6 +11419,15 @@ async function getDopplerLaunchHookV2ConfigAddress(programId = DOPPLER_LAUNCH_HO
11195
11419
  seeds: [textEncoder7.encode(DOPPLER_LAUNCH_HOOK_V2_CONFIG_SEED)]
11196
11420
  });
11197
11421
  }
11422
+ async function getDopplerLaunchHookV2CosignGateControlAddress(launch, programId = DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID) {
11423
+ return kit.getProgramDerivedAddress({
11424
+ programAddress: programId,
11425
+ seeds: [
11426
+ textEncoder7.encode(DOPPLER_LAUNCH_HOOK_V2_COSIGN_GATE_CONTROL_SEED),
11427
+ kit.getAddressEncoder().encode(launch)
11428
+ ]
11429
+ });
11430
+ }
11198
11431
 
11199
11432
  // src/solana/dopplerLaunchHookV2/config.ts
11200
11433
  var resolvedManagedCosignerGateV2Brand = Symbol(
@@ -11265,6 +11498,48 @@ async function resolveManagedCosignerGate2(rpc, input = {}) {
11265
11498
  });
11266
11499
  return Object.freeze(resolvedGate);
11267
11500
  }
11501
+ async function prepareDisableCosignGates(input) {
11502
+ if (input.launches.length === 0 || input.launches.length > DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES) {
11503
+ throw new Error(
11504
+ `cosign gate disable batch must contain between 1 and ${DOPPLER_LAUNCH_HOOK_V2_MAX_COSIGN_GATE_DISABLES} launches`
11505
+ );
11506
+ }
11507
+ if (new Set(input.launches).size !== input.launches.length) {
11508
+ throw new Error("cosign gate disable batch contains a duplicate launch");
11509
+ }
11510
+ const programId = input.programId ?? DOPPLER_LAUNCH_HOOK_V2_PROGRAM_ID;
11511
+ const cosignGateControls = await Promise.all(
11512
+ input.launches.map(async (launch) => {
11513
+ const [control] = await getDopplerLaunchHookV2CosignGateControlAddress(
11514
+ launch,
11515
+ programId
11516
+ );
11517
+ return control;
11518
+ })
11519
+ );
11520
+ const generatedInstruction = await getDisableCosignGatesInstructionAsync(
11521
+ {
11522
+ adminAuthority: input.adminAuthority,
11523
+ config: input.config,
11524
+ launches: [...input.launches]
11525
+ },
11526
+ { programAddress: programId }
11527
+ );
11528
+ const remainingAccounts = input.launches.flatMap((launch, index) => [
11529
+ { address: launch, role: kit.AccountRole.READONLY },
11530
+ {
11531
+ address: cosignGateControls[index],
11532
+ role: kit.AccountRole.WRITABLE
11533
+ }
11534
+ ]);
11535
+ return {
11536
+ instruction: Object.freeze({
11537
+ ...generatedInstruction,
11538
+ accounts: [...generatedInstruction.accounts, ...remainingAccounts]
11539
+ }),
11540
+ cosignGateControls
11541
+ };
11542
+ }
11268
11543
  var MAX_U643 = (1n << 64n) - 1n;
11269
11544
  var ZERO_ADDRESS = "11111111111111111111111111111111";
11270
11545
  function toBigInt3(value) {
@@ -11314,7 +11589,7 @@ function encodeDopplerLaunchHookV2Payload(args = {}) {
11314
11589
  throw new Error("invalid Doppler launch hook v2 cosigner gate mode");
11315
11590
  }
11316
11591
  const gateValue = assertU64("cosigner gate value", args.cosignerGate.value);
11317
- featureFlags |= DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE;
11592
+ featureFlags |= DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE | DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE;
11318
11593
  payload[32] = args.cosignerGate.mode;
11319
11594
  view.setBigUint64(40, gateValue, true);
11320
11595
  writeAddress(payload, 48, args.cosignerGate.cosigner);
@@ -11344,6 +11619,10 @@ function decodeDopplerLaunchHookV2Payload(payload) {
11344
11619
  const hasDynamicFee = (featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_DYNAMIC_FEE) !== 0;
11345
11620
  const hasCosignerGate = (featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_COSIGN_GATE) !== 0;
11346
11621
  const hasFeeRehypothecation = (featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_FEE_REHYPOTHECATION) !== 0;
11622
+ const hasManualCosignDisable = (featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE) !== 0;
11623
+ if (hasManualCosignDisable && !hasCosignerGate) {
11624
+ throw new Error("invalid Doppler launch hook v2 manual cosigner disable");
11625
+ }
11347
11626
  const dynamicFee = hasDynamicFee ? {
11348
11627
  startingTime: view.getBigInt64(16, true),
11349
11628
  startFeeBps: view.getUint16(24, true),
@@ -11388,6 +11667,7 @@ function getDopplerLaunchHookV2RemainingAccounts({
11388
11667
  config,
11389
11668
  feeRehypothecationState,
11390
11669
  settlementSigner,
11670
+ cosignGateControl,
11391
11671
  cosigner
11392
11672
  }) {
11393
11673
  if (Boolean(feeRehypothecationState) !== Boolean(settlementSigner)) {
@@ -11395,12 +11675,15 @@ function getDopplerLaunchHookV2RemainingAccounts({
11395
11675
  "feeRehypothecationState and settlementSigner must be provided together"
11396
11676
  );
11397
11677
  }
11678
+ if (Boolean(cosignGateControl) !== Boolean(cosigner)) {
11679
+ throw new Error("cosignGateControl and cosigner must be provided together");
11680
+ }
11398
11681
  const signedHookRemainingAccounts = [namespace, config];
11399
11682
  if (feeRehypothecationState && settlementSigner) {
11400
11683
  signedHookRemainingAccounts.push(feeRehypothecationState, settlementSigner);
11401
11684
  }
11402
- if (cosigner) {
11403
- signedHookRemainingAccounts.push(cosigner);
11685
+ if (cosignGateControl && cosigner) {
11686
+ signedHookRemainingAccounts.push(cosignGateControl, cosigner);
11404
11687
  }
11405
11688
  const unsignedHookRemainingAccounts = signedHookRemainingAccounts.map(
11406
11689
  chunkAANZBN5X_cjs.getAddressFromRemainingAccount
@@ -13240,11 +13523,16 @@ async function prepareLaunch(input) {
13240
13523
  if (gate && (gate.programId !== deployment.dopplerLaunchHookV2Program || gate.config !== deployment.dopplerLaunchHookV2Config)) {
13241
13524
  throw new Error("cosignerGate does not match the selected deployment");
13242
13525
  }
13526
+ const cosignGateControl = gate ? (await getDopplerLaunchHookV2CosignGateControlAddress(
13527
+ launchAddresses.launch,
13528
+ deployment.dopplerLaunchHookV2Program
13529
+ ))[0] : void 0;
13243
13530
  const remainingAccounts = getDopplerLaunchHookV2RemainingAccounts({
13244
13531
  namespace,
13245
13532
  config: deployment.dopplerLaunchHookV2Config,
13246
13533
  feeRehypothecationState: routingAddresses.state,
13247
13534
  settlementSigner: routingAddresses.settlementSigner,
13535
+ cosignGateControl,
13248
13536
  cosigner: gate?.cosigner
13249
13537
  });
13250
13538
  const payload = encodeDopplerLaunchHookV2Payload({
@@ -13269,7 +13557,6 @@ async function prepareLaunch(input) {
13269
13557
  namespace,
13270
13558
  launchId,
13271
13559
  buybackDestination: input.buybackDestination,
13272
- settlementAuthority: input.settlementAuthority,
13273
13560
  routingMode: input.strategy.routingMode,
13274
13561
  feeRouting: input.strategy.feeRouting,
13275
13562
  beneficiaries
@@ -13326,6 +13613,7 @@ async function prepareLaunch(input) {
13326
13613
  config: deployment.dopplerLaunchHookV2Config,
13327
13614
  feeRehypothecationState: routingAddresses.state,
13328
13615
  settlementSigner: routingAddresses.settlementSigner,
13616
+ cosignGateControl,
13329
13617
  cosigner: cosigner ?? gate?.cosigner
13330
13618
  });
13331
13619
  return {
@@ -13413,9 +13701,13 @@ async function prepareSettlement(input) {
13413
13701
  if (payload.feeRehypothecationState !== routingAddresses.state) {
13414
13702
  throw new Error("launch payload does not match its router state");
13415
13703
  }
13704
+ const cosignGateControl = (payload.featureFlags & DOPPLER_LAUNCH_HOOK_V2_FEATURE_MANUAL_COSIGN_DISABLE) !== 0 ? (await getDopplerLaunchHookV2CosignGateControlAddress(
13705
+ input.launch,
13706
+ deployment.dopplerLaunchHookV2Program
13707
+ ))[0] : void 0;
13416
13708
  const feeState = feeStateAccount.data;
13417
13709
  const routingState = routingStateAccount.data;
13418
- 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) {
13710
+ 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) {
13419
13711
  throw new Error("fee rehypothecation state does not match the launch");
13420
13712
  }
13421
13713
  if (routingState.pendingCrossBase !== 0n || routingState.pendingCrossQuote !== 0n || routingState.pendingLpBase !== 0n || routingState.pendingLpQuote !== 0n || routingState.inflightKind !== 0 || routingState.inflightAmountIn !== 0n || routingState.inflightExpectedAmountOut !== 0n) {
@@ -13522,7 +13814,7 @@ async function prepareSettlement(input) {
13522
13814
  });
13523
13815
  const instruction = await getSettleFeesInstructionAsync(
13524
13816
  {
13525
- settlementAuthority: input.settlementAuthority,
13817
+ payer: input.payer,
13526
13818
  initializerProgram: deployment.initializerProgram,
13527
13819
  initializerConfig: deployment.initializerConfig,
13528
13820
  launch: input.launch,
@@ -13545,6 +13837,7 @@ async function prepareSettlement(input) {
13545
13837
  hookProgram: deployment.dopplerLaunchHookV2Program,
13546
13838
  baseTokenProgram,
13547
13839
  quoteTokenProgram,
13840
+ cosignGateControl,
13548
13841
  gateCosigner: payload.cosignerGate?.cosigner,
13549
13842
  minBaseToQuoteOut,
13550
13843
  minQuoteToBaseOut
@@ -13982,6 +14275,7 @@ chunkQ7SFCCGT_cjs.__export(predictionMigrator_exports, {
13982
14275
  getPayloadBufCodec: () => getPayloadBufCodec,
13983
14276
  getPayloadBufDecoder: () => getPayloadBufDecoder2,
13984
14277
  getPayloadBufEncoder: () => getPayloadBufEncoder2,
14278
+ getPredictionClaimReceiptAddress: () => getPredictionClaimReceiptAddress,
13985
14279
  getPredictionEntryAddress: () => getPredictionEntryAddress,
13986
14280
  getPredictionEntryByMintAddress: () => getPredictionEntryByMintAddress,
13987
14281
  getPredictionMarketAddress: () => getPredictionMarketAddress,
@@ -14016,7 +14310,8 @@ chunkQ7SFCCGT_cjs.__export(predictionMigrator_exports, {
14016
14310
  parsePredictionMigratorInstruction: () => parsePredictionMigratorInstruction,
14017
14311
  parsePreviewPayoutIfWinnerInstruction: () => parsePreviewPayoutIfWinnerInstruction,
14018
14312
  parseRegisterEntryInstruction: () => parseRegisterEntryInstruction,
14019
- predictionMigratorProgram: () => predictionMigratorProgram
14313
+ predictionMigratorProgram: () => predictionMigratorProgram,
14314
+ prepareClaimAndClose: () => prepareClaimAndClose
14020
14315
  });
14021
14316
  var PREDICTION_MIGRATOR_ERROR__UNAUTHORIZED = 6e3;
14022
14317
  var PREDICTION_MIGRATOR_ERROR__QUOTE_MINT_MISMATCH = 6001;
@@ -14073,6 +14368,101 @@ function isPredictionMigratorError(error, transactionMessage, code) {
14073
14368
  code
14074
14369
  );
14075
14370
  }
14371
+ var MAX_U647 = (1n << 64n) - 1n;
14372
+ async function prepareClaimAndClose(input) {
14373
+ if (input.outcomeTokenBalance < 0n || input.outcomeTokenBalance > MAX_U647) {
14374
+ throw new Error("outcomeTokenBalance must fit in a u64");
14375
+ }
14376
+ const baseTokenProgram = input.baseTokenProgram ?? token.TOKEN_PROGRAM_ADDRESS;
14377
+ const quoteTokenProgram = input.quoteTokenProgram ?? token.TOKEN_PROGRAM_ADDRESS;
14378
+ const associatedTokenProgram = input.associatedTokenProgram ?? token.ASSOCIATED_TOKEN_PROGRAM_ADDRESS;
14379
+ const systemProgram = input.systemProgram ?? chunkO2Z5ORGF_cjs.SYSTEM_PROGRAM_ADDRESS;
14380
+ const predictionMigratorProgram2 = input.predictionMigratorProgram ?? PREDICTION_MIGRATOR_PROGRAM_ADDRESS;
14381
+ const rentDestination = input.rentDestination ?? input.payer.address;
14382
+ const [
14383
+ [outcomeTokenAccount],
14384
+ [quoteTokenAccount],
14385
+ [marketAuthority],
14386
+ [entryByMint],
14387
+ [receipt]
14388
+ ] = await Promise.all([
14389
+ token.findAssociatedTokenPda({
14390
+ owner: input.claimer.address,
14391
+ mint: input.winnerMint,
14392
+ tokenProgram: baseTokenProgram
14393
+ }),
14394
+ token.findAssociatedTokenPda({
14395
+ owner: input.claimer.address,
14396
+ mint: input.quoteMint,
14397
+ tokenProgram: quoteTokenProgram
14398
+ }),
14399
+ getPredictionMarketAuthorityAddress(
14400
+ input.market,
14401
+ predictionMigratorProgram2
14402
+ ),
14403
+ getPredictionEntryByMintAddress(
14404
+ input.market,
14405
+ input.winnerMint,
14406
+ predictionMigratorProgram2
14407
+ ),
14408
+ getPredictionClaimReceiptAddress(
14409
+ input.market,
14410
+ input.claimer.address,
14411
+ predictionMigratorProgram2
14412
+ )
14413
+ ]);
14414
+ const createQuoteTokenAccountInstruction = token.getCreateAssociatedTokenIdempotentInstruction(
14415
+ {
14416
+ payer: input.payer,
14417
+ ata: quoteTokenAccount,
14418
+ owner: input.claimer.address,
14419
+ mint: input.quoteMint,
14420
+ systemProgram,
14421
+ tokenProgram: quoteTokenProgram
14422
+ },
14423
+ { programAddress: associatedTokenProgram }
14424
+ );
14425
+ const claimInstruction = await getClaimInstructionAsync(
14426
+ {
14427
+ market: input.market,
14428
+ marketAuthority,
14429
+ potVault: input.potVault,
14430
+ winnerMint: input.winnerMint,
14431
+ quoteMint: input.quoteMint,
14432
+ entryByMint,
14433
+ claimerWinnerAta: outcomeTokenAccount,
14434
+ claimerQuoteAta: quoteTokenAccount,
14435
+ claimer: input.claimer,
14436
+ receipt,
14437
+ payer: input.payer,
14438
+ baseTokenProgram,
14439
+ quoteTokenProgram,
14440
+ systemProgram,
14441
+ burnAmount: input.outcomeTokenBalance
14442
+ },
14443
+ { programAddress: predictionMigratorProgram2 }
14444
+ );
14445
+ const closeOutcomeTokenAccountInstruction = token.getCloseAccountInstruction(
14446
+ {
14447
+ account: outcomeTokenAccount,
14448
+ destination: rentDestination,
14449
+ owner: input.claimer
14450
+ },
14451
+ { programAddress: baseTokenProgram }
14452
+ );
14453
+ return {
14454
+ outcomeTokenAccount,
14455
+ quoteTokenAccount,
14456
+ createQuoteTokenAccountInstruction,
14457
+ claimInstruction,
14458
+ closeOutcomeTokenAccountInstruction,
14459
+ instructions: [
14460
+ createQuoteTokenAccountInstruction,
14461
+ claimInstruction,
14462
+ closeOutcomeTokenAccountInstruction
14463
+ ]
14464
+ };
14465
+ }
14076
14466
 
14077
14467
  // src/solana/trustedOracle/index.ts
14078
14468
  var trustedOracle_exports = {};