mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-05-24 23:26:44 +00:00
Merge branch 'main' into feature/tensor-sdk
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
deploy_collection,
|
||||
deploy_token,
|
||||
get_balance,
|
||||
get_balance_other,
|
||||
getTPS,
|
||||
resolveSolDomain,
|
||||
getPrimaryDomain,
|
||||
@@ -24,10 +25,13 @@ import {
|
||||
getTokenDataByTicker,
|
||||
stakeWithJup,
|
||||
sendCompressedAirdrop,
|
||||
createOrcaSingleSidedWhirlpool,
|
||||
orcaCreateSingleSidedLiquidityPool,
|
||||
orcaCreateCLMM,
|
||||
orcaOpenCenteredPositionWithLiquidity,
|
||||
orcaOpenSingleSidedPosition,
|
||||
FEE_TIERS,
|
||||
fetchPrice,
|
||||
pythFetchPrice,
|
||||
FEE_TIERS,
|
||||
getAllDomainsTLDs,
|
||||
getAllRegisteredAllDomains,
|
||||
getOwnedDomainsForTLD,
|
||||
@@ -35,11 +39,14 @@ import {
|
||||
getOwnedAllDomains,
|
||||
resolveAllDomains,
|
||||
create_gibwork_task,
|
||||
orcaClosePosition,
|
||||
orcaFetchPositions,
|
||||
rock_paper_scissor,
|
||||
create_TipLink,
|
||||
listNFTForSale,
|
||||
cancelListing,
|
||||
} from "../tools";
|
||||
|
||||
import {
|
||||
CollectionDeployment,
|
||||
CollectionOptions,
|
||||
@@ -64,12 +71,12 @@ export class SolanaAgentKit {
|
||||
public connection: Connection;
|
||||
public wallet: Keypair;
|
||||
public wallet_address: PublicKey;
|
||||
public openai_api_key: string;
|
||||
public openai_api_key: string | null;
|
||||
|
||||
constructor(
|
||||
private_key: string,
|
||||
rpc_url = "https://api.mainnet-beta.solana.com",
|
||||
openai_api_key: string,
|
||||
openai_api_key: string | null = null,
|
||||
) {
|
||||
this.connection = new Connection(rpc_url);
|
||||
this.wallet = Keypair.fromSecretKey(bs58.decode(private_key));
|
||||
@@ -102,6 +109,13 @@ export class SolanaAgentKit {
|
||||
return get_balance(this, token_address);
|
||||
}
|
||||
|
||||
async getBalanceOther(
|
||||
walletAddress: PublicKey,
|
||||
tokenAddress?: PublicKey,
|
||||
): Promise<number> {
|
||||
return get_balance_other(this, walletAddress, tokenAddress);
|
||||
}
|
||||
|
||||
async mintNFT(
|
||||
collectionMint: PublicKey,
|
||||
metadata: Parameters<typeof mintCollectionNFT>[2],
|
||||
@@ -203,15 +217,28 @@ export class SolanaAgentKit {
|
||||
);
|
||||
}
|
||||
|
||||
async createOrcaSingleSidedWhirlpool(
|
||||
depositTokenAmount: BN,
|
||||
async orcaClosePosition(positionMintAddress: PublicKey) {
|
||||
return orcaClosePosition(this, positionMintAddress);
|
||||
}
|
||||
|
||||
async orcaCreateCLMM(
|
||||
mintDeploy: PublicKey,
|
||||
mintPair: PublicKey,
|
||||
initialPrice: Decimal,
|
||||
feeTier: keyof typeof FEE_TIERS,
|
||||
) {
|
||||
return orcaCreateCLMM(this, mintDeploy, mintPair, initialPrice, feeTier);
|
||||
}
|
||||
|
||||
async orcaCreateSingleSidedLiquidityPool(
|
||||
depositTokenAmount: number,
|
||||
depositTokenMint: PublicKey,
|
||||
otherTokenMint: PublicKey,
|
||||
initialPrice: Decimal,
|
||||
maxPrice: Decimal,
|
||||
feeTier: keyof typeof FEE_TIERS,
|
||||
) {
|
||||
return createOrcaSingleSidedWhirlpool(
|
||||
return orcaCreateSingleSidedLiquidityPool(
|
||||
this,
|
||||
depositTokenAmount,
|
||||
depositTokenMint,
|
||||
@@ -222,6 +249,42 @@ export class SolanaAgentKit {
|
||||
);
|
||||
}
|
||||
|
||||
async orcaFetchPositions() {
|
||||
return orcaFetchPositions(this);
|
||||
}
|
||||
|
||||
async orcaOpenCenteredPositionWithLiquidity(
|
||||
whirlpoolAddress: PublicKey,
|
||||
priceOffsetBps: number,
|
||||
inputTokenMint: PublicKey,
|
||||
inputAmount: Decimal,
|
||||
) {
|
||||
return orcaOpenCenteredPositionWithLiquidity(
|
||||
this,
|
||||
whirlpoolAddress,
|
||||
priceOffsetBps,
|
||||
inputTokenMint,
|
||||
inputAmount,
|
||||
);
|
||||
}
|
||||
|
||||
async orcaOpenSingleSidedPosition(
|
||||
whirlpoolAddress: PublicKey,
|
||||
distanceFromCurrentPriceBps: number,
|
||||
widthBps: number,
|
||||
inputTokenMint: PublicKey,
|
||||
inputAmount: Decimal,
|
||||
): Promise<string> {
|
||||
return orcaOpenSingleSidedPosition(
|
||||
this,
|
||||
whirlpoolAddress,
|
||||
distanceFromCurrentPriceBps,
|
||||
widthBps,
|
||||
inputTokenMint,
|
||||
inputAmount,
|
||||
);
|
||||
}
|
||||
|
||||
async resolveAllDomains(domain: string): Promise<PublicKey | undefined> {
|
||||
return resolveAllDomains(this, domain);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user