@streamflow/stream 4.1.0-beta.3 → 4.1.0-beta.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.
@@ -22,7 +22,7 @@ export interface AptosStreamClientOptions {
22
22
  maxGas?: string;
23
23
  }
24
24
  export interface EvmStreamClientOptions {
25
- chain: IChain.Etherium | IChain.BNB | IChain.Polygon;
25
+ chain: IChain.Ethereum | IChain.BNB | IChain.Polygon;
26
26
  clusterUrl: string;
27
27
  signer: Signer;
28
28
  cluster?: ICluster;
@@ -36,7 +36,7 @@ var GenericStreamClient = /** @class */ (function (_super) {
36
36
  _this.nativeStreamClient = new StreamClient_2.default(options.clusterUrl, options.cluster, options.maxGas, options.programId);
37
37
  break;
38
38
  case types_1.IChain.BNB:
39
- case types_1.IChain.Etherium:
39
+ case types_1.IChain.Ethereum:
40
40
  case types_1.IChain.Polygon:
41
41
  _this.nativeStreamClient = new evm_1.EvmStreamClient(options.clusterUrl, options.chain, options.signer, options.cluster, options.programId);
42
42
  break;
@@ -94,7 +94,7 @@ export declare enum StreamType {
94
94
  export declare enum IChain {
95
95
  Solana = "Solana",
96
96
  Aptos = "Aptos",
97
- Etherium = "Etherium",
97
+ Ethereum = "Ethereum",
98
98
  BNB = "BNB",
99
99
  Polygon = "Polygon"
100
100
  }
@@ -25,7 +25,7 @@ var IChain;
25
25
  (function (IChain) {
26
26
  IChain["Solana"] = "Solana";
27
27
  IChain["Aptos"] = "Aptos";
28
- IChain["Etherium"] = "Etherium";
28
+ IChain["Ethereum"] = "Ethereum";
29
29
  IChain["BNB"] = "BNB";
30
30
  IChain["Polygon"] = "Polygon";
31
31
  })(IChain = exports.IChain || (exports.IChain = {}));
@@ -105,16 +105,16 @@ var EvmStreamClient = /** @class */ (function (_super) {
105
105
  function EvmStreamClient(clusterUrl, chain, signer, cluster, programId) {
106
106
  if (cluster === void 0) { cluster = types_1.ICluster.Mainnet; }
107
107
  var _this = _super.call(this) || this;
108
- if (chain !== types_1.IChain.Etherium && chain !== types_1.IChain.BNB && chain !== types_1.IChain.Polygon) {
109
- throw new Error("Wrong chain. Supported chains are Etherium , BNB and Polygon!");
108
+ if (chain !== types_1.IChain.Ethereum && chain !== types_1.IChain.BNB && chain !== types_1.IChain.Polygon) {
109
+ throw new Error("Wrong chain. Supported chains are Ethereum , BNB and Polygon!");
110
110
  }
111
111
  if (programId) {
112
112
  _this.programId = programId;
113
113
  }
114
114
  else {
115
115
  switch (chain) {
116
- case types_1.IChain.Etherium:
117
- _this.programId = constants_1.ETHERIUM_PROGRAM_IDS[cluster];
116
+ case types_1.IChain.Ethereum:
117
+ _this.programId = constants_1.ETHEREUM_PROGRAM_IDS[cluster];
118
118
  break;
119
119
  case types_1.IChain.BNB:
120
120
  _this.programId = constants_1.BNB_PROGRAM_IDS[cluster];
@@ -133,7 +133,7 @@ var EvmStreamClient = /** @class */ (function (_super) {
133
133
  }
134
134
  EvmStreamClient.prototype.create = function (streamData) {
135
135
  return __awaiter(this, void 0, void 0, function () {
136
- var multiParams, fees, args, sum, tokenContract, approvalTx, result, confirmedTx, metadataId;
136
+ var multiParams, fees, args, result, confirmedTx, metadataId;
137
137
  var _a, _b;
138
138
  return __generator(this, function (_c) {
139
139
  switch (_c.label) {
@@ -145,19 +145,11 @@ var EvmStreamClient = /** @class */ (function (_super) {
145
145
  return [4 /*yield*/, this.generateMultiPayloads(multiParams)];
146
146
  case 2:
147
147
  args = (_c.sent())[0];
148
- sum = streamData.amount.mul(new bn_js_1.BN(constants_2.BASE_FEE)).div(new bn_js_1.BN(1000000));
149
- tokenContract = new ethers_1.ethers.Contract(streamData.tokenId, ercAbi_1.default, this.signer);
150
- return [4 /*yield*/, tokenContract.approve(this.programId, sum.toString())];
151
- case 3:
152
- approvalTx = _c.sent();
153
- return [4 /*yield*/, approvalTx.wait()];
154
- case 4:
155
- _c.sent();
156
148
  return [4 /*yield*/, (_b = this.writeContract).create.apply(_b, __spreadArray(__spreadArray([], __read(args), false), [{ value: fees.value }], false))];
157
- case 5:
149
+ case 3:
158
150
  result = _c.sent();
159
151
  return [4 /*yield*/, result.wait()];
160
- case 6:
152
+ case 4:
161
153
  confirmedTx = _c.sent();
162
154
  metadataId = this.formatMetadataId(confirmedTx.logs[confirmedTx.logs.length - 1].data);
163
155
  return [2 /*return*/, {
@@ -432,7 +424,7 @@ var EvmStreamClient = /** @class */ (function (_super) {
432
424
  ];
433
425
  };
434
426
  EvmStreamClient.prototype.formatMetadataId = function (id) {
435
- // 40 chars is etherium address size
427
+ // 40 chars is ethereum address size
436
428
  return (0, ethereum_checksum_address_1.toChecksumAddress)("0x".concat(id.slice(-40)));
437
429
  };
438
430
  return EvmStreamClient;
@@ -1,4 +1,4 @@
1
1
  import { ICluster } from "../common/types";
2
- export declare const ETHERIUM_PROGRAM_IDS: Record<ICluster, string>;
2
+ export declare const ETHEREUM_PROGRAM_IDS: Record<ICluster, string>;
3
3
  export declare const BNB_PROGRAM_IDS: Record<ICluster, string>;
4
4
  export declare const POLYGON_PROGRAM_IDS: Record<ICluster, string>;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  var _a, _b, _c;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.POLYGON_PROGRAM_IDS = exports.BNB_PROGRAM_IDS = exports.ETHERIUM_PROGRAM_IDS = void 0;
4
+ exports.POLYGON_PROGRAM_IDS = exports.BNB_PROGRAM_IDS = exports.ETHEREUM_PROGRAM_IDS = void 0;
5
5
  var types_1 = require("../common/types");
6
- exports.ETHERIUM_PROGRAM_IDS = (_a = {},
6
+ exports.ETHEREUM_PROGRAM_IDS = (_a = {},
7
7
  _a[types_1.ICluster.Mainnet] = "0x35fC2D13D97c13d6697Dc273fEDF93eBC92B7743",
8
8
  _a[types_1.ICluster.Devnet] = "0x35fC2D13D97c13d6697Dc273fEDF93eBC92B7743",
9
9
  _a[types_1.ICluster.Testnet] = "0x35fC2D13D97c13d6697Dc273fEDF93eBC92B7743",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/stream",
3
- "version": "4.1.0-beta.3",
3
+ "version": "4.1.0-beta.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/",