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

(feat) Improved the Injective Delegation Script #6905

Open
wants to merge 8 commits into
base: development
Choose a base branch
from

Conversation

peterwilli
Copy link
Contributor

@peterwilli peterwilli commented Mar 11, 2024

Before submitting this PR, please make sure:

  • Your code builds clean without any errors or warnings
  • You are using approved title ("feat/", "fix/", "docs/", "refactor/")

A description of the changes proposed in the pull request:

With this change, you can use the delegation script without any modifications as it uses argparse to supply the parameters.

In addition to argparse, the script now also takes both a private key and seed phrase, without showing it on screen (no echo). This improves security (when someone is looking over your shoulder).

Also, deprecated functions have been replaced by up-to-date PyInjective functions. We might have to update the dependency in the docker container, though. I will make a separate PR for this.

Current usage:

usage: account_delegation_script.py [-h] [--network NETWORK] --grantee_address GRANTEE_ADDRESS [--granter_subaccount_index GRANTER_SUBACCOUNT_INDEX] [--grant_expiration_days GRANT_EXPIRATION_DAYS] [--spot_market_ids SPOT_MARKET_IDS]
                                    [--derivative_market_ids DERIVATIVE_MARKET_IDS]

Delegate Injective funds for trading.

options:
  -h, --help            show this help message and exit
  --network NETWORK
  --grantee_address GRANTEE_ADDRESS
  --granter_subaccount_index GRANTER_SUBACCOUNT_INDEX
  --grant_expiration_days GRANT_EXPIRATION_DAYS
                        Expiration of the grant (in days) (default: 365)
  --spot_market_ids SPOT_MARKET_IDS
                        Comma-separated list of spot market IDs to accept (see: mainnet: https://lcd.injective.network/injective/exchange/v1beta1/spot/markets testnet:
                        https://k8s.testnet.lcd.injective.network/injective/exchange/v1beta1/spot/markets) (default: None)
  --derivative_market_ids DERIVATIVE_MARKET_IDS
                        Comma-separated list of derivative market IDs to accept (see: mainnet: https://lcd.injective.network/injective/exchange/v1beta1/derivative/markets testnet:
                        https://k8s.testnet.lcd.injective.network/injective/exchange/v1beta1/derivative/markets) (default: None)

Tests performed by the developer:

Tested the script with my test trading account (Call was python hummingbot/connector/exchange/injective_v2/account_delegation_script.py --grantee_address inj1wdgalm0ygdcs4235gw7gqcwzsflpvaqfdq82tj --derivative_market_ids=0x18b2ca44b3d20a3b87c87d3765669b09b73b5e900693896c08394c70e79ab1e7 --grant_expiration_days 1): https://www.mintscan.io/injective/tx/9D310898642A5270FF969FC537180FD95E41FD60F391AA9A91B8632C5F890773

Tips for QA testing:

@nikspz nikspz changed the base branch from master to development March 11, 2024 13:15
@nikspz
Copy link
Contributor

nikspz commented Mar 11, 2024

hi @peterwilli , thank you for submitting PR, fyi, it should be aimed to development, I changed it for now https://hummingbot.org/developers/contributions/#checklist

@peterwilli
Copy link
Contributor Author

peterwilli commented Mar 11, 2024

hi @peterwilli , thank you for submitting PR, fyi, it should be aimed to development, I changed it for now https://hummingbot.org/developers/contributions/#checklist

Yeah I saw, sorry I missed that, I will make sure to switch to development next time

This was referenced Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants