@streamflow/stream 4.0.2 → 4.1.0-beta.0

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,224 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = [
4
+ {
5
+ constant: true,
6
+ inputs: [],
7
+ name: "name",
8
+ outputs: [
9
+ {
10
+ name: "",
11
+ type: "string",
12
+ },
13
+ ],
14
+ payable: false,
15
+ stateMutability: "view",
16
+ type: "function",
17
+ },
18
+ {
19
+ constant: false,
20
+ inputs: [
21
+ {
22
+ name: "_spender",
23
+ type: "address",
24
+ },
25
+ {
26
+ name: "_value",
27
+ type: "uint256",
28
+ },
29
+ ],
30
+ name: "approve",
31
+ outputs: [
32
+ {
33
+ name: "",
34
+ type: "bool",
35
+ },
36
+ ],
37
+ payable: false,
38
+ stateMutability: "nonpayable",
39
+ type: "function",
40
+ },
41
+ {
42
+ constant: true,
43
+ inputs: [],
44
+ name: "totalSupply",
45
+ outputs: [
46
+ {
47
+ name: "",
48
+ type: "uint256",
49
+ },
50
+ ],
51
+ payable: false,
52
+ stateMutability: "view",
53
+ type: "function",
54
+ },
55
+ {
56
+ constant: false,
57
+ inputs: [
58
+ {
59
+ name: "_from",
60
+ type: "address",
61
+ },
62
+ {
63
+ name: "_to",
64
+ type: "address",
65
+ },
66
+ {
67
+ name: "_value",
68
+ type: "uint256",
69
+ },
70
+ ],
71
+ name: "transferFrom",
72
+ outputs: [
73
+ {
74
+ name: "",
75
+ type: "bool",
76
+ },
77
+ ],
78
+ payable: false,
79
+ stateMutability: "nonpayable",
80
+ type: "function",
81
+ },
82
+ {
83
+ constant: true,
84
+ inputs: [],
85
+ name: "decimals",
86
+ outputs: [
87
+ {
88
+ name: "",
89
+ type: "uint8",
90
+ },
91
+ ],
92
+ payable: false,
93
+ stateMutability: "view",
94
+ type: "function",
95
+ },
96
+ {
97
+ constant: true,
98
+ inputs: [
99
+ {
100
+ name: "_owner",
101
+ type: "address",
102
+ },
103
+ ],
104
+ name: "balanceOf",
105
+ outputs: [
106
+ {
107
+ name: "balance",
108
+ type: "uint256",
109
+ },
110
+ ],
111
+ payable: false,
112
+ stateMutability: "view",
113
+ type: "function",
114
+ },
115
+ {
116
+ constant: true,
117
+ inputs: [],
118
+ name: "symbol",
119
+ outputs: [
120
+ {
121
+ name: "",
122
+ type: "string",
123
+ },
124
+ ],
125
+ payable: false,
126
+ stateMutability: "view",
127
+ type: "function",
128
+ },
129
+ {
130
+ constant: false,
131
+ inputs: [
132
+ {
133
+ name: "_to",
134
+ type: "address",
135
+ },
136
+ {
137
+ name: "_value",
138
+ type: "uint256",
139
+ },
140
+ ],
141
+ name: "transfer",
142
+ outputs: [
143
+ {
144
+ name: "",
145
+ type: "bool",
146
+ },
147
+ ],
148
+ payable: false,
149
+ stateMutability: "nonpayable",
150
+ type: "function",
151
+ },
152
+ {
153
+ constant: true,
154
+ inputs: [
155
+ {
156
+ name: "_owner",
157
+ type: "address",
158
+ },
159
+ {
160
+ name: "_spender",
161
+ type: "address",
162
+ },
163
+ ],
164
+ name: "allowance",
165
+ outputs: [
166
+ {
167
+ name: "",
168
+ type: "uint256",
169
+ },
170
+ ],
171
+ payable: false,
172
+ stateMutability: "view",
173
+ type: "function",
174
+ },
175
+ {
176
+ payable: true,
177
+ stateMutability: "payable",
178
+ type: "fallback",
179
+ },
180
+ {
181
+ anonymous: false,
182
+ inputs: [
183
+ {
184
+ indexed: true,
185
+ name: "owner",
186
+ type: "address",
187
+ },
188
+ {
189
+ indexed: true,
190
+ name: "spender",
191
+ type: "address",
192
+ },
193
+ {
194
+ indexed: false,
195
+ name: "value",
196
+ type: "uint256",
197
+ },
198
+ ],
199
+ name: "Approval",
200
+ type: "event",
201
+ },
202
+ {
203
+ anonymous: false,
204
+ inputs: [
205
+ {
206
+ indexed: true,
207
+ name: "from",
208
+ type: "address",
209
+ },
210
+ {
211
+ indexed: true,
212
+ name: "to",
213
+ type: "address",
214
+ },
215
+ {
216
+ indexed: false,
217
+ name: "value",
218
+ type: "uint256",
219
+ },
220
+ ],
221
+ name: "Transfer",
222
+ type: "event",
223
+ },
224
+ ];
@@ -0,0 +1,2 @@
1
+ export { default, default as EvmStreamClient } from "./StreamClient";
2
+ export * from "./types";
@@ -0,0 +1,24 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.EvmStreamClient = exports.default = void 0;
21
+ var StreamClient_1 = require("./StreamClient");
22
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(StreamClient_1).default; } });
23
+ Object.defineProperty(exports, "EvmStreamClient", { enumerable: true, get: function () { return __importDefault(StreamClient_1).default; } });
24
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,122 @@
1
+ import BN from "bn.js";
2
+ import { BigNumber } from "ethers";
3
+ export interface StreamAbiResult {
4
+ amount: BigNumber;
5
+ amount_per_period: BigNumber;
6
+ canceled_at: BigNumber;
7
+ cliff_amount: BigNumber;
8
+ closed: boolean;
9
+ created: BigNumber;
10
+ current_pause_start: BigNumber;
11
+ end: BigNumber;
12
+ fees: {
13
+ streamflow_fee_percentage: BigNumber;
14
+ streamflow_fee: BigNumber;
15
+ streamflow_fee_withdrawn: BigNumber;
16
+ tx_fee: BigNumber;
17
+ };
18
+ funds_unlocked_at_last_rate_change: BigNumber;
19
+ last_rate_change_time: BigNumber;
20
+ last_withdrawn_at: BigNumber;
21
+ meta: {
22
+ automatic_withdrawal: boolean;
23
+ can_topup: boolean;
24
+ can_update_rate: boolean;
25
+ cancelable_by_recipient: boolean;
26
+ cancelable_by_sender: boolean;
27
+ contract_name: string;
28
+ pausable: boolean;
29
+ transferable_by_recipient: boolean;
30
+ transferable_by_sender: boolean;
31
+ withdrawal_frequency: BigNumber;
32
+ };
33
+ pause_cumulative: BigNumber;
34
+ period: BigNumber;
35
+ recipient: string;
36
+ sender: string;
37
+ start: BigNumber;
38
+ token: string;
39
+ withdrawn: BigNumber;
40
+ }
41
+ export interface Stream {
42
+ magic: number;
43
+ version: number;
44
+ createdAt: number;
45
+ withdrawnAmount: BN;
46
+ canceledAt: number;
47
+ end: number;
48
+ lastWithdrawnAt: number;
49
+ sender: string;
50
+ senderTokens: string;
51
+ recipient: string;
52
+ recipientTokens: string;
53
+ mint: string;
54
+ escrowTokens: string;
55
+ streamflowTreasury: string;
56
+ streamflowTreasuryTokens: string;
57
+ streamflowFeeTotal: BN;
58
+ streamflowFeeWithdrawn: BN;
59
+ streamflowFeePercent: number;
60
+ partnerFeeTotal: BN;
61
+ partnerFeeWithdrawn: BN;
62
+ partnerFeePercent: number;
63
+ partner: string;
64
+ partnerTokens: string;
65
+ start: number;
66
+ depositedAmount: BN;
67
+ period: number;
68
+ amountPerPeriod: BN;
69
+ cliff: number;
70
+ cliffAmount: BN;
71
+ cancelableBySender: boolean;
72
+ cancelableByRecipient: boolean;
73
+ automaticWithdrawal: boolean;
74
+ transferableBySender: boolean;
75
+ transferableByRecipient: boolean;
76
+ canTopup: boolean;
77
+ name: string;
78
+ withdrawalFrequency: number;
79
+ unlocked(currentTimestamp: number, decimals: number): number;
80
+ }
81
+ export declare class EvmContract implements Stream {
82
+ magic: number;
83
+ version: number;
84
+ createdAt: number;
85
+ withdrawnAmount: BN;
86
+ canceledAt: number;
87
+ end: number;
88
+ lastWithdrawnAt: number;
89
+ sender: string;
90
+ senderTokens: string;
91
+ recipient: string;
92
+ recipientTokens: string;
93
+ mint: string;
94
+ escrowTokens: string;
95
+ streamflowTreasury: string;
96
+ streamflowTreasuryTokens: string;
97
+ streamflowFeeTotal: BN;
98
+ streamflowFeeWithdrawn: BN;
99
+ streamflowFeePercent: number;
100
+ partnerFeeTotal: BN;
101
+ partnerFeeWithdrawn: BN;
102
+ partnerFeePercent: number;
103
+ partner: string;
104
+ partnerTokens: string;
105
+ start: number;
106
+ depositedAmount: BN;
107
+ period: number;
108
+ amountPerPeriod: BN;
109
+ cliff: number;
110
+ cliffAmount: BN;
111
+ cancelableBySender: boolean;
112
+ cancelableByRecipient: boolean;
113
+ automaticWithdrawal: boolean;
114
+ transferableBySender: boolean;
115
+ transferableByRecipient: boolean;
116
+ canTopup: boolean;
117
+ name: string;
118
+ withdrawalFrequency: number;
119
+ constructor(stream: StreamAbiResult);
120
+ unlocked(currentTimestamp: number, decimals: number): number;
121
+ remaining(decimals: number): number;
122
+ }
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.EvmContract = void 0;
7
+ var bn_js_1 = __importDefault(require("bn.js"));
8
+ var utils_1 = require("../common/utils");
9
+ var EvmContract = /** @class */ (function () {
10
+ function EvmContract(stream) {
11
+ this.magic = 0;
12
+ this.version = 0;
13
+ this.createdAt = stream.created.toNumber();
14
+ this.withdrawnAmount = new bn_js_1.default(stream.withdrawn.toString());
15
+ this.canceledAt = stream.canceled_at.toNumber();
16
+ this.end = stream.end.toNumber();
17
+ this.lastWithdrawnAt = stream.last_withdrawn_at.toNumber();
18
+ this.sender = stream.sender;
19
+ this.senderTokens = stream.sender;
20
+ this.recipient = stream.recipient;
21
+ this.recipientTokens = stream.recipient;
22
+ this.mint = stream.token.toLowerCase();
23
+ this.escrowTokens = "";
24
+ this.streamflowTreasury = "";
25
+ this.streamflowTreasuryTokens = "";
26
+ this.streamflowFeeTotal = new bn_js_1.default(stream.fees.streamflow_fee.toString());
27
+ this.streamflowFeeWithdrawn = new bn_js_1.default(stream.fees.streamflow_fee_withdrawn.toString());
28
+ this.streamflowFeePercent = stream.fees.streamflow_fee_percentage.toNumber() / 10000;
29
+ this.partnerFeeTotal = new bn_js_1.default(0);
30
+ this.partnerFeeWithdrawn = new bn_js_1.default(0);
31
+ this.partnerFeePercent = 0;
32
+ this.partner = "";
33
+ this.partnerTokens = "";
34
+ this.start = stream.start.toNumber();
35
+ this.depositedAmount = new bn_js_1.default(stream.amount.toString());
36
+ this.period = stream.period.toNumber();
37
+ this.amountPerPeriod = new bn_js_1.default(stream.amount_per_period.toString());
38
+ this.cliff = stream.start.toNumber();
39
+ this.cliffAmount = new bn_js_1.default(stream.cliff_amount.toString());
40
+ this.cancelableBySender = stream.meta.cancelable_by_sender;
41
+ this.cancelableByRecipient = stream.meta.cancelable_by_recipient;
42
+ this.automaticWithdrawal = stream.meta.automatic_withdrawal;
43
+ this.transferableBySender = stream.meta.transferable_by_sender;
44
+ this.transferableByRecipient = stream.meta.transferable_by_recipient;
45
+ this.canTopup = stream.meta.can_topup;
46
+ this.name = stream.meta.contract_name;
47
+ this.withdrawalFrequency = stream.meta.withdrawal_frequency.toNumber();
48
+ }
49
+ EvmContract.prototype.unlocked = function (currentTimestamp, decimals) {
50
+ var deposited = (0, utils_1.getNumberFromBN)(this.depositedAmount, decimals);
51
+ if (currentTimestamp < this.cliff)
52
+ return 0;
53
+ if (currentTimestamp > this.end)
54
+ return deposited;
55
+ var streamedBN = this.cliffAmount.add(new bn_js_1.default(Math.floor((currentTimestamp - this.cliff) / this.period)).mul(this.amountPerPeriod));
56
+ var streamed = (0, utils_1.getNumberFromBN)(streamedBN, decimals);
57
+ return streamed < deposited ? streamed : deposited;
58
+ };
59
+ EvmContract.prototype.remaining = function (decimals) {
60
+ return (0, utils_1.getNumberFromBN)(this.depositedAmount.sub(this.withdrawnAmount), decimals);
61
+ };
62
+ return EvmContract;
63
+ }());
64
+ exports.EvmContract = EvmContract;
@@ -1,6 +1,6 @@
1
1
  import { Connection, Commitment, ConnectionConfig } from "@solana/web3.js";
