Exemple #1
0
    def __init__(self, org_id, service_id, service_metadata, group,
                 service_stub, payment_strategy, options, mpe_contract,
                 account, sdk_web3):
        self.org_id = org_id
        self.service_id = service_id
        self.options = options
        self.group = group
        self.service_metadata = service_metadata

        self.payment_strategy = payment_strategy
        self.expiry_threshold = self.group["payment"][
            "payment_expiration_threshold"]
        self.__base_grpc_channel = self._get_grpc_channel()
        self.grpc_channel = grpc.intercept_channel(
            self.__base_grpc_channel,
            generic_client_interceptor.create(self._intercept_call))
        self.payment_channel_provider = PaymentChannelProvider(
            sdk_web3, self._generate_payment_channel_state_service_client(),
            mpe_contract)
        self.service = self._generate_grpc_stub(service_stub)
        self.payment_channels = []
        self.last_read_block = 0
        self.account = account
        self.sdk_web3 = sdk_web3
        self.mpe_address = mpe_contract.contract.address
Exemple #2
0
 def __init__(self, sdk, metadata, group, service_stub,
              payment_channel_management_strategy, options):
     self.sdk = sdk
     self.options = options
     self.group = group
     self.metadata = metadata
     self.payment_channel_management_strategy = payment_channel_management_strategy
     self.expiry_threshold = self.metadata["payment_expiration_threshold"]
     self._base_grpc_channel = self._get_grpc_channel()
     self.grpc_channel = grpc.intercept_channel(
         self._base_grpc_channel,
         generic_client_interceptor.create(self._intercept_call))
     self.payment_channel_state_service_client = self._generate_payment_channel_state_service_client(
     )
     self.service = self._generate_grpc_stub(service_stub)
     self.payment_channels = []
     self.last_read_block = 0