This commit is contained in:
Blockiosaurus
2024-12-18 19:56:04 -05:00
22 changed files with 380 additions and 46 deletions

View File

@@ -9,9 +9,13 @@ import {
transfer,
trade,
registerDomain,
resolveSolDomain,
getPrimaryDomain,
launchPumpFunToken,
lendAsset,
getTPS,
getTokenDataByAddress,
getTokenDataByTicker,
stakeWithJup,
} from "../tools";
import { CollectionOptions, PumpFunTokenOptions } from "../types";
@@ -35,7 +39,7 @@ export class SolanaAgentKit {
constructor(
private_key: string,
rpc_url = "https://api.mainnet-beta.solana.com",
openai_api_key: string,
openai_api_key: string
) {
this.connection = new Connection(rpc_url);
this.wallet = Keypair.fromSecretKey(bs58.decode(private_key));
@@ -69,7 +73,7 @@ export class SolanaAgentKit {
async mintNFT(
collectionMint: PublicKey,
metadata: Parameters<typeof mintCollectionNFT>[2],
recipient?: PublicKey,
recipient?: PublicKey
) {
return mintCollectionNFT(this, collectionMint, metadata, recipient);
}
@@ -82,11 +86,19 @@ export class SolanaAgentKit {
return registerDomain(this, name, spaceKB);
}
async resolveSolDomain(domain: string) {
return resolveSolDomain(this, domain)
}
async getPrimaryDomain(account: PublicKey) {
return getPrimaryDomain(this, account)
}
async trade(
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);
}
@@ -99,12 +111,20 @@ export class SolanaAgentKit {
return getTPS(this);
}
async getTokenDataByAddress(mint: string) {
return getTokenDataByAddress(new PublicKey(mint));
}
async getTokenDataByTicker(ticker: string) {
return getTokenDataByTicker(ticker);
}
async launchPumpFunToken(
tokenName: string,
tokenTicker: string,
description: string,
imageUrl: string,
options?: PumpFunTokenOptions,
options?: PumpFunTokenOptions
) {
return launchPumpFunToken(
this,
@@ -112,10 +132,10 @@ export class SolanaAgentKit {
tokenTicker,
description,
imageUrl,
options,
options
);
}
async stake(
amount: number,
) {