RuntimeeRuntimee
Reference

Types

TypeScript types in Runtimee

Types

This page lists the key TypeScript types used in Runtimee.

Core Types

These types are imported from @runtimee/core.

Actor

interface Actor {
  id: string
  name: string
  status: "active" | "frozen" | "depleted"
  createdAt: string
}

Budget

interface Budget {
  id: string
  actorId: string
  amount: bigint
  used: bigint
  currency: "USDC"
  period: "monthly" | "total"
  resetAt: string
}

Policy

interface Policy {
  id: string
  actorId: string
  type: string
  version: string
  config: Record<string, unknown>
  priority: number
}

Intent

interface Intent {
  target: string
  amount: bigint
  purpose: Purpose
  idempotencyKey?: string
}

Purpose

interface Purpose {
  type: string
  id: string
  description?: string
}

AuthorizationDecision

type AuthorizationDecision = "approved" | "denied" | "pending-review"

Authorization

interface Authorization {
  intent: Intent
  policyResults: PolicyResult[]
  decision: AuthorizationDecision
  evaluatedAt: string
  actorVersion: string
}

BudgetState

interface BudgetState {
  total: bigint
  used: bigint
  remaining: bigint
  period: string
  currency: string
}

PolicyResult

interface PolicyResult {
  policyId: string
  policyType: string
  version: string
  decision: "pass" | "deny" | "review"
  reason: { code: string; message: string }
  evaluatedAt: string
}

SDK Types

These types are imported from @runtimee/sdk.

CreateActorParams

interface CreateActorParams {
  name: string
  budget: {
    amount: string
    currency: "USDC"
    period: "monthly" | "total"
  }
  policies: {
    type: string
    version?: string
    config?: Record<string, unknown>
  }[]
}

PayParams

interface PayParams {
  target: string
  amount: string
  purpose: {
    type: string
    id: string
    description?: string
  }
  idempotencyKey?: string
}

PreviewPayParams

interface PreviewPayParams {
  target: string
  amount: string
  purpose: {
    type: string
    id: string
    description?: string
  }
}

ActorStatus

interface ActorStatus {
  budget: {
    total: string
    used: string
    remaining: string
    period: string
    currency: string
  }
  txCount: number
}

ActorSummary

interface ActorSummary {
  id: string
  name: string
  status: "active" | "frozen" | "depleted"
  createdAt: string
}

ExecutionReceipt

interface ExecutionReceipt {
  executionId: string
  status: "pending" | "confirmed" | "failed"
  txHash?: string
}

RuntimeeConfig

interface RuntimeeConfig {
  apiKey: string
  baseUrl?: string
}

EVM Types

These types are imported from @runtimee/evm.

ExecutionProvider

interface ExecutionProvider {
  simulate(intent: Intent): Promise<SimulationResult>
  sign(executionPlan: ExecutionPlan): Promise<SignedTransaction>
  broadcast(signed: SignedTransaction): Promise<`0x${string}`>
  wait(txHash: `0x${string}`, confirmations?: number): Promise<Receipt>
}

Signer

interface Signer {
  signTransaction(tx: {
    to: `0x${string}`
    data: `0x${string}`
    value: bigint
    chainId: number
    gasLimit: bigint
    maxFeePerGas?: bigint
    maxPriorityFeePerGas?: bigint
    nonce: number
  }): Promise<`0x${string}`>
}

Broadcaster

interface Broadcaster {
  sendRawTransaction(signedTx: `0x${string}`): Promise<`0x${string}`>
  getTransactionReceipt(txHash: `0x${string}`): Promise<{
    status: "success" | "reverted"
    blockNumber: bigint
    gasUsed: bigint
    effectiveGasPrice: bigint
  } | null>
  getTransactionCount(address: `0x${string}`): Promise<number>
  estimateGas(tx: { to: `0x${string}`; data: `0x${string}`; value: bigint; from: `0x${string}` }): Promise<bigint>
}

SimulationResult

interface SimulationResult {
  decision: AuthorizationDecision
  policyResults: PolicyResult[]
  estimatedGas?: bigint
  estimatedCost?: bigint
}

SignedTransaction

interface SignedTransaction {
  serialized: `0x${string}`
  hash: `0x${string}`
}

Receipt

interface Receipt {
  txHash: `0x${string}`
  status: "confirmed" | "failed"
  blockNumber: bigint
  gasUsed: bigint
  effectiveGasPrice: bigint
}

How is this guide?

On this page