Feat: Added Pumpfun Token Launch

This commit is contained in:
Scriptscrypt
2024-11-28 01:50:31 +05:30
parent 68d250df24
commit b2a9ddcd06
6 changed files with 1897 additions and 151 deletions

View File

@@ -9,11 +9,9 @@ import {
transfer,
trade,
registerDomain,
lendAsset,
getLendingDetails,
getTPS,
launchpumpfuntoken,
} from "../tools";
import { CollectionOptions, LuloDepositAssetMint } from "../types";
import { CollectionOptions } from "../types";
import { DEFAULT_OPTIONS } from "../constants";
/**
@@ -31,23 +29,11 @@ export class SolanaAgentKit {
public wallet_address: PublicKey;
constructor(
privateKey?: string,
rpcURL = "https://api.mainnet-beta.solana.com",
private_key: string,
rpc_url = "https://api.mainnet-beta.solana.com"
) {
this.connection = new Connection(rpcURL);
if (privateKey) {
this.wallet = Keypair.fromSecretKey(bs58.decode(privateKey));
} else {
this.wallet = Keypair.generate();
console.log("Generated new wallet: ", this.wallet.publicKey.toBase58());
console.log(
"Safely store the private key: ",
"\n----------------------------------\n",
this.wallet.secretKey,
"\n----------------------------------\n",
"Please fund this wallet with SOL to use it (on mainnet), or use the faucet method to request funds (only on devnet/testnet).",
);
}
this.connection = new Connection(rpc_url);
this.wallet = Keypair.fromSecretKey(bs58.decode(private_key));
this.wallet_address = this.wallet.publicKey;
}
@@ -57,7 +43,7 @@ export class SolanaAgentKit {
}
async deployToken(
decimals: number = DEFAULT_OPTIONS.TOKEN_DECIMALS,
decimals: number = DEFAULT_OPTIONS.TOKEN_DECIMALS
// initialSupply?: number
) {
return deploy_token(this, decimals);
@@ -74,7 +60,7 @@ export class SolanaAgentKit {
async mintNFT(
collectionMint: PublicKey,
metadata: Parameters<typeof mintCollectionNFT>[2],
recipient?: PublicKey,
recipient?: PublicKey
) {
return mintCollectionNFT(this, collectionMint, metadata, recipient);
}
@@ -91,24 +77,24 @@ export class SolanaAgentKit {
outputMint: PublicKey,
inputAmount: number,
inputMint?: PublicKey,
slippageBps: number = DEFAULT_OPTIONS.SLIPPAGE_BPS,
slippageBps: number = DEFAULT_OPTIONS.SLIPPAGE_BPS
) {
return trade(this, outputMint, inputAmount, inputMint, slippageBps);
}
async lendAssets(
asset: LuloDepositAssetMint,
amount: number,
LULO_API_KEY: string,
async launchpumpfuntoken(
tokenName: string,
tokenTicker: string,
options: {
description: string;
twitter: string;
telegram: string;
website: string;
imageUrl: string;
initialLiquiditySOL: any;
mintAddress: string;
}
) {
return lendAsset(this, asset, amount, LULO_API_KEY);
}
async fetchLendingDetails(LULO_API_KEY: string) {
return getLendingDetails(this, LULO_API_KEY);
}
async getTPS() {
return getTPS(this);
return launchpumpfuntoken(this, tokenName, tokenTicker, options);
}
}