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

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 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.
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.
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, StreamType.Payment
429
+ type: StreamType.All, // StreamType.Vesting, StreamType.Lock
430
430
  direction: StreamDirection.All, // StreamDirection.Outgoing, StreamDirection.Incoming
431
431
  };
432
432
 
@@ -59,11 +59,8 @@ 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
- };
65
62
  var isVesting = (streamData) => {
66
- return !streamData.canTopup && !isCliffCloseToDepositedAmount(streamData) && !isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage);
63
+ return !isCliffCloseToDepositedAmount(streamData) && !isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage);
67
64
  };
68
65
  var isAligned = (stream) => {
69
66
  return "minPrice" in stream && "maxPrice" in stream && "minPercentage" in stream && "maxPercentage" in stream;
@@ -78,13 +75,10 @@ var isTokenLock = (streamData) => {
78
75
  return !streamData.canTopup && !streamData.automaticWithdrawal && !streamData.cancelableBySender && !streamData.cancelableByRecipient && !streamData.transferableBySender && (isCliffCloseToDepositedAmount(streamData) || isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage));
79
76
  };
80
77
  var buildStreamType = (streamData) => {
81
- if (isVesting(streamData)) {
82
- return "vesting" /* Vesting */;
83
- }
84
78
  if (isTokenLock(streamData)) {
85
79
  return "lock" /* Lock */;
86
80
  }
87
- return "payment" /* Payment */;
81
+ return "vesting" /* Vesting */;
88
82
  };
89
83
  var decodeEndTime = (endTime) => {
90
84
  if (endTime.gt(new BN3__default.default(MAX_SAFE_UNIX_TIME_VALUE))) {
@@ -101,7 +95,6 @@ var StreamDirection = /* @__PURE__ */ ((StreamDirection2) => {
101
95
  })(StreamDirection || {});
102
96
  var StreamType = /* @__PURE__ */ ((StreamType2) => {
103
97
  StreamType2["All"] = "all";
104
- StreamType2["Payment"] = "payment";
105
98
  StreamType2["Vesting"] = "vesting";
106
99
  StreamType2["Lock"] = "lock";
107
100
  return StreamType2;
@@ -2671,7 +2664,7 @@ var SolanaStreamClient = class {
2671
2664
  return { ixs, txId: signature, metadataId };
2672
2665
  }
2673
2666
  async prepareCreateInstructions(streamParams, extParams) {
2674
- const { ixs, metadata, metadataPubKey } = isCreateAlignedStreamData(streamParams) ? await this.prepareCreateAlignedUnlockInstructions(streamParams, extParams) : await this.prepareCreateStreamInstructions(streamParams, extParams);
2667
+ const { ixs, metadata, metadataPubKey } = isCreateAlignedStreamData(streamParams) ? await this.prepareCreateAlignedUnlockInstructions(streamParams, extParams) : await this.prepareCreateLinearStreamInstructions(streamParams, extParams);
2675
2668
  return { ixs, metadata, metadataPubKey };
2676
2669
  }
2677
2670
  async prepareCreateAlignedUnlockInstructions(streamParams, extParams) {
@@ -2781,7 +2774,7 @@ var SolanaStreamClient = class {
2781
2774
  * @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
2782
2775
  * @returns Create stream instructions
2783
2776
  */
2784
- async prepareCreateStreamInstructions({
2777
+ async prepareCreateLinearStreamInstructions({
2785
2778
  recipient,
2786
2779
  tokenId: mint,
2787
2780
  start,
@@ -3334,7 +3327,7 @@ var SolanaStreamClient = class {
3334
3327
  }
3335
3328
  const { sender: senderPublicKey } = decodeStream(account.data);
3336
3329
  const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, senderPublicKey);
3337
- const ixs = isAlignedUnlock ? await this.prepareCancelAlignedUnlockInstructions(cancelData, extParams) : await this.prepareCancelStreamInstructions(cancelData, extParams);
3330
+ const ixs = isAlignedUnlock ? await this.prepareCancelAlignedUnlockInstructions(cancelData, extParams) : await this.prepareCancelLinearStream(cancelData, extParams);
3338
3331
  return ixs;
3339
3332
  }
3340
3333
  /**
@@ -3382,7 +3375,7 @@ var SolanaStreamClient = class {
3382
3375
  * @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
3383
3376
  * @returns Transaction instructions
3384
3377
  */
3385
- async prepareCancelStreamInstructions({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
3378
+ async prepareCancelLinearStream({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
3386
3379
  common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
3387
3380
  const streamPublicKey = new web3_js.PublicKey(id);
3388
3381
  const escrowAcc = await this.connection.getAccountInfo(streamPublicKey);
@@ -4354,7 +4347,6 @@ exports.isAligned = isAligned;
4354
4347
  exports.isCliffCloseToDepositedAmount = isCliffCloseToDepositedAmount;
4355
4348
  exports.isCreateAlignedStreamData = isCreateAlignedStreamData;
4356
4349
  exports.isDynamicLock = isDynamicLock;
4357
- exports.isPayment = isPayment;
4358
4350
  exports.isTokenLock = isTokenLock;
4359
4351
  exports.isVesting = isVesting;
4360
4352
  exports.sendAndConfirmStreamRawTransaction = sendAndConfirmStreamRawTransaction;