Skip to content

Commit

Permalink
Add message for runes (#95)
Browse files Browse the repository at this point in the history
* Add message for runes

* Handle nil

* Update chunkly
  • Loading branch information
habibitcoin authored Apr 19, 2024
1 parent 9b4de98 commit 11cae6b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ async function run() {
}
console.log(`Scan request with id: ${scan_request_id} is complete`)
if (!rescan_request_ids.has(scan_request_id)) {
if (info.satributes.length > 0 || !process.env.ONLY_NOTIFY_ON_SATS) {
const messages = generate_satributes_messages(info.satributes)
if (info.satributes.length > 0 || info.runes.length > 0 || !process.env.ONLY_NOTIFY_ON_SATS) {
const messages = generate_satributes_messages(info.satributes, info.runes)
for (const msg of messages) {
await sendNotifications(msg)
}
Expand Down
12 changes: 10 additions & 2 deletions satributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ const emojis_by_rarity = {
special_name: '🔤',
2009: '0️⃣9️⃣',
'450x': '⁴⁵⁰ˣ',
block_840000: '⁸⁴⁰ˣ',
}
const first_2010_sat = 162450000000000
const first_450x_sat = 45000000000
const last_450x_sat = 45100000000

function generate_satributes_messages(satributes) {
function generate_satributes_messages(satributes, runes = []) {
if (satributes.length === 0) return ['No special sats found on this utxo']
const messages = [`Found ${satributes.length} special sats:`]
for (const satribute of satributes) {
Expand All @@ -47,7 +48,7 @@ function generate_satributes_messages(satributes) {
}
for (const rarity of satribute.rarity_tags) {
msg += `${rarity} `
if (['block_9', 'block_78', 'pizza'].includes(rarity)) {
if (['block_9', 'block_78', 'pizza', 'block_840000', 'block_666'].includes(rarity)) {
is_chunkly = true
}
}
Expand All @@ -61,6 +62,13 @@ function generate_satributes_messages(satributes) {
}
messages.push(msg)
}
for (const rune of runes) {
let msg = 'Rune:'
msg += `\n${rune.symbol} ${rune.name ? `\nname: ${rune.name}` : ''}`
msg += `\namount: ${rune.amount}`
msg += `\ndivisibility: ${rune.divisibility}`
messages.push(msg)
}
return messages
}

Expand Down

0 comments on commit 11cae6b

Please sign in to comment.