Class: Weft::Facilitator::RouteConfig

Inherits:
Struct
  • Object
show all
Defined in:
lib/weft/facilitator/middleware.rb

Overview

Configuration for a route that requires payment.

{
  path: "/api/resource",          # string or Regexp
  price: "0.01",                  # price in asset units
  asset: "USDC",
  network: "base-sepolia",
  pay_to: "0x...",                # recipient address
  description: "Access resource",
  max_deadline_seconds: 60,
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ RouteConfig

Returns a new instance of RouteConfig.



22
23
24
25
26
27
# File 'lib/weft/facilitator/middleware.rb', line 22

def initialize(**kwargs)
  super
  self.network ||= 'base-sepolia'
  self.max_deadline_seconds ||= 60
  self.description ||= ''
end

Instance Attribute Details

#assetObject

Returns the value of attribute asset

Returns:

  • (Object)

    the current value of asset



17
18
19
# File 'lib/weft/facilitator/middleware.rb', line 17

def asset
  @asset
end

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



17
18
19
# File 'lib/weft/facilitator/middleware.rb', line 17

def description
  @description
end

#max_deadline_secondsObject

Returns the value of attribute max_deadline_seconds

Returns:

  • (Object)

    the current value of max_deadline_seconds



17
18
19
# File 'lib/weft/facilitator/middleware.rb', line 17

def max_deadline_seconds
  @max_deadline_seconds
end

#networkObject

Returns the value of attribute network

Returns:

  • (Object)

    the current value of network



17
18
19
# File 'lib/weft/facilitator/middleware.rb', line 17

def network
  @network
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



17
18
19
# File 'lib/weft/facilitator/middleware.rb', line 17

def path
  @path
end

#pay_toObject

Returns the value of attribute pay_to

Returns:

  • (Object)

    the current value of pay_to



17
18
19
# File 'lib/weft/facilitator/middleware.rb', line 17

def pay_to
  @pay_to
end

#priceObject

Returns the value of attribute price

Returns:

  • (Object)

    the current value of price



17
18
19
# File 'lib/weft/facilitator/middleware.rb', line 17

def price
  @price
end