@streamflow/stream 10.0.0-alpha.p313.4046054 → 10.0.0-alpha.p313.e531e2c

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.
package/README.md CHANGED
@@ -99,7 +99,7 @@ const solanaInteractParams = {
99
99
 
100
100
  ## Create a Vesting Stream
101
101
 
102
- Vesting Streams are a type of Stream used to linearly unlock a given amount of tokens over a period of time. You can specify the amount, cliff, start time and releasePeriod along with other configuration that controls who can transfer or cancel the contract. For a Stream to be considered Vesting in the Streamflow App it has to match the criteria from the `isVesting` helper function (or `buildStreamType` returns `StreamType.Vesting`). The cliff amount must not be too close to the total amount and it must not be a Dynamic token lock.
102
+ Vesting Streams are a type of Stream used to linearly unlock a given amount of tokens over a period of time. You can specify the amount, cliff, start time and releasePeriod along with other configuration that controls who can transfer or cancel the contract. For a Stream to be considered Vesting in the Streamflow App it has to match the criteria from the `isVesting` helper function (or `buildStreamType` returns `StreamType.Vesting`). The stream must not allow top-ups, the cliff amount must not be too close to the total amount and it must not be a Dynamic token lock.
103
103
 
104
104
  For more details creating a Stream with arbitrary configuration see [General Stream creation](#general-stream-creation).
105
105
  For creating multiple Streams at once see [Create Multiple Streams](#create-multiple-streams-at-once).
@@ -426,7 +426,7 @@ console.log(remaining);
426
426
  ```javascript
427
427
  const data: IGetAllData = {
428
428
  address: "99h00075bKjVg000000tLdk4w42NyG3Mv0000dc0M99",
429
- type: StreamType.All, // StreamType.Vesting, StreamType.Lock
429
+ type: StreamType.All, // StreamType.Vesting, StreamType.Lock, StreamType.Payment
430
430
  direction: StreamDirection.All, // StreamDirection.Outgoing, StreamDirection.Incoming
431
431
  };
432
432
 
@@ -59,8 +59,11 @@ var calculateUnlockedAmount = ({
59
59
  var isCliffCloseToDepositedAmount = (streamData) => {
60
60
  return streamData.cliffAmount.gte(streamData.depositedAmount.sub(new BN3__default.default(1)));
61
61
  };
62
+ var isPayment = (streamData) => {
63
+ return streamData.canTopup;
64
+ };
62
65
  var isVesting = (streamData) => {
63
- return !isCliffCloseToDepositedAmount(streamData) && !isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage);
66
+ return !streamData.canTopup && !isCliffCloseToDepositedAmount(streamData) && !isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage);
64
67
  };
65
68
  var isAligned = (stream) => {
66
69
  return "minPrice" in stream && "maxPrice" in stream && "minPercentage" in stream && "maxPercentage" in stream;
@@ -75,10 +78,13 @@ var isTokenLock = (streamData) => {
75
78
  return !streamData.canTopup && !streamData.automaticWithdrawal && !streamData.cancelableBySender && !streamData.cancelableByRecipient && !streamData.transferableBySender && (isCliffCloseToDepositedAmount(streamData) || isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage));
76
79
  };
77
80
  var buildStreamType = (streamData) => {
81
+ if (isVesting(streamData)) {
82
+ return "vesting" /* Vesting */;
83
+ }
78
84
  if (isTokenLock(streamData)) {
79
85
  return "lock" /* Lock */;
80
86
  }
81
- return "vesting" /* Vesting */;
87
+ return "payment" /* Payment */;
82
88
  };
83
89
  var decodeEndTime = (endTime) => {
84
90
  if (endTime.gt(new BN3__default.default(MAX_SAFE_UNIX_TIME_VALUE))) {
@@ -95,6 +101,7 @@ var StreamDirection = /* @__PURE__ */ ((StreamDirection2) => {
95
101
  })(StreamDirection || {});
96
102
  var StreamType = /* @__PURE__ */ ((StreamType2) => {
97
103
  StreamType2["All"] = "all";
104
+ StreamType2["Payment"] = "payment";
98
105
  StreamType2["Vesting"] = "vesting";
99
106
  StreamType2["Lock"] = "lock";
100
107
  return StreamType2;
@@ -4347,6 +4354,7 @@ exports.isAligned = isAligned;
4347
4354
  exports.isCliffCloseToDepositedAmount = isCliffCloseToDepositedAmount;
4348
4355
  exports.isCreateAlignedStreamData = isCreateAlignedStreamData;
4349
4356
  exports.isDynamicLock = isDynamicLock;
4357
+ exports.isPayment = isPayment;
4350
4358
  exports.isTokenLock = isTokenLock;
4351
4359
  exports.isVesting = isVesting;
4352
4360
  exports.sendAndConfirmStreamRawTransaction = sendAndConfirmStreamRawTransaction;