Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: InjectiveLabs/sdk-python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.1.1
Choose a base ref
...
head repository: InjectiveLabs/sdk-python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Jan 16, 2024

  1. (fix) Changed version number for dev branch

    abel committed Jan 16, 2024
    Copy the full SHA
    ae60e4d View commit details
  2. Merge pull request #293 from InjectiveLabs/fix/sync_dev_with_master_110

    Fix/sync dev with master 110
    aarmoa authored Jan 16, 2024
    Copy the full SHA
    4fcdeba View commit details

Commits on Jan 17, 2024

  1. Copy the full SHA
    c318d0a View commit details
  2. Merge pull request #294 from InjectiveLabs/feat/cleanup_markets_initi…

    …alization_logic
    
    (feat) Cleaned up the markets initialization logic
    aarmoa authored Jan 17, 2024
    Copy the full SHA
    9105d5b View commit details

Commits on Jan 23, 2024

  1. (fix) Updated gas cost for messages in gas estimator. Updated core de…

    …pendencies to version 1.12.1
    abel committed Jan 23, 2024
    Copy the full SHA
    f54b4d1 View commit details
  2. (fix) Updated version number and CHANGELOG

    abel committed Jan 23, 2024
    Copy the full SHA
    ae051f4 View commit details

Commits on Jan 24, 2024

  1. Copy the full SHA
    6eefa4c View commit details
  2. (fix) Configured different extra gas cost for spot and derivative pos…

    …t only orders
    abel committed Jan 24, 2024
    Copy the full SHA
    53496cf View commit details
  3. (fix) Changed gas cost of spot orders in general, to solve out of gas…

    … issues when using the estimator
    abel committed Jan 24, 2024
    Copy the full SHA
    e315110 View commit details

Commits on Jan 25, 2024

  1. Copy the full SHA
    1d66710 View commit details
  2. Merge pull request #299 from InjectiveLabs/feat/update_gas_cost_in_ga…

    …s_estimator
    
    Feat/update gas cost in gas estimator
    aarmoa authored Jan 25, 2024
    Copy the full SHA
    b2758b7 View commit details
  3. (fix) Changed version number for dev branch

    abel committed Jan 25, 2024
    Copy the full SHA
    352cd44 View commit details
  4. Copy the full SHA
    158b341 View commit details
  5. Merge branch 'dev' of https://github.com/InjectiveLabs/sdk-python int…

    …o fix/sync_dev_with_master_1_12_0
    abel committed Jan 25, 2024
    Copy the full SHA
    f31992d View commit details
  6. Merge pull request #300 from InjectiveLabs/fix/sync_dev_with_master_1…

    …_12_0
    
    Fix/sync dev with master 1.12.0
    aarmoa authored Jan 25, 2024
    Copy the full SHA
    9720c80 View commit details

Commits on Feb 6, 2024

  1. (feat) Refactored all examples to remove references to private keys. …

    …Added the use of `dotenv` to load private keys into environment variables. Removed `asyncio` package dependency
    abel committed Feb 6, 2024
    Copy the full SHA
    ca0c2ce View commit details
  2. Merge branch 'dev' of https://github.com/InjectiveLabs/sdk-python int…

    …o feat/use_dot_env_in_examples
    abel committed Feb 6, 2024
    Copy the full SHA
    8c64589 View commit details
  3. Merge pull request #301 from InjectiveLabs/feat/use_dot_env_in_examples

    Feat/use dot env in examples
    aarmoa authored Feb 6, 2024
    Copy the full SHA
    fe3bb32 View commit details

Commits on Feb 9, 2024

  1. (feat) Added support for all distribution module queries. Added als…

    …o new example scripts for all queries and unit tests
    abel committed Feb 9, 2024
    Copy the full SHA
    33e2962 View commit details
  2. (fix) Fix error due to incomplete rename

    abel committed Feb 9, 2024
    Copy the full SHA
    51a73f4 View commit details

