forked from preichenberger/go-coinbasepro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
withdrawals.go
32 lines (27 loc) · 1005 Bytes
/
withdrawals.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package coinbasepro
import (
"context"
"fmt"
)
type WithdrawalCrypto struct {
Currency string `json:"currency"`
Amount string `json:"amount"`
CryptoAddress string `json:"crypto_address"`
}
type WithdrawalCoinbase struct {
Currency string `json:"currency"`
Amount string `json:"amount"`
CoinbaseAccountID string `json:"coinbase_account_id"`
}
func (c *Client) CreateWithdrawalCrypto(ctx context.Context, withdrawal *WithdrawalCrypto) (WithdrawalCrypto, error) {
var savedWithdrawal WithdrawalCrypto
url := fmt.Sprintf("/withdrawals/crypto")
_, err := c.Request(ctx, "POST", url, withdrawal, &savedWithdrawal)
return savedWithdrawal, err
}
func (c *Client) CreateWithdrawalCoinbase(ctx context.Context, withdrawal *WithdrawalCoinbase) (WithdrawalCoinbase, error) {
var savedWithdrawal WithdrawalCoinbase
url := fmt.Sprintf("/withdrawals/coinbase-account")
_, err := c.Request(ctx, "POST", url, withdrawal, &savedWithdrawal)
return savedWithdrawal, err
}