feat: switch to replaceable events for nostr source
Some checks failed
BTClock CI / build (push) Failing after 5m31s
BTClock CI / merge (map[name:btclock_rev_b version:esp32s3], 213epd) (push) Has been skipped
BTClock CI / merge (map[name:btclock_v8 version:esp32s3], 213epd) (push) Has been skipped
BTClock CI / merge (map[name:lolin_s3_mini version:esp32s3], 213epd) (push) Has been skipped
BTClock CI / merge (map[name:lolin_s3_mini version:esp32s3], 29epd) (push) Has been skipped
BTClock CI / release (push) Has been skipped
Some checks failed
BTClock CI / build (push) Failing after 5m31s
BTClock CI / merge (map[name:btclock_rev_b version:esp32s3], 213epd) (push) Has been skipped
BTClock CI / merge (map[name:btclock_v8 version:esp32s3], 213epd) (push) Has been skipped
BTClock CI / merge (map[name:lolin_s3_mini version:esp32s3], 213epd) (push) Has been skipped
BTClock CI / merge (map[name:lolin_s3_mini version:esp32s3], 29epd) (push) Has been skipped
BTClock CI / release (push) Has been skipped
This commit is contained in:
parent
0b1a362b53
commit
e4ac3c5c94
3 changed files with 13 additions and 3 deletions
2
data
2
data
|
@ -1 +1 @@
|
||||||
Subproject commit 68207a7d95b6cb16df5c991b84ff40c25c23755b
|
Subproject commit 0116cd68cdfdf383823f74e0f9665a1700cf0500
|
|
@ -4,6 +4,6 @@ dependencies:
|
||||||
source:
|
source:
|
||||||
type: idf
|
type: idf
|
||||||
version: 4.4.7
|
version: 4.4.7
|
||||||
manifest_hash: 04e75badb795f8a851d8b088baff06d145ecf7a66457d960c2f4ede17b45ef05
|
manifest_hash: cd2f3ee15e776d949eb4ea4eddc8f39b30c2a7905050850eed01ab4928143cff
|
||||||
target: esp32s3
|
target: esp32s3
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
|
|
|
@ -41,7 +41,7 @@ void setupNostrNotify(bool asDatasource, bool zapNotify)
|
||||||
{relay},
|
{relay},
|
||||||
{// First filter
|
{// First filter
|
||||||
{
|
{
|
||||||
{"kinds", {"1"}},
|
{"kinds", {"12203"}},
|
||||||
{"since", {String(getMinutesAgo(60))}},
|
{"since", {String(getMinutesAgo(60))}},
|
||||||
{"authors", {pubKey}},
|
{"authors", {pubKey}},
|
||||||
}},
|
}},
|
||||||
|
@ -146,6 +146,7 @@ void handleNostrEventCallback(const String &subId, nostr::SignedNostrEvent *even
|
||||||
// Use direct value access instead of multiple comparisons
|
// Use direct value access instead of multiple comparisons
|
||||||
String typeValue;
|
String typeValue;
|
||||||
uint medianFee = 0;
|
uint medianFee = 0;
|
||||||
|
uint blockHeight = 0;
|
||||||
|
|
||||||
for (JsonArray tag : tags) {
|
for (JsonArray tag : tags) {
|
||||||
if (tag.size() != 2) continue;
|
if (tag.size() != 2) continue;
|
||||||
|
@ -166,6 +167,11 @@ void handleNostrEventCallback(const String &subId, nostr::SignedNostrEvent *even
|
||||||
medianFee = tag[1].as<uint>();
|
medianFee = tag[1].as<uint>();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'b': // blockHeight
|
||||||
|
if (strcmp(key, "block") == 0) {
|
||||||
|
blockHeight = tag[1].as<uint>();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,6 +179,10 @@ void handleNostrEventCallback(const String &subId, nostr::SignedNostrEvent *even
|
||||||
if (!typeValue.isEmpty()) {
|
if (!typeValue.isEmpty()) {
|
||||||
if (typeValue == "priceUsd") {
|
if (typeValue == "priceUsd") {
|
||||||
processNewPrice(obj["content"].as<uint>(), CURRENCY_USD);
|
processNewPrice(obj["content"].as<uint>(), CURRENCY_USD);
|
||||||
|
if (blockHeight != 0) {
|
||||||
|
auto& blockNotify = BlockNotify::getInstance();
|
||||||
|
blockNotify.processNewBlock(blockHeight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (typeValue == "blockHeight") {
|
else if (typeValue == "blockHeight") {
|
||||||
auto& blockNotify = BlockNotify::getInstance();
|
auto& blockNotify = BlockNotify::getInstance();
|
||||||
|
|
Loading…
Add table
Reference in a new issue