@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a1 as Account, a8 as AlignedContract, R as AlignedUnlocksContract, ab as BatchItem, ad as BatchItemError, ae as BatchItemResult, ac as BatchItemSuccess, Y as ChangeOracleParams, G as ClientCreationOptions, a7 as Contract, X as CreateParams, Z as CreateTestOracleParams, a9 as DecodedStream, a2 as ICreateSolanaExt, a6 as ICreateStreamInstructions, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, a4 as IPrepareCreateStreamSolanaExt, a5 as IPrepareStreamSolanaExt, a0 as ISearchStreams, b as ITopUpStreamSolanaExt, a3 as ITransactionSolanaExtWithInstructions, af as InstructionGenerator, aa as MetadataRecipientHashMap, U as OracleType, S as SolanaStreamClient, V as TestOracle, $ as UpdateTestOracleParams, ak as cancelStreamInstruction, B as constants, ag as createStreamInstruction, ah as createUncheckedStreamInstruction, H as decodeStream, M as deriveContractPDA, N as deriveEscrowPDA, Q as deriveTestOraclePDA, L as extractSolanaErrorCode, K as sendAndConfirmStreamRawTransaction, J as signAllTransactionWithRecipients, _ as timelockIDL, am as topupStreamInstruction, al as transferStreamInstruction, aj as updateStreamInstruction, ai as withdrawStreamInstruction } from '../index-DfKoIGsU.js';
|
|
2
2
|
export { ContractError, IChain, ICluster } from '@streamflow/common';
|
|
3
3
|
import 'p-queue';
|
|
4
4
|
import '@solana/web3.js';
|
|
@@ -6,7 +6,7 @@ import '@streamflow/common/solana';
|
|
|
6
6
|
import '@coral-xyz/anchor';
|
|
7
7
|
import '@solana/wallet-adapter-base';
|
|
8
8
|
import 'bn.js';
|
|
9
|
-
import '../BaseStreamClient-
|
|
9
|
+
import '../BaseStreamClient-BRangMb7.js';
|
|
10
10
|
import 'ethers';
|
|
11
11
|
import 'aptos';
|
|
12
12
|
import '@mysten/sui/cryptography';
|
package/dist/esm/solana/index.js
CHANGED
|
@@ -88,6 +88,8 @@ __export(constants_exports, {
|
|
|
88
88
|
CONTRACT_DISCRIMINATOR: () => CONTRACT_DISCRIMINATOR,
|
|
89
89
|
CONTRACT_SEED: () => CONTRACT_SEED,
|
|
90
90
|
CREATE_PARAMS_PADDING: () => CREATE_PARAMS_PADDING,
|
|
91
|
+
DEFAULT_AUTO_CLAIM_FEE_SOL: () => DEFAULT_AUTO_CLAIM_FEE_SOL,
|
|
92
|
+
DEFAULT_CREATION_FEE_SOL: () => DEFAULT_CREATION_FEE_SOL,
|
|
91
93
|
DEFAULT_STREAMFLOW_FEE: () => DEFAULT_STREAMFLOW_FEE,
|
|
92
94
|
ESCROW_SEED: () => ESCROW_SEED,
|
|
93
95
|
FEES_METADATA_SEED: () => FEES_METADATA_SEED,
|
|
@@ -108,6 +110,7 @@ __export(constants_exports, {
|
|
|
108
110
|
TEST_ORACLE_DISCRIMINATOR: () => TEST_ORACLE_DISCRIMINATOR,
|
|
109
111
|
TEST_ORACLE_SEED: () => TEST_ORACLE_SEED,
|
|
110
112
|
TX_FINALITY_CONFIRMED: () => TX_FINALITY_CONFIRMED,
|
|
113
|
+
WITHDRAWOR: () => WITHDRAWOR,
|
|
111
114
|
WITHDRAWOR_PUBLIC_KEY: () => WITHDRAWOR_PUBLIC_KEY
|
|
112
115
|
});
|
|
113
116
|
var TX_FINALITY_CONFIRMED = "confirmed";
|
|
@@ -136,25 +139,40 @@ var ALIGNED_UNLOCKS_PROGRAM_ID = {
|
|
|
136
139
|
[ICluster.Testnet]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
|
|
137
140
|
[ICluster.Local]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH"
|
|
138
141
|
};
|
|
142
|
+
var PARTNER_ORACLE_PROGRAM_ID = {
|
|
143
|
+
[ICluster.Devnet]: "pardoTarcc6HKsPcbXkVycxsJsoN9QEzrdHgVdHAGY3",
|
|
144
|
+
[ICluster.Mainnet]: "pardpVtPjC8nLj1Dwncew62mUzfChdCX1EaoZe8oCAa",
|
|
145
|
+
[ICluster.Testnet]: "pardoTarcc6HKsPcbXkVycxsJsoN9QEzrdHgVdHAGY3",
|
|
146
|
+
[ICluster.Local]: "pardoTarcc6HKsPcbXkVycxsJsoN9QEzrdHgVdHAGY3"
|
|
147
|
+
};
|
|
148
|
+
var FEE_ORACLE_PUBLIC_KEY = {
|
|
149
|
+
[ICluster.Devnet]: "Aa2JJfFzUN3V54DXUHRBJowFw416xfZHpPk9DaNy3iYs",
|
|
150
|
+
[ICluster.Mainnet]: "B743wFVk2pCYhV91cn287e1xY7f1vt4gdY48hhNiuQmT",
|
|
151
|
+
[ICluster.Testnet]: "Aa2JJfFzUN3V54DXUHRBJowFw416xfZHpPk9DaNy3iYs",
|
|
152
|
+
[ICluster.Local]: "Aa2JJfFzUN3V54DXUHRBJowFw416xfZHpPk9DaNy3iYs"
|
|
153
|
+
};
|
|
139
154
|
var ALIGNED_COMPUTE_LIMIT = 3e5;
|
|
140
155
|
var CONTRACT_DISCRIMINATOR = [172, 138, 115, 242, 121, 67, 183, 26];
|
|
141
156
|
var TEST_ORACLE_DISCRIMINATOR = [198, 49, 63, 134, 232, 251, 168, 28];
|
|
142
157
|
var CONTRACT_SEED = Buffer.from("contract", "utf-8");
|
|
143
158
|
var ESCROW_SEED = Buffer.from("strm", "utf-8");
|
|
144
159
|
var TEST_ORACLE_SEED = Buffer.from("test-oracle", "utf-8");
|
|
145
|
-
var PARTNER_ORACLE_PROGRAM_ID = "pardpVtPjC8nLj1Dwncew62mUzfChdCX1EaoZe8oCAa";
|
|
146
160
|
var STREAMFLOW_TREASURY_PUBLIC_KEY = new PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
|
|
147
|
-
var
|
|
148
|
-
var
|
|
161
|
+
var WITHDRAWOR = "wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u";
|
|
162
|
+
var WITHDRAWOR_PUBLIC_KEY = new PublicKey(WITHDRAWOR);
|
|
149
163
|
var AIRDROP_TEST_TOKEN = "Gssm3vfi8s65R31SBdmQRq6cKeYojGgup7whkw4VCiQj";
|
|
150
164
|
var FEES_METADATA_SEED = Buffer.from("strm_fees");
|
|
151
|
-
var
|
|
165
|
+
var DEFAULT_CREATION_FEE_SOL = 9e7;
|
|
166
|
+
var DEFAULT_AUTO_CLAIM_FEE_SOL = 19e7;
|
|
167
|
+
var DEFAULT_STREAMFLOW_FEE = 0.19;
|
|
152
168
|
var AIRDROP_AMOUNT = 1;
|
|
153
169
|
var PARTNER_SCHEMA = {
|
|
154
170
|
struct: {
|
|
155
171
|
pubkey: { array: { type: "u8", len: 32 } },
|
|
156
|
-
|
|
157
|
-
|
|
172
|
+
creation_fee: "u32",
|
|
173
|
+
auto_claim_fee: "u32",
|
|
174
|
+
token_fee_percent: "f32",
|
|
175
|
+
buffer: { array: { type: "u8", len: 16 } }
|
|
158
176
|
}
|
|
159
177
|
};
|
|
160
178
|
var PARTNERS_SCHEMA = { array: { type: PARTNER_SCHEMA } };
|
|
@@ -2492,6 +2510,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2492
2510
|
this.commitment = commitment;
|
|
2493
2511
|
this.connection = new Connection(optionsOrClusterUrl, this.commitment);
|
|
2494
2512
|
this.programId = programId !== "" ? new PublicKey(programId) : new PublicKey(PROGRAM_ID[cluster]);
|
|
2513
|
+
this.partnerOracleProgramId = new PublicKey(PARTNER_ORACLE_PROGRAM_ID[cluster]);
|
|
2514
|
+
this.feeOraclePublicKey = new PublicKey(FEE_ORACLE_PUBLIC_KEY[cluster]);
|
|
2495
2515
|
this.schedulingParams = {
|
|
2496
2516
|
sendThrottler: sendThrottler ?? buildSendThrottler(sendRate)
|
|
2497
2517
|
};
|
|
@@ -2506,6 +2526,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2506
2526
|
this.commitment = commitment2;
|
|
2507
2527
|
this.connection = new Connection(clusterUrl, this.commitment);
|
|
2508
2528
|
this.programId = programId2 !== "" ? new PublicKey(programId2) : new PublicKey(PROGRAM_ID[cluster2]);
|
|
2529
|
+
this.partnerOracleProgramId = new PublicKey(PARTNER_ORACLE_PROGRAM_ID[cluster2]);
|
|
2530
|
+
this.feeOraclePublicKey = new PublicKey(FEE_ORACLE_PUBLIC_KEY[cluster2]);
|
|
2509
2531
|
const schedulingOptions = sendScheduler && "sendRate" in sendScheduler ? sendScheduler : void 0;
|
|
2510
2532
|
const sendThrottler2 = !sendScheduler ? buildSendThrottler(1) : "sendRate" in sendScheduler ? buildSendThrottler(sendScheduler.sendRate ?? 1, sendScheduler.sendInterval) : sendScheduler;
|
|
2511
2533
|
this.schedulingParams = {
|
|
@@ -2729,7 +2751,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2729
2751
|
partner: partnerPublicKey,
|
|
2730
2752
|
recipient: recipientPublicKey,
|
|
2731
2753
|
withdrawor: WITHDRAWOR_PUBLIC_KEY,
|
|
2732
|
-
feeOracle:
|
|
2754
|
+
feeOracle: this.feeOraclePublicKey,
|
|
2733
2755
|
priceOracle: oracle,
|
|
2734
2756
|
tokenProgram: tokenProgramId,
|
|
2735
2757
|
streamflowProgram: this.programId
|
|
@@ -2820,7 +2842,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2820
2842
|
partner: partnerPublicKey,
|
|
2821
2843
|
partnerTokens,
|
|
2822
2844
|
mint: new PublicKey(mint),
|
|
2823
|
-
feeOracle:
|
|
2845
|
+
feeOracle: this.feeOraclePublicKey,
|
|
2824
2846
|
rent: SYSVAR_RENT_PUBKEY,
|
|
2825
2847
|
timelockProgram: this.programId,
|
|
2826
2848
|
tokenProgram: tokenProgramId,
|
|
@@ -2947,7 +2969,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2947
2969
|
metadata: metadataPubKey,
|
|
2948
2970
|
escrowTokens,
|
|
2949
2971
|
mint: new PublicKey(mint),
|
|
2950
|
-
feeOracle:
|
|
2972
|
+
feeOracle: this.feeOraclePublicKey,
|
|
2951
2973
|
rent: SYSVAR_RENT_PUBKEY,
|
|
2952
2974
|
timelockProgram: this.programId,
|
|
2953
2975
|
tokenProgram: tokenProgramId,
|
|
@@ -3753,30 +3775,43 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3753
3775
|
* @returns Fees
|
|
3754
3776
|
*/
|
|
3755
3777
|
async getFees({ address }) {
|
|
3756
|
-
const
|
|
3757
|
-
[Buffer.from(FEES_METADATA_SEED)],
|
|
3758
|
-
new PublicKey(PARTNER_ORACLE_PROGRAM_ID)
|
|
3759
|
-
);
|
|
3760
|
-
const data = await this.connection.getAccountInfo(metadataPubKey);
|
|
3778
|
+
const data = await this.connection.getAccountInfo(this.feeOraclePublicKey);
|
|
3761
3779
|
if (!data) {
|
|
3762
3780
|
return null;
|
|
3763
3781
|
}
|
|
3764
3782
|
const partners = borsh.deserialize(PARTNERS_SCHEMA, data.data);
|
|
3765
|
-
const
|
|
3766
|
-
|
|
3767
|
-
|
|
3783
|
+
for (const partner of partners) {
|
|
3784
|
+
const partnerAddress = new PublicKey(partner.pubkey).toString();
|
|
3785
|
+
if (partnerAddress === address) {
|
|
3786
|
+
return {
|
|
3787
|
+
creationFeeSol: Number(partner.creation_fee),
|
|
3788
|
+
autoClaimFeeSol: Number(partner.auto_claim_fee),
|
|
3789
|
+
streamflowFee: Number(partner.token_fee_percent.toFixed(4)),
|
|
3790
|
+
partnerFee: 0
|
|
3791
|
+
};
|
|
3792
|
+
}
|
|
3768
3793
|
}
|
|
3769
|
-
return
|
|
3770
|
-
streamflowFee: Number(filteredPartners[0].strm_fee.toFixed(4)),
|
|
3771
|
-
partnerFee: Number(filteredPartners[0].partner_fee.toFixed(4))
|
|
3772
|
-
};
|
|
3794
|
+
return null;
|
|
3773
3795
|
}
|
|
3774
3796
|
/**
|
|
3775
3797
|
* Gets default streamflow fee
|
|
3776
3798
|
* @returns Default streamflow fee
|
|
3777
3799
|
*/
|
|
3778
3800
|
async getDefaultStreamflowFee() {
|
|
3779
|
-
return
|
|
3801
|
+
return (await this.getDefaultFees()).streamflowFee;
|
|
3802
|
+
}
|
|
3803
|
+
/**
|
|
3804
|
+
* Get all defaults fees applied by the protocol.
|
|
3805
|
+
*
|
|
3806
|
+
* Protocol will use fees set for WITHDRAWOR as default if they are set.
|
|
3807
|
+
*/
|
|
3808
|
+
async getDefaultFees() {
|
|
3809
|
+
return await this.getFees({ address: WITHDRAWOR }) || {
|
|
3810
|
+
creationFeeSol: DEFAULT_CREATION_FEE_SOL,
|
|
3811
|
+
autoClaimFeeSol: DEFAULT_AUTO_CLAIM_FEE_SOL,
|
|
3812
|
+
streamflowFee: DEFAULT_STREAMFLOW_FEE,
|
|
3813
|
+
partnerFee: 0
|
|
3814
|
+
};
|
|
3780
3815
|
}
|
|
3781
3816
|
/**
|
|
3782
3817
|
* Extracts error code from an error
|