@riocrypto/common-server 1.0.2916 → 1.0.2918

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.ts CHANGED
@@ -159,15 +159,6 @@ export * from "./clients/cosigner-client";
159
159
  export * from "./clients/bitso-client";
160
160
  export * from "./clients/circle-client";
161
161
  export * from "./clients/coincover-client";
162
- export * from "./clients/google-sheets-api-client";
163
- export * from "./clients/binance-client";
164
- export * from "./clients/kraken-client";
165
- export * from "./helpers/get-user-helper";
166
- export * from "./helpers/get-processor-fees";
167
- export * from "./helpers/get-network-fees";
168
- export * from "./helpers/calculate-aggregate-volume-and-revenue";
169
- export * from "./helpers/calculate-volume-and-revenue";
170
- export * from "./helpers/get-user";
171
162
  export * from "./helpers/unescape";
172
163
  export * from "./helpers/sanitize-user-doc";
173
164
  export * from "./helpers/sanitize-bank-account-doc";
@@ -201,3 +192,12 @@ export * from "./helpers/find-user-tier-forward-curve-rate";
201
192
  export * from "./helpers/resolve-forward-curve-rate";
202
193
  export * from "./helpers/get-resolved-forward-curve-tiers";
203
194
  export * from "./helpers/get-fx-trading-policy";
195
+ export * from "./clients/google-sheets-api-client";
196
+ export * from "./clients/binance-client";
197
+ export * from "./clients/kraken-client";
198
+ export * from "./helpers/get-user-helper";
199
+ export * from "./helpers/get-processor-fees";
200
+ export * from "./helpers/get-network-fees";
201
+ export * from "./helpers/calculate-aggregate-volume-and-revenue";
202
+ export * from "./helpers/calculate-volume-and-revenue";
203
+ export * from "./helpers/get-user";
package/build/index.js CHANGED
@@ -175,15 +175,6 @@ __exportStar(require("./clients/cosigner-client"), exports);
175
175
  __exportStar(require("./clients/bitso-client"), exports);
176
176
  __exportStar(require("./clients/circle-client"), exports);
177
177
  __exportStar(require("./clients/coincover-client"), exports);
178
- __exportStar(require("./clients/google-sheets-api-client"), exports);
179
- __exportStar(require("./clients/binance-client"), exports);
180
- __exportStar(require("./clients/kraken-client"), exports);
181
- __exportStar(require("./helpers/get-user-helper"), exports);
182
- __exportStar(require("./helpers/get-processor-fees"), exports);
183
- __exportStar(require("./helpers/get-network-fees"), exports);
184
- __exportStar(require("./helpers/calculate-aggregate-volume-and-revenue"), exports);
185
- __exportStar(require("./helpers/calculate-volume-and-revenue"), exports);
186
- __exportStar(require("./helpers/get-user"), exports);
187
178
  __exportStar(require("./helpers/unescape"), exports);
188
179
  __exportStar(require("./helpers/sanitize-user-doc"), exports);
189
180
  __exportStar(require("./helpers/sanitize-bank-account-doc"), exports);
@@ -217,3 +208,13 @@ __exportStar(require("./helpers/find-user-tier-forward-curve-rate"), exports);
217
208
  __exportStar(require("./helpers/resolve-forward-curve-rate"), exports);
218
209
  __exportStar(require("./helpers/get-resolved-forward-curve-tiers"), exports);
219
210
  __exportStar(require("./helpers/get-fx-trading-policy"), exports);
211
+ ;
212
+ __exportStar(require("./clients/google-sheets-api-client"), exports);
213
+ __exportStar(require("./clients/binance-client"), exports);
214
+ __exportStar(require("./clients/kraken-client"), exports);
215
+ __exportStar(require("./helpers/get-user-helper"), exports);
216
+ __exportStar(require("./helpers/get-processor-fees"), exports);
217
+ __exportStar(require("./helpers/get-network-fees"), exports);
218
+ __exportStar(require("./helpers/calculate-aggregate-volume-and-revenue"), exports);
219
+ __exportStar(require("./helpers/calculate-volume-and-revenue"), exports);
220
+ __exportStar(require("./helpers/get-user"), exports);
@@ -71,6 +71,14 @@ const buildSTPMXNWithdrawal = (mongoose) => {
71
71
  },
72
72
  },
73
73
  });
74
+ // The STP withdrawal webhook resolves the document from the id nested in this
75
+ // array. Unindexed it is a collection scan, which is what let STP time out
76
+ // waiting on us and redeliver the same notification.
77
+ STPMXNWithdrawalSchema.index({ "STPWithdrawals.STPWithdrawalId": 1 });
78
+ // Both are looked up on the payout path before every withdrawal and on every
79
+ // cosigner notification.
80
+ STPMXNWithdrawalSchema.index({ orderId: 1 });
81
+ STPMXNWithdrawalSchema.index({ bulkBankPayoutId: 1 });
74
82
  STPMXNWithdrawalSchema.statics.build = (attrs) => {
75
83
  return new STPMXNWithdrawal(attrs);
76
84
  };
@@ -403,6 +403,13 @@ const buildOrder = (mongoose) => {
403
403
  orderSchema.index({ payoutAutoRetryAt: 1 }, { sparse: true });
404
404
  orderSchema.index({ userId: 1, "TWAP.sessionId": 1, createdAt: 1 });
405
405
  orderSchema.index({ brokerId: 1, "TWAP.sessionId": 1, createdAt: 1 });
406
+ // The stuck order scans (the admin task in admin-tasks and the payout
407
+ // auto-complete in orders) both select on status alone, which no index above
408
+ // has as a prefix, so each run scanned the whole collection. The first serves
409
+ // the side + status pairs the auto-complete looks for, the second gives the
410
+ // admin task its createdAt bound after the status bounds.
411
+ orderSchema.index({ status: 1, side: 1 });
412
+ orderSchema.index({ status: 1, createdAt: 1 });
406
413
  orderSchema.index({ clientReferenceId: 1 }, { sparse: true });
407
414
  orderSchema.index({ "paymentsReceived.blockchainTxId": 1 }, { sparse: true });
408
415
  // At most one order per real quoteId. Imported orders use quoteId "" and are
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2916",
3
+ "version": "1.0.2918",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",