Commits on Feb 12, 2024

  1. (feat) Added support in Composer to create all missing messages from …

    …the `distribution` module. Marked as deprecated old functions not following Python naming standards and created the replacements for them (with the correct name following standards)
    abel committed Feb 12, 2024
    Copy the full SHA
    03b81d6 View commit details
  2. Copy the full SHA
    41473cd View commit details
  3. (fix) Updated version number

    abel committed Feb 12, 2024
    Copy the full SHA
    af40b1a View commit details
  4. Merge pull request #305 from InjectiveLabs/fix/remove_asyncio_dependency

    fix/remove_asyncio_dependency
    aarmoa authored Feb 12, 2024
    Copy the full SHA
    9aae397 View commit details
  5. (fix) Changed version number for dev branch

    abel committed Feb 12, 2024
    Copy the full SHA
    68c2a08 View commit details
  6. Copy the full SHA
    445d44e View commit details
  7. (feat) Refactored all examples to remove references to private keys. …

    …Added the use of `dotenv` to load private keys into environment variables. Removed `asyncio` package dependency
    abel committed Feb 12, 2024
    Copy the full SHA
    3590e04 View commit details
  8. (fix) Changed version number for dev branch

    abel committed Feb 12, 2024
    Copy the full SHA
    90f66bd View commit details
  9. Copy the full SHA
    9c1b774 View commit details
  10. Merge branch 'dev' of https://github.com/InjectiveLabs/sdk-python int…

    …o feat/sync_dev_with_master_130
    abel committed Feb 12, 2024
    Copy the full SHA
    72229a8 View commit details
  11. (fix) Fixed typo in CHANGELOG.md

    abel committed Feb 12, 2024
    Copy the full SHA
    13f776d View commit details
  12. Merge pull request #306 from InjectiveLabs/feat/sync_dev_with_master_130

    Feat/sync dev with master 1.3.0
    aarmoa authored Feb 12, 2024
    Copy the full SHA
    e02f0c7 View commit details

Commits on Feb 13, 2024

  1. (feat) Added support for all distribution module queries. Added als…

    …o new example scripts for all queries and unit tests
    abel committed Feb 13, 2024
    Copy the full SHA
    65e6e99 View commit details
  2. (fix) Fix error due to incomplete rename

    abel committed Feb 13, 2024
    Copy the full SHA
    1c1067c View commit details
  3. (feat) Added support in Composer to create all missing messages from …

    …the `distribution` module. Marked as deprecated old functions not following Python naming standards and created the replacements for them (with the correct name following standards)
    abel committed Feb 13, 2024
    Copy the full SHA
    c6c0cbd View commit details
  4. Merge branch 'feat/add_distribution_module_queries_support' of https:…

    …//github.com/InjectiveLabs/sdk-python into feat/add_distribution_module_queries_support
    abel committed Feb 13, 2024
    Copy the full SHA
    c64c8ca View commit details
  5. Merge pull request #304 from InjectiveLabs/feat/add_distribution_modu…

    …le_queries_support
    
    Feat/add distribution module queries support
    aarmoa authored Feb 13, 2024
    Copy the full SHA
    0c61c63 View commit details

Commits on Feb 20, 2024

  1. (feat) Added support for all chain exchange module queries. Included …

    …new example scripts for all the queries and unit tests.
    abel committed Feb 20, 2024
    Copy the full SHA
    d566638 View commit details

