@streamflow/stream 9.0.4 → 10.0.0-alpha.p313.18b7be3
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/README.md +6 -62
- package/dist/cjs/index.cjs +421 -3786
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +3 -186
- package/dist/cjs/solana/index.cjs +376 -301
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +1134 -17
- package/dist/esm/index.d.ts +3 -186
- package/dist/esm/index.js +239 -3617
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +1134 -17
- package/dist/esm/solana/index.js +257 -232
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -43
- package/dist/cjs/BaseStreamClient-DOyJqO7R.d.cts +0 -551
- package/dist/cjs/aptos/index.cjs +0 -456
- package/dist/cjs/aptos/index.cjs.map +0 -1
- package/dist/cjs/aptos/index.d.cts +0 -14
- package/dist/cjs/evm/index.cjs +0 -1915
- package/dist/cjs/evm/index.cjs.map +0 -1
- package/dist/cjs/evm/index.d.cts +0 -13
- package/dist/cjs/index-BMZATAYa.d.cts +0 -213
- package/dist/cjs/index-BgGtpOPg.d.cts +0 -850
- package/dist/cjs/index-DYIamO0j.d.cts +0 -203
- package/dist/cjs/index-Y0HH2ugY.d.cts +0 -136
- package/dist/cjs/sui/index.cjs +0 -1021
- package/dist/cjs/sui/index.cjs.map +0 -1
- package/dist/cjs/sui/index.d.cts +0 -13
- package/dist/esm/BaseStreamClient-DOyJqO7R.d.ts +0 -551
- package/dist/esm/aptos/index.d.ts +0 -14
- package/dist/esm/aptos/index.js +0 -443
- package/dist/esm/aptos/index.js.map +0 -1
- package/dist/esm/evm/index.d.ts +0 -13
- package/dist/esm/evm/index.js +0 -1902
- package/dist/esm/evm/index.js.map +0 -1
- package/dist/esm/index-D54wSYym.d.ts +0 -203
- package/dist/esm/index-Dp5DXxr-.d.ts +0 -850
- package/dist/esm/index-DrzqsoIB.d.ts +0 -136
- package/dist/esm/index-elpYUBph.d.ts +0 -213
- package/dist/esm/sui/index.d.ts +0 -13
- package/dist/esm/sui/index.js +0 -1011
- package/dist/esm/sui/index.js.map +0 -1
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var BN3 = require('bn.js');
|
|
4
4
|
var bs58 = require('bs58');
|
|
5
5
|
var buffer = require('buffer');
|
|
6
6
|
var splToken = require('@solana/spl-token');
|
|
7
7
|
var web3_js = require('@solana/web3.js');
|
|
8
|
-
var
|
|
8
|
+
var common = require('@streamflow/common');
|
|
9
9
|
var borsh = require('borsh');
|
|
10
10
|
var anchor = require('@coral-xyz/anchor');
|
|
11
|
-
var common = require('@streamflow/common');
|
|
12
11
|
var BufferLayout = require('@solana/buffer-layout');
|
|
13
12
|
|
|
14
13
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -31,20 +30,13 @@ function _interopNamespace(e) {
|
|
|
31
30
|
return Object.freeze(n);
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
var
|
|
33
|
+
var BN3__default = /*#__PURE__*/_interopDefault(BN3);
|
|
35
34
|
var bs58__default = /*#__PURE__*/_interopDefault(bs58);
|
|
36
35
|
var borsh__namespace = /*#__PURE__*/_interopNamespace(borsh);
|
|
37
36
|
var BufferLayout__namespace = /*#__PURE__*/_interopNamespace(BufferLayout);
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
var __export = (target, all) => {
|
|
41
|
-
for (var name in all)
|
|
42
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
43
|
-
};
|
|
38
|
+
// solana/StreamClient.ts
|
|
44
39
|
var MAX_SAFE_UNIX_TIME_VALUE = 864e10;
|
|
45
|
-
var WITHDRAW_AVAILABLE_AMOUNT = new BN4__default.default("18446744073709551615");
|
|
46
|
-
|
|
47
|
-
// common/contractUtils.ts
|
|
48
40
|
var calculateUnlockedAmount = ({
|
|
49
41
|
depositedAmount,
|
|
50
42
|
cliff,
|
|
@@ -57,19 +49,25 @@ var calculateUnlockedAmount = ({
|
|
|
57
49
|
fundsUnlockedAtLastRateChange
|
|
58
50
|
}) => {
|
|
59
51
|
const deposited = depositedAmount;
|
|
60
|
-
if (currentTimestamp < cliff) return new
|
|
52
|
+
if (currentTimestamp < cliff) return new BN3__default.default(0);
|
|
61
53
|
if (currentTimestamp > end) return deposited;
|
|
62
54
|
const savedUnlockedFunds = lastRateChangeTime === 0 ? cliffAmount : fundsUnlockedAtLastRateChange;
|
|
63
55
|
const savedUnlockedFundsTime = lastRateChangeTime === 0 ? cliff : lastRateChangeTime;
|
|
64
|
-
const streamed = new
|
|
56
|
+
const streamed = new BN3__default.default(Math.floor((currentTimestamp - savedUnlockedFundsTime) / period)).mul(amountPerPeriod).add(savedUnlockedFunds);
|
|
65
57
|
return streamed.lt(deposited) ? streamed : deposited;
|
|
66
58
|
};
|
|
67
59
|
var isCliffCloseToDepositedAmount = (streamData) => {
|
|
68
|
-
return streamData.cliffAmount.gte(streamData.depositedAmount.sub(new
|
|
60
|
+
return streamData.cliffAmount.gte(streamData.depositedAmount.sub(new BN3__default.default(1)));
|
|
61
|
+
};
|
|
62
|
+
var isPayment = (streamData) => {
|
|
63
|
+
return streamData.canTopup;
|
|
69
64
|
};
|
|
70
65
|
var isVesting = (streamData) => {
|
|
71
66
|
return !streamData.canTopup && !isCliffCloseToDepositedAmount(streamData) && !isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage);
|
|
72
67
|
};
|
|
68
|
+
var isAligned = (stream) => {
|
|
69
|
+
return "minPrice" in stream && "maxPrice" in stream && "minPercentage" in stream && "maxPercentage" in stream;
|
|
70
|
+
};
|
|
73
71
|
var isCreateAlignedStreamData = (obj) => {
|
|
74
72
|
return "minPrice" in obj && "maxPrice" in obj && "minPercentage" in obj && "maxPercentage" in obj;
|
|
75
73
|
};
|
|
@@ -89,60 +87,158 @@ var buildStreamType = (streamData) => {
|
|
|
89
87
|
return "payment" /* Payment */;
|
|
90
88
|
};
|
|
91
89
|
var decodeEndTime = (endTime) => {
|
|
92
|
-
if (endTime.gt(new
|
|
90
|
+
if (endTime.gt(new BN3__default.default(MAX_SAFE_UNIX_TIME_VALUE))) {
|
|
93
91
|
return MAX_SAFE_UNIX_TIME_VALUE;
|
|
94
92
|
}
|
|
95
93
|
return endTime.toNumber();
|
|
96
94
|
};
|
|
97
|
-
var
|
|
98
|
-
var
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
95
|
+
var ALIGNED_PRECISION_FACTOR_POW = 9;
|
|
96
|
+
var StreamDirection = /* @__PURE__ */ ((StreamDirection2) => {
|
|
97
|
+
StreamDirection2["Outgoing"] = "outgoing";
|
|
98
|
+
StreamDirection2["Incoming"] = "incoming";
|
|
99
|
+
StreamDirection2["All"] = "all";
|
|
100
|
+
return StreamDirection2;
|
|
101
|
+
})(StreamDirection || {});
|
|
102
|
+
var StreamType = /* @__PURE__ */ ((StreamType2) => {
|
|
103
|
+
StreamType2["All"] = "all";
|
|
104
|
+
StreamType2["Payment"] = "payment";
|
|
105
|
+
StreamType2["Vesting"] = "vesting";
|
|
106
|
+
StreamType2["Lock"] = "lock";
|
|
107
|
+
return StreamType2;
|
|
108
|
+
})(StreamType || {});
|
|
109
|
+
var ContractErrorCode = /* @__PURE__ */ ((ContractErrorCode2) => {
|
|
110
|
+
ContractErrorCode2["AccountsNotWritable"] = "AccountsNotWritable";
|
|
111
|
+
ContractErrorCode2["InvalidMetadata"] = "InvalidMetadata";
|
|
112
|
+
ContractErrorCode2["InvalidMetadataAccount"] = "InvalidMetadataAccount";
|
|
113
|
+
ContractErrorCode2["MetadataAccountMismatch"] = "MetadataAccountMismatch";
|
|
114
|
+
ContractErrorCode2["InvalidEscrowAccount"] = "InvalidEscrowAccount";
|
|
115
|
+
ContractErrorCode2["NotAssociated"] = "NotAssociated";
|
|
116
|
+
ContractErrorCode2["MintMismatch"] = "MintMismatch";
|
|
117
|
+
ContractErrorCode2["TransferNotAllowed"] = "TransferNotAllowed";
|
|
118
|
+
ContractErrorCode2["ContractClosed"] = "ContractClosed";
|
|
119
|
+
ContractErrorCode2["InvalidTreasury"] = "InvalidTreasury";
|
|
120
|
+
ContractErrorCode2["InvalidTimestamps"] = "InvalidTimestamps";
|
|
121
|
+
ContractErrorCode2["InvalidDepositConfiguration"] = "InvalidDepositConfiguration";
|
|
122
|
+
ContractErrorCode2["AmountIsZero"] = "AmountIsZero";
|
|
123
|
+
ContractErrorCode2["AmountMoreThanAvailable"] = "AmountMoreThanAvailable";
|
|
124
|
+
ContractErrorCode2["AmountAvailableIsZero"] = "AmountAvailableIsZero";
|
|
125
|
+
ContractErrorCode2["ArithmeticError"] = "ArithmeticError";
|
|
126
|
+
ContractErrorCode2["InvalidMetadataSize"] = "InvalidMetadataSize";
|
|
127
|
+
ContractErrorCode2["UninitializedMetadata"] = "UninitializedMetadata";
|
|
128
|
+
ContractErrorCode2["Unauthorized"] = "Unauthorized";
|
|
129
|
+
ContractErrorCode2["SelfTransfer"] = "SelfTransfer";
|
|
130
|
+
ContractErrorCode2["AlreadyPaused"] = "AlreadyPaused";
|
|
131
|
+
ContractErrorCode2["NotPaused"] = "NotPaused";
|
|
132
|
+
ContractErrorCode2["MetadataNotRentExempt"] = "MetadataNotRentExempt";
|
|
133
|
+
return ContractErrorCode2;
|
|
134
|
+
})(ContractErrorCode || {});
|
|
135
|
+
var AlignedProxyErrorCode = /* @__PURE__ */ ((AlignedProxyErrorCode2) => {
|
|
136
|
+
AlignedProxyErrorCode2["Unauthorized"] = "Unauthorized";
|
|
137
|
+
AlignedProxyErrorCode2["ArithmeticError"] = "ArithmeticError";
|
|
138
|
+
AlignedProxyErrorCode2["UnsupportedTokenExtensions"] = "UnsupportedTokenExtensions";
|
|
139
|
+
AlignedProxyErrorCode2["PeriodTooShort"] = "PeriodTooShort";
|
|
140
|
+
AlignedProxyErrorCode2["InvalidTickSize"] = "InvalidTickSize";
|
|
141
|
+
AlignedProxyErrorCode2["InvalidPercentageBoundaries"] = "InvalidPercentageBoundaries";
|
|
142
|
+
AlignedProxyErrorCode2["InvalidPriceBoundaries"] = "InvalidPriceBoundaries";
|
|
143
|
+
AlignedProxyErrorCode2["UnsupportedOracle"] = "UnsupportedOracle";
|
|
144
|
+
AlignedProxyErrorCode2["InvalidOracleAccount"] = "InvalidOracleAccount";
|
|
145
|
+
AlignedProxyErrorCode2["InvalidOraclePrice"] = "InvalidOraclePrice";
|
|
146
|
+
AlignedProxyErrorCode2["InvalidStreamMetadata"] = "InvalidStreamMetadata";
|
|
147
|
+
AlignedProxyErrorCode2["AmountAlreadyUpdated"] = "AmountAlreadyUpdated";
|
|
148
|
+
AlignedProxyErrorCode2["AllFundsUnlocked"] = "AllFundsUnlocked";
|
|
149
|
+
return AlignedProxyErrorCode2;
|
|
150
|
+
})(AlignedProxyErrorCode || {});
|
|
151
|
+
var Contract = class {
|
|
152
|
+
constructor(stream) {
|
|
153
|
+
this.magic = stream.magic.toNumber();
|
|
154
|
+
this.version = stream.version.toNumber();
|
|
155
|
+
this.createdAt = stream.createdAt.toNumber();
|
|
156
|
+
this.withdrawnAmount = stream.withdrawnAmount;
|
|
157
|
+
this.canceledAt = stream.canceledAt.toNumber();
|
|
158
|
+
this.end = decodeEndTime(stream.end);
|
|
159
|
+
this.lastWithdrawnAt = stream.lastWithdrawnAt.toNumber();
|
|
160
|
+
this.sender = stream.sender.toBase58();
|
|
161
|
+
this.senderTokens = stream.senderTokens.toBase58();
|
|
162
|
+
this.recipient = stream.recipient.toBase58();
|
|
163
|
+
this.recipientTokens = stream.recipientTokens.toBase58();
|
|
164
|
+
this.mint = stream.mint.toBase58();
|
|
165
|
+
this.escrowTokens = stream.escrowTokens.toBase58();
|
|
166
|
+
this.streamflowTreasury = stream.streamflowTreasury.toBase58();
|
|
167
|
+
this.streamflowTreasuryTokens = stream.streamflowTreasuryTokens.toBase58();
|
|
168
|
+
this.streamflowFeeTotal = stream.streamflowFeeTotal;
|
|
169
|
+
this.streamflowFeeWithdrawn = stream.streamflowFeeWithdrawn;
|
|
170
|
+
this.streamflowFeePercent = stream.streamflowFeePercent;
|
|
171
|
+
this.partnerFeeTotal = stream.partnerFeeTotal;
|
|
172
|
+
this.partnerFeeWithdrawn = stream.partnerFeeWithdrawn;
|
|
173
|
+
this.partnerFeePercent = stream.partnerFeePercent;
|
|
174
|
+
this.partner = stream.partner.toBase58();
|
|
175
|
+
this.partnerTokens = stream.partnerTokens?.toBase58();
|
|
176
|
+
this.start = stream.start.toNumber();
|
|
177
|
+
this.depositedAmount = stream.depositedAmount;
|
|
178
|
+
this.period = stream.period.toNumber();
|
|
179
|
+
this.amountPerPeriod = stream.amountPerPeriod;
|
|
180
|
+
this.cliff = stream.cliff.toNumber();
|
|
181
|
+
this.cliffAmount = stream.cliffAmount;
|
|
182
|
+
this.cancelableBySender = stream.cancelableBySender;
|
|
183
|
+
this.cancelableByRecipient = stream.cancelableByRecipient;
|
|
184
|
+
this.automaticWithdrawal = stream.automaticWithdrawal;
|
|
185
|
+
this.transferableBySender = stream.transferableBySender;
|
|
186
|
+
this.transferableByRecipient = stream.transferableByRecipient;
|
|
187
|
+
this.canTopup = stream.canTopup;
|
|
188
|
+
this.name = stream.name;
|
|
189
|
+
this.withdrawalFrequency = stream.withdrawFrequency.toNumber();
|
|
190
|
+
this.closed = stream.closed;
|
|
191
|
+
this.currentPauseStart = stream.currentPauseStart.toNumber();
|
|
192
|
+
this.pauseCumulative = stream.pauseCumulative;
|
|
193
|
+
this.lastRateChangeTime = stream.lastRateChangeTime.toNumber();
|
|
194
|
+
this.fundsUnlockedAtLastRateChange = stream.fundsUnlockedAtLastRateChange;
|
|
195
|
+
this.type = buildStreamType(this);
|
|
196
|
+
this.isAligned = false;
|
|
197
|
+
}
|
|
198
|
+
unlocked(currentTimestamp) {
|
|
199
|
+
return calculateUnlockedAmount({
|
|
200
|
+
...this,
|
|
201
|
+
currentTimestamp
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
remaining(decimals) {
|
|
205
|
+
return common.getNumberFromBN(this.depositedAmount.sub(this.withdrawnAmount), decimals);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
var AlignedContract = class extends Contract {
|
|
209
|
+
constructor(stream, alignedProxy) {
|
|
210
|
+
super(stream);
|
|
211
|
+
this.minPrice = common.getNumberFromBN(alignedProxy.minPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
212
|
+
this.maxPrice = common.getNumberFromBN(alignedProxy.maxPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
213
|
+
this.minPercentage = common.getNumberFromBN(alignedProxy.minPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
214
|
+
this.maxPercentage = common.getNumberFromBN(alignedProxy.maxPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
215
|
+
this.oracleType = Object.keys(alignedProxy.priceOracleType).find((key) => !!key) || "none";
|
|
216
|
+
this.tickSize = alignedProxy.tickSize.toNumber();
|
|
217
|
+
this.priceOracle = this.oracleType === "none" ? void 0 : alignedProxy.priceOracle.toBase58();
|
|
218
|
+
this.sender = alignedProxy.sender.toBase58();
|
|
219
|
+
this.canceledAt = alignedProxy.streamCanceledTime.toNumber();
|
|
220
|
+
this.proxyAddress = stream.sender.toBase58();
|
|
221
|
+
this.initialAmountPerPeriod = alignedProxy.initialAmountPerPeriod;
|
|
222
|
+
this.initialPrice = common.getNumberFromBN(alignedProxy.initialPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
223
|
+
this.lastPrice = common.getNumberFromBN(alignedProxy.lastPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
224
|
+
this.lastAmountUpdateTime = alignedProxy.lastAmountUpdateTime.toNumber();
|
|
225
|
+
this.initialNetAmount = alignedProxy.initialNetAmount;
|
|
226
|
+
this.expiryTime = alignedProxy.expiryTime.toNumber();
|
|
227
|
+
this.expiryPercentage = common.getNumberFromBN(alignedProxy.expiryPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
228
|
+
this.floorPrice = common.getNumberFromBN(alignedProxy.floorPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
229
|
+
this.type = buildStreamType(this);
|
|
230
|
+
this.isAligned = true;
|
|
231
|
+
}
|
|
104
232
|
};
|
|
105
|
-
|
|
106
|
-
// solana/constants.ts
|
|
107
|
-
var constants_exports = {};
|
|
108
|
-
__export(constants_exports, {
|
|
109
|
-
AIRDROP_AMOUNT: () => AIRDROP_AMOUNT,
|
|
110
|
-
AIRDROP_TEST_TOKEN: () => AIRDROP_TEST_TOKEN,
|
|
111
|
-
ALIGNED_COMPUTE_LIMIT: () => ALIGNED_COMPUTE_LIMIT,
|
|
112
|
-
ALIGNED_PRECISION_FACTOR_POW: () => ALIGNED_PRECISION_FACTOR_POW,
|
|
113
|
-
ALIGNED_UNLOCKS_PROGRAM_ID: () => ALIGNED_UNLOCKS_PROGRAM_ID,
|
|
114
|
-
CONTRACT_DISCRIMINATOR: () => CONTRACT_DISCRIMINATOR,
|
|
115
|
-
CONTRACT_SEED: () => CONTRACT_SEED,
|
|
116
|
-
CREATE_PARAMS_PADDING: () => CREATE_PARAMS_PADDING,
|
|
117
|
-
DEFAULT_STREAMFLOW_FEE: () => DEFAULT_STREAMFLOW_FEE,
|
|
118
|
-
ESCROW_SEED: () => ESCROW_SEED,
|
|
119
|
-
FEES_METADATA_SEED: () => FEES_METADATA_SEED,
|
|
120
|
-
FEE_ORACLE_PUBLIC_KEY: () => FEE_ORACLE_PUBLIC_KEY,
|
|
121
|
-
ORIGINAL_CONTRACT_SENDER_OFFSET: () => ORIGINAL_CONTRACT_SENDER_OFFSET,
|
|
122
|
-
PARTNERS_SCHEMA: () => PARTNERS_SCHEMA,
|
|
123
|
-
PARTNER_ORACLE_PROGRAM_ID: () => PARTNER_ORACLE_PROGRAM_ID,
|
|
124
|
-
PARTNER_SCHEMA: () => PARTNER_SCHEMA,
|
|
125
|
-
PROGRAM_ID: () => PROGRAM_ID,
|
|
126
|
-
SOLANA_ERROR_MAP: () => SOLANA_ERROR_MAP,
|
|
127
|
-
SOLANA_ERROR_MATCH_REGEX: () => SOLANA_ERROR_MATCH_REGEX,
|
|
128
|
-
STREAMFLOW_TREASURY_PUBLIC_KEY: () => STREAMFLOW_TREASURY_PUBLIC_KEY,
|
|
129
|
-
STREAM_STRUCT_OFFSETS: () => STREAM_STRUCT_OFFSETS,
|
|
130
|
-
STREAM_STRUCT_OFFSET_CLOSED: () => STREAM_STRUCT_OFFSET_CLOSED,
|
|
131
|
-
STREAM_STRUCT_OFFSET_MINT: () => STREAM_STRUCT_OFFSET_MINT,
|
|
132
|
-
STREAM_STRUCT_OFFSET_RECIPIENT: () => STREAM_STRUCT_OFFSET_RECIPIENT,
|
|
133
|
-
STREAM_STRUCT_OFFSET_SENDER: () => STREAM_STRUCT_OFFSET_SENDER,
|
|
134
|
-
TEST_ORACLE_DISCRIMINATOR: () => TEST_ORACLE_DISCRIMINATOR,
|
|
135
|
-
TEST_ORACLE_SEED: () => TEST_ORACLE_SEED,
|
|
136
|
-
TX_FINALITY_CONFIRMED: () => TX_FINALITY_CONFIRMED,
|
|
137
|
-
WITHDRAWOR_PUBLIC_KEY: () => WITHDRAWOR_PUBLIC_KEY
|
|
138
|
-
});
|
|
139
233
|
var TX_FINALITY_CONFIRMED = "confirmed";
|
|
140
234
|
var ORIGINAL_CONTRACT_SENDER_OFFSET = 9;
|
|
141
235
|
var STREAM_STRUCT_OFFSET_SENDER = 49;
|
|
142
236
|
var STREAM_STRUCT_OFFSET_RECIPIENT = 113;
|
|
143
237
|
var STREAM_STRUCT_OFFSET_MINT = 177;
|
|
144
238
|
var STREAM_STRUCT_OFFSET_CLOSED = 671;
|
|
145
|
-
var
|
|
239
|
+
var MAX_SAFE_UNIX_TIME_VALUE2 = 864e10;
|
|
240
|
+
var WITHDRAW_AVAILABLE_AMOUNT = new BN3__default.default("18446744073709551615");
|
|
241
|
+
var ALIGNED_PRECISION_FACTOR_POW2 = 9;
|
|
146
242
|
var STREAM_STRUCT_OFFSETS = {
|
|
147
243
|
mint: STREAM_STRUCT_OFFSET_MINT,
|
|
148
244
|
recipient: STREAM_STRUCT_OFFSET_RECIPIENT,
|
|
@@ -223,88 +319,8 @@ var SOLANA_ERROR_MAP = {
|
|
|
223
319
|
6011: "AmountAlreadyUpdated" /* AmountAlreadyUpdated */,
|
|
224
320
|
6012: "AllFundsUnlocked" /* AllFundsUnlocked */
|
|
225
321
|
};
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
this.magic = stream.magic.toNumber();
|
|
229
|
-
this.version = stream.version.toNumber();
|
|
230
|
-
this.createdAt = stream.createdAt.toNumber();
|
|
231
|
-
this.withdrawnAmount = stream.withdrawnAmount;
|
|
232
|
-
this.canceledAt = stream.canceledAt.toNumber();
|
|
233
|
-
this.end = decodeEndTime(stream.end);
|
|
234
|
-
this.lastWithdrawnAt = stream.lastWithdrawnAt.toNumber();
|
|
235
|
-
this.sender = stream.sender.toBase58();
|
|
236
|
-
this.senderTokens = stream.senderTokens.toBase58();
|
|
237
|
-
this.recipient = stream.recipient.toBase58();
|
|
238
|
-
this.recipientTokens = stream.recipientTokens.toBase58();
|
|
239
|
-
this.mint = stream.mint.toBase58();
|
|
240
|
-
this.escrowTokens = stream.escrowTokens.toBase58();
|
|
241
|
-
this.streamflowTreasury = stream.streamflowTreasury.toBase58();
|
|
242
|
-
this.streamflowTreasuryTokens = stream.streamflowTreasuryTokens.toBase58();
|
|
243
|
-
this.streamflowFeeTotal = stream.streamflowFeeTotal;
|
|
244
|
-
this.streamflowFeeWithdrawn = stream.streamflowFeeWithdrawn;
|
|
245
|
-
this.streamflowFeePercent = stream.streamflowFeePercent;
|
|
246
|
-
this.partnerFeeTotal = stream.partnerFeeTotal;
|
|
247
|
-
this.partnerFeeWithdrawn = stream.partnerFeeWithdrawn;
|
|
248
|
-
this.partnerFeePercent = stream.partnerFeePercent;
|
|
249
|
-
this.partner = stream.partner.toBase58();
|
|
250
|
-
this.partnerTokens = stream.partnerTokens?.toBase58();
|
|
251
|
-
this.start = stream.start.toNumber();
|
|
252
|
-
this.depositedAmount = stream.depositedAmount;
|
|
253
|
-
this.period = stream.period.toNumber();
|
|
254
|
-
this.amountPerPeriod = stream.amountPerPeriod;
|
|
255
|
-
this.cliff = stream.cliff.toNumber();
|
|
256
|
-
this.cliffAmount = stream.cliffAmount;
|
|
257
|
-
this.cancelableBySender = stream.cancelableBySender;
|
|
258
|
-
this.cancelableByRecipient = stream.cancelableByRecipient;
|
|
259
|
-
this.automaticWithdrawal = stream.automaticWithdrawal;
|
|
260
|
-
this.transferableBySender = stream.transferableBySender;
|
|
261
|
-
this.transferableByRecipient = stream.transferableByRecipient;
|
|
262
|
-
this.canTopup = stream.canTopup;
|
|
263
|
-
this.name = stream.name;
|
|
264
|
-
this.withdrawalFrequency = stream.withdrawFrequency.toNumber();
|
|
265
|
-
this.closed = stream.closed;
|
|
266
|
-
this.currentPauseStart = stream.currentPauseStart.toNumber();
|
|
267
|
-
this.pauseCumulative = stream.pauseCumulative;
|
|
268
|
-
this.lastRateChangeTime = stream.lastRateChangeTime.toNumber();
|
|
269
|
-
this.fundsUnlockedAtLastRateChange = stream.fundsUnlockedAtLastRateChange;
|
|
270
|
-
this.type = buildStreamType(this);
|
|
271
|
-
this.isAligned = false;
|
|
272
|
-
}
|
|
273
|
-
unlocked(currentTimestamp) {
|
|
274
|
-
return calculateUnlockedAmount({
|
|
275
|
-
...this,
|
|
276
|
-
currentTimestamp
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
remaining(decimals) {
|
|
280
|
-
return getNumberFromBN(this.depositedAmount.sub(this.withdrawnAmount), decimals);
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
var AlignedContract = class extends Contract {
|
|
284
|
-
constructor(stream, alignedProxy) {
|
|
285
|
-
super(stream);
|
|
286
|
-
this.minPrice = getNumberFromBN(alignedProxy.minPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
287
|
-
this.maxPrice = getNumberFromBN(alignedProxy.maxPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
288
|
-
this.minPercentage = getNumberFromBN(alignedProxy.minPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
289
|
-
this.maxPercentage = getNumberFromBN(alignedProxy.maxPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
290
|
-
this.oracleType = Object.keys(alignedProxy.priceOracleType).find((key) => !!key) || "none";
|
|
291
|
-
this.tickSize = alignedProxy.tickSize.toNumber();
|
|
292
|
-
this.priceOracle = this.oracleType === "none" ? void 0 : alignedProxy.priceOracle.toBase58();
|
|
293
|
-
this.sender = alignedProxy.sender.toBase58();
|
|
294
|
-
this.canceledAt = alignedProxy.streamCanceledTime.toNumber();
|
|
295
|
-
this.proxyAddress = stream.sender.toBase58();
|
|
296
|
-
this.initialAmountPerPeriod = alignedProxy.initialAmountPerPeriod;
|
|
297
|
-
this.initialPrice = getNumberFromBN(alignedProxy.initialPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
298
|
-
this.lastPrice = getNumberFromBN(alignedProxy.lastPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
299
|
-
this.lastAmountUpdateTime = alignedProxy.lastAmountUpdateTime.toNumber();
|
|
300
|
-
this.initialNetAmount = alignedProxy.initialNetAmount;
|
|
301
|
-
this.expiryTime = alignedProxy.expiryTime.toNumber();
|
|
302
|
-
this.expiryPercentage = getNumberFromBN(alignedProxy.expiryPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
303
|
-
this.floorPrice = getNumberFromBN(alignedProxy.floorPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
304
|
-
this.type = buildStreamType(this);
|
|
305
|
-
this.isAligned = true;
|
|
306
|
-
}
|
|
307
|
-
};
|
|
322
|
+
|
|
323
|
+
// solana/layout.ts
|
|
308
324
|
var streamLayout = BufferLayout__namespace.struct([
|
|
309
325
|
BufferLayout__namespace.blob(8, "magic"),
|
|
310
326
|
BufferLayout__namespace.blob(1, "version"),
|
|
@@ -464,20 +480,25 @@ var encodeUpdateStream = (values, data) => {
|
|
|
464
480
|
var topupStreamLayout = BufferLayout__namespace.struct([
|
|
465
481
|
BufferLayout__namespace.blob(8, "amount")
|
|
466
482
|
]);
|
|
467
|
-
|
|
468
|
-
|
|
483
|
+
var FEE_PRECISION = 4;
|
|
484
|
+
var FEE_NORMALIZER = 10 ** FEE_PRECISION;
|
|
485
|
+
var FEE_MULTIPLIER = new BN3__default.default(10 ** 6);
|
|
469
486
|
var decoder = new TextDecoder("utf-8");
|
|
470
487
|
var LE = "le";
|
|
488
|
+
var calculateTotalAmountToDeposit = (depositedAmount, totalFee) => {
|
|
489
|
+
const totalFeeNormalized = new BN3__default.default(totalFee * FEE_NORMALIZER);
|
|
490
|
+
return depositedAmount.mul(totalFeeNormalized.add(FEE_MULTIPLIER)).div(FEE_MULTIPLIER);
|
|
491
|
+
};
|
|
471
492
|
var decodeStream = (buf) => {
|
|
472
493
|
const raw = streamLayout.decode(buf);
|
|
473
494
|
return {
|
|
474
|
-
magic: new
|
|
475
|
-
version: new
|
|
476
|
-
createdAt: new
|
|
477
|
-
withdrawnAmount: new
|
|
478
|
-
canceledAt: new
|
|
479
|
-
end: new
|
|
480
|
-
lastWithdrawnAt: new
|
|
495
|
+
magic: new BN3__default.default(raw.magic, LE),
|
|
496
|
+
version: new BN3__default.default(raw.version, LE),
|
|
497
|
+
createdAt: new BN3__default.default(raw.created_at, LE),
|
|
498
|
+
withdrawnAmount: new BN3__default.default(raw.withdrawn_amount, LE),
|
|
499
|
+
canceledAt: new BN3__default.default(raw.canceled_at, LE),
|
|
500
|
+
end: new BN3__default.default(raw.end_time, LE),
|
|
501
|
+
lastWithdrawnAt: new BN3__default.default(raw.last_withdrawn_at, LE),
|
|
481
502
|
sender: new web3_js.PublicKey(raw.sender),
|
|
482
503
|
senderTokens: new web3_js.PublicKey(raw.sender_tokens),
|
|
483
504
|
recipient: new web3_js.PublicKey(raw.recipient),
|
|
@@ -486,20 +507,20 @@ var decodeStream = (buf) => {
|
|
|
486
507
|
escrowTokens: new web3_js.PublicKey(raw.escrow_tokens),
|
|
487
508
|
streamflowTreasury: new web3_js.PublicKey(raw.streamflow_treasury),
|
|
488
509
|
streamflowTreasuryTokens: new web3_js.PublicKey(raw.streamflow_treasury_tokens),
|
|
489
|
-
streamflowFeeTotal: new
|
|
490
|
-
streamflowFeeWithdrawn: new
|
|
510
|
+
streamflowFeeTotal: new BN3__default.default(raw.streamflow_fee_total, LE),
|
|
511
|
+
streamflowFeeWithdrawn: new BN3__default.default(raw.streamflow_fee_withdrawn, LE),
|
|
491
512
|
streamflowFeePercent: raw.streamflow_fee_percent,
|
|
492
|
-
partnerFeeTotal: new
|
|
493
|
-
partnerFeeWithdrawn: new
|
|
513
|
+
partnerFeeTotal: new BN3__default.default(raw.partner_fee_total, LE),
|
|
514
|
+
partnerFeeWithdrawn: new BN3__default.default(raw.partner_fee_withdrawn, LE),
|
|
494
515
|
partnerFeePercent: raw.partner_fee_percent,
|
|
495
516
|
partner: new web3_js.PublicKey(raw.partner),
|
|
496
517
|
partnerTokens: new web3_js.PublicKey(raw.partner_tokens),
|
|
497
|
-
start: new
|
|
498
|
-
depositedAmount: new
|
|
499
|
-
period: new
|
|
500
|
-
amountPerPeriod: new
|
|
501
|
-
cliff: new
|
|
502
|
-
cliffAmount: new
|
|
518
|
+
start: new BN3__default.default(raw.start_time, LE),
|
|
519
|
+
depositedAmount: new BN3__default.default(raw.net_amount_deposited, LE),
|
|
520
|
+
period: new BN3__default.default(raw.period, LE),
|
|
521
|
+
amountPerPeriod: new BN3__default.default(raw.amount_per_period, LE),
|
|
522
|
+
cliff: new BN3__default.default(raw.cliff, LE),
|
|
523
|
+
cliffAmount: new BN3__default.default(raw.cliff_amount, LE),
|
|
503
524
|
cancelableBySender: Boolean(raw.cancelable_by_sender),
|
|
504
525
|
cancelableByRecipient: Boolean(raw.cancelable_by_recipient),
|
|
505
526
|
automaticWithdrawal: Boolean(raw.automatic_withdrawal),
|
|
@@ -507,17 +528,17 @@ var decodeStream = (buf) => {
|
|
|
507
528
|
transferableByRecipient: Boolean(raw.transferable_by_recipient),
|
|
508
529
|
canTopup: Boolean(raw.can_topup),
|
|
509
530
|
name: decoder.decode(raw.stream_name),
|
|
510
|
-
withdrawFrequency: new
|
|
531
|
+
withdrawFrequency: new BN3__default.default(raw.withdraw_frequency, LE),
|
|
511
532
|
closed: Boolean(raw.closed),
|
|
512
|
-
currentPauseStart: new
|
|
513
|
-
pauseCumulative: new
|
|
514
|
-
lastRateChangeTime: new
|
|
515
|
-
fundsUnlockedAtLastRateChange: new
|
|
533
|
+
currentPauseStart: new BN3__default.default(raw.current_pause_start, LE),
|
|
534
|
+
pauseCumulative: new BN3__default.default(raw.pause_cumulative, LE),
|
|
535
|
+
lastRateChangeTime: new BN3__default.default(raw.last_rate_change_time, LE),
|
|
536
|
+
fundsUnlockedAtLastRateChange: new BN3__default.default(raw.funds_unlocked_at_last_rate_change, LE)
|
|
516
537
|
};
|
|
517
538
|
};
|
|
518
539
|
async function signAllTransactionWithRecipients(sender, items) {
|
|
519
|
-
const isKeypair =
|
|
520
|
-
const isWallet =
|
|
540
|
+
const isKeypair = common.isSignerKeypair(sender);
|
|
541
|
+
const isWallet = common.isSignerWallet(sender);
|
|
521
542
|
if (isKeypair) {
|
|
522
543
|
return items.map((t) => {
|
|
523
544
|
t.tx.sign([sender]);
|
|
@@ -535,7 +556,7 @@ async function signAllTransactionWithRecipients(sender, items) {
|
|
|
535
556
|
}
|
|
536
557
|
async function sendAndConfirmStreamRawTransaction(connection, batchItem, confirmationParams, throttleParams) {
|
|
537
558
|
try {
|
|
538
|
-
const completedTxSignature = await
|
|
559
|
+
const completedTxSignature = await common.executeTransaction(connection, batchItem.tx, confirmationParams, throttleParams);
|
|
539
560
|
return { ...batchItem, signature: completedTxSignature };
|
|
540
561
|
} catch (error) {
|
|
541
562
|
throw {
|
|
@@ -544,6 +565,19 @@ async function sendAndConfirmStreamRawTransaction(connection, batchItem, confirm
|
|
|
544
565
|
};
|
|
545
566
|
}
|
|
546
567
|
}
|
|
568
|
+
async function handleContractError(func, callback) {
|
|
569
|
+
try {
|
|
570
|
+
return await func();
|
|
571
|
+
} catch (err) {
|
|
572
|
+
if (err instanceof Error) {
|
|
573
|
+
if (callback) {
|
|
574
|
+
throw new common.ContractError(err, callback(err));
|
|
575
|
+
}
|
|
576
|
+
throw new common.ContractError(err);
|
|
577
|
+
}
|
|
578
|
+
throw err;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
547
581
|
function extractSolanaErrorCode(errorText, logs) {
|
|
548
582
|
let match = SOLANA_ERROR_MATCH_REGEX.exec(errorText);
|
|
549
583
|
if (!match && logs) {
|
|
@@ -873,28 +907,6 @@ var topupStreamInstruction = async (amount, programId, {
|
|
|
873
907
|
});
|
|
874
908
|
};
|
|
875
909
|
|
|
876
|
-
// common/BaseStreamClient.ts
|
|
877
|
-
var BaseStreamClient = class {
|
|
878
|
-
/**
|
|
879
|
-
* Returns total fee percent, streamflow fees + partner fees
|
|
880
|
-
* @param getFeesData structure with address for which we need to derive fee, either sender or partner usually
|
|
881
|
-
* @param chainSpecificParams additional parameters required by chain client
|
|
882
|
-
* @returns fee as floating number, so if fee is 0.99%, it will return 0.99
|
|
883
|
-
*/
|
|
884
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
885
|
-
async getTotalFee(getFeesData, chainSpecificParams) {
|
|
886
|
-
const fees = await this.getFees(getFeesData, chainSpecificParams);
|
|
887
|
-
if (fees) {
|
|
888
|
-
return fees.partnerFee + fees.streamflowFee;
|
|
889
|
-
}
|
|
890
|
-
return this.getDefaultStreamflowFee(chainSpecificParams);
|
|
891
|
-
}
|
|
892
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
893
|
-
extractErrorCode(err) {
|
|
894
|
-
return null;
|
|
895
|
-
}
|
|
896
|
-
};
|
|
897
|
-
|
|
898
910
|
// solana/descriptor/idl/streamflow_aligned_unlocks.json
|
|
899
911
|
var streamflow_aligned_unlocks_default = {
|
|
900
912
|
address: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
|
|
@@ -2408,18 +2420,17 @@ var deriveTestOraclePDA = (programId, mint, creator) => {
|
|
|
2408
2420
|
// solana/StreamClient.ts
|
|
2409
2421
|
var METADATA_ACC_SIZE = 1104;
|
|
2410
2422
|
var ALIGNED_METADATA_ACC_SIZE = 320;
|
|
2411
|
-
var SolanaStreamClient = class
|
|
2423
|
+
var SolanaStreamClient = class {
|
|
2412
2424
|
/**
|
|
2413
2425
|
* Create Stream instance
|
|
2414
2426
|
*/
|
|
2415
2427
|
constructor(optionsOrClusterUrl, cluster = common.ICluster.Mainnet, commitment = "confirmed", programId = "", sendRate = 1, sendThrottler) {
|
|
2416
|
-
super();
|
|
2417
2428
|
if (typeof optionsOrClusterUrl === "string") {
|
|
2418
2429
|
this.commitment = commitment;
|
|
2419
2430
|
this.connection = new web3_js.Connection(optionsOrClusterUrl, this.commitment);
|
|
2420
2431
|
this.programId = programId !== "" ? new web3_js.PublicKey(programId) : new web3_js.PublicKey(PROGRAM_ID[cluster]);
|
|
2421
2432
|
this.schedulingParams = {
|
|
2422
|
-
sendThrottler: sendThrottler ??
|
|
2433
|
+
sendThrottler: sendThrottler ?? common.buildSendThrottler(sendRate)
|
|
2423
2434
|
};
|
|
2424
2435
|
} else {
|
|
2425
2436
|
const {
|
|
@@ -2433,7 +2444,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2433
2444
|
this.connection = new web3_js.Connection(clusterUrl, this.commitment);
|
|
2434
2445
|
this.programId = programId2 !== "" ? new web3_js.PublicKey(programId2) : new web3_js.PublicKey(PROGRAM_ID[cluster2]);
|
|
2435
2446
|
const schedulingOptions = sendScheduler && "sendRate" in sendScheduler ? sendScheduler : void 0;
|
|
2436
|
-
const sendThrottler2 = !sendScheduler ?
|
|
2447
|
+
const sendThrottler2 = !sendScheduler ? common.buildSendThrottler(1) : "sendRate" in sendScheduler ? common.buildSendThrottler(sendScheduler.sendRate ?? 1, sendScheduler.sendInterval) : sendScheduler;
|
|
2437
2448
|
this.schedulingParams = {
|
|
2438
2449
|
...schedulingOptions,
|
|
2439
2450
|
sendThrottler: sendThrottler2
|
|
@@ -2465,7 +2476,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2465
2476
|
* (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.
|
|
2466
2477
|
*
|
|
2467
2478
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
2468
|
-
* @param {Omit<
|
|
2479
|
+
* @param {Omit<ICreateStreamExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
2469
2480
|
* @returns Transaction instructions and metadata ID
|
|
2470
2481
|
*/
|
|
2471
2482
|
async buildCreateTransactionInstructions(data, extParams) {
|
|
@@ -2486,7 +2497,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2486
2497
|
address: partnerPublicKey.toString()
|
|
2487
2498
|
});
|
|
2488
2499
|
const totalAmount = calculateTotalAmountToDeposit(amount, totalFee);
|
|
2489
|
-
ixs.push(...await
|
|
2500
|
+
ixs.push(...await common.prepareWrappedAccount(this.connection, sender.publicKey, totalAmount));
|
|
2490
2501
|
}
|
|
2491
2502
|
const {
|
|
2492
2503
|
ixs: createIxs,
|
|
@@ -2512,13 +2523,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2512
2523
|
* (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.
|
|
2513
2524
|
*
|
|
2514
2525
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
2515
|
-
* @param {Omit<
|
|
2526
|
+
* @param {Omit<ICreateStreamExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
2516
2527
|
* @returns Transaction and metadata information
|
|
2517
2528
|
*/
|
|
2518
2529
|
async buildCreateTransaction(data, extParams) {
|
|
2519
2530
|
const { sender } = extParams;
|
|
2520
2531
|
const { ixs, metadataId, metadata } = await this.buildCreateTransactionInstructions(data, extParams);
|
|
2521
|
-
const { tx, hash, context } = await
|
|
2532
|
+
const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, sender.publicKey, void 0, [
|
|
2522
2533
|
metadata
|
|
2523
2534
|
]);
|
|
2524
2535
|
return {
|
|
@@ -2533,7 +2544,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2533
2544
|
* Creates a new stream/vesting contract.
|
|
2534
2545
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
2535
2546
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
2536
|
-
* @param {
|
|
2547
|
+
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, native token handling, and compute settings
|
|
2537
2548
|
* @returns Create result
|
|
2538
2549
|
*/
|
|
2539
2550
|
async create(data, extParams) {
|
|
@@ -2543,10 +2554,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2543
2554
|
...extParams,
|
|
2544
2555
|
sender
|
|
2545
2556
|
});
|
|
2546
|
-
const { tx, hash, context } = await
|
|
2557
|
+
const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, sender.publicKey, void 0, [
|
|
2547
2558
|
metadata
|
|
2548
2559
|
]);
|
|
2549
|
-
const signature = await
|
|
2560
|
+
const signature = await common.signAndExecuteTransaction(
|
|
2550
2561
|
this.connection,
|
|
2551
2562
|
sender,
|
|
2552
2563
|
tx,
|
|
@@ -2603,13 +2614,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2603
2614
|
common.invariant(metadataPubKey, "Metadata public key is required");
|
|
2604
2615
|
let tokenProgramId = streamTokenProgramId ? new web3_js.PublicKey(streamTokenProgramId) : void 0;
|
|
2605
2616
|
if (!tokenProgramId) {
|
|
2606
|
-
tokenProgramId = (await
|
|
2617
|
+
tokenProgramId = (await common.getMintAndProgram(this.connection, mintPublicKey)).tokenProgramId;
|
|
2607
2618
|
}
|
|
2608
2619
|
const partnerPublicKey = partner ? new web3_js.PublicKey(partner) : WITHDRAWOR_PUBLIC_KEY;
|
|
2609
2620
|
const streamflowProgramPublicKey = new web3_js.PublicKey(this.programId);
|
|
2610
2621
|
const escrowPDA = deriveEscrowPDA(streamflowProgramPublicKey, metadataPubKey);
|
|
2611
2622
|
const oracle = priceOracle ?? deriveTestOraclePDA(this.alignedProxyProgram.programId, mintPublicKey, sender.publicKey);
|
|
2612
|
-
const ixs =
|
|
2623
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
2613
2624
|
computePrice,
|
|
2614
2625
|
computeLimit: computeLimit ?? ALIGNED_COMPUTE_LIMIT
|
|
2615
2626
|
});
|
|
@@ -2621,11 +2632,11 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2621
2632
|
const encodedUIntArray = new TextEncoder().encode(streamName);
|
|
2622
2633
|
const streamNameArray = Array.from(encodedUIntArray);
|
|
2623
2634
|
const createIx = await this.alignedProxyProgram.methods.create({
|
|
2624
|
-
startTime: new
|
|
2635
|
+
startTime: new BN3__default.default(start),
|
|
2625
2636
|
netAmountDeposited: depositedAmount,
|
|
2626
|
-
period: new
|
|
2637
|
+
period: new BN3__default.default(period),
|
|
2627
2638
|
amountPerPeriod,
|
|
2628
|
-
cliff: new
|
|
2639
|
+
cliff: new BN3__default.default(cliff),
|
|
2629
2640
|
cliffAmount,
|
|
2630
2641
|
transferableBySender,
|
|
2631
2642
|
transferableByRecipient,
|
|
@@ -2634,15 +2645,15 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2634
2645
|
canTopup,
|
|
2635
2646
|
oracleType: !!oracleType ? { [oracleType]: {} } : { none: {} },
|
|
2636
2647
|
streamName: streamNameArray,
|
|
2637
|
-
minPrice: typeof minPrice === "number" ? common.getBN(minPrice,
|
|
2638
|
-
maxPrice: typeof maxPrice === "number" ? common.getBN(maxPrice,
|
|
2639
|
-
minPercentage: typeof minPercentage === "number" ? common.getBN(minPercentage,
|
|
2640
|
-
maxPercentage: typeof maxPercentage === "number" ? common.getBN(maxPercentage,
|
|
2641
|
-
tickSize: new
|
|
2648
|
+
minPrice: typeof minPrice === "number" ? common.getBN(minPrice, ALIGNED_PRECISION_FACTOR_POW2) : minPrice,
|
|
2649
|
+
maxPrice: typeof maxPrice === "number" ? common.getBN(maxPrice, ALIGNED_PRECISION_FACTOR_POW2) : maxPrice,
|
|
2650
|
+
minPercentage: typeof minPercentage === "number" ? common.getBN(minPercentage, ALIGNED_PRECISION_FACTOR_POW2) : minPercentage,
|
|
2651
|
+
maxPercentage: typeof maxPercentage === "number" ? common.getBN(maxPercentage, ALIGNED_PRECISION_FACTOR_POW2) : maxPercentage,
|
|
2652
|
+
tickSize: new BN3__default.default(tickSize || 1),
|
|
2642
2653
|
skipInitial: skipInitial ?? false,
|
|
2643
|
-
expiryTime: new
|
|
2644
|
-
expiryPercentage: typeof expiryPercentage === "number" ? common.getBN(expiryPercentage,
|
|
2645
|
-
floorPrice: typeof floorPrice === "number" ? common.getBN(floorPrice,
|
|
2654
|
+
expiryTime: new BN3__default.default(expiryTime ?? 0),
|
|
2655
|
+
expiryPercentage: typeof expiryPercentage === "number" ? common.getBN(expiryPercentage, ALIGNED_PRECISION_FACTOR_POW2) : expiryPercentage ?? new BN3__default.default(0),
|
|
2656
|
+
floorPrice: typeof floorPrice === "number" ? common.getBN(floorPrice, ALIGNED_PRECISION_FACTOR_POW2) : floorPrice ?? new BN3__default.default(0)
|
|
2646
2657
|
}).accountsPartial({
|
|
2647
2658
|
payer: sender.publicKey,
|
|
2648
2659
|
sender: sender.publicKey,
|
|
@@ -2664,7 +2675,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2664
2675
|
* Creates a new stream/vesting contract.
|
|
2665
2676
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
2666
2677
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
2667
|
-
* @param {
|
|
2678
|
+
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
2668
2679
|
* @returns Create stream instructions
|
|
2669
2680
|
*/
|
|
2670
2681
|
async prepareCreateStreamInstructions({
|
|
@@ -2690,7 +2701,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2690
2701
|
tokenProgramId: streamTokenProgramId
|
|
2691
2702
|
}, { sender, metadataPubKeys, isNative = false, computePrice, computeLimit }) {
|
|
2692
2703
|
common.assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
2693
|
-
const ixs =
|
|
2704
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
2694
2705
|
computePrice,
|
|
2695
2706
|
computeLimit
|
|
2696
2707
|
});
|
|
@@ -2703,22 +2714,22 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2703
2714
|
);
|
|
2704
2715
|
let tokenProgramId = streamTokenProgramId ? new web3_js.PublicKey(streamTokenProgramId) : void 0;
|
|
2705
2716
|
if (!tokenProgramId) {
|
|
2706
|
-
tokenProgramId = (await
|
|
2717
|
+
tokenProgramId = (await common.getMintAndProgram(this.connection, mintPublicKey)).tokenProgramId;
|
|
2707
2718
|
}
|
|
2708
|
-
const senderTokens = await
|
|
2709
|
-
const recipientTokens = await
|
|
2710
|
-
const streamflowTreasuryTokens = await
|
|
2719
|
+
const senderTokens = await common.ata(mintPublicKey, sender.publicKey, tokenProgramId);
|
|
2720
|
+
const recipientTokens = await common.ata(mintPublicKey, recipientPublicKey, tokenProgramId);
|
|
2721
|
+
const streamflowTreasuryTokens = await common.ata(mintPublicKey, STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
|
|
2711
2722
|
const partnerPublicKey = partner ? new web3_js.PublicKey(partner) : WITHDRAWOR_PUBLIC_KEY;
|
|
2712
|
-
const partnerTokens = await
|
|
2723
|
+
const partnerTokens = await common.ata(mintPublicKey, partnerPublicKey, tokenProgramId);
|
|
2713
2724
|
ixs.push(
|
|
2714
2725
|
await createStreamInstruction(
|
|
2715
2726
|
{
|
|
2716
|
-
start: new
|
|
2727
|
+
start: new BN3__default.default(start),
|
|
2717
2728
|
depositedAmount,
|
|
2718
|
-
period: new
|
|
2729
|
+
period: new BN3__default.default(period),
|
|
2719
2730
|
amountPerPeriod,
|
|
2720
|
-
cliff: new
|
|
2721
|
-
cliffAmount: new
|
|
2731
|
+
cliff: new BN3__default.default(cliff),
|
|
2732
|
+
cliffAmount: new BN3__default.default(cliffAmount),
|
|
2722
2733
|
cancelableBySender,
|
|
2723
2734
|
cancelableByRecipient,
|
|
2724
2735
|
automaticWithdrawal,
|
|
@@ -2728,7 +2739,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2728
2739
|
canUpdateRate: !!canUpdateRate,
|
|
2729
2740
|
canPause: !!canPause,
|
|
2730
2741
|
name,
|
|
2731
|
-
withdrawFrequency: new
|
|
2742
|
+
withdrawFrequency: new BN3__default.default(automaticWithdrawal ? withdrawalFrequency : period)
|
|
2732
2743
|
},
|
|
2733
2744
|
this.programId,
|
|
2734
2745
|
{
|
|
@@ -2765,7 +2776,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2765
2776
|
*
|
|
2766
2777
|
* If you are not sure if you should use create or create_unchecked, go for create to be safer.
|
|
2767
2778
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
2768
|
-
* @param {
|
|
2779
|
+
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
2769
2780
|
* @returns Create result
|
|
2770
2781
|
*/
|
|
2771
2782
|
async createUnchecked(data, extParams) {
|
|
@@ -2773,14 +2784,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2773
2784
|
data,
|
|
2774
2785
|
extParams
|
|
2775
2786
|
);
|
|
2776
|
-
const { tx, hash, context } = await
|
|
2787
|
+
const { tx, hash, context } = await common.prepareTransaction(
|
|
2777
2788
|
this.connection,
|
|
2778
2789
|
ixs,
|
|
2779
2790
|
extParams.sender.publicKey,
|
|
2780
2791
|
void 0,
|
|
2781
2792
|
[metadata]
|
|
2782
2793
|
);
|
|
2783
|
-
const signature = await
|
|
2794
|
+
const signature = await common.signAndExecuteTransaction(
|
|
2784
2795
|
this.connection,
|
|
2785
2796
|
extParams.sender,
|
|
2786
2797
|
tx,
|
|
@@ -2833,26 +2844,26 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2833
2844
|
[buffer.Buffer.from("strm"), metadataPubKey.toBuffer()],
|
|
2834
2845
|
this.programId
|
|
2835
2846
|
);
|
|
2836
|
-
const { tokenProgramId } = await
|
|
2837
|
-
const senderTokens = await
|
|
2847
|
+
const { tokenProgramId } = await common.getMintAndProgram(this.connection, mintPublicKey);
|
|
2848
|
+
const senderTokens = await common.ata(mintPublicKey, sender.publicKey, tokenProgramId);
|
|
2838
2849
|
const partnerPublicKey = partner ? new web3_js.PublicKey(partner) : WITHDRAWOR_PUBLIC_KEY;
|
|
2839
|
-
const ixs =
|
|
2850
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
2840
2851
|
computePrice,
|
|
2841
2852
|
computeLimit
|
|
2842
2853
|
});
|
|
2843
2854
|
if (isNative) {
|
|
2844
2855
|
const totalFee = await this.getTotalFee({ address: partnerPublicKey.toString() });
|
|
2845
2856
|
const totalAmount = calculateTotalAmountToDeposit(depositedAmount, totalFee);
|
|
2846
|
-
ixs.push(...await
|
|
2857
|
+
ixs.push(...await common.prepareWrappedAccount(this.connection, sender.publicKey, totalAmount));
|
|
2847
2858
|
}
|
|
2848
2859
|
const createInstruction = await createUncheckedStreamInstruction(
|
|
2849
2860
|
{
|
|
2850
|
-
start: new
|
|
2861
|
+
start: new BN3__default.default(start),
|
|
2851
2862
|
depositedAmount,
|
|
2852
|
-
period: new
|
|
2863
|
+
period: new BN3__default.default(period),
|
|
2853
2864
|
amountPerPeriod,
|
|
2854
|
-
cliff: new
|
|
2855
|
-
cliffAmount: new
|
|
2865
|
+
cliff: new BN3__default.default(cliff),
|
|
2866
|
+
cliffAmount: new BN3__default.default(cliffAmount),
|
|
2856
2867
|
cancelableBySender,
|
|
2857
2868
|
cancelableByRecipient,
|
|
2858
2869
|
automaticWithdrawal,
|
|
@@ -2862,7 +2873,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2862
2873
|
canUpdateRate: !!canUpdateRate,
|
|
2863
2874
|
canPause: !!canPause,
|
|
2864
2875
|
name,
|
|
2865
|
-
withdrawFrequency: new
|
|
2876
|
+
withdrawFrequency: new BN3__default.default(automaticWithdrawal ? withdrawalFrequency : period),
|
|
2866
2877
|
recipient: recipientPublicKey,
|
|
2867
2878
|
partner: partnerPublicKey
|
|
2868
2879
|
},
|
|
@@ -2888,7 +2899,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2888
2899
|
* Builds transaction instructions for creating multiple stream/vesting contracts without creating transactions.
|
|
2889
2900
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
2890
2901
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
2891
|
-
* @param {
|
|
2902
|
+
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
2892
2903
|
* @returns Create multiple transaction instructions
|
|
2893
2904
|
*/
|
|
2894
2905
|
async buildCreateMultipleTransactionInstructions(data, extParams) {
|
|
@@ -2931,8 +2942,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2931
2942
|
true
|
|
2932
2943
|
);
|
|
2933
2944
|
if (isNative) {
|
|
2934
|
-
const totalDepositedAmount = recipients.reduce((acc, recipient) => recipient.amount.add(acc), new
|
|
2935
|
-
const nativeInstructions = await
|
|
2945
|
+
const totalDepositedAmount = recipients.reduce((acc, recipient) => recipient.amount.add(acc), new BN3__default.default(0));
|
|
2946
|
+
const nativeInstructions = await common.prepareWrappedAccount(
|
|
2936
2947
|
this.connection,
|
|
2937
2948
|
sender.publicKey,
|
|
2938
2949
|
totalDepositedAmount
|
|
@@ -2969,7 +2980,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2969
2980
|
* ```
|
|
2970
2981
|
*
|
|
2971
2982
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
2972
|
-
* @param {
|
|
2983
|
+
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
2973
2984
|
* @returns Multiple transaction information
|
|
2974
2985
|
*/
|
|
2975
2986
|
async buildCreateMultipleTransactions(data, extParams) {
|
|
@@ -2978,11 +2989,11 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2978
2989
|
const { value: hash, context } = await this.connection.getLatestBlockhashAndContext();
|
|
2979
2990
|
const batch = [];
|
|
2980
2991
|
for (const { ixs, metadata, recipient } of instructionsBatch) {
|
|
2981
|
-
batch.push({ tx:
|
|
2992
|
+
batch.push({ tx: common.createVersionedTransaction(ixs, sender.publicKey, hash.blockhash, [metadata]), recipient });
|
|
2982
2993
|
}
|
|
2983
2994
|
let prepareTx;
|
|
2984
2995
|
if (prepareInstructions.length > 0) {
|
|
2985
|
-
prepareTx =
|
|
2996
|
+
prepareTx = common.createVersionedTransaction(prepareInstructions, sender.publicKey, hash.blockhash);
|
|
2986
2997
|
}
|
|
2987
2998
|
return {
|
|
2988
2999
|
transactions: batch,
|
|
@@ -2997,7 +3008,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
2997
3008
|
* Creates multiple stream/vesting contracts.
|
|
2998
3009
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
2999
3010
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
3000
|
-
* @param {
|
|
3011
|
+
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
3001
3012
|
* @returns Multiple transaction information
|
|
3002
3013
|
*/
|
|
3003
3014
|
async createMultiple(data, extParams) {
|
|
@@ -3012,11 +3023,11 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3012
3023
|
const batch = [];
|
|
3013
3024
|
const { value: hash, context } = await this.connection.getLatestBlockhashAndContext();
|
|
3014
3025
|
for (const { ixs, metadata, recipient } of instructionsBatch) {
|
|
3015
|
-
batch.push({ tx:
|
|
3026
|
+
batch.push({ tx: common.createVersionedTransaction(ixs, sender.publicKey, hash.blockhash, [metadata]), recipient });
|
|
3016
3027
|
}
|
|
3017
3028
|
if (prepareInstructions.length > 0) {
|
|
3018
3029
|
batch.push({
|
|
3019
|
-
tx:
|
|
3030
|
+
tx: common.createVersionedTransaction(prepareInstructions, sender.publicKey, hash.blockhash),
|
|
3020
3031
|
recipient: sender.publicKey.toBase58()
|
|
3021
3032
|
});
|
|
3022
3033
|
}
|
|
@@ -3030,13 +3041,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3030
3041
|
for (const batchTx of signedBatch) {
|
|
3031
3042
|
responses.push(
|
|
3032
3043
|
...await Promise.allSettled([
|
|
3033
|
-
|
|
3044
|
+
common.executeTransaction(this.connection, batchTx.tx, { hash, context }, this.schedulingParams)
|
|
3034
3045
|
])
|
|
3035
3046
|
);
|
|
3036
3047
|
}
|
|
3037
3048
|
} else {
|
|
3038
3049
|
responses.push(
|
|
3039
|
-
...await
|
|
3050
|
+
...await common.executeMultipleTransactions(
|
|
3040
3051
|
this.connection,
|
|
3041
3052
|
signedBatch.map((item) => item.tx),
|
|
3042
3053
|
{ hash, context },
|
|
@@ -3062,7 +3073,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3062
3073
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
3063
3074
|
* In most cases, createMultiple should be used instead.
|
|
3064
3075
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
3065
|
-
* @param {
|
|
3076
|
+
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
3066
3077
|
* @returns Multiple transaction information
|
|
3067
3078
|
*/
|
|
3068
3079
|
async createMultipleSequential(data, extParams) {
|
|
@@ -3108,7 +3119,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3108
3119
|
for (const batchTx of signedBatch) {
|
|
3109
3120
|
responses.push(
|
|
3110
3121
|
...await Promise.allSettled([
|
|
3111
|
-
|
|
3122
|
+
common.executeTransaction(this.connection, batchTx.tx, { hash, context }, this.schedulingParams)
|
|
3112
3123
|
])
|
|
3113
3124
|
);
|
|
3114
3125
|
}
|
|
@@ -3128,7 +3139,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3128
3139
|
/**
|
|
3129
3140
|
* Attempts withdrawing from the specified stream.
|
|
3130
3141
|
* @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
|
|
3131
|
-
* @param {
|
|
3142
|
+
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
3132
3143
|
* @returns Transaction result
|
|
3133
3144
|
*/
|
|
3134
3145
|
async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, extParams) {
|
|
@@ -3140,8 +3151,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3140
3151
|
);
|
|
3141
3152
|
const metadata = new web3_js.PublicKey(id);
|
|
3142
3153
|
await this.applyCustomAfterInstructions(ixs, customInstructions, metadata);
|
|
3143
|
-
const { tx, hash, context } = await
|
|
3144
|
-
const signature = await
|
|
3154
|
+
const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, invoker.publicKey);
|
|
3155
|
+
const signature = await common.signAndExecuteTransaction(
|
|
3145
3156
|
this.connection,
|
|
3146
3157
|
extParams.invoker,
|
|
3147
3158
|
tx,
|
|
@@ -3157,12 +3168,12 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3157
3168
|
/**
|
|
3158
3169
|
* Creates Transaction Instructions for withdrawal
|
|
3159
3170
|
* @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
|
|
3160
|
-
* @param {
|
|
3171
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
|
|
3161
3172
|
* @returns Transaction instructions
|
|
3162
3173
|
*/
|
|
3163
3174
|
async prepareWithdrawInstructions({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
3164
3175
|
common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
3165
|
-
const ixs =
|
|
3176
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
3166
3177
|
computePrice,
|
|
3167
3178
|
computeLimit
|
|
3168
3179
|
});
|
|
@@ -3171,9 +3182,9 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3171
3182
|
common.invariant(escrow?.data, "Couldn't get account info");
|
|
3172
3183
|
const data = decodeStream(escrow.data);
|
|
3173
3184
|
const { sender, recipient, mint, streamflowTreasury, partner, recipientTokens, escrowTokens } = data;
|
|
3174
|
-
const { tokenProgramId } = await
|
|
3175
|
-
const streamflowTreasuryTokens = await
|
|
3176
|
-
const partnerTokens = await
|
|
3185
|
+
const { tokenProgramId } = await common.getMintAndProgram(this.connection, mint);
|
|
3186
|
+
const streamflowTreasuryTokens = await common.ata(mint, STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
|
|
3187
|
+
const partnerTokens = await common.ata(mint, partner, tokenProgramId);
|
|
3177
3188
|
const ataIx = await this.getCreateATAInstructions(
|
|
3178
3189
|
[sender, recipient, streamflowTreasury, partner],
|
|
3179
3190
|
mint,
|
|
@@ -3202,13 +3213,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3202
3213
|
/**
|
|
3203
3214
|
* Attempts canceling the specified stream.
|
|
3204
3215
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
3205
|
-
* @param {
|
|
3216
|
+
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
3206
3217
|
* @returns Transaction result
|
|
3207
3218
|
*/
|
|
3208
3219
|
async cancel(cancelData, extParams) {
|
|
3209
3220
|
const ixs = await this.prepareCancelInstructions(cancelData, extParams);
|
|
3210
|
-
const { tx, hash, context } = await
|
|
3211
|
-
const signature = await
|
|
3221
|
+
const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
3222
|
+
const signature = await common.signAndExecuteTransaction(
|
|
3212
3223
|
this.connection,
|
|
3213
3224
|
extParams.invoker,
|
|
3214
3225
|
tx,
|
|
@@ -3224,7 +3235,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3224
3235
|
/**
|
|
3225
3236
|
* Creates Transaction Instructions for cancel
|
|
3226
3237
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
3227
|
-
* @param {
|
|
3238
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
|
|
3228
3239
|
* @returns Transaction instructions
|
|
3229
3240
|
*/
|
|
3230
3241
|
async prepareCancelInstructions(cancelData, extParams) {
|
|
@@ -3241,7 +3252,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3241
3252
|
/**
|
|
3242
3253
|
* Creates Transaction Instructions for cancel
|
|
3243
3254
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
3244
|
-
* @param {
|
|
3255
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
3245
3256
|
* @returns Transaction instructions
|
|
3246
3257
|
*/
|
|
3247
3258
|
async prepareCancelAlignedUnlockInstructions({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
@@ -3251,8 +3262,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3251
3262
|
common.invariant(escrowAcc?.data, "Couldn't get account info");
|
|
3252
3263
|
const streamData = decodeStream(escrowAcc.data);
|
|
3253
3264
|
const { sender, recipient, mint, streamflowTreasury, partner, escrowTokens } = streamData;
|
|
3254
|
-
const { tokenProgramId } = await
|
|
3255
|
-
const ixs =
|
|
3265
|
+
const { tokenProgramId } = await common.getMintAndProgram(this.connection, mint);
|
|
3266
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
3256
3267
|
computePrice,
|
|
3257
3268
|
computeLimit: computeLimit ?? ALIGNED_COMPUTE_LIMIT
|
|
3258
3269
|
});
|
|
@@ -3280,7 +3291,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3280
3291
|
/**
|
|
3281
3292
|
* Creates Transaction Instructions for cancel
|
|
3282
3293
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
3283
|
-
* @param {
|
|
3294
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
3284
3295
|
* @returns Transaction instructions
|
|
3285
3296
|
*/
|
|
3286
3297
|
async prepareCancelStreamInstructions({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
@@ -3290,10 +3301,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3290
3301
|
common.invariant(escrowAcc?.data, "Couldn't get account info");
|
|
3291
3302
|
const data = decodeStream(escrowAcc.data);
|
|
3292
3303
|
const { sender, recipient, partner, streamflowTreasury, mint, senderTokens, recipientTokens, escrowTokens } = data;
|
|
3293
|
-
const { tokenProgramId } = await
|
|
3294
|
-
const streamflowTreasuryTokens = await
|
|
3295
|
-
const partnerTokens = await
|
|
3296
|
-
const ixs =
|
|
3304
|
+
const { tokenProgramId } = await common.getMintAndProgram(this.connection, mint);
|
|
3305
|
+
const streamflowTreasuryTokens = await common.ata(mint, STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
|
|
3306
|
+
const partnerTokens = await common.ata(mint, partner, tokenProgramId);
|
|
3307
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
3297
3308
|
computePrice,
|
|
3298
3309
|
computeLimit
|
|
3299
3310
|
});
|
|
@@ -3328,13 +3339,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3328
3339
|
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
3329
3340
|
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
3330
3341
|
* @param {ITransferData} transferData - Transfer parameters including stream ID and new recipient address
|
|
3331
|
-
* @param {
|
|
3342
|
+
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
3332
3343
|
* @returns Transaction result
|
|
3333
3344
|
*/
|
|
3334
3345
|
async transfer({ id, newRecipient }, extParams) {
|
|
3335
3346
|
const ixs = await this.prepareTransferInstructions({ id, newRecipient }, extParams);
|
|
3336
|
-
const { tx, hash, context } = await
|
|
3337
|
-
const signature = await
|
|
3347
|
+
const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
3348
|
+
const signature = await common.signAndExecuteTransaction(
|
|
3338
3349
|
this.connection,
|
|
3339
3350
|
extParams.invoker,
|
|
3340
3351
|
tx,
|
|
@@ -3351,12 +3362,12 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3351
3362
|
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
3352
3363
|
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
3353
3364
|
* @param {ITransferData} transferData - Transfer parameters including stream ID and new recipient address
|
|
3354
|
-
* @param {
|
|
3365
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
3355
3366
|
* @returns Transaction instructions
|
|
3356
3367
|
*/
|
|
3357
3368
|
async prepareTransferInstructions({ id, newRecipient }, { invoker, computePrice, computeLimit = 100001 }) {
|
|
3358
3369
|
common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
3359
|
-
const ixs =
|
|
3370
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
3360
3371
|
computePrice,
|
|
3361
3372
|
computeLimit
|
|
3362
3373
|
});
|
|
@@ -3365,8 +3376,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3365
3376
|
const escrow = await this.connection.getAccountInfo(stream);
|
|
3366
3377
|
common.invariant(escrow?.data, "Couldn't get account info");
|
|
3367
3378
|
const { mint } = decodeStream(escrow?.data);
|
|
3368
|
-
const { tokenProgramId } = await
|
|
3369
|
-
const newRecipientTokens = await
|
|
3379
|
+
const { tokenProgramId } = await common.getMintAndProgram(this.connection, mint);
|
|
3380
|
+
const newRecipientTokens = await common.ata(mint, newRecipientPublicKey, tokenProgramId);
|
|
3370
3381
|
ixs.push(
|
|
3371
3382
|
await transferStreamInstruction(this.programId, {
|
|
3372
3383
|
authority: invoker.publicKey,
|
|
@@ -3385,13 +3396,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3385
3396
|
/**
|
|
3386
3397
|
* Tops up stream account with specified amount.
|
|
3387
3398
|
* @param {ITopUpData} topupData - Top-up parameters including stream ID and amount to add
|
|
3388
|
-
* @param {
|
|
3399
|
+
* @param {ITopUpStreamExt} extParams - Transaction configuration including invoker wallet, native token handling, and compute settings
|
|
3389
3400
|
* @returns Transaction result
|
|
3390
3401
|
*/
|
|
3391
3402
|
async topup({ id, amount }, extParams) {
|
|
3392
3403
|
const ixs = await this.prepareTopupInstructions({ id, amount }, extParams);
|
|
3393
|
-
const { tx, hash, context } = await
|
|
3394
|
-
const signature = await
|
|
3404
|
+
const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
3405
|
+
const signature = await common.signAndExecuteTransaction(
|
|
3395
3406
|
this.connection,
|
|
3396
3407
|
extParams.invoker,
|
|
3397
3408
|
tx,
|
|
@@ -3407,14 +3418,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3407
3418
|
/**
|
|
3408
3419
|
* Create Transaction instructions for topup
|
|
3409
3420
|
* @param {ITopUpData} topupData - Top-up parameters including stream ID and amount to add
|
|
3410
|
-
* @param {
|
|
3421
|
+
* @param {ITopUpStreamExt} extParams - Transaction configuration including invoker wallet, native token handling, and compute settings
|
|
3411
3422
|
* @returns Transaction instructions
|
|
3412
3423
|
*/
|
|
3413
3424
|
async prepareTopupInstructions({ id, amount }, { invoker, isNative, computePrice, computeLimit }) {
|
|
3414
3425
|
if (!invoker.publicKey) {
|
|
3415
3426
|
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
3416
3427
|
}
|
|
3417
|
-
const ixs =
|
|
3428
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
3418
3429
|
computePrice,
|
|
3419
3430
|
computeLimit
|
|
3420
3431
|
});
|
|
@@ -3424,11 +3435,11 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3424
3435
|
throw new Error("Couldn't get account info");
|
|
3425
3436
|
}
|
|
3426
3437
|
const { mint, partner, senderTokens, escrowTokens } = decodeStream(escrow?.data);
|
|
3427
|
-
const { tokenProgramId } = await
|
|
3428
|
-
const streamflowTreasuryTokens = await
|
|
3429
|
-
const partnerTokens = await
|
|
3438
|
+
const { tokenProgramId } = await common.getMintAndProgram(this.connection, mint);
|
|
3439
|
+
const streamflowTreasuryTokens = await common.ata(mint, STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
|
|
3440
|
+
const partnerTokens = await common.ata(mint, partner, tokenProgramId);
|
|
3430
3441
|
if (isNative) {
|
|
3431
|
-
ixs.push(...await
|
|
3442
|
+
ixs.push(...await common.prepareWrappedAccount(this.connection, invoker.publicKey, amount));
|
|
3432
3443
|
}
|
|
3433
3444
|
ixs.push(
|
|
3434
3445
|
await topupStreamInstruction(amount, this.programId, {
|
|
@@ -3490,7 +3501,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3490
3501
|
}
|
|
3491
3502
|
]);
|
|
3492
3503
|
const streamPubKeys = alignedOutgoingProgramAccounts.map((account) => account.account.stream);
|
|
3493
|
-
const streamAccounts = await
|
|
3504
|
+
const streamAccounts = await common.getMultipleAccountsInfoBatched(this.connection, streamPubKeys, TX_FINALITY_CONFIRMED);
|
|
3494
3505
|
streamAccounts.forEach((account, index) => {
|
|
3495
3506
|
if (account) {
|
|
3496
3507
|
const alignedData = alignedOutgoingProgramAccounts[index].account;
|
|
@@ -3505,7 +3516,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3505
3516
|
const alignedProxyPDAs = alignedStreamsPubKeys.map(
|
|
3506
3517
|
(streamPubKey) => deriveContractPDA(this.alignedProxyProgram.programId, new web3_js.PublicKey(streamPubKey))
|
|
3507
3518
|
);
|
|
3508
|
-
const alignedProxyAccounts = await
|
|
3519
|
+
const alignedProxyAccounts = await common.getMultipleAccountsInfoBatched(this.connection, alignedProxyPDAs);
|
|
3509
3520
|
alignedProxyAccounts.forEach((account, index) => {
|
|
3510
3521
|
if (account && account.data.length === ALIGNED_METADATA_ACC_SIZE) {
|
|
3511
3522
|
const alignedData = streamRecord[alignedStreamsPubKeys[index]];
|
|
@@ -3532,7 +3543,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3532
3543
|
let streams = {};
|
|
3533
3544
|
const shouldFetchAligned = type === "all" /* All */ || type === "vesting" /* Vesting */;
|
|
3534
3545
|
if (direction !== "incoming" /* Incoming */) {
|
|
3535
|
-
const outgoingStreamAccounts = await
|
|
3546
|
+
const outgoingStreamAccounts = await common.getProgramAccounts(
|
|
3536
3547
|
this.connection,
|
|
3537
3548
|
publicKey,
|
|
3538
3549
|
STREAM_STRUCT_OFFSET_SENDER,
|
|
@@ -3547,7 +3558,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3547
3558
|
}
|
|
3548
3559
|
}
|
|
3549
3560
|
if (direction !== "outgoing" /* Outgoing */) {
|
|
3550
|
-
const allIncomingAccounts = await
|
|
3561
|
+
const allIncomingAccounts = await common.getProgramAccounts(
|
|
3551
3562
|
this.connection,
|
|
3552
3563
|
publicKey,
|
|
3553
3564
|
STREAM_STRUCT_OFFSET_RECIPIENT,
|
|
@@ -3605,7 +3616,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3605
3616
|
/**
|
|
3606
3617
|
* Attempts updating the stream auto withdrawal params and amount per period
|
|
3607
3618
|
* @param {IUpdateData} data - Update parameters including stream ID and new settings
|
|
3608
|
-
* @param {
|
|
3619
|
+
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
3609
3620
|
* @returns Transaction result
|
|
3610
3621
|
*/
|
|
3611
3622
|
async update(data, extParams) {
|
|
@@ -3613,8 +3624,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3613
3624
|
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
3614
3625
|
}
|
|
3615
3626
|
const ixs = await this.prepareUpdateInstructions(data, extParams);
|
|
3616
|
-
const { tx, hash, context } = await
|
|
3617
|
-
const signature = await
|
|
3627
|
+
const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
3628
|
+
const signature = await common.signAndExecuteTransaction(
|
|
3618
3629
|
this.connection,
|
|
3619
3630
|
extParams.invoker,
|
|
3620
3631
|
tx,
|
|
@@ -3633,7 +3644,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3633
3644
|
/**
|
|
3634
3645
|
* Create Transaction instructions for update
|
|
3635
3646
|
* @param {IUpdateData} data - Update parameters including stream ID and new settings
|
|
3636
|
-
* @param {
|
|
3647
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
3637
3648
|
* @returns Transaction instructions
|
|
3638
3649
|
*/
|
|
3639
3650
|
async prepareUpdateInstructions(data, { invoker, computePrice, computeLimit }) {
|
|
@@ -3641,7 +3652,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3641
3652
|
const streamPublicKey = new web3_js.PublicKey(data.id);
|
|
3642
3653
|
const escrow = await this.connection.getAccountInfo(streamPublicKey);
|
|
3643
3654
|
common.invariant(escrow, "Couldn't get account info");
|
|
3644
|
-
const ixs =
|
|
3655
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
3645
3656
|
computePrice,
|
|
3646
3657
|
computeLimit
|
|
3647
3658
|
});
|
|
@@ -3686,6 +3697,20 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3686
3697
|
async getDefaultStreamflowFee() {
|
|
3687
3698
|
return DEFAULT_STREAMFLOW_FEE;
|
|
3688
3699
|
}
|
|
3700
|
+
/**
|
|
3701
|
+
* Returns total fee percent, streamflow fees + partner fees
|
|
3702
|
+
* @param getFeesData structure with address for which we need to derive fee, either sender or partner usually
|
|
3703
|
+
* @param chainSpecificParams additional parameters required by chain client
|
|
3704
|
+
* @returns fee as floating number, so if fee is 0.99%, it will return 0.99
|
|
3705
|
+
*/
|
|
3706
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3707
|
+
async getTotalFee(getFeesData) {
|
|
3708
|
+
const fees = await this.getFees(getFeesData);
|
|
3709
|
+
if (fees) {
|
|
3710
|
+
return fees.partnerFee + fees.streamflowFee;
|
|
3711
|
+
}
|
|
3712
|
+
return this.getDefaultStreamflowFee();
|
|
3713
|
+
}
|
|
3689
3714
|
/**
|
|
3690
3715
|
* Extracts error code from an error
|
|
3691
3716
|
* @param {Error} err - Error
|
|
@@ -3726,7 +3751,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3726
3751
|
const uniqueOwners = Array.from(new Set(owners.map((owner) => owner.toBase58()))).map(
|
|
3727
3752
|
(pkString) => new web3_js.PublicKey(pkString)
|
|
3728
3753
|
);
|
|
3729
|
-
return
|
|
3754
|
+
return common.checkOrCreateAtaBatch(this.connection, uniqueOwners, mint, invoker, programId);
|
|
3730
3755
|
}
|
|
3731
3756
|
async applyCustomAfterInstructions(ixs, customInstructions, metadata) {
|
|
3732
3757
|
if (customInstructions?.after) {
|
|
@@ -4165,26 +4190,76 @@ Object.defineProperty(exports, "ContractError", {
|
|
|
4165
4190
|
enumerable: true,
|
|
4166
4191
|
get: function () { return common.ContractError; }
|
|
4167
4192
|
});
|
|
4168
|
-
Object.defineProperty(exports, "IChain", {
|
|
4169
|
-
enumerable: true,
|
|
4170
|
-
get: function () { return common.IChain; }
|
|
4171
|
-
});
|
|
4172
4193
|
Object.defineProperty(exports, "ICluster", {
|
|
4173
4194
|
enumerable: true,
|
|
4174
4195
|
get: function () { return common.ICluster; }
|
|
4175
4196
|
});
|
|
4197
|
+
Object.defineProperty(exports, "getBN", {
|
|
4198
|
+
enumerable: true,
|
|
4199
|
+
get: function () { return common.getBN; }
|
|
4200
|
+
});
|
|
4201
|
+
Object.defineProperty(exports, "getNumberFromBN", {
|
|
4202
|
+
enumerable: true,
|
|
4203
|
+
get: function () { return common.getNumberFromBN; }
|
|
4204
|
+
});
|
|
4205
|
+
exports.AIRDROP_AMOUNT = AIRDROP_AMOUNT;
|
|
4206
|
+
exports.AIRDROP_TEST_TOKEN = AIRDROP_TEST_TOKEN;
|
|
4207
|
+
exports.ALIGNED_COMPUTE_LIMIT = ALIGNED_COMPUTE_LIMIT;
|
|
4208
|
+
exports.ALIGNED_PRECISION_FACTOR_POW = ALIGNED_PRECISION_FACTOR_POW2;
|
|
4209
|
+
exports.ALIGNED_UNLOCKS_PROGRAM_ID = ALIGNED_UNLOCKS_PROGRAM_ID;
|
|
4176
4210
|
exports.AlignedContract = AlignedContract;
|
|
4211
|
+
exports.AlignedProxyErrorCode = AlignedProxyErrorCode;
|
|
4212
|
+
exports.CONTRACT_DISCRIMINATOR = CONTRACT_DISCRIMINATOR;
|
|
4213
|
+
exports.CONTRACT_SEED = CONTRACT_SEED;
|
|
4214
|
+
exports.CREATE_PARAMS_PADDING = CREATE_PARAMS_PADDING;
|
|
4177
4215
|
exports.Contract = Contract;
|
|
4216
|
+
exports.ContractErrorCode = ContractErrorCode;
|
|
4217
|
+
exports.DEFAULT_STREAMFLOW_FEE = DEFAULT_STREAMFLOW_FEE;
|
|
4218
|
+
exports.ESCROW_SEED = ESCROW_SEED;
|
|
4219
|
+
exports.FEES_METADATA_SEED = FEES_METADATA_SEED;
|
|
4220
|
+
exports.FEE_ORACLE_PUBLIC_KEY = FEE_ORACLE_PUBLIC_KEY;
|
|
4221
|
+
exports.MAX_SAFE_UNIX_TIME_VALUE = MAX_SAFE_UNIX_TIME_VALUE2;
|
|
4222
|
+
exports.ORIGINAL_CONTRACT_SENDER_OFFSET = ORIGINAL_CONTRACT_SENDER_OFFSET;
|
|
4223
|
+
exports.PARTNERS_SCHEMA = PARTNERS_SCHEMA;
|
|
4224
|
+
exports.PARTNER_ORACLE_PROGRAM_ID = PARTNER_ORACLE_PROGRAM_ID;
|
|
4225
|
+
exports.PARTNER_SCHEMA = PARTNER_SCHEMA;
|
|
4226
|
+
exports.PROGRAM_ID = PROGRAM_ID;
|
|
4227
|
+
exports.SOLANA_ERROR_MAP = SOLANA_ERROR_MAP;
|
|
4228
|
+
exports.SOLANA_ERROR_MATCH_REGEX = SOLANA_ERROR_MATCH_REGEX;
|
|
4229
|
+
exports.STREAMFLOW_TREASURY_PUBLIC_KEY = STREAMFLOW_TREASURY_PUBLIC_KEY;
|
|
4230
|
+
exports.STREAM_STRUCT_OFFSETS = STREAM_STRUCT_OFFSETS;
|
|
4231
|
+
exports.STREAM_STRUCT_OFFSET_CLOSED = STREAM_STRUCT_OFFSET_CLOSED;
|
|
4232
|
+
exports.STREAM_STRUCT_OFFSET_MINT = STREAM_STRUCT_OFFSET_MINT;
|
|
4233
|
+
exports.STREAM_STRUCT_OFFSET_RECIPIENT = STREAM_STRUCT_OFFSET_RECIPIENT;
|
|
4234
|
+
exports.STREAM_STRUCT_OFFSET_SENDER = STREAM_STRUCT_OFFSET_SENDER;
|
|
4178
4235
|
exports.SolanaStreamClient = SolanaStreamClient;
|
|
4236
|
+
exports.StreamDirection = StreamDirection;
|
|
4237
|
+
exports.StreamType = StreamType;
|
|
4238
|
+
exports.TEST_ORACLE_DISCRIMINATOR = TEST_ORACLE_DISCRIMINATOR;
|
|
4239
|
+
exports.TEST_ORACLE_SEED = TEST_ORACLE_SEED;
|
|
4240
|
+
exports.TX_FINALITY_CONFIRMED = TX_FINALITY_CONFIRMED;
|
|
4241
|
+
exports.WITHDRAWOR_PUBLIC_KEY = WITHDRAWOR_PUBLIC_KEY;
|
|
4242
|
+
exports.WITHDRAW_AVAILABLE_AMOUNT = WITHDRAW_AVAILABLE_AMOUNT;
|
|
4243
|
+
exports.buildStreamType = buildStreamType;
|
|
4244
|
+
exports.calculateTotalAmountToDeposit = calculateTotalAmountToDeposit;
|
|
4245
|
+
exports.calculateUnlockedAmount = calculateUnlockedAmount;
|
|
4179
4246
|
exports.cancelStreamInstruction = cancelStreamInstruction;
|
|
4180
|
-
exports.constants = constants_exports;
|
|
4181
4247
|
exports.createStreamInstruction = createStreamInstruction;
|
|
4182
4248
|
exports.createUncheckedStreamInstruction = createUncheckedStreamInstruction;
|
|
4249
|
+
exports.decodeEndTime = decodeEndTime;
|
|
4183
4250
|
exports.decodeStream = decodeStream;
|
|
4184
4251
|
exports.deriveContractPDA = deriveContractPDA;
|
|
4185
4252
|
exports.deriveEscrowPDA = deriveEscrowPDA;
|
|
4186
4253
|
exports.deriveTestOraclePDA = deriveTestOraclePDA;
|
|
4187
4254
|
exports.extractSolanaErrorCode = extractSolanaErrorCode;
|
|
4255
|
+
exports.handleContractError = handleContractError;
|
|
4256
|
+
exports.isAligned = isAligned;
|
|
4257
|
+
exports.isCliffCloseToDepositedAmount = isCliffCloseToDepositedAmount;
|
|
4258
|
+
exports.isCreateAlignedStreamData = isCreateAlignedStreamData;
|
|
4259
|
+
exports.isDynamicLock = isDynamicLock;
|
|
4260
|
+
exports.isPayment = isPayment;
|
|
4261
|
+
exports.isTokenLock = isTokenLock;
|
|
4262
|
+
exports.isVesting = isVesting;
|
|
4188
4263
|
exports.sendAndConfirmStreamRawTransaction = sendAndConfirmStreamRawTransaction;
|
|
4189
4264
|
exports.signAllTransactionWithRecipients = signAllTransactionWithRecipients;
|
|
4190
4265
|
exports.timelockIDL = timelockIDL_default;
|