Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions scripts/invoke.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,24 @@ function parseArg(raw) {
if (type === "address") return nativeToScVal(new Address(value), { type: "address" });
if (type === "u32") return nativeToScVal(parseInt(value, 10), { type: "u32" });
if (type === "i128") return nativeToScVal(BigInt(value), { type: "i128" });
// Support Vec<(Address, u32)> for release() recipients parameter.
// Format: vec-tuple-address-u32:[["GADDR...",5000],["GADDR...",5000]]
if (type === "vec-tuple-address-u32") {
const parsed = JSON.parse(value);
if (!Array.isArray(parsed)) {
throw new Error("vec-tuple-address-u32 value must be a JSON array of [address, bps] pairs");
}
const tuples = parsed.map((pair) => {
if (!Array.isArray(pair) || pair.length !== 2) {
throw new Error("Each element must be a 2-element array [address, bps]");
}
return nativeToScVal(
[new Address(pair[0]), nativeToScVal(parseInt(pair[1], 10), { type: "u32" })],
{ type: "tuple" }
);
});
return nativeToScVal(tuples, { type: "vec" });
}
throw new Error(`Unknown arg type: ${type}`);
}

Expand Down