@streamflow/stream 9.0.3 → 9.1.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 +136 -29
- 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 +136 -29
- 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 +136 -29
- 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 +136 -29
- 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);
|
|
@@ -6155,10 +6243,20 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6155
6243
|
const accounts = await this.connection.getProgramAccounts(this.programId, {
|
|
6156
6244
|
filters
|
|
6157
6245
|
});
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6246
|
+
const mapped = await Promise.all(
|
|
6247
|
+
accounts.map(async ({ pubkey, account }) => {
|
|
6248
|
+
const stream = decodeStream(account.data);
|
|
6249
|
+
if (this.isAlignedUnlock(pubkey, stream.sender)) {
|
|
6250
|
+
const alignedProxy = await this.alignedProxyProgram.account.contract.fetch(
|
|
6251
|
+
deriveContractPDA(this.alignedProxyProgram.programId, pubkey)
|
|
6252
|
+
);
|
|
6253
|
+
invariant(alignedProxy, "Couldn't get aligned proxy account info");
|
|
6254
|
+
return { publicKey: pubkey, account: new AlignedContract(stream, alignedProxy) };
|
|
6255
|
+
}
|
|
6256
|
+
return { publicKey: pubkey, account: new Contract2(stream) };
|
|
6257
|
+
})
|
|
6258
|
+
);
|
|
6259
|
+
return mapped;
|
|
6162
6260
|
}
|
|
6163
6261
|
/**
|
|
6164
6262
|
* Attempts updating the stream auto withdrawal params and amount per period
|
|
@@ -6199,17 +6297,26 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6199
6297
|
const streamPublicKey = new PublicKey(data.id);
|
|
6200
6298
|
const escrow = await this.connection.getAccountInfo(streamPublicKey);
|
|
6201
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
|
+
}
|
|
6202
6305
|
const ixs = prepareBaseInstructions(this.connection, {
|
|
6203
6306
|
computePrice,
|
|
6204
6307
|
computeLimit
|
|
6205
6308
|
});
|
|
6206
6309
|
ixs.push(
|
|
6207
|
-
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, {
|
|
6208
6315
|
authority: invoker.publicKey,
|
|
6209
6316
|
metadata: streamPublicKey,
|
|
6210
6317
|
withdrawor: WITHDRAWOR_PUBLIC_KEY,
|
|
6211
6318
|
systemProgram: SystemProgram.programId
|
|
6212
|
-
})
|
|
6319
|
+
}))
|
|
6213
6320
|
);
|
|
6214
6321
|
return ixs;
|
|
6215
6322
|
}
|
|
@@ -6254,8 +6361,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6254
6361
|
return extractSolanaErrorCode(err.toString() ?? "Unknown error!", logs);
|
|
6255
6362
|
}
|
|
6256
6363
|
/**
|
|
6257
|
-
|
|
6258
|
-
|
|
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
|
+
*/
|
|
6259
6366
|
isAlignedUnlock(streamPublicKey, senderPublicKey) {
|
|
6260
6367
|
const pda = deriveContractPDA(this.alignedProxyProgram.programId, streamPublicKey);
|
|
6261
6368
|
return senderPublicKey.equals(pda);
|