Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8febe65
(feat) Test using Prcryptodome to remove pysha3
Jun 1, 2023
ae8c316
(feat) Test using Prcryptodome to remove pysha3
Jun 1, 2023
111f8bc
(fix) Removed eip712-struct from the project because it depends on py…
Jun 5, 2023
aedc9c8
(fix) Refactor dependencies to remove the pysha3 library requirement
Jun 5, 2023
e0f2fe4
Merge branch 'fix/remove_pysha3_dependency' of https://github.com/Inj…
Jun 5, 2023
8eddc54
(fix) Change setup.py version to enable the release of this version
Jun 5, 2023
c89af2a
(fix) Added restriction in setup.py to require Python >= 3.9 (the new…
Jun 5, 2023
5b5c357
chore: add cometbft dep
achilleas-kal Jun 8, 2023
54a3e77
chore: re-gen
achilleas-kal Jun 8, 2023
26554d9
Merge pull request #215 from InjectiveLabs/fix/sync_dev_with_master_065
aarmoa Jun 15, 2023
cb09390
(feat) Test using Prcryptodome to remove pysha3
Jun 1, 2023
900ba8c
(fix) Removed eip712-struct from the project because it depends on py…
Jun 5, 2023
ed335ba
(fix) Refactor dependencies to remove the pysha3 library requirement
Jun 5, 2023
0829eea
(feat) Test using Prcryptodome to remove pysha3
Jun 1, 2023
a6c45af
(fix) Change setup.py version to enable the release of this version
Jun 5, 2023
c2de4bb
(fix) Added restriction in setup.py to require Python >= 3.9 (the new…
Jun 5, 2023
7ddb66d
(fix) Added missing required library in setup.py
Jun 15, 2023
72b2f8a
Merge branch 'fix/remove_pysha3_dependency' of https://github.com/Inj…
Jun 15, 2023
e96cf02
Merge pull request #210 from InjectiveLabs/fix/remove_pysha3_dependency
aarmoa Jun 15, 2023
f159abe
Merge branch 'f/add_cometbft' of https://github.com/InjectiveLabs/sdk…
Jun 20, 2023
ecf9322
Merge pull request #216 from InjectiveLabs/feat/add_cometbft_to_dev
aarmoa Jun 20, 2023
84f837d
(fix) Changed the lcd_endpoint configuration for the bare metal nodes…
Jun 28, 2023
d9b38ab
(fix) Updated changelog
Jun 28, 2023
95fcb58
Merge pull request #217 from InjectiveLabs/fix/configure_lcd_urls_for…
aarmoa Jun 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ copy-proto:
mkdir -p proto/exchange
buf export buf.build/cosmos/cosmos-sdk:v0.47.0 --output=third_party
buf export https://github.com/cosmos/ibc-go.git --exclude-imports --output=third_party
buf export https://github.com/tendermint/tendermint.git --exclude-imports --output=third_party
buf export https://github.com/cometbft/cometbft.git --exclude-imports --output=third_party
buf export https://github.com/CosmWasm/wasmd.git --exclude-imports --output=./third_party
buf export https://github.com/cosmos/ics23.git --exclude-imports --output=./third_party

Expand Down
26 changes: 14 additions & 12 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,28 @@ verify_ssl = true
name = "pypi"

[packages]
protobuf = "*"
grpcio-tools = "*"
grpcio = "*"
asyncio = "*"
aiocron = "*"
aiohttp = "*"
ecdsa = "*"
asyncio = "*"
bech32 = "*"
mnemonic = "*"
hdwallets = "*"
bip32 = "*"
requests = "*"
eip712_structs = "*"
coincurve = "*"
aiocron = "*"
websockets = "*"
ecdsa = "*"
eip712 = "*"
grpcio = "*"
grpcio-tools = "*"
hdwallets = "*"
mnemonic = "*"
protobuf = "*"
requests = "*"
safe-pysha3 = "*"
urllib3 = "<2"
websockets = "*"

[dev-packages]
pytest = "*"
pytest-asyncio = "*"
requests-mock = "*"

[requires]
python_version = "3.9"
python_version = "3"
489 changes: 446 additions & 43 deletions Pipfile.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ make tests
```

### Changelogs
**0.7**
* 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
* Updated sentry nodes LCD URL, for each sentry node to use its own service

**0.6.5**
* Removed `k8s` from the list of supported mainnet nodes (`lb` should be used instead)

Expand Down
2 changes: 1 addition & 1 deletion pyinjective/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def mainnet(cls, node='lb'):
grpc_exchange_endpoint = 'k8s.global.mainnet.exchange.grpc.injective.network:443'
grpc_explorer_endpoint = 'k8s.global.mainnet.explorer.grpc.injective.network:443'
else:
lcd_endpoint='https://lcd.injective.network'
lcd_endpoint=f'http://{node}.injective.network:10337'
tm_websocket_endpoint=f'ws://{node}.injective.network:26657/websocket'
grpc_endpoint=f'{node}.injective.network:9900'
grpc_exchange_endpoint=f'{node}.injective.network:9910'
Expand Down
84 changes: 46 additions & 38 deletions pyinjective/orderhash.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,48 @@
import sha3
import requests
from decimal import Decimal
from eip712_structs import make_domain, EIP712Struct, String

class OrderInfo(EIP712Struct):
SubaccountId = String()
FeeRecipient = String()
Price = String()
Quantity = String()

class SpotOrder(EIP712Struct):
MarketId = String()
OrderInfo = OrderInfo
Salt = String()
OrderType = String()
TriggerPrice = String()

class DerivativeOrder(EIP712Struct):
MarketId = String()
OrderInfo = OrderInfo
OrderType = String()
Margin = String()
TriggerPrice = String()
Salt = String()

EIP712_domain = make_domain(
name='Injective Protocol',
version='2.0.0',
chainId=888,
verifyingContract='0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
salt='0x0000000000000000000000000000000000000000000000000000000000000000'
)

domain_separator = EIP712_domain.hash_struct()

from eip712.messages import EIP712Message, EIP712Type
from eth_account.messages import _hash_eip191_message as hash_eip191_message
from hexbytes import HexBytes


class OrderInfo(EIP712Type):
SubaccountId: "string"
FeeRecipient: "string"
Price: "string"
Quantity: "string"


class SpotOrder(EIP712Message):
_name_ = "Injective Protocol"
_version_ = "2.0.0"
_chainId_ = 888
_verifyingContract_ = "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
_salt_ = HexBytes("0x0000000000000000000000000000000000000000000000000000000000000000")

MarketId: "string"
OrderInfo: OrderInfo
Salt: "string"
OrderType: "string"
TriggerPrice: "string"


class DerivativeOrder(EIP712Message):
_name_ = "Injective Protocol"
_version_ = "2.0.0"
_chainId_ = 888
_verifyingContract_ = "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
_salt_ = HexBytes("0x0000000000000000000000000000000000000000000000000000000000000000")

MarketId: "string"
OrderInfo: OrderInfo
OrderType: "string"
Margin: "string"
TriggerPrice: "string"
Salt: "string"


# domain_separator = EIP712_domain.hash_struct()
order_type_dict = {0: '\x00', 1: '\x01', 2: '\x02', 3: '\x03', 4: '\x04', 5: '\x05', 6: '\x06', 7: '\x07', 8: '\x08'}

class OrderHashResponse:
Expand Down Expand Up @@ -127,8 +137,6 @@ def build_eip712_msg(order, nonce):
)

def hash_order(msg):
typed_data_hash = msg.hash_struct()
typed_bytes = b'\x19\x01' + domain_separator + typed_data_hash
keccak256 = sha3.keccak_256()
keccak256.update(typed_bytes)
return '0x' + keccak256.hexdigest()
signable_message = msg.signable_message
hex_digest = hash_eip191_message(signable_message=signable_message).hex()
return "0x" + hex_digest
37 changes: 0 additions & 37 deletions pyinjective/proto/cosmos/base/store/v1beta1/commit_info_pb2.py

This file was deleted.

This file was deleted.

31 changes: 0 additions & 31 deletions pyinjective/proto/cosmos/base/store/v1beta1/listening_pb2.py

This file was deleted.

This file was deleted.

49 changes: 26 additions & 23 deletions pyinjective/proto/ibc/applications/fee/v1/tx_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading