File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -22,13 +22,14 @@ const sink: Sink<ExecutionResult<Price>> = {
2222 } ,
2323} ;
2424
25- const address = process . argv [ 2 ] ?? "0x302cae5dcf8f051d0177043c3438020b89b33218" ;
26- const networkId = process . argv [ 3 ] ?? "1" ;
25+ const address =
26+ process . argv [ 2 ] ?? "2zMMhcVQEXDtdE6vsFS7S7D5oUodfJHE8vd1gnBouauv" ;
27+ const networkId = process . argv [ 3 ] ?? "1399811149" ;
2728
2829console . log ( `subscribing to ${ address } :${ networkId } ` ) ;
2930
3031// Subscribes to the onPriceUpdated event and just logs out the value to the console
31- sdk . subscribe < Price , { address : string ; networkId : number } > (
32+ const cleanup = sdk . subscribe < Price , { address : string ; networkId : number } > (
3233 `
3334 subscription onPriceUpdated($address: String!, $networkId: Int!) {
3435 onPriceUpdated(address: $address, networkId: $networkId) {
@@ -45,3 +46,8 @@ sdk.subscribe<Price, { address: string; networkId: number }>(
4546 } ,
4647 sink ,
4748) ;
49+
50+ setTimeout ( ( ) => {
51+ console . log ( "Calling cleanup function to unsubscribe" ) ;
52+ cleanup ( ) ;
53+ } , 5000 ) ;
You can’t perform that action at this time.
0 commit comments