Skip to content

feat: rust algod client #179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 81 commits into from
Jul 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
8b891fe
wip: utils crate with composer
joe-p Jun 3, 2025
37608d4
wip: working utils py (with some modifications)
joe-p Jun 3, 2025
5552911
wip: working utils ts
joe-p Jun 3, 2025
326ed8e
wip: get uniffi compiling again
joe-p Jun 3, 2025
a7f3776
wip: use Mutex for WASM, toString, and transactions getter
joe-p Jun 4, 2025
5f1a167
wip: valueOf and proper toString via JSON.stringify
joe-p Jun 4, 2025
bbe4e6e
wip: toJSON
joe-p Jun 4, 2025
84f8e5e
wip: test error
joe-p Jun 4, 2025
4fca1ae
wip: fetch
joe-p Jun 4, 2025
ba89749
wip: blocking HTTPClient
joe-p Jun 6, 2025
6b30bc6
async http client
joe-p Jun 6, 2025
726c301
wip: AlgodClient
joe-p Jun 6, 2025
8f261ed
wip: so close
joe-p Jun 6, 2025
2cf84d9
wip: AlgodClient class and async extern, still same error
joe-p Jun 6, 2025
00b784e
wip: working
joe-p Jun 6, 2025
44e9f34
wip: split out wasm mod
joe-p Jun 6, 2025
2f5eb2e
wip: almost working, just need to split out httpclient trait
joe-p Jun 6, 2025
44b9bf4
wip: split out http trait
joe-p Jun 7, 2025
07a666f
wip: working utils py without http test
joe-p Jun 7, 2025
84e2f01
wip: passing pytest w/ http call!
joe-p Jun 7, 2025
249d275
wip: working TS!
joe-p Jun 7, 2025
e011f45
wip: unified wasm and uniffi
joe-p Jun 7, 2025
7ffb4a9
wip: split out wasm file
joe-p Jun 7, 2025
874a6b4
wip: move wasm externs into http crate
joe-p Jun 7, 2025
b900e3d
wip: split out unified mutex
joe-p Jun 7, 2025
bff57fe
wip: rename FfiMutex
joe-p Jun 7, 2025
a1c1f53
wip: HTTP -> Http
joe-p Jun 7, 2025
b7a6641
wip: add some comments
joe-p Jun 7, 2025
2b2eba2
wip: add default client to http crate
joe-p Jun 7, 2025
aaff444
change main to node.cjs
joe-p Jun 8, 2025
fc8f7bc
wip: add_payment in rust utils
joe-p Jun 17, 2025
cdf4c91
wip: algod_api crate
joe-p Jun 17, 2025
21d516a
wip: proper transactions/params deserialization
joe-p Jun 17, 2025
13a69c7
wip: build() function
joe-p Jun 17, 2025
5bd2a2d
Merge branch 'main' into spike/utils_crate
joe-p Jun 17, 2025
d5214d8
wip: assign group
joe-p Jun 17, 2025
4ee2034
wip: return an already build group
joe-p Jun 17, 2025
a17eb49
wip: gather signatures
joe-p Jun 17, 2025
0c40e9c
wip: use traits for signer/signer getter
joe-p Jun 18, 2025
10a7aa6
wip: rm utils_ffi
joe-p Jun 20, 2025
c97d362
wip: fix __init__.py
joe-p Jun 20, 2025
4e70e67
wip: rm unused variables
joe-p Jun 20, 2025
7e3b7fb
wip: fix http trait wasm feat
joe-p Jun 20, 2025
b1da130
wip: rm utils packages
joe-p Jun 20, 2025
d4c330a
wip: make signer traits async
joe-p Jun 20, 2025
fcfa5b5
chore: fix typo
joe-p Jun 25, 2025
c9b26d9
Merge branch 'main' into feat/rust_utils
joe-p Jun 25, 2025
9d4e137
feat(ffi_mutex): set ffi_uniffi as the default trait
joe-p Jun 25, 2025
9db75dd
chore: fmt/clippy
joe-p Jun 25, 2025
d8ee065
fix(utils): http client trait with ffi_wasm
joe-p Jun 25, 2025
e4b3b2c
chore: fix typo
joe-p Jun 25, 2025
cc8526a
chore: rename algokit_http_client crate
joe-p Jun 25, 2025
4324c93
fix(utils): use appropriate error types
joe-p Jun 25, 2025
380e44e
fix(http_client): avoid unwrap
joe-p Jun 25, 2025
afb55ca
chore: add docstring
joe-p Jun 25, 2025
6c56a67
feat: custom jinja based rust client generator
aorumbayev Jun 23, 2025
5cfefa9
chore: generate rust client crate
aorumbayev Jun 23, 2025
4832bee
refactor: a file per endpoint
aorumbayev Jun 24, 2025
62fc442
chore: wip
aorumbayev Jun 24, 2025
d2f3193
chore: wip
aorumbayev Jun 24, 2025
4ae3411
chore: adding basic tests for raw rust client
aorumbayev Jun 24, 2025
2cc1ab1
chore: refining tests
aorumbayev Jun 25, 2025
f7ae886
chore: commenting out cd for old oas based py ts clients; reorganizin…
aorumbayev Jun 25, 2025
6de4f6a
chore: removing native api clients
aorumbayev Jun 25, 2025
c693554
chore: refactoring oas generator with ruff and mypy conventions
aorumbayev Jun 25, 2025
5604359
chore: refining generator; basic ci pipeline
aorumbayev Jun 26, 2025
804a4ab
refactor: tag extra fields with explicit x-algokit-bigint
aorumbayev Jun 26, 2025
2987eac
chore: various fmt and clippy fixes
aorumbayev Jun 26, 2025
ce6ba39
Merge remote-tracking branch 'origin/main' into feat/rust-client
aorumbayev Jun 26, 2025
9f0b579
chore: clippy warnings
aorumbayev Jun 26, 2025
6beeb5b
Merge branch 'main' into feat/rust-client
PatrickDinh Jun 27, 2025
28b8f79
chore: remove 200Response postfix
PatrickDinh Jun 27, 2025
00aad1e
fix: compile issues
PatrickDinh Jun 27, 2025
5c46d5e
Merge pull request #181 from algorandfoundation/feat/rust-client-pat
PatrickDinh Jun 27, 2025
c5a3535
chore: add u64 fields
PatrickDinh Jun 30, 2025
6d45be8
Merge pull request #184 from algorandfoundation/feat/rust-client-pat
PatrickDinh Jun 30, 2025
ead4ca1
Merge remote-tracking branch 'origin/main' into feat/rust-client
aorumbayev Jun 30, 2025
57fd2b3
refactor: HTTP client creation
aorumbayev Jun 30, 2025
b289f1d
refactor: Enhance API client generation
aorumbayev Jun 30, 2025
876a56b
chore: clarify on algod_client_tests that are to be moved in follow prs
aorumbayev Jun 30, 2025
d439bff
refactor: Improve integer type selection
aorumbayev Jul 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[alias]
bin = ["run", "--package", "cargo-bin", "--"]
pkg = ["run", "--bin", "build_pkgs", "--"]
api = ["run", "--bin", "api_tools", "--"]