Commits on Feb 27, 2024

  1. (feat) Added support for all chain exchange module messages in Compos…

    …er. Added unit tests for new messages. Refactored example scripts to move them into separated subfolders for each module.
    abel committed Feb 27, 2024
    Copy the full SHA
    96c79c0 View commit details
  2. (feat) Adde CodeRabbit configuration file

    abel committed Feb 27, 2024
    Copy the full SHA
    25d3444 View commit details
  3. (feat) Added support for all chain exchange module queries. Included …

    …new example scripts for all the queries and unit tests.
    abel committed Feb 27, 2024
    Copy the full SHA
    4d6ce1b View commit details
  4. (feat) Added support for all chain exchange module messages in Compos…

    …er. Added unit tests for new messages. Refactored example scripts to move them into separated subfolders for each module.
    abel committed Feb 27, 2024
    Copy the full SHA
    c5cb600 View commit details
  5. (feat) Adde CodeRabbit configuration file

    abel committed Feb 27, 2024
    Copy the full SHA
    2991ccd View commit details
  6. Merge branch 'feat/add_chain_exchange_module_support' of https://gith…

    …ub.com/InjectiveLabs/sdk-python into feat/add_chain_exchange_module_support
    abel committed Feb 27, 2024
    Copy the full SHA
    bd42221 View commit details
  7. (fix) Fix in CodeRabbit confir YAML file

    abel committed Feb 27, 2024
    Copy the full SHA
    a435b21 View commit details

Commits on Feb 28, 2024

  1. Merge pull request #307 from InjectiveLabs/feat/add_chain_exchange_mo…

    …dule_support
    
    Feat/add chain exchange module support
    aarmoa authored Feb 28, 2024
    Copy the full SHA
    a054c55 View commit details

Commits on Feb 29, 2024

  1. (fix) Updated the cookie assistant to support the exchange server not…

    … returning any cookie
    abel committed Feb 29, 2024
    Copy the full SHA
    cee3bfb View commit details
  2. (fix) Changed cookie expiration info parsing in the Kubernetes cookie…

    …s assistant to tackle the suggestion in the PR review
    abel committed Feb 29, 2024
    Copy the full SHA
    8cebde5 View commit details
  3. Merge pull request #308 from InjectiveLabs/fix/update_indexer_cookie_…

    …policy
    
    fix/update_indexer_cookie_policy
    aarmoa authored Feb 29, 2024
    Copy the full SHA
    83152b2 View commit details

Commits on Mar 5, 2024

  1. (fix) Changed version number for dev branch

    abel committed Mar 5, 2024
    Copy the full SHA
    10491af View commit details
Showing 847 changed files with 47,724 additions and 23,012 deletions.
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
9 changes: 5 additions & 4 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -9,15 +9,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4

uses: actions/setup-python@v5
with:
python-version: '>=3.9 <3.12'
- name: Install poetry
run: python -m pip install poetry
- name: Cache the virtualenv
id: cache-venv
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./.venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -10,9 +10,9 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
- name: Install poetry
run: python -m pip install poetry
- name: Publish package
10 changes: 5 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -9,24 +9,24 @@ jobs:
strategy:
matrix:
python: ["3.9", "3.10", "3.11"]
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-13, windows-latest]
runs-on: ${{ matrix.os }}
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install poetry
run: python -m pip install poetry
- name: Cache the virtualenv
id: cache-venv
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./.venv
key: ${{ runner.os }}-${{ matrix.python }}-venv-${{ hashFiles('**/poetry.lock') }}
@@ -40,6 +40,6 @@ jobs:
poetry run pytest --cov --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
env_vars: OS,PYTHON
118 changes: 118 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,124 @@

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

## [1.8.2] - 2024-12-13
### Changed
- Updated `protobuf` dependency version to make it more flexible

## [1.8.1] - 2024-12-04
### Changed
- Updated OFAC list link and contents

## [1.8.0] - 2024-11-14
### Changed
- The markets initialization in AsyncClient has been modified to get markets information from the chain endpoints instead of the Indexer endpoints

### Removed
- Removed the legacy deprecated markets and tokens initialization using the denoms INI files in the SDK. Removed also the INI files from the SDK

## [1.7.2] - 2024-11-13
### Fixed
- Fixed link to official `ofac.json` file
- Refreshed the local copy of the file after the update

## [1.7.1] - 2024-09-24
### Fixed
- Fixed logic to get the absolute ofac.json file path

## [1.7.0] - 2024-09-19
### Added
- Added OFAC restricted addresses validations

## [1.6.3]
### Fixed
- Updated reference gas cost for messages in the gas limit estimator after chain upgrade v1.13

