Skip to content

Commit b2df679

Browse files
authored
Merge pull request #218 from InjectiveLabs/release/staging_v07
Release/staging v0.7
2 parents 2940568 + 95fcb58 commit b2df679

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1318
-894
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ copy-proto:
2121
mkdir -p proto/exchange
2222
buf export buf.build/cosmos/cosmos-sdk:v0.47.0 --output=third_party
2323
buf export https://github.com/cosmos/ibc-go.git --exclude-imports --output=third_party
24-
buf export https://github.com/tendermint/tendermint.git --exclude-imports --output=third_party
24+
buf export https://github.com/cometbft/cometbft.git --exclude-imports --output=third_party
2525
buf export https://github.com/CosmWasm/wasmd.git --exclude-imports --output=./third_party
2626
buf export https://github.com/cosmos/ics23.git --exclude-imports --output=./third_party
2727

Pipfile

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,28 @@ verify_ssl = true
44
name = "pypi"
55

66
[packages]
7-
protobuf = "*"
8-
grpcio-tools = "*"
9-
grpcio = "*"
10-
asyncio = "*"
7+
aiocron = "*"
118
aiohttp = "*"
12-
ecdsa = "*"
9+
asyncio = "*"
1310
bech32 = "*"
14-
mnemonic = "*"
15-
hdwallets = "*"
1611
bip32 = "*"
17-
requests = "*"
18-
eip712_structs = "*"
1912
coincurve = "*"
20-
aiocron = "*"
21-
websockets = "*"
13+
ecdsa = "*"
14+
eip712 = "*"
15+
grpcio = "*"
16+
grpcio-tools = "*"
17+
hdwallets = "*"
18+
mnemonic = "*"
19+
protobuf = "*"
20+
requests = "*"
21+
safe-pysha3 = "*"
2222
urllib3 = "<2"
23+
websockets = "*"
2324

2425
[dev-packages]
2526
pytest = "*"
2627
pytest-asyncio = "*"
28+
requests-mock = "*"
2729

2830
[requires]
29-
python_version = "3.9"
31+
python_version = "3"

Pipfile.lock

Lines changed: 446 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ make tests
8787
```
8888

8989
### Changelogs
90+
**0.7**
91+
* Removed references to pysha3 library (and also eip712-struct that required it) and replaced it with other implementation to allow the project to work with Python 3.11
92+
* Updated sentry nodes LCD URL, for each sentry node to use its own service
93+
9094
**0.6.5**
9195
* Removed `k8s` from the list of supported mainnet nodes (`lb` should be used instead)
9296

pyinjective/constant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def mainnet(cls, node='lb'):
124124
grpc_exchange_endpoint = 'k8s.global.mainnet.exchange.grpc.injective.network:443'
125125
grpc_explorer_endpoint = 'k8s.global.mainnet.explorer.grpc.injective.network:443'
126126
else:
127-
lcd_endpoint='https://lcd.injective.network'
127+
lcd_endpoint=f'http://{node}.injective.network:10337'
128128
tm_websocket_endpoint=f'ws://{node}.injective.network:26657/websocket'
129129
grpc_endpoint=f'{node}.injective.network:9900'
130130
grpc_exchange_endpoint=f'{node}.injective.network:9910'

pyinjective/orderhash.py

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,48 @@
1-
import sha3
21
import requests
32
from decimal import Decimal
4-
from eip712_structs import make_domain, EIP712Struct, String
5-
6-
class OrderInfo(EIP712Struct):
7-
SubaccountId = String()
8-
FeeRecipient = String()
9-
Price = String()
10-
Quantity = String()
11-
12-
class SpotOrder(EIP712Struct):
13-
MarketId = String()
14-
OrderInfo = OrderInfo
15-
Salt = String()
16-
OrderType = String()
17-
TriggerPrice = String()
18-
19-
class DerivativeOrder(EIP712Struct):
20-
MarketId = String()
21-
OrderInfo = OrderInfo
22-
OrderType = String()
23-
Margin = String()
24-
TriggerPrice = String()
25-
Salt = String()
26-
27-
EIP712_domain = make_domain(
28-
name='Injective Protocol',
29-
version='2.0.0',
30-
chainId=888,
31-
verifyingContract='0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
32-
salt='0x0000000000000000000000000000000000000000000000000000000000000000'
33-
)
34-
35-
domain_separator = EIP712_domain.hash_struct()
3+
4+
from eip712.messages import EIP712Message, EIP712Type
5+
from eth_account.messages import _hash_eip191_message as hash_eip191_message
6+
from hexbytes import HexBytes
7+
8+
9+
class OrderInfo(EIP712Type):
10+
SubaccountId: "string"
11+
FeeRecipient: "string"
12+
Price: "string"
13+
Quantity: "string"
14+
15+
16+
class SpotOrder(EIP712Message):
17+
_name_ = "Injective Protocol"
18+
_version_ = "2.0.0"
19+
_chainId_ = 888
20+
_verifyingContract_ = "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
21+
_salt_ = HexBytes("0x0000000000000000000000000000000000000000000000000000000000000000")
22+
23+
MarketId: "string"
24+
OrderInfo: OrderInfo
25+
Salt: "string"
26+
OrderType: "string"
27+
TriggerPrice: "string"
28+
29+
30+
class DerivativeOrder(EIP712Message):
31+
_name_ = "Injective Protocol"
32+
_version_ = "2.0.0"
33+
_chainId_ = 888
34+
_verifyingContract_ = "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
35+
_salt_ = HexBytes("0x0000000000000000000000000000000000000000000000000000000000000000")
36+
37+
MarketId: "string"
38+
OrderInfo: OrderInfo
39+
OrderType: "string"
40+
Margin: "string"
41+
TriggerPrice: "string"
42+
Salt: "string"
43+
44+
45+
# domain_separator = EIP712_domain.hash_struct()
3646
order_type_dict = {0: '\x00', 1: '\x01', 2: '\x02', 3: '\x03', 4: '\x04', 5: '\x05', 6: '\x06', 7: '\x07', 8: '\x08'}
3747

3848
class OrderHashResponse:
@@ -127,8 +137,6 @@ def build_eip712_msg(order, nonce):
127137
)
128138

129139
def hash_order(msg):
130-
typed_data_hash = msg.hash_struct()
131-
typed_bytes = b'\x19\x01' + domain_separator + typed_data_hash
132-
keccak256 = sha3.keccak_256()
133-
keccak256.update(typed_bytes)
134-
return '0x' + keccak256.hexdigest()
140+
signable_message = msg.signable_message
141+
hex_digest = hash_eip191_message(signable_message=signable_message).hex()
142+
return "0x" + hex_digest

pyinjective/proto/cosmos/base/store/v1beta1/commit_info_pb2.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

pyinjective/proto/cosmos/base/store/v1beta1/commit_info_pb2_grpc.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

pyinjective/proto/cosmos/base/store/v1beta1/listening_pb2.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

pyinjective/proto/cosmos/base/store/v1beta1/listening_pb2_grpc.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)