MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / postTxn

Function postTxn

tests/loadtest/script.js:222–251  ·  view source on GitHub ↗
(source, destination)

Source from the content-addressed store, hash-verified

220}
221
222function postTxn(source, destination) {
223 var amount = Math.floor(Math.random() * (1000 - 100 + 1)) + 100; // 100..1000
224 var payload = JSON.stringify({
225 amount: 100,
226 description: "load test",
227 precision: 100,
228 allow_overdraft: true,
229 inflight: true,
230 reference: uuidv4(),
231 currency: "USD",
232 source: source,
233 destination: destination,
234 });
235
236 var headers = { "Content-Type": "application/json" };
237 if (API_KEY) {
238 headers["X-LedgerForge-Key"] = API_KEY;
239 }
240 var res = http.post(URL, payload, {
241 headers: headers,
242 timeout: "30s",
243 tags: { endpoint: "transactions" },
244 });
245
246 check(res, {
247 "is status 201": function (r) {
248 return r.status === 201;
249 },
250 });
251}
252
253export default function () {
254 // baseline, ramp, soak, spike use this

Callers 5

script.jsFile · 0.85
hotTrafficFunction · 0.85
randomTrafficFunction · 0.85
hotSourceTrafficFunction · 0.85
hotDestinationTrafficFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected