@streamflow/stream 11.0.0-alpha.p334.fcf4225 → 11.0.1
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.cjs +58 -19
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/solana/index.cjs +58 -19
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +15 -3
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +57 -20
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +15 -3
- package/dist/esm/solana/index.js +57 -20
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -166,6 +166,7 @@ interface LinearStream {
|
|
|
166
166
|
pauseCumulative: BN;
|
|
167
167
|
lastRateChangeTime: number;
|
|
168
168
|
fundsUnlockedAtLastRateChange: BN;
|
|
169
|
+
oldMetadata: PublicKey;
|
|
169
170
|
type: StreamType;
|
|
170
171
|
unlocked(currentTimestamp: number): BN;
|
|
171
172
|
remaining(decimals: number): number;
|
|
@@ -395,6 +396,7 @@ declare class Contract implements LinearStream {
|
|
|
395
396
|
pauseCumulative: BN;
|
|
396
397
|
lastRateChangeTime: number;
|
|
397
398
|
fundsUnlockedAtLastRateChange: BN;
|
|
399
|
+
oldMetadata: PublicKey;
|
|
398
400
|
type: StreamType;
|
|
399
401
|
isAligned: boolean;
|
|
400
402
|
constructor(stream: DecodedStream);
|
|
@@ -463,6 +465,7 @@ interface DecodedStream {
|
|
|
463
465
|
pauseCumulative: BN;
|
|
464
466
|
lastRateChangeTime: BN;
|
|
465
467
|
fundsUnlockedAtLastRateChange: BN;
|
|
468
|
+
oldMetadata: PublicKey;
|
|
466
469
|
}
|
|
467
470
|
interface MetadataRecipientHashMap {
|
|
468
471
|
[metadataPubKey: string]: IRecipient;
|
|
@@ -733,6 +736,7 @@ declare class SolanaStreamClient {
|
|
|
733
736
|
* @returns Stream data
|
|
734
737
|
*/
|
|
735
738
|
getOne({ id }: IGetOneData): Promise<Stream>;
|
|
739
|
+
private decodeStreamAccount;
|
|
736
740
|
/**
|
|
737
741
|
* Fetch all aligned outgoing streams/contracts by the provided public key.
|
|
738
742
|
* @param {string} sender - Sender public key
|
|
@@ -801,9 +805,10 @@ declare class SolanaStreamClient {
|
|
|
801
805
|
*/
|
|
802
806
|
extractErrorCode(err: Error): string | null;
|
|
803
807
|
/**
|
|
804
|
-
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
|
|
808
|
+
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA.
|
|
809
|
+
* For migrated streams, the PDA was derived from the old metadata key.
|
|
805
810
|
*/
|
|
806
|
-
isAlignedUnlock(streamPublicKey: PublicKey, senderPublicKey: PublicKey): boolean;
|
|
811
|
+
isAlignedUnlock(streamPublicKey: PublicKey, senderPublicKey: PublicKey, oldMetadata?: PublicKey): boolean;
|
|
807
812
|
private flatBuildCreateMultipleTransactionInstructions;
|
|
808
813
|
/**
|
|
809
814
|
* Utility function to generate metadata for a Contract or return existing Pubkey
|
|
@@ -816,6 +821,12 @@ declare class SolanaStreamClient {
|
|
|
816
821
|
private applyCustomAfterInstructions;
|
|
817
822
|
}
|
|
818
823
|
|
|
824
|
+
/**
|
|
825
|
+
* Returns the key that should be used for PDA derivation.
|
|
826
|
+
* For migrated streams, the aligned proxy PDA was derived from the original (old) metadata key,
|
|
827
|
+
* so we need to use that instead of the current stream pubkey.
|
|
828
|
+
*/
|
|
829
|
+
declare const getMetadataKey: (streamPubkey: PublicKey, oldMetadata: PublicKey) => PublicKey;
|
|
819
830
|
/**
|
|
820
831
|
* Calculate total amount of a Contract including all fees.
|
|
821
832
|
* - first we convert fee floating to a BN with up to 4 decimals precision
|
|
@@ -1058,6 +1069,7 @@ declare const STREAM_STRUCT_OFFSET_SENDER = 49;
|
|
|
1058
1069
|
declare const STREAM_STRUCT_OFFSET_RECIPIENT = 113;
|
|
1059
1070
|
declare const STREAM_STRUCT_OFFSET_MINT = 177;
|
|
1060
1071
|
declare const STREAM_STRUCT_OFFSET_CLOSED = 671;
|
|
1072
|
+
declare const STREAM_STRUCT_OFFSET_OLD_METADATA_KEY = 714;
|
|
1061
1073
|
declare const MAX_SAFE_UNIX_TIME_VALUE = 8640000000000;
|
|
1062
1074
|
declare const WITHDRAW_AVAILABLE_AMOUNT: BN;
|
|
1063
1075
|
declare const ALIGNED_PRECISION_FACTOR_POW = 9;
|
|
@@ -1171,4 +1183,4 @@ declare const _default: {
|
|
|
1171
1183
|
}[];
|
|
1172
1184
|
};
|
|
1173
1185
|
|
|
1174
|
-
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, type Account, AlignedContract, AlignedProxyErrorCode, type AlignedStream, type AlignedStreamData, type AlignedUnlocksContract, type BatchItem, type BatchItemError, type BatchItemResult, type BatchItemSuccess, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, type ChangeOracleParams, type ClientCreationOptions, Contract, ContractErrorCode, type CreateParams, type CreateTestOracleParams, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, type DecodedStream, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, type IAlignedStreamConfig, type IBaseStreamConfig, type ICancelData, type ICreateAlignedStreamData, type ICreateExt, type ICreateLinearStreamData, type ICreateMultiError, type ICreateMultipleAlignedStreamData, type ICreateMultipleLinearStreamData, type ICreateMultipleStreamData, type ICreateResult, type ICreateStreamData, type ICreateStreamExt, type ICreateStreamInstructions, type IFees, type IGetAllData, type IGetFeesData, type IGetOneData, type IInteractData, type IInteractStreamExt, type IMultiTransactionResult, type IPrepareCreateStreamExt, type IPrepareStreamExt, type IRecipient, type ISearchStreams, type ITopUpData, type ITopUpStreamExt, type ITransactionExtWithInstructions, type ITransactionResult, type ITransferData, type IUpdateData, type IWithdrawData, type InstructionGenerator, type LinearStream, MAX_SAFE_UNIX_TIME_VALUE, type MetadataRecipientHashMap, ORIGINAL_CONTRACT_SENDER_OFFSET, type OracleType, type OracleTypeName, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, 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_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, type Stream, type StreamClientOptions, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, type TestOracle, type TransactionSchedulingOptions, type UpdateTestOracleParams, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, _default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
|
|
1186
|
+
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, type Account, AlignedContract, AlignedProxyErrorCode, type AlignedStream, type AlignedStreamData, type AlignedUnlocksContract, type BatchItem, type BatchItemError, type BatchItemResult, type BatchItemSuccess, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, type ChangeOracleParams, type ClientCreationOptions, Contract, ContractErrorCode, type CreateParams, type CreateTestOracleParams, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, type DecodedStream, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, type IAlignedStreamConfig, type IBaseStreamConfig, type ICancelData, type ICreateAlignedStreamData, type ICreateExt, type ICreateLinearStreamData, type ICreateMultiError, type ICreateMultipleAlignedStreamData, type ICreateMultipleLinearStreamData, type ICreateMultipleStreamData, type ICreateResult, type ICreateStreamData, type ICreateStreamExt, type ICreateStreamInstructions, type IFees, type IGetAllData, type IGetFeesData, type IGetOneData, type IInteractData, type IInteractStreamExt, type IMultiTransactionResult, type IPrepareCreateStreamExt, type IPrepareStreamExt, type IRecipient, type ISearchStreams, type ITopUpData, type ITopUpStreamExt, type ITransactionExtWithInstructions, type ITransactionResult, type ITransferData, type IUpdateData, type IWithdrawData, type InstructionGenerator, type LinearStream, MAX_SAFE_UNIX_TIME_VALUE, type MetadataRecipientHashMap, ORIGINAL_CONTRACT_SENDER_OFFSET, type OracleType, type OracleTypeName, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, 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, type Stream, type StreamClientOptions, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, type TestOracle, type TransactionSchedulingOptions, type UpdateTestOracleParams, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, getMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, _default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
|
package/dist/esm/solana/index.js
CHANGED
|
@@ -159,6 +159,7 @@ var Contract = class {
|
|
|
159
159
|
this.pauseCumulative = stream.pauseCumulative;
|
|
160
160
|
this.lastRateChangeTime = stream.lastRateChangeTime.toNumber();
|
|
161
161
|
this.fundsUnlockedAtLastRateChange = stream.fundsUnlockedAtLastRateChange;
|
|
162
|
+
this.oldMetadata = stream.oldMetadata;
|
|
162
163
|
this.type = buildStreamType(this);
|
|
163
164
|
this.isAligned = false;
|
|
164
165
|
}
|
|
@@ -203,6 +204,7 @@ var STREAM_STRUCT_OFFSET_SENDER = 49;
|
|
|
203
204
|
var STREAM_STRUCT_OFFSET_RECIPIENT = 113;
|
|
204
205
|
var STREAM_STRUCT_OFFSET_MINT = 177;
|
|
205
206
|
var STREAM_STRUCT_OFFSET_CLOSED = 671;
|
|
207
|
+
var STREAM_STRUCT_OFFSET_OLD_METADATA_KEY = 714;
|
|
206
208
|
var MAX_SAFE_UNIX_TIME_VALUE2 = 864e10;
|
|
207
209
|
var WITHDRAW_AVAILABLE_AMOUNT = new BN3("18446744073709551615");
|
|
208
210
|
var ALIGNED_PRECISION_FACTOR_POW2 = 9;
|
|
@@ -351,7 +353,12 @@ var streamLayout = BufferLayout.struct([
|
|
|
351
353
|
BufferLayout.blob(8, "current_pause_start"),
|
|
352
354
|
BufferLayout.blob(8, "pause_cumulative"),
|
|
353
355
|
BufferLayout.blob(8, "last_rate_change_time"),
|
|
354
|
-
BufferLayout.blob(8, "funds_unlocked_at_last_rate_change")
|
|
356
|
+
BufferLayout.blob(8, "funds_unlocked_at_last_rate_change"),
|
|
357
|
+
BufferLayout.u32("creation_fee"),
|
|
358
|
+
BufferLayout.u8("creation_fee_claimed"),
|
|
359
|
+
BufferLayout.u32("auto_claim_fee"),
|
|
360
|
+
BufferLayout.u8("auto_claim_fee_claimed"),
|
|
361
|
+
BufferLayout.blob(32, "old_metadata")
|
|
355
362
|
]);
|
|
356
363
|
BufferLayout.struct([
|
|
357
364
|
BufferLayout.blob(32, "pubkey"),
|
|
@@ -462,6 +469,12 @@ var encodeUpdateStream = (values, data) => {
|
|
|
462
469
|
var topupStreamLayout = BufferLayout.struct([
|
|
463
470
|
BufferLayout.blob(8, "amount")
|
|
464
471
|
]);
|
|
472
|
+
var getMetadataKey = (streamPubkey, oldMetadata) => {
|
|
473
|
+
if (PublicKey.default.equals(oldMetadata)) {
|
|
474
|
+
return streamPubkey;
|
|
475
|
+
}
|
|
476
|
+
return oldMetadata;
|
|
477
|
+
};
|
|
465
478
|
var FEE_PRECISION = 4;
|
|
466
479
|
var FEE_NORMALIZER = 10 ** FEE_PRECISION;
|
|
467
480
|
var FEE_MULTIPLIER = new BN3(10 ** 6);
|
|
@@ -515,7 +528,8 @@ var decodeStream = (buf) => {
|
|
|
515
528
|
currentPauseStart: new BN3(raw.current_pause_start, LE),
|
|
516
529
|
pauseCumulative: new BN3(raw.pause_cumulative, LE),
|
|
517
530
|
lastRateChangeTime: new BN3(raw.last_rate_change_time, LE),
|
|
518
|
-
fundsUnlockedAtLastRateChange: new BN3(raw.funds_unlocked_at_last_rate_change, LE)
|
|
531
|
+
fundsUnlockedAtLastRateChange: new BN3(raw.funds_unlocked_at_last_rate_change, LE),
|
|
532
|
+
oldMetadata: new PublicKey(raw.old_metadata)
|
|
519
533
|
};
|
|
520
534
|
};
|
|
521
535
|
async function signAllTransactionWithRecipients(sender, items) {
|
|
@@ -3319,8 +3333,8 @@ var SolanaStreamClient = class {
|
|
|
3319
3333
|
if (!account) {
|
|
3320
3334
|
throw new Error("Impossible to cancel a stream contract that does not exist");
|
|
3321
3335
|
}
|
|
3322
|
-
const
|
|
3323
|
-
const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey,
|
|
3336
|
+
const decoded = decodeStream(account.data);
|
|
3337
|
+
const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, decoded.sender, decoded.oldMetadata);
|
|
3324
3338
|
const ixs = isAlignedUnlock ? await this.prepareCancelAlignedUnlockInstructions(cancelData, extParams) : await this.prepareCancelLinearStream(cancelData, extParams);
|
|
3325
3339
|
return ixs;
|
|
3326
3340
|
}
|
|
@@ -3542,13 +3556,31 @@ var SolanaStreamClient = class {
|
|
|
3542
3556
|
async getOne({ id }) {
|
|
3543
3557
|
const streamPublicKey = new PublicKey(id);
|
|
3544
3558
|
const escrow = await this.connection.getAccountInfo(streamPublicKey, TX_FINALITY_CONFIRMED);
|
|
3545
|
-
if (
|
|
3559
|
+
if (escrow?.data) {
|
|
3560
|
+
return this.decodeStreamAccount(streamPublicKey, escrow.data);
|
|
3561
|
+
}
|
|
3562
|
+
const migrated = await this.connection.getProgramAccounts(this.programId, {
|
|
3563
|
+
filters: [
|
|
3564
|
+
{ dataSize: METADATA_ACC_SIZE },
|
|
3565
|
+
{
|
|
3566
|
+
memcmp: {
|
|
3567
|
+
offset: STREAM_STRUCT_OFFSET_OLD_METADATA_KEY,
|
|
3568
|
+
bytes: id
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
]
|
|
3572
|
+
});
|
|
3573
|
+
if (migrated.length === 0) {
|
|
3546
3574
|
throw new Error("Couldn't get account info.");
|
|
3547
3575
|
}
|
|
3548
|
-
|
|
3549
|
-
|
|
3576
|
+
return this.decodeStreamAccount(migrated[0].pubkey, migrated[0].account.data);
|
|
3577
|
+
}
|
|
3578
|
+
async decodeStreamAccount(pubkey, data) {
|
|
3579
|
+
const stream = decodeStream(data);
|
|
3580
|
+
const metadataKey = getMetadataKey(pubkey, stream.oldMetadata);
|
|
3581
|
+
if (this.isAlignedUnlock(pubkey, stream.sender, stream.oldMetadata)) {
|
|
3550
3582
|
const alignedProxy = await this.alignedProxyProgram.account.contract.fetch(
|
|
3551
|
-
deriveContractPDA(this.alignedProxyProgram.programId,
|
|
3583
|
+
deriveContractPDA(this.alignedProxyProgram.programId, metadataKey)
|
|
3552
3584
|
);
|
|
3553
3585
|
if (!alignedProxy) {
|
|
3554
3586
|
throw new Error("Couldn't get proxy account info.");
|
|
@@ -3588,9 +3620,11 @@ var SolanaStreamClient = class {
|
|
|
3588
3620
|
async getIncomingAlignedStreams(streamRecord) {
|
|
3589
3621
|
const streams = {};
|
|
3590
3622
|
const alignedStreamsPubKeys = Object.keys(streamRecord);
|
|
3591
|
-
const alignedProxyPDAs = alignedStreamsPubKeys.map(
|
|
3592
|
-
|
|
3593
|
-
|
|
3623
|
+
const alignedProxyPDAs = alignedStreamsPubKeys.map((streamPubKey) => {
|
|
3624
|
+
const pubkey = new PublicKey(streamPubKey);
|
|
3625
|
+
const metadataKey = getMetadataKey(pubkey, streamRecord[streamPubKey].oldMetadata);
|
|
3626
|
+
return deriveContractPDA(this.alignedProxyProgram.programId, metadataKey);
|
|
3627
|
+
});
|
|
3594
3628
|
const alignedProxyAccounts = await getMultipleAccountsInfoBatched(this.connection, alignedProxyPDAs);
|
|
3595
3629
|
alignedProxyAccounts.forEach((account, index) => {
|
|
3596
3630
|
if (account && account.data.length === ALIGNED_METADATA_ACC_SIZE) {
|
|
@@ -3642,7 +3676,7 @@ var SolanaStreamClient = class {
|
|
|
3642
3676
|
const allIncomingStreams = allIncomingAccounts.map((account) => decodeStream(account.account.data));
|
|
3643
3677
|
const alignedDecoded = {};
|
|
3644
3678
|
allIncomingAccounts.forEach((account, index) => {
|
|
3645
|
-
if (this.isAlignedUnlock(account.pubkey, allIncomingStreams[index].sender)) {
|
|
3679
|
+
if (this.isAlignedUnlock(account.pubkey, allIncomingStreams[index].sender, allIncomingStreams[index].oldMetadata)) {
|
|
3646
3680
|
alignedDecoded[account.pubkey.toBase58()] = allIncomingStreams[index];
|
|
3647
3681
|
} else {
|
|
3648
3682
|
streams[account.pubkey.toBase58()] = new Contract(allIncomingStreams[index]);
|
|
@@ -3687,8 +3721,9 @@ var SolanaStreamClient = class {
|
|
|
3687
3721
|
collectAlignedEntries(decoded) {
|
|
3688
3722
|
const entries = [];
|
|
3689
3723
|
decoded.forEach(({ pubkey, stream }, index) => {
|
|
3690
|
-
if (this.isAlignedUnlock(pubkey, stream.sender)) {
|
|
3691
|
-
|
|
3724
|
+
if (this.isAlignedUnlock(pubkey, stream.sender, stream.oldMetadata)) {
|
|
3725
|
+
const metadataKey = getMetadataKey(pubkey, stream.oldMetadata);
|
|
3726
|
+
entries.push({ index, pda: deriveContractPDA(this.alignedProxyProgram.programId, metadataKey) });
|
|
3692
3727
|
}
|
|
3693
3728
|
});
|
|
3694
3729
|
return entries;
|
|
@@ -3748,8 +3783,8 @@ var SolanaStreamClient = class {
|
|
|
3748
3783
|
const streamPublicKey = new PublicKey(data.id);
|
|
3749
3784
|
const escrow = await this.connection.getAccountInfo(streamPublicKey);
|
|
3750
3785
|
invariant(escrow, "Couldn't get account info");
|
|
3751
|
-
const
|
|
3752
|
-
const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey,
|
|
3786
|
+
const decoded = decodeStream(escrow.data);
|
|
3787
|
+
const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, decoded.sender, decoded.oldMetadata);
|
|
3753
3788
|
if (isAlignedUnlock && (data.enableAutomaticWithdrawal !== void 0 || data.amountPerPeriod !== void 0)) {
|
|
3754
3789
|
throw new Error("Automatic withdrawal and rate update are not possible in price-based vesting!");
|
|
3755
3790
|
}
|
|
@@ -3840,10 +3875,12 @@ var SolanaStreamClient = class {
|
|
|
3840
3875
|
return extractSolanaErrorCode(err.toString() ?? "Unknown error!", logs);
|
|
3841
3876
|
}
|
|
3842
3877
|
/**
|
|
3843
|
-
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
|
|
3878
|
+
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA.
|
|
3879
|
+
* For migrated streams, the PDA was derived from the old metadata key.
|
|
3844
3880
|
*/
|
|
3845
|
-
isAlignedUnlock(streamPublicKey, senderPublicKey) {
|
|
3846
|
-
const
|
|
3881
|
+
isAlignedUnlock(streamPublicKey, senderPublicKey, oldMetadata) {
|
|
3882
|
+
const metadataKey = oldMetadata ? getMetadataKey(streamPublicKey, oldMetadata) : streamPublicKey;
|
|
3883
|
+
const pda = deriveContractPDA(this.alignedProxyProgram.programId, metadataKey);
|
|
3847
3884
|
return senderPublicKey.equals(pda);
|
|
3848
3885
|
}
|
|
3849
3886
|
async flatBuildCreateMultipleTransactionInstructions(data, extParams) {
|
|
@@ -4320,6 +4357,6 @@ var timelockIDL_default = {
|
|
|
4320
4357
|
]
|
|
4321
4358
|
};
|
|
4322
4359
|
|
|
4323
|
-
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, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, 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_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, timelockIDL_default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
|
|
4360
|
+
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, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, 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, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, getMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, timelockIDL_default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
|
|
4324
4361
|
//# sourceMappingURL=index.js.map
|
|
4325
4362
|
//# sourceMappingURL=index.js.map
|