2
- import { Stream as StreamData, GetAllParams, CreateResponse, CreateMultiResponse, TxResponse, ICreateStreamSolanaExt, IInteractStreamSolanaExt, ITopUpStreamSolanaExt } from "./types";
3
- import { ICancelData, ICluster, ICreateMultipleStreamData, ICreateStreamData, IGetOneData, ITopUpData, ITransferData, IUpdateData, IWithdrawData } from "../common/types";
2
+ import { Stream as StreamData, ICreateStreamSolanaExt, IInteractStreamSolanaExt, ITopUpStreamSolanaExt } from "./types";
3
+ import { ICancelData, ICluster, ICreateMultipleStreamData, ICreateResult, ICreateStreamData, IGetAllData, IGetOneData, IMultiTransactionResult, ITopUpData, ITransactionResult, ITransferData, IUpdateData, IWithdrawData } from "../common/types";
4
4
  import { BaseStreamClient } from "../common/BaseStreamClient";
5
5
  export default class SolanaStreamClient extends BaseStreamClient {
6
6
  private connection;
@@ -16,7 +16,7 @@ export default class SolanaStreamClient extends BaseStreamClient {
16
16
  * Creates a new stream/vesting contract.
17
17
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
18
18
  */
19
- create({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, }: ICreateStreamData, { sender, partner, isNative }: ICreateStreamSolanaExt): Promise<CreateResponse>;
19
+ create({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, }: ICreateStreamData, { sender, partner, isNative }: ICreateStreamSolanaExt): Promise<ICreateResult>;
20
20
  /**
21
21
  * Creates a new stream/vesting contract using unchecked instruction.
22
22
  *
@@ -27,29 +27,29 @@ export default class SolanaStreamClient extends BaseStreamClient {
27
27
  *
28
28
  * If you are not sure if you should use create or create_unchecked, go for create to be safer.
29
29
  */
30
- createUnchecked({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, }: ICreateStreamData, { sender, partner, isNative }: ICreateStreamSolanaExt): Promise<CreateResponse>;
30
+ createUnchecked({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, }: ICreateStreamData, { sender, partner, isNative }: ICreateStreamSolanaExt): Promise<ICreateResult>;
31
31
  /**
32
32
  * Creates multiple stream/vesting contracts.
33
33
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
34
34
  */
35
- createMultiple(data: ICreateMultipleStreamData, { sender, partner, isNative }: ICreateStreamSolanaExt): Promise<CreateMultiResponse>;
35
+ createMultiple(data: ICreateMultipleStreamData, { sender, partner, isNative }: ICreateStreamSolanaExt): Promise<IMultiTransactionResult>;
36
36
  /**
37
37
  * Attempts withdrawing from the specified stream.
38
38
  */
39
- withdraw({ id, amount }: IWithdrawData, { invoker }: IInteractStreamSolanaExt): Promise<TxResponse>;
39
+ withdraw({ id, amount }: IWithdrawData, { invoker }: IInteractStreamSolanaExt): Promise<ITransactionResult>;
40
40
  /**
41
41
  * Attempts canceling the specified stream.
42
42
  */
43
- cancel({ id }: ICancelData, { invoker }: IInteractStreamSolanaExt): Promise<TxResponse>;
43
+ cancel({ id }: ICancelData, { invoker }: IInteractStreamSolanaExt): Promise<ITransactionResult>;
44
44
  /**
45
45
  * Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
46
46
  * Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
47
47
  */
48
- transfer({ id, newRecipient: newRecipientString }: ITransferData, { invoker }: IInteractStreamSolanaExt): Promise<TxResponse>;
48
+ transfer({ id, newRecipient: newRecipientString }: ITransferData, { invoker }: IInteractStreamSolanaExt): Promise<ITransactionResult>;
49
49
  /**
50
50
  * Tops up stream account with specified amount.
51
51
  */
52
- topup({ id, amount }: ITopUpData, { invoker, isNative }: ITopUpStreamSolanaExt): Promise<TxResponse>;
52
+ topup({ id, amount }: ITopUpData, { invoker, isNative }: ITopUpStreamSolanaExt): Promise<ITransactionResult>;
53
53
  /**
54
54
  * Fetch stream data by its id (address).
55
55
  */
@@ -58,12 +58,12 @@ export default class SolanaStreamClient extends BaseStreamClient {
58
58
  * Fetch streams/contracts by providing direction.
59
59
  * Streams are sorted by start time in ascending order.
60
60
  */
61
- get({ wallet, type, direction, }: GetAllParams): Promise<[string, StreamData][]>;
61
+ get({ address, type, direction, }: IGetAllData): Promise<[string, StreamData][]>;
62
62
  private sign;
63
63
  /**
64
64
  * Attempts updating the stream auto withdrawal params and amount per period
65
65
  */
66
- update(data: IUpdateData, { invoker }: IInteractStreamSolanaExt): Promise<TxResponse>;
66
+ update(data: IUpdateData, { invoker }: IInteractStreamSolanaExt): Promise<ITransactionResult>;
67
67
  /**
68
68
  * Forms instructions from params, creates a raw transaction and fetch recent blockhash.
69
69
  */
@@ -230,7 +230,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
230
230
  return [4 /*yield*/, this.sign(sender, tx, hash)];
231
231
  case 10:
232
232
  signature = _k.sent();
233
- return [2 /*return*/, { ixs: ixs, tx: signature, metadata: metadata }];
233
+ return [2 /*return*/, { ixs: ixs, txId: signature, metadataId: metadata.publicKey.toBase58() }];
234
234
  }
235
235
  });
236
236
  });
@@ -331,7 +331,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
331
331
  return [4 /*yield*/, this.sign(sender, tx, hash)];
332
332
  case 8:
333
333
  signature = _k.sent();
334
- return [2 /*return*/, { ixs: ixs, tx: signature, metadata: metadata }];
334
+ return [2 /*return*/, { ixs: ixs, txId: signature, metadataId: metadata.publicKey.toBase58() }];
335
335
  }
336
336
  });
337
337
  });
@@ -343,7 +343,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
343
343
  SolanaStreamClient.prototype.createMultiple = function (data, _a) {
344
344
  var sender = _a.sender, _b = _a.partner, partner = _b === void 0 ? null : _b, _c = _a.isNative, isNative = _c === void 0 ? false : _c;
345
345
  return __awaiter(this, void 0, void 0, function () {
346
- var recipients, metadatas, metadataToRecipient, errors, signatures, batch, recipients_1, recipients_1_1, recipientData, _d, tx, metadata, metadataPubKey, e_1_1, totalDepositedAmount, nativeInstructions, commitment, hash, prepareTransaction, signed_batch, prepareTx, batchTransactionsCalls, responses, successes, failures;
346
+ var recipients, metadatas, metadataToRecipient, errors, signatures, batch, recipients_1, recipients_1_1, recipientData, _d, tx, metadata, metadataPubKey, e_1_1, totalDepositedAmount, nativeInstructions, commitment, hash, prepareTransaction, signedBatch, prepareTx, batchTransactionsCalls, responses, successes, failures, metadataIds;
347
347
  var e_1, _e, _f;
348
348
  var _this = this;
349
349
  return __generator(this, function (_g) {
@@ -410,15 +410,18 @@ var SolanaStreamClient = /** @class */ (function (_super) {
410
410
  _g.label = 11;
411
411
  case 11: return [4 /*yield*/, (0, utils_1.signAllTransactionWithRecipients)(sender, batch)];
412
412
  case 12:
413
- signed_batch = _g.sent();
413
+ signedBatch = _g.sent();
414
+ signedBatch.forEach(function (item, index) {
415
+ item.tx.lastValidBlockHeight = batch[index].tx.lastValidBlockHeight;
416
+ });
414
417
  if (!isNative) return [3 /*break*/, 14];
415
- prepareTx = signed_batch.pop();
418
+ prepareTx = signedBatch.pop();
416
419
  return [4 /*yield*/, (0, utils_1.sendAndConfirmStreamRawTransaction)(this.connection, prepareTx)];
417
420
  case 13:
418
421
  _g.sent();
419
422
  _g.label = 14;
420
423
  case 14:
421
- batchTransactionsCalls = signed_batch.map(function (el) {
424
+ batchTransactionsCalls = signedBatch.map(function (el) {
422
425
  return (0, utils_1.sendAndConfirmStreamRawTransaction)(_this.connection, el);
423
426
  });
424
427
  return [4 /*yield*/, Promise.allSettled(batchTransactionsCalls)];
@@ -432,7 +435,8 @@ var SolanaStreamClient = /** @class */ (function (_super) {
432
435
  .filter(function (el) { return el.status === "rejected"; })
433
436
  .map(function (el) { return el.reason; });
434
437
  errors.push.apply(errors, __spreadArray([], __read(failures), false));
435
- return [2 /*return*/, { txs: signatures, metadatas: metadatas, metadataToRecipient: metadataToRecipient, errors: errors }];
438
+ metadataIds = metadatas.map(function (pk) { return pk.publicKey.toBase58(); });
439
+ return [2 /*return*/, { txs: signatures, metadatas: metadataIds, metadataToRecipient: metadataToRecipient, errors: errors }];
436
440
  }
437
441
  });
438
442
  });
@@ -492,7 +496,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
492
496
  return [4 /*yield*/, this.sign(invoker, tx, hash)];
493
497
  case 5:
494
498
  signature = _d.sent();
495
- return [2 /*return*/, { ixs: ixs, tx: signature }];
499
+ return [2 /*return*/, { ixs: ixs, txId: signature }];
496
500
  }
497
501
  });
498
502
  });
@@ -504,7 +508,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
504
508
  var id = _a.id;
505
509
  var invoker = _b.invoker;
506
510
  return __awaiter(this, void 0, void 0, function () {
507
- var streamPublicKey, escrow_acc, data, streamflowTreasuryTokens, partnerTokens, ixs, commitment, hash, tx, signature;
511
+ var streamPublicKey, escrowAcc, data, streamflowTreasuryTokens, partnerTokens, ixs, commitment, hash, tx, signature;
508
512
  var _c;
509
513
  return __generator(this, function (_d) {
510
514
  switch (_d.label) {
@@ -515,11 +519,11 @@ var SolanaStreamClient = /** @class */ (function (_super) {
515
519
  streamPublicKey = new web3_js_1.PublicKey(id);
516
520
  return [4 /*yield*/, this.connection.getAccountInfo(streamPublicKey)];
517
521
  case 1:
518
- escrow_acc = _d.sent();
519
- if (!(escrow_acc === null || escrow_acc === void 0 ? void 0 : escrow_acc.data)) {
522
+ escrowAcc = _d.sent();
523
+ if (!(escrowAcc === null || escrowAcc === void 0 ? void 0 : escrowAcc.data)) {
520
524
  throw new Error("Couldn't get account info");
521
525
  }
522
- data = (0, utils_1.decodeStream)(escrow_acc === null || escrow_acc === void 0 ? void 0 : escrow_acc.data);
526
+ data = (0, utils_1.decodeStream)(escrowAcc === null || escrowAcc === void 0 ? void 0 : escrowAcc.data);
523
527
  return [4 /*yield*/, (0, utils_1.ata)(data.mint, constants_1.STREAMFLOW_TREASURY_PUBLIC_KEY)];
524
528
  case 2:
525
529
  streamflowTreasuryTokens = _d.sent();
@@ -554,7 +558,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
554
558
  return [4 /*yield*/, this.sign(invoker, tx, hash)];
555
559
  case 5:
556
560
  signature = _d.sent();
557
- return [2 /*return*/, { ixs: ixs, tx: signature }];
561
+ return [2 /*return*/, { ixs: ixs, txId: signature }];
558
562
  }
559
563
  });
560
564
  });
@@ -611,7 +615,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
611
615
  return [4 /*yield*/, this.sign(invoker, tx, hash)];
612
616
  case 4:
613
617
  signature = _d.sent();
614
- return [2 /*return*/, { ixs: ixs, tx: signature }];
618
+ return [2 /*return*/, { ixs: ixs, txId: signature }];
615
619
  }
616
620
  });
617
621
  });
