@streamflow/stream 2.0.2-beta.24 → 2.0.2-test.6

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.
@@ -9,6 +9,6 @@ export declare const PROGRAM_ID: {
9
9
  local: string;
10
10
  };
11
11
  export declare const STREAMFLOW_PROGRAM_ID = "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m";
12
- export declare const STREAMFLOW_DEVNET_PROGRAM_ID = "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ";
12
+ export declare const STREAMFLOW_DEVNET_PROGRAM_ID = "FGjLaVo5zLGdzCxMo9gu9tXr1kzTToKd8C8K7YS5hNM1";
13
13
  export declare const STREAMFLOW_TREASURY_PUBLIC_KEY: PublicKey;
14
14
  export declare const WITHDRAWOR_PUBLIC_KEY: PublicKey;
package/dist/constants.js CHANGED
@@ -7,13 +7,19 @@ var types_1 = require("./types");
7
7
  exports.TX_FINALITY_CONFIRMED = "confirmed";
8
8
  exports.STREAM_STRUCT_OFFSET_SENDER = 49;
9
9
  exports.STREAM_STRUCT_OFFSET_RECIPIENT = 113;
10
+ // export const PROGRAM_ID = {
11
+ // [Cluster.Devnet]: "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
12
+ // [Cluster.Mainnet]: "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m",
13
+ // [Cluster.Testnet]: "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
14
+ // [LocalCluster.Local]: "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
15
+ // };
10
16
  exports.PROGRAM_ID = (_a = {},
11
- _a[types_1.Cluster.Devnet] = "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
17
+ _a[types_1.Cluster.Devnet] = "FGjLaVo5zLGdzCxMo9gu9tXr1kzTToKd8C8K7YS5hNM1",
12
18
  _a[types_1.Cluster.Mainnet] = "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m",
13
- _a[types_1.Cluster.Testnet] = "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
14
- _a[types_1.LocalCluster.Local] = "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
19
+ _a[types_1.Cluster.Testnet] = "FGjLaVo5zLGdzCxMo9gu9tXr1kzTToKd8C8K7YS5hNM1",
20
+ _a[types_1.LocalCluster.Local] = "FGjLaVo5zLGdzCxMo9gu9tXr1kzTToKd8C8K7YS5hNM1",
15
21
  _a);
16
22
  exports.STREAMFLOW_PROGRAM_ID = "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m";
17
- exports.STREAMFLOW_DEVNET_PROGRAM_ID = "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ";
23
+ exports.STREAMFLOW_DEVNET_PROGRAM_ID = "FGjLaVo5zLGdzCxMo9gu9tXr1kzTToKd8C8K7YS5hNM1";
18
24
  exports.STREAMFLOW_TREASURY_PUBLIC_KEY = new web3_js_1.PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
19
25
  exports.WITHDRAWOR_PUBLIC_KEY = new web3_js_1.PublicKey("wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u");
