Exemplo n.º 1
0
def _prepare_sender(args: Any) -> Account:
    if args.pem:
        sender = Account(pem_file=args.pem, pem_index=args.pem_index)
    elif args.keyfile and args.passfile:
        sender = Account(key_file=args.keyfile, pass_file=args.passfile)
    else:
        raise errors.NoWalletProvided()

    sender.nonce = args.nonce
    if args.recall_nonce:
        sender.sync_nonce(ElrondProxy(args.proxy))

    return sender
Exemplo n.º 2
0
def compute_dns_address_for_shard_id(shard_id) -> Address:
    deployer_pubkey_prefix = InitialDNSAddress[:len(InitialDNSAddress) -
                                               ShardIdentiferLen]

    deployer_pubkey = deployer_pubkey_prefix + bytes([0, shard_id])
    deployer = Account(address=Address(deployer_pubkey))
    deployer.nonce = 0
    # Workaround: currently, in erdpy, in order to compute the address of a contract, one has to create an instance of the class "SmartContract".
    # This might change in the future.
    contract = SmartContract()
    contract.owner = deployer
    contract.compute_address()
    return contract.address