-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
2,016 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "starknet-py" | ||
version = "0.22.0" | ||
version = "0.23.0" | ||
description = "A python SDK for Starknet" | ||
authors = ["Tomasz Rejowski <[email protected]>", "Jakub Ptak <[email protected]>"] | ||
include = ["starknet_py", "starknet_py/utils/crypto/libcrypto_c_exports.*"] | ||
|
@@ -17,17 +17,18 @@ documentation = "https://starknetpy.rtfd.io/" | |
python = ">=3.8, <3.13" | ||
asgiref = "^3.4.1" | ||
marshmallow = "^3.15.0" | ||
marshmallow-oneofschema = "3.0.1" | ||
marshmallow-oneofschema = "3.1.1" | ||
typing-extensions = "^4.3.0" | ||
marshmallow-dataclass = "<8.7.0" | ||
marshmallow-dataclass = "<8.8.0" | ||
poseidon-py = "0.1.4" | ||
lark = "^1.1.5" | ||
aiohttp = "^3.8.4" | ||
sphinx = { version = ">=4.3.1,<8.0.0", optional = true } | ||
enum-tools = { extras = ["sphinx"], version = "0.11.0", optional = true } | ||
furo = { version = "^2023.5.20", optional = true } | ||
enum-tools = { extras = ["sphinx"], version = "0.12.0", optional = true } | ||
furo = { version = "^2024.5.6", optional = true } | ||
pycryptodome = "^3.17" | ||
crypto-cpp-py = "1.4.4" | ||
eth-keyfile = "^0.8.1" | ||
|
||
[tool.poetry.extras] | ||
docs = ["sphinx", "enum-tools", "furo"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from enum import Enum | ||
from typing import List | ||
|
||
from poseidon_py.poseidon_hash import poseidon_hash, poseidon_hash_many | ||
|
||
from starknet_py.hash.utils import compute_hash_on_elements, pedersen_hash | ||
|
||
|
||
class HashMethod(Enum): | ||
""" | ||
Enum representing hash method. | ||
""" | ||
|
||
PEDERSEN = "pedersen" | ||
POSEIDON = "poseidon" | ||
|
||
def hash(self, left: int, right: int): | ||
if self == HashMethod.PEDERSEN: | ||
return pedersen_hash(left, right) | ||
if self == HashMethod.POSEIDON: | ||
return poseidon_hash(left, right) | ||
raise ValueError(f"Unsupported hash method: {self}.") | ||
|
||
def hash_many(self, values: List[int]): | ||
if self == HashMethod.PEDERSEN: | ||
return compute_hash_on_elements(values) | ||
if self == HashMethod.POSEIDON: | ||
return poseidon_hash_many(values) | ||
raise ValueError(f"Unsupported hash method: {self}.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.