Skip to content

Commit e4edd6e

Browse files
committed
looprpc: add scriptable autoloop RPC fields
Add new fields to LiquidityParameters for scriptable autoloop: - scriptable_autoloop (bool): Enable scriptable autoloop mode - scriptable_script (string): The Starlark script content - scriptable_tick_interval_sec (uint64): Custom tick interval These fields allow clients to configure scriptable autoloop via the SetLiquidityParams RPC. The script is validated on the server side before being accepted.
1 parent c5a63c1 commit e4edd6e

File tree

3 files changed

+82
-2
lines changed

3 files changed

+82
-2
lines changed

looprpc/client.pb.go

Lines changed: 43 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

looprpc/client.proto

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,32 @@ message LiquidityParameters {
12871287
considered for easy autoloop swaps.
12881288
*/
12891289
repeated bytes easy_autoloop_excluded_peers = 27;
1290+
1291+
/*
1292+
Set to true to enable scriptable autoloop using Starlark scripts. If set,
1293+
all channel/peer rules and easy autoloop will be overridden and the client
1294+
will evaluate the configured Starlark script on each tick to determine
1295+
swaps. This mode is mutually exclusive with easy_autoloop and threshold
1296+
rules. Starlark is a Python-like language that supports variables,
1297+
functions, loops, and sorting - making it much more readable and powerful
1298+
than simple expressions.
1299+
*/
1300+
bool scriptable_autoloop = 28;
1301+
1302+
/*
1303+
The Starlark script to evaluate on each autoloop tick. Required if
1304+
scriptable_autoloop is true. The script must set a 'decisions' variable
1305+
to a list of swap decisions using the loop_out() and loop_in() helper
1306+
functions. See documentation for available context variables (channels,
1307+
peers, total_local, restrictions, etc.) and helper functions.
1308+
*/
1309+
string scriptable_script = 29;
1310+
1311+
/*
1312+
Optional custom tick interval in seconds for scriptable autoloop mode.
1313+
If 0 or not set, uses the default 20-minute interval.
1314+
*/
1315+
uint64 scriptable_tick_interval_sec = 30;
12901316
}
12911317

12921318
message EasyAssetAutoloopParams {

looprpc/client.swagger.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,6 +1796,19 @@
17961796
"format": "byte"
17971797
},
17981798
"description": "A list of peers (their public keys) that should be excluded from the easy\nautoloop run. If set, channels connected to these peers won't be\nconsidered for easy autoloop swaps."
1799+
},
1800+
"scriptable_autoloop": {
1801+
"type": "boolean",
1802+
"description": "Set to true to enable scriptable autoloop using Starlark scripts. If set,\nall channel/peer rules and easy autoloop will be overridden and the client\nwill evaluate the configured Starlark script on each tick to determine\nswaps. This mode is mutually exclusive with easy_autoloop and threshold\nrules. Starlark is a Python-like language that supports variables,\nfunctions, loops, and sorting - making it much more readable and powerful\nthan simple expressions."
1803+
},
1804+
"scriptable_script": {
1805+
"type": "string",
1806+
"description": "The Starlark script to evaluate on each autoloop tick. Required if\nscriptable_autoloop is true. The script must set a 'decisions' variable\nto a list of swap decisions using the loop_out() and loop_in() helper\nfunctions. See documentation for available context variables (channels,\npeers, total_local, restrictions, etc.) and helper functions."
1807+
},
1808+
"scriptable_tick_interval_sec": {
1809+
"type": "string",
1810+
"format": "uint64",
1811+
"description": "Optional custom tick interval in seconds for scriptable autoloop mode.\nIf 0 or not set, uses the default 20-minute interval."
17991812
}
18001813
}
18011814
},

0 commit comments

Comments
 (0)