mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-06-01 07:36:46 +00:00
fix: Using sendTx function
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import BN from "bn.js";
|
||||
import {
|
||||
ComputeBudgetProgram,
|
||||
PublicKey,
|
||||
sendAndConfirmTransaction,
|
||||
} from "@solana/web3.js";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import DLMM, { ActivationType } from "@meteora-ag/dlmm";
|
||||
import { getMint } from "@solana/spl-token";
|
||||
import { sendTx } from "../../utils/send_tx";
|
||||
|
||||
/**
|
||||
* Create Meteora DLMM pool
|
||||
@@ -33,7 +30,6 @@ export async function createMeteoraDlmmPool(
|
||||
activationType: ActivationType,
|
||||
hasAlphaVault: boolean,
|
||||
activationPoint: BN | undefined,
|
||||
computeUnitMicroLamports: number,
|
||||
): Promise<string> {
|
||||
const tokenAMintInfo = await getMint(agent.connection, tokenAMint);
|
||||
const tokenBMintInfo = await getMint(agent.connection, tokenBMint);
|
||||
@@ -65,20 +61,10 @@ export async function createMeteoraDlmmPool(
|
||||
cluster: "mainnet-beta",
|
||||
},
|
||||
);
|
||||
initPoolTx.add(
|
||||
ComputeBudgetProgram.setComputeUnitPrice({
|
||||
microLamports: computeUnitMicroLamports,
|
||||
}),
|
||||
);
|
||||
|
||||
const initPoolTxHash = await sendAndConfirmTransaction(
|
||||
agent.connection,
|
||||
initPoolTx,
|
||||
[agent.wallet],
|
||||
).catch((err) => {
|
||||
console.error(err);
|
||||
throw err;
|
||||
});
|
||||
const initPoolTxHash = await sendTx(agent, initPoolTx.instructions, [
|
||||
agent.wallet,
|
||||
]);
|
||||
|
||||
return initPoolTxHash;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import AmmImpl from "@mercurial-finance/dynamic-amm-sdk";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import BN from "bn.js";
|
||||
import {
|
||||
ComputeBudgetProgram,
|
||||
PublicKey,
|
||||
sendAndConfirmTransaction,
|
||||
} from "@solana/web3.js";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { CustomizableParams } from "@mercurial-finance/dynamic-amm-sdk/dist/cjs/src/amm/types";
|
||||
import { sendTx } from "../../utils/send_tx";
|
||||
|
||||
/**
|
||||
* Create Meteora Dynamic AMM pool
|
||||
@@ -30,7 +27,6 @@ export async function createMeteoraDynamicAMMPool(
|
||||
tokenAAmount: BN,
|
||||
tokenBAmount: BN,
|
||||
customizableParams: CustomizableParams,
|
||||
computeUnitMicroLamports: number,
|
||||
): Promise<string> {
|
||||
const initPoolTx =
|
||||
await AmmImpl.createCustomizablePermissionlessConstantProductPool(
|
||||
@@ -43,20 +39,9 @@ export async function createMeteoraDynamicAMMPool(
|
||||
customizableParams,
|
||||
);
|
||||
|
||||
initPoolTx.add(
|
||||
ComputeBudgetProgram.setComputeUnitPrice({
|
||||
microLamports: computeUnitMicroLamports,
|
||||
}),
|
||||
);
|
||||
|
||||
const initPoolTxHash = await sendAndConfirmTransaction(
|
||||
agent.connection,
|
||||
initPoolTx,
|
||||
[agent.wallet],
|
||||
).catch((err) => {
|
||||
console.error(err);
|
||||
throw err;
|
||||
});
|
||||
const initPoolTxHash = await sendTx(agent, initPoolTx.instructions, [
|
||||
agent.wallet,
|
||||
]);
|
||||
|
||||
return initPoolTxHash;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user