Giter Site home page Giter Site logo

fireblocks-defi-sdk-py's People

Contributors

aviba avatar chenshoo avatar dsahni avatar rdvorkin avatar salickco avatar tomerlf44 avatar yanlevi avatar yarinvak avatar yoavbz avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fireblocks-defi-sdk-py's Issues

Updated py-evm package is required to run the examples

Without installing py-evm, running the examples raises an error:
"TypeError: MockBackend.estimate_gas() takes 2 positional arguments but 3 were given"

After installing via "pip install py-evm" the error is resolved

Import in examples do not work

from web3 import Web3
from web3_bridge import Web3Bridge
from chain import Chain
from fireblocks_sdk import FireblocksSDK, TransferPeerPath, TRANSACTION_STATUS_CONFIRMED, TRANSACTION_STATUS_CANCELLED, TRANSACTION_STATUS_REJECTED, TRANSACTION_STATUS_FAILED, VAULT_ACCOUNT,\
    TRANSACTION_MINT, TRANSACTION_BURN, FireblocksApiException, DestinationTransferPeerPath, ONE_TIME_ADDRESS

these import from the examples can not work.
"chain" and "web3_bridge" are files within the fireblocks_defi_sdk_py package and have to be imported like this:

from fireblocks_defi_sdk_py.web3_bridge import Web3Bridge
from fireblocks_defi_sdk_py.chain import Chain

Requires >= Python 3.9

Because fo the way type hinting is used in this definition

def safe_batch_transfer_from(self, to_address: str, token_ids: list[int], values: list[int], from_address: str = "",
                                 data: bytes = bytearray(), note: str = ""):

in file: fireblocks_defi_sdk_py/examples/basic_example.py

Python 3.9 or above is needed in order to run this code but the documentation indicates that python 3.6 is sufficient.

Wrong return type, misleading timeout, and print() statements

def check_tx_is_completed(self, tx_id) -> dict:
"""
This function waits for SUBMIT_TIMEOUT*4 (180 by default) seconds to retrieve status of the transaction sent to
Fireblocks. Will stop upon completion / failure.
:param tx_id: Transaction ID from FBKS.
:return: Transaction last status after timeout / completion.
"""
timeout = 0
current_status = self.fb_api_client.get_transaction_by_id(tx_id)[STATUS_KEY]
while current_status not in (
TRANSACTION_STATUS_COMPLETED, TRANSACTION_STATUS_FAILED, TRANSACTION_STATUS_BLOCKED,
TRANSACTION_STATUS_CANCELLED) and timeout < SUBMIT_TIMEOUT:
print(f"TX [{tx_id}] is currently at status - {current_status} {'.' * (timeout % 4)} ",
end="\r")
time.sleep(4)
current_status = self.fb_api_client.get_transaction_by_id(tx_id)[STATUS_KEY]
timeout += 1
print(f"\nTX [{tx_id}] is currently at status - {current_status}")
return current_status

These print statements make it extra difficult for output be properly logged. They should either be done with the logging package or just not at all, since this isn't a presentation layer. In particular, the \r special character to make it look self-erasing ruins my log files.

I'm confused as to why the initial call to Why doesn't the initial POST return an HTTP 202 status to indicate that it wasn't completed, only accepted? Also, SUBMIT_TIMEOUT is actually a retry loop, not a time in seconds, which is misleading. It will stop retrying after SUBMIT_TIMEOUT number of loops, which is guaranteed to be significantly longer than SUBMIT_TIMEOUT*4 since the very minimum amount of time it will take is 4 seconds from the time.sleep(4) statement.

Also this function returns str and not dict

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.