@streamflow/stream 13.3.1 → 13.5.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.
@@ -69,6 +69,7 @@ interface IUpdateData extends IInteractData {
69
69
  transferableBySender?: boolean;
70
70
  transferableByRecipient?: boolean;
71
71
  cancelableBySender?: boolean;
72
+ name?: string;
72
73
  }
73
74
  type ICancelData = IInteractData;
74
75
  type RoutedFeeDestination = "treasury" | "sender";
@@ -846,6 +847,15 @@ declare class SolanaStreamClient {
846
847
  * @returns Fees
847
848
  */
848
849
  getFees({ address }: IGetFeesData): Promise<IFees | null>;
850
+ private getFeeRows;
851
+ /**
852
+ * Fee rates the program applies to a create from `sender` with `partnerLink`, used to size the WSOL wrap.
853
+ * Mirrors `resolve_vesting_partner`: a `partnerLink` counts if it signs or the partner oracle owns it, and a
854
+ * PartnerLink account stands for its partner. A link to another wallet fails the program's lookup, which then
855
+ * charges its hardcoded fallback and skips the sender's own row. Otherwise the sender's own row, then the
856
+ * partner's, then the default row. `partner` only takes a share and never picks the row.
857
+ */
858
+ private getCreateFeeRates;
849
859
  /**
850
860
  * Gets default streamflow fee
851
861
  * @returns Default streamflow fee
@@ -1100,4 +1110,4 @@ declare function execute(builtTx: BuiltTransaction, env: ExecutionEnv): Promise<
1100
1110
  declare function executeBatch(builtTransactions: BuiltTransaction[], env: ExecutionEnv): Promise<BatchExecuteResult>;
1101
1111
  declare function executeBatchSequential(builtTransactions: BuiltTransaction[], env: ExecutionEnv): Promise<BatchExecuteResult>;
1102
1112
 
1103
- export { type ICreateStreamInstructions as $, type AlignedStream as A, type BatchItem as B, type CancelFn as C, type DecodedStream as D, type CreateTestOracleParams as E, type Env as F, type ExecuteBatchFn as G, type ExecuteBatchSequentialFn as H, type IUpdateData as I, type ExecuteFn as J, type ExecutionEnv as K, type IAlignedStreamConfig as L, type IBaseStreamConfig as M, type ICancelData as N, type IClaimRoutedFeeData as O, type ICreateExt as P, type ICreateLinearStreamData as Q, type RoutedFeeDestination as R, StreamType as S, type ICreateLockBatchParams as T, type ICreateLockParams as U, type ICreateMultiError as V, type ICreateMultipleAlignedStreamData as W, type ICreateMultipleLinearStreamData as X, type ICreateMultipleStreamData as Y, type ICreateResult as Z, type ICreateStreamExt as _, type BatchItemResult as a, update as a$, type ICreateVestingBatchParams as a0, type ICreateVestingParams as a1, type IFees as a2, type IGetAllData as a3, type IGetFeesData as a4, type IGetOneData as a5, type IInteractData as a6, type IInteractStreamExt as a7, type ILockBatchRecipient as a8, type IMultiTransactionResult as a9, type TransactionSchedulingOptions as aA, type TransferFn as aB, type UpdateFn as aC, type UpdateTestOracleParams as aD, type WithdrawFn as aE, buildLockBatchParams as aF, buildLockParams as aG, buildTransaction as aH, buildVestingBatchParams as aI, buildVestingParams as aJ, cancel as aK, computeAmountPerPeriod as aL, create as aM, createBatch as aN, createClientFromEnv as aO, createLock as aP, createLockBatch as aQ, createVesting as aR, createVestingBatch as aS, execute as aT, executeBatch as aU, executeBatchSequential as aV, resolveConnection as aW, resolveDuration as aX, sign as aY, topup as aZ, transfer as a_, type IPrepareCreateStreamExt as aa, type IPrepareStreamExt as ab, type IPrepareTopUpstreamExt as ac, type IRecipient as ad, type ITopUpData as ae, type ITopUpStreamExt as af, type ITransactionExtWithInstructions as ag, type ITransactionResult as ah, type ITransferData as ai, type IVestingBatchRecipient as aj, type IWithdrawData as ak, type InstructionGenerator as al, type InstructionResult as am, type Invoker as an, type LinearStream as ao, type MetadataRecipientHashMap as ap, type NativeOptions as aq, type OracleType as ar, type OracleTypeName as as, type SignFn as at, SolanaStreamClient as au, type StreamClientOptions as av, type StreamClientOptionsWithConnection as aw, StreamDirection as ax, type TestOracle as ay, type TopupFn as az, type Stream as b, withdraw as b0, type ICreateStreamData as c, type ICreateAlignedStreamData as d, type ISearchStreams as e, type Account as f, AlignedContract as g, AlignedProxyErrorCode as h, type AlignedStreamData as i, type AlignedUnlocksContract as j, type BatchCreationItem as k, type BatchExecuteResult as l, type BatchInstructionResult as m, type BatchItemError as n, type BatchItemSuccess as o, type BuildTransactionFn as p, type BuildTransactionOptions as q, type BuiltTransaction as r, type ChangeOracleParams as s, type ClientCreationOptions as t, Contract as u, ContractErrorCode as v, type CreateBatchFn as w, type CreateFn as x, type CreateInstructionResult as y, type CreateParams as z };
1113
+ export { type ICreateStreamInstructions as $, type AlignedStream as A, type BatchItem as B, type CancelFn as C, type DecodedStream as D, type CreateParams as E, type CreateTestOracleParams as F, type Env as G, type ExecuteBatchFn as H, type IUpdateData as I, type ExecuteBatchSequentialFn as J, type ExecuteFn as K, type ExecutionEnv as L, type IAlignedStreamConfig as M, type IBaseStreamConfig as N, type ICancelData as O, type IClaimRoutedFeeData as P, type ICreateExt as Q, type RoutedFeeDestination as R, StreamType as S, type ICreateLockBatchParams as T, type ICreateLockParams as U, type ICreateMultiError as V, type ICreateMultipleAlignedStreamData as W, type ICreateMultipleLinearStreamData as X, type ICreateMultipleStreamData as Y, type ICreateResult as Z, type ICreateStreamExt as _, type BatchItemResult as a, update as a$, type ICreateVestingBatchParams as a0, type ICreateVestingParams as a1, type IFees as a2, type IGetAllData as a3, type IGetFeesData as a4, type IGetOneData as a5, type IInteractData as a6, type IInteractStreamExt as a7, type ILockBatchRecipient as a8, type IMultiTransactionResult as a9, type TransactionSchedulingOptions as aA, type TransferFn as aB, type UpdateFn as aC, type UpdateTestOracleParams as aD, type WithdrawFn as aE, buildLockBatchParams as aF, buildLockParams as aG, buildTransaction as aH, buildVestingBatchParams as aI, buildVestingParams as aJ, cancel as aK, computeAmountPerPeriod as aL, create as aM, createBatch as aN, createClientFromEnv as aO, createLock as aP, createLockBatch as aQ, createVesting as aR, createVestingBatch as aS, execute as aT, executeBatch as aU, executeBatchSequential as aV, resolveConnection as aW, resolveDuration as aX, sign as aY, topup as aZ, transfer as a_, type IPrepareCreateStreamExt as aa, type IPrepareStreamExt as ab, type IPrepareTopUpstreamExt as ac, type IRecipient as ad, type ITopUpData as ae, type ITopUpStreamExt as af, type ITransactionExtWithInstructions as ag, type ITransactionResult as ah, type ITransferData as ai, type IVestingBatchRecipient as aj, type IWithdrawData as ak, type InstructionGenerator as al, type InstructionResult as am, type Invoker as an, type LinearStream as ao, type MetadataRecipientHashMap as ap, type NativeOptions as aq, type OracleType as ar, type OracleTypeName as as, type SignFn as at, SolanaStreamClient as au, type StreamClientOptions as av, type StreamClientOptionsWithConnection as aw, StreamDirection as ax, type TestOracle as ay, type TopupFn as az, type Stream as b, withdraw as b0, type ICreateStreamData as c, type ICreateAlignedStreamData as d, type ICreateLinearStreamData as e, type ISearchStreams as f, type Account as g, AlignedContract as h, AlignedProxyErrorCode as i, type AlignedStreamData as j, type AlignedUnlocksContract as k, type BatchCreationItem as l, type BatchExecuteResult as m, type BatchInstructionResult as n, type BatchItemError as o, type BatchItemSuccess as p, type BuildTransactionFn as q, type BuildTransactionOptions as r, type BuiltTransaction as s, type ChangeOracleParams as t, type ClientCreationOptions as u, Contract as v, ContractErrorCode as w, type CreateBatchFn as x, type CreateFn as y, type CreateInstructionResult as z };
@@ -87,6 +87,24 @@ var isTokenLock = (streamData) => {
87
87
  }
88
88
  return false;
89
89
  };
90
+ var isStrictTokenLockCreate = (data, now = Math.floor(Date.now() / 1e3)) => {
91
+ if (data.canTopup || data.automaticWithdrawal || data.cancelableBySender || data.cancelableByRecipient || data.transferableBySender) {
92
+ return false;
93
+ }
94
+ if (!isCliffCloseToDepositedAmount({ depositedAmount: data.amount, cliffAmount: data.cliffAmount })) {
95
+ return false;
96
+ }
97
+ if (data.cliffAmount.gt(data.amount) || data.amountPerPeriod.isZero()) {
98
+ return false;
99
+ }
100
+ const remaining = data.amount.sub(data.cliffAmount);
101
+ const periodsLeft = remaining.add(data.amountPerPeriod).subn(1).div(data.amountPerPeriod);
102
+ const cliff = data.start === 0 ? now : data.cliff;
103
+ const unlockStart = cliff > 0 ? cliff : data.start;
104
+ const end = new BN3__default.default(unlockStart).add(periodsLeft.mul(new BN3__default.default(data.period)));
105
+ const cliffEndGap = end.sub(new BN3__default.default(cliff));
106
+ return !cliffEndGap.isNeg() && cliffEndGap.lten(MAX_CLIFF_END_GAP_SECONDS);
107
+ };
90
108
  var buildStreamType = (streamData) => {
91
109
  if (isTokenLock(streamData)) {
92
110
  return "lock" /* Lock */;
@@ -540,7 +558,13 @@ var encodeUpdateStream = (values, data) => {
540
558
  structs.push(BufferLayout__namespace.u8("cancelable_by_sender_exists"));
541
559
  structs.push(BufferLayout__namespace.u8("cancelable_by_sender"));
542
560
  } else {
543
- structs.push(BufferLayout__namespace.u8("cancelable_by_sender"));
561
+ structs.push(BufferLayout__namespace.u8("cancelable_by_sender_exists"));
562
+ }
563
+ if (values.stream_name) {
564
+ structs.push(BufferLayout__namespace.u8("stream_name_exists"));
565
+ structs.push(BufferLayout__namespace.blob(64, "stream_name"));
566
+ } else {
567
+ structs.push(BufferLayout__namespace.u8("stream_name_exists"));
544
568
  }
545
569
  return BufferLayout__namespace.struct(structs).encode(
546
570
  {
@@ -555,7 +579,9 @@ var encodeUpdateStream = (values, data) => {
555
579
  transferable_by_recipient_exists: values.transferable_by_recipient !== void 0 ? 1 : 0,
556
580
  transferable_by_recipient: values.transferable_by_recipient ?? 0,
557
581
  cancelable_by_sender_exists: values.cancelable_by_sender !== void 0 ? 1 : 0,
558
- cancelable_by_sender: values.cancelable_by_sender ?? 0
582
+ cancelable_by_sender: values.cancelable_by_sender ?? 0,
583
+ stream_name_exists: values.stream_name ? 1 : 0,
584
+ stream_name: values.stream_name ?? 0
559
585
  },
560
586
  data
561
587
  );
@@ -578,6 +604,13 @@ var calculateTotalAmountToDeposit = (depositedAmount, totalFee) => {
578
604
  const totalFeeNormalized = new BN3__default.default(totalFee * FEE_NORMALIZER);
579
605
  return depositedAmount.mul(totalFeeNormalized.add(FEE_MULTIPLIER)).div(FEE_MULTIPLIER);
580
606
  };
607
+ var encodeStreamName = (name) => {
608
+ const encoded = new TextEncoder().encode(name);
609
+ return Buffer.alloc(64).fill(encoded, 0, encoded.byteLength);
610
+ };
611
+ var encodeStreamNameAsArray = (name) => {
612
+ return Array.from(encodeStreamName(name));
613
+ };
581
614
  var decodeStream = (buf) => {
582
615
  const raw = streamLayout.decode(buf);
583
616
  return {
@@ -734,8 +767,6 @@ var createStreamInstruction = async (data, programId, accounts) => {
734
767
  keys.push({ pubkey: accounts.partnerLink.pubkey, isSigner: accounts.partnerLink.isSigner, isWritable: false });
735
768
  }
736
769
  let bufferData = buffer.Buffer.alloc(createStreamLayout.span);
737
- const encodedUIntArray = new TextEncoder().encode(data.name);
738
- const streamNameBuffer = buffer.Buffer.alloc(64).fill(encodedUIntArray, 0, encodedUIntArray.byteLength);
739
770
  const decodedData = {
740
771
  start_time: data.start.toArrayLike(buffer.Buffer, "le", 8),
741
772
  net_amount_deposited: data.depositedAmount.toArrayLike(buffer.Buffer, "le", 8),
@@ -753,7 +784,7 @@ var createStreamInstruction = async (data, programId, accounts) => {
753
784
  can_update_rate: Number(data.canUpdateRate),
754
785
  _can_update_rate_discriminator: 1,
755
786
  pausable: Number(data.canPause),
756
- stream_name: streamNameBuffer,
787
+ stream_name: encodeStreamName(data.name),
757
788
  withdraw_frequency: data.withdrawFrequency.toArrayLike(buffer.Buffer, "le", 8)
758
789
  };
759
790
  const encodeLength = createStreamLayout.encode(decodedData, bufferData);
@@ -1014,7 +1045,8 @@ var updateStreamInstruction = async (params, programId, { authority, metadata, w
1014
1045
  amount_per_period: params.amountPerPeriod ? params.amountPerPeriod.toArrayLike(buffer.Buffer, "le", 8) : void 0,
1015
1046
  transferable_by_sender: params.transferableBySender !== void 0 ? Number(params.transferableBySender) : void 0,
1016
1047
  transferable_by_recipient: params.transferableByRecipient !== void 0 ? Number(params.transferableByRecipient) : void 0,
1017
- cancelable_by_sender: params.cancelableBySender !== void 0 ? Number(params.cancelableBySender) : void 0
1048
+ cancelable_by_sender: params.cancelableBySender !== void 0 ? Number(params.cancelableBySender) : void 0,
1049
+ stream_name: params.name !== void 0 ? encodeStreamName(params.name) : void 0
1018
1050
  };
1019
1051
  const encodeLength = encodeUpdateStream(decodedData, data);
1020
1052
  data = data.slice(0, encodeLength);
@@ -3141,6 +3173,17 @@ var streamflow_aligned_unlocks_default = {
3141
3173
  type: {
3142
3174
  option: "bool"
3143
3175
  }
3176
+ },
3177
+ {
3178
+ name: "stream_name",
3179
+ type: {
3180
+ option: {
3181
+ array: [
3182
+ "u8",
3183
+ 64
3184
+ ]
3185
+ }
3186
+ }
3144
3187
  }
3145
3188
  ]
3146
3189
  }
@@ -3340,6 +3383,27 @@ var transformContract = async (schema) => {
3340
3383
  // solana/StreamClient.ts
3341
3384
  var METADATA_ACC_SIZE = 1104;
3342
3385
  var ALIGNED_METADATA_ACC_SIZE = 320;
3386
+ var PARTNER_LINK_DISCRIMINATOR = buffer.Buffer.from([114, 220, 250, 94, 181, 182, 195, 222]);
3387
+ var PARTNER_LINK_SIZE = 8 + 32 + 32 + 32;
3388
+ var decodePartnerLink = (data) => data.length >= PARTNER_LINK_SIZE && data.subarray(0, 8).equals(PARTNER_LINK_DISCRIMINATOR) ? { partnerPubkey: new web3_js.PublicKey(data.subarray(8, 40)), linkedPubkey: new web3_js.PublicKey(data.subarray(40, 72)) } : null;
3389
+ var findFees = (partners, address) => {
3390
+ const filteredPartners = partners.filter((partner2) => new web3_js.PublicKey(partner2.pubkey).toString() === address);
3391
+ if (filteredPartners.length === 0) {
3392
+ return null;
3393
+ }
3394
+ if (filteredPartners.length > 1) {
3395
+ throw new Error("More than one partner found, fees fetching is not possible.");
3396
+ }
3397
+ const partner = filteredPartners[0];
3398
+ return {
3399
+ creationFeeSol: Number(partner.creation_fee),
3400
+ autoClaimFeeSol: Number(partner.auto_claim_fee),
3401
+ streamflowFee: Number(partner.token_fee_percent.toFixed(4)),
3402
+ streamflowLockFee: Number(partner.token_lock_token_fee_percent.toFixed(4)),
3403
+ partnerFee: 0
3404
+ };
3405
+ };
3406
+ var getWrapFeePercent = (rates, data) => isStrictTokenLockCreate(data) ? rates.streamflowLockFee : rates.streamflowFee;
3343
3407
  var SolanaStreamClient = class {
3344
3408
  /**
3345
3409
  * Create Stream instance
@@ -3433,10 +3497,8 @@ var SolanaStreamClient = class {
3433
3497
  tokenProgramId ? new web3_js.PublicKey(tokenProgramId) : void 0
3434
3498
  );
3435
3499
  if (isNative) {
3436
- const totalFee = await this.getTotalFee({
3437
- address: partnerPublicKey.toString()
3438
- });
3439
- const totalAmount = calculateTotalAmountToDeposit(amount, totalFee);
3500
+ const rates = await this.getCreateFeeRates(data.partnerLink, sender.publicKey);
3501
+ const totalAmount = calculateTotalAmountToDeposit(amount, getWrapFeePercent(rates, data));
3440
3502
  ixs.push(...await common.prepareWrappedAccount(this.connection, sender.publicKey, totalAmount));
3441
3503
  }
3442
3504
  const {
@@ -3581,8 +3643,6 @@ var SolanaStreamClient = class {
3581
3643
  ...await this.getCreateATAInstructions([recipientPublicKey], mintPublicKey, sender, true, tokenProgramId)
3582
3644
  );
3583
3645
  }
3584
- const encodedUIntArray = new TextEncoder().encode(streamName);
3585
- const streamNameArray = Array.from(encodedUIntArray);
3586
3646
  const createMethod = this.alignedProxyProgram.methods.create({
3587
3647
  startTime: new BN3__default.default(start),
3588
3648
  netAmountDeposited: depositedAmount,
@@ -3596,7 +3656,7 @@ var SolanaStreamClient = class {
3596
3656
  cancelableBySender,
3597
3657
  canTopup,
3598
3658
  oracleType: !!oracleType ? { [oracleType]: {} } : { none: {} },
3599
- streamName: streamNameArray,
3659
+ streamName: encodeStreamNameAsArray(streamName),
3600
3660
  minPrice: typeof minPrice === "number" ? common.getBN(minPrice, ALIGNED_PRECISION_FACTOR_POW2) : minPrice,
3601
3661
  maxPrice: typeof maxPrice === "number" ? common.getBN(maxPrice, ALIGNED_PRECISION_FACTOR_POW2) : maxPrice,
3602
3662
  minPercentage: typeof minPercentage === "number" ? common.getBN(minPercentage, ALIGNED_PRECISION_FACTOR_POW2) : minPercentage,
@@ -3825,7 +3885,20 @@ var SolanaStreamClient = class {
3825
3885
  computeLimit
3826
3886
  });
3827
3887
  if (isNative) {
3828
- const totalFee = await this.getTotalFee({ address: partnerPublicKey.toString() });
3888
+ const rates = await this.getCreateFeeRates(partnerLink, sender.publicKey);
3889
+ const totalFee = getWrapFeePercent(rates, {
3890
+ start,
3891
+ amount: depositedAmount,
3892
+ period,
3893
+ cliff,
3894
+ cliffAmount,
3895
+ amountPerPeriod,
3896
+ canTopup,
3897
+ automaticWithdrawal,
3898
+ cancelableBySender,
3899
+ cancelableByRecipient,
3900
+ transferableBySender
3901
+ });
3829
3902
  const totalAmount = calculateTotalAmountToDeposit(depositedAmount, totalFee);
3830
3903
  ixs.push(...await common.prepareWrappedAccount(this.connection, sender.publicKey, totalAmount));
3831
3904
  }
@@ -3915,6 +3988,7 @@ var SolanaStreamClient = class {
3915
3988
  if (recipients.length === 0) {
3916
3989
  throw new Error("Recipients array is empty!");
3917
3990
  }
3991
+ const wrapFeeRates = isNative ? await this.getCreateFeeRates(data.partnerLink, sender.publicKey) : void 0;
3918
3992
  for (let i = 0; i < recipients.length; i++) {
3919
3993
  const recipientData = recipients[i];
3920
3994
  const createStreamData = { ...streamParams, ...recipientData };
@@ -3923,8 +3997,8 @@ var SolanaStreamClient = class {
3923
3997
  metadataPubKeys: metadataPubKeysExt?.[i] ? [metadataPubKeysExt[i]] : void 0
3924
3998
  };
3925
3999
  const wrapInstructions = [];
3926
- if (isNative) {
3927
- const totalFee = await this.getTotalFee({ address: partnerPublicKey.toString() });
4000
+ if (wrapFeeRates) {
4001
+ const totalFee = getWrapFeePercent(wrapFeeRates, createStreamData);
3928
4002
  const recipientAmount = calculateTotalAmountToDeposit(recipientData.amount, totalFee);
3929
4003
  wrapInstructions.push(...await common.prepareWrappedAccount(this.connection, sender.publicKey, recipientAmount));
3930
4004
  }
@@ -4818,7 +4892,8 @@ var SolanaStreamClient = class {
4818
4892
  await (isAlignedUnlock ? this.alignedProxyProgram.methods.updateContract({
4819
4893
  transferableBySender: data.transferableBySender ?? null,
4820
4894
  transferableByRecipient: data.transferableByRecipient ?? null,
4821
- cancelableBySender: data.cancelableBySender ?? null
4895
+ cancelableBySender: data.cancelableBySender ?? null,
4896
+ streamName: data.name !== void 0 ? encodeStreamNameAsArray(data.name) : null
4822
4897
  }).accounts({ sender: invoker.publicKey, streamMetadata: streamPublicKey, withdrawor: WITHDRAWOR_PUBLIC_KEY }).accountsPartial({ streamflowProgram: this.programId }).instruction() : updateStreamInstruction(data, this.programId, {
4823
4898
  authority: invoker.publicKey,
4824
4899
  metadata: streamPublicKey,
@@ -4834,26 +4909,38 @@ var SolanaStreamClient = class {
4834
4909
  * @returns Fees
4835
4910
  */
4836
4911
  async getFees({ address }) {
4912
+ const partners = await this.getFeeRows();
4913
+ return partners ? findFees(partners, address) : null;
4914
+ }
4915
+ async getFeeRows() {
4837
4916
  const data = await this.connection.getAccountInfo(this.feeOraclePublicKey);
4838
- if (!data) {
4839
- return null;
4840
- }
4841
- const partners = borsh__namespace.deserialize(PARTNERS_SCHEMA, data.data);
4842
- const filteredPartners = partners.filter((partner2) => new web3_js.PublicKey(partner2.pubkey).toString() === address);
4843
- if (filteredPartners.length === 0) {
4844
- return null;
4845
- }
4846
- if (filteredPartners.length > 1) {
4847
- throw new Error("More than one partner found, fees fetching is not possible.");
4917
+ return data ? borsh__namespace.deserialize(PARTNERS_SCHEMA, data.data) : null;
4918
+ }
4919
+ /**
4920
+ * Fee rates the program applies to a create from `sender` with `partnerLink`, used to size the WSOL wrap.
4921
+ * Mirrors `resolve_vesting_partner`: a `partnerLink` counts if it signs or the partner oracle owns it, and a
4922
+ * PartnerLink account stands for its partner. A link to another wallet fails the program's lookup, which then
4923
+ * charges its hardcoded fallback and skips the sender's own row. Otherwise the sender's own row, then the
4924
+ * partner's, then the default row. `partner` only takes a share and never picks the row.
4925
+ */
4926
+ async getCreateFeeRates(partnerLink, sender) {
4927
+ const fallback = { streamflowFee: DEFAULT_STREAMFLOW_FEE, streamflowLockFee: DEFAULT_STREAMFLOW_FEE };
4928
+ let linkedPartner;
4929
+ if (partnerLink?.isSigner) {
4930
+ linkedPartner = common.pk(partnerLink.address).toBase58();
4931
+ } else if (partnerLink) {
4932
+ const address = common.pk(partnerLink.address);
4933
+ const account = await this.connection.getAccountInfo(address);
4934
+ if (account?.owner.equals(this.partnerOracleProgramId)) {
4935
+ const link = decodePartnerLink(account.data);
4936
+ if (link && !link.linkedPubkey.equals(sender)) {
4937
+ return fallback;
4938
+ }
4939
+ linkedPartner = (link?.partnerPubkey ?? address).toBase58();
4940
+ }
4848
4941
  }
4849
- const partner = filteredPartners[0];
4850
- return {
4851
- creationFeeSol: Number(partner.creation_fee),
4852
- autoClaimFeeSol: Number(partner.auto_claim_fee),
4853
- streamflowFee: Number(partner.token_fee_percent.toFixed(4)),
4854
- streamflowLockFee: Number(partner.token_lock_token_fee_percent.toFixed(4)),
4855
- partnerFee: 0
4856
- };
4942
+ const partners = await this.getFeeRows() ?? [];
4943
+ return findFees(partners, sender.toBase58()) ?? (linkedPartner ? findFees(partners, linkedPartner) : null) ?? findFees(partners, WITHDRAWOR) ?? fallback;
4857
4944
  }
4858
4945
  /**
4859
4946
  * Gets default streamflow fee
@@ -5965,6 +6052,8 @@ exports.deriveEscrowPDA = deriveEscrowPDA;
5965
6052
  exports.deriveRepopulatedMetadataPDA = deriveRepopulatedMetadataPDA;
5966
6053
  exports.deriveStreamMetadataPDA = deriveStreamMetadataPDA;
5967
6054
  exports.deriveTestOraclePDA = deriveTestOraclePDA;
6055
+ exports.encodeStreamName = encodeStreamName;
6056
+ exports.encodeStreamNameAsArray = encodeStreamNameAsArray;
5968
6057
  exports.execute = execute;
5969
6058
  exports.executeBatch = executeBatch;
5970
6059
  exports.executeBatchSequential = executeBatchSequential;
@@ -5975,6 +6064,7 @@ exports.isAligned = isAligned;
5975
6064
  exports.isCliffCloseToDepositedAmount = isCliffCloseToDepositedAmount;
5976
6065
  exports.isCreateAlignedStreamData = isCreateAlignedStreamData;
5977
6066
  exports.isDynamicLock = isDynamicLock;
6067
+ exports.isStrictTokenLockCreate = isStrictTokenLockCreate;
5978
6068
  exports.isTokenLock = isTokenLock;
5979
6069
  exports.isVesting = isVesting;
5980
6070
  exports.resolveConnection = resolveConnection;