コード例 #1
0
ファイル: autopay.py プロジェクト: naaomimore/arky
def USD2ARK(value):
    return value / getArkPrice("usd")


if len(args) == 1 and os.path.exists(args[0]):
    in_ = open(args[0])
    content = in_.read()
    in_.close()
    conf = json.loads(
        content.decode() if isinstance(content, bytes) else content)
    wlt = wallet.Wallet(conf["forging"]["secret"][0])
elif options.secret:
    wlt = wallet.Wallet(options.secret)
elif options.keyring:
    wlt = wallet.open(options.keyring)
else:
    raise Exception("Can not do something for now !")

print(wlt.address)

logfile = os.path.join(
    HOME, "Payment",
    "%s.pay" % datetime.datetime.now().strftime("%y-%m-%d %Hh%M"))
try:
    os.makedirs(os.path.dirname(logfile))
except:
    pass
log = open(logfile, "w")

wlt.update()
コード例 #2
0
                  "--wallet",
                  dest="wallet",
                  help="wallet file you want to use")
(options, args) = parser.parse_args()

if len(args) == 1 and os.path.exists(args[0]):
    in_ = open(args[0])
    content = in_.read()
    in_.close()
    conf = json.loads(
        content.decode() if isinstance(content, bytes) else content)
    wlt = wallet.Wallet(conf["forging"]["secret"][0])
elif options.secret:
    wlt = wallet.Wallet(options.secret)
elif options.wallet:
    wlt = wallet.open(options.wallet)
else:
    raise Exception("Can not do something for now !")

if wlt.delegate["rate"] > 51:
    raise Exception("%s is not an active delegate right now !" %
                    wlt.delegate["username"])

relays = api.Delegate.getCandidates()[52:]
vote_sum = max(1, sum([float(d.get("vote", 0.)) for d in relays]))
dist = dict([(r["address"], float(r.get("vote", 0.)) / vote_sum)
             for r in relays])
balance = wlt.balance

for address, ratio in dist.items():
    amount = (balance * ratio) - 0.1
コード例 #3
0
from arky import wallet
import socket
wallet.api.use("ark")

w = wallet.open("arky.awt")
w.sendArkMultisign(
    1,
    'AR1LhtKphHSAPdef8vksHWaXYFxLPjDQNU',
    keysgroup=[
        '0326f7374132b18b31b3b9e99769e323ce1a4ac5c26a43111472614bcf6c65a377',
        '03a02b9d5fdd1307c2ee4652ba54d492d1fd11a7d1bb3f3a44c4a05e79f19de933'
    ],
    vendorField="arky multi signature test !",
    ip='109.130.85.151')

import os
wallet.mgmt.join()
os.system("pause")