@streamflow/stream 7.0.0-alpha.2 → 7.0.0-alpha.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.
Files changed (38) hide show
  1. package/dist/cjs/__tests__/aptos/streamClient.spec.js +83 -134
  2. package/dist/cjs/__tests__/common/GenericStreamClient.spec.js +9 -9
  3. package/dist/cjs/aptos/StreamClient.js +162 -367
  4. package/dist/cjs/aptos/constants.js +7 -8
  5. package/dist/cjs/aptos/index.js +3 -3
  6. package/dist/cjs/aptos/types.js +17 -26
  7. package/dist/cjs/aptos/utils.js +4 -4
  8. package/dist/cjs/aptos/wallet.js +20 -75
  9. package/dist/cjs/common/BaseStreamClient.js +11 -59
  10. package/dist/cjs/common/GenericStreamClient.js +46 -72
  11. package/dist/cjs/common/constants.js +1 -1
  12. package/dist/cjs/common/contractUtils.js +12 -13
  13. package/dist/cjs/common/utils.js +21 -66
  14. package/dist/cjs/evm/StreamClient.js +198 -456
  15. package/dist/cjs/evm/constants.js +19 -20
  16. package/dist/cjs/evm/types.js +14 -23
  17. package/dist/cjs/evm/utils.js +2 -2
  18. package/dist/cjs/index.js +10 -10
  19. package/dist/cjs/solana/StreamClient.js +592 -1090
  20. package/dist/cjs/solana/constants.js +9 -10
  21. package/dist/cjs/solana/instructions.js +60 -65
  22. package/dist/cjs/solana/layout.js +7 -8
  23. package/dist/cjs/solana/types.js +14 -24
  24. package/dist/cjs/solana/utils.js +48 -136
  25. package/dist/cjs/sui/StreamClient.js +325 -571
  26. package/dist/cjs/sui/constants.js +19 -20
  27. package/dist/cjs/sui/types.js +17 -51
  28. package/dist/cjs/sui/utils.js +7 -7
  29. package/dist/cjs/sui/wallet.js +13 -63
  30. package/dist/esm/__tests__/aptos/streamClient.spec.js +1 -1
  31. package/dist/esm/aptos/index.d.ts +3 -3
  32. package/dist/esm/aptos/index.js +3 -3
  33. package/dist/esm/common/GenericStreamClient.d.ts +4 -4
  34. package/dist/esm/common/GenericStreamClient.js +4 -4
  35. package/dist/esm/common/types.d.ts +1 -1
  36. package/dist/esm/index.d.ts +9 -9
  37. package/dist/esm/index.js +9 -9
  38. package/package.json +4 -4
@@ -1,26 +1,25 @@
1
1
  "use strict";
