@@ -345,6 +345,19 @@ export class NotifyNamespace {
345
345
}
346
346
) ;
347
347
}
348
+ /**
349
+ * Create a new {@link CustomGraphqlWebhook} to track any event on every block.
350
+ *
351
+ * @param url The URL that the webhook should send events to.
352
+ * @param type The type of webhook to create.
353
+ * @param params Parameters object containing the graphql query to be executed
354
+ * on every block
355
+ */
356
+ createWebhook (
357
+ url : string ,
358
+ type : WebhookType . GRAPHQL ,
359
+ params : CustomGraphqlWebhookParams
360
+ ) : Promise < CustomGraphqlWebhook > ;
348
361
349
362
/**
350
363
* Create a new {@link MinedTransactionWebhook} to track mined transactions
@@ -400,20 +413,6 @@ export class NotifyNamespace {
400
413
params : NftWebhookParams
401
414
) : Promise < NftMetadataUpdateWebhook > ;
402
415
403
- /**
404
- * Create a new {@link CustomGraphqlWebhook} to track any event on every block.
405
- *
406
- * @param url The URL that the webhook should send events to.
407
- * @param type The type of webhook to create.
408
- * @param params Parameters object containing the graphql query to be executed
409
- * on every block
410
- */
411
- createWebhook (
412
- url : string ,
413
- type : WebhookType . GRAPHQL ,
414
- params : CustomGraphqlWebhookParams
415
- ) : Promise < CustomGraphqlWebhook > ;
416
-
417
416
/**
418
417
* Create a new {@link AddressActivityWebhook} to track address activity.
419
418
*
@@ -446,10 +445,11 @@ export class NotifyNamespace {
446
445
let appId ;
447
446
if (
448
447
type === WebhookType . MINED_TRANSACTION ||
449
- type === WebhookType . DROPPED_TRANSACTION
448
+ type === WebhookType . DROPPED_TRANSACTION ||
449
+ type === WebhookType . GRAPHQL
450
450
) {
451
451
if ( ! ( 'appId' in params ) ) {
452
- throw new Error ( 'Transaction Webhooks require an app id.' ) ;
452
+ throw new Error ( 'Transaction and GraphQL Webhooks require an app id.' ) ;
453
453
}
454
454
appId = params . appId ;
455
455
}
@@ -458,6 +458,7 @@ export class NotifyNamespace {
458
458
let nftFilterObj ;
459
459
let addresses ;
460
460
let graphqlQuery ;
461
+ let skipEmptyMessages ;
461
462
if (
462
463
type === WebhookType . NFT_ACTIVITY ||
463
464
type === WebhookType . NFT_METADATA_UPDATE
@@ -510,6 +511,7 @@ export class NotifyNamespace {
510
511
? NETWORK_TO_WEBHOOK_NETWORK . get ( params . network )
511
512
: network ;
512
513
graphqlQuery = params . graphqlQuery ;
514
+ skipEmptyMessages = params . skipEmptyMessages ;
513
515
}
514
516
515
517
const data = {
@@ -521,7 +523,10 @@ export class NotifyNamespace {
521
523
// Only include the filters/addresses in the final response if they're defined
522
524
...nftFilterObj ,
523
525
...( addresses && { addresses } ) ,
524
- ...( graphqlQuery && { graphql_query : graphqlQuery } )
526
+ ...( graphqlQuery && {
527
+ graphql_query : graphqlQuery
528
+ } ) ,
529
+ ...( skipEmptyMessages && { skip_empty_messages : skipEmptyMessages } )
525
530
} ;
526
531
527
532
const response = await this . sendWebhookRequest < RawCreateWebhookResponse > (
0 commit comments