Class: CoinbaseCustody::Transactions

Inherits:
Client
  • Object
show all
Defined in:
lib/coinbase_custody/transactions.rb

Overview

Coinbase Transaction APIs

Constant Summary collapse

TRANSACTIONS_PATH =
'/transactions'

Constants included from Util

Util::BASE_API_URL

Instance Method Summary collapse

Methods inherited from Client

#get, #headers, #http_request, #initialize, #post

Methods included from Util

#format_response, #pagination_params, #send_request

Constructor Details

This class inherits a constructor from CoinbaseCustody::Client

Instance Method Details

#create(params = {}) ⇒ Hash

Creates a new withdrawal transaction

body [Object] The create transaction payload source [String] The source wallet id for the transaction currency [String] A fiat currency symbol such as USD. If provided Custody will automatically convert the amount value into crypto units. whole_amount [String] The amount of the transaction in whole units (e.g. “1.01”) destination [String] The destination address of the transaction account_identifier [String] The account identifier of the transaction (for example destination tag or memo value)

Parameters:

  • params (Hash) (defaults to: {})

    The hash with the following parameters

Returns:

  • (Hash)

    Created transaction record



52
53
54
# File 'lib/coinbase_custody/transactions.rb', line 52

def create(params = {})
  format_response(post(TRANSACTIONS_PATH, body: params))
end

#fetch(transaction_id) ⇒ Hash

Gets a single transaction by id

from organization.

Parameters:

  • id (String)

    The transaction id to retrieve

Returns:

  • (Hash)

    The information about a single transaction



34
35
36
# File 'lib/coinbase_custody/transactions.rb', line 34

def fetch(transaction_id)
  format_response(get("#{TRANSACTIONS_PATH}/#{transaction_id}"))
end

#list(params = {}) ⇒ Hash

Retrieve a list of the transactions from organization. The response is filterable by query parameters.

currency [String] The type of currency to filter. state [String] The state of transactions to filter. type [String] The type of transactions to filter. wallet_id [String] The wallet id to filter. start_time [String] The start time to filter. end_time [String] The end time to filter. human_id [String] The human id to filter. before [String] Request page before (newer) this pagination id (optional). after [String] Request page after (older) this pagination id (optional). limit [Integer] Number of results per request.

Parameters:

  • The (Hash)

    hash with the following parameters

Returns:

  • (Hash)

    a list of transactions records.



25
26
27
# File 'lib/coinbase_custody/transactions.rb', line 25

def list(params = {})
  format_response(get(TRANSACTIONS_PATH, query: params))
end