@streamflow/stream 2.1.0 → 2.2.2
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/constants.d.ts +1 -0
- package/dist/constants.js +2 -1
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.js +8 -6
- package/package.json +1 -1
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.WITHDRAWOR_PUBLIC_KEY = exports.STREAMFLOW_TREASURY_PUBLIC_KEY = exports.PROGRAM_ID = exports.STREAM_STRUCT_OFFSET_RECIPIENT = exports.STREAM_STRUCT_OFFSET_SENDER = exports.TX_FINALITY_CONFIRMED = void 0;
|
|
4
|
+
exports.FEE_ORACLE_PUBLIC_KEY = exports.WITHDRAWOR_PUBLIC_KEY = exports.STREAMFLOW_TREASURY_PUBLIC_KEY = exports.PROGRAM_ID = exports.STREAM_STRUCT_OFFSET_RECIPIENT = exports.STREAM_STRUCT_OFFSET_SENDER = exports.TX_FINALITY_CONFIRMED = void 0;
|
|
5
5
|
var web3_js_1 = require("@solana/web3.js");
|
|
6
6
|
var types_1 = require("./types");
|
|
7
7
|
exports.TX_FINALITY_CONFIRMED = "confirmed";
|
|
@@ -15,3 +15,4 @@ exports.PROGRAM_ID = (_a = {},
|
|
|
15
15
|
_a);
|
|
16
16
|
exports.STREAMFLOW_TREASURY_PUBLIC_KEY = new web3_js_1.PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
|
|
17
17
|
exports.WITHDRAWOR_PUBLIC_KEY = new web3_js_1.PublicKey("wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u");
|
|
18
|
+
exports.FEE_ORACLE_PUBLIC_KEY = new web3_js_1.PublicKey("B743wFVk2pCYhV91cn287e1xY7f1vt4gdY48hhNiuQmT");
|
package/dist/sdk.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export default class Stream {
|
|
|
22
22
|
* @param {boolean} data.transferableByRecipient - Whether or not recipient can transfer the stream.
|
|
23
23
|
* @param {boolean} [data.automaticWithdrawal = false] - Whether or not a 3rd party can initiate withdraw in the name of recipient.
|
|
24
24
|
* @param {number} [data.withdrawalFrequency = 0] - Relevant when automatic withdrawal is enabled. If greater than 0 our withdrawor will take care of withdrawals. If equal to 0 our withdrawor will skip, but everyone else can initiate withdrawals.
|
|
25
|
-
* @param {string} [data.partner =
|
|
25
|
+
* @param {string} [data.partner = ""] - Partner's wallet address (optional).
|
|
26
26
|
* @param {ClusterExtended} [data.cluster = Cluster.Mainnet] - Cluster: devnet, mainnet-beta, testnet or local (optional).
|
|
27
27
|
*/
|
|
28
28
|
static create({ connection, sender, recipient, mint, start, depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, partner, cluster, }: CreateStreamParams): Promise<CreateStreamResponse>;
|
package/dist/sdk.js
CHANGED
|
@@ -112,11 +112,11 @@ var Stream = /** @class */ (function () {
|
|
|
112
112
|
* @param {boolean} data.transferableByRecipient - Whether or not recipient can transfer the stream.
|
|
113
113
|
* @param {boolean} [data.automaticWithdrawal = false] - Whether or not a 3rd party can initiate withdraw in the name of recipient.
|
|
114
114
|
* @param {number} [data.withdrawalFrequency = 0] - Relevant when automatic withdrawal is enabled. If greater than 0 our withdrawor will take care of withdrawals. If equal to 0 our withdrawor will skip, but everyone else can initiate withdrawals.
|
|
115
|
-
* @param {string} [data.partner =
|
|
115
|
+
* @param {string} [data.partner = ""] - Partner's wallet address (optional).
|
|
116
116
|
* @param {ClusterExtended} [data.cluster = Cluster.Mainnet] - Cluster: devnet, mainnet-beta, testnet or local (optional).
|
|
117
117
|
*/
|
|
118
118
|
Stream.create = function (_a) {
|
|
119
|
-
var connection = _a.connection, sender = _a.sender, recipient = _a.recipient, mint = _a.mint, start = _a.start, depositedAmount = _a.depositedAmount, period = _a.period, cliff = _a.cliff, cliffAmount = _a.cliffAmount, amountPerPeriod = _a.amountPerPeriod, name = _a.name, canTopup = _a.canTopup, cancelableBySender = _a.cancelableBySender, cancelableByRecipient = _a.cancelableByRecipient, transferableBySender = _a.transferableBySender, transferableByRecipient = _a.transferableByRecipient, _b = _a.automaticWithdrawal, automaticWithdrawal = _b === void 0 ? false : _b, _c = _a.withdrawalFrequency, withdrawalFrequency = _c === void 0 ? 0 : _c, _d = _a.partner, partner = _d === void 0 ?
|
|
119
|
+
var connection = _a.connection, sender = _a.sender, recipient = _a.recipient, mint = _a.mint, start = _a.start, depositedAmount = _a.depositedAmount, period = _a.period, cliff = _a.cliff, cliffAmount = _a.cliffAmount, amountPerPeriod = _a.amountPerPeriod, name = _a.name, canTopup = _a.canTopup, cancelableBySender = _a.cancelableBySender, cancelableByRecipient = _a.cancelableByRecipient, transferableBySender = _a.transferableBySender, transferableByRecipient = _a.transferableByRecipient, _b = _a.automaticWithdrawal, automaticWithdrawal = _b === void 0 ? false : _b, _c = _a.withdrawalFrequency, withdrawalFrequency = _c === void 0 ? 0 : _c, _d = _a.partner, partner = _d === void 0 ? "" : _d, _e = _a.cluster, cluster = _e === void 0 ? types_1.Cluster.Mainnet : _e;
|
|
120
120
|
return __awaiter(this, void 0, void 0, function () {
|
|
121
121
|
var program, mintPublicKey, recipientPublicKey, metadata, _f, escrowTokens, senderTokens, recipientTokens, streamflowTreasuryTokens, partnerPublicKey, partnerTokens, signers, nameUtf8EncodedBytes, tx;
|
|
122
122
|
return __generator(this, function (_g) {
|
|
@@ -138,7 +138,9 @@ var Stream = /** @class */ (function () {
|
|
|
138
138
|
return [4 /*yield*/, ata(mintPublicKey, constants_1.STREAMFLOW_TREASURY_PUBLIC_KEY)];
|
|
139
139
|
case 4:
|
|
140
140
|
streamflowTreasuryTokens = _g.sent();
|
|
141
|
-
partnerPublicKey =
|
|
141
|
+
partnerPublicKey = partner
|
|
142
|
+
? new web3_js_1.PublicKey(partner)
|
|
143
|
+
: sender.publicKey;
|
|
142
144
|
return [4 /*yield*/, ata(mintPublicKey, partnerPublicKey)];
|
|
143
145
|
case 5:
|
|
144
146
|
partnerTokens = _g.sent();
|
|
@@ -159,7 +161,7 @@ var Stream = /** @class */ (function () {
|
|
|
159
161
|
partner: partnerPublicKey,
|
|
160
162
|
partnerTokens: partnerTokens,
|
|
161
163
|
mint: mint,
|
|
162
|
-
feeOracle: constants_1.
|
|
164
|
+
feeOracle: constants_1.FEE_ORACLE_PUBLIC_KEY,
|
|
163
165
|
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
164
166
|
timelockProgram: program.programId,
|
|
165
167
|
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
@@ -210,7 +212,7 @@ var Stream = /** @class */ (function () {
|
|
|
210
212
|
return [4 /*yield*/, program.rpc.withdraw(amount, {
|
|
211
213
|
accounts: {
|
|
212
214
|
authority: invoker.publicKey,
|
|
213
|
-
recipient:
|
|
215
|
+
recipient: data.recipient,
|
|
214
216
|
recipientTokens: data.recipientTokens,
|
|
215
217
|
metadata: streamPublicKey,
|
|
216
218
|
escrowTokens: data.escrowTokens,
|
|
@@ -490,7 +492,7 @@ function ata(mint, account) {
|
|
|
490
492
|
return __awaiter(this, void 0, void 0, function () {
|
|
491
493
|
return __generator(this, function (_a) {
|
|
492
494
|
switch (_a.label) {
|
|
493
|
-
case 0: return [4 /*yield*/, spl_token_1.Token.getAssociatedTokenAddress(spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, spl_token_1.TOKEN_PROGRAM_ID, mint, account)];
|
|
495
|
+
case 0: return [4 /*yield*/, spl_token_1.Token.getAssociatedTokenAddress(spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, spl_token_1.TOKEN_PROGRAM_ID, mint, account, true)];
|
|
494
496
|
case 1: return [2 /*return*/, _a.sent()];
|
|
495
497
|
}
|
|
496
498
|
});
|
package/package.json
CHANGED