@streamflow/stream 11.1.0-alpha.p335.6615f0a → 11.1.0-alpha.p335.b571df3
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 +64 -19
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/solana/index.cjs +64 -19
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +17 -3
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +61 -20
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +17 -3
- package/dist/esm/solana/index.js +61 -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
|
|
@@ -855,6 +866,7 @@ declare function extractSolanaErrorCode(errorText: string, logs?: string[]): str
|
|
|
855
866
|
declare const deriveContractPDA: (programId: PublicKey, streamMetadata: PublicKey) => PublicKey;
|
|
856
867
|
declare const deriveEscrowPDA: (programId: PublicKey, streamMetadata: PublicKey) => PublicKey;
|
|
857
868
|
declare const deriveTestOraclePDA: (programId: PublicKey, mint: PublicKey, creator: PublicKey) => PublicKey;
|
|
869
|
+
declare const deriveRepopulatedMetadataPDA: (programId: PublicKey, streamMetadata: PublicKey) => PublicKey;
|
|
858
870
|
|
|
859
871
|
interface CreateStreamData {
|
|
860
872
|
start: BN;
|
|
@@ -1058,6 +1070,7 @@ declare const STREAM_STRUCT_OFFSET_SENDER = 49;
|
|
|
1058
1070
|
declare const STREAM_STRUCT_OFFSET_RECIPIENT = 113;
|
|
1059
1071
|
declare const STREAM_STRUCT_OFFSET_MINT = 177;
|
|
1060
1072
|
declare const STREAM_STRUCT_OFFSET_CLOSED = 671;
|
|
1073
|
+
declare const STREAM_STRUCT_OFFSET_OLD_METADATA_KEY = 714;
|
|
1061
1074
|
declare const MAX_SAFE_UNIX_TIME_VALUE = 8640000000000;
|
|
1062
1075
|
declare const WITHDRAW_AVAILABLE_AMOUNT: BN;
|
|
1063
1076
|
declare const ALIGNED_PRECISION_FACTOR_POW = 9;
|
|
@@ -1093,6 +1106,7 @@ declare const TEST_ORACLE_DISCRIMINATOR: number[];
|
|
|
1093
1106
|
declare const CONTRACT_SEED: Buffer$1;
|
|
1094
1107
|
declare const ESCROW_SEED: Buffer$1;
|
|
1095
1108
|
declare const TEST_ORACLE_SEED: Buffer$1;
|
|
1109
|
+
declare const REPOPULATED_METADATA_SEED: Buffer$1;
|
|
1096
1110
|
declare const STREAMFLOW_TREASURY_PUBLIC_KEY: PublicKey;
|
|
1097
1111
|
declare const WITHDRAWOR = "wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u";
|
|
1098
1112
|
declare const WITHDRAWOR_PUBLIC_KEY: PublicKey;
|
|
@@ -1171,4 +1185,4 @@ declare const _default: {
|
|
|
1171
1185
|
}[];
|
|
1172
1186
|
};
|
|
1173
1187
|
|
|
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 };
|
|
1188
|
+
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, 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, 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, deriveRepopulatedMetadataPDA, deriveTestOraclePDA, extractSolanaErrorCode, getMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, _default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, Account, AlignedContract, AlignedProxyErrorCode, AlignedStream, AlignedStreamData, AlignedUnlocksContract, BatchItem, BatchItemError, BatchItemResult, BatchItemSuccess, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, ChangeOracleParams, ClientCreationOptions, Contract, ContractErrorCode, CreateParams, CreateTestOracleParams, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, DecodedStream, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, IAlignedStreamConfig, IBaseStreamConfig, ICancelData, ICreateAlignedStreamData, ICreateExt, ICreateLinearStreamData, ICreateMultiError, ICreateMultipleAlignedStreamData, ICreateMultipleLinearStreamData, ICreateMultipleStreamData, ICreateResult, ICreateStreamData, ICreateStreamExt, ICreateStreamInstructions, IFees, IGetAllData, IGetFeesData, IGetOneData, IInteractData, IInteractStreamExt, IMultiTransactionResult, IPrepareCreateStreamExt, IPrepareStreamExt, IRecipient, ISearchStreams, ITopUpData, ITopUpStreamExt, ITransactionExtWithInstructions, ITransactionResult, ITransferData, IUpdateData, IWithdrawData, InstructionGenerator, LinearStream, MAX_SAFE_UNIX_TIME_VALUE, MetadataRecipientHashMap, ORIGINAL_CONTRACT_SENDER_OFFSET, OracleType, 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, Stream, StreamClientOptions, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, TestOracle, TransactionSchedulingOptions, 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, timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction } from './solana/index.js';
|
|
1
|
+
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, Account, AlignedContract, AlignedProxyErrorCode, AlignedStream, AlignedStreamData, AlignedUnlocksContract, BatchItem, BatchItemError, BatchItemResult, BatchItemSuccess, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, ChangeOracleParams, ClientCreationOptions, Contract, ContractErrorCode, CreateParams, CreateTestOracleParams, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, DecodedStream, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, IAlignedStreamConfig, IBaseStreamConfig, ICancelData, ICreateAlignedStreamData, ICreateExt, ICreateLinearStreamData, ICreateMultiError, ICreateMultipleAlignedStreamData, ICreateMultipleLinearStreamData, ICreateMultipleStreamData, ICreateResult, ICreateStreamData, ICreateStreamExt, ICreateStreamInstructions, IFees, IGetAllData, IGetFeesData, IGetOneData, IInteractData, IInteractStreamExt, IMultiTransactionResult, IPrepareCreateStreamExt, IPrepareStreamExt, IRecipient, ISearchStreams, ITopUpData, ITopUpStreamExt, ITransactionExtWithInstructions, ITransactionResult, ITransferData, IUpdateData, IWithdrawData, InstructionGenerator, LinearStream, MAX_SAFE_UNIX_TIME_VALUE, MetadataRecipientHashMap, ORIGINAL_CONTRACT_SENDER_OFFSET, OracleType, OracleTypeName, 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, Stream, StreamClientOptions, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, TestOracle, TransactionSchedulingOptions, UpdateTestOracleParams, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveRepopulatedMetadataPDA, deriveTestOraclePDA, extractSolanaErrorCode, getMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction } from './solana/index.js';
|
|
2
2
|
export { ContractError, ICluster, getBN, getNumberFromBN } from '@streamflow/common';
|
|
3
3
|
import 'p-queue';
|
|
4
4
|
import '@solana/web3.js';
|
package/dist/esm/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;
|
|
@@ -243,6 +245,7 @@ var TEST_ORACLE_DISCRIMINATOR = [198, 49, 63, 134, 232, 251, 168, 28];
|
|
|
243
245
|
var CONTRACT_SEED = Buffer.from("contract", "utf-8");
|
|
244
246
|
var ESCROW_SEED = Buffer.from("strm", "utf-8");
|
|
245
247
|
var TEST_ORACLE_SEED = Buffer.from("test-oracle", "utf-8");
|
|
248
|
+
var REPOPULATED_METADATA_SEED = Buffer.from("strm-rep", "utf-8");
|
|
246
249
|
var STREAMFLOW_TREASURY_PUBLIC_KEY = new PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
|
|
247
250
|
var WITHDRAWOR = "wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u";
|
|
248
251
|
var WITHDRAWOR_PUBLIC_KEY = new PublicKey(WITHDRAWOR);
|
|
@@ -351,7 +354,12 @@ var streamLayout = BufferLayout.struct([
|
|
|
351
354
|
BufferLayout.blob(8, "current_pause_start"),
|
|
352
355
|
BufferLayout.blob(8, "pause_cumulative"),
|
|
353
356
|
BufferLayout.blob(8, "last_rate_change_time"),
|
|
354
|
-
BufferLayout.blob(8, "funds_unlocked_at_last_rate_change")
|
|
357
|
+
BufferLayout.blob(8, "funds_unlocked_at_last_rate_change"),
|
|
358
|
+
BufferLayout.u32("creation_fee"),
|
|
359
|
+
BufferLayout.u8("creation_fee_claimed"),
|
|
360
|
+
BufferLayout.u32("auto_claim_fee"),
|
|
361
|
+
BufferLayout.u8("auto_claim_fee_claimed"),
|
|
362
|
+
BufferLayout.blob(32, "old_metadata")
|
|
355
363
|
]);
|
|
356
364
|
BufferLayout.struct([
|
|
357
365
|
BufferLayout.blob(32, "pubkey"),
|
|
@@ -462,6 +470,12 @@ var encodeUpdateStream = (values, data) => {
|
|
|
462
470
|
var topupStreamLayout = BufferLayout.struct([
|
|
463
471
|
BufferLayout.blob(8, "amount")
|
|
464
472
|
]);
|
|
473
|
+
var getMetadataKey = (streamPubkey, oldMetadata) => {
|
|
474
|
+
if (PublicKey.default.equals(oldMetadata)) {
|
|
475
|
+
return streamPubkey;
|
|
476
|
+
}
|
|
477
|
+
return oldMetadata;
|
|
478
|
+
};
|
|
465
479
|
var FEE_PRECISION = 4;
|
|
466
480
|
var FEE_NORMALIZER = 10 ** FEE_PRECISION;
|
|
467
481
|
var FEE_MULTIPLIER = new BN3(10 ** 6);
|
|
@@ -515,7 +529,8 @@ var decodeStream = (buf) => {
|
|
|
515
529
|
currentPauseStart: new BN3(raw.current_pause_start, LE),
|
|
516
530
|
pauseCumulative: new BN3(raw.pause_cumulative, LE),
|
|
517
531
|
lastRateChangeTime: new BN3(raw.last_rate_change_time, LE),
|
|
518
|
-
fundsUnlockedAtLastRateChange: new BN3(raw.funds_unlocked_at_last_rate_change, LE)
|
|
532
|
+
fundsUnlockedAtLastRateChange: new BN3(raw.funds_unlocked_at_last_rate_change, LE),
|
|
533
|
+
oldMetadata: new PublicKey(raw.old_metadata)
|
|
519
534
|
};
|
|
520
535
|
};
|
|
521
536
|
async function signAllTransactionWithRecipients(sender, items) {
|
|
@@ -2498,6 +2513,9 @@ var deriveEscrowPDA = (programId, streamMetadata) => {
|
|
|
2498
2513
|
var deriveTestOraclePDA = (programId, mint, creator) => {
|
|
2499
2514
|
return PublicKey.findProgramAddressSync([TEST_ORACLE_SEED, mint.toBuffer(), creator.toBuffer()], programId)[0];
|
|
2500
2515
|
};
|
|
2516
|
+
var deriveRepopulatedMetadataPDA = (programId, streamMetadata) => {
|
|
2517
|
+
return PublicKey.findProgramAddressSync([REPOPULATED_METADATA_SEED, streamMetadata.toBuffer()], programId)[0];
|
|
2518
|
+
};
|
|
2501
2519
|
|
|
2502
2520
|
// solana/StreamClient.ts
|
|
2503
2521
|
var METADATA_ACC_SIZE = 1104;
|
|
@@ -3319,8 +3337,8 @@ var SolanaStreamClient = class {
|
|
|
3319
3337
|
if (!account) {
|
|
3320
3338
|
throw new Error("Impossible to cancel a stream contract that does not exist");
|
|
3321
3339
|
}
|
|
3322
|
-
const
|
|
3323
|
-
const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey,
|
|
3340
|
+
const decoded = decodeStream(account.data);
|
|
3341
|
+
const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, decoded.sender, decoded.oldMetadata);
|
|
3324
3342
|
const ixs = isAlignedUnlock ? await this.prepareCancelAlignedUnlockInstructions(cancelData, extParams) : await this.prepareCancelLinearStream(cancelData, extParams);
|
|
3325
3343
|
return ixs;
|
|
3326
3344
|
}
|
|
@@ -3542,13 +3560,31 @@ var SolanaStreamClient = class {
|
|
|
3542
3560
|
async getOne({ id }) {
|
|
3543
3561
|
const streamPublicKey = new PublicKey(id);
|
|
3544
3562
|
const escrow = await this.connection.getAccountInfo(streamPublicKey, TX_FINALITY_CONFIRMED);
|
|
3545
|
-
if (
|
|
3563
|
+
if (escrow?.data) {
|
|
3564
|
+
return this.decodeStreamAccount(streamPublicKey, escrow.data);
|
|
3565
|
+
}
|
|
3566
|
+
const migrated = await this.connection.getProgramAccounts(this.programId, {
|
|
3567
|
+
filters: [
|
|
3568
|
+
{ dataSize: METADATA_ACC_SIZE },
|
|
3569
|
+
{
|
|
3570
|
+
memcmp: {
|
|
3571
|
+
offset: STREAM_STRUCT_OFFSET_OLD_METADATA_KEY,
|
|
3572
|
+
bytes: id
|
|
3573
|
+
}
|
|
3574
|
+
}
|
|
3575
|
+
]
|
|
3576
|
+
});
|
|
3577
|
+
if (migrated.length === 0) {
|
|
3546
3578
|
throw new Error("Couldn't get account info.");
|
|
3547
3579
|
}
|
|
3548
|
-
|
|
3549
|
-
|
|
3580
|
+
return this.decodeStreamAccount(migrated[0].pubkey, migrated[0].account.data);
|
|
3581
|
+
}
|
|
3582
|
+
async decodeStreamAccount(pubkey, data) {
|
|
3583
|
+
const stream = decodeStream(data);
|
|
3584
|
+
const metadataKey = getMetadataKey(pubkey, stream.oldMetadata);
|
|
3585
|
+
if (this.isAlignedUnlock(pubkey, stream.sender, stream.oldMetadata)) {
|
|
3550
3586
|
const alignedProxy = await this.alignedProxyProgram.account.contract.fetch(
|
|
3551
|
-
deriveContractPDA(this.alignedProxyProgram.programId,
|
|
3587
|
+
deriveContractPDA(this.alignedProxyProgram.programId, metadataKey)
|
|
3552
3588
|
);
|
|
3553
3589
|
if (!alignedProxy) {
|
|
3554
3590
|
throw new Error("Couldn't get proxy account info.");
|
|
@@ -3588,9 +3624,11 @@ var SolanaStreamClient = class {
|
|
|
3588
3624
|
async getIncomingAlignedStreams(streamRecord) {
|
|
3589
3625
|
const streams = {};
|
|
3590
3626
|
const alignedStreamsPubKeys = Object.keys(streamRecord);
|
|
3591
|
-
const alignedProxyPDAs = alignedStreamsPubKeys.map(
|
|
3592
|
-
|
|
3593
|
-
|
|
3627
|
+
const alignedProxyPDAs = alignedStreamsPubKeys.map((streamPubKey) => {
|
|
3628
|
+
const pubkey = new PublicKey(streamPubKey);
|
|
3629
|
+
const metadataKey = getMetadataKey(pubkey, streamRecord[streamPubKey].oldMetadata);
|
|
3630
|
+
return deriveContractPDA(this.alignedProxyProgram.programId, metadataKey);
|
|
3631
|
+
});
|
|
3594
3632
|
const alignedProxyAccounts = await getMultipleAccountsInfoBatched(this.connection, alignedProxyPDAs);
|
|
3595
3633
|
alignedProxyAccounts.forEach((account, index) => {
|
|
3596
3634
|
if (account && account.data.length === ALIGNED_METADATA_ACC_SIZE) {
|
|
@@ -3642,7 +3680,7 @@ var SolanaStreamClient = class {
|
|
|
3642
3680
|
const allIncomingStreams = allIncomingAccounts.map((account) => decodeStream(account.account.data));
|
|
3643
3681
|
const alignedDecoded = {};
|
|
3644
3682
|
allIncomingAccounts.forEach((account, index) => {
|
|
3645
|
-
if (this.isAlignedUnlock(account.pubkey, allIncomingStreams[index].sender)) {
|
|
3683
|
+
if (this.isAlignedUnlock(account.pubkey, allIncomingStreams[index].sender, allIncomingStreams[index].oldMetadata)) {
|
|
3646
3684
|
alignedDecoded[account.pubkey.toBase58()] = allIncomingStreams[index];
|
|
3647
3685
|
} else {
|
|
3648
3686
|
streams[account.pubkey.toBase58()] = new Contract(allIncomingStreams[index]);
|
|
@@ -3687,8 +3725,9 @@ var SolanaStreamClient = class {
|
|
|
3687
3725
|
collectAlignedEntries(decoded) {
|
|
3688
3726
|
const entries = [];
|
|
3689
3727
|
decoded.forEach(({ pubkey, stream }, index) => {
|
|
3690
|
-
if (this.isAlignedUnlock(pubkey, stream.sender)) {
|
|
3691
|
-
|
|
3728
|
+
if (this.isAlignedUnlock(pubkey, stream.sender, stream.oldMetadata)) {
|
|
3729
|
+
const metadataKey = getMetadataKey(pubkey, stream.oldMetadata);
|
|
3730
|
+
entries.push({ index, pda: deriveContractPDA(this.alignedProxyProgram.programId, metadataKey) });
|
|
3692
3731
|
}
|
|
3693
3732
|
});
|
|
3694
3733
|
return entries;
|
|
@@ -3748,8 +3787,8 @@ var SolanaStreamClient = class {
|
|
|
3748
3787
|
const streamPublicKey = new PublicKey(data.id);
|
|
3749
3788
|
const escrow = await this.connection.getAccountInfo(streamPublicKey);
|
|
3750
3789
|
invariant(escrow, "Couldn't get account info");
|
|
3751
|
-
const
|
|
3752
|
-
const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey,
|
|
3790
|
+
const decoded = decodeStream(escrow.data);
|
|
3791
|
+
const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, decoded.sender, decoded.oldMetadata);
|
|
3753
3792
|
if (isAlignedUnlock && (data.enableAutomaticWithdrawal !== void 0 || data.amountPerPeriod !== void 0)) {
|
|
3754
3793
|
throw new Error("Automatic withdrawal and rate update are not possible in price-based vesting!");
|
|
3755
3794
|
}
|
|
@@ -3840,10 +3879,12 @@ var SolanaStreamClient = class {
|
|
|
3840
3879
|
return extractSolanaErrorCode(err.toString() ?? "Unknown error!", logs);
|
|
3841
3880
|
}
|
|
3842
3881
|
/**
|
|
3843
|
-
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
|
|
3882
|
+
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA.
|
|
3883
|
+
* For migrated streams, the PDA was derived from the old metadata key.
|
|
3844
3884
|
*/
|
|
3845
|
-
isAlignedUnlock(streamPublicKey, senderPublicKey) {
|
|
3846
|
-
const
|
|
3885
|
+
isAlignedUnlock(streamPublicKey, senderPublicKey, oldMetadata) {
|
|
3886
|
+
const metadataKey = oldMetadata ? getMetadataKey(streamPublicKey, oldMetadata) : streamPublicKey;
|
|
3887
|
+
const pda = deriveContractPDA(this.alignedProxyProgram.programId, metadataKey);
|
|
3847
3888
|
return senderPublicKey.equals(pda);
|
|
3848
3889
|
}
|
|
3849
3890
|
async flatBuildCreateMultipleTransactionInstructions(data, extParams) {
|
|
@@ -4320,6 +4361,6 @@ var timelockIDL_default = {
|
|
|
4320
4361
|
]
|
|
4321
4362
|
};
|
|
4322
4363
|
|
|
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 };
|
|
4364
|
+
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, 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, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveRepopulatedMetadataPDA, deriveTestOraclePDA, extractSolanaErrorCode, getMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, timelockIDL_default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
|
|
4324
4365
|
//# sourceMappingURL=index.js.map
|
|
4325
4366
|
//# sourceMappingURL=index.js.map
|