Esempio n. 1
0
for i in range(2):
    logger.debug('- Public Key {}: {}'.format(i, accounts[i]['publicKey']))
    logger.debug('- Address {}: {}'.format(i, accounts[i]['address']))
'''
Vision Protobuf
'''
from api import api_pb2 as api
from core import Contract_pb2 as contract
from api.api_pb2_grpc import WalletStub
from core import Vision_pb2 as vision
from google.protobuf.any_pb2 import Any
import grpc

# Start Channel and WalletStub
channel = grpc.insecure_channel("vtest.infragrid.v.network:50051")
stub = WalletStub(channel)

logger.debug('''
   Vision Transactions tests
''')

############
# Send VS #
############
logger.debug('\n\nTransfer Contract:')

tx = stub.CreateTransaction2(
    contract.TransferContract(
        owner_address=bytes.fromhex(accounts[1]['addressHex']),
        to_address=bytes.fromhex(accounts[0]['addressHex']),
        amount=1))
for i in range(2):
    logger.debug('- Public Key {}: {}'.format(i, accounts[i]['publicKey']))
    logger.debug('- Address {}: {}'.format(i, accounts[i]['address']))
'''
Tron Protobuf
'''
from api import api_pb2 as api
from core import Contract_pb2 as contract
from api.api_pb2_grpc import WalletStub
from core import Tron_pb2 as tron
from google.protobuf.any_pb2 import Any
import grpc

# Start Channel and WalletStub
channel = grpc.insecure_channel("grpc.trongrid.io:50051")
stub = WalletStub(channel)

logger.debug('''
   Tron SmartContract Custom Messages tests
''')

# check if device have custom contracts enable
result = dongle.exchange(bytearray.fromhex("E0060000FF"))
customAllowed = result[0] & 0x02
if customAllowed == 0:
    print("Custom Contract not allowed, test should fail...")
    sys.exit(0)

####################
# TWM Deposit TRX  #
####################
Esempio n. 3
0
# Get Addresses
logger.debug('-= Vision Ledger =-')
'''
Vision Protobuf
'''
from api import api_pb2 as api
from core import Contract_pb2 as contract
from api.api_pb2_grpc import WalletStub
from core import Vision_pb2 as vision
from google.protobuf.any_pb2 import Any
import grpc

# Start Channel and WalletStub
channel = grpc.insecure_channel("vtest.infragrid.v.network:50051")
stub = WalletStub(channel)

logger.debug('''
   Vision MultiSign tests
''')

tx = stub.CreateTransaction2(
    contract.TransferContract(
        owner_address=bytes.fromhex(
            address_hex("VUEZSdKsoDHQMeZwihtdoBiN46zxhGWYdH")),
        to_address=bytes.fromhex(
            address_hex("VPnYqC2ukKyhEDAjqRRobSVygMAb8nAcXM")),
        amount=100000))
# use permission 2
tx.transaction.raw_data.contract[0].Permission_id = 2