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

refactor(rpc): rename reserved TradingLimits fields #1980

Merged
1 commit merged into from
Nov 6, 2020
Merged
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
8 changes: 4 additions & 4 deletions docs/api.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions lib/cli/commands/tradinglimits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const HEADERS = [
colors.blue('Currency'),
colors.blue('Max Buy'),
colors.blue('Max Sell'),
colors.blue('Reserved Outbound'),
colors.blue('Reserved Inbound'),
colors.blue('Reserved Buy'),
colors.blue('Reserved Sell'),
];

const formatTradingLimits = (tradingLimits: TradingLimitsResponse.AsObject) => {
Expand All @@ -23,8 +23,8 @@ const formatTradingLimits = (tradingLimits: TradingLimitsResponse.AsObject) => {
currency,
`${satsToCoinsStr(tradingLimit.maxBuy)}`,
`${satsToCoinsStr(tradingLimit.maxSell)}`,
`${satsToCoinsStr(tradingLimit.reservedOutbound)}`,
`${satsToCoinsStr(tradingLimit.reservedInbound)}`,
`${satsToCoinsStr(tradingLimit.reservedBuy)}`,
`${satsToCoinsStr(tradingLimit.reservedSell)}`,
);
formatted.push(row);
});
Expand Down
4 changes: 2 additions & 2 deletions lib/grpc/GrpcService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ class GrpcService {
const tradingLimits = new xudrpc.TradingLimits();
tradingLimits.setMaxSell(tradingLimitsObj.maxSell);
tradingLimits.setMaxBuy(tradingLimitsObj.maxBuy);
tradingLimits.setReservedInbound(tradingLimitsObj.reservedInbound);
tradingLimits.setReservedOutbound(tradingLimitsObj.reservedOutbound);
tradingLimits.setReservedSell(tradingLimitsObj.reservedSell);
tradingLimits.setReservedBuy(tradingLimitsObj.reservedBuy);
limitsMap.set(currency, tradingLimits);
});
callback(null, response);
Expand Down
12 changes: 6 additions & 6 deletions lib/proto/xudrpc.swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions lib/proto/xudrpc_pb.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions lib/proto/xudrpc_pb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/swaps/SwapClientManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ class SwapClientManager extends EventEmitter {
const availableInboundCapacity = Math.max(0, swapCapacities.totalInboundCapacity - reservedInbound);

return {
reservedOutbound,
reservedInbound,
reservedSell: reservedOutbound,
reservedBuy: reservedInbound,
maxSell: Math.min(swapCapacities.maxOutboundChannelCapacity, availableOutboundCapacity),
maxBuy: Math.min(swapCapacities.maxInboundChannelCapacity, availableInboundCapacity),
};
Expand Down
12 changes: 6 additions & 6 deletions lib/swaps/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ export type SwapCapacities = {
};

export type TradingLimits = {
/** Maximum outbound limit for an order denominated in satoshis. */
/** Maximum outbound limit for a sell order denominated in satoshis. */
maxSell: number,
/** Maximum inbound limit for an order denominated in satoshis. */
/** Maximum inbound limit for a buy order denominated in satoshis. */
maxBuy: number,
/** The outbound amount reserved for open orders. */
reservedOutbound: number,
/** The inbound amount reserved for open orders. */
reservedInbound: number,
/** The outbound amount reserved for open sell orders. */
reservedSell: number,
/** The inbound amount reserved for open buy orders. */
reservedBuy: number,
};

export type ResolveRequest = {
Expand Down
12 changes: 6 additions & 6 deletions proto/xudrpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -928,14 +928,14 @@ message TradeHistoryResponse {
}

message TradingLimits {
// Maximum outbound limit for an order denominated in satoshis.
// Maximum outbound limit for a sell order denominated in satoshis.
uint64 max_sell = 1 [json_name = "max_sell"];
// Maximum inbound limit for an order denominated in satoshis.
// Maximum inbound limit for a buy order denominated in satoshis.
uint64 max_buy = 2 [json_name = "max_buy"];
// The outbound amount reserved for open orders.
uint64 reserved_outbound = 3 [json_name = "reserved_outbound"];
// The inbound amount reserved for open orders.
uint64 reserved_inbound = 4 [json_name = "reserved_inbound"];
// The outbound amount reserved for open sell orders.
uint64 reserved_sell = 3 [json_name = "reserved_sell"];
// The inbound amount reserved for open buy orders.
uint64 reserved_buy = 4 [json_name = "reserved_buy"];
}

message TradingLimitsRequest {
Expand Down
10 changes: 5 additions & 5 deletions test/jest/cli/__snapshots__/tradinglimits.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Array [
Trading Limits:",
],
Array [
"┌──────────┬────────────┬───────────┬───────────────────┬──────────────────┐
│ Currency │ Max Buy │ Max Sell │ Reserved Outbound │ Reserved Inbound
├──────────┼────────────┼───────────┼───────────────────┼──────────────────┤
│ BTC │ 0.00012345 │ 0.0006789 │ 0.00075 │ 0.00025
└──────────┴────────────┴───────────┴───────────────────┴──────────────────┘",
"┌──────────┬────────────┬───────────┬─────────────────────────────┐
│ Currency │ Max Buy │ Max Sell │ Reserved Buy │ Reserved Sell
├──────────┼────────────┼───────────┼─────────────────────────────┤
│ BTC │ 0.00012345 │ 0.0006789 │ 0.00025 │ 0.00075
└──────────┴────────────┴───────────┴─────────────────────────────┘",
],
]
`;
4 changes: 2 additions & 2 deletions test/jest/cli/tradinglimits.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ describe('displayLimits', () => {
limitsMap: [['BTC', {
maxBuy: 12345,
maxSell: 67890,
reservedInbound: 25000,
reservedOutbound: 75000,
reservedBuy: 25000,
reservedSell: 75000,
}]],
});

Expand Down
Loading