-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdeposit.go
44 lines (37 loc) · 1.16 KB
/
deposit.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
33
34
35
36
37
38
39
40
41
42
43
44
package fswap
import (
"context"
"time"
"github.com/shopspring/decimal"
)
const (
DepositStatePending = "Pending"
DepositStateCancelled = "Cancelled"
DepositStateDone = "Done"
)
type Deposit struct {
ID string `json:"id,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
State string `json:"state,omitempty"`
UserID string `json:"user_id,omitempty"`
FollowID string `json:"follow_id,omitempty"`
BaseAssetID string `json:"base_asset_id,omitempty"`
QuoteAssetID string `json:"quote_asset_id,omitempty"`
BaseAmount decimal.Decimal `json:"base_amount,omitempty"`
QuoteAmount decimal.Decimal `json:"quote_amount,omitempty"`
Slippage decimal.Decimal `json:"slippage,omitempty"`
}
func (c *Client) ReadDeposit(ctx context.Context, depositID string) (*Deposit, error) {
const uri = "/api/deposits/{id}"
resp, err := c.request(ctx).SetPathParams(map[string]string{
"id": depositID,
}).Get(uri)
if err != nil {
return nil, err
}
var deposit Deposit
if err := UnmarshalResponse(resp, &deposit); err != nil {
return nil, err
}
return &deposit, err
}