Testnet only (Arkiv Tiramisu). OpenTrigger 0.1 has not had an outside audit.
OpenTrigger

SDK

Everything the arkiv-triggers package exports for apps, with signatures.

npm install arkiv-triggers @arkiv-network/sdk@0.8.1 viem

Apps import from arkiv-triggers. The worker is a separate entry point, arkiv-triggers/worker, so apps that only write rules never load it.

createTriggers

const triggers = createTriggers(options?)

Prop

Type

Methods

MethodReturnsNotes
createRule(input){ key, txHash, warnings }Validates, checks an expire target exists, writes one rule
createRules(inputs){ keys, txHash, warnings }Several rules in one transaction
deleteRule(key){ txHash }
listRules({ creator, app? })RuleWithStatus[]Each with status, deadline and its receipts, sorted by deadline
getRule(key)AuditTrail or undefined{ rule, status, deadline, targetExpiresAt, claims, receipts }
listReceipts({ rule?, creator?, sinceBlock? })Receipt[]Newest first
listWorkers({ operator? })WorkerInfo[]From heartbeats, with online and operatorVerified
watch(handlers)() => void (stop)Live receipts, rules, heartbeats over one WebSocket
clock(){ block, timeMs, blockSeconds }The chain's current block and its time
toBlock(date)Promise<bigint>The block expected at a date
toDate(block)Promise<Date>The time a block is expected at
readerpublic clientThe client reads go through

watch handlers

Prop

Type

Rule input

type RuleInput = {
  trigger: { on: 'expire'; target: Hex; offset?: bigint } | { on: 'block'; fireAt: bigint; offset?: bigint }
  action: 'telegram' | 'webhook' | 'receipt' | 'extend'
  name?: string
  message?: string      // telegram, webhook; {entity} {time} {rule}
  chat?: string         // telegram; sealed with sealForWorker
  url?: string          // webhook; https only, public
  extendDays?: number   // extend
  worker?: 'any' | Hex  // default 'any'
  retries?: number      // 0 to 10, default 3
  app?: string
}

Other exports

ExportWhat it is
sealForWorker(text, workerSealKey)Seal a chat ID to one worker. See Sealing
verifyWebhook(rawBody, signature, trusted){ ok: true, worker } or { ok: false, reason }. Server side
WEBHOOK_HEADERSsignature, worker, rule, event header names
validateRule(input)Throws SchemaError with a readable message
ruleWarnings(input)Non-blocking warnings, such as a URL that looks secret
fillMessage(message, values)Fills {entity}, {time}, {rule}
toBlock(date, clock), toDate(block, clock)Pure conversions, no network call
ACTIONS, ACTION_NAMESThe action menu: label, icon, description, fields, who can fire it
TEMPLATESReady-made rules the dashboard offers
TYPESEntity types: trg.rule, trg.claim, trg.receipt, trg.worker
LIFETIMES, BLOCK_SECONDS, SCHEMA_VERSIONLifetimes, 2-second blocks, format version 1
operatorVerified(heartbeat)Checks a worker's operator signature
DEFAULT_RPC_URL, DEFAULT_WS_URLTiramisu endpoints
TriggersError, SchemaError, SealError, QueryTimeoutErrorError classes

Types: Rule, RuleInput, RuleWithStatus, Receipt, Claim, Heartbeat, WorkerInfo, AuditTrail, Triggers, TriggersOptions, WatchHandlers, BlockClock, WebhookBody, VerifyResult.

On this page