Skip to content

Commit 572d3ad

Browse files
authored
Merge pull request #332 from InjectiveLabs/feat/update_dependencies_chain_v1_13
feat/update_dependencies_chain_v1_13
2 parents c8ac1b9 + b2c569c commit 572d3ad

File tree

726 files changed

+42367
-17442
lines changed

Some content is hidden

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

726 files changed

+42367
-17442
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## [1.6.0] - 9999-99-99
5+
## [1.6.0] - 2024-07-30
66
### Added
77
- Support for all queries in the chain "tendermint" module
88
- Support for all queries in the "IBC Transfer" module
99
- Support for all queries in the "IBC Channel" module
1010
- Support for all queries in the "IBC Client" module
1111
- Support for all queries in the "IBC Connection" module
12+
- Support for all queries and messages in the chain "permissions" module
1213
- Tokens initialization from the official tokens list in https://github.com/InjectiveLabs/injective-lists
1314

1415
### Changed
16+
- Updated all proto definitions based on chain upgrade to v1.13
1517
- Refactored cookies management logic to use all gRPC calls' responses to update the current cookies
1618

1719
## [1.5.4] - 2024-07-03

Makefile

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,15 @@ gen: gen-client
44

55
gen-client: clone-all copy-proto
66
mkdir -p ./pyinjective/proto
7-
@for dir in $(shell find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq); do \
8-
python3 -m grpc_tools.protoc \
9-
--proto_path=./proto \
10-
--python_out=./pyinjective/proto \
11-
--grpc_python_out=./pyinjective/proto \
12-
$$(find ./$${dir} -type f -name '*.proto'); \
13-
done
7+
buf generate --template buf.gen.yaml
148
rm -rf proto
159
$(call clean_repos)
16-
touch pyinjective/proto/__init__.py
17-
$(MAKE) fix-proto-imports
10+
$(MAKE) fix-generated-proto-imports
1811

1912
PROTO_MODULES := cosmwasm exchange gogoproto cosmos_proto cosmos testpb ibc amino tendermint injective
20-
fix-proto-imports:
13+
14+
fix-generated-proto-imports:
15+
@touch pyinjective/proto/__init__.py
2116
@for module in $(PROTO_MODULES); do \
2217
find ./pyinjective/proto -type f -name "*.py" -exec sed -i "" -e "s/from $${module}/from pyinjective.proto.$${module}/g" {} \; ; \
2318
done
@@ -35,39 +30,14 @@ endef
3530
clean-all:
3631
$(call clean_repos)
3732

38-
clone-injective-core:
39-
git clone https://github.com/InjectiveLabs/injective-core.git -b v1.12.1 --depth 1 --single-branch
40-
4133
clone-injective-indexer:
42-
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.12.79.1 --depth 1 --single-branch
43-
44-
clone-cometbft:
45-
git clone https://github.com/InjectiveLabs/cometbft.git -b v0.37.2-inj --depth 1 --single-branch
46-
47-
clone-wasmd:
48-
git clone https://github.com/InjectiveLabs/wasmd.git -b v0.45.0-inj --depth 1 --single-branch
34+
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.13.4 --depth 1 --single-branch
4935

50-
clone-cosmos-sdk:
51-
git clone https://github.com/InjectiveLabs/cosmos-sdk.git -b v0.47.3-inj-9 --depth 1 --single-branch
52-
53-
clone-ibc-go:
54-
git clone https://github.com/InjectiveLabs/ibc-go.git -b v7.2.0-inj --depth 1 --single-branch
55-
56-
clone-all: clone-cosmos-sdk clone-cometbft clone-ibc-go clone-wasmd clone-injective-core clone-injective-indexer
36+
clone-all: clone-injective-indexer
5737

