Skip to content

feat(sdk): implement queryEvents and getEventById HTTP methods #18

@Depo-dev

Description

@Depo-dev

Summary

Both methods in TridentClient throw "not yet implemented". They need real HTTP calls to the Go REST API.

Acceptance Criteria

queryEvents(params: QueryEventsParams)

  • Serialize params to query string (contractId, topic0, topic1, ledgerFrom, ledgerTo, cursor, limit)
  • GET {apiUrl}/v1/events with X-API-Key header
  • Validate response body with the SorobanEvent Zod schema
  • Return typed PaginatedEvents with events[] and nextCursor

getEventById(params: GetEventByIdParams)

  • GET {apiUrl}/v1/events/{id} with X-API-Key header
  • Return typed SorobanEvent
  • Throw TridentError with NOT_FOUND code on 404

Error handling

  • TridentError class: code (NOT_FOUND, UNAUTHORIZED, RATE_LIMITED, INTERNAL), message, optional cause
  • Map HTTP status codes → TridentError

Files

sdk/typescript/src/index.ts, sdk/typescript/src/errors.ts (new)

Metadata

Metadata

Assignees

No one assigned

    Labels

    phase-1MVP phase 1 scopetypescriptTypeScript SDK work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions