Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/release v140 to master #311

Merged
merged 59 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
ae60e4d
(fix) Changed version number for dev branch
Jan 16, 2024
4fcdeba
Merge pull request #293 from InjectiveLabs/fix/sync_dev_with_master_110
aarmoa Jan 16, 2024
c318d0a
(feat) Cleaned up the markets initialization logic
Jan 17, 2024
9105d5b
Merge pull request #294 from InjectiveLabs/feat/cleanup_markets_initi…
aarmoa Jan 17, 2024
352cd44
(fix) Changed version number for dev branch
Jan 16, 2024
158b341
(feat) Cleaned up the markets initialization logic
Jan 17, 2024
f31992d
Merge branch 'dev' of https://github.com/InjectiveLabs/sdk-python int…
Jan 25, 2024
9720c80
Merge pull request #300 from InjectiveLabs/fix/sync_dev_with_master_1…
aarmoa Jan 25, 2024
ca0c2ce
(feat) Refactored all examples to remove references to private keys. …
Feb 6, 2024
8c64589
Merge branch 'dev' of https://github.com/InjectiveLabs/sdk-python int…
Feb 6, 2024
fe3bb32
Merge pull request #301 from InjectiveLabs/feat/use_dot_env_in_examples
aarmoa Feb 6, 2024
33e2962
(feat) Added support for all `distribution` module queries. Added als…
Feb 9, 2024
51a73f4
(fix) Fix error due to incomplete rename
Feb 9, 2024
03b81d6
(feat) Added support in Composer to create all missing messages from …
Feb 12, 2024
68c2a08
(fix) Changed version number for dev branch
Jan 16, 2024
445d44e
(feat) Cleaned up the markets initialization logic
Jan 17, 2024
3590e04
(feat) Refactored all examples to remove references to private keys. …
Feb 6, 2024
90f66bd
(fix) Changed version number for dev branch
Jan 16, 2024
9c1b774
(fix) Updated dependencies versions in poetry.lock
Feb 12, 2024
72229a8
Merge branch 'dev' of https://github.com/InjectiveLabs/sdk-python int…
Feb 12, 2024
13f776d
(fix) Fixed typo in CHANGELOG.md
Feb 12, 2024
e02f0c7
Merge pull request #306 from InjectiveLabs/feat/sync_dev_with_master_130
aarmoa Feb 12, 2024
65e6e99
(feat) Added support for all `distribution` module queries. Added als…
Feb 9, 2024
1c1067c
(fix) Fix error due to incomplete rename
Feb 9, 2024
c6c0cbd
(feat) Added support in Composer to create all missing messages from …
Feb 12, 2024
c64c8ca
Merge branch 'feat/add_distribution_module_queries_support' of https:…
Feb 13, 2024
0c61c63
Merge pull request #304 from InjectiveLabs/feat/add_distribution_modu…
aarmoa Feb 13, 2024
d566638
(feat) Added support for all chain exchange module queries. Included …
Feb 20, 2024
96c79c0
(feat) Added support for all chain exchange module messages in Compos…
Feb 27, 2024
25d3444
(feat) Adde CodeRabbit configuration file
Feb 27, 2024
4d6ce1b
(feat) Added support for all chain exchange module queries. Included …
Feb 20, 2024
c5cb600
(feat) Added support for all chain exchange module messages in Compos…
Feb 27, 2024
2991ccd
(feat) Adde CodeRabbit configuration file
Feb 27, 2024
bd42221
Merge branch 'feat/add_chain_exchange_module_support' of https://gith…
Feb 27, 2024
a435b21
(fix) Fix in CodeRabbit confir YAML file
Feb 27, 2024
a054c55
Merge pull request #307 from InjectiveLabs/feat/add_chain_exchange_mo…
aarmoa Feb 28, 2024
10491af
(fix) Changed version number for dev branch
Jan 16, 2024
4bba9cd
(feat) Cleaned up the markets initialization logic
Jan 17, 2024
c526eac
(feat) Refactored all examples to remove references to private keys. …
Feb 6, 2024
f02435c
(fix) Changed version number for dev branch
Jan 16, 2024
7573faa
(fix) Updated dependencies versions in poetry.lock
Feb 12, 2024
9235c41
(feat) Refactored all examples to remove references to private keys. …
Feb 6, 2024
9ff8783
(fix) Changed version number for dev branch
Jan 16, 2024
51f1752
(feat) Added support for all `distribution` module queries. Added als…
Feb 9, 2024
d976f69
(fix) Fix error due to incomplete rename
Feb 9, 2024
873e8c7
(feat) Added support in Composer to create all missing messages from …
Feb 12, 2024
364f022
(feat) Added support for all chain exchange module queries. Included …
Feb 20, 2024
17524af
(feat) Added support for all chain exchange module messages in Compos…
Feb 27, 2024
189354a
(feat) Adde CodeRabbit configuration file
Feb 27, 2024
4dfde9a
(feat) Added support for all chain exchange module queries. Included …
Feb 20, 2024
4725ad2
(feat) Added support for all chain exchange module messages in Compos…
Feb 27, 2024
1b6953a
(fix) Fix in CodeRabbit confir YAML file
Feb 27, 2024
5e8b13b
(feat) Added support for a missing endpoint in the chain exchange mod…
Mar 5, 2024
13ff9a8
(fix) Updated CHANGELOG.md file
Mar 5, 2024
aa397a0
Merge branch 'dev' of https://github.com/InjectiveLabs/sdk-python int…
Mar 5, 2024
c5645ab
Merge pull request #309 from InjectiveLabs/feat/add_trade_reward_camp…
aarmoa Mar 5, 2024
e365b10
(fix) Solved several errors in the example scripts
Mar 8, 2024
54e4622
Merge pull request #310 from InjectiveLabs/fix/fix_example_script_errors
aarmoa Mar 8, 2024
ec1fb93
(fix) Updated SDK version in pyproject.toml. Updated denoms .ini files
Mar 8, 2024
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
8 changes: 8 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
reviews:
auto_review:
base_branches:
- "master"
- "dev"
- "feat/.*"
chat:
auto_reply: true
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

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

## [1.4.0] - 2024-03-11
### Added
- Added support for all queries and messages in the chain 'distribution' module
- Added support for all queries and messages in the chain 'exchange' module
- Use of python-dotenv in all example scripts to load private keys from a .env file

## [1.3.1] - 2024-02-29
### Changed
- Updated cookie assistant logic to support the Indexer exchange server not using cookies and the chain server using them
Expand Down
7 changes: 6 additions & 1 deletion examples/SendToInjective.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import asyncio
import json
import os

import dotenv

from pyinjective.core.network import Network
from pyinjective.sendtocosmos import Peggo


async def main() -> None:
dotenv.load_dotenv()
private_key = os.getenv("INJECTIVE_PRIVATE_KEY")

# select network: testnet, mainnet
network = Network.testnet()
peggo_composer = Peggo(network=network.string())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ethereum_endpoint is hardcoded in the script. For enhanced flexibility and to accommodate different environments or networks, consider fetching this endpoint from an environment variable or a configuration file.


private_key = "5d386fbdbf11f1141010f81a46b40f94887367562bd33b452bbaa6ce1cd1381e"
ethereum_endpoint = "https://eth-goerli.g.alchemy.com/v2/q-7JVv4mTfsNh1y_djKkKn3maRBGILLL"

maxFeePerGas_Gwei = 4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import asyncio
import os
import uuid
from decimal import Decimal

import dotenv

from pyinjective.async_client import AsyncClient
from pyinjective.constant import GAS_FEE_BUFFER_AMOUNT, GAS_PRICE
Expand All @@ -10,6 +14,9 @@


async def main() -> None:
dotenv.load_dotenv()
configured_private_key = os.getenv("INJECTIVE_PRIVATE_KEY")

# select network: local, testnet, mainnet
network = Network.testnet()

Expand All @@ -19,7 +26,7 @@ async def main() -> None:
await client.sync_timeout_height()

# load account
priv_key = PrivateKey.from_hex("f9db9bf330e23cb7839039e944adef6e9df447b90b503d5b4464c90bea9022f3")
priv_key = PrivateKey.from_hex(configured_private_key)
pub_key = priv_key.to_public_key()
address = pub_key.to_address()
await client.fetch_account(address.to_acc_bech32())
Expand All @@ -34,57 +41,59 @@ async def main() -> None:
fee_recipient = "inj1hkhdaj2a2clmq5jq6mspsggqs32vynpk228q3r"

