Class: WhopSDK::Resources::Swaps
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Swaps
- Defined in:
- lib/whop_sdk/resources/swaps.rb
Instance Method Summary collapse
-
#create_quote(amount:, from_token:, to_token:, from_address: nil, from_chain: nil, metadata: nil, slippage_bps: nil, to_address: nil, to_chain: nil, request_options: {}) ⇒ WhopSDK::Models::SwapCreateQuoteResponse
Returns a stateless swap price preview.
-
#initialize(client:) ⇒ Swaps
constructor
private
A new instance of Swaps.
Constructor Details
#initialize(client:) ⇒ Swaps
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Swaps.
47 48 49 |
# File 'lib/whop_sdk/resources/swaps.rb', line 47 def initialize(client:) @client = client end |
Instance Method Details
#create_quote(amount:, from_token:, to_token:, from_address: nil, from_chain: nil, metadata: nil, slippage_bps: nil, to_address: nil, to_chain: nil, request_options: {}) ⇒ WhopSDK::Models::SwapCreateQuoteResponse
Returns a stateless swap price preview. No funds move and nothing is persisted.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/whop_sdk/resources/swaps.rb', line 33 def create_quote(params) parsed, = WhopSDK::SwapCreateQuoteParams.dump_request(params) @client.request( method: :post, path: "swaps/quote", body: parsed, model: WhopSDK::Models::SwapCreateQuoteResponse, options: ) end |