Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
252c42f
docs: design spec for import_contract! macro (#419)
willemneal Jul 3, 2026
696e2ef
docs: implementation plan for import_contract! macro (#419)
willemneal Jul 3, 2026
8703f87
feat: stellar-registry-macro crate skeleton + pure helpers
willemneal Jul 3, 2026
d007a83
fix: format stellar-registry-macro and commit Cargo.lock
willemneal Jul 3, 2026
17af95f
feat: build-time address resolution for import_contract!
willemneal Jul 3, 2026
bb1379f
feat: parse import_contract! input and generate the bound client
willemneal Jul 3, 2026
f03b882
feat: wire import_contract! proc-macro and re-export from stellar-reg…
willemneal Jul 3, 2026
83d77ed
fix: guard empty contract names and validate before caching the id
willemneal Jul 3, 2026
67493c8
fix(macro): resolve import_contract! by contract, not by wasm-name
willemneal Jul 14, 2026
41e4ad4
feat: move import_contract_client here
willemneal Jul 15, 2026
face1fb
feat: initial work
willemneal Jul 16, 2026
0acb8ae
feat: consolidate registry macros
willemneal Jul 16, 2026
c2b1e2b
feat: new stellar-registry-name crate to address final feedback
willemneal Jul 20, 2026
464f6a3
chore: remove leftover code
willemneal Jul 22, 2026
30a95a3
fix: actually remove cli feature and clean up
willemneal Jul 22, 2026
ff553bd
docs: desc & readme for stellar-registry-name
chadoh Jul 23, 2026
3243f50
chore: rm extraneous cargo.toml spaces
chadoh Jul 23, 2026
8a23762
docs: missing stellar-registry-macro docs
chadoh Jul 23, 2026
1e45de2
fix: mod_name should be lowercase
willemneal Jul 23, 2026
e477aee
docs: registry-macro/util#Name can be for a wasm
chadoh Jul 24, 2026
0f4a894
fix: link to /wasms for import_contract_client
chadoh Jul 24, 2026
385783d
docs: registry-macro doc comments
chadoh Jul 24, 2026
0053097
docs: `stellar-registry-cli` not `stellar` CLI
chadoh Jul 24, 2026
0b2f6b7
chore: use cleaner var check
chadoh Jul 24, 2026
ba8db4c
fix: use display directly
willemneal Jul 24, 2026
1cca728
fix: another direct display
willemneal Jul 24, 2026
dcfb5e6
build: mv semver and thiserror to root cargo.toml
chadoh Jul 24, 2026
0aff849
build: rm extraneous line
chadoh Jul 24, 2026
5518e09
docs: stellar-registry readme
chadoh Jul 24, 2026
44f0ceb
fix: Path doesn't implement Display
chadoh Jul 27, 2026
e484fad
fix: mod_name and canonical_name are opposites
chadoh Jul 27, 2026
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
10 changes: 6 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Related repos:
- `stellar-registry/contracts` — the on-chain registry contracts this CLI talks to
- `stellar-registry/ui` — registry frontend
- `stellar-registry/indexer` — registry indexer & API
- `stellar-scaffold/cli` — the `stellar scaffold` CLI; publishes `stellar-build` and `stellar-scaffold-macro` (crates.io) that this repo depends on
- `stellar-scaffold/cli` — the `stellar scaffold` CLI; publishes `stellar-build` (crates.io) that this repo depends on

## Common Commands

Expand Down Expand Up @@ -41,7 +41,10 @@ Note: the `justfile` still carries some recipes from the monorepo. Prefer the `c
|-------|---------|
| `stellar-registry-cli` | The `stellar registry` CLI: `publish`, `deploy`, `download`, `install`/`create-alias`, `upgrade`, `register-contract` |
| `stellar-registry-build` | Library for interacting with the registry at build time |
| `stellar-registry` | Shared registry types and the `import_contract_client!` macro (published to crates.io; dev-dependency of `stellar-registry/contracts`) |
| `stellar-registry-macro` | Macro crate defining procedural macros `import_contract!`, `import_contract_client!`, and `import_asset`. Proc-macro crates are special and need to only export proc-macros. |
| `stellar-registry` | Re-exports the `import_contract!`, `import_contract_client!`, and `import_asset!` macros from `stellar-registry-macro`. Might export more behavior later. (published to crates.io; dev-dependency of `stellar-registry/contracts`) |
| `stellar-registry-name` | Defines standard name parsing/formatting used by `stellar-registry-macro` and `stellar-registry-cli` |
| `stellar-registry-test` | Unpublished testing tools used throughout this monorepo as a dev-dependency |

### CLI Command Flow

Expand All @@ -59,7 +62,6 @@ Note: the `justfile` still carries some recipes from the monorepo. Prefer the `c
## Cross-repo dependencies

This repo's crates depend on, from crates.io:
- `stellar-build` and `stellar-scaffold-macro` — published from `stellar-scaffold/cli`
- `stellar-scaffold-test` — pulled via git from `stellar-scaffold/cli` (it is `publish = false`); used in tests only
- `stellar-build` — published from `stellar-scaffold/cli`

These are declared as workspace dependencies in the root `Cargo.toml`. If the registry CLI ever needs an unreleased change in one of these, bump and publish it from `stellar-scaffold/cli` first (or temporarily `[patch]` it locally).
82 changes: 35 additions & 47 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ repository = "https://github.com/stellar-registry/cli"
# Local crates
stellar-registry = { path = "crates/stellar-registry" }
stellar-registry-test = { path = "crates/stellar-registry-test" }
stellar-registry-macro = { path = "crates/stellar-registry-macro", version = "0.0.1" }
stellar-registry-build = { path = "crates/stellar-registry-build", version = "0.0.9" }
stellar-registry-name = { path = "crates/stellar-registry-name", version = "0.0.1" }

# Cross-repo deps from scaffold-stellar/cli (crates.io for published libs,
# git for stellar-scaffold-test which is `publish = false`).
# Cross-repo deps from scaffold-stellar/cli
stellar-build = "0.0.6"
stellar-scaffold-macro = "0.8.14"

stellar-cli = { version = "27.0.0", package = "soroban-cli", default-features = false }
soroban-rpc = { package = "stellar-rpc-client", version = "27.0.0" }
Expand All @@ -25,9 +26,14 @@ admin-sep = { git = "https://github.com/theahaco/admin-sep", rev = "c4624cc74291
stellar-xdr = "=27.0.0"
stellar-strkey = "0.0.16"

proc-macro2 = "1.0"
quote = "1.0"
syn = { version = "2", features = ["full"] }

cargo_metadata = "0.18.1"
thiserror = "2.0.17"
sha2 = "0.10.9"
semver = "1.0.28"

clap = "4.6.1"
reqwest = { version = "0.12.9", default-features = false }
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ the detailed command reference, configuration, and the mainnet workflow.
|-------|---------|
| [`stellar-registry-cli`](./crates/stellar-registry-cli) | The `stellar registry` CLI plugin |
| [`stellar-registry-build`](./crates/stellar-registry-build) | Library for interacting with the registry at build time |
| [`stellar-registry`](./crates/stellar-registry) | Shared registry types and the `import_contract_client!` macro |
| [`stellar-registry-macro`](./crates/stellar-registry-macro) | Macro crate defining procedural macros `import_contract!`, `import_contract_client!`, and `import_asset`. [Proc-macro crates are special](https://www.reddit.com/r/rust/comments/tuxawv/why_do_procedural_macros_have_to_be_defined_in_a/) and need to only export proc-macros. |
| [`stellar-registry`](./crates/stellar-registry) | For use in Stellar smart contracts. Re-exports the `import_contract!`, `import_contract_client!`, and `import_asset!` macros from `stellar-registry-macro`. Might export more behavior later. |
| [`stellar-registry-name`](./crates/stellar-registry-name)| Defines standard name parsing/formatting used by `stellar-registry-macro` and `stellar-registry-cli`. |
| [`stellar-registry-test`](./crates/stellar-registry-test)| Unpublished testing tools used throughout this monorepo as a dev-dependency |

## What is the Contract Registry?

Expand Down
12 changes: 3 additions & 9 deletions crates/stellar-registry-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,14 @@ crate-type = ["rlib"]
[dependencies]
stellar-cli = { workspace = true, default-features = false, features = [] }
stellar-build = { workspace = true }
stellar-registry-name = { workspace = true }

soroban-spec-tools = { workspace = true }
soroban-rpc = { workspace = true }
stellar-strkey = { workspace = true }

thiserror = "2.0.17"
tokio = { version = "1", features = ["full"] }
shlex = "1.1.0"
heck = "0.5.0"
ed25519-dalek = "2.2.0"
sha2 = { workspace = true }

dotenvy = "0.15.7"
# soroban-rpc = "=20.3.3"
thiserror = { workspace = true }
semver = { workspace = true }

[dev-dependencies]
expect-test = "1.5"
16 changes: 11 additions & 5 deletions crates/stellar-registry-build/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{Error, named_registry::PrefixedName, registry::Registry};
use crate::{Error, name, registry::Registry};
use sha2::{Digest, Sha256};
use soroban_rpc as rpc;
use stellar_build::Network;
Expand Down Expand Up @@ -88,7 +88,13 @@ pub enum ContractId {
Resolved(stellar_strkey::Contract),
Unresolved(stellar_cli::config::UnresolvedContract),
PreHash(PreHashContractID),
FromRegistry(PrefixedName),
FromRegistry(name::Prefixed),
}

impl From<name::Prefixed> for ContractId {
fn from(value: name::Prefixed) -> Self {
Self::FromRegistry(value)
}
}

impl ContractId {
Expand All @@ -105,10 +111,10 @@ impl ContractId {
ContractId::PreHash(pre_hash_contract_id) => {
pre_hash_contract_id.id(&network_passphrase.parse()?)
}
ContractId::FromRegistry(PrefixedName { channel, name }) => {
Registry::new(config, channel.as_deref())
ContractId::FromRegistry(name) => {
Registry::new(config, name.channel())
.await?
.fetch_contract_id(name)
.fetch_contract_id(name.name())
.await?
}
})
Expand Down
6 changes: 6 additions & 0 deletions crates/stellar-registry-build/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use stellar_cli::{
pub enum Error {
#[error("Invalid contract id: {0}")]
InvalidContractId(String),
#[error("contract `{0}` is flagged as compromised in the registry")]
ContractFlagged(String),
#[error(transparent)]
Invoke(#[from] invoke::Error),
#[error(transparent)]
Expand All @@ -15,4 +17,8 @@ pub enum Error {
Locator(#[from] locator::Error),
#[error(transparent)]
Build(#[from] stellar_build::networks::Error),
#[error(transparent)]
Rpc(#[from] soroban_rpc::Error),
#[error(transparent)]
Xdr(#[from] stellar_cli::xdr::Error),
}
10 changes: 9 additions & 1 deletion crates/stellar-registry-build/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
//! Registry interaction at build time.
//!
//! Talks to the on-chain registry over the network (`contract`, `registry`,
//! `error`), pulling in the full stellar-cli stack. Proc-macro crates that only
//! need typed registry names depend on the dependency-light `stellar-registry-name`
//! crate directly (re-exported here via the `name` module).

pub mod contract;
pub mod error;
pub mod named_registry;
pub mod registry;

pub mod name;

pub use error::Error;
22 changes: 22 additions & 0 deletions crates/stellar-registry-build/src/name.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
pub use stellar_registry_name::*;

mod cli {
use stellar_cli::config;

use super::Prefixed;
use crate::registry::Registry;

#[allow(async_fn_in_trait)]
pub trait RegistryAccess {
/// Resolve the (sub)registry this name's channel points at.
async fn registry(&self, config: &config::Args) -> Result<Registry, crate::Error>;
}

impl RegistryAccess for Prefixed {
async fn registry(&self, config: &config::Args) -> Result<Registry, crate::Error> {
Registry::from_named_registry(config, self).await
}
}
}

pub use cli::RegistryAccess;
Loading
Loading