コード例 #1
0
ファイル: test_testnet.py プロジェクト: dpays/dpaygo
 def test_allow(self):
     bts = self.bts
     self.assertIn(bts.prefix, "STX")
     acc = Account("dpaygo", dpay_instance=bts)
     self.assertIn(acc.dpay.prefix, "STX")
     tx = acc.allow(
         "STX55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n",
         account="dpaygo",
         weight=1,
         threshold=1,
         permission="active",
     )
     self.assertEqual((tx["operations"][0][0]), "account_update")
     op = tx["operations"][0][1]
     self.assertIn("active", op)
     self.assertIn(
         ["STX55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n", '1'],
         op["active"]["key_auths"])
     self.assertEqual(op["active"]["weight_threshold"], 1)
コード例 #2
0
ファイル: op_on_testnet.py プロジェクト: dpays/dpaygo
    posting_pubkey = posting_key.get_public_key()
    memo_pubkey = memo_key.get_public_key()
    active_privkey = active_key.get_private_key()
    posting_privkey = posting_key.get_private_key()
    owner_privkey = owner_key.get_private_key()
    memo_privkey = memo_key.get_private_key()
    if useWallet:
        stm.wallet.addPrivateKey(owner_privkey)
        stm.wallet.addPrivateKey(active_privkey)
        stm.wallet.addPrivateKey(memo_privkey)
        stm.wallet.addPrivateKey(posting_privkey)
    else:
        stm = DPay(node=nodelist.get_nodes(normal=False, appbase=False, testnet=True),
                    wif={'active': str(active_privkey),
                         'posting': str(posting_privkey),
                         'memo': str(memo_privkey)})
    account = Account(username, dpay_instance=stm)
    account.disallow("dpaygo1", permission='posting')
    account.allow('dpaygo1', weight=1, permission='posting', account=None)
    if useWallet:
        stm.wallet.getAccountFromPrivateKey(str(active_privkey))

    # stm.create_account("dpaygo1", creator=account, password=password1)

    account1 = Account("dpaygo1", dpay_instance=stm)
    b = Blockchain(dpay_instance=stm)
    blocknum = b.get_current_block().identifier

    account.transfer("dpaygo1", 1, "BBD", "test")
    b1 = Block(blocknum, dpay_instance=stm)