Example #1
0
    async def asyncSetUp(self) -> None:
        self.account = Account.from_key(self.private_key)
        ethereum_signer = EthereumSignerWeb3(account=self.account)
        self.library = ZkSyncLibrary()

        w3 = Web3(
            HTTPProvider(
                endpoint_uri=
                "https://rinkeby.infura.io/v3/bcf42e619a704151a1b0d95a35cb2e62"
            ))
        provider = ZkSyncProviderV01(provider=HttpJsonRPCTransport(
            network=rinkeby))
        address = await provider.get_contract_address()
        self.zksync = ZkSync(account=self.account,
                             web3=w3,
                             zksync_contract_address=address.main_contract)

        ethereum_provider = EthereumProvider(w3, self.zksync)
        signer = ZkSyncSigner.from_account(self.account, self.library,
                                           rinkeby.chain_id)

        self.wallet = Wallet(ethereum_provider=ethereum_provider,
                             zk_signer=signer,
                             eth_signer=ethereum_signer,
                             provider=provider)
Example #2
0
async def get_wallet():
    # Load crypto library
    library = ZkSyncLibrary()

    # Create Zksync Provider
    zk_provider = ZkSyncProviderV01(provider=HttpJsonRPCTransport(
        network=network.rinkeby))

    # Load contract addresses from server
    contracts = await zk_provider.get_contract_address()

    pprint(contracts)
    contracts.main_contract
    print(contracts.main_contract)

    # Setup web3 account
    account = Account.from_key("")
    pprint(account)
    addr = account.address
    print(addr)

    # Create EthereumSigner
    eth_signer = EthereumSignerWeb3(account=account)

    # Setup web3
    w3 = Web3(HTTPProvider(endpoint_uri=""))

    # Setup zksync contract interactor
    zksync = ZkSync(account=account,
                    web3=w3,
                    zksync_contract_address=contracts.main_contract)

    # Create ethereum provider for interacting with ethereum node
    eth_provider = EthereumProvider(w3, zksync)

    # Initialize zksync signer, all creating options were described earlier
    zk_signer = ZkSyncSigner.from_account(account, library,
                                          network.rinkeby.chain_id)
Example #3
0
 def setUp(self) -> None:
     self.provider = ZkSyncProviderV01(provider=HttpJsonRPCTransport(network=rinkeby))