jmcore.notifications
jmcore.notifications
Notification system for JoinMarket components.
Provides operator notifications through Apprise, supporting multiple notification channels (Gotify, Telegram, Pushover, Discord, email, etc.).
Configuration is via environment variables: - NOTIFY_URLS: Comma-separated list of Apprise URLs (required to enable notifications) - NOTIFY_ENABLED: Set to "false" to disable all notifications (default: true if NOTIFY_URLS set) - NOTIFY_TITLE_PREFIX: Prefix for notification titles (default: "JoinMarket")
Example NOTIFY_URLS: - Gotify: gotify://hostname/token - Telegram: tgram://bot_token/chat_id - Pushover: pover://user_key@token - Discord: discord://webhook_id/webhook_token - Slack: slack://hook_id - Email: mailto://user:pass@smtp.example.com - Multiple: gotify://host/token,tgram://bot/chat
For full list of supported services: https://github.com/caronc/apprise#supported-notifications
Usage: from jmcore.notifications import get_notifier
notifier = get_notifier()
await notifier.notify_fill_request(taker_nick, cj_amount, offer_id)
The module is designed to be: 1. Fire-and-forget: Notification failures don't affect protocol operations 2. Async-first: All notifications are sent asynchronously 3. Privacy-aware: Sensitive data (txids, amounts) can be optionally excluded 4. Configurable: Per-event type enable/disable through environment variables 5. Resilient: Failed notifications are retried in the background with exponential backoff (configurable, enabled by default). This is critical for Tor-routed notifications where transient circuit failures are common.
Attributes
EVENT_TEMPLATES: dict[NotificationEvent, EventTemplate] = {NotificationEvent.SUMMARY: EventTemplate(gating_attr='notify_summary', title_builder=(lambda _n, f: f'{f['period_label']} Summary'), body_builder=_summary_body, priority_builder=(lambda _f: NotificationPriority.INFO)), NotificationEvent.FILL_REQUEST: EventTemplate(gating_attr='notify_fill', title_builder=(lambda _n, _f: 'Fill Request Received'), body_builder=(lambda n, f: f'Taker: {n._format_nick(f['taker_nick'])}Amount: {n._format_amount(f['cj_amount'])}Offer ID: {f['offer_id']}'), priority_builder=(lambda _f: NotificationPriority.INFO)), NotificationEvent.REJECTION: EventTemplate(gating_attr='notify_rejection', title_builder=(lambda _n, _f: 'Request Rejected'), body_builder=_rejection_body, priority_builder=(lambda _f: NotificationPriority.WARNING)), NotificationEvent.TX_SIGNED: EventTemplate(gating_attr='notify_signing', title_builder=(lambda _n, _f: 'Transaction Signed'), body_builder=(lambda n, f: f'Taker: {n._format_nick(f['taker_nick'])}CJ Amount: {n._format_amount(f['cj_amount'])}Inputs signed: {f['num_inputs']}Fee earned: {n._format_amount(f['fee_earned'])}'), priority_builder=(lambda _f: NotificationPriority.SUCCESS)), NotificationEvent.MEMPOOL: EventTemplate(gating_attr='notify_mempool', title_builder=(lambda _n, _f: 'CoinJoin in Mempool'), body_builder=(lambda n, f: f'Role: {f.get('role', 'maker').capitalize()}TxID: {n._format_txid(f['txid'])}Amount: {n._format_amount(f['cj_amount'])}'), priority_builder=(lambda _f: NotificationPriority.INFO)), NotificationEvent.CONFIRMED: EventTemplate(gating_attr='notify_confirmed', title_builder=(lambda _n, _f: 'CoinJoin Confirmed'), body_builder=(lambda n, f: f'Role: {f.get('role', 'maker').capitalize()}TxID: {n._format_txid(f['txid'])}Amount: {n._format_amount(f['cj_amount'])}Confirmations: {f['confirmations']}'), priority_builder=(lambda _f: NotificationPriority.SUCCESS)), NotificationEvent.NICK_CHANGE: EventTemplate(gating_attr='notify_nick_change', title_builder=(lambda _n, _f: 'Nick Changed'), body_builder=(lambda n, f: f'Old: {n._format_nick(f['old_nick'])}New: {n._format_nick(f['new_nick'])}'), priority_builder=(lambda _f: NotificationPriority.INFO)), NotificationEvent.DIRECTORY_DISCONNECT: EventTemplate(gating_attr='notify_disconnect', title_builder=(lambda _n, _f: 'Directory Server Disconnected'), body_builder=(lambda _n, f: f'Server: {f['server'][:30]}...Status: {'reconnecting' if f.get('reconnecting', True) else 'disconnected'}Connected: {f['connected_count']}/{f['total_count']}'), priority_builder=_directory_disconnect_priority), NotificationEvent.DIRECTORY_RECONNECT: EventTemplate(gating_attr='notify_disconnect', title_builder=(lambda _n, _f: 'Directory Server Reconnected'), body_builder=(lambda _n, f: f'Server: {f['server'][:30]}...Connected: {f['connected_count']}/{f['total_count']}'), priority_builder=(lambda _f: NotificationPriority.SUCCESS)), NotificationEvent.ALL_DIRECTORIES_DISCONNECTED: EventTemplate(gating_attr='notify_all_disconnect', title_builder=(lambda _n, _f: 'CRITICAL: All Directories Disconnected'), body_builder=(lambda _n, _f: 'Lost connection to ALL directory servers.\nNo CoinJoins possible until reconnected.\nCheck network connectivity and Tor status.'), priority_builder=(lambda _f: NotificationPriority.FAILURE)), NotificationEvent.ALL_DIRECTORIES_RECONNECTED: EventTemplate(gating_attr='notify_all_disconnect', title_builder=(lambda _n, _f: 'RESOLVED: Directory Servers Reconnected'), body_builder=(lambda _n, f: f'Reconnected to directory servers ({f['connected_count']}/{f['total_count']}).CoinJoins are possible again.'), priority_builder=(lambda _f: NotificationPriority.SUCCESS)), NotificationEvent.COINJOIN_START: EventTemplate(gating_attr='notify_coinjoin_start', title_builder=(lambda _n, _f: 'CoinJoin Started'), body_builder=(lambda n, f: f'Amount: {n._format_amount(f['cj_amount'])}Makers: {f['num_makers']}Destination: {'internal' if f['destination'] == 'INTERNAL' else f['destination'][:12] + '...'}'), priority_builder=(lambda _f: NotificationPriority.INFO)), NotificationEvent.COINJOIN_COMPLETE: EventTemplate(gating_attr='notify_coinjoin_complete', title_builder=(lambda _n, _f: 'CoinJoin Complete'), body_builder=(lambda n, f: f'TxID: {n._format_txid(f['txid'])}Amount: {n._format_amount(f['cj_amount'])}Makers: {f['num_makers']}Total fees: {n._format_amount(f['total_fees'])}'), priority_builder=(lambda _f: NotificationPriority.SUCCESS)), NotificationEvent.COINJOIN_FAILED: EventTemplate(gating_attr='notify_coinjoin_failed', title_builder=(lambda _n, _f: 'CoinJoin Failed'), body_builder=_coinjoin_failed_body, priority_builder=(lambda _f: NotificationPriority.FAILURE)), NotificationEvent.PEER_CONNECTED: EventTemplate(gating_attr='notify_peer_events', title_builder=(lambda _n, _f: 'Peer Connected'), body_builder=(lambda n, f: f'Nick: {n._format_nick(f['nick'])}Location: {f['location'][:30]}...Total peers: {f['total_peers']}'), priority_builder=(lambda _f: NotificationPriority.INFO)), NotificationEvent.PEER_DISCONNECTED: EventTemplate(gating_attr='notify_peer_events', title_builder=(lambda _n, _f: 'Peer Disconnected'), body_builder=(lambda n, f: f'Nick: {n._format_nick(f['nick'])}Remaining peers: {f['total_peers']}'), priority_builder=(lambda _f: NotificationPriority.INFO)), NotificationEvent.PEER_BANNED: EventTemplate(gating_attr='notify_rate_limit', title_builder=(lambda _n, _f: 'Peer Banned'), body_builder=(lambda n, f: f'Nick: {n._format_nick(f['nick'])}Reason: {f['reason']}Duration: {f['duration']}s'), priority_builder=(lambda _f: NotificationPriority.WARNING)), NotificationEvent.ORDERBOOK_STATUS: EventTemplate(gating_attr=None, title_builder=(lambda _n, _f: 'Orderbook Status'), body_builder=(lambda _n, f: f'Directories: {f['connected_directories']}/{f['total_directories']}Offers: {f['total_offers']}Makers: {f['total_makers']}'), priority_builder=(lambda _f: NotificationPriority.INFO)), NotificationEvent.MAKER_OFFLINE: EventTemplate(gating_attr=None, title_builder=(lambda _n, _f: 'Maker Offline'), body_builder=(lambda n, f: f'Nick: {n._format_nick(f['nick'])}Last seen: {f['last_seen']}'), priority_builder=(lambda _f: NotificationPriority.INFO)), NotificationEvent.STARTUP: EventTemplate(gating_attr='notify_startup', title_builder=(lambda _n, _f: 'Component Started'), body_builder=_startup_body, priority_builder=(lambda _f: NotificationPriority.INFO))}
module-attribute
__all__ = ['EVENT_TEMPLATES', 'EventTemplate', 'NotificationConfig', 'NotificationEvent', 'NotificationPriority', 'Notifier', 'convert_settings_to_notification_config', 'get_notifier', 'load_notification_config', 'reset_notifier']
module-attribute
Classes
EventTemplate
dataclass
Declarative template for a notification event.
Attributes:
gating_attr: Name of the boolean attribute on
:class:NotificationConfig that gates this event. None means
the event is always emitted (subject only to the master switch
in :meth:Notifier._ensure_initialized).
title_builder: Callable (notifier, fields) -> str that returns
the notification title. Static titles are wrapped via
lambda _n, _f: "...".
body_builder: Callable (notifier, fields) -> str that returns
the notification body. The notifier is passed so builders can
use the _format_amount / _format_nick / _format_txid
privacy helpers.
priority_builder: Callable (fields) -> NotificationPriority that
returns the priority. Static priorities are wrapped via
lambda _f: NotificationPriority.INFO.
Source code in jmcore/src/jmcore/notifications.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
Attributes
body_builder: Callable[[Notifier, dict[str, Any]], str]
instance-attribute
gating_attr: str | None
instance-attribute
priority_builder: Callable[[dict[str, Any]], NotificationPriority]
instance-attribute
title_builder: Callable[[Notifier, dict[str, Any]], str]
instance-attribute
NotificationConfig
Bases: BaseModel
Configuration for the notification system.
All configuration is loaded from environment variables.
Source code in jmcore/src/jmcore/notifications.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | |
Attributes
check_for_updates: bool = Field(default=False, description='Check GitHub for new releases and include version info in summary notifications. PRIVACY WARNING: polls api.github.com each summary interval.')
class-attribute
instance-attribute
component_name: str = Field(default='', description="Component name to include in notification titles (e.g., 'Maker', 'Taker')")
class-attribute
instance-attribute
enabled: bool = Field(default=False, description='Master switch for notifications')
class-attribute
instance-attribute
include_amounts: bool = Field(default=True, description='Include amounts in notifications')
class-attribute
instance-attribute
include_nick: bool = Field(default=True, description='Include peer nicks in notifications')
class-attribute
instance-attribute
include_txids: bool = Field(default=False, description='Include transaction IDs in notifications (privacy risk)')
class-attribute
instance-attribute
mempool_url: str = Field(default='', description="Base URL of a mempool/block explorer. When set (and include_txids is enabled), txids in notifications become clickable '<mempool_url>/tx/<txid>' links instead of bare ids (e.g. 'https://mempool.space/signet').")
class-attribute
instance-attribute
model_config = {'frozen': False}
class-attribute
instance-attribute
notify_all_disconnect: bool = Field(default=True, description='Notify when ALL directory servers are disconnected (critical)')
class-attribute
instance-attribute
notify_coinjoin_complete: bool = Field(default=True, description='Notify on CoinJoin complete')
class-attribute
instance-attribute
notify_coinjoin_failed: bool = Field(default=True, description='Notify on CoinJoin failure')
class-attribute
instance-attribute
notify_coinjoin_start: bool = Field(default=True, description='Notify on CoinJoin start')
class-attribute
instance-attribute
notify_confirmed: bool = Field(default=True, description='Notify on confirmation')
class-attribute
instance-attribute
notify_disconnect: bool = Field(default=False, description='Notify on individual directory server disconnect/reconnect (noisy)')
class-attribute
instance-attribute
notify_fill: bool = Field(default=True, description='Notify on !fill requests')
class-attribute
instance-attribute
notify_mempool: bool = Field(default=True, description='Notify on mempool detection')
class-attribute
instance-attribute
notify_nick_change: bool = Field(default=True, description='Notify on nick change')
class-attribute
instance-attribute
notify_peer_events: bool = Field(default=False, description='Notify on peer connect/disconnect')
class-attribute
instance-attribute
notify_rate_limit: bool = Field(default=True, description='Notify on rate limit bans')
class-attribute
instance-attribute
notify_rejection: bool = Field(default=True, description='Notify on rejections')
class-attribute
instance-attribute
notify_signing: bool = Field(default=True, description='Notify on tx signing')
class-attribute
instance-attribute
notify_startup: bool = Field(default=True, description='Notify on component startup')
class-attribute
instance-attribute
notify_summary: bool = Field(default=True, description='Send periodic summary notifications with CoinJoin stats')
class-attribute
instance-attribute
notify_summary_balance: bool = Field(default=False, description='Include total wallet balance and UTXO count in periodic summary notifications. Disabled by default for privacy.')
class-attribute
instance-attribute
retry_base_delay: float = Field(default=5.0, ge=1.0, le=60.0, description='Base delay in seconds before the first retry (1-60). Subsequent retries double this delay (exponential backoff).')
class-attribute
instance-attribute
retry_enabled: bool = Field(default=True, description='Retry failed notifications in the background. Retries use exponential backoff and never block the main process.')
class-attribute
instance-attribute
retry_max_attempts: int = Field(default=3, ge=1, le=10, description='Maximum number of retry attempts for a failed notification (1-10)')
class-attribute
instance-attribute
stream_isolation: bool = Field(default=True, description='Use SOCKS5 auth credentials to isolate notification and update-check traffic onto separate Tor circuits (only used if use_tor=True)')
class-attribute
instance-attribute
summary_interval_hours: int = Field(default=24, ge=1, le=168, description='Interval in hours between summary notifications (1-168). Common values: 24 (daily), 168 (weekly)')
class-attribute
instance-attribute
title_prefix: str = Field(default='JoinMarket NG', description='Prefix for all notification titles')
class-attribute
instance-attribute
tor_socks_host: str = Field(default='127.0.0.1', description='Tor SOCKS5 proxy host (only used if use_tor=True)')
class-attribute
instance-attribute
tor_socks_port: int = Field(default=9050, ge=1, le=65535, description='Tor SOCKS5 proxy port (only used if use_tor=True)')
class-attribute
instance-attribute
urls: list[SecretStr] = Field(default_factory=list, description='List of Apprise notification URLs')
class-attribute
instance-attribute
use_tor: bool = Field(default=True, description='Route notifications through Tor SOCKS proxy')
class-attribute
instance-attribute
NotificationEvent
Bases: StrEnum
Typed event identifiers for the notification registry.
Each event has an entry in EVENT_TEMPLATES describing its gating flag,
title, body builder, and default priority. The public notify_*
methods on :class:Notifier are thin shims around
:meth:Notifier.emit, which looks the event up in the registry.
Source code in jmcore/src/jmcore/notifications.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
Attributes
ALL_DIRECTORIES_DISCONNECTED = 'all_directories_disconnected'
class-attribute
instance-attribute
ALL_DIRECTORIES_RECONNECTED = 'all_directories_reconnected'
class-attribute
instance-attribute
COINJOIN_COMPLETE = 'coinjoin_complete'
class-attribute
instance-attribute
COINJOIN_FAILED = 'coinjoin_failed'
class-attribute
instance-attribute
COINJOIN_START = 'coinjoin_start'
class-attribute
instance-attribute
CONFIRMED = 'confirmed'
class-attribute
instance-attribute
DIRECTORY_DISCONNECT = 'directory_disconnect'
class-attribute
instance-attribute
DIRECTORY_RECONNECT = 'directory_reconnect'
class-attribute
instance-attribute
FILL_REQUEST = 'fill_request'
class-attribute
instance-attribute
MAKER_OFFLINE = 'maker_offline'
class-attribute
instance-attribute
MEMPOOL = 'mempool'
class-attribute
instance-attribute
NICK_CHANGE = 'nick_change'
class-attribute
instance-attribute
ORDERBOOK_STATUS = 'orderbook_status'
class-attribute
instance-attribute
PEER_BANNED = 'peer_banned'
class-attribute
instance-attribute
PEER_CONNECTED = 'peer_connected'
class-attribute
instance-attribute
PEER_DISCONNECTED = 'peer_disconnected'
class-attribute
instance-attribute
REJECTION = 'rejection'
class-attribute
instance-attribute
STARTUP = 'startup'
class-attribute
instance-attribute
SUMMARY = 'summary'
class-attribute
instance-attribute
TX_SIGNED = 'tx_signed'
class-attribute
instance-attribute
NotificationPriority
Bases: StrEnum
Notification priority levels (maps to Apprise NotifyType).
Source code in jmcore/src/jmcore/notifications.py
55 56 57 58 59 60 61 | |
Attributes
FAILURE = 'failure'
class-attribute
instance-attribute
INFO = 'info'
class-attribute
instance-attribute
SUCCESS = 'success'
class-attribute
instance-attribute
WARNING = 'warning'
class-attribute
instance-attribute
Notifier
Notification sender using Apprise.
Thread-safe and async-friendly. Notification failures are logged but don't raise exceptions - notifications should never block protocol operations.
Failed notifications are automatically retried in the background with exponential backoff when retry_enabled is True (the default). This is important for Tor-routed notifications where transient circuit failures are common.
Source code in jmcore/src/jmcore/notifications.py
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 | |
Attributes
config = config or load_notification_config()
instance-attribute
Functions
__init__(config: NotificationConfig | None = None)
Initialize the notifier.
Args: config: Notification configuration. If None, loads from environment.
Source code in jmcore/src/jmcore/notifications.py
637 638 639 640 641 642 643 644 645 646 647 648 | |
emit(event: NotificationEvent, **fields: Any) -> bool
async
Emit a typed notification event through the registry.
This is the single dispatch point shared by every public
notify_* shim. It:
- Looks up the :class:
EventTemplateforevent. - Checks the gating flag on :class:
NotificationConfig(if any) and short-circuits toFalsewhen the operator has disabled that event class. - Builds the title, body, and priority through the template's
builders, passing
selfso they can use privacy helpers. - Delegates to :meth:
_send, which handles initialization, Apprise dispatch, and background retries.
Args:
event: The :class:NotificationEvent to emit.
**fields: Event-specific payload consumed by the template's
body / title / priority builders. The accepted keys are
documented on the corresponding notify_* shim.
Returns:
True if the notification was accepted on the first send
attempt; False otherwise (gated off, never initialized,
or first-attempt failure - in which case a background retry
may still succeed when retry_enabled is true).
Source code in jmcore/src/jmcore/notifications.py
925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 | |
notify(title: str, body: str, priority: NotificationPriority = NotificationPriority.INFO) -> bool
async
Send a generic notification.
Source code in jmcore/src/jmcore/notifications.py
1273 1274 1275 1276 1277 1278 1279 1280 | |
notify_all_directories_disconnected() -> bool
async
Notify when disconnected from ALL directory servers (critical).
Source code in jmcore/src/jmcore/notifications.py
1099 1100 1101 | |
notify_all_directories_reconnected(connected_count: int, total_count: int) -> bool
async
Notify when at least one directory server is reconnected after all were lost (recovery).
Source code in jmcore/src/jmcore/notifications.py
1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 | |
notify_coinjoin_complete(txid: str, cj_amount: int, num_makers: int, total_fees: int) -> bool
async
Notify when CoinJoin completes successfully (taker).
Source code in jmcore/src/jmcore/notifications.py
1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 | |
notify_coinjoin_failed(reason: str, phase: str = '', cj_amount: int = 0) -> bool
async
Notify when CoinJoin fails (taker).
Source code in jmcore/src/jmcore/notifications.py
1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 | |
notify_coinjoin_start(cj_amount: int, num_makers: int, destination: str) -> bool
async
Notify when CoinJoin is initiated (taker).
Source code in jmcore/src/jmcore/notifications.py
1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 | |
notify_confirmed(txid: str, cj_amount: int, confirmations: int, role: str = 'maker') -> bool
async
Notify when CoinJoin is confirmed.
Source code in jmcore/src/jmcore/notifications.py
1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 | |
notify_directory_disconnect(server: str, connected_count: int, total_count: int, reconnecting: bool = True) -> bool
async
Notify when disconnected from a directory server.
Source code in jmcore/src/jmcore/notifications.py
1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 | |
notify_directory_reconnect(server: str, connected_count: int, total_count: int) -> bool
async
Notify when successfully reconnected to a directory server.
Source code in jmcore/src/jmcore/notifications.py
1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 | |
notify_fill_request(taker_nick: str, cj_amount: int, offer_id: int) -> bool
async
Notify when a !fill request is received (maker).
Source code in jmcore/src/jmcore/notifications.py
997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 | |
notify_maker_offline(nick: str, last_seen: str) -> bool
async
Notify when a maker goes offline.
Source code in jmcore/src/jmcore/notifications.py
1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 | |
notify_mempool(txid: str, cj_amount: int, role: str = 'maker') -> bool
async
Notify when CoinJoin is seen in mempool.
Source code in jmcore/src/jmcore/notifications.py
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 | |
notify_nick_change(old_nick: str, new_nick: str) -> bool
async
Notify when maker nick changes (privacy feature).
Source code in jmcore/src/jmcore/notifications.py
1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 | |
notify_orderbook_status(connected_directories: int, total_directories: int, total_offers: int, total_makers: int) -> bool
async
Notify orderbook status summary.
Source code in jmcore/src/jmcore/notifications.py
1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 | |
notify_peer_banned(nick: str, reason: str, duration: int) -> bool
async
Notify when a peer is banned for rate limit violations.
Source code in jmcore/src/jmcore/notifications.py
1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 | |
notify_peer_connected(nick: str, location: str, total_peers: int) -> bool
async
Notify when a new peer connects (directory server).
Source code in jmcore/src/jmcore/notifications.py
1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 | |
notify_peer_disconnected(nick: str, total_peers: int) -> bool
async
Notify when a peer disconnects (directory server).
Source code in jmcore/src/jmcore/notifications.py
1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 | |
notify_rejection(taker_nick: str, reason: str, details: str = '') -> bool
async
Notify when rejecting a taker request (maker).
Source code in jmcore/src/jmcore/notifications.py
1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 | |
notify_startup(component: str, version: str = '', network: str = '', nick: str = '') -> bool
async
Notify when a component starts up.
Source code in jmcore/src/jmcore/notifications.py
1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 | |
notify_summary(period_label: str, total_requests: int, successful: int, failed: int, total_earnings: int, total_volume: int, successful_volume: int = 0, utxos_disclosed: int = 0, version: str | None = None, update_available: str | None = None, total_balance: int | None = None, utxo_count: int | None = None) -> bool
async
Send a periodic summary notification with CoinJoin statistics.
Source code in jmcore/src/jmcore/notifications.py
965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 | |
notify_tx_signed(taker_nick: str, cj_amount: int, num_inputs: int, fee_earned: int) -> bool
async
Notify when transaction is signed (maker).
Source code in jmcore/src/jmcore/notifications.py
1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 | |
Functions
convert_settings_to_notification_config(settings: JoinMarketSettings, component_name: str = '') -> NotificationConfig
Convert NotificationSettings from JoinMarketSettings to NotificationConfig.
This allows the notification system to use the unified settings system (config file + env vars + CLI args) instead of only environment variables.
Args: settings: JoinMarketSettings instance with notification configuration component_name: Optional component name to include in notification titles. If provided, overrides settings.notifications.component_name. Examples: "Maker", "Taker", "Directory", "Orderbook Watcher"
Returns: NotificationConfig suitable for use with Notifier
Source code in jmcore/src/jmcore/notifications.py
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | |
get_notifier(settings: JoinMarketSettings | None = None, component_name: str = '') -> Notifier
Get the global Notifier instance.
The notifier is lazily initialized on first use. Configuration is loaded from JoinMarketSettings if provided, otherwise from environment variables.
Args: settings: Optional JoinMarketSettings instance. If provided, notification configuration will be taken from settings.notifications (which supports config file + env vars + CLI args). If None, falls back to environment variables only (legacy). component_name: Component name to include in notification titles. Examples: "Maker", "Taker", "Directory", "Orderbook Watcher". This makes it easier to identify which component sent a notification when running multiple JoinMarket components.
Returns: Notifier instance
Source code in jmcore/src/jmcore/notifications.py
1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 | |
load_notification_config() -> NotificationConfig
Load notification configuration from the unified settings system.
This function uses JoinMarketSettings which loads from: 1. Environment variables (NOTIFICATIONS__, TOR__) 2. Config file (~/.joinmarket-ng/config.toml) 3. Default values
Source code in jmcore/src/jmcore/notifications.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | |
reset_notifier() -> None
Reset the global notifier (useful for testing).
Source code in jmcore/src/jmcore/notifications.py
1325 1326 1327 1328 | |