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

client/rpcserver: Add cancel route. #411

Merged
merged 2 commits into from
Jun 2, 2020
Merged

Conversation

JoeGruffins
Copy link
Member

No description provided.

@JoeGruffins JoeGruffins force-pushed the cancelroute branch 3 times, most recently from 062902b to 18d7a9d Compare May 30, 2020 05:53
@JoeGruffins JoeGruffins marked this pull request as ready for review May 30, 2020 06:06
client/rpcserver/rpcserver.go Show resolved Hide resolved
client/rpcserver/types.go Outdated Show resolved Hide resolved
@@ -42,7 +45,7 @@ type getFeeResponse struct {

// tradeResponse is used when responding to the trade route.
type tradeResponse struct {
OrderID string `json:"orderid"`
OrderID string `json:"orderID"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what passes for idiomatic json, but I though we were using all lower. Leaving that up to @buck54321

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been inconsistent again. This is fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@buck54321 I don't have an opinion, but I would like them to be the same for the same values. An all lower-case rule would make that simpler however. Let me know

client/rpcserver/types.go Outdated Show resolved Hide resolved
client/rpcserver/types.go Outdated Show resolved Hide resolved
return nil, fmt.Errorf("%w: invalid order id hex", errArgs)
}
if _, err := hex.DecodeString(id); err != nil {
return nil, fmt.Errorf("%w: invalid order id hex", errArgs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, %w is great: https://blog.golang.org/go1.13-errors#TOC_3.3. I didn't know about this addition to the language.

@chappjc
Copy link
Member

chappjc commented Jun 2, 2020

As expected:

 $    ./dexcctl -u u -P p trade 127.0.0.1:7232 true false 42 0 100000000 10000 0
App password:
{
  "orderID": "4e96d67c36200813c351f1d564f7b93310bc6ec12b65254d2aeca155d26eaf26",
  "sig": "3044022036c4cc2e1cf1c1e30e66e7df9cfcac397060bd49fbe7bc3e35a32051f25c83a002203c3a1cb73f6c6c38704e60db6e616a5903ec2de3a60ea7e9a6aed7892c139c48",
  "stamp": 1591131274731
}

$    ./dexcctl -u u -P p help cancel
cancel "orderID"

Cancel an order.

Args:
    orderID (string): The hex ID of the order to cancel

Returns:
    string: The message "canceled order [order ID]"

$    ./dexcctl -u u -P p cancel 4e96d67c36200813c351f1d564f7b93310bc6ec12b65254d2aeca155d26eaf26
App password:
canceled order 4e96d67c36200813c351f1d564f7b93310bc6ec12b65254d2aeca155d26eaf26
[DBG] CORE: notify: |POKE| (order) Order placed - buying 1.00000000 dcr (4e96d67c) - Order: 4e96d67c36200813c351f1d564f7b93310bc6ec12b65254d2aeca155d26eaf26
[TRC] CORE: notify: |DATA| (balance) balance updated
[DBG] CORE: notify: |POKE| (order) Preimage sent - match cycle has begun for order 4e96d67c - Order: 4e96d67c36200813c351f1d564f7b93310bc6ec12b65254d2aeca155d26eaf26
[DBG] RPC: authenticated user with ip: 127.0.0.1:56330
[DBG] RPC: authenticated user with ip: 127.0.0.1:56362
[DBG] CORE: notify: |POKE| (order) Preimage sent - match cycle has begun for cancellation order for trade 4e96d67c - Order: 
[INF] CORE: maker notification for cancel order received for order 4e96d67c36200813c351f1d564f7b93310bc6ec12b65254d2aeca155d26eaf26. match id = baacd20842e743d64edf1a98dbe14b7e0e19a470f51e2511cd116bafea88654f
[INF] CORE: notify: |SUCCESS| (order) Order canceled - Buy order on dcr-btc at 127.0.0.1:7232 has been canceled (4e96d67c) - Order: 4e96d67c36200813c351f1d564f7b93310bc6ec12b65254d2aeca155d26eaf26
[TRC] CORE: notify: |DATA| (order) cancel - Order: 
[INF] CORE: taker notification for cancel order received for order ea1ff20d610c7647f16a5c2b1409f775cdcba8d6e71023f4b0f625d73cbbfe72. match id = baacd20842e743d64edf1a98dbe14b7e0e19a470f51e2511cd116bafea88654f

@chappjc chappjc merged commit 5dd3c49 into decred:master Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants