-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6cf265
commit 620640e
Showing
13 changed files
with
98 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@degenfrends/solana-rugchecker': patch | ||
--- | ||
|
||
## @degenfrends/solana-rugchecker: Initial version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { config } from 'dotenv'; | ||
import axios from 'axios'; | ||
import MarketdataCheckConfig from '../model/config/marketdata-check'; | ||
import MarketdataCheckResult from '../model/result/marketdata-check'; | ||
|
||
config(); | ||
|
||
export default class MarketdataChecker { | ||
constructor({}: MarketdataCheckConfig) {} | ||
|
||
async check(tokenAddress: string): Promise<MarketdataCheckResult> { | ||
const marketdataResponse = await axios.get('https://api.dexscreener.com/latest/dex/tokens/' + tokenAddress, { | ||
timeout: 300000, | ||
responseType: 'json' | ||
}); | ||
let marketdataResult = this.createMarketdataCheckResult(marketdataResponse.data.pairs[0]); | ||
marketdataResult.address = tokenAddress; | ||
return marketdataResult; | ||
} | ||
|
||
private createMarketdataCheckResult(marketdata: any): MarketdataCheckResult { | ||
const metadataCheckResult = new MarketdataCheckResult(); | ||
metadataCheckResult.priceSol = marketdata.priceNative; | ||
metadataCheckResult.priceUsd = marketdata.priceUsd; | ||
metadataCheckResult.liquidityUsd = marketdata.liquidity.usd; | ||
metadataCheckResult.fdv = marketdata.fdv; | ||
metadataCheckResult.volume24h = marketdata.volume.h24; | ||
metadataCheckResult.volume6h = marketdata.volume.h6; | ||
metadataCheckResult.volume1h = marketdata.volume.h1; | ||
metadataCheckResult.volume5m = marketdata.volume.m5; | ||
metadataCheckResult.priceChange24h = marketdata.priceChange.h24; | ||
metadataCheckResult.priceChange6h = marketdata.priceChange.h6; | ||
metadataCheckResult.priceChange1h = marketdata.priceChange.h1; | ||
metadataCheckResult.priceChange5m = marketdata.priceChange.m5; | ||
metadataCheckResult.buys24h = marketdata.txns.h24.buys; | ||
metadataCheckResult.buys6h = marketdata.txns.h6.buys; | ||
metadataCheckResult.buys1h = marketdata.txns.h1.buys; | ||
metadataCheckResult.buys5m = marketdata.txns.m5.buys; | ||
metadataCheckResult.sells24h = marketdata.txns.h24.sells; | ||
metadataCheckResult.sells6h = marketdata.txns.h6.sells; | ||
metadataCheckResult.sells1h = marketdata.txns.h1.sells; | ||
metadataCheckResult.sells5m = marketdata.txns.m5.sells; | ||
return metadataCheckResult; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default class MarketdataCheckConfig {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export default class MarketdataCheckResult { | ||
address: string; | ||
priceSol: number; | ||
priceUsd: number; | ||
liquidityUsd: number; | ||
fdv: number; | ||
volume24h: number; | ||
volume6h: number; | ||
volume1h: number; | ||
volume5m: number; | ||
priceChange24h: number; | ||
priceChange6h: number; | ||
priceChange1h: number; | ||
priceChange5m: number; | ||
buys24h: number; | ||
buys6h: number; | ||
buys1h: number; | ||
buys5m: number; | ||
sells24h: number; | ||
sells6h: number; | ||
sells1h: number; | ||
sells5m: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import HoldersCheckResult from './holders-check'; | ||
import LiquidityCheckResult from './liquidity-check'; | ||
import MarketdataCheckResult from './marketdata-check'; | ||
import MetadataCheckResult from './metadata-check'; | ||
|
||
export default class RugCheckResult { | ||
address: string; | ||
metadata: MetadataCheckResult; | ||
holders: HoldersCheckResult; | ||
liquidity: LiquidityCheckResult; | ||
marketdata: MarketdataCheckResult; | ||
} |