# We need to enable dynamic linking for musl targets
# See https://github.com/rust-lang/rust/issues/59302#issue-422994250
Expand All @@ -10,4 +11,3 @@ rustflags = ["-C", "target-feature=-crt-static"]

[target.x86_64-unknown-linux-musl]
rustflags = ["-C", "target-feature=-crt-static"]

63 changes: 63 additions & 0 deletions .github/workflows/algod_client_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Algod Client Tests

on:
push:
branches:
- main
paths:
- "crates/algod_client/**"
- "crates/algod_client_tests/**"
- "crates/algokit_http_client/**"
- "crates/algokit_transact/**"
- ".github/workflows/algod_client_tests.yml"
pull_request:
branches:
- main
paths:
- "crates/algod_client/**"
- "crates/algod_client_tests/**"
- "crates/algokit_http_client/**"
- "crates/algokit_transact/**"
- ".github/workflows/algod_client_tests.yml"
workflow_dispatch:

permissions:
contents: read

jobs:
algod_client_tests:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.85.0

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install algokit CLI
run: uv tool install algokit

- name: Add uv tools to PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Verify algokit installation
run: |
algokit --version
which algokit

- name: Build algod_client
run: cargo build -p algod_client

- name: Build algod_client_tests
run: cargo build -p algod_client_tests

