@streamflow/stream 3.0.2 → 3.0.4

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.
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transferCancelOptions = exports.DATA_LAYER_VARIABLE = exports.USD_PEGGED_COINS = exports.DEFAULT_GA_PURCHASE_CURRENCY = exports.AFFILIATION = exports.TRANSACTION_VARIANT = exports.EVENT_TYPE = exports.EVENT_LABEL = exports.EVENT_ACTION = exports.EVENT_CATEGORY = exports.timePeriodOptions = exports.PERIOD = exports.ERRORS = exports.DEFAULT_DECIMAL_PLACES = exports.products = exports.PRODUCT_MULTISIG = exports.PRODUCT_MULTIPAY = exports.PRODUCT_STREAMS = exports.PRODUCT_VESTING = exports.ERR_NO_PRIOR_CREDIT = exports.ERR_NO_TOKEN_SELECTED = exports.ERR_NOT_CONNECTED = exports.ERR_NO_STREAM = exports.END = exports.START = exports.TIME_FORMAT = exports.DATE_FORMAT = exports.EXPLORER_TYPE_ADDR = exports.EXPLORER_TYPE_TX = exports.ProgramInstruction = exports.INSTRUCTION_TRANSFER_RECIPIENT = exports.INSTRUCTION_CANCEL_STREAM = exports.INSTRUCTION_WITHDRAW_STREAM = exports.INSTRUCTION_CREATE_STREAM = exports.TX_FINALITY_FINALIZED = exports.TX_FINALITY_CONFIRMED = exports.ALLOWED_PDA_PROGRAMS = exports.AIRDROP_WHITELIST = exports.AIRDROP_TEST_TOKEN = exports.AIRDROP_PDA = exports.AIRDROP_AMOUNT = void 0;
4
+ exports.AIRDROP_AMOUNT = 1; // 1 SOL is the cap on the testnet
5
+ exports.AIRDROP_PDA = "DRCLpDJUNiMeKuRP9dcnGuibjTMjDGFwbZEXsq1RRgiR";
6
+ exports.AIRDROP_TEST_TOKEN = "Gssm3vfi8s65R31SBdmQRq6cKeYojGgup7whkw4VCiQj";
7
+ exports.AIRDROP_WHITELIST = [
8
+ "3r1cS6LS7Q5e2XzMhjV4jwuJEyMsPnTFSSEU8HitWYFc",
9
+ "9CTuPR1xDwyAnQmtAY7PawFDta7yjhkyZhLkXXsUQWFS",
10
+ "8HRZui7gdzueWfB1Bgj2GesaPMJFyqLEk4y67TnNXcJd",
11
+ "4pYeM1AhyqCXy63xtwfMtytz8keWxBD2gHWHqdwacK3C",
12
+ ];
13
+ exports.ALLOWED_PDA_PROGRAMS = [
14
+ "GokivDYuQXPZCWRkwMhdH2h91KpDQXBEmpgBgs55bnpH",
15
+ ];
16
+ exports.TX_FINALITY_CONFIRMED = "confirmed";
17
+ exports.TX_FINALITY_FINALIZED = "finalized";
18
+ exports.INSTRUCTION_CREATE_STREAM = 0;
19
+ exports.INSTRUCTION_WITHDRAW_STREAM = 1;
20
+ exports.INSTRUCTION_CANCEL_STREAM = 2;
21
+ exports.INSTRUCTION_TRANSFER_RECIPIENT = 3;
22
+ var ProgramInstruction;
23
+ (function (ProgramInstruction) {
24
+ ProgramInstruction[ProgramInstruction["Create"] = 0] = "Create";
25
+ ProgramInstruction[ProgramInstruction["Withdraw"] = 1] = "Withdraw";
26
+ ProgramInstruction[ProgramInstruction["Topup"] = 2] = "Topup";
27
+ ProgramInstruction[ProgramInstruction["Cancel"] = 3] = "Cancel";
28
+ ProgramInstruction[ProgramInstruction["TransferRecipient"] = 4] = "TransferRecipient";
29
+ })(ProgramInstruction = exports.ProgramInstruction || (exports.ProgramInstruction = {}));
30
+ exports.EXPLORER_TYPE_TX = "tx";
31
+ exports.EXPLORER_TYPE_ADDR = "address";
32
+ exports.DATE_FORMAT = "yyyy-MM-dd";
33
+ exports.TIME_FORMAT = "HH:mm";
34
+ exports.START = "start";
35
+ exports.END = "end";
36
+ //might move to a separate class if it becomes clunky
37
+ exports.ERR_NO_STREAM = "Specified stream doesn't exist. Please double check with the sender.";
38
+ exports.ERR_NOT_CONNECTED = "There was an issue with the connection - please try to refresh the page.";
39
+ exports.ERR_NO_TOKEN_SELECTED = "Please select the token";
40
+ exports.ERR_NO_PRIOR_CREDIT = "You don't have enough SOL in your wallet to pay for transaction fees.";
41
+ exports.PRODUCT_VESTING = "vesting";
42
+ exports.PRODUCT_STREAMS = "streams";
43
+ exports.PRODUCT_MULTIPAY = "multipay";
44
+ exports.PRODUCT_MULTISIG = "multisig";
45
+ exports.products = [
46
+ exports.PRODUCT_VESTING,
47
+ exports.PRODUCT_STREAMS,
48
+ exports.PRODUCT_MULTIPAY,
49
+ exports.PRODUCT_MULTISIG,
50
+ ];
51
+ exports.DEFAULT_DECIMAL_PLACES = 2;
52
+ exports.ERRORS = {
53
+ amount_required: "Amount is required.",
54
+ amount_greater_than: "Please provide amount greater than 0.",
55
+ token_required: "Token is required.",
56
+ recipient_required: "You must choose a recipient.",
57
+ not_valid_email: "Must be a valid email.",
58
+ subject_required: "Please provide a subject (title).",
59
+ start_date_required: "Start date is required.",
60
+ start_date_is_in_the_past: "Cannot start stream in the past.",
61
+ start_time_required: "Start time is required.",
62
+ start_time_is_in_the_past: "Should start in future.",
63
+ end_date_required: "End date is required.",
64
+ end_time_required: "End time is required.",
65
+ deposited_amount_required: "Deposited amount is required.",
66
+ amount_too_high: "You don't have enough tokens.",
67
+ invalid_address: "Please enter a valid Solana wallet address.",
68
+ address_is_a_program: "Address cannot be a program.",
69
+ release_amount_greater_than_deposited: "Should be <= deposited amount.",
70
+ end_should_be_after_start: "End should happen after start.",
71
+ cliff_should_be_after_start: "Cliff should happen after start.",
72
+ cliff_should_be_before_end: "Cliff should happen before end.",
73
+ required: "Required.",
74
+ release_frequency_is_too_slow: "Should be smaller or equal to difference between END and CLIFF time.",
75
+ should_be_greater_than_0: "Should be greater than 0.",
76
+ max_year: "Year should be less than 9999.",
77
+ subject_too_long: "It is either too long or there are many complex characters.",
78
+ withdrawal_frequency_too_high: "Withdrawal frequency should be >= release frequency.",
79
+ };
80
+ exports.PERIOD = {
81
+ SECOND: 1,
82
+ MINUTE: 60,
83
+ HOUR: 3600,
84
+ DAY: 24 * 3600,
85
+ WEEK: 7 * 24 * 3600,
86
+ MONTH: Math.floor(30.4167 * 24 * 3600),
87
+ YEAR: 365 * 24 * 3600, // 365 days
88
+ };
89
+ exports.timePeriodOptions = [
90
+ { value: exports.PERIOD.SECOND, label: "second" },
91
+ { value: exports.PERIOD.MINUTE, label: "minute" },
92
+ { value: exports.PERIOD.HOUR, label: "hour" },
93
+ { value: exports.PERIOD.DAY, label: "day" },
94
+ { value: exports.PERIOD.WEEK, label: "week" },
95
+ { value: exports.PERIOD.MONTH, label: "month" },
96
+ { value: exports.PERIOD.YEAR, label: "year" },
97
+ ];
98
+ exports.EVENT_CATEGORY = {
99
+ WALLET: "wallet",
100
+ STREAM: "stream",
101
+ VESTING: "vesting",
102
+ };
103
+ exports.EVENT_ACTION = {
104
+ TRANSFER: "transfer",
105
+ CANCEL: "cancel",
106
+ TOP_UP: "top_up",
107
+ WITHDRAW: "withdraw",
108
+ CONNECT: "connect",
109
+ DISCONNECT: "disconnect",
110
+ };
111
+ exports.EVENT_LABEL = {
112
+ NONE: "none",
113
+ };
114
+ exports.EVENT_TYPE = {
115
+ EVENT: "event",
116
+ PAGEVIEW: "pageview",
117
+ PURCHASE: "purchase",
118
+ };
119
+ exports.TRANSACTION_VARIANT = {
120
+ CREATE_VESTING: "create_vesting",
121
+ CREATE_STREAM: "create_stream",
122
+ TOP_UP_STREAM: "top_up_stream",
123
+ };
124
+ exports.AFFILIATION = {
125
+ FREE: "free",
126
+ APP: "app",
127
+ };
128
+ exports.DEFAULT_GA_PURCHASE_CURRENCY = "USD";
129
+ exports.USD_PEGGED_COINS = ["USDT", "USDC"];
130
+ exports.DATA_LAYER_VARIABLE = {
131
+ WALLET_TYPE: "walletType",
132
+ TOKEN_FEE: "tokenFee",
133
+ TOKEN_SYMBOL: "tokenSymbol",
134
+ STREAM_ADDRESS: "streamAddress",
135
+ TOKEN_WITHDRAW_USD: "tokenWithdrawUsd",
136
+ STREAMFLOW_FEE_USD: "streamflowFeeUsd",
137
+ STREAMFLOW_FEE_TOKEN: "streamflowFeeToken",
138
+ TOTAL_AMOUNT_TOKEN: "totalAmountToken",
139
+ TOTAL_AMOUNT_USD: "totalAmountUsd",
140
+ };
141
+ exports.transferCancelOptions = [
142
+ {
143
+ value: "recipient",
144
+ label: "Only Recipient",
145
+ },
146
+ {
147
+ value: "sender",
148
+ label: "Only Sender",
149
+ },
150
+ {
151
+ value: "both",
152
+ label: "Both",
153
+ },
154
+ {
155
+ value: "neither",
156
+ label: "Neither",
157
+ },
158
+ ];
@@ -0,0 +1,27 @@
1
+ declare const _default: {
2
+ version: string;
3
+ name: string;
4
+ instructions: {
5
+ name: string;
6
+ accounts: {
7
+ name: string;
8
+ isMut: boolean;
9
+ isSigner: boolean;
10
+ }[];
11
+ args: {
12
+ name: string;
13
+ type: string;
14
+ }[];
15
+ }[];
16
+ accounts: {
17
+ name: string;
18
+ type: {
19
+ kind: string;
20
+ fields: {
21
+ name: string;
22
+ type: string;
23
+ }[];
24
+ };
25
+ }[];
26
+ };
27
+ export default _default;
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ version: "0.1.0",
5
+ name: "airdrop",
6
+ instructions: [
7
+ {
8
+ name: "initializeAirdrop",
9
+ accounts: [
10
+ {
11
+ name: "initializer",
12
+ isMut: false,
13
+ isSigner: true,
14
+ },
15
+ {
16
+ name: "initializerDepositTokenAccount",
17
+ isMut: true,
18
+ isSigner: false,
19
+ },
20
+ {
21
+ name: "airdropAccount",
22
+ isMut: true,
23
+ isSigner: true,
24
+ },
25
+ {
26
+ name: "airdropTokenAccount",
27
+ isMut: true,
28
+ isSigner: false,
29
+ },
30
+ {
31
+ name: "systemProgram",
32
+ isMut: false,
33
+ isSigner: false,
34
+ },
35
+ {
36
+ name: "tokenProgram",
37
+ isMut: false,
38
+ isSigner: false,
39
+ },
40
+ ],
41
+ args: [
42
+ {
43
+ name: "airdropAmount",
44
+ type: "u64",
45
+ },
46
+ {
47
+ name: "withdrawAmount",
48
+ type: "u64",
49
+ },
50
+ ],
51
+ },
52
+ {
53
+ name: "getAirdrop",
54
+ accounts: [
55
+ {
56
+ name: "taker",
57
+ isMut: false,
58
+ isSigner: true,
59
+ },
60
+ {
61
+ name: "takerReceiveTokenAccount",
62
+ isMut: true,
63
+ isSigner: false,
64
+ },
65
+ {
66
+ name: "airdropAccount",
67
+ isMut: true,
68
+ isSigner: false,
69
+ },
70
+ {
71
+ name: "mint",
72
+ isMut: false,
73
+ isSigner: false,
74
+ },
75
+ {
76
+ name: "airdropTokenAccount",
77
+ isMut: true,
78
+ isSigner: false,
79
+ },
80
+ {
81
+ name: "pdaAccount",
82
+ isMut: false,
83
+ isSigner: false,
84
+ },
85
+ {
86
+ name: "tokenProgram",
87
+ isMut: false,
88
+ isSigner: false,
89
+ },
90
+ {
91
+ name: "associatedTokenProgram",
92
+ isMut: false,
93
+ isSigner: false,
94
+ },
95
+ {
96
+ name: "systemProgram",
97
+ isMut: false,
98
+ isSigner: false,
99
+ },
100
+ {
101
+ name: "rent",
102
+ isMut: false,
103
+ isSigner: false,
104
+ },
105
+ ],
106
+ args: [],
107
+ },
108
+ {
109
+ name: "cancelAirdrop",
110
+ accounts: [
111
+ {
112
+ name: "initializer",
113
+ isMut: true,
114
+ isSigner: true,
115
+ },
116
+ {
117
+ name: "initializerDepositTokenAccount",
118
+ isMut: true,
119
+ isSigner: false,
120
+ },
121
+ {
122
+ name: "pdaAccount",
123
+ isMut: false,
124
+ isSigner: false,
125
+ },
126
+ {
127
+ name: "airdropAccount",
128
+ isMut: true,
129
+ isSigner: false,
130
+ },
131
+ {
132
+ name: "airdropTokenAccount",
133
+ isMut: true,
134
+ isSigner: false,
135
+ },
136
+ {
137
+ name: "tokenProgram",
138
+ isMut: false,
139
+ isSigner: false,
140
+ },
141
+ ],
142
+ args: [],
143
+ },
144
+ ],
145
+ accounts: [
146
+ {
147
+ name: "AirdropAccount",
148
+ type: {
149
+ kind: "struct",
150
+ fields: [
151
+ {
152
+ name: "initializerKey",
153
+ type: "publicKey",
154
+ },
155
+ {
156
+ name: "initializerDepositTokenAccount",
157
+ type: "publicKey",
158
+ },
159
+ {
160
+ name: "airdropTokenAccount",
161
+ type: "publicKey",
162
+ },
163
+ {
164
+ name: "withdrawAmount",
165
+ type: "u64",
166
+ },
167
+ ],
168
+ },
169
+ },
170
+ ],
171
+ };
@@ -13,3 +13,5 @@ export declare const STREAMFLOW_DEVNET_PROGRAM_ID = "FGjLaVo5zLGdzCxMo9gu9tXr1kz
13
13
  export declare const STREAMFLOW_TREASURY_PUBLIC_KEY: PublicKey;
