@streamflow/stream 3.0.3-test.0 → 3.0.5

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/Stream.js CHANGED
@@ -410,7 +410,7 @@ var Stream = /** @class */ (function () {
410
410
  if (!(escrow === null || escrow === void 0 ? void 0 : escrow.data)) {
411
411
  throw new Error("Couldn't get account info.");
412
412
  }
413
- return [2 /*return*/, (0, utils_1.formatDecodedStream)((0, utils_1.decodeStream)(escrow === null || escrow === void 0 ? void 0 : escrow.data))];
413
+ return [2 /*return*/, new types_1.Contract((0, utils_1.decodeStream)(escrow === null || escrow === void 0 ? void 0 : escrow.data))];
414
414
  }
415
415
  });
416
416
  });
@@ -454,7 +454,7 @@ var Stream = /** @class */ (function () {
454
454
  streams = {};
455
455
  accounts.forEach(function (account) {
456
456
  var _a;
457
- var decoded = (0, utils_1.formatDecodedStream)((0, utils_1.decodeStream)(account.account.data));
457
+ var decoded = new types_1.Contract((0, utils_1.decodeStream)(account.account.data));
458
458
  streams = __assign(__assign({}, streams), (_a = {}, _a[account.pubkey.toBase58()] = decoded, _a));
459
459
  });
460
460
  sortedStreams = Object.entries(streams).sort(function (_a, _b) {
@@ -9,8 +9,9 @@ export default class StreamClient {
9
9
  /**
10
10
  * Create Stream instance
11
11
  */
12
- constructor(clusterUrl: string, cluster?: ClusterExtended, commitment?: Commitment | ConnectionConfig);
12
+ constructor(clusterUrl: string, cluster?: ClusterExtended, commitment?: Commitment | ConnectionConfig, programId?: string);
13
13
  getConnection(): web3.Connection;
14
+ getProgramId(): string;
14
15
  /**
15
16
  * Creates a new stream/vesting contract.
16
17
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
@@ -97,21 +97,29 @@ var utils_1 = require("./utils");
97
97
  var constants_1 = require("./constants");
98
98
  var instructions_1 = require("./instructions");
99
99
  var common_1 = require("@project-serum/common");
100
+ var bs58_1 = require("@project-serum/anchor/dist/cjs/utils/bytes/bs58");
100
101
  var StreamClient = /** @class */ (function () {
101
102
  /**
102
103
  * Create Stream instance
103
104
  */
104
- function StreamClient(clusterUrl, cluster, commitment) {
105
+ function StreamClient(clusterUrl, cluster, commitment, programId) {
105
106
  if (cluster === void 0) { cluster = types_1.Cluster.Mainnet; }
106
107
  if (commitment === void 0) { commitment = "confirmed"; }
108
+ if (programId === void 0) { programId = ""; }
107
109
  this.commitment = commitment;
108
110
  this.cluster = cluster;
109
111
  this.connection = new web3_js_1.Connection(clusterUrl, this.commitment);
110
112
  this.programId = new web3_js_1.PublicKey(constants_1.PROGRAM_ID[cluster]);
113
+ if (programId != "") {
114
+ this.programId = new web3_js_1.PublicKey(programId);
115
+ }
111
116
  }
112
117
  StreamClient.prototype.getConnection = function () {
113
118
  return this.connection;
114
119
  };
120
+ StreamClient.prototype.getProgramId = function () {
121
+ return this.programId.toBase58();
122
+ };
115
123
  /**
116
124
  * Creates a new stream/vesting contract.
117
125
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
@@ -240,8 +248,8 @@ var StreamClient = /** @class */ (function () {
240
248
  */
241
249
  StreamClient.prototype.createMultiple = function (data) {
242
250
  return __awaiter(this, void 0, void 0, function () {
243
- var sender, recipientsData, metadatas, metadataToRecipient, errors, signatures, chunkSize, chunkes, i, chunk, chunkes_1, chunkes_1_1, chunk, batch, chunk_1, chunk_1_1, recipientData, _a, tx, metadata, metadataPubKey, e_1_1, signed_batch, batchTransactionsCalls, responses, successes, failures, e_2_1;
244
- var e_2, _b, e_1, _c;
251
+ var sender, recipientsData, metadatas, metadataToRecipient, errors, signatures, chunkSize, chunkes, batch, recipientsData_1, recipientsData_1_1, recipientData, _a, tx, metadata, metadataPubKey, e_1_1, i, chunk, chunkes_1, chunkes_1_1, chunk, signed_batch, batchTransactionsCalls, responses, successes, failures, e_2_1;
252
+ var e_1, _b, e_2, _c;
245
253
  var _this = this;
246
254
  return __generator(this, function (_d) {
247
255
  switch (_d.label) {
@@ -251,52 +259,53 @@ var StreamClient = /** @class */ (function () {
251
259
  metadataToRecipient = {};
252
260
  errors = [];
253
261
  signatures = [];
254
- chunkSize = 10;
262
+ chunkSize = 100;
255
263
  chunkes = [];
256
- for (i = 0; i < recipientsData.length; i += chunkSize) {
257
- chunk = recipientsData.slice(i, i + chunkSize);
258
- chunkes.push(chunk);
259
- }
264
+ batch = [];
260
265
  _d.label = 1;
261
266
  case 1:
262
- _d.trys.push([1, 16, 17, 18]);
263
- chunkes_1 = __values(chunkes), chunkes_1_1 = chunkes_1.next();
267
+ _d.trys.push([1, 6, 7, 8]);
268
+ recipientsData_1 = __values(recipientsData), recipientsData_1_1 = recipientsData_1.next();
264
269
  _d.label = 2;
265
270
  case 2:
266
- if (!!chunkes_1_1.done) return [3 /*break*/, 15];
267
- chunk = chunkes_1_1.value;
268
- batch = [];
269
- _d.label = 3;
270
- case 3:
271
- _d.trys.push([3, 8, 9, 10]);
272
- chunk_1 = (e_1 = void 0, __values(chunk)), chunk_1_1 = chunk_1.next();
273
- _d.label = 4;
274
- case 4:
275
- if (!!chunk_1_1.done) return [3 /*break*/, 7];
276
- recipientData = chunk_1_1.value;
271
+ if (!!recipientsData_1_1.done) return [3 /*break*/, 5];
272
+ recipientData = recipientsData_1_1.value;
277
273
  return [4 /*yield*/, this.prepareStreamTransaction(recipientData, data)];
278
- case 5:
274
+ case 3:
279
275
  _a = _d.sent(), tx = _a.tx, metadata = _a.metadata;
280
276
  metadataPubKey = metadata.publicKey.toBase58();
281
277
  metadataToRecipient[metadataPubKey] = recipientData;
282
278
  metadatas.push(metadata);
283
279
  batch.push({ tx: tx, recipient: recipientData.recipient });
284
- _d.label = 6;
280
+ _d.label = 4;
281
+ case 4:
282
+ recipientsData_1_1 = recipientsData_1.next();
283
+ return [3 /*break*/, 2];
284
+ case 5: return [3 /*break*/, 8];
285
285
  case 6:
286
- chunk_1_1 = chunk_1.next();
287
- return [3 /*break*/, 4];
288
- case 7: return [3 /*break*/, 10];
289
- case 8:
290
286
  e_1_1 = _d.sent();
291
287
  e_1 = { error: e_1_1 };
292
- return [3 /*break*/, 10];
293
- case 9:
288
+ return [3 /*break*/, 8];
289
+ case 7:
294
290
  try {
295
- if (chunk_1_1 && !chunk_1_1.done && (_c = chunk_1.return)) _c.call(chunk_1);
291
+ if (recipientsData_1_1 && !recipientsData_1_1.done && (_b = recipientsData_1.return)) _b.call(recipientsData_1);
296
292
  }
297
293
  finally { if (e_1) throw e_1.error; }
298
294
  return [7 /*endfinally*/];
299
- case 10: return [4 /*yield*/, signAllTransactionWithRecipients(sender, batch)];
295
+ case 8:
296
+ for (i = 0; i < batch.length; i += chunkSize) {
297
+ chunk = batch.slice(i, i + chunkSize);
298
+ chunkes.push(chunk);
299
+ }
300
+ _d.label = 9;
301
+ case 9:
302
+ _d.trys.push([9, 16, 17, 18]);
303
+ chunkes_1 = __values(chunkes), chunkes_1_1 = chunkes_1.next();
304
+ _d.label = 10;
305
+ case 10:
306
+ if (!!chunkes_1_1.done) return [3 /*break*/, 15];
307
+ chunk = chunkes_1_1.value;
308
+ return [4 /*yield*/, signAllTransactionWithRecipients(sender, chunk)];
300
309
  case 11:
301
310
  signed_batch = _d.sent();
302
311
  batchTransactionsCalls = signed_batch.map(function (el) {
@@ -321,7 +330,7 @@ var StreamClient = /** @class */ (function () {
321
330
  _d.label = 14;
322
331
  case 14:
323
332
  chunkes_1_1 = chunkes_1.next();
324
- return [3 /*break*/, 2];
333
+ return [3 /*break*/, 10];
325
334
  case 15: return [3 /*break*/, 18];
326
335
  case 16:
327
336
  e_2_1 = _d.sent();
@@ -329,7 +338,7 @@ var StreamClient = /** @class */ (function () {
329
338
  return [3 /*break*/, 18];
330
339
  case 17:
331
340
  try {
332
- if (chunkes_1_1 && !chunkes_1_1.done && (_b = chunkes_1.return)) _b.call(chunkes_1);
341
+ if (chunkes_1_1 && !chunkes_1_1.done && (_c = chunkes_1.return)) _c.call(chunkes_1);
333
342
  }
334
343
  finally { if (e_2) throw e_2.error; }
335
344
  return [7 /*endfinally*/];
@@ -596,7 +605,7 @@ var StreamClient = /** @class */ (function () {
596
605
  if (!(escrow === null || escrow === void 0 ? void 0 : escrow.data)) {
597
606
  throw new Error("Couldn't get account info.");
598
607
  }
599
- return [2 /*return*/, (0, utils_1.formatDecodedStream)((0, utils_1.decodeStream)(escrow === null || escrow === void 0 ? void 0 : escrow.data))];
608
+ return [2 /*return*/, new types_1.Contract((0, utils_1.decodeStream)(escrow === null || escrow === void 0 ? void 0 : escrow.data))];
600
609
  }
601
610
  });
602
611
  });
@@ -638,7 +647,7 @@ var StreamClient = /** @class */ (function () {
638
647
  streams = {};
639
648
  accounts.forEach(function (account) {
640
649
  var _a;
641
- var decoded = (0, utils_1.formatDecodedStream)((0, utils_1.decodeStream)(account.account.data));
650
+ var decoded = new types_1.Contract((0, utils_1.decodeStream)(account.account.data));
642
651
  streams = __assign(__assign({}, streams), (_a = {}, _a[account.pubkey.toBase58()] = decoded, _a));
643
652
  });
644
653
  sortedStreams = Object.entries(streams).sort(function (_a, _b) {
@@ -753,12 +762,13 @@ var StreamClient = /** @class */ (function () {
753
762
  withdrawor: constants_1.WITHDRAWOR_PUBLIC_KEY,
754
763
  systemProgram: web3_js_1.SystemProgram.programId,
755
764
  }));
756
- return [4 /*yield*/, this.connection.getRecentBlockhash(commitment)];
765
+ return [4 /*yield*/, this.connection.getLatestBlockhash(commitment)];
757
766
  case 6:
758
767
  hash = _f.sent();
759
768
  tx = (_e = new web3_js_1.Transaction({
760
769
  feePayer: sender.publicKey,
761
- recentBlockhash: hash.blockhash,
770
+ blockhash: hash.blockhash,
771
+ lastValidBlockHeight: hash.lastValidBlockHeight,
762
772
  })).add.apply(_e, __spreadArray([], __read(ixs), false));
763
773
  tx.partialSign(metadata);
764
774
  return [2 /*return*/, { tx: tx, metadata: metadata }];
@@ -852,18 +862,26 @@ function signAllTransactionWithRecipients(sender, batch) {
852
862
  }
853
863
  function sendAndConfirmStreamRawTransaction(connection, batchItem) {
854
864
  return __awaiter(this, void 0, void 0, function () {
855
- var rawTx, signature, error_1;
856
- return __generator(this, function (_a) {
857
- switch (_a.label) {
865
+ var rawTx, _a, lastValidBlockHeight, signature, recentBlockhash, confirmationStrategy, completedTxSignature, error_1;
866
+ return __generator(this, function (_b) {
867
+ switch (_b.label) {
858
868
  case 0:
859
- _a.trys.push([0, 2, , 3]);
869
+ _b.trys.push([0, 2, , 3]);
860
870
  rawTx = batchItem.tx.serialize();
861
- return [4 /*yield*/, (0, web3_js_1.sendAndConfirmRawTransaction)(connection, rawTx)];
871
+ _a = batchItem.tx, lastValidBlockHeight = _a.lastValidBlockHeight, signature = _a.signature, recentBlockhash = _a.recentBlockhash;
872
+ if (!lastValidBlockHeight || !signature || !recentBlockhash)
873
+ throw { recipient: batchItem.recipient, error: "no recent blockhash" };
874
+ confirmationStrategy = {
875
+ lastValidBlockHeight: lastValidBlockHeight,
876
+ signature: (0, bs58_1.encode)(signature),
877
+ blockhash: recentBlockhash,
878
+ };
879
+ return [4 /*yield*/, (0, web3_js_1.sendAndConfirmRawTransaction)(connection, rawTx, confirmationStrategy)];
862
880
  case 1:
863
- signature = _a.sent();
864
- return [2 /*return*/, __assign(__assign({}, batchItem), { signature: signature })];
881
+ completedTxSignature = _b.sent();
882
+ return [2 /*return*/, __assign(__assign({}, batchItem), { signature: completedTxSignature })];
865
883
  case 2:
866
- error_1 = _a.sent();
884
+ error_1 = _b.sent();
867
885
  throw { recipient: batchItem.recipient, error: error_1 };
868
886
  case 3: return [2 /*return*/];
869
887
  }
@@ -120,7 +120,7 @@ beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
120
120
  connection = new web3.Connection(web3.clusterApiUrl(), "confirmed");
121
121
  sender = new anchor_1.Wallet(web3.Keypair.generate());
122
122
  recipient = new anchor_1.Wallet(web3.Keypair.generate());
123
- recipients = __spreadArray([], __read(new Array(30)), false).map(function () { return new anchor_1.Wallet(web3.Keypair.generate()); });
123
+ recipients = __spreadArray([], __read(new Array(10)), false).map(function () { return new anchor_1.Wallet(web3.Keypair.generate()); });
124
124
  return [4 /*yield*/, (0, airdrop_request_1.requestAirdrop)(sender, connection)];
125
125
  case 1:
126
126
  _a.sent();
@@ -211,7 +211,7 @@ exports.timePeriodOptions = [
211
211
  { value: exports.PERIOD.YEAR, label: "year" },
212
212
  ];
213
213
  test("Can create multiple stremas", function () { return __awaiter(void 0, void 0, void 0, function () {
214
- var now, recipientsPayload, values, data, response;
214
+ var now, recipientsPayload, values, data, response, errors;
215
215
  return __generator(this, function (_a) {
216
216
  switch (_a.label) {
217
217
  case 0:
@@ -242,6 +242,8 @@ test("Can create multiple stremas", function () { return __awaiter(void 0, void
242
242
  return [4 /*yield*/, (streamInstance === null || streamInstance === void 0 ? void 0 : streamInstance.createMultiple(data))];
243
243
  case 1:
244
244
  response = _a.sent();
245
+ errors = response === null || response === void 0 ? void 0 : response.errors;
246
+ console.log(errors);
245
247
  return [2 /*return*/, response];
246
248
  }
247
249
  });
package/dist/types.d.ts CHANGED
@@ -85,7 +85,7 @@ export interface WithdrawStreamParams extends WithdrawStreamData {
85
85
  cluster?: ClusterExtended;
86
86
  }
87
87
  export interface WithdrawParams extends WithdrawStreamData {
88
- invoker: Wallet;
88
+ invoker: Wallet | Keypair;
89
89
  }
90
90
  export interface TopupStreamData {
91
91
  id: string;
@@ -97,7 +97,7 @@ export interface TopupStreamParams extends TopupStreamData {
97
97
  cluster?: ClusterExtended;
98
98
  }
99
99
  export interface TopupParams extends TopupStreamData {
100
- invoker: Wallet;
100
+ invoker: Wallet | Keypair;
101
101
  }
102
102
  export interface CancelStreamData {
103
103
  id: string;
@@ -108,7 +108,7 @@ export interface CancelStreamParams extends CancelStreamData {
108
108
  cluster?: ClusterExtended;
109
109
  }
110
110
  export interface CancelParams extends CancelStreamData {
111
- invoker: Wallet;
111
+ invoker: Wallet | Keypair;
112
112
  }
113
113
  export interface TransferStreamData {
114
114
  id: string;
@@ -120,7 +120,7 @@ export interface TransferStreamParams extends TransferStreamData {
120
120
  cluster?: ClusterExtended;
121
121
  }
122
122
  export interface TransferParams extends TransferStreamData {
123
- invoker: Wallet;
123
+ invoker: Wallet | Keypair;
124
124
  }
125
125
  export interface GetStreamParams {
126
126
  connection: Connection;
@@ -176,6 +176,49 @@ export interface Stream {
176
176
  canTopup: boolean;
177
177
  name: string;
178
178
  withdrawalFrequency: number;
179
+ unlocked(currentTimestamp: number, decimals: number): number;
180
+ }
181
+ export declare class Contract implements Stream {
182
+ magic: number;
183
+ version: number;
184
+ createdAt: number;
185
+ withdrawnAmount: BN;
186
+ canceledAt: number;
187
+ end: number;
188
+ lastWithdrawnAt: number;
189
+ sender: string;
190
+ senderTokens: string;
191
+ recipient: string;
192
+ recipientTokens: string;
193
+ mint: string;
194
+ escrowTokens: string;
195
+ streamflowTreasury: string;
196
+ streamflowTreasuryTokens: string;
197
+ streamflowFeeTotal: BN;
198
+ streamflowFeeWithdrawn: BN;
199
+ streamflowFeePercent: number;
200
+ partnerFeeTotal: BN;
201
+ partnerFeeWithdrawn: BN;
202
+ partnerFeePercent: number;
203
+ partner: string;
204
+ partnerTokens: string;
205
+ start: number;
206
+ depositedAmount: BN;
207
+ period: number;
208
+ amountPerPeriod: BN;
209
+ cliff: number;
210
+ cliffAmount: BN;
211
+ cancelableBySender: boolean;
212
+ cancelableByRecipient: boolean;
213
+ automaticWithdrawal: boolean;
214
+ transferableBySender: boolean;
215
+ transferableByRecipient: boolean;
216
+ canTopup: boolean;
217
+ name: string;
218
+ withdrawalFrequency: number;
219
+ constructor(stream: DecodedStream);
220
+ unlocked(currentTimestamp: number, decimals: number): number;
221
+ remaining(decimals: number): number;
179
222
  }
180
223
  export interface DecodedStream {
181
224
  magic: BN;
package/dist/types.js CHANGED
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TransferCancelOptions = exports.LocalCluster = exports.StreamType = exports.StreamDirection = exports.Cluster = void 0;
6
+ exports.TransferCancelOptions = exports.Contract = exports.LocalCluster = exports.StreamType = exports.StreamDirection = exports.Cluster = void 0;
7
+ var bn_js_1 = __importDefault(require("bn.js"));
8
+ var utils_1 = require("./utils");
4
9
  var wallet_adapter_base_1 = require("@solana/wallet-adapter-base");
5
10
  Object.defineProperty(exports, "Cluster", { enumerable: true, get: function () { return wallet_adapter_base_1.WalletAdapterNetwork; } });
6
11
  var StreamDirection;
@@ -19,6 +24,64 @@ var LocalCluster;
19
24
  (function (LocalCluster) {
20
25
  LocalCluster["Local"] = "local";
21
26
  })(LocalCluster = exports.LocalCluster || (exports.LocalCluster = {}));
27
+ var Contract = /** @class */ (function () {
28
+ function Contract(stream) {
29
+ var _a;
30
+ this.magic = stream.magic.toNumber();
31
+ this.version = stream.version.toNumber();
32
+ this.createdAt = stream.createdAt.toNumber();
33
+ this.withdrawnAmount = stream.withdrawnAmount;
34
+ this.canceledAt = stream.canceledAt.toNumber();
35
+ this.end = stream.end.toNumber();
36
+ this.lastWithdrawnAt = stream.lastWithdrawnAt.toNumber();
37
+ this.sender = stream.sender.toBase58();
38
+ this.senderTokens = stream.senderTokens.toBase58();
39
+ this.recipient = stream.recipient.toBase58();
40
+ this.recipientTokens = stream.recipientTokens.toBase58();
41
+ this.mint = stream.mint.toBase58();
42
+ this.escrowTokens = stream.escrowTokens.toBase58();
43
+ this.streamflowTreasury = stream.streamflowTreasury.toBase58();
44
+ this.streamflowTreasuryTokens =
45
+ stream.streamflowTreasuryTokens.toBase58();
46
+ this.streamflowFeeTotal = stream.streamflowFeeTotal;
47
+ this.streamflowFeeWithdrawn = stream.streamflowFeeWithdrawn;
48
+ this.streamflowFeePercent = stream.streamflowFeePercent.toNumber();
49
+ this.partnerFeeTotal = stream.partnerFeeTotal;
50
+ this.partnerFeeWithdrawn = stream.partnerFeeWithdrawn;
51
+ this.partnerFeePercent = stream.partnerFeePercent.toNumber();
52
+ this.partner = stream.partner.toBase58();
53
+ this.partnerTokens = (_a = stream.partnerTokens) === null || _a === void 0 ? void 0 : _a.toBase58();
54
+ this.start = stream.start.toNumber();
55
+ this.depositedAmount = stream.depositedAmount;
56
+ this.period = stream.period.toNumber();
57
+ this.amountPerPeriod = stream.amountPerPeriod;
58
+ this.cliff = stream.cliff.toNumber();
59
+ this.cliffAmount = stream.cliffAmount;
60
+ this.cancelableBySender = stream.cancelableBySender;
61
+ this.cancelableByRecipient = stream.cancelableByRecipient;
62
+ this.automaticWithdrawal = stream.automaticWithdrawal;
63
+ this.transferableBySender = stream.transferableBySender;
64
+ this.transferableByRecipient = stream.transferableByRecipient;
65
+ this.canTopup = stream.canTopup;
66
+ this.name = stream.name;
67
+ this.withdrawalFrequency = stream.withdrawFrequency.toNumber();
68
+ }
69
+ Contract.prototype.unlocked = function (currentTimestamp, decimals) {
70
+ var deposited = (0, utils_1.getNumberFromBN)(this.depositedAmount, decimals);
71
+ if (currentTimestamp < this.cliff)
72
+ return 0;
73
+ if (currentTimestamp > this.end)
74
+ return deposited;
75
+ var streamedBN = this.cliffAmount.add(new bn_js_1.default(Math.floor((currentTimestamp - this.cliff) / this.period)).mul(this.amountPerPeriod));
76
+ var streamed = (0, utils_1.getNumberFromBN)(streamedBN, decimals);
77
+ return streamed < deposited ? streamed : deposited;
78
+ };
79
+ Contract.prototype.remaining = function (decimals) {
80
+ return (0, utils_1.getNumberFromBN)(this.depositedAmount.sub(this.withdrawnAmount), decimals);
81
+ };
82
+ return Contract;
83
+ }());
84
+ exports.Contract = Contract;
22
85
  var TransferCancelOptions;
23
86
  (function (TransferCancelOptions) {
24
87
  TransferCancelOptions["Recipient"] = "recipient";
package/dist/utils.js CHANGED
@@ -52,9 +52,11 @@ var decodeStream = function (buf) {
52
52
  };
53
53
  };
54
54
  exports.decodeStream = decodeStream;
55
+ // DeprecationWarning: This object will be deprecated starting from the version 4.0.0. Use
56
+ // types/Contract instead
55
57
  var formatDecodedStream = function (stream) {
56
58
  var _a;
57
- return ({
59
+ var resp = {
58
60
  magic: stream.magic.toNumber(),
59
61
  version: stream.version.toNumber(),
60
62
  createdAt: stream.createdAt.toNumber(),
@@ -92,7 +94,10 @@ var formatDecodedStream = function (stream) {
92
94
  canTopup: stream.canTopup,
93
95
  name: stream.name,
94
96
  withdrawalFrequency: stream.withdrawFrequency.toNumber(),
95
- });
97
+ unlocked: function () { return 0; },
98
+ withdrawn: function () { return new bn_js_1.default(0); } //phantom method to preserve partial support of this object
99
+ };
100
+ return resp;
96
101
  };
97
102
  exports.formatDecodedStream = formatDecodedStream;
98
103
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/stream",
3
- "version": "3.0.3-test.0",
3
+ "version": "3.0.5",
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/",
@@ -20,7 +20,7 @@
20
20
  "@project-serum/common": "^0.0.1-beta.3",
21
21
  "@solana/spl-token": "^0.1.8",
22
22
  "@solana/wallet-adapter-base": "^0.9.2",
23
- "@solana/web3.js": "^1.29.2",
23
+ "@solana/web3.js": "^1.42.0",
24
24
  "bn.js": "^5.2.0",
25
25
  "buffer-layout": "^1.2.1"
26
26
  }