Class: Privy::Models::AdvancedSwapRequestBody

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/privy/models/advanced_swap_request_body.rb,
sig/privy/models/advanced_swap_request_body.rbs

Defined Under Namespace

Modules: SlippageBps

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(amount:, input_token:, output_token:, caip2: nil, dry_run: nil, fee_recipient: nil, platform_fee_bps: nil, slippage_bps: nil) ⇒ Object

Some parameter documentations has been truncated, see Privy::Models::AdvancedSwapRequestBody for more details.

Request body for initiating a synchronous Solana token swap through an embedded wallet.

Parameters:

  • amount (String)

    Amount in the smallest unit of the input token (e.g. lamports for SOL).

  • input_token (String)

    Input token address (base58 mint address).

  • output_token (String)

    Output token address (base58 mint address).

  • caip2 (String) (defaults to: nil)

    CAIP-2 chain identifier. Defaults to Solana mainnet.

  • dry_run (Boolean) (defaults to: nil)

    When true, skip transaction submission (quote + sign only). The signed transacti

  • fee_recipient (String) (defaults to: nil)

    Token account (base58) to receive the platform fee. Must exist on-chain for the

  • platform_fee_bps (Integer) (defaults to: nil)

    Platform fee in basis points, taken from the output token. Requires fee_recipien

  • slippage_bps (Integer, Symbol, Privy::Models::AdvancedSwapRequestBody::SlippageBps) (defaults to: nil)

    Max slippage tolerance in basis points (0-10000), or "auto" for provider-determi



# File 'lib/privy/models/advanced_swap_request_body.rb', line 58

Instance Attribute Details

#amountString

Amount in the smallest unit of the input token (e.g. lamports for SOL).

Parameters:

  • value (String)

Returns:

  • (String)


10
# File 'lib/privy/models/advanced_swap_request_body.rb', line 10

required :amount, String

#caip2String?

CAIP-2 chain identifier. Defaults to Solana mainnet.

Parameters:

  • (String)

Returns:

  • (String, nil)


28
# File 'lib/privy/models/advanced_swap_request_body.rb', line 28

optional :caip2, String

#dry_runBoolean?

When true, skip transaction submission (quote + sign only). The signed transaction is still returned.

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


35
# File 'lib/privy/models/advanced_swap_request_body.rb', line 35

optional :dry_run, Privy::Internal::Type::Boolean

#fee_recipientString?

Token account (base58) to receive the platform fee. Must exist on-chain for the output token.

Parameters:

  • (String)

Returns:

  • (String, nil)


42
# File 'lib/privy/models/advanced_swap_request_body.rb', line 42

optional :fee_recipient, String

#input_tokenString

Input token address (base58 mint address).

Parameters:

  • value (String)

Returns:

  • (String)


16
# File 'lib/privy/models/advanced_swap_request_body.rb', line 16

required :input_token, String

#output_tokenString

Output token address (base58 mint address).

Parameters:

  • value (String)

Returns:

  • (String)


22
# File 'lib/privy/models/advanced_swap_request_body.rb', line 22

required :output_token, String

#platform_fee_bpsInteger?

Platform fee in basis points, taken from the output token. Requires fee_recipient when > 0.

Parameters:

  • (Integer)

Returns:

  • (Integer, nil)


49
# File 'lib/privy/models/advanced_swap_request_body.rb', line 49

optional :platform_fee_bps, Integer

#slippage_bpsInteger, ...

Max slippage tolerance in basis points (0-10000), or "auto" for provider-determined. Defaults to "auto".

Returns:



56
# File 'lib/privy/models/advanced_swap_request_body.rb', line 56

optional :slippage_bps, union: -> { Privy::AdvancedSwapRequestBody::SlippageBps }

Instance Method Details

#to_hash{

Returns:

  • ({)


55
# File 'sig/privy/models/advanced_swap_request_body.rbs', line 55

def to_hash: -> {