Class: Privy::Resources::Wallets::Earn::Ethereum

Inherits:
Object
  • Object
show all
Defined in:
lib/privy/resources/wallets/earn/ethereum.rb,
lib/privy/resources/wallets/earn/ethereum/incentive.rb

Overview

Operations related to wallet actions

Defined Under Namespace

Classes: Incentive

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Ethereum

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 Ethereum.

Parameters:



104
105
106
107
# File 'lib/privy/resources/wallets/earn/ethereum.rb', line 104

def initialize(client:)
  @client = client
  @incentive = Privy::Resources::Wallets::Earn::Ethereum::Incentive.new(client: client)
end

Instance Attribute Details

#incentivePrivy::Resources::Wallets::Earn::Ethereum::Incentive (readonly)

Operations related to wallet actions



11
12
13
# File 'lib/privy/resources/wallets/earn/ethereum.rb', line 11

def incentive
  @incentive
end

Instance Method Details

#_deposit(wallet_id, vault_id:, amount: nil, raw_amount: nil, privy_authorization_signature: nil, privy_idempotency_key: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::EarnDepositActionResponse

Some parameter documentations has been truncated, see Models::Wallets::Earn::EthereumDepositParams for more details.

Deposit assets into an ERC-4626 vault.

Parameters:

  • wallet_id (String)

    Path param: ID of the wallet.

  • vault_id (String)

    Body param: The ID of the vault to deposit into.

  • amount (String)

    Body param: Human-readable decimal amount to deposit (e.g. “1.5” for 1.5 USDC).

  • raw_amount (String)

    Body param: Amount in smallest unit to deposit (e.g. “1500000” for 1.5 USDC with

  • privy_authorization_signature (String)

    Header param: Request authorization signature. If multiple signatures are requir

  • privy_idempotency_key (String)

    Header param: Idempotency keys ensure API requests are executed only once within

  • privy_request_expiry (String)

    Header param: Request expiry. Value is a Unix timestamp in milliseconds represen

  • request_options (Privy::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/privy/resources/wallets/earn/ethereum.rb', line 39

def _deposit(wallet_id, params)
  parsed, options = Privy::Wallets::Earn::EthereumDepositParams.dump_request(params)
  header_params =
    {
      privy_authorization_signature: "privy-authorization-signature",
      privy_idempotency_key: "privy-idempotency-key",
      privy_request_expiry: "privy-request-expiry"
    }
  @client.request(
    method: :post,
    path: ["v1/wallets/%1$s/earn/ethereum/deposit", wallet_id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Privy::EarnDepositActionResponse,
    options: options
  )
end

#_withdraw(wallet_id, vault_id:, amount: nil, raw_amount: nil, privy_authorization_signature: nil, privy_idempotency_key: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::EarnWithdrawActionResponse

Some parameter documentations has been truncated, see Models::Wallets::Earn::EthereumWithdrawParams for more details.

Withdraw assets from an ERC-4626 vault.

Parameters:

  • wallet_id (String)

    Path param: ID of the wallet.

  • vault_id (String)

    Body param: The ID of the vault to withdraw from.

  • amount (String)

    Body param: Human-readable decimal amount to withdraw (e.g. “1.5” for 1.5 USDC).

  • raw_amount (String)

    Body param: Amount in smallest unit to withdraw (e.g. “1500000” for 1.5 USDC wit

  • privy_authorization_signature (String)

    Header param: Request authorization signature. If multiple signatures are requir

  • privy_idempotency_key (String)

    Header param: Idempotency keys ensure API requests are executed only once within

  • privy_request_expiry (String)

    Header param: Request expiry. Value is a Unix timestamp in milliseconds represen

  • request_options (Privy::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/privy/resources/wallets/earn/ethereum.rb', line 83

def _withdraw(wallet_id, params)
  parsed, options = Privy::Wallets::Earn::EthereumWithdrawParams.dump_request(params)
  header_params =
    {
      privy_authorization_signature: "privy-authorization-signature",
      privy_idempotency_key: "privy-idempotency-key",
      privy_request_expiry: "privy-request-expiry"
    }
  @client.request(
    method: :post,
    path: ["v1/wallets/%1$s/earn/ethereum/withdraw", wallet_id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Privy::EarnWithdrawActionResponse,
    options: options
  )
end