2
- var _a, _b, _c;
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.EVM_ERROR_MAP = exports.EVM_ERROR_MATCH_REGEX = exports.POLYGON_PROGRAM_IDS = exports.BNB_PROGRAM_IDS = exports.ETHEREUM_PROGRAM_IDS = void 0;
5
- var types_js_1 = require("../common/types.js");
6
- exports.ETHEREUM_PROGRAM_IDS = (_a = {},
7
- _a[types_js_1.ICluster.Mainnet] = "0x94d4646Bd307Bf91CB1893BC64d976BF9E60D9B2",
8
- _a[types_js_1.ICluster.Devnet] = "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
9
- _a[types_js_1.ICluster.Testnet] = "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
10
- _a[types_js_1.ICluster.Local] = "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
11
- _a);
12
- exports.BNB_PROGRAM_IDS = (_b = {},
13
- _b[types_js_1.ICluster.Mainnet] = "0x94d4646Bd307Bf91CB1893BC64d976BF9E60D9B2",
14
- _b[types_js_1.ICluster.Devnet] = "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
15
- _b[types_js_1.ICluster.Testnet] = "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
16
- _b[types_js_1.ICluster.Local] = "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
17
- _b);
18
- exports.POLYGON_PROGRAM_IDS = (_c = {},
19
- _c[types_js_1.ICluster.Mainnet] = "0x94d4646Bd307Bf91CB1893BC64d976BF9E60D9B2",
20
- _c[types_js_1.ICluster.Devnet] = "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
21
- _c[types_js_1.ICluster.Testnet] = "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
22
- _c[types_js_1.ICluster.Local] = "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
23
- _c);
4
+ const types_js_1 = require("../common/types.js");
5
+ exports.ETHEREUM_PROGRAM_IDS = {
6
+ [types_js_1.ICluster.Mainnet]: "0x94d4646Bd307Bf91CB1893BC64d976BF9E60D9B2",
7
+ [types_js_1.ICluster.Devnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
8
+ [types_js_1.ICluster.Testnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
9
+ [types_js_1.ICluster.Local]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
10
+ };
11
+ exports.BNB_PROGRAM_IDS = {
12
+ [types_js_1.ICluster.Mainnet]: "0x94d4646Bd307Bf91CB1893BC64d976BF9E60D9B2",
13
+ [types_js_1.ICluster.Devnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
14
+ [types_js_1.ICluster.Testnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
15
+ [types_js_1.ICluster.Local]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
16
+ };
17
+ exports.POLYGON_PROGRAM_IDS = {
18
+ [types_js_1.ICluster.Mainnet]: "0x94d4646Bd307Bf91CB1893BC64d976BF9E60D9B2",
19
+ [types_js_1.ICluster.Devnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
20
+ [types_js_1.ICluster.Testnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
21
+ [types_js_1.ICluster.Local]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
22
+ };
24
23
  exports.EVM_ERROR_MATCH_REGEX = /execution reverted: ([A-Z_]+)/;
25
24
  exports.EVM_ERROR_MAP = {
26
25
  ECONTRACT_NOT_INIT: types_js_1.ContractErrorCode.ECONTRACT_NOT_INIT,
@@ -1,25 +1,14 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
4
  };
16
5
  Object.defineProperty(exports, "__esModule", { value: true });
17
6
  exports.EvmContract = void 0;
18
- var bignumber_js_1 = __importDefault(require("bignumber.js"));
19
- var contractUtils_js_1 = require("../common/contractUtils.js");
20
- var utils_js_1 = require("../common/utils.js");
21
- var EvmContract = /** @class */ (function () {
22
- function EvmContract(stream) {
7
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
+ const contractUtils_js_1 = require("../common/contractUtils.js");
9
+ const utils_js_1 = require("../common/utils.js");
10
+ class EvmContract {
11
+ constructor(stream) {
23
12
  this.magic = 0;
24
13
  this.version = 0;
25
14
  this.createdAt = stream.created.toNumber();
@@ -64,12 +53,14 @@ var EvmContract = /** @class */ (function () {
64
53
  this.fundsUnlockedAtLastRateChange = (0, bignumber_js_1.default)(stream.funds_unlocked_at_last_rate_change.toString());
65
54
  this.type = (0, contractUtils_js_1.buildStreamType)(this);
66
55
  }
67
- EvmContract.prototype.unlocked = function (currentTimestamp) {
68
- return (0, contractUtils_js_1.calculateUnlockedAmount)(__assign(__assign({}, this), { currentTimestamp: currentTimestamp }));
69
- };
70
- EvmContract.prototype.remaining = function (decimals) {
56
+ unlocked(currentTimestamp) {
57
+ return (0, contractUtils_js_1.calculateUnlockedAmount)({
58
+ ...this,
59
+ currentTimestamp,
60
+ });
61
+ }
62
+ remaining(decimals) {
71
63
  return (0, utils_js_1.getNumberFromBigNumber)(this.depositedAmount.minus(this.withdrawnAmount), decimals);
72
- };
73
- return EvmContract;
74
- }());
64
+ }
65
+ }
75
66
  exports.EvmContract = EvmContract;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.extractEvmErrorCode = void 0;
4
- var constants_js_1 = require("./constants.js");
4
+ const constants_js_1 = require("./constants.js");
5
5
  function extractEvmErrorCode(errorText) {
6
- var match = constants_js_1.EVM_ERROR_MATCH_REGEX.exec(errorText);
6
+ const match = constants_js_1.EVM_ERROR_MATCH_REGEX.exec(errorText);
7
7
  if (!match) {
8
8
  return null;
9
9
  }
package/dist/cjs/index.js CHANGED
@@ -30,13 +30,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
32
  exports.GenericStreamClient = exports.StreamflowSui = exports.StreamflowSolana = exports.StreamflowEVM = exports.StreamflowAptos = void 0;
33
- exports.StreamflowAptos = __importStar(require("./aptos"));
34
- exports.StreamflowEVM = __importStar(require("./evm"));
35
- exports.StreamflowSolana = __importStar(require("./solana"));
36
- exports.StreamflowSui = __importStar(require("./sui"));
37
- __exportStar(require("./common/types"), exports);
38
- __exportStar(require("./common/utils"), exports);
39
- __exportStar(require("./common/constants"), exports);
40
- __exportStar(require("./common/contractUtils"), exports);
41
- var GenericStreamClient_1 = require("./common/GenericStreamClient");
42
- Object.defineProperty(exports, "GenericStreamClient", { enumerable: true, get: function () { return __importDefault(GenericStreamClient_1).default; } });
33
+ exports.StreamflowAptos = __importStar(require("./aptos/index.js"));
34
+ exports.StreamflowEVM = __importStar(require("./evm/index.js"));
35
+ exports.StreamflowSolana = __importStar(require("./solana/index.js"));
36
+ exports.StreamflowSui = __importStar(require("./sui/index.js"));
37
+ __exportStar(require("./common/types.js"), exports);
38
+ __exportStar(require("./common/utils.js"), exports);
39
+ __exportStar(require("./common/constants.js"), exports);
40
+ __exportStar(require("./common/contractUtils.js"), exports);
41
+ var GenericStreamClient_js_1 = require("./common/GenericStreamClient.js");
42
+ Object.defineProperty(exports, "GenericStreamClient", { enumerable: true, get: function () { return __importDefault(GenericStreamClient_js_1).default; } });