From b1157af9cd66878623ad1f9fadac862e4990901c Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 25 May 2023 01:20:56 +0200 Subject: Updated the lib for the new api --- lib/contracts.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 lib/contracts.js (limited to 'lib/contracts.js') diff --git a/lib/contracts.js b/lib/contracts.js new file mode 100644 index 0000000..9494595 --- /dev/null +++ b/lib/contracts.js @@ -0,0 +1,17 @@ +import * as api from './api.js'; + +export async function accept(ctx) { + return await api.send({endpoint: `/my/contracts/${ctx.id}/accept`, method: 'POST'}); +} + +export async function contracts() { + return await api.send({endpoint: '/my/contracts'}); +} + +export async function deliver(ctx) { + return await api.send({ endpoint: `/my/contracts/${ctx.contract}/deliver`, method: 'POST', payload: { + shipSymbol: ctx.ship, + tradeSymbol: ctx.good, + units: ctx.units, + }}); +} -- cgit v1.2.3