@streamflow/stream 4.0.0-Alpha.0 → 4.0.0-Alpha.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.
Files changed (39) hide show
  1. package/dist/aptos/StreamClient.d.ts +2 -1
  2. package/dist/aptos/StreamClient.js +2 -1
  3. package/dist/common/StreamClient.d.ts +10 -0
  4. package/dist/common/StreamClient.js +9 -0
  5. package/dist/common/types.d.ts +0 -9
  6. package/dist/common/types.js +1 -7
  7. package/dist/solana/StreamClient.d.ts +2 -1
  8. package/dist/solana/StreamClient.js +2 -1
  9. package/dist/solana/index.d.ts +2 -0
  10. package/dist/solana/index.js +16 -1
  11. package/dist/solana/layout.d.ts +6 -6
  12. package/dist/solana/layout.js +100 -75
  13. package/package.json +3 -3
  14. package/dist/Stream.d.ts +0 -87
  15. package/dist/Stream.js +0 -503
  16. package/dist/StreamClient.d.ts +0 -145
  17. package/dist/StreamClient.js +0 -1031
  18. package/dist/__tests__/test_dependencies/airdrop/airdrop-request.d.ts +0 -2
  19. package/dist/__tests__/test_dependencies/airdrop/airdrop-request.js +0 -67
  20. package/dist/__tests__/test_dependencies/airdrop/airdrop.d.ts +0 -6
  21. package/dist/__tests__/test_dependencies/airdrop/airdrop.js +0 -215
  22. package/dist/__tests__/test_dependencies/constants/index.d.ts +0 -122
  23. package/dist/__tests__/test_dependencies/constants/index.js +0 -158
  24. package/dist/__tests__/test_dependencies/idl/airdrop.d.ts +0 -27
  25. package/dist/__tests__/test_dependencies/idl/airdrop.js +0 -171
  26. package/dist/constants.d.ts +0 -18
  27. package/dist/constants.js +0 -23
  28. package/dist/idl/timelock.d.ts +0 -22
  29. package/dist/idl/timelock.js +0 -422
  30. package/dist/instructionTypes.d.ts +0 -81
  31. package/dist/instructionTypes.js +0 -2
  32. package/dist/instructions.d.ts +0 -131
  33. package/dist/instructions.js +0 -379
  34. package/dist/layout.d.ts +0 -22
  35. package/dist/layout.js +0 -99
  36. package/dist/types.d.ts +0 -317
  37. package/dist/types.js +0 -91
  38. package/dist/utils.d.ts +0 -19
  39. package/dist/utils.js +0 -126
@@ -1,4 +1,5 @@
1
- import { GenericStreamClient, ICancelData, ICluster, ICreateMultipleStreamData, ICreateStreamData, ITopUpData, ITransferData, IWithdrawData } from "../common/types";
1
+ import { GenericStreamClient } from "../common/StreamClient";
2
+ import { ICancelData, ICluster, ICreateMultipleStreamData, ICreateStreamData, ITopUpData, ITransferData, IWithdrawData } from "../common/types";
2
3
  import { ICreateStreamAptosExt, ITransactionAptosExt, ITransactionResult } from "./types";
3
4
  export default class AptosStreamClient extends GenericStreamClient {
4
5
  private programId;
@@ -63,6 +63,7 @@ var __values = (this && this.__values) || function(o) {
63
63
  };
64
64
  Object.defineProperty(exports, "__esModule", { value: true });
65
65
  var aptos_1 = require("aptos");
66
+ var StreamClient_1 = require("../common/StreamClient");
66
67
  var types_1 = require("../common/types");
67
68
  var constants_1 = require("./constants");
68
69
  var AptosStreamClient = /** @class */ (function (_super) {
@@ -292,5 +293,5 @@ var AptosStreamClient = /** @class */ (function (_super) {
292
293
  });
293
294
  };
294
295
  return AptosStreamClient;
295
- }(types_1.GenericStreamClient));
296
+ }(StreamClient_1.GenericStreamClient));
296
297
  exports.default = AptosStreamClient;