spot_orders = [
composer.SpotOrder(
composer.spot_order(
market_id=spot_market_id,
subaccount_id=subaccount_id,
fee_recipient=fee_recipient,
price=0.524,
quantity=0.01,
is_buy=True,
is_po=False,
price=Decimal("0.524"),
quantity=Decimal("0.01"),
order_type="BUY",
cid=str(uuid.uuid4()),
),
composer.SpotOrder(
composer.spot_order(
market_id=spot_market_id,
subaccount_id=subaccount_id,
fee_recipient=fee_recipient,
price=27.92,
quantity=0.01,
is_buy=False,
is_po=False,
price=Decimal("27.92"),
quantity=Decimal("0.01"),
order_type="SELL",
cid=str(uuid.uuid4()),
),
]

derivative_orders = [
composer.DerivativeOrder(
composer.derivative_order(
market_id=deriv_market_id,
subaccount_id=subaccount_id,
fee_recipient=fee_recipient,
price=10500,
quantity=0.01,
leverage=1.5,
is_buy=True,
is_po=False,
price=Decimal(10500),
quantity=Decimal(0.01),
margin=composer.calculate_margin(
quantity=Decimal(0.01), price=Decimal(10500), leverage=Decimal(2), is_reduce_only=False
),
order_type="BUY",
cid=str(uuid.uuid4()),
),
composer.DerivativeOrder(
composer.derivative_order(
market_id=deriv_market_id,
subaccount_id=subaccount_id,
fee_recipient=fee_recipient,
price=65111,
quantity=0.01,
leverage=2,
is_buy=False,
is_reduce_only=False,
price=Decimal(65111),
quantity=Decimal(0.01),
margin=composer.calculate_margin(
quantity=Decimal(0.01), price=Decimal(65111), leverage=Decimal(2), is_reduce_only=False
),
order_type="SELL",
cid=str(uuid.uuid4()),
),
]

# prepare tx msg
spot_msg = composer.MsgBatchCreateSpotLimitOrders(sender=address.to_acc_bech32(), orders=spot_orders)
spot_msg = composer.msg_batch_create_spot_limit_orders(sender=address.to_acc_bech32(), orders=spot_orders)

deriv_msg = composer.MsgBatchCreateDerivativeLimitOrders(sender=address.to_acc_bech32(), orders=derivative_orders)
deriv_msg = composer.msg_batch_create_derivative_limit_orders(
sender=address.to_acc_bech32(), orders=derivative_orders
)

# compute order hashes
order_hashes = order_hash_manager.compute_order_hashes(
Expand All @@ -107,7 +116,7 @@ async def main() -> None:
gas_limit = base_gas + GAS_FEE_BUFFER_AMOUNT # add buffer for gas fee computation
gas_fee = "{:.18f}".format((gas_price * gas_limit) / pow(10, 18)).rstrip("0")
fee = [
composer.Coin(
composer.coin(
amount=gas_price * gas_limit,
denom=network.fee_denom,
)
Expand Down Expand Up @@ -144,7 +153,7 @@ async def main() -> None:
gas_limit = base_gas + GAS_FEE_BUFFER_AMOUNT # add buffer for gas fee computation
gas_fee = "{:.18f}".format((gas_price * gas_limit) / pow(10, 18)).rstrip("0")
fee = [
composer.Coin(
composer.coin(
amount=gas_price * gas_limit,
denom=network.fee_denom,
)
Expand All @@ -161,57 +170,59 @@ async def main() -> None:
print("gas fee: {} INJ".format(gas_fee))

spot_orders = [
composer.SpotOrder(
composer.spot_order(
market_id=spot_market_id,
subaccount_id=subaccount_id_2,
fee_recipient=fee_recipient,
price=1.524,
quantity=0.01,
is_buy=True,
is_po=True,
price=Decimal("1.524"),
quantity=Decimal("0.01"),
order_type="BUY_PO",
cid=str(uuid.uuid4()),
),
composer.SpotOrder(
composer.spot_order(
market_id=spot_market_id,
subaccount_id=subaccount_id_2,
fee_recipient=fee_recipient,
price=27.92,
quantity=0.01,
is_buy=False,
is_po=False,
price=Decimal("27.92"),
quantity=Decimal("0.01"),
order_type="SELL_PO",
cid=str(uuid.uuid4()),
),
]

derivative_orders = [
composer.DerivativeOrder(
composer.derivative_order(
market_id=deriv_market_id,
subaccount_id=subaccount_id_2,
fee_recipient=fee_recipient,
price=25111,
quantity=0.01,
leverage=1.5,
is_buy=True,
is_po=False,
price=Decimal(25111),
quantity=Decimal(0.01),
margin=composer.calculate_margin(
quantity=Decimal(0.01), price=Decimal(25111), leverage=Decimal("1.5"), is_reduce_only=False
),
order_type="BUY",
cid=str(uuid.uuid4()),
),
composer.DerivativeOrder(
composer.derivative_order(
market_id=deriv_market_id,
subaccount_id=subaccount_id_2,
fee_recipient=fee_recipient,
price=65111,
quantity=0.01,
leverage=2,
is_buy=False,
is_reduce_only=False,
price=Decimal(65111),
quantity=Decimal(0.01),
margin=composer.calculate_margin(
quantity=Decimal(0.01), price=Decimal(25111), leverage=Decimal(2), is_reduce_only=False
),
order_type="SELL",
cid=str(uuid.uuid4()),
),
]

# prepare tx msg
spot_msg = composer.MsgBatchCreateSpotLimitOrders(sender=address.to_acc_bech32(), orders=spot_orders)
spot_msg = composer.msg_batch_create_spot_limit_orders(sender=address.to_acc_bech32(), orders=spot_orders)

deriv_msg = composer.MsgBatchCreateDerivativeLimitOrders(sender=address.to_acc_bech32(), orders=derivative_orders)
deriv_msg = composer.msg_batch_create_derivative_limit_orders(
sender=address.to_acc_bech32(), orders=derivative_orders
)

# compute order hashes
order_hashes = order_hash_manager.compute_order_hashes(
Expand All @@ -234,7 +245,7 @@ async def main() -> None:
gas_limit = base_gas + GAS_FEE_BUFFER_AMOUNT # add buffer for gas fee computation
gas_fee = "{:.18f}".format((gas_price * gas_limit) / pow(10, 18)).rstrip("0")
fee = [
composer.Coin(
composer.coin(
amount=gas_price * gas_limit,
denom=network.fee_denom,
)
Expand Down
76 changes: 0 additions & 76 deletions examples/chain_client/26_MsgWithdrawDelegatorReward.py

This file was deleted.

Loading
Loading