Skip to content

Add buffer create command to the CLI - #207

Open
kaze-cow wants to merge 9 commits into
cli-order-reclaimfrom
cli-buffer-create
Open

kaze-cow wants to merge 9 commits into
cli-order-reclaimfrom
cli-buffer-create

Conversation

@kaze-cow

Copy link
Copy Markdown
Contributor

Description

Adds the cow buffer subcommand group with its shared send helper, and cow buffer create <mint>..., which creates the missing buffer PDAs of up to 14 mints in one transaction. Mints whose buffer already exists are skipped and reported.

Motivation

Second of the three PRs split out of #204, stacked on #206. This lays the groundwork that buffer reclaim (#204) builds on.

Considerations

One instruction per token program

CreateBuffers serves a single token program, so mints are grouped and get one instruction per program. MAX_MINTS = 14 is the worst case, where the mints span both programs. max_mints_is_the_most_that_always_fit pins it.

Validation

As with order reclaim, every mint is checked first: it has to exist, be owned by a supported token program and decode as a mint. If any fail, nothing is sent.

How to test

cargo test -p cow-test-cli
cargo run -p cow-test-cli -- buffer create --help

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kaze-cow
kaze-cow requested a review from a team as a code owner October 16, 2026 05:51
kaze-cow added a commit that referenced this pull request Oct 19, 2026
# Description

Brings the `cow` CLI Docker image and its `CLI image` workflow into
`main`. This is all @glokos's work: it builds
`ghcr.io/cowprotocol/cow-cli` for amd64 and arm64, then merges both into
one manifest tagged with the sha and branch/tag. The image includes the
Solana CLI and `bc` that the buffer-reclaim script needs.

The first three commits are Assem's original commits from #190 and #205,
cherry-picked unchanged. The last one drops the temporary
`cli-reclaim-buffer` push trigger, which #190 said to remove once the
image landed in `main`.

## Motivation

#190 and #205 were merged into the reclaim stack's branches instead of
`main`, so the image work now shows up inside #206/#207/#204 and makes
them harder to review. Landing it here on its own means those PRs only
show CLI changes once they're rebased.

## Considerations

### Credit

Please **rebase-merge** this PR rather than squash it, so that Assem's
commits land on `main` with him as the author. The trigger commit lists
him as co-author too.

### Parity with the stack

`.github/workflows/cli-image.yml` and `test-cli/Dockerfile` on this
branch are byte-for-byte identical to the versions on
`cli-reclaim-buffer` (#204), so rebasing the stack onto `main`
afterwards should drop these files from its diff.

## How to test

This PR should be the same as those already included in the buffer
reclaim changes we eventually expect to merge:

```
git diff origin/cli-reclaim-buffer -- .github/workflows/cli-image.yml test-cli/Dockerfile   # empty
```

**Once merged**, any branch that contains the workflow file can be built
by hand, via Actions → CLI image → Run workflow (pick the branch under
"Use workflow from") or:

```
gh workflow run cli-image.yml --ref <branch>
```

Unfortunately it doesn't seem to be possible to workflow dispatch until
this is actually merged, but an example of this dockerfile generating a
successful build though CI is [already on its actions
page](https://github.com/cowprotocol/solana-programs/actions/workflows/cli-image.yml).

The image is tagged `cow-cli:<branch>` (slashes become `-`) and
`cow-cli:sha-<short>`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Assem Hasna <assem@cow.fi>
Co-authored-by: Assem Hasna <210342530+glokos@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Federico Giacon <58218759+fedgiac@users.noreply.github.com>
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