Skip to content

Commit

Permalink
Merge pull request #29 from adpthegreat/gib-bounty-sol033188
Browse files Browse the repository at this point in the history
Support Resolving AD Domains
  • Loading branch information
thearyanag authored Dec 24, 2024
2 parents daec25f + 737d5ce commit 838a265
Show file tree
Hide file tree
Showing 12 changed files with 1,004 additions and 26 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"build": "tsc",
"docs": "typedoc src --out docs",
"test": "ts-node test/index.ts",
"test:domain": "ts-node test/domain_methods.test.ts",
"generate": "ts-node src/utils/keypair.ts"
},
"engines": {
Expand All @@ -32,6 +33,7 @@
"@metaplex-foundation/umi": "^0.9.2",
"@metaplex-foundation/umi-bundle-defaults": "^0.9.2",
"@metaplex-foundation/umi-web3js-adapters": "^0.9.2",
"@onsol/tldparser": "^0.6.7",
"@orca-so/common-sdk": "0.6.4",
"@orca-so/whirlpools-sdk": "^0.13.12",
"@pythnetwork/price-service-client": "^1.9.0",
Expand All @@ -40,6 +42,7 @@
"@solana/web3.js": "^1.95.4",
"bn.js": "^5.2.1",
"bs58": "^6.0.0",
"chai": "^5.1.2",
"decimal.js": "^10.4.3",
"dotenv": "^16.4.5",
"form-data": "^4.0.1",
Expand All @@ -49,6 +52,7 @@
},
"devDependencies": {
"@types/bn.js": "^5.1.5",
"@types/chai": "^5.0.1",
"@types/node": "^22.9.0",
"ts-node": "^10.9.2",
"typescript": "^5.7.2"
Expand Down
448 changes: 448 additions & 0 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

56 changes: 46 additions & 10 deletions src/agent/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ import {
createOrcaSingleSidedWhirlpool,
FEE_TIERS,
pythFetchPrice,
getAllDomainsTLDs,
getAllRegisteredAllDomains,
getOwnedDomainsForTLD,
getMainAllDomainsDomain,
getOwnedAllDomains,
resolveAllDomains,
} from "../tools";
import {
CollectionDeployment,
Expand All @@ -37,6 +43,7 @@ import {
PumpFunTokenOptions,
} from "../types";
import { BN } from "@coral-xyz/anchor";
import { NameAccountAndDomain } from "@onsol/tldparser";

/**
* Main class for interacting with Solana blockchain
Expand Down Expand Up @@ -192,24 +199,52 @@ export class SolanaAgentKit {
otherTokenMint: PublicKey,
initialPrice: Decimal,
maxPrice: Decimal,
feeTier: keyof typeof FEE_TIERS,
): Promise<string> {
feeTier: keyof typeof FEE_TIERS
) {
return createOrcaSingleSidedWhirlpool(
this,
depositTokenAmount,
depositTokenMint,
otherTokenMint,
initialPrice,
maxPrice,
feeTier,
feeTier
);
}

async resolveAllDomains(domain: string): Promise<PublicKey | undefined> {
return resolveAllDomains(this, domain);
}

async getOwnedAllDomains(
owner: PublicKey
): Promise<string[]> {
return getOwnedAllDomains(this, owner);
}

async getOwnedDomainsForTLD(
tld: string
):Promise<string[]> {
return getOwnedDomainsForTLD(this, tld);
}

async getAllDomainsTLDs(): Promise<String[]> {
return getAllDomainsTLDs(this);
}

async getAllRegisteredAllDomains(): Promise<string[]> {
return getAllRegisteredAllDomains(this);
}

async getMainAllDomainsDomain(owner: PublicKey): Promise<string | null> {
return getMainAllDomainsDomain(this, owner);
}

async raydiumCreateAmmV4(
marketId: PublicKey,
baseAmount: BN,
quoteAmount: BN,
startTime: BN,
startTime: BN
): Promise<string> {
return raydiumCreateAmmV4(
this,
Expand All @@ -218,16 +253,16 @@ export class SolanaAgentKit {
baseAmount,
quoteAmount,

startTime,
);
startTime
);;
}

async raydiumCreateClmm(
mint1: PublicKey,
mint2: PublicKey,
configId: PublicKey,
initialPrice: Decimal,
startTime: BN,
startTime: BN
): Promise<string> {
return raydiumCreateClmm(
this,
Expand All @@ -245,7 +280,7 @@ export class SolanaAgentKit {
configId: PublicKey,
mintAAmount: BN,
mintBAmount: BN,
startTime: BN,
startTime: BN
): Promise<string> {
return raydiumCreateCpmm(
this,
Expand All @@ -254,15 +289,16 @@ export class SolanaAgentKit {
configId,
mintAAmount,
mintBAmount,
startTime,

startTime
);
}

async openbookCreateMarket(
baseMint: PublicKey,
quoteMint: PublicKey,
lotSize: number = 1,
tickSize: number = 0.01,
tickSize: number = 0.01
): Promise<string[]> {
return openbookCreateMarket(
this,
Expand Down
Loading

0 comments on commit 838a265

Please sign in to comment.