## [1.6.2]
### Fixed
- Fixed issue in the `listen_derivative_market_updates` method in the `AsyncClient` class

## [1.6.1] - 2024-08-07
### Added
- Added support for the following messages in the chain "exchange" module:
- MsgDecreasePositionMargin
- MsgUpdateSpotMarket
- MsgUpdateDerivativeMarket
- MsgAuthorizeStakeGrants
- MsgActivateStakeGrant

## [1.6.0] - 2024-07-30
### Added
- Support for all queries in the chain "tendermint" module
- Support for all queries in the "IBC Transfer" module
- Support for all queries in the "IBC Channel" module
- Support for all queries in the "IBC Client" module
- Support for all queries in the "IBC Connection" module
- Support for all queries and messages in the chain "permissions" module
- Tokens initialization from the official tokens list in https://github.com/InjectiveLabs/injective-lists

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

## [1.5.4] - 2024-07-03
### Changed
- Fixed all import statements in pyinjective.proto modules to make them explicit

## [1.4.4] - 2024-07-03
### Changed
- Fixed all import statements in pyinjective.proto modules to make them explicit

## [1.5.3] - 2024-06-12
### Changed
- Changed parameter `key` from the PaginationOption class.
- Fixed an error when using the next page key in PaginationOption, causing incorrect pagination responses.

## [1.4.3] - 2024-06-06
### Changed
- Fixed `protobuf` dependency version to "<5" to for the v1.4 branch, because newer versions require a code refactoring (done in v1.5)
- Fixed `protobuf` dependency version to "<5" for the v1.4 branch because newer versions require a code refactoring (done in v1.5)

## [1.5.2] - 2024-05-10
### Changed
- Updated `protobuf` dependency version to ">=5.26.1"

## [1.5.1] - 2024-05-02
### Changed
- Updated calls to `json_format.MessageToDict` for compliance with the new version of the `protobuf` library

## [1.5.0] - 2024-04-19
### Changed
- Refactoring in Network class to support mixed secure and insecure endpoints.
- Marked the Network parameter `use_secure_connection` as deprecated.

## [1.4.2] - 2024-03-19
### Changed
- Updated `aiohttp` dependency version to ">=3.9.2" to solve a security vulnerability detected by Dependabot

## [1.4.1] - 2024-03-12
### Changed
- Updates example scripts that were still using deprecated methods

## [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

## [1.3.0] - 2024-02-12
### Changed
- Removed `asyncio` from the dependencies

## [1.2.0] - 2024-01-25
### Changed
- Updated reference gas cost for all messages in the gas estimator
- Included different calculation for Post Only orders
- Updated all proto definitions for Injective Core 1.12.1

## [1.1.1] - 2024-01-18
### Changed
- Updated the logic to create a `MsgLiquidatePosition` message
50 changes: 14 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
@@ -3,17 +3,20 @@ all:
gen: gen-client

gen-client: clone-all copy-proto
@for dir in $(shell find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq); do \
mkdir -p ./pyinjective/$${dir}; \
python3 -m grpc_tools.protoc \
-I proto \
--python_out=./pyinjective/proto \
--grpc_python_out=./pyinjective/proto \
$$(find ./$${dir} -type f -name '*.proto'); \
done; \
mkdir -p ./pyinjective/proto
buf generate --template buf.gen.yaml
rm -rf proto
$(call clean_repos)
echo "import os\nimport sys\n\nsys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))" > pyinjective/proto/__init__.py
$(MAKE) fix-generated-proto-imports

PROTO_MODULES := cosmwasm exchange gogoproto cosmos_proto cosmos testpb ibc amino tendermint injective

fix-generated-proto-imports:
@touch pyinjective/proto/__init__.py
@for module in $(PROTO_MODULES); do \
find ./pyinjective/proto -type f -name "*.py" -exec sed -i "" -e "s/from $${module}/from pyinjective.proto.$${module}/g" {} \; ; \
done
@find ./pyinjective/proto -type f -name "*.py" -exec sed -i "" -e "s/from google.api/from pyinjective.proto.google.api/g" {} \;

