@usherlabs/cex-broker 0.3.2 → 0.3.3

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/README.md CHANGED
@@ -538,6 +538,11 @@ same gRPC status as the corresponding unary call.
538
538
  `loadMarkets`, market maker/taker defaults, or `broker.fees` as account
539
539
  commission. `FetchCurrency` requires one network and no longer returns an
540
540
  unscoped raw currency object.
541
+ Its `withdrawalPrecision` is the selected network's observed precision in
542
+ decimal places, or `null` when unavailable or unsupported. The broker normalizes
543
+ non-negative integer counts and exact power-of-ten increments; it never substitutes
544
+ currency-level precision. This observation supports precision-change warnings,
545
+ not automatic changes to an operator's configured withdrawal precision.
541
546
 
542
547
  These facts have distinct authority:
543
548
 
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.3.2",
3
- "gitHead": "a15ddc1a0b9e27d5f6f26291569d5e1011adb77c",
2
+ "version": "0.3.3",
3
+ "gitHead": "e292d6b1db98fefd49a0b2a5e1fb10b6a015844a",
4
4
  "protoSha256": "7dea012e0fb26e9f742219ace6d102d4eb126d4770ed2a8ca7cee6a41a40eff7",
5
5
  "evidenceSchemas": [
6
6
  "cex-trading-fee-evidence/v1",
@@ -12,17 +12,17 @@
12
12
  "src/proto/node.proto": "7dea012e0fb26e9f742219ace6d102d4eb126d4770ed2a8ca7cee6a41a40eff7",
13
13
  "src/proto/node.descriptor.ts": "ffadaf5c3f1906f74433940115dd6766719b943dcdc6b2102aebca636732c991",
14
14
  "src/helpers/constants.ts": "00670b063cd7ec0d0f9f78df55cfa32b093c364d084974ba3d2d862332e27c8a",
15
- "src/helpers/venue-evidence.ts": "ecc88a6d6aeedc5d66e72aee01f491ca839722ae68a3d439034f5c7ab618bd3b",
15
+ "src/helpers/venue-evidence.ts": "b3e249c8326e60422353637f695c53616bcbfb52c42cb656cad647f512ac3c05",
16
16
  "src/helpers/broker-execution-archive/redact.ts": "c1e44e81d6376360f1dae72063b618fde2630aac41bb90d25f0f2fcd5426d443",
17
17
  "src/helpers/grpc/status.ts": "5dd86e0e1235a0f2b870bad823afae939f6095a1c01f8d828a7e501823ec8686",
18
- "src/schemas/action-evidence.ts": "78c7b8676d6374d308a949cedbe416f1ef1c8819ffcb7429516a574d96ae4185",
18
+ "src/schemas/action-evidence.ts": "20ce5e9de19d998eccffe0d2074109791ebdd5d1aa9ee1315fd9f27a791a81e6",
19
19
  "src/schemas/action-payloads.ts": "ced19200fcf2936956909ecd8701290437576c9fa022bb3ee555cbc7a279aac5",
20
20
  "src/handlers/execute-action/batch.ts": "2d33eb6ed73f4a964bad5268b69a3e6486ffcdd5a489efc4e9fce4ecebe7b076",
21
21
  "src/handlers/execute-action/context.ts": "ba48f3351a3c016e775bf1b6b9d38f7d9dd4ca6aebf1bc4b6b873f5e1043b88d",
22
22
  "src/handlers/execute-action/handler.ts": "95b0f72473d74f854158f10f5ca599a03c13993c994adf5dd291f0988514170c",
23
23
  "src/handlers/execute-action/index.ts": "00c4a4e8fa8e5d292a61fa524e5187c1ad466f6a13d718770f8a70566771769a",
24
24
  "src/handlers/execute-action/registry.ts": "b870f5dda680266d599a0fc3ea56fce06d36e04e673cc09c26b6d82cd20e0b14",
25
- "src/handlers/execute-action/venue-evidence.ts": "95e61a928460e5e5a30fba63570fdf3446d43a120c1673799c79436108b060e4",
25
+ "src/handlers/execute-action/venue-evidence.ts": "ed8b613238a390b07a83557e52b153a89edc71f5fb08b16d6b5b506d2e232045",
26
26
  "src/handlers/execute-action/pass-through.ts": "d899ec47314f566df88c812e6a187245e038a17b584fd9f0d0a6b0e20eb75be5"
27
27
  }
28
28
  }
@@ -313229,6 +313229,26 @@ function decimalFractionToBasisPoints(value) {
313229
313229
  function canonicalOptionalDecimal(value, field) {
313230
313230
  return value === undefined || value === null ? undefined : canonicalNonnegativeDecimal(value, field);
313231
313231
  }
313232
+ function withdrawalPrecision(value) {
313233
+ if (typeof value === "number" && Number.isSafeInteger(value) && value >= 0) {
313234
+ return value;
313235
+ }
313236
+ if (typeof value !== "number" && typeof value !== "string") {
313237
+ return null;
313238
+ }
313239
+ const match = String(value).trim().replace(/^\+?\./, "0.").match(DECIMAL_PATTERN);
313240
+ if (!match) {
313241
+ return null;
313242
+ }
313243
+ const fraction = match[2] ?? "";
313244
+ const digits = `${match[1]}${fraction}`.replace(/^0+/, "");
313245
+ if (!/^10*$/.test(digits)) {
313246
+ return null;
313247
+ }
313248
+ const exponent = Number(match[3] ?? "0");
313249
+ const places = fraction.length - exponent - (digits.length - 1);
313250
+ return Number.isSafeInteger(exponent) && Number.isSafeInteger(places) && places >= 0 ? places : null;
313251
+ }
313232
313252
  function precisionIncrement(value, precisionMode, field) {
313233
313253
  if ((precisionMode === 2 || precisionMode === "DECIMAL_PLACES") && (typeof value === "number" || typeof value === "string")) {
313234
313254
  const decimalPlaces = Number(value);
@@ -313370,6 +313390,7 @@ var TransferNetworkEvidenceSchema = exports_external.object({
313370
313390
  depositAvailable: exports_external.boolean(),
313371
313391
  withdrawalAvailable: exports_external.boolean(),
313372
313392
  withdrawalFee: CanonicalDecimalStringSchema.nullable(),
313393
+ withdrawalPrecision: exports_external.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).nullable(),
313373
313394
  withdrawalLimits: exports_external.object({
313374
313395
  minimum: CanonicalDecimalStringSchema.nullable(),
313375
313396
  maximum: CanonicalDecimalStringSchema.nullable()
@@ -314227,6 +314248,7 @@ async function handleFetchCurrencyEvidence(ctx) {
314227
314248
  depositAvailable: network.deposit,
314228
314249
  withdrawalAvailable: network.withdraw,
314229
314250
  withdrawalFee: canonicalOptionalDecimal(network.fee, "withdrawal fee") ?? null,
314251
+ withdrawalPrecision: withdrawalPrecision(network.precision),
314230
314252
  withdrawalLimits: {
314231
314253
  minimum: canonicalOptionalDecimal(withdrawalLimits.min, "minimum withdrawal") ?? null,
314232
314254
  maximum: canonicalOptionalDecimal(withdrawalLimits.max, "maximum withdrawal") ?? null
@@ -316350,4 +316372,4 @@ program2.name("cex-broker").description("CLI to start the CEXBroker service").re
316350
316372
  });
316351
316373
  await program2.parseAsync(process.argv);
316352
316374
 
316353
- //# debugId=1B96662F2E51296364756E2164756E21
316375
+ //# debugId=37ECE49EF8321E6C64756E2164756E21