Skip to content

Commit

Permalink
Generate bids from mini-template
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardobl committed Jun 13, 2024
1 parent 8054922 commit b23f3a5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/runtime/PluginRepo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ export default class PluginRepo{
allowedHostsTemplate+=`["param", "allow-host", "${escapeString(host)}"],\n`;
}
}

let bidsTemplate="";
if(meta["prices"]){
for(const price of meta["prices"]){
bidsTemplate+=`["bid", "${price["amount"]}", "${price["currency"]||"bitcoin"}", "${price["protocol"]||"lightning"}"],\n`;
}
}


template = `
Expand All @@ -102,6 +109,7 @@ export default class PluginRepo{
["param","run-on", "openagents/extism-runtime" ],
["param","main","${escapeString(main)}"],
${allowedHostsTemplate.trim()}
${bidsTemplate.trim()}
["i", "${escapeString(input)}", "text", ""],
["expiration", "{{{sys.expiration_timestamp_seconds}}}"]
],
Expand Down

0 comments on commit b23f3a5

Please sign in to comment.