Skip to content

Commit

Permalink
changed lp id retrival
Browse files Browse the repository at this point in the history
  • Loading branch information
kryptobrah committed Jun 9, 2024
1 parent 3ac1f9e commit b6c6c32
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/lqpapi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@degenfrends/solana-rugchecker': patch
---

## @degenfrends/solana-rugchecker: Initial version
Empty file added download-pools
Empty file.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async function main() {
const result = await rugChecker.check('97oWtQfbZMdDbn1jdNciDHm2vnPBR8VT3Ns7vSS7i9cm');
const score = rugChecker.rugScore(result);
const isRug = rugChecker.isRug(result);
console.log(isRug);
console.log(result);
}
async function website() {
const website = 'patriotsmonth.xyz';
Expand Down
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@metaplex-foundation/js": "^0.20.1",
"@raydium-io/raydium-sdk": "^1.3.1-beta.52",
"@solana/web3.js": "^1.92.3",
"axios": "^1.7.2",
"dotenv": "^16.4.5",
"web3": "^4.9.0",
"whois": "^2.14.2",
Expand Down
15 changes: 14 additions & 1 deletion src/checker/liquidity-checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { promises as fs } from 'fs';
import { LIQUIDITY_STATE_LAYOUT_V4 } from '@raydium-io/raydium-sdk';
import LiquidityCheckConfig from '../model/config/liquidity-check';
import LiquidityCheckResult from '../model/result/liquidity-check';
import axios from 'axios';

export default class LiquidityChecker {
private connection: Connection;
Expand All @@ -24,7 +25,7 @@ export default class LiquidityChecker {
}

async check(tokenAddress: string): Promise<LiquidityCheckResult> {
const poolAddress = await this.getLiquidityPool(tokenAddress);
const poolAddress = await this.getRaydiumPoolAddress(tokenAddress);
const liquidityCheckResult = new LiquidityCheckResult();
if (!poolAddress) {
//throw new Error('No pool found');
Expand Down Expand Up @@ -63,4 +64,16 @@ export default class LiquidityChecker {
return '';
}
}

async getRaydiumPoolAddress(mintAddress: string) {
try {
const url = 'https://api.geckoterminal.com/api/v2/networks/solana/tokens/' + mintAddress;

const response = await axios.get(url);
console.log(response);
return response.data.data.relationships.top_pools.data[0].id.replace('solana_', '');
} catch (error) {
console.error('Error fetching pool address:', error);
}
}
}

0 comments on commit b6c6c32

Please sign in to comment.