add
This commit is contained in:
16
ccxt/static_dependencies/starknet/hash/selector.py
Normal file
16
ccxt/static_dependencies/starknet/hash/selector.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from ..constants import (
|
||||
DEFAULT_ENTRY_POINT_NAME,
|
||||
DEFAULT_ENTRY_POINT_SELECTOR,
|
||||
DEFAULT_L1_ENTRY_POINT_NAME,
|
||||
)
|
||||
from ..hash.utils import _starknet_keccak
|
||||
|
||||
|
||||
def get_selector_from_name(func_name: str) -> int:
|
||||
"""
|
||||
Returns the selector of a contract's function name.
|
||||
"""
|
||||
if func_name in [DEFAULT_ENTRY_POINT_NAME, DEFAULT_L1_ENTRY_POINT_NAME]:
|
||||
return DEFAULT_ENTRY_POINT_SELECTOR
|
||||
|
||||
return _starknet_keccak(data=func_name.encode("ascii"))
|
||||
Reference in New Issue
Block a user