@streamflow/stream 3.0.5 → 3.0.8

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.
@@ -627,10 +627,10 @@ var StreamClient = /** @class */ (function () {
627
627
  case 0:
628
628
  accounts = [];
629
629
  if (!(direction === "all")) return [3 /*break*/, 3];
630
- return [4 /*yield*/, getProgramAccounts(this.connection, wallet, constants_1.STREAM_STRUCT_OFFSET_SENDER, this.cluster)];
630
+ return [4 /*yield*/, getProgramAccounts(this.connection, wallet, constants_1.STREAM_STRUCT_OFFSET_SENDER, this.programId)];
631
631
  case 1:
632
632
  outgoingAccounts = _d.sent();
633
- return [4 /*yield*/, getProgramAccounts(this.connection, wallet, constants_1.STREAM_STRUCT_OFFSET_RECIPIENT, this.cluster)];
633
+ return [4 /*yield*/, getProgramAccounts(this.connection, wallet, constants_1.STREAM_STRUCT_OFFSET_RECIPIENT, this.programId)];
634
634
  case 2:
635
635
  incomingAccounts = _d.sent();
636
636
  accounts = __spreadArray(__spreadArray([], __read(outgoingAccounts), false), __read(incomingAccounts), false);
@@ -639,7 +639,7 @@ var StreamClient = /** @class */ (function () {
639
639
  offset = direction === "outgoing"
640
640
  ? constants_1.STREAM_STRUCT_OFFSET_SENDER
641
641
  : constants_1.STREAM_STRUCT_OFFSET_RECIPIENT;
642
- return [4 /*yield*/, getProgramAccounts(this.connection, wallet, offset, this.cluster)];
642
+ return [4 /*yield*/, getProgramAccounts(this.connection, wallet, offset, this.programId)];
643
643
  case 4:
644
644
  accounts = _d.sent();
645
645
  _d.label = 5;
@@ -779,11 +779,10 @@ var StreamClient = /** @class */ (function () {
779
779
  return StreamClient;
780
780
  }());
781
781
  exports.default = StreamClient;
782
- function getProgramAccounts(connection, wallet, offset, cluster) {
783
- if (cluster === void 0) { cluster = types_1.Cluster.Mainnet; }
782
+ function getProgramAccounts(connection, wallet, offset, programId) {
784
783
  return __awaiter(this, void 0, void 0, function () {
785
784
  return __generator(this, function (_a) {
786
- return [2 /*return*/, connection === null || connection === void 0 ? void 0 : connection.getProgramAccounts(new web3_js_1.PublicKey(constants_1.PROGRAM_ID[cluster]), {
785
+ return [2 /*return*/, connection === null || connection === void 0 ? void 0 : connection.getProgramAccounts(programId, {
787
786
  filters: [
788
787
  {
789
788
  memcmp: {
@@ -85,6 +85,7 @@ var createStreamInstruction = function (data, programId, accounts) {
85
85
  bufferData = buffer_1.Buffer.concat([
86
86
  buffer_1.Buffer.from(js_sha256_1.sha256.digest("global:create")).slice(0, 8),
87
87
  bufferData,
88
+ buffer_1.Buffer.alloc(10)
88
89
  ]);
89
90
  return new web3_js_1.TransactionInstruction({
90
91
  keys: keys,
@@ -119,6 +120,7 @@ var withdrawStreamInstruction = function (amount, programId, _a) {
119
120
  data = buffer_1.Buffer.concat([
120
121
  buffer_1.Buffer.from(js_sha256_1.sha256.digest("global:withdraw")).slice(0, 8),
121
122
  data,
123
+ buffer_1.Buffer.alloc(10)
122
124
  ]);
123
125
  return new web3_js_1.TransactionInstruction({
124
126
  keys: keys,
@@ -148,7 +150,10 @@ var cancelStreamInstruction = function (programId, _a) {
148
150
  { pubkey: mint, isSigner: false, isWritable: false },
149
151
  { pubkey: tokenProgram, isSigner: false, isWritable: false },
150
152
  ];
151
- var data = buffer_1.Buffer.from(js_sha256_1.sha256.digest("global:cancel")).slice(0, 8);
153
+ var data = buffer_1.Buffer.concat([
154
+ buffer_1.Buffer.from(js_sha256_1.sha256.digest("global:cancel")).slice(0, 8),
155
+ buffer_1.Buffer.alloc(10),
156
+ ]);
152
157
  return new web3_js_1.TransactionInstruction({
153
158
  keys: keys,
154
159
  programId: programId,
@@ -169,7 +174,10 @@ var transferStreamInstruction = function (programId, _a) {
169
174
  { pubkey: associatedTokenProgram, isSigner: false, isWritable: false },
170
175
  { pubkey: systemProgram, isSigner: false, isWritable: false },
171
176
  ];
172
- var data = buffer_1.Buffer.from(js_sha256_1.sha256.digest("global:transfer_recipient")).slice(0, 8);
177
+ var data = buffer_1.Buffer.concat([
178
+ buffer_1.Buffer.from(js_sha256_1.sha256.digest("global:transfer_recipient")).slice(0, 8),
179
+ buffer_1.Buffer.alloc(10),
180
+ ]);
173
181
  return new web3_js_1.TransactionInstruction({
174
182
  keys: keys,
175
183
  programId: programId,
@@ -204,6 +212,7 @@ var topupStreamInstruction = function (amount, programId, _a) {
204
212
  data = buffer_1.Buffer.concat([
205
213
  buffer_1.Buffer.from(js_sha256_1.sha256.digest("global:topup")).slice(0, 8),
206
214
  data,
215
+ buffer_1.Buffer.alloc(10)
207
216
  ]);
208
217
  return new web3_js_1.TransactionInstruction({
209
218
  keys: keys,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/stream",
3
- "version": "3.0.5",
3
+ "version": "3.0.8",
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/",