Skip to content

Conversation

@Wutche
Copy link

@Wutche Wutche commented Jan 4, 2026

…unctions

Adds validation functions for Stacks contract identifiers. Closes #1804
@janniks

Description

Added two new validation functions for Stacks contract identifiers:

  • validateContractName(name) - Validates contract name according to Clarity rules
  • validateContractId(contractId) - Validates full contract identifier (address.name)

These functions leverage the existing isClarityName() and validateStacksAddress() for consistent validation.

Breaking change?

None - this adds new exports without modifying existing behavior.

Example

import { validateContractName, validateContractId } from '@stacks/transactions';

validateContractName('my-contract');  // true
validateContractName('123invalid');   // false

validateContractId('SP000000000000000000002Q6VF78.pox');  // true
validateContractId('SP000000000000000000002Q6VF78');      // false (no contract name)

Checklist

…unctions

Adds validation functions for Stacks contract identifiers.
Closes stx-labs#1804
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.

Function to validate contract address

1 participant