Skip to content

Commit 20ad17a

Browse files
0xrinegadeclaude
andcommitted
fix(examples): Fix format function usage in stream_pumpfun.ovsm
OVSM format() only supports single placeholder, not multiple. Rewrote to use log() with :message/:value pattern and str() concatenation. This fixes "Type error: expected string, got int" error. πŸ€– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent bab9e17 commit 20ad17a

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

β€Žexamples/ovsm_scripts/stream_pumpfun.ovsmβ€Ž

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
(log :message "βœ… Connected to Pump.fun event stream" :value stream-id)
1515
(log :message "πŸ” Monitoring for Buy/Sell transactions...")
16-
(println "")
16+
(log :message "")
1717

1818
;; Initialize counters
1919
(define buy-count 0)
@@ -43,14 +43,14 @@
4343
(if (string-contains logs-text "Instruction: Buy")
4444
(do
4545
(set! buy-count (+ buy-count 1))
46-
(println (format "πŸ“ˆ BUY #{} | Signature: {}" buy-count signature)))
46+
(log :message "πŸ“ˆ BUY" :value (str "#" buy-count)))
4747
null)
4848

4949
;; Check for Sell transactions
5050
(if (string-contains logs-text "Instruction: Sell")
5151
(do
5252
(set! sell-count (+ sell-count 1))
53-
(println (format "πŸ“‰ SELL #{} | Signature: {}" sell-count signature)))
53+
(log :message "πŸ“‰ SELL" :value (str "#" sell-count)))
5454
null)
5555

5656
;; Check for Token Graduation (migration to Raydium)
@@ -59,30 +59,21 @@
5959
(string-contains logs-text "bonding curve complete"))
6060
(do
6161
(set! graduation-count (+ graduation-count 1))
62-
(println "")
63-
(println (format "πŸŽ“ GRADUATION DETECTED #{} πŸŽ“" graduation-count))
64-
(println (format " Signature: {}" signature))
65-
(println " Token has migrated to Raydium!")
66-
(println ""))
62+
(log :message "πŸŽ“ GRADUATION DETECTED!" :value (str "Count: " graduation-count))
63+
(log :message "Signature" :value signature))
6764
null))
68-
null))
69-
70-
;; Sleep for 500ms before next poll
71-
(if (= (length events) 0)
72-
null ;; Sleep handled by stream-wait if needed
73-
null))
65+
null)))
7466

7567
;; Print summary statistics
76-
(println "")
77-
(println "═══════════════════════════════════")
78-
(println "πŸ“Š Streaming Summary")
79-
(println "═══════════════════════════════════")
80-
(println (format "Duration: {} seconds" duration))
81-
(println (format "πŸ“ˆ Buy Transactions: {}" buy-count))
82-
(println (format "πŸ“‰ Sell Transactions: {}" sell-count))
83-
(println (format "πŸŽ“ Graduations: {}" graduation-count))
84-
(println (format "πŸ“¦ Total Events: {}" (+ buy-count sell-count graduation-count)))
85-
(println "═══════════════════════════════════")
68+
(log :message "═══════════════════════════════════")
69+
(log :message "πŸ“Š Streaming Summary")
70+
(log :message "═══════════════════════════════════")
71+
(log :message "Duration" :value (str duration " seconds"))
72+
(log :message "πŸ“ˆ Buy Transactions" :value buy-count)
73+
(log :message "πŸ“‰ Sell Transactions" :value sell-count)
74+
(log :message "πŸŽ“ Graduations" :value graduation-count)
75+
(log :message "πŸ“¦ Total Events" :value (+ buy-count sell-count graduation-count))
76+
(log :message "═══════════════════════════════════")
8677

8778
;; Close stream
8879
(stream-close stream-id)

0 commit comments

Comments
Β (0)