@streamflow/stream 9.0.4 → 9.2.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-BgGtpOPg.d.cts → index-ByMlPIUq.d.cts} +2 -2
- package/dist/cjs/index.cjs +122 -25
- 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 +122 -25
- 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 +122 -25
- 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 +122 -25
- 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,
|
|
@@ -5492,19 +5592,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5492
5592
|
recipient: recipientData.recipient
|
|
5493
5593
|
});
|
|
5494
5594
|
}
|
|
5495
|
-
const prepareInstructions = await this.getCreateATAInstructions(
|
|
5496
|
-
[partnerPublicKey],
|
|
5497
|
-
mintPublicKey,
|
|
5498
|
-
sender,
|
|
5499
|
-
true
|
|
5500
|
-
);
|
|
5595
|
+
const prepareInstructions = await this.getCreateATAInstructions([partnerPublicKey], mintPublicKey, sender, true);
|
|
5501
5596
|
if (isNative) {
|
|
5502
5597
|
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
|
-
);
|
|
5598
|
+
const nativeInstructions = await prepareWrappedAccount(this.connection, sender.publicKey, totalDepositedAmount);
|
|
5508
5599
|
prepareInstructions.push(...nativeInstructions);
|
|
5509
5600
|
}
|
|
5510
5601
|
return {
|
|
@@ -5702,10 +5793,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5702
5793
|
async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, extParams) {
|
|
5703
5794
|
const { invoker, customInstructions } = extParams;
|
|
5704
5795
|
assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5705
|
-
const ixs = await this.prepareWithdrawInstructions(
|
|
5706
|
-
{ id, amount },
|
|
5707
|
-
extParams
|
|
5708
|
-
);
|
|
5796
|
+
const ixs = await this.prepareWithdrawInstructions({ id, amount }, extParams);
|
|
5709
5797
|
const metadata = new PublicKey(id);
|
|
5710
5798
|
await this.applyCustomAfterInstructions(ixs, customInstructions, metadata);
|
|
5711
5799
|
const { tx, hash, context } = await prepareTransaction(this.connection, ixs, invoker.publicKey);
|
|
@@ -6209,17 +6297,26 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6209
6297
|
const streamPublicKey = new PublicKey(data.id);
|
|
6210
6298
|
const escrow = await this.connection.getAccountInfo(streamPublicKey);
|
|
6211
6299
|
invariant(escrow, "Couldn't get account info");
|
|
6300
|
+
const { sender: senderPublicKey } = decodeStream(escrow.data);
|
|
6301
|
+
const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, senderPublicKey);
|
|
6302
|
+
if (isAlignedUnlock && (data.enableAutomaticWithdrawal !== void 0 || data.amountPerPeriod !== void 0)) {
|
|
6303
|
+
throw new Error("Automatic withdrawal and rate update are not possible in price-based vesting!");
|
|
6304
|
+
}
|
|
6212
6305
|
const ixs = prepareBaseInstructions(this.connection, {
|
|
6213
6306
|
computePrice,
|
|
6214
6307
|
computeLimit
|
|
6215
6308
|
});
|
|
6216
6309
|
ixs.push(
|
|
6217
|
-
await
|
|
6310
|
+
await (isAlignedUnlock ? this.alignedProxyProgram.methods.updateContract({
|
|
6311
|
+
transferableBySender: data.transferableBySender ?? null,
|
|
6312
|
+
transferableByRecipient: data.transferableByRecipient ?? null,
|
|
6313
|
+
cancelableBySender: data.cancelableBySender ?? null
|
|
6314
|
+
}).accounts({ sender: invoker.publicKey, streamMetadata: streamPublicKey, withdrawor: WITHDRAWOR_PUBLIC_KEY }).accountsPartial({ streamflowProgram: this.programId }).instruction() : updateStreamInstruction(data, this.programId, {
|
|
6218
6315
|
authority: invoker.publicKey,
|
|
6219
6316
|
metadata: streamPublicKey,
|
|
6220
6317
|
withdrawor: WITHDRAWOR_PUBLIC_KEY,
|
|
6221
6318
|
systemProgram: SystemProgram.programId
|
|
6222
|
-
})
|
|
6319
|
+
}))
|
|
6223
6320
|
);
|
|
6224
6321
|
return ixs;
|
|
6225
6322
|
}
|
|
@@ -6264,8 +6361,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6264
6361
|
return extractSolanaErrorCode(err.toString() ?? "Unknown error!", logs);
|
|
6265
6362
|
}
|
|
6266
6363
|
/**
|
|
6267
|
-
|
|
6268
|
-
|
|
6364
|
+
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
|
|
6365
|
+
*/
|
|
6269
6366
|
isAlignedUnlock(streamPublicKey, senderPublicKey) {
|
|
6270
6367
|
const pda = deriveContractPDA(this.alignedProxyProgram.programId, streamPublicKey);
|
|
6271
6368
|
return senderPublicKey.equals(pda);
|