Skip to content

Braga has been retired. The next public testnet is coming in September 2026. Read the announcement →

toValue(input, attributeName?): ArkivValue

Defined in: src/attr/values.ts:430

Resolves a ValueInput to a typed value, applying the bare-form defaults above. Tagged values pass through untouched.

ValueInput

The value to resolve.

string

The attribute this value belongs to, used to make errors name it.

ArkivValue

If the input is undefined or null — an attribute is either set with a value and a type, or not set at all.

If the input is not a tagged value or a bare boolean, number, bigint or string.

If a bare value does not fit the type it defaults to.

toValue(10) // i32(10)
toValue(10n) // u256(10n)
toValue("hello") // str("hello")
toValue(dec("3.5")) // unchanged