@streamflow/stream 6.0.0-alpha.0 → 6.0.0-alpha.10
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.
- package/dist/aptos/StreamClient.d.ts +1 -1
- package/dist/aptos/StreamClient.js +8 -6
- package/dist/common/GenericStreamClient.d.ts +1 -1
- package/dist/common/GenericStreamClient.js +4 -2
- package/dist/common/constants.d.ts +2 -0
- package/dist/common/constants.js +6 -1
- package/dist/common/types.d.ts +9 -14
- package/dist/evm/StreamClient.d.ts +1 -1
- package/dist/evm/StreamClient.js +6 -5
- package/dist/solana/StreamClient.d.ts +52 -13
- package/dist/solana/StreamClient.js +297 -202
- package/dist/solana/constants.d.ts +0 -2
- package/dist/solana/constants.js +1 -3
- package/dist/solana/types.d.ts +6 -164
- package/dist/solana/types.js +1 -10
- package/dist/sui/StreamClient.d.ts +1 -1
- package/dist/sui/StreamClient.js +9 -7
- package/package.json +4 -4
|
@@ -9,8 +9,6 @@ export declare const PROGRAM_ID: {
|
|
|
9
9
|
testnet: string;
|
|
10
10
|
local: string;
|
|
11
11
|
};
|
|
12
|
-
export declare const STREAMFLOW_PROGRAM_ID = "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m";
|
|
13
|
-
export declare const STREAMFLOW_DEVNET_PROGRAM_ID = "FGjLaVo5zLGdzCxMo9gu9tXr1kzTToKd8C8K7YS5hNM1";
|
|
14
12
|
export declare const PARTNER_ORACLE_PROGRAM_ID = "pardpVtPjC8nLj1Dwncew62mUzfChdCX1EaoZe8oCAa";
|
|
15
13
|
export declare const STREAMFLOW_TREASURY_PUBLIC_KEY: PublicKey;
|
|
16
14
|
export declare const WITHDRAWOR_PUBLIC_KEY: PublicKey;
|
package/dist/solana/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.SOLANA_ERROR_MAP = exports.SOLANA_ERROR_MATCH_REGEX = exports.PARTNERS_SCHEMA = exports.PARTNER_SCHEMA = exports.AIRDROP_AMOUNT = exports.DEFAULT_STREAMFLOW_FEE = exports.FEES_METADATA_SEED = exports.AIRDROP_TEST_TOKEN = exports.FEE_ORACLE_PUBLIC_KEY = exports.WITHDRAWOR_PUBLIC_KEY = exports.STREAMFLOW_TREASURY_PUBLIC_KEY = exports.PARTNER_ORACLE_PROGRAM_ID = exports.
|
|
4
|
+
exports.SOLANA_ERROR_MAP = exports.SOLANA_ERROR_MATCH_REGEX = exports.PARTNERS_SCHEMA = exports.PARTNER_SCHEMA = exports.AIRDROP_AMOUNT = exports.DEFAULT_STREAMFLOW_FEE = exports.FEES_METADATA_SEED = exports.AIRDROP_TEST_TOKEN = exports.FEE_ORACLE_PUBLIC_KEY = exports.WITHDRAWOR_PUBLIC_KEY = exports.STREAMFLOW_TREASURY_PUBLIC_KEY = exports.PARTNER_ORACLE_PROGRAM_ID = exports.PROGRAM_ID = exports.CREATE_PARAMS_PADDING = 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("../common/types");
|
|
7
7
|
exports.TX_FINALITY_CONFIRMED = "confirmed";
|
|
@@ -15,8 +15,6 @@ exports.PROGRAM_ID = (_a = {},
|
|
|
15
15
|
_a[types_1.ICluster.Testnet] = "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
|
|
16
16
|
_a[types_1.ICluster.Local] = "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
|
|
17
17
|
_a);
|
|
18
|
-
exports.STREAMFLOW_PROGRAM_ID = "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m";
|
|
19
|
-
exports.STREAMFLOW_DEVNET_PROGRAM_ID = "FGjLaVo5zLGdzCxMo9gu9tXr1kzTToKd8C8K7YS5hNM1";
|
|
20
18
|
exports.PARTNER_ORACLE_PROGRAM_ID = "pardpVtPjC8nLj1Dwncew62mUzfChdCX1EaoZe8oCAa";
|
|
21
19
|
exports.STREAMFLOW_TREASURY_PUBLIC_KEY = new web3_js_1.PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
|
|
22
20
|
exports.WITHDRAWOR_PUBLIC_KEY = new web3_js_1.PublicKey("wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u");
|
package/dist/solana/types.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { SignerWalletAdapter } from "@solana/wallet-adapter-base";
|
|
2
|
-
import { AccountInfo,
|
|
3
|
-
import {
|
|
2
|
+
import { AccountInfo, PublicKey, Keypair, Transaction } from "@solana/web3.js";
|
|
3
|
+
import { ITransactionSolanaExt } from "@streamflow/common/solana";
|
|
4
4
|
import BN from "bn.js";
|
|
5
|
-
import { IRecipient, Stream,
|
|
6
|
-
export { WalletAdapterNetwork as Cluster } from "@solana/wallet-adapter-base";
|
|
5
|
+
import { IRecipient, Stream, StreamType } from "../common/types";
|
|
7
6
|
export interface Account {
|
|
8
7
|
pubkey: PublicKey;
|
|
9
8
|
account: AccountInfo<Buffer>;
|
|
@@ -12,131 +11,18 @@ export interface ICreateSolanaExt {
|
|
|
12
11
|
sender: SignerWalletAdapter | Keypair;
|
|
13
12
|
isNative?: boolean;
|
|
14
13
|
}
|
|
15
|
-
export interface ICreateStreamSolanaExt extends ICreateSolanaExt {
|
|
14
|
+
export interface ICreateStreamSolanaExt extends ICreateSolanaExt, ITransactionSolanaExt {
|
|
16
15
|
metadataPubKeys?: PublicKey[];
|
|
17
16
|
partner?: string | null;
|
|
18
17
|
}
|
|
19
|
-
export interface IInteractStreamSolanaExt {
|
|
18
|
+
export interface IInteractStreamSolanaExt extends ITransactionSolanaExt {
|
|
20
19
|
invoker: SignerWalletAdapter | Keypair;
|
|
21
20
|
checkTokenAccounts?: boolean;
|
|
22
21
|
}
|
|
23
|
-
export interface ITopUpStreamSolanaExt {
|
|
22
|
+
export interface ITopUpStreamSolanaExt extends ITransactionSolanaExt {
|
|
24
23
|
invoker: SignerWalletAdapter | Keypair;
|
|
25
24
|
isNative?: boolean;
|
|
26
25
|
}
|
|
27
|
-
export interface CreateStreamData {
|
|
28
|
-
recipient: string;
|
|
29
|
-
mint: string;
|
|
30
|
-
start: number;
|
|
31
|
-
depositedAmount: BN;
|
|
32
|
-
period: number;
|
|
33
|
-
cliff: number;
|
|
34
|
-
cliffAmount: BN;
|
|
35
|
-
amountPerPeriod: BN;
|
|
36
|
-
name: string;
|
|
37
|
-
canTopup: boolean;
|
|
38
|
-
cancelableBySender: boolean;
|
|
39
|
-
cancelableByRecipient: boolean;
|
|
40
|
-
transferableBySender: boolean;
|
|
41
|
-
transferableByRecipient: boolean;
|
|
42
|
-
automaticWithdrawal?: boolean;
|
|
43
|
-
withdrawalFrequency?: number;
|
|
44
|
-
}
|
|
45
|
-
export interface MultiRecipient {
|
|
46
|
-
recipient: string;
|
|
47
|
-
depositedAmount: BN;
|
|
48
|
-
name: string;
|
|
49
|
-
cliffAmount: BN;
|
|
50
|
-
amountPerPeriod: BN;
|
|
51
|
-
}
|
|
52
|
-
export interface CreateMultiData {
|
|
53
|
-
recipientsData: MultiRecipient[];
|
|
54
|
-
mint: string;
|
|
55
|
-
start: number;
|
|
56
|
-
period: number;
|
|
57
|
-
cliff: number;
|
|
58
|
-
canTopup: boolean;
|
|
59
|
-
cancelableBySender: boolean;
|
|
60
|
-
cancelableByRecipient: boolean;
|
|
61
|
-
transferableBySender: boolean;
|
|
62
|
-
transferableByRecipient: boolean;
|
|
63
|
-
automaticWithdrawal?: boolean;
|
|
64
|
-
withdrawalFrequency?: number;
|
|
65
|
-
}
|
|
66
|
-
export interface CreateStreamParams extends CreateStreamData {
|
|
67
|
-
connection: Connection;
|
|
68
|
-
sender: SignerWalletAdapter;
|
|
69
|
-
partner?: string;
|
|
70
|
-
}
|
|
71
|
-
export interface CreateParams extends CreateStreamData {
|
|
72
|
-
sender: SignerWalletAdapter | Keypair;
|
|
73
|
-
partner?: string | null;
|
|
74
|
-
isNative?: boolean;
|
|
75
|
-
}
|
|
76
|
-
export interface CreateMultiParams extends CreateMultiData {
|
|
77
|
-
sender: SignerWalletAdapter | Keypair;
|
|
78
|
-
partner?: string | null;
|
|
79
|
-
isNative?: boolean;
|
|
80
|
-
}
|
|
81
|
-
export interface WithdrawStreamData {
|
|
82
|
-
id: string;
|
|
83
|
-
amount: BN;
|
|
84
|
-
}
|
|
85
|
-
export interface WithdrawStreamParams extends WithdrawStreamData {
|
|
86
|
-
connection: Connection;
|
|
87
|
-
invoker: SignerWalletAdapter;
|
|
88
|
-
}
|
|
89
|
-
export interface WithdrawParams extends WithdrawStreamData {
|
|
90
|
-
invoker: SignerWalletAdapter | Keypair;
|
|
91
|
-
}
|
|
92
|
-
export interface TopupStreamData {
|
|
93
|
-
id: string;
|
|
94
|
-
amount: BN;
|
|
95
|
-
}
|
|
96
|
-
export interface TopupStreamParams extends TopupStreamData {
|
|
97
|
-
connection: Connection;
|
|
98
|
-
invoker: SignerWalletAdapter;
|
|
99
|
-
}
|
|
100
|
-
export interface TopupParams extends TopupStreamData {
|
|
101
|
-
invoker: SignerWalletAdapter | Keypair;
|
|
102
|
-
isNative?: boolean;
|
|
103
|
-
}
|
|
104
|
-
export interface CancelStreamData {
|
|
105
|
-
id: string;
|
|
106
|
-
}
|
|
107
|
-
export interface CancelStreamParams extends CancelStreamData {
|
|
108
|
-
connection: Connection;
|
|
109
|
-
invoker: SignerWalletAdapter;
|
|
110
|
-
}
|
|
111
|
-
export interface CancelParams extends CancelStreamData {
|
|
112
|
-
invoker: SignerWalletAdapter | Keypair;
|
|
113
|
-
}
|
|
114
|
-
export interface TransferStreamData {
|
|
115
|
-
id: string;
|
|
116
|
-
recipientId: string;
|
|
117
|
-
}
|
|
118
|
-
export interface TransferStreamParams extends TransferStreamData {
|
|
119
|
-
connection: Connection;
|
|
120
|
-
invoker: SignerWalletAdapter;
|
|
121
|
-
}
|
|
122
|
-
export interface TransferParams extends TransferStreamData {
|
|
123
|
-
invoker: SignerWalletAdapter | Keypair;
|
|
124
|
-
}
|
|
125
|
-
export interface GetStreamParams {
|
|
126
|
-
connection: Connection;
|
|
127
|
-
id: string;
|
|
128
|
-
}
|
|
129
|
-
export interface GetStreamsParams {
|
|
130
|
-
connection: Connection;
|
|
131
|
-
wallet: PublicKey;
|
|
132
|
-
type?: StreamType;
|
|
133
|
-
direction?: StreamDirection;
|
|
134
|
-
}
|
|
135
|
-
export interface GetAllParams {
|
|
136
|
-
wallet: PublicKey;
|
|
137
|
-
type?: StreamType;
|
|
138
|
-
direction?: StreamDirection;
|
|
139
|
-
}
|
|
140
26
|
export declare class Contract implements Stream {
|
|
141
27
|
magic: number;
|
|
142
28
|
version: number;
|
|
@@ -229,53 +115,9 @@ export interface DecodedStream {
|
|
|
229
115
|
lastRateChangeTime: BN;
|
|
230
116
|
fundsUnlockedAtLastRateChange: BN;
|
|
231
117
|
}
|
|
232
|
-
export interface CreateStreamResponse extends TransactionResponse {
|
|
233
|
-
id: string;
|
|
234
|
-
}
|
|
235
|
-
export interface CreateResponse extends TxResponse {
|
|
236
|
-
metadata: Keypair;
|
|
237
|
-
}
|
|
238
118
|
export interface MetadataRecipientHashMap {
|
|
239
119
|
[metadataPubKey: string]: IRecipient;
|
|
240
120
|
}
|
|
241
|
-
export interface CreateMultiError {
|
|
242
|
-
recipient: string;
|
|
243
|
-
error: string;
|
|
244
|
-
}
|
|
245
|
-
export interface CreateMultiResponse {
|
|
246
|
-
txs: TransactionSignature[];
|
|
247
|
-
metadatas: Keypair[];
|
|
248
|
-
metadataToRecipient: MetadataRecipientHashMap;
|
|
249
|
-
errors: CreateMultiError[];
|
|
250
|
-
}
|
|
251
|
-
export declare enum TransferCancelOptions {
|
|
252
|
-
Recipient = "recipient",
|
|
253
|
-
Sender = "sender",
|
|
254
|
-
Both = "both",
|
|
255
|
-
Neither = "neither"
|
|
256
|
-
}
|
|
257
|
-
export interface Recipient {
|
|
258
|
-
recipient: string;
|
|
259
|
-
recipientEmail: string;
|
|
260
|
-
name: string;
|
|
261
|
-
depositedAmount: number;
|
|
262
|
-
}
|
|
263
|
-
export interface CreateMultipleStreamsValues {
|
|
264
|
-
releaseAmount: number;
|
|
265
|
-
email: string;
|
|
266
|
-
tokenSymbol: string;
|
|
267
|
-
startDate: string;
|
|
268
|
-
startTime: string;
|
|
269
|
-
releaseFrequencyCounter: number;
|
|
270
|
-
whoCanTransfer: TransferCancelOptions;
|
|
271
|
-
whoCanCancel: TransferCancelOptions;
|
|
272
|
-
releaseFrequencyPeriod: number;
|
|
273
|
-
automaticWithdrawal: boolean;
|
|
274
|
-
withdrawalFrequencyCounter: number;
|
|
275
|
-
withdrawalFrequencyPeriod: number;
|
|
276
|
-
referral: string;
|
|
277
|
-
recipients: Recipient[];
|
|
278
|
-
}
|
|
279
121
|
export interface BatchItem {
|
|
280
122
|
recipient: string;
|
|
281
123
|
tx: Transaction;
|
package/dist/solana/types.js
CHANGED
|
@@ -11,11 +11,9 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
14
|
+
exports.Contract = void 0;
|
|
15
15
|
var contractUtils_1 = require("../common/contractUtils");
|
|
16
16
|
var utils_1 = require("../common/utils");
|
|
17
|
-
var wallet_adapter_base_1 = require("@solana/wallet-adapter-base");
|
|
18
|
-
Object.defineProperty(exports, "Cluster", { enumerable: true, get: function () { return wallet_adapter_base_1.WalletAdapterNetwork; } });
|
|
19
17
|
var Contract = /** @class */ (function () {
|
|
20
18
|
function Contract(stream) {
|
|
21
19
|
var _a;
|
|
@@ -72,10 +70,3 @@ var Contract = /** @class */ (function () {
|
|
|
72
70
|
return Contract;
|
|
73
71
|
}());
|
|
74
72
|
exports.Contract = Contract;
|
|
75
|
-
var TransferCancelOptions;
|
|
76
|
-
(function (TransferCancelOptions) {
|
|
77
|
-
TransferCancelOptions["Recipient"] = "recipient";
|
|
78
|
-
TransferCancelOptions["Sender"] = "sender";
|
|
79
|
-
TransferCancelOptions["Both"] = "both";
|
|
80
|
-
TransferCancelOptions["Neither"] = "neither";
|
|
81
|
-
})(TransferCancelOptions || (exports.TransferCancelOptions = TransferCancelOptions = {}));
|
|
@@ -19,7 +19,7 @@ export default class SuiStreamClient extends BaseStreamClient {
|
|
|
19
19
|
/**
|
|
20
20
|
* Attempts withdrawing from the specified stream.
|
|
21
21
|
*/
|
|
22
|
-
withdraw(
|
|
22
|
+
withdraw({ id, amount }: IWithdrawData, { senderWallet, tokenId }: ITransactionSuiExt): Promise<ITransactionResult>;
|
|
23
23
|
/**
|
|
24
24
|
* Attempts canceling the specified stream.
|
|
25
25
|
*/
|
package/dist/sui/StreamClient.js
CHANGED
|
@@ -97,6 +97,7 @@ var types_2 = require("./types");
|
|
|
97
97
|
var utils_2 = require("./utils");
|
|
98
98
|
var wallet_1 = require("./wallet");
|
|
99
99
|
var utils_3 = require("../common/utils");
|
|
100
|
+
var constants_2 = require("../common/constants");
|
|
100
101
|
var SuiStreamClient = /** @class */ (function (_super) {
|
|
101
102
|
__extends(SuiStreamClient, _super);
|
|
102
103
|
function SuiStreamClient(clusterUrl, cluster, ids) {
|
|
@@ -225,12 +226,13 @@ var SuiStreamClient = /** @class */ (function (_super) {
|
|
|
225
226
|
/**
|
|
226
227
|
* Attempts withdrawing from the specified stream.
|
|
227
228
|
*/
|
|
228
|
-
SuiStreamClient.prototype.withdraw = function (
|
|
229
|
-
var
|
|
229
|
+
SuiStreamClient.prototype.withdraw = function (_a, _b) {
|
|
230
|
+
var id = _a.id, _c = _a.amount, amount = _c === void 0 ? constants_2.WITHDRAW_AVAILABLE_AMOUNT : _c;
|
|
231
|
+
var senderWallet = _b.senderWallet, tokenId = _b.tokenId;
|
|
230
232
|
return __awaiter(this, void 0, void 0, function () {
|
|
231
233
|
var wallet, txb, digest;
|
|
232
|
-
return __generator(this, function (
|
|
233
|
-
switch (
|
|
234
|
+
return __generator(this, function (_d) {
|
|
235
|
+
switch (_d.label) {
|
|
234
236
|
case 0:
|
|
235
237
|
wallet = new wallet_1.SuiWalletWrapper(senderWallet, this.client);
|
|
236
238
|
txb = new transactions_1.TransactionBlock();
|
|
@@ -238,17 +240,17 @@ var SuiStreamClient = /** @class */ (function (_super) {
|
|
|
238
240
|
target: "".concat(this.programId, "::protocol::withdraw"),
|
|
239
241
|
typeArguments: [tokenId],
|
|
240
242
|
arguments: [
|
|
241
|
-
txb.object(
|
|
243
|
+
txb.object(id),
|
|
242
244
|
txb.object(this.configId),
|
|
243
245
|
txb.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
244
|
-
txb.pure(
|
|
246
|
+
txb.pure(amount.toString()),
|
|
245
247
|
],
|
|
246
248
|
});
|
|
247
249
|
return [4 /*yield*/, wallet.signAndExecuteTransactionBlock({
|
|
248
250
|
transactionBlock: txb,
|
|
249
251
|
})];
|
|
250
252
|
case 1:
|
|
251
|
-
digest = (
|
|
253
|
+
digest = (_d.sent()).digest;
|
|
252
254
|
return [2 /*return*/, {
|
|
253
255
|
ixs: [],
|
|
254
256
|
txId: digest,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamflow/stream",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.10",
|
|
4
4
|
"description": "JavaScript SDK to interact with Streamflow protocol.",
|
|
5
5
|
"homepage": "https://github.com/streamflow-finance/js-sdk/",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"lint": "eslint --fix .",
|
|
36
36
|
"prepublishOnly": "npm run lint && npm test && npm run build"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "ba69862bbf25947672eb767e5852c9763a4a1165",
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@streamflow/eslint-config": "6.0.0-alpha.
|
|
40
|
+
"@streamflow/eslint-config": "6.0.0-alpha.10",
|
|
41
41
|
"@types/bn.js": "5.1.1",
|
|
42
42
|
"@types/ethereum-checksum-address": "^0.0.0",
|
|
43
43
|
"@types/jest": "29.2.4",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@solana/spl-token": "0.3.6",
|
|
55
55
|
"@solana/wallet-adapter-base": "0.9.19",
|
|
56
56
|
"@solana/web3.js": "1.70.1",
|
|
57
|
-
"@streamflow/common": "6.0.0-alpha.
|
|
57
|
+
"@streamflow/common": "6.0.0-alpha.10",
|
|
58
58
|
"@suiet/wallet-kit": "0.2.22",
|
|
59
59
|
"aptos": "1.4.0",
|
|
60
60
|
"bn.js": "5.2.1",
|