Python Hot Signing Link Generation Tool for HiveEngine transfers

in HiveDevs3 years ago (edited)

    Generating hot signing links using python had been a roadblock for our bot development.

After a bit of trial by error, found the issue and the solution.

     Long story short, it was a encoding issue corrected by enclosing the required_auths and required_posting_auths arrays in doublequotes as follows:

...
        "required_auths": "[\"anthonyadavisii\"]",
        "required_posting_auths": "[]",
...

     The latter didn't matter so much as it was an empy array but the former had double quotes which were being encoded as single quotations(%27) as a result. This led to an "Invalid cast from string_type to Array" error when attempting the link.

Anyways, glad this was figured out so we can move forward with the next phases of development.

image.png

Repository:

https://github.com/anthonyadavisii/get_hive_engine_hc_hot_link

get_hive_engine_hc_hot_link

Python utility generates Hive Connect hot signing links for perform Hive-Engine token transactions

Prerequisites:

Installation:

pip install hivesigner
  • Usage:

Import script as module.

import get_hive_engine_hc_hot_link

#Example usage
get_hive_engine_hc_hot_link.get_he_hc_hot_link('anthonyadavisii','HDR','1','test post id')

Should output as follows:

'https://hivesigner.com/sign/custom_json?authority=active&required_auths=%5B%22anthonyadavisii%22%5D&required_posting_auths=%5B%5D&id=ssc-mainnet-hive&json=%7B%22contractName%22%3A%22tokens%22%2C%22contractAction%22%3A%22transfer%22%2C%22contractPayload%22%3A%7B%22symbol%22%3A%22HDR%22%2C%22to%22%3A%22hive-dr%22%2C%22quantity%22%3A%221%22%2C%22memo%22%3A%22test+post+id%22%7D%7D'

Test Results

image.png
https://hiveblocks.com/tx/602b425598f18fb2ca2d6d0b1da274dd64f1fb9f

image.png

I plan on refining this so it may be run as a script in addition to interactively. Feel free to fork and suit to your purpose. I will be using it as part of the abuse reporting functionality for Hive Downvote Rewards project (@hive-dr) formerly @steemflagrewards.

Thank you for your time and supporting this work


Additional Links:

HiveEngine

https://hive-engine.com/

(Below included in Github repo for onboarding potential)
Are you interested in the HIVE social media blockchain? Get started with my links below:

Ecency Referral Link

https://ecency.com/?referral=anthonyadavisii

HiveOnboard

https://hiveonboard.com?ref=anthonyadavisii

Sort:  

Your post has been voted as a part of Encouragement program. Keep up the good work!
Dear reader, follow and support this author, Install Android: https://android.ecency.com, iOS: https://ios.ecency.com mobile app or desktop app for Windows, Mac, Linux: https://desktop.ecency.com
Learn more: https://ecency.com
Join our discord: https://discord.me/ecency