summaryrefslogtreecommitdiff
path: root/lib/contracts.js
blob: abf32b3c3680f08b0a18766150422ca31c6ce4fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import * as api from './api.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) {
	return await api.send({ endpoint: `/my/contracts/${ctx.contract}/deliver`, method: 'POST', payload: {
		shipSymbol: ctx.symbol,
		tradeSymbol: ctx.good,
		units: ctx.units,
	}});
}

export async function fulfill(ctx) {
	return await api.send({ endpoint: `/my/contracts/${ctx.contract}/fulfill`, method: 'POST'});
}