Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(coinbase): buy and transfer fix #679

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading