Bech32 Strings
To provide some clarity for arguments, some functions in the SDK are documented that
they take a type like AccAddress
where one may expect a str
. It is simply a
type alias annotation (equivalent to str
) that serves only to remind the developer
which format the string is expected to be in.
Terra SDK also provides useful functions for checking and converting addresses and pubkeys.
Addresses
AccAddress
- class terra_sdk.core.bech32.AccAddress(x)
Terra Bech32 Account Address – type alias of str.
- terra_sdk.core.bech32.is_acc_address(data)[source]
Checks whether the given string is a properly formatted Terra account address.
- Parameters
data (str) – string to check
- Returns
whether the string is a proper account address
- Return type
bool
- terra_sdk.core.bech32.to_acc_address(data)[source]
Converts a validator operator address into an account address.
- Parameters
data (ValAddress) – validator operator address
- Raises
ValueError – if provided string is not Bech32
- Returns
account address
- Return type
ValAddress
- class terra_sdk.core.bech32.ValAddress(x)
Terra Bech32 Validator Operator Address – type alias of str.
- terra_sdk.core.bech32.is_val_address(data)[source]
Checks whether the given string is a properly formatted Terra validator operator address.
- Parameters
data (str) – string to check
- Returns
whether the string is a proper validator address
- Return type
bool
- terra_sdk.core.bech32.to_val_address(data)[source]
Converts an account address into a validator operator address.
- Parameters
data (AccAddress) – account address
- Raises
ValueError – if provided string is not Bech32
- Returns
validator operator address
- Return type
PubKeys
AccPubKey
- class terra_sdk.core.bech32.AccPubKey(x)
Terra Bech32 Account Address – type alias of str.
ValPubKey
- class terra_sdk.core.bech32.ValPubKey(x)
Terra Bech32 Validator PubKey – type alias of str.