@@ -0,0 +1,10 @@
1
+ import { ICreateStreamData, ICreateMultipleStreamData, IWithdrawData, ICancelData, ITransferData, ITopUpData, IGetOneData } from "./types";
2
+ export declare abstract class GenericStreamClient {
3
+ abstract create(streamData: ICreateStreamData, ...chainSpecificParams: any[]): Promise<any>;
4
+ abstract createMultiple(multipleStreamData: ICreateMultipleStreamData, ...chainSpecificParams: any[]): Promise<any>;
5
+ abstract withdraw(withdrawData: IWithdrawData, ...chainSpecificParams: any[]): Promise<any>;
6
+ abstract cancel(cancelData: ICancelData, ...chainSpecificParams: any[]): Promise<any>;
7
+ abstract transfer(transferData: ITransferData, ...chainSpecificParams: any[]): Promise<any>;
8
+ abstract topup(topupData: ITopUpData, ...chainSpecificParams: any[]): Promise<any>;
9
+ abstract getOne(getOneData: IGetOneData, ...chainSpecificParams: any[]): Promise<any>;
10
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GenericStreamClient = void 0;
4
+ var GenericStreamClient = /** @class */ (function () {
5
+ function GenericStreamClient() {
6
+ }
7
+ return GenericStreamClient;
8
+ }());
9
+ exports.GenericStreamClient = GenericStreamClient;
@@ -43,15 +43,6 @@ export interface ITopUpData {
43
43
  export interface IGetOneData {
44
44
  id: string;
45
45
  }
46
- export declare abstract class GenericStreamClient {
47
- abstract create(streamData: ICreateStreamData, ...chainSpecificParams: any[]): Promise<any>;
48
- abstract createMultiple(multipleStreamData: ICreateMultipleStreamData, ...chainSpecificParams: any[]): Promise<any>;
49
- abstract withdraw(withdrawData: IWithdrawData, ...chainSpecificParams: any[]): Promise<any>;
50
- abstract cancel(cancelData: ICancelData, ...chainSpecificParams: any[]): Promise<any>;
51
- abstract transfer(transferData: ITransferData, ...chainSpecificParams: any[]): Promise<any>;
52
- abstract topup(topupData: ITopUpData, ...chainSpecificParams: any[]): Promise<any>;
53
- abstract getOne(getOneData: IGetOneData, ...chainSpecificParams: any[]): Promise<any>;
54
- }
55
46
  export declare enum ICluster {
56
47
  Mainnet = "mainnet",
57
48
  Devnet = "devnet",
@@ -1,12 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StreamType = exports.StreamDirection = exports.ICluster = exports.GenericStreamClient = void 0;
4
- var GenericStreamClient = /** @class */ (function () {
5
- function GenericStreamClient() {
6
- }
7
- return GenericStreamClient;
8
- }());
9
- exports.GenericStreamClient = GenericStreamClient;
3
+ exports.StreamType = exports.StreamDirection = exports.ICluster = void 0;
10
4
  // Utility types
11
5
  var ICluster;
12
6
  (function (ICluster) {
@@ -1,6 +1,7 @@
1
1
  import { Connection, Commitment, ConnectionConfig } from "@solana/web3.js";
2
2
  import { Stream as StreamData, GetAllParams, CreateResponse, CreateMultiResponse, TxResponse, ICreateStreamSolanaExt, IInteractStreamSolanaExt, ITopUpStreamSolanaExt } from "./types";
3
- import { GenericStreamClient, ICancelData, ICluster, ICreateMultipleStreamData, ICreateStreamData, IGetOneData, ITopUpData, ITransferData, IWithdrawData } from "../common/types";
3
+ import { ICancelData, ICluster, ICreateMultipleStreamData, ICreateStreamData, IGetOneData, ITopUpData, ITransferData, IWithdrawData } from "../common/types";
4
+ import { GenericStreamClient } from "../common/StreamClient";
4
5
  export default class SolanaStreamClient extends GenericStreamClient {
5
6
  private connection;
6
7
  private programId;
@@ -112,6 +112,7 @@ var utils_1 = require("./utils");
112
112
  var constants_1 = require("./constants");
113
113
  var instructions_1 = require("./instructions");
114
114
  var types_2 = require("../common/types");
115
+ var StreamClient_1 = require("../common/StreamClient");
115
116
  var METADATA_ACC_SIZE = 1104;
116
117
  var SolanaStreamClient = /** @class */ (function (_super) {
117
118
  __extends(SolanaStreamClient, _super);
@@ -948,5 +949,5 @@ var SolanaStreamClient = /** @class */ (function (_super) {
948
949
  });
949
950
  };
950
951
  return SolanaStreamClient;
951
- }(types_2.GenericStreamClient));
952
+ }(StreamClient_1.GenericStreamClient));
952
953
  exports.default = SolanaStreamClient;
@@ -2,4 +2,6 @@ export { default } from "./StreamClient";
2
2
  export * from "./utils";
3
3
  export * from "./types";
4
4
  export * from "./instructions";
5
+ export * as constants from "./constants";
6
+ export { default as timelockIDL } from "./timelockIDL";
5
7
  export { default as BN } from "bn.js";
@@ -10,18 +10,33 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
13
18
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
19
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
20
  };
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
16
28
  var __importDefault = (this && this.__importDefault) || function (mod) {
17
29
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
30
  };
19
31
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.BN = exports.default = void 0;
32
+ exports.BN = exports.timelockIDL = exports.constants = exports.default = void 0;
21
33
  var StreamClient_1 = require("./StreamClient");
22
34
  Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(StreamClient_1).default; } });
