MCPcopy Create free account
hub / github.com/AmazingAng/PolyWorld / createTradeSession

Function createTradeSession

src/lib/tradeSession.ts:34–58  ·  view source on GitHub ↗
(input: {
  address: string;
  proxyAddress: string;
  creds: L2Creds;
})

Source from the content-addressed store, hash-verified

32}
33
34export function createTradeSession(input: {
35 address: string;
36 proxyAddress: string;
37 creds: L2Creds;
38}): TradeSession {
39 const now = Date.now();
40 cleanupExpiredSessions(now);
41
42 const sessionToken = randomUUID();
43 sessions.set(sessionToken, {
44 sessionToken,
45 address: input.address,
46 proxyAddress: input.proxyAddress,
47 creds: input.creds,
48 createdAt: now,
49 lastAccessedAt: now,
50 expiresAt: now + SESSION_IDLE_TTL_MS,
51 });
52
53 return {
54 sessionToken,
55 address: input.address,
56 proxyAddress: input.proxyAddress,
57 };
58}
59
60export function getTradeSession(
61 sessionToken: string,

Callers 1

POSTFunction · 0.90

Calls 2

cleanupExpiredSessionsFunction · 0.85
setMethod · 0.45

Tested by

no test coverage detected