forked from urbit/azimuth-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linearSR.js
88 lines (76 loc) · 3.08 KB
/
linearSR.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/***
* linearSR API
* @module linearSR
*/
const internal = require('./internal/linearSR');
/**
* Return the details of a batch.
* @param {Object} contracts - An Urbit contracts object.
* @param {String} address - The participant/registered address for the batch.
* @return {Promise<Object>} A batch object, with windup, rate, rateUnit,
* amount, withdrawn.
*/
module.exports.getBatch = internal.getBatch;
/**
* Return the list of stars that have been deposited into, but not yet
* withdrawn from a batch.
* @param {Object} contracts - An Urbit contracts object.
* @param {String} address - The participant/registered address for the batch.
* @return {Promise<Array<Number>>} The stars left in the batch.
*/
module.exports.getRemainingStars = internal.getRemainingStars;
/**
* Return whether the amount of stars deposited into the batch checks out.
* @param {Object} contracts - An Urbit contracts object.
* @param {String} address - The participant/registered address for the batch.
* @return {Promise<Bool>} true if sufficient stars have been deposited.
*/
module.exports.verifyBalance = internal.verifyBalance;
/**
* Return the timestamp at which the release was started.
* @param {Object} contracts - An Urbit contracts object.
* @return {Promise<Number>} A timestamp.
*/
module.exports.getStartTime = internal.getStartTime;
/**
* Return the amount of stars a participant is allowed to withdraw from their
* batch at the current time.
* @param {Object} contracts - An Urbit contracts object.
* @param {String} address - The participant/registered address for the batch.
* @return {Promise<Number>} the withdraw limit.
*/
module.exports.getWithdrawLimit = internal.getWithdrawLimit;
/**
* Return the address this batch can be transferred to.
* @param {Object} contracts - An Urbit contracts object.
* @param {String} address - The participant/registered address for the batch.
* @return {Promise<String>} The approved transfer address, 0x0 for none.
*/
module.exports.getApprovedTransfer = internal.getApprovedTransfer;
/**
* Approve the transfer of a batch to another address.
* @param {Object} contracts - An Urbit contracts object.
* @param {String} address - The address to transfer to.
* @return {Object} An unsigned transaction object.
*/
module.exports.approveBatchTransfer = internal.approveBatchTransfer;
/**
* Make an approved transfer of the specified batch to the caller's address.
* @param {Object} contracts - An Urbit contracts object.
* @param {String} address - The address to transfer from.
* @return {Object} An unsigned transaction object.
*/
module.exports.transferBatch = internal.transferBatch;
/**
* Withdraw one star to the caller's address.
* @param {Object} contracts - An Urbit contracts object.
* @return {Object} An unsigned transaction object.
*/
module.exports.withdraw = internal.withdraw;
/**
* Withdraw one star to the specified address.
* @param {Object} contracts - An Urbit contracts object.
* @param {String} address - The address to withdraw to.
* @return {Object} An unsigned transaction object.
*/
module.exports.withdrawTo = internal.withdrawTo;