Ejemplo n.º 1
0
from __future__ import print_function
from __future__ import unicode_literals
import sys
from datetime import datetime, timedelta
import time
import io
import logging

from dpaycli.blockchain import Blockchain
from dpaycli.block import Block
from dpaycli.account import Account
from dpaycli.amount import Amount
from dpaycligraphenebase.account import PasswordKey, PrivateKey, PublicKey
from dpaycli.dpay import DPay
from dpaycli.utils import parse_time, formatTimedelta
from dpaycliapi.exceptions import NumRetriesReached
from dpaycli.nodelist import NodeList
log = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)

if __name__ == "__main__":
    # stm = DPay(node="https://testnet.timcliff.com/")
    # stm = DPay(node="https://testnet.dpaydev.com")
    stm = DPay(node="https://api.dpays.io")
    stm.wallet.unlock(pwd="pwd123")

    account = Account("dpayclibot", dpay_instance=stm)
    print(account.get_voting_power())

    account.transfer("holger80", 0.001, "BBD", "test")
 # rep
 print("dpaycli_acc.rep  {}".format(dpaycli_acc.rep))
 print("dpay_acc.rep {}".format(dpay_acc.rep))
 # balances
 print("dpaycli_acc.balances  {}".format(dpaycli_acc.balances))
 print("dpay_acc.balances {}".format(dpay_acc.balances))
 # get_balances()
 print("dpaycli_acc.get_balances()  {}".format(dpaycli_acc.get_balances()))
 print("dpay_acc.get_balances() {}".format(dpay_acc.get_balances()))
 # reputation()
 print("dpaycli_acc.get_reputation()  {}".format(
     dpaycli_acc.get_reputation()))
 print("dpay_acc.reputation() {}".format(dpay_acc.reputation()))
 # voting_power()
 print("dpaycli_acc.get_voting_power()  {}".format(
     dpaycli_acc.get_voting_power()))
 print("dpay_acc.voting_power() {}".format(dpay_acc.voting_power()))
 # get_followers()
 print("dpaycli_acc.get_followers()  {}".format(
     dpaycli_acc.get_followers()))
 print("dpay_acc.get_followers() {}".format(dpay_acc.get_followers()))
 # get_following()
 print("dpaycli_acc.get_following()  {}".format(
     dpaycli_acc.get_following()))
 print("dpay_acc.get_following() {}".format(dpay_acc.get_following()))
 # has_voted()
 print("dpaycli_acc.has_voted()  {}".format(
     dpaycli_acc.has_voted("@holger80/api-methods-list-for-appbase")))
 print("dpay_acc.has_voted() {}".format(
     dpay_acc.has_voted(
         dpayPost("@holger80/api-methods-list-for-appbase"))))