@@ -4,6 +4,7 @@ import { calculateTokenPercentages, formatNumber } from "../utils/solana";
4
4
import { Pair } from "../models/Pair" ;
5
5
6
6
export function poolsInfoMessage ( positions : Position [ ] ) {
7
+ let botName = process . env . BOT_NAME ;
7
8
let poolInfoMessage = "" ;
8
9
9
10
for ( var position of positions ) {
@@ -12,111 +13,108 @@ export function poolsInfoMessage(positions: Position[]) {
12
13
const tokenPercentages = calculateTokenPercentages ( position ) ;
13
14
const isOutRange =
14
15
tokenPercentages . tokenX === 100 || tokenPercentages . tokenY === 100 ;
15
- const urlPositionDetail = `https://t.me/meteora_lp_test_bot ?start=position_${ position . poolKey } ` ;
16
+ const urlPositionDetail = `https://t.me/${ botName } ?start=position_${ position . poolKey } ` ;
16
17
17
18
poolInfoMessage += `
18
- ${
19
- isOutRange ? "🔴" : "🟢"
20
- } <a href="${ urlPositionDetail } "><b>${ tokenXSymbol } -${ tokenYSymbol } </b></a> - Current price (${ position . totalCurrent . exchangeRate . toFixed (
21
- 8
22
- ) } ) - <a href="https://app.meteora.ag/dlmm/${ position . poolKey } ">🪐</a>
19
+ ${ isOutRange ? "🔴" : "🟢"
20
+ } <a href="${ urlPositionDetail } "><b>${ tokenXSymbol } -${ tokenYSymbol } </b></a> - Current price (${ position . totalCurrent . exchangeRate . toFixed (
21
+ 8
22
+ ) } ) - <a href="https://app.meteora.ag/dlmm/${ position . poolKey } ">🪐</a>
23
23
<code>${ position . poolKey } </code>
24
24
25
25
• <b>Range:</b> ${ parseFloat ( position . startBinPricePerToken ) . toFixed (
26
- 8
27
- ) } - ${ parseFloat ( position . lastBinPricePerToken ) . toFixed ( 8 ) } ${
28
- isOutRange ? "⚠️ Out of range" : ""
29
- }
26
+ 8
27
+ ) } - ${ parseFloat ( position . lastBinPricePerToken ) . toFixed ( 8 ) } ${ isOutRange ? "⚠️ Out of range" : ""
28
+ }
30
29
• <b>${ tokenXSymbol } :</b> ${ tokenPercentages . tokenX } %
31
30
• <b>${ tokenYSymbol } :</b> ${ tokenPercentages . tokenY } %
32
31
33
32
• <b>Liquidity:</b> $${ position . totalCurrent . totalValueInTokenY . toFixed ( 2 ) }
34
33
• <b>Fees Claimed:</b> $${ position . totalUnclaimedFees . totalValueInTokenY . toFixed (
35
- 2
36
- ) }
34
+ 2
35
+ ) }
37
36
• <b>Current Balance:</b> ${ position . totalCurrent . tokenXBalance . toFixed (
38
- 4
39
- ) } ${ tokenXSymbol } - ${ position . totalCurrent . tokenYBalance . toFixed (
40
- 4
41
- ) } ${ tokenYSymbol }
37
+ 4
38
+ ) } ${ tokenXSymbol } - ${ position . totalCurrent . tokenYBalance . toFixed (
39
+ 4
40
+ ) } ${ tokenYSymbol }
42
41
• <b>Unclaimed Swap Fee:</b> ${ position . totalUnclaimedFees . tokenXBalance . toFixed (
43
- 6
44
- ) } ${ tokenXSymbol } - ${ position . totalUnclaimedFees . tokenYBalance . toFixed (
45
- 6
46
- ) } ${ tokenYSymbol }
42
+ 6
43
+ ) } ${ tokenXSymbol } - ${ position . totalUnclaimedFees . tokenYBalance . toFixed (
44
+ 6
45
+ ) } ${ tokenYSymbol }
47
46
` ;
48
47
}
49
48
50
49
return poolInfoMessage ;
51
50
}
52
51
53
52
export function poolsCompletePositionInfoMessage ( position : Position ) {
53
+ let botName = process . env . BOT_NAME ;
54
54
let poolInfoMessage = "" ;
55
55
56
56
const tokenXSymbol = position . tokenX . symbol ;
57
57
const tokenYSymbol = position . tokenY . symbol ;
58
58
const tokenPercentages = calculateTokenPercentages ( position ) ;
59
59
const isOutRange =
60
60
tokenPercentages . tokenX === 100 || tokenPercentages . tokenY === 100 ;
61
- const urlPositionDetail = `https://t.me/meteora_lp_test_bot ?start=position_${ position . poolKey } ` ;
61
+ const urlPositionDetail = `https://t.me/${ botName } ?start=position_${ position . poolKey } ` ;
62
62
63
63
poolInfoMessage += `
64
- ${
65
- isOutRange ? "🔴" : "🟢"
66
- } <a href="${ urlPositionDetail } "><b>${ tokenXSymbol } -${ tokenYSymbol } </b></a> - Current price (${ position . totalCurrent . exchangeRate . toFixed (
67
- 8
68
- ) } ) - <a href="https://app.meteora.ag/dlmm/${ position . poolKey } ">🪐</a>
64
+ ${ isOutRange ? "🔴" : "🟢"
65
+ } <a href="${ urlPositionDetail } "><b>${ tokenXSymbol } -${ tokenYSymbol } </b></a> - Current price (${ position . totalCurrent . exchangeRate . toFixed (
66
+ 8
67
+ ) } ) - <a href="https://app.meteora.ag/dlmm/${ position . poolKey } ">🪐</a>
69
68
<code>${ position . poolKey } </code>
70
69
71
70
• <b>Bin Step:</b> ${ position . pairInfo . binStep }
72
71
• <b>Base Fee:</b> ${ position . pairInfo . baseFeePercentage } %
73
72
• <b>Max Fee:</b> ${ position . pairInfo . maxFeePercentage } %
74
73
75
74
• <b>Pool liquidity:</b> ${ formatNumber (
76
- parseFloat ( position . pairInfo . liquidity )
77
- ) }
75
+ parseFloat ( position . pairInfo . liquidity )
76
+ ) }
78
77
• <b>Daily Yield:</b> ${ position . pairInfo . apr . toFixed ( 2 ) } %
79
78
• <b>24h volume:</b> ${ formatNumber ( position . pairInfo . tradeVolume24h ) }
80
79
• <b>24h fees:</b> ${ formatNumber ( position . pairInfo . fees24h ) }
81
80
82
81
• <b>Range:</b> ${ parseFloat ( position . startBinPricePerToken ) . toFixed (
83
- 8
84
- ) } - ${ parseFloat ( position . lastBinPricePerToken ) . toFixed ( 8 ) } ${
85
- isOutRange ? "⚠️ Out of range" : ""
86
- }
82
+ 8
83
+ ) } - ${ parseFloat ( position . lastBinPricePerToken ) . toFixed ( 8 ) } ${ isOutRange ? "⚠️ Out of range" : ""
84
+ }
87
85
• <b>${ tokenXSymbol } :</b> ${ tokenPercentages . tokenX } %
88
86
• <b>${ tokenYSymbol } :</b> ${ tokenPercentages . tokenY } %
89
87
90
88
• <b>Liquidity:</b> $${ position . totalCurrent . totalValueInTokenY . toFixed ( 2 ) }
91
89
• <b>Fees Claimed:</b> $${ position . totalUnclaimedFees . totalValueInTokenY . toFixed (
92
- 2
93
- ) }
90
+ 2
91
+ ) }
94
92
• <b>Current Balance:</b> ${ position . totalCurrent . tokenXBalance . toFixed (
95
- 4
96
- ) } ${ tokenXSymbol } - ${ position . totalCurrent . tokenYBalance . toFixed (
97
- 4
98
- ) } ${ tokenYSymbol }
93
+ 4
94
+ ) } ${ tokenXSymbol } - ${ position . totalCurrent . tokenYBalance . toFixed (
95
+ 4
96
+ ) } ${ tokenYSymbol }
99
97
• <b>Unclaimed Swap Fee:</b> ${ position . totalUnclaimedFees . tokenXBalance . toFixed (
100
- 6
101
- ) } ${ tokenXSymbol } - ${ position . totalUnclaimedFees . tokenYBalance . toFixed (
102
- 6
103
- ) } ${ tokenYSymbol }
98
+ 6
99
+ ) } ${ tokenXSymbol } - ${ position . totalUnclaimedFees . tokenYBalance . toFixed (
100
+ 6
101
+ ) } ${ tokenYSymbol }
104
102
` ;
105
103
106
104
return poolInfoMessage ;
107
105
}
108
106
109
107
export function poolsCompleteInfoMessage ( pairInfo : PairInfo ) {
108
+ let botName = process . env . BOT_NAME ;
110
109
let poolInfoMessage = "" ;
111
- const urlPositionDetail = `https://t.me/meteora_lp_test_bot ?start=pair_${ pairInfo . address } ` ;
110
+ const urlPositionDetail = `https://t.me/${ botName } ?start=pair_${ pairInfo . address } ` ;
112
111
113
112
poolInfoMessage += `
114
113
115
- <a href="${ urlPositionDetail } "><b>${
116
- pairInfo . name
117
- } </b></a> - Current price (${ pairInfo . currentPrice . toFixed (
118
- 9
119
- ) } ) - <a href="https://app.meteora.ag/dlmm/${ pairInfo . address } ">🪐</a>
114
+ <a href="${ urlPositionDetail } "><b>${ pairInfo . name
115
+ } </b></a> - Current price (${ pairInfo . currentPrice . toFixed (
116
+ 9
117
+ ) } ) - <a href="https://app.meteora.ag/dlmm/${ pairInfo . address } ">🪐</a>
120
118
<code>${ pairInfo . address } </code>
121
119
122
120
• <b>Bin Step:</b> ${ pairInfo . binStep }
@@ -135,6 +133,7 @@ export function poolsCompleteInfoMessage(pairInfo: PairInfo) {
135
133
}
136
134
137
135
export function pairListMessage ( pairResponse : PairResponse ) {
136
+ let botName = process . env . BOT_NAME ;
138
137
let pairInfoMessage = "" ;
139
138
140
139
for ( var group of pairResponse . groups ) {
@@ -159,8 +158,8 @@ export function pairListMessage(pairResponse: PairResponse) {
159
158
return sum + ( isNaN ( fee ) ? 0 : fee ) ;
160
159
} , 0 ) ;
161
160
const numPools = group . pairs . length ;
162
- const urlPairListDetail = `https://t.me/meteora_lp_test_bot ?start=pairListDetail_${ pairName } ` ;
163
- const urlPairDetail = `https://t.me/meteora_lp_test_bot ?start=pair_` ;
161
+ const urlPairListDetail = `https://t.me/${ botName } ?start=pairListDetail_${ pairName } ` ;
162
+ const urlPairDetail = `https://t.me/${ botName } ?start=pair_` ;
164
163
165
164
if ( ! isOnlyOnePool ) {
166
165
pairInfoMessage += `
@@ -189,6 +188,7 @@ export function pairListMessage(pairResponse: PairResponse) {
189
188
}
190
189
191
190
export function pairListDetailMessage ( pairs : Pair [ ] ) {
191
+ let botName = process . env . BOT_NAME ;
192
192
let pairInfoMessage = "" ;
193
193
194
194
for ( var pair of pairs ) {
@@ -198,15 +198,13 @@ export function pairListDetailMessage(pairs: Pair[]) {
198
198
const totalTvl = parseFloat ( pair . liquidity ) ;
199
199
const totalVolume24h = pair . tradeVolume24h ;
200
200
const totalFee24h = pair . fees24h ;
201
- const urlPairDetail = `https://t.me/meteora_lp_test_bot ?start=pair_` ;
201
+ const urlPairDetail = `https://t.me/${ botName } ?start=pair_` ;
202
202
203
203
pairInfoMessage += `
204
204
205
- <a href="${ urlPairDetail } ${
206
- pair . address
207
- } "><b>${ pairName } </b></a> - <a href="https://app.meteora.ag/dlmm/${
208
- pair . address
209
- } ">🪐</a>
205
+ <a href="${ urlPairDetail } ${ pair . address
206
+ } "><b>${ pairName } </b></a> - <a href="https://app.meteora.ag/dlmm/${ pair . address
207
+ } ">🪐</a>
210
208
<code>${ pair . address } </code>
211
209
212
210
• <b>Bin Step:</b> ${ binStep }
0 commit comments