- name: Run algod_client integration tests
run: cargo test -p algod_client_tests --verbose
96 changes: 96 additions & 0 deletions .github/workflows/api_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: API OAS Generator CI
# This workflow tests the OpenAPI Specification (OAS) generator in the api/ folder.
# It validates the Python-based Jinja2 generator, ensures generated Rust code compiles,
# and checks for output stability. For testing the generated algod_client crate itself,
# see the algod_client_tests.yml workflow.

on:
push:
branches:
- main
paths:
- "api/**"
- "tools/api_tools/**"
- ".github/workflows/api_ci.yml"
pull_request:
branches:
- main
paths:
- "api/**"
- "tools/api_tools/**"
- ".github/workflows/api_ci.yml"
workflow_dispatch:

permissions:
contents: read

env:
API_DIR: api
OUTPUT_DIR: crates/algod_client

jobs:
oas_generator_check:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.85.0
components: rustfmt

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install bun dependencies
working-directory: ${{ env.API_DIR }}
run: bun install

- name: Install uv dependencies
working-directory: ${{ env.API_DIR }}/oas_generator
run: uv sync --extra dev

- name: Run OAS generator linting
run: cargo api lint-oas

- name: Run OAS generator tests
run: cargo api test-oas

- name: Store original state for stability check
run: |
git diff --name-only HEAD~1..HEAD -- ${{ env.OUTPUT_DIR }} > /tmp/initial_changes.txt || true
git status --porcelain ${{ env.OUTPUT_DIR }} > /tmp/initial_status.txt || true

- name: Generate algod API client
run: cargo api generate-algod

- name: Check for output stability
run: |
git status --porcelain ${{ env.OUTPUT_DIR }} > /tmp/post_generation_status.txt

if [ -s /tmp/post_generation_status.txt ]; then
echo "❌ Output instability detected! The following files were modified or created:"
cat /tmp/post_generation_status.txt
echo ""
echo "🔍 Detailed diff:"
git diff --no-pager ${{ env.OUTPUT_DIR }}
echo ""
echo "💡 This indicates that the generated code is not in sync with the current specification."
echo " Please run 'cargo api generate-algod' and commit the changes."
exit 1
else
echo "✅ Output stability check passed - no unexpected changes detected"
fi

- name: Verify generated code compiles
run: |
cargo check --manifest-path Cargo.toml -p algod_client
5 changes: 0 additions & 5 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,9 @@ jobs:
outputs:
# The packages that use Uniffi bindings
ffi_packages: ${{ steps.set_ffi_packages.outputs.ffi_packages }}
# The API client packages
api_packages: ${{ steps.set_api_packages.outputs.api_packages }}
steps:
- id: set_ffi_packages
run: echo 'ffi_packages=["algokit_transact"]' >> $GITHUB_OUTPUT
- id: set_api_packages
run: echo 'api_packages=["algod_api"]' >> $GITHUB_OUTPUT

typescript_wasm_ci_cd:
needs: setup
Expand Down Expand Up @@ -71,7 +67,6 @@ jobs:
secrets:
BOT_ID: ${{ secrets.BOT_ID }}
BOT_SK: ${{ secrets.BOT_SK }}

deploy_docs:
# Only run on pushes to main (not on PRs)
if: github.event_name == 'push'
Expand Down
Loading