@gvnrdao/dh-sdk 0.0.149 → 0.0.151

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -58,6 +58,7 @@ if (result.success) {
58
58
  - ✅ **PKP Integration**: Secure key management with LIT Protocol
59
59
  - ✅ **Smart Contract Integration**: Direct interaction with Diamond Hands contracts
60
60
  - ✅ **Bitcoin Operations**: Support for Bitcoin deposit verification
61
+ - ✅ **Telegram Notifications**: Optional event notifications (Node.js only)
61
62
 
62
63
  ## API Reference
63
64
 
@@ -72,6 +73,50 @@ if (result.success) {
72
73
 
73
74
  See the full API documentation for detailed configuration options and method signatures.
74
75
 
76
+ ## Telegram Notifications
77
+
78
+ The SDK supports optional Telegram notifications for loan events (minting, payments, renewals, etc.). These notifications only work in Node.js environments due to browser security restrictions.
79
+
80
+ ### Enabling Telegram Notifications
81
+
82
+ Add the `telegram` configuration when initializing the SDK:
83
+
84
+ ```typescript
85
+ const sdk = new DiamondHandsSDK({
86
+ mode: "service",
87
+ serviceEndpoint: "http://localhost:3001",
88
+ telegram: {
89
+ chatId: "your-chat-id",
90
+ chatToken: "your-bot-token",
91
+ threadId: 123 // Optional: for group threads
92
+ },
93
+ // ... other config
94
+ });
95
+ ```
96
+
97
+ ### Browser Behavior
98
+
99
+ **Important**: Telegram notifications are automatically disabled in browser environments to avoid CORS errors. The SDK detects browser environments and silently skips notification attempts without breaking your application flow.
100
+
101
+ - ✅ **Node.js**: Notifications sent via Telegram Bot API
102
+ - ✅ **Browser**: Notifications silently skipped (no errors)
103
+ - ✅ **Development**: Console logs in localhost for debugging
104
+
105
+ ### Supported Events
106
+
107
+ The SDK sends notifications for:
108
+ - Loan creation
109
+ - UCD minting
110
+ - Partial payments
111
+ - Loan renewals
112
+ - Balance confirmations
113
+ - BTC withdrawals
114
+ - Operation failures
115
+
116
+ ### Security Note
117
+
118
+ Never expose your Telegram bot token in frontend code. If you need notifications from browser applications, use a backend webhook endpoint instead.
119
+
75
120
  ## License
76
121
 
77
122
  MIT