mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-05-18 15:10:33 +00:00
fix: jup staking
This commit is contained in:
@@ -27,10 +27,6 @@ export async function deploy_token(
|
||||
);
|
||||
|
||||
const mint = Keypair.generate();
|
||||
|
||||
console.log("Mint address: ", mint.publicKey.toString());
|
||||
console.log("Agent address: ", agent.wallet_address.toString());
|
||||
|
||||
let account_create_ix = SystemProgram.createAccount({
|
||||
fromPubkey: agent.wallet_address,
|
||||
newAccountPubkey: mint.publicKey,
|
||||
@@ -51,13 +47,6 @@ export async function deploy_token(
|
||||
|
||||
let hash = await sendTx(agent, tx, [mint]);
|
||||
|
||||
console.log("Transaction hash: ", hash);
|
||||
|
||||
console.log(
|
||||
"Token deployed successfully. Mint address: ",
|
||||
mint.publicKey.toString()
|
||||
);
|
||||
|
||||
return {
|
||||
mint: mint.publicKey,
|
||||
};
|
||||
|
||||
@@ -38,7 +38,6 @@ async function uploadMetadata(
|
||||
finalFormData.append('file', files.file);
|
||||
}
|
||||
|
||||
console.log("Final form data:", finalFormData);
|
||||
|
||||
const metadataResponse = await fetch("https://pump.fun/api/ipfs", {
|
||||
method: "POST",
|
||||
@@ -46,7 +45,6 @@ async function uploadMetadata(
|
||||
});
|
||||
|
||||
if (!metadataResponse.ok) {
|
||||
console.log("Metadata response:", await metadataResponse.json());
|
||||
throw new Error(`Metadata upload failed: ${metadataResponse.statusText}`);
|
||||
}
|
||||
|
||||
@@ -152,30 +150,14 @@ export async function launchPumpFunToken(
|
||||
options?: PumpFunTokenOptions
|
||||
) {
|
||||
try {
|
||||
// TBD : Remove clgs after approval
|
||||
console.log("Starting token launch process...");
|
||||
|
||||
// Generate mint keypair
|
||||
const mintKeypair = Keypair.generate();
|
||||
console.log("Mint public key:", mintKeypair.publicKey.toBase58());
|
||||
|
||||
// Upload metadata
|
||||
console.log("Uploading metadata to IPFS...");
|
||||
const metadataResponse = await uploadMetadata(tokenName, tokenTicker, description, imageUrl, options);
|
||||
console.log("Metadata response:", metadataResponse);
|
||||
|
||||
// Create token transaction
|
||||
console.log("Creating token transaction...");
|
||||
const response = await createTokenTransaction(agent, mintKeypair, metadataResponse, options);
|
||||
|
||||
const transactionData = await response.arrayBuffer();
|
||||
const tx = VersionedTransaction.deserialize(new Uint8Array(transactionData));
|
||||
|
||||
// Send transaction with proper blockhash handling
|
||||
console.log("Sending transaction...");
|
||||
const signature = await signAndSendTransaction(agent, tx, mintKeypair);
|
||||
|
||||
console.log("Token launch successful!");
|
||||
return {
|
||||
signature,
|
||||
mint: mintKeypair.publicKey.toBase58(),
|
||||
|
||||
@@ -19,8 +19,6 @@ export async function trade(
|
||||
slippageBps: number = DEFAULT_OPTIONS.SLIPPAGE_BPS,
|
||||
): Promise<string> {
|
||||
try {
|
||||
// Get quote for the swap
|
||||
console.log(inputMint.toString(), outputMint.toString(), inputAmount, slippageBps);
|
||||
const quoteResponse = await (
|
||||
await fetch(
|
||||
`${JUP_API}/quote?` +
|
||||
|
||||
Reference in New Issue
Block a user