Skip to content

feat: add contract decoding submissions API - #31

Merged
bh2smith merged 2 commits into
mainfrom
bh2smith/df-1107-contract-decoding-submissions
Sep 11, 2026
Merged

bh2smith merged 2 commits into
mainfrom
bh2smith/df-1107-contract-decoding-submissions

Conversation

@bh2smith

Copy link
Copy Markdown
Member

What & why

Adds SubmitContracts and ListContractSubmissions to DuneClient, wrapping the new POST /v1/contracts/decode and GET /v1/contracts/submissions endpoints (docs: https://docs.dune.com/api-reference/contracts/introduction). Lets users submit contracts for decoding in batches of up to 100 with per-item results and idempotency keys, and poll status with cursor paging.

Architecture

  • models/contracts.go - request and response types. ABI is a json.RawMessage since the API accepts an array or a JSON string; optional request fields are pointers with omitempty; ListContractSubmissionsOptions.ToURLValues() encodes only the set filters.
  • dune/contracts.go - the two methods, following the datasets/uploads pattern; interface entries and URL templates in dune/dune.go.
  • Library only: the CLI in cmd/ is a single-purpose query runner without subcommands, and the other endpoint families (datasets, uploads, matviews) are library-only too, so I kept parity with them rather than redesigning the CLI.
  • Tested: httptest unit tests for body shape (ABI as array or string, omitted optionals), per-item result parsing, API error mapping, query encoding; e2e covers listing only, since every submit call creates a real submission for the key owner. go vet and -race tests pass. make lint cannot build golangci-lint 1.57.2 under my local Go 1.27, so CI is the authority for lint.
  • README gains a Contract Decoding APIs section.

Fixes DF-1107

SubmitContracts wraps POST /v1/contracts/decode and ListContractSubmissions
wraps GET /v1/contracts/submissions, so contracts can be submitted for
decoding in batches and their status tracked, mirroring the Contract
Decoding section of the API docs.
@bh2smith
bh2smith requested review from ivpusic and norbertdurcansk and removed request for ivpusic September 10, 2026 17:55

@TheEdgeOfRage TheEdgeOfRage left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. One documentation suggestion left inline.

Comment thread README.md
@bh2smith
bh2smith merged commit e868259 into main Sep 11, 2026
1 check passed
@bh2smith
bh2smith deleted the bh2smith/df-1107-contract-decoding-submissions branch September 11, 2026 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants