Skip to content

Commit

Permalink
fix: coinbase buy and transfer fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Syn-McJ committed Jan 14, 2025
1 parent 1ef9e4b commit 71c59e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ import Foundation

struct CoinbasePlaceBuyOrder: Codable {
let success: Bool
let failureReason: String
let orderId: String
let failureReason: String?
let clientOrderId: String?
let errorResponse: ErrorResponse?
let successResponse: SuccessResponse?
let orderConfiguration: OrderConfiguration?

enum CodingKeys: String, CodingKey {
case success
case failureReason = "failure_reason"
case orderId = "order_id"
case clientOrderId = "client_order_id"
case errorResponse = "error_response"
case successResponse = "success_response"
case orderConfiguration = "order_configuration"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ final class ConfirmOrderModel: OrderPreviewModel {
let result = try await Coinbase.shared.placeCoinbaseBuyOrder(amount: amountToTransfer)

if !result.success {
throw Coinbase.Error.transactionFailed(.message(result.errorResponse?.message ?? result.failureReason))
throw Coinbase.Error.transactionFailed(.message(result.errorResponse?.message ?? result.failureReason ?? "unknown error"))
}

try await transferFromCoinbase(amount: amountToTransfer, with: nil)
Expand Down

0 comments on commit 71c59e1

Please sign in to comment.