14
14
  export declare const WITHDRAWOR_PUBLIC_KEY: PublicKey;
15
15
  export declare const FEE_ORACLE_PUBLIC_KEY: PublicKey;
16
+ export declare const AIRDROP_TEST_TOKEN = "Gssm3vfi8s65R31SBdmQRq6cKeYojGgup7whkw4VCiQj";
17
+ export declare const AIRDROP_AMOUNT = 1;
package/dist/constants.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.FEE_ORACLE_PUBLIC_KEY = exports.WITHDRAWOR_PUBLIC_KEY = exports.STREAMFLOW_TREASURY_PUBLIC_KEY = exports.STREAMFLOW_DEVNET_PROGRAM_ID = exports.STREAMFLOW_PROGRAM_ID = exports.PROGRAM_ID = exports.STREAM_STRUCT_OFFSET_RECIPIENT = exports.STREAM_STRUCT_OFFSET_SENDER = exports.TX_FINALITY_CONFIRMED = void 0;
4
+ exports.AIRDROP_AMOUNT = exports.AIRDROP_TEST_TOKEN = exports.FEE_ORACLE_PUBLIC_KEY = exports.WITHDRAWOR_PUBLIC_KEY = exports.STREAMFLOW_TREASURY_PUBLIC_KEY = exports.STREAMFLOW_DEVNET_PROGRAM_ID = exports.STREAMFLOW_PROGRAM_ID = exports.PROGRAM_ID = exports.STREAM_STRUCT_OFFSET_RECIPIENT = exports.STREAM_STRUCT_OFFSET_SENDER = exports.TX_FINALITY_CONFIRMED = void 0;
5
5
  var web3_js_1 = require("@solana/web3.js");