5838
copy-proto:
5939
rm -rf pyinjective/proto
6040
mkdir -p proto/exchange
61-
buf export ./cosmos-sdk --output=third_party
62-
buf export ./ibc-go --exclude-imports --output=third_party
63-
buf export ./cometbft --exclude-imports --output=third_party
64-
buf export ./wasmd --exclude-imports --output=third_party
65-
buf export https://github.com/cosmos/ics23.git --exclude-imports --output=third_party
66-
cp -r injective-core/proto/injective proto/
67-
cp -r third_party/* proto/
68-
69-
rm -rf ./third_party
70-
7141
find ./injective-indexer/api/gen/grpc -type f -name "*.proto" -exec cp {} ./proto/exchange/ \;
7242

7343
tests:

buf.gen.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
version: v2
2+
managed:
3+
enabled: true
4+
plugins:
5+
- remote: buf.build/protocolbuffers/python
6+
out: ./pyinjective/proto/
7+
- remote: buf.build/grpc/python
8+
out: ./pyinjective/proto/
9+
inputs:
10+
- module: buf.build/cosmos/cosmos-proto
11+
- module: buf.build/cosmos/gogo-proto
12+
- module: buf.build/googleapis/googleapis
13+
- module: buf.build/cosmos/ics23
14+
- git_repo: https://github.com/InjectiveLabs/cosmos-sdk
15+
tag: v0.50.8-inj-0
16+
- git_repo: https://github.com/InjectiveLabs/ibc-go
17+
tag: v8.3.2-inj-0
18+
- git_repo: https://github.com/InjectiveLabs/wasmd
19+
tag: v0.51.0-inj-0
20+
# - git_repo: https://github.com/InjectiveLabs/wasmd
21+
# branch: v0.51.x-inj
22+
# subdir: proto
23+
- git_repo: https://github.com/InjectiveLabs/injective-core
24+
tag: v1.13.0
25+
subdir: proto
26+
# - git_repo: https://github.com/InjectiveLabs/injective-core
27+
# branch: master
28+
# subdir: proto
29+
- directory: proto

examples/chain_client/exchange/13_MsgInstantBinaryOptionsMarketLaunch.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22
import os
3+
from decimal import Decimal
34

45
import dotenv
56

@@ -40,14 +41,15 @@ async def main() -> None:
4041
oracle_provider="UFC",
4142
oracle_type="Provider",
4243
oracle_scale_factor=6,
43-
maker_fee_rate=0.0005, # 0.05%
44-
taker_fee_rate=0.0010, # 0.10%
44+
maker_fee_rate=Decimal("0.0005"), # 0.05%
45+
taker_fee_rate=Decimal("0.0010"), # 0.10%
4546
expiration_timestamp=1680730982,
4647
settlement_timestamp=1690730982,
4748
admin=address.to_acc_bech32(),
4849
quote_denom="peggy0xdAC17F958D2ee523a2206206994597C13D831ec7",
49-
min_price_tick_size=0.01,
50-
min_quantity_tick_size=0.01,
50+
min_price_tick_size=Decimal("0.01"),
51+
min_quantity_tick_size=Decimal("0.01"),
52+
min_notional=Decimal("1"),
5153
)
5254

5355
# broadcast the transaction

examples/chain_client/exchange/3_MsgInstantSpotMarketLaunch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ async def main() -> None:
4242
quote_denom="USDC",
4343
min_price_tick_size=Decimal("0.001"),
4444
min_quantity_tick_size=Decimal("0.01"),
45+
min_notional=Decimal("1"),
4546
)
4647

4748
# broadcast the transaction

examples/chain_client/exchange/4_MsgInstantPerpetualMarketLaunch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ async def main() -> None:
4949
maintenance_margin_ratio=Decimal("0.095"),
5050
min_price_tick_size=Decimal("0.001"),
5151
min_quantity_tick_size=Decimal("0.01"),
52+
min_notional=Decimal("1"),
5253
)
5354

5455
# broadcast the transaction

examples/chain_client/exchange/5_MsgInstantExpiryFuturesMarketLaunch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ async def main() -> None:
5050
maintenance_margin_ratio=Decimal("0.095"),
5151
min_price_tick_size=Decimal("0.001"),
5252
min_quantity_tick_size=Decimal("0.01"),
53+
min_notional=Decimal("1"),
5354
)
5455

5556
# broadcast the transaction
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import asyncio
2+
import os
3+
4+
import dotenv
5+
6+
from pyinjective.composer import Composer as ProtoMsgComposer
7+
from pyinjective.core.broadcaster import MsgBroadcasterWithPk
8+
from pyinjective.core.network import Network
9+
from pyinjective.wallet import PrivateKey
10+
11+
12+
async def main() -> None:
13+
dotenv.load_dotenv()
14+
private_key_in_hexa = os.getenv("INJECTIVE_PRIVATE_KEY")
15+
16+
# select network: local, testnet, mainnet
17+
network = Network.devnet()
18+
composer = ProtoMsgComposer(network=network.string())
19+
20+
message_broadcaster = MsgBroadcasterWithPk.new_using_simulation(
21+
network=network,
22+
private_key=private_key_in_hexa,
23+
)
24+
25+
priv_key = PrivateKey.from_hex(private_key_in_hexa)
26+
pub_key = priv_key.to_public_key()
27+
address = pub_key.to_address()
28+
29+
blocked_address = "inj1hkhdaj2a2clmq5jq6mspsggqs32vynpk228q3r"
30+
denom = "factory/inj1hkhdaj2a2clmq5jq6mspsggqs32vynpk228q3r/inj_test"
31+
role1 = composer.permissions_role(
32+
role=composer.DEFAULT_PERMISSIONS_EVERYONE_ROLE,
33+
permissions=composer.MINT_ACTION_PERMISSION
34+
| composer.RECEIVE_ACTION_PERMISSION
35+
| composer.BURN_ACTION_PERMISSION,
36+
)
37+
role2 = composer.permissions_role(role="blacklisted", permissions=composer.UNDEFINED_ACTION_PERMISSION)
38+
address_role1 = composer.permissions_address_roles(address=blocked_address, roles=["blacklisted"])
39+
40+
message = composer.msg_create_namespace(
41+
sender=address.to_acc_bech32(),
42+
denom=denom,
43+
wasm_hook="",
44+
mints_paused=False,
45+
sends_paused=False,
46+
burns_paused=False,
47+
role_permissions=[role1, role2],
48+
address_roles=[address_role1],
49+
)
50+
51+
# broadcast the transaction
52+
result = await message_broadcaster.broadcast([message])
53+
print("---Transaction Response---")
54+
print(result)
55+
56+
57+
if __name__ == "__main__":
58+
asyncio.get_event_loop().run_until_complete(main())
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import asyncio
2+
import os
3+
4+
import dotenv
5+
6+
from pyinjective.composer import Composer as ProtoMsgComposer
7+
from pyinjective.core.broadcaster import MsgBroadcasterWithPk
8+
from pyinjective.core.network import Network
9+
from pyinjective.wallet import PrivateKey
10+
11+
12+
async def main() -> None:
13+
dotenv.load_dotenv()
14+
private_key_in_hexa = os.getenv("INJECTIVE_PRIVATE_KEY")
15+
16+
# select network: local, testnet, mainnet
17+
network = Network.devnet()
18+
composer = ProtoMsgComposer(network=network.string())
19+
20+
message_broadcaster = MsgBroadcasterWithPk.new_using_simulation(
21+
network=network,
22+
private_key=private_key_in_hexa,
23+
)
24+
25+
priv_key = PrivateKey.from_hex(private_key_in_hexa)
26+
pub_key = priv_key.to_public_key()
27+
address = pub_key.to_address()
28+
29+
denom = "factory/inj1hkhdaj2a2clmq5jq6mspsggqs32vynpk228q3r/inj_test"
30+
message = composer.msg_delete_namespace(
31+
sender=address.to_acc_bech32(),
32+
namespace_denom=denom,
33+
)
34+
35+
# broadcast the transaction
36+
result = await message_broadcaster.broadcast([message])
37+
print("---Transaction Response---")
38+
print(result)
39+
40+
41+
if __name__ == "__main__":
42+
asyncio.get_event_loop().run_until_complete(main())
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import asyncio
2+
import os
3+
4+
import dotenv
5+
6+
from pyinjective.composer import Composer as ProtoMsgComposer
7+
from pyinjective.core.broadcaster import MsgBroadcasterWithPk
8+
from pyinjective.core.network import Network
9+
from pyinjective.wallet import PrivateKey
10+
11+
12+
async def main() -> None:
13+
dotenv.load_dotenv()
14+
private_key_in_hexa = os.getenv("INJECTIVE_PRIVATE_KEY")
15+
16+
# select network: local, testnet, mainnet
17+
network = Network.devnet()
18+
composer = ProtoMsgComposer(network=network.string())
19+
20+
message_broadcaster = MsgBroadcasterWithPk.new_using_simulation(
21+
network=network,
22+
private_key=private_key_in_hexa,
23+
)
24+
25+
priv_key = PrivateKey.from_hex(private_key_in_hexa)
26+
pub_key = priv_key.to_public_key()
27+
address = pub_key.to_address()
28+
29+
denom = "factory/inj1hkhdaj2a2clmq5jq6mspsggqs32vynpk228q3r/inj_test"
30+
31+
message = composer.msg_update_namespace(
32+
sender=address.to_acc_bech32(),
33+
namespace_denom=denom,
34+
wasm_hook="inj19ld6swyldyujcn72j7ugnu9twafhs9wxlyye5m",
35+
mints_paused=True,
36+
sends_paused=True,
37+
burns_paused=True,
38+
)
39+
40+
# broadcast the transaction
41+
result = await message_broadcaster.broadcast([message])
42+
print("---Transaction Response---")
43+
print(result)
44+
45+
46+
if __name__ == "__main__":
47+
asyncio.get_event_loop().run_until_complete(main())

0 commit comments

Comments
 (0)