@streamflow/stream 13.3.1-alpha.p371.561653f → 13.4.0

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.
@@ -1,5 +1,5 @@
1
- export { f as Account, g as AlignedContract, h as AlignedProxyErrorCode, A as AlignedStream, i as AlignedStreamData, j as AlignedUnlocksContract, k as BatchCreationItem, l as BatchExecuteResult, m as BatchInstructionResult, B as BatchItem, n as BatchItemError, a as BatchItemResult, o as BatchItemSuccess, p as BuildTransactionFn, q as BuildTransactionOptions, r as BuiltTransaction, C as CancelFn, s as ChangeOracleParams, t as ClientCreationOptions, u as Contract, v as ContractErrorCode, w as CreateBatchFn, x as CreateFn, y as CreateInstructionResult, z as CreateParams, E as CreateTestOracleParams, D as DecodedStream, F as Env, G as ExecuteBatchFn, H as ExecuteBatchSequentialFn, J as ExecuteFn, K as ExecutionEnv, L as IAlignedStreamConfig, M as IBaseStreamConfig, N as ICancelData, O as IClaimRoutedFeeData, d as ICreateAlignedStreamData, P as ICreateExt, Q as ICreateLinearStreamData, T as ICreateLockBatchParams, U as ICreateLockParams, V as ICreateMultiError, W as ICreateMultipleAlignedStreamData, X as ICreateMultipleLinearStreamData, Y as ICreateMultipleStreamData, Z as ICreateResult, c as ICreateStreamData, _ as ICreateStreamExt, $ as ICreateStreamInstructions, a0 as ICreateVestingBatchParams, a1 as ICreateVestingParams, a2 as IFees, a3 as IGetAllData, a4 as IGetFeesData, a5 as IGetOneData, a6 as IInteractData, a7 as IInteractStreamExt, a8 as ILockBatchRecipient, a9 as IMultiTransactionResult, aa as IPrepareCreateStreamExt, ab as IPrepareStreamExt, ac as IPrepareTopUpstreamExt, ad as IRecipient, e as ISearchStreams, ae as ITopUpData, af as ITopUpStreamExt, ag as ITransactionExtWithInstructions, ah as ITransactionResult, ai as ITransferData, I as IUpdateData, aj as IVestingBatchRecipient, ak as IWithdrawData, al as InstructionGenerator, am as InstructionResult, an as Invoker, ao as LinearStream, ap as MetadataRecipientHashMap, aq as NativeOptions, ar as OracleType, as as OracleTypeName, R as RoutedFeeDestination, at as SignFn, au as SolanaStreamClient, b as Stream, av as StreamClientOptions, aw as StreamClientOptionsWithConnection, ax as StreamDirection, S as StreamType, ay as TestOracle, az as TopupFn, aA as TransactionSchedulingOptions, aB as TransferFn, aC as UpdateFn, aD as UpdateTestOracleParams, aE as WithdrawFn, aF as buildLockBatchParams, aG as buildLockParams, aH as buildTransaction, aI as buildVestingBatchParams, aJ as buildVestingParams, aK as cancel, aL as computeAmountPerPeriod, aM as create, aN as createBatch, aO as createClientFromEnv, aP as createLock, aQ as createLockBatch, aR as createVesting, aS as createVestingBatch, aT as execute, aU as executeBatch, aV as executeBatchSequential, aW as resolveConnection, aX as resolveDuration, aY as sign, aZ as topup, a_ as transfer, a$ as update, b0 as withdraw } from './index-B2NHAfM3.cjs';
2
- export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, ApiClient, ApiClientOptions, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, Chain, ContractSchema, ContractType, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, DynamicContractSchema, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, GetContractsOptions, MAX_SAFE_UNIX_TIME_VALUE, METADATA_SEED, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, PriceOracleType, REPOPULATED_METADATA_SEED, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_OLD_METADATA_KEY, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, TabulariumContract, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, claimRoutedFeeStreamInstruction, createClient, createStreamInstruction, createStreamV2Instruction, createUncheckedStreamInstruction, createUncheckedStreamV2Instruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveRepopulatedMetadataPDA, deriveStreamMetadataPDA, deriveTestOraclePDA, extractSolanaErrorCode, getMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, timelockIDL, topupStreamInstruction, transferStreamInstruction, transformContract, updateStreamInstruction, withdrawStreamInstruction } from './solana/index.cjs';
1
+ export { f as Account, g as AlignedContract, h as AlignedProxyErrorCode, A as AlignedStream, i as AlignedStreamData, j as AlignedUnlocksContract, k as BatchCreationItem, l as BatchExecuteResult, m as BatchInstructionResult, B as BatchItem, n as BatchItemError, a as BatchItemResult, o as BatchItemSuccess, p as BuildTransactionFn, q as BuildTransactionOptions, r as BuiltTransaction, C as CancelFn, s as ChangeOracleParams, t as ClientCreationOptions, u as Contract, v as ContractErrorCode, w as CreateBatchFn, x as CreateFn, y as CreateInstructionResult, z as CreateParams, E as CreateTestOracleParams, D as DecodedStream, F as Env, G as ExecuteBatchFn, H as ExecuteBatchSequentialFn, J as ExecuteFn, K as ExecutionEnv, L as IAlignedStreamConfig, M as IBaseStreamConfig, N as ICancelData, O as IClaimRoutedFeeData, d as ICreateAlignedStreamData, P as ICreateExt, Q as ICreateLinearStreamData, T as ICreateLockBatchParams, U as ICreateLockParams, V as ICreateMultiError, W as ICreateMultipleAlignedStreamData, X as ICreateMultipleLinearStreamData, Y as ICreateMultipleStreamData, Z as ICreateResult, c as ICreateStreamData, _ as ICreateStreamExt, $ as ICreateStreamInstructions, a0 as ICreateVestingBatchParams, a1 as ICreateVestingParams, a2 as IFees, a3 as IGetAllData, a4 as IGetFeesData, a5 as IGetOneData, a6 as IInteractData, a7 as IInteractStreamExt, a8 as ILockBatchRecipient, a9 as IMultiTransactionResult, aa as IPrepareCreateStreamExt, ab as IPrepareStreamExt, ac as IPrepareTopUpstreamExt, ad as IRecipient, e as ISearchStreams, ae as ITopUpData, af as ITopUpStreamExt, ag as ITransactionExtWithInstructions, ah as ITransactionResult, ai as ITransferData, I as IUpdateData, aj as IVestingBatchRecipient, ak as IWithdrawData, al as InstructionGenerator, am as InstructionResult, an as Invoker, ao as LinearStream, ap as MetadataRecipientHashMap, aq as NativeOptions, ar as OracleType, as as OracleTypeName, R as RoutedFeeDestination, at as SignFn, au as SolanaStreamClient, b as Stream, av as StreamClientOptions, aw as StreamClientOptionsWithConnection, ax as StreamDirection, S as StreamType, ay as TestOracle, az as TopupFn, aA as TransactionSchedulingOptions, aB as TransferFn, aC as UpdateFn, aD as UpdateTestOracleParams, aE as WithdrawFn, aF as buildLockBatchParams, aG as buildLockParams, aH as buildTransaction, aI as buildVestingBatchParams, aJ as buildVestingParams, aK as cancel, aL as computeAmountPerPeriod, aM as create, aN as createBatch, aO as createClientFromEnv, aP as createLock, aQ as createLockBatch, aR as createVesting, aS as createVestingBatch, aT as execute, aU as executeBatch, aV as executeBatchSequential, aW as resolveConnection, aX as resolveDuration, aY as sign, aZ as topup, a_ as transfer, a$ as update, b0 as withdraw } from './index-BqHEM38f.cjs';
2
+ export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, ApiClient, ApiClientOptions, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, Chain, ContractSchema, ContractType, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, DynamicContractSchema, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, GetContractsOptions, MAX_SAFE_UNIX_TIME_VALUE, METADATA_SEED, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, PriceOracleType, REPOPULATED_METADATA_SEED, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_OLD_METADATA_KEY, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, TabulariumContract, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, claimRoutedFeeStreamInstruction, createClient, createStreamInstruction, createStreamV2Instruction, createUncheckedStreamInstruction, createUncheckedStreamV2Instruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveRepopulatedMetadataPDA, deriveStreamMetadataPDA, deriveTestOraclePDA, encodeStreamName, encodeStreamNameAsArray, extractSolanaErrorCode, getMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, timelockIDL, topupStreamInstruction, transferStreamInstruction, transformContract, updateStreamInstruction, withdrawStreamInstruction } from './solana/index.cjs';
3
3
  export { ContractError, ICluster, getBN, getNumberFromBN } from '@streamflow/common';
