SteemAX 1.5 ~ Send All, Accept All and Cancel All Auto Exchange Invitations by learnelectronics

View this thread on steempeak.com
· @learnelectronics ·
$20.52
SteemAX 1.5 ~ Send All, Accept All and Cancel All Auto Exchange Invitations
#### Repository
https://github.com/artolabs/steemax

<center>
![steemax_1.5_update.png](https://cdn.steemitimages.com/DQmRpit8PCEvUnhfF8pZvQbKrynpwWuJL5X8Rf1owgKRNeg/steemax_1.5_update.png)
</center>

##### [SteemAX](https://steemax.trade) helps minnow content-creators 
and whale curators by automating an exchange of upvotes between their quality blog posts, allowing both 1 to 1 as well as disproportional exchanges that grant bigger curations, better support than a bid bot, and the long-term support they both deserve.

# Batch Processing

Although a user must still complete a Captcha in order to create each new invite, they can now accept, send and cancel all their exchanges with one button. This greatly aides the user in speeding up the process, but still ensures that spammers are deterred. 

Batch processing uses Steem Connect in the same manner as for sending, accepting or canceling a single invite, and simply modifies the memo field to include a delineated list of all the commands to be processed. The user simply clicks the Send All, Accept All or Cancel All button, and when they are redirected to Steem Connect they can see the total SBD needed to be sent in order to process all the transactions ($0.001 per transaction).

SteemAX never takes a fee and the amount sent is used to forward messages to the other party via the memo field in an SBD send. This is a much more polite way to send an invitation than posting a comment.

<center>
![sendall.png](https://cdn.steemitimages.com/DQmct4YgMtnV3kfGu2k5iMr7ec7xPWQQJ9S3VV71VATVUSH/sendall.png)
</center>

#### To accomplish this:

Batch processing of actions can be done manually or on the website. Separate actions can be bundled into a batch by simply connecting them together with an underscore ( _ ). 

```
95668782990251425900461858022559:start_36294926653274271029985954993428:start_89481516139033791344673789303206:start
``` 

The `parse_memo` function now parses the memo by splitting it on the underscore delineator, then splitting again on the semicolon delineator, into a list of dictionaries, each dictionary stores the `memoid`, action to be commenced, along with the ratio, percentage and duration if it is a barter.  

```

    def parse_memo(self, memo=None):
        """ Parses the memo message in a transaction
        for the appropriate action.
        """
        memodict = {}
        memos = []
        self.memolist = []
        if re.search(r'_', memo): 
            try:
                memos = memo.split("_")
            # A broad exception is used because any exception
            # should return false.
            except:
                self.msg.error_message("Unable to parse memo. Error code 1.")
                return False
        else:
            memos.append(memo)
        for i in range(0, len(memos)):
            if i == len(memos):
                break
            try:
                memo_parts = memos[i].split(":")
            # A broad exception is used because any exception
            # should return false.
            except:
                self.msg.error_message("Unable to parse memo. Error code 2.")
                return False
            # Everything from the outside world is 
            # filtered for security and added to a dictionary
            memodict['memoid'] = sec.filter_token(memo_parts[0])
            if len(memo_parts) == 2:
                memodict['action'] = sec.filter_account(memo_parts[1])
            elif len(memo_parts) == 5:
                memodict['action'] = sec.filter_account(memo_parts[1])
                memodict['percentage'] = sec.filter_number(memo_parts[2])
                memodict['ratio'] = sec.filter_number(memo_parts[3], 1000)
                memodict['duration'] = sec.filter_number(memo_parts[4], 365)
            else:
                self.msg.error_message("Unable to parse memo. Error code 3.")
                return False
            # The dictionary is added to a list
            self.memolist.append(memodict.copy())
        return True

```

After the memo has been parsed, transactions are sent to receiving parties based on the content of the list of dictionaries.

```
elif self.memolist[i]['action'] == "start":
            self.react.start(acct1,
                             acct2,
                             self.memofrom,
                             rstatus,
                             self.memolist[i]['memoid'])
        elif self.memolist[i]['action'] == "cancel":
            self.react.cancel(self.memofrom, self.memolist[i]['memoid'], rstatus, acct2)
        elif self.memolist[i]['action'] == "accept":
            self.react.accept(acct1, acct2, self.memofrom, rstatus, self.memolist[i]['memoid'])
        elif self.memolist[i]['action'] == "barter":
            self.react.barter(acct1, acct2, self.memolist[i]['memoid'], self.memofrom, rstatus,
                              self.memolist[i]['percentage'], self.memolist[i]['ratio'], self.memolist[i]['duration'])
```

On the website javascript code was created to concatenate the command strings into one memo, and to calculate the cost of sending each each action to each receiving party. Along with this is code that determines if the buttons should be seen: no need to display a send-all button if there's nothing to send! 


```
function sendAll(command) {
    regex = new RegExp('[^A-Za-z0-9\\:\\.]', 'g');
    var ids;
    if (command === "accept") {
        ids = document.getElementById("allacceptids").value.split(",");
    }
    else if (command === "start") {
        ids = document.getElementById("allsendids").value.split(",");
    }
    else if (command === "cancel") {
        ids = document.getElementById("allcancelids").value.split(",");
    } 
    var memoid = document.getElementById("memoid"+ids[0]).value.replace(regex, '');
    memo = memoid+":"+command;
    for(i=1;i<ids.length;i++) {
        memoid = document.getElementById("memoid"+ids[i]).value.replace(regex, '');
        memo += "_"+memoid+":"+command;
    }
    sendamount = ids.length / 1000;
    var url = "https://steemconnect.com/sign/transfer?from="+myaccountname+"&to=steem-ax&amount="+sendamount+"%20SBD&memo="+memo+"&redirect_uri=https://steemax.info/@"+myaccountname;
    window.location = (url);
}
function showAllButtons() {
    var acceptids = document.getElementById("allacceptids").value.split(",");
    var sendids = document.getElementById("allsendids").value.split(",");
    var cancelids = document.getElementById("allcancelids").value.split(",");
    if (sendids.length > 1) {
        document.getElementById("sendall-button").style.display = 'block';
    }
    if (acceptids.length > 1) {
        document.getElementById("acceptall-button").style.display = 'block';
    }
    if (cancelids.length > 1) {
        document.getElementById("cancelall-button").style.display = 'block';
    }
}
```
<br>
#### [Commit #5dd6723](https://github.com/ArtoLabs/SteemAX/commit/5dd6723df8afe43b7316804fc3431043cd96dd45)

#### Technology Stack

SteemAX is written to use Python 3.5 and MySQL. The web interface for https://steemax.trade and https://steemax.info has been written in HTML, CSS and Javascript.

#### Roadmap

In the future more contributors will be brought into the fold
via Task Requests to help improve the functionality of the site and most especially the look and feel. After all, projects always benefit from the synergistic action of teamwork.

#### Contact

Please contact Mike (Mike-A) on Discord
https://discord.gg/97GKVFC


#### GitHub Account
https://github.com/artolabs
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 4 others
properties (23)
post_id67,158,803
authorlearnelectronics
permlinksteemax-1-5-send-all-accept-all-and-cancel-all-auto-exchange-invitations
categoryutopian-io
json_metadata{"format":"markdown","app":"steemit\/0.1","image":["https:\/\/cdn.steemitimages.com\/DQmRpit8PCEvUnhfF8pZvQbKrynpwWuJL5X8Rf1owgKRNeg\/steemax_1.5_update.png"],"tags":["utopian-io","development","steemax","steemit","python"],"links":["https:\/\/github.com\/artolabs\/steemax","https:\/\/steemax.trade","https:\/\/github.com\/ArtoLabs\/SteemAX\/commit\/5dd6723df8afe43b7316804fc3431043cd96dd45","https:\/\/steemax.info","https:\/\/discord.gg\/97GKVFC","https:\/\/github.com\/artolabs"]}
created2018-12-08 15:42:09
last_update2018-12-08 15:42:09
depth0
children5
net_rshares33,767,402,284,339
last_payout2018-12-15 15:42:09
cashout_time1969-12-31 23:59:59
total_payout_value15.661 SBD
curator_payout_value4.861 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length7,547
author_reputation15,488,166,189,124
root_title"SteemAX 1.5 ~ Send All, Accept All and Cancel All Auto Exchange Invitations"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (68)
@artturtle ·
message
### Thank you learnelectronics! You've just received an upvote of 80% by @ArtTurtle!

<a href="https://steemit.com/art/@artopium/artturtle-will-upvote-each-and-every-one-of-your-art-music-posts">
<img src="https://steemitimages.com/0x0/https://cdn.steemitimages.com/DQmT74pZRACxgYK9JcfU3u22qLuJmUgSQsbwoPksykT8YGA/artturtlead.png"></a>

### [Learn how I will upvote each and every one of *your* art and music posts](https://steemit.com/art/@artopium/artturtle-will-upvote-each-and-every-one-of-your-art-music-posts)
Please come visit me as I've updated my daily report with more information about my upvote value and how to get the best upvote from me.
properties (22)
post_id67,159,397
authorartturtle
permlinkre-steemax-1-5-send-all-accept-all-and-cancel-all-auto-exchange-invitations-20181208t160025
categoryutopian-io
json_metadata{}
created2018-12-08 16:00:24
last_update2018-12-08 16:00:24
depth1
children0
net_rshares0
last_payout2018-12-15 16:00:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length653
author_reputation18,812,410,398,491
root_title"SteemAX 1.5 ~ Send All, Accept All and Cancel All Auto Exchange Invitations"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@justyy ·
$9.97
Thank you for your contribution. It is nice to see continuous development on the project. You said version is 1.5 but in your source code, you change it to 1.4.2 - which seems a bit odd to me.  It is also worth separating your changes in a few commits and create a PR and merge which will keep your master branch history a bit clean.

Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/3/2-3-2-2-2-2-2-).

---- 
Need help? Write a ticket on https://support.utopian.io/. 
Chat with us on [Discord](https://discord.gg/uTyJkNm). 
[[utopian-moderator]](https://join.utopian.io/)
πŸ‘  , , , , , , , , , , , , , , , , , , , ,
properties (23)
post_id67,166,299
authorjustyy
permlinkre-learnelectronics-steemax-1-5-send-all-accept-all-and-cancel-all-auto-exchange-invitations-20181208t194508924z
categoryutopian-io
json_metadata{"app":"steemit\/0.1","tags":["utopian-io"],"links":["https:\/\/join.utopian.io\/guidelines","https:\/\/review.utopian.io\/result\/3\/2-3-2-2-2-2-2-","https:\/\/support.utopian.io\/","https:\/\/discord.gg\/uTyJkNm","https:\/\/join.utopian.io\/"]}
created2018-12-08 19:45:12
last_update2018-12-08 19:45:12
depth1
children2
net_rshares16,311,390,259,362
last_payout2018-12-15 19:45:12
cashout_time1969-12-31 23:59:59
total_payout_value7.531 SBD
curator_payout_value2.441 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length831
author_reputation2,057,469,156,047,835
root_title"SteemAX 1.5 ~ Send All, Accept All and Cancel All Auto Exchange Invitations"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (21)
@learnelectronics · (edited)
Yeah, I just forgot to update the version number on github, which has been done now. As for the commit: I did half the work for half the reward. I think it's fair. If either the price of Steem increases or Utopian modifies its upvote strategy to accommodate the price of steem then they might see a match between the actual output of quality and that which seems expected.
properties (22)
post_id67,233,475
authorlearnelectronics
permlinkre-justyy-re-learnelectronics-steemax-1-5-send-all-accept-all-and-cancel-all-auto-exchange-invitations-20181210t113000185z
categoryutopian-io
json_metadata{"app":"steemit\/0.1","tags":["utopian-io"]}
created2018-12-10 11:30:00
last_update2018-12-10 11:30:51
depth2
children0
net_rshares0
last_payout2018-12-17 11:30:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length372
author_reputation15,488,166,189,124
root_title"SteemAX 1.5 ~ Send All, Accept All and Cancel All Auto Exchange Invitations"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@utopian-io ·
Thank you for your review, @justyy! Keep up the good work!
properties (22)
post_id67,271,677
authorutopian-io
permlinkre-re-learnelectronics-steemax-1-5-send-all-accept-all-and-cancel-all-auto-exchange-invitations-20181208t194508924z-20181211t074511z
categoryutopian-io
json_metadata{"app":"beem\/0.20.9"}
created2018-12-11 07:45:12
last_update2018-12-11 07:45:12
depth2
children0
net_rshares0
last_payout2018-12-18 07:45:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length58
author_reputation152,913,012,544,965
root_title"SteemAX 1.5 ~ Send All, Accept All and Cancel All Auto Exchange Invitations"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@utopian-io ·
Hey, @learnelectronics!

**Thanks for contributing on Utopian**.
We’re already looking forward to your next contribution!

**Get higher incentives and support Utopian.io!**
 Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via [SteemPlus](https://chrome.google.com/webstore/detail/steemplus/mjbkjgcplmaneajhcbegoffkedeankaj?hl=en) or [Steeditor](https://steeditor.app)).

**Want to chat? Join us on Discord https://discord.gg/h52nFrV.**

<a href='https://steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
properties (22)
post_id67,190,765
authorutopian-io
permlinkre-steemax-1-5-send-all-accept-all-and-cancel-all-auto-exchange-invitations-20181209t120435z
categoryutopian-io
json_metadata{"app":"beem\/0.20.9"}
created2018-12-09 12:04:36
last_update2018-12-09 12:04:36
depth1
children0
net_rshares0
last_payout2018-12-16 12:04:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length598
author_reputation152,913,012,544,965
root_title"SteemAX 1.5 ~ Send All, Accept All and Cancel All Auto Exchange Invitations"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000