Documentation
¶
Index ¶
- func CAIP2Namespace(chain string) string
- func CanonicalizeAddressByNamespace(chain, addr string) (string, error)
- func CanonicalizeEVMAddress(s string) (string, error)
- func CanonicalizeEVMHash(s string) (string, error)
- func CanonicalizeHexBlob(s string) string
- func CanonicalizeTxHashByNamespace(chain, txHash string) (string, error)
- func ConvertAnyAddressToBytes(addr string) ([]byte, error)
- func ConvertAnyAddressesToBytes[T ByteType](addr ...string) ([]T, error)
- func ExtractEvmChainID(chainID string) (string, error)
- func GetAddressPair(addr string) (sdk.AccAddress, common.Address, error)
- func GetEnvRPCOverride(chain string) string
- func HexToBytes(s string) ([]byte, error)
- func IsValidAddress(addr string, at AddressType) bool
- func LenientCanonicalizeAddress(chain, addr string) string
- func LenientCanonicalizeEVMAddress(addr string) string
- func LenientCanonicalizeTxHash(chain, txHash string) string
- func MustConvertCosmosToHex(addr string) string
- func StringToBigInt(s string) *big.Int
- type AddressType
- type ByteType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CAIP2Namespace ¶ added in v0.0.40
CAIP2Namespace returns the namespace component of a CAIP-2 chain id ("eip155:1" → "eip155"). Returns "" when the id has no namespace.
func CanonicalizeAddressByNamespace ¶ added in v0.0.40
CanonicalizeAddressByNamespace canonicalizes an address for the given CAIP-2 chain. Empty input passes through (optional fields).
func CanonicalizeEVMAddress ¶ added in v0.0.40
CanonicalizeEVMAddress validates s as a 20-byte hex address (with or without 0x) and returns the EIP-55 checksummed, 0x-prefixed form.
func CanonicalizeEVMHash ¶ added in v0.0.40
CanonicalizeEVMHash validates s as a 32-byte hex hash (with or without 0x) and returns the 0x-prefixed lowercase form.
func CanonicalizeHexBlob ¶ added in v0.0.40
CanonicalizeHexBlob lenient-canonicalizes free-length hex payloads (raw_payload, verification_data): valid hex (with or without 0x, even length) → 0x-prefixed lowercase; anything else is returned trimmed as-is.
func CanonicalizeTxHashByNamespace ¶ added in v0.0.40
CanonicalizeTxHashByNamespace canonicalizes a transaction hash/signature for the given CAIP-2 chain. Empty input passes through (e.g. failed outbound observations carry no hash).
func ConvertAnyAddressToBytes ¶
convert the 0x and/or cosmos address to raw bytes
func ConvertAnyAddressesToBytes ¶
return either []byte or common.Address
func ExtractEvmChainID ¶ added in v0.0.13
Returns evm chainId, e.g. push-chain-42101 -> 42101
func GetAddressPair ¶
get address pair returns both the cosmos and the 0x addresses, or an error
func GetEnvRPCOverride ¶
chain is a CAIP-2 chain identifier, e.g., "eip155:1"
func HexToBytes ¶
func IsValidAddress ¶
func IsValidAddress(addr string, at AddressType) bool
IsValidAddress checks if the address is a valid COSMOS, HEX (0x), or EITHER address
func LenientCanonicalizeAddress ¶ added in v0.0.40
LenientCanonicalizeAddress canonicalizes addr for chain, falling back to the trimmed input when it does not parse.
func LenientCanonicalizeEVMAddress ¶ added in v0.0.40
LenientCanonicalizeEVMAddress canonicalizes a Push-Chain (EVM) address to EIP-55, falling back to the trimmed input when it does not parse.
func LenientCanonicalizeTxHash ¶ added in v0.0.40
LenientCanonicalizeTxHash canonicalizes txHash for chain, falling back to the trimmed input when it does not parse.
func MustConvertCosmosToHex ¶
func StringToBigInt ¶
Types ¶
type AddressType ¶
type AddressType int
create an enum for COSMOS, 0x, or EITHER
const ( COSMOS AddressType = iota HEX EITHER )