def test_trx_unfreeze_balance_bw(self, app): tx = app.packContract( tron.Transaction.Contract.UnfreezeBalanceContract, contract.UnfreezeBalanceContract( owner_address=bytes.fromhex(app.getAccount(0)['addressHex']), resource=contract.BANDWIDTH, ) ) data, status = app.sign(app.getAccount(0)['path'], tx) validSignature, txID = validateSignature.validate(tx,data[0:65],app.getAccount(0)['publicKey'][2:]) assert(validSignature == True)
def test_vs_unfreeze_balance_delegate_entropy(self, app): tx = app.packContract( vision.Transaction.Contract.UnfreezeBalanceContract, contract.UnfreezeBalanceContract( owner_address=bytes.fromhex(app.getAccount(0)['addressHex']), resource=contract.ENTROPY, receiver_address=bytes.fromhex(app.getAccount(1)['addressHex']), ) ) data, status = app.sign(app.getAccount(0)['path'], tx) validSignature, txID = validateSignature.validate(tx,data[0:65],app.getAccount(0)['publicKey'][2:]) assert(validSignature == True)
logger.debug('- txID: {}'.format(txID)) logger.debug('- Signature: {}'.format(binascii.hexlify(result[0:65]))) if (validSignature): logger.debug('- Valid: {}'.format(validSignature)) else: logger.error('- Valid: {}'.format(validSignature)) sys.exit(0) ###################### # Unfreeze Balance BW# ###################### logger.debug('\n\nUnfreeze Contract photon:') tx = vision.Transaction() newContract = contract.UnfreezeBalanceContract(owner_address=bytes.fromhex( accounts[1]['addressHex']), resource=contract.PHOTON) c = tx.raw_data.contract.add() c.type = vision.Transaction.Contract.UnfreezeBalanceContract param = Any() param.Pack(newContract) c.parameter.CopyFrom(param) raw_tx, result = ledgerSign(accounts[1]['path'], tx) validSignature, txID = validateSignature.validate(raw_tx, result[0:65], accounts[1]['publicKey'][2:]) logger.debug('- RAW: {}'.format(raw_tx)) logger.debug('- txID: {}'.format(txID)) logger.debug('- Signature: {}'.format(binascii.hexlify(result[0:65]))) if (validSignature): logger.debug('- Valid: {}'.format(validSignature))
logger.debug('- Signature: {}'.format(binascii.hexlify(result[0:65]))) if (validSignature): logger.debug('- Valid: {}'.format(validSignature)) else: logger.error('- Valid: {}'.format(validSignature)) sys.exit(0) ###################### # Unfreeze Balance BW# ###################### logger.debug('\n\nUnfreeze Contract bandwidth:') tx = tron.Transaction() newContract = contract.UnfreezeBalanceContract( owner_address=bytes.fromhex(accounts[1]['addressHex']), resource=contract.BANDWIDTH ) c = tx.raw_data.contract.add() c.type = tron.Transaction.Contract.UnfreezeBalanceContract param = Any() param.Pack(newContract) c.parameter.CopyFrom(param) raw_tx, result = ledgerSign(accounts[1]['path'],tx) validSignature, txID = validateSignature.validate(raw_tx,result[0:65],accounts[1]['publicKey'][2:]) logger.debug('- RAW: {}'.format(raw_tx)) logger.debug('- txID: {}'.format(txID)) logger.debug('- Signature: {}'.format(binascii.hexlify(result[0:65]))) if (validSignature): logger.debug('- Valid: {}'.format(validSignature)) else: