Interface Gateway.Builder

Enclosing interface:
Gateway

public static interface Gateway.Builder
The builder is used to specify the options used when connecting a Gateway. An instance of builder is created using the static method Gateway.newInstance(). Every method on the builder object will return a reference to the same builder object allowing them to be chained together in a single line, terminating with a call to connect() to complete connection of the Gateway.
  • Method Details

    • connection

      Gateway.Builder connection(Channel grpcChannel)
      Specifies an existing gRPC connection to be used by the Gateway. The connection will not be closed when the Gateway instance is closed. This allows multiple Gateway instances to share a gRPC connection.
      Parameters:
      grpcChannel - A gRPC connection.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • identity

      Gateway.Builder identity(Identity identity)
      Specifies the client identity used to connect to the network. All interactions will the Fabric network using this Gateway will be performed by this identity.
      Parameters:
      identity - An identity.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • signer

      Gateway.Builder signer(Signer signer)
      Specify the signing implementation used to sign messages sent to the Fabric network.
      Parameters:
      signer - A signing implementation.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • hash

      Gateway.Builder hash(Function<byte[],byte[]> hash)
      Specify the hashing implementation used to generate digests of messages sent to the Fabric network. If this option is not specified, SHA-256 is used by default.

      Standard hash implementations are provided in Hash.

      Parameters:
      hash - A hashing function.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • tlsClientCertificateHash

      Gateway.Builder tlsClientCertificateHash(byte[] certificateHash)
      Specify the SHA-256 hash of the TLS client certificate. This option is required only if mutual TLS authentication is used for the gRPC connection to the Gateway peer.
      Parameters:
      certificateHash - A SHA-256 hash.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • evaluateOptions

      @Deprecated default Gateway.Builder evaluateOptions(CallOption... options)
      Deprecated.
      Specify the default call options for evaluating transactions.

      A call of:

      
           evaluateOptions(CallOption.deadlineAfter(5, TimeUnit.SECONDS))
       

      is equivalent to:

      
           evaluateOptions(options -> options.withDeadlineAfter(5, TimeUnit.SECONDS))
       
      Parameters:
      options - Call options.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • evaluateOptions

      Gateway.Builder evaluateOptions(UnaryOperator<CallOptions> options)
      Specify the default call options for evaluating transactions.
      Parameters:
      options - Function that transforms call options.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • endorseOptions

      @Deprecated default Gateway.Builder endorseOptions(CallOption... options)
      Deprecated.
      Specify the default call options for endorsements.

      A call of:

      
           endorseOptions(CallOption.deadlineAfter(5, TimeUnit.SECONDS))
       

      is equivalent to:

      
           endorseOptions(options -> options.withDeadlineAfter(5, TimeUnit.SECONDS))
       
      Parameters:
      options - Call options.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • endorseOptions

      Gateway.Builder endorseOptions(UnaryOperator<CallOptions> options)
      Specify the default call options for endorsements.
      Parameters:
      options - Function that transforms call options.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • submitOptions

      @Deprecated default Gateway.Builder submitOptions(CallOption... options)
      Deprecated.
      Specify the default call options for submit of transactions to the orderer.

      A call of:

      
           submitOptions(CallOption.deadlineAfter(5, TimeUnit.SECONDS))
       

      is equivalent to:

      
           submitOptions(options -> options.withDeadlineAfter(5, TimeUnit.SECONDS))
       
      Parameters:
      options - Call options.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • submitOptions

      Gateway.Builder submitOptions(UnaryOperator<CallOptions> options)
      Specify the default call options for submit of transactions to the orderer.
      Parameters:
      options - Function that transforms call options.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • commitStatusOptions

      @Deprecated default Gateway.Builder commitStatusOptions(CallOption... options)
      Deprecated.
      Specify the default call options for retrieving transaction commit status.

      A call of:

      
           commitStatusOptions(CallOption.deadlineAfter(5, TimeUnit.SECONDS))
       

      is equivalent to:

      
           commitStatusOptions(options -> options.withDeadlineAfter(5, TimeUnit.SECONDS))
       
      Parameters:
      options - Call options.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • commitStatusOptions

      Gateway.Builder commitStatusOptions(UnaryOperator<CallOptions> options)
      Specify the default call options for retrieving transaction commit status.
      Parameters:
      options - Function that transforms call options.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • chaincodeEventsOptions

      @Deprecated default Gateway.Builder chaincodeEventsOptions(CallOption... options)
      Deprecated.
      Specify the default call options for chaincode events.

      A call of:

      
           chaincodeEventsOptions(CallOption.deadlineAfter(5, TimeUnit.SECONDS))
       

      is equivalent to:

      
           chaincodeEventsOptions(options -> options.withDeadlineAfter(5, TimeUnit.SECONDS))
       
      Parameters:
      options - Call options.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • chaincodeEventsOptions

      Gateway.Builder chaincodeEventsOptions(UnaryOperator<CallOptions> options)
      Specify the default call options for chaincode events.
      Parameters:
      options - Function that transforms call options.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • blockEventsOptions

      Gateway.Builder blockEventsOptions(UnaryOperator<CallOptions> options)
      Specify the default call options for block events.
      Parameters:
      options - Function that transforms call options.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • filteredBlockEventsOptions

      Gateway.Builder filteredBlockEventsOptions(UnaryOperator<CallOptions> options)
      Specify the default call options for filtered block events.
      Parameters:
      options - Function that transforms call options.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • blockAndPrivateDataEventsOptions

      Gateway.Builder blockAndPrivateDataEventsOptions(UnaryOperator<CallOptions> options)
      Specify the default call options for block and private data events.
      Parameters:
      options - Function that transforms call options.
      Returns:
      The builder instance, allowing multiple configuration options to be chained.
    • connect

      Gateway connect()
      Connects to the gateway using the specified options.
      Returns:
      The connected Gateway object.