@streamflow/stream 13.4.0 → 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.
- package/dist/cjs/{index-BqHEM38f.d.cts → index-BLL6w66C.d.cts} +10 -1
- package/dist/cjs/index.cjs +89 -25
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -2
- package/dist/cjs/solana/api/index.cjs +88 -25
- package/dist/cjs/solana/api/index.cjs.map +1 -1
- package/dist/cjs/solana/api/index.d.cts +1 -1
- package/dist/cjs/solana/index.cjs +89 -25
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +10 -3
- package/dist/esm/{index-CYAitoQO.d.ts → index-FDwxtRYV.d.ts} +10 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +90 -27
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/api/index.d.ts +1 -1
- package/dist/esm/solana/api/index.js +89 -26
- package/dist/esm/solana/api/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +10 -3
- package/dist/esm/solana/index.js +90 -27
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DecodedStream, B as BatchItem, a as BatchItemResult, R as RoutedFeeDestination, I as IUpdateData, S as StreamType, b as Stream, A as AlignedStream, c as ICreateStreamData, d as ICreateAlignedStreamData, e as ISearchStreams } from '../index-
|
|
2
|
-
export {
|
|
1
|
+
import { D as DecodedStream, B as BatchItem, a as BatchItemResult, R as RoutedFeeDestination, I as IUpdateData, S as StreamType, b as Stream, A as AlignedStream, c as ICreateStreamData, d as ICreateAlignedStreamData, e as ICreateLinearStreamData, f as ISearchStreams } from '../index-FDwxtRYV.js';
|
|
2
|
+
export { g as Account, h as AlignedContract, i as AlignedProxyErrorCode, j as AlignedStreamData, k as AlignedUnlocksContract, l as BatchCreationItem, m as BatchExecuteResult, n as BatchInstructionResult, o as BatchItemError, p as BatchItemSuccess, q as BuildTransactionFn, r as BuildTransactionOptions, s as BuiltTransaction, C as CancelFn, t as ChangeOracleParams, u as ClientCreationOptions, v as Contract, w as ContractErrorCode, x as CreateBatchFn, y as CreateFn, z as CreateInstructionResult, E as CreateParams, F as CreateTestOracleParams, G as Env, H as ExecuteBatchFn, J as ExecuteBatchSequentialFn, K as ExecuteFn, L as ExecutionEnv, M as IAlignedStreamConfig, N as IBaseStreamConfig, O as ICancelData, P as IClaimRoutedFeeData, Q as ICreateExt, T as ICreateLockBatchParams, U as ICreateLockParams, V as ICreateMultiError, W as ICreateMultipleAlignedStreamData, X as ICreateMultipleLinearStreamData, Y as ICreateMultipleStreamData, Z as ICreateResult, _ 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, ae as ITopUpData, af as ITopUpStreamExt, ag as ITransactionExtWithInstructions, ah as ITransactionResult, ai as ITransferData, 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, at as SignFn, au as SolanaStreamClient, av as StreamClientOptions, aw as StreamClientOptionsWithConnection, ax as StreamDirection, 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-FDwxtRYV.js';
|
|
3
3
|
import { ConfirmationParams, ThrottleParams } from '@streamflow/common';
|
|
4
4
|
export { ContractError, ICluster, getBN, getNumberFromBN } from '@streamflow/common';
|
|
5
5
|
import { SignerWalletAdapter } from '@solana/wallet-adapter-base';
|
|
@@ -313,6 +313,13 @@ declare const isTokenLock: (streamData: {
|
|
|
313
313
|
minPercentage?: number;
|
|
314
314
|
maxPercentage?: number;
|
|
315
315
|
}) => boolean;
|
|
316
|
+
/**
|
|
317
|
+
* Whether the program charges a linear create the token-lock fee instead of the stream fee.
|
|
318
|
+
* Keep in sync with the program's `is_strict_token_lock`, which runs on the create's own params
|
|
319
|
+
* (a `start` of 0 sets both `start` and `cliff` to the current time); `isTokenLock` classifies a
|
|
320
|
+
* decoded stream instead.
|
|
321
|
+
*/
|
|
322
|
+
declare const isStrictTokenLockCreate: (data: Pick<ICreateLinearStreamData, "canTopup" | "automaticWithdrawal" | "cancelableBySender" | "cancelableByRecipient" | "transferableBySender" | "amount" | "cliffAmount" | "amountPerPeriod" | "cliff" | "start" | "period">, now?: number) => boolean;
|
|
316
323
|
declare const buildStreamType: (streamData: {
|
|
317
324
|
canTopup: boolean;
|
|
318
325
|
automaticWithdrawal: boolean;
|
|
@@ -626,4 +633,4 @@ declare const createClient: (options?: ApiClientOptions) => ApiClient;
|
|
|
626
633
|
|
|
627
634
|
declare const transformContract: (schema: ContractSchema) => Promise<Stream>;
|
|
628
635
|
|
|
629
|
-
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, AlignedStream, type ApiClient, type ApiClientOptions, BatchItem, BatchItemResult, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, type Chain, type ContractSchema, type ContractType, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, DecodedStream, type DynamicContractSchema, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, type GetContractsOptions, ICreateAlignedStreamData, ICreateStreamData, ISearchStreams, IUpdateData, MAX_SAFE_UNIX_TIME_VALUE, METADATA_SEED, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, type PriceOracleType, REPOPULATED_METADATA_SEED, RoutedFeeDestination, 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, Stream, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, type 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, _default as timelockIDL, topupStreamInstruction, transferStreamInstruction, transformContract, updateStreamInstruction, withdrawStreamInstruction };
|
|
636
|
+
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, AlignedStream, type ApiClient, type ApiClientOptions, BatchItem, BatchItemResult, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, type Chain, type ContractSchema, type ContractType, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, DecodedStream, type DynamicContractSchema, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, type GetContractsOptions, ICreateAlignedStreamData, ICreateLinearStreamData, ICreateStreamData, ISearchStreams, IUpdateData, MAX_SAFE_UNIX_TIME_VALUE, METADATA_SEED, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, type PriceOracleType, REPOPULATED_METADATA_SEED, RoutedFeeDestination, 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, Stream, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, type 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, isStrictTokenLockCreate, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, _default as timelockIDL, topupStreamInstruction, transferStreamInstruction, transformContract, updateStreamInstruction, withdrawStreamInstruction };
|
package/dist/esm/solana/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import bs58 from 'bs58';
|
|
|
3
3
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
4
4
|
import { NATIVE_MINT, ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, getTransferHook, addExtraAccountMetasForExecute } from '@solana/spl-token';
|
|
5
5
|
import { PublicKey, TransactionInstruction, Connection, Keypair, SystemProgram, SYSVAR_RENT_PUBKEY, TransactionMessage, VersionedTransaction } from '@solana/web3.js';
|
|
6
|
-
import { ICluster, getNumberFromBN, isSignerKeypair, isSignerWallet, executeTransaction, ContractError, buildSendThrottler, assertHasPublicKey, prepareWrappedAccount, prepareTransaction, signAndExecuteTransaction, invariant, getMintAndProgram, ata, prepareBaseInstructions, getBN, createVersionedTransaction, executeMultipleTransactions, getMultipleAccountsInfoBatched, getProgramAccounts, isDev, checkOrCreateAtaBatch
|
|
6
|
+
import { ICluster, getNumberFromBN, isSignerKeypair, isSignerWallet, executeTransaction, ContractError, buildSendThrottler, assertHasPublicKey, prepareWrappedAccount, prepareTransaction, signAndExecuteTransaction, invariant, getMintAndProgram, ata, prepareBaseInstructions, getBN, createVersionedTransaction, executeMultipleTransactions, getMultipleAccountsInfoBatched, getProgramAccounts, pk, isDev, checkOrCreateAtaBatch } from '@streamflow/common';
|
|
7
7
|
export { ContractError, ICluster, getBN, getNumberFromBN } from '@streamflow/common';
|
|
8
8
|
import * as borsh from 'borsh';
|
|
9
9
|
import { Program } from '@coral-xyz/anchor';
|
|
@@ -61,6 +61,24 @@ var isTokenLock = (streamData) => {
|
|
|
61
61
|
}
|
|
62
62
|
return false;
|
|
63
63
|
};
|
|
64
|
+
var isStrictTokenLockCreate = (data, now = Math.floor(Date.now() / 1e3)) => {
|
|
65
|
+
if (data.canTopup || data.automaticWithdrawal || data.cancelableBySender || data.cancelableByRecipient || data.transferableBySender) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
if (!isCliffCloseToDepositedAmount({ depositedAmount: data.amount, cliffAmount: data.cliffAmount })) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
if (data.cliffAmount.gt(data.amount) || data.amountPerPeriod.isZero()) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
const remaining = data.amount.sub(data.cliffAmount);
|
|
75
|
+
const periodsLeft = remaining.add(data.amountPerPeriod).subn(1).div(data.amountPerPeriod);
|
|
76
|
+
const cliff = data.start === 0 ? now : data.cliff;
|
|
77
|
+
const unlockStart = cliff > 0 ? cliff : data.start;
|
|
78
|
+
const end = new BN3(unlockStart).add(periodsLeft.mul(new BN3(data.period)));
|
|
79
|
+
const cliffEndGap = end.sub(new BN3(cliff));
|
|
80
|
+
return !cliffEndGap.isNeg() && cliffEndGap.lten(MAX_CLIFF_END_GAP_SECONDS);
|
|
81
|
+
};
|
|
64
82
|
var buildStreamType = (streamData) => {
|
|
65
83
|
if (isTokenLock(streamData)) {
|
|
66
84
|
return "lock" /* Lock */;
|
|
@@ -3339,6 +3357,27 @@ var transformContract = async (schema) => {
|
|
|
3339
3357
|
// solana/StreamClient.ts
|
|
3340
3358
|
var METADATA_ACC_SIZE = 1104;
|
|
3341
3359
|
var ALIGNED_METADATA_ACC_SIZE = 320;
|
|
3360
|
+
var PARTNER_LINK_DISCRIMINATOR = Buffer$1.from([114, 220, 250, 94, 181, 182, 195, 222]);
|
|
3361
|
+
var PARTNER_LINK_SIZE = 8 + 32 + 32 + 32;
|
|
3362
|
+
var decodePartnerLink = (data) => data.length >= PARTNER_LINK_SIZE && data.subarray(0, 8).equals(PARTNER_LINK_DISCRIMINATOR) ? { partnerPubkey: new PublicKey(data.subarray(8, 40)), linkedPubkey: new PublicKey(data.subarray(40, 72)) } : null;
|
|
3363
|
+
var findFees = (partners, address) => {
|
|
3364
|
+
const filteredPartners = partners.filter((partner2) => new PublicKey(partner2.pubkey).toString() === address);
|
|
3365
|
+
if (filteredPartners.length === 0) {
|
|
3366
|
+
return null;
|
|
3367
|
+
}
|
|
3368
|
+
if (filteredPartners.length > 1) {
|
|
3369
|
+
throw new Error("More than one partner found, fees fetching is not possible.");
|
|
3370
|
+
}
|
|
3371
|
+
const partner = filteredPartners[0];
|
|
3372
|
+
return {
|
|
3373
|
+
creationFeeSol: Number(partner.creation_fee),
|
|
3374
|
+
autoClaimFeeSol: Number(partner.auto_claim_fee),
|
|
3375
|
+
streamflowFee: Number(partner.token_fee_percent.toFixed(4)),
|
|
3376
|
+
streamflowLockFee: Number(partner.token_lock_token_fee_percent.toFixed(4)),
|
|
3377
|
+
partnerFee: 0
|
|
3378
|
+
};
|
|
3379
|
+
};
|
|
3380
|
+
var getWrapFeePercent = (rates, data) => isStrictTokenLockCreate(data) ? rates.streamflowLockFee : rates.streamflowFee;
|
|
3342
3381
|
var SolanaStreamClient = class {
|
|
3343
3382
|
/**
|
|
3344
3383
|
* Create Stream instance
|
|
@@ -3432,10 +3471,8 @@ var SolanaStreamClient = class {
|
|
|
3432
3471
|
tokenProgramId ? new PublicKey(tokenProgramId) : void 0
|
|
3433
3472
|
);
|
|
3434
3473
|
if (isNative) {
|
|
3435
|
-
const
|
|
3436
|
-
|
|
3437
|
-
});
|
|
3438
|
-
const totalAmount = calculateTotalAmountToDeposit(amount, totalFee);
|
|
3474
|
+
const rates = await this.getCreateFeeRates(data.partnerLink, sender.publicKey);
|
|
3475
|
+
const totalAmount = calculateTotalAmountToDeposit(amount, getWrapFeePercent(rates, data));
|
|
3439
3476
|
ixs.push(...await prepareWrappedAccount(this.connection, sender.publicKey, totalAmount));
|
|
3440
3477
|
}
|
|
3441
3478
|
const {
|
|
@@ -3822,7 +3859,20 @@ var SolanaStreamClient = class {
|
|
|
3822
3859
|
computeLimit
|
|
3823
3860
|
});
|
|
3824
3861
|
if (isNative) {
|
|
3825
|
-
const
|
|
3862
|
+
const rates = await this.getCreateFeeRates(partnerLink, sender.publicKey);
|
|
3863
|
+
const totalFee = getWrapFeePercent(rates, {
|
|
3864
|
+
start,
|
|
3865
|
+
amount: depositedAmount,
|
|
3866
|
+
period,
|
|
3867
|
+
cliff,
|
|
3868
|
+
cliffAmount,
|
|
3869
|
+
amountPerPeriod,
|
|
3870
|
+
canTopup,
|
|
3871
|
+
automaticWithdrawal,
|
|
3872
|
+
cancelableBySender,
|
|
3873
|
+
cancelableByRecipient,
|
|
3874
|
+
transferableBySender
|
|
3875
|
+
});
|
|
3826
3876
|
const totalAmount = calculateTotalAmountToDeposit(depositedAmount, totalFee);
|
|
3827
3877
|
ixs.push(...await prepareWrappedAccount(this.connection, sender.publicKey, totalAmount));
|
|
3828
3878
|
}
|
|
@@ -3912,6 +3962,7 @@ var SolanaStreamClient = class {
|
|
|
3912
3962
|
if (recipients.length === 0) {
|
|
3913
3963
|
throw new Error("Recipients array is empty!");
|
|
3914
3964
|
}
|
|
3965
|
+
const wrapFeeRates = isNative ? await this.getCreateFeeRates(data.partnerLink, sender.publicKey) : void 0;
|
|
3915
3966
|
for (let i = 0; i < recipients.length; i++) {
|
|
3916
3967
|
const recipientData = recipients[i];
|
|
3917
3968
|
const createStreamData = { ...streamParams, ...recipientData };
|
|
@@ -3920,8 +3971,8 @@ var SolanaStreamClient = class {
|
|
|
3920
3971
|
metadataPubKeys: metadataPubKeysExt?.[i] ? [metadataPubKeysExt[i]] : void 0
|
|
3921
3972
|
};
|
|
3922
3973
|
const wrapInstructions = [];
|
|
3923
|
-
if (
|
|
3924
|
-
const totalFee =
|
|
3974
|
+
if (wrapFeeRates) {
|
|
3975
|
+
const totalFee = getWrapFeePercent(wrapFeeRates, createStreamData);
|
|
3925
3976
|
const recipientAmount = calculateTotalAmountToDeposit(recipientData.amount, totalFee);
|
|
3926
3977
|
wrapInstructions.push(...await prepareWrappedAccount(this.connection, sender.publicKey, recipientAmount));
|
|
3927
3978
|
}
|
|
@@ -4832,26 +4883,38 @@ var SolanaStreamClient = class {
|
|
|
4832
4883
|
* @returns Fees
|
|
4833
4884
|
*/
|
|
4834
4885
|
async getFees({ address }) {
|
|
4886
|
+
const partners = await this.getFeeRows();
|
|
4887
|
+
return partners ? findFees(partners, address) : null;
|
|
4888
|
+
}
|
|
4889
|
+
async getFeeRows() {
|
|
4835
4890
|
const data = await this.connection.getAccountInfo(this.feeOraclePublicKey);
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4891
|
+
return data ? borsh.deserialize(PARTNERS_SCHEMA, data.data) : null;
|
|
4892
|
+
}
|
|
4893
|
+
/**
|
|
4894
|
+
* Fee rates the program applies to a create from `sender` with `partnerLink`, used to size the WSOL wrap.
|
|
4895
|
+
* Mirrors `resolve_vesting_partner`: a `partnerLink` counts if it signs or the partner oracle owns it, and a
|
|
4896
|
+
* PartnerLink account stands for its partner. A link to another wallet fails the program's lookup, which then
|
|
4897
|
+
* charges its hardcoded fallback and skips the sender's own row. Otherwise the sender's own row, then the
|
|
4898
|
+
* partner's, then the default row. `partner` only takes a share and never picks the row.
|
|
4899
|
+
*/
|
|
4900
|
+
async getCreateFeeRates(partnerLink, sender) {
|
|
4901
|
+
const fallback = { streamflowFee: DEFAULT_STREAMFLOW_FEE, streamflowLockFee: DEFAULT_STREAMFLOW_FEE };
|
|
4902
|
+
let linkedPartner;
|
|
4903
|
+
if (partnerLink?.isSigner) {
|
|
4904
|
+
linkedPartner = pk(partnerLink.address).toBase58();
|
|
4905
|
+
} else if (partnerLink) {
|
|
4906
|
+
const address = pk(partnerLink.address);
|
|
4907
|
+
const account = await this.connection.getAccountInfo(address);
|
|
4908
|
+
if (account?.owner.equals(this.partnerOracleProgramId)) {
|
|
4909
|
+
const link = decodePartnerLink(account.data);
|
|
4910
|
+
if (link && !link.linkedPubkey.equals(sender)) {
|
|
4911
|
+
return fallback;
|
|
4912
|
+
}
|
|
4913
|
+
linkedPartner = (link?.partnerPubkey ?? address).toBase58();
|
|
4914
|
+
}
|
|
4846
4915
|
}
|
|
4847
|
-
const
|
|
4848
|
-
return
|
|
4849
|
-
creationFeeSol: Number(partner.creation_fee),
|
|
4850
|
-
autoClaimFeeSol: Number(partner.auto_claim_fee),
|
|
4851
|
-
streamflowFee: Number(partner.token_fee_percent.toFixed(4)),
|
|
4852
|
-
streamflowLockFee: Number(partner.token_lock_token_fee_percent.toFixed(4)),
|
|
4853
|
-
partnerFee: 0
|
|
4854
|
-
};
|
|
4916
|
+
const partners = await this.getFeeRows() ?? [];
|
|
4917
|
+
return findFees(partners, sender.toBase58()) ?? (linkedPartner ? findFees(partners, linkedPartner) : null) ?? findFees(partners, WITHDRAWOR) ?? fallback;
|
|
4855
4918
|
}
|
|
4856
4919
|
/**
|
|
4857
4920
|
* Gets default streamflow fee
|
|
@@ -5872,6 +5935,6 @@ async function executeBatchSequential(builtTransactions, env) {
|
|
|
5872
5935
|
return { signatures, errors };
|
|
5873
5936
|
}
|
|
5874
5937
|
|
|
5875
|
-
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW2 as ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, AlignedContract, AlignedProxyErrorCode, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, Contract, ContractErrorCode, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, MAX_SAFE_UNIX_TIME_VALUE2 as MAX_SAFE_UNIX_TIME_VALUE, METADATA_SEED, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, 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, SolanaStreamClient, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildLockBatchParams, buildLockParams, buildStreamType, buildTransaction, buildVestingBatchParams, buildVestingParams, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancel, cancelStreamInstruction, claimRoutedFeeStreamInstruction, computeAmountPerPeriod, create, createBatch, createClient, createClientFromEnv, createLock, createLockBatch, createStreamInstruction, createStreamV2Instruction, createUncheckedStreamInstruction, createUncheckedStreamV2Instruction, createVesting, createVestingBatch, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveRepopulatedMetadataPDA, deriveStreamMetadataPDA, deriveTestOraclePDA, encodeStreamName, encodeStreamNameAsArray, execute, executeBatch, executeBatchSequential, extractSolanaErrorCode, getMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, resolveConnection, resolveDuration, sendAndConfirmStreamRawTransaction, sign, signAllTransactionWithRecipients, timelockIDL_default as timelockIDL, topup, topupStreamInstruction, transfer, transferStreamInstruction, transformContract, update, updateStreamInstruction, withdraw, withdrawStreamInstruction };
|
|
5938
|
+
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW2 as ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, AlignedContract, AlignedProxyErrorCode, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, Contract, ContractErrorCode, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, MAX_SAFE_UNIX_TIME_VALUE2 as MAX_SAFE_UNIX_TIME_VALUE, METADATA_SEED, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, 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, SolanaStreamClient, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildLockBatchParams, buildLockParams, buildStreamType, buildTransaction, buildVestingBatchParams, buildVestingParams, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancel, cancelStreamInstruction, claimRoutedFeeStreamInstruction, computeAmountPerPeriod, create, createBatch, createClient, createClientFromEnv, createLock, createLockBatch, createStreamInstruction, createStreamV2Instruction, createUncheckedStreamInstruction, createUncheckedStreamV2Instruction, createVesting, createVestingBatch, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveRepopulatedMetadataPDA, deriveStreamMetadataPDA, deriveTestOraclePDA, encodeStreamName, encodeStreamNameAsArray, execute, executeBatch, executeBatchSequential, extractSolanaErrorCode, getMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isStrictTokenLockCreate, isTokenLock, isVesting, resolveConnection, resolveDuration, sendAndConfirmStreamRawTransaction, sign, signAllTransactionWithRecipients, timelockIDL_default as timelockIDL, topup, topupStreamInstruction, transfer, transferStreamInstruction, transformContract, update, updateStreamInstruction, withdraw, withdrawStreamInstruction };
|
|
5876
5939
|
//# sourceMappingURL=index.js.map
|
|
5877
5940
|
//# sourceMappingURL=index.js.map
|