package/dist/sdk.js CHANGED
@@ -122,10 +122,10 @@ var Stream = /** @class */ (function () {
122
122
  Stream.prototype.create = function (_a) {
123
123
  var 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, automaticWithdrawal = _a.automaticWithdrawal, partner = _a.partner;
124
124
  return __awaiter(this, void 0, void 0, function () {
125
- var ixs, mintPublicKey, recipientPublicKey, metadata, _b, escrowTokens, senderTokens, recipientTokens, streamflowTreasuryTokens, partnerPublicKey, partnerTokens, commitment, hash, tx, rawTx, signature;
126
- var _c;
127
- return __generator(this, function (_d) {
128
- switch (_d.label) {
125
+ var ixs, mintPublicKey, recipientPublicKey, metadata, _b, escrowTokens, metadataAcc, _c, _d, senderTokens, recipientTokens, streamflowTreasuryTokens, partnerPublicKey, partnerTokens, commitment, hash, tx, rawTx, signature;
126
+ var _e, _f;
127
+ return __generator(this, function (_g) {
128
+ switch (_g.label) {
129
129
  case 0:
130
130
  ixs = [];
131
131
  mintPublicKey = new web3_js_1.PublicKey(mint);
@@ -133,22 +133,34 @@ var Stream = /** @class */ (function () {
133
133
  metadata = web3_js_1.Keypair.generate();
134
134
  return [4 /*yield*/, anchor_1.web3.PublicKey.findProgramAddress([buffer_1.Buffer.from("strm"), metadata.publicKey.toBuffer()], this.programId)];
135
135
  case 1:
136
- _b = __read.apply(void 0, [_d.sent(), 1]), escrowTokens = _b[0];
137
- return [4 /*yield*/, ata(mintPublicKey, sender.publicKey)];
136
+ _b = __read.apply(void 0, [_g.sent(), 1]), escrowTokens = _b[0];
137
+ _d = (_c = web3_js_1.SystemProgram).createAccount;
138
+ _e = {
139
+ programId: this.programId,
140
+ space: 1500
141
+ };
142
+ return [4 /*yield*/, this.connection.getMinimumBalanceForRentExemption(1500, "confirmed")];
138
143
  case 2:
139
- senderTokens = _d.sent();
140
- return [4 /*yield*/, ata(mintPublicKey, recipientPublicKey)];
144
+ metadataAcc = _d.apply(_c, [(_e.lamports = _g.sent(),
145
+ _e.fromPubkey = sender.publicKey,
146
+ _e.newAccountPubkey = metadata.publicKey,
147
+ _e)]);
148
+ return [4 /*yield*/, ata(mintPublicKey, sender.publicKey)];
141
149
  case 3:
142
- recipientTokens = _d.sent();
143
- return [4 /*yield*/, ata(mintPublicKey, constants_1.STREAMFLOW_TREASURY_PUBLIC_KEY)];
150
+ senderTokens = _g.sent();
151
+ return [4 /*yield*/, ata(mintPublicKey, recipientPublicKey)];
144
152
  case 4:
145
- streamflowTreasuryTokens = _d.sent();
153
+ recipientTokens = _g.sent();
154
+ return [4 /*yield*/, ata(mintPublicKey, constants_1.STREAMFLOW_TREASURY_PUBLIC_KEY)];
155
+ case 5:
156
+ streamflowTreasuryTokens = _g.sent();
146
157
  partnerPublicKey = partner
147
158
  ? new web3_js_1.PublicKey(partner)
148
159
  : constants_1.STREAMFLOW_TREASURY_PUBLIC_KEY;
149
160
  return [4 /*yield*/, ata(mintPublicKey, partnerPublicKey)];
150
- case 5:
151
- partnerTokens = _d.sent();
161
+ case 6:
162
+ partnerTokens = _g.sent();
163
+ ixs.push(metadataAcc);
152
164
  ixs.push((0, instructions_1.createStreamInstruction)({
153
165
  start: new spl_token_1.u64(start),
154
166
  depositedAmount: depositedAmount,
@@ -188,20 +200,20 @@ var Stream = /** @class */ (function () {
188
200
  ? this.commitment
189
201
  : this.commitment.commitment;
190
202
  return [4 /*yield*/, this.connection.getRecentBlockhash(commitment)];
191
- case 6:
192
- hash = _d.sent();
193
- tx = (_c = new web3_js_1.Transaction({
203
+ case 7:
204
+ hash = _g.sent();
205
+ tx = (_f = new web3_js_1.Transaction({
194
206
  feePayer: sender.publicKey,
195
207
  recentBlockhash: hash.blockhash,
196
- })).add.apply(_c, __spreadArray([], __read(ixs), false));
208
+ })).add.apply(_f, __spreadArray([], __read(ixs), false));
197
209
  tx.partialSign(metadata);
198
210
  return [4 /*yield*/, sender.signTransaction(tx)];
199
- case 7:
200
- _d.sent();
211
+ case 8:
212
+ _g.sent();
201
213
  rawTx = tx.serialize();
202
214
  return [4 /*yield*/, (0, web3_js_1.sendAndConfirmRawTransaction)(this.connection, rawTx)];
203
- case 8:
204
- signature = _d.sent();
215
+ case 9:
216
+ signature = _g.sent();
205
217
  return [2 /*return*/, { ixs: ixs, tx: signature, metadata: metadata }];
206
218
  }
207
219
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/stream",
3
- "version": "2.0.2-beta.24",
3
+ "version": "2.0.2-test.6",
4
4
  "description": "JavaScript SDK to interact with Streamflow protocol.",
5
5
  "main": "dist/index.js",
6
6
  "homepage": "https://github.com/streamflow-finance/js-sdk/",