ccxt 4.3.71__py2.py3-none-any.whl → 4.3.72__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ccxt might be problematic. Click here for more details.
- ccxt/__init__.py +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/paradex.py +1 -1
- ccxt/base/exchange.py +1 -1
- ccxt/paradex.py +1 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/static_dependencies/starknet/models/__init__.py +0 -0
- ccxt/static_dependencies/starknet/models/typed_data.py +45 -0
- ccxt/static_dependencies/starkware/__init__.py +0 -0
- ccxt/static_dependencies/starkware/crypto/__init__.py +0 -0
- ccxt/static_dependencies/starkware/crypto/fast_pedersen_hash.py +50 -0
- ccxt/static_dependencies/starkware/crypto/math_utils.py +78 -0
- ccxt/static_dependencies/starkware/crypto/signature.py +2344 -0
- ccxt/static_dependencies/starkware/crypto/utils.py +58 -0
- ccxt/static_dependencies/sympy/core/__init__.py +0 -0
- ccxt/static_dependencies/sympy/core/intfunc.py +35 -0
- {ccxt-4.3.71.dist-info → ccxt-4.3.72.dist-info}/METADATA +5 -5
- {ccxt-4.3.71.dist-info → ccxt-4.3.72.dist-info}/RECORD +22 -12
- {ccxt-4.3.71.dist-info → ccxt-4.3.72.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.71.dist-info → ccxt-4.3.72.dist-info}/WHEEL +0 -0
- {ccxt-4.3.71.dist-info → ccxt-4.3.72.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/paradex.py
CHANGED
@@ -130,7 +130,7 @@ class paradex(Exchange, ImplicitAPI):
|
|
130
130
|
},
|
131
131
|
'hostname': 'paradex.trade',
|
132
132
|
'urls': {
|
133
|
-
'logo': 'https://github.com/user-attachments/assets/
|
133
|
+
'logo': 'https://github.com/user-attachments/assets/84628770-784e-4ec4-a759-ec2fbb2244ea',
|
134
134
|
'api': {
|
135
135
|
'v1': 'https://api.prod.{hostname}/v1',
|
136
136
|
},
|
ccxt/base/exchange.py
CHANGED
ccxt/paradex.py
CHANGED
@@ -130,7 +130,7 @@ class paradex(Exchange, ImplicitAPI):
|
|
130
130
|
},
|
131
131
|
'hostname': 'paradex.trade',
|
132
132
|
'urls': {
|
133
|
-
'logo': 'https://github.com/user-attachments/assets/
|
133
|
+
'logo': 'https://github.com/user-attachments/assets/84628770-784e-4ec4-a759-ec2fbb2244ea',
|
134
134
|
'api': {
|
135
135
|
'v1': 'https://api.prod.{hostname}/v1',
|
136
136
|
},
|
ccxt/pro/__init__.py
CHANGED
File without changes
|
@@ -0,0 +1,45 @@
|
|
1
|
+
"""
|
2
|
+
TypedDict structures for TypedData
|
3
|
+
"""
|
4
|
+
|
5
|
+
from enum import Enum
|
6
|
+
from typing import Any, Dict, List, Optional, TypedDict
|
7
|
+
|
8
|
+
class Revision(Enum):
|
9
|
+
"""
|
10
|
+
Enum representing the revision of the specification to be used.
|
11
|
+
"""
|
12
|
+
|
13
|
+
V0 = 0
|
14
|
+
V1 = 1
|
15
|
+
|
16
|
+
|
17
|
+
class ParameterDict(TypedDict):
|
18
|
+
"""
|
19
|
+
TypedDict representing a Parameter object
|
20
|
+
"""
|
21
|
+
|
22
|
+
name: str
|
23
|
+
type: str
|
24
|
+
|
25
|
+
|
26
|
+
class StarkNetDomainDict(TypedDict):
|
27
|
+
"""
|
28
|
+
TypedDict representing a domain object (both StarkNetDomain, StarknetDomain).
|
29
|
+
"""
|
30
|
+
|
31
|
+
name: str
|
32
|
+
version: str
|
33
|
+
chainId: str
|
34
|
+
revision: Optional[Revision]
|
35
|
+
|
36
|
+
|
37
|
+
class TypedDataDict(TypedDict):
|
38
|
+
"""
|
39
|
+
TypedDict representing a TypedData object
|
40
|
+
"""
|
41
|
+
|
42
|
+
types: Dict[str, List[ParameterDict]]
|
43
|
+
primaryType: str
|
44
|
+
domain: StarkNetDomainDict
|
45
|
+
message: Dict[str, Any]
|
File without changes
|
File without changes
|
@@ -0,0 +1,50 @@
|
|
1
|
+
from ...ecdsa.curves import Curve
|
2
|
+
from ...ecdsa.ellipticcurve import CurveFp, Point
|
3
|
+
|
4
|
+
from .signature import (
|
5
|
+
ALPHA,
|
6
|
+
BETA,
|
7
|
+
CONSTANT_POINTS,
|
8
|
+
EC_ORDER,
|
9
|
+
FIELD_PRIME,
|
10
|
+
N_ELEMENT_BITS_HASH,
|
11
|
+
SHIFT_POINT,
|
12
|
+
)
|
13
|
+
from .utils import from_bytes, to_bytes
|
14
|
+
|
15
|
+
curve_stark = CurveFp(FIELD_PRIME, ALPHA, BETA)
|
16
|
+
LOW_PART_BITS = 248
|
17
|
+
LOW_PART_MASK = 2**248 - 1
|
18
|
+
HASH_SHIFT_POINT = Point(curve_stark, SHIFT_POINT[0], SHIFT_POINT[1], EC_ORDER)
|
19
|
+
P_0 = Point(curve_stark, CONSTANT_POINTS[2][0], CONSTANT_POINTS[2][1], EC_ORDER)
|
20
|
+
P_1 = Point(curve_stark, CONSTANT_POINTS[2 + LOW_PART_BITS][0], CONSTANT_POINTS[2 + LOW_PART_BITS][1], EC_ORDER)
|
21
|
+
P_2 = Point(curve_stark, CONSTANT_POINTS[2 + N_ELEMENT_BITS_HASH][0], CONSTANT_POINTS[2 + N_ELEMENT_BITS_HASH][1], EC_ORDER)
|
22
|
+
P_3 = Point(curve_stark, CONSTANT_POINTS[2 + N_ELEMENT_BITS_HASH + LOW_PART_BITS][0], CONSTANT_POINTS[2 + N_ELEMENT_BITS_HASH + LOW_PART_BITS][1], EC_ORDER)
|
23
|
+
|
24
|
+
def process_single_element(element: int, p1, p2) -> Point:
|
25
|
+
assert 0 <= element < FIELD_PRIME, "Element integer value is out of range"
|
26
|
+
|
27
|
+
high_nibble = element >> LOW_PART_BITS
|
28
|
+
low_part = element & LOW_PART_MASK
|
29
|
+
return low_part * p1 + high_nibble * p2
|
30
|
+
|
31
|
+
|
32
|
+
def pedersen_hash(x: int, y: int) -> int:
|
33
|
+
"""
|
34
|
+
Computes the Starkware version of the Pedersen hash of x and y.
|
35
|
+
The hash is defined by:
|
36
|
+
shift_point + x_low * P_0 + x_high * P1 + y_low * P2 + y_high * P3
|
37
|
+
where x_low is the 248 low bits of x, x_high is the 4 high bits of x and similarly for y.
|
38
|
+
shift_point, P_0, P_1, P_2, P_3 are constant points generated from the digits of pi.
|
39
|
+
"""
|
40
|
+
return (
|
41
|
+
HASH_SHIFT_POINT + process_single_element(x, P_0, P_1) + process_single_element(y, P_2, P_3)
|
42
|
+
).x()
|
43
|
+
|
44
|
+
|
45
|
+
def pedersen_hash_func(x: bytes, y: bytes) -> bytes:
|
46
|
+
"""
|
47
|
+
A variant of 'pedersen_hash', where the elements and their resulting hash are in bytes.
|
48
|
+
"""
|
49
|
+
assert len(x) == len(y) == 32, "Unexpected element length."
|
50
|
+
return to_bytes(pedersen_hash(*(from_bytes(element) for element in (x, y))))
|
@@ -0,0 +1,78 @@
|
|
1
|
+
###############################################################################
|
2
|
+
# Copyright 2019 StarkWare Industries Ltd. #
|
3
|
+
# #
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). #
|
5
|
+
# You may not use this file except in compliance with the License. #
|
6
|
+
# You may obtain a copy of the License at #
|
7
|
+
# #
|
8
|
+
# https://www.starkware.co/open-source-license/ #
|
9
|
+
# #
|
10
|
+
# Unless required by applicable law or agreed to in writing, #
|
11
|
+
# software distributed under the License is distributed on an "AS IS" BASIS, #
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
13
|
+
# See the License for the specific language governing permissions #
|
14
|
+
# and limitations under the License. #
|
15
|
+
###############################################################################
|
16
|
+
|
17
|
+
|
18
|
+
from typing import Tuple
|
19
|
+
|
20
|
+
from ...sympy.core.intfunc import igcdex
|
21
|
+
|
22
|
+
# A type that represents a point (x,y) on an elliptic curve.
|
23
|
+
ECPoint = Tuple[int, int]
|
24
|
+
|
25
|
+
def div_mod(n: int, m: int, p: int) -> int:
|
26
|
+
"""
|
27
|
+
Finds a nonnegative integer 0 <= x < p such that (m * x) % p == n
|
28
|
+
"""
|
29
|
+
a, b, c = igcdex(m, p)
|
30
|
+
assert c == 1
|
31
|
+
return (n * a) % p
|
32
|
+
|
33
|
+
def div_ceil(x, y):
|
34
|
+
assert isinstance(x, int) and isinstance(y, int)
|
35
|
+
return -((-x) // y)
|
36
|
+
|
37
|
+
def ec_add(point1: ECPoint, point2: ECPoint, p: int) -> ECPoint:
|
38
|
+
"""
|
39
|
+
Gets two points on an elliptic curve mod p and returns their sum.
|
40
|
+
Assumes the points are given in affine form (x, y) and have different x coordinates.
|
41
|
+
"""
|
42
|
+
assert (point1[0] - point2[0]) % p != 0
|
43
|
+
m = div_mod(point1[1] - point2[1], point1[0] - point2[0], p)
|
44
|
+
x = (m * m - point1[0] - point2[0]) % p
|
45
|
+
y = (m * (point1[0] - x) - point1[1]) % p
|
46
|
+
return x, y
|
47
|
+
|
48
|
+
|
49
|
+
def ec_neg(point: ECPoint, p: int) -> ECPoint:
|
50
|
+
"""
|
51
|
+
Given a point (x,y) return (x, -y)
|
52
|
+
"""
|
53
|
+
x, y = point
|
54
|
+
return (x, (-y) % p)
|
55
|
+
|
56
|
+
|
57
|
+
def ec_double(point: ECPoint, alpha: int, p: int) -> ECPoint:
|
58
|
+
"""
|
59
|
+
Doubles a point on an elliptic curve with the equation y^2 = x^3 + alpha*x + beta mod p.
|
60
|
+
Assumes the point is given in affine form (x, y) and has y != 0.
|
61
|
+
"""
|
62
|
+
assert point[1] % p != 0
|
63
|
+
m = div_mod(3 * point[0] * point[0] + alpha, 2 * point[1], p)
|
64
|
+
x = (m * m - 2 * point[0]) % p
|
65
|
+
y = (m * (point[0] - x) - point[1]) % p
|
66
|
+
return x, y
|
67
|
+
|
68
|
+
|
69
|
+
def ec_mult(m: int, point: ECPoint, alpha: int, p: int) -> ECPoint:
|
70
|
+
"""
|
71
|
+
Multiplies by m a point on the elliptic curve with equation y^2 = x^3 + alpha*x + beta mod p.
|
72
|
+
Assumes the point is given in affine form (x, y) and that 0 < m < order(point).
|
73
|
+
"""
|
74
|
+
if m == 1:
|
75
|
+
return point
|
76
|
+
if m % 2 == 0:
|
77
|
+
return ec_mult(m // 2, ec_double(point, alpha, p), alpha, p)
|
78
|
+
return ec_add(ec_mult(m - 1, point, alpha, p), point, p)
|