summaryrefslogtreecommitdiff
path: root/lib/contracts.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/contracts.js17
1 files changed, 17 insertions, 0 deletions
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,
+ }});
+}