-
Notifications
You must be signed in to change notification settings - Fork 20
/
satributes.js
78 lines (76 loc) · 2.71 KB
/
satributes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const INSCRIPTION_BASE_URL = 'https://ordinals.com/sat'
const emojis_by_rarity = {
legendary: '🤯🤯🤯🤯🤯🤯🤯',
epic: '💫⭐✨💫⭐✨💫⭐✨💫⭐✨',
rare: '💍🔥💍🔥💍🔥💍',
uncommon: '💎',
black_uncommon: '♠️',
black_rare: '🖤💍',
omega: '🅾️',
alpha: '🅰️',
pizza: '🍕',
prime: '🔱',
palindrome: '♊',
vintage: '🍷',
vintage_nakamoto: '🍷🧘🏽',
block_9: '9️⃣',
'block 9': '9️⃣',
block_78: '7️⃣8️⃣',
'block 78': '7️⃣8️⃣',
block_666: '👹',
digits_palindrome: '♊',
name_palindrome: '♏',
halfinney: '👨🏻',
inscription: '🖼',
special_name: '🔤',
2009: '0️⃣9️⃣',
'450x': '⁴⁵⁰ˣ',
block_840000: '⁸⁴⁰ˣ',
ephemera: '🌟',
}
const first_2010_sat = 162450000000000
const first_450x_sat = 45000000000
const last_450x_sat = 45100000000
function generate_satributes_messages(satributes, runes = []) {
if (satributes.length === 0 && runes.length === 0) return ['No special sats found on this utxo']
const messages = [`Found ${satributes.length} special sats:`]
for (const satribute of satributes) {
let msg = ''
let is_chunkly = false
if (satribute.sat_number < first_2010_sat) {
msg += `${emojis_by_rarity['2009']} `
}
if (satribute.sat_number < last_450x_sat && satribute.sat_number >= first_450x_sat) {
msg += `${emojis_by_rarity['450x']} `
}
for (const rarity of satribute.rarity_tags) {
msg += `${emojis_by_rarity[rarity] || ''} `
}
for (const rarity of satribute.rarity_tags) {
msg += `${rarity} `
if (['block_9', 'block_78', 'pizza', 'block_840000', 'block_666'].includes(rarity)) {
is_chunkly = true
}
}
for (const inscription_group of satribute.inscriptions || []) {
msg += `\ncollection: ${inscription_group}`
msg += `\n${INSCRIPTION_BASE_URL}/${satribute.sat_number}`
}
msg += `\n#${satribute.sat_number}${satribute.name ? `\nname: ${satribute.name}` : ''}${satribute.timestamp ? `\n${satribute.timestamp.split('T')[0]}` : ''}`
if (satribute.size > 1 || is_chunkly) {
msg += `\nsize: ${satribute.size}`
}
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
}
module.exports = {
generate_satributes_messages,
}