Skip to content

feat: support SAC and XLM in import_contract! - #64

Merged
pselle merged 3 commits into
mainfrom
feat/import-contract-sac-xlm
Sep 11, 2026
Merged

feat: support SAC and XLM in import_contract!#64
pselle merged 3 commits into
mainfrom
feat/import-contract-sac-xlm

Conversation

@pselle

@pselle pselle commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Add support for assets in import_contract, such as import_contract!(env, xlm) or import_contract!(env, "circle/usdc")

  • add a parsing condition to see if we are trying to import an asset rather than a contract
  • resolve this info to the SAC, so we don't fail on stellar contract fetch
  • New xlm_tip_jar fixture demonstrates the pattern plus the in-test counterpart (Env::register_stellar_asset_contract_v2).

@pselle
pselle force-pushed the feat/import-contract-sac-xlm branch from 72421d2 to be1ec46 Compare September 10, 2026 17:01
… (D14)

`import_contract!` now accepts an asset name — `xlm`/`native`, or
`"CODE:ISSUER"` — resolving the Stellar Asset Contract id offline (reusing
import_asset!'s existing logic) and binding the SDK's standard token client,
with no registry lookup or cache files needed.

A registered name that itself resolves to a SAC (e.g. "circle/usdc") is also
handled: `stellar contract fetch` always fails for a SAC address (it has no
downloadable wasm), so that specific failure is now recognized and falls back
to the same token client instead of erroring, caching the outcome so repeat
builds don't re-fetch.

Adds a demo fixture (xlm_tip_jar) showing both the production
`import_contract!(env, xlm)` pattern and the in-test counterpart using
`Env::register_stellar_asset_contract_v2`.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ny6dgiM5jPjW4yJ78UkDnd
@pselle
pselle force-pushed the feat/import-contract-sac-xlm branch from be1ec46 to 7deb51b Compare September 10, 2026 17:37
@pselle
pselle marked this pull request as ready for review September 10, 2026 17:51
@pselle
pselle requested a review from willemneal September 10, 2026 17:51
@pselle pselle changed the title feat: support SAC and XLM in import_contract! (D14) feat: support SAC and XLM in import_contract! Sep 10, 2026
chadoh
chadoh previously approved these changes Sep 10, 2026

@chadoh chadoh 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.

goddamn this shit's so slick

coupla tiny notes below, and of course ideally @willemneal would also take a look at this before we merge, but aside from my minor notes below this looks great! The tip jar test 💯

Comment thread crates/stellar-registry-macro/src/contract.rs Outdated
Comment thread crates/stellar-registry-macro/src/contract.rs
- Extract the SAC-marker write into `record_sac_marker`, with a comment
  explaining why its error is dropped (it's just a cache; a rebuild just
  redoes the work) — per willemneal's suggestions.
- Add an inline comment on the fallback match arm explaining why it's
  reachable at all (a registered name can itself resolve to a SAC) — per
  chadoh's suggestion.
- Trim the `expand_token_client` doc comment's aside about the deprecated
  `token::Client` alias to one line — per chadoh's comment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ny6dgiM5jPjW4yJ78UkDnd
chadoh
chadoh previously approved these changes Sep 11, 2026

@chadoh chadoh 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.

💐

love how fast this came together 👏🏼

Trim the record_sac_marker doc comment and the fallback match-arm comment
down to their essential point, per feedback that the previous versions ran
long.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ny6dgiM5jPjW4yJ78UkDnd
@pselle

pselle commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

@chadoh Thank you for the speedy reviews! I'm done clanking (simplifying comments) so I'll merge when the tests come back green.

@pselle
pselle merged commit 45469a0 into main Sep 11, 2026
5 checks passed
@pselle
pselle deleted the feat/import-contract-sac-xlm branch September 11, 2026 15:09
@aha-release-plz aha-release-plz Bot mentioned this pull request Sep 11, 2026
pselle pushed a commit that referenced this pull request Sep 11, 2026
## 🤖 New release

* `stellar-registry-macro`: 0.1.0 -> 0.1.1
* `stellar-registry`: 0.1.0 -> 0.1.1
* `stellar-registry-cli`: 0.1.0 -> 0.1.1 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

## `stellar-registry-macro`

<blockquote>

##
[0.1.1](stellar-registry-macro-v0.1.0...stellar-registry-macro-v0.1.1)
- 2026-09-11

### Added

- support SAC and XLM in import_contract!
([#64](#64))
</blockquote>

## `stellar-registry`

<blockquote>

##
[0.1.1](stellar-registry-v0.1.0...stellar-registry-v0.1.1)
- 2026-09-11

### Added

- support SAC and XLM in import_contract!
([#64](#64))
</blockquote>

## `stellar-registry-cli`

<blockquote>

##
[0.1.1](stellar-registry-cli-v0.1.0...stellar-registry-cli-v0.1.1)
- 2026-09-11

### Other

- test fetch_contract_id default fails for flagged
([#60](#60))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

Co-authored-by: aha-release-plz[bot] <211513279+aha-release-plz[bot]@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.

3 participants