Skip to content

Commit

Permalink
Merge pull request #1980 from ExchangeUnion/rename-trading-limits
Browse files Browse the repository at this point in the history
refactor(rpc): rename reserved TradingLimits fields
  • Loading branch information
Karl Ranna authored Nov 6, 2020
2 parents 17e40de + 721e098 commit 74a59dc
Show file tree
Hide file tree
Showing 12 changed files with 319 additions and 319 deletions.
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

0 comments on commit 74a59dc

Please sign in to comment.