@streamflow/stream 5.2.1 → 5.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,16 +12,33 @@ interface ICalculateUnlockedAmount {
|
|
|
12
12
|
fundsUnlockedAtLastRateChange: BN;
|
|
13
13
|
}
|
|
14
14
|
export declare const calculateUnlockedAmount: ({ depositedAmount, cliff, cliffAmount, end, currentTimestamp, lastRateChangeTime, period, amountPerPeriod, fundsUnlockedAtLastRateChange, }: ICalculateUnlockedAmount) => BN;
|
|
15
|
+
export declare const isCliffCloseToDepositedAmount: (streamData: {
|
|
16
|
+
depositedAmount: BN;
|
|
17
|
+
cliffAmount: BN;
|
|
18
|
+
}) => boolean;
|
|
15
19
|
export declare const isPayment: (streamData: {
|
|
16
20
|
canTopup: boolean;
|
|
17
21
|
}) => boolean;
|
|
22
|
+
export declare const isVesting: (streamData: {
|
|
23
|
+
canTopup: boolean;
|
|
24
|
+
}) => boolean;
|
|
18
25
|
export declare const isTokenLock: (streamData: {
|
|
19
26
|
canTopup: boolean;
|
|
27
|
+
automaticWithdrawal: boolean;
|
|
28
|
+
cancelableBySender: boolean;
|
|
29
|
+
cancelableByRecipient: boolean;
|
|
30
|
+
transferableBySender: boolean;
|
|
31
|
+
transferableByRecipient: boolean;
|
|
20
32
|
depositedAmount: BN;
|
|
21
33
|
cliffAmount: BN;
|
|
22
34
|
}) => boolean;
|
|
23
35
|
export declare const buildStreamType: (streamData: {
|
|
24
36
|
canTopup: boolean;
|
|
37
|
+
automaticWithdrawal: boolean;
|
|
38
|
+
cancelableBySender: boolean;
|
|
39
|
+
cancelableByRecipient: boolean;
|
|
40
|
+
transferableBySender: boolean;
|
|
41
|
+
transferableByRecipient: boolean;
|
|
25
42
|
depositedAmount: BN;
|
|
26
43
|
cliffAmount: BN;
|
|
27
44
|
}) => StreamType;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.buildStreamType = exports.isTokenLock = exports.isPayment = exports.calculateUnlockedAmount = void 0;
|
|
6
|
+
exports.buildStreamType = exports.isTokenLock = exports.isVesting = exports.isPayment = exports.isCliffCloseToDepositedAmount = exports.calculateUnlockedAmount = void 0;
|
|
7
7
|
var bn_js_1 = __importDefault(require("bn.js"));
|
|
8
8
|
var types_1 = require("./types");
|
|
9
9
|
var calculateUnlockedAmount = function (_a) {
|
|
@@ -21,21 +21,35 @@ var calculateUnlockedAmount = function (_a) {
|
|
|
21
21
|
return streamed.lt(deposited) ? streamed : deposited;
|
|
22
22
|
};
|
|
23
23
|
exports.calculateUnlockedAmount = calculateUnlockedAmount;
|
|
24
|
+
var isCliffCloseToDepositedAmount = function (streamData) {
|
|
25
|
+
return streamData.cliffAmount.gte(streamData.depositedAmount.sub(new bn_js_1.default("1")));
|
|
26
|
+
};
|
|
27
|
+
exports.isCliffCloseToDepositedAmount = isCliffCloseToDepositedAmount;
|
|
24
28
|
var isPayment = function (streamData) {
|
|
25
29
|
return streamData.canTopup;
|
|
26
30
|
};
|
|
27
31
|
exports.isPayment = isPayment;
|
|
32
|
+
var isVesting = function (streamData) {
|
|
33
|
+
return !streamData.canTopup && !exports.isCliffCloseToDepositedAmount;
|
|
34
|
+
};
|
|
35
|
+
exports.isVesting = isVesting;
|
|
28
36
|
var isTokenLock = function (streamData) {
|
|
29
|
-
return (!streamData.canTopup &&
|
|
37
|
+
return (!streamData.canTopup &&
|
|
38
|
+
!streamData.automaticWithdrawal &&
|
|
39
|
+
!streamData.cancelableBySender &&
|
|
40
|
+
!streamData.cancelableByRecipient &&
|
|
41
|
+
!streamData.transferableBySender &&
|
|
42
|
+
!streamData.transferableByRecipient &&
|
|
43
|
+
(0, exports.isCliffCloseToDepositedAmount)(streamData));
|
|
30
44
|
};
|
|
31
45
|
exports.isTokenLock = isTokenLock;
|
|
32
46
|
var buildStreamType = function (streamData) {
|
|
33
|
-
if ((0, exports.
|
|
34
|
-
return types_1.StreamType.
|
|
47
|
+
if ((0, exports.isVesting)(streamData)) {
|
|
48
|
+
return types_1.StreamType.Vesting;
|
|
35
49
|
}
|
|
36
50
|
if ((0, exports.isTokenLock)(streamData)) {
|
|
37
51
|
return types_1.StreamType.Lock;
|
|
38
52
|
}
|
|
39
|
-
return types_1.StreamType.
|
|
53
|
+
return types_1.StreamType.Payment;
|
|
40
54
|
};
|
|
41
55
|
exports.buildStreamType = buildStreamType;
|
package/dist/sui/types.js
CHANGED
|
@@ -119,8 +119,7 @@ var Contract = /** @class */ (function () {
|
|
|
119
119
|
this.transferableBySender = meta.transferable_by_sender;
|
|
120
120
|
this.transferableByRecipient = meta.transferable_by_recipient;
|
|
121
121
|
this.canTopup = meta.can_topup;
|
|
122
|
-
|
|
123
|
-
this.name = Buffer.from(name, "hex").toString("utf8");
|
|
122
|
+
this.name = String.fromCharCode.apply(String, __spreadArray([], __read(meta.contract_name), false));
|
|
124
123
|
this.withdrawalFrequency = parseInt(meta.withdrawal_frequency);
|
|
125
124
|
this.closed = stream.closed;
|
|
126
125
|
this.currentPauseStart = parseInt(stream.current_pause_start);
|
package/package.json
CHANGED