6
6
  var types_1 = require("./types");
7
7
  exports.TX_FINALITY_CONFIRMED = "confirmed";
@@ -18,3 +18,5 @@ exports.STREAMFLOW_DEVNET_PROGRAM_ID = "FGjLaVo5zLGdzCxMo9gu9tXr1kzTToKd8C8K7YS5
18
18
  exports.STREAMFLOW_TREASURY_PUBLIC_KEY = new web3_js_1.PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
19
19
  exports.WITHDRAWOR_PUBLIC_KEY = new web3_js_1.PublicKey("wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u");
20
20
  exports.FEE_ORACLE_PUBLIC_KEY = new web3_js_1.PublicKey("B743wFVk2pCYhV91cn287e1xY7f1vt4gdY48hhNiuQmT");
21
+ exports.AIRDROP_TEST_TOKEN = "Gssm3vfi8s65R31SBdmQRq6cKeYojGgup7whkw4VCiQj";
22
+ exports.AIRDROP_AMOUNT = 1; // 1 SOL is the cap on the testnet
File without changes
File without changes
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/dist/types.d.ts CHANGED
@@ -232,8 +232,41 @@ export interface CreateResponse extends TxResponse {
232
232
  export interface MetadataRecipientHashMap {
233
233
  [metadataPubKey: string]: MultiRecipient;
234
234
  }
235
+ export interface CreateMultiError {
236
+ recipient: string;
237
+ error: string;
238
+ }
235
239
  export interface CreateMultiResponse {
236
240
  txs: TransactionSignature[];
237
241
  metadatas: Keypair[];
238
242
  metadataToRecipient: MetadataRecipientHashMap;
243
+ errors: CreateMultiError[];
244
+ }
245
+ export declare enum TransferCancelOptions {
246
+ Recipient = "recipient",
247
+ Sender = "sender",
248
+ Both = "both",
249
+ Neither = "neither"
250
+ }
251
+ export interface Recipient {
252
+ recipient: string;
253
+ recipientEmail: string;
254
+ name: string;
255
+ depositedAmount: number;
256
+ }
257
+ export interface CreateMultipleStreamsValues {
258
+ releaseAmount: number;
259
+ email: string;
260
+ tokenSymbol: string;
261
+ startDate: string;
262
+ startTime: string;
263
+ releaseFrequencyCounter: number;
264
+ whoCanTransfer: TransferCancelOptions;
265
+ whoCanCancel: TransferCancelOptions;
266
+ releaseFrequencyPeriod: number;
267
+ automaticWithdrawal: boolean;
268
+ withdrawalFrequencyCounter: number;
269
+ withdrawalFrequencyPeriod: number;
270
+ referral: string;
271
+ recipients: Recipient[];
239
272
  }
package/dist/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LocalCluster = exports.StreamType = exports.StreamDirection = exports.Cluster = void 0;
3
+ exports.TransferCancelOptions = exports.LocalCluster = exports.StreamType = exports.StreamDirection = exports.Cluster = void 0;
4
4
  var wallet_adapter_base_1 = require("@solana/wallet-adapter-base");
5
5
  Object.defineProperty(exports, "Cluster", { enumerable: true, get: function () { return wallet_adapter_base_1.WalletAdapterNetwork; } });
6
6
  var StreamDirection;
@@ -19,3 +19,10 @@ var LocalCluster;
19
19
  (function (LocalCluster) {
20
20
  LocalCluster["Local"] = "local";
21
21
  })(LocalCluster = exports.LocalCluster || (exports.LocalCluster = {}));
22
+ var TransferCancelOptions;
23
+ (function (TransferCancelOptions) {
24
+ TransferCancelOptions["Recipient"] = "recipient";
25
+ TransferCancelOptions["Sender"] = "sender";
26
+ TransferCancelOptions["Both"] = "both";
27
+ TransferCancelOptions["Neither"] = "neither";
28
+ })(TransferCancelOptions = exports.TransferCancelOptions || (exports.TransferCancelOptions = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/stream",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
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/",
@@ -9,5 +9,19 @@
9
9
  "build": "tsc --outDir ./dist",
10
10
  "test": "echo \"Error: no test specified\" && exit 1"
11
11
  },
12
- "gitHead": "a37306eba0e762af096db642fa22f07194014cfd"
12
+ "gitHead": "a37306eba0e762af096db642fa22f07194014cfd",
13
+ "devDependencies": {
14
+ "@types/bn.js": "^5.1.0",
15
+ "date-fns": "^2.28.0",
16
+ "typescript": "^4.6.4"
17
+ },
18
+ "dependencies": {
19
+ "@project-serum/anchor": "^0.16.2",
20
+ "@project-serum/common": "^0.0.1-beta.3",
21
+ "@solana/spl-token": "^0.1.8",
22
+ "@solana/wallet-adapter-base": "^0.9.2",
23
+ "@solana/web3.js": "^1.42.0",
24
+ "bn.js": "^5.2.0",
25
+ "buffer-layout": "^1.2.1"
26
+ }
13
27
  }