@streamflow/stream 7.1.0 → 7.1.1

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.
@@ -29,6 +29,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
30
  exports.SolanaStreamClient = void 0;
31
31
  const bn_js_1 = __importDefault(require("bn.js"));
32
+ const bs58_1 = __importDefault(require("bs58"));
32
33
  const buffer_1 = require("buffer");
33
34
  const spl_token_1 = require("@solana/spl-token");
34
35
  const web3_js_1 = require("@solana/web3.js");
@@ -872,14 +873,17 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
872
873
  async searchStreams(data) {
873
874
  const filters = Object.entries(data)
874
875
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
875
- .filter(([_, value]) => value) // Only keep entries where the value is truthy
876
+ .filter(([_, value]) => value !== undefined) // Only keep entries where the value is truthy
876
877
  .map(([key, value]) => ({
877
878
  memcmp: {
878
879
  offset: constants_js_1.STREAM_STRUCT_OFFSETS[key],
879
- bytes: value,
880
+ bytes: typeof value === "boolean" ? bs58_1.default.encode([Number(value)]) : value.toString(),
880
881
  },
881
882
  }));
882
- const accounts = await this.connection.getProgramAccounts(this.programId, { filters });
883
+ filters.push({ dataSize: METADATA_ACC_SIZE });
884
+ const accounts = await this.connection.getProgramAccounts(this.programId, {
885
+ filters,
886
+ });
883
887
  return accounts.map(({ pubkey, account }) => ({
884
888
  publicKey: pubkey,
885
889
  account: new types_js_1.Contract((0, utils_js_1.decodeStream)(account.data)),
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SOLANA_ERROR_MAP = exports.SOLANA_ERROR_MATCH_REGEX = exports.PARTNERS_SCHEMA = exports.PARTNER_SCHEMA = exports.AIRDROP_AMOUNT = exports.DEFAULT_STREAMFLOW_FEE = exports.FEES_METADATA_SEED = exports.AIRDROP_TEST_TOKEN = exports.FEE_ORACLE_PUBLIC_KEY = exports.WITHDRAWOR_PUBLIC_KEY = exports.STREAMFLOW_TREASURY_PUBLIC_KEY = exports.PARTNER_ORACLE_PROGRAM_ID = exports.TEST_ORACLE_SEED = exports.ESCROW_SEED = exports.CONTRACT_SEED = exports.TEST_ORACLE_DISCRIMINATOR = exports.CONTRACT_DISCRIMINATOR = exports.ALIGNED_COMPUTE_LIMIT = exports.ALIGNED_UNLOCKS_PROGRAM_ID = exports.PROGRAM_ID = exports.CREATE_PARAMS_PADDING = exports.STREAM_STRUCT_OFFSETS = exports.ALIGNED_PRECISION_FACTOR_POW = exports.STREAM_STRUCT_OFFSET_MINT = exports.STREAM_STRUCT_OFFSET_RECIPIENT = exports.STREAM_STRUCT_OFFSET_SENDER = exports.ORIGINAL_CONTRACT_SENDER_OFFSET = exports.TX_FINALITY_CONFIRMED = void 0;
3
+ exports.SOLANA_ERROR_MAP = exports.SOLANA_ERROR_MATCH_REGEX = exports.PARTNERS_SCHEMA = exports.PARTNER_SCHEMA = exports.AIRDROP_AMOUNT = exports.DEFAULT_STREAMFLOW_FEE = exports.FEES_METADATA_SEED = exports.AIRDROP_TEST_TOKEN = exports.FEE_ORACLE_PUBLIC_KEY = exports.WITHDRAWOR_PUBLIC_KEY = exports.STREAMFLOW_TREASURY_PUBLIC_KEY = exports.PARTNER_ORACLE_PROGRAM_ID = exports.TEST_ORACLE_SEED = exports.ESCROW_SEED = exports.CONTRACT_SEED = exports.TEST_ORACLE_DISCRIMINATOR = exports.CONTRACT_DISCRIMINATOR = exports.ALIGNED_COMPUTE_LIMIT = exports.ALIGNED_UNLOCKS_PROGRAM_ID = exports.PROGRAM_ID = exports.CREATE_PARAMS_PADDING = exports.STREAM_STRUCT_OFFSETS = exports.ALIGNED_PRECISION_FACTOR_POW = exports.STREAM_STRUCT_OFFSET_CLOSED = exports.STREAM_STRUCT_OFFSET_MINT = exports.STREAM_STRUCT_OFFSET_RECIPIENT = exports.STREAM_STRUCT_OFFSET_SENDER = exports.ORIGINAL_CONTRACT_SENDER_OFFSET = exports.TX_FINALITY_CONFIRMED = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
5
  const buffer_1 = require("buffer");
6
6
  const types_js_1 = require("../common/types.js");
@@ -9,11 +9,13 @@ exports.ORIGINAL_CONTRACT_SENDER_OFFSET = 9;
9
9
  exports.STREAM_STRUCT_OFFSET_SENDER = 49;
10
10
  exports.STREAM_STRUCT_OFFSET_RECIPIENT = 113;
11
11
  exports.STREAM_STRUCT_OFFSET_MINT = 177;
12
+ exports.STREAM_STRUCT_OFFSET_CLOSED = 671;
12
13
  exports.ALIGNED_PRECISION_FACTOR_POW = 9;
13
14
  exports.STREAM_STRUCT_OFFSETS = {
14
15
  mint: exports.STREAM_STRUCT_OFFSET_MINT,
15
16
  recipient: exports.STREAM_STRUCT_OFFSET_RECIPIENT,
16
17
  sender: exports.STREAM_STRUCT_OFFSET_SENDER,
18
+ closed: exports.STREAM_STRUCT_OFFSET_CLOSED,
17
19
  };
18
20
  // Defined: https://github.com/streamflow-finance/protocol/blob/main/programs/protocol/src/state.rs#L25
19
21
  exports.CREATE_PARAMS_PADDING = 126;
@@ -1,5 +1,6 @@
1
1
  // Latest version of the SDK that does not use Anchor. It supports raw instructions.
2
2
  import BN from "bn.js";
3
+ import bs58 from "bs58";
3
4
  import { Buffer } from "buffer";
4
5
  import { ASSOCIATED_TOKEN_PROGRAM_ID, NATIVE_MINT } from "@solana/spl-token";
5
6
  import { Connection, Keypair, PublicKey, SystemProgram, SYSVAR_RENT_PUBKEY, TransactionMessage, VersionedTransaction, } from "@solana/web3.js";
@@ -848,14 +849,17 @@ export class SolanaStreamClient extends BaseStreamClient {
848
849
  async searchStreams(data) {
849
850
  const filters = Object.entries(data)
850
851
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
851
- .filter(([_, value]) => value) // Only keep entries where the value is truthy
852
+ .filter(([_, value]) => value !== undefined) // Only keep entries where the value is truthy
852
853
  .map(([key, value]) => ({
853
854
  memcmp: {
854
855
  offset: STREAM_STRUCT_OFFSETS[key],
855
- bytes: value,
856
+ bytes: typeof value === "boolean" ? bs58.encode([Number(value)]) : value.toString(),
856
857
  },
857
858
  }));
858
- const accounts = await this.connection.getProgramAccounts(this.programId, { filters });
859
+ filters.push({ dataSize: METADATA_ACC_SIZE });
860
+ const accounts = await this.connection.getProgramAccounts(this.programId, {
861
+ filters,
862
+ });
859
863
  return accounts.map(({ pubkey, account }) => ({
860
864
  publicKey: pubkey,
861
865
  account: new Contract(decodeStream(account.data)),
@@ -6,6 +6,7 @@ export declare const ORIGINAL_CONTRACT_SENDER_OFFSET = 9;
6
6
  export declare const STREAM_STRUCT_OFFSET_SENDER = 49;
7
7
  export declare const STREAM_STRUCT_OFFSET_RECIPIENT = 113;
8
8
  export declare const STREAM_STRUCT_OFFSET_MINT = 177;
9
+ export declare const STREAM_STRUCT_OFFSET_CLOSED = 671;
9
10
  export declare const ALIGNED_PRECISION_FACTOR_POW = 9;
10
11
  export declare const STREAM_STRUCT_OFFSETS: Record<keyof ISearchStreams, number>;
11
12
  export declare const CREATE_PARAMS_PADDING = 126;
@@ -6,11 +6,13 @@ export const ORIGINAL_CONTRACT_SENDER_OFFSET = 9;
6
6
  export const STREAM_STRUCT_OFFSET_SENDER = 49;
7
7
  export const STREAM_STRUCT_OFFSET_RECIPIENT = 113;
8
8
  export const STREAM_STRUCT_OFFSET_MINT = 177;
9
+ export const STREAM_STRUCT_OFFSET_CLOSED = 671;
9
10
  export const ALIGNED_PRECISION_FACTOR_POW = 9;
10
11
  export const STREAM_STRUCT_OFFSETS = {
11
12
  mint: STREAM_STRUCT_OFFSET_MINT,
12
13
  recipient: STREAM_STRUCT_OFFSET_RECIPIENT,
13
14
  sender: STREAM_STRUCT_OFFSET_SENDER,
15
+ closed: STREAM_STRUCT_OFFSET_CLOSED,
14
16
  };
15
17
  // Defined: https://github.com/streamflow-finance/protocol/blob/main/programs/protocol/src/state.rs#L25
16
18
  export const CREATE_PARAMS_PADDING = 126;
@@ -18,6 +18,7 @@ export interface ISearchStreams {
18
18
  mint?: string;
19
19
  sender?: string;
20
20
  recipient?: string;
21
+ closed?: boolean;
21
22
  }
22
23
  export interface Account {
23
24
  pubkey: PublicKey;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/stream",
3
- "version": "7.1.0",
3
+ "version": "7.1.1",
4
4
  "description": "JavaScript SDK to interact with Streamflow protocol.",
5
5
  "homepage": "https://github.com/streamflow-finance/js-sdk/",
6
6
  "main": "./dist/esm/index.js",
@@ -42,9 +42,9 @@
42
42
  "lint": "eslint --fix .",
43
43
  "prepublishOnly": "pnpm run lint && pnpm run test run && pnpm run build"
44
44
  },
45
- "gitHead": "43138796876f19398e3fbae5173c901cd7b5a580",
45
+ "gitHead": "6828e48741b4abf46f4a8aae9d9512b4cb587e84",
46
46
  "devDependencies": {
47
- "@streamflow/eslint-config": "7.1.0",
47
+ "@streamflow/eslint-config": "7.1.1",
48
48
  "@types/bn.js": "5.1.1",
49
49
  "@types/ethereum-checksum-address": "^0.0.0",
50
50
  "date-fns": "2.28.0",
@@ -59,7 +59,7 @@
59
59
  "@solana/spl-token": "0.4.9",
60
60
  "@solana/wallet-adapter-base": "0.9.19",
61
61
  "@solana/web3.js": "1.95.4",
62
- "@streamflow/common": "7.1.0",
62
+ "@streamflow/common": "7.1.1",
63
63
  "@suiet/wallet-kit": "0.2.22",
64
64
  "aptos": "1.21.0",
65
65
  "bn.js": "5.2.1",