Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-stone committed Nov 13, 2024
1 parent 99260f1 commit a867854
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/coinbase/address/wallet_address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def sign_payload(unsigned_payload:)
# @param amount [Integer, Float, BigDecimal] The amount of the Asset to fund the wallet with.
# @param asset_id [Symbol] The ID of the Asset to trade from. For Ether, :eth, :gwei, and :wei are supported.
# @return [Coinbase::FundOperation] The FundOperation object.
def fund(amount, asset_id, options: {})
def fund(amount, asset_id)
FundOperation.create(
address_id: id,
amount: amount,
Expand All @@ -235,7 +235,7 @@ def fund(amount, asset_id, options: {})
# account for the amount of the specified Asset.
# @param asset_id [Symbol] The ID of the Asset to trade from. For Ether, :eth, :gwei, and :wei are supported.
# @return [Coinbase::FundQuote] The FundQuote object.
def quote_fund(amount, asset_id, options: {})
def quote_fund(amount, asset_id)
FundQuote.create(
address_id: id,
amount: amount,
Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/fund_operation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def create(wallet_id:, address_id:, amount:, asset_id:, network:)
address_id,
{
amount: asset.to_atomic_amount(amount).to_i.to_s,
asset_id: asset.primary_denomination.to_s,
asset_id: asset.primary_denomination.to_s
}
)
end
Expand Down
9 changes: 3 additions & 6 deletions lib/coinbase/fund_quote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def asset
# Returns the amount of the asset for the Transfer.
# @return [BigDecimal] The amount of the asset
def amount
BigDecimal(@model.crypto_amount.amount) / BigDecimal(10).power(@model.crypto_amount.asset.decimals)
CryptoAmount.from_model(@model.crypto_amount)
end

# Returns the amount of Fiat the FundOperation will cost (inclusive of fees).
Expand All @@ -100,10 +100,7 @@ def buy_fee
end

def transfer_fee
{
amount: BigDecimal(@model.fees.transfer_fee.amount) / BigDecimal(10).power(@model.fees.transfer_fee.asset.decimals),
asset: Coinbase::Asset.from_model(@model.fees.transfer_fee.asset)
}
CryptoAmount.from_model(@model.fees.transfer_fee)
end

# Returns a String representation of the Fund Operation.
Expand All @@ -119,7 +116,7 @@ def to_s
fiat_amount: fiat_amount,
fiat_currency: fiat_currency,
buy_fee: Coinbase.pretty_print_object(buy_fee),
transfer_fee: Coinbase.pretty_print_object(transfer_fee)
transfer_fee: transfer_fee
)
end

Expand Down

0 comments on commit a867854

Please sign in to comment.