@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 +5 -0
- package/dist/build-metadata.json +5 -5
- package/dist/commands/cli.js +23 -1
- package/dist/commands/cli.js.map +5 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +23 -1
- package/dist/index.js.map +5 -5
- package/dist/schemas/action-evidence.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -233,6 +233,7 @@ export declare const TransferNetworkEvidenceSchema: z.ZodObject<{
|
|
|
233
233
|
depositAvailable: z.ZodBoolean;
|
|
234
234
|
withdrawalAvailable: z.ZodBoolean;
|
|
235
235
|
withdrawalFee: z.ZodNullable<z.ZodString>;
|
|
236
|
+
withdrawalPrecision: z.ZodNullable<z.ZodNumber>;
|
|
236
237
|
withdrawalLimits: z.ZodObject<{
|
|
237
238
|
minimum: z.ZodNullable<z.ZodString>;
|
|
238
239
|
maximum: z.ZodNullable<z.ZodString>;
|
package/dist/index.js
CHANGED
|
@@ -311118,6 +311118,26 @@ function decimalFractionToBasisPoints(value) {
|
|
|
311118
311118
|
function canonicalOptionalDecimal(value, field) {
|
|
311119
311119
|
return value === undefined || value === null ? undefined : canonicalNonnegativeDecimal(value, field);
|
|
311120
311120
|
}
|
|
311121
|
+
function withdrawalPrecision(value) {
|
|
311122
|
+
if (typeof value === "number" && Number.isSafeInteger(value) && value >= 0) {
|
|
311123
|
+
return value;
|
|
311124
|
+
}
|
|
311125
|
+
if (typeof value !== "number" && typeof value !== "string") {
|
|
311126
|
+
return null;
|
|
311127
|
+
}
|
|
311128
|
+
const match = String(value).trim().replace(/^\+?\./, "0.").match(DECIMAL_PATTERN);
|
|
311129
|
+
if (!match) {
|
|
311130
|
+
return null;
|
|
311131
|
+
}
|
|
311132
|
+
const fraction = match[2] ?? "";
|
|
311133
|
+
const digits = `${match[1]}${fraction}`.replace(/^0+/, "");
|
|
311134
|
+
if (!/^10*$/.test(digits)) {
|
|
311135
|
+
return null;
|
|
311136
|
+
}
|
|
311137
|
+
const exponent = Number(match[3] ?? "0");
|
|
311138
|
+
const places = fraction.length - exponent - (digits.length - 1);
|
|
311139
|
+
return Number.isSafeInteger(exponent) && Number.isSafeInteger(places) && places >= 0 ? places : null;
|
|
311140
|
+
}
|
|
311121
311141
|
function precisionIncrement(value, precisionMode, field) {
|
|
311122
311142
|
if ((precisionMode === 2 || precisionMode === "DECIMAL_PLACES") && (typeof value === "number" || typeof value === "string")) {
|
|
311123
311143
|
const decimalPlaces = Number(value);
|
|
@@ -311259,6 +311279,7 @@ var TransferNetworkEvidenceSchema = exports_external.object({
|
|
|
311259
311279
|
depositAvailable: exports_external.boolean(),
|
|
311260
311280
|
withdrawalAvailable: exports_external.boolean(),
|
|
311261
311281
|
withdrawalFee: CanonicalDecimalStringSchema.nullable(),
|
|
311282
|
+
withdrawalPrecision: exports_external.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).nullable(),
|
|
311262
311283
|
withdrawalLimits: exports_external.object({
|
|
311263
311284
|
minimum: CanonicalDecimalStringSchema.nullable(),
|
|
311264
311285
|
maximum: CanonicalDecimalStringSchema.nullable()
|
|
@@ -312116,6 +312137,7 @@ async function handleFetchCurrencyEvidence(ctx) {
|
|
|
312116
312137
|
depositAvailable: network.deposit,
|
|
312117
312138
|
withdrawalAvailable: network.withdraw,
|
|
312118
312139
|
withdrawalFee: canonicalOptionalDecimal(network.fee, "withdrawal fee") ?? null,
|
|
312140
|
+
withdrawalPrecision: withdrawalPrecision(network.precision),
|
|
312119
312141
|
withdrawalLimits: {
|
|
312120
312142
|
minimum: canonicalOptionalDecimal(withdrawalLimits.min, "minimum withdrawal") ?? null,
|
|
312121
312143
|
maximum: canonicalOptionalDecimal(withdrawalLimits.max, "maximum withdrawal") ?? null
|
|
@@ -314181,4 +314203,4 @@ export {
|
|
|
314181
314203
|
Action
|
|
314182
314204
|
};
|
|
314183
314205
|
|
|
314184
|
-
//# debugId=
|
|
314206
|
+
//# debugId=8B3E6C76C52F584E64756E2164756E21
|