From 36cc33f9e96a38ecea98ac8d26275b4828347d80 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sat, 1 Jul 2023 23:13:13 +0200 Subject: Moved the nodejs agent to its own subfolder to make room for my haskell agent --- lib/contracts.js | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 lib/contracts.js (limited to 'lib/contracts.js') diff --git a/lib/contracts.js b/lib/contracts.js deleted file mode 100644 index 316e181..0000000 --- a/lib/contracts.js +++ /dev/null @@ -1,26 +0,0 @@ -import * as api from './api.js'; -import * as dbShips from '../database/ships.js'; - -export async function accept(ctx) { - return await api.send({endpoint: `/my/contracts/${ctx.contract}/accept`, method: 'POST'}); -} - -export async function contracts() { - return await api.send({endpoint: '/my/contracts'}); -} - -export async function deliver(ctx) { - const response = await api.send({ endpoint: `/my/contracts/${ctx.contract}/deliver`, method: 'POST', payload: { - shipSymbol: ctx.symbol, - tradeSymbol: ctx.good, - units: ctx.units, - }}); - if (response.error !== undefined) { - throw response; - } - dbShips.setShipCargo(ctx.symbol, response.data.cargo); -} - -export async function fulfill(ctx) { - return await api.send({ endpoint: `/my/contracts/${ctx.contract}/fulfill`, method: 'POST'}); -} -- cgit v1.2.3