@meteora-ag/cp-amm-sdk 1.0.10 → 1.0.11-rc.1

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.
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Meteora Constant Product AMM SDK (DAMM V2 SDK)
2
2
 
3
- A TypeScript SDK for interacting with the Dynamic CP-AMM on Meteora
3
+ A TypeScript SDK for interacting with the DAMM V2 on Meteora
4
4
 
5
5
  ## Overview
6
6
 
7
- This SDK provides a set of tools and methods to interact with the [Meteora Dynamic CP-AMM](https://github.com/MeteoraAg/cp-amm). It simplifies common operations like creating pools, managing positions, adding/removing liquidity, swapping tokens, and claiming rewards.
7
+ This SDK provides a set of tools and methods to interact with the [Meteora DAMM-V2](https://github.com/MeteoraAg/damm-v2). It simplifies common operations like creating pools, managing positions, adding/removing liquidity, swapping tokens, and claiming rewards.
8
8
 
9
- For detailed technical documentation, please refer to the [CP-AMM SDK Documentation](https://github.com/MeteoraAg/cp-amm-sdk/blob/main/docs.md).
9
+ For detailed technical documentation, please refer to the [DAMM-V2 SDK Documentation](https://github.com/MeteoraAg/damm-v2-sdk/blob/main/docs.md).
10
10
 
11
11
  ## Installation
12
12
 
package/dist/index.d.mts CHANGED
@@ -13,7 +13,7 @@ type CpAmm$1 = {
13
13
  address: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG";
14
14
  metadata: {
15
15
  name: "cpAmm";
16
- version: "0.1.1";
16
+ version: "0.1.2";
17
17
  spec: "0.1.0";
18
18
  description: "Created with Anchor";
19
19
  };
@@ -658,7 +658,16 @@ type CpAmm$1 = {
658
658
  name: "program";
659
659
  }
660
660
  ];
661
- args: [];
661
+ args: [
662
+ {
663
+ name: "maxAmountA";
664
+ type: "u64";
665
+ },
666
+ {
667
+ name: "maxAmountB";
668
+ type: "u64";
669
+ }
670
+ ];
662
671
  },
663
672
  {
664
673
  name: "claimReward";
@@ -760,6 +769,10 @@ type CpAmm$1 = {
760
769
  {
761
770
  name: "rewardIndex";
762
771
  type: "u8";
772
+ },
773
+ {
774
+ name: "skipReward";
775
+ type: "u8";
763
776
  }
764
777
  ];
765
778
  },
@@ -966,6 +979,58 @@ type CpAmm$1 = {
966
979
  ];
967
980
  args: [];
968
981
  },
982
+ {
983
+ name: "closeTokenBadge";
984
+ discriminator: [108, 146, 86, 110, 179, 254, 10, 104];
985
+ accounts: [
986
+ {
987
+ name: "tokenBadge";
988
+ writable: true;
989
+ },
990
+ {
991
+ name: "admin";
992
+ writable: true;
993
+ signer: true;
994
+ },
995
+ {
996
+ name: "rentReceiver";
997
+ writable: true;
998
+ },
999
+ {
1000
+ name: "eventAuthority";
1001
+ pda: {
1002
+ seeds: [
1003
+ {
1004
+ kind: "const";
1005
+ value: [
1006
+ 95,
1007
+ 95,
1008
+ 101,
1009
+ 118,
1010
+ 101,
1011
+ 110,
1012
+ 116,
1013
+ 95,
1014
+ 97,
1015
+ 117,
1016
+ 116,
1017
+ 104,
1018
+ 111,
1019
+ 114,
1020
+ 105,
1021
+ 116,
1022
+ 121
1023
+ ];
1024
+ }
1025
+ ];
1026
+ };
1027
+ },
1028
+ {
1029
+ name: "program";
1030
+ }
1031
+ ];
1032
+ args: [];
1033
+ },
969
1034
  {
970
1035
  name: "createClaimFeeOperator";
971
1036
  discriminator: [169, 62, 207, 107, 58, 187, 162, 109];
@@ -2244,7 +2309,11 @@ type CpAmm$1 = {
2244
2309
  name: "rewardMint";
2245
2310
  },
2246
2311
  {
2247
- name: "admin";
2312
+ name: "signer";
2313
+ signer: true;
2314
+ },
2315
+ {
2316
+ name: "payer";
2248
2317
  writable: true;
2249
2318
  signer: true;
2250
2319
  },
@@ -2919,7 +2988,7 @@ type CpAmm$1 = {
2919
2988
  writable: true;
2920
2989
  },
2921
2990
  {
2922
- name: "admin";
2991
+ name: "signer";
2923
2992
  signer: true;
2924
2993
  },
2925
2994
  {
@@ -2975,7 +3044,7 @@ type CpAmm$1 = {
2975
3044
  writable: true;
2976
3045
  },
2977
3046
  {
2978
- name: "admin";
3047
+ name: "signer";
2979
3048
  signer: true;
2980
3049
  },
2981
3050
  {
@@ -3449,6 +3518,16 @@ type CpAmm$1 = {
3449
3518
  code: 6041;
3450
3519
  name: "invalidConfigType";
3451
3520
  msg: "Invalid config type";
3521
+ },
3522
+ {
3523
+ code: 6042;
3524
+ name: "invalidPoolCreator";
3525
+ msg: "Invalid pool creator";
3526
+ },
3527
+ {
3528
+ code: 6043;
3529
+ name: "rewardVaultFrozenSkipRequired";
3530
+ msg: "Reward vault is frozen, must skip reward to proceed";
3452
3531
  }
3453
3532
  ];
3454
3533
  types: [
@@ -4823,11 +4902,16 @@ type CpAmm$1 = {
4823
4902
  };
4824
4903
  };
4825
4904
  },
4905
+ {
4906
+ name: "creator";
4907
+ docs: ["pool creator"];
4908
+ type: "pubkey";
4909
+ },
4826
4910
  {
4827
4911
  name: "padding1";
4828
4912
  docs: ["Padding for further use"];
4829
4913
  type: {
4830
- array: ["u64", 10];
4914
+ array: ["u64", 6];
4831
4915
  };
4832
4916
  },
4833
4917
  {
@@ -5931,17 +6015,31 @@ type InitializeRewardParams = {
5931
6015
  rewardDuration: BN;
5932
6016
  pool: PublicKey;
5933
6017
  rewardMint: PublicKey;
6018
+ funder: PublicKey;
5934
6019
  payer: PublicKey;
6020
+ creator: PublicKey;
6021
+ rewardMintProgram?: PublicKey;
6022
+ };
6023
+ type InitializeAndFundReward = {
6024
+ rewardIndex: number;
6025
+ rewardDuration: BN;
6026
+ pool: PublicKey;
6027
+ creator: PublicKey;
6028
+ payer: PublicKey;
6029
+ rewardMint: PublicKey;
6030
+ carryForward: boolean;
6031
+ amount: BN;
6032
+ rewardMintProgram: PublicKey;
5935
6033
  };
5936
6034
  type UpdateRewardDurationParams = {
5937
6035
  pool: PublicKey;
5938
- admin: PublicKey;
6036
+ signer: PublicKey;
5939
6037
  rewardIndex: number;
5940
6038
  newDuration: BN;
5941
6039
  };
5942
6040
  type UpdateRewardFunderParams = {
5943
6041
  pool: PublicKey;
5944
- admin: PublicKey;
6042
+ signer: PublicKey;
5945
6043
  rewardIndex: number;
5946
6044
  newFunder: PublicKey;
5947
6045
  };
@@ -5973,6 +6071,7 @@ type ClaimRewardParams = {
5973
6071
  positionState: PositionState;
5974
6072
  positionNftAccount: PublicKey;
5975
6073
  rewardIndex: number;
6074
+ isSkipReward: boolean;
5976
6075
  feePayer?: PublicKey;
5977
6076
  };
5978
6077
  type RefreshVestingParams = {
@@ -6036,7 +6135,7 @@ type DynamicFeeParams = {
6036
6135
  };
6037
6136
 
6038
6137
  /**
6039
- * CpAmm SDK class to interact with the Dynamic CP-AMM
6138
+ * CpAmm SDK class to interact with the DAMM-V2
6040
6139
  */
6041
6140
  declare class CpAmm {
6042
6141
  _program: AmmProgram;
@@ -6387,6 +6486,13 @@ declare class CpAmm {
6387
6486
  * @throws {Error} If either position is locked or incompatible
6388
6487
  */
6389
6488
  mergePosition(params: MergePositionParams): TxBuilder;
6489
+ initializeReward(params: InitializeRewardParams): TxBuilder;
6490
+ /**
6491
+ * Builds a transaction to initialize reward and fund reward
6492
+ * @param {InitializeAndFundReward} params
6493
+ * @returns Transaction builder.
6494
+ */
6495
+ initializeAndFundReward(params: InitializeAndFundReward): TxBuilder;
6390
6496
  /**
6391
6497
  * Builds a transaction to update reward duration.
6392
6498
  * @param {UpdateRewardDurationParams} params - Parameters including pool and new duration.
@@ -6678,7 +6784,7 @@ declare function decimalToQ64(num: Decimal): BN;
6678
6784
  var address = "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG";
6679
6785
  var metadata = {
6680
6786
  name: "cp_amm",
6681
- version: "0.1.1",
6787
+ version: "0.1.2",
6682
6788
  spec: "0.1.0",
6683
6789
  description: "Created with Anchor"
6684
6790
  };
@@ -7477,6 +7583,14 @@ var instructions = [
7477
7583
  }
7478
7584
  ],
7479
7585
  args: [
7586
+ {
7587
+ name: "max_amount_a",
7588
+ type: "u64"
7589
+ },
7590
+ {
7591
+ name: "max_amount_b",
7592
+ type: "u64"
7593
+ }
7480
7594
  ]
7481
7595
  },
7482
7596
  {
@@ -7596,6 +7710,10 @@ var instructions = [
7596
7710
  {
7597
7711
  name: "reward_index",
7598
7712
  type: "u8"
7713
+ },
7714
+ {
7715
+ name: "skip_reward",
7716
+ type: "u8"
7599
7717
  }
7600
7718
  ]
7601
7719
  },
@@ -7840,6 +7958,68 @@ var instructions = [
7840
7958
  args: [
7841
7959
  ]
7842
7960
  },
7961
+ {
7962
+ name: "close_token_badge",
7963
+ discriminator: [
7964
+ 108,
7965
+ 146,
7966
+ 86,
7967
+ 110,
7968
+ 179,
7969
+ 254,
7970
+ 10,
7971
+ 104
7972
+ ],
7973
+ accounts: [
7974
+ {
7975
+ name: "token_badge",
7976
+ writable: true
7977
+ },
7978
+ {
7979
+ name: "admin",
7980
+ writable: true,
7981
+ signer: true
7982
+ },
7983
+ {
7984
+ name: "rent_receiver",
7985
+ writable: true
7986
+ },
7987
+ {
7988
+ name: "event_authority",
7989
+ pda: {
7990
+ seeds: [
7991
+ {
7992
+ kind: "const",
7993
+ value: [
7994
+ 95,
7995
+ 95,
7996
+ 101,
7997
+ 118,
7998
+ 101,
7999
+ 110,
8000
+ 116,
8001
+ 95,
8002
+ 97,
8003
+ 117,
8004
+ 116,
8005
+ 104,
8006
+ 111,
8007
+ 114,
8008
+ 105,
8009
+ 116,
8010
+ 121
8011
+ ]
8012
+ }
8013
+ ]
8014
+ }
8015
+ },
8016
+ {
8017
+ name: "program"
8018
+ }
8019
+ ],
8020
+ args: [
8021
+ ]
8022
+ },
7843
8023
  {
7844
8024
  name: "create_claim_fee_operator",
7845
8025
  discriminator: [
@@ -9445,7 +9625,11 @@ var instructions = [
9445
9625
  name: "reward_mint"
9446
9626
  },
9447
9627
  {
9448
- name: "admin",
9628
+ name: "signer",
9629
+ signer: true
9630
+ },
9631
+ {
9632
+ name: "payer",
9449
9633
  writable: true,
9450
9634
  signer: true
9451
9635
  },
@@ -10295,7 +10479,7 @@ var instructions = [
10295
10479
  writable: true
10296
10480
  },
10297
10481
  {
10298
- name: "admin",
10482
+ name: "signer",
10299
10483
  signer: true
10300
10484
  },
10301
10485
  {
@@ -10360,7 +10544,7 @@ var instructions = [
10360
10544
  writable: true
10361
10545
  },
10362
10546
  {
10363
- name: "admin",
10547
+ name: "signer",
10364
10548
  signer: true
10365
10549
  },
10366
10550
  {
@@ -11113,6 +11297,16 @@ var errors = [
11113
11297
  code: 6041,
11114
11298
  name: "InvalidConfigType",
11115
11299
  msg: "Invalid config type"
11300
+ },
11301
+ {
11302
+ code: 6042,
11303
+ name: "InvalidPoolCreator",
11304
+ msg: "Invalid pool creator"
11305
+ },
11306
+ {
11307
+ code: 6043,
11308
+ name: "RewardVaultFrozenSkipRequired",
11309
+ msg: "Reward vault is frozen, must skip reward to proceed"
11116
11310
  }
11117
11311
  ];
11118
11312
  var types = [
@@ -12637,6 +12831,13 @@ var types = [
12637
12831
  }
12638
12832
  }
12639
12833
  },
12834
+ {
12835
+ name: "creator",
12836
+ docs: [
12837
+ "pool creator"
12838
+ ],
12839
+ type: "pubkey"
12840
+ },
12640
12841
  {
12641
12842
  name: "_padding_1",
12642
12843
  docs: [
@@ -12645,7 +12846,7 @@ var types = [
12645
12846
  type: {
12646
12847
  array: [
12647
12848
  "u64",
12648
- 10
12849
+ 6
12649
12850
  ]
12650
12851
  }
12651
12852
  },
@@ -13471,4 +13672,4 @@ var CpAmmIDL = {
13471
13672
  types: types
13472
13673
  };
13473
13674
 
13474
- export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, BIN_STEP_BPS_DEFAULT, BIN_STEP_BPS_U128_DEFAULT, type BaseFee, type BuildAddLiquidityParams, type BuildLiquidatePositionInstructionParams, type BuildRemoveAllLiquidityInstructionParams, CP_AMM_PROGRAM_ID, type ClaimPartnerFeeParams, type ClaimPositionFeeInstructionParams, type ClaimPositionFeeParams, type ClaimPositionFeeParams2, type ClaimRewardParams, type ClosePositionInstructionParams, type ClosePositionParams, CollectFeeMode, type ConfigState, CpAmm, type CpAmm$1 as CpAmmTypes, type CreatePoolParams, type CreatePositionAndAddLiquidity, type CreatePositionParams, DYNAMIC_FEE_DECAY_PERIOD_DEFAULT, DYNAMIC_FEE_FILTER_PERIOD_DEFAULT, DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT, type DepositQuote, type DynamicFee, type DynamicFeeParams, FEE_DENOMINATOR, type FeeMode, FeeSchedulerMode, type FundRewardParams, type GetDepositQuoteParams, type GetQuoteParams, type GetWithdrawQuoteParams, type InitializeCustomizeablePoolParams, type InitializeCustomizeablePoolWithDynamicConfigParams, type InitializeRewardParams, LIQUIDITY_SCALE, type LiquidityDeltaParams, type LockPositionParams, MAX_CU_BUFFER, MAX_FEE_NUMERATOR, MAX_PRICE_CHANGE_BPS_DEFAULT, MAX_SQRT_PRICE, MIN_CU_BUFFER, MIN_SQRT_PRICE, type MergePositionParams, ONE, type PermanentLockParams, type PoolFeesParams, type PoolState, type PositionState, type PrepareCustomizablePoolParams, type PreparePoolCreationParams, type PreparePoolCreationSingleSide, type PrepareTokenAccountParams, type PreparedPoolCreation, type RefreshVestingParams, type RemoveAllLiquidityAndClosePositionParams, type RemoveAllLiquidityParams, type RemoveLiquidityParams, type RewardInfo, Rounding, SCALE_OFFSET, type SetupFeeClaimAccountsParams, type SwapParams, type SwapQuotes, type TokenBadgeState, TradeDirection, type TxBuilder, type UpdateRewardDurationParams, type UpdateRewardFunderParams, type VestingState, type WithdrawIneligibleRewardParams, type WithdrawQuote, bpsToFeeNumerator, calculateInitSqrtPrice, calculateTransferFeeExcludedAmount, calculateTransferFeeIncludedAmount, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadgeAddress, deriveTokenVaultAddress, feeNumeratorToBps, getAllPositionNftAccountByOwner, getAllUserPositionNftAccount, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getAvailableVestingLiquidity, getBaseFeeNumerator, getBaseFeeParams, getDynamicFeeNumerator, getDynamicFeeParams, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getOrCreateATAInstruction, getPriceFromSqrtPrice, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSqrtPriceFromPrice, getSwapAmount, getTokenDecimals, getTokenProgram, getTotalLockedLiquidity, getUnClaimReward, isVestingComplete, mulDiv, positionByPoolFilter, pow, q64ToDecimal, unwrapSOLInstruction, vestingByPositionFilter, wrapSOLInstruction };
13675
+ export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, BIN_STEP_BPS_DEFAULT, BIN_STEP_BPS_U128_DEFAULT, type BaseFee, type BuildAddLiquidityParams, type BuildLiquidatePositionInstructionParams, type BuildRemoveAllLiquidityInstructionParams, CP_AMM_PROGRAM_ID, type ClaimPartnerFeeParams, type ClaimPositionFeeInstructionParams, type ClaimPositionFeeParams, type ClaimPositionFeeParams2, type ClaimRewardParams, type ClosePositionInstructionParams, type ClosePositionParams, CollectFeeMode, type ConfigState, CpAmm, type CpAmm$1 as CpAmmTypes, type CreatePoolParams, type CreatePositionAndAddLiquidity, type CreatePositionParams, DYNAMIC_FEE_DECAY_PERIOD_DEFAULT, DYNAMIC_FEE_FILTER_PERIOD_DEFAULT, DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT, type DepositQuote, type DynamicFee, type DynamicFeeParams, FEE_DENOMINATOR, type FeeMode, FeeSchedulerMode, type FundRewardParams, type GetDepositQuoteParams, type GetQuoteParams, type GetWithdrawQuoteParams, type InitializeAndFundReward, type InitializeCustomizeablePoolParams, type InitializeCustomizeablePoolWithDynamicConfigParams, type InitializeRewardParams, LIQUIDITY_SCALE, type LiquidityDeltaParams, type LockPositionParams, MAX_CU_BUFFER, MAX_FEE_NUMERATOR, MAX_PRICE_CHANGE_BPS_DEFAULT, MAX_SQRT_PRICE, MIN_CU_BUFFER, MIN_SQRT_PRICE, type MergePositionParams, ONE, type PermanentLockParams, type PoolFeesParams, type PoolState, type PositionState, type PrepareCustomizablePoolParams, type PreparePoolCreationParams, type PreparePoolCreationSingleSide, type PrepareTokenAccountParams, type PreparedPoolCreation, type RefreshVestingParams, type RemoveAllLiquidityAndClosePositionParams, type RemoveAllLiquidityParams, type RemoveLiquidityParams, type RewardInfo, Rounding, SCALE_OFFSET, type SetupFeeClaimAccountsParams, type SwapParams, type SwapQuotes, type TokenBadgeState, TradeDirection, type TxBuilder, type UpdateRewardDurationParams, type UpdateRewardFunderParams, type VestingState, type WithdrawIneligibleRewardParams, type WithdrawQuote, bpsToFeeNumerator, calculateInitSqrtPrice, calculateTransferFeeExcludedAmount, calculateTransferFeeIncludedAmount, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadgeAddress, deriveTokenVaultAddress, feeNumeratorToBps, getAllPositionNftAccountByOwner, getAllUserPositionNftAccount, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getAvailableVestingLiquidity, getBaseFeeNumerator, getBaseFeeParams, getDynamicFeeNumerator, getDynamicFeeParams, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getOrCreateATAInstruction, getPriceFromSqrtPrice, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSqrtPriceFromPrice, getSwapAmount, getTokenDecimals, getTokenProgram, getTotalLockedLiquidity, getUnClaimReward, isVestingComplete, mulDiv, positionByPoolFilter, pow, q64ToDecimal, unwrapSOLInstruction, vestingByPositionFilter, wrapSOLInstruction };