Function: useEncoded()
useEncoded(
decoded):bigint
Defined in: src/utils/starknetId.ts:93
Encodes a single Starknet.id label into a bigint value.
Only the characters of the Starknet.id alphabets are accepted: a-z, 0-9, - and the two
bigAlphabet characters. Any other character throws, so a mistyped name can never be silently
encoded as a different, existing one.
Parameters
decoded
string
The label to be encoded, without any . separator nor .stark suffix.
Returns
bigint
The encoded bigint value.
Throws
If the label holds a character outside the Starknet.id alphabets.
Example
const result = starknetId.useEncoded("starknetjs");
// result = 3015206943634620n
starknetId.useEncoded("Starknetjs");
// throws an Error: the uppercase "S" is not a Starknet.id character