Module: Bitfinex::RESTv2Wallet

Included in:
RESTv2
Defined in:
lib/rest/v2/wallet.rb

Instance Method Summary collapse

Instance Method Details

#create_deposit_address(wallet, method) ⇒ Array

Regenerate the deposit address for the given currency. All previous addresses are still active and can receive funds.

Parameters:

  • wallet (string)

    wallet to transfer funds from (exchange, margin ect…)

  • method (string)

    funds transfer protocol (bitcoin, tetherus ect…)

Returns:

  • (Array)

    Raw notification



49
50
51
52
# File 'lib/rest/v2/wallet.rb', line 49

def create_deposit_address (wallet, method)
  payload = { :wallet => wallet, :method => method, :op_renew => 1 }
  authenticated_post("auth/w/deposit/address", params: payload).body
end

#deposit_address(wallet, method) ⇒ Array

Get the deposit address for the given currency

Parameters:

  • wallet (string)

    wallet to transfer funds from (exchange, margin ect…)

  • method (string)

    funds transfer protocol (bitcoin, tetherus ect…)

Returns:

  • (Array)

    Raw notification



35
36
37
38
# File 'lib/rest/v2/wallet.rb', line 35

def deposit_address (wallet, method)
  payload = { :wallet => wallet, :method => method, :op_renew => 0 }
  authenticated_post("auth/w/deposit/address", params: payload).body
end

#transfer(from, to, currency_from, currency_to, amount) ⇒ Array

Transfer between bitfinex wallets

Parameters:

  • from (string)

    wallet to transfer funds from (exchange, margin ect…)

  • to (string)

    wallet to transfer funds to (exchange, margin ect…)

  • currency_from (string)

    original currency of funds

  • currency_to (string)

    currency to convert funds to

  • amount (number)

    amount of funds to convert

Returns:

  • (Array)

    Raw notification



22
23
24
25
# File 'lib/rest/v2/wallet.rb', line 22

def transfer (from, to, currency_from, currency_to, amount)
  payload = { :from => from, :to => to, :currency => currency, :currency_to => currency_to, :amount => amount }
  authenticated_post("auth/w/transfer", params: payload).body
end

#walletsObject

Get account wallets

@example:

client.wallets


7
8
9
# File 'lib/rest/v2/wallet.rb', line 7

def wallets
  authenticated_post("auth/r/wallets").body
end

#withdraw(wallet, method, amount, address) ⇒ Array

Withdraw from the given bitfinex wallet to the given cryptocurrency address

Parameters:

  • wallet (string)

    wallet to transfer funds from (exchange, margin ect…)

  • method (string)

    funds transfer protocol (bitcoin, tetherus ect…)

  • amount (number)

    amount of funds to withdraw

  • address (string)

    public key destination address

Returns:

  • (Array)

    Raw notification



64
65
66
67
# File 'lib/rest/v2/wallet.rb', line 64

def withdraw (wallet, method, amount, address)
  payload = { :wallet => wallet, :method => method, :amount => amount, :address => address }
  authenticated_post("auth/w/withdraw", params: { :id => id }).body
end