@streamflow/stream 9.3.4 → 9.4.0-alpha.p325.15b4539
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/{BaseStreamClient-CHsnYIS9.d.cts → BaseStreamClient-BRangMb7.d.cts} +5 -0
- package/dist/cjs/aptos/index.d.cts +2 -2
- package/dist/cjs/evm/index.d.cts +2 -2
- package/dist/cjs/{index-C23IQA_J.d.cts → index-BLHxwbFK.d.cts} +1 -1
- package/dist/cjs/{index-W_ordLlY.d.cts → index-Bk3BX3xT.d.cts} +1 -1
- package/dist/cjs/{index-BPXCu9SM.d.cts → index-CQ0MapA9.d.cts} +1 -1
- package/dist/cjs/{index-BUzIZ0Xt.d.cts → index-odfplH5I.d.cts} +48 -10
- package/dist/cjs/index.cjs +60 -22
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +10 -10
- package/dist/cjs/solana/index.cjs +57 -22
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +2 -2
- package/dist/cjs/sui/index.d.cts +2 -2
- package/dist/esm/{BaseStreamClient-CHsnYIS9.d.ts → BaseStreamClient-BRangMb7.d.ts} +5 -0
- package/dist/esm/aptos/index.d.ts +2 -2
- package/dist/esm/evm/index.d.ts +2 -2
- package/dist/esm/{index-NAVXCAs6.d.ts → index-C2SrwWri.d.ts} +1 -1
- package/dist/esm/{index-DeXLiSzq.d.ts → index-D_k66_bp.d.ts} +1 -1
- package/dist/esm/{index-Dy_mbGDE.d.ts → index-DfKoIGsU.d.ts} +48 -10
- package/dist/esm/{index-Qi50rkRx.d.ts → index-DnUf1qd8.d.ts} +1 -1
- package/dist/esm/index.d.ts +10 -10
- package/dist/esm/index.js +58 -23
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +2 -2
- package/dist/esm/solana/index.js +57 -22
- package/dist/esm/solana/index.js.map +1 -1
- package/dist/esm/sui/index.d.ts +2 -2
- package/package.json +4 -4
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { A as AptosStreamClient, I as ICreateStreamAptosExt, a as ITransactionAptosExt } from './index-
|
|
2
|
-
export { i as StreamflowAptos } from './index-
|
|
3
|
-
import { E as EvmStreamClient } from './index-
|
|
4
|
-
export { i as StreamflowEVM } from './index-
|
|
5
|
-
import { S as SolanaStreamClient, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, b as ITopUpStreamSolanaExt } from './index-
|
|
6
|
-
export {
|
|
7
|
-
import { S as SuiStreamClient } from './index-
|
|
8
|
-
export { i as StreamflowSui } from './index-
|
|
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-
|
|
10
|
-
export { H as AlignedStreamData, G as ContractErrorCode, w as IAlignedStreamConfig, v as IBaseStreamConfig, x as ICreateLinearStreamData, D as ICreateMultiError, z as ICreateMultipleAlignedStreamData, y as ICreateMultipleLinearStreamData, C as IInteractData, u as IRecipient, L as LinearStream, O as OracleTypeName, K as SolanaAlignedProxyErrorCode, J as SolanaContractErrorCode, M as SolanaTransactionSchedulingOptions, F as StreamDirection } from './BaseStreamClient-
|
|
1
|
+
import { A as AptosStreamClient, I as ICreateStreamAptosExt, a as ITransactionAptosExt } from './index-Bk3BX3xT.cjs';
|
|
2
|
+
export { i as StreamflowAptos } from './index-Bk3BX3xT.cjs';
|
|
3
|
+
import { E as EvmStreamClient } from './index-BLHxwbFK.cjs';
|
|
4
|
+
export { i as StreamflowEVM } from './index-BLHxwbFK.cjs';
|
|
5
|
+
import { S as SolanaStreamClient, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, b as ITopUpStreamSolanaExt } from './index-odfplH5I.cjs';
|
|
6
|
+
export { v as AIRDROP_AMOUNT, r as AIRDROP_TEST_TOKEN, k as ALIGNED_COMPUTE_LIMIT, A as ALIGNED_PRECISION_FACTOR_POW, h as ALIGNED_UNLOCKS_PROGRAM_ID, l as CONTRACT_DISCRIMINATOR, n as CONTRACT_SEED, C as CREATE_PARAMS_PADDING, t as DEFAULT_AUTO_CLAIM_FEE_SOL, D as DEFAULT_CREATION_FEE_SOL, u as DEFAULT_STREAMFLOW_FEE, E as ESCROW_SEED, s as FEES_METADATA_SEED, F as FEE_ORACLE_PUBLIC_KEY, O as ORIGINAL_CONTRACT_SENDER_OFFSET, x as PARTNERS_SCHEMA, j as PARTNER_ORACLE_PROGRAM_ID, w as PARTNER_SCHEMA, P as PROGRAM_ID, z as SOLANA_ERROR_MAP, y 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, m as TEST_ORACLE_DISCRIMINATOR, o as TEST_ORACLE_SEED, T as TX_FINALITY_CONFIRMED, W as WITHDRAWOR, q as WITHDRAWOR_PUBLIC_KEY } from './index-odfplH5I.cjs';
|
|
7
|
+
import { S as SuiStreamClient } from './index-CQ0MapA9.cjs';
|
|
8
|
+
export { i as StreamflowSui } from './index-CQ0MapA9.cjs';
|
|
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-BRangMb7.cjs';
|
|
10
|
+
export { H as AlignedStreamData, G as ContractErrorCode, w as IAlignedStreamConfig, v as IBaseStreamConfig, x as ICreateLinearStreamData, D as ICreateMultiError, z as ICreateMultipleAlignedStreamData, y as ICreateMultipleLinearStreamData, C as IInteractData, u as IRecipient, L as LinearStream, O as OracleTypeName, K as SolanaAlignedProxyErrorCode, J as SolanaContractErrorCode, M as SolanaTransactionSchedulingOptions, F as StreamDirection } from './BaseStreamClient-BRangMb7.cjs';
|
|
11
11
|
import BN from 'bn.js';
|
|
12
12
|
import { IChain } from '@streamflow/common';
|
|
13
13
|
export { ContractError, IChain, ICluster } from '@streamflow/common';
|
|
@@ -114,6 +114,8 @@ __export(constants_exports, {
|
|
|
114
114
|
CONTRACT_DISCRIMINATOR: () => CONTRACT_DISCRIMINATOR,
|
|
115
115
|
CONTRACT_SEED: () => CONTRACT_SEED,
|
|
116
116
|
CREATE_PARAMS_PADDING: () => CREATE_PARAMS_PADDING,
|
|
117
|
+
DEFAULT_AUTO_CLAIM_FEE_SOL: () => DEFAULT_AUTO_CLAIM_FEE_SOL,
|
|
118
|
+
DEFAULT_CREATION_FEE_SOL: () => DEFAULT_CREATION_FEE_SOL,
|
|
117
119
|
DEFAULT_STREAMFLOW_FEE: () => DEFAULT_STREAMFLOW_FEE,
|
|
118
120
|
ESCROW_SEED: () => ESCROW_SEED,
|
|
119
121
|
FEES_METADATA_SEED: () => FEES_METADATA_SEED,
|
|
@@ -134,6 +136,7 @@ __export(constants_exports, {
|
|
|
134
136
|
TEST_ORACLE_DISCRIMINATOR: () => TEST_ORACLE_DISCRIMINATOR,
|
|
135
137
|
TEST_ORACLE_SEED: () => TEST_ORACLE_SEED,
|
|
136
138
|
TX_FINALITY_CONFIRMED: () => TX_FINALITY_CONFIRMED,
|
|
139
|
+
WITHDRAWOR: () => WITHDRAWOR,
|
|
137
140
|
WITHDRAWOR_PUBLIC_KEY: () => WITHDRAWOR_PUBLIC_KEY
|
|
138
141
|
});
|
|
139
142
|
var TX_FINALITY_CONFIRMED = "confirmed";
|
|
@@ -162,25 +165,40 @@ var ALIGNED_UNLOCKS_PROGRAM_ID = {
|
|
|
162
165
|
[common.ICluster.Testnet]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
|
|
163
166
|
[common.ICluster.Local]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH"
|
|
164
167
|
};
|
|
168
|
+
var PARTNER_ORACLE_PROGRAM_ID = {
|
|
169
|
+
[common.ICluster.Devnet]: "pardoTarcc6HKsPcbXkVycxsJsoN9QEzrdHgVdHAGY3",
|
|
170
|
+
[common.ICluster.Mainnet]: "pardpVtPjC8nLj1Dwncew62mUzfChdCX1EaoZe8oCAa",
|
|
171
|
+
[common.ICluster.Testnet]: "pardoTarcc6HKsPcbXkVycxsJsoN9QEzrdHgVdHAGY3",
|
|
172
|
+
[common.ICluster.Local]: "pardoTarcc6HKsPcbXkVycxsJsoN9QEzrdHgVdHAGY3"
|
|
173
|
+
};
|
|
174
|
+
var FEE_ORACLE_PUBLIC_KEY = {
|
|
175
|
+
[common.ICluster.Devnet]: "Aa2JJfFzUN3V54DXUHRBJowFw416xfZHpPk9DaNy3iYs",
|
|
176
|
+
[common.ICluster.Mainnet]: "B743wFVk2pCYhV91cn287e1xY7f1vt4gdY48hhNiuQmT",
|
|
177
|
+
[common.ICluster.Testnet]: "Aa2JJfFzUN3V54DXUHRBJowFw416xfZHpPk9DaNy3iYs",
|
|
178
|
+
[common.ICluster.Local]: "Aa2JJfFzUN3V54DXUHRBJowFw416xfZHpPk9DaNy3iYs"
|
|
179
|
+
};
|
|
165
180
|
var ALIGNED_COMPUTE_LIMIT = 3e5;
|
|
166
181
|
var CONTRACT_DISCRIMINATOR = [172, 138, 115, 242, 121, 67, 183, 26];
|
|
167
182
|
var TEST_ORACLE_DISCRIMINATOR = [198, 49, 63, 134, 232, 251, 168, 28];
|
|
168
183
|
var CONTRACT_SEED = buffer.Buffer.from("contract", "utf-8");
|
|
169
184
|
var ESCROW_SEED = buffer.Buffer.from("strm", "utf-8");
|
|
170
185
|
var TEST_ORACLE_SEED = buffer.Buffer.from("test-oracle", "utf-8");
|
|
171
|
-
var PARTNER_ORACLE_PROGRAM_ID = "pardpVtPjC8nLj1Dwncew62mUzfChdCX1EaoZe8oCAa";
|
|
172
186
|
var STREAMFLOW_TREASURY_PUBLIC_KEY = new web3_js.PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
|
|
173
|
-
var
|
|
174
|
-
var
|
|
187
|
+
var WITHDRAWOR = "wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u";
|
|
188
|
+
var WITHDRAWOR_PUBLIC_KEY = new web3_js.PublicKey(WITHDRAWOR);
|
|
175
189
|
var AIRDROP_TEST_TOKEN = "Gssm3vfi8s65R31SBdmQRq6cKeYojGgup7whkw4VCiQj";
|
|
176
190
|
var FEES_METADATA_SEED = buffer.Buffer.from("strm_fees");
|
|
177
|
-
var
|
|
191
|
+
var DEFAULT_CREATION_FEE_SOL = 9e7;
|
|
192
|
+
var DEFAULT_AUTO_CLAIM_FEE_SOL = 19e7;
|
|
193
|
+
var DEFAULT_STREAMFLOW_FEE = 0.19;
|
|
178
194
|
var AIRDROP_AMOUNT = 1;
|
|
179
195
|
var PARTNER_SCHEMA = {
|
|
180
196
|
struct: {
|
|
181
197
|
pubkey: { array: { type: "u8", len: 32 } },
|
|
182
|
-
|
|
183
|
-
|
|
198
|
+
creation_fee: "u32",
|
|
199
|
+
auto_claim_fee: "u32",
|
|
200
|
+
token_fee_percent: "f32",
|
|
201
|
+
buffer: { array: { type: "u8", len: 16 } }
|
|
184
202
|
}
|
|
185
203
|
};
|
|
186
204
|
var PARTNERS_SCHEMA = { array: { type: PARTNER_SCHEMA } };
|
|
@@ -2518,6 +2536,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2518
2536
|
this.commitment = commitment;
|
|
2519
2537
|
this.connection = new web3_js.Connection(optionsOrClusterUrl, this.commitment);
|
|
2520
2538
|
this.programId = programId !== "" ? new web3_js.PublicKey(programId) : new web3_js.PublicKey(PROGRAM_ID[cluster]);
|
|
2539
|
+
this.partnerOracleProgramId = new web3_js.PublicKey(PARTNER_ORACLE_PROGRAM_ID[cluster]);
|
|
2540
|
+
this.feeOraclePublicKey = new web3_js.PublicKey(FEE_ORACLE_PUBLIC_KEY[cluster]);
|
|
2521
2541
|
this.schedulingParams = {
|
|
2522
2542
|
sendThrottler: sendThrottler ?? solana.buildSendThrottler(sendRate)
|
|
2523
2543
|
};
|
|
@@ -2532,6 +2552,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2532
2552
|
this.commitment = commitment2;
|
|
2533
2553
|
this.connection = new web3_js.Connection(clusterUrl, this.commitment);
|
|
2534
2554
|
this.programId = programId2 !== "" ? new web3_js.PublicKey(programId2) : new web3_js.PublicKey(PROGRAM_ID[cluster2]);
|
|
2555
|
+
this.partnerOracleProgramId = new web3_js.PublicKey(PARTNER_ORACLE_PROGRAM_ID[cluster2]);
|
|
2556
|
+
this.feeOraclePublicKey = new web3_js.PublicKey(FEE_ORACLE_PUBLIC_KEY[cluster2]);
|
|
2535
2557
|
const schedulingOptions = sendScheduler && "sendRate" in sendScheduler ? sendScheduler : void 0;
|
|
2536
2558
|
const sendThrottler2 = !sendScheduler ? solana.buildSendThrottler(1) : "sendRate" in sendScheduler ? solana.buildSendThrottler(sendScheduler.sendRate ?? 1, sendScheduler.sendInterval) : sendScheduler;
|
|
2537
2559
|
this.schedulingParams = {
|
|
@@ -2755,7 +2777,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2755
2777
|
partner: partnerPublicKey,
|
|
2756
2778
|
recipient: recipientPublicKey,
|
|
2757
2779
|
withdrawor: WITHDRAWOR_PUBLIC_KEY,
|
|
2758
|
-
feeOracle:
|
|
2780
|
+
feeOracle: this.feeOraclePublicKey,
|
|
2759
2781
|
priceOracle: oracle,
|
|
2760
2782
|
tokenProgram: tokenProgramId,
|
|
2761
2783
|
streamflowProgram: this.programId
|
|
@@ -2846,7 +2868,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2846
2868
|
partner: partnerPublicKey,
|
|
2847
2869
|
partnerTokens,
|
|
2848
2870
|
mint: new web3_js.PublicKey(mint),
|
|
2849
|
-
feeOracle:
|
|
2871
|
+
feeOracle: this.feeOraclePublicKey,
|
|
2850
2872
|
rent: web3_js.SYSVAR_RENT_PUBKEY,
|
|
2851
2873
|
timelockProgram: this.programId,
|
|
2852
2874
|
tokenProgram: tokenProgramId,
|
|
@@ -2973,7 +2995,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2973
2995
|
metadata: metadataPubKey,
|
|
2974
2996
|
escrowTokens,
|
|
2975
2997
|
mint: new web3_js.PublicKey(mint),
|
|
2976
|
-
feeOracle:
|
|
2998
|
+
feeOracle: this.feeOraclePublicKey,
|
|
2977
2999
|
rent: web3_js.SYSVAR_RENT_PUBKEY,
|
|
2978
3000
|
timelockProgram: this.programId,
|
|
2979
3001
|
tokenProgram: tokenProgramId,
|
|
@@ -3779,30 +3801,43 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3779
3801
|
* @returns Fees
|
|
3780
3802
|
*/
|
|
3781
3803
|
async getFees({ address }) {
|
|
3782
|
-
const
|
|
3783
|
-
[buffer.Buffer.from(FEES_METADATA_SEED)],
|
|
3784
|
-
new web3_js.PublicKey(PARTNER_ORACLE_PROGRAM_ID)
|
|
3785
|
-
);
|
|
3786
|
-
const data = await this.connection.getAccountInfo(metadataPubKey);
|
|
3804
|
+
const data = await this.connection.getAccountInfo(this.feeOraclePublicKey);
|
|
3787
3805
|
if (!data) {
|
|
3788
3806
|
return null;
|
|
3789
3807
|
}
|
|
3790
3808
|
const partners = borsh__namespace.deserialize(PARTNERS_SCHEMA, data.data);
|
|
3791
|
-
const
|
|
3792
|
-
|
|
3793
|
-
|
|
3809
|
+
for (const partner of partners) {
|
|
3810
|
+
const partnerAddress = new web3_js.PublicKey(partner.pubkey).toString();
|
|
3811
|
+
if (partnerAddress === address) {
|
|
3812
|
+
return {
|
|
3813
|
+
creationFeeSol: Number(partner.creation_fee),
|
|
3814
|
+
autoClaimFeeSol: Number(partner.auto_claim_fee),
|
|
3815
|
+
streamflowFee: Number(partner.token_fee_percent.toFixed(4)),
|
|
3816
|
+
partnerFee: 0
|
|
3817
|
+
};
|
|
3818
|
+
}
|
|
3794
3819
|
}
|
|
3795
|
-
return
|
|
3796
|
-
streamflowFee: Number(filteredPartners[0].strm_fee.toFixed(4)),
|
|
3797
|
-
partnerFee: Number(filteredPartners[0].partner_fee.toFixed(4))
|
|
3798
|
-
};
|
|
3820
|
+
return null;
|
|
3799
3821
|
}
|
|
3800
3822
|
/**
|
|
3801
3823
|
* Gets default streamflow fee
|
|
3802
3824
|
* @returns Default streamflow fee
|
|
3803
3825
|
*/
|
|
3804
3826
|
async getDefaultStreamflowFee() {
|
|
3805
|
-
return
|
|
3827
|
+
return (await this.getDefaultFees()).streamflowFee;
|
|
3828
|
+
}
|
|
3829
|
+
/**
|
|
3830
|
+
* Get all defaults fees applied by the protocol.
|
|
3831
|
+
*
|
|
3832
|
+
* Protocol will use fees set for WITHDRAWOR as default if they are set.
|
|
3833
|
+
*/
|
|
3834
|
+
async getDefaultFees() {
|
|
3835
|
+
return await this.getFees({ address: WITHDRAWOR }) || {
|
|
3836
|
+
creationFeeSol: DEFAULT_CREATION_FEE_SOL,
|
|
3837
|
+
autoClaimFeeSol: DEFAULT_AUTO_CLAIM_FEE_SOL,
|
|
3838
|
+
streamflowFee: DEFAULT_STREAMFLOW_FEE,
|
|
3839
|
+
partnerFee: 0
|
|
3840
|
+
};
|
|
3806
3841
|
}
|
|
3807
3842
|
/**
|
|
3808
3843
|
* Extracts error code from an error
|