@crediolabs/policy-builder-cli 0.4.0 → 0.5.1
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.
|
@@ -48,6 +48,24 @@ export async function runDeclareCommand(argv, flags) {
|
|
|
48
48
|
args.recipientArgIndex = Number(pairs['to-arg']);
|
|
49
49
|
if (pairs['allow-zero-cap'] !== undefined)
|
|
50
50
|
args.allowZeroCap = true;
|
|
51
|
+
// Slippage floor: `--min-out-ratio 99/100 --in-arg 0 --out-arg 1`. All four
|
|
52
|
+
// parts are required together - a ratio with no argument positions cannot
|
|
53
|
+
// be lowered, and guessing them would bound the wrong values silently.
|
|
54
|
+
if (pairs['min-out-ratio'] !== undefined) {
|
|
55
|
+
const [num, den] = String(pairs['min-out-ratio']).split('/');
|
|
56
|
+
if (!num || !den) {
|
|
57
|
+
throw missing('declare: --min-out-ratio must be `num/den`, e.g. 99/100 for a 1% floor');
|
|
58
|
+
}
|
|
59
|
+
if (pairs['in-arg'] === undefined || pairs['out-arg'] === undefined) {
|
|
60
|
+
throw missing('declare: --min-out-ratio also needs --in-arg <i> and --out-arg <j>');
|
|
61
|
+
}
|
|
62
|
+
args.minOutputRatio = {
|
|
63
|
+
num,
|
|
64
|
+
den,
|
|
65
|
+
inputArgIndex: Number(pairs['in-arg']),
|
|
66
|
+
outputArgIndex: Number(pairs['out-arg']),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
51
69
|
const res = runDeclarePolicy(args);
|
|
52
70
|
const data = formatToolResponse(res, flags, 'declare');
|
|
53
71
|
// Warnings go to stderr so `--json` stdout stays a clean envelope, but they
|
|
@@ -51,6 +51,24 @@ async function runDeclareCommand(argv, flags) {
|
|
|
51
51
|
args.recipientArgIndex = Number(pairs['to-arg']);
|
|
52
52
|
if (pairs['allow-zero-cap'] !== undefined)
|
|
53
53
|
args.allowZeroCap = true;
|
|
54
|
+
// Slippage floor: `--min-out-ratio 99/100 --in-arg 0 --out-arg 1`. All four
|
|
55
|
+
// parts are required together - a ratio with no argument positions cannot
|
|
56
|
+
// be lowered, and guessing them would bound the wrong values silently.
|
|
57
|
+
if (pairs['min-out-ratio'] !== undefined) {
|
|
58
|
+
const [num, den] = String(pairs['min-out-ratio']).split('/');
|
|
59
|
+
if (!num || !den) {
|
|
60
|
+
throw missing('declare: --min-out-ratio must be `num/den`, e.g. 99/100 for a 1% floor');
|
|
61
|
+
}
|
|
62
|
+
if (pairs['in-arg'] === undefined || pairs['out-arg'] === undefined) {
|
|
63
|
+
throw missing('declare: --min-out-ratio also needs --in-arg <i> and --out-arg <j>');
|
|
64
|
+
}
|
|
65
|
+
args.minOutputRatio = {
|
|
66
|
+
num,
|
|
67
|
+
den,
|
|
68
|
+
inputArgIndex: Number(pairs['in-arg']),
|
|
69
|
+
outputArgIndex: Number(pairs['out-arg']),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
54
72
|
const res = (0, run_1.runDeclarePolicy)(args);
|
|
55
73
|
const data = (0, output_ts_1.formatToolResponse)(res, flags, 'declare');
|
|
56
74
|
// Warnings go to stderr so `--json` stdout stays a clean envelope, but they
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crediolabs/policy-builder-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "CLI wrapper around the OZ policy-synth core (record + synthesize) for solo-dev and CI workflows.",
|
|
6
6
|
"type": "module",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"prepack": "bun run build"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@crediolabs/policy-synth": "0.
|
|
66
|
+
"@crediolabs/policy-synth": "0.5.1",
|
|
67
67
|
"@stellar/stellar-sdk": "14.4.0",
|
|
68
68
|
"zod": "3.25.76"
|
|
69
69
|
},
|
package/src/commands/declare.ts
CHANGED
|
@@ -59,6 +59,24 @@ export async function runDeclareCommand(
|
|
|
59
59
|
}
|
|
60
60
|
if (pairs['to-arg'] !== undefined) args.recipientArgIndex = Number(pairs['to-arg'])
|
|
61
61
|
if (pairs['allow-zero-cap'] !== undefined) args.allowZeroCap = true
|
|
62
|
+
// Slippage floor: `--min-out-ratio 99/100 --in-arg 0 --out-arg 1`. All four
|
|
63
|
+
// parts are required together - a ratio with no argument positions cannot
|
|
64
|
+
// be lowered, and guessing them would bound the wrong values silently.
|
|
65
|
+
if (pairs['min-out-ratio'] !== undefined) {
|
|
66
|
+
const [num, den] = String(pairs['min-out-ratio']).split('/')
|
|
67
|
+
if (!num || !den) {
|
|
68
|
+
throw missing('declare: --min-out-ratio must be `num/den`, e.g. 99/100 for a 1% floor')
|
|
69
|
+
}
|
|
70
|
+
if (pairs['in-arg'] === undefined || pairs['out-arg'] === undefined) {
|
|
71
|
+
throw missing('declare: --min-out-ratio also needs --in-arg <i> and --out-arg <j>')
|
|
72
|
+
}
|
|
73
|
+
args.minOutputRatio = {
|
|
74
|
+
num,
|
|
75
|
+
den,
|
|
76
|
+
inputArgIndex: Number(pairs['in-arg']),
|
|
77
|
+
outputArgIndex: Number(pairs['out-arg']),
|
|
78
|
+
}
|
|
79
|
+
}
|
|
62
80
|
|
|
63
81
|
const res = runDeclarePolicy(args)
|
|
64
82
|
const data = formatToolResponse(res, flags, 'declare') as DeclareResult
|