@@ -8,12 +8,9 @@ jest.mock("fs");
8
8
jest . mock ( "node-cache" ) ;
9
9
10
10
describe ( "TokenProvider Tests" , ( ) => {
11
- // let connection: Connection;
12
11
let tokenProvider : TokenProvider ;
13
12
14
13
beforeEach ( ( ) => {
15
- // Initialize the connection and token provider before each test
16
- // connection = new Connection("https://api.mainnet-beta.solana.com");
17
14
tokenProvider = new TokenProvider (
18
15
"2weMjPLLybRMMva1fM3U31goWWrCpF59CHWNhnCJ9Vyh"
19
16
) ;
@@ -28,12 +25,123 @@ describe("TokenProvider Tests", () => {
28
25
const mockFetchResponse = {
29
26
success : true ,
30
27
data : {
31
- ownerBalance : "100" ,
32
- creatorBalance : "50" ,
33
- ownerPercentage : 10 ,
34
- creatorPercentage : 5 ,
35
- top10HolderBalance : "200" ,
36
- top10HolderPercent : 20 ,
28
+ // Security Data
29
+ security : {
30
+ ownerBalance : "1000" ,
31
+ creatorBalance : "500" ,
32
+ ownerPercentage : 10 , // Represents 10%
33
+ creatorPercentage : 5 , // Represents 5%
34
+ top10HolderBalance : "2000" ,
35
+ top10HolderPercent : 20 , // Represents 20%
36
+ } ,
37
+ // Trade Data
38
+ tradeData : {
39
+ holder : 1500 ,
40
+ unique_wallet_24h : 120 ,
41
+ price_change_24h_percent : 4.5 , // 4.5%
42
+ price_change_12h_percent : 2.3 , // 2.3%
43
+ volume_24h_usd : "75000.50" , // String representation for consistency
44
+ price : "2.50" , // Current price in USD as a string
45
+ // Add additional trade-related fields if necessary
46
+ } ,
47
+ // Holder Distribution Trend
48
+ holderDistributionTrend : "increasing" , // Possible values: 'increasing', 'decreasing', 'stable'
49
+ // High-Value Holders
50
+ highValueHolders : [
51
+ {
52
+ holderAddress : "0xHolderAddress1" ,
53
+ balanceUsd : "6000.00" ,
54
+ } ,
55
+ {
56
+ holderAddress : "0xHolderAddress2" ,
57
+ balanceUsd : "5500.00" ,
58
+ } ,
59
+ // Add more high-value holders as needed
60
+ ] ,
61
+ // Recent Trades Indicator
62
+ recentTrades : true , // Indicates whether there have been recent trades in the last 24 hours
63
+ // High-Supply Holders Count
64
+ highSupplyHoldersCount : 15 , // Number of holders holding more than 2% of the total supply
65
+ // DexScreener Data
66
+ dexScreenerData : {
67
+ schemaVersion : "1.0" ,
68
+ pairs : [
69
+ {
70
+ chainId : "1" , // Example Chain ID (e.g., Ethereum Mainnet)
71
+ dexId : "Uniswap" , // Decentralized Exchange Identifier
72
+ url : "https://uniswap.org" , // URL to the DEX
73
+ pairAddress : "0xPairAddress1" ,
74
+ baseToken : {
75
+ address : "0xBaseTokenAddress1" ,
76
+ name : "Base Token Name" ,
77
+ symbol : "BASE" ,
78
+ } ,
79
+ quoteToken : {
80
+ address : "0xQuoteTokenAddress1" ,
81
+ name : "Quote Token Name" ,
82
+ symbol : "QUOTE" ,
83
+ } ,
84
+ priceNative : "0.002" , // Price in native blockchain currency (e.g., ETH)
85
+ priceUsd : "2.50" , // Price in USD as a string
86
+ txns : {
87
+ m5 : { buys : 15 , sells : 10 } , // Transactions in the last 5 minutes
88
+ h1 : { buys : 60 , sells : 45 } , // Transactions in the last hour
89
+ h6 : { buys : 300 , sells : 270 } , // Transactions in the last 6 hours
90
+ h24 : { buys : 1200 , sells : 1100 } , // Transactions in the last 24 hours
91
+ } ,
92
+ volume : {
93
+ h24 : 50000 , // Volume in the last 24 hours in USD
94
+ h6 : 30000 , // Volume in the last 6 hours in USD
95
+ h1 : 15000 , // Volume in the last hour in USD
96
+ m5 : 5000 , // Volume in the last 5 minutes in USD
97
+ } ,
98
+ priceChange : {
99
+ m5 : 0.5 , // Price change in the last 5 minutes
100
+ h1 : 1.2 , // Price change in the last hour
101
+ h6 : 3.5 , // Price change in the last 6 hours
102
+ h24 : 5.0 , // Price change in the last 24 hours
103
+ } ,
104
+ liquidity : {
105
+ usd : 1000000 , // Liquidity in USD
106
+ base : 500000 , // Liquidity in base token
107
+ quote : 500000 , // Liquidity in quote token
108
+ } ,
109
+ fdv : 2000000 , // Fully Diluted Valuation in USD
110
+ marketCap : 1500000 , // Market Capitalization in USD
111
+ pairCreatedAt : 1633036800 , // Unix timestamp for pair creation
112
+ info : {
113
+ imageUrl : "https://example.com/image.png" , // URL to the pair's image
114
+ websites : [
115
+ {
116
+ label : "Official Website" ,
117
+ url : "https://example.com" ,
118
+ } ,
119
+ {
120
+ label : "Documentation" ,
121
+ url : "https://docs.example.com" ,
122
+ } ,
123
+ ] ,
124
+ socials : [
125
+ {
126
+ type : "Twitter" ,
127
+ url : "https://twitter.com/example" ,
128
+ } ,
129
+ {
130
+ type : "Discord" ,
131
+ url : "https://discord.gg/example" ,
132
+ } ,
133
+ ] ,
134
+ } ,
135
+ boosts : {
136
+ active : 2 , // Number of active boosts
137
+ } ,
138
+ } ,
139
+ // Add more DexScreenerPair objects as needed
140
+ ] ,
141
+ } ,
142
+ // DexScreener Listing Status
143
+ isDexScreenerListed : true , // Indicates if the token is listed on DexScreener
144
+ isDexScreenerPaid : false , // Indicates if the listing on DexScreener is paid
37
145
} ,
38
146
} ;
39
147
@@ -67,8 +175,7 @@ describe("TokenProvider Tests", () => {
67
175
// const dexScreenerData = await tokenProvider.fetchDexScreenerData();
68
176
// console.log({ dexScreenerData });
69
177
70
- const tokenReport =
71
- await tokenProvider . getFormattedTokenReport ( runtime ) ;
178
+ const tokenReport = await tokenProvider . getFormattedTokenReport ( ) ;
72
179
console . log ( { tokenReport } ) ;
73
180
74
181
// Ensure the mock was called
0 commit comments