Skip to content

Commit 18fa69d

Browse files
authored
Add support for memo field for ATOM coin (clean up orderbookentry id that was not added using sdkgenerator) (#119)
1 parent e2ac8fc commit 18fa69d

File tree

4 files changed

+135
-31
lines changed

4 files changed

+135
-31
lines changed

api.go

Lines changed: 123 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ type CreateAccountRequest struct {
6161
//
6262
// Users must be verified to trade currency in order to be able to create an Account. For more information on the verification process, please see <a href="/help/en/articles/1000168396">How do I verify my identity?</a>.
6363
//
64-
// Users have a limit of 4 accounts per currency.
64+
// Users have a limit of 10 accounts per currency.
6565
//
6666
// required: true
6767
Currency string `json:"currency" url:"currency"`
@@ -405,9 +405,6 @@ type GetMoveResponse struct {
405405
// <code>client_move_id</code>. If both are provided an API error will be
406406
// returned.
407407
//
408-
// This endpoint is in BETA, behaviour and specification may change without
409-
// any previous notice.
410-
//
411408
// Permissions required: <code>MP_None</code>
412409
func (cl *Client) GetMove(ctx context.Context, req *GetMoveRequest) (*GetMoveResponse, error) {
413410
var res GetMoveResponse
@@ -591,6 +588,9 @@ type GetOrderV2Response struct {
591588
// Use this field and `side` to determine credit or debit of funds.
592589
Base decimal.Decimal `json:"base"`
593590

591+
// The base account ID used to place the order
592+
BaseAccountId int64 `json:"base_account_id"`
593+
594594
// Client Order ID has the value that was passed in when the Order was posted.
595595
ClientOrderId string `json:"client_order_id"`
596596

@@ -606,6 +606,9 @@ type GetOrderV2Response struct {
606606
// Use this field and `side` to determine credit or debit of funds.
607607
Counter decimal.Decimal `json:"counter"`
608608

609+
// The counter account ID used to place the order
610+
CounterAccountId int64 `json:"counter_account_id"`
611+
609612
// Time of order creation (Unix milliseconds)
610613
CreationTimestamp Time `json:"creation_timestamp"`
611614

@@ -695,6 +698,9 @@ type GetOrderV3Response struct {
695698
// Use this field and `side` to determine credit or debit of funds.
696699
Base decimal.Decimal `json:"base"`
697700

701+
// The base account ID used to place the order
702+
BaseAccountId int64 `json:"base_account_id"`
703+
698704
// Client Order ID has the value that was passed in when the Order was posted.
699705
ClientOrderId string `json:"client_order_id"`
700706

@@ -710,6 +716,9 @@ type GetOrderV3Response struct {
710716
// Use this field and `side` to determine credit or debit of funds.
711717
Counter decimal.Decimal `json:"counter"`
712718

719+
// The counter account ID used to place the order
720+
CounterAccountId int64 `json:"counter_account_id"`
721+
713722
// Time of order creation (Unix milliseconds)
714723
CreationTimestamp Time `json:"creation_timestamp"`
715724

@@ -909,7 +918,8 @@ func (cl *Client) GetWithdrawal(ctx context.Context, req *GetWithdrawalRequest)
909918
}
910919

911920
// ListBeneficiariesResponseRequest is the request struct for ListBeneficiariesResponse.
912-
type ListBeneficiariesResponseRequest struct{}
921+
type ListBeneficiariesResponseRequest struct {
922+
}
913923

914924
// ListBeneficiariesResponseResponse is the response struct for ListBeneficiariesResponse.
915925
type ListBeneficiariesResponseResponse struct {
@@ -949,9 +959,6 @@ type ListMovesResponse struct {
949959
// Returns a list of the most recent moves ordered from newest to oldest.
950960
// This endpoint will list up to 100 most recent moves by default.
951961
//
952-
// This endpoint is in BETA, behaviour and specification may change without
953-
// any previous notice.
954-
//
955962
// Permissions required: <code>MP_None</code>
956963
func (cl *Client) ListMoves(ctx context.Context, req *ListMovesRequest) (*ListMovesResponse, error) {
957964
var res ListMovesResponse
@@ -1184,9 +1191,6 @@ type ListTransfersResponse struct {
11841191
// until you have all the transfers you need.
11851192
// This endpoint will list up to 100 transfers at a time by default.
11861193
//
1187-
// This endpoint is in BETA, behaviour and specification may change without
1188-
// any previous notice.
1189-
//
11901194
// Permissions required: <Code>Perm_R_Transfers</Code>
11911195
func (cl *Client) ListTransfers(ctx context.Context, req *ListTransfersRequest) (*ListTransfersResponse, error) {
11921196
var res ListTransfersResponse
@@ -1356,9 +1360,6 @@ type MoveResponse struct {
13561360
//
13571361
// Note: moves will show as transactions, but not as transfers.
13581362
//
1359-
// This endpoint is in BETA, behaviour and specification may change without
1360-
// any previous notice.
1361-
//
13621363
// Permissions required: <code>MP_None_Write</code>
13631364
func (cl *Client) Move(ctx context.Context, req *MoveRequest) (*MoveResponse, error) {
13641365
var res MoveResponse
@@ -1534,15 +1535,14 @@ func (cl *Client) PostMarketOrder(ctx context.Context, req *PostMarketOrderReque
15341535
type SendRequest struct {
15351536
// Destination address or email address.
15361537
//
1537-
// # Note:
1538-
//
1539-
// - Ethereum addresses must be [checksummed]
1540-
//
1541-
// - Ethereum sends to email addresses are not supported.
1538+
// <b>Note</b>:
1539+
// <ul>
1540+
// <li>Ethereum addresses must be
1541+
// <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md" target="_blank" rel="nofollow">checksummed</a>.</li>
1542+
// <li>Ethereum sends to email addresses are not supported.</li>
1543+
// </ul>
15421544
//
15431545
// required: true
1544-
//
1545-
// [checksummed]: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md
15461546
Address string `json:"address" url:"address"`
15471547

15481548
// Amount to send as a decimal string.
@@ -1566,9 +1566,22 @@ type SendRequest struct {
15661566
// This supports all alphanumeric characters, as well as "-" and "_".
15671567
ExternalId string `json:"external_id" url:"external_id"`
15681568

1569+
// Only required for Foreign Exchange Notification under the Malaysia FEN rules. ForexNoticeSelfDeclaration must be true if the user has exceeded his/her annual investment limit in foreign currency assets.
1570+
ForexNoticeSelfDeclaration bool `json:"forex_notice_self_declaration" url:"forex_notice_self_declaration"`
1571+
15691572
// Optional boolean flag indicating that a XRP destination tag is provided (even if zero).
15701573
HasDestinationTag bool `json:"has_destination_tag" url:"has_destination_tag"`
15711574

1575+
// Only required for Foreign Exchange Notification under the Malaysia FEN rules. IsDRB must be true if the user has Domestic Ringgit Borrowing (DRB).
1576+
IsDrb bool `json:"is_drb" url:"is_drb"`
1577+
1578+
// Only required for Foreign Exchange Notification under the Malaysia FEN rules. IsForexSend must be true if sending to an address hosted outside of Malaysia.
1579+
IsForexSend bool `json:"is_forex_send" url:"is_forex_send"`
1580+
1581+
// Optional memo string used to provide account information for ATOM, etc. where it holds "account" information
1582+
// for a generic address.
1583+
Memo string `json:"memo" url:"memo"`
1584+
15721585
// Message to send to the recipient.
15731586
// This is only relevant when sending to an email address.
15741587
Message string `json:"message" url:"message"`
@@ -1707,4 +1720,93 @@ func (cl *Client) UpdateAccountName(ctx context.Context, req *UpdateAccountNameR
17071720
return &res, nil
17081721
}
17091722

1723+
// ValidateRequest is the request struct for Validate.
1724+
type ValidateRequest struct {
1725+
// Destination address or email address.
1726+
//
1727+
// <b>Note</b>:
1728+
// <ul>
1729+
// <li>Ethereum addresses must be
1730+
// <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md" target="_blank" rel="nofollow">checksummed</a>.</li>
1731+
// <li>Ethereum validations of email addresses are not supported.</li>
1732+
// </ul>
1733+
//
1734+
// required: true
1735+
Address string `json:"address" url:"address"`
1736+
1737+
// Currency is the currency associated with the address.
1738+
//
1739+
// required: true
1740+
Currency string `json:"currency" url:"currency"`
1741+
1742+
// AddressName is the optional name under which to store the address as in the address book.
1743+
AddressName string `json:"address_name" url:"address_name"`
1744+
1745+
// BeneficiaryName is the name of the beneficial owner if is it is a private address
1746+
BeneficiaryName string `json:"beneficiary_name" url:"beneficiary_name"`
1747+
1748+
// Country is the ISO 3166-1 country code of the beneficial owner of the address
1749+
Country string `json:"country" url:"country"`
1750+
1751+
// DateOfBirth is the date of birth of the (non-institutional) beneficial owner of the address in the form "YYYY-MM-DD"
1752+
DateOfBirth string `json:"date_of_birth" url:"date_of_birth"`
1753+
1754+
// Optional XRP destination tag. Note that HasDestinationTag must be true if this value is provided.
1755+
DestinationTag int64 `json:"destination_tag" url:"destination_tag"`
1756+
1757+
// Optional boolean flag indicating that a XRP destination tag is provided (even if zero).
1758+
HasDestinationTag bool `json:"has_destination_tag" url:"has_destination_tag"`
1759+
1760+
// InstitutionName is the name of the beneficial owner if is it is a legal entities address
1761+
InstitutionName string `json:"institution_name" url:"institution_name"`
1762+
1763+
// IsLegalEntity indicates if the address is for a legal entity and not a private beneficiary.
1764+
// If this field is true then the fields BeneficiaryName, Nationality & DateOfBirth should be empty but the
1765+
// fields InstitutionName and Country should be populated.
1766+
// If this field is false and IsSelfSend is false (or empty) then the field InstitutionName should be empty but the
1767+
// fields BeneficiaryName, Nationality & DateOfBirth and Country should be populated.
1768+
IsLegalEntity bool `json:"is_legal_entity" url:"is_legal_entity"`
1769+
1770+
// IsPrivateWallet indicates if the address is for private wallet and not held at an exchange.
1771+
IsPrivateWallet bool `json:"is_private_wallet" url:"is_private_wallet"`
1772+
1773+
// IsSelfSend to indicate that the address belongs to the customer.
1774+
// If this field is true then the remaining omitempty fields should not
1775+
// be populated.
1776+
IsSelfSend bool `json:"is_self_send" url:"is_self_send"`
1777+
1778+
// Optional memo string used to provide account information for ATOM, etc. where it holds "account" information
1779+
// for a generic address.
1780+
Memo string `json:"memo" url:"memo"`
1781+
1782+
// Nationality ISO 3166-1 country code of the nationality of the (non-institutional) beneficial owner of the address
1783+
Nationality string `json:"nationality" url:"nationality"`
1784+
1785+
// PhysicalAddress is the legal physical address of the beneficial owner of the crypto address
1786+
PhysicalAddress string `json:"physical_address" url:"physical_address"`
1787+
1788+
// PrivateWalletName is the name of the private wallet
1789+
WalletName string `json:"wallet_name" url:"wallet_name"`
1790+
}
1791+
1792+
// ValidateResponse is the response struct for Validate.
1793+
type ValidateResponse struct {
1794+
Success bool `json:"success"`
1795+
}
1796+
1797+
// Validate makes a call to POST /api/1/address/validate.
1798+
//
1799+
// Validate receive addresses, to which a customer wishes to make cryptocurrency sends, are verified under covering
1800+
// regulatory requirements for the customer such as travel rules.
1801+
//
1802+
// Permissions required: <code>Perm_W_Send</code>
1803+
func (cl *Client) Validate(ctx context.Context, req *ValidateRequest) (*ValidateResponse, error) {
1804+
var res ValidateResponse
1805+
err := cl.do(ctx, "POST", "/api/1/address/validate", req, &res, true)
1806+
if err != nil {
1807+
return nil, err
1808+
}
1809+
return &res, nil
1810+
}
1811+
17101812
// vi: ft=go

streaming/streaming.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ func flatten(m map[string]order, reverse bool) []luno.OrderBookEntry {
6969
var ol []luno.OrderBookEntry
7070
for _, o := range m {
7171
ol = append(ol, luno.OrderBookEntry{
72-
ID: o.ID,
7372
Price: o.Price,
7473
Volume: o.Volume,
7574
})

streaming/streaming_internal_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -548,14 +548,14 @@ func Test_flatten(t *testing.T) {
548548
"3": {ID: "3", Price: decimal.NewFromInt64(3), Volume: decimal.NewFromInt64(3)},
549549
}
550550
expForward := []luno.OrderBookEntry{
551-
{ID: "1", Price: decimal.NewFromInt64(1), Volume: decimal.NewFromInt64(1)},
552-
{ID: "2", Price: decimal.NewFromInt64(2), Volume: decimal.NewFromInt64(2)},
553-
{ID: "3", Price: decimal.NewFromInt64(3), Volume: decimal.NewFromInt64(3)},
551+
{Price: decimal.NewFromInt64(1), Volume: decimal.NewFromInt64(1)},
552+
{Price: decimal.NewFromInt64(2), Volume: decimal.NewFromInt64(2)},
553+
{Price: decimal.NewFromInt64(3), Volume: decimal.NewFromInt64(3)},
554554
}
555555
expReverse := []luno.OrderBookEntry{
556-
{ID: "3", Price: decimal.NewFromInt64(3), Volume: decimal.NewFromInt64(3)},
557-
{ID: "2", Price: decimal.NewFromInt64(2), Volume: decimal.NewFromInt64(2)},
558-
{ID: "1", Price: decimal.NewFromInt64(1), Volume: decimal.NewFromInt64(1)},
556+
{Price: decimal.NewFromInt64(3), Volume: decimal.NewFromInt64(3)},
557+
{Price: decimal.NewFromInt64(2), Volume: decimal.NewFromInt64(2)},
558+
{Price: decimal.NewFromInt64(1), Volume: decimal.NewFromInt64(1)},
559559
}
560560

561561
forward := flatten(orders, false)

types.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,6 @@ type Order struct {
206206
}
207207

208208
type OrderBookEntry struct {
209-
// ID is the unique identifier of the order
210-
ID string `json:"id"`
211-
212209
// Limit price at which orders are trading at
213210
Price decimal.Decimal `json:"price"`
214211

@@ -238,6 +235,9 @@ type OrderV2 struct {
238235
// Use this field and `side` to determine credit or debit of funds.
239236
Base decimal.Decimal `json:"base"`
240237

238+
// The base account ID used to place the order
239+
BaseAccountId int64 `json:"base_account_id"`
240+
241241
// Client Order ID has the value that was passed in when the Order was posted.
242242
ClientOrderId string `json:"client_order_id"`
243243

@@ -253,6 +253,9 @@ type OrderV2 struct {
253253
// Use this field and `side` to determine credit or debit of funds.
254254
Counter decimal.Decimal `json:"counter"`
255255

256+
// The counter account ID used to place the order
257+
CounterAccountId int64 `json:"counter_account_id"`
258+
256259
// Time of order creation (Unix milliseconds)
257260
CreationTimestamp Time `json:"creation_timestamp"`
258261

0 commit comments

Comments
 (0)