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

Fix type annotations to support < Python3.9 #22

Merged
merged 5 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 8 additions & 5 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]

python-version: [3.6, 3.7, 3.8, 3.9, '3.10', 3.11]
os: [macos-11, macos-12, windows-latest, ubuntu-18.04, ubuntu-20.04, ubuntu-22.04]
exclude:
- python-version: 3.6
os: ubuntu-22.04
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -20,13 +22,14 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Build package
run: pip install -e .
# - name: Test with pytest
# run: |
# pytest
3 changes: 1 addition & 2 deletions fireblocks_defi_sdk_py/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Chain(Enum):
SONGBIRD = "songbird"
ARBITRUM = "arbitrum"
ARBITRUM_RIN = "arbitrum_rin"
ARBITRUM_GOERLI = "arbitrum_goerli"
FANTOM = "fantom"
RSK = "rsk_smart_bitcoin"
RSK_TEST = "rsk smart bitcoin testnet"
Expand All @@ -27,5 +28,3 @@ class Chain(Enum):
OPTIMISM_KOVAN = "optimistic ethereum kovan"
RONIN = "ronin"
RONIN_TEST = "ronin_test"
ARBITRUM = "arbitrum"
ARBITRUM_GOERLI = "arbitrum_goerli"
6 changes: 4 additions & 2 deletions fireblocks_defi_sdk_py/tokenization/tokens/erc1155.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import List

from . base_token import *
from .. utils.helpers import ERC1155_ABI

Expand Down Expand Up @@ -50,7 +52,7 @@ def safe_transfer_from(self, to_address: str, token_id: int, amount: int, from_a

return self.submit_transaction(transaction, note)

def safe_batch_transfer_from(self, to_address: str, token_ids: list[int], values: list[int], from_address: str = "",
def safe_batch_transfer_from(self, to_address: str, token_ids: List[int], values: List[int], from_address: str = "",
data: bytes = bytearray(), note: str = ""):
"""
Length of token_ids and values must match. Moreover, the value of each token (at position x at [values]) to be
Expand Down Expand Up @@ -106,7 +108,7 @@ def balance_of(self, token_id: int, owner_address: str = "") -> int:
owner_address = self.wallet_address
return self.call_read_function("balanceOf", owner_address, token_id)

def balance_of_batch(self, id_list: list[int], owners_list=None) -> list[int]:
def balance_of_batch(self, id_list: List[int], owners_list=None) -> List[int]:
"""

:param owners_list: A list of addresses
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

22 changes: 12 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

setup(
name='fireblocks_defi_sdk',
packages=['fireblocks_defi_sdk_py',
'fireblocks_defi_sdk_py.tokenization',
'fireblocks_defi_sdk_py.tokenization.tokens',
'fireblocks_defi_sdk_py.tokenization.utils',
'fireblocks_defi_sdk_py.tokenization.examples'],
packages=[
'fireblocks_defi_sdk_py',
'fireblocks_defi_sdk_py.tokenization',
'fireblocks_defi_sdk_py.tokenization.tokens',
'fireblocks_defi_sdk_py.tokenization.utils',
'fireblocks_defi_sdk_py.tokenization.examples'
],
version='1.0.0',
license='MIT',
description='fireblocks_defi_sdk_py',
Expand All @@ -17,10 +19,9 @@
url='https://github.com/fireblocks/fireblocks-defi-sdk-py',
download_url='https://github.com/fireblocks/fireblocks-defi-sdk-py/archive/refs/tags/1.0.0.tar.gz',
keywords=['FIREBLOCKS', 'DeFi', 'SDK', 'PYTHON'],

install_requires=[
'fireblocks_sdk',
'web3',
'fireblocks_sdk==1.17.3',
'web3==5.26.0'
],
classifiers=[
'Development Status :: 3 - Alpha',
Expand All @@ -31,6 +32,7 @@
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
'Programming Language :: Python :: 3.10'
'Programming Language :: Python :: 3.11'
]
)