Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

harvestLockLp can not work for devnet, keypools do not set #85

Open
benhaben opened this issue Jan 29, 2025 · 4 comments
Open

harvestLockLp can not work for devnet, keypools do not set #85

benhaben opened this issue Jan 29, 2025 · 4 comments

Comments

@benhaben
Copy link

raydium.cpmm.harvestLockLp can not find keypools at devnet

@cruzshia
Copy link
Collaborator

cruzshia commented Jan 29, 2025

for devent you should fetch pool keys from rpc, here's the example

const data = await raydium.cpmm.getPoolInfoFromRpc(lockData.poolId.toBase58())
const { execute, transaction } = await raydium.cpmm.harvestLockLp({
    poolInfo,
    nftMint: new PublicKey('lock nft mint'), // locked nft mint
    lpFeeAmount: new BN(99999999),
    poolKeys: data.poolKeys,
    txVersion,
    // optional: add transfer sol to tip account instruction. e.g sent tip to jito
    // txTipConfig: {
    //   address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'),
    //   amount: new BN(10000000), // 0.01 sol
    // },
  })

@khorammfar
Copy link

for devent you should fetch pool keys from rpc, here's the example

const data = await raydium.cpmm.getPoolInfoFromRpc(lockData.poolId.toBase58())
const { execute, transaction } = await raydium.cpmm.harvestLockLp({
    poolInfo,
    nftMint: new PublicKey('lock nft mint'), // locked nft mint
    lpFeeAmount: new BN(99999999),
    poolKeys: data.poolKeys,
    txVersion,
    // optional: add transfer sol to tip account instruction. e.g sent tip to jito
    // txTipConfig: {
    //   address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'),
    //   amount: new BN(10000000), // 0.01 sol
    // },
  })

why this 'txTipConfig' not working for me, is there any docs for this parameter?

def get_transaction(input_mint, output_mint, swap_mode, compute_price, swap_response) -> bytes:
    
    tx_url = f"{utils.RAYDIUM_API['SWAP_HOST']}/transaction/{swap_mode}"

    is_input_sol = input_mint == "So11111111111111111111111111111111111111112"
    is_output_sol = output_mint == "So11111111111111111111111111111111111111112"

    tx_data = {
        "computeUnitPriceMicroLamports": str(compute_price),
        "swapResponse": swap_response,
        "txVersion": "V0",
        "wallet": str(owner.pubkey()),
        "wrapSol": is_input_sol,
        "unwrapSol": is_output_sol,
        'txTipConfig': {
            'address': utils.TIP_ACCOUNTS,
            'amount': 10000
        }

    }
    print(tx_data)
    try:
        tx_response = requests.post(tx_url, json=tx_data)  
    except Exception as error:
        print('tx cannot be generated! ', error)
    else:
        if tx_response.status_code == 200 and tx_response.json().get('success', None):
            for transaction in tx_response.json().get('data'):
                return base64.b64decode(transaction.get('transaction'))

@cruzshia
Copy link
Collaborator

tip config only adds a transfer instruction to tx and you need to set a jito rpc node by yourself

@khorammfar
Copy link

tip config only adds a transfer instruction to tx and you need to set a jito rpc node by yourself

is there any exmaple in python?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants