@streamflow/stream 2.0.2-beta.24 → 2.1.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.
- package/README.md +47 -34
- package/dist/constants.d.ts +0 -2
- package/dist/constants.js +1 -3
- package/dist/index.d.ts +1 -2
- package/dist/index.js +3 -4
- package/dist/sdk.d.ts +28 -26
- package/dist/sdk.js +194 -251
- package/dist/types.d.ts +54 -40
- package/dist/utils.d.ts +6 -6
- package/dist/utils.js +74 -32
- package/package.json +1 -1
- package/dist/instructions.d.ts +0 -97
- package/dist/instructions.js +0 -210
- package/dist/layout.d.ts +0 -18
- package/dist/layout.js +0 -73
package/README.md
CHANGED
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
**Important: Security audit is underway.**
|
|
1
|
+
**Important: Security audit for the v2 is underway.**
|
|
2
2
|
|
|
3
3
|
Docs: https://streamflow.finance/js-sdk/
|
|
4
|
+
|
|
4
5
|
# Streamflow
|
|
5
|
-
Streamflow is a token distribution platform powered by a streaming payments' protocol.
|
|
6
6
|
|
|
7
|
-
Streamflow
|
|
8
|
-
<br>
|
|
9
|
-
Streamflow program ID (mainnet) => `strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m`
|
|
7
|
+
Streamflow is a token distribution platform powered by a streaming payments' protocol.
|
|
10
8
|
|
|
11
|
-
There are several ways to use Streamflow
|
|
9
|
+
There are several ways to use **Streamflow**:
|
|
12
10
|
|
|
13
|
-
- **(
|
|
14
|
-
- **JS SDK**
|
|
15
|
-
- **Rust SDK**
|
|
11
|
+
- **(easiest) [app.streamflow.finance](https://app.streamflow.finance)** (React application that uses JS SDK directly)
|
|
12
|
+
- **[JS SDK](https://github.com/streamflow-finance/js-sdk)** to interact with the protocol => [NPM package](https://www.npmjs.com/package/@streamflow/stream/v/2.0.0)
|
|
13
|
+
- **[Rust SDK](https://github.com/streamflow-finance/rust-sdk)** to integrate within a Solana program => [Rust Crate](https://docs.rs/streamflow-sdk/)
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
## JS SDK
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
This package allows you to `create`, `withdraw`, `cancel`, `topup` and `transfer` SPL token stream.
|
|
17
|
+
This SDK allows you to `create`, `withdraw`, `cancel`, `topup` and `transfer` SPL token stream.
|
|
21
18
|
|
|
22
19
|
You can also `getOne` stream and `get` multiple streams.
|
|
23
20
|
|
|
24
|
-
|
|
21
|
+
---
|
|
25
22
|
|
|
26
|
-
|
|
23
|
+
### Installation
|
|
27
24
|
|
|
25
|
+
`npm i @streamflow/stream @solana/web3.js @project-serum/anchor`
|
|
28
26
|
|
|
29
|
-
>_Anchor is needed for the `Wallet` type. We plan on removing this dependency in upcoming releases._
|
|
27
|
+
> _Anchor is needed for the `Wallet` type. We plan on removing this dependency in upcoming releases._
|
|
30
28
|
|
|
31
29
|
`bn.js` library is used for handling big numbers.
|
|
32
30
|
|
|
@@ -36,7 +34,9 @@ import { Wallet } from "@project-serum/anchor/src/provider";
|
|
|
36
34
|
import BN from "bn.js";
|
|
37
35
|
```
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+
### Usage
|
|
38
|
+
|
|
39
|
+
#### Imports
|
|
40
40
|
|
|
41
41
|
Most common imports:
|
|
42
42
|
|
|
@@ -57,9 +57,10 @@ import Stream, {
|
|
|
57
57
|
CreateStreamResponse,
|
|
58
58
|
} from "@streamflow/stream";
|
|
59
59
|
```
|
|
60
|
+
|
|
60
61
|
_Check the SDK for other types and utility functions._
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
#### Create stream
|
|
63
64
|
|
|
64
65
|
```javascript
|
|
65
66
|
const createStreamParams = {
|
|
@@ -68,19 +69,20 @@ const createStreamParams = {
|
|
|
68
69
|
recipient: "4ih00075bKjVg000000tLdk4w42NyG3Mv0000dc0M00", // Solana recipient address.
|
|
69
70
|
mint: "DNw99999M7e24g99999999WJirKeZ5fQc6KY999999gK", // SPL Token mint.
|
|
70
71
|
start: 1643363040, // Timestamp (in seconds) when the stream/token vesting starts.
|
|
71
|
-
depositedAmount: new BN(1000000000000), // Deposited amount of tokens (
|
|
72
|
+
depositedAmount: new BN(1000000000000), // Deposited amount of tokens (using smallest denomination).
|
|
72
73
|
period: 1, // Time step (period) in seconds per which the unlocking occurs.
|
|
73
74
|
cliff: 1643363160, // Vesting contract "cliff" timestamp in seconds.
|
|
74
|
-
cliffAmount: new BN(100000000000), // Amount unlocked at the "cliff" timestamp.
|
|
75
|
+
cliffAmount: new BN(100000000000), // Amount (smallest denomination) unlocked at the "cliff" timestamp.
|
|
75
76
|
amountPerPeriod: new BN(5000000000), // Release rate: how many tokens are unlocked per each period.
|
|
76
|
-
name: "Transfer to Jane Doe.", // The stream name
|
|
77
|
+
name: "Transfer to Jane Doe.", // The stream name or subject.
|
|
77
78
|
canTopup: false, // setting to FALSE will effectively create a vesting contract.
|
|
78
79
|
cancelableBySender: true, // Whether or not sender can cancel the stream.
|
|
79
80
|
cancelableByRecipient: false, // Whether or not recipient can cancel the stream.
|
|
80
|
-
transferableBySender: true, // Whether or not sender can transfer the stream.
|
|
81
|
-
transferableByRecipient: false, // Whether or not recipient can transfer the stream.
|
|
82
|
-
automaticWithdrawal:
|
|
83
|
-
|
|
81
|
+
transferableBySender: true, // Whether or not sender can transfer the stream to the new recipient.
|
|
82
|
+
transferableByRecipient: false, // Whether or not recipient can transfer the stream to the new recipient.
|
|
83
|
+
automaticWithdrawal: true, // [WIP] Whether or not a 3rd party (e.g. cron job, "cranker") can initiate a token withdraw/transfer. Defaults to false.
|
|
84
|
+
withdrawalFrequency: 10, // [WIP] 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.
|
|
85
|
+
partner: "AAAAA075bKjVg000000tLdk4w42NyG3Mv0000dc0M00", // (optional) Partner's wallet address (string).
|
|
84
86
|
cluster: Cluster.Mainnet, // (optional) Cluster (default is Cluster.Mainnet).
|
|
85
87
|
};
|
|
86
88
|
|
|
@@ -91,7 +93,11 @@ try {
|
|
|
91
93
|
}
|
|
92
94
|
```
|
|
93
95
|
|
|
94
|
-
|
|
96
|
+
\_Disclaimer: Support for scheduled, automatic token withdrawals/transfers is under development and scheduled to launch in Q1. Once launched, it will be enabled retroactively for all streams that have `automaticWithdrawal` set to `true`.
|
|
97
|
+
|
|
98
|
+
Please note that transaction fees for the scheduled transfers are paid upfront by the stream creator (sender).\_
|
|
99
|
+
|
|
100
|
+
#### Withdraw from stream
|
|
95
101
|
|
|
96
102
|
```javascript
|
|
97
103
|
const withdrawStreamParams = {
|
|
@@ -109,7 +115,7 @@ try {
|
|
|
109
115
|
}
|
|
110
116
|
```
|
|
111
117
|
|
|
112
|
-
|
|
118
|
+
#### Topup stream
|
|
113
119
|
|
|
114
120
|
```javascript
|
|
115
121
|
const topupStreamParams = {
|
|
@@ -127,7 +133,7 @@ try {
|
|
|
127
133
|
}
|
|
128
134
|
```
|
|
129
135
|
|
|
130
|
-
|
|
136
|
+
#### Transfer stream to another recipient
|
|
131
137
|
|
|
132
138
|
```javascript
|
|
133
139
|
const data = {
|
|
@@ -145,7 +151,7 @@ try {
|
|
|
145
151
|
}
|
|
146
152
|
```
|
|
147
153
|
|
|
148
|
-
|
|
154
|
+
#### Cancel stream
|
|
149
155
|
|
|
150
156
|
```javascript
|
|
151
157
|
const cancelStreamParams = {
|
|
@@ -162,7 +168,7 @@ try {
|
|
|
162
168
|
}
|
|
163
169
|
```
|
|
164
170
|
|
|
165
|
-
|
|
171
|
+
#### Get one stream by its ID
|
|
166
172
|
|
|
167
173
|
```javascript
|
|
168
174
|
try {
|
|
@@ -175,7 +181,7 @@ try {
|
|
|
175
181
|
}
|
|
176
182
|
```
|
|
177
183
|
|
|
178
|
-
|
|
184
|
+
#### Get multiple streams for a specific wallet address
|
|
179
185
|
|
|
180
186
|
```javascript
|
|
181
187
|
try {
|
|
@@ -191,13 +197,20 @@ try {
|
|
|
191
197
|
}
|
|
192
198
|
```
|
|
193
199
|
|
|
194
|
-
|
|
200
|
+
## Additional notes
|
|
195
201
|
|
|
196
|
-
|
|
202
|
+
Streamflow protocol program ID (devnet): `HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ`
|
|
203
|
+
<br>
|
|
204
|
+
Streamflow protocol program ID (mainnet): `strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m`
|
|
205
|
+
|
|
206
|
+
**All BN amounts are denominated in their smallest units.**
|
|
207
|
+
|
|
208
|
+
E.g, if the amount is 1 SOL than this amount in lamports is `1000 \* 10^9 = 1_000_000_000.`
|
|
197
209
|
|
|
198
|
-
E.g, if the amount is 1 SOL than this amount in lamports is 1000 \* 10^9 = 1_000_000_000.
|
|
199
210
|
And `new BN(1_000_000_000)` is used.
|
|
200
211
|
|
|
201
212
|
Use `getBN` and `getNumberFromBN` utility functions for conversions between `BN` and `Number` types.
|
|
202
213
|
|
|
203
|
-
|
|
214
|
+
**Streamflow Community** (free and open source version, with a limited feature set) is available [here](https://github.com/streamflow-finance/js-sdk/tree/community).
|
|
215
|
+
|
|
216
|
+
WAGMI.
|
package/dist/constants.d.ts
CHANGED
|
@@ -8,7 +8,5 @@ export declare const PROGRAM_ID: {
|
|
|
8
8
|
testnet: string;
|
|
9
9
|
local: string;
|
|
10
10
|
};
|
|
11
|
-
export declare const STREAMFLOW_PROGRAM_ID = "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m";
|
|
12
|
-
export declare const STREAMFLOW_DEVNET_PROGRAM_ID = "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ";
|
|
13
11
|
export declare const STREAMFLOW_TREASURY_PUBLIC_KEY: PublicKey;
|
|
14
12
|
export declare const WITHDRAWOR_PUBLIC_KEY: PublicKey;
|
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.WITHDRAWOR_PUBLIC_KEY = exports.STREAMFLOW_TREASURY_PUBLIC_KEY = exports.
|
|
4
|
+
exports.WITHDRAWOR_PUBLIC_KEY = exports.STREAMFLOW_TREASURY_PUBLIC_KEY = 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";
|
|
@@ -13,7 +13,5 @@ exports.PROGRAM_ID = (_a = {},
|
|
|
13
13
|
_a[types_1.Cluster.Testnet] = "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
|
|
14
14
|
_a[types_1.LocalCluster.Local] = "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
|
|
15
15
|
_a);
|
|
16
|
-
exports.STREAMFLOW_PROGRAM_ID = "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m";
|
|
17
|
-
exports.STREAMFLOW_DEVNET_PROGRAM_ID = "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ";
|
|
18
16
|
exports.STREAMFLOW_TREASURY_PUBLIC_KEY = new web3_js_1.PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
|
|
19
17
|
exports.WITHDRAWOR_PUBLIC_KEY = new web3_js_1.PublicKey("wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u");
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -13,11 +13,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.
|
|
16
|
+
exports.BN = exports.default = void 0;
|
|
17
17
|
var sdk_1 = require("./sdk");
|
|
18
18
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(sdk_1).default; } });
|
|
19
19
|
__exportStar(require("./utils"), exports);
|
|
20
20
|
__exportStar(require("./types"), exports);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Object.defineProperty(exports, "u64", { enumerable: true, get: function () { return spl_token_1.u64; } });
|
|
21
|
+
var anchor_1 = require("@project-serum/anchor");
|
|
22
|
+
Object.defineProperty(exports, "BN", { enumerable: true, get: function () { return anchor_1.BN; } });
|
package/dist/sdk.d.ts
CHANGED
|
@@ -1,85 +1,87 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Commitment, ConnectionConfig } from "@solana/web3.js";
|
|
3
|
-
import { Stream as StreamData, CreateStreamParams, WithdrawStreamParams, TopupStreamParams, CancelStreamParams, TransferStreamParams, ClusterExtended, GetStreamParams, GetStreamsParams, CreateStreamResponse, TransactionResponse } from "./types";
|
|
1
|
+
import { Stream as StreamData, CreateStreamParams, WithdrawStreamParams, TopupStreamParams, CancelStreamParams, TransferStreamParams, GetStreamParams, GetStreamsParams, CreateStreamResponse, TransactionResponse } from "./types";
|
|
4
2
|
export default class Stream {
|
|
5
|
-
private connection;
|
|
6
|
-
private cluster;
|
|
7
|
-
private programId;
|
|
8
|
-
private commitment;
|
|
9
|
-
/**
|
|
10
|
-
* Create Stream instance
|
|
11
|
-
*/
|
|
12
|
-
constructor(clusterUrl: string, cluster?: ClusterExtended, commitment?: Commitment | ConnectionConfig);
|
|
13
|
-
getConnection(): web3.Connection;
|
|
14
3
|
/**
|
|
15
4
|
* Creates a new stream/vesting contract.
|
|
16
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).
|
|
17
6
|
* @param {CreateStreamParams} data
|
|
7
|
+
* @param {Connection} data.connection - A connection to the cluster.
|
|
18
8
|
* @param {Wallet} data.sender - Wallet signing the transaction. Its address should match the authorized wallet (sender) or transaction will fail.
|
|
19
9
|
* @param {string} data.recipient - Solana address of the recipient. Associated token account will be derived using this address and token mint address.
|
|
20
10
|
* @param {string} data.mint - SPL Token mint.
|
|
21
11
|
* @param {number} data.start - Timestamp (in seconds) when the stream/token vesting starts.
|
|
22
|
-
* @param {
|
|
12
|
+
* @param {BN} data.depositedAmount - Initially deposited amount of tokens (in the smallest units).
|
|
23
13
|
* @param {number} data.period - Time step (period) in seconds per which the unlocking occurs.
|
|
24
14
|
* @param {number} data.cliff - Vesting contract "cliff" timestamp in seconds.
|
|
25
|
-
* @param {
|
|
26
|
-
* @param {
|
|
15
|
+
* @param {BN} data.cliffAmount - Amount unlocked at the "cliff".
|
|
16
|
+
* @param {BN} data.amountPerPeriod - Amount unlocked per each period.
|
|
27
17
|
* @param {string} data.name - Stream name/subject.
|
|
28
18
|
* @param {boolean} data.canTopup - TRUE for streams, FALSE for vesting contracts.
|
|
29
19
|
* @param {boolean} data.cancelableBySender - Whether or not sender can cancel the stream.
|
|
30
20
|
* @param {boolean} data.cancelableByRecipient - Whether or not recipient can cancel the stream.
|
|
31
21
|
* @param {boolean} data.transferableBySender - Whether or not sender can transfer the stream.
|
|
32
22
|
* @param {boolean} data.transferableByRecipient - Whether or not recipient can transfer the stream.
|
|
33
|
-
* @param {boolean} data.automaticWithdrawal - Whether or not a 3rd party can initiate withdraw in the name of recipient.
|
|
34
|
-
* @param {
|
|
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} [data.partner = STREAMFLOW_TREASURY] - Partner's wallet address (optional).
|
|
26
|
+
* @param {ClusterExtended} [data.cluster = Cluster.Mainnet] - Cluster: devnet, mainnet-beta, testnet or local (optional).
|
|
35
27
|
*/
|
|
36
|
-
create({ sender, recipient, mint, start, depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, partner, }: CreateStreamParams): Promise<CreateStreamResponse>;
|
|
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>;
|
|
37
29
|
/**
|
|
38
30
|
* Attempts withdrawal from the specified stream.
|
|
39
31
|
* @param {WithdrawStreamParams} data
|
|
32
|
+
* @param {Connection} data.connection - A connection to the cluster.
|
|
40
33
|
* @param {Wallet} data.invoker - Wallet signing the transaction. It's address should match authorized wallet (recipient) or transaction will fail.
|
|
41
34
|
* @param {string} data.id - Identifier of a stream (escrow account with metadata) to be withdrawn from.
|
|
42
|
-
* @param {
|
|
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).
|
|
43
37
|
*/
|
|
44
|
-
withdraw({ invoker, id, amount, }: WithdrawStreamParams): Promise<TransactionResponse>;
|
|
38
|
+
static withdraw({ connection, invoker, id, amount, cluster, }: WithdrawStreamParams): Promise<TransactionResponse>;
|
|
45
39
|
/**
|
|
46
40
|
* Attempts canceling the specified stream.
|
|
47
41
|
* @param {CancelStreamParams} data
|
|
42
|
+
* @param {Connection} data.connection - A connection to the cluster.
|
|
48
43
|
* @param {Wallet} data.invoker - Wallet signing the transaction. It's address should match authorized wallet (sender or recipient) or transaction will fail.
|
|
49
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).
|
|
50
46
|
*/
|
|
51
|
-
cancel({ invoker, id, }: CancelStreamParams): Promise<TransactionResponse>;
|
|
47
|
+
static cancel({ connection, invoker, id, cluster, }: CancelStreamParams): Promise<TransactionResponse>;
|
|
52
48
|
/**
|
|
53
49
|
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
54
50
|
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
55
51
|
* @param {TransferStreamParams} data
|
|
52
|
+
* @param {Connection} data.connection - A connection to the cluster.
|
|
56
53
|
* @param {Wallet} data.invoker - Wallet signing the transaction. It's address should match authorized wallet (sender or recipient) or transaction will fail.
|
|
57
54
|
* @param {string} data.id - Identifier of a stream (escrow account with metadata) to be transferred.
|
|
58
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).
|
|
59
57
|
*/
|
|
60
|
-
transfer({ invoker, id, recipientId, }: TransferStreamParams): Promise<TransactionResponse>;
|
|
58
|
+
static transfer({ connection, invoker, id, recipientId, cluster, }: TransferStreamParams): Promise<TransactionResponse>;
|
|
61
59
|
/**
|
|
62
60
|
* Tops up stream account deposited amount.
|
|
63
61
|
* @param {TopupStreamParams} data
|
|
62
|
+
* @param {Connection} data.connection - A connection to the cluster.
|
|
64
63
|
* @param {Wallet} data.invoker - Wallet signing the transaction. It's address should match current stream sender or transaction will fail.
|
|
65
64
|
* @param {string} data.id - Identifier of a stream (escrow account with metadata) to be topped up.
|
|
66
|
-
* @param {
|
|
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
67
|
*/
|
|
68
|
-
topup({ invoker, id, amount, }: TopupStreamParams): Promise<TransactionResponse>;
|
|
68
|
+
static topup({ connection, invoker, id, amount, cluster, }: TopupStreamParams): Promise<TransactionResponse>;
|
|
69
69
|
/**
|
|
70
70
|
* Fetch stream data by its id (address).
|
|
71
71
|
* @param {GetStreamParams} data
|
|
72
72
|
* @param {Connection} data.connection - A connection to the cluster.
|
|
73
73
|
* @param {string} data.id - Identifier of a stream that is fetched.
|
|
74
74
|
*/
|
|
75
|
-
getOne({ id }: GetStreamParams): Promise<StreamData>;
|
|
75
|
+
static getOne({ connection, id, }: GetStreamParams): Promise<StreamData>;
|
|
76
76
|
/**
|
|
77
77
|
* Fetch streams/contracts by providing direction.
|
|
78
78
|
* Streams are sorted by start time in ascending order.
|
|
79
79
|
* @param {GetStreamsParams} data
|
|
80
|
+
* @param {Connection} data.connection - A connection to the cluster.
|
|
80
81
|
* @param {PublicKey} data.wallet - PublicKey of the wallet for which the streams/contracts are fetched.
|
|
81
82
|
* @param {StreamType} [data.type = StreamType.All] - It can be one of: stream, vesting, all.
|
|
82
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).
|
|
83
85
|
*/
|
|
84
|
-
get({ wallet, type, direction, }: GetStreamsParams): Promise<[string, StreamData][]>;
|
|
86
|
+
static get({ connection, wallet, type, direction, cluster, }: GetStreamsParams): Promise<[string, StreamData][]>;
|
|
85
87
|
}
|