Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F12428794
D17293.id51408.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
9 KB
Subscribers
None
D17293.id51408.diff
View Options
diff --git a/apps/ecash-herald/scripts/getDailySummary.ts b/apps/ecash-herald/scripts/getDailySummary.ts
--- a/apps/ecash-herald/scripts/getDailySummary.ts
+++ b/apps/ecash-herald/scripts/getDailySummary.ts
@@ -120,7 +120,8 @@
timestamp,
timeFirstSeenTxs,
tokenInfoMap,
- 3, // tokens to show
+ 3, // agora tokens to show
+ 0, // non-agora tokens to show
priceInfo,
activeStakers,
);
diff --git a/apps/ecash-herald/src/events.ts b/apps/ecash-herald/src/events.ts
--- a/apps/ecash-herald/src/events.ts
+++ b/apps/ecash-herald/src/events.ts
@@ -372,12 +372,14 @@
// Do not include this info in the tg msg
}
- const TOKENS_TO_SHOW_PROD = 3;
+ const AGORA_TOKENS_MAX_RENDER = 3;
+ const NON_AGORA_TOKENS_MAX_RENDER = 0;
const dailySummaryTgMsgs = summarizeTxHistory(
newDayTimestamp,
timeFirstSeenTxs,
tokenInfoMap,
- TOKENS_TO_SHOW_PROD,
+ AGORA_TOKENS_MAX_RENDER,
+ NON_AGORA_TOKENS_MAX_RENDER,
priceInfo,
activeStakers,
);
diff --git a/apps/ecash-herald/src/parse.ts b/apps/ecash-herald/src/parse.ts
--- a/apps/ecash-herald/src/parse.ts
+++ b/apps/ecash-herald/src/parse.ts
@@ -2301,7 +2301,8 @@
* @param now unix timestamp in seconds
* @param txs array of CONFIRMED Txs
* @param tokenInfoMap tokenId => genesisInfo
- * @param tokensToShow how many tokens to render, useful for showing more or less info
+ * @param agoraTokensMaxRender how many agora tokens to render, useful for showing more or less info
+ * @param nonAgoraTokensMaxRender same for non-agora token actions. this info is less interesting in the summary.
* @param priceInfo { usd, usd_market_cap, usd_24h_vol, usd_24h_change }
* @param activeStakers
*/
@@ -2309,7 +2310,8 @@
now: number,
txs: Tx[],
tokenInfoMap: false | Map<string, GenesisInfo>,
- tokensToShow: number,
+ agoraTokensMaxRender: number,
+ nonAgoraTokensMaxRender: number,
priceInfo?: PriceInfo,
activeStakers?: CoinDanceStaker[],
): string[] => {
@@ -3415,17 +3417,18 @@
);
}
- const AGORA_TOKENS_TO_SHOW = tokensToShow;
-
// Handle case where we do not see as many agora tokens as our max
const agoraTokensToShow =
- agoraTokenCount < AGORA_TOKENS_TO_SHOW
+ agoraTokenCount < agoraTokensMaxRender
? agoraTokenCount
- : AGORA_TOKENS_TO_SHOW;
+ : agoraTokensMaxRender;
const newsworthyAgoraTokens = agoraTokens.slice(0, agoraTokensToShow);
- if (agoraTokenCount > AGORA_TOKENS_TO_SHOW) {
- tgMsg.push(`<u>Top ${AGORA_TOKENS_TO_SHOW}</u>`);
+ if (
+ agoraTokenCount > agoraTokensMaxRender &&
+ agoraTokensMaxRender !== 0
+ ) {
+ tgMsg.push(`<u>Top ${agoraTokensMaxRender}</u>`);
}
// Emoji key
@@ -3552,11 +3555,6 @@
tgMsg.push(`<u>Top ${AGORA_COLLECTIONS_TO_SHOW}</u>`);
}
- // Repeat emoji key
- tgMsg.push(
- `${config.emojis.agoraBuy}Buy, ${config.emojis.agoraList}List, ${config.emojis.agoraCancel}Cancel`,
- );
-
for (let i = 0; i < newsworthyAgoraCollections.length; i += 1) {
const tokenId = newsworthyAgoraCollections[i];
const tokenActionInfo = sortedNftAgoraActions.get(tokenId);
@@ -3634,15 +3632,17 @@
}</i></b>`,
);
- const NON_AGORA_TOKENS_TO_SHOW = tokensToShow;
const nonAgoraTokensToShow =
- nonAgoraTokenCount < NON_AGORA_TOKENS_TO_SHOW
+ nonAgoraTokenCount < nonAgoraTokensMaxRender
? nonAgoraTokenCount
- : NON_AGORA_TOKENS_TO_SHOW;
+ : nonAgoraTokensMaxRender;
const newsworthyTokens = nonAgoraTokens.slice(0, nonAgoraTokensToShow);
- if (nonAgoraTokenCount > NON_AGORA_TOKENS_TO_SHOW) {
- tgMsg.push(`<u>Top ${NON_AGORA_TOKENS_TO_SHOW}</u>`);
+ if (
+ nonAgoraTokenCount > nonAgoraTokensMaxRender &&
+ nonAgoraTokensMaxRender !== 0
+ ) {
+ tgMsg.push(`<u>Top ${nonAgoraTokensMaxRender}</u>`);
}
for (let i = 0; i < newsworthyTokens.length; i += 1) {
@@ -3656,7 +3656,9 @@
const isAlp =
tokenTypeMap.get(tokenId) === 'ALP_TOKEN_TYPE_STANDARD';
tgMsg.push(
- `${isAlp ? config.emojis.alp : ''}<a href="${config.tokenLandingBase}/${tokenId}">${
+ `${isAlp ? config.emojis.alp : ''}<a href="${
+ config.tokenLandingBase
+ }/${tokenId}">${
typeof genesisInfo === 'undefined'
? `${tokenId.slice(0, 3)}...${tokenId.slice(-3)}`
: genesisInfo.tokenName
@@ -3692,8 +3694,10 @@
);
}
- // Line break for new section
- tgMsg.push('');
+ if (nonAgoraTokensMaxRender > 0) {
+ // Line break for new section if not rendered as a one-liner
+ tgMsg.push('');
+ }
}
// NFT summary
@@ -3727,20 +3731,20 @@
}</i></b>`,
);
- const NON_AGORA_COLLECTIONS_TO_SHOW = tokensToShow;
const nonAgoraCollectionsToShow =
- collectionsWithNonAgoraActionsCount < NON_AGORA_COLLECTIONS_TO_SHOW
+ collectionsWithNonAgoraActionsCount < nonAgoraTokensMaxRender
? collectionsWithNonAgoraActionsCount
- : NON_AGORA_COLLECTIONS_TO_SHOW;
+ : nonAgoraTokensMaxRender;
const newsworthyCollections = collectionsWithNonAgoraActions.slice(
0,
nonAgoraCollectionsToShow,
);
if (
- collectionsWithNonAgoraActionsCount > NON_AGORA_COLLECTIONS_TO_SHOW
+ collectionsWithNonAgoraActionsCount > nonAgoraTokensMaxRender &&
+ nonAgoraTokensMaxRender !== 0
) {
- tgMsg.push(`<u>Top ${NON_AGORA_COLLECTIONS_TO_SHOW}</u>`);
+ tgMsg.push(`<u>Top ${nonAgoraTokensMaxRender}</u>`);
}
for (let i = 0; i < newsworthyCollections.length; i += 1) {
@@ -3789,8 +3793,10 @@
}`,
);
}
- // Line break for new section
- tgMsg.push('');
+ if (nonAgoraTokensMaxRender > 0) {
+ // Line break for new section if not rendered as a one-liner
+ tgMsg.push('');
+ }
}
// Genesis and mints token summary
diff --git a/apps/ecash-herald/test/parse.test.ts b/apps/ecash-herald/test/parse.test.ts
--- a/apps/ecash-herald/test/parse.test.ts
+++ b/apps/ecash-herald/test/parse.test.ts
@@ -364,7 +364,8 @@
mockUtcNewDayTimestampSeconds,
dailyTxs,
tokenInfoMap,
- 10, // show all tested tokens
+ 10, // show all tested agora tokens
+ 10, // show all tested non-agora tokens
{
usd: 0.00003487,
usd_market_cap: 689047177.8128564,
@@ -408,7 +409,6 @@
'<a href="https://cashtab.com/#/token/01d63c4f4cb496829a6743f7b1805d086ea3877a1dd34b3f92ffba2c9c99f896">Bull</a> (BULL): 🏷\n' +
'\n🏛🖼 <b><i>3 Agora NFT txs from 2 NFTs in 2 collections</i></b>\n' +
'🔊 <b><i>$0.465</i></b>\n' +
- '💰Buy, 🏷List, ❌Cancel\n' +
'<a href="https://cashtab.com/#/token/78efa5177e99bf05b48948ac7e23e6cc2255764e52ccf7092afb979a766dee2c">xolosArmyPOP</a> (RMZPOP): 💰 ($0.465)\n' +
'<a href="https://cashtab.com/#/token/0fb781a98fffb980b1c9c609f62b29783c348e74aa7ea3908dcf7f46388ab316">Flags</a> (FLAGS): 🏷❌\n' +
'\n' +
@@ -449,7 +449,8 @@
dailyTxs,
// we can't get any token cache info
new Map(),
- 10, // show all tested tokens
+ 10, // show all tested agora tokens
+ 10, // show all tested non-agora tokens
{
usd: 0.00003487,
usd_market_cap: 689047177.8128564,
@@ -493,7 +494,6 @@
'<a href="https://cashtab.com/#/token/01d63c4f4cb496829a6743f7b1805d086ea3877a1dd34b3f92ffba2c9c99f896">01d...896</a>: 🏷\n' +
'\n🏛🖼 <b><i>3 Agora NFT txs from 2 NFTs in 2 collections</i></b>\n' +
'🔊 <b><i>$0.465</i></b>\n' +
- '💰Buy, 🏷List, ❌Cancel\n' +
'<a href="https://cashtab.com/#/token/78efa5177e99bf05b48948ac7e23e6cc2255764e52ccf7092afb979a766dee2c">78e...e2c</a>: 💰 ($0.465)\n' +
'<a href="https://cashtab.com/#/token/0fb781a98fffb980b1c9c609f62b29783c348e74aa7ea3908dcf7f46388ab316">0fb...316</a>: 🏷❌\n' +
'\n' +
@@ -533,7 +533,8 @@
mockUtcNewDayTimestampSeconds,
dailyTxs,
tokenInfoMap,
- 10, // show all tested tokens
+ 10, // show all tested agora tokens
+ 10, // show all tested non-agora tokens
),
[
'<b>15 Oct 2024</b>\n' +
@@ -565,7 +566,6 @@
'<a href="https://cashtab.com/#/token/01d63c4f4cb496829a6743f7b1805d086ea3877a1dd34b3f92ffba2c9c99f896">Bull</a> (BULL): 🏷\n' +
'\n🏛🖼 <b><i>3 Agora NFT txs from 2 NFTs in 2 collections</i></b>\n' +
'🔊 <b><i>13k XEC</i></b>\n' +
- '💰Buy, 🏷List, ❌Cancel\n' +
'<a href="https://cashtab.com/#/token/78efa5177e99bf05b48948ac7e23e6cc2255764e52ccf7092afb979a766dee2c">xolosArmyPOP</a> (RMZPOP): 💰 (13k XEC)\n' +
'<a href="https://cashtab.com/#/token/0fb781a98fffb980b1c9c609f62b29783c348e74aa7ea3908dcf7f46388ab316">Flags</a> (FLAGS): 🏷❌\n' +
'\n' +
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 28, 19:48 (8 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4842379
Default Alt Text
D17293.id51408.diff (9 KB)
Attached To
D17293: [ecash-herald] Tighten up daily summary msgs
Event Timeline
Log In to Comment