如何查询 PowerDown Route

in #cn7 years ago

在之前的文章中:

我提及了一个大家或许不知道的功能PowerDown Route,通过这一功能,你可以把一个账户里的SP提现到另外一个账户,也可以选择提现的时候PowerUp到另外一个账户。

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

steemd.com上只有这个信息:
如果你从未设置过,那么应该是:

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

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 仅为说明问题,非实际账户。

Sort:  

#steemdev is a good tag for posts like these.

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

Ran it through google translator. Interesting - thanks.

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

Great!

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

BITCOIN VOLUME BUY PATTERN

DATEBUY PRICESELL AFTER 48HRPROFIT / ( 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$ 25122338( -$ 174 )$ 529.00
7/27/2017$ 25892705$ 116$ 645
7/31/2017$ 27542720($ -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

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

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

代理是借,可以随时收回

哥 先代理个一个亿 哈哈

已代理,请查收

白借的吧?不用利息?

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

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

Hi @oflyhigh
Thank you for shared.