4
4
  import '@solana/wallet-adapter-base';
5
5
  import '@solana/web3.js';
@@ -475,7 +475,13 @@ var encodeUpdateStream = (values, data) => {
475
475
  structs.push(BufferLayout__namespace.u8("cancelable_by_sender_exists"));
476
476
  structs.push(BufferLayout__namespace.u8("cancelable_by_sender"));
477
477
  } else {
478
- structs.push(BufferLayout__namespace.u8("cancelable_by_sender"));
478
+ structs.push(BufferLayout__namespace.u8("cancelable_by_sender_exists"));
479
+ }
480
+ if (values.stream_name) {
481
+ structs.push(BufferLayout__namespace.u8("stream_name_exists"));
482
+ structs.push(BufferLayout__namespace.blob(64, "stream_name"));
483
+ } else {
484
+ structs.push(BufferLayout__namespace.u8("stream_name_exists"));
479
485
  }
480
486
  return BufferLayout__namespace.struct(structs).encode(
481
487
  {
@@ -490,7 +496,9 @@ var encodeUpdateStream = (values, data) => {
490
496
  transferable_by_recipient_exists: values.transferable_by_recipient !== void 0 ? 1 : 0,
491
497
  transferable_by_recipient: values.transferable_by_recipient ?? 0,
492
498
  cancelable_by_sender_exists: values.cancelable_by_sender !== void 0 ? 1 : 0,
493
- cancelable_by_sender: values.cancelable_by_sender ?? 0
499
+ cancelable_by_sender: values.cancelable_by_sender ?? 0,
500
+ stream_name_exists: values.stream_name ? 1 : 0,
501
+ stream_name: values.stream_name ?? 0
494
502
  },
495
503
  data
496
504
  );
@@ -507,6 +515,13 @@ var calculateTotalAmountToDeposit = (depositedAmount, totalFee) => {
507
515
  const totalFeeNormalized = new BN3__default.default(totalFee * FEE_NORMALIZER);
508
516
  return depositedAmount.mul(totalFeeNormalized.add(FEE_MULTIPLIER)).div(FEE_MULTIPLIER);
509
517
  };
518
+ var encodeStreamName = (name) => {
519
+ const encoded = new TextEncoder().encode(name);
520
+ return Buffer.alloc(64).fill(encoded, 0, encoded.byteLength);
521
+ };
522
+ var encodeStreamNameAsArray = (name) => {
523
+ return Array.from(encodeStreamName(name));
524
+ };
510
525
  var decodeStream = (buf) => {
511
526
  const raw = streamLayout.decode(buf);
512
527
  return {
@@ -650,8 +665,6 @@ var createStreamInstruction = async (data, programId, accounts) => {
650
665
  keys.push({ pubkey: accounts.partnerLink.pubkey, isSigner: accounts.partnerLink.isSigner, isWritable: false });
651
666
  }
652
667
  let bufferData = buffer.Buffer.alloc(createStreamLayout.span);
653
- const encodedUIntArray = new TextEncoder().encode(data.name);
654
- const streamNameBuffer = buffer.Buffer.alloc(64).fill(encodedUIntArray, 0, encodedUIntArray.byteLength);
655
668
  const decodedData = {
656
669
  start_time: data.start.toArrayLike(buffer.Buffer, "le", 8),
657
670
  net_amount_deposited: data.depositedAmount.toArrayLike(buffer.Buffer, "le", 8),
@@ -669,7 +682,7 @@ var createStreamInstruction = async (data, programId, accounts) => {
669
682
  can_update_rate: Number(data.canUpdateRate),
670
683
  _can_update_rate_discriminator: 1,
671
684
  pausable: Number(data.canPause),
672
- stream_name: streamNameBuffer,
685
+ stream_name: encodeStreamName(data.name),
673
686
  withdraw_frequency: data.withdrawFrequency.toArrayLike(buffer.Buffer, "le", 8)
674
687
  };
675
688
  const encodeLength = createStreamLayout.encode(decodedData, bufferData);
@@ -930,7 +943,8 @@ var updateStreamInstruction = async (params, programId, { authority, metadata, w
930
943
  amount_per_period: params.amountPerPeriod ? params.amountPerPeriod.toArrayLike(buffer.Buffer, "le", 8) : void 0,
931
944
  transferable_by_sender: params.transferableBySender !== void 0 ? Number(params.transferableBySender) : void 0,
932
945
  transferable_by_recipient: params.transferableByRecipient !== void 0 ? Number(params.transferableByRecipient) : void 0,
933
- cancelable_by_sender: params.cancelableBySender !== void 0 ? Number(params.cancelableBySender) : void 0
946
+ cancelable_by_sender: params.cancelableBySender !== void 0 ? Number(params.cancelableBySender) : void 0,
947
+ stream_name: params.name !== void 0 ? encodeStreamName(params.name) : void 0
934
948
  };
935
949
  const encodeLength = encodeUpdateStream(decodedData, data);
936
950
  data = data.slice(0, encodeLength);
@@ -3057,6 +3071,17 @@ var streamflow_aligned_unlocks_default = {
3057
3071
  type: {
3058
3072
  option: "bool"
3059
3073
  }
3074
+ },
3075
+ {
3076
+ name: "stream_name",
3077
+ type: {
3078
+ option: {
3079
+ array: [
3080
+ "u8",
3081
+ 64
3082
+ ]
3083
+ }
3084
+ }
3060
3085
  }
3061
3086
  ]
3062
3087
  }
@@ -3494,8 +3519,6 @@ var SolanaStreamClient = class {
3494
3519
  ...await this.getCreateATAInstructions([recipientPublicKey], mintPublicKey, sender, true, tokenProgramId)
3495
3520
  );
3496
3521
  }
3497
- const encodedUIntArray = new TextEncoder().encode(streamName);
3498
- const streamNameArray = Array.from(encodedUIntArray);
3499
3522
  const createMethod = this.alignedProxyProgram.methods.create({
3500
3523
  startTime: new BN3__default.default(start),
3501
3524
  netAmountDeposited: depositedAmount,
@@ -3509,7 +3532,7 @@ var SolanaStreamClient = class {
3509
3532
  cancelableBySender,
3510
3533
  canTopup,
3511
3534
  oracleType: !!oracleType ? { [oracleType]: {} } : { none: {} },
3512
- streamName: streamNameArray,
3535
+ streamName: encodeStreamNameAsArray(streamName),
3513
3536
  minPrice: typeof minPrice === "number" ? common.getBN(minPrice, ALIGNED_PRECISION_FACTOR_POW2) : minPrice,
3514
3537
  maxPrice: typeof maxPrice === "number" ? common.getBN(maxPrice, ALIGNED_PRECISION_FACTOR_POW2) : maxPrice,
3515
3538
  minPercentage: typeof minPercentage === "number" ? common.getBN(minPercentage, ALIGNED_PRECISION_FACTOR_POW2) : minPercentage,
@@ -4731,7 +4754,8 @@ var SolanaStreamClient = class {
4731
4754
  await (isAlignedUnlock ? this.alignedProxyProgram.methods.updateContract({
4732
4755
  transferableBySender: data.transferableBySender ?? null,
4733
4756
  transferableByRecipient: data.transferableByRecipient ?? null,
4734
- cancelableBySender: data.cancelableBySender ?? null
4757
+ cancelableBySender: data.cancelableBySender ?? null,
4758
+ streamName: data.name !== void 0 ? encodeStreamNameAsArray(data.name) : null
4735
4759
  }).accounts({ sender: invoker.publicKey, streamMetadata: streamPublicKey, withdrawor: WITHDRAWOR_PUBLIC_KEY }).accountsPartial({ streamflowProgram: this.programId }).instruction() : updateStreamInstruction(data, this.programId, {
4736
4760
  authority: invoker.publicKey,
4737
4761
  metadata: streamPublicKey,