principal
Last updated
Was this helpful?
Creates a Clarity principal type from any address string. Automatically detects whether the address is a standard principal or a contract principal (if it contains a .).
import { Cl } from '@stacks/transactions';
// Standard principal
Cl.principal('STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6');
// Contract principal
Cl.principal('ST000000000000000000002AMW42H.asset');This is the recommended way to create principal values — it auto-detects the type.
Cl.address is an alias for Cl.principal.
For explicit control, use Cl.standardPrincipal or Cl.contractPrincipal.
StandardPrincipalCV | ContractPrincipalCV
A Clarity principal value object. The specific type depends on whether the input contains a . separator.
Type: string
A Stacks address string. If it contains a ., it is treated as a contract principal (address.contract-name). Otherwise, it is treated as a standard principal.
Last updated
Was this helpful?
Was this helpful?
function principal(address: string): StandardPrincipalCV | ContractPrincipalCV;