@zebec-network/zebec-stream-sdk 3.3.1 → 3.3.3

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.
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.ZebecStreamService = void 0;
7
4
  const anchor_1 = require("@coral-xyz/anchor");
@@ -12,7 +9,6 @@ const spl_token_1 = require("@solana/spl-token");
12
9
  const web3_js_1 = require("@solana/web3.js");
13
10
  const core_utils_1 = require("@zebec-network/core-utils");
14
11
  const solana_common_1 = require("@zebec-network/solana-common");
15
- const assert_1 = __importDefault(require("assert"));
16
12
  const bignumber_js_1 = require("bignumber.js");
17
13
  const artifacts_1 = require("../artifacts");
18
14
  const constants_1 = require("../constants");
@@ -104,7 +100,9 @@ class ZebecStreamService {
104
100
  .instruction();
105
101
  }
106
102
  async getCreateStreamInstruction(streamConfig, feePayer, receiver, senderAta, streamToken, withdrawAccount, sender, streamMetadata, streamData) {
107
- (0, assert_1.default)(streamData.streamName.length === constants_1.STREAM_NAME_BUFFER_SIZE, `Stream name buffer must be of size ${constants_1.STREAM_NAME_BUFFER_SIZE}`);
103
+ if (streamData.streamName.length !== constants_1.STREAM_NAME_BUFFER_SIZE) {
104
+ throw new Error(`Stream name buffer must be of size ${constants_1.STREAM_NAME_BUFFER_SIZE}`);
105
+ }
108
106
  return this.program.methods
109
107
  .createStream({
110
108
  amount: streamData.amount,
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { PublicKey } from "@solana/web3.js";
2
+ import BigNumber from "bignumber.js";
2
3
  import type { FeeTier, RpcNetwork, StreamFeeInfo } from "./types";
3
4
  export declare function getFeeInfoForStream(streamToken: PublicKey, parsedStreamTokenAmount: BigNumber.Value, streamTokenDecimals: number, network: RpcNetwork): Promise<StreamFeeInfo>;
4
5
  export declare function getFeeRateForUsdAmount(amount: BigNumber.Value, feeTiers: FeeTier[]): string;
package/dist/utils.js CHANGED
@@ -1,15 +1,18 @@
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
6
  exports.getFeeInfoForStream = getFeeInfoForStream;
4
7
  exports.getFeeRateForUsdAmount = getFeeRateForUsdAmount;
5
8
  const core_utils_1 = require("@zebec-network/core-utils");
6
- const bignumber_js_1 = require("bignumber.js");
9
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
7
10
  const constants_1 = require("./constants");
8
11
  async function getFeeInfoForStream(streamToken, parsedStreamTokenAmount, streamTokenDecimals, network) {
9
12
  const urlsParams = new URLSearchParams({
10
13
  mintAddress: streamToken.toBase58(),
11
14
  chain: "SOLANA",
12
- amount: (0, bignumber_js_1.BigNumber)(parsedStreamTokenAmount).toFixed(0),
15
+ amount: (0, bignumber_js_1.default)(parsedStreamTokenAmount).toFixed(0),
13
16
  decimals: streamTokenDecimals.toString(),
14
17
  });
15
18
  const url = `${constants_1.SUPERAPP_BACKEND_URL[network]}/l1-stream/fees/stream-quote?${urlsParams}`;
@@ -25,9 +28,9 @@ async function getFeeInfoForStream(streamToken, parsedStreamTokenAmount, streamT
25
28
  return data;
26
29
  }
27
30
  function getFeeRateForUsdAmount(amount, feeTiers) {
28
- feeTiers.sort((a, b) => (0, bignumber_js_1.BigNumber)(a.minThreshold).comparedTo((0, bignumber_js_1.BigNumber)(b.minThreshold)) ?? 0);
29
- const tier = feeTiers.find((tier) => (0, bignumber_js_1.BigNumber)(amount).gte(tier.minThreshold) &&
30
- (0, bignumber_js_1.BigNumber)(amount).lt(tier.maxThreshold));
31
+ feeTiers.sort((a, b) => (0, bignumber_js_1.default)(a.minThreshold).comparedTo((0, bignumber_js_1.default)(b.minThreshold)) ?? 0);
32
+ const tier = feeTiers.find((tier) => (0, bignumber_js_1.default)(amount).gte(tier.minThreshold) &&
33
+ (0, bignumber_js_1.default)(amount).lt(tier.maxThreshold));
31
34
  if (!tier) {
32
35
  throw new Error(`No fee tier found for amount: ${amount}`);
33
36
  }
package/package.json CHANGED
@@ -3,26 +3,26 @@
3
3
  "dependencies": {
4
4
  "@coral-xyz/anchor": "^0.31.1",
5
5
  "@metaplex-foundation/mpl-token-metadata": "^3.4.0",
6
- "@metaplex-foundation/umi": "^1.4.1",
7
- "@metaplex-foundation/umi-bundle-defaults": "^1.4.1",
8
- "@metaplex-foundation/umi-web3js-adapters": "^1.4.1",
6
+ "@metaplex-foundation/umi": "^1.5.1",
7
+ "@metaplex-foundation/umi-bundle-defaults": "^1.5.1",
8
+ "@metaplex-foundation/umi-web3js-adapters": "^1.5.1",
9
9
  "@solana/spl-token": "^0.4.14",
10
10
  "@solana/web3.js": "^1.98.2",
11
- "@zebec-network/core-utils": "^1.1.1",
12
- "@zebec-network/solana-common": "^2.3.1",
13
- "bignumber.js": "^9.3.1"
11
+ "@zebec-network/core-utils": "^1.3.0",
12
+ "@zebec-network/solana-common": "^2.6.0",
13
+ "bignumber.js": "^11.1.1"
14
14
  },
15
15
  "description": "This is an SDK for interacting with ZEBEC Stream Program in solana",
16
16
  "devDependencies": {
17
17
  "@types/bn.js": "^5.2.0",
18
18
  "@types/mocha": "^10.0.10",
19
- "@types/node": "^24.3.1",
20
- "dotenv": "^17.2.3",
19
+ "@types/node": "^25.7.0",
20
+ "dotenv": "^17.4.2",
21
21
  "mocha": "^11.7.5",
22
- "rimraf": "^6.1.2",
22
+ "rimraf": "^6.1.3",
23
23
  "ts-mocha": "^11.1.0",
24
24
  "ts-node": "^10.9.2",
25
- "typescript": "^5.9.2"
25
+ "typescript": "^6.0.3"
26
26
  },
27
27
  "files": [
28
28
  "dist"
@@ -34,10 +34,10 @@
34
34
  "build": "npm run clean && tsc",
35
35
  "clean": "rimraf ./dist",
36
36
  "format": "npx @biomejs/biome format --write",
37
- "start": "ts-node src/index.ts",
37
+ "prepare": "npm run format && npm run build",
38
38
  "test": "ts-mocha -p ./tsconfig.json -t 1000000000 test/**/*.test.ts",
39
39
  "test:single": "ts-mocha -p ./tsconfig.json -t 1000000000"
40
40
  },
41
41
  "types": "dist/index.d.ts",
42
- "version": "3.3.1"
42
+ "version": "3.3.3"
43
43
  }