import { MintInfo, AccountInfo, u64 } from '@solana/spl-token'; import { PublicKey, Connection } from '@solana/web3.js'; import { AnchorTypes } from '@cremafinance/anchor-contrib'; import * as BN from 'bn.js'; import BN__default from 'bn.js'; import * as anchor from '@project-serum/anchor'; import { BN as BN$1, Address } from '@project-serum/anchor'; import Decimal from 'decimal.js'; type clmmpool = { "version": "0.1.0"; "name": "clmmpool"; "instructions": [ { "name": "initializeClmmConfig"; "accounts": [ { "name": "payer"; "isMut": true; "isSigner": true; }, { "name": "clmmConfig"; "isMut": true; "isSigner": false; }, { "name": "rent"; "isMut": false; "isSigner": false; }, { "name": "systemProgram"; "isMut": false; "isSigner": false; } ]; "args": [ { "name": "protocolAuthority"; "type": "publicKey"; }, { "name": "protocolFeeClaimAuthority"; "type": "publicKey"; }, { "name": "createPoolAuthority"; "type": "publicKey"; }, { "name": "protocolFeeRate"; "type": "u16"; } ]; }, { "name": "createFeeTier"; "accounts": [ { "name": "payer"; "isMut": true; "isSigner": true; }, { "name": "clmmConfig"; "isMut": false; "isSigner": false; }, { "name": "feeTier"; "isMut": true; "isSigner": false; }, { "name": "protocolAuthority"; "isMut": false; "isSigner": true; }, { "name": "rent"; "isMut": false; "isSigner": false; }, { "name": "systemProgram"; "isMut": false; "isSigner": false; } ]; "args": [ { "name": "tickSpacing"; "type": "u16"; }, { "name": "feeRate"; "type": "u16"; } ]; }, { "name": "updateConfig"; "accounts": [ { "name": "clmmConfig"; "isMut": true; "isSigner": false; }, { "name": "protocolAuthority"; "isMut": false; "isSigner": true; } ]; "args": [ { "name": "newProtocolFeeRate"; "type": { "option": "u16"; }; }, { "name": "createPoolAuthority"; "type": { "option": "publicKey"; }; }, { "name": "claimAuthority"; "type": { "option": "publicKey"; }; } ]; }, { "name": "updateFeeRate"; "accounts": [ { "name": "protocolAuthority"; "isMut": false; "isSigner": true; }, { "name": "clmmConfig"; "isMut": false; "isSigner": false; }, { "name": "clmmpool"; "isMut": true; "isSigner": false; } ]; "args": [ { "name": "newFeeRate"; "type": "u16"; } ]; }, { "name": "transferProtocolAuthority"; "accounts": [ { "name": "protocolAuthority"; "isMut": false; "isSigner": true; }, { "name": "clmmConfig"; "isMut": true; "isSigner": false; }, { "name": "newAuthority"; "isMut": false; "isSigner": false; } ]; "args": []; }, { "name": "acceptProtocolAuthority"; "accounts": [ { "name": "newAuthority"; "isMut": false; "isSigner": true; }, { "name": "clmmConfig"; "isMut": true; "isSigner": false; } ]; "args": []; }, { "name": "createClmmpool"; "accounts": [ { "name": "payer"; "isMut": true; "isSigner": true; }, { "name": "clmmConfig"; "isMut": false; "isSigner": false; }, { "name": "feeTier"; "isMut": false; "isSigner": false; }, { "name": "clmmpool"; "isMut": true; "isSigner": false; }, { "name": "tokenA"; "isMut": false; "isSigner": false; }, { "name": "tokenB"; "isMut": false; "isSigner": false; }, { "name": "tokenAVault"; "isMut": true; "isSigner": false; }, { "name": "tokenBVault"; "isMut": true; "isSigner": false; }, { "name": "tokenProgram"; "isMut": false; "isSigner": false; }, { "name": "associatedTokenProgram"; "isMut": false; "isSigner": false; }, { "name": "systemProgram"; "isMut": false; "isSigner": false; }, { "name": "rent"; "isMut": false; "isSigner": false; } ]; "args": [ { "name": "initSqrtPrice"; "type": "u128"; } ]; }, { "name": "createTickArray"; "accounts": [ { "name": "payer"; "isMut": true; "isSigner": true; }, { "name": "clmmpool"; "isMut": false; "isSigner": false; }, { "name": "tickArray"; "isMut": true; "isSigner": false; }, { "name": "systemProgram"; "isMut": false; "isSigner": false; }, { "name": "rent"; "isMut": false; "isSigner": false; } ]; "args": [ { "name": "arrayIndex"; "type": "u16"; } ]; }, { "name": "createTickArrayMap"; "accounts": [ { "name": "payer"; "isMut": true; "isSigner": true; }, { "name": "clmmpool"; "isMut": false; "isSigner": false; }, { "name": "tickArrayMap"; "isMut": true; "isSigner": false; }, { "name": "systemProgram"; "isMut": false; "isSigner": false; }, { "name": "rent"; "isMut": false; "isSigner": false; } ]; "args": []; }, { "name": "openPosition"; "accounts": [ { "name": "owner"; "isMut": true; "isSigner": true; }, { "name": "clmmpool"; "isMut": false; "isSigner": false; }, { "name": "position"; "isMut": true; "isSigner": false; }, { "name": "positionNftMint"; "isMut": true; "isSigner": true; }, { "name": "positionMetadataAccount"; "isMut": true; "isSigner": false; }, { "name": "positionEdition"; "isMut": true; "isSigner": false; }, { "name": "positionAta"; "isMut": true; "isSigner": false; }, { "name": "tokenProgram"; "isMut": false; "isSigner": false; }, { "name": "associatedTokenProgram"; "isMut": false; "isSigner": false; }, { "name": "metadataProgram"; "isMut": false; "isSigner": false; }, { "name": "systemProgram"; "isMut": false; "isSigner": false; }, { "name": "rent"; "isMut": false; "isSigner": false; } ]; "args": [ { "name": "tickLowerIndex"; "type": "i32"; }, { "name": "tickUpperIndex"; "type": "i32"; } ]; }, { "name": "removePosition"; "accounts": [ { "name": "owner"; "isMut": true; "isSigner": true; }, { "name": "position"; "isMut": true; "isSigner": false; }, { "name": "positionNftMint"; "isMut": true; "isSigner": false; }, { "name": "positionAta"; "isMut": true; "isSigner": false; }, { "name": "positionMetadataAccount"; "isMut": true; "isSigner": false; }, { "name": "positionEdition"; "isMut": true; "isSigner": false; }, { "name": "tokenProgram"; "isMut": false; "isSigner": false; }, { "name": "metadataProgram"; "isMut": false; "isSigner": false; } ]; "args": []; }, { "name": "increaseLiquidity"; "accounts": [ { "name": "owner"; "isMut": true; "isSigner": true; }, { "name": "clmmpool"; "isMut": true; "isSigner": false; }, { "name": "position"; "isMut": true; "isSigner": false; }, { "name": "positionAta"; "isMut": false; "isSigner": false; }, { "name": "tokenAAta"; "isMut": true; "isSigner": false; }, { "name": "tokenBAta"; "isMut": true; "isSigner": false; }, { "name": "tokenAVault"; "isMut": true; "isSigner": false; }, { "name": "tokenBVault"; "isMut": true; "isSigner": false; }, { "name": "tickArrayLower"; "isMut": true; "isSigner": false; }, { "name": "tickArrayUpper"; "isMut": true; "isSigner": false; }, { "name": "tickArrayMap"; "isMut": true; "isSigner": false; }, { "name": "tokenProgram"; "isMut": false; "isSigner": false; } ]; "args": [ { "name": "deltaLiquidity"; "type": "u128"; }, { "name": "tokenAMax"; "type": "u64"; }, { "name": "tokenBMax"; "type": "u64"; } ]; }, { "name": "increaseLiquidityWithFixedToken"; "accounts": [ { "name": "owner"; "isMut": true; "isSigner": true; }, { "name": "clmmpool"; "isMut": true; "isSigner": false; }, { "name": "position"; "isMut": true; "isSigner": false; }, { "name": "positionAta"; "isMut": false; "isSigner": false; }, { "name": "tokenAAta"; "isMut": true; "isSigner": false; }, { "name": "tokenBAta"; "isMut": true; "isSigner": false; }, { "name": "tokenAVault"; "isMut": true; "isSigner": false; }, { "name": "tokenBVault"; "isMut": true; "isSigner": false; }, { "name": "tickArrayLower"; "isMut": true; "isSigner": false; }, { "name": "tickArrayUpper"; "isMut": true; "isSigner": false; }, { "name": "tickArrayMap"; "isMut": true; "isSigner": false; }, { "name": "tokenProgram"; "isMut": false; "isSigner": false; } ]; "args": [ { "name": "tokenA"; "type": "u64"; }, { "name": "tokenB"; "type": "u64"; }, { "name": "isAFixed"; "type": "bool"; } ]; }, { "name": "decreaseLiquidity"; "accounts": [ { "name": "owner"; "isMut": false; "isSigner": true; }, { "name": "clmmpool"; "isMut": true; "isSigner": false; }, { "name": "position"; "isMut": true; "isSigner": false; }, { "name": "positionAta"; "isMut": false; "isSigner": false; }, { "name": "tokenAAta"; "isMut": true; "isSigner": false; }, { "name": "tokenBAta"; "isMut": true; "isSigner": false; }, { "name": "tokenAVault"; "isMut": true; "isSigner": false; }, { "name": "tokenBVault"; "isMut": true; "isSigner": false; }, { "name": "tickArrayLower"; "isMut": true; "isSigner": false; }, { "name": "tickArrayUpper"; "isMut": true; "isSigner": false; }, { "name": "tickArrayMap"; "isMut": true; "isSigner": false; }, { "name": "tokenProgram"; "isMut": false; "isSigner": false; } ]; "args": [ { "name": "deltaLiquidity"; "type": "u128"; }, { "name": "tokenAMin"; "type": "u64"; }, { "name": "tokenBMin"; "type": "u64"; } ]; }, { "name": "swap"; "accounts": [ { "name": "clmmConfig"; "isMut": false; "isSigner": false; }, { "name": "clmmpool"; "isMut": true; "isSigner": false; }, { "name": "tokenA"; "isMut": false; "isSigner": false; }, { "name": "tokenB"; "isMut": false; "isSigner": false; }, { "name": "accountA"; "isMut": true; "isSigner": false; }, { "name": "accountB"; "isMut": true; "isSigner": false; }, { "name": "tokenAVault"; "isMut": true; "isSigner": false; }, { "name": "tokenBVault"; "isMut": true; "isSigner": false; }, { "name": "tickArrayMap"; "isMut": true; "isSigner": false; }, { "name": "owner"; "isMut": false; "isSigner": true; }, { "name": "tokenProgram"; "isMut": false; "isSigner": false; } ]; "args": [ { "name": "aToB"; "type": "bool"; }, { "name": "byAmountIn"; "type": "bool"; }, { "name": "amount"; "type": "u64"; }, { "name": "amountLimit"; "type": "u64"; }, { "name": "sqrtPriceLimit"; "type": "u128"; } ]; }, { "name": "collectFee"; "accounts": [ { "name": "owner"; "isMut": false; "isSigner": true; }, { "name": "clmmpool"; "isMut": false; "isSigner": false; }, { "name": "position"; "isMut": true; "isSigner": false; }, { "name": "positionAta"; "isMut": false; "isSigner": false; }, { "name": "tokenAAta"; "isMut": true; "isSigner": false; }, { "name": "tokenBAta"; "isMut": true; "isSigner": false; }, { "name": "tokenAVault"; "isMut": true; "isSigner": false; }, { "name": "tokenBVault"; "isMut": true; "isSigner": false; }, { "name": "tickArrayLower"; "isMut": false; "isSigner": false; }, { "name": "tickArrayUpper"; "isMut": false; "isSigner": false; }, { "name": "tokenProgram"; "isMut": false; "isSigner": false; } ]; "args": []; }, { "name": "collectProtocolFee"; "accounts": [ { "name": "protocolFeeClaimAuthority"; "isMut": false; "isSigner": true; }, { "name": "clmmConfig"; "isMut": false; "isSigner": false; }, { "name": "clmmpool"; "isMut": true; "isSigner": false; }, { "name": "tokenAAta"; "isMut": true; "isSigner": false; }, { "name": "tokenBAta"; "isMut": true; "isSigner": false; }, { "name": "tokenAVault"; "isMut": true; "isSigner": false; }, { "name": "tokenBVault"; "isMut": true; "isSigner": false; }, { "name": "tokenProgram"; "isMut": false; "isSigner": false; } ]; "args": []; }, { "name": "createPartner"; "accounts": [ { "name": "payer"; "isMut": true; "isSigner": true; }, { "name": "clmmConfig"; "isMut": false; "isSigner": false; }, { "name": "protocolAuthority"; "isMut": false; "isSigner": true; }, { "name": "base"; "isMut": false; "isSigner": true; }, { "name": "partner"; "isMut": true; "isSigner": false; }, { "name": "rent"; "isMut": false; "isSigner": false; }, { "name": "systemProgram"; "isMut": false; "isSigner": false; } ]; "args": [ { "name": "partnerFeeClaimAuthority"; "type": "publicKey"; }, { "name": "feeRate"; "type": "u16"; }, { "name": "startTime"; "type": "u64"; }, { "name": "endTime"; "type": "u64"; }, { "name": "name"; "type": "string"; } ]; }, { "name": "updatePartner"; "accounts": [ { "name": "clmmConfig"; "isMut": false; "isSigner": false; }, { "name": "partner"; "isMut": true; "isSigner": false; }, { "name": "authority"; "isMut": false; "isSigner": true; } ]; "args": [ { "name": "newFeeRate"; "type": { "option": "u16"; }; }, { "name": "newClaimAuthority"; "type": { "option": "publicKey"; }; }, { "name": "startTime"; "type": { "option": "u64"; }; }, { "name": "endTime"; "type": { "option": "u64"; }; } ]; }, { "name": "collectPartnerFee"; "accounts": [ { "name": "partnerFeeClaimAuthority"; "isMut": false; "isSigner": true; }, { "name": "partner"; "isMut": false; "isSigner": false; }, { "name": "clmmpool"; "isMut": false; "isSigner": false; }, { "name": "tokenAAta"; "isMut": true; "isSigner": false; }, { "name": "tokenBAta"; "isMut": true; "isSigner": false; }, { "name": "tokenAPartnerFeeVault"; "isMut": true; "isSigner": false; }, { "name": "tokenBPartnerFeeVault"; "isMut": true; "isSigner": false; }, { "name": "tokenProgram"; "isMut": false; "isSigner": false; } ]; "args": []; }, { "name": "swapWithPartner"; "accounts": [ { "name": "clmmConfig"; "isMut": false; "isSigner": false; }, { "name": "clmmpool"; "isMut": true; "isSigner": false; }, { "name": "tokenA"; "isMut": false; "isSigner": false; }, { "name": "tokenB"; "isMut": false; "isSigner": false; }, { "name": "accountA"; "isMut": true; "isSigner": false; }, { "name": "accountB"; "isMut": true; "isSigner": false; }, { "name": "tokenAVault"; "isMut": true; "isSigner": false; }, { "name": "tokenBVault"; "isMut": true; "isSigner": false; }, { "name": "tickArrayMap"; "isMut": true; "isSigner": false; }, { "name": "owner"; "isMut": false; "isSigner": true; }, { "name": "partner"; "isMut": false; "isSigner": false; }, { "name": "partnerAtaA"; "isMut": true; "isSigner": false; }, { "name": "partnerAtaB"; "isMut": true; "isSigner": false; }, { "name": "tokenProgram"; "isMut": false; "isSigner": false; } ]; "args": [ { "name": "aToB"; "type": "bool"; }, { "name": "byAmountIn"; "type": "bool"; }, { "name": "amount"; "type": "u64"; }, { "name": "amountLimit"; "type": "u64"; }, { "name": "sqrtPriceLimit"; "type": "u128"; } ]; }, { "name": "initializeRewarder"; "accounts": [ { "name": "payer"; "isMut": true; "isSigner": true; }, { "name": "clmmConfig"; "isMut": false; "isSigner": false; }, { "name": "clmmpool"; "isMut": true; "isSigner": false; }, { "name": "rewarderAuthority"; "isMut": false; "isSigner": true; }, { "name": "rewarderTokenMint"; "isMut": false; "isSigner": false; }, { "name": "tokenProgram"; "isMut": false; "isSigner": false; }, { "name": "systemProgram"; "isMut": false; "isSigner": false; }, { "name": "rent"; "isMut": false; "isSigner": false; } ]; "args": [ { "name": "rewarderIndex"; "type": "u8"; }, { "name": "mintWrapper"; "type": "publicKey"; }, { "name": "minter"; "type": "publicKey"; } ]; }, { "name": "updateRewarderEmission"; "accounts": [ { "name": "rewarderAuthority"; "isMut": false; "isSigner": true; }, { "name": "clmmConfig"; "isMut": false; "isSigner": false; }, { "name": "clmmpool"; "isMut": true; "isSigner": false; } ]; "args": [ { "name": "rewarderIndex"; "type": "u8"; }, { "name": "emissionsPerSecond"; "type": "u128"; } ]; }, { "name": "collectRewarder"; "accounts": [ { "name": "owner"; "isMut": false; "isSigner": true; }, { "name": "clmmpool"; "isMut": true; "isSigner": false; }, { "name": "position"; "isMut": true; "isSigner": false; }, { "name": "positionAta"; "isMut": false; "isSigner": false; }, { "name": "rewarderAta"; "isMut": true; "isSigner": false; }, { "name": "mintWrapper"; "isMut": true; "isSigner": false; }, { "name": "minter"; "isMut": true; "isSigner": false; }, { "name": "mintWrapperProgram"; "isMut": false; "isSigner": false; }, { "name": "rewardsTokenMint"; "isMut": true; "isSigner": false; }, { "name": "tickArrayLower"; "isMut": false; "isSigner": false; }, { "name": "tickArrayUpper"; "isMut": false; "isSigner": false; }, { "name": "tokenProgram"; "isMut": false; "isSigner": false; } ]; "args": [ { "name": "rewarderIndex"; "type": "u8"; } ]; }, { "name": "transferPartnerClaimAuthority"; "accounts": [ { "name": "partnerClaimAuthority"; "isMut": false; "isSigner": true; }, { "name": "partner"; "isMut": true; "isSigner": false; }, { "name": "newAuthority"; "isMut": false; "isSigner": false; } ]; "args": []; }, { "name": "acceptPartnerClaimAuthority"; "accounts": [ { "name": "newAuthority"; "isMut": false; "isSigner": true; }, { "name": "partner"; "isMut": true; "isSigner": false; } ]; "args": []; }, { "name": "pauseClmmpool"; "accounts": [ { "name": "clmmConfig"; "isMut": false; "isSigner": false; }, { "name": "protocolAuthority"; "isMut": false; "isSigner": true; }, { "name": "clmmpool"; "isMut": true; "isSigner": false; } ]; "args": []; }, { "name": "unpauseClmmpool"; "accounts": [ { "name": "clmmConfig"; "isMut": false; "isSigner": false; }, { "name": "protocolAuthority"; "isMut": false; "isSigner": true; }, { "name": "clmmpool"; "isMut": true; "isSigner": false; } ]; "args": []; }, { "name": "createClmmpoolMetadata"; "accounts": [ { "name": "payer"; "isMut": true; "isSigner": true; }, { "name": "clmmConfig"; "isMut": false; "isSigner": false; }, { "name": "clmmpool"; "isMut": false; "isSigner": false; }, { "name": "clmmpoolMetadata"; "isMut": true; "isSigner": false; }, { "name": "protocolAuthority"; "isMut": false; "isSigner": true; }, { "name": "rent"; "isMut": false; "isSigner": false; }, { "name": "systemProgram"; "isMut": false; "isSigner": false; } ]; "args": [ { "name": "name"; "type": "string"; }, { "name": "uri"; "type": "string"; } ]; } ]; "accounts": [ { "name": "clmmConfig"; "type": { "kind": "struct"; "fields": [ { "name": "protocolAuthority"; "type": "publicKey"; }, { "name": "protocolFeeClaimAuthority"; "type": "publicKey"; }, { "name": "protocolFeeRate"; "type": "u16"; }, { "name": "pendingAuthority"; "type": "publicKey"; }, { "name": "createPoolAuthority"; "type": "publicKey"; } ]; }; }, { "name": "clmmpoolMetadata"; "type": { "kind": "struct"; "fields": [ { "name": "clmmpool"; "type": "publicKey"; }, { "name": "positionNums"; "type": "u64"; }, { "name": "name"; "type": "string"; }, { "name": "symbol"; "type": "string"; }, { "name": "uri"; "type": "string"; } ]; }; }, { "name": "clmmpool"; "type": { "kind": "struct"; "fields": [ { "name": "clmmConfig"; "type": "publicKey"; }, { "name": "tokenA"; "type": "publicKey"; }, { "name": "tokenB"; "type": "publicKey"; }, { "name": "tokenAVault"; "type": "publicKey"; }, { "name": "tokenBVault"; "type": "publicKey"; }, { "name": "tickSpacing"; "type": "u16"; }, { "name": "tickSpacingSeed"; "type": { "array": [ "u8", 2 ]; }; }, { "name": "feeRate"; "type": "u16"; }, { "name": "liquidity"; "type": "u128"; }, { "name": "currentSqrtPrice"; "type": "u128"; }, { "name": "currentTickIndex"; "type": "i32"; }, { "name": "feeGrowthGlobalA"; "type": "u128"; }, { "name": "feeGrowthGlobalB"; "type": "u128"; }, { "name": "feeProtocolTokenA"; "type": "u64"; }, { "name": "feeProtocolTokenB"; "type": "u64"; }, { "name": "bump"; "type": { "array": [ "u8", 1 ]; }; }, { "name": "rewarderInfos"; "type": { "array": [ { "defined": "Rewarder"; }, 3 ]; }; }, { "name": "rewarderLastUpdatedTime"; "type": "u64"; }, { "name": "isPause"; "type": "bool"; } ]; }; }, { "name": "feeTier"; "type": { "kind": "struct"; "fields": [ { "name": "feeRate"; "type": "u16"; }, { "name": "tickSpacing"; "type": "u16"; }, { "name": "bump"; "type": "u8"; } ]; }; }, { "name": "partner"; "type": { "kind": "struct"; "fields": [ { "name": "partnerFeeClaimAuthority"; "type": "publicKey"; }, { "name": "pendingAuthority"; "type": "publicKey"; }, { "name": "base"; "type": "publicKey"; }, { "name": "feeRate"; "type": "u16"; }, { "name": "bump"; "type": { "array": [ "u8", 1 ]; }; }, { "name": "startTime"; "type": "u64"; }, { "name": "endTime"; "type": "u64"; }, { "name": "name"; "type": "string"; } ]; }; }, { "name": "position"; "type": { "kind": "struct"; "fields": [ { "name": "clmmpool"; "type": "publicKey"; }, { "name": "positionNftMint"; "type": "publicKey"; }, { "name": "liquidity"; "type": "u128"; }, { "name": "tickLowerIndex"; "type": "i32"; }, { "name": "tickUpperIndex"; "type": "i32"; }, { "name": "feeGrowthInsideA"; "type": "u128"; }, { "name": "feeOwedA"; "type": "u64"; }, { "name": "feeGrowthInsideB"; "type": "u128"; }, { "name": "feeOwedB"; "type": "u64"; }, { "name": "rewarderInfos"; "type": { "array": [ { "defined": "PositionReward"; }, 3 ]; }; } ]; }; }, { "name": "tickArray"; "type": { "kind": "struct"; "fields": [ { "name": "arrayIndex"; "type": "u16"; }, { "name": "tickSpacing"; "type": "u16"; }, { "name": "clmmpool"; "type": "publicKey"; }, { "name": "ticks"; "type": { "array": [ { "defined": "Tick"; }, 64 ]; }; } ]; }; }, { "name": "tickArrayMap"; "type": { "kind": "struct"; "fields": [ { "name": "bitmap"; "type": { "array": [ "u8", 868 ]; }; } ]; }; } ]; "types": [ { "name": "Rewarder"; "type": { "kind": "struct"; "fields": [ { "name": "mintWrapper"; "type": "publicKey"; }, { "name": "minter"; "type": "publicKey"; }, { "name": "mint"; "type": "publicKey"; }, { "name": "authority"; "type": "publicKey"; }, { "name": "emissionsPerSecond"; "type": "u128"; }, { "name": "growthGlobal"; "type": "u128"; } ]; }; }, { "name": "PositionReward"; "type": { "kind": "struct"; "fields": [ { "name": "growthInside"; "type": "u128"; }, { "name": "amountOwed"; "type": "u64"; } ]; }; }, { "name": "Tick"; "type": { "kind": "struct"; "fields": [ { "name": "isInitialized"; "type": "bool"; }, { "name": "index"; "type": "i32"; }, { "name": "sqrtPrice"; "type": "u128"; }, { "name": "liquidityNet"; "type": "i128"; }, { "name": "liquidityGross"; "type": "u128"; }, { "name": "feeGrowthOutsideA"; "type": "u128"; }, { "name": "feeGrowthOutsideB"; "type": "u128"; }, { "name": "rewardGrowthOutside"; "type": { "array": [ "u128", 3 ]; }; } ]; }; }, { "name": "ErrorCode"; "type": { "kind": "enum"; "variants": [ { "name": "LOK"; }, { "name": "NumberCastError"; }, { "name": "ZeroMintAmount"; }, { "name": "IntegerDowncastOverflow"; }, { "name": "MultiplicationOverflow"; }, { "name": "DivisorIsZero"; }, { "name": "TokenAmountMinSubceeded"; }, { "name": "TokenAmountMaxExceeded"; }, { "name": "SqrtPriceOutOfBounds"; }, { "name": "ProtocolFeeRateIllegal"; }, { "name": "FeeRateIllegal"; }, { "name": "TokenMintPairIllgal"; }, { "name": "TickArrayStartIndexIllegal"; }, { "name": "InvalidTickSpacing"; }, { "name": "InvalidTickIndex"; }, { "name": "InvalidTickArrayAccount"; }, { "name": "PositionIsNotEmpty"; }, { "name": "InvalidTokenAccountOwner"; }, { "name": "TickNotFound"; }, { "name": "TickNotInArray"; }, { "name": "InvalidTokenAccount"; }, { "name": "InvalidMint"; }, { "name": "InvalidAuthority"; }, { "name": "PositionAndClmmpoolNotMatch"; }, { "name": "PositionIllegal"; }, { "name": "InvalidDeltaLiquidity"; }, { "name": "ConfigAndPoolNotMatch"; }, { "name": "WrongSqrtPriceLimit"; }, { "name": "TickArrayNotFound"; }, { "name": "InvalidTickArrayIndex"; }, { "name": "NextTickNotFound"; }, { "name": "FeeGrowthIllegal"; }, { "name": "LiquidityOverflow"; }, { "name": "LiquidityUnderflow"; }, { "name": "RemainerAmountUnderflow"; }, { "name": "SwapAmountInOverflow"; }, { "name": "SwapAmountOutOverflow"; }, { "name": "SwapFeeAmountOverflow"; }, { "name": "InvalidTime"; }, { "name": "AmountInAboveMaximumLimit"; }, { "name": "AmountOutBelowMaximumLimit"; }, { "name": "InvalidFixedTokenType"; }, { "name": "InvalidRewarderIndex"; }, { "name": "InvalidPartner"; }, { "name": "InvalidClmmpoolStatus"; }, { "name": "InvalidClmmpoolMetadataAccount"; } ]; }; } ]; "events": [ { "name": "AcceptPartnerClaimAuthorityEvent"; "fields": [ { "name": "newAuthority"; "type": "publicKey"; "index": false; }, { "name": "partner"; "type": "publicKey"; "index": false; }, { "name": "oldAuthority"; "type": "publicKey"; "index": false; } ]; }, { "name": "AcceptProtocolAuthorityEvent"; "fields": [ { "name": "newAuthority"; "type": "publicKey"; "index": false; }, { "name": "config"; "type": "publicKey"; "index": false; }, { "name": "oldAuthority"; "type": "publicKey"; "index": false; } ]; }, { "name": "CollectFeeEvent"; "fields": [ { "name": "pool"; "type": "publicKey"; "index": false; }, { "name": "owner"; "type": "publicKey"; "index": false; }, { "name": "positionNftMint"; "type": "publicKey"; "index": false; }, { "name": "amountA"; "type": "u64"; "index": false; }, { "name": "amountB"; "type": "u64"; "index": false; } ]; }, { "name": "CollectPartnerFeeEvent"; "fields": [ { "name": "claimAuthority"; "type": "publicKey"; "index": false; }, { "name": "partner"; "type": "publicKey"; "index": false; }, { "name": "pool"; "type": "publicKey"; "index": false; }, { "name": "amountA"; "type": "u64"; "index": false; }, { "name": "amountB"; "type": "u64"; "index": false; } ]; }, { "name": "CollectProtocolFeeEvent"; "fields": [ { "name": "claimAuthority"; "type": "publicKey"; "index": false; }, { "name": "config"; "type": "publicKey"; "index": false; }, { "name": "pool"; "type": "publicKey"; "index": false; }, { "name": "amountA"; "type": "u64"; "index": false; }, { "name": "amountB"; "type": "u64"; "index": false; } ]; }, { "name": "CollectRewarderEvent"; "fields": [ { "name": "pool"; "type": "publicKey"; "index": false; }, { "name": "owner"; "type": "publicKey"; "index": false; }, { "name": "positionNftMint"; "type": "publicKey"; "index": false; }, { "name": "amount"; "type": "u64"; "index": false; }, { "name": "rewarderMint"; "type": "publicKey"; "index": false; } ]; }, { "name": "CreateClmmPoolEvent"; "fields": [ { "name": "payer"; "type": "publicKey"; "index": false; }, { "name": "config"; "type": "publicKey"; "index": false; }, { "name": "feeTier"; "type": "publicKey"; "index": false; }, { "name": "pool"; "type": "publicKey"; "index": false; }, { "name": "tokenA"; "type": "publicKey"; "index": false; }, { "name": "tokenB"; "type": "publicKey"; "index": false; } ]; }, { "name": "CreateClmmpoolMetadataEvent"; "fields": [ { "name": "clmmpool"; "type": "publicKey"; "index": false; }, { "name": "clmmpoolMetadata"; "type": "publicKey"; "index": false; } ]; }, { "name": "CreateFeeTierEvent"; "fields": [ { "name": "payer"; "type": "publicKey"; "index": false; }, { "name": "config"; "type": "publicKey"; "index": false; }, { "name": "feeTier"; "type": "publicKey"; "index": false; } ]; }, { "name": "CreatePartnerEvent"; "fields": [ { "name": "config"; "type": "publicKey"; "index": false; }, { "name": "protocolAuthority"; "type": "publicKey"; "index": false; }, { "name": "partner"; "type": "publicKey"; "index": false; } ]; }, { "name": "CreateTickArrayEvent"; "fields": [ { "name": "payer"; "type": "publicKey"; "index": false; }, { "name": "pool"; "type": "publicKey"; "index": false; }, { "name": "tickArray"; "type": "publicKey"; "index": false; }, { "name": "arrayIndex"; "type": "u16"; "index": false; } ]; }, { "name": "CreateTickArrayMapEvent"; "fields": [ { "name": "payer"; "type": "publicKey"; "index": false; }, { "name": "pool"; "type": "publicKey"; "index": false; }, { "name": "tickArrayMap"; "type": "publicKey"; "index": false; } ]; }, { "name": "DecreaseLiquidityEvent"; "fields": [ { "name": "pool"; "type": "publicKey"; "index": false; }, { "name": "owner"; "type": "publicKey"; "index": false; }, { "name": "positionNftMint"; "type": "publicKey"; "index": false; }, { "name": "deltaLiquidity"; "type": "u128"; "index": false; }, { "name": "amountA"; "type": "u64"; "index": false; }, { "name": "amountB"; "type": "u64"; "index": false; } ]; }, { "name": "IncreaseLiquidityEvent"; "fields": [ { "name": "pool"; "type": "publicKey"; "index": false; }, { "name": "owner"; "type": "publicKey"; "index": false; }, { "name": "positionNftMint"; "type": "publicKey"; "index": false; }, { "name": "deltaLiquidity"; "type": "u128"; "index": false; }, { "name": "amountA"; "type": "u64"; "index": false; }, { "name": "amountB"; "type": "u64"; "index": false; } ]; }, { "name": "IncreaseLiquidityWithFixedTokenEvent"; "fields": [ { "name": "pool"; "type": "publicKey"; "index": false; }, { "name": "owner"; "type": "publicKey"; "index": false; }, { "name": "positionNftMint"; "type": "publicKey"; "index": false; }, { "name": "deltaLiquidity"; "type": "u128"; "index": false; }, { "name": "amountA"; "type": "u64"; "index": false; }, { "name": "amountB"; "type": "u64"; "index": false; } ]; }, { "name": "InitializeClmmConfigEvent"; "fields": [ { "name": "config"; "type": "publicKey"; "index": false; }, { "name": "feeAuthority"; "type": "publicKey"; "index": false; }, { "name": "claimAuthority"; "type": "publicKey"; "index": false; }, { "name": "createPoolAuthority"; "type": "publicKey"; "index": false; }, { "name": "feeRate"; "type": "u16"; "index": false; } ]; }, { "name": "OpenPositionEvent"; "fields": [ { "name": "pool"; "type": "publicKey"; "index": false; }, { "name": "owner"; "type": "publicKey"; "index": false; }, { "name": "positionNftMint"; "type": "publicKey"; "index": false; }, { "name": "position"; "type": "publicKey"; "index": false; }, { "name": "tickLowerIndex"; "type": "i32"; "index": false; }, { "name": "tickUpperIndex"; "type": "i32"; "index": false; } ]; }, { "name": "RemovePositionEvent"; "fields": [ { "name": "pool"; "type": "publicKey"; "index": false; }, { "name": "owner"; "type": "publicKey"; "index": false; }, { "name": "positionNftMint"; "type": "publicKey"; "index": false; }, { "name": "position"; "type": "publicKey"; "index": false; } ]; }, { "name": "SwapEvent"; "fields": [ { "name": "pool"; "type": "publicKey"; "index": false; }, { "name": "owner"; "type": "publicKey"; "index": false; }, { "name": "partner"; "type": "publicKey"; "index": false; }, { "name": "aToB"; "type": "bool"; "index": false; }, { "name": "amountIn"; "type": "u64"; "index": false; }, { "name": "amountOut"; "type": "u64"; "index": false; }, { "name": "refAmount"; "type": "u64"; "index": false; }, { "name": "feeAmount"; "type": "u64"; "index": false; }, { "name": "protocolAmount"; "type": "u64"; "index": false; }, { "name": "vaultAAmount"; "type": "u64"; "index": false; }, { "name": "vaultBAmount"; "type": "u64"; "index": false; } ]; }, { "name": "SwapWithPartnerEvent"; "fields": [ { "name": "pool"; "type": "publicKey"; "index": false; }, { "name": "owner"; "type": "publicKey"; "index": false; }, { "name": "partner"; "type": "publicKey"; "index": false; }, { "name": "aToB"; "type": "bool"; "index": false; }, { "name": "amountIn"; "type": "u64"; "index": false; }, { "name": "amountOut"; "type": "u64"; "index": false; }, { "name": "refAmount"; "type": "u64"; "index": false; }, { "name": "feeAmount"; "type": "u64"; "index": false; }, { "name": "protocolAmount"; "type": "u64"; "index": false; }, { "name": "vaultAAmount"; "type": "u64"; "index": false; }, { "name": "vaultBAmount"; "type": "u64"; "index": false; } ]; }, { "name": "TransferPartnerClaimAuthorityEvent"; "fields": [ { "name": "newAuthority"; "type": "publicKey"; "index": false; }, { "name": "partner"; "type": "publicKey"; "index": false; }, { "name": "oldAuthority"; "type": "publicKey"; "index": false; } ]; }, { "name": "TransferProtocolAuthorityEvent"; "fields": [ { "name": "newAuthority"; "type": "publicKey"; "index": false; }, { "name": "config"; "type": "publicKey"; "index": false; }, { "name": "oldAuthority"; "type": "publicKey"; "index": false; } ]; }, { "name": "UpdateConfigEvent"; "fields": [ { "name": "config"; "type": "publicKey"; "index": false; }, { "name": "newProtocolFeeRate"; "type": { "option": "u16"; }; "index": false; }, { "name": "createPoolAuthority"; "type": { "option": "publicKey"; }; "index": false; }, { "name": "claimAuthority"; "type": { "option": "publicKey"; }; "index": false; } ]; }, { "name": "UpdateFeeRateEvent"; "fields": [ { "name": "pool"; "type": "publicKey"; "index": false; }, { "name": "config"; "type": "publicKey"; "index": false; } ]; }, { "name": "UpdatePartnerEvent"; "fields": [ { "name": "authority"; "type": "publicKey"; "index": false; }, { "name": "partner"; "type": "publicKey"; "index": false; }, { "name": "newFeeRate"; "type": { "option": "u16"; }; "index": false; }, { "name": "newClaimAuthority"; "type": { "option": "publicKey"; }; "index": false; } ]; } ]; }; declare const IDL: clmmpool; type ClmmpoolTypes = AnchorTypes; type Accounts = ClmmpoolTypes["Accounts"]; declare enum AccountName { ClmmConfig = "ClmmConfig", ClmmPool = "Clmmpool", FeeTier = "FeeTier", Partner = "Partner", Position = "Position", TickArrayMap = "TickArrayMap", TickArray = "TickArray", Rewarder = "Rewarder" } type RewarderData = { mintWrapper: PublicKey; minter: PublicKey; mint: PublicKey; authority: PublicKey; emissionsPerSecond: BN__default; growthGlobal: BN__default; }; type ClmmpoolData = Accounts["clmmpool"]; type ClmmConfigData = Accounts["clmmConfig"]; type PositionData = Accounts["position"]; type FeeTierData = Accounts["feeTier"]; type PartnerData = Accounts["partner"]; type TickArrayMapData = Accounts["tickArrayMap"]; type TickData = { isInitialized: boolean; index: number; sqrtPrice: BN__default; liquidityNet: BN__default; liquidityGross: BN__default; feeGrowthOutsideA: BN__default; feeGrowthOutsideB: BN__default; rewardGrowthOutside: BN__default[]; }; type TickArrayData = { arrayIndex: number; tickSpacing: number; clmmpool: PublicKey; ticks: TickData[]; }; type ClmmpoolProgram = ClmmpoolTypes["Program"]; type ClmmpoolEvent = ClmmpoolTypes["Events"]; /** * Extended MintInfo class to host token info. * @category ClmmpoolClient */ type TokenInfo = MintInfo & { mint: PublicKey; }; type TokenAccountInfo = AccountInfo; /** * A wrapper class of a TickArray on a Clmmpool * @category ClmmpoolClient */ type TickArray = { address: PublicKey; data: TickArrayData | null; }; /** * CLMM's config PublicKey. * @category Constants */ declare const CLMMPOOLS_CONFIG: anchor.web3.PublicKey; declare const CLMMPOOL_PROGRAM_ID: anchor.web3.PublicKey; declare const MINT_WRAPPER_PROGRAM_ID: anchor.web3.PublicKey; /** * The maximum tick index supported by the clmmpool program. * @category Constants */ declare const MAX_TICK_INDEX = 443636; /** * The minimum tick index supported by the clmmpool program. * @category Constants */ declare const MIN_TICK_INDEX = -443636; /** * The maximum sqrt-price supported by the clmmpool program. * @category Constants */ declare const MAX_SQRT_PRICE = "79226673515401279992447579055"; /** * The minimum sqrt-price supported by the clmmpool program. * @category Constants */ declare const MIN_SQRT_PRICE = "4295048016"; /** * The number of initialized ticks that a tick-array account can hold. * @category Constants */ declare const TICK_ARRAY_SIZE = 64; /** * @category Constants */ declare const METADATA_PROGRAM_ADDRESS: anchor.web3.PublicKey; /** * The denominator which the protocol fee rate is divided on. * @category Constants */ declare const PROTOCOL_FEE_RATE_DENOMINATOR: BN$1; /** * The denominator which the fee rate is divided on. * @category Constants */ declare const FEE_RATE_DENOMINATOR: BN$1; /** * The max and min number of tick arrays that tick array map holds. * @category Constants */ declare const TICK_ARRAY_MAP_MAX_BIT_INDEX: number; declare const TICK_ARRAY_MAP_MIN_BIT_INDEX = 0; declare const MAX_TICK_ARRAY = 3; declare const TICK_ARRAY_AMOUNT = 6943; declare const POSITION_NFT_UPDATE_AUTHORITY: anchor.web3.PublicKey; declare const ZERO_BN: BN$1; /** * Input parameters to deposit liquidity into a position. * * @category Instruction Types * @param tokenMaxA - the maximum amount of tokenA allowed to withdraw from the source wallet. * @param tokenMaxB - the maximum amount of tokenB allowed to withdraw from the source wallet. * @param liquidityAmount - the desired amount of liquidity to deposit into the position. */ type DecreaseLiquidityInput = { tokenMinA: BN$1; tokenMinB: BN$1; liquidityAmount: BN$1; }; /** * Input parameters to deposit liquidity into a position. * * This type is usually generated by a quote class to estimate the amount of tokens required to * deposit a certain amount of liquidity into a position. * * @category Instruction Types * @param tokenMaxA - the maximum amount of tokenA allowed to withdraw from the source wallet. * @param tokenMaxB - the maximum amount of tokenB allowed to withdraw from the source wallet. * @param liquidityAmount - the desired amount of liquidity to deposit into the position. */ type IncreaseLiquidityInput = { tokenMaxA: u64; tokenMaxB: u64; liquidityAmount: BN$1; }; type SwapResult = { amountIn: BN__default; amountOut: BN__default; feeAmount: BN__default; refAmount: BN__default; nextSqrtPrice: BN__default; crossTickNum: number; swapTickArrays: PublicKey[]; }; /** * Simulate swap by imput lots of ticks. * * @param aToB * @param byAmountIn * @param amount * @param poolData * @param swapTicks * @returns */ declare function computeSwap(aToB: boolean, byAmountIn: boolean, amount: BN__default, poolData: ClmmpoolData, swapTicks: Array, clmmpool?: PublicKey, tickArrayMap?: TickArrayMapData): SwapResult; type PDA = { publicKey: PublicKey; bump: number; }; /** * Static abstract class definition to parse entities. * @category ParsablesEntity */ interface ParsableEntity { /** * Parse account data * * @param accountData Buffer data for the entity * @returns Parsed entity */ parse: (accountData: Buffer | undefined | null) => T | null; } /** * Supported accounts */ type CachedValue = ClmmConfigData | ClmmpoolData | PositionData | TickArrayData | FeeTierData | AccountInfo | PositionData[] | MintInfo; /** * Include both the entity (i.e. type) of the stored value, and the value itself */ interface CachedContent { entity: ParsableEntity; value: CachedValue | null; } declare class AccountFetcher { private readonly connection; private readonly _cache; private _accountRentExempt; constructor(connection: Connection, cache?: Record>); /** * Retrieve minimum balance for rent exemption of a Token Account; * * @param refresh force refresh of account rent exemption * @returns minimum balance for rent exemption */ getAccountRentExempt(refresh?: boolean): Promise; /** * Retrieve a cached clmmpool account. Fetch from rpc on cache miss. * * @param address clmmpool address * @param refresh force cache refresh, default true * @returns clmmpool account */ getPool(address: Address, refresh?: boolean): Promise; /** * Retrieve a cached position account. Fetch from rpc on cache miss. * * @param address position address * @param refresh force cache refresh, default true * @returns position account */ getPosition(address: Address, refresh?: boolean): Promise; /** * Retrieve a cached tick array account. Fetch from rpc on cache miss. * * @param address tick array address * @param refresh force cache refresh * @returns tick array account */ getTickArray(address: Address, refresh?: boolean): Promise; /** * Retrieve a cached fee tier account. Fetch from rpc on cache miss. * * @param address fee tier address * @param refresh force cache refresh * @returns fee tier account */ getFeeTier(address: Address, refresh?: boolean): Promise; getTickArrayMap(address: Address, refresh?: boolean): Promise; /** * Retrieve a cached token info account. Fetch from rpc on cache miss. * * @param address token info address * @param refresh force cache refresh * @returns token info account */ getTokenInfo(address: Address, refresh?: boolean): Promise; /** * Retrieve a cached mint info account. Fetch from rpc on cache miss. * * @param address mint info address * @param refresh force cache refresh * @returns mint info account */ getMintInfo(address: Address, refresh?: boolean): Promise; /** * Retrieve a cached clmmpool config account. Fetch from rpc on cache miss. * * @param address clmmpool config address * @param refresh force cache refresh * @returns clmmpool config account */ getConfig(address: Address, refresh?: boolean): Promise; /** * Retrieve a cached partner. Fetch from rpc on cache miss. * * @param address partner address * @param refresh force cache refresh * @returns partner account */ getPartner(address: Address, refresh?: boolean): Promise; /** * Retrieve a list of cached clmmpool accounts. Fetch from rpc for cache misses. * * @param addresses clmmpool addresses * @param refresh force cache refresh * @returns clmmpool accounts */ listPools(addresses: Address[], refresh: boolean): Promise<(ClmmpoolData | null)[]>; /** * Retrieve a list of cached position accounts. Fetch from rpc for cache misses. * * @param addresses position addresses * @param refresh force cache refresh * @returns position accounts */ listPositions(addresses: Address[], refresh: boolean): Promise<(PositionData | null)[]>; /** * Retrieve a list of cached tick array accounts. Fetch from rpc for cache misses. * * @param addresses tick array addresses * @param refresh force cache refresh * @returns tick array accounts */ listTickArrays(addresses: Address[], refresh: boolean): Promise<(TickArrayData | null)[]>; /** * Retrieve a list of cached token info accounts. Fetch from rpc for cache misses. * * @param addresses token info addresses * @param refresh force cache refresh * @returns token info accounts */ listTokenInfos(addresses: Address[], refresh: boolean): Promise<(AccountInfo | null)[]>; /** * Retrieve a list of cached mint info accounts. Fetch from rpc for cache misses. * * @param addresses mint info addresses * @param refresh force cache refresh * @returns mint info accounts */ listMintInfos(addresses: Address[], refresh: boolean): Promise<(MintInfo | null)[]>; /** * Update the cached value of all entities currently in the cache. * Uses batched rpc request for network efficient fetch. */ refreshAll(): Promise; /** * Get the cached value of an entity. Fetch from rpc on cache miss. * * @param address * @param entity * @param refresh * @returns */ private get; /** * Retrieve from cache or fetch from rpc, a list of accounts * * @param addresses * @param entity * @param refresh * @returns */ private list; /** * bulk request for accounts address. * * @param addresses * @returns */ private bulkRequest; } /** * TickMath - the math util set of tick. */ declare class TickMath { static priceToSqrtPriceX64(price: Decimal, decimalsA: number, decimalsB: number): BN$1; static sqrtPriceX64ToPrice(sqrtPriceX64: BN$1, decimalsA: number, decimalsB: number): Decimal; /** * @param tickIndex * @returns */ static tickIndexToSqrtPriceX64(tickIndex: number): BN$1; /** * * @param sqrtPriceX64 * @returns */ static sqrtPriceX64ToTickIndex(sqrtPriceX64: BN$1): number; static tickIndexToPrice(tickIndex: number, decimalsA: number, decimalsB: number): Decimal; static priceToTickIndex(price: Decimal, decimalsA: number, decimalsB: number): number; static priceToInitializableTickIndex(price: Decimal, decimalsA: number, decimalsB: number, tickSpacing: number): number; static getStartTickIndex(tickIndex: number, tickSpacing: number, offset?: number): number; static getInitializableTickIndex(tickIndex: number, tickSpacing: number): number; static getNextInitializableTickIndex(tickIndex: number, tickSpacing: number): number; static getPrevInitializableTickIndex(tickIndex: number, tickSpacing: number): number; } /** * @category PDA Utils */ declare class PDAUtil { /** * Get clmm config pda. * * @param programId * @returns */ static getClmmConfigPDA(programId: PublicKey): PDA; /** * Get clmmpool pda. * @param programId * @param clmmConfigKey * @param tokenMintAKey * @param tokenMintBKey * @param tickSpacing * @returns */ static getClmmpoolPDA(programId: PublicKey, clmmConfigKey: PublicKey, tokenMintAKey: PublicKey, tokenMintBKey: PublicKey, tickSpacing: number): PDA; /** * Get position pda. * * @param programId * @param positionNFTMintKey * @returns */ static getPositionPDA(programId: PublicKey, positionNFTMintKey: PublicKey): PDA; /** * Get position mint key. * * @param positionMintKey * @returns */ static getPositionMetadataPDA(positionMintKey: PublicKey): PDA; /** * Get opsition edition pda. * * @param positionMintKey * @returns */ static getPositionEditionPDA(positionMintKey: PublicKey): PDA; /** * Get tick array pda. * * @param programId * @param clmmpoolKey * @param arrayIndex * @returns */ static getTickArrayPDA(programId: PublicKey, clmmpoolKey: PublicKey, arrayIndex: number): PDA; /** * Get tick array map pda. * * @param programId * @param clmmpoolKey * @returns */ static getTickArrayMapPDA(programId: PublicKey, clmmpoolKey: PublicKey): PDA; /** * Get tick array from tick index PDA. * * @param tickIndex * @param tickSpacing * @param clmmpool * @param programId * @returns */ static getTickArrayFromTickIndexPDA(tickIndex: number, tickSpacing: number, clmmpool: PublicKey, programId: PublicKey): PDA; /** * Get the PDA of the tick array containing tickIndex. * tickArrayOffset can be used to get neighboring tick arrays. * * @param sqrtPriceX64 * @param tickSpacing * @param clmmpool * @param programId * @returns */ static getTickArrayFromSqrtPricePDA(sqrtPriceX64: BN__default, tickSpacing: number, clmmpool: PublicKey, programId: PublicKey): PDA; /** * @category Program Derived Addresses * @param programId * @param clmmConfigKey * @param tickSpacing * @returns */ static getFeeTierPDA(programId: PublicKey, clmmConfigKey: PublicKey, tickSpacing: number): PDA; /** * @category Get Program Derived Addresses * @param programId * @param baseKey * @returns */ static getPartnerPDA(programId: PublicKey, baseKey: PublicKey): PDA; /** * @category Get Program Derived Addresses * @param programId * @param clmmpoolKey * @returns */ static getClmmpoolMetadataPDA(programId: PublicKey, clmmpoolKey: PublicKey): PDA; } /** * A collection of utility functions when interacting with a Tick. * There are some functions already initialized in tick math. * @category Tick Utils */ declare class TickUtil { /** * Verify is tick initializeable. * * @param tick * @param tickSpacing * @returns */ static isTickInitializable(tick: number, tickSpacing: number): boolean; /** * Check if the tick is in bounds. * * @param tick - tick index * @retruns true or false */ static checkTickInBounds(tick: number): boolean; /** * Check if the tick is valid. * * @param tick_index - tick index * @param tick_spacing - tick spacing * @retruns */ static checkIsValidTick(tick_index: number, tick_spacing: number): void; /** * Get min tick index. * * @param tick_spacing - tick spacing * @retruns min tick index */ static getMinIndex(tick_spacing: number): number; /** * Get max tick index. * @param tick_spacing - tick spacing * @retruns max tick index */ static getMaxIndex(tick_spacing: number): number; /** * Get array index. * * @param tick_index - tick index * @param tick_spacing - tick spacing * @retruns max tick index */ static getArrayIndex(tick_index: number, tick_spacing: number): number; /** * Get offset index. * * @param tick_index - tick index * @param tick_spacing - tick spacing * @retruns offset index */ static getOffset(tick_index: number, tick_spacing: number): number; /** * Get start tick index. * * @param array_index - tick index * @param tick_spacing - tick spacing * @retruns start tick index */ static getStartTickIndex(array_index: number, tick_spacing: number): number; /** * Get end tick index. * * @param array_index - tick index * @param tick_spacing - tick spacing * @retruns end tick index */ static getEndTickIndex(array_index: number, tick_spacing: number): number; /** * Verify if the tickArray is min. * * @param array_index - array index * @param tick_spacing - tick spacing * @retruns true or false */ static isMinTickArray(array_index: number, tick_spacing: number): boolean; /** * Verify if the tickArray is max. * * @param array_index - array index * @param tick_spacing - tick spacing * @retruns true or false */ static isMaxTickArray(array_index: number, tick_spacing: number): boolean; /** * Verify if the tick is in tickArray * * @param array_index - array index * @param tick_spacing - tick spacing * @param tick_index - tick index * @retruns true or false */ static isInArray(array_index: number, tick_spacing: number, tick_index: number): boolean; /** * Cross update. * * @param tick - index data * @param pool - clmm pool address * @param aToB - swap direcation * @retruns true or false */ static crossUpdate(tick: TickData, pool: ClmmpoolData, aToB: boolean): BN; /** * Get tick data from tick index. * * @param fetcher - solana fetcher * @param clmmpool - clmm pool address * @param programId - SPL Token program account * @param tick_index - tick index * @param tick_spacing - tick spacing * @retruns tick data */ static getTickDataFromIndex(fetcher: AccountFetcher, clmmpool: PublicKey, programId: PublicKey, tick_index: number, tick_spacing: number): Promise; } export { AccountName, CLMMPOOLS_CONFIG, CLMMPOOL_PROGRAM_ID, ClmmConfigData, ClmmpoolData, ClmmpoolEvent, ClmmpoolProgram, ClmmpoolTypes, DecreaseLiquidityInput, FEE_RATE_DENOMINATOR, FeeTierData, IDL, IncreaseLiquidityInput, MAX_SQRT_PRICE, MAX_TICK_ARRAY, MAX_TICK_INDEX, METADATA_PROGRAM_ADDRESS, MINT_WRAPPER_PROGRAM_ID, MIN_SQRT_PRICE, MIN_TICK_INDEX, PDAUtil, POSITION_NFT_UPDATE_AUTHORITY, PROTOCOL_FEE_RATE_DENOMINATOR, PartnerData, PositionData, RewarderData, TICK_ARRAY_AMOUNT, TICK_ARRAY_MAP_MAX_BIT_INDEX, TICK_ARRAY_MAP_MIN_BIT_INDEX, TICK_ARRAY_SIZE, TickArray, TickArrayData, TickArrayMapData, TickData, TickMath, TickUtil, TokenAccountInfo, TokenInfo, ZERO_BN, clmmpool, computeSwap };