Skip to content

Implement the common API from mina-sdk-spec - #29

Merged
dkijania merged 1 commit into
masterfrom
feat/common-api
Oct 1, 2026
Merged

dkijania merged 1 commit into
masterfrom
feat/common-api

Conversation

@dkijania

@dkijania dkijania commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

The Python part of the SDK parity work. Rust: o1-labs/mina-sdk-rust#20. Go: o1-labs/mina-sdk-go#8. JS: o1-labs/mina-sdk-js#12. Specification: o1-labs/mina-sdk-spec v0.1.0.

  • Specification
    • spec/ is a copy of mina-sdk-spec v0.1.0, and the tag is in spec/VERSION.
    • queries.py is generated from spec/operations.graphql, with all 22 named operations.
    • tests/test_spec.py checks that the query strings are the specification's documents.
    • A new CI job, Specification copy, checks that spec/ is the tag's copy.
  • New methods: get_daemon_metrics, get_genesis_block, get_block, get_pooled_zkapp_commands, get_transaction_status, get_genesis_constants, get_tracked_accounts, get_snark_pool, get_fork_config, send_zkapp, unlock_account.
  • Signatures: send_payment and send_delegation take an optional signature=SignatureInput(...). The signature variable is always sent, as null when it is not set.
  • New fields: the result fields of the specification. Existing names stay, and all new fields have defaults, so existing constructors still work.
  • Compatibility:
    • get_pooled_user_commands returns PooledUserCommand objects, not dicts. The old dict access (cmd["hash"], cmd.get("hash")) still works for the old keys. The daemon's from field is the attribute from_.
    • get_account raises AccountNotFoundError, which is a ValueError, so existing except ValueError code still catches it.
  • Removed: the schema drift check, its workflow and src/mina_sdk/schema/. The mina-sdk-spec CI validates the documents, as in the other SDKs.
  • Not in this PR: the ITN client of the specification (spec/ITN.md). This SDK does not have one yet.

Test plan

  • ruff (lint and format), mypy, bandit: pass.
  • Unit tests: 59 pass on Python 3.12 and 3.10, with 93% coverage. This includes the new tests/test_common_api.py, whose mock-daemon tests check the variables that the client sends.
  • The conformance test fails on a changed document; a test checks this.
  • Live, against devnet daemon 4.0.0-6965b50: all 17 integration tests pass. This includes the 4 new tests and the payment and delegation tests, with a funded key in the keystore. The live run found that old code calls cmd.get(...) on pooled commands, so PooledUserCommand now has get().

🤖 Generated with Claude Code

https://claude.ai/code/session_01E9VzXg2bJYonrX5xBfmLMr

spec/ is a copy of o1-labs/mina-sdk-spec v0.1.0 (spec/VERSION), and
queries.py is generated from spec/operations.graphql; tests/test_spec.py
checks it. A CI job checks that spec/ is the tag's copy.

Add the methods this SDK did not have, the optional signature on payments
and delegations, and the result fields of the specification. Existing
names stay; new fields have defaults. get_pooled_user_commands returns
PooledUserCommand objects, which still answer the old dictionary keys.
Nullable variables are always sent, as null.

Remove the schema drift check and the schema snapshot: mina-sdk-spec
validates the documents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E9VzXg2bJYonrX5xBfmLMr
@dkijania
dkijania merged commit a4659a1 into master Oct 1, 2026
10 checks passed
@dkijania
dkijania deleted the feat/common-api branch October 1, 2026 20:46
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.

1 participant