@@ -682,7 +686,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
682
686
  return [4 /*yield*/, this.sign(invoker, tx, hash)];
683
687
  case 8:
684
688
  signature = _f.sent();
685
- return [2 /*return*/, { ixs: ixs, tx: signature }];
689
+ return [2 /*return*/, { ixs: ixs, txId: signature }];
686
690
  }
687
691
  });
688
692
  });
@@ -712,25 +716,26 @@ var SolanaStreamClient = /** @class */ (function (_super) {
712
716
  * Streams are sorted by start time in ascending order.
713
717
  */
714
718
  SolanaStreamClient.prototype.get = function (_a) {
715
- var wallet = _a.wallet, _b = _a.type, type = _b === void 0 ? types_2.StreamType.All : _b, _c = _a.direction, direction = _c === void 0 ? types_2.StreamDirection.All : _c;
719
+ var address = _a.address, _b = _a.type, type = _b === void 0 ? types_2.StreamType.All : _b, _c = _a.direction, direction = _c === void 0 ? types_2.StreamDirection.All : _c;
716
720
  return __awaiter(this, void 0, void 0, function () {
717
- var accounts, outgoingAccounts, incomingAccounts, offset, streams, sortedStreams;
721
+ var publicKey, accounts, outgoingAccounts, incomingAccounts, offset, streams, sortedStreams;
718
722
  return __generator(this, function (_d) {
719
723
  switch (_d.label) {
720
724
  case 0:
725
+ publicKey = new web3_js_1.PublicKey(address);
721
726
  accounts = [];
722
727
  if (!(direction === "all")) return [3 /*break*/, 3];
723
- return [4 /*yield*/, (0, utils_1.getProgramAccounts)(this.connection, wallet, constants_1.STREAM_STRUCT_OFFSET_SENDER, this.programId)];
728
+ return [4 /*yield*/, (0, utils_1.getProgramAccounts)(this.connection, publicKey, constants_1.STREAM_STRUCT_OFFSET_SENDER, this.programId)];
724
729
  case 1:
725
730
  outgoingAccounts = _d.sent();
726
- return [4 /*yield*/, (0, utils_1.getProgramAccounts)(this.connection, wallet, constants_1.STREAM_STRUCT_OFFSET_RECIPIENT, this.programId)];
731
+ return [4 /*yield*/, (0, utils_1.getProgramAccounts)(this.connection, publicKey, constants_1.STREAM_STRUCT_OFFSET_RECIPIENT, this.programId)];
727
732
  case 2:
728
733
  incomingAccounts = _d.sent();
729
734
  accounts = __spreadArray(__spreadArray([], __read(outgoingAccounts), false), __read(incomingAccounts), false);
730
735
  return [3 /*break*/, 5];
731
736
  case 3:
732
737
  offset = direction === "outgoing" ? constants_1.STREAM_STRUCT_OFFSET_SENDER : constants_1.STREAM_STRUCT_OFFSET_RECIPIENT;
733
- return [4 /*yield*/, (0, utils_1.getProgramAccounts)(this.connection, wallet, offset, this.programId)];
738
+ return [4 /*yield*/, (0, utils_1.getProgramAccounts)(this.connection, publicKey, offset, this.programId)];
734
739
  case 4:
735
740
  accounts = _d.sent();
736
741
  _d.label = 5;
@@ -827,7 +832,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
827
832
  signature = _b.sent();
828
833
  return [2 /*return*/, {
829
834
  ixs: [updateIx],
830
- tx: signature,
835
+ txId: signature,
831
836
  }];
832
837
  }
833
838
  });