gRPC

Connect via gRPC to receive real-time notifications when your trigger conditions are met.

How Triggers Work

  1. Connect — Establish a persistent gRPC stream to receive notifications

  2. Create Triggers — Use the REST API to define triggers with unique identifiers and market conditions

  3. Receive Notifications — When a trigger condition is met, a notification is dispatched to your connected client


Endpoint

enterprise.guardis.io:443

Authentication

Include your API key in the request metadata using the x-api-key field.

x-api-key: your_api_key_here

Service Definition

syntax = "proto3";

package guardis.triggers.v1;

import "google/protobuf/timestamp.proto";

service TriggersService {
  // Stream trigger notifications
  rpc StreamTriggers(StreamTriggersRequest) returns (stream TriggerNotification);
}

message StreamTriggersRequest {
  // Reserved for future filtering options
}

message TriggerNotification {
  // Notification type
  string type = 1;
  // Your unique trigger identifier
  string trigger_id = 2;
  // Timestamp when the trigger fired
  google.protobuf.Timestamp fired_at = 3;
  // Current pool state that triggered the notification
  Pool pool = 4;
}

message Pool {
  // The on-chain address of the liquidity pool
  string pair_address = 1;
  // The mint address of the token
  string token_address = 2;
  // Amount of SOL currently in the pool
  string sol_amount = 3;
  // Amount of tokens currently in the pool
  string token_amount = 4;
  // Total buy transactions on the pool
  int32 number_of_buys = 5;
  // Total sell transactions on the pool
  int32 number_of_sells = 6;
  // Cumulative buy volume in USD
  string buy_volume_usd = 7;
  // Cumulative sell volume in USD
  string sell_volume_usd = 8;
  // Total trading volume in USD
  string total_volume_usd = 9;
}

Request Parameters

StreamTriggersRequest

Currently accepts no parameters. Future versions may support filtering options.


Response Format

TriggerNotification

Field
Type
Description

type

string

Notification type (trigger_fired)

trigger_id

string

Your unique trigger identifier

fired_at

google.protobuf.Timestamp

Timestamp when the trigger fired

pool

Pool

Current pool state that triggered the notification

Pool

Field
Type
Description

pair_address

string

The on-chain address of the liquidity pool

token_address

string

The mint address of the token

sol_amount

string

Amount of SOL currently in the pool

token_amount

string

Amount of tokens currently in the pool

number_of_buys

int32

Total buy transactions on the pool

number_of_sells

int32

Total sell transactions on the pool

buy_volume_usd

string

Cumulative buy volume in USD

sell_volume_usd

string

Cumulative sell volume in USD

total_volume_usd

string

Total trading volume in USD

Note: Decimal values are returned as strings to preserve precision.


Example Usage

Python:

Go:


Connection Best Practices

  • Implement reconnection logic — Network interruptions happen; automatically reconnect with exponential backoff

  • Use deadlines — Set appropriate deadlines for your streaming calls to handle stale connections

  • Handle stream errors gracefully — Check for io.EOF and gRPC status codes to determine if reconnection is needed

Last updated