23
35
  __exportStar(require("./utils"), exports);
24
36
  __exportStar(require("./types"), exports);
25
37
  __exportStar(require("./instructions"), exports);
38
+ exports.constants = __importStar(require("./constants"));
39
+ var timelockIDL_1 = require("./timelockIDL");
40
+ Object.defineProperty(exports, "timelockIDL", { enumerable: true, get: function () { return __importDefault(timelockIDL_1).default; } });
26
41
  var bn_js_1 = require("bn.js");
27
42
  Object.defineProperty(exports, "BN", { enumerable: true, get: function () { return __importDefault(bn_js_1).default; } });
@@ -1,22 +1,22 @@
1
- import { Structure } from "@solana/buffer-layout";
1
+ import * as BufferLayout from "@solana/buffer-layout";
2
2
  import { ICreateStreamLayout, ICreateUncheckedStreamLayout, IStreamLayout, ITopupStreamLayout, IWithdrawStreamLayout } from "./instructionTypes";
3
3
  /**
4
4
  * Stream layout
5
5
  */
6
- export declare const streamLayout: Structure<IStreamLayout>;
6
+ export declare const streamLayout: BufferLayout.Structure<IStreamLayout>;
7
7
  /**
8
8
  * Create stream instruction layout
9
9
  */
10
- export declare const createStreamLayout: Structure<ICreateStreamLayout>;
10
+ export declare const createStreamLayout: BufferLayout.Structure<ICreateStreamLayout>;
11
11
  /**
12
12
  * Create unchecked stream instruction layout
13
13
  */
14
- export declare const createUncheckedStreamLayout: Structure<ICreateUncheckedStreamLayout>;
14
+ export declare const createUncheckedStreamLayout: BufferLayout.Structure<ICreateUncheckedStreamLayout>;
15
15
  /**
16
16
  * Withdraw stream instruction layout
17
17
  */
