@whetstone-research/doppler-sdk 1.0.38 → 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.
@@ -9288,7 +9288,7 @@ function getRehypeStateEncoder() {
9288
9288
  ["beneficiaryCount", getU8Encoder()],
9289
9289
  ["inflightKind", getU8Encoder()],
9290
9290
  ["inflightDirection", getU8Encoder()],
9291
- ["settlementAuthority", getAddressEncoder()],
9291
+ ["reservedSettlementAuthority", fixEncoderSize(getBytesEncoder(), 32)],
9292
9292
  ["cumulativeRoutedBaseFees", getU64Encoder()],
9293
9293
  ["cumulativeRoutedQuoteFees", getU64Encoder()],
9294
9294
  ["settledInitializerBaseFees", getU64Encoder()],
@@ -9335,7 +9335,7 @@ function getRehypeStateDecoder() {
9335
9335
  ["beneficiaryCount", getU8Decoder()],
9336
9336
  ["inflightKind", getU8Decoder()],
9337
9337
  ["inflightDirection", getU8Decoder()],
9338
- ["settlementAuthority", getAddressDecoder()],
9338
+ ["reservedSettlementAuthority", fixDecoderSize(getBytesDecoder(), 32)],
9339
9339
  ["cumulativeRoutedBaseFees", getU64Decoder()],
9340
9340
  ["cumulativeRoutedQuoteFees", getU64Decoder()],
9341
9341
  ["settledInitializerBaseFees", getU64Decoder()],
@@ -9792,10 +9792,6 @@ async function getInitializeRehypeInstructionAsync(input, config) {
9792
9792
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
9793
9793
  const originalAccounts = {
9794
9794
  payer: { value: input.payer ?? null, isWritable: true },
9795
- settlementAuthority: {
9796
- value: input.settlementAuthority ?? null,
9797
- isWritable: false
9798
- },
9799
9795
  baseMint: { value: input.baseMint ?? null, isWritable: false },
9800
9796
  quoteMint: { value: input.quoteMint ?? null, isWritable: false },
9801
9797
  hookProgram: { value: input.hookProgram ?? null, isWritable: false },
@@ -9922,7 +9918,6 @@ async function getInitializeRehypeInstructionAsync(input, config) {
9922
9918
  return Object.freeze({
9923
9919
  accounts: [
9924
9920
  getAccountMeta("payer", accounts.payer),
9925
- getAccountMeta("settlementAuthority", accounts.settlementAuthority),
9926
9921
  getAccountMeta("baseMint", accounts.baseMint),
9927
9922
  getAccountMeta("quoteMint", accounts.quoteMint),
9928
9923
  getAccountMeta("hookProgram", accounts.hookProgram),
@@ -9942,10 +9937,6 @@ function getInitializeRehypeInstruction(input, config) {
9942
9937
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
9943
9938
  const originalAccounts = {
9944
9939
  payer: { value: input.payer ?? null, isWritable: true },
9945
- settlementAuthority: {
9946
- value: input.settlementAuthority ?? null,
9947
- isWritable: false
9948
- },
9949
9940
  baseMint: { value: input.baseMint ?? null, isWritable: false },
9950
9941
  quoteMint: { value: input.quoteMint ?? null, isWritable: false },
9951
9942
  hookProgram: { value: input.hookProgram ?? null, isWritable: false },
@@ -9976,7 +9967,6 @@ function getInitializeRehypeInstruction(input, config) {
9976
9967
  return Object.freeze({
9977
9968
  accounts: [
9978
9969
  getAccountMeta("payer", accounts.payer),
9979
- getAccountMeta("settlementAuthority", accounts.settlementAuthority),
9980
9970
  getAccountMeta("baseMint", accounts.baseMint),
9981
9971
  getAccountMeta("quoteMint", accounts.quoteMint),
9982
9972
  getAccountMeta("hookProgram", accounts.hookProgram),
@@ -9993,12 +9983,12 @@ function getInitializeRehypeInstruction(input, config) {
9993
9983
  });
9994
9984
  }
9995
9985
  function parseInitializeRehypeInstruction(instruction) {
9996
- if (instruction.accounts.length < 10) {
9986
+ if (instruction.accounts.length < 9) {
9997
9987
  throw new SolanaError(
9998
9988
  SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
9999
9989
  {
10000
9990
  actualAccountMetas: instruction.accounts.length,
10001
- expectedAccountMetas: 10
9991
+ expectedAccountMetas: 9
10002
9992
  }
10003
9993
  );
10004
9994
  }
@@ -10012,7 +10002,6 @@ function parseInitializeRehypeInstruction(instruction) {
10012
10002
  programAddress: instruction.programAddress,
10013
10003
  accounts: {
10014
10004
  payer: getNextAccount(),
10015
- settlementAuthority: getNextAccount(),
10016
10005
  baseMint: getNextAccount(),
10017
10006
  quoteMint: getNextAccount(),
10018
10007
  hookProgram: getNextAccount(),
@@ -10207,10 +10196,7 @@ function getSettleFeesInstructionDataCodec() {
10207
10196
  async function getSettleFeesInstructionAsync(input, config) {
10208
10197
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
10209
10198
  const originalAccounts = {
10210
- settlementAuthority: {
10211
- value: input.settlementAuthority ?? null,
10212
- isWritable: true
10213
- },
10199
+ payer: { value: input.payer ?? null, isWritable: true },
10214
10200
  initializerProgram: {
10215
10201
  value: input.initializerProgram ?? null,
10216
10202
  isWritable: false
@@ -10428,7 +10414,7 @@ async function getSettleFeesInstructionAsync(input, config) {
10428
10414
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
10429
10415
  return Object.freeze({
10430
10416
  accounts: [
10431
- getAccountMeta("settlementAuthority", accounts.settlementAuthority),
10417
+ getAccountMeta("payer", accounts.payer),
10432
10418
  getAccountMeta("initializerProgram", accounts.initializerProgram),
10433
10419
  getAccountMeta("initializerConfig", accounts.initializerConfig),
10434
10420
  getAccountMeta("launch", accounts.launch),
@@ -10465,10 +10451,7 @@ async function getSettleFeesInstructionAsync(input, config) {
10465
10451
  function getSettleFeesInstruction(input, config) {
10466
10452
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
10467
10453
  const originalAccounts = {
10468
- settlementAuthority: {
10469
- value: input.settlementAuthority ?? null,
10470
- isWritable: true
10471
- },
10454
+ payer: { value: input.payer ?? null, isWritable: true },
10472
10455
  initializerProgram: {
10473
10456
  value: input.initializerProgram ?? null,
10474
10457
  isWritable: false
@@ -10540,7 +10523,7 @@ function getSettleFeesInstruction(input, config) {
10540
10523
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
10541
10524
  return Object.freeze({
10542
10525
  accounts: [
10543
- getAccountMeta("settlementAuthority", accounts.settlementAuthority),
10526
+ getAccountMeta("payer", accounts.payer),
10544
10527
  getAccountMeta("initializerProgram", accounts.initializerProgram),
10545
10528
  getAccountMeta("initializerConfig", accounts.initializerConfig),
10546
10529
  getAccountMeta("launch", accounts.launch),
@@ -10597,7 +10580,7 @@ function parseSettleFeesInstruction(instruction) {
10597
10580
  return {
10598
10581
  programAddress: instruction.programAddress,
10599
10582
  accounts: {
10600
- settlementAuthority: getNextAccount(),
10583
+ payer: getNextAccount(),
10601
10584
  initializerProgram: getNextAccount(),
10602
10585
  initializerConfig: getNextAccount(),
10603
10586
  launch: getNextAccount(),
@@ -10676,10 +10659,7 @@ function getSettleMigratedFeesInstructionDataCodec() {
10676
10659
  async function getSettleMigratedFeesInstructionAsync(input, config) {
10677
10660
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
10678
10661
  const originalAccounts = {
10679
- settlementAuthority: {
10680
- value: input.settlementAuthority ?? null,
10681
- isWritable: true
10682
- },
10662
+ payer: { value: input.payer ?? null, isWritable: true },
10683
10663
  initializerProgram: {
10684
10664
  value: input.initializerProgram ?? null,
10685
10665
  isWritable: false
@@ -10872,7 +10852,7 @@ async function getSettleMigratedFeesInstructionAsync(input, config) {
10872
10852
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
10873
10853
  return Object.freeze({
10874
10854
  accounts: [
10875
- getAccountMeta("settlementAuthority", accounts.settlementAuthority),
10855
+ getAccountMeta("payer", accounts.payer),
10876
10856
  getAccountMeta("initializerProgram", accounts.initializerProgram),
10877
10857
  getAccountMeta("initializerConfig", accounts.initializerConfig),
10878
10858
  getAccountMeta("launch", accounts.launch),
@@ -10912,10 +10892,7 @@ async function getSettleMigratedFeesInstructionAsync(input, config) {
10912
10892
  function getSettleMigratedFeesInstruction(input, config) {
10913
10893
  const programAddress = config?.programAddress ?? DOPPLER_REHYPE_ROUTER_V1_PROGRAM_ADDRESS;
10914
10894
  const originalAccounts = {
10915
- settlementAuthority: {
10916
- value: input.settlementAuthority ?? null,
10917
- isWritable: true
10918
- },
10895
+ payer: { value: input.payer ?? null, isWritable: true },
10919
10896
  initializerProgram: {
10920
10897
  value: input.initializerProgram ?? null,
10921
10898
  isWritable: false
@@ -10996,7 +10973,7 @@ function getSettleMigratedFeesInstruction(input, config) {
10996
10973
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
10997
10974
  return Object.freeze({
10998
10975
  accounts: [
10999
- getAccountMeta("settlementAuthority", accounts.settlementAuthority),
10976
+ getAccountMeta("payer", accounts.payer),
11000
10977
  getAccountMeta("initializerProgram", accounts.initializerProgram),
11001
10978
  getAccountMeta("initializerConfig", accounts.initializerConfig),
11002
10979
  getAccountMeta("launch", accounts.launch),
@@ -11056,7 +11033,7 @@ function parseSettleMigratedFeesInstruction(instruction) {
11056
11033
  return {
11057
11034
  programAddress: instruction.programAddress,
11058
11035
  accounts: {
11059
- settlementAuthority: getNextAccount(),
11036
+ payer: getNextAccount(),
11060
11037
  initializerProgram: getNextAccount(),
11061
11038
  initializerConfig: getNextAccount(),
11062
11039
  launch: getNextAccount(),
@@ -11321,11 +11298,17 @@ function dopplerRehypeRouterV1Program() {
11321
11298
  ),
11322
11299
  settleFees: (input) => addSelfPlanAndSendFunctions(
11323
11300
  client,
11324
- getSettleFeesInstructionAsync(input)
11301
+ getSettleFeesInstructionAsync({
11302
+ ...input,
11303
+ payer: input.payer ?? client.payer
11304
+ })
11325
11305
  ),
11326
11306
  settleMigratedFees: (input) => addSelfPlanAndSendFunctions(
11327
11307
  client,
11328
- getSettleMigratedFeesInstructionAsync(input)
11308
+ getSettleMigratedFeesInstructionAsync({
11309
+ ...input,
11310
+ payer: input.payer ?? client.payer
11311
+ })
11329
11312
  )
11330
11313
  }
11331
11314
  }
@@ -13572,7 +13555,6 @@ async function prepareLaunch(input) {
13572
13555
  namespace,
13573
13556
  launchId,
13574
13557
  buybackDestination: input.buybackDestination,
13575
- settlementAuthority: input.settlementAuthority,
13576
13558
  routingMode: input.strategy.routingMode,
13577
13559
  feeRouting: input.strategy.feeRouting,
13578
13560
  beneficiaries
@@ -13723,7 +13705,7 @@ async function prepareSettlement(input) {
13723
13705
  ))[0] : void 0;
13724
13706
  const feeState = feeStateAccount.data;
13725
13707
  const routingState = routingStateAccount.data;
13726
- if (feeState.launch !== input.launch || feeState.beneficiaryLen !== 1 || feeState.beneficiaries[0]?.wallet !== routingAddresses.authority || feeState.beneficiaries[0]?.shareBps !== 1e4 || routingState.launch !== input.launch || routingState.baseMint !== launch.baseMint || routingState.quoteMint !== launch.quoteMint || routingState.hookProgram !== launch.hookProgram || routingState.settlementAuthority !== input.settlementAuthority.address || baseMintAccount.address !== launch.baseMint || quoteMintAccount.address !== launch.quoteMint || baseVaultAccount.address !== launch.baseVault || quoteVaultAccount.address !== launch.quoteVault || baseVaultAccount.programAddress !== baseTokenProgram || quoteVaultAccount.programAddress !== quoteTokenProgram || baseVaultAccount.data.mint !== launch.baseMint || quoteVaultAccount.data.mint !== launch.quoteMint || baseVaultAccount.data.owner !== launchAuthority || quoteVaultAccount.data.owner !== launchAuthority) {
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) {
13727
13709
  throw new Error("fee rehypothecation state does not match the launch");
13728
13710
  }
13729
13711
  if (routingState.pendingCrossBase !== 0n || routingState.pendingCrossQuote !== 0n || routingState.pendingLpBase !== 0n || routingState.pendingLpQuote !== 0n || routingState.inflightKind !== 0 || routingState.inflightAmountIn !== 0n || routingState.inflightExpectedAmountOut !== 0n) {
@@ -13830,7 +13812,7 @@ async function prepareSettlement(input) {
13830
13812
  });
13831
13813
  const instruction = await getSettleFeesInstructionAsync(
13832
13814
  {
13833
- settlementAuthority: input.settlementAuthority,
13815
+ payer: input.payer,
13834
13816
  initializerProgram: deployment.initializerProgram,
13835
13817
  initializerConfig: deployment.initializerConfig,
13836
13818
  launch: input.launch,