Exemplo n.º 1
0
    def _set_get_recent_blockhash_resp(
        channel: grpc_testing.Channel, ) -> tx_pb_v4.GetRecentBlockhashRequest:
        md, request, rpc = channel.take_unary_unary(
            tx_pb_v4.DESCRIPTOR.services_by_name['Transaction'].
            methods_by_name['GetRecentBlockhash'])
        rpc.terminate(_recent_blockhash_resp, (), grpc.StatusCode.OK, '')

        TestInternalClientV4._assert_metadata(md)
        return request
Exemplo n.º 2
0
 def _set_submit_transaction_response(
     channel: grpc_testing.Channel, resp: tx_pb.SubmitTransactionResponse,
     status: grpc.StatusCode = grpc.StatusCode.OK
 ) -> tx_pb.SubmitTransactionRequest:
     _, request, rpc = channel.take_unary_unary(
         tx_pb.DESCRIPTOR.services_by_name['Transaction'].methods_by_name['SubmitTransaction']
     )
     rpc.terminate(resp, (), status, '')
     return request
Exemplo n.º 3
0
 def _set_get_account_info_response(
     channel: grpc_testing.Channel, resp: account_pb.GetAccountInfoResponse,
     status: grpc.StatusCode = grpc.StatusCode.OK
 ) -> account_pb.GetAccountInfoRequest:
     _, request, rpc = channel.take_unary_unary(
         account_pb.DESCRIPTOR.services_by_name['Account'].methods_by_name['GetAccountInfo']
     )
     rpc.terminate(resp, (), status, '')
     return request
Exemplo n.º 4
0
    def _set_get_min_balance_response(
        channel: grpc_testing.Channel,
    ) -> tx_pb_v4.GetMinimumBalanceForRentExemptionRequest:
        md, request, rpc = channel.take_unary_unary(
            tx_pb_v4.DESCRIPTOR.services_by_name['Transaction'].
            methods_by_name['GetMinimumBalanceForRentExemption'])
        rpc.terminate(_min_balance_resp, (), grpc.StatusCode.OK, '')

        TestInternalClientV4._assert_metadata(md)
        return request
Exemplo n.º 5
0
    def _set_request_airdrop_resp(
        channel: grpc_testing.Channel,
        resp: airdrop_pb_v4.RequestAirdropResponse,
        status: grpc.StatusCode = grpc.StatusCode.OK,
    ) -> airdrop_pb_v4.RequestAirdropRequest:
        md, request, rpc = channel.take_unary_unary(
            airdrop_pb_v4.DESCRIPTOR.services_by_name['Airdrop'].
            methods_by_name['RequestAirdrop'])
        rpc.terminate(resp, (), status, '')

        TestInternalClientV4._assert_metadata(md)
        return request
Exemplo n.º 6
0
    def _set_submit_transaction_resp(
        channel: grpc_testing.Channel,
        resp: tx_pb_v4.SubmitTransactionResponse,
        status: grpc.StatusCode = grpc.StatusCode.OK,
    ) -> tx_pb_v4.GetTransactionRequest:
        md, request, rpc = channel.take_unary_unary(
            tx_pb_v4.DESCRIPTOR.services_by_name['Transaction'].
            methods_by_name['SubmitTransaction'])
        rpc.terminate(resp, (), status, '')

        TestInternalClientV4._assert_metadata(md)
        return request
Exemplo n.º 7
0
    def _set_get_account_info_resp(
        channel: grpc_testing.Channel,
        resp: account_pb_v4.GetAccountInfoResponse,
        status: grpc.StatusCode = grpc.StatusCode.OK,
    ) -> account_pb_v4.GetAccountInfoRequest:
        md, request, rpc = channel.take_unary_unary(
            account_pb_v4.DESCRIPTOR.services_by_name['Account'].
            methods_by_name['GetAccountInfo'])
        rpc.terminate(resp, (), status, '')

        TestInternalClientV4._assert_metadata(md)
        return request