@streamflow/stream 9.0.4 → 9.2.0-alpha.p0.5034440
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-BgGtpOPg.d.cts → index-ByMlPIUq.d.cts} +2 -2
- package/dist/cjs/index.cjs +124 -28
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -2
- package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.d.cts +101 -1
- package/dist/cjs/solana/index.cjs +124 -28
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +1 -1
- package/dist/esm/{index-Dp5DXxr-.d.ts → index-DsFyl13W.d.ts} +2 -2
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +124 -28
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/descriptor/idl/streamflow_aligned_unlocks.json +101 -1
- package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.d.ts +101 -1
- package/dist/esm/solana/index.d.ts +1 -1
- package/dist/esm/solana/index.js +124 -28
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Z as Account, a5 as AlignedContract, M as AlignedUnlocksContract, a8 as BatchItem, aa as BatchItemError, ab as BatchItemResult, a9 as BatchItemSuccess, U as ChangeOracleParams, y as ClientCreationOptions, a4 as Contract, R as CreateParams, V as CreateTestOracleParams, a6 as DecodedStream, $ as ICreateSolanaExt, a3 as ICreateStreamInstructions, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, a1 as IPrepareCreateStreamSolanaExt, a2 as IPrepareStreamSolanaExt, Y as ISearchStreams, b as ITopUpStreamSolanaExt, a0 as ITransactionSolanaExtWithInstructions, ac as InstructionGenerator, a7 as MetadataRecipientHashMap, N as OracleType, S as SolanaStreamClient, Q as TestOracle, X as UpdateTestOracleParams, ah as cancelStreamInstruction, x as constants, ad as createStreamInstruction, ae as createUncheckedStreamInstruction, z as decodeStream, J as deriveContractPDA, K as deriveEscrowPDA, L as deriveTestOraclePDA, H as extractSolanaErrorCode, G as sendAndConfirmStreamRawTransaction, B as signAllTransactionWithRecipients, _ as timelockIDL, aj as topupStreamInstruction, ai as transferStreamInstruction, ag as updateStreamInstruction, af as withdrawStreamInstruction } from '../index-
|
|
1
|
+
export { Z as Account, a5 as AlignedContract, M as AlignedUnlocksContract, a8 as BatchItem, aa as BatchItemError, ab as BatchItemResult, a9 as BatchItemSuccess, U as ChangeOracleParams, y as ClientCreationOptions, a4 as Contract, R as CreateParams, V as CreateTestOracleParams, a6 as DecodedStream, $ as ICreateSolanaExt, a3 as ICreateStreamInstructions, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, a1 as IPrepareCreateStreamSolanaExt, a2 as IPrepareStreamSolanaExt, Y as ISearchStreams, b as ITopUpStreamSolanaExt, a0 as ITransactionSolanaExtWithInstructions, ac as InstructionGenerator, a7 as MetadataRecipientHashMap, N as OracleType, S as SolanaStreamClient, Q as TestOracle, X as UpdateTestOracleParams, ah as cancelStreamInstruction, x as constants, ad as createStreamInstruction, ae as createUncheckedStreamInstruction, z as decodeStream, J as deriveContractPDA, K as deriveEscrowPDA, L as deriveTestOraclePDA, H as extractSolanaErrorCode, G as sendAndConfirmStreamRawTransaction, B as signAllTransactionWithRecipients, _ as timelockIDL, aj as topupStreamInstruction, ai as transferStreamInstruction, ag as updateStreamInstruction, af as withdrawStreamInstruction } from '../index-ByMlPIUq.cjs';
|
|
2
2
|
export { ContractError, IChain, ICluster } from '@streamflow/common';
|
|
3
3
|
import 'p-queue';
|
|
4
4
|
import '@solana/web3.js';
|
|
@@ -495,8 +495,8 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
495
495
|
*/
|
|
496
496
|
extractErrorCode(err: Error): string | null;
|
|
497
497
|
/**
|
|
498
|
-
|
|
499
|
-
|
|
498
|
+
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
|
|
499
|
+
*/
|
|
500
500
|
isAlignedUnlock(streamPublicKey: PublicKey, senderPublicKey: PublicKey): boolean;
|
|
501
501
|
/**
|
|
502
502
|
* Utility function to generate metadata for a Contract or return existing Pubkey
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { A as AptosStreamClient, I as ICreateStreamAptosExt, a as ITransactionAp
|
|
|
2
2
|
export { i as StreamflowAptos } from './index-D54wSYym.js';
|
|
3
3
|
import { E as EvmStreamClient } from './index-elpYUBph.js';
|
|
4
4
|
export { i as StreamflowEVM } from './index-elpYUBph.js';
|
|
5
|
-
import { S as SolanaStreamClient, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, b as ITopUpStreamSolanaExt } from './index-
|
|
6
|
-
export { s as AIRDROP_AMOUNT, q as AIRDROP_TEST_TOKEN, j as ALIGNED_COMPUTE_LIMIT, A as ALIGNED_PRECISION_FACTOR_POW, h as ALIGNED_UNLOCKS_PROGRAM_ID, k as CONTRACT_DISCRIMINATOR, m as CONTRACT_SEED, C as CREATE_PARAMS_PADDING, D as DEFAULT_STREAMFLOW_FEE, E as ESCROW_SEED, r as FEES_METADATA_SEED, F as FEE_ORACLE_PUBLIC_KEY, O as ORIGINAL_CONTRACT_SENDER_OFFSET, u as PARTNERS_SCHEMA, o as PARTNER_ORACLE_PROGRAM_ID, t as PARTNER_SCHEMA, P as PROGRAM_ID, w as SOLANA_ERROR_MAP, v as SOLANA_ERROR_MATCH_REGEX, p as STREAMFLOW_TREASURY_PUBLIC_KEY, g as STREAM_STRUCT_OFFSETS, f as STREAM_STRUCT_OFFSET_CLOSED, e as STREAM_STRUCT_OFFSET_MINT, d as STREAM_STRUCT_OFFSET_RECIPIENT, c as STREAM_STRUCT_OFFSET_SENDER, i as StreamflowSolana, l as TEST_ORACLE_DISCRIMINATOR, n as TEST_ORACLE_SEED, T as TX_FINALITY_CONFIRMED, W as WITHDRAWOR_PUBLIC_KEY } from './index-
|
|
5
|
+
import { S as SolanaStreamClient, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, b as ITopUpStreamSolanaExt } from './index-DsFyl13W.js';
|
|
6
|
+
export { s as AIRDROP_AMOUNT, q as AIRDROP_TEST_TOKEN, j as ALIGNED_COMPUTE_LIMIT, A as ALIGNED_PRECISION_FACTOR_POW, h as ALIGNED_UNLOCKS_PROGRAM_ID, k as CONTRACT_DISCRIMINATOR, m as CONTRACT_SEED, C as CREATE_PARAMS_PADDING, D as DEFAULT_STREAMFLOW_FEE, E as ESCROW_SEED, r as FEES_METADATA_SEED, F as FEE_ORACLE_PUBLIC_KEY, O as ORIGINAL_CONTRACT_SENDER_OFFSET, u as PARTNERS_SCHEMA, o as PARTNER_ORACLE_PROGRAM_ID, t as PARTNER_SCHEMA, P as PROGRAM_ID, w as SOLANA_ERROR_MAP, v as SOLANA_ERROR_MATCH_REGEX, p as STREAMFLOW_TREASURY_PUBLIC_KEY, g as STREAM_STRUCT_OFFSETS, f as STREAM_STRUCT_OFFSET_CLOSED, e as STREAM_STRUCT_OFFSET_MINT, d as STREAM_STRUCT_OFFSET_RECIPIENT, c as STREAM_STRUCT_OFFSET_SENDER, i as StreamflowSolana, l as TEST_ORACLE_DISCRIMINATOR, n as TEST_ORACLE_SEED, T as TX_FINALITY_CONFIRMED, W as WITHDRAWOR_PUBLIC_KEY } from './index-DsFyl13W.js';
|
|
7
7
|
import { S as SuiStreamClient } from './index-DrzqsoIB.js';
|
|
8
8
|
export { i as StreamflowSui } from './index-DrzqsoIB.js';
|
|
9
9
|
import { S as Stream, A as AlignedStream, I as ICreateStreamData, a as ICreateAlignedStreamData, b as StreamType, B as BaseStreamClient, c as SolanaStreamClientOptions, d as AptosStreamClientOptions, e as SuiStreamClientOptions, E as EvmStreamClientOptions, f as ICreateStreamSuiExt, g as ICreateResult, h as ICreateMultipleStreamData, i as IMultiTransactionResult, j as IWithdrawData, k as ITransactionSuiExt, l as ITransactionResult, m as ICancelData, n as ITransferData, o as ITopUpData, p as IGetOneData, q as IGetAllData, r as IUpdateData, s as IGetFeesData, t as IFees } from './BaseStreamClient-DOyJqO7R.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -3468,7 +3468,7 @@ var streamflow_aligned_unlocks_default = {
|
|
|
3468
3468
|
address: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
|
|
3469
3469
|
metadata: {
|
|
3470
3470
|
name: "streamflow_aligned_unlocks",
|
|
3471
|
-
version: "1.
|
|
3471
|
+
version: "1.4.0",
|
|
3472
3472
|
spec: "0.1.0",
|
|
3473
3473
|
description: "Proxy to update unlock amount within Streamflow vesting protocol according to Token performance and other metrics"
|
|
3474
3474
|
},
|
|
@@ -4342,6 +4342,80 @@ var streamflow_aligned_unlocks_default = {
|
|
|
4342
4342
|
],
|
|
4343
4343
|
args: []
|
|
4344
4344
|
},
|
|
4345
|
+
{
|
|
4346
|
+
name: "update_contract",
|
|
4347
|
+
discriminator: [
|
|
4348
|
+
78,
|
|
4349
|
+
184,
|
|
4350
|
+
162,
|
|
4351
|
+
174,
|
|
4352
|
+
233,
|
|
4353
|
+
5,
|
|
4354
|
+
40,
|
|
4355
|
+
82
|
|
4356
|
+
],
|
|
4357
|
+
accounts: [
|
|
4358
|
+
{
|
|
4359
|
+
name: "sender",
|
|
4360
|
+
writable: true,
|
|
4361
|
+
signer: true
|
|
4362
|
+
},
|
|
4363
|
+
{
|
|
4364
|
+
name: "proxy_metadata",
|
|
4365
|
+
docs: [
|
|
4366
|
+
"Proxy Contract"
|
|
4367
|
+
],
|
|
4368
|
+
writable: true,
|
|
4369
|
+
pda: {
|
|
4370
|
+
seeds: [
|
|
4371
|
+
{
|
|
4372
|
+
kind: "const",
|
|
4373
|
+
value: [
|
|
4374
|
+
99,
|
|
4375
|
+
111,
|
|
4376
|
+
110,
|
|
4377
|
+
116,
|
|
4378
|
+
114,
|
|
4379
|
+
97,
|
|
4380
|
+
99,
|
|
4381
|
+
116
|
|
4382
|
+
]
|
|
4383
|
+
},
|
|
4384
|
+
{
|
|
4385
|
+
kind: "account",
|
|
4386
|
+
path: "stream_metadata"
|
|
4387
|
+
}
|
|
4388
|
+
]
|
|
4389
|
+
}
|
|
4390
|
+
},
|
|
4391
|
+
{
|
|
4392
|
+
name: "stream_metadata",
|
|
4393
|
+
writable: true
|
|
4394
|
+
},
|
|
4395
|
+
{
|
|
4396
|
+
name: "withdrawor",
|
|
4397
|
+
writable: true
|
|
4398
|
+
},
|
|
4399
|
+
{
|
|
4400
|
+
name: "streamflow_program",
|
|
4401
|
+
address: "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m"
|
|
4402
|
+
},
|
|
4403
|
+
{
|
|
4404
|
+
name: "system_program",
|
|
4405
|
+
address: "11111111111111111111111111111111"
|
|
4406
|
+
}
|
|
4407
|
+
],
|
|
4408
|
+
args: [
|
|
4409
|
+
{
|
|
4410
|
+
name: "params",
|
|
4411
|
+
type: {
|
|
4412
|
+
defined: {
|
|
4413
|
+
name: "UpdateContractParams"
|
|
4414
|
+
}
|
|
4415
|
+
}
|
|
4416
|
+
}
|
|
4417
|
+
]
|
|
4418
|
+
},
|
|
4345
4419
|
{
|
|
4346
4420
|
name: "update_test_oracle",
|
|
4347
4421
|
discriminator: [
|
|
@@ -4937,6 +5011,32 @@ var streamflow_aligned_unlocks_default = {
|
|
|
4937
5011
|
]
|
|
4938
5012
|
}
|
|
4939
5013
|
},
|
|
5014
|
+
{
|
|
5015
|
+
name: "UpdateContractParams",
|
|
5016
|
+
type: {
|
|
5017
|
+
kind: "struct",
|
|
5018
|
+
fields: [
|
|
5019
|
+
{
|
|
5020
|
+
name: "transferable_by_sender",
|
|
5021
|
+
type: {
|
|
5022
|
+
option: "bool"
|
|
5023
|
+
}
|
|
5024
|
+
},
|
|
5025
|
+
{
|
|
5026
|
+
name: "transferable_by_recipient",
|
|
5027
|
+
type: {
|
|
5028
|
+
option: "bool"
|
|
5029
|
+
}
|
|
5030
|
+
},
|
|
5031
|
+
{
|
|
5032
|
+
name: "cancelable_by_sender",
|
|
5033
|
+
type: {
|
|
5034
|
+
option: "bool"
|
|
5035
|
+
}
|
|
5036
|
+
}
|
|
5037
|
+
]
|
|
5038
|
+
}
|
|
5039
|
+
},
|
|
4940
5040
|
{
|
|
4941
5041
|
name: "UpdateTestOracleParams",
|
|
4942
5042
|
type: {
|
|
@@ -5162,7 +5262,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5162
5262
|
floorPrice
|
|
5163
5263
|
} = streamParams;
|
|
5164
5264
|
const { isNative, sender, computeLimit, computePrice, metadataPubKeys } = extParams;
|
|
5165
|
-
invariant(
|
|
5265
|
+
invariant(
|
|
5266
|
+
priceOracle || !oracleType || oracleType === "none",
|
|
5267
|
+
"Price oracle is required for the specified oracle type"
|
|
5268
|
+
);
|
|
5166
5269
|
assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5167
5270
|
const recipientPublicKey = new PublicKey(recipient);
|
|
5168
5271
|
const mintPublicKey = isNative ? NATIVE_MINT : new PublicKey(mint);
|
|
@@ -5337,10 +5440,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5337
5440
|
* @returns Create result
|
|
5338
5441
|
*/
|
|
5339
5442
|
async createUnchecked(data, extParams) {
|
|
5340
|
-
const { ixs, metadata, metadataPubKey } = await this.prepareCreateUncheckedInstructions(
|
|
5341
|
-
data,
|
|
5342
|
-
extParams
|
|
5343
|
-
);
|
|
5443
|
+
const { ixs, metadata, metadataPubKey } = await this.prepareCreateUncheckedInstructions(data, extParams);
|
|
5344
5444
|
const { tx, hash, context } = await prepareTransaction(
|
|
5345
5445
|
this.connection,
|
|
5346
5446
|
ixs,
|
|
@@ -5466,7 +5566,6 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5466
5566
|
const metadatas = [];
|
|
5467
5567
|
const metadataToRecipient = {};
|
|
5468
5568
|
const instructionsBatch = [];
|
|
5469
|
-
const metadataPubKeys = metadataPubKeysExt || [];
|
|
5470
5569
|
const partnerPublicKey = data.partner ? new PublicKey(data.partner) : WITHDRAWOR_PUBLIC_KEY;
|
|
5471
5570
|
const mintPublicKey = new PublicKey(data.tokenId);
|
|
5472
5571
|
if (recipients.length === 0) {
|
|
@@ -5476,8 +5575,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5476
5575
|
const recipientData = recipients[i];
|
|
5477
5576
|
const createStreamData = { ...streamParams, ...recipientData };
|
|
5478
5577
|
const createStreamExtParams = {
|
|
5479
|
-
|
|
5480
|
-
|
|
5578
|
+
...extParams,
|
|
5579
|
+
metadataPubKeys: metadataPubKeysExt?.[i] ? [metadataPubKeysExt[i]] : void 0
|
|
5481
5580
|
};
|
|
5482
5581
|
const { ixs, metadata, metadataPubKey } = await this.prepareCreateInstructions(
|
|
5483
5582
|
createStreamData,
|
|
@@ -5492,19 +5591,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5492
5591
|
recipient: recipientData.recipient
|
|
5493
5592
|
});
|
|
5494
5593
|
}
|
|
5495
|
-
const prepareInstructions = await this.getCreateATAInstructions(
|
|
5496
|
-
[partnerPublicKey],
|
|
5497
|
-
mintPublicKey,
|
|
5498
|
-
sender,
|
|
5499
|
-
true
|
|
5500
|
-
);
|
|
5594
|
+
const prepareInstructions = await this.getCreateATAInstructions([partnerPublicKey], mintPublicKey, sender, true);
|
|
5501
5595
|
if (isNative) {
|
|
5502
5596
|
const totalDepositedAmount = recipients.reduce((acc, recipient) => recipient.amount.add(acc), new BN7(0));
|
|
5503
|
-
const nativeInstructions = await prepareWrappedAccount(
|
|
5504
|
-
this.connection,
|
|
5505
|
-
sender.publicKey,
|
|
5506
|
-
totalDepositedAmount
|
|
5507
|
-
);
|
|
5597
|
+
const nativeInstructions = await prepareWrappedAccount(this.connection, sender.publicKey, totalDepositedAmount);
|
|
5508
5598
|
prepareInstructions.push(...nativeInstructions);
|
|
5509
5599
|
}
|
|
5510
5600
|
return {
|
|
@@ -5702,10 +5792,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5702
5792
|
async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, extParams) {
|
|
5703
5793
|
const { invoker, customInstructions } = extParams;
|
|
5704
5794
|
assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5705
|
-
const ixs = await this.prepareWithdrawInstructions(
|
|
5706
|
-
{ id, amount },
|
|
5707
|
-
extParams
|
|
5708
|
-
);
|
|
5795
|
+
const ixs = await this.prepareWithdrawInstructions({ id, amount }, extParams);
|
|
5709
5796
|
const metadata = new PublicKey(id);
|
|
5710
5797
|
await this.applyCustomAfterInstructions(ixs, customInstructions, metadata);
|
|
5711
5798
|
const { tx, hash, context } = await prepareTransaction(this.connection, ixs, invoker.publicKey);
|
|
@@ -6209,17 +6296,26 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6209
6296
|
const streamPublicKey = new PublicKey(data.id);
|
|
6210
6297
|
const escrow = await this.connection.getAccountInfo(streamPublicKey);
|
|
6211
6298
|
invariant(escrow, "Couldn't get account info");
|
|
6299
|
+
const { sender: senderPublicKey } = decodeStream(escrow.data);
|
|
6300
|
+
const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, senderPublicKey);
|
|
6301
|
+
if (isAlignedUnlock && (data.enableAutomaticWithdrawal !== void 0 || data.amountPerPeriod !== void 0)) {
|
|
6302
|
+
throw new Error("Automatic withdrawal and rate update are not possible in price-based vesting!");
|
|
6303
|
+
}
|
|
6212
6304
|
const ixs = prepareBaseInstructions(this.connection, {
|
|
6213
6305
|
computePrice,
|
|
6214
6306
|
computeLimit
|
|
6215
6307
|
});
|
|
6216
6308
|
ixs.push(
|
|
6217
|
-
await
|
|
6309
|
+
await (isAlignedUnlock ? this.alignedProxyProgram.methods.updateContract({
|
|
6310
|
+
transferableBySender: data.transferableBySender ?? null,
|
|
6311
|
+
transferableByRecipient: data.transferableByRecipient ?? null,
|
|
6312
|
+
cancelableBySender: data.cancelableBySender ?? null
|
|
6313
|
+
}).accounts({ sender: invoker.publicKey, streamMetadata: streamPublicKey, withdrawor: WITHDRAWOR_PUBLIC_KEY }).accountsPartial({ streamflowProgram: this.programId }).instruction() : updateStreamInstruction(data, this.programId, {
|
|
6218
6314
|
authority: invoker.publicKey,
|
|
6219
6315
|
metadata: streamPublicKey,
|
|
6220
6316
|
withdrawor: WITHDRAWOR_PUBLIC_KEY,
|
|
6221
6317
|
systemProgram: SystemProgram.programId
|
|
6222
|
-
})
|
|
6318
|
+
}))
|
|
6223
6319
|
);
|
|
6224
6320
|
return ixs;
|
|
6225
6321
|
}
|
|
@@ -6264,8 +6360,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6264
6360
|
return extractSolanaErrorCode(err.toString() ?? "Unknown error!", logs);
|
|
6265
6361
|
}
|
|
6266
6362
|
/**
|
|
6267
|
-
|
|
6268
|
-
|
|
6363
|
+
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
|
|
6364
|
+
*/
|
|
6269
6365
|
isAlignedUnlock(streamPublicKey, senderPublicKey) {
|
|
6270
6366
|
const pda = deriveContractPDA(this.alignedProxyProgram.programId, streamPublicKey);
|
|
6271
6367
|
return senderPublicKey.equals(pda);
|