____  ___    _  _     _   _ _____     _______
 / ___|/ _ \  | || |   | | | |_ _\ \   / / ____|
| |  _| | | | | || |_  | |_| || | \ \ / /|  _|
| |_| | |_| | |__   _| |  _  || |  \ V / | |___
 \____|\___/     |_|   |_| |_|___|  \_/  |_____|

 --- A GOPHER-LIKE INTERFACE FOR HIVE BLOCKCHAIN ---

如何查询 PowerDown Route

BY: @oflyhigh | CREATED: Aug. 8, 2017, 11:40 a.m. | VOTES: 265 | PAYOUT: $230.61 | [ VOTE ]

在之前的文章中:
* 你或许不知道的STEEMIT(STEEM)一些隐藏功能

我提及了一个大家或许不知道的功能PowerDown Route,通过这一功能,你可以把一个账户里的SP提现到另外一个账户,也可以选择提现的时候PowerUp到另外一个账户。
[IMAGE: https://steemitimages.com/DQmRRHJbz1yoett4WsQDkzKfST6Ex3PCj4bxw9N3PGfnRSk/image.png]

当时为了理解这个事,特意拿个测试账户测试了一下,设置测试号A的PowerDown Route为B, 然后我今天突然想看一下我设置的B是哪个账户,结果尴尬了,在steemd.com 找不到。

steemd.com上只有这个信息: [IMAGE: https://steemitimages.com/DQmcGdYMdMaqBvv8YJUonp9Qfsyp4gYeAscJMN9K2MzHKUf/image.png]
如果你从未设置过,那么应该是: [IMAGE: https://steemitimages.com/DQmeJTSrXg6hCkFiymSXomEz8qsvQ58foVXPtcQZCRoBKK4/image.png]

好吧,我知道我设置过,但是我设置哪里去了呢?

API get_withdraw_routes

研究半天发现有一个API
vector< withdraw_route > get_withdraw_routes( string account, withdraw_route_type type = outgoing )const;

相关结构体和类型定义:

struct withdraw_route
{
   string               from_account;
   string               to_account;
   uint16_t             percent;
   bool                 auto_vest;
};

enum withdraw_route_type
{
   incoming,
   outgoing,
   all
};

curl 测试

有了上述API定义,我们就可以使用curl进行调用了

查询account_a的PowerDown Routes

curl --data '{"jsonrpc": "2.0", "method": "get_withdraw_routes", "params": ["account_a", 1], "id": 1}' https://steemd.steemit.com

得出如下结果:
{"id":1,"result":[{"from_account":"account_a","to_account":"account_b","percent":10000,"auto_vest":false}]}

查询将account_a设置为PowerDown Route的账户列表

curl --data '{"jsonrpc": "2.0", "method": "get_withdraw_routes", "params": ["account_a", 0], "id": 1}' https://steemd.steemit.com

查询结果为空:
{"id":1,"result":[]}

steem python 库

直接使用API可以查询账户的PowerDown Route(Incoming, outgoing)
当然也可以自行对API就行封装

庆幸的是, steem python 库已经帮我们做好了封装

get_withdraw_routes

    def get_withdraw_routes(self, account: str, withdraw_route_type: str):
        """ get_withdraw_routes """
        return self.exec('get_withdraw_routes', account, withdraw_route_type, api='database_api')

简单的测试代码

from steem import Steem
from pprint import pprint
steem = Steem()
routes = steem.get_withdraw_routes('account_a', 'all')
pprint(routes)

结果

[{'auto_vest': False,
  'from_account': 'account_a',
  'percent': 10000,
  'to_account': 'account_b'}]

设置& 取消PowerDown Route

设置

可以使用steem python 库提供的API设置PowerDown Route
set_withdraw_vesting_route
详情见代码内注释即可
可以设置N个Routes,并对其分配不同比例,总量不超过100%

取消

如果想取消对account_a设置的PowerDown Route
只需将account_a的PowerDown Route 设置为account_b,并将percent设置为0 即可

说明: 文中 account_a, account_b 仅为说明问题,非实际账户。

TAGS: [ #cn ] [ #cn-programming ] [ #route ] [ #api ] [ #steem ]

Replies

@novale | Aug. 8, 2017, 11:42 a.m. | Votes: 0 | [ VOTE ]

Very interesting post friend, thank you

@na722 | Aug. 8, 2017, 11:42 a.m. | Votes: 0 | [ VOTE ]

I like this post, very nice and good post. @naz722

@fem-of-war | Aug. 8, 2017, 11:43 a.m. | Votes: 1 | [ VOTE ]

Lol wish i could read this post.... i likes the pics though lol3)

@jubi | Aug. 8, 2017, 11:44 a.m. | Votes: 0 | [ VOTE ]

可以把sp转移到另外一个id 感觉好像代理 嘿嘿

@oflyhigh | Aug. 8, 2017, 11:49 a.m. | Votes: 1 | [ VOTE ]

和代理有所区别
这个是真转移

代理是借,可以随时收回

@jubi | Aug. 8, 2017, 11:55 a.m. | Votes: 0 | [ VOTE ]

哥 先代理个一个亿 哈哈

@oflyhigh | Aug. 8, 2017, 12:13 p.m. | Votes: 1 | [ VOTE ]

已代理,请查收

@justyy | Aug. 8, 2017, 5:15 p.m. | Votes: 0 | [ VOTE ]

白借的吧?不用利息?

@guyverckw | Aug. 8, 2017, 8:04 p.m. | Votes: 0 | [ VOTE ]

可以多代理一個億到我這裏嗎? :p

@katythompson | Aug. 8, 2017, 11:57 a.m. | Votes: 2 | [ VOTE ]

Ran it through google translator. Interesting - thanks.

@rea | Aug. 8, 2017, 12:35 p.m. | Votes: 0 | [ VOTE ]

还真不知道可以power up 到其他帐号呢,不过我对编程这东西完全是一窍不通啊,唉!

@justyy | Aug. 8, 2017, 5:16 p.m. | Votes: 0 | [ VOTE ]

我懂一些编程 但是对于O哥发的,我每次都是一窍不通啊,唉! 我学得一定是假程序。

@oflyhigh | Aug. 9, 2017, 3:22 a.m. | Votes: 0 | [ VOTE ]

会发帖就好啦:)
你的帖子一个字: 值

@alfa2141 | Aug. 8, 2017, 12:46 p.m. | Votes: 1 | [ VOTE ]

BITCOIN VOLUME BUY PATTERN
DATE|BUY PRICE|SELL AFTER 48HR|PROFIT / ( LOSS)|Cumulative P/L
-|-|-|-|-
5/27/2017|$ 2040|$ 2268|$ 228|$ 228
6/02/2017|$ 2428|$ 2560|$ 132|$ 360
6/08/2017|$ 2781|$ 2877|$ 96|$ 456
6/15/2017|$ 2320|$ 2564|$ 244|$ 700
6/22/2017|$ 2668|$ 2714|$ 46|$ 746
7/01/2017|$ 2503|$ 2485|( -$ 18 )|$ 728
7/07/2017|$ 2582|$ 2557|( -$ 25 )|$ 703
7/10/2017|$ 2512|2338|( -$ 174 )|$ 529.00
7/27/2017|$ 2589|2705|$ 116|$ 645
7/31/2017|$ 2754|2720|($ -34 )|$ 611
8/04/2017|$ 2848|$ 3186|$ 338|$ 949

🐒 Now for a completely different Sell pattern it works like this I have circled two volume highs and the btc price also made intermediate highs then as well .Now I'm thinking that if Bitcoin runs up again in price in new highs I should be watching the volume on this chart and if the volume makes a high above the last high of400,398 I will be selling some of my Bitcoin

@rogerblu | Aug. 8, 2017, 12:57 p.m. | Votes: 0 | [ VOTE ]

Great post

@aydotnov16 | Aug. 8, 2017, 1:08 p.m. | Votes: 0 | [ VOTE ]

Even though it took me some time to interpret it, but i found it interesting

@chainarong | Aug. 8, 2017, 1:09 p.m. | Votes: 0 | [ VOTE ]

Hi @oflyhigh
Thank you for shared.

@mukhtar.juned | Aug. 8, 2017, 1:31 p.m. | Votes: 0 | [ VOTE ]

I like your posts even though I do not fully understand but thank goodness because I can still use translate application to be able to read your writing. I have a suggestion so that your writing can be in two languages ​​that is your own country language and english because your writing is already worldwide, sorry this is just a suggestion from a reader like me.

Best regards from me
@mukhtar.juned
steamians from Aceh Indonesia

indonesia

ksi

@rindi118 | Aug. 8, 2017, 1:50 p.m. | Votes: 0 | [ VOTE ]

nice post, thanks for sharing.

@cryptousage | Aug. 8, 2017, 2:11 p.m. | Votes: 0 | [ VOTE ]

Thanks to google. I think I got the idea. Thank you.

@applesspatrick | Aug. 8, 2017, 2:48 p.m. | Votes: 0 | [ VOTE ]

总结的很不错 :)
upvoted, followed
如果有时间的话帮我点个赞呗👍👍
Please get your time and like my page
Thanks
https://steemit.com/cn/@applesspatrick/a-short-visit-to-bushan-south-korea

@faheemahmad | Aug. 8, 2017, 3:33 p.m. | Votes: 0 | [ VOTE ]

你好
你的这篇文章是非常好的/我不懂你的语言,但是使用更改的软件和m阅读你的文章
关于编程的很好的信息
m也是在软件工程师学习的程序员
因为我的回报非常低,这里需要你帮助Steemit Up投票
我希望你了解我的语言和感受
如果你不介意请来我的博客@faheemahmad&@ chillimilli786
都是我的帐号
如果你不介意,请加入https://steemit.chat/home
并搜索我chillimilli786

Thanks For Supporting me

@kenchung | Aug. 8, 2017, 5:41 p.m. | Votes: 1 | [ VOTE ]

長知識了,真的不知道有power down route 這個東西呢~

@shasol | Aug. 8, 2017, 6:24 p.m. | Votes: 0 | [ VOTE ]

Cant Understand chinise but looks intresting .
Upvoted

@misrori | Aug. 8, 2017, 7:04 p.m. | Votes: 1 | [ VOTE ]

Great!

@simonsayz | Aug. 9, 2017, 3:17 a.m. | Votes: 0 | [ VOTE ]

Very interesting thanks.

Check out my latest post please.
https://steemit.com/travel/@simonsayz/travel-to-xiamen-with-me-holiday-photo-journal-ed-3

@magicmonk | Aug. 9, 2017, 1:14 p.m. | Votes: 0 | [ VOTE ]

好有趣。看來真得學Python. 我惡補一陣後再來請教。

@arcange | Aug. 9, 2017, 2:34 p.m. | Votes: 0 | [ VOTE ]

Congratulations @oflyhigh!
Your post was mentioned in the hit parade in the following category:

  • Pending payout - Ranked 7 with $ 248,06
@transisto | Aug. 9, 2017, 5:44 p.m. | Votes: 4 | [ VOTE ]

steemdev is a good tag for posts like these.

@oflyhigh | Aug. 10, 2017, 12:49 a.m. | Votes: 0 | [ VOTE ]

Thank you,I will use this tag in the next steem development related posts.

[ BACK TO TRENDING ] [ BACK TO MENU ]
CMD>