18
- export declare const withdrawStreamLayout: Structure<IWithdrawStreamLayout>;
18
+ export declare const withdrawStreamLayout: BufferLayout.Structure<IWithdrawStreamLayout>;
19
19
  /**
20
20
  * Topup stream instruction layout
21
21
  */
22
- export declare const topupStreamLayout: Structure<ITopupStreamLayout>;
22
+ export declare const topupStreamLayout: BufferLayout.Structure<ITopupStreamLayout>;
@@ -1,96 +1,121 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.topupStreamLayout = exports.withdrawStreamLayout = exports.createUncheckedStreamLayout = exports.createStreamLayout = exports.streamLayout = void 0;
4
- var buffer_layout_1 = require("@solana/buffer-layout");
27
+ var BufferLayout = __importStar(require("@solana/buffer-layout"));
5
28
  /**
6
29
  * Stream layout
7
30
  */
8
- exports.streamLayout = (0, buffer_layout_1.struct)([
9
- (0, buffer_layout_1.blob)(8, "magic"),
10
- (0, buffer_layout_1.blob)(1, "version"),
11
- (0, buffer_layout_1.blob)(8, "created_at"),
12
- (0, buffer_layout_1.blob)(8, "withdrawn_amount"),
13
- (0, buffer_layout_1.blob)(8, "canceled_at"),
14
- (0, buffer_layout_1.blob)(8, "end_time"),
15
- (0, buffer_layout_1.blob)(8, "last_withdrawn_at"),
16
- (0, buffer_layout_1.blob)(32, "sender"),
17
- (0, buffer_layout_1.blob)(32, "sender_tokens"),
18
- (0, buffer_layout_1.blob)(32, "recipient"),
19
- (0, buffer_layout_1.blob)(32, "recipient_tokens"),
20
- (0, buffer_layout_1.blob)(32, "mint"),
21
- (0, buffer_layout_1.blob)(32, "escrow_tokens"),
22
- (0, buffer_layout_1.blob)(32, "streamflow_treasury"),
23
- (0, buffer_layout_1.blob)(32, "streamflow_treasury_tokens"),
24
- (0, buffer_layout_1.blob)(8, "streamflow_fee_total"),
25
- (0, buffer_layout_1.blob)(8, "streamflow_fee_withdrawn"),
26
- (0, buffer_layout_1.f32)("streamflow_fee_percent"),
27
- (0, buffer_layout_1.blob)(32, "partner"),
28
- (0, buffer_layout_1.blob)(32, "partner_tokens"),
29
- (0, buffer_layout_1.blob)(8, "partner_fee_total"),
30
- (0, buffer_layout_1.blob)(8, "partner_fee_withdrawn"),
31
- (0, buffer_layout_1.f32)("partner_fee_percent"),
32
- (0, buffer_layout_1.blob)(8, "start_time"),
33
- (0, buffer_layout_1.blob)(8, "net_amount_deposited"),
34
- (0, buffer_layout_1.blob)(8, "period"),
35
- (0, buffer_layout_1.blob)(8, "amount_per_period"),
36
- (0, buffer_layout_1.blob)(8, "cliff"),
37
- (0, buffer_layout_1.blob)(8, "cliff_amount"),
38
- (0, buffer_layout_1.u8)("cancelable_by_sender"),
39
- (0, buffer_layout_1.u8)("cancelable_by_recipient"),
40
- (0, buffer_layout_1.u8)("automatic_withdrawal"),
41
- (0, buffer_layout_1.u8)("transferable_by_sender"),
42
- (0, buffer_layout_1.u8)("transferable_by_recipient"),
43
- (0, buffer_layout_1.u8)("can_topup"),
44
- (0, buffer_layout_1.blob)(64, "stream_name"),
45
- (0, buffer_layout_1.blob)(8, "withdraw_frequency"),
31
+ exports.streamLayout = BufferLayout.struct([
32
+ BufferLayout.blob(8, "magic"),
33
+ BufferLayout.blob(1, "version"),
34
+ BufferLayout.blob(8, "created_at"),
35
+ BufferLayout.blob(8, "withdrawn_amount"),
36
+ BufferLayout.blob(8, "canceled_at"),
37
+ BufferLayout.blob(8, "end_time"),
38
+ BufferLayout.blob(8, "last_withdrawn_at"),
39
+ BufferLayout.blob(32, "sender"),
40
+ BufferLayout.blob(32, "sender_tokens"),
41
+ BufferLayout.blob(32, "recipient"),
42
+ BufferLayout.blob(32, "recipient_tokens"),
43
+ BufferLayout.blob(32, "mint"),
44
+ BufferLayout.blob(32, "escrow_tokens"),
45
+ BufferLayout.blob(32, "streamflow_treasury"),
46
+ BufferLayout.blob(32, "streamflow_treasury_tokens"),
47
+ BufferLayout.blob(8, "streamflow_fee_total"),
48
+ BufferLayout.blob(8, "streamflow_fee_withdrawn"),
49
+ BufferLayout.f32("streamflow_fee_percent"),
50
+ BufferLayout.blob(32, "partner"),
51
+ BufferLayout.blob(32, "partner_tokens"),
52
+ BufferLayout.blob(8, "partner_fee_total"),
53
+ BufferLayout.blob(8, "partner_fee_withdrawn"),
54
+ BufferLayout.f32("partner_fee_percent"),
55
+ BufferLayout.blob(8, "start_time"),
56
+ BufferLayout.blob(8, "net_amount_deposited"),
57
+ BufferLayout.blob(8, "period"),
58
+ BufferLayout.blob(8, "amount_per_period"),
59
+ BufferLayout.blob(8, "cliff"),
60
+ BufferLayout.blob(8, "cliff_amount"),
61
+ BufferLayout.u8("cancelable_by_sender"),
62
+ BufferLayout.u8("cancelable_by_recipient"),
63
+ BufferLayout.u8("automatic_withdrawal"),
64
+ BufferLayout.u8("transferable_by_sender"),
65
+ BufferLayout.u8("transferable_by_recipient"),
66
+ BufferLayout.u8("can_topup"),
67
+ BufferLayout.blob(64, "stream_name"),
68
+ BufferLayout.blob(8, "withdraw_frequency"),
46
69
  ]);
47
70
  /**
48
71
  * Create stream instruction layout
49
72
  */
50
- exports.createStreamLayout = (0, buffer_layout_1.struct)([
51
- (0, buffer_layout_1.blob)(8, "start_time"),
52
- (0, buffer_layout_1.blob)(8, "net_amount_deposited"),
53
- (0, buffer_layout_1.blob)(8, "period"),
54
- (0, buffer_layout_1.blob)(8, "amount_per_period"),
55
- (0, buffer_layout_1.blob)(8, "cliff"),
56
- (0, buffer_layout_1.blob)(8, "cliff_amount"),
57
- (0, buffer_layout_1.u8)("cancelable_by_sender"),
58
- (0, buffer_layout_1.u8)("cancelable_by_recipient"),
59
- (0, buffer_layout_1.u8)("automatic_withdrawal"),
60
- (0, buffer_layout_1.u8)("transferable_by_sender"),
61
- (0, buffer_layout_1.u8)("transferable_by_recipient"),
62
- (0, buffer_layout_1.u8)("can_topup"),
63
- (0, buffer_layout_1.blob)(64, "stream_name"),
64
- (0, buffer_layout_1.blob)(8, "withdraw_frequency"),
73
+ exports.createStreamLayout = BufferLayout.struct([
74
+ BufferLayout.blob(8, "start_time"),
75
+ BufferLayout.blob(8, "net_amount_deposited"),
76
+ BufferLayout.blob(8, "period"),
77
+ BufferLayout.blob(8, "amount_per_period"),
78
+ BufferLayout.blob(8, "cliff"),
79
+ BufferLayout.blob(8, "cliff_amount"),
80
+ BufferLayout.u8("cancelable_by_sender"),
81
+ BufferLayout.u8("cancelable_by_recipient"),
82
+ BufferLayout.u8("automatic_withdrawal"),
83
+ BufferLayout.u8("transferable_by_sender"),
84
+ BufferLayout.u8("transferable_by_recipient"),
85
+ BufferLayout.u8("can_topup"),
86
+ BufferLayout.blob(64, "stream_name"),
87
+ BufferLayout.blob(8, "withdraw_frequency"),
65
88
  ]);
66
89
  /**
67
90
  * Create unchecked stream instruction layout
68
91
  */
69
- exports.createUncheckedStreamLayout = (0, buffer_layout_1.struct)([
70
- (0, buffer_layout_1.blob)(8, "start_time"),
71
- (0, buffer_layout_1.blob)(8, "net_amount_deposited"),
72
- (0, buffer_layout_1.blob)(8, "period"),
73
- (0, buffer_layout_1.blob)(8, "amount_per_period"),
74
- (0, buffer_layout_1.blob)(8, "cliff"),
75
- (0, buffer_layout_1.blob)(8, "cliff_amount"),
76
- (0, buffer_layout_1.u8)("cancelable_by_sender"),
77
- (0, buffer_layout_1.u8)("cancelable_by_recipient"),
78
- (0, buffer_layout_1.u8)("automatic_withdrawal"),
79
- (0, buffer_layout_1.u8)("transferable_by_sender"),
80
- (0, buffer_layout_1.u8)("transferable_by_recipient"),
81
- (0, buffer_layout_1.u8)("can_topup"),
82
- (0, buffer_layout_1.blob)(64, "stream_name"),
83
- (0, buffer_layout_1.blob)(8, "withdraw_frequency"),
84
- (0, buffer_layout_1.blob)(32, "recipient"),
85
- (0, buffer_layout_1.blob)(32, "partner"),
86
- (0, buffer_layout_1.u8)("pausable"),
87
- (0, buffer_layout_1.u8)("can_update_rate"),
92
+ exports.createUncheckedStreamLayout = BufferLayout.struct([
93
+ BufferLayout.blob(8, "start_time"),
94
+ BufferLayout.blob(8, "net_amount_deposited"),
95
+ BufferLayout.blob(8, "period"),
96
+ BufferLayout.blob(8, "amount_per_period"),
97
+ BufferLayout.blob(8, "cliff"),
98
+ BufferLayout.blob(8, "cliff_amount"),
99
+ BufferLayout.u8("cancelable_by_sender"),
100
+ BufferLayout.u8("cancelable_by_recipient"),
101
+ BufferLayout.u8("automatic_withdrawal"),
102
+ BufferLayout.u8("transferable_by_sender"),
103
+ BufferLayout.u8("transferable_by_recipient"),
104
+ BufferLayout.u8("can_topup"),
105
+ BufferLayout.blob(64, "stream_name"),
106
+ BufferLayout.blob(8, "withdraw_frequency"),
107
+ BufferLayout.blob(32, "recipient"),
108
+ BufferLayout.blob(32, "partner"),
109
+ BufferLayout.u8("pausable"),
110
+ BufferLayout.u8("can_update_rate"),
88
111
  ]);
89
112
  /**
90
113
  * Withdraw stream instruction layout
91
114
  */
92
- exports.withdrawStreamLayout = (0, buffer_layout_1.struct)([(0, buffer_layout_1.blob)(8, "amount")]);
115
+ exports.withdrawStreamLayout = BufferLayout.struct([BufferLayout.blob(8, "amount")]);
93
116
  /**
94
117
  * Topup stream instruction layout
95
118
  */
96
- exports.topupStreamLayout = (0, buffer_layout_1.struct)([(0, buffer_layout_1.blob)(8, "amount")]);
119
+ exports.topupStreamLayout = BufferLayout.struct([
120
+ BufferLayout.blob(8, "amount"),
121
+ ]);
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@streamflow/stream",
3
- "version": "4.0.0-Alpha.0",
3
+ "version": "4.0.0-Alpha.1",
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/",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
9
- "build": "tsc --outDir ./dist",
9
+ "build": "rm -rf ./dist && tsc --outDir ./dist --project ../../tsconfig.json",
10
10
  "test": "jest .",
11
11
  "lint": "eslint .",
12
- "publish": "npm run lint && npm test && npm run build && npm publish"
12
+ "prepublishOnly": "npm run lint && npm test && npm run build"
13
13
  },
14
14
  "gitHead": "a37306eba0e762af096db642fa22f07194014cfd",
15
15
  "devDependencies": {
package/dist/Stream.d.ts DELETED
@@ -1,87 +0,0 @@
1
- import { Stream as StreamData, GetStreamsParams, CreateStreamParams, CreateStreamResponse, WithdrawStreamParams, CancelStreamParams, TransactionResponse, TopupStreamParams, TransferStreamParams, GetStreamParams } from "./types";
2
- export default class Stream {
3
- /**
4
- * Creates a new stream/vesting contract.
5
- * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
6
- * @param {CreateStreamParams} data
7
- * @param {Connection} data.connection - A connection to the cluster.
8
- * @param {Wallet} data.sender - Wallet signing the transaction. Its address should match the authorized wallet (sender) or transaction will fail.
9
- * @param {string} data.recipient - Solana address of the recipient. Associated token account will be derived using this address and token mint address.
10
- * @param {string} data.mint - SPL Token mint.
11
- * @param {number} data.start - Timestamp (in seconds) when the stream/token vesting starts.
12
- * @param {BN} data.depositedAmount - Initially deposited amount of tokens (in the smallest units).
13
- * @param {number} data.period - Time step (period) in seconds per which the unlocking occurs.
14
- * @param {number} data.cliff - Vesting contract "cliff" timestamp in seconds.
15
- * @param {BN} data.cliffAmount - Amount unlocked at the "cliff".
16
- * @param {BN} data.amountPerPeriod - Amount unlocked per each period.
17
- * @param {string} data.name - Stream name/subject.
18
- * @param {boolean} data.canTopup - TRUE for streams, FALSE for vesting contracts.
19
- * @param {boolean} data.cancelableBySender - Whether or not sender can cancel the stream.
20
- * @param {boolean} data.cancelableByRecipient - Whether or not recipient can cancel the stream.
21
- * @param {boolean} data.transferableBySender - Whether or not sender can transfer the stream.
22
- * @param {boolean} data.transferableByRecipient - Whether or not recipient can transfer the stream.
23
- * @param {boolean} [data.automaticWithdrawal = false] - Whether or not a 3rd party can initiate withdraw in the name of recipient.
24
- * @param {number} [data.withdrawalFrequency = 0] - Relevant when automatic withdrawal is enabled. If greater than 0 our withdrawor will take care of withdrawals. If equal to 0 our withdrawor will skip, but everyone else can initiate withdrawals.
25
- * @param {string | null} [data.partner = null] - Partner's wallet address (optional).
26
- * @param {ClusterExtended} [data.cluster = Cluster.Mainnet] - Cluster: devnet, mainnet-beta, testnet or local (optional).
27
- */
28
- static create({ connection, sender, recipient, mint, start, depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, partner, cluster, }: CreateStreamParams): Promise<CreateStreamResponse>;
29
- /**
30
- * Attempts withdrawal from the specified stream.
31
- * @param {WithdrawStreamParams} data
32
- * @param {Connection} data.connection - A connection to the cluster.
33
- * @param {Wallet} data.invoker - Wallet signing the transaction. It's address should match authorized wallet (recipient) or transaction will fail.
34
- * @param {string} data.id - Identifier of a stream (escrow account with metadata) to be withdrawn from.
35
- * @param {BN} data.amount - Requested amount (in the smallest units) to withdraw (while streaming). If stream is completed, the whole amount will be withdrawn.
36
- * @param {ClusterExtended} [data.cluster = Cluster.Mainnet] - Cluster: devnet, mainnet-beta, testnet or local (optional).
37
- */
38
- static withdraw({ connection, invoker, id, amount, cluster, }: WithdrawStreamParams): Promise<TransactionResponse>;
39
- /**
40
- * Attempts canceling the specified stream.
41
- * @param {CancelStreamParams} data
42
- * @param {Connection} data.connection - A connection to the cluster.
43
- * @param {Wallet} data.invoker - Wallet signing the transaction. It's address should match authorized wallet (sender or recipient) or transaction will fail.
44
- * @param {string} data.id - Identifier of a stream (escrow account with metadata) to be canceled.
45
- * @param {ClusterExtended} [data.cluster = Cluster.Mainnet] - Cluster: devnet, mainnet-beta, testnet or local (optional).
46
- */
47
- static cancel({ connection, invoker, id, cluster, }: CancelStreamParams): Promise<TransactionResponse>;
48
- /**
49
- * Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
50
- * Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
51
- * @param {TransferStreamParams} data
52
- * @param {Connection} data.connection - A connection to the cluster.
53
- * @param {Wallet} data.invoker - Wallet signing the transaction. It's address should match authorized wallet (sender or recipient) or transaction will fail.
54
- * @param {string} data.id - Identifier of a stream (escrow account with metadata) to be transferred.
55
- * @param {string} data.recipientId - Address of a new recipient.
56
- * @param {ClusterExtended} [data.cluster = Cluster.Mainnet] - Cluster: devnet, mainnet-beta, testnet or local (optional).
57
- */
58
- static transfer({ connection, invoker, id, recipientId, cluster, }: TransferStreamParams): Promise<TransactionResponse>;
59
- /**
60
- * Tops up stream account deposited amount.
61
- * @param {TopupStreamParams} data
62
- * @param {Connection} data.connection - A connection to the cluster.
63
- * @param {Wallet} data.invoker - Wallet signing the transaction. It's address should match current stream sender or transaction will fail.
64
- * @param {string} data.id - Identifier of a stream (escrow account with metadata) to be topped up.
65
- * @param {BN} data.amount - Specified amount (in the smallest units) to topup (increases deposited amount).
66
- * @param {ClusterExtended} [data.cluster = Cluster.Mainnet] - Cluster: devnet, mainnet-beta, testnet or local (optional).
67
- */
68
- static topup({ connection, invoker, id, amount, cluster, }: TopupStreamParams): Promise<TransactionResponse>;
69
- /**
70
- * Fetch stream data by its id (address).
71
- * @param {GetStreamParams} data
72
- * @param {Connection} data.connection - A connection to the cluster.
73
- * @param {string} data.id - Identifier of a stream that is fetched.
74
- */
75
- static getOne({ connection, id, }: GetStreamParams): Promise<StreamData>;
76
- /**
77
- * Fetch streams/contracts by providing direction.
78
- * Streams are sorted by start time in ascending order.
79
- * @param {GetStreamsParams} data
80
- * @param {Connection} data.connection - A connection to the cluster.
81
- * @param {PublicKey} data.wallet - PublicKey of the wallet for which the streams/contracts are fetched.
82
- * @param {StreamType} [data.type = StreamType.All] - It can be one of: stream, vesting, all.
83
- * @param {StreamDirection} [data.direction = StreamDirection.All] - It can be one of: incoming, outgoing, all.
84
- * @param {ClusterExtended} [data.cluster = Cluster.Mainnet] - Cluster: devnet, mainnet-beta, testnet or local (optional).
85
- */
86
- static get({ connection, wallet, type, direction, cluster, }: GetStreamsParams): Promise<[string, StreamData][]>;
87
- }