define clean_repos
rm -Rf cosmos-sdk
@@ -27,39 +30,14 @@ endef
clean-all:
$(call clean_repos)

clone-injective-core:
git clone https://github.com/InjectiveLabs/injective-core.git -b v1.12.0 --depth 1 --single-branch

clone-injective-indexer:
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.12.79.1 --depth 1 --single-branch

clone-cometbft:
git clone https://github.com/InjectiveLabs/cometbft.git -b v0.37.2-inj --depth 1 --single-branch

clone-wasmd:
git clone https://github.com/InjectiveLabs/wasmd.git -b v0.45.0-inj --depth 1 --single-branch
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.13.4 --depth 1 --single-branch

clone-cosmos-sdk:
git clone https://github.com/InjectiveLabs/cosmos-sdk.git -b v0.47.3-inj-9 --depth 1 --single-branch

clone-ibc-go:
git clone https://github.com/InjectiveLabs/ibc-go.git -b v7.2.0-inj --depth 1 --single-branch

clone-all: clone-cosmos-sdk clone-cometbft clone-ibc-go clone-wasmd clone-injective-core clone-injective-indexer
clone-all: clone-injective-indexer

copy-proto:
rm -rf pyinjective/proto
mkdir -p proto/exchange
buf export ./cosmos-sdk --output=third_party
buf export ./ibc-go --exclude-imports --output=third_party
buf export ./cometbft --exclude-imports --output=third_party
buf export ./wasmd --exclude-imports --output=third_party
buf export https://github.com/cosmos/ics23.git --exclude-imports --output=third_party
cp -r injective-core/proto/injective proto/
cp -r third_party/* proto/

rm -rf ./third_party

find ./injective-indexer/api/gen/grpc -type f -name "*.proto" -exec cp {} ./proto/exchange/ \;

tests:
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ sudo dnf install python3-devel autoconf automake gcc gcc-c++ libffi-devel libtoo
**macOS**

```bash
brew install autoconf automake libtool
brew install autoconf automake libtool bufbuild/buf/buf
```

### Quick Start
@@ -67,7 +67,7 @@ Upgrade `pip` to the latest version, if you see these warnings:

3. Fetch latest denom config
```
poetry run python pyinjective/fetch_metadata.py
poetry run python pyinjective/utils/fetch_metadata.py
```

Note that the [sync client](https://github.com/InjectiveLabs/sdk-python/blob/master/pyinjective/client.py) has been deprecated as of April 18, 2022. If you are using the sync client please make sure to transition to the [async client](https://github.com/InjectiveLabs/sdk-python/blob/master/pyinjective/async_client.py), for more information read [here](https://github.com/InjectiveLabs/sdk-python/issues/101)
29 changes: 29 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: v2
managed:
enabled: true
plugins:
- remote: buf.build/protocolbuffers/python:v26.1
out: ./pyinjective/proto/
- remote: buf.build/grpc/python:v1.65.5
out: ./pyinjective/proto/
inputs:
- module: buf.build/cosmos/cosmos-proto
- module: buf.build/cosmos/gogo-proto
- module: buf.build/googleapis/googleapis
- module: buf.build/cosmos/ics23
- git_repo: https://github.com/InjectiveLabs/cosmos-sdk
tag: v0.50.8-inj-0
- git_repo: https://github.com/InjectiveLabs/ibc-go
tag: v8.3.2-inj-0
- git_repo: https://github.com/InjectiveLabs/wasmd
tag: v0.51.0-inj-0
# - git_repo: https://github.com/InjectiveLabs/wasmd
# branch: v0.51.x-inj
# subdir: proto
- git_repo: https://github.com/InjectiveLabs/injective-core
tag: v1.13.0
subdir: proto
# - git_repo: https://github.com/InjectiveLabs/injective-core
# branch: master
# subdir: proto
- directory: proto
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())

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

maxFeePerGas_Gwei = 4
Loading