Skip to main content

@radix-effects/shared

@radix-effects/shared contains Effect schemas and branded domain types reused by the Radix Effects packages. Use it to make service boundaries explicit and to avoid passing plain strings or numbers where a Radix-specific value is expected.

Install

npm install @radix-effects/shared effect

Branded Types

The package exports Effect branded schemas and their corresponding TypeScript types:

SchemaRepresents
AccountAddressRadix account address.
ValidatorAddressValidator component address.
ComponentAddressComponent address.
AccountLockerAddressAccount locker component address.
PoolAddressPool component address.
PackageAddressPackage address.
AccessControllerAddressAccess controller address.
FungibleResourceAddressFungible resource address.
NonFungibleResourceAddressNon-fungible resource address.
NonFungibleIdNon-fungible local id.
TransactionIdTransaction intent id.
TransactionManifestStringManifest text.
TransactionMessageStringTransaction message text.
HexStringHex-encoded string.
Base64StringBase64-encoded string.
AmountDecimal amount string.
AmountUsdUSD amount string.
StateVersionLedger state version.
EpochRadix epoch number.
NetworkIdRadix network id.
NonceNonce value.
UserId, SeasonId, PositionKeyApplication-level identifiers used by dependent packages.

Usage

import {
AccountAddress,
Amount,
TransactionManifestString,
} from '@radix-effects/shared';

const account = AccountAddress.make('account_rdx1...');
const amount = Amount.make('10');
const manifest = TransactionManifestString.make(`
CALL_METHOD
Address("account_rdx1...")
"lock_fee"
Decimal("10")
;
`);

Branded values are still represented by their underlying primitive at runtime, but TypeScript tracks their domain-specific type after construction.

Account Schemas

The package exports account schemas used by transaction tools:

SchemaPurpose
UnsecurifiedAccountSchemaAccount controlled by a single public key.
SecurifiedAccountSchemaAccount controlled through securified access.
AccountSchemaUnion of unsecurified and securified accounts.
WalletAccountSchemaWallet account shape with address, label, and appearance id.
AccountProofSchemaAccount proof shape for wallet proof flows.
ProofSchemaGeneric public-key/signature proof shape.
BigNumberSchemaEffect schema for BigNumber transformations.

Boundary Validation

Use the schemas with Schema.decodeUnknown when reading JSON files, API input, or CLI payloads:

import { Schema } from 'effect';
import { AccountSchema } from '@radix-effects/shared';

const account = await Schema.decodeUnknownPromise(AccountSchema)(input);

The branded schemas are intentionally small. They provide type separation, not full Radix address semantic validation.