Skip to content

Add Soroban contract ID validator - #194

Open
louiss72 wants to merge 1 commit into
StellarState:devfrom
louiss72:agent/soroban-contract-id-validator-163
Open

Add Soroban contract ID validator#194
louiss72 wants to merge 1 commit into
StellarState:devfrom
louiss72:agent/soroban-contract-id-validator-163

Conversation

@louiss72

Copy link
Copy Markdown
Contributor

Summary

  • add shared Stellar address validators for public keys and Soroban contract C-addresses
  • validate Soroban contract IDs via StrKey.decodeContract() so invalid C-address inputs are rejected without relying on an untyped runtime helper
  • add focused unit coverage for valid contract IDs, malformed/non-string inputs, and public-key-vs-contract separation

Closes #163.

Validation

  • npm test -- tests/unit/stellar-address.test.ts -> 1 suite / 4 tests passed
  • npm run type-check -> passed
  • npm run build -> passed
  • npm run lint -> passed
  • git diff --check -> passed

Payout

This is Stellar Wave / USDC-compatible. EVM/Base USDC address: 0x2f8081562ac67467d1cbd40ab3120849c1f587da.

If payment must be Stellar-native USDC, please ask for a Stellar public key before sending.

@chizzy192 chizzy192 closed this Jul 29, 2026
@chizzy192 chizzy192 reopened this Jul 29, 2026
@chizzy192

Copy link
Copy Markdown
Contributor

Hi @louiss72! 👋

Thank you for your contribution!

Problem Identified:
Your branch developed a merge conflict against dev after sibling PRs (#191, #192, #193) were merged into dev.

Recommended Fix:
Please rebase your branch onto the latest dev branch to resolve the conflict:

git fetch origin dev
git checkout agent/soroban-contract-id-validator-163
git rebase origin/dev
# Resolve any conflicts, then:
git add <resolved-files>
git rebase --continue
npm test
git push --force-with-lease origin agent/soroban-contract-id-validator-163

Once rebased and clean, we will merge this PR into dev. Thanks! 🚀

@chizzy192

Copy link
Copy Markdown
Contributor

Hi @louiss72! 👋

Specific Conflict Analysis for PR #194:

Your sibling PR #191 (Add Stellar public key validator) was merged into dev earlier, creating a minor import conflict in your unit test file:

Step-by-Step Fix:

  1. Fetch latest dev and rebase:
    git fetch origin dev
    git checkout agent/soroban-contract-id-validator-163
    git rebase origin/dev
  2. Open tests/unit/stellar-address.test.ts and update imports to:
    import { isValidSorobanContractId, isValidStellarPublicKey } from "../../src/lib/stellar-address";
  3. Continue rebase and push:
    git add tests/unit/stellar-address.test.ts
    git rebase --continue
    npm test
    git push --force-with-lease origin agent/soroban-contract-id-validator-163

Once clean, we'll merge this PR right away! Thanks! 🚀

@chizzy192

Copy link
Copy Markdown
Contributor

Hi @louiss72! 👋

Conflict Summary & Action Required:
Your PR has 1 merge conflict against dev in tests/unit/stellar-address.test.ts due to import path changes introduced when PR #191 was merged.

Rebase Steps:

git fetch origin dev
git checkout agent/soroban-contract-id-validator-163
git rebase origin/dev
# Update tests/unit/stellar-address.test.ts imports to:
# import { isValidSorobanContractId, isValidStellarPublicKey } from "../../src/lib/stellar-address";
git add tests/unit/stellar-address.test.ts
git rebase --continue
npm test
git push --force-with-lease origin agent/soroban-contract-id-validator-163

Once clean, we will merge this PR into dev. Thanks! 🚀

@chizzy192

Copy link
Copy Markdown
Contributor

Hi @louiss72! 👋

Here is a detailed breakdown of the conflict in your PR and the exact code changes needed to resolve it:

📌 File in Conflict

  • File Path: tests/unit/stellar-address.test.ts

🔍 Root Cause & Line-Level Conflict

When sibling PR #191 was merged, helper functions were relocated from src/utils/stellar-address.utils.ts to src/lib/stellar-address.ts. Your branch currently attempts to import from the old location:

<<<<<<< HEAD (dev)
import {
  isValidSorobanContractId,
  isValidStellarPublicKey,
} from "../../src/lib/stellar-address";
=======
import { isValidStellarPublicKey } from "../../src/utils/stellar-address.utils";
>>>>>>> agent/soroban-contract-id-validator-163

🛠️ Step-by-Step Resolution

  1. Rebase your branch onto the latest dev:
    git fetch origin dev
    git checkout agent/soroban-contract-id-validator-163
    git rebase origin/dev
  2. Open tests/unit/stellar-address.test.ts and update the top import lines to:
    import { Keypair, StrKey } from "stellar-sdk";
    import {
      isValidSorobanContractId,
      isValidStellarPublicKey,
    } from "../../src/lib/stellar-address";
  3. Ensure your test suite for isValidSorobanContractId is included inside the describe("stellar address validators", ...) block.
  4. Finalize the rebase and push:
    git add tests/unit/stellar-address.test.ts
    git rebase --continue
    npm test
    git push --force-with-lease origin agent/soroban-contract-id-validator-163

Once clean, we'll merge this immediately! Thanks! 🚀

@chizzy192

Copy link
Copy Markdown
Contributor

Hi @louiss72! 👋

Rebase Reminder & Code-Level Resolution:
Your PR has 1 merge conflict in tests/unit/stellar-address.test.ts following the merge of sibling PR #191.

Quick Rebase Commands:

git fetch origin dev
git checkout agent/soroban-contract-id-validator-163
git rebase origin/dev
# Update tests/unit/stellar-address.test.ts imports to:
# import { isValidSorobanContractId, isValidStellarPublicKey } from "../../src/lib/stellar-address";
git add tests/unit/stellar-address.test.ts
git rebase --continue
npm test
git push --force-with-lease origin agent/soroban-contract-id-validator-163

Once clean, we'll merge this PR right away into dev! Thanks! 🚀

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.

[BACKEND] Add helper for validating Soroban contract ID C-address format

3 participants