mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-05-18 23:26:45 +00:00
fix
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
import OpenAI from "openai";
|
||||
|
||||
/**
|
||||
@@ -10,7 +10,7 @@ import OpenAI from "openai";
|
||||
* @returns Object containing the generated image URLs
|
||||
*/
|
||||
export async function create_image(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
prompt: string,
|
||||
size: "256x256" | "512x512" | "1024x1024" = "1024x1024",
|
||||
n: number = 1,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Keypair, PublicKey, Transaction } from "@solana/web3.js";
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
import { BN, Wallet } from "@coral-xyz/anchor";
|
||||
import { Decimal } from "decimal.js";
|
||||
import {
|
||||
@@ -99,7 +99,7 @@ export const FEE_TIERS = {
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* import { SolanaAgentKit } from "your-sdk";
|
||||
* agent: SolanaAgentKitKit } from "your-sdk";
|
||||
* import { PublicKey } from "@solana/web3.js";
|
||||
* import { BN } from "@coral-xyz/anchor";
|
||||
* import Decimal from "decimal.js";
|
||||
@@ -125,7 +125,7 @@ export const FEE_TIERS = {
|
||||
* ```
|
||||
*/
|
||||
export async function createOrcaSingleSidedWhirlpool(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
depositTokenAmount: BN,
|
||||
depositTokenMint: PublicKey,
|
||||
otherTokenMint: PublicKey,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
import {
|
||||
generateSigner,
|
||||
keypairIdentity,
|
||||
@@ -23,7 +23,7 @@ import { createUmi } from "@metaplex-foundation/umi-bundle-defaults";
|
||||
* @returns Object containing collection address and metadata
|
||||
*/
|
||||
export async function deploy_collection(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
options: CollectionOptions,
|
||||
): Promise<CollectionDeployment> {
|
||||
try {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { createUmi } from "@metaplex-foundation/umi-bundle-defaults";
|
||||
import { generateSigner, keypairIdentity } from "@metaplex-foundation/umi";
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
* @returns Object containing token mint address and initial account (if supply was minted)
|
||||
*/
|
||||
export async function deploy_token(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
name: string,
|
||||
uri: string,
|
||||
symbol: string,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js";
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
|
||||
/**
|
||||
* Get the balance of SOL or an SPL token for the agent's wallet
|
||||
@@ -8,7 +8,7 @@ import { SolanaAgent } from "../index";
|
||||
* @returns Promise resolving to the balance as a number (in UI units) or null if account doesn't exist
|
||||
*/
|
||||
export async function get_balance(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
token_address?: PublicKey,
|
||||
): Promise<number | null> {
|
||||
if (!token_address)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { getPrimaryDomain as _getPrimaryDomain } from "@bonfida/spl-name-service";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
|
||||
/**
|
||||
* Retrieves the primary .sol domain associated with a given Solana public key.
|
||||
@@ -15,7 +15,7 @@ import { SolanaAgent } from "../index";
|
||||
* @throws Error if the domain is stale or if the domain resolution fails
|
||||
*/
|
||||
export async function getPrimaryDomain(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
account: PublicKey,
|
||||
): Promise<string> {
|
||||
try {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
|
||||
export async function getTPS(agent: SolanaAgentKit): Promise<number> {
|
||||
const perfSamples = await agent.connection.getRecentPerformanceSamples();
|
||||
|
||||
@@ -55,7 +55,7 @@ async function uploadMetadata(
|
||||
}
|
||||
|
||||
async function createTokenTransaction(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
mintKeypair: Keypair,
|
||||
metadataResponse: any,
|
||||
options?: PumpFunTokenOptions,
|
||||
@@ -149,7 +149,7 @@ async function signAndSendTransaction(
|
||||
* @returns - Signature of the transaction, mint address and metadata URI, if successful, else error
|
||||
*/
|
||||
export async function launchPumpFunToken(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
tokenName: string,
|
||||
tokenTicker: string,
|
||||
description: string,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { VersionedTransaction } from "@solana/web3.js";
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
|
||||
/**
|
||||
* Lend tokens for yields using Lulo
|
||||
@@ -8,7 +8,7 @@ import { SolanaAgent } from "../index";
|
||||
* @returns Transaction signature
|
||||
*/
|
||||
export async function lendAsset(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
amount: number,
|
||||
): Promise<string> {
|
||||
try {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
import { generateSigner, keypairIdentity } from "@metaplex-foundation/umi";
|
||||
import { create, mplCore } from "@metaplex-foundation/mpl-core";
|
||||
import { fetchCollection } from "@metaplex-foundation/mpl-core";
|
||||
@@ -20,7 +20,7 @@ import { MintCollectionNFTResponse } from "../types";
|
||||
* @returns Object containing NFT mint address and token account
|
||||
*/
|
||||
export async function mintCollectionNFT(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
collectionMint: PublicKey,
|
||||
metadata: {
|
||||
name: string;
|
||||
|
||||
@@ -5,10 +5,10 @@ import {
|
||||
} from "@raydium-io/raydium-sdk-v2";
|
||||
import { MintLayout, TOKEN_PROGRAM_ID } from "@solana/spl-token";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
|
||||
export async function openbookCreateMarket(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
baseMint: PublicKey,
|
||||
quoteMint: PublicKey,
|
||||
lotSize: number = 1,
|
||||
|
||||
@@ -9,10 +9,10 @@ import {
|
||||
import { MintLayout, TOKEN_PROGRAM_ID } from "@solana/spl-token";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import BN from "bn.js";
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
|
||||
export async function raydiumCreateAmmV4(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
marketId: PublicKey,
|
||||
baseAmount: BN,
|
||||
quoteAmount: BN,
|
||||
|
||||
@@ -7,10 +7,10 @@ import { MintLayout } from "@solana/spl-token";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import BN from "bn.js";
|
||||
import Decimal from "decimal.js";
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
|
||||
export async function raydiumCreateClmm(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
mint1: PublicKey,
|
||||
mint2: PublicKey,
|
||||
configId: PublicKey,
|
||||
|
||||
@@ -7,10 +7,10 @@ import {
|
||||
import { MintLayout } from "@solana/spl-token";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import BN from "bn.js";
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
|
||||
export async function raydiumCreateCpmm(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
mintA: PublicKey,
|
||||
mintB: PublicKey,
|
||||
configId: PublicKey,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { registerDomainNameV2 } from "@bonfida/spl-name-service";
|
||||
import { Transaction } from "@solana/web3.js";
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
import { getAssociatedTokenAddressSync } from "@solana/spl-token";
|
||||
import { TOKENS } from "../constants";
|
||||
|
||||
@@ -12,7 +12,7 @@ import { TOKENS } from "../constants";
|
||||
* @returns Transaction signature
|
||||
*/
|
||||
export async function registerDomain(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
name: string,
|
||||
spaceKB: number = 1,
|
||||
): Promise<string> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
import { LAMPORTS_PER_SOL } from "@solana/web3.js";
|
||||
|
||||
/**
|
||||
@@ -8,7 +8,7 @@ import { LAMPORTS_PER_SOL } from "@solana/web3.js";
|
||||
* @throws Error if the request fails or times out
|
||||
*/
|
||||
export async function request_faucet_funds(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
): Promise<string> {
|
||||
const tx = await agent.connection.requestAirdrop(
|
||||
agent.wallet_address,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { resolve } from "@bonfida/spl-name-service";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
|
||||
/**
|
||||
* Resolves a .sol domain to a Solana PublicKey.
|
||||
@@ -15,7 +15,7 @@ import { SolanaAgent } from "../index";
|
||||
* @throws Error if the domain resolution fails
|
||||
*/
|
||||
export async function resolveSolDomain(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
domain: string,
|
||||
): Promise<PublicKey> {
|
||||
if (!domain || typeof domain !== "string") {
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
PublicKey,
|
||||
TransactionInstruction,
|
||||
} from "@solana/web3.js";
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
import {
|
||||
buildAndSignTx,
|
||||
calculateComputeUnitPrice,
|
||||
@@ -56,7 +56,7 @@ export const getAirdropCostEstimate = (
|
||||
* @param shouldLog Whether to log progress to stdout. Defaults to false.
|
||||
*/
|
||||
export async function sendCompressedAirdrop(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
mintAddress: PublicKey,
|
||||
amount: number,
|
||||
decimals: number,
|
||||
@@ -119,7 +119,7 @@ export async function sendCompressedAirdrop(
|
||||
}
|
||||
|
||||
async function processAll(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
amount: number,
|
||||
mint: PublicKey,
|
||||
recipients: PublicKey[],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { VersionedTransaction } from "@solana/web3.js";
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
|
||||
/**
|
||||
* Stake SOL with Jup validator
|
||||
@@ -8,7 +8,7 @@ import { SolanaAgent } from "../index";
|
||||
* @returns Transaction signature
|
||||
*/
|
||||
export async function stakeWithJup(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
amount: number,
|
||||
): Promise<string> {
|
||||
try {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
PublicKey,
|
||||
LAMPORTS_PER_SOL,
|
||||
} from "@solana/web3.js";
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
import { TOKENS, DEFAULT_OPTIONS, JUP_API } from "../constants";
|
||||
|
||||
/**
|
||||
@@ -16,7 +16,7 @@ import { TOKENS, DEFAULT_OPTIONS, JUP_API } from "../constants";
|
||||
* @returns Transaction signature
|
||||
*/
|
||||
export async function trade(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
outputMint: PublicKey,
|
||||
inputAmount: number,
|
||||
inputMint: PublicKey = TOKENS.USDC,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SolanaAgent } from "../index";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
import { PublicKey, SystemProgram, Transaction } from "@solana/web3.js";
|
||||
import { LAMPORTS_PER_SOL } from "@solana/web3.js";
|
||||
import {
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
* @returns Transaction signature
|
||||
*/
|
||||
export async function transfer(
|
||||
agent: SolanaAgent,
|
||||
agent: SolanaAgentKit,
|
||||
to: PublicKey,
|
||||
amount: number,
|
||||
mint?: PublicKey,
|
||||
|
||||
Reference in New Issue
Block a user