@streamflow/stream 10.0.0-alpha.p311.10f340e → 10.0.0-alpha.p313.18b7be3
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 +8 -64
- package/dist/cjs/index.cjs +453 -3797
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +3 -182
- package/dist/cjs/solana/index.cjs +407 -313
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +1134 -17
- package/dist/esm/index.d.ts +3 -182
- package/dist/esm/index.js +271 -3629
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +1134 -17
- package/dist/esm/solana/index.js +288 -244
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -43
- package/dist/cjs/BaseStreamClient-Dvs8yWEE.d.cts +0 -550
- package/dist/cjs/aptos/index.cjs +0 -450
- package/dist/cjs/aptos/index.cjs.map +0 -1
- package/dist/cjs/aptos/index.d.cts +0 -14
- package/dist/cjs/evm/index.cjs +0 -1909
- package/dist/cjs/evm/index.cjs.map +0 -1
- package/dist/cjs/evm/index.d.cts +0 -13
- package/dist/cjs/index-BHKWsVnx.d.cts +0 -849
- package/dist/cjs/index-CGNg22mO.d.cts +0 -203
- package/dist/cjs/index-Dk1hKzM3.d.cts +0 -213
- package/dist/cjs/index-dSxy_PVV.d.cts +0 -136
- package/dist/cjs/sui/index.cjs +0 -1015
- package/dist/cjs/sui/index.cjs.map +0 -1
- package/dist/cjs/sui/index.d.cts +0 -13
- package/dist/esm/BaseStreamClient-Dvs8yWEE.d.ts +0 -550
- package/dist/esm/aptos/index.d.ts +0 -14
- package/dist/esm/aptos/index.js +0 -437
- package/dist/esm/aptos/index.js.map +0 -1
- package/dist/esm/evm/index.d.ts +0 -13
- package/dist/esm/evm/index.js +0 -1896
- package/dist/esm/evm/index.js.map +0 -1
- package/dist/esm/index-CRXW7eZy.d.ts +0 -203
- package/dist/esm/index-CgDmuCzv.d.ts +0 -849
- package/dist/esm/index-DED7TgAo.d.ts +0 -136
- package/dist/esm/index-li6QZ_tF.d.ts +0 -213
- package/dist/esm/sui/index.d.ts +0 -13
- package/dist/esm/sui/index.js +0 -1005
- package/dist/esm/sui/index.js.map +0 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var common = require('@streamflow/common');
|
|
5
|
-
var BN7 = require('bn.js');
|
|
6
|
-
var buffer = require('buffer');
|
|
7
|
-
require('@manahippo/aptos-wallet-adapter');
|
|
8
|
-
var ethers = require('ethers');
|
|
9
|
-
var ethereumChecksumAddress = require('ethereum-checksum-address');
|
|
3
|
+
var BN3 = require('bn.js');
|
|
10
4
|
var bs58 = require('bs58');
|
|
5
|
+
var buffer = require('buffer');
|
|
11
6
|
var splToken = require('@solana/spl-token');
|
|
12
7
|
var web3_js = require('@solana/web3.js');
|
|
13
|
-
var
|
|
8
|
+
var common = require('@streamflow/common');
|
|
14
9
|
var borsh = require('borsh');
|
|
15
10
|
var anchor = require('@coral-xyz/anchor');
|
|
16
11
|
var BufferLayout = require('@solana/buffer-layout');
|
|
17
|
-
var client = require('@mysten/sui/client');
|
|
18
|
-
var transactions = require('@mysten/sui/transactions');
|
|
19
|
-
var utils = require('@mysten/sui/utils');
|
|
20
|
-
var bcs = require('@mysten/sui/bcs');
|
|
21
|
-
var cryptography = require('@mysten/sui/cryptography');
|
|
22
12
|
|
|
23
13
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
14
|
|
|
@@ -40,411 +30,13 @@ function _interopNamespace(e) {
|
|
|
40
30
|
return Object.freeze(n);
|
|
41
31
|
}
|
|
42
32
|
|
|
43
|
-
var
|
|
33
|
+
var BN3__default = /*#__PURE__*/_interopDefault(BN3);
|
|
44
34
|
var bs58__default = /*#__PURE__*/_interopDefault(bs58);
|
|
45
35
|
var borsh__namespace = /*#__PURE__*/_interopNamespace(borsh);
|
|
46
36
|
var BufferLayout__namespace = /*#__PURE__*/_interopNamespace(BufferLayout);
|
|
47
37
|
|
|
48
|
-
|
|
49
|
-
var __defProp = Object.defineProperty;
|
|
50
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
51
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
52
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
53
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
54
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
55
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
56
|
-
};
|
|
57
|
-
var __export = (target, all) => {
|
|
58
|
-
for (var name in all)
|
|
59
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
60
|
-
};
|
|
61
|
-
var __copyProps = (to, from, except, desc) => {
|
|
62
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
63
|
-
for (let key of __getOwnPropNames(from))
|
|
64
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
65
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
66
|
-
}
|
|
67
|
-
return to;
|
|
68
|
-
};
|
|
69
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
70
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
71
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
72
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
73
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
74
|
-
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
75
|
-
mod
|
|
76
|
-
));
|
|
77
|
-
|
|
78
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js
|
|
79
|
-
var require_retry_operation = __commonJS({
|
|
80
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports, module) {
|
|
81
|
-
function RetryOperation(timeouts, options) {
|
|
82
|
-
if (typeof options === "boolean") {
|
|
83
|
-
options = { forever: options };
|
|
84
|
-
}
|
|
85
|
-
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
86
|
-
this._timeouts = timeouts;
|
|
87
|
-
this._options = options || {};
|
|
88
|
-
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
89
|
-
this._fn = null;
|
|
90
|
-
this._errors = [];
|
|
91
|
-
this._attempts = 1;
|
|
92
|
-
this._operationTimeout = null;
|
|
93
|
-
this._operationTimeoutCb = null;
|
|
94
|
-
this._timeout = null;
|
|
95
|
-
this._operationStart = null;
|
|
96
|
-
this._timer = null;
|
|
97
|
-
if (this._options.forever) {
|
|
98
|
-
this._cachedTimeouts = this._timeouts.slice(0);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
module.exports = RetryOperation;
|
|
102
|
-
RetryOperation.prototype.reset = function() {
|
|
103
|
-
this._attempts = 1;
|
|
104
|
-
this._timeouts = this._originalTimeouts.slice(0);
|
|
105
|
-
};
|
|
106
|
-
RetryOperation.prototype.stop = function() {
|
|
107
|
-
if (this._timeout) {
|
|
108
|
-
clearTimeout(this._timeout);
|
|
109
|
-
}
|
|
110
|
-
if (this._timer) {
|
|
111
|
-
clearTimeout(this._timer);
|
|
112
|
-
}
|
|
113
|
-
this._timeouts = [];
|
|
114
|
-
this._cachedTimeouts = null;
|
|
115
|
-
};
|
|
116
|
-
RetryOperation.prototype.retry = function(err) {
|
|
117
|
-
if (this._timeout) {
|
|
118
|
-
clearTimeout(this._timeout);
|
|
119
|
-
}
|
|
120
|
-
if (!err) {
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
124
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
125
|
-
this._errors.push(err);
|
|
126
|
-
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
this._errors.push(err);
|
|
130
|
-
var timeout = this._timeouts.shift();
|
|
131
|
-
if (timeout === void 0) {
|
|
132
|
-
if (this._cachedTimeouts) {
|
|
133
|
-
this._errors.splice(0, this._errors.length - 1);
|
|
134
|
-
timeout = this._cachedTimeouts.slice(-1);
|
|
135
|
-
} else {
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
var self = this;
|
|
140
|
-
this._timer = setTimeout(function() {
|
|
141
|
-
self._attempts++;
|
|
142
|
-
if (self._operationTimeoutCb) {
|
|
143
|
-
self._timeout = setTimeout(function() {
|
|
144
|
-
self._operationTimeoutCb(self._attempts);
|
|
145
|
-
}, self._operationTimeout);
|
|
146
|
-
if (self._options.unref) {
|
|
147
|
-
self._timeout.unref();
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
self._fn(self._attempts);
|
|
151
|
-
}, timeout);
|
|
152
|
-
if (this._options.unref) {
|
|
153
|
-
this._timer.unref();
|
|
154
|
-
}
|
|
155
|
-
return true;
|
|
156
|
-
};
|
|
157
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
158
|
-
this._fn = fn;
|
|
159
|
-
if (timeoutOps) {
|
|
160
|
-
if (timeoutOps.timeout) {
|
|
161
|
-
this._operationTimeout = timeoutOps.timeout;
|
|
162
|
-
}
|
|
163
|
-
if (timeoutOps.cb) {
|
|
164
|
-
this._operationTimeoutCb = timeoutOps.cb;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
var self = this;
|
|
168
|
-
if (this._operationTimeoutCb) {
|
|
169
|
-
this._timeout = setTimeout(function() {
|
|
170
|
-
self._operationTimeoutCb();
|
|
171
|
-
}, self._operationTimeout);
|
|
172
|
-
}
|
|
173
|
-
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
174
|
-
this._fn(this._attempts);
|
|
175
|
-
};
|
|
176
|
-
RetryOperation.prototype.try = function(fn) {
|
|
177
|
-
console.log("Using RetryOperation.try() is deprecated");
|
|
178
|
-
this.attempt(fn);
|
|
179
|
-
};
|
|
180
|
-
RetryOperation.prototype.start = function(fn) {
|
|
181
|
-
console.log("Using RetryOperation.start() is deprecated");
|
|
182
|
-
this.attempt(fn);
|
|
183
|
-
};
|
|
184
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
185
|
-
RetryOperation.prototype.errors = function() {
|
|
186
|
-
return this._errors;
|
|
187
|
-
};
|
|
188
|
-
RetryOperation.prototype.attempts = function() {
|
|
189
|
-
return this._attempts;
|
|
190
|
-
};
|
|
191
|
-
RetryOperation.prototype.mainError = function() {
|
|
192
|
-
if (this._errors.length === 0) {
|
|
193
|
-
return null;
|
|
194
|
-
}
|
|
195
|
-
var counts = {};
|
|
196
|
-
var mainError = null;
|
|
197
|
-
var mainErrorCount = 0;
|
|
198
|
-
for (var i = 0; i < this._errors.length; i++) {
|
|
199
|
-
var error = this._errors[i];
|
|
200
|
-
var message = error.message;
|
|
201
|
-
var count = (counts[message] || 0) + 1;
|
|
202
|
-
counts[message] = count;
|
|
203
|
-
if (count >= mainErrorCount) {
|
|
204
|
-
mainError = error;
|
|
205
|
-
mainErrorCount = count;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
return mainError;
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js
|
|
214
|
-
var require_retry = __commonJS({
|
|
215
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports) {
|
|
216
|
-
var RetryOperation = require_retry_operation();
|
|
217
|
-
exports.operation = function(options) {
|
|
218
|
-
var timeouts = exports.timeouts(options);
|
|
219
|
-
return new RetryOperation(timeouts, {
|
|
220
|
-
forever: options && (options.forever || options.retries === Infinity),
|
|
221
|
-
unref: options && options.unref,
|
|
222
|
-
maxRetryTime: options && options.maxRetryTime
|
|
223
|
-
});
|
|
224
|
-
};
|
|
225
|
-
exports.timeouts = function(options) {
|
|
226
|
-
if (options instanceof Array) {
|
|
227
|
-
return [].concat(options);
|
|
228
|
-
}
|
|
229
|
-
var opts = {
|
|
230
|
-
retries: 10,
|
|
231
|
-
factor: 2,
|
|
232
|
-
minTimeout: 1 * 1e3,
|
|
233
|
-
maxTimeout: Infinity,
|
|
234
|
-
randomize: false
|
|
235
|
-
};
|
|
236
|
-
for (var key in options) {
|
|
237
|
-
opts[key] = options[key];
|
|
238
|
-
}
|
|
239
|
-
if (opts.minTimeout > opts.maxTimeout) {
|
|
240
|
-
throw new Error("minTimeout is greater than maxTimeout");
|
|
241
|
-
}
|
|
242
|
-
var timeouts = [];
|
|
243
|
-
for (var i = 0; i < opts.retries; i++) {
|
|
244
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
245
|
-
}
|
|
246
|
-
if (options && options.forever && !timeouts.length) {
|
|
247
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
248
|
-
}
|
|
249
|
-
timeouts.sort(function(a, b) {
|
|
250
|
-
return a - b;
|
|
251
|
-
});
|
|
252
|
-
return timeouts;
|
|
253
|
-
};
|
|
254
|
-
exports.createTimeout = function(attempt, opts) {
|
|
255
|
-
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
256
|
-
var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
|
|
257
|
-
timeout = Math.min(timeout, opts.maxTimeout);
|
|
258
|
-
return timeout;
|
|
259
|
-
};
|
|
260
|
-
exports.wrap = function(obj, options, methods) {
|
|
261
|
-
if (options instanceof Array) {
|
|
262
|
-
methods = options;
|
|
263
|
-
options = null;
|
|
264
|
-
}
|
|
265
|
-
if (!methods) {
|
|
266
|
-
methods = [];
|
|
267
|
-
for (var key in obj) {
|
|
268
|
-
if (typeof obj[key] === "function") {
|
|
269
|
-
methods.push(key);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
for (var i = 0; i < methods.length; i++) {
|
|
274
|
-
var method = methods[i];
|
|
275
|
-
var original = obj[method];
|
|
276
|
-
obj[method] = function retryWrapper(original2) {
|
|
277
|
-
var op = exports.operation(options);
|
|
278
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
279
|
-
var callback = args.pop();
|
|
280
|
-
args.push(function(err) {
|
|
281
|
-
if (op.retry(err)) {
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
if (err) {
|
|
285
|
-
arguments[0] = op.mainError();
|
|
286
|
-
}
|
|
287
|
-
callback.apply(this, arguments);
|
|
288
|
-
});
|
|
289
|
-
op.attempt(function() {
|
|
290
|
-
original2.apply(obj, args);
|
|
291
|
-
});
|
|
292
|
-
}.bind(obj, original);
|
|
293
|
-
obj[method].options = options;
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js
|
|
300
|
-
var require_retry2 = __commonJS({
|
|
301
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports, module) {
|
|
302
|
-
module.exports = require_retry();
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
// aptos/index.ts
|
|
307
|
-
var aptos_exports = {};
|
|
308
|
-
__export(aptos_exports, {
|
|
309
|
-
AptosStreamClient: () => AptosStreamClient,
|
|
310
|
-
Contract: () => Contract,
|
|
311
|
-
constants: () => constants_exports,
|
|
312
|
-
default: () => AptosStreamClient,
|
|
313
|
-
extractAptosErrorCode: () => extractAptosErrorCode,
|
|
314
|
-
normalizeAptosAddress: () => normalizeAptosAddress
|
|
315
|
-
});
|
|
316
|
-
var StreamDirection = /* @__PURE__ */ ((StreamDirection2) => {
|
|
317
|
-
StreamDirection2["Outgoing"] = "outgoing";
|
|
318
|
-
StreamDirection2["Incoming"] = "incoming";
|
|
319
|
-
StreamDirection2["All"] = "all";
|
|
320
|
-
return StreamDirection2;
|
|
321
|
-
})(StreamDirection || {});
|
|
322
|
-
var StreamType = /* @__PURE__ */ ((StreamType2) => {
|
|
323
|
-
StreamType2["All"] = "all";
|
|
324
|
-
StreamType2["Vesting"] = "vesting";
|
|
325
|
-
StreamType2["Lock"] = "lock";
|
|
326
|
-
return StreamType2;
|
|
327
|
-
})(StreamType || {});
|
|
328
|
-
var ContractErrorCode = /* @__PURE__ */ ((ContractErrorCode2) => {
|
|
329
|
-
ContractErrorCode2["ECONTRACT_NOT_INIT"] = "ECONTRACT_NOT_INIT";
|
|
330
|
-
ContractErrorCode2["EBAD_AMOUNT"] = "EBAD_AMOUNT";
|
|
331
|
-
ContractErrorCode2["ENO_PERMISSIONS"] = "ENO_PERMISSIONS";
|
|
332
|
-
ContractErrorCode2["EBADINPUT"] = "EBADINPUT";
|
|
333
|
-
ContractErrorCode2["ECLOSED"] = "ECLOSED";
|
|
334
|
-
ContractErrorCode2["EBAD_INPUT_AMOUNT_PER_PERIOD"] = "EBAD_INPUT_AMOUNT_PER_PERIOD";
|
|
335
|
-
ContractErrorCode2["EBAD_INPUT_PAUSABLE"] = "EBAD_INPUT_PAUSABLE";
|
|
336
|
-
ContractErrorCode2["EBAD_INPUT_UPDATE_RATE"] = "EBAD_INPUT_UPDATE_RATE";
|
|
337
|
-
ContractErrorCode2["EBAD_INPUT_CLIFF_AMOUNT"] = "EBAD_INPUT_CLIFF_AMOUNT";
|
|
338
|
-
ContractErrorCode2["EBAD_INPUT_PERIOD"] = "EBAD_INPUT_PERIOD";
|
|
339
|
-
ContractErrorCode2["EBAD_INPUT_START"] = "EBAD_INPUT_START";
|
|
340
|
-
ContractErrorCode2["EBAD_INSUFFICIENT_TOKEN_ALLOWANCE"] = "EBAD_INSUFFICIENT_TOKEN_ALLOWANCE";
|
|
341
|
-
ContractErrorCode2["EBAD_INSUFFICIENT_WITHDRAWAL_FEES"] = "EBAD_INSUFFICIENT_WITHDRAWAL_FEES";
|
|
342
|
-
ContractErrorCode2["EBAD_INSUFFICIENT_AMOUNT"] = "EBAD_INSUFFICIENT_AMOUNT";
|
|
343
|
-
ContractErrorCode2["EPAUSED"] = "EPAUSED";
|
|
344
|
-
ContractErrorCode2["ENOTPAUSED"] = "ENOTPAUSED";
|
|
345
|
-
ContractErrorCode2["ENO_RECIPIENT_COIN_ADDRESS"] = "ENO_RECIPIENT_COIN_ADDRESS";
|
|
346
|
-
return ContractErrorCode2;
|
|
347
|
-
})(ContractErrorCode || {});
|
|
348
|
-
var SolanaContractErrorCode = /* @__PURE__ */ ((SolanaContractErrorCode2) => {
|
|
349
|
-
SolanaContractErrorCode2["AccountsNotWritable"] = "AccountsNotWritable";
|
|
350
|
-
SolanaContractErrorCode2["InvalidMetadata"] = "InvalidMetadata";
|
|
351
|
-
SolanaContractErrorCode2["InvalidMetadataAccount"] = "InvalidMetadataAccount";
|
|
352
|
-
SolanaContractErrorCode2["MetadataAccountMismatch"] = "MetadataAccountMismatch";
|
|
353
|
-
SolanaContractErrorCode2["InvalidEscrowAccount"] = "InvalidEscrowAccount";
|
|
354
|
-
SolanaContractErrorCode2["NotAssociated"] = "NotAssociated";
|
|
355
|
-
SolanaContractErrorCode2["MintMismatch"] = "MintMismatch";
|
|
356
|
-
SolanaContractErrorCode2["TransferNotAllowed"] = "TransferNotAllowed";
|
|
357
|
-
SolanaContractErrorCode2["ContractClosed"] = "ContractClosed";
|
|
358
|
-
SolanaContractErrorCode2["InvalidTreasury"] = "InvalidTreasury";
|
|
359
|
-
SolanaContractErrorCode2["InvalidTimestamps"] = "InvalidTimestamps";
|
|
360
|
-
SolanaContractErrorCode2["InvalidDepositConfiguration"] = "InvalidDepositConfiguration";
|
|
361
|
-
SolanaContractErrorCode2["AmountIsZero"] = "AmountIsZero";
|
|
362
|
-
SolanaContractErrorCode2["AmountMoreThanAvailable"] = "AmountMoreThanAvailable";
|
|
363
|
-
SolanaContractErrorCode2["AmountAvailableIsZero"] = "AmountAvailableIsZero";
|
|
364
|
-
SolanaContractErrorCode2["ArithmeticError"] = "ArithmeticError";
|
|
365
|
-
SolanaContractErrorCode2["InvalidMetadataSize"] = "InvalidMetadataSize";
|
|
366
|
-
SolanaContractErrorCode2["UninitializedMetadata"] = "UninitializedMetadata";
|
|
367
|
-
SolanaContractErrorCode2["Unauthorized"] = "Unauthorized";
|
|
368
|
-
SolanaContractErrorCode2["SelfTransfer"] = "SelfTransfer";
|
|
369
|
-
SolanaContractErrorCode2["AlreadyPaused"] = "AlreadyPaused";
|
|
370
|
-
SolanaContractErrorCode2["NotPaused"] = "NotPaused";
|
|
371
|
-
SolanaContractErrorCode2["MetadataNotRentExempt"] = "MetadataNotRentExempt";
|
|
372
|
-
return SolanaContractErrorCode2;
|
|
373
|
-
})(SolanaContractErrorCode || {});
|
|
374
|
-
var SolanaAlignedProxyErrorCode = /* @__PURE__ */ ((SolanaAlignedProxyErrorCode2) => {
|
|
375
|
-
SolanaAlignedProxyErrorCode2["Unauthorized"] = "Unauthorized";
|
|
376
|
-
SolanaAlignedProxyErrorCode2["ArithmeticError"] = "ArithmeticError";
|
|
377
|
-
SolanaAlignedProxyErrorCode2["UnsupportedTokenExtensions"] = "UnsupportedTokenExtensions";
|
|
378
|
-
SolanaAlignedProxyErrorCode2["PeriodTooShort"] = "PeriodTooShort";
|
|
379
|
-
SolanaAlignedProxyErrorCode2["InvalidTickSize"] = "InvalidTickSize";
|
|
380
|
-
SolanaAlignedProxyErrorCode2["InvalidPercentageBoundaries"] = "InvalidPercentageBoundaries";
|
|
381
|
-
SolanaAlignedProxyErrorCode2["InvalidPriceBoundaries"] = "InvalidPriceBoundaries";
|
|
382
|
-
SolanaAlignedProxyErrorCode2["UnsupportedOracle"] = "UnsupportedOracle";
|
|
383
|
-
SolanaAlignedProxyErrorCode2["InvalidOracleAccount"] = "InvalidOracleAccount";
|
|
384
|
-
SolanaAlignedProxyErrorCode2["InvalidOraclePrice"] = "InvalidOraclePrice";
|
|
385
|
-
SolanaAlignedProxyErrorCode2["InvalidStreamMetadata"] = "InvalidStreamMetadata";
|
|
386
|
-
SolanaAlignedProxyErrorCode2["AmountAlreadyUpdated"] = "AmountAlreadyUpdated";
|
|
387
|
-
SolanaAlignedProxyErrorCode2["AllFundsUnlocked"] = "AllFundsUnlocked";
|
|
388
|
-
return SolanaAlignedProxyErrorCode2;
|
|
389
|
-
})(SolanaAlignedProxyErrorCode || {});
|
|
390
|
-
|
|
391
|
-
// common/BaseStreamClient.ts
|
|
392
|
-
var BaseStreamClient = class {
|
|
393
|
-
/**
|
|
394
|
-
* Returns total fee percent, streamflow fees + partner fees
|
|
395
|
-
* @param getFeesData structure with address for which we need to derive fee, either sender or partner usually
|
|
396
|
-
* @param chainSpecificParams additional parameters required by chain client
|
|
397
|
-
* @returns fee as floating number, so if fee is 0.99%, it will return 0.99
|
|
398
|
-
*/
|
|
399
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
400
|
-
async getTotalFee(getFeesData, chainSpecificParams) {
|
|
401
|
-
const fees = await this.getFees(getFeesData, chainSpecificParams);
|
|
402
|
-
if (fees) {
|
|
403
|
-
return fees.partnerFee + fees.streamflowFee;
|
|
404
|
-
}
|
|
405
|
-
return this.getDefaultStreamflowFee(chainSpecificParams);
|
|
406
|
-
}
|
|
407
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
408
|
-
extractErrorCode(err) {
|
|
409
|
-
return null;
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
// aptos/constants.ts
|
|
414
|
-
var constants_exports = {};
|
|
415
|
-
__export(constants_exports, {
|
|
416
|
-
APTOS_ERROR_MATCH_REGEX: () => APTOS_ERROR_MATCH_REGEX,
|
|
417
|
-
APTOS_MODULE_ERROR_MAP: () => APTOS_MODULE_ERROR_MAP,
|
|
418
|
-
APTOS_PROGRAM_IDS: () => APTOS_PROGRAM_IDS
|
|
419
|
-
});
|
|
420
|
-
var APTOS_PROGRAM_IDS = {
|
|
421
|
-
[common.ICluster.Mainnet]: "0x9009d93d52576bf9ac6dc6cf10b870610bcb316342fef6eff80662fbbfce51b0",
|
|
422
|
-
// TODO: Add a correct programID for Test net
|
|
423
|
-
[common.ICluster.Devnet]: "0xc6737de143d91b2f99a7e490d4f8348fdfa3bdd1eb8737a27d0455f8a3625688",
|
|
424
|
-
[common.ICluster.Testnet]: "0xc6737de143d91b2f99a7e490d4f8348fdfa3bdd1eb8737a27d0455f8a3625688",
|
|
425
|
-
[common.ICluster.Local]: "0x9009d93d52576bf9ac6dc6cf10b870610bcb316342fef6eff80662fbbfce51b0"
|
|
426
|
-
};
|
|
427
|
-
var APTOS_ERROR_MATCH_REGEX = /Move abort in [a-z0-9]+::([^:]+): ([A-Z_]+)/;
|
|
428
|
-
var APTOS_MODULE_ERROR_MAP = {
|
|
429
|
-
protocol: {
|
|
430
|
-
1: "ECONTRACT_NOT_INIT" /* ECONTRACT_NOT_INIT */,
|
|
431
|
-
2: "EBAD_AMOUNT" /* EBAD_AMOUNT */,
|
|
432
|
-
3: "ENO_PERMISSIONS" /* ENO_PERMISSIONS */,
|
|
433
|
-
4: "EBADINPUT" /* EBADINPUT */,
|
|
434
|
-
5: "ECLOSED" /* ECLOSED */,
|
|
435
|
-
6: "EBAD_INPUT_AMOUNT_PER_PERIOD" /* EBAD_INPUT_AMOUNT_PER_PERIOD */,
|
|
436
|
-
8: "EBAD_INPUT_UPDATE_RATE" /* EBAD_INPUT_UPDATE_RATE */,
|
|
437
|
-
9: "EBAD_INPUT_CLIFF_AMOUNT" /* EBAD_INPUT_CLIFF_AMOUNT */,
|
|
438
|
-
10: "EBAD_INPUT_PERIOD" /* EBAD_INPUT_PERIOD */,
|
|
439
|
-
11: "EBAD_INPUT_START" /* EBAD_INPUT_START */,
|
|
440
|
-
12: "ENO_RECIPIENT_COIN_ADDRESS" /* ENO_RECIPIENT_COIN_ADDRESS */
|
|
441
|
-
}
|
|
442
|
-
};
|
|
38
|
+
// solana/StreamClient.ts
|
|
443
39
|
var MAX_SAFE_UNIX_TIME_VALUE = 864e10;
|
|
444
|
-
var BASE_FEE = 1009900;
|
|
445
|
-
var WITHDRAW_AVAILABLE_AMOUNT = new BN7__default.default("18446744073709551615");
|
|
446
|
-
|
|
447
|
-
// common/contractUtils.ts
|
|
448
40
|
var calculateUnlockedAmount = ({
|
|
449
41
|
depositedAmount,
|
|
450
42
|
cliff,
|
|
@@ -457,18 +49,21 @@ var calculateUnlockedAmount = ({
|
|
|
457
49
|
fundsUnlockedAtLastRateChange
|
|
458
50
|
}) => {
|
|
459
51
|
const deposited = depositedAmount;
|
|
460
|
-
if (currentTimestamp < cliff) return new
|
|
52
|
+
if (currentTimestamp < cliff) return new BN3__default.default(0);
|
|
461
53
|
if (currentTimestamp > end) return deposited;
|
|
462
54
|
const savedUnlockedFunds = lastRateChangeTime === 0 ? cliffAmount : fundsUnlockedAtLastRateChange;
|
|
463
55
|
const savedUnlockedFundsTime = lastRateChangeTime === 0 ? cliff : lastRateChangeTime;
|
|
464
|
-
const streamed = new
|
|
56
|
+
const streamed = new BN3__default.default(Math.floor((currentTimestamp - savedUnlockedFundsTime) / period)).mul(amountPerPeriod).add(savedUnlockedFunds);
|
|
465
57
|
return streamed.lt(deposited) ? streamed : deposited;
|
|
466
58
|
};
|
|
467
59
|
var isCliffCloseToDepositedAmount = (streamData) => {
|
|
468
|
-
return streamData.cliffAmount.gte(streamData.depositedAmount.sub(new
|
|
60
|
+
return streamData.cliffAmount.gte(streamData.depositedAmount.sub(new BN3__default.default(1)));
|
|
61
|
+
};
|
|
62
|
+
var isPayment = (streamData) => {
|
|
63
|
+
return streamData.canTopup;
|
|
469
64
|
};
|
|
470
65
|
var isVesting = (streamData) => {
|
|
471
|
-
return !isCliffCloseToDepositedAmount(streamData) && !isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage);
|
|
66
|
+
return !streamData.canTopup && !isCliffCloseToDepositedAmount(streamData) && !isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage);
|
|
472
67
|
};
|
|
473
68
|
var isAligned = (stream) => {
|
|
474
69
|
return "minPrice" in stream && "maxPrice" in stream && "minPercentage" in stream && "maxPercentage" in stream;
|
|
@@ -483,117 +78,122 @@ var isTokenLock = (streamData) => {
|
|
|
483
78
|
return !streamData.canTopup && !streamData.automaticWithdrawal && !streamData.cancelableBySender && !streamData.cancelableByRecipient && !streamData.transferableBySender && (isCliffCloseToDepositedAmount(streamData) || isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage));
|
|
484
79
|
};
|
|
485
80
|
var buildStreamType = (streamData) => {
|
|
81
|
+
if (isVesting(streamData)) {
|
|
82
|
+
return "vesting" /* Vesting */;
|
|
83
|
+
}
|
|
486
84
|
if (isTokenLock(streamData)) {
|
|
487
85
|
return "lock" /* Lock */;
|
|
488
86
|
}
|
|
489
|
-
return "
|
|
87
|
+
return "payment" /* Payment */;
|
|
490
88
|
};
|
|
491
89
|
var decodeEndTime = (endTime) => {
|
|
492
|
-
if (endTime.gt(new
|
|
90
|
+
if (endTime.gt(new BN3__default.default(MAX_SAFE_UNIX_TIME_VALUE))) {
|
|
493
91
|
return MAX_SAFE_UNIX_TIME_VALUE;
|
|
494
92
|
}
|
|
495
93
|
return endTime.toNumber();
|
|
496
94
|
};
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
95
|
+
var ALIGNED_PRECISION_FACTOR_POW = 9;
|
|
96
|
+
var StreamDirection = /* @__PURE__ */ ((StreamDirection2) => {
|
|
97
|
+
StreamDirection2["Outgoing"] = "outgoing";
|
|
98
|
+
StreamDirection2["Incoming"] = "incoming";
|
|
99
|
+
StreamDirection2["All"] = "all";
|
|
100
|
+
return StreamDirection2;
|
|
101
|
+
})(StreamDirection || {});
|
|
102
|
+
var StreamType = /* @__PURE__ */ ((StreamType2) => {
|
|
103
|
+
StreamType2["All"] = "all";
|
|
104
|
+
StreamType2["Payment"] = "payment";
|
|
105
|
+
StreamType2["Vesting"] = "vesting";
|
|
106
|
+
StreamType2["Lock"] = "lock";
|
|
107
|
+
return StreamType2;
|
|
108
|
+
})(StreamType || {});
|
|
109
|
+
var ContractErrorCode = /* @__PURE__ */ ((ContractErrorCode2) => {
|
|
110
|
+
ContractErrorCode2["AccountsNotWritable"] = "AccountsNotWritable";
|
|
111
|
+
ContractErrorCode2["InvalidMetadata"] = "InvalidMetadata";
|
|
112
|
+
ContractErrorCode2["InvalidMetadataAccount"] = "InvalidMetadataAccount";
|
|
113
|
+
ContractErrorCode2["MetadataAccountMismatch"] = "MetadataAccountMismatch";
|
|
114
|
+
ContractErrorCode2["InvalidEscrowAccount"] = "InvalidEscrowAccount";
|
|
115
|
+
ContractErrorCode2["NotAssociated"] = "NotAssociated";
|
|
116
|
+
ContractErrorCode2["MintMismatch"] = "MintMismatch";
|
|
117
|
+
ContractErrorCode2["TransferNotAllowed"] = "TransferNotAllowed";
|
|
118
|
+
ContractErrorCode2["ContractClosed"] = "ContractClosed";
|
|
119
|
+
ContractErrorCode2["InvalidTreasury"] = "InvalidTreasury";
|
|
120
|
+
ContractErrorCode2["InvalidTimestamps"] = "InvalidTimestamps";
|
|
121
|
+
ContractErrorCode2["InvalidDepositConfiguration"] = "InvalidDepositConfiguration";
|
|
122
|
+
ContractErrorCode2["AmountIsZero"] = "AmountIsZero";
|
|
123
|
+
ContractErrorCode2["AmountMoreThanAvailable"] = "AmountMoreThanAvailable";
|
|
124
|
+
ContractErrorCode2["AmountAvailableIsZero"] = "AmountAvailableIsZero";
|
|
125
|
+
ContractErrorCode2["ArithmeticError"] = "ArithmeticError";
|
|
126
|
+
ContractErrorCode2["InvalidMetadataSize"] = "InvalidMetadataSize";
|
|
127
|
+
ContractErrorCode2["UninitializedMetadata"] = "UninitializedMetadata";
|
|
128
|
+
ContractErrorCode2["Unauthorized"] = "Unauthorized";
|
|
129
|
+
ContractErrorCode2["SelfTransfer"] = "SelfTransfer";
|
|
130
|
+
ContractErrorCode2["AlreadyPaused"] = "AlreadyPaused";
|
|
131
|
+
ContractErrorCode2["NotPaused"] = "NotPaused";
|
|
132
|
+
ContractErrorCode2["MetadataNotRentExempt"] = "MetadataNotRentExempt";
|
|
133
|
+
return ContractErrorCode2;
|
|
134
|
+
})(ContractErrorCode || {});
|
|
135
|
+
var AlignedProxyErrorCode = /* @__PURE__ */ ((AlignedProxyErrorCode2) => {
|
|
136
|
+
AlignedProxyErrorCode2["Unauthorized"] = "Unauthorized";
|
|
137
|
+
AlignedProxyErrorCode2["ArithmeticError"] = "ArithmeticError";
|
|
138
|
+
AlignedProxyErrorCode2["UnsupportedTokenExtensions"] = "UnsupportedTokenExtensions";
|
|
139
|
+
AlignedProxyErrorCode2["PeriodTooShort"] = "PeriodTooShort";
|
|
140
|
+
AlignedProxyErrorCode2["InvalidTickSize"] = "InvalidTickSize";
|
|
141
|
+
AlignedProxyErrorCode2["InvalidPercentageBoundaries"] = "InvalidPercentageBoundaries";
|
|
142
|
+
AlignedProxyErrorCode2["InvalidPriceBoundaries"] = "InvalidPriceBoundaries";
|
|
143
|
+
AlignedProxyErrorCode2["UnsupportedOracle"] = "UnsupportedOracle";
|
|
144
|
+
AlignedProxyErrorCode2["InvalidOracleAccount"] = "InvalidOracleAccount";
|
|
145
|
+
AlignedProxyErrorCode2["InvalidOraclePrice"] = "InvalidOraclePrice";
|
|
146
|
+
AlignedProxyErrorCode2["InvalidStreamMetadata"] = "InvalidStreamMetadata";
|
|
147
|
+
AlignedProxyErrorCode2["AmountAlreadyUpdated"] = "AmountAlreadyUpdated";
|
|
148
|
+
AlignedProxyErrorCode2["AllFundsUnlocked"] = "AllFundsUnlocked";
|
|
149
|
+
return AlignedProxyErrorCode2;
|
|
150
|
+
})(AlignedProxyErrorCode || {});
|
|
551
151
|
var Contract = class {
|
|
552
|
-
constructor(stream
|
|
553
|
-
this.magic =
|
|
554
|
-
this.version =
|
|
555
|
-
this.createdAt =
|
|
556
|
-
this.withdrawnAmount =
|
|
557
|
-
this.canceledAt =
|
|
558
|
-
this.end =
|
|
559
|
-
this.lastWithdrawnAt =
|
|
560
|
-
this.sender =
|
|
561
|
-
this.senderTokens =
|
|
562
|
-
this.recipient =
|
|
563
|
-
this.recipientTokens =
|
|
564
|
-
this.mint =
|
|
565
|
-
this.escrowTokens =
|
|
566
|
-
this.streamflowTreasury =
|
|
567
|
-
this.streamflowTreasuryTokens =
|
|
568
|
-
this.streamflowFeeTotal =
|
|
569
|
-
this.streamflowFeeWithdrawn =
|
|
570
|
-
this.streamflowFeePercent =
|
|
571
|
-
this.partnerFeeTotal =
|
|
572
|
-
this.partnerFeeWithdrawn =
|
|
573
|
-
this.partnerFeePercent =
|
|
574
|
-
this.partner =
|
|
575
|
-
this.partnerTokens =
|
|
576
|
-
this.start =
|
|
577
|
-
this.depositedAmount =
|
|
578
|
-
this.period =
|
|
579
|
-
this.amountPerPeriod =
|
|
580
|
-
this.cliff =
|
|
581
|
-
this.cliffAmount =
|
|
582
|
-
this.cancelableBySender = stream.
|
|
583
|
-
this.cancelableByRecipient = stream.
|
|
584
|
-
this.automaticWithdrawal = stream.
|
|
585
|
-
this.transferableBySender = stream.
|
|
586
|
-
this.transferableByRecipient = stream.
|
|
587
|
-
this.canTopup = stream.
|
|
588
|
-
|
|
589
|
-
this.
|
|
590
|
-
this.withdrawalFrequency = parseInt(stream.meta.withdrawal_frequency);
|
|
152
|
+
constructor(stream) {
|
|
153
|
+
this.magic = stream.magic.toNumber();
|
|
154
|
+
this.version = stream.version.toNumber();
|
|
155
|
+
this.createdAt = stream.createdAt.toNumber();
|
|
156
|
+
this.withdrawnAmount = stream.withdrawnAmount;
|
|
157
|
+
this.canceledAt = stream.canceledAt.toNumber();
|
|
158
|
+
this.end = decodeEndTime(stream.end);
|
|
159
|
+
this.lastWithdrawnAt = stream.lastWithdrawnAt.toNumber();
|
|
160
|
+
this.sender = stream.sender.toBase58();
|
|
161
|
+
this.senderTokens = stream.senderTokens.toBase58();
|
|
162
|
+
this.recipient = stream.recipient.toBase58();
|
|
163
|
+
this.recipientTokens = stream.recipientTokens.toBase58();
|
|
164
|
+
this.mint = stream.mint.toBase58();
|
|
165
|
+
this.escrowTokens = stream.escrowTokens.toBase58();
|
|
166
|
+
this.streamflowTreasury = stream.streamflowTreasury.toBase58();
|
|
167
|
+
this.streamflowTreasuryTokens = stream.streamflowTreasuryTokens.toBase58();
|
|
168
|
+
this.streamflowFeeTotal = stream.streamflowFeeTotal;
|
|
169
|
+
this.streamflowFeeWithdrawn = stream.streamflowFeeWithdrawn;
|
|
170
|
+
this.streamflowFeePercent = stream.streamflowFeePercent;
|
|
171
|
+
this.partnerFeeTotal = stream.partnerFeeTotal;
|
|
172
|
+
this.partnerFeeWithdrawn = stream.partnerFeeWithdrawn;
|
|
173
|
+
this.partnerFeePercent = stream.partnerFeePercent;
|
|
174
|
+
this.partner = stream.partner.toBase58();
|
|
175
|
+
this.partnerTokens = stream.partnerTokens?.toBase58();
|
|
176
|
+
this.start = stream.start.toNumber();
|
|
177
|
+
this.depositedAmount = stream.depositedAmount;
|
|
178
|
+
this.period = stream.period.toNumber();
|
|
179
|
+
this.amountPerPeriod = stream.amountPerPeriod;
|
|
180
|
+
this.cliff = stream.cliff.toNumber();
|
|
181
|
+
this.cliffAmount = stream.cliffAmount;
|
|
182
|
+
this.cancelableBySender = stream.cancelableBySender;
|
|
183
|
+
this.cancelableByRecipient = stream.cancelableByRecipient;
|
|
184
|
+
this.automaticWithdrawal = stream.automaticWithdrawal;
|
|
185
|
+
this.transferableBySender = stream.transferableBySender;
|
|
186
|
+
this.transferableByRecipient = stream.transferableByRecipient;
|
|
187
|
+
this.canTopup = stream.canTopup;
|
|
188
|
+
this.name = stream.name;
|
|
189
|
+
this.withdrawalFrequency = stream.withdrawFrequency.toNumber();
|
|
591
190
|
this.closed = stream.closed;
|
|
592
|
-
this.currentPauseStart =
|
|
593
|
-
this.pauseCumulative =
|
|
594
|
-
this.lastRateChangeTime =
|
|
595
|
-
this.fundsUnlockedAtLastRateChange =
|
|
191
|
+
this.currentPauseStart = stream.currentPauseStart.toNumber();
|
|
192
|
+
this.pauseCumulative = stream.pauseCumulative;
|
|
193
|
+
this.lastRateChangeTime = stream.lastRateChangeTime.toNumber();
|
|
194
|
+
this.fundsUnlockedAtLastRateChange = stream.fundsUnlockedAtLastRateChange;
|
|
596
195
|
this.type = buildStreamType(this);
|
|
196
|
+
this.isAligned = false;
|
|
597
197
|
}
|
|
598
198
|
unlocked(currentTimestamp) {
|
|
599
199
|
return calculateUnlockedAmount({
|
|
@@ -602,2194 +202,81 @@ var Contract = class {
|
|
|
602
202
|
});
|
|
603
203
|
}
|
|
604
204
|
remaining(decimals) {
|
|
605
|
-
return getNumberFromBN(this.depositedAmount.sub(this.withdrawnAmount), decimals);
|
|
205
|
+
return common.getNumberFromBN(this.depositedAmount.sub(this.withdrawnAmount), decimals);
|
|
606
206
|
}
|
|
607
207
|
};
|
|
608
|
-
var
|
|
609
|
-
constructor(
|
|
610
|
-
|
|
611
|
-
this.
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
return tx.hash;
|
|
632
|
-
}
|
|
633
|
-
return (await this.wallet.signAndSubmitTransaction(input)).hash;
|
|
208
|
+
var AlignedContract = class extends Contract {
|
|
209
|
+
constructor(stream, alignedProxy) {
|
|
210
|
+
super(stream);
|
|
211
|
+
this.minPrice = common.getNumberFromBN(alignedProxy.minPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
212
|
+
this.maxPrice = common.getNumberFromBN(alignedProxy.maxPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
213
|
+
this.minPercentage = common.getNumberFromBN(alignedProxy.minPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
214
|
+
this.maxPercentage = common.getNumberFromBN(alignedProxy.maxPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
215
|
+
this.oracleType = Object.keys(alignedProxy.priceOracleType).find((key) => !!key) || "none";
|
|
216
|
+
this.tickSize = alignedProxy.tickSize.toNumber();
|
|
217
|
+
this.priceOracle = this.oracleType === "none" ? void 0 : alignedProxy.priceOracle.toBase58();
|
|
218
|
+
this.sender = alignedProxy.sender.toBase58();
|
|
219
|
+
this.canceledAt = alignedProxy.streamCanceledTime.toNumber();
|
|
220
|
+
this.proxyAddress = stream.sender.toBase58();
|
|
221
|
+
this.initialAmountPerPeriod = alignedProxy.initialAmountPerPeriod;
|
|
222
|
+
this.initialPrice = common.getNumberFromBN(alignedProxy.initialPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
223
|
+
this.lastPrice = common.getNumberFromBN(alignedProxy.lastPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
224
|
+
this.lastAmountUpdateTime = alignedProxy.lastAmountUpdateTime.toNumber();
|
|
225
|
+
this.initialNetAmount = alignedProxy.initialNetAmount;
|
|
226
|
+
this.expiryTime = alignedProxy.expiryTime.toNumber();
|
|
227
|
+
this.expiryPercentage = common.getNumberFromBN(alignedProxy.expiryPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
228
|
+
this.floorPrice = common.getNumberFromBN(alignedProxy.floorPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
229
|
+
this.type = buildStreamType(this);
|
|
230
|
+
this.isAligned = true;
|
|
634
231
|
}
|
|
635
232
|
};
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
var
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
recipient: recipient.recipient
|
|
684
|
-
});
|
|
685
|
-
} finally {
|
|
686
|
-
metadatas.push(metadataId);
|
|
687
|
-
metadataToRecipient[metadataId] = recipient;
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
return {
|
|
691
|
-
txs,
|
|
692
|
-
metadatas,
|
|
693
|
-
metadataToRecipient,
|
|
694
|
-
errors
|
|
695
|
-
};
|
|
696
|
-
}
|
|
697
|
-
/**
|
|
698
|
-
* Attempts withdrawing from the specified stream.
|
|
699
|
-
*/
|
|
700
|
-
async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, { senderWallet, tokenId }) {
|
|
701
|
-
const payload = {
|
|
702
|
-
type: "withdraw",
|
|
703
|
-
function: `${this.programId}::protocol::withdraw`,
|
|
704
|
-
type_arguments: [tokenId],
|
|
705
|
-
arguments: [id, amount.toString()]
|
|
706
|
-
};
|
|
707
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
708
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
709
|
-
return { ixs: [payload], txId: hash };
|
|
710
|
-
}
|
|
711
|
-
/**
|
|
712
|
-
* Attempts canceling the specified stream.
|
|
713
|
-
*/
|
|
714
|
-
async cancel(cancelData, { senderWallet, tokenId }) {
|
|
715
|
-
const payload = {
|
|
716
|
-
type: "cancel",
|
|
717
|
-
function: `${this.programId}::protocol::cancel`,
|
|
718
|
-
type_arguments: [tokenId],
|
|
719
|
-
arguments: [cancelData.id]
|
|
720
|
-
};
|
|
721
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
722
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
723
|
-
return { ixs: [payload], txId: hash };
|
|
724
|
-
}
|
|
725
|
-
/**
|
|
726
|
-
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
727
|
-
*/
|
|
728
|
-
async transfer(transferData, { senderWallet, tokenId }) {
|
|
729
|
-
const payload = {
|
|
730
|
-
type: "transfer",
|
|
731
|
-
function: `${this.programId}::protocol::transfer`,
|
|
732
|
-
type_arguments: [tokenId],
|
|
733
|
-
arguments: [transferData.id, transferData.newRecipient]
|
|
734
|
-
};
|
|
735
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
736
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
737
|
-
return { ixs: [payload], txId: hash };
|
|
738
|
-
}
|
|
739
|
-
/**
|
|
740
|
-
* Tops up stream account with specified amount.
|
|
741
|
-
*/
|
|
742
|
-
async topup(topupData, { senderWallet, tokenId }) {
|
|
743
|
-
const payload = {
|
|
744
|
-
type: "topup",
|
|
745
|
-
function: `${this.programId}::protocol::topup`,
|
|
746
|
-
type_arguments: [tokenId],
|
|
747
|
-
arguments: [topupData.id, topupData.amount.toString()]
|
|
748
|
-
};
|
|
749
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
750
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
751
|
-
return { ixs: [payload], txId: hash };
|
|
752
|
-
}
|
|
753
|
-
/**
|
|
754
|
-
* Fetch stream data by its id (address).
|
|
755
|
-
*/
|
|
756
|
-
async getOne({ id }) {
|
|
757
|
-
const contractResources = await this.client.getAccountResources(id);
|
|
758
|
-
const contract = contractResources.find((r) => r.type.includes("protocol::Contract"));
|
|
759
|
-
if (!contract) {
|
|
760
|
-
throw new Error(`Contract with id ${id} could not be found!`);
|
|
761
|
-
}
|
|
762
|
-
const tokenIdMatch = contract.type.match(/0x[0-9a-f]+::protocol::Contract<(.*)>/);
|
|
763
|
-
const tokenId = tokenIdMatch?.[1] ?? "";
|
|
764
|
-
const { data } = contract;
|
|
765
|
-
return new Contract(data, tokenId);
|
|
766
|
-
}
|
|
767
|
-
async get() {
|
|
768
|
-
throw new Error("Get all method is not supported for Aptos chain!");
|
|
769
|
-
}
|
|
770
|
-
/**
|
|
771
|
-
* Attempts updating the stream auto withdrawal params and amount per period
|
|
772
|
-
*/
|
|
773
|
-
async update(updateData, { senderWallet, tokenId }) {
|
|
774
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
775
|
-
const payload = {
|
|
776
|
-
type: "update",
|
|
777
|
-
function: `${this.programId}::protocol::update`,
|
|
778
|
-
type_arguments: [tokenId],
|
|
779
|
-
arguments: [
|
|
780
|
-
updateData.id,
|
|
781
|
-
updateData.enableAutomaticWithdrawal ? [true] : [],
|
|
782
|
-
updateData.withdrawFrequency ? [updateData.withdrawFrequency.toString()] : [],
|
|
783
|
-
updateData.amountPerPeriod ? [updateData.amountPerPeriod.toString()] : []
|
|
784
|
-
]
|
|
785
|
-
};
|
|
786
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
787
|
-
return { ixs: [payload], txId: hash };
|
|
788
|
-
}
|
|
789
|
-
async getFees({ address }) {
|
|
790
|
-
const resource = await this.client.getAccountResource(this.programId, `${this.programId}::fees::FeeTable`);
|
|
791
|
-
const data = resource.data;
|
|
792
|
-
const value = await this.client.getTableItem(data.values.handle, {
|
|
793
|
-
key_type: "address",
|
|
794
|
-
key: address,
|
|
795
|
-
value_type: "u64"
|
|
796
|
-
});
|
|
797
|
-
if (!value) {
|
|
798
|
-
return null;
|
|
799
|
-
}
|
|
800
|
-
return { streamflowFee: Number(value) / 100, partnerFee: 0 };
|
|
801
|
-
}
|
|
802
|
-
async getDefaultStreamflowFee() {
|
|
803
|
-
const resource = await this.client.getAccountResource(this.programId, `${this.programId}::admin::ConfigV2`);
|
|
804
|
-
return Number(resource.data.streamflow_fees) / 100;
|
|
805
|
-
}
|
|
806
|
-
extractErrorCode(err) {
|
|
807
|
-
return extractAptosErrorCode(err.toString() ?? "Unknown error!");
|
|
808
|
-
}
|
|
809
|
-
/**
|
|
810
|
-
* Returns StreamClient protocol program ID.
|
|
811
|
-
*/
|
|
812
|
-
getProgramId() {
|
|
813
|
-
return this.programId;
|
|
814
|
-
}
|
|
815
|
-
getMaxGas() {
|
|
816
|
-
return { max_gas_amount: this.maxGas };
|
|
817
|
-
}
|
|
818
|
-
// Utility function to prepare transaction payloads for multiple recipients.
|
|
819
|
-
generateMultiPayloads(multipleStreamData, wallet) {
|
|
820
|
-
return multipleStreamData.recipients.map((recipient) => {
|
|
821
|
-
const acc = new aptos.AptosAccount();
|
|
822
|
-
const seeds = acc.address();
|
|
823
|
-
const encoder = new TextEncoder();
|
|
824
|
-
const actualSeeds = encoder.encode(seeds.hex());
|
|
825
|
-
const metadataId = aptos.AptosAccount.getResourceAccountAddress(wallet.address, actualSeeds);
|
|
826
|
-
return [
|
|
827
|
-
metadataId.toString(),
|
|
828
|
-
{
|
|
829
|
-
type: "create",
|
|
830
|
-
function: `${this.programId}::protocol::create`,
|
|
831
|
-
type_arguments: [multipleStreamData.tokenId],
|
|
832
|
-
arguments: [
|
|
833
|
-
seeds.hex(),
|
|
834
|
-
recipient.amount.toString(),
|
|
835
|
-
multipleStreamData.period,
|
|
836
|
-
recipient.amountPerPeriod.toString(),
|
|
837
|
-
multipleStreamData.start,
|
|
838
|
-
recipient.cliffAmount.toString(),
|
|
839
|
-
multipleStreamData.cancelableBySender,
|
|
840
|
-
multipleStreamData.cancelableByRecipient,
|
|
841
|
-
multipleStreamData.transferableBySender,
|
|
842
|
-
multipleStreamData.transferableByRecipient,
|
|
843
|
-
multipleStreamData.canTopup,
|
|
844
|
-
multipleStreamData.canPause || false,
|
|
845
|
-
multipleStreamData.canUpdateRate || false,
|
|
846
|
-
multipleStreamData.automaticWithdrawal || false,
|
|
847
|
-
multipleStreamData.withdrawalFrequency || 0,
|
|
848
|
-
recipient.name,
|
|
849
|
-
recipient.recipient
|
|
850
|
-
]
|
|
851
|
-
}
|
|
852
|
-
];
|
|
853
|
-
});
|
|
854
|
-
}
|
|
855
|
-
};
|
|
856
|
-
|
|
857
|
-
// evm/index.ts
|
|
858
|
-
var evm_exports = {};
|
|
859
|
-
__export(evm_exports, {
|
|
860
|
-
EvmContract: () => EvmContract,
|
|
861
|
-
EvmStreamClient: () => EvmStreamClient,
|
|
862
|
-
constants: () => constants_exports2,
|
|
863
|
-
default: () => EvmStreamClient,
|
|
864
|
-
ercAbi: () => ercAbi_default,
|
|
865
|
-
extractEvmErrorCode: () => extractEvmErrorCode
|
|
866
|
-
});
|
|
867
|
-
|
|
868
|
-
// evm/constants.ts
|
|
869
|
-
var constants_exports2 = {};
|
|
870
|
-
__export(constants_exports2, {
|
|
871
|
-
BNB_PROGRAM_IDS: () => BNB_PROGRAM_IDS,
|
|
872
|
-
ETHEREUM_PROGRAM_IDS: () => ETHEREUM_PROGRAM_IDS,
|
|
873
|
-
EVM_ERROR_MAP: () => EVM_ERROR_MAP,
|
|
874
|
-
EVM_ERROR_MATCH_REGEX: () => EVM_ERROR_MATCH_REGEX,
|
|
875
|
-
POLYGON_PROGRAM_IDS: () => POLYGON_PROGRAM_IDS
|
|
876
|
-
});
|
|
877
|
-
var ETHEREUM_PROGRAM_IDS = {
|
|
878
|
-
[common.ICluster.Mainnet]: "0x94d4646Bd307Bf91CB1893BC64d976BF9E60D9B2",
|
|
879
|
-
[common.ICluster.Devnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
880
|
-
[common.ICluster.Testnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
881
|
-
[common.ICluster.Local]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d"
|
|
882
|
-
};
|
|
883
|
-
var BNB_PROGRAM_IDS = {
|
|
884
|
-
[common.ICluster.Mainnet]: "0x94d4646Bd307Bf91CB1893BC64d976BF9E60D9B2",
|
|
885
|
-
[common.ICluster.Devnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
886
|
-
[common.ICluster.Testnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
887
|
-
[common.ICluster.Local]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d"
|
|
888
|
-
};
|
|
889
|
-
var POLYGON_PROGRAM_IDS = {
|
|
890
|
-
[common.ICluster.Mainnet]: "0x94d4646Bd307Bf91CB1893BC64d976BF9E60D9B2",
|
|
891
|
-
[common.ICluster.Devnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
892
|
-
[common.ICluster.Testnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
893
|
-
[common.ICluster.Local]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d"
|
|
894
|
-
};
|
|
895
|
-
var EVM_ERROR_MATCH_REGEX = /execution reverted: ([A-Z_]+)/;
|
|
896
|
-
var EVM_ERROR_MAP = {
|
|
897
|
-
ECONTRACT_NOT_INIT: "ECONTRACT_NOT_INIT" /* ECONTRACT_NOT_INIT */,
|
|
898
|
-
EBAD_AMOUNT: "EBAD_AMOUNT" /* EBAD_AMOUNT */,
|
|
899
|
-
ENO_PERMISSIONS: "ENO_PERMISSIONS" /* ENO_PERMISSIONS */,
|
|
900
|
-
EBADINPUT: "EBADINPUT" /* EBADINPUT */,
|
|
901
|
-
ECLOSED: "ECLOSED" /* ECLOSED */,
|
|
902
|
-
EBAD_INPUT_AMOUNT_PER_PERIOD: "EBAD_INPUT_AMOUNT_PER_PERIOD" /* EBAD_INPUT_AMOUNT_PER_PERIOD */,
|
|
903
|
-
EBAD_INPUT_PAUSABLE: "EBAD_INPUT_PAUSABLE" /* EBAD_INPUT_PAUSABLE */,
|
|
904
|
-
EBAD_INPUT_UPDATE_RATE: "EBAD_INPUT_UPDATE_RATE" /* EBAD_INPUT_UPDATE_RATE */,
|
|
905
|
-
EBAD_INPUT_CLIFF_AMOUNT: "EBAD_INPUT_CLIFF_AMOUNT" /* EBAD_INPUT_CLIFF_AMOUNT */,
|
|
906
|
-
EBAD_INPUT_PERIOD: "EBAD_INPUT_PERIOD" /* EBAD_INPUT_PERIOD */,
|
|
907
|
-
EBAD_INPUT_START: "EBAD_INPUT_START" /* EBAD_INPUT_START */,
|
|
908
|
-
EBAD_INSUFFICIENT_TOKEN_ALLOWANCE: "EBAD_INSUFFICIENT_TOKEN_ALLOWANCE" /* EBAD_INSUFFICIENT_TOKEN_ALLOWANCE */,
|
|
909
|
-
EBAD_INSUFFICIENT_WITHDRAWAL_FEES: "EBAD_INSUFFICIENT_WITHDRAWAL_FEES" /* EBAD_INSUFFICIENT_WITHDRAWAL_FEES */
|
|
910
|
-
};
|
|
911
|
-
|
|
912
|
-
// evm/abi.ts
|
|
913
|
-
var abi_default = [
|
|
914
|
-
{
|
|
915
|
-
anonymous: false,
|
|
916
|
-
inputs: [
|
|
917
|
-
{
|
|
918
|
-
indexed: false,
|
|
919
|
-
internalType: "address",
|
|
920
|
-
name: "",
|
|
921
|
-
type: "address"
|
|
922
|
-
}
|
|
923
|
-
],
|
|
924
|
-
name: "ContractCreated",
|
|
925
|
-
type: "event"
|
|
926
|
-
},
|
|
927
|
-
{
|
|
928
|
-
inputs: [
|
|
929
|
-
{
|
|
930
|
-
internalType: "address",
|
|
931
|
-
name: "_stream_id",
|
|
932
|
-
type: "address"
|
|
933
|
-
}
|
|
934
|
-
],
|
|
935
|
-
name: "cancel",
|
|
936
|
-
outputs: [],
|
|
937
|
-
stateMutability: "nonpayable",
|
|
938
|
-
type: "function"
|
|
939
|
-
},
|
|
940
|
-
{
|
|
941
|
-
inputs: [
|
|
942
|
-
{
|
|
943
|
-
internalType: "uint256",
|
|
944
|
-
name: "_new_fees",
|
|
945
|
-
type: "uint256"
|
|
946
|
-
}
|
|
947
|
-
],
|
|
948
|
-
name: "changeStreamflowFees",
|
|
949
|
-
outputs: [],
|
|
950
|
-
stateMutability: "nonpayable",
|
|
951
|
-
type: "function"
|
|
952
|
-
},
|
|
953
|
-
{
|
|
954
|
-
inputs: [
|
|
955
|
-
{
|
|
956
|
-
internalType: "address payable",
|
|
957
|
-
name: "_new_treasury",
|
|
958
|
-
type: "address"
|
|
959
|
-
}
|
|
960
|
-
],
|
|
961
|
-
name: "changeTreasury",
|
|
962
|
-
outputs: [],
|
|
963
|
-
stateMutability: "nonpayable",
|
|
964
|
-
type: "function"
|
|
965
|
-
},
|
|
966
|
-
{
|
|
967
|
-
inputs: [
|
|
968
|
-
{
|
|
969
|
-
internalType: "uint256",
|
|
970
|
-
name: "_new_fee",
|
|
971
|
-
type: "uint256"
|
|
972
|
-
}
|
|
973
|
-
],
|
|
974
|
-
name: "changeTxFee",
|
|
975
|
-
outputs: [],
|
|
976
|
-
stateMutability: "nonpayable",
|
|
977
|
-
type: "function"
|
|
978
|
-
},
|
|
979
|
-
{
|
|
980
|
-
inputs: [
|
|
981
|
-
{
|
|
982
|
-
internalType: "address payable",
|
|
983
|
-
name: "_new_withdawor",
|
|
984
|
-
type: "address"
|
|
985
|
-
}
|
|
986
|
-
],
|
|
987
|
-
name: "changeWithdrawor",
|
|
988
|
-
outputs: [],
|
|
989
|
-
stateMutability: "nonpayable",
|
|
990
|
-
type: "function"
|
|
991
|
-
},
|
|
992
|
-
{
|
|
993
|
-
inputs: [],
|
|
994
|
-
name: "config",
|
|
995
|
-
outputs: [
|
|
996
|
-
{
|
|
997
|
-
internalType: "address",
|
|
998
|
-
name: "admin",
|
|
999
|
-
type: "address"
|
|
1000
|
-
},
|
|
1001
|
-
{
|
|
1002
|
-
internalType: "uint256",
|
|
1003
|
-
name: "streamflow_fees",
|
|
1004
|
-
type: "uint256"
|
|
1005
|
-
},
|
|
1006
|
-
{
|
|
1007
|
-
internalType: "address payable",
|
|
1008
|
-
name: "treasury",
|
|
1009
|
-
type: "address"
|
|
1010
|
-
},
|
|
1011
|
-
{
|
|
1012
|
-
internalType: "address payable",
|
|
1013
|
-
name: "withdrawor",
|
|
1014
|
-
type: "address"
|
|
1015
|
-
},
|
|
1016
|
-
{
|
|
1017
|
-
internalType: "uint256",
|
|
1018
|
-
name: "tx_fee",
|
|
1019
|
-
type: "uint256"
|
|
1020
|
-
}
|
|
1021
|
-
],
|
|
1022
|
-
stateMutability: "view",
|
|
1023
|
-
type: "function"
|
|
1024
|
-
},
|
|
1025
|
-
{
|
|
1026
|
-
inputs: [
|
|
1027
|
-
{
|
|
1028
|
-
internalType: "contract IERC20",
|
|
1029
|
-
name: "_token",
|
|
1030
|
-
type: "address"
|
|
1031
|
-
},
|
|
1032
|
-
{
|
|
1033
|
-
internalType: "uint256",
|
|
1034
|
-
name: "_amount",
|
|
1035
|
-
type: "uint256"
|
|
1036
|
-
},
|
|
1037
|
-
{
|
|
1038
|
-
internalType: "uint256",
|
|
1039
|
-
name: "_period",
|
|
1040
|
-
type: "uint256"
|
|
1041
|
-
},
|
|
1042
|
-
{
|
|
1043
|
-
internalType: "uint256",
|
|
1044
|
-
name: "_amount_per_period",
|
|
1045
|
-
type: "uint256"
|
|
1046
|
-
},
|
|
1047
|
-
{
|
|
1048
|
-
internalType: "uint256",
|
|
1049
|
-
name: "_start",
|
|
1050
|
-
type: "uint256"
|
|
1051
|
-
},
|
|
1052
|
-
{
|
|
1053
|
-
internalType: "uint256",
|
|
1054
|
-
name: "_cliff_amount",
|
|
1055
|
-
type: "uint256"
|
|
1056
|
-
},
|
|
1057
|
-
{
|
|
1058
|
-
components: [
|
|
1059
|
-
{
|
|
1060
|
-
internalType: "bool",
|
|
1061
|
-
name: "cancelable_by_sender",
|
|
1062
|
-
type: "bool"
|
|
1063
|
-
},
|
|
1064
|
-
{
|
|
1065
|
-
internalType: "bool",
|
|
1066
|
-
name: "cancelable_by_recipient",
|
|
1067
|
-
type: "bool"
|
|
1068
|
-
},
|
|
1069
|
-
{
|
|
1070
|
-
internalType: "bool",
|
|
1071
|
-
name: "transferable_by_sender",
|
|
1072
|
-
type: "bool"
|
|
1073
|
-
},
|
|
1074
|
-
{
|
|
1075
|
-
internalType: "bool",
|
|
1076
|
-
name: "transferable_by_recipient",
|
|
1077
|
-
type: "bool"
|
|
1078
|
-
},
|
|
1079
|
-
{
|
|
1080
|
-
internalType: "bool",
|
|
1081
|
-
name: "can_topup",
|
|
1082
|
-
type: "bool"
|
|
1083
|
-
},
|
|
1084
|
-
{
|
|
1085
|
-
internalType: "bool",
|
|
1086
|
-
name: "pausable",
|
|
1087
|
-
type: "bool"
|
|
1088
|
-
},
|
|
1089
|
-
{
|
|
1090
|
-
internalType: "bool",
|
|
1091
|
-
name: "can_update_rate",
|
|
1092
|
-
type: "bool"
|
|
1093
|
-
},
|
|
1094
|
-
{
|
|
1095
|
-
internalType: "bool",
|
|
1096
|
-
name: "automatic_withdrawal",
|
|
1097
|
-
type: "bool"
|
|
1098
|
-
},
|
|
1099
|
-
{
|
|
1100
|
-
internalType: "uint256",
|
|
1101
|
-
name: "withdrawal_frequency",
|
|
1102
|
-
type: "uint256"
|
|
1103
|
-
},
|
|
1104
|
-
{
|
|
1105
|
-
internalType: "string",
|
|
1106
|
-
name: "contract_name",
|
|
1107
|
-
type: "string"
|
|
1108
|
-
}
|
|
1109
|
-
],
|
|
1110
|
-
internalType: "struct ContractMeta",
|
|
1111
|
-
name: "_meta",
|
|
1112
|
-
type: "tuple"
|
|
1113
|
-
},
|
|
1114
|
-
{
|
|
1115
|
-
internalType: "address",
|
|
1116
|
-
name: "_recipient",
|
|
1117
|
-
type: "address"
|
|
1118
|
-
},
|
|
1119
|
-
{
|
|
1120
|
-
internalType: "address",
|
|
1121
|
-
name: "_partner",
|
|
1122
|
-
type: "address"
|
|
1123
|
-
}
|
|
1124
|
-
],
|
|
1125
|
-
name: "create",
|
|
1126
|
-
outputs: [],
|
|
1127
|
-
stateMutability: "payable",
|
|
1128
|
-
type: "function"
|
|
1129
|
-
},
|
|
1130
|
-
{
|
|
1131
|
-
inputs: [
|
|
1132
|
-
{
|
|
1133
|
-
internalType: "address",
|
|
1134
|
-
name: "_address",
|
|
1135
|
-
type: "address"
|
|
1136
|
-
}
|
|
1137
|
-
],
|
|
1138
|
-
name: "feesRemove",
|
|
1139
|
-
outputs: [],
|
|
1140
|
-
stateMutability: "nonpayable",
|
|
1141
|
-
type: "function"
|
|
1142
|
-
},
|
|
1143
|
-
{
|
|
1144
|
-
inputs: [
|
|
1145
|
-
{
|
|
1146
|
-
internalType: "address",
|
|
1147
|
-
name: "_address",
|
|
1148
|
-
type: "address"
|
|
1149
|
-
},
|
|
1150
|
-
{
|
|
1151
|
-
internalType: "uint256",
|
|
1152
|
-
name: "streamflow_fee",
|
|
1153
|
-
type: "uint256"
|
|
1154
|
-
},
|
|
1155
|
-
{
|
|
1156
|
-
internalType: "uint256",
|
|
1157
|
-
name: "partner_fee",
|
|
1158
|
-
type: "uint256"
|
|
1159
|
-
}
|
|
1160
|
-
],
|
|
1161
|
-
name: "feesWrite",
|
|
1162
|
-
outputs: [],
|
|
1163
|
-
stateMutability: "nonpayable",
|
|
1164
|
-
type: "function"
|
|
1165
|
-
},
|
|
1166
|
-
{
|
|
1167
|
-
inputs: [],
|
|
1168
|
-
name: "getAdmin",
|
|
1169
|
-
outputs: [
|
|
1170
|
-
{
|
|
1171
|
-
internalType: "address",
|
|
1172
|
-
name: "",
|
|
1173
|
-
type: "address"
|
|
1174
|
-
}
|
|
1175
|
-
],
|
|
1176
|
-
stateMutability: "view",
|
|
1177
|
-
type: "function"
|
|
1178
|
-
},
|
|
1179
|
-
{
|
|
1180
|
-
inputs: [],
|
|
1181
|
-
name: "getAll",
|
|
1182
|
-
outputs: [
|
|
1183
|
-
{
|
|
1184
|
-
internalType: "address[]",
|
|
1185
|
-
name: "",
|
|
1186
|
-
type: "address[]"
|
|
1187
|
-
},
|
|
1188
|
-
{
|
|
1189
|
-
components: [
|
|
1190
|
-
{
|
|
1191
|
-
internalType: "contract IERC20",
|
|
1192
|
-
name: "token",
|
|
1193
|
-
type: "address"
|
|
1194
|
-
},
|
|
1195
|
-
{
|
|
1196
|
-
components: [
|
|
1197
|
-
{
|
|
1198
|
-
internalType: "bool",
|
|
1199
|
-
name: "cancelable_by_sender",
|
|
1200
|
-
type: "bool"
|
|
1201
|
-
},
|
|
1202
|
-
{
|
|
1203
|
-
internalType: "bool",
|
|
1204
|
-
name: "cancelable_by_recipient",
|
|
1205
|
-
type: "bool"
|
|
1206
|
-
},
|
|
1207
|
-
{
|
|
1208
|
-
internalType: "bool",
|
|
1209
|
-
name: "transferable_by_sender",
|
|
1210
|
-
type: "bool"
|
|
1211
|
-
},
|
|
1212
|
-
{
|
|
1213
|
-
internalType: "bool",
|
|
1214
|
-
name: "transferable_by_recipient",
|
|
1215
|
-
type: "bool"
|
|
1216
|
-
},
|
|
1217
|
-
{
|
|
1218
|
-
internalType: "bool",
|
|
1219
|
-
name: "can_topup",
|
|
1220
|
-
type: "bool"
|
|
1221
|
-
},
|
|
1222
|
-
{
|
|
1223
|
-
internalType: "bool",
|
|
1224
|
-
name: "pausable",
|
|
1225
|
-
type: "bool"
|
|
1226
|
-
},
|
|
1227
|
-
{
|
|
1228
|
-
internalType: "bool",
|
|
1229
|
-
name: "can_update_rate",
|
|
1230
|
-
type: "bool"
|
|
1231
|
-
},
|
|
1232
|
-
{
|
|
1233
|
-
internalType: "bool",
|
|
1234
|
-
name: "automatic_withdrawal",
|
|
1235
|
-
type: "bool"
|
|
1236
|
-
},
|
|
1237
|
-
{
|
|
1238
|
-
internalType: "uint256",
|
|
1239
|
-
name: "withdrawal_frequency",
|
|
1240
|
-
type: "uint256"
|
|
1241
|
-
},
|
|
1242
|
-
{
|
|
1243
|
-
internalType: "string",
|
|
1244
|
-
name: "contract_name",
|
|
1245
|
-
type: "string"
|
|
1246
|
-
}
|
|
1247
|
-
],
|
|
1248
|
-
internalType: "struct ContractMeta",
|
|
1249
|
-
name: "meta",
|
|
1250
|
-
type: "tuple"
|
|
1251
|
-
},
|
|
1252
|
-
{
|
|
1253
|
-
internalType: "uint256",
|
|
1254
|
-
name: "amount",
|
|
1255
|
-
type: "uint256"
|
|
1256
|
-
},
|
|
1257
|
-
{
|
|
1258
|
-
internalType: "uint256",
|
|
1259
|
-
name: "period",
|
|
1260
|
-
type: "uint256"
|
|
1261
|
-
},
|
|
1262
|
-
{
|
|
1263
|
-
internalType: "uint256",
|
|
1264
|
-
name: "amount_per_period",
|
|
1265
|
-
type: "uint256"
|
|
1266
|
-
},
|
|
1267
|
-
{
|
|
1268
|
-
internalType: "uint256",
|
|
1269
|
-
name: "start",
|
|
1270
|
-
type: "uint256"
|
|
1271
|
-
},
|
|
1272
|
-
{
|
|
1273
|
-
internalType: "uint256",
|
|
1274
|
-
name: "end",
|
|
1275
|
-
type: "uint256"
|
|
1276
|
-
},
|
|
1277
|
-
{
|
|
1278
|
-
internalType: "uint256",
|
|
1279
|
-
name: "cliff_amount",
|
|
1280
|
-
type: "uint256"
|
|
1281
|
-
},
|
|
1282
|
-
{
|
|
1283
|
-
internalType: "uint256",
|
|
1284
|
-
name: "withdrawn",
|
|
1285
|
-
type: "uint256"
|
|
1286
|
-
},
|
|
1287
|
-
{
|
|
1288
|
-
internalType: "uint256",
|
|
1289
|
-
name: "last_withdrawn_at",
|
|
1290
|
-
type: "uint256"
|
|
1291
|
-
},
|
|
1292
|
-
{
|
|
1293
|
-
internalType: "uint256",
|
|
1294
|
-
name: "created",
|
|
1295
|
-
type: "uint256"
|
|
1296
|
-
},
|
|
1297
|
-
{
|
|
1298
|
-
internalType: "uint256",
|
|
1299
|
-
name: "canceled_at",
|
|
1300
|
-
type: "uint256"
|
|
1301
|
-
},
|
|
1302
|
-
{
|
|
1303
|
-
internalType: "address",
|
|
1304
|
-
name: "recipient",
|
|
1305
|
-
type: "address"
|
|
1306
|
-
},
|
|
1307
|
-
{
|
|
1308
|
-
internalType: "address",
|
|
1309
|
-
name: "sender",
|
|
1310
|
-
type: "address"
|
|
1311
|
-
},
|
|
1312
|
-
{
|
|
1313
|
-
internalType: "address",
|
|
1314
|
-
name: "partner",
|
|
1315
|
-
type: "address"
|
|
1316
|
-
},
|
|
1317
|
-
{
|
|
1318
|
-
components: [
|
|
1319
|
-
{
|
|
1320
|
-
internalType: "uint256",
|
|
1321
|
-
name: "streamflow_fee_percentage",
|
|
1322
|
-
type: "uint256"
|
|
1323
|
-
},
|
|
1324
|
-
{
|
|
1325
|
-
internalType: "uint256",
|
|
1326
|
-
name: "streamflow_fee",
|
|
1327
|
-
type: "uint256"
|
|
1328
|
-
},
|
|
1329
|
-
{
|
|
1330
|
-
internalType: "uint256",
|
|
1331
|
-
name: "streamflow_fee_withdrawn",
|
|
1332
|
-
type: "uint256"
|
|
1333
|
-
},
|
|
1334
|
-
{
|
|
1335
|
-
internalType: "uint256",
|
|
1336
|
-
name: "partner_fee_percentage",
|
|
1337
|
-
type: "uint256"
|
|
1338
|
-
},
|
|
1339
|
-
{
|
|
1340
|
-
internalType: "uint256",
|
|
1341
|
-
name: "partner_fee",
|
|
1342
|
-
type: "uint256"
|
|
1343
|
-
},
|
|
1344
|
-
{
|
|
1345
|
-
internalType: "uint256",
|
|
1346
|
-
name: "partner_fee_withdrawn",
|
|
1347
|
-
type: "uint256"
|
|
1348
|
-
},
|
|
1349
|
-
{
|
|
1350
|
-
internalType: "uint256",
|
|
1351
|
-
name: "tx_fee",
|
|
1352
|
-
type: "uint256"
|
|
1353
|
-
}
|
|
1354
|
-
],
|
|
1355
|
-
internalType: "struct FeesData",
|
|
1356
|
-
name: "fees",
|
|
1357
|
-
type: "tuple"
|
|
1358
|
-
},
|
|
1359
|
-
{
|
|
1360
|
-
internalType: "bool",
|
|
1361
|
-
name: "closed",
|
|
1362
|
-
type: "bool"
|
|
1363
|
-
},
|
|
1364
|
-
{
|
|
1365
|
-
internalType: "uint256",
|
|
1366
|
-
name: "current_pause_start",
|
|
1367
|
-
type: "uint256"
|
|
1368
|
-
},
|
|
1369
|
-
{
|
|
1370
|
-
internalType: "uint256",
|
|
1371
|
-
name: "pause_cumulative",
|
|
1372
|
-
type: "uint256"
|
|
1373
|
-
},
|
|
1374
|
-
{
|
|
1375
|
-
internalType: "uint256",
|
|
1376
|
-
name: "last_rate_change_time",
|
|
1377
|
-
type: "uint256"
|
|
1378
|
-
},
|
|
1379
|
-
{
|
|
1380
|
-
internalType: "uint256",
|
|
1381
|
-
name: "funds_unlocked_at_last_rate_change",
|
|
1382
|
-
type: "uint256"
|
|
1383
|
-
}
|
|
1384
|
-
],
|
|
1385
|
-
internalType: "struct Contract[]",
|
|
1386
|
-
name: "",
|
|
1387
|
-
type: "tuple[]"
|
|
1388
|
-
}
|
|
1389
|
-
],
|
|
1390
|
-
stateMutability: "view",
|
|
1391
|
-
type: "function"
|
|
1392
|
-
},
|
|
1393
|
-
{
|
|
1394
|
-
inputs: [
|
|
1395
|
-
{
|
|
1396
|
-
internalType: "address",
|
|
1397
|
-
name: "_id",
|
|
1398
|
-
type: "address"
|
|
1399
|
-
}
|
|
1400
|
-
],
|
|
1401
|
-
name: "getById",
|
|
1402
|
-
outputs: [
|
|
1403
|
-
{
|
|
1404
|
-
components: [
|
|
1405
|
-
{
|
|
1406
|
-
internalType: "contract IERC20",
|
|
1407
|
-
name: "token",
|
|
1408
|
-
type: "address"
|
|
1409
|
-
},
|
|
1410
|
-
{
|
|
1411
|
-
components: [
|
|
1412
|
-
{
|
|
1413
|
-
internalType: "bool",
|
|
1414
|
-
name: "cancelable_by_sender",
|
|
1415
|
-
type: "bool"
|
|
1416
|
-
},
|
|
1417
|
-
{
|
|
1418
|
-
internalType: "bool",
|
|
1419
|
-
name: "cancelable_by_recipient",
|
|
1420
|
-
type: "bool"
|
|
1421
|
-
},
|
|
1422
|
-
{
|
|
1423
|
-
internalType: "bool",
|
|
1424
|
-
name: "transferable_by_sender",
|
|
1425
|
-
type: "bool"
|
|
1426
|
-
},
|
|
1427
|
-
{
|
|
1428
|
-
internalType: "bool",
|
|
1429
|
-
name: "transferable_by_recipient",
|
|
1430
|
-
type: "bool"
|
|
1431
|
-
},
|
|
1432
|
-
{
|
|
1433
|
-
internalType: "bool",
|
|
1434
|
-
name: "can_topup",
|
|
1435
|
-
type: "bool"
|
|
1436
|
-
},
|
|
1437
|
-
{
|
|
1438
|
-
internalType: "bool",
|
|
1439
|
-
name: "pausable",
|
|
1440
|
-
type: "bool"
|
|
1441
|
-
},
|
|
1442
|
-
{
|
|
1443
|
-
internalType: "bool",
|
|
1444
|
-
name: "can_update_rate",
|
|
1445
|
-
type: "bool"
|
|
1446
|
-
},
|
|
1447
|
-
{
|
|
1448
|
-
internalType: "bool",
|
|
1449
|
-
name: "automatic_withdrawal",
|
|
1450
|
-
type: "bool"
|
|
1451
|
-
},
|
|
1452
|
-
{
|
|
1453
|
-
internalType: "uint256",
|
|
1454
|
-
name: "withdrawal_frequency",
|
|
1455
|
-
type: "uint256"
|
|
1456
|
-
},
|
|
1457
|
-
{
|
|
1458
|
-
internalType: "string",
|
|
1459
|
-
name: "contract_name",
|
|
1460
|
-
type: "string"
|
|
1461
|
-
}
|
|
1462
|
-
],
|
|
1463
|
-
internalType: "struct ContractMeta",
|
|
1464
|
-
name: "meta",
|
|
1465
|
-
type: "tuple"
|
|
1466
|
-
},
|
|
1467
|
-
{
|
|
1468
|
-
internalType: "uint256",
|
|
1469
|
-
name: "amount",
|
|
1470
|
-
type: "uint256"
|
|
1471
|
-
},
|
|
1472
|
-
{
|
|
1473
|
-
internalType: "uint256",
|
|
1474
|
-
name: "period",
|
|
1475
|
-
type: "uint256"
|
|
1476
|
-
},
|
|
1477
|
-
{
|
|
1478
|
-
internalType: "uint256",
|
|
1479
|
-
name: "amount_per_period",
|
|
1480
|
-
type: "uint256"
|
|
1481
|
-
},
|
|
1482
|
-
{
|
|
1483
|
-
internalType: "uint256",
|
|
1484
|
-
name: "start",
|
|
1485
|
-
type: "uint256"
|
|
1486
|
-
},
|
|
1487
|
-
{
|
|
1488
|
-
internalType: "uint256",
|
|
1489
|
-
name: "end",
|
|
1490
|
-
type: "uint256"
|
|
1491
|
-
},
|
|
1492
|
-
{
|
|
1493
|
-
internalType: "uint256",
|
|
1494
|
-
name: "cliff_amount",
|
|
1495
|
-
type: "uint256"
|
|
1496
|
-
},
|
|
1497
|
-
{
|
|
1498
|
-
internalType: "uint256",
|
|
1499
|
-
name: "withdrawn",
|
|
1500
|
-
type: "uint256"
|
|
1501
|
-
},
|
|
1502
|
-
{
|
|
1503
|
-
internalType: "uint256",
|
|
1504
|
-
name: "last_withdrawn_at",
|
|
1505
|
-
type: "uint256"
|
|
1506
|
-
},
|
|
1507
|
-
{
|
|
1508
|
-
internalType: "uint256",
|
|
1509
|
-
name: "created",
|
|
1510
|
-
type: "uint256"
|
|
1511
|
-
},
|
|
1512
|
-
{
|
|
1513
|
-
internalType: "uint256",
|
|
1514
|
-
name: "canceled_at",
|
|
1515
|
-
type: "uint256"
|
|
1516
|
-
},
|
|
1517
|
-
{
|
|
1518
|
-
internalType: "address",
|
|
1519
|
-
name: "recipient",
|
|
1520
|
-
type: "address"
|
|
1521
|
-
},
|
|
1522
|
-
{
|
|
1523
|
-
internalType: "address",
|
|
1524
|
-
name: "sender",
|
|
1525
|
-
type: "address"
|
|
1526
|
-
},
|
|
1527
|
-
{
|
|
1528
|
-
internalType: "address",
|
|
1529
|
-
name: "partner",
|
|
1530
|
-
type: "address"
|
|
1531
|
-
},
|
|
1532
|
-
{
|
|
1533
|
-
components: [
|
|
1534
|
-
{
|
|
1535
|
-
internalType: "uint256",
|
|
1536
|
-
name: "streamflow_fee_percentage",
|
|
1537
|
-
type: "uint256"
|
|
1538
|
-
},
|
|
1539
|
-
{
|
|
1540
|
-
internalType: "uint256",
|
|
1541
|
-
name: "streamflow_fee",
|
|
1542
|
-
type: "uint256"
|
|
1543
|
-
},
|
|
1544
|
-
{
|
|
1545
|
-
internalType: "uint256",
|
|
1546
|
-
name: "streamflow_fee_withdrawn",
|
|
1547
|
-
type: "uint256"
|
|
1548
|
-
},
|
|
1549
|
-
{
|
|
1550
|
-
internalType: "uint256",
|
|
1551
|
-
name: "partner_fee_percentage",
|
|
1552
|
-
type: "uint256"
|
|
1553
|
-
},
|
|
1554
|
-
{
|
|
1555
|
-
internalType: "uint256",
|
|
1556
|
-
name: "partner_fee",
|
|
1557
|
-
type: "uint256"
|
|
1558
|
-
},
|
|
1559
|
-
{
|
|
1560
|
-
internalType: "uint256",
|
|
1561
|
-
name: "partner_fee_withdrawn",
|
|
1562
|
-
type: "uint256"
|
|
1563
|
-
},
|
|
1564
|
-
{
|
|
1565
|
-
internalType: "uint256",
|
|
1566
|
-
name: "tx_fee",
|
|
1567
|
-
type: "uint256"
|
|
1568
|
-
}
|
|
1569
|
-
],
|
|
1570
|
-
internalType: "struct FeesData",
|
|
1571
|
-
name: "fees",
|
|
1572
|
-
type: "tuple"
|
|
1573
|
-
},
|
|
1574
|
-
{
|
|
1575
|
-
internalType: "bool",
|
|
1576
|
-
name: "closed",
|
|
1577
|
-
type: "bool"
|
|
1578
|
-
},
|
|
1579
|
-
{
|
|
1580
|
-
internalType: "uint256",
|
|
1581
|
-
name: "current_pause_start",
|
|
1582
|
-
type: "uint256"
|
|
1583
|
-
},
|
|
1584
|
-
{
|
|
1585
|
-
internalType: "uint256",
|
|
1586
|
-
name: "pause_cumulative",
|
|
1587
|
-
type: "uint256"
|
|
1588
|
-
},
|
|
1589
|
-
{
|
|
1590
|
-
internalType: "uint256",
|
|
1591
|
-
name: "last_rate_change_time",
|
|
1592
|
-
type: "uint256"
|
|
1593
|
-
},
|
|
1594
|
-
{
|
|
1595
|
-
internalType: "uint256",
|
|
1596
|
-
name: "funds_unlocked_at_last_rate_change",
|
|
1597
|
-
type: "uint256"
|
|
1598
|
-
}
|
|
1599
|
-
],
|
|
1600
|
-
internalType: "struct Contract",
|
|
1601
|
-
name: "",
|
|
1602
|
-
type: "tuple"
|
|
1603
|
-
}
|
|
1604
|
-
],
|
|
1605
|
-
stateMutability: "view",
|
|
1606
|
-
type: "function"
|
|
1607
|
-
},
|
|
1608
|
-
{
|
|
1609
|
-
inputs: [
|
|
1610
|
-
{
|
|
1611
|
-
internalType: "address",
|
|
1612
|
-
name: "_recipient",
|
|
1613
|
-
type: "address"
|
|
1614
|
-
}
|
|
1615
|
-
],
|
|
1616
|
-
name: "getByRecipient",
|
|
1617
|
-
outputs: [
|
|
1618
|
-
{
|
|
1619
|
-
internalType: "address[]",
|
|
1620
|
-
name: "",
|
|
1621
|
-
type: "address[]"
|
|
1622
|
-
}
|
|
1623
|
-
],
|
|
1624
|
-
stateMutability: "view",
|
|
1625
|
-
type: "function"
|
|
1626
|
-
},
|
|
1627
|
-
{
|
|
1628
|
-
inputs: [
|
|
1629
|
-
{
|
|
1630
|
-
internalType: "address",
|
|
1631
|
-
name: "_sender",
|
|
1632
|
-
type: "address"
|
|
1633
|
-
}
|
|
1634
|
-
],
|
|
1635
|
-
name: "getBySender",
|
|
1636
|
-
outputs: [
|
|
1637
|
-
{
|
|
1638
|
-
internalType: "address[]",
|
|
1639
|
-
name: "",
|
|
1640
|
-
type: "address[]"
|
|
1641
|
-
}
|
|
1642
|
-
],
|
|
1643
|
-
stateMutability: "view",
|
|
1644
|
-
type: "function"
|
|
1645
|
-
},
|
|
1646
|
-
{
|
|
1647
|
-
inputs: [
|
|
1648
|
-
{
|
|
1649
|
-
internalType: "address",
|
|
1650
|
-
name: "_address",
|
|
1651
|
-
type: "address"
|
|
1652
|
-
}
|
|
1653
|
-
],
|
|
1654
|
-
name: "getFees",
|
|
1655
|
-
outputs: [
|
|
1656
|
-
{
|
|
1657
|
-
components: [
|
|
1658
|
-
{
|
|
1659
|
-
internalType: "bool",
|
|
1660
|
-
name: "exists",
|
|
1661
|
-
type: "bool"
|
|
1662
|
-
},
|
|
1663
|
-
{
|
|
1664
|
-
internalType: "uint256",
|
|
1665
|
-
name: "streamflow_fee",
|
|
1666
|
-
type: "uint256"
|
|
1667
|
-
},
|
|
1668
|
-
{
|
|
1669
|
-
internalType: "uint256",
|
|
1670
|
-
name: "partner_fee",
|
|
1671
|
-
type: "uint256"
|
|
1672
|
-
}
|
|
1673
|
-
],
|
|
1674
|
-
internalType: "struct StreamflowFeeManager.FeeValue",
|
|
1675
|
-
name: "",
|
|
1676
|
-
type: "tuple"
|
|
1677
|
-
}
|
|
1678
|
-
],
|
|
1679
|
-
stateMutability: "view",
|
|
1680
|
-
type: "function"
|
|
1681
|
-
},
|
|
1682
|
-
{
|
|
1683
|
-
inputs: [
|
|
1684
|
-
{
|
|
1685
|
-
internalType: "address[]",
|
|
1686
|
-
name: "_ids",
|
|
1687
|
-
type: "address[]"
|
|
1688
|
-
}
|
|
1689
|
-
],
|
|
1690
|
-
name: "getMultiple",
|
|
1691
|
-
outputs: [
|
|
1692
|
-
{
|
|
1693
|
-
components: [
|
|
1694
|
-
{
|
|
1695
|
-
internalType: "contract IERC20",
|
|
1696
|
-
name: "token",
|
|
1697
|
-
type: "address"
|
|
1698
|
-
},
|
|
1699
|
-
{
|
|
1700
|
-
components: [
|
|
1701
|
-
{
|
|
1702
|
-
internalType: "bool",
|
|
1703
|
-
name: "cancelable_by_sender",
|
|
1704
|
-
type: "bool"
|
|
1705
|
-
},
|
|
1706
|
-
{
|
|
1707
|
-
internalType: "bool",
|
|
1708
|
-
name: "cancelable_by_recipient",
|
|
1709
|
-
type: "bool"
|
|
1710
|
-
},
|
|
1711
|
-
{
|
|
1712
|
-
internalType: "bool",
|
|
1713
|
-
name: "transferable_by_sender",
|
|
1714
|
-
type: "bool"
|
|
1715
|
-
},
|
|
1716
|
-
{
|
|
1717
|
-
internalType: "bool",
|
|
1718
|
-
name: "transferable_by_recipient",
|
|
1719
|
-
type: "bool"
|
|
1720
|
-
},
|
|
1721
|
-
{
|
|
1722
|
-
internalType: "bool",
|
|
1723
|
-
name: "can_topup",
|
|
1724
|
-
type: "bool"
|
|
1725
|
-
},
|
|
1726
|
-
{
|
|
1727
|
-
internalType: "bool",
|
|
1728
|
-
name: "pausable",
|
|
1729
|
-
type: "bool"
|
|
1730
|
-
},
|
|
1731
|
-
{
|
|
1732
|
-
internalType: "bool",
|
|
1733
|
-
name: "can_update_rate",
|
|
1734
|
-
type: "bool"
|
|
1735
|
-
},
|
|
1736
|
-
{
|
|
1737
|
-
internalType: "bool",
|
|
1738
|
-
name: "automatic_withdrawal",
|
|
1739
|
-
type: "bool"
|
|
1740
|
-
},
|
|
1741
|
-
{
|
|
1742
|
-
internalType: "uint256",
|
|
1743
|
-
name: "withdrawal_frequency",
|
|
1744
|
-
type: "uint256"
|
|
1745
|
-
},
|
|
1746
|
-
{
|
|
1747
|
-
internalType: "string",
|
|
1748
|
-
name: "contract_name",
|
|
1749
|
-
type: "string"
|
|
1750
|
-
}
|
|
1751
|
-
],
|
|
1752
|
-
internalType: "struct ContractMeta",
|
|
1753
|
-
name: "meta",
|
|
1754
|
-
type: "tuple"
|
|
1755
|
-
},
|
|
1756
|
-
{
|
|
1757
|
-
internalType: "uint256",
|
|
1758
|
-
name: "amount",
|
|
1759
|
-
type: "uint256"
|
|
1760
|
-
},
|
|
1761
|
-
{
|
|
1762
|
-
internalType: "uint256",
|
|
1763
|
-
name: "period",
|
|
1764
|
-
type: "uint256"
|
|
1765
|
-
},
|
|
1766
|
-
{
|
|
1767
|
-
internalType: "uint256",
|
|
1768
|
-
name: "amount_per_period",
|
|
1769
|
-
type: "uint256"
|
|
1770
|
-
},
|
|
1771
|
-
{
|
|
1772
|
-
internalType: "uint256",
|
|
1773
|
-
name: "start",
|
|
1774
|
-
type: "uint256"
|
|
1775
|
-
},
|
|
1776
|
-
{
|
|
1777
|
-
internalType: "uint256",
|
|
1778
|
-
name: "end",
|
|
1779
|
-
type: "uint256"
|
|
1780
|
-
},
|
|
1781
|
-
{
|
|
1782
|
-
internalType: "uint256",
|
|
1783
|
-
name: "cliff_amount",
|
|
1784
|
-
type: "uint256"
|
|
1785
|
-
},
|
|
1786
|
-
{
|
|
1787
|
-
internalType: "uint256",
|
|
1788
|
-
name: "withdrawn",
|
|
1789
|
-
type: "uint256"
|
|
1790
|
-
},
|
|
1791
|
-
{
|
|
1792
|
-
internalType: "uint256",
|
|
1793
|
-
name: "last_withdrawn_at",
|
|
1794
|
-
type: "uint256"
|
|
1795
|
-
},
|
|
1796
|
-
{
|
|
1797
|
-
internalType: "uint256",
|
|
1798
|
-
name: "created",
|
|
1799
|
-
type: "uint256"
|
|
1800
|
-
},
|
|
1801
|
-
{
|
|
1802
|
-
internalType: "uint256",
|
|
1803
|
-
name: "canceled_at",
|
|
1804
|
-
type: "uint256"
|
|
1805
|
-
},
|
|
1806
|
-
{
|
|
1807
|
-
internalType: "address",
|
|
1808
|
-
name: "recipient",
|
|
1809
|
-
type: "address"
|
|
1810
|
-
},
|
|
1811
|
-
{
|
|
1812
|
-
internalType: "address",
|
|
1813
|
-
name: "sender",
|
|
1814
|
-
type: "address"
|
|
1815
|
-
},
|
|
1816
|
-
{
|
|
1817
|
-
internalType: "address",
|
|
1818
|
-
name: "partner",
|
|
1819
|
-
type: "address"
|
|
1820
|
-
},
|
|
1821
|
-
{
|
|
1822
|
-
components: [
|
|
1823
|
-
{
|
|
1824
|
-
internalType: "uint256",
|
|
1825
|
-
name: "streamflow_fee_percentage",
|
|
1826
|
-
type: "uint256"
|
|
1827
|
-
},
|
|
1828
|
-
{
|
|
1829
|
-
internalType: "uint256",
|
|
1830
|
-
name: "streamflow_fee",
|
|
1831
|
-
type: "uint256"
|
|
1832
|
-
},
|
|
1833
|
-
{
|
|
1834
|
-
internalType: "uint256",
|
|
1835
|
-
name: "streamflow_fee_withdrawn",
|
|
1836
|
-
type: "uint256"
|
|
1837
|
-
},
|
|
1838
|
-
{
|
|
1839
|
-
internalType: "uint256",
|
|
1840
|
-
name: "partner_fee_percentage",
|
|
1841
|
-
type: "uint256"
|
|
1842
|
-
},
|
|
1843
|
-
{
|
|
1844
|
-
internalType: "uint256",
|
|
1845
|
-
name: "partner_fee",
|
|
1846
|
-
type: "uint256"
|
|
1847
|
-
},
|
|
1848
|
-
{
|
|
1849
|
-
internalType: "uint256",
|
|
1850
|
-
name: "partner_fee_withdrawn",
|
|
1851
|
-
type: "uint256"
|
|
1852
|
-
},
|
|
1853
|
-
{
|
|
1854
|
-
internalType: "uint256",
|
|
1855
|
-
name: "tx_fee",
|
|
1856
|
-
type: "uint256"
|
|
1857
|
-
}
|
|
1858
|
-
],
|
|
1859
|
-
internalType: "struct FeesData",
|
|
1860
|
-
name: "fees",
|
|
1861
|
-
type: "tuple"
|
|
1862
|
-
},
|
|
1863
|
-
{
|
|
1864
|
-
internalType: "bool",
|
|
1865
|
-
name: "closed",
|
|
1866
|
-
type: "bool"
|
|
1867
|
-
},
|
|
1868
|
-
{
|
|
1869
|
-
internalType: "uint256",
|
|
1870
|
-
name: "current_pause_start",
|
|
1871
|
-
type: "uint256"
|
|
1872
|
-
},
|
|
1873
|
-
{
|
|
1874
|
-
internalType: "uint256",
|
|
1875
|
-
name: "pause_cumulative",
|
|
1876
|
-
type: "uint256"
|
|
1877
|
-
},
|
|
1878
|
-
{
|
|
1879
|
-
internalType: "uint256",
|
|
1880
|
-
name: "last_rate_change_time",
|
|
1881
|
-
type: "uint256"
|
|
1882
|
-
},
|
|
1883
|
-
{
|
|
1884
|
-
internalType: "uint256",
|
|
1885
|
-
name: "funds_unlocked_at_last_rate_change",
|
|
1886
|
-
type: "uint256"
|
|
1887
|
-
}
|
|
1888
|
-
],
|
|
1889
|
-
internalType: "struct Contract[]",
|
|
1890
|
-
name: "",
|
|
1891
|
-
type: "tuple[]"
|
|
1892
|
-
}
|
|
1893
|
-
],
|
|
1894
|
-
stateMutability: "view",
|
|
1895
|
-
type: "function"
|
|
1896
|
-
},
|
|
1897
|
-
{
|
|
1898
|
-
inputs: [
|
|
1899
|
-
{
|
|
1900
|
-
internalType: "address",
|
|
1901
|
-
name: "_address",
|
|
1902
|
-
type: "address"
|
|
1903
|
-
}
|
|
1904
|
-
],
|
|
1905
|
-
name: "getStreamflowFee",
|
|
1906
|
-
outputs: [
|
|
1907
|
-
{
|
|
1908
|
-
internalType: "uint256",
|
|
1909
|
-
name: "",
|
|
1910
|
-
type: "uint256"
|
|
1911
|
-
}
|
|
1912
|
-
],
|
|
1913
|
-
stateMutability: "view",
|
|
1914
|
-
type: "function"
|
|
1915
|
-
},
|
|
1916
|
-
{
|
|
1917
|
-
inputs: [],
|
|
1918
|
-
name: "getStreamflowFees",
|
|
1919
|
-
outputs: [
|
|
1920
|
-
{
|
|
1921
|
-
internalType: "uint256",
|
|
1922
|
-
name: "",
|
|
1923
|
-
type: "uint256"
|
|
1924
|
-
}
|
|
1925
|
-
],
|
|
1926
|
-
stateMutability: "view",
|
|
1927
|
-
type: "function"
|
|
1928
|
-
},
|
|
1929
|
-
{
|
|
1930
|
-
inputs: [
|
|
1931
|
-
{
|
|
1932
|
-
internalType: "address",
|
|
1933
|
-
name: "_stream_id",
|
|
1934
|
-
type: "address"
|
|
1935
|
-
},
|
|
1936
|
-
{
|
|
1937
|
-
internalType: "uint256",
|
|
1938
|
-
name: "_amount",
|
|
1939
|
-
type: "uint256"
|
|
1940
|
-
}
|
|
1941
|
-
],
|
|
1942
|
-
name: "getTopUpWithdrawalFees",
|
|
1943
|
-
outputs: [
|
|
1944
|
-
{
|
|
1945
|
-
components: [
|
|
1946
|
-
{
|
|
1947
|
-
internalType: "uint256",
|
|
1948
|
-
name: "value",
|
|
1949
|
-
type: "uint256"
|
|
1950
|
-
},
|
|
1951
|
-
{
|
|
1952
|
-
internalType: "uint256",
|
|
1953
|
-
name: "tx_fee",
|
|
1954
|
-
type: "uint256"
|
|
1955
|
-
}
|
|
1956
|
-
],
|
|
1957
|
-
internalType: "struct WithdrawalFeesData",
|
|
1958
|
-
name: "",
|
|
1959
|
-
type: "tuple"
|
|
1960
|
-
}
|
|
1961
|
-
],
|
|
1962
|
-
stateMutability: "view",
|
|
1963
|
-
type: "function"
|
|
1964
|
-
},
|
|
1965
|
-
{
|
|
1966
|
-
inputs: [],
|
|
1967
|
-
name: "getTreasuryAddress",
|
|
1968
|
-
outputs: [
|
|
1969
|
-
{
|
|
1970
|
-
internalType: "address payable",
|
|
1971
|
-
name: "",
|
|
1972
|
-
type: "address"
|
|
1973
|
-
}
|
|
1974
|
-
],
|
|
1975
|
-
stateMutability: "view",
|
|
1976
|
-
type: "function"
|
|
1977
|
-
},
|
|
1978
|
-
{
|
|
1979
|
-
inputs: [],
|
|
1980
|
-
name: "getTxFee",
|
|
1981
|
-
outputs: [
|
|
1982
|
-
{
|
|
1983
|
-
internalType: "uint256",
|
|
1984
|
-
name: "",
|
|
1985
|
-
type: "uint256"
|
|
1986
|
-
}
|
|
1987
|
-
],
|
|
1988
|
-
stateMutability: "view",
|
|
1989
|
-
type: "function"
|
|
1990
|
-
},
|
|
1991
|
-
{
|
|
1992
|
-
inputs: [
|
|
1993
|
-
{
|
|
1994
|
-
internalType: "uint256",
|
|
1995
|
-
name: "_amount",
|
|
1996
|
-
type: "uint256"
|
|
1997
|
-
},
|
|
1998
|
-
{
|
|
1999
|
-
internalType: "uint256",
|
|
2000
|
-
name: "_period",
|
|
2001
|
-
type: "uint256"
|
|
2002
|
-
},
|
|
2003
|
-
{
|
|
2004
|
-
internalType: "uint256",
|
|
2005
|
-
name: "_amount_per_period",
|
|
2006
|
-
type: "uint256"
|
|
2007
|
-
},
|
|
2008
|
-
{
|
|
2009
|
-
internalType: "uint256",
|
|
2010
|
-
name: "_start",
|
|
2011
|
-
type: "uint256"
|
|
2012
|
-
},
|
|
2013
|
-
{
|
|
2014
|
-
internalType: "uint256",
|
|
2015
|
-
name: "_cliff_amount",
|
|
2016
|
-
type: "uint256"
|
|
2017
|
-
},
|
|
2018
|
-
{
|
|
2019
|
-
internalType: "bool",
|
|
2020
|
-
name: "_automatic_withdrawal",
|
|
2021
|
-
type: "bool"
|
|
2022
|
-
},
|
|
2023
|
-
{
|
|
2024
|
-
internalType: "uint256",
|
|
2025
|
-
name: "_withdrawal_frequency",
|
|
2026
|
-
type: "uint256"
|
|
2027
|
-
}
|
|
2028
|
-
],
|
|
2029
|
-
name: "getWithdrawalFees",
|
|
2030
|
-
outputs: [
|
|
2031
|
-
{
|
|
2032
|
-
components: [
|
|
2033
|
-
{
|
|
2034
|
-
internalType: "uint256",
|
|
2035
|
-
name: "value",
|
|
2036
|
-
type: "uint256"
|
|
2037
|
-
},
|
|
2038
|
-
{
|
|
2039
|
-
internalType: "uint256",
|
|
2040
|
-
name: "tx_fee",
|
|
2041
|
-
type: "uint256"
|
|
2042
|
-
}
|
|
2043
|
-
],
|
|
2044
|
-
internalType: "struct WithdrawalFeesData",
|
|
2045
|
-
name: "",
|
|
2046
|
-
type: "tuple"
|
|
2047
|
-
}
|
|
2048
|
-
],
|
|
2049
|
-
stateMutability: "view",
|
|
2050
|
-
type: "function"
|
|
2051
|
-
},
|
|
2052
|
-
{
|
|
2053
|
-
inputs: [],
|
|
2054
|
-
name: "getWithdraworAddress",
|
|
2055
|
-
outputs: [
|
|
2056
|
-
{
|
|
2057
|
-
internalType: "address payable",
|
|
2058
|
-
name: "",
|
|
2059
|
-
type: "address"
|
|
2060
|
-
}
|
|
2061
|
-
],
|
|
2062
|
-
stateMutability: "view",
|
|
2063
|
-
type: "function"
|
|
2064
|
-
},
|
|
2065
|
-
{
|
|
2066
|
-
inputs: [],
|
|
2067
|
-
name: "initialize",
|
|
2068
|
-
outputs: [],
|
|
2069
|
-
stateMutability: "nonpayable",
|
|
2070
|
-
type: "function"
|
|
2071
|
-
},
|
|
2072
|
-
{
|
|
2073
|
-
inputs: [
|
|
2074
|
-
{
|
|
2075
|
-
internalType: "address",
|
|
2076
|
-
name: "_stream_id",
|
|
2077
|
-
type: "address"
|
|
2078
|
-
},
|
|
2079
|
-
{
|
|
2080
|
-
internalType: "uint256",
|
|
2081
|
-
name: "_amount",
|
|
2082
|
-
type: "uint256"
|
|
2083
|
-
}
|
|
2084
|
-
],
|
|
2085
|
-
name: "topUp",
|
|
2086
|
-
outputs: [],
|
|
2087
|
-
stateMutability: "payable",
|
|
2088
|
-
type: "function"
|
|
2089
|
-
},
|
|
2090
|
-
{
|
|
2091
|
-
inputs: [
|
|
2092
|
-
{
|
|
2093
|
-
internalType: "address",
|
|
2094
|
-
name: "_stream_id",
|
|
2095
|
-
type: "address"
|
|
2096
|
-
},
|
|
2097
|
-
{
|
|
2098
|
-
internalType: "address",
|
|
2099
|
-
name: "new_recipient",
|
|
2100
|
-
type: "address"
|
|
2101
|
-
}
|
|
2102
|
-
],
|
|
2103
|
-
name: "transfer",
|
|
2104
|
-
outputs: [],
|
|
2105
|
-
stateMutability: "nonpayable",
|
|
2106
|
-
type: "function"
|
|
2107
|
-
},
|
|
2108
|
-
{
|
|
2109
|
-
inputs: [
|
|
2110
|
-
{
|
|
2111
|
-
internalType: "address",
|
|
2112
|
-
name: "_new_admin",
|
|
2113
|
-
type: "address"
|
|
2114
|
-
}
|
|
2115
|
-
],
|
|
2116
|
-
name: "transferAdmin",
|
|
2117
|
-
outputs: [],
|
|
2118
|
-
stateMutability: "nonpayable",
|
|
2119
|
-
type: "function"
|
|
2120
|
-
},
|
|
2121
|
-
{
|
|
2122
|
-
inputs: [
|
|
2123
|
-
{
|
|
2124
|
-
internalType: "address",
|
|
2125
|
-
name: "_stream_id",
|
|
2126
|
-
type: "address"
|
|
2127
|
-
},
|
|
2128
|
-
{
|
|
2129
|
-
internalType: "bool[]",
|
|
2130
|
-
name: "_automatic_withdrawal",
|
|
2131
|
-
type: "bool[]"
|
|
2132
|
-
},
|
|
2133
|
-
{
|
|
2134
|
-
internalType: "uint256[]",
|
|
2135
|
-
name: "_withdrawal_frequency",
|
|
2136
|
-
type: "uint256[]"
|
|
2137
|
-
},
|
|
2138
|
-
{
|
|
2139
|
-
internalType: "uint256[]",
|
|
2140
|
-
name: "_amount_per_period",
|
|
2141
|
-
type: "uint256[]"
|
|
2142
|
-
}
|
|
2143
|
-
],
|
|
2144
|
-
name: "update",
|
|
2145
|
-
outputs: [],
|
|
2146
|
-
stateMutability: "payable",
|
|
2147
|
-
type: "function"
|
|
2148
|
-
},
|
|
2149
|
-
{
|
|
2150
|
-
inputs: [
|
|
2151
|
-
{
|
|
2152
|
-
internalType: "address",
|
|
2153
|
-
name: "_stream_id",
|
|
2154
|
-
type: "address"
|
|
2155
|
-
},
|
|
2156
|
-
{
|
|
2157
|
-
internalType: "uint256",
|
|
2158
|
-
name: "_amount",
|
|
2159
|
-
type: "uint256"
|
|
2160
|
-
}
|
|
2161
|
-
],
|
|
2162
|
-
name: "withdraw",
|
|
2163
|
-
outputs: [],
|
|
2164
|
-
stateMutability: "nonpayable",
|
|
2165
|
-
type: "function"
|
|
2166
|
-
}
|
|
2167
|
-
];
|
|
2168
|
-
|
|
2169
|
-
// evm/ercAbi.ts
|
|
2170
|
-
var ercAbi_default = [
|
|
2171
|
-
{
|
|
2172
|
-
constant: true,
|
|
2173
|
-
inputs: [],
|
|
2174
|
-
name: "name",
|
|
2175
|
-
outputs: [
|
|
2176
|
-
{
|
|
2177
|
-
name: "",
|
|
2178
|
-
type: "string"
|
|
2179
|
-
}
|
|
2180
|
-
],
|
|
2181
|
-
payable: false,
|
|
2182
|
-
stateMutability: "view",
|
|
2183
|
-
type: "function"
|
|
2184
|
-
},
|
|
2185
|
-
{
|
|
2186
|
-
constant: false,
|
|
2187
|
-
inputs: [
|
|
2188
|
-
{
|
|
2189
|
-
name: "_spender",
|
|
2190
|
-
type: "address"
|
|
2191
|
-
},
|
|
2192
|
-
{
|
|
2193
|
-
name: "_value",
|
|
2194
|
-
type: "uint256"
|
|
2195
|
-
}
|
|
2196
|
-
],
|
|
2197
|
-
name: "approve",
|
|
2198
|
-
outputs: [
|
|
2199
|
-
{
|
|
2200
|
-
name: "",
|
|
2201
|
-
type: "bool"
|
|
2202
|
-
}
|
|
2203
|
-
],
|
|
2204
|
-
payable: false,
|
|
2205
|
-
stateMutability: "nonpayable",
|
|
2206
|
-
type: "function"
|
|
2207
|
-
},
|
|
2208
|
-
{
|
|
2209
|
-
constant: true,
|
|
2210
|
-
inputs: [],
|
|
2211
|
-
name: "totalSupply",
|
|
2212
|
-
outputs: [
|
|
2213
|
-
{
|
|
2214
|
-
name: "",
|
|
2215
|
-
type: "uint256"
|
|
2216
|
-
}
|
|
2217
|
-
],
|
|
2218
|
-
payable: false,
|
|
2219
|
-
stateMutability: "view",
|
|
2220
|
-
type: "function"
|
|
2221
|
-
},
|
|
2222
|
-
{
|
|
2223
|
-
constant: false,
|
|
2224
|
-
inputs: [
|
|
2225
|
-
{
|
|
2226
|
-
name: "_from",
|
|
2227
|
-
type: "address"
|
|
2228
|
-
},
|
|
2229
|
-
{
|
|
2230
|
-
name: "_to",
|
|
2231
|
-
type: "address"
|
|
2232
|
-
},
|
|
2233
|
-
{
|
|
2234
|
-
name: "_value",
|
|
2235
|
-
type: "uint256"
|
|
2236
|
-
}
|
|
2237
|
-
],
|
|
2238
|
-
name: "transferFrom",
|
|
2239
|
-
outputs: [
|
|
2240
|
-
{
|
|
2241
|
-
name: "",
|
|
2242
|
-
type: "bool"
|
|
2243
|
-
}
|
|
2244
|
-
],
|
|
2245
|
-
payable: false,
|
|
2246
|
-
stateMutability: "nonpayable",
|
|
2247
|
-
type: "function"
|
|
2248
|
-
},
|
|
2249
|
-
{
|
|
2250
|
-
constant: true,
|
|
2251
|
-
inputs: [],
|
|
2252
|
-
name: "decimals",
|
|
2253
|
-
outputs: [
|
|
2254
|
-
{
|
|
2255
|
-
name: "",
|
|
2256
|
-
type: "uint8"
|
|
2257
|
-
}
|
|
2258
|
-
],
|
|
2259
|
-
payable: false,
|
|
2260
|
-
stateMutability: "view",
|
|
2261
|
-
type: "function"
|
|
2262
|
-
},
|
|
2263
|
-
{
|
|
2264
|
-
constant: true,
|
|
2265
|
-
inputs: [
|
|
2266
|
-
{
|
|
2267
|
-
name: "_owner",
|
|
2268
|
-
type: "address"
|
|
2269
|
-
}
|
|
2270
|
-
],
|
|
2271
|
-
name: "balanceOf",
|
|
2272
|
-
outputs: [
|
|
2273
|
-
{
|
|
2274
|
-
name: "balance",
|
|
2275
|
-
type: "uint256"
|
|
2276
|
-
}
|
|
2277
|
-
],
|
|
2278
|
-
payable: false,
|
|
2279
|
-
stateMutability: "view",
|
|
2280
|
-
type: "function"
|
|
2281
|
-
},
|
|
2282
|
-
{
|
|
2283
|
-
constant: true,
|
|
2284
|
-
inputs: [],
|
|
2285
|
-
name: "symbol",
|
|
2286
|
-
outputs: [
|
|
2287
|
-
{
|
|
2288
|
-
name: "",
|
|
2289
|
-
type: "string"
|
|
2290
|
-
}
|
|
2291
|
-
],
|
|
2292
|
-
payable: false,
|
|
2293
|
-
stateMutability: "view",
|
|
2294
|
-
type: "function"
|
|
2295
|
-
},
|
|
2296
|
-
{
|
|
2297
|
-
constant: false,
|
|
2298
|
-
inputs: [
|
|
2299
|
-
{
|
|
2300
|
-
name: "_to",
|
|
2301
|
-
type: "address"
|
|
2302
|
-
},
|
|
2303
|
-
{
|
|
2304
|
-
name: "_value",
|
|
2305
|
-
type: "uint256"
|
|
2306
|
-
}
|
|
2307
|
-
],
|
|
2308
|
-
name: "transfer",
|
|
2309
|
-
outputs: [
|
|
2310
|
-
{
|
|
2311
|
-
name: "",
|
|
2312
|
-
type: "bool"
|
|
2313
|
-
}
|
|
2314
|
-
],
|
|
2315
|
-
payable: false,
|
|
2316
|
-
stateMutability: "nonpayable",
|
|
2317
|
-
type: "function"
|
|
2318
|
-
},
|
|
2319
|
-
{
|
|
2320
|
-
constant: true,
|
|
2321
|
-
inputs: [
|
|
2322
|
-
{
|
|
2323
|
-
name: "_owner",
|
|
2324
|
-
type: "address"
|
|
2325
|
-
},
|
|
2326
|
-
{
|
|
2327
|
-
name: "_spender",
|
|
2328
|
-
type: "address"
|
|
2329
|
-
}
|
|
2330
|
-
],
|
|
2331
|
-
name: "allowance",
|
|
2332
|
-
outputs: [
|
|
2333
|
-
{
|
|
2334
|
-
name: "",
|
|
2335
|
-
type: "uint256"
|
|
2336
|
-
}
|
|
2337
|
-
],
|
|
2338
|
-
payable: false,
|
|
2339
|
-
stateMutability: "view",
|
|
2340
|
-
type: "function"
|
|
2341
|
-
},
|
|
2342
|
-
{
|
|
2343
|
-
payable: true,
|
|
2344
|
-
stateMutability: "payable",
|
|
2345
|
-
type: "fallback"
|
|
2346
|
-
},
|
|
2347
|
-
{
|
|
2348
|
-
anonymous: false,
|
|
2349
|
-
inputs: [
|
|
2350
|
-
{
|
|
2351
|
-
indexed: true,
|
|
2352
|
-
name: "owner",
|
|
2353
|
-
type: "address"
|
|
2354
|
-
},
|
|
2355
|
-
{
|
|
2356
|
-
indexed: true,
|
|
2357
|
-
name: "spender",
|
|
2358
|
-
type: "address"
|
|
2359
|
-
},
|
|
2360
|
-
{
|
|
2361
|
-
indexed: false,
|
|
2362
|
-
name: "value",
|
|
2363
|
-
type: "uint256"
|
|
2364
|
-
}
|
|
2365
|
-
],
|
|
2366
|
-
name: "Approval",
|
|
2367
|
-
type: "event"
|
|
2368
|
-
},
|
|
2369
|
-
{
|
|
2370
|
-
anonymous: false,
|
|
2371
|
-
inputs: [
|
|
2372
|
-
{
|
|
2373
|
-
indexed: true,
|
|
2374
|
-
name: "from",
|
|
2375
|
-
type: "address"
|
|
2376
|
-
},
|
|
2377
|
-
{
|
|
2378
|
-
indexed: true,
|
|
2379
|
-
name: "to",
|
|
2380
|
-
type: "address"
|
|
2381
|
-
},
|
|
2382
|
-
{
|
|
2383
|
-
indexed: false,
|
|
2384
|
-
name: "value",
|
|
2385
|
-
type: "uint256"
|
|
2386
|
-
}
|
|
2387
|
-
],
|
|
2388
|
-
name: "Transfer",
|
|
2389
|
-
type: "event"
|
|
2390
|
-
}
|
|
2391
|
-
];
|
|
2392
|
-
var EvmContract = class {
|
|
2393
|
-
constructor(stream) {
|
|
2394
|
-
this.magic = 0;
|
|
2395
|
-
this.version = 0;
|
|
2396
|
-
this.createdAt = stream.created.toNumber();
|
|
2397
|
-
this.withdrawnAmount = new BN7__default.default(stream.withdrawn.toString());
|
|
2398
|
-
this.canceledAt = stream.canceled_at.toNumber();
|
|
2399
|
-
this.end = stream.end.toNumber();
|
|
2400
|
-
this.lastWithdrawnAt = stream.last_withdrawn_at.toNumber();
|
|
2401
|
-
this.sender = stream.sender;
|
|
2402
|
-
this.senderTokens = stream.sender;
|
|
2403
|
-
this.recipient = stream.recipient;
|
|
2404
|
-
this.recipientTokens = stream.recipient;
|
|
2405
|
-
this.mint = stream.token.toLowerCase();
|
|
2406
|
-
this.escrowTokens = "";
|
|
2407
|
-
this.streamflowTreasury = "";
|
|
2408
|
-
this.streamflowTreasuryTokens = "";
|
|
2409
|
-
this.streamflowFeeTotal = new BN7__default.default(stream.fees.streamflow_fee.toString());
|
|
2410
|
-
this.streamflowFeeWithdrawn = new BN7__default.default(stream.fees.streamflow_fee_withdrawn.toString());
|
|
2411
|
-
this.streamflowFeePercent = stream.fees.streamflow_fee_percentage.toNumber() / 1e4;
|
|
2412
|
-
this.partnerFeeTotal = new BN7__default.default(0);
|
|
2413
|
-
this.partnerFeeWithdrawn = new BN7__default.default(0);
|
|
2414
|
-
this.partnerFeePercent = 0;
|
|
2415
|
-
this.partner = "";
|
|
2416
|
-
this.partnerTokens = "";
|
|
2417
|
-
this.start = stream.start.toNumber();
|
|
2418
|
-
this.depositedAmount = new BN7__default.default(stream.amount.toString());
|
|
2419
|
-
this.period = stream.period.toNumber();
|
|
2420
|
-
this.amountPerPeriod = new BN7__default.default(stream.amount_per_period.toString());
|
|
2421
|
-
this.cliff = stream.start.toNumber();
|
|
2422
|
-
this.cliffAmount = new BN7__default.default(stream.cliff_amount.toString());
|
|
2423
|
-
this.cancelableBySender = stream.meta.cancelable_by_sender;
|
|
2424
|
-
this.cancelableByRecipient = stream.meta.cancelable_by_recipient;
|
|
2425
|
-
this.automaticWithdrawal = stream.meta.automatic_withdrawal;
|
|
2426
|
-
this.transferableBySender = stream.meta.transferable_by_sender;
|
|
2427
|
-
this.transferableByRecipient = stream.meta.transferable_by_recipient;
|
|
2428
|
-
this.canTopup = stream.meta.can_topup;
|
|
2429
|
-
this.name = stream.meta.contract_name;
|
|
2430
|
-
this.withdrawalFrequency = stream.meta.withdrawal_frequency.toNumber();
|
|
2431
|
-
this.closed = stream.closed;
|
|
2432
|
-
this.currentPauseStart = stream.current_pause_start.toNumber();
|
|
2433
|
-
this.pauseCumulative = new BN7__default.default(stream.pause_cumulative.toString());
|
|
2434
|
-
this.lastRateChangeTime = stream.last_rate_change_time.toNumber();
|
|
2435
|
-
this.fundsUnlockedAtLastRateChange = new BN7__default.default(stream.funds_unlocked_at_last_rate_change.toString());
|
|
2436
|
-
this.type = buildStreamType(this);
|
|
2437
|
-
}
|
|
2438
|
-
unlocked(currentTimestamp) {
|
|
2439
|
-
return calculateUnlockedAmount({
|
|
2440
|
-
...this,
|
|
2441
|
-
currentTimestamp
|
|
2442
|
-
});
|
|
2443
|
-
}
|
|
2444
|
-
remaining(decimals) {
|
|
2445
|
-
return getNumberFromBN(this.depositedAmount.sub(this.withdrawnAmount), decimals);
|
|
2446
|
-
}
|
|
2447
|
-
};
|
|
2448
|
-
|
|
2449
|
-
// evm/utils.ts
|
|
2450
|
-
function extractEvmErrorCode(errorText) {
|
|
2451
|
-
const match = EVM_ERROR_MATCH_REGEX.exec(errorText);
|
|
2452
|
-
if (!match) {
|
|
2453
|
-
return null;
|
|
2454
|
-
}
|
|
2455
|
-
return match[1];
|
|
2456
|
-
}
|
|
2457
|
-
|
|
2458
|
-
// evm/StreamClient.ts
|
|
2459
|
-
var EvmStreamClient = class extends BaseStreamClient {
|
|
2460
|
-
constructor(clusterUrl, chain, signer, cluster = common.ICluster.Mainnet, programId) {
|
|
2461
|
-
super();
|
|
2462
|
-
if (chain !== common.IChain.Ethereum && chain !== common.IChain.BNB && chain !== common.IChain.Polygon) {
|
|
2463
|
-
throw new Error("Wrong chain. Supported chains are Ethereum , BNB and Polygon!");
|
|
2464
|
-
}
|
|
2465
|
-
if (programId) {
|
|
2466
|
-
this.programId = programId;
|
|
2467
|
-
} else {
|
|
2468
|
-
switch (chain) {
|
|
2469
|
-
case common.IChain.Ethereum:
|
|
2470
|
-
this.programId = ETHEREUM_PROGRAM_IDS[cluster];
|
|
2471
|
-
break;
|
|
2472
|
-
case common.IChain.BNB:
|
|
2473
|
-
this.programId = BNB_PROGRAM_IDS[cluster];
|
|
2474
|
-
break;
|
|
2475
|
-
case common.IChain.Polygon:
|
|
2476
|
-
this.programId = POLYGON_PROGRAM_IDS[cluster];
|
|
2477
|
-
break;
|
|
2478
|
-
}
|
|
2479
|
-
}
|
|
2480
|
-
this.provider = new ethers.ethers.providers.JsonRpcProvider(clusterUrl);
|
|
2481
|
-
this.signer = signer;
|
|
2482
|
-
const baseContract = new ethers.ethers.Contract(this.programId, abi_default);
|
|
2483
|
-
this.readContract = baseContract.connect(this.provider);
|
|
2484
|
-
this.writeContract = baseContract.connect(this.signer);
|
|
2485
|
-
}
|
|
2486
|
-
async create(streamData) {
|
|
2487
|
-
const multiParams = {
|
|
2488
|
-
...streamData,
|
|
2489
|
-
recipients: [streamData]
|
|
2490
|
-
};
|
|
2491
|
-
const fees = await this.readContract.getWithdrawalFees(...this.getFeeParams(multiParams));
|
|
2492
|
-
const args = (await this.generateMultiPayloads(multiParams))[0];
|
|
2493
|
-
const sum = streamData.amount.mul(new BN7__default.default(BASE_FEE)).div(new BN7__default.default(1e6));
|
|
2494
|
-
await this.approveTokens(streamData.tokenId, sum);
|
|
2495
|
-
const result = await this.writeContract.create(...args, {
|
|
2496
|
-
value: fees.value
|
|
2497
|
-
});
|
|
2498
|
-
const confirmedTx = await result.wait();
|
|
2499
|
-
const metadataId = this.formatMetadataId(
|
|
2500
|
-
confirmedTx.events.find((item) => item.event === "ContractCreated").args[0]
|
|
2501
|
-
);
|
|
2502
|
-
return {
|
|
2503
|
-
ixs: [],
|
|
2504
|
-
txId: result.hash,
|
|
2505
|
-
metadataId
|
|
2506
|
-
};
|
|
2507
|
-
}
|
|
2508
|
-
async createMultiple(multipleStreamData) {
|
|
2509
|
-
const fees = await this.readContract.getWithdrawalFees(...this.getFeeParams(multipleStreamData));
|
|
2510
|
-
const args = await this.generateMultiPayloads(multipleStreamData);
|
|
2511
|
-
const sum = multipleStreamData.recipients.reduce((acc, v) => acc.add(v.amount), new BN7__default.default(0)).mul(new BN7__default.default(BASE_FEE)).div(new BN7__default.default(1e6));
|
|
2512
|
-
await this.approveTokens(multipleStreamData.tokenId, sum);
|
|
2513
|
-
const creationPromises = args.map((item) => this.writeContract.create(...item, { value: fees.value }));
|
|
2514
|
-
const signatures = [];
|
|
2515
|
-
const results = await Promise.all(creationPromises);
|
|
2516
|
-
const confirmations = await Promise.allSettled(results.map((result) => result.wait()));
|
|
2517
|
-
const successes = confirmations.filter((el) => el.status === "fulfilled").map((el) => el.value);
|
|
2518
|
-
signatures.push(...successes.map((el) => el.hash));
|
|
2519
|
-
const metadatas = confirmations.map(
|
|
2520
|
-
(result) => result.status === "fulfilled" ? this.formatMetadataId(
|
|
2521
|
-
result.value.events.find((item) => item.event === "ContractCreated").args[0]
|
|
2522
|
-
) : null
|
|
2523
|
-
);
|
|
2524
|
-
const metadataToRecipient = metadatas.reduce(
|
|
2525
|
-
(acc, value, index) => {
|
|
2526
|
-
if (value) {
|
|
2527
|
-
acc[value] = multipleStreamData.recipients[index];
|
|
2528
|
-
}
|
|
2529
|
-
return acc;
|
|
2530
|
-
},
|
|
2531
|
-
{}
|
|
2532
|
-
);
|
|
2533
|
-
const failures = confirmations.filter((el) => el.status === "rejected").map((el) => el.reason);
|
|
2534
|
-
return {
|
|
2535
|
-
txs: signatures,
|
|
2536
|
-
metadatas: metadatas.filter(Boolean),
|
|
2537
|
-
metadataToRecipient,
|
|
2538
|
-
errors: failures
|
|
2539
|
-
};
|
|
2540
|
-
}
|
|
2541
|
-
async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }) {
|
|
2542
|
-
const result = await this.writeContract.withdraw(id, amount.toString());
|
|
2543
|
-
return {
|
|
2544
|
-
ixs: [],
|
|
2545
|
-
txId: result.hash
|
|
2546
|
-
};
|
|
2547
|
-
}
|
|
2548
|
-
async cancel(cancelData) {
|
|
2549
|
-
const result = await this.writeContract.cancel(cancelData.id);
|
|
2550
|
-
return {
|
|
2551
|
-
ixs: [],
|
|
2552
|
-
txId: result.hash
|
|
2553
|
-
};
|
|
2554
|
-
}
|
|
2555
|
-
async transfer(transferData) {
|
|
2556
|
-
const result = await this.writeContract.transfer(transferData.id, transferData.newRecipient);
|
|
2557
|
-
return {
|
|
2558
|
-
ixs: [],
|
|
2559
|
-
txId: result.hash
|
|
2560
|
-
};
|
|
2561
|
-
}
|
|
2562
|
-
async topup(topupData) {
|
|
2563
|
-
const fees = await this.readContract.getTopUpWithdrawalFees(topupData.id, topupData.amount.toString());
|
|
2564
|
-
const sum = topupData.amount.mul(new BN7__default.default(BASE_FEE)).div(new BN7__default.default(1e6));
|
|
2565
|
-
const stream = await this.getOne({ id: topupData.id });
|
|
2566
|
-
await this.approveTokens(stream.mint, sum);
|
|
2567
|
-
const result = await this.writeContract.topUp(topupData.id, topupData.amount.toString(), {
|
|
2568
|
-
value: fees.value
|
|
2569
|
-
});
|
|
2570
|
-
return {
|
|
2571
|
-
ixs: [],
|
|
2572
|
-
txId: result.hash
|
|
2573
|
-
};
|
|
2574
|
-
}
|
|
2575
|
-
async update(updateData) {
|
|
2576
|
-
const result = await this.writeContract.update(
|
|
2577
|
-
updateData.id,
|
|
2578
|
-
updateData.enableAutomaticWithdrawal ? [true] : [],
|
|
2579
|
-
updateData.withdrawFrequency ? [updateData.withdrawFrequency.toString()] : [],
|
|
2580
|
-
updateData.amountPerPeriod ? [updateData.amountPerPeriod.toString()] : []
|
|
2581
|
-
);
|
|
2582
|
-
return {
|
|
2583
|
-
ixs: [],
|
|
2584
|
-
txId: result.hash
|
|
2585
|
-
};
|
|
2586
|
-
}
|
|
2587
|
-
async getOne({ id }) {
|
|
2588
|
-
const result = await this.readContract.getById(id);
|
|
2589
|
-
return new EvmContract(result);
|
|
2590
|
-
}
|
|
2591
|
-
async get({
|
|
2592
|
-
address,
|
|
2593
|
-
// type = StreamType.All,
|
|
2594
|
-
direction = "all" /* All */
|
|
2595
|
-
}) {
|
|
2596
|
-
const addresses = [];
|
|
2597
|
-
if (direction === "all" /* All */ || direction === "outgoing" /* Outgoing */) {
|
|
2598
|
-
const senderAddresses = await this.readContract.getBySender(address);
|
|
2599
|
-
addresses.push(...senderAddresses);
|
|
2600
|
-
}
|
|
2601
|
-
if (direction === "all" /* All */ || direction === "incoming" /* Incoming */) {
|
|
2602
|
-
const recipientAddresses = await this.readContract.getByRecipient(address);
|
|
2603
|
-
addresses.push(...recipientAddresses);
|
|
2604
|
-
}
|
|
2605
|
-
const uniqueAddresses = [...new Set(addresses)];
|
|
2606
|
-
const results = await this.readContract.getMultiple(uniqueAddresses);
|
|
2607
|
-
return results.map((result, index) => [uniqueAddresses[index], new EvmContract(result)]);
|
|
2608
|
-
}
|
|
2609
|
-
extractErrorCode(err) {
|
|
2610
|
-
return extractEvmErrorCode(err.toString() ?? "Unknown error!");
|
|
2611
|
-
}
|
|
2612
|
-
async getFees({ address }) {
|
|
2613
|
-
const fees = await this.readContract.getFees(address);
|
|
2614
|
-
if (!fees.exists) {
|
|
2615
|
-
return null;
|
|
2616
|
-
}
|
|
2617
|
-
return {
|
|
2618
|
-
streamflowFee: fees.streamflow_fee.toNumber() / 100,
|
|
2619
|
-
partnerFee: fees.partner_fee.toNumber() / 100
|
|
2620
|
-
};
|
|
2621
|
-
}
|
|
2622
|
-
async getDefaultStreamflowFee() {
|
|
2623
|
-
const fee = await this.readContract.getStreamflowFees();
|
|
2624
|
-
return fee.toNumber() / 100;
|
|
2625
|
-
}
|
|
2626
|
-
/**
|
|
2627
|
-
* Returns StreamClient protocol program ID.
|
|
2628
|
-
*/
|
|
2629
|
-
getProgramId() {
|
|
2630
|
-
return this.programId;
|
|
2631
|
-
}
|
|
2632
|
-
async approveTokens(tokenId, amount) {
|
|
2633
|
-
const tokenContract = new ethers.ethers.Contract(tokenId, ercAbi_default, this.signer);
|
|
2634
|
-
const address = await this.signer.getAddress();
|
|
2635
|
-
const allowance = await tokenContract.allowance(address, this.programId);
|
|
2636
|
-
if (new BN7__default.default(allowance.toString()).gte(amount)) {
|
|
2637
|
-
return;
|
|
2638
|
-
}
|
|
2639
|
-
const approvalTx = await tokenContract.approve(this.programId, amount.toString());
|
|
2640
|
-
await approvalTx.wait();
|
|
2641
|
-
}
|
|
2642
|
-
// Utility function to prepare transaction payloads for multiple recipients.
|
|
2643
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2644
|
-
async generateMultiPayloads(multipleStreamData) {
|
|
2645
|
-
const sender = await this.signer.getAddress();
|
|
2646
|
-
return multipleStreamData.recipients.map((recipient) => {
|
|
2647
|
-
return [
|
|
2648
|
-
multipleStreamData.tokenId,
|
|
2649
|
-
recipient.amount.toString(),
|
|
2650
|
-
multipleStreamData.period,
|
|
2651
|
-
recipient.amountPerPeriod.toString(),
|
|
2652
|
-
multipleStreamData.start,
|
|
2653
|
-
recipient.cliffAmount.toString(),
|
|
2654
|
-
[
|
|
2655
|
-
multipleStreamData.cancelableBySender,
|
|
2656
|
-
multipleStreamData.cancelableByRecipient,
|
|
2657
|
-
multipleStreamData.transferableBySender,
|
|
2658
|
-
multipleStreamData.transferableByRecipient,
|
|
2659
|
-
multipleStreamData.canTopup,
|
|
2660
|
-
multipleStreamData.canPause || false,
|
|
2661
|
-
multipleStreamData.canUpdateRate || false,
|
|
2662
|
-
multipleStreamData.automaticWithdrawal || false,
|
|
2663
|
-
multipleStreamData.withdrawalFrequency || 0,
|
|
2664
|
-
recipient.name
|
|
2665
|
-
],
|
|
2666
|
-
recipient.recipient,
|
|
2667
|
-
multipleStreamData.partner || sender
|
|
2668
|
-
];
|
|
2669
|
-
});
|
|
2670
|
-
}
|
|
2671
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2672
|
-
getFeeParams(multipleStreamData) {
|
|
2673
|
-
return [
|
|
2674
|
-
multipleStreamData.recipients[0].amount.toString(),
|
|
2675
|
-
multipleStreamData.period,
|
|
2676
|
-
multipleStreamData.recipients[0].amountPerPeriod.toString(),
|
|
2677
|
-
multipleStreamData.start,
|
|
2678
|
-
multipleStreamData.recipients[0].cliffAmount.toString(),
|
|
2679
|
-
multipleStreamData.automaticWithdrawal || false,
|
|
2680
|
-
multipleStreamData.withdrawalFrequency || 0
|
|
2681
|
-
];
|
|
2682
|
-
}
|
|
2683
|
-
formatMetadataId(id) {
|
|
2684
|
-
return ethereumChecksumAddress.toChecksumAddress(`0x${id.slice(-40)}`);
|
|
2685
|
-
}
|
|
2686
|
-
};
|
|
2687
|
-
|
|
2688
|
-
// solana/index.ts
|
|
2689
|
-
var solana_exports = {};
|
|
2690
|
-
__export(solana_exports, {
|
|
2691
|
-
AlignedContract: () => AlignedContract,
|
|
2692
|
-
Contract: () => Contract2,
|
|
2693
|
-
ContractError: () => common.ContractError,
|
|
2694
|
-
IChain: () => common.IChain,
|
|
2695
|
-
ICluster: () => common.ICluster,
|
|
2696
|
-
SolanaStreamClient: () => SolanaStreamClient,
|
|
2697
|
-
cancelStreamInstruction: () => cancelStreamInstruction,
|
|
2698
|
-
constants: () => constants_exports3,
|
|
2699
|
-
createStreamInstruction: () => createStreamInstruction,
|
|
2700
|
-
createUncheckedStreamInstruction: () => createUncheckedStreamInstruction,
|
|
2701
|
-
decodeStream: () => decodeStream,
|
|
2702
|
-
deriveContractPDA: () => deriveContractPDA,
|
|
2703
|
-
deriveEscrowPDA: () => deriveEscrowPDA,
|
|
2704
|
-
deriveTestOraclePDA: () => deriveTestOraclePDA,
|
|
2705
|
-
extractSolanaErrorCode: () => extractSolanaErrorCode,
|
|
2706
|
-
sendAndConfirmStreamRawTransaction: () => sendAndConfirmStreamRawTransaction,
|
|
2707
|
-
signAllTransactionWithRecipients: () => signAllTransactionWithRecipients,
|
|
2708
|
-
timelockIDL: () => timelockIDL_default,
|
|
2709
|
-
topupStreamInstruction: () => topupStreamInstruction,
|
|
2710
|
-
transferStreamInstruction: () => transferStreamInstruction,
|
|
2711
|
-
updateStreamInstruction: () => updateStreamInstruction,
|
|
2712
|
-
withdrawStreamInstruction: () => withdrawStreamInstruction
|
|
2713
|
-
});
|
|
2714
|
-
|
|
2715
|
-
// solana/constants.ts
|
|
2716
|
-
var constants_exports3 = {};
|
|
2717
|
-
__export(constants_exports3, {
|
|
2718
|
-
AIRDROP_AMOUNT: () => AIRDROP_AMOUNT,
|
|
2719
|
-
AIRDROP_TEST_TOKEN: () => AIRDROP_TEST_TOKEN,
|
|
2720
|
-
ALIGNED_COMPUTE_LIMIT: () => ALIGNED_COMPUTE_LIMIT,
|
|
2721
|
-
ALIGNED_PRECISION_FACTOR_POW: () => ALIGNED_PRECISION_FACTOR_POW,
|
|
2722
|
-
ALIGNED_UNLOCKS_PROGRAM_ID: () => ALIGNED_UNLOCKS_PROGRAM_ID,
|
|
2723
|
-
CONTRACT_DISCRIMINATOR: () => CONTRACT_DISCRIMINATOR,
|
|
2724
|
-
CONTRACT_SEED: () => CONTRACT_SEED,
|
|
2725
|
-
CREATE_PARAMS_PADDING: () => CREATE_PARAMS_PADDING,
|
|
2726
|
-
DEFAULT_STREAMFLOW_FEE: () => DEFAULT_STREAMFLOW_FEE,
|
|
2727
|
-
ESCROW_SEED: () => ESCROW_SEED,
|
|
2728
|
-
FEES_METADATA_SEED: () => FEES_METADATA_SEED,
|
|
2729
|
-
FEE_ORACLE_PUBLIC_KEY: () => FEE_ORACLE_PUBLIC_KEY,
|
|
2730
|
-
ORIGINAL_CONTRACT_SENDER_OFFSET: () => ORIGINAL_CONTRACT_SENDER_OFFSET,
|
|
2731
|
-
PARTNERS_SCHEMA: () => PARTNERS_SCHEMA,
|
|
2732
|
-
PARTNER_ORACLE_PROGRAM_ID: () => PARTNER_ORACLE_PROGRAM_ID,
|
|
2733
|
-
PARTNER_SCHEMA: () => PARTNER_SCHEMA,
|
|
2734
|
-
PROGRAM_ID: () => PROGRAM_ID,
|
|
2735
|
-
SOLANA_ERROR_MAP: () => SOLANA_ERROR_MAP,
|
|
2736
|
-
SOLANA_ERROR_MATCH_REGEX: () => SOLANA_ERROR_MATCH_REGEX,
|
|
2737
|
-
STREAMFLOW_TREASURY_PUBLIC_KEY: () => STREAMFLOW_TREASURY_PUBLIC_KEY,
|
|
2738
|
-
STREAM_STRUCT_OFFSETS: () => STREAM_STRUCT_OFFSETS,
|
|
2739
|
-
STREAM_STRUCT_OFFSET_CLOSED: () => STREAM_STRUCT_OFFSET_CLOSED,
|
|
2740
|
-
STREAM_STRUCT_OFFSET_MINT: () => STREAM_STRUCT_OFFSET_MINT,
|
|
2741
|
-
STREAM_STRUCT_OFFSET_RECIPIENT: () => STREAM_STRUCT_OFFSET_RECIPIENT,
|
|
2742
|
-
STREAM_STRUCT_OFFSET_SENDER: () => STREAM_STRUCT_OFFSET_SENDER,
|
|
2743
|
-
TEST_ORACLE_DISCRIMINATOR: () => TEST_ORACLE_DISCRIMINATOR,
|
|
2744
|
-
TEST_ORACLE_SEED: () => TEST_ORACLE_SEED,
|
|
2745
|
-
TX_FINALITY_CONFIRMED: () => TX_FINALITY_CONFIRMED,
|
|
2746
|
-
WITHDRAWOR_PUBLIC_KEY: () => WITHDRAWOR_PUBLIC_KEY
|
|
2747
|
-
});
|
|
2748
|
-
var TX_FINALITY_CONFIRMED = "confirmed";
|
|
2749
|
-
var ORIGINAL_CONTRACT_SENDER_OFFSET = 9;
|
|
2750
|
-
var STREAM_STRUCT_OFFSET_SENDER = 49;
|
|
2751
|
-
var STREAM_STRUCT_OFFSET_RECIPIENT = 113;
|
|
2752
|
-
var STREAM_STRUCT_OFFSET_MINT = 177;
|
|
2753
|
-
var STREAM_STRUCT_OFFSET_CLOSED = 671;
|
|
2754
|
-
var ALIGNED_PRECISION_FACTOR_POW = 9;
|
|
2755
|
-
var STREAM_STRUCT_OFFSETS = {
|
|
2756
|
-
mint: STREAM_STRUCT_OFFSET_MINT,
|
|
2757
|
-
recipient: STREAM_STRUCT_OFFSET_RECIPIENT,
|
|
2758
|
-
sender: STREAM_STRUCT_OFFSET_SENDER,
|
|
2759
|
-
closed: STREAM_STRUCT_OFFSET_CLOSED
|
|
2760
|
-
};
|
|
2761
|
-
var CREATE_PARAMS_PADDING = 126;
|
|
2762
|
-
var PROGRAM_ID = {
|
|
2763
|
-
[common.ICluster.Devnet]: "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
|
|
2764
|
-
[common.ICluster.Mainnet]: "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m",
|
|
2765
|
-
[common.ICluster.Testnet]: "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
|
|
2766
|
-
[common.ICluster.Local]: "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ"
|
|
2767
|
-
};
|
|
2768
|
-
var ALIGNED_UNLOCKS_PROGRAM_ID = {
|
|
2769
|
-
[common.ICluster.Devnet]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
|
|
2770
|
-
[common.ICluster.Mainnet]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
|
|
2771
|
-
[common.ICluster.Testnet]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
|
|
2772
|
-
[common.ICluster.Local]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH"
|
|
2773
|
-
};
|
|
2774
|
-
var ALIGNED_COMPUTE_LIMIT = 3e5;
|
|
2775
|
-
var CONTRACT_DISCRIMINATOR = [172, 138, 115, 242, 121, 67, 183, 26];
|
|
2776
|
-
var TEST_ORACLE_DISCRIMINATOR = [198, 49, 63, 134, 232, 251, 168, 28];
|
|
2777
|
-
var CONTRACT_SEED = buffer.Buffer.from("contract", "utf-8");
|
|
2778
|
-
var ESCROW_SEED = buffer.Buffer.from("strm", "utf-8");
|
|
2779
|
-
var TEST_ORACLE_SEED = buffer.Buffer.from("test-oracle", "utf-8");
|
|
2780
|
-
var PARTNER_ORACLE_PROGRAM_ID = "pardpVtPjC8nLj1Dwncew62mUzfChdCX1EaoZe8oCAa";
|
|
2781
|
-
var STREAMFLOW_TREASURY_PUBLIC_KEY = new web3_js.PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
|
|
2782
|
-
var WITHDRAWOR_PUBLIC_KEY = new web3_js.PublicKey("wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u");
|
|
2783
|
-
var FEE_ORACLE_PUBLIC_KEY = new web3_js.PublicKey("B743wFVk2pCYhV91cn287e1xY7f1vt4gdY48hhNiuQmT");
|
|
2784
|
-
var AIRDROP_TEST_TOKEN = "Gssm3vfi8s65R31SBdmQRq6cKeYojGgup7whkw4VCiQj";
|
|
2785
|
-
var FEES_METADATA_SEED = buffer.Buffer.from("strm_fees");
|
|
2786
|
-
var DEFAULT_STREAMFLOW_FEE = 0.99;
|
|
2787
|
-
var AIRDROP_AMOUNT = 1;
|
|
2788
|
-
var PARTNER_SCHEMA = {
|
|
2789
|
-
struct: {
|
|
2790
|
-
pubkey: { array: { type: "u8", len: 32 } },
|
|
2791
|
-
partner_fee: "f32",
|
|
2792
|
-
strm_fee: "f32"
|
|
233
|
+
var TX_FINALITY_CONFIRMED = "confirmed";
|
|
234
|
+
var ORIGINAL_CONTRACT_SENDER_OFFSET = 9;
|
|
235
|
+
var STREAM_STRUCT_OFFSET_SENDER = 49;
|
|
236
|
+
var STREAM_STRUCT_OFFSET_RECIPIENT = 113;
|
|
237
|
+
var STREAM_STRUCT_OFFSET_MINT = 177;
|
|
238
|
+
var STREAM_STRUCT_OFFSET_CLOSED = 671;
|
|
239
|
+
var MAX_SAFE_UNIX_TIME_VALUE2 = 864e10;
|
|
240
|
+
var WITHDRAW_AVAILABLE_AMOUNT = new BN3__default.default("18446744073709551615");
|
|
241
|
+
var ALIGNED_PRECISION_FACTOR_POW2 = 9;
|
|
242
|
+
var STREAM_STRUCT_OFFSETS = {
|
|
243
|
+
mint: STREAM_STRUCT_OFFSET_MINT,
|
|
244
|
+
recipient: STREAM_STRUCT_OFFSET_RECIPIENT,
|
|
245
|
+
sender: STREAM_STRUCT_OFFSET_SENDER,
|
|
246
|
+
closed: STREAM_STRUCT_OFFSET_CLOSED
|
|
247
|
+
};
|
|
248
|
+
var CREATE_PARAMS_PADDING = 126;
|
|
249
|
+
var PROGRAM_ID = {
|
|
250
|
+
[common.ICluster.Devnet]: "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
|
|
251
|
+
[common.ICluster.Mainnet]: "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m",
|
|
252
|
+
[common.ICluster.Testnet]: "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
|
|
253
|
+
[common.ICluster.Local]: "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ"
|
|
254
|
+
};
|
|
255
|
+
var ALIGNED_UNLOCKS_PROGRAM_ID = {
|
|
256
|
+
[common.ICluster.Devnet]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
|
|
257
|
+
[common.ICluster.Mainnet]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
|
|
258
|
+
[common.ICluster.Testnet]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
|
|
259
|
+
[common.ICluster.Local]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH"
|
|
260
|
+
};
|
|
261
|
+
var ALIGNED_COMPUTE_LIMIT = 3e5;
|
|
262
|
+
var CONTRACT_DISCRIMINATOR = [172, 138, 115, 242, 121, 67, 183, 26];
|
|
263
|
+
var TEST_ORACLE_DISCRIMINATOR = [198, 49, 63, 134, 232, 251, 168, 28];
|
|
264
|
+
var CONTRACT_SEED = buffer.Buffer.from("contract", "utf-8");
|
|
265
|
+
var ESCROW_SEED = buffer.Buffer.from("strm", "utf-8");
|
|
266
|
+
var TEST_ORACLE_SEED = buffer.Buffer.from("test-oracle", "utf-8");
|
|
267
|
+
var PARTNER_ORACLE_PROGRAM_ID = "pardpVtPjC8nLj1Dwncew62mUzfChdCX1EaoZe8oCAa";
|
|
268
|
+
var STREAMFLOW_TREASURY_PUBLIC_KEY = new web3_js.PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
|
|
269
|
+
var WITHDRAWOR_PUBLIC_KEY = new web3_js.PublicKey("wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u");
|
|
270
|
+
var FEE_ORACLE_PUBLIC_KEY = new web3_js.PublicKey("B743wFVk2pCYhV91cn287e1xY7f1vt4gdY48hhNiuQmT");
|
|
271
|
+
var AIRDROP_TEST_TOKEN = "Gssm3vfi8s65R31SBdmQRq6cKeYojGgup7whkw4VCiQj";
|
|
272
|
+
var FEES_METADATA_SEED = buffer.Buffer.from("strm_fees");
|
|
273
|
+
var DEFAULT_STREAMFLOW_FEE = 0.99;
|
|
274
|
+
var AIRDROP_AMOUNT = 1;
|
|
275
|
+
var PARTNER_SCHEMA = {
|
|
276
|
+
struct: {
|
|
277
|
+
pubkey: { array: { type: "u8", len: 32 } },
|
|
278
|
+
partner_fee: "f32",
|
|
279
|
+
strm_fee: "f32"
|
|
2793
280
|
}
|
|
2794
281
|
};
|
|
2795
282
|
var PARTNERS_SCHEMA = { array: { type: PARTNER_SCHEMA } };
|
|
@@ -2832,88 +319,8 @@ var SOLANA_ERROR_MAP = {
|
|
|
2832
319
|
6011: "AmountAlreadyUpdated" /* AmountAlreadyUpdated */,
|
|
2833
320
|
6012: "AllFundsUnlocked" /* AllFundsUnlocked */
|
|
2834
321
|
};
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
this.magic = stream.magic.toNumber();
|
|
2838
|
-
this.version = stream.version.toNumber();
|
|
2839
|
-
this.createdAt = stream.createdAt.toNumber();
|
|
2840
|
-
this.withdrawnAmount = stream.withdrawnAmount;
|
|
2841
|
-
this.canceledAt = stream.canceledAt.toNumber();
|
|
2842
|
-
this.end = decodeEndTime(stream.end);
|
|
2843
|
-
this.lastWithdrawnAt = stream.lastWithdrawnAt.toNumber();
|
|
2844
|
-
this.sender = stream.sender.toBase58();
|
|
2845
|
-
this.senderTokens = stream.senderTokens.toBase58();
|
|
2846
|
-
this.recipient = stream.recipient.toBase58();
|
|
2847
|
-
this.recipientTokens = stream.recipientTokens.toBase58();
|
|
2848
|
-
this.mint = stream.mint.toBase58();
|
|
2849
|
-
this.escrowTokens = stream.escrowTokens.toBase58();
|
|
2850
|
-
this.streamflowTreasury = stream.streamflowTreasury.toBase58();
|
|
2851
|
-
this.streamflowTreasuryTokens = stream.streamflowTreasuryTokens.toBase58();
|
|
2852
|
-
this.streamflowFeeTotal = stream.streamflowFeeTotal;
|
|
2853
|
-
this.streamflowFeeWithdrawn = stream.streamflowFeeWithdrawn;
|
|
2854
|
-
this.streamflowFeePercent = stream.streamflowFeePercent;
|
|
2855
|
-
this.partnerFeeTotal = stream.partnerFeeTotal;
|
|
2856
|
-
this.partnerFeeWithdrawn = stream.partnerFeeWithdrawn;
|
|
2857
|
-
this.partnerFeePercent = stream.partnerFeePercent;
|
|
2858
|
-
this.partner = stream.partner.toBase58();
|
|
2859
|
-
this.partnerTokens = stream.partnerTokens?.toBase58();
|
|
2860
|
-
this.start = stream.start.toNumber();
|
|
2861
|
-
this.depositedAmount = stream.depositedAmount;
|
|
2862
|
-
this.period = stream.period.toNumber();
|
|
2863
|
-
this.amountPerPeriod = stream.amountPerPeriod;
|
|
2864
|
-
this.cliff = stream.cliff.toNumber();
|
|
2865
|
-
this.cliffAmount = stream.cliffAmount;
|
|
2866
|
-
this.cancelableBySender = stream.cancelableBySender;
|
|
2867
|
-
this.cancelableByRecipient = stream.cancelableByRecipient;
|
|
2868
|
-
this.automaticWithdrawal = stream.automaticWithdrawal;
|
|
2869
|
-
this.transferableBySender = stream.transferableBySender;
|
|
2870
|
-
this.transferableByRecipient = stream.transferableByRecipient;
|
|
2871
|
-
this.canTopup = stream.canTopup;
|
|
2872
|
-
this.name = stream.name;
|
|
2873
|
-
this.withdrawalFrequency = stream.withdrawFrequency.toNumber();
|
|
2874
|
-
this.closed = stream.closed;
|
|
2875
|
-
this.currentPauseStart = stream.currentPauseStart.toNumber();
|
|
2876
|
-
this.pauseCumulative = stream.pauseCumulative;
|
|
2877
|
-
this.lastRateChangeTime = stream.lastRateChangeTime.toNumber();
|
|
2878
|
-
this.fundsUnlockedAtLastRateChange = stream.fundsUnlockedAtLastRateChange;
|
|
2879
|
-
this.type = buildStreamType(this);
|
|
2880
|
-
this.isAligned = false;
|
|
2881
|
-
}
|
|
2882
|
-
unlocked(currentTimestamp) {
|
|
2883
|
-
return calculateUnlockedAmount({
|
|
2884
|
-
...this,
|
|
2885
|
-
currentTimestamp
|
|
2886
|
-
});
|
|
2887
|
-
}
|
|
2888
|
-
remaining(decimals) {
|
|
2889
|
-
return getNumberFromBN(this.depositedAmount.sub(this.withdrawnAmount), decimals);
|
|
2890
|
-
}
|
|
2891
|
-
};
|
|
2892
|
-
var AlignedContract = class extends Contract2 {
|
|
2893
|
-
constructor(stream, alignedProxy) {
|
|
2894
|
-
super(stream);
|
|
2895
|
-
this.minPrice = getNumberFromBN(alignedProxy.minPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
2896
|
-
this.maxPrice = getNumberFromBN(alignedProxy.maxPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
2897
|
-
this.minPercentage = getNumberFromBN(alignedProxy.minPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
2898
|
-
this.maxPercentage = getNumberFromBN(alignedProxy.maxPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
2899
|
-
this.oracleType = Object.keys(alignedProxy.priceOracleType).find((key) => !!key) || "none";
|
|
2900
|
-
this.tickSize = alignedProxy.tickSize.toNumber();
|
|
2901
|
-
this.priceOracle = this.oracleType === "none" ? void 0 : alignedProxy.priceOracle.toBase58();
|
|
2902
|
-
this.sender = alignedProxy.sender.toBase58();
|
|
2903
|
-
this.canceledAt = alignedProxy.streamCanceledTime.toNumber();
|
|
2904
|
-
this.proxyAddress = stream.sender.toBase58();
|
|
2905
|
-
this.initialAmountPerPeriod = alignedProxy.initialAmountPerPeriod;
|
|
2906
|
-
this.initialPrice = getNumberFromBN(alignedProxy.initialPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
2907
|
-
this.lastPrice = getNumberFromBN(alignedProxy.lastPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
2908
|
-
this.lastAmountUpdateTime = alignedProxy.lastAmountUpdateTime.toNumber();
|
|
2909
|
-
this.initialNetAmount = alignedProxy.initialNetAmount;
|
|
2910
|
-
this.expiryTime = alignedProxy.expiryTime.toNumber();
|
|
2911
|
-
this.expiryPercentage = getNumberFromBN(alignedProxy.expiryPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
2912
|
-
this.floorPrice = getNumberFromBN(alignedProxy.floorPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
2913
|
-
this.type = buildStreamType(this);
|
|
2914
|
-
this.isAligned = true;
|
|
2915
|
-
}
|
|
2916
|
-
};
|
|
322
|
+
|
|
323
|
+
// solana/layout.ts
|
|
2917
324
|
var streamLayout = BufferLayout__namespace.struct([
|
|
2918
325
|
BufferLayout__namespace.blob(8, "magic"),
|
|
2919
326
|
BufferLayout__namespace.blob(1, "version"),
|
|
@@ -3073,20 +480,25 @@ var encodeUpdateStream = (values, data) => {
|
|
|
3073
480
|
var topupStreamLayout = BufferLayout__namespace.struct([
|
|
3074
481
|
BufferLayout__namespace.blob(8, "amount")
|
|
3075
482
|
]);
|
|
3076
|
-
|
|
3077
|
-
|
|
483
|
+
var FEE_PRECISION = 4;
|
|
484
|
+
var FEE_NORMALIZER = 10 ** FEE_PRECISION;
|
|
485
|
+
var FEE_MULTIPLIER = new BN3__default.default(10 ** 6);
|
|
3078
486
|
var decoder = new TextDecoder("utf-8");
|
|
3079
487
|
var LE = "le";
|
|
488
|
+
var calculateTotalAmountToDeposit = (depositedAmount, totalFee) => {
|
|
489
|
+
const totalFeeNormalized = new BN3__default.default(totalFee * FEE_NORMALIZER);
|
|
490
|
+
return depositedAmount.mul(totalFeeNormalized.add(FEE_MULTIPLIER)).div(FEE_MULTIPLIER);
|
|
491
|
+
};
|
|
3080
492
|
var decodeStream = (buf) => {
|
|
3081
493
|
const raw = streamLayout.decode(buf);
|
|
3082
494
|
return {
|
|
3083
|
-
magic: new
|
|
3084
|
-
version: new
|
|
3085
|
-
createdAt: new
|
|
3086
|
-
withdrawnAmount: new
|
|
3087
|
-
canceledAt: new
|
|
3088
|
-
end: new
|
|
3089
|
-
lastWithdrawnAt: new
|
|
495
|
+
magic: new BN3__default.default(raw.magic, LE),
|
|
496
|
+
version: new BN3__default.default(raw.version, LE),
|
|
497
|
+
createdAt: new BN3__default.default(raw.created_at, LE),
|
|
498
|
+
withdrawnAmount: new BN3__default.default(raw.withdrawn_amount, LE),
|
|
499
|
+
canceledAt: new BN3__default.default(raw.canceled_at, LE),
|
|
500
|
+
end: new BN3__default.default(raw.end_time, LE),
|
|
501
|
+
lastWithdrawnAt: new BN3__default.default(raw.last_withdrawn_at, LE),
|
|
3090
502
|
sender: new web3_js.PublicKey(raw.sender),
|
|
3091
503
|
senderTokens: new web3_js.PublicKey(raw.sender_tokens),
|
|
3092
504
|
recipient: new web3_js.PublicKey(raw.recipient),
|
|
@@ -3095,20 +507,20 @@ var decodeStream = (buf) => {
|
|
|
3095
507
|
escrowTokens: new web3_js.PublicKey(raw.escrow_tokens),
|
|
3096
508
|
streamflowTreasury: new web3_js.PublicKey(raw.streamflow_treasury),
|
|
3097
509
|
streamflowTreasuryTokens: new web3_js.PublicKey(raw.streamflow_treasury_tokens),
|
|
3098
|
-
streamflowFeeTotal: new
|
|
3099
|
-
streamflowFeeWithdrawn: new
|
|
510
|
+
streamflowFeeTotal: new BN3__default.default(raw.streamflow_fee_total, LE),
|
|
511
|
+
streamflowFeeWithdrawn: new BN3__default.default(raw.streamflow_fee_withdrawn, LE),
|
|
3100
512
|
streamflowFeePercent: raw.streamflow_fee_percent,
|
|
3101
|
-
partnerFeeTotal: new
|
|
3102
|
-
partnerFeeWithdrawn: new
|
|
513
|
+
partnerFeeTotal: new BN3__default.default(raw.partner_fee_total, LE),
|
|
514
|
+
partnerFeeWithdrawn: new BN3__default.default(raw.partner_fee_withdrawn, LE),
|
|
3103
515
|
partnerFeePercent: raw.partner_fee_percent,
|
|
3104
516
|
partner: new web3_js.PublicKey(raw.partner),
|
|
3105
517
|
partnerTokens: new web3_js.PublicKey(raw.partner_tokens),
|
|
3106
|
-
start: new
|
|
3107
|
-
depositedAmount: new
|
|
3108
|
-
period: new
|
|
3109
|
-
amountPerPeriod: new
|
|
3110
|
-
cliff: new
|
|
3111
|
-
cliffAmount: new
|
|
518
|
+
start: new BN3__default.default(raw.start_time, LE),
|
|
519
|
+
depositedAmount: new BN3__default.default(raw.net_amount_deposited, LE),
|
|
520
|
+
period: new BN3__default.default(raw.period, LE),
|
|
521
|
+
amountPerPeriod: new BN3__default.default(raw.amount_per_period, LE),
|
|
522
|
+
cliff: new BN3__default.default(raw.cliff, LE),
|
|
523
|
+
cliffAmount: new BN3__default.default(raw.cliff_amount, LE),
|
|
3112
524
|
cancelableBySender: Boolean(raw.cancelable_by_sender),
|
|
3113
525
|
cancelableByRecipient: Boolean(raw.cancelable_by_recipient),
|
|
3114
526
|
automaticWithdrawal: Boolean(raw.automatic_withdrawal),
|
|
@@ -3116,17 +528,17 @@ var decodeStream = (buf) => {
|
|
|
3116
528
|
transferableByRecipient: Boolean(raw.transferable_by_recipient),
|
|
3117
529
|
canTopup: Boolean(raw.can_topup),
|
|
3118
530
|
name: decoder.decode(raw.stream_name),
|
|
3119
|
-
withdrawFrequency: new
|
|
531
|
+
withdrawFrequency: new BN3__default.default(raw.withdraw_frequency, LE),
|
|
3120
532
|
closed: Boolean(raw.closed),
|
|
3121
|
-
currentPauseStart: new
|
|
3122
|
-
pauseCumulative: new
|
|
3123
|
-
lastRateChangeTime: new
|
|
3124
|
-
fundsUnlockedAtLastRateChange: new
|
|
533
|
+
currentPauseStart: new BN3__default.default(raw.current_pause_start, LE),
|
|
534
|
+
pauseCumulative: new BN3__default.default(raw.pause_cumulative, LE),
|
|
535
|
+
lastRateChangeTime: new BN3__default.default(raw.last_rate_change_time, LE),
|
|
536
|
+
fundsUnlockedAtLastRateChange: new BN3__default.default(raw.funds_unlocked_at_last_rate_change, LE)
|
|
3125
537
|
};
|
|
3126
538
|
};
|
|
3127
539
|
async function signAllTransactionWithRecipients(sender, items) {
|
|
3128
|
-
const isKeypair =
|
|
3129
|
-
const isWallet =
|
|
540
|
+
const isKeypair = common.isSignerKeypair(sender);
|
|
541
|
+
const isWallet = common.isSignerWallet(sender);
|
|
3130
542
|
if (isKeypair) {
|
|
3131
543
|
return items.map((t) => {
|
|
3132
544
|
t.tx.sign([sender]);
|
|
@@ -3144,7 +556,7 @@ async function signAllTransactionWithRecipients(sender, items) {
|
|
|
3144
556
|
}
|
|
3145
557
|
async function sendAndConfirmStreamRawTransaction(connection, batchItem, confirmationParams, throttleParams) {
|
|
3146
558
|
try {
|
|
3147
|
-
const completedTxSignature = await
|
|
559
|
+
const completedTxSignature = await common.executeTransaction(connection, batchItem.tx, confirmationParams, throttleParams);
|
|
3148
560
|
return { ...batchItem, signature: completedTxSignature };
|
|
3149
561
|
} catch (error) {
|
|
3150
562
|
throw {
|
|
@@ -3153,6 +565,19 @@ async function sendAndConfirmStreamRawTransaction(connection, batchItem, confirm
|
|
|
3153
565
|
};
|
|
3154
566
|
}
|
|
3155
567
|
}
|
|
568
|
+
async function handleContractError(func, callback) {
|
|
569
|
+
try {
|
|
570
|
+
return await func();
|
|
571
|
+
} catch (err) {
|
|
572
|
+
if (err instanceof Error) {
|
|
573
|
+
if (callback) {
|
|
574
|
+
throw new common.ContractError(err, callback(err));
|
|
575
|
+
}
|
|
576
|
+
throw new common.ContractError(err);
|
|
577
|
+
}
|
|
578
|
+
throw err;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
3156
581
|
function extractSolanaErrorCode(errorText, logs) {
|
|
3157
582
|
let match = SOLANA_ERROR_MATCH_REGEX.exec(errorText);
|
|
3158
583
|
if (!match && logs) {
|
|
@@ -4995,18 +2420,17 @@ var deriveTestOraclePDA = (programId, mint, creator) => {
|
|
|
4995
2420
|
// solana/StreamClient.ts
|
|
4996
2421
|
var METADATA_ACC_SIZE = 1104;
|
|
4997
2422
|
var ALIGNED_METADATA_ACC_SIZE = 320;
|
|
4998
|
-
var SolanaStreamClient = class
|
|
2423
|
+
var SolanaStreamClient = class {
|
|
4999
2424
|
/**
|
|
5000
2425
|
* Create Stream instance
|
|
5001
2426
|
*/
|
|
5002
2427
|
constructor(optionsOrClusterUrl, cluster = common.ICluster.Mainnet, commitment = "confirmed", programId = "", sendRate = 1, sendThrottler) {
|
|
5003
|
-
super();
|
|
5004
2428
|
if (typeof optionsOrClusterUrl === "string") {
|
|
5005
2429
|
this.commitment = commitment;
|
|
5006
2430
|
this.connection = new web3_js.Connection(optionsOrClusterUrl, this.commitment);
|
|
5007
2431
|
this.programId = programId !== "" ? new web3_js.PublicKey(programId) : new web3_js.PublicKey(PROGRAM_ID[cluster]);
|
|
5008
2432
|
this.schedulingParams = {
|
|
5009
|
-
sendThrottler: sendThrottler ??
|
|
2433
|
+
sendThrottler: sendThrottler ?? common.buildSendThrottler(sendRate)
|
|
5010
2434
|
};
|
|
5011
2435
|
} else {
|
|
5012
2436
|
const {
|
|
@@ -5020,7 +2444,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5020
2444
|
this.connection = new web3_js.Connection(clusterUrl, this.commitment);
|
|
5021
2445
|
this.programId = programId2 !== "" ? new web3_js.PublicKey(programId2) : new web3_js.PublicKey(PROGRAM_ID[cluster2]);
|
|
5022
2446
|
const schedulingOptions = sendScheduler && "sendRate" in sendScheduler ? sendScheduler : void 0;
|
|
5023
|
-
const sendThrottler2 = !sendScheduler ?
|
|
2447
|
+
const sendThrottler2 = !sendScheduler ? common.buildSendThrottler(1) : "sendRate" in sendScheduler ? common.buildSendThrottler(sendScheduler.sendRate ?? 1, sendScheduler.sendInterval) : sendScheduler;
|
|
5024
2448
|
this.schedulingParams = {
|
|
5025
2449
|
...schedulingOptions,
|
|
5026
2450
|
sendThrottler: sendThrottler2
|
|
@@ -5041,6 +2465,9 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5041
2465
|
getProgramId() {
|
|
5042
2466
|
return this.programId.toBase58();
|
|
5043
2467
|
}
|
|
2468
|
+
getAlignedProxyProgramId() {
|
|
2469
|
+
return this.alignedProxyProgram.programId.toBase58();
|
|
2470
|
+
}
|
|
5044
2471
|
/**
|
|
5045
2472
|
* Builds transaction instructions for creating a new stream/vesting contract without creating a transaction.
|
|
5046
2473
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
@@ -5049,7 +2476,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5049
2476
|
* (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.
|
|
5050
2477
|
*
|
|
5051
2478
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
5052
|
-
* @param {Omit<
|
|
2479
|
+
* @param {Omit<ICreateStreamExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
5053
2480
|
* @returns Transaction instructions and metadata ID
|
|
5054
2481
|
*/
|
|
5055
2482
|
async buildCreateTransactionInstructions(data, extParams) {
|
|
@@ -5070,7 +2497,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5070
2497
|
address: partnerPublicKey.toString()
|
|
5071
2498
|
});
|
|
5072
2499
|
const totalAmount = calculateTotalAmountToDeposit(amount, totalFee);
|
|
5073
|
-
ixs.push(...await
|
|
2500
|
+
ixs.push(...await common.prepareWrappedAccount(this.connection, sender.publicKey, totalAmount));
|
|
5074
2501
|
}
|
|
5075
2502
|
const {
|
|
5076
2503
|
ixs: createIxs,
|
|
@@ -5096,13 +2523,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5096
2523
|
* (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.
|
|
5097
2524
|
*
|
|
5098
2525
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
5099
|
-
* @param {Omit<
|
|
2526
|
+
* @param {Omit<ICreateStreamExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
5100
2527
|
* @returns Transaction and metadata information
|
|
5101
2528
|
*/
|
|
5102
2529
|
async buildCreateTransaction(data, extParams) {
|
|
5103
2530
|
const { sender } = extParams;
|
|
5104
2531
|
const { ixs, metadataId, metadata } = await this.buildCreateTransactionInstructions(data, extParams);
|
|
5105
|
-
const { tx, hash, context } = await
|
|
2532
|
+
const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, sender.publicKey, void 0, [
|
|
5106
2533
|
metadata
|
|
5107
2534
|
]);
|
|
5108
2535
|
return {
|
|
@@ -5117,7 +2544,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5117
2544
|
* Creates a new stream/vesting contract.
|
|
5118
2545
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
5119
2546
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
5120
|
-
* @param {
|
|
2547
|
+
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, native token handling, and compute settings
|
|
5121
2548
|
* @returns Create result
|
|
5122
2549
|
*/
|
|
5123
2550
|
async create(data, extParams) {
|
|
@@ -5127,10 +2554,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5127
2554
|
...extParams,
|
|
5128
2555
|
sender
|
|
5129
2556
|
});
|
|
5130
|
-
const { tx, hash, context } = await
|
|
2557
|
+
const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, sender.publicKey, void 0, [
|
|
5131
2558
|
metadata
|
|
5132
2559
|
]);
|
|
5133
|
-
const signature = await
|
|
2560
|
+
const signature = await common.signAndExecuteTransaction(
|
|
5134
2561
|
this.connection,
|
|
5135
2562
|
sender,
|
|
5136
2563
|
tx,
|
|
@@ -5187,13 +2614,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5187
2614
|
common.invariant(metadataPubKey, "Metadata public key is required");
|
|
5188
2615
|
let tokenProgramId = streamTokenProgramId ? new web3_js.PublicKey(streamTokenProgramId) : void 0;
|
|
5189
2616
|
if (!tokenProgramId) {
|
|
5190
|
-
tokenProgramId = (await
|
|
2617
|
+
tokenProgramId = (await common.getMintAndProgram(this.connection, mintPublicKey)).tokenProgramId;
|
|
5191
2618
|
}
|
|
5192
2619
|
const partnerPublicKey = partner ? new web3_js.PublicKey(partner) : WITHDRAWOR_PUBLIC_KEY;
|
|
5193
2620
|
const streamflowProgramPublicKey = new web3_js.PublicKey(this.programId);
|
|
5194
2621
|
const escrowPDA = deriveEscrowPDA(streamflowProgramPublicKey, metadataPubKey);
|
|
5195
2622
|
const oracle = priceOracle ?? deriveTestOraclePDA(this.alignedProxyProgram.programId, mintPublicKey, sender.publicKey);
|
|
5196
|
-
const ixs =
|
|
2623
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
5197
2624
|
computePrice,
|
|
5198
2625
|
computeLimit: computeLimit ?? ALIGNED_COMPUTE_LIMIT
|
|
5199
2626
|
});
|
|
@@ -5205,11 +2632,11 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5205
2632
|
const encodedUIntArray = new TextEncoder().encode(streamName);
|
|
5206
2633
|
const streamNameArray = Array.from(encodedUIntArray);
|
|
5207
2634
|
const createIx = await this.alignedProxyProgram.methods.create({
|
|
5208
|
-
startTime: new
|
|
2635
|
+
startTime: new BN3__default.default(start),
|
|
5209
2636
|
netAmountDeposited: depositedAmount,
|
|
5210
|
-
period: new
|
|
2637
|
+
period: new BN3__default.default(period),
|
|
5211
2638
|
amountPerPeriod,
|
|
5212
|
-
cliff: new
|
|
2639
|
+
cliff: new BN3__default.default(cliff),
|
|
5213
2640
|
cliffAmount,
|
|
5214
2641
|
transferableBySender,
|
|
5215
2642
|
transferableByRecipient,
|
|
@@ -5218,15 +2645,15 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5218
2645
|
canTopup,
|
|
5219
2646
|
oracleType: !!oracleType ? { [oracleType]: {} } : { none: {} },
|
|
5220
2647
|
streamName: streamNameArray,
|
|
5221
|
-
minPrice: typeof minPrice === "number" ? common.getBN(minPrice,
|
|
5222
|
-
maxPrice: typeof maxPrice === "number" ? common.getBN(maxPrice,
|
|
5223
|
-
minPercentage: typeof minPercentage === "number" ? common.getBN(minPercentage,
|
|
5224
|
-
maxPercentage: typeof maxPercentage === "number" ? common.getBN(maxPercentage,
|
|
5225
|
-
tickSize: new
|
|
2648
|
+
minPrice: typeof minPrice === "number" ? common.getBN(minPrice, ALIGNED_PRECISION_FACTOR_POW2) : minPrice,
|
|
2649
|
+
maxPrice: typeof maxPrice === "number" ? common.getBN(maxPrice, ALIGNED_PRECISION_FACTOR_POW2) : maxPrice,
|
|
2650
|
+
minPercentage: typeof minPercentage === "number" ? common.getBN(minPercentage, ALIGNED_PRECISION_FACTOR_POW2) : minPercentage,
|
|
2651
|
+
maxPercentage: typeof maxPercentage === "number" ? common.getBN(maxPercentage, ALIGNED_PRECISION_FACTOR_POW2) : maxPercentage,
|
|
2652
|
+
tickSize: new BN3__default.default(tickSize || 1),
|
|
5226
2653
|
skipInitial: skipInitial ?? false,
|
|
5227
|
-
expiryTime: new
|
|
5228
|
-
expiryPercentage: typeof expiryPercentage === "number" ? common.getBN(expiryPercentage,
|
|
5229
|
-
floorPrice: typeof floorPrice === "number" ? common.getBN(floorPrice,
|
|
2654
|
+
expiryTime: new BN3__default.default(expiryTime ?? 0),
|
|
2655
|
+
expiryPercentage: typeof expiryPercentage === "number" ? common.getBN(expiryPercentage, ALIGNED_PRECISION_FACTOR_POW2) : expiryPercentage ?? new BN3__default.default(0),
|
|
2656
|
+
floorPrice: typeof floorPrice === "number" ? common.getBN(floorPrice, ALIGNED_PRECISION_FACTOR_POW2) : floorPrice ?? new BN3__default.default(0)
|
|
5230
2657
|
}).accountsPartial({
|
|
5231
2658
|
payer: sender.publicKey,
|
|
5232
2659
|
sender: sender.publicKey,
|
|
@@ -5248,7 +2675,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5248
2675
|
* Creates a new stream/vesting contract.
|
|
5249
2676
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
5250
2677
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
5251
|
-
* @param {
|
|
2678
|
+
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
5252
2679
|
* @returns Create stream instructions
|
|
5253
2680
|
*/
|
|
5254
2681
|
async prepareCreateStreamInstructions({
|
|
@@ -5274,7 +2701,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5274
2701
|
tokenProgramId: streamTokenProgramId
|
|
5275
2702
|
}, { sender, metadataPubKeys, isNative = false, computePrice, computeLimit }) {
|
|
5276
2703
|
common.assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5277
|
-
const ixs =
|
|
2704
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
5278
2705
|
computePrice,
|
|
5279
2706
|
computeLimit
|
|
5280
2707
|
});
|
|
@@ -5287,22 +2714,22 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5287
2714
|
);
|
|
5288
2715
|
let tokenProgramId = streamTokenProgramId ? new web3_js.PublicKey(streamTokenProgramId) : void 0;
|
|
5289
2716
|
if (!tokenProgramId) {
|
|
5290
|
-
tokenProgramId = (await
|
|
2717
|
+
tokenProgramId = (await common.getMintAndProgram(this.connection, mintPublicKey)).tokenProgramId;
|
|
5291
2718
|
}
|
|
5292
|
-
const senderTokens = await
|
|
5293
|
-
const recipientTokens = await
|
|
5294
|
-
const streamflowTreasuryTokens = await
|
|
2719
|
+
const senderTokens = await common.ata(mintPublicKey, sender.publicKey, tokenProgramId);
|
|
2720
|
+
const recipientTokens = await common.ata(mintPublicKey, recipientPublicKey, tokenProgramId);
|
|
2721
|
+
const streamflowTreasuryTokens = await common.ata(mintPublicKey, STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
|
|
5295
2722
|
const partnerPublicKey = partner ? new web3_js.PublicKey(partner) : WITHDRAWOR_PUBLIC_KEY;
|
|
5296
|
-
const partnerTokens = await
|
|
2723
|
+
const partnerTokens = await common.ata(mintPublicKey, partnerPublicKey, tokenProgramId);
|
|
5297
2724
|
ixs.push(
|
|
5298
2725
|
await createStreamInstruction(
|
|
5299
2726
|
{
|
|
5300
|
-
start: new
|
|
2727
|
+
start: new BN3__default.default(start),
|
|
5301
2728
|
depositedAmount,
|
|
5302
|
-
period: new
|
|
2729
|
+
period: new BN3__default.default(period),
|
|
5303
2730
|
amountPerPeriod,
|
|
5304
|
-
cliff: new
|
|
5305
|
-
cliffAmount: new
|
|
2731
|
+
cliff: new BN3__default.default(cliff),
|
|
2732
|
+
cliffAmount: new BN3__default.default(cliffAmount),
|
|
5306
2733
|
cancelableBySender,
|
|
5307
2734
|
cancelableByRecipient,
|
|
5308
2735
|
automaticWithdrawal,
|
|
@@ -5312,7 +2739,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5312
2739
|
canUpdateRate: !!canUpdateRate,
|
|
5313
2740
|
canPause: !!canPause,
|
|
5314
2741
|
name,
|
|
5315
|
-
withdrawFrequency: new
|
|
2742
|
+
withdrawFrequency: new BN3__default.default(automaticWithdrawal ? withdrawalFrequency : period)
|
|
5316
2743
|
},
|
|
5317
2744
|
this.programId,
|
|
5318
2745
|
{
|
|
@@ -5349,7 +2776,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5349
2776
|
*
|
|
5350
2777
|
* If you are not sure if you should use create or create_unchecked, go for create to be safer.
|
|
5351
2778
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
5352
|
-
* @param {
|
|
2779
|
+
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
5353
2780
|
* @returns Create result
|
|
5354
2781
|
*/
|
|
5355
2782
|
async createUnchecked(data, extParams) {
|
|
@@ -5357,14 +2784,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5357
2784
|
data,
|
|
5358
2785
|
extParams
|
|
5359
2786
|
);
|
|
5360
|
-
const { tx, hash, context } = await
|
|
2787
|
+
const { tx, hash, context } = await common.prepareTransaction(
|
|
5361
2788
|
this.connection,
|
|
5362
2789
|
ixs,
|
|
5363
2790
|
extParams.sender.publicKey,
|
|
5364
2791
|
void 0,
|
|
5365
2792
|
[metadata]
|
|
5366
2793
|
);
|
|
5367
|
-
const signature = await
|
|
2794
|
+
const signature = await common.signAndExecuteTransaction(
|
|
5368
2795
|
this.connection,
|
|
5369
2796
|
extParams.sender,
|
|
5370
2797
|
tx,
|
|
@@ -5417,26 +2844,26 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5417
2844
|
[buffer.Buffer.from("strm"), metadataPubKey.toBuffer()],
|
|
5418
2845
|
this.programId
|
|
5419
2846
|
);
|
|
5420
|
-
const { tokenProgramId } = await
|
|
5421
|
-
const senderTokens = await
|
|
2847
|
+
const { tokenProgramId } = await common.getMintAndProgram(this.connection, mintPublicKey);
|
|
2848
|
+
const senderTokens = await common.ata(mintPublicKey, sender.publicKey, tokenProgramId);
|
|
5422
2849
|
const partnerPublicKey = partner ? new web3_js.PublicKey(partner) : WITHDRAWOR_PUBLIC_KEY;
|
|
5423
|
-
const ixs =
|
|
2850
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
5424
2851
|
computePrice,
|
|
5425
2852
|
computeLimit
|
|
5426
2853
|
});
|
|
5427
2854
|
if (isNative) {
|
|
5428
2855
|
const totalFee = await this.getTotalFee({ address: partnerPublicKey.toString() });
|
|
5429
2856
|
const totalAmount = calculateTotalAmountToDeposit(depositedAmount, totalFee);
|
|
5430
|
-
ixs.push(...await
|
|
2857
|
+
ixs.push(...await common.prepareWrappedAccount(this.connection, sender.publicKey, totalAmount));
|
|
5431
2858
|
}
|
|
5432
2859
|
const createInstruction = await createUncheckedStreamInstruction(
|
|
5433
2860
|
{
|
|
5434
|
-
start: new
|
|
2861
|
+
start: new BN3__default.default(start),
|
|
5435
2862
|
depositedAmount,
|
|
5436
|
-
period: new
|
|
2863
|
+
period: new BN3__default.default(period),
|
|
5437
2864
|
amountPerPeriod,
|
|
5438
|
-
cliff: new
|
|
5439
|
-
cliffAmount: new
|
|
2865
|
+
cliff: new BN3__default.default(cliff),
|
|
2866
|
+
cliffAmount: new BN3__default.default(cliffAmount),
|
|
5440
2867
|
cancelableBySender,
|
|
5441
2868
|
cancelableByRecipient,
|
|
5442
2869
|
automaticWithdrawal,
|
|
@@ -5446,7 +2873,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5446
2873
|
canUpdateRate: !!canUpdateRate,
|
|
5447
2874
|
canPause: !!canPause,
|
|
5448
2875
|
name,
|
|
5449
|
-
withdrawFrequency: new
|
|
2876
|
+
withdrawFrequency: new BN3__default.default(automaticWithdrawal ? withdrawalFrequency : period),
|
|
5450
2877
|
recipient: recipientPublicKey,
|
|
5451
2878
|
partner: partnerPublicKey
|
|
5452
2879
|
},
|
|
@@ -5472,7 +2899,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5472
2899
|
* Builds transaction instructions for creating multiple stream/vesting contracts without creating transactions.
|
|
5473
2900
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
5474
2901
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
5475
|
-
* @param {
|
|
2902
|
+
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
5476
2903
|
* @returns Create multiple transaction instructions
|
|
5477
2904
|
*/
|
|
5478
2905
|
async buildCreateMultipleTransactionInstructions(data, extParams) {
|
|
@@ -5515,8 +2942,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5515
2942
|
true
|
|
5516
2943
|
);
|
|
5517
2944
|
if (isNative) {
|
|
5518
|
-
const totalDepositedAmount = recipients.reduce((acc, recipient) => recipient.amount.add(acc), new
|
|
5519
|
-
const nativeInstructions = await
|
|
2945
|
+
const totalDepositedAmount = recipients.reduce((acc, recipient) => recipient.amount.add(acc), new BN3__default.default(0));
|
|
2946
|
+
const nativeInstructions = await common.prepareWrappedAccount(
|
|
5520
2947
|
this.connection,
|
|
5521
2948
|
sender.publicKey,
|
|
5522
2949
|
totalDepositedAmount
|
|
@@ -5553,7 +2980,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5553
2980
|
* ```
|
|
5554
2981
|
*
|
|
5555
2982
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
5556
|
-
* @param {
|
|
2983
|
+
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
5557
2984
|
* @returns Multiple transaction information
|
|
5558
2985
|
*/
|
|
5559
2986
|
async buildCreateMultipleTransactions(data, extParams) {
|
|
@@ -5562,11 +2989,11 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5562
2989
|
const { value: hash, context } = await this.connection.getLatestBlockhashAndContext();
|
|
5563
2990
|
const batch = [];
|
|
5564
2991
|
for (const { ixs, metadata, recipient } of instructionsBatch) {
|
|
5565
|
-
batch.push({ tx:
|
|
2992
|
+
batch.push({ tx: common.createVersionedTransaction(ixs, sender.publicKey, hash.blockhash, [metadata]), recipient });
|
|
5566
2993
|
}
|
|
5567
2994
|
let prepareTx;
|
|
5568
2995
|
if (prepareInstructions.length > 0) {
|
|
5569
|
-
prepareTx =
|
|
2996
|
+
prepareTx = common.createVersionedTransaction(prepareInstructions, sender.publicKey, hash.blockhash);
|
|
5570
2997
|
}
|
|
5571
2998
|
return {
|
|
5572
2999
|
transactions: batch,
|
|
@@ -5581,7 +3008,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5581
3008
|
* Creates multiple stream/vesting contracts.
|
|
5582
3009
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
5583
3010
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
5584
|
-
* @param {
|
|
3011
|
+
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
5585
3012
|
* @returns Multiple transaction information
|
|
5586
3013
|
*/
|
|
5587
3014
|
async createMultiple(data, extParams) {
|
|
@@ -5596,11 +3023,11 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5596
3023
|
const batch = [];
|
|
5597
3024
|
const { value: hash, context } = await this.connection.getLatestBlockhashAndContext();
|
|
5598
3025
|
for (const { ixs, metadata, recipient } of instructionsBatch) {
|
|
5599
|
-
batch.push({ tx:
|
|
3026
|
+
batch.push({ tx: common.createVersionedTransaction(ixs, sender.publicKey, hash.blockhash, [metadata]), recipient });
|
|
5600
3027
|
}
|
|
5601
3028
|
if (prepareInstructions.length > 0) {
|
|
5602
3029
|
batch.push({
|
|
5603
|
-
tx:
|
|
3030
|
+
tx: common.createVersionedTransaction(prepareInstructions, sender.publicKey, hash.blockhash),
|
|
5604
3031
|
recipient: sender.publicKey.toBase58()
|
|
5605
3032
|
});
|
|
5606
3033
|
}
|
|
@@ -5614,13 +3041,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5614
3041
|
for (const batchTx of signedBatch) {
|
|
5615
3042
|
responses.push(
|
|
5616
3043
|
...await Promise.allSettled([
|
|
5617
|
-
|
|
3044
|
+
common.executeTransaction(this.connection, batchTx.tx, { hash, context }, this.schedulingParams)
|
|
5618
3045
|
])
|
|
5619
3046
|
);
|
|
5620
3047
|
}
|
|
5621
3048
|
} else {
|
|
5622
3049
|
responses.push(
|
|
5623
|
-
...await
|
|
3050
|
+
...await common.executeMultipleTransactions(
|
|
5624
3051
|
this.connection,
|
|
5625
3052
|
signedBatch.map((item) => item.tx),
|
|
5626
3053
|
{ hash, context },
|
|
@@ -5646,7 +3073,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5646
3073
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
5647
3074
|
* In most cases, createMultiple should be used instead.
|
|
5648
3075
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
5649
|
-
* @param {
|
|
3076
|
+
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
5650
3077
|
* @returns Multiple transaction information
|
|
5651
3078
|
*/
|
|
5652
3079
|
async createMultipleSequential(data, extParams) {
|
|
@@ -5692,7 +3119,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5692
3119
|
for (const batchTx of signedBatch) {
|
|
5693
3120
|
responses.push(
|
|
5694
3121
|
...await Promise.allSettled([
|
|
5695
|
-
|
|
3122
|
+
common.executeTransaction(this.connection, batchTx.tx, { hash, context }, this.schedulingParams)
|
|
5696
3123
|
])
|
|
5697
3124
|
);
|
|
5698
3125
|
}
|
|
@@ -5712,7 +3139,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5712
3139
|
/**
|
|
5713
3140
|
* Attempts withdrawing from the specified stream.
|
|
5714
3141
|
* @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
|
|
5715
|
-
* @param {
|
|
3142
|
+
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
5716
3143
|
* @returns Transaction result
|
|
5717
3144
|
*/
|
|
5718
3145
|
async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, extParams) {
|
|
@@ -5724,8 +3151,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5724
3151
|
);
|
|
5725
3152
|
const metadata = new web3_js.PublicKey(id);
|
|
5726
3153
|
await this.applyCustomAfterInstructions(ixs, customInstructions, metadata);
|
|
5727
|
-
const { tx, hash, context } = await
|
|
5728
|
-
const signature = await
|
|
3154
|
+
const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, invoker.publicKey);
|
|
3155
|
+
const signature = await common.signAndExecuteTransaction(
|
|
5729
3156
|
this.connection,
|
|
5730
3157
|
extParams.invoker,
|
|
5731
3158
|
tx,
|
|
@@ -5741,12 +3168,12 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5741
3168
|
/**
|
|
5742
3169
|
* Creates Transaction Instructions for withdrawal
|
|
5743
3170
|
* @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
|
|
5744
|
-
* @param {
|
|
3171
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
|
|
5745
3172
|
* @returns Transaction instructions
|
|
5746
3173
|
*/
|
|
5747
3174
|
async prepareWithdrawInstructions({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
5748
3175
|
common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5749
|
-
const ixs =
|
|
3176
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
5750
3177
|
computePrice,
|
|
5751
3178
|
computeLimit
|
|
5752
3179
|
});
|
|
@@ -5755,9 +3182,9 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5755
3182
|
common.invariant(escrow?.data, "Couldn't get account info");
|
|
5756
3183
|
const data = decodeStream(escrow.data);
|
|
5757
3184
|
const { sender, recipient, mint, streamflowTreasury, partner, recipientTokens, escrowTokens } = data;
|
|
5758
|
-
const { tokenProgramId } = await
|
|
5759
|
-
const streamflowTreasuryTokens = await
|
|
5760
|
-
const partnerTokens = await
|
|
3185
|
+
const { tokenProgramId } = await common.getMintAndProgram(this.connection, mint);
|
|
3186
|
+
const streamflowTreasuryTokens = await common.ata(mint, STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
|
|
3187
|
+
const partnerTokens = await common.ata(mint, partner, tokenProgramId);
|
|
5761
3188
|
const ataIx = await this.getCreateATAInstructions(
|
|
5762
3189
|
[sender, recipient, streamflowTreasury, partner],
|
|
5763
3190
|
mint,
|
|
@@ -5786,13 +3213,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5786
3213
|
/**
|
|
5787
3214
|
* Attempts canceling the specified stream.
|
|
5788
3215
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
5789
|
-
* @param {
|
|
3216
|
+
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
5790
3217
|
* @returns Transaction result
|
|
5791
3218
|
*/
|
|
5792
3219
|
async cancel(cancelData, extParams) {
|
|
5793
3220
|
const ixs = await this.prepareCancelInstructions(cancelData, extParams);
|
|
5794
|
-
const { tx, hash, context } = await
|
|
5795
|
-
const signature = await
|
|
3221
|
+
const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
3222
|
+
const signature = await common.signAndExecuteTransaction(
|
|
5796
3223
|
this.connection,
|
|
5797
3224
|
extParams.invoker,
|
|
5798
3225
|
tx,
|
|
@@ -5808,7 +3235,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5808
3235
|
/**
|
|
5809
3236
|
* Creates Transaction Instructions for cancel
|
|
5810
3237
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
5811
|
-
* @param {
|
|
3238
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
|
|
5812
3239
|
* @returns Transaction instructions
|
|
5813
3240
|
*/
|
|
5814
3241
|
async prepareCancelInstructions(cancelData, extParams) {
|
|
@@ -5825,7 +3252,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5825
3252
|
/**
|
|
5826
3253
|
* Creates Transaction Instructions for cancel
|
|
5827
3254
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
5828
|
-
* @param {
|
|
3255
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
5829
3256
|
* @returns Transaction instructions
|
|
5830
3257
|
*/
|
|
5831
3258
|
async prepareCancelAlignedUnlockInstructions({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
@@ -5835,8 +3262,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5835
3262
|
common.invariant(escrowAcc?.data, "Couldn't get account info");
|
|
5836
3263
|
const streamData = decodeStream(escrowAcc.data);
|
|
5837
3264
|
const { sender, recipient, mint, streamflowTreasury, partner, escrowTokens } = streamData;
|
|
5838
|
-
const { tokenProgramId } = await
|
|
5839
|
-
const ixs =
|
|
3265
|
+
const { tokenProgramId } = await common.getMintAndProgram(this.connection, mint);
|
|
3266
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
5840
3267
|
computePrice,
|
|
5841
3268
|
computeLimit: computeLimit ?? ALIGNED_COMPUTE_LIMIT
|
|
5842
3269
|
});
|
|
@@ -5864,7 +3291,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5864
3291
|
/**
|
|
5865
3292
|
* Creates Transaction Instructions for cancel
|
|
5866
3293
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
5867
|
-
* @param {
|
|
3294
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
5868
3295
|
* @returns Transaction instructions
|
|
5869
3296
|
*/
|
|
5870
3297
|
async prepareCancelStreamInstructions({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
@@ -5874,10 +3301,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5874
3301
|
common.invariant(escrowAcc?.data, "Couldn't get account info");
|
|
5875
3302
|
const data = decodeStream(escrowAcc.data);
|
|
5876
3303
|
const { sender, recipient, partner, streamflowTreasury, mint, senderTokens, recipientTokens, escrowTokens } = data;
|
|
5877
|
-
const { tokenProgramId } = await
|
|
5878
|
-
const streamflowTreasuryTokens = await
|
|
5879
|
-
const partnerTokens = await
|
|
5880
|
-
const ixs =
|
|
3304
|
+
const { tokenProgramId } = await common.getMintAndProgram(this.connection, mint);
|
|
3305
|
+
const streamflowTreasuryTokens = await common.ata(mint, STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
|
|
3306
|
+
const partnerTokens = await common.ata(mint, partner, tokenProgramId);
|
|
3307
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
5881
3308
|
computePrice,
|
|
5882
3309
|
computeLimit
|
|
5883
3310
|
});
|
|
@@ -5912,13 +3339,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5912
3339
|
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
5913
3340
|
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
5914
3341
|
* @param {ITransferData} transferData - Transfer parameters including stream ID and new recipient address
|
|
5915
|
-
* @param {
|
|
3342
|
+
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
5916
3343
|
* @returns Transaction result
|
|
5917
3344
|
*/
|
|
5918
3345
|
async transfer({ id, newRecipient }, extParams) {
|
|
5919
3346
|
const ixs = await this.prepareTransferInstructions({ id, newRecipient }, extParams);
|
|
5920
|
-
const { tx, hash, context } = await
|
|
5921
|
-
const signature = await
|
|
3347
|
+
const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
3348
|
+
const signature = await common.signAndExecuteTransaction(
|
|
5922
3349
|
this.connection,
|
|
5923
3350
|
extParams.invoker,
|
|
5924
3351
|
tx,
|
|
@@ -5935,12 +3362,12 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5935
3362
|
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
5936
3363
|
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
5937
3364
|
* @param {ITransferData} transferData - Transfer parameters including stream ID and new recipient address
|
|
5938
|
-
* @param {
|
|
3365
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
5939
3366
|
* @returns Transaction instructions
|
|
5940
3367
|
*/
|
|
5941
3368
|
async prepareTransferInstructions({ id, newRecipient }, { invoker, computePrice, computeLimit = 100001 }) {
|
|
5942
3369
|
common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5943
|
-
const ixs =
|
|
3370
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
5944
3371
|
computePrice,
|
|
5945
3372
|
computeLimit
|
|
5946
3373
|
});
|
|
@@ -5949,8 +3376,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5949
3376
|
const escrow = await this.connection.getAccountInfo(stream);
|
|
5950
3377
|
common.invariant(escrow?.data, "Couldn't get account info");
|
|
5951
3378
|
const { mint } = decodeStream(escrow?.data);
|
|
5952
|
-
const { tokenProgramId } = await
|
|
5953
|
-
const newRecipientTokens = await
|
|
3379
|
+
const { tokenProgramId } = await common.getMintAndProgram(this.connection, mint);
|
|
3380
|
+
const newRecipientTokens = await common.ata(mint, newRecipientPublicKey, tokenProgramId);
|
|
5954
3381
|
ixs.push(
|
|
5955
3382
|
await transferStreamInstruction(this.programId, {
|
|
5956
3383
|
authority: invoker.publicKey,
|
|
@@ -5969,13 +3396,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5969
3396
|
/**
|
|
5970
3397
|
* Tops up stream account with specified amount.
|
|
5971
3398
|
* @param {ITopUpData} topupData - Top-up parameters including stream ID and amount to add
|
|
5972
|
-
* @param {
|
|
3399
|
+
* @param {ITopUpStreamExt} extParams - Transaction configuration including invoker wallet, native token handling, and compute settings
|
|
5973
3400
|
* @returns Transaction result
|
|
5974
3401
|
*/
|
|
5975
3402
|
async topup({ id, amount }, extParams) {
|
|
5976
3403
|
const ixs = await this.prepareTopupInstructions({ id, amount }, extParams);
|
|
5977
|
-
const { tx, hash, context } = await
|
|
5978
|
-
const signature = await
|
|
3404
|
+
const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
3405
|
+
const signature = await common.signAndExecuteTransaction(
|
|
5979
3406
|
this.connection,
|
|
5980
3407
|
extParams.invoker,
|
|
5981
3408
|
tx,
|
|
@@ -5991,14 +3418,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5991
3418
|
/**
|
|
5992
3419
|
* Create Transaction instructions for topup
|
|
5993
3420
|
* @param {ITopUpData} topupData - Top-up parameters including stream ID and amount to add
|
|
5994
|
-
* @param {
|
|
3421
|
+
* @param {ITopUpStreamExt} extParams - Transaction configuration including invoker wallet, native token handling, and compute settings
|
|
5995
3422
|
* @returns Transaction instructions
|
|
5996
3423
|
*/
|
|
5997
3424
|
async prepareTopupInstructions({ id, amount }, { invoker, isNative, computePrice, computeLimit }) {
|
|
5998
3425
|
if (!invoker.publicKey) {
|
|
5999
3426
|
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
6000
3427
|
}
|
|
6001
|
-
const ixs =
|
|
3428
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
6002
3429
|
computePrice,
|
|
6003
3430
|
computeLimit
|
|
6004
3431
|
});
|
|
@@ -6008,11 +3435,11 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6008
3435
|
throw new Error("Couldn't get account info");
|
|
6009
3436
|
}
|
|
6010
3437
|
const { mint, partner, senderTokens, escrowTokens } = decodeStream(escrow?.data);
|
|
6011
|
-
const { tokenProgramId } = await
|
|
6012
|
-
const streamflowTreasuryTokens = await
|
|
6013
|
-
const partnerTokens = await
|
|
3438
|
+
const { tokenProgramId } = await common.getMintAndProgram(this.connection, mint);
|
|
3439
|
+
const streamflowTreasuryTokens = await common.ata(mint, STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
|
|
3440
|
+
const partnerTokens = await common.ata(mint, partner, tokenProgramId);
|
|
6014
3441
|
if (isNative) {
|
|
6015
|
-
ixs.push(...await
|
|
3442
|
+
ixs.push(...await common.prepareWrappedAccount(this.connection, invoker.publicKey, amount));
|
|
6016
3443
|
}
|
|
6017
3444
|
ixs.push(
|
|
6018
3445
|
await topupStreamInstruction(amount, this.programId, {
|
|
@@ -6053,7 +3480,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6053
3480
|
}
|
|
6054
3481
|
return new AlignedContract(stream, alignedProxy);
|
|
6055
3482
|
}
|
|
6056
|
-
return new
|
|
3483
|
+
return new Contract(stream);
|
|
6057
3484
|
}
|
|
6058
3485
|
/**
|
|
6059
3486
|
* Fetch all aligned outgoing streams/contracts by the provided public key.
|
|
@@ -6074,7 +3501,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6074
3501
|
}
|
|
6075
3502
|
]);
|
|
6076
3503
|
const streamPubKeys = alignedOutgoingProgramAccounts.map((account) => account.account.stream);
|
|
6077
|
-
const streamAccounts = await
|
|
3504
|
+
const streamAccounts = await common.getMultipleAccountsInfoBatched(this.connection, streamPubKeys, TX_FINALITY_CONFIRMED);
|
|
6078
3505
|
streamAccounts.forEach((account, index) => {
|
|
6079
3506
|
if (account) {
|
|
6080
3507
|
const alignedData = alignedOutgoingProgramAccounts[index].account;
|
|
@@ -6089,7 +3516,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6089
3516
|
const alignedProxyPDAs = alignedStreamsPubKeys.map(
|
|
6090
3517
|
(streamPubKey) => deriveContractPDA(this.alignedProxyProgram.programId, new web3_js.PublicKey(streamPubKey))
|
|
6091
3518
|
);
|
|
6092
|
-
const alignedProxyAccounts = await
|
|
3519
|
+
const alignedProxyAccounts = await common.getMultipleAccountsInfoBatched(this.connection, alignedProxyPDAs);
|
|
6093
3520
|
alignedProxyAccounts.forEach((account, index) => {
|
|
6094
3521
|
if (account && account.data.length === ALIGNED_METADATA_ACC_SIZE) {
|
|
6095
3522
|
const alignedData = streamRecord[alignedStreamsPubKeys[index]];
|
|
@@ -6116,14 +3543,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6116
3543
|
let streams = {};
|
|
6117
3544
|
const shouldFetchAligned = type === "all" /* All */ || type === "vesting" /* Vesting */;
|
|
6118
3545
|
if (direction !== "incoming" /* Incoming */) {
|
|
6119
|
-
const outgoingStreamAccounts = await
|
|
3546
|
+
const outgoingStreamAccounts = await common.getProgramAccounts(
|
|
6120
3547
|
this.connection,
|
|
6121
3548
|
publicKey,
|
|
6122
3549
|
STREAM_STRUCT_OFFSET_SENDER,
|
|
6123
3550
|
this.programId
|
|
6124
3551
|
);
|
|
6125
3552
|
outgoingStreamAccounts.forEach((account) => {
|
|
6126
|
-
streams[account.pubkey.toBase58()] = new
|
|
3553
|
+
streams[account.pubkey.toBase58()] = new Contract(decodeStream(account.account.data));
|
|
6127
3554
|
});
|
|
6128
3555
|
if (shouldFetchAligned) {
|
|
6129
3556
|
const alignedStreams = await this.getOutgoingAlignedStreams(address);
|
|
@@ -6131,7 +3558,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6131
3558
|
}
|
|
6132
3559
|
}
|
|
6133
3560
|
if (direction !== "outgoing" /* Outgoing */) {
|
|
6134
|
-
const allIncomingAccounts = await
|
|
3561
|
+
const allIncomingAccounts = await common.getProgramAccounts(
|
|
6135
3562
|
this.connection,
|
|
6136
3563
|
publicKey,
|
|
6137
3564
|
STREAM_STRUCT_OFFSET_RECIPIENT,
|
|
@@ -6143,7 +3570,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6143
3570
|
if (this.isAlignedUnlock(account.pubkey, allIncomingStreams[index].sender)) {
|
|
6144
3571
|
alignedDecoded[account.pubkey.toBase58()] = allIncomingStreams[index];
|
|
6145
3572
|
} else {
|
|
6146
|
-
streams[account.pubkey.toBase58()] = new
|
|
3573
|
+
streams[account.pubkey.toBase58()] = new Contract(allIncomingStreams[index]);
|
|
6147
3574
|
}
|
|
6148
3575
|
});
|
|
6149
3576
|
if (shouldFetchAligned) {
|
|
@@ -6171,15 +3598,25 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6171
3598
|
const accounts = await this.connection.getProgramAccounts(this.programId, {
|
|
6172
3599
|
filters
|
|
6173
3600
|
});
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
3601
|
+
const mapped = await Promise.all(
|
|
3602
|
+
accounts.map(async ({ pubkey, account }) => {
|
|
3603
|
+
const stream = decodeStream(account.data);
|
|
3604
|
+
if (this.isAlignedUnlock(pubkey, stream.sender)) {
|
|
3605
|
+
const alignedProxy = await this.alignedProxyProgram.account.contract.fetch(
|
|
3606
|
+
deriveContractPDA(this.alignedProxyProgram.programId, pubkey)
|
|
3607
|
+
);
|
|
3608
|
+
common.invariant(alignedProxy, "Couldn't get aligned proxy account info");
|
|
3609
|
+
return { publicKey: pubkey, account: new AlignedContract(stream, alignedProxy) };
|
|
3610
|
+
}
|
|
3611
|
+
return { publicKey: pubkey, account: new Contract(stream) };
|
|
3612
|
+
})
|
|
3613
|
+
);
|
|
3614
|
+
return mapped;
|
|
6178
3615
|
}
|
|
6179
3616
|
/**
|
|
6180
3617
|
* Attempts updating the stream auto withdrawal params and amount per period
|
|
6181
3618
|
* @param {IUpdateData} data - Update parameters including stream ID and new settings
|
|
6182
|
-
* @param {
|
|
3619
|
+
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
6183
3620
|
* @returns Transaction result
|
|
6184
3621
|
*/
|
|
6185
3622
|
async update(data, extParams) {
|
|
@@ -6187,8 +3624,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6187
3624
|
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
6188
3625
|
}
|
|
6189
3626
|
const ixs = await this.prepareUpdateInstructions(data, extParams);
|
|
6190
|
-
const { tx, hash, context } = await
|
|
6191
|
-
const signature = await
|
|
3627
|
+
const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
3628
|
+
const signature = await common.signAndExecuteTransaction(
|
|
6192
3629
|
this.connection,
|
|
6193
3630
|
extParams.invoker,
|
|
6194
3631
|
tx,
|
|
@@ -6207,7 +3644,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6207
3644
|
/**
|
|
6208
3645
|
* Create Transaction instructions for update
|
|
6209
3646
|
* @param {IUpdateData} data - Update parameters including stream ID and new settings
|
|
6210
|
-
* @param {
|
|
3647
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
6211
3648
|
* @returns Transaction instructions
|
|
6212
3649
|
*/
|
|
6213
3650
|
async prepareUpdateInstructions(data, { invoker, computePrice, computeLimit }) {
|
|
@@ -6215,7 +3652,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6215
3652
|
const streamPublicKey = new web3_js.PublicKey(data.id);
|
|
6216
3653
|
const escrow = await this.connection.getAccountInfo(streamPublicKey);
|
|
6217
3654
|
common.invariant(escrow, "Couldn't get account info");
|
|
6218
|
-
const ixs =
|
|
3655
|
+
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
6219
3656
|
computePrice,
|
|
6220
3657
|
computeLimit
|
|
6221
3658
|
});
|
|
@@ -6260,6 +3697,20 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6260
3697
|
async getDefaultStreamflowFee() {
|
|
6261
3698
|
return DEFAULT_STREAMFLOW_FEE;
|
|
6262
3699
|
}
|
|
3700
|
+
/**
|
|
3701
|
+
* Returns total fee percent, streamflow fees + partner fees
|
|
3702
|
+
* @param getFeesData structure with address for which we need to derive fee, either sender or partner usually
|
|
3703
|
+
* @param chainSpecificParams additional parameters required by chain client
|
|
3704
|
+
* @returns fee as floating number, so if fee is 0.99%, it will return 0.99
|
|
3705
|
+
*/
|
|
3706
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3707
|
+
async getTotalFee(getFeesData) {
|
|
3708
|
+
const fees = await this.getFees(getFeesData);
|
|
3709
|
+
if (fees) {
|
|
3710
|
+
return fees.partnerFee + fees.streamflowFee;
|
|
3711
|
+
}
|
|
3712
|
+
return this.getDefaultStreamflowFee();
|
|
3713
|
+
}
|
|
6263
3714
|
/**
|
|
6264
3715
|
* Extracts error code from an error
|
|
6265
3716
|
* @param {Error} err - Error
|
|
@@ -6269,6 +3720,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6269
3720
|
const logs = "logs" in err && Array.isArray(err.logs) ? err.logs : void 0;
|
|
6270
3721
|
return extractSolanaErrorCode(err.toString() ?? "Unknown error!", logs);
|
|
6271
3722
|
}
|
|
3723
|
+
/**
|
|
3724
|
+
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
|
|
3725
|
+
*/
|
|
3726
|
+
isAlignedUnlock(streamPublicKey, senderPublicKey) {
|
|
3727
|
+
const pda = deriveContractPDA(this.alignedProxyProgram.programId, streamPublicKey);
|
|
3728
|
+
return senderPublicKey.equals(pda);
|
|
3729
|
+
}
|
|
6272
3730
|
/**
|
|
6273
3731
|
* Utility function to generate metadata for a Contract or return existing Pubkey
|
|
6274
3732
|
*/
|
|
@@ -6283,13 +3741,6 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6283
3741
|
}
|
|
6284
3742
|
return { metadata, metadataPubKey };
|
|
6285
3743
|
}
|
|
6286
|
-
/**
|
|
6287
|
-
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
|
|
6288
|
-
*/
|
|
6289
|
-
isAlignedUnlock(streamPublicKey, senderPublicKey) {
|
|
6290
|
-
const pda = deriveContractPDA(this.alignedProxyProgram.programId, streamPublicKey);
|
|
6291
|
-
return senderPublicKey.equals(pda);
|
|
6292
|
-
}
|
|
6293
3744
|
/**
|
|
6294
3745
|
* Returns insrtuctions for creating associated token accounts for the provided owners
|
|
6295
3746
|
*/
|
|
@@ -6300,7 +3751,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6300
3751
|
const uniqueOwners = Array.from(new Set(owners.map((owner) => owner.toBase58()))).map(
|
|
6301
3752
|
(pkString) => new web3_js.PublicKey(pkString)
|
|
6302
3753
|
);
|
|
6303
|
-
return
|
|
3754
|
+
return common.checkOrCreateAtaBatch(this.connection, uniqueOwners, mint, invoker, programId);
|
|
6304
3755
|
}
|
|
6305
3756
|
async applyCustomAfterInstructions(ixs, customInstructions, metadata) {
|
|
6306
3757
|
if (customInstructions?.after) {
|
|
@@ -6687,891 +4138,87 @@ var timelockIDL_default = {
|
|
|
6687
4138
|
{
|
|
6688
4139
|
name: "streamflowTreasury",
|
|
6689
4140
|
isMut: true,
|
|
6690
|
-
isSigner: false
|
|
6691
|
-
},
|
|
6692
|
-
{
|
|
6693
|
-
name: "streamflowTreasuryTokens",
|
|
6694
|
-
isMut: true,
|
|
6695
|
-
isSigner: false
|
|
6696
|
-
},
|
|
6697
|
-
{
|
|
6698
|
-
name: "withdrawor",
|
|
6699
|
-
isMut: true,
|
|
6700
|
-
isSigner: false
|
|
6701
|
-
},
|
|
6702
|
-
{
|
|
6703
|
-
name: "partner",
|
|
6704
|
-
isMut: true,
|
|
6705
|
-
isSigner: false
|
|
6706
|
-
},
|
|
6707
|
-
{
|
|
6708
|
-
name: "partnerTokens",
|
|
6709
|
-
isMut: true,
|
|
6710
|
-
isSigner: false
|
|
6711
|
-
},
|
|
6712
|
-
{
|
|
6713
|
-
name: "mint",
|
|
6714
|
-
isMut: false,
|
|
6715
|
-
isSigner: false
|
|
6716
|
-
},
|
|
6717
|
-
{
|
|
6718
|
-
name: "tokenProgram",
|
|
6719
|
-
isMut: false,
|
|
6720
|
-
isSigner: false
|
|
6721
|
-
},
|
|
6722
|
-
{
|
|
6723
|
-
name: "systemProgram",
|
|
6724
|
-
isMut: false,
|
|
6725
|
-
isSigner: false
|
|
6726
|
-
}
|
|
6727
|
-
],
|
|
6728
|
-
args: [
|
|
6729
|
-
{
|
|
6730
|
-
name: "amount",
|
|
6731
|
-
type: "u64"
|
|
6732
|
-
}
|
|
6733
|
-
]
|
|
6734
|
-
}
|
|
6735
|
-
]
|
|
6736
|
-
};
|
|
6737
|
-
|
|
6738
|
-
// sui/index.ts
|
|
6739
|
-
var sui_exports = {};
|
|
6740
|
-
__export(sui_exports, {
|
|
6741
|
-
Contract: () => Contract3,
|
|
6742
|
-
SuiStreamClient: () => SuiStreamClient,
|
|
6743
|
-
constants: () => constants_exports4,
|
|
6744
|
-
extractSuiErrorInfo: () => extractSuiErrorInfo,
|
|
6745
|
-
getTransactionBlock: () => getTransactionBlock
|
|
6746
|
-
});
|
|
6747
|
-
|
|
6748
|
-
// sui/constants.ts
|
|
6749
|
-
var constants_exports4 = {};
|
|
6750
|
-
__export(constants_exports4, {
|
|
6751
|
-
SUI_CONFIG_IDS: () => SUI_CONFIG_IDS,
|
|
6752
|
-
SUI_ERROR_MATCH_REGEX: () => SUI_ERROR_MATCH_REGEX,
|
|
6753
|
-
SUI_FEE_TABLE_IDS: () => SUI_FEE_TABLE_IDS,
|
|
6754
|
-
SUI_MODULE_ERROR_MAP: () => SUI_MODULE_ERROR_MAP,
|
|
6755
|
-
SUI_PROGRAM_IDS: () => SUI_PROGRAM_IDS
|
|
6756
|
-
});
|
|
6757
|
-
var SUI_PROGRAM_IDS = {
|
|
6758
|
-
[common.ICluster.Mainnet]: "0xe456a3a1d4e58e85b4b7175fabe6dae895b983f1379bb8948d6ec2f137b08a7b",
|
|
6759
|
-
[common.ICluster.Devnet]: "0x34dacd839e1758ebb70bdcd4e08f18fbfef5e2b96d9aa7ce2b4a71d96ca0df5a",
|
|
6760
|
-
[common.ICluster.Testnet]: "0x34dacd839e1758ebb70bdcd4e08f18fbfef5e2b96d9aa7ce2b4a71d96ca0df5a",
|
|
6761
|
-
[common.ICluster.Local]: "0x34dacd839e1758ebb70bdcd4e08f18fbfef5e2b96d9aa7ce2b4a71d96ca0df5a"
|
|
6762
|
-
};
|
|
6763
|
-
var SUI_CONFIG_IDS = {
|
|
6764
|
-
[common.ICluster.Mainnet]: "0x6cf6760b64245b8d23ef57c28ddceb6adbd540a23a509fef29b82237da4ab87b",
|
|
6765
|
-
[common.ICluster.Devnet]: "0xd6c9f5074584f58074ce56e3c5cc436d82258ec3285f186a0d6438a60bacdbf8",
|
|
6766
|
-
[common.ICluster.Testnet]: "0xd6c9f5074584f58074ce56e3c5cc436d82258ec3285f186a0d6438a60bacdbf8",
|
|
6767
|
-
[common.ICluster.Local]: "0xd6c9f5074584f58074ce56e3c5cc436d82258ec3285f186a0d6438a60bacdbf8"
|
|
6768
|
-
};
|
|
6769
|
-
var SUI_FEE_TABLE_IDS = {
|
|
6770
|
-
[common.ICluster.Mainnet]: "0xad9b75399632583fb9fcae6b5bcca34e6542ab3bedb630ecbd3f15cb1cc48dbe",
|
|
6771
|
-
[common.ICluster.Devnet]: "0x6057b093904c5bdfec1067d2b8a4dc35f65bcab03b3029ad716c4882b0f36078",
|
|
6772
|
-
[common.ICluster.Testnet]: "0x6057b093904c5bdfec1067d2b8a4dc35f65bcab03b3029ad716c4882b0f36078",
|
|
6773
|
-
[common.ICluster.Local]: "0x6057b093904c5bdfec1067d2b8a4dc35f65bcab03b3029ad716c4882b0f36078"
|
|
6774
|
-
};
|
|
6775
|
-
var SUI_ERROR_MATCH_REGEX = /MoveAbort\(MoveLocation \{ module: ModuleId \{ address: (\w+), name: Identifier\("([\w_]+)"\) }, function: \d+, instruction: \d+, function_name: Some\("([\w_]+)"\) }, (\d+)\) in command (\d+)/;
|
|
6776
|
-
var SUI_MODULE_ERROR_MAP = {
|
|
6777
|
-
protocol: {
|
|
6778
|
-
1: "ECONTRACT_NOT_INIT" /* ECONTRACT_NOT_INIT */,
|
|
6779
|
-
2: "EBAD_AMOUNT" /* EBAD_AMOUNT */,
|
|
6780
|
-
3: "ENO_PERMISSIONS" /* ENO_PERMISSIONS */,
|
|
6781
|
-
4: "EBADINPUT" /* EBADINPUT */,
|
|
6782
|
-
5: "ECLOSED" /* ECLOSED */,
|
|
6783
|
-
6: "EBAD_INPUT_AMOUNT_PER_PERIOD" /* EBAD_INPUT_AMOUNT_PER_PERIOD */,
|
|
6784
|
-
8: "EBAD_INPUT_UPDATE_RATE" /* EBAD_INPUT_UPDATE_RATE */,
|
|
6785
|
-
9: "EBAD_INPUT_CLIFF_AMOUNT" /* EBAD_INPUT_CLIFF_AMOUNT */,
|
|
6786
|
-
10: "EBAD_INPUT_PERIOD" /* EBAD_INPUT_PERIOD */,
|
|
6787
|
-
11: "EBAD_INPUT_START" /* EBAD_INPUT_START */,
|
|
6788
|
-
13: "EBAD_INSUFFICIENT_WITHDRAWAL_FEES" /* EBAD_INSUFFICIENT_WITHDRAWAL_FEES */,
|
|
6789
|
-
14: "EBAD_INSUFFICIENT_AMOUNT" /* EBAD_INSUFFICIENT_AMOUNT */,
|
|
6790
|
-
15: "EPAUSED" /* EPAUSED */,
|
|
6791
|
-
16: "ENOTPAUSED" /* ENOTPAUSED */
|
|
6792
|
-
}
|
|
6793
|
-
};
|
|
6794
|
-
var Contract3 = class {
|
|
6795
|
-
constructor(stream, tokenId) {
|
|
6796
|
-
const meta = stream.meta.fields;
|
|
6797
|
-
const fees = stream.fees.fields;
|
|
6798
|
-
this.magic = 0;
|
|
6799
|
-
this.version = parseInt(stream.version);
|
|
6800
|
-
this.createdAt = parseInt(stream.created);
|
|
6801
|
-
this.withdrawnAmount = new BN7__default.default(stream.withdrawn);
|
|
6802
|
-
this.canceledAt = parseInt(stream.canceled_at);
|
|
6803
|
-
this.end = parseInt(stream.end);
|
|
6804
|
-
this.lastWithdrawnAt = parseInt(stream.last_withdrawn_at);
|
|
6805
|
-
this.sender = stream.sender;
|
|
6806
|
-
this.senderTokens = stream.sender;
|
|
6807
|
-
this.recipient = stream.recipient;
|
|
6808
|
-
this.recipientTokens = stream.recipient;
|
|
6809
|
-
this.mint = tokenId;
|
|
6810
|
-
this.escrowTokens = "";
|
|
6811
|
-
this.streamflowTreasury = "";
|
|
6812
|
-
this.streamflowTreasuryTokens = "";
|
|
6813
|
-
this.streamflowFeeTotal = new BN7__default.default(0);
|
|
6814
|
-
this.streamflowFeeWithdrawn = new BN7__default.default(0);
|
|
6815
|
-
this.streamflowFeePercent = parseInt(fees.streamflow_fee_percentage) / 1e4;
|
|
6816
|
-
this.partnerFeeTotal = new BN7__default.default(0);
|
|
6817
|
-
this.partnerFeeWithdrawn = new BN7__default.default(0);
|
|
6818
|
-
this.partnerFeePercent = parseInt(fees.partner_fee_percentage) / 1e4;
|
|
6819
|
-
this.partner = stream.partner;
|
|
6820
|
-
this.partnerTokens = "";
|
|
6821
|
-
this.start = parseInt(stream.start);
|
|
6822
|
-
this.depositedAmount = new BN7__default.default(stream.amount);
|
|
6823
|
-
this.period = parseInt(stream.period);
|
|
6824
|
-
this.amountPerPeriod = new BN7__default.default(stream.amount_per_period);
|
|
6825
|
-
this.cliff = parseInt(stream.start);
|
|
6826
|
-
this.cliffAmount = new BN7__default.default(stream.cliff_amount);
|
|
6827
|
-
this.cancelableBySender = meta.cancelable_by_sender;
|
|
6828
|
-
this.cancelableByRecipient = meta.cancelable_by_recipient;
|
|
6829
|
-
this.automaticWithdrawal = meta.automatic_withdrawal;
|
|
6830
|
-
this.transferableBySender = meta.transferable_by_sender;
|
|
6831
|
-
this.transferableByRecipient = meta.transferable_by_recipient;
|
|
6832
|
-
this.canTopup = meta.can_topup;
|
|
6833
|
-
this.name = String.fromCharCode(...meta.contract_name);
|
|
6834
|
-
this.withdrawalFrequency = parseInt(meta.withdrawal_frequency);
|
|
6835
|
-
this.closed = stream.closed;
|
|
6836
|
-
this.currentPauseStart = parseInt(stream.current_pause_start);
|
|
6837
|
-
this.pauseCumulative = new BN7__default.default(stream.pause_cumulative);
|
|
6838
|
-
this.lastRateChangeTime = parseInt(stream.last_rate_change_time);
|
|
6839
|
-
this.fundsUnlockedAtLastRateChange = new BN7__default.default(stream.funds_unlocked_at_last_rate_change);
|
|
6840
|
-
this.type = buildStreamType(this);
|
|
6841
|
-
}
|
|
6842
|
-
unlocked(currentTimestamp) {
|
|
6843
|
-
return calculateUnlockedAmount({
|
|
6844
|
-
...this,
|
|
6845
|
-
currentTimestamp
|
|
6846
|
-
});
|
|
6847
|
-
}
|
|
6848
|
-
remaining(decimals) {
|
|
6849
|
-
return getNumberFromBN(this.depositedAmount.sub(this.withdrawnAmount), decimals);
|
|
6850
|
-
}
|
|
6851
|
-
};
|
|
6852
|
-
|
|
6853
|
-
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
6854
|
-
var import_retry = __toESM(require_retry2());
|
|
6855
|
-
|
|
6856
|
-
// ../../node_modules/.pnpm/is-network-error@1.1.0/node_modules/is-network-error/index.js
|
|
6857
|
-
var objectToString = Object.prototype.toString;
|
|
6858
|
-
var isError = (value) => objectToString.call(value) === "[object Error]";
|
|
6859
|
-
var errorMessages = /* @__PURE__ */ new Set([
|
|
6860
|
-
"network error",
|
|
6861
|
-
// Chrome
|
|
6862
|
-
"Failed to fetch",
|
|
6863
|
-
// Chrome
|
|
6864
|
-
"NetworkError when attempting to fetch resource.",
|
|
6865
|
-
// Firefox
|
|
6866
|
-
"The Internet connection appears to be offline.",
|
|
6867
|
-
// Safari 16
|
|
6868
|
-
"Load failed",
|
|
6869
|
-
// Safari 17+
|
|
6870
|
-
"Network request failed",
|
|
6871
|
-
// `cross-fetch`
|
|
6872
|
-
"fetch failed",
|
|
6873
|
-
// Undici (Node.js)
|
|
6874
|
-
"terminated"
|
|
6875
|
-
// Undici (Node.js)
|
|
6876
|
-
]);
|
|
6877
|
-
function isNetworkError(error) {
|
|
6878
|
-
const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
|
|
6879
|
-
if (!isValid) {
|
|
6880
|
-
return false;
|
|
6881
|
-
}
|
|
6882
|
-
if (error.message === "Load failed") {
|
|
6883
|
-
return error.stack === void 0;
|
|
6884
|
-
}
|
|
6885
|
-
return errorMessages.has(error.message);
|
|
6886
|
-
}
|
|
6887
|
-
|
|
6888
|
-
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
6889
|
-
var AbortError = class extends Error {
|
|
6890
|
-
constructor(message) {
|
|
6891
|
-
super();
|
|
6892
|
-
if (message instanceof Error) {
|
|
6893
|
-
this.originalError = message;
|
|
6894
|
-
({ message } = message);
|
|
6895
|
-
} else {
|
|
6896
|
-
this.originalError = new Error(message);
|
|
6897
|
-
this.originalError.stack = this.stack;
|
|
6898
|
-
}
|
|
6899
|
-
this.name = "AbortError";
|
|
6900
|
-
this.message = message;
|
|
6901
|
-
}
|
|
6902
|
-
};
|
|
6903
|
-
var decorateErrorWithCounts = (error, attemptNumber, options) => {
|
|
6904
|
-
const retriesLeft = options.retries - (attemptNumber - 1);
|
|
6905
|
-
error.attemptNumber = attemptNumber;
|
|
6906
|
-
error.retriesLeft = retriesLeft;
|
|
6907
|
-
return error;
|
|
6908
|
-
};
|
|
6909
|
-
async function pRetry(input, options) {
|
|
6910
|
-
return new Promise((resolve, reject) => {
|
|
6911
|
-
options = { ...options };
|
|
6912
|
-
options.onFailedAttempt ?? (options.onFailedAttempt = () => {
|
|
6913
|
-
});
|
|
6914
|
-
options.shouldRetry ?? (options.shouldRetry = () => true);
|
|
6915
|
-
options.retries ?? (options.retries = 10);
|
|
6916
|
-
const operation = import_retry.default.operation(options);
|
|
6917
|
-
const abortHandler = () => {
|
|
6918
|
-
operation.stop();
|
|
6919
|
-
reject(options.signal?.reason);
|
|
6920
|
-
};
|
|
6921
|
-
if (options.signal && !options.signal.aborted) {
|
|
6922
|
-
options.signal.addEventListener("abort", abortHandler, { once: true });
|
|
6923
|
-
}
|
|
6924
|
-
const cleanUp = () => {
|
|
6925
|
-
options.signal?.removeEventListener("abort", abortHandler);
|
|
6926
|
-
operation.stop();
|
|
6927
|
-
};
|
|
6928
|
-
operation.attempt(async (attemptNumber) => {
|
|
6929
|
-
try {
|
|
6930
|
-
const result = await input(attemptNumber);
|
|
6931
|
-
cleanUp();
|
|
6932
|
-
resolve(result);
|
|
6933
|
-
} catch (error) {
|
|
6934
|
-
try {
|
|
6935
|
-
if (!(error instanceof Error)) {
|
|
6936
|
-
throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
|
|
6937
|
-
}
|
|
6938
|
-
if (error instanceof AbortError) {
|
|
6939
|
-
throw error.originalError;
|
|
6940
|
-
}
|
|
6941
|
-
if (error instanceof TypeError && !isNetworkError(error)) {
|
|
6942
|
-
throw error;
|
|
6943
|
-
}
|
|
6944
|
-
decorateErrorWithCounts(error, attemptNumber, options);
|
|
6945
|
-
if (!await options.shouldRetry(error)) {
|
|
6946
|
-
operation.stop();
|
|
6947
|
-
reject(error);
|
|
6948
|
-
}
|
|
6949
|
-
await options.onFailedAttempt(error);
|
|
6950
|
-
if (!operation.retry(error)) {
|
|
6951
|
-
throw operation.mainError();
|
|
6952
|
-
}
|
|
6953
|
-
} catch (finalError) {
|
|
6954
|
-
decorateErrorWithCounts(finalError, attemptNumber, options);
|
|
6955
|
-
cleanUp();
|
|
6956
|
-
reject(finalError);
|
|
4141
|
+
isSigner: false
|
|
4142
|
+
},
|
|
4143
|
+
{
|
|
4144
|
+
name: "streamflowTreasuryTokens",
|
|
4145
|
+
isMut: true,
|
|
4146
|
+
isSigner: false
|
|
4147
|
+
},
|
|
4148
|
+
{
|
|
4149
|
+
name: "withdrawor",
|
|
4150
|
+
isMut: true,
|
|
4151
|
+
isSigner: false
|
|
4152
|
+
},
|
|
4153
|
+
{
|
|
4154
|
+
name: "partner",
|
|
4155
|
+
isMut: true,
|
|
4156
|
+
isSigner: false
|
|
4157
|
+
},
|
|
4158
|
+
{
|
|
4159
|
+
name: "partnerTokens",
|
|
4160
|
+
isMut: true,
|
|
4161
|
+
isSigner: false
|
|
4162
|
+
},
|
|
4163
|
+
{
|
|
4164
|
+
name: "mint",
|
|
4165
|
+
isMut: false,
|
|
4166
|
+
isSigner: false
|
|
4167
|
+
},
|
|
4168
|
+
{
|
|
4169
|
+
name: "tokenProgram",
|
|
4170
|
+
isMut: false,
|
|
4171
|
+
isSigner: false
|
|
4172
|
+
},
|
|
4173
|
+
{
|
|
4174
|
+
name: "systemProgram",
|
|
4175
|
+
isMut: false,
|
|
4176
|
+
isSigner: false
|
|
6957
4177
|
}
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
// sui/utils.ts
|
|
6964
|
-
function extractSuiErrorInfo(errorText) {
|
|
6965
|
-
const error = { text: errorText };
|
|
6966
|
-
const match = SUI_ERROR_MATCH_REGEX.exec(errorText);
|
|
6967
|
-
if (!match) {
|
|
6968
|
-
return error;
|
|
6969
|
-
}
|
|
6970
|
-
const moduleName = match[2];
|
|
6971
|
-
const errorCode = Number(match[4]);
|
|
6972
|
-
const errorName = SUI_MODULE_ERROR_MAP[moduleName] ? SUI_MODULE_ERROR_MAP[moduleName][errorCode] : void 0;
|
|
6973
|
-
const index = Number(match[5]);
|
|
6974
|
-
if (index) {
|
|
6975
|
-
error.index = index;
|
|
6976
|
-
}
|
|
6977
|
-
if (errorName) {
|
|
6978
|
-
error.parsed = {
|
|
6979
|
-
module: moduleName,
|
|
6980
|
-
code: errorCode,
|
|
6981
|
-
name: errorName
|
|
6982
|
-
};
|
|
6983
|
-
}
|
|
6984
|
-
return error;
|
|
6985
|
-
}
|
|
6986
|
-
function getTransactionBlock(client, input) {
|
|
6987
|
-
return pRetry(() => client.getTransactionBlock(input), {
|
|
6988
|
-
retries: 5,
|
|
6989
|
-
shouldRetry: (error) => error.message.includes("Could not find the referenced transaction"),
|
|
6990
|
-
minTimeout: 500,
|
|
6991
|
-
maxTimeout: 1e3
|
|
6992
|
-
});
|
|
6993
|
-
}
|
|
6994
|
-
function isSignerKeypair2(walletOrKeypair) {
|
|
6995
|
-
return walletOrKeypair instanceof cryptography.Keypair || walletOrKeypair.constructor === cryptography.Keypair || walletOrKeypair.constructor.name === cryptography.Keypair.prototype.constructor.name || "getSecretKey" in walletOrKeypair;
|
|
6996
|
-
}
|
|
6997
|
-
var SuiWalletWrapper = class {
|
|
6998
|
-
constructor(wallet, client) {
|
|
6999
|
-
this.client = client;
|
|
7000
|
-
this.wallet = wallet;
|
|
7001
|
-
if (isSignerKeypair2(wallet)) {
|
|
7002
|
-
this.address = wallet.toSuiAddress();
|
|
7003
|
-
} else {
|
|
7004
|
-
this.address = wallet.address;
|
|
7005
|
-
}
|
|
7006
|
-
}
|
|
7007
|
-
async signAndExecuteTransaction(input) {
|
|
7008
|
-
if (isSignerKeypair2(this.wallet)) {
|
|
7009
|
-
return this.client.signAndExecuteTransaction({
|
|
7010
|
-
...input,
|
|
7011
|
-
// @ts-ignore
|
|
7012
|
-
signer: this.wallet
|
|
7013
|
-
});
|
|
7014
|
-
}
|
|
7015
|
-
return this.wallet.signAndExecuteTransaction(input);
|
|
7016
|
-
}
|
|
7017
|
-
};
|
|
7018
|
-
|
|
7019
|
-
// sui/StreamClient.ts
|
|
7020
|
-
var SuiStreamClient = class extends BaseStreamClient {
|
|
7021
|
-
constructor(clusterUrl, cluster = common.ICluster.Mainnet, ids) {
|
|
7022
|
-
super();
|
|
7023
|
-
this.programId = ids?.program ? ids.program : SUI_PROGRAM_IDS[cluster];
|
|
7024
|
-
this.configId = ids?.config ? ids.config : SUI_CONFIG_IDS[cluster];
|
|
7025
|
-
this.feeTableId = ids?.feeTable ? ids.feeTable : SUI_FEE_TABLE_IDS[cluster];
|
|
7026
|
-
this.client = new client.SuiClient({ url: clusterUrl });
|
|
7027
|
-
}
|
|
7028
|
-
/**
|
|
7029
|
-
* Creates a new stream/vesting contract.
|
|
7030
|
-
*/
|
|
7031
|
-
async create(streamData, { senderWallet }) {
|
|
7032
|
-
const wallet = new SuiWalletWrapper(senderWallet, this.client);
|
|
7033
|
-
const totalFee = await this.getTotalFee({
|
|
7034
|
-
address: streamData.partner ?? wallet.address
|
|
7035
|
-
});
|
|
7036
|
-
const [tx] = await this.generateCreateBlock(
|
|
7037
|
-
wallet.address,
|
|
7038
|
-
{
|
|
7039
|
-
...streamData,
|
|
7040
|
-
recipients: [{ ...streamData }]
|
|
7041
|
-
},
|
|
7042
|
-
totalFee
|
|
7043
|
-
);
|
|
7044
|
-
const { digest, events } = await wallet.signAndExecuteTransaction({
|
|
7045
|
-
transaction: tx,
|
|
7046
|
-
options: { showEvents: true }
|
|
7047
|
-
});
|
|
7048
|
-
return {
|
|
7049
|
-
ixs: [],
|
|
7050
|
-
txId: digest,
|
|
7051
|
-
metadataId: events[0].parsedJson.address
|
|
7052
|
-
};
|
|
7053
|
-
}
|
|
7054
|
-
/**
|
|
7055
|
-
* Creates multiple stream/vesting contracts.
|
|
7056
|
-
* We don't chain transactions in one Block so that one failed transaction does not revert all others.
|
|
7057
|
-
*/
|
|
7058
|
-
async createMultiple(multipleStreamData, { senderWallet }) {
|
|
7059
|
-
const wallet = new SuiWalletWrapper(senderWallet, this.client);
|
|
7060
|
-
const totalFee = await this.getTotalFee({
|
|
7061
|
-
address: multipleStreamData.partner ?? wallet.address
|
|
7062
|
-
});
|
|
7063
|
-
const [tx, firstIndex] = await this.generateCreateBlock(wallet.address, multipleStreamData, totalFee);
|
|
7064
|
-
const txs = [];
|
|
7065
|
-
const metadatas = [];
|
|
7066
|
-
const metadataToRecipient = {};
|
|
7067
|
-
const errors = [];
|
|
7068
|
-
try {
|
|
7069
|
-
const executedTx = await wallet.signAndExecuteTransaction({
|
|
7070
|
-
transaction: tx,
|
|
7071
|
-
options: { showEffects: true, showEvents: true }
|
|
7072
|
-
});
|
|
7073
|
-
const digest = executedTx.digest;
|
|
7074
|
-
const { events, effects } = !executedTx.effects || typeof executedTx.effects === "string" ? await getTransactionBlock(this.client, { digest, options: { showEvents: true, showEffects: true } }) : executedTx;
|
|
7075
|
-
txs.push(digest);
|
|
7076
|
-
if (effects.status.status === "failure") {
|
|
7077
|
-
multipleStreamData.recipients.forEach((recipient) => {
|
|
7078
|
-
errors.push({
|
|
7079
|
-
error: effects.status.error ?? "Unknown error!",
|
|
7080
|
-
recipient: recipient.recipient
|
|
7081
|
-
});
|
|
7082
|
-
});
|
|
7083
|
-
} else {
|
|
7084
|
-
multipleStreamData.recipients.forEach((recipient, index) => {
|
|
7085
|
-
const metadataId = events[index].parsedJson.address;
|
|
7086
|
-
metadatas.push(metadataId);
|
|
7087
|
-
metadataToRecipient[metadataId] = recipient;
|
|
7088
|
-
});
|
|
7089
|
-
}
|
|
7090
|
-
} catch (e) {
|
|
7091
|
-
const errorInfo = extractSuiErrorInfo(e.toString() ?? "Unknown error!");
|
|
7092
|
-
multipleStreamData.recipients.forEach((recipient, index) => {
|
|
7093
|
-
if (errorInfo.index === void 0 || errorInfo.index < index + firstIndex || errorInfo.index >= multipleStreamData.recipients.length + firstIndex || errorInfo.index === index + firstIndex) {
|
|
7094
|
-
errors.push({
|
|
7095
|
-
error: errorInfo.text,
|
|
7096
|
-
recipient: recipient.recipient,
|
|
7097
|
-
contractErrorCode: errorInfo.parsed?.name
|
|
7098
|
-
});
|
|
4178
|
+
],
|
|
4179
|
+
args: [
|
|
4180
|
+
{
|
|
4181
|
+
name: "amount",
|
|
4182
|
+
type: "u64"
|
|
7099
4183
|
}
|
|
7100
|
-
});
|
|
7101
|
-
}
|
|
7102
|
-
return {
|
|
7103
|
-
txs,
|
|
7104
|
-
metadatas,
|
|
7105
|
-
metadataToRecipient,
|
|
7106
|
-
errors
|
|
7107
|
-
};
|
|
7108
|
-
}
|
|
7109
|
-
/**
|
|
7110
|
-
* Attempts withdrawing from the specified stream.
|
|
7111
|
-
*/
|
|
7112
|
-
async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, { senderWallet, tokenId }) {
|
|
7113
|
-
const wallet = new SuiWalletWrapper(senderWallet, this.client);
|
|
7114
|
-
const tx = new transactions.Transaction();
|
|
7115
|
-
tx.moveCall({
|
|
7116
|
-
target: `${this.programId}::protocol::withdraw`,
|
|
7117
|
-
typeArguments: [tokenId],
|
|
7118
|
-
arguments: [
|
|
7119
|
-
tx.object(id),
|
|
7120
|
-
tx.object(this.configId),
|
|
7121
|
-
tx.object(utils.SUI_CLOCK_OBJECT_ID),
|
|
7122
|
-
tx.pure.u64(amount.toString())
|
|
7123
|
-
]
|
|
7124
|
-
});
|
|
7125
|
-
const { digest } = await wallet.signAndExecuteTransaction({
|
|
7126
|
-
transaction: tx
|
|
7127
|
-
});
|
|
7128
|
-
return {
|
|
7129
|
-
ixs: [],
|
|
7130
|
-
txId: digest
|
|
7131
|
-
};
|
|
7132
|
-
}
|
|
7133
|
-
/**
|
|
7134
|
-
* Attempts canceling the specified stream.
|
|
7135
|
-
*/
|
|
7136
|
-
async cancel(cancelData, { senderWallet, tokenId }) {
|
|
7137
|
-
const wallet = new SuiWalletWrapper(senderWallet, this.client);
|
|
7138
|
-
const tx = new transactions.Transaction();
|
|
7139
|
-
tx.moveCall({
|
|
7140
|
-
target: `${this.programId}::protocol::cancel`,
|
|
7141
|
-
typeArguments: [tokenId],
|
|
7142
|
-
arguments: [tx.object(cancelData.id), tx.object(this.configId), tx.object(utils.SUI_CLOCK_OBJECT_ID)]
|
|
7143
|
-
});
|
|
7144
|
-
const { digest } = await wallet.signAndExecuteTransaction({
|
|
7145
|
-
transaction: tx
|
|
7146
|
-
});
|
|
7147
|
-
return {
|
|
7148
|
-
ixs: [],
|
|
7149
|
-
txId: digest
|
|
7150
|
-
};
|
|
7151
|
-
}
|
|
7152
|
-
/**
|
|
7153
|
-
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
7154
|
-
*/
|
|
7155
|
-
async transfer(transferData, { senderWallet, tokenId }) {
|
|
7156
|
-
const wallet = new SuiWalletWrapper(senderWallet, this.client);
|
|
7157
|
-
const tx = new transactions.Transaction();
|
|
7158
|
-
tx.moveCall({
|
|
7159
|
-
target: `${this.programId}::protocol::transfer`,
|
|
7160
|
-
typeArguments: [tokenId],
|
|
7161
|
-
arguments: [tx.object(transferData.id), tx.pure.address(transferData.newRecipient)]
|
|
7162
|
-
});
|
|
7163
|
-
const { digest } = await wallet.signAndExecuteTransaction({
|
|
7164
|
-
transaction: tx
|
|
7165
|
-
});
|
|
7166
|
-
return {
|
|
7167
|
-
ixs: [],
|
|
7168
|
-
txId: digest
|
|
7169
|
-
};
|
|
7170
|
-
}
|
|
7171
|
-
/**
|
|
7172
|
-
* Tops up stream account with specified amount.
|
|
7173
|
-
*/
|
|
7174
|
-
async topup(topupData, { senderWallet, tokenId }) {
|
|
7175
|
-
const wallet = new SuiWalletWrapper(senderWallet, this.client);
|
|
7176
|
-
const tx = new transactions.Transaction();
|
|
7177
|
-
const coins = await this.getAllCoins(wallet.address, tokenId);
|
|
7178
|
-
const stream = await this.getOne({ id: topupData.id });
|
|
7179
|
-
const totalFee = (stream.partnerFeePercent + stream.streamflowFeePercent) / 100;
|
|
7180
|
-
const coinObject = this.splitCoinObjectForAmount(tx, topupData.amount, tokenId, coins, totalFee);
|
|
7181
|
-
tx.moveCall({
|
|
7182
|
-
target: `${this.programId}::protocol::topup`,
|
|
7183
|
-
typeArguments: [tokenId],
|
|
7184
|
-
arguments: [
|
|
7185
|
-
tx.object(topupData.id),
|
|
7186
|
-
tx.object(this.configId),
|
|
7187
|
-
coinObject,
|
|
7188
|
-
tx.gas,
|
|
7189
|
-
tx.pure.u64(topupData.amount.toString())
|
|
7190
|
-
]
|
|
7191
|
-
});
|
|
7192
|
-
this.returnSplittedCoinObject(tx, tokenId, coins, coinObject);
|
|
7193
|
-
const { digest } = await wallet.signAndExecuteTransaction({
|
|
7194
|
-
transaction: tx
|
|
7195
|
-
});
|
|
7196
|
-
return {
|
|
7197
|
-
ixs: [],
|
|
7198
|
-
txId: digest
|
|
7199
|
-
};
|
|
7200
|
-
}
|
|
7201
|
-
/**
|
|
7202
|
-
* Fetch stream data by its id (address).
|
|
7203
|
-
*/
|
|
7204
|
-
async getOne({ id }) {
|
|
7205
|
-
const response = await this.client.getObject({
|
|
7206
|
-
id,
|
|
7207
|
-
options: {
|
|
7208
|
-
showContent: true
|
|
7209
|
-
}
|
|
7210
|
-
});
|
|
7211
|
-
if (!response.data) {
|
|
7212
|
-
throw new Error(`Contract with id ${id} could not be found!`);
|
|
7213
|
-
}
|
|
7214
|
-
const content = response.data.content;
|
|
7215
|
-
if (content.dataType !== "moveObject") {
|
|
7216
|
-
throw new Error(`Not a Move Object!`);
|
|
7217
|
-
}
|
|
7218
|
-
return new Contract3(
|
|
7219
|
-
content.fields,
|
|
7220
|
-
"0x97e9a9fb1392e9785319f5512d0bfde6ecf7757b09c6de41cec89e798dd361f2::strmt::STRMT"
|
|
7221
|
-
);
|
|
7222
|
-
}
|
|
7223
|
-
async get() {
|
|
7224
|
-
throw new Error("Get all method is not supported for Sui chain!");
|
|
7225
|
-
}
|
|
7226
|
-
/**
|
|
7227
|
-
* Attempts updating the stream auto withdrawal params and amount per period
|
|
7228
|
-
*/
|
|
7229
|
-
async update(updateData, { senderWallet, tokenId }) {
|
|
7230
|
-
const wallet = new SuiWalletWrapper(senderWallet, this.client);
|
|
7231
|
-
const tx = new transactions.Transaction();
|
|
7232
|
-
tx.moveCall({
|
|
7233
|
-
target: `${this.programId}::protocol::update`,
|
|
7234
|
-
typeArguments: [tokenId],
|
|
7235
|
-
arguments: [
|
|
7236
|
-
tx.object(updateData.id),
|
|
7237
|
-
tx.object(this.configId),
|
|
7238
|
-
tx.object(utils.SUI_CLOCK_OBJECT_ID),
|
|
7239
|
-
tx.gas,
|
|
7240
|
-
bcs.bcs.vector(bcs.bcs.bool()).serialize(updateData.enableAutomaticWithdrawal !== void 0 ? [updateData.enableAutomaticWithdrawal] : []),
|
|
7241
|
-
bcs.bcs.vector(bcs.bcs.u64()).serialize(updateData.withdrawFrequency !== void 0 ? [updateData.withdrawFrequency.toString()] : []),
|
|
7242
|
-
bcs.bcs.vector(bcs.bcs.u64()).serialize(updateData.amountPerPeriod !== void 0 ? [updateData.amountPerPeriod.toString()] : [])
|
|
7243
4184
|
]
|
|
7244
|
-
});
|
|
7245
|
-
const { digest } = await wallet.signAndExecuteTransaction({
|
|
7246
|
-
transaction: tx
|
|
7247
|
-
});
|
|
7248
|
-
return {
|
|
7249
|
-
ixs: [],
|
|
7250
|
-
txId: digest
|
|
7251
|
-
};
|
|
7252
|
-
}
|
|
7253
|
-
extractErrorCode(err) {
|
|
7254
|
-
const errorInfo = extractSuiErrorInfo(err.toString() ?? "Unknown error!");
|
|
7255
|
-
return errorInfo?.parsed?.name || null;
|
|
7256
|
-
}
|
|
7257
|
-
async getFees({ address }) {
|
|
7258
|
-
const response = await this.client.getObject({
|
|
7259
|
-
id: this.feeTableId,
|
|
7260
|
-
options: {
|
|
7261
|
-
showContent: true
|
|
7262
|
-
}
|
|
7263
|
-
});
|
|
7264
|
-
const content = response.data.content;
|
|
7265
|
-
if (content.dataType !== "moveObject") {
|
|
7266
|
-
throw new Error(`Not a Move Object!`);
|
|
7267
|
-
}
|
|
7268
|
-
const fields = content.fields;
|
|
7269
|
-
const fieldsResponse = await this.client.getDynamicFields({
|
|
7270
|
-
parentId: fields.values.fields.id.id
|
|
7271
|
-
});
|
|
7272
|
-
const partnerDynamicField = fieldsResponse.data.filter((item) => item.name.value === address)[0];
|
|
7273
|
-
if (!partnerDynamicField) {
|
|
7274
|
-
return null;
|
|
7275
|
-
}
|
|
7276
|
-
const valueResponse = await this.client.getObject({
|
|
7277
|
-
id: partnerDynamicField.objectId,
|
|
7278
|
-
options: {
|
|
7279
|
-
showContent: true
|
|
7280
|
-
}
|
|
7281
|
-
});
|
|
7282
|
-
const valueContent = valueResponse.data.content;
|
|
7283
|
-
if (valueContent.dataType !== "moveObject") {
|
|
7284
|
-
throw new Error(`Not a Move Object!`);
|
|
7285
|
-
}
|
|
7286
|
-
const valueFields = valueContent.fields.value.fields;
|
|
7287
|
-
return {
|
|
7288
|
-
streamflowFee: Number(valueFields.streamflow_fee) / 100,
|
|
7289
|
-
partnerFee: Number(valueFields.partner_fee) / 100
|
|
7290
|
-
};
|
|
7291
|
-
}
|
|
7292
|
-
async getDefaultStreamflowFee() {
|
|
7293
|
-
const response = await this.client.getObject({
|
|
7294
|
-
id: this.configId,
|
|
7295
|
-
options: {
|
|
7296
|
-
showContent: true
|
|
7297
|
-
}
|
|
7298
|
-
});
|
|
7299
|
-
const content = response.data.content;
|
|
7300
|
-
if (content.dataType !== "moveObject") {
|
|
7301
|
-
throw new Error(`Not a Move Object!`);
|
|
7302
|
-
}
|
|
7303
|
-
const fields = content.fields;
|
|
7304
|
-
return Number(fields.streamflow_fee) / 100;
|
|
7305
|
-
}
|
|
7306
|
-
/**
|
|
7307
|
-
* Returns StreamClient protocol program ID.
|
|
7308
|
-
*/
|
|
7309
|
-
getProgramId() {
|
|
7310
|
-
return this.programId;
|
|
7311
|
-
}
|
|
7312
|
-
/**
|
|
7313
|
-
* Utility function to generate Transaction Block to create streams
|
|
7314
|
-
*/
|
|
7315
|
-
async generateCreateBlock(walletAddress, multipleStreamData, totalFee) {
|
|
7316
|
-
let coins = await this.getAllCoins(walletAddress, multipleStreamData.tokenId);
|
|
7317
|
-
const totalAmount = multipleStreamData.recipients.map((recipiient) => recipiient.amount).reduce((prev, current) => current.add(prev));
|
|
7318
|
-
const tx = new transactions.Transaction();
|
|
7319
|
-
const coinObject = this.splitCoinObjectForAmount(tx, totalAmount, multipleStreamData.tokenId, coins, totalFee);
|
|
7320
|
-
coins = [coins[0]];
|
|
7321
|
-
let firstIndex = null;
|
|
7322
|
-
multipleStreamData.recipients.forEach((recipient) => {
|
|
7323
|
-
const result = tx.moveCall({
|
|
7324
|
-
target: `${this.programId}::protocol::create`,
|
|
7325
|
-
typeArguments: [multipleStreamData.tokenId],
|
|
7326
|
-
arguments: [
|
|
7327
|
-
tx.object(this.configId),
|
|
7328
|
-
tx.object(this.feeTableId),
|
|
7329
|
-
tx.object(utils.SUI_CLOCK_OBJECT_ID),
|
|
7330
|
-
coinObject,
|
|
7331
|
-
tx.gas,
|
|
7332
|
-
tx.pure.u64(recipient.amount.toString()),
|
|
7333
|
-
tx.pure.u64(multipleStreamData.period),
|
|
7334
|
-
tx.pure.u64(recipient.amountPerPeriod.toString()),
|
|
7335
|
-
tx.pure.u64(multipleStreamData.start),
|
|
7336
|
-
tx.pure.u64(recipient.cliffAmount.toString()),
|
|
7337
|
-
tx.pure.bool(multipleStreamData.cancelableBySender),
|
|
7338
|
-
tx.pure.bool(multipleStreamData.cancelableByRecipient),
|
|
7339
|
-
tx.pure.bool(multipleStreamData.transferableBySender),
|
|
7340
|
-
tx.pure.bool(multipleStreamData.transferableByRecipient),
|
|
7341
|
-
tx.pure.bool(multipleStreamData.canTopup),
|
|
7342
|
-
tx.pure.bool(!!multipleStreamData.canPause),
|
|
7343
|
-
tx.pure.bool(!!multipleStreamData.canUpdateRate),
|
|
7344
|
-
tx.pure.bool(!!multipleStreamData.automaticWithdrawal),
|
|
7345
|
-
tx.pure.u64(multipleStreamData.withdrawalFrequency || 0),
|
|
7346
|
-
tx.pure.string(recipient.name),
|
|
7347
|
-
tx.pure.address(recipient.recipient),
|
|
7348
|
-
tx.pure.address(multipleStreamData.partner || walletAddress)
|
|
7349
|
-
]
|
|
7350
|
-
});
|
|
7351
|
-
if (result.$kind === "Result" && firstIndex === null) {
|
|
7352
|
-
firstIndex = result.Result;
|
|
7353
|
-
}
|
|
7354
|
-
});
|
|
7355
|
-
this.returnSplittedCoinObject(tx, multipleStreamData.tokenId, coins, coinObject);
|
|
7356
|
-
return [tx, firstIndex];
|
|
7357
|
-
}
|
|
7358
|
-
/**
|
|
7359
|
-
* Returns all coins owned by a Wallet
|
|
7360
|
-
* @param walletAddress wallet address
|
|
7361
|
-
* @param coinType coin type
|
|
7362
|
-
* @returns Array of Coin Structs
|
|
7363
|
-
*/
|
|
7364
|
-
async getAllCoins(walletAddress, coinType) {
|
|
7365
|
-
let coinsResponse = await this.client.getCoins({
|
|
7366
|
-
owner: walletAddress,
|
|
7367
|
-
coinType
|
|
7368
|
-
});
|
|
7369
|
-
const coins = coinsResponse.data;
|
|
7370
|
-
while (coinsResponse.hasNextPage) {
|
|
7371
|
-
coinsResponse = await this.client.getCoins({
|
|
7372
|
-
owner: walletAddress,
|
|
7373
|
-
coinType,
|
|
7374
|
-
cursor: coinsResponse.nextCursor
|
|
7375
|
-
});
|
|
7376
|
-
coins.push(...coinsResponse.data);
|
|
7377
|
-
}
|
|
7378
|
-
return coins;
|
|
7379
|
-
}
|
|
7380
|
-
/**
|
|
7381
|
-
* Utility function to split Coin object and use splitted object for stream operations.
|
|
7382
|
-
* We do it like thid to mitigate risk of Transaction reverting in case Stream is created for Sui Coin object.
|
|
7383
|
-
* This way we can safely pass splitted Sui Coin object in Stream payload and use another object for gas/withdrawal fees.
|
|
7384
|
-
* @param tx current transanction block
|
|
7385
|
-
* @param amount minimal amount of coins requried
|
|
7386
|
-
* @param coinType coin type
|
|
7387
|
-
* @param coins array of owned coins of the same type
|
|
7388
|
-
* @param totalFee partner and treasury fees
|
|
7389
|
-
* @returns Coin Object to use in a Move Call
|
|
7390
|
-
*/
|
|
7391
|
-
splitCoinObjectForAmount(tx, amount, coinType, coins, totalFee) {
|
|
7392
|
-
const coinObject = coinType === utils.SUI_TYPE_ARG ? tx.gas : tx.object(coins[0].coinObjectId);
|
|
7393
|
-
if (coins.length > 1) {
|
|
7394
|
-
tx.mergeCoins(
|
|
7395
|
-
coinObject,
|
|
7396
|
-
coins.slice(1).map((item) => tx.object(item.coinObjectId))
|
|
7397
|
-
);
|
|
7398
|
-
}
|
|
7399
|
-
const totalAmount = calculateTotalAmountToDeposit(amount, totalFee);
|
|
7400
|
-
return tx.splitCoins(coinObject, [tx.pure.u64(totalAmount.toString())])[0];
|
|
7401
|
-
}
|
|
7402
|
-
/**
|
|
7403
|
-
* Return previously splitted Coin Object to owner and merge it to to rebate storage fees
|
|
7404
|
-
* @param tx current transaction
|
|
7405
|
-
* @param coinType coin type
|
|
7406
|
-
* @param coinObject splitted object
|
|
7407
|
-
* @param coins array of objects used in
|
|
7408
|
-
*/
|
|
7409
|
-
returnSplittedCoinObject(tx, coinType, coins, coinObject) {
|
|
7410
|
-
const firstCoinObject = coinType === utils.SUI_TYPE_ARG ? tx.gas : tx.object(coins[0].coinObjectId);
|
|
7411
|
-
tx.mergeCoins(firstCoinObject, [coinObject]);
|
|
7412
|
-
}
|
|
7413
|
-
};
|
|
7414
|
-
|
|
7415
|
-
// common/GenericStreamClient.ts
|
|
7416
|
-
var GenericStreamClient = class extends BaseStreamClient {
|
|
7417
|
-
constructor(options) {
|
|
7418
|
-
super();
|
|
7419
|
-
this.chain = options.chain;
|
|
7420
|
-
switch (options.chain) {
|
|
7421
|
-
case common.IChain.Solana:
|
|
7422
|
-
this.nativeStreamClient = new SolanaStreamClient(options);
|
|
7423
|
-
break;
|
|
7424
|
-
case common.IChain.Aptos:
|
|
7425
|
-
this.nativeStreamClient = new AptosStreamClient(
|
|
7426
|
-
options.clusterUrl,
|
|
7427
|
-
options.cluster,
|
|
7428
|
-
options.maxGas,
|
|
7429
|
-
options.programId
|
|
7430
|
-
);
|
|
7431
|
-
break;
|
|
7432
|
-
case common.IChain.BNB:
|
|
7433
|
-
case common.IChain.Ethereum:
|
|
7434
|
-
case common.IChain.Polygon:
|
|
7435
|
-
this.nativeStreamClient = new EvmStreamClient(
|
|
7436
|
-
options.clusterUrl,
|
|
7437
|
-
options.chain,
|
|
7438
|
-
options.signer,
|
|
7439
|
-
options.cluster,
|
|
7440
|
-
options.programId
|
|
7441
|
-
);
|
|
7442
|
-
break;
|
|
7443
|
-
case common.IChain.Sui:
|
|
7444
|
-
this.nativeStreamClient = new SuiStreamClient(
|
|
7445
|
-
options.clusterUrl,
|
|
7446
|
-
options.cluster,
|
|
7447
|
-
options.ids
|
|
7448
|
-
);
|
|
7449
4185
|
}
|
|
7450
|
-
|
|
7451
|
-
/**
|
|
7452
|
-
* Creates a new stream/vesting contract.
|
|
7453
|
-
*/
|
|
7454
|
-
create(streamData, chainSpecificParams) {
|
|
7455
|
-
return handleContractError(
|
|
7456
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7457
|
-
() => this.nativeStreamClient.create(streamData, chainSpecificParams),
|
|
7458
|
-
this.nativeStreamClient.extractErrorCode
|
|
7459
|
-
);
|
|
7460
|
-
}
|
|
7461
|
-
/**
|
|
7462
|
-
* Creates multiple stream/vesting contracts.
|
|
7463
|
-
*/
|
|
7464
|
-
createMultiple(multipleStreamData, chainSpecificParams) {
|
|
7465
|
-
return handleContractError(
|
|
7466
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7467
|
-
() => this.nativeStreamClient.createMultiple(multipleStreamData, chainSpecificParams),
|
|
7468
|
-
this.nativeStreamClient.extractErrorCode
|
|
7469
|
-
);
|
|
7470
|
-
}
|
|
7471
|
-
/**
|
|
7472
|
-
* Attempts withdrawing from the specified stream.
|
|
7473
|
-
*/
|
|
7474
|
-
withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, chainSpecificParams) {
|
|
7475
|
-
return handleContractError(
|
|
7476
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7477
|
-
() => this.nativeStreamClient.withdraw({ id, amount }, chainSpecificParams),
|
|
7478
|
-
this.nativeStreamClient.extractErrorCode
|
|
7479
|
-
);
|
|
7480
|
-
}
|
|
7481
|
-
/**
|
|
7482
|
-
* Attempts canceling the specified stream.
|
|
7483
|
-
*/
|
|
7484
|
-
cancel(cancelData, chainSpecificParams) {
|
|
7485
|
-
return handleContractError(
|
|
7486
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7487
|
-
() => this.nativeStreamClient.cancel(cancelData, chainSpecificParams),
|
|
7488
|
-
this.nativeStreamClient.extractErrorCode
|
|
7489
|
-
);
|
|
7490
|
-
}
|
|
7491
|
-
/**
|
|
7492
|
-
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
7493
|
-
*/
|
|
7494
|
-
transfer(transferData, chainSpecificParams) {
|
|
7495
|
-
return handleContractError(
|
|
7496
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7497
|
-
() => this.nativeStreamClient.transfer(transferData, chainSpecificParams),
|
|
7498
|
-
this.nativeStreamClient.extractErrorCode
|
|
7499
|
-
);
|
|
7500
|
-
}
|
|
7501
|
-
/**
|
|
7502
|
-
* Tops up stream account with specified amount.
|
|
7503
|
-
*/
|
|
7504
|
-
topup(topupData, chainSpecificParams) {
|
|
7505
|
-
return handleContractError(
|
|
7506
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7507
|
-
() => this.nativeStreamClient.topup(topupData, chainSpecificParams),
|
|
7508
|
-
this.nativeStreamClient.extractErrorCode
|
|
7509
|
-
);
|
|
7510
|
-
}
|
|
7511
|
-
/**
|
|
7512
|
-
* Fetch stream data by its id (address).
|
|
7513
|
-
*/
|
|
7514
|
-
getOne(getOneData) {
|
|
7515
|
-
return this.nativeStreamClient.getOne(getOneData);
|
|
7516
|
-
}
|
|
7517
|
-
/**
|
|
7518
|
-
* Fetch streams by sender or recipient address.
|
|
7519
|
-
*/
|
|
7520
|
-
get(getAllData) {
|
|
7521
|
-
return this.nativeStreamClient.get(getAllData);
|
|
7522
|
-
}
|
|
7523
|
-
/**
|
|
7524
|
-
* Attempts updating the stream auto withdrawal params and amount per period
|
|
7525
|
-
*/
|
|
7526
|
-
update(updateData, chainSpecificParams) {
|
|
7527
|
-
return handleContractError(
|
|
7528
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7529
|
-
() => this.nativeStreamClient.update(updateData, chainSpecificParams),
|
|
7530
|
-
this.nativeStreamClient.extractErrorCode
|
|
7531
|
-
);
|
|
7532
|
-
}
|
|
7533
|
-
/**
|
|
7534
|
-
* Returns streamflow and partner fees for the specific wallet in %
|
|
7535
|
-
*/
|
|
7536
|
-
getFees(getFeesData) {
|
|
7537
|
-
return this.nativeStreamClient.getFees(getFeesData);
|
|
7538
|
-
}
|
|
7539
|
-
/**
|
|
7540
|
-
* Returns default Streamflow Fee in %
|
|
7541
|
-
*/
|
|
7542
|
-
getDefaultStreamflowFee() {
|
|
7543
|
-
return this.nativeStreamClient.getDefaultStreamflowFee();
|
|
7544
|
-
}
|
|
4186
|
+
]
|
|
7545
4187
|
};
|
|
7546
4188
|
|
|
7547
4189
|
Object.defineProperty(exports, "ContractError", {
|
|
7548
4190
|
enumerable: true,
|
|
7549
4191
|
get: function () { return common.ContractError; }
|
|
7550
4192
|
});
|
|
7551
|
-
Object.defineProperty(exports, "IChain", {
|
|
7552
|
-
enumerable: true,
|
|
7553
|
-
get: function () { return common.IChain; }
|
|
7554
|
-
});
|
|
7555
4193
|
Object.defineProperty(exports, "ICluster", {
|
|
7556
4194
|
enumerable: true,
|
|
7557
4195
|
get: function () { return common.ICluster; }
|
|
7558
4196
|
});
|
|
4197
|
+
Object.defineProperty(exports, "getBN", {
|
|
4198
|
+
enumerable: true,
|
|
4199
|
+
get: function () { return common.getBN; }
|
|
4200
|
+
});
|
|
4201
|
+
Object.defineProperty(exports, "getNumberFromBN", {
|
|
4202
|
+
enumerable: true,
|
|
4203
|
+
get: function () { return common.getNumberFromBN; }
|
|
4204
|
+
});
|
|
7559
4205
|
exports.AIRDROP_AMOUNT = AIRDROP_AMOUNT;
|
|
7560
4206
|
exports.AIRDROP_TEST_TOKEN = AIRDROP_TEST_TOKEN;
|
|
7561
4207
|
exports.ALIGNED_COMPUTE_LIMIT = ALIGNED_COMPUTE_LIMIT;
|
|
7562
|
-
exports.ALIGNED_PRECISION_FACTOR_POW =
|
|
4208
|
+
exports.ALIGNED_PRECISION_FACTOR_POW = ALIGNED_PRECISION_FACTOR_POW2;
|
|
7563
4209
|
exports.ALIGNED_UNLOCKS_PROGRAM_ID = ALIGNED_UNLOCKS_PROGRAM_ID;
|
|
7564
|
-
exports.
|
|
4210
|
+
exports.AlignedContract = AlignedContract;
|
|
4211
|
+
exports.AlignedProxyErrorCode = AlignedProxyErrorCode;
|
|
7565
4212
|
exports.CONTRACT_DISCRIMINATOR = CONTRACT_DISCRIMINATOR;
|
|
7566
4213
|
exports.CONTRACT_SEED = CONTRACT_SEED;
|
|
7567
4214
|
exports.CREATE_PARAMS_PADDING = CREATE_PARAMS_PADDING;
|
|
4215
|
+
exports.Contract = Contract;
|
|
7568
4216
|
exports.ContractErrorCode = ContractErrorCode;
|
|
7569
4217
|
exports.DEFAULT_STREAMFLOW_FEE = DEFAULT_STREAMFLOW_FEE;
|
|
7570
4218
|
exports.ESCROW_SEED = ESCROW_SEED;
|
|
7571
4219
|
exports.FEES_METADATA_SEED = FEES_METADATA_SEED;
|
|
7572
4220
|
exports.FEE_ORACLE_PUBLIC_KEY = FEE_ORACLE_PUBLIC_KEY;
|
|
7573
|
-
exports.
|
|
7574
|
-
exports.MAX_SAFE_UNIX_TIME_VALUE = MAX_SAFE_UNIX_TIME_VALUE;
|
|
4221
|
+
exports.MAX_SAFE_UNIX_TIME_VALUE = MAX_SAFE_UNIX_TIME_VALUE2;
|
|
7575
4222
|
exports.ORIGINAL_CONTRACT_SENDER_OFFSET = ORIGINAL_CONTRACT_SENDER_OFFSET;
|
|
7576
4223
|
exports.PARTNERS_SCHEMA = PARTNERS_SCHEMA;
|
|
7577
4224
|
exports.PARTNER_ORACLE_PROGRAM_ID = PARTNER_ORACLE_PROGRAM_ID;
|
|
@@ -7585,14 +4232,9 @@ exports.STREAM_STRUCT_OFFSET_CLOSED = STREAM_STRUCT_OFFSET_CLOSED;
|
|
|
7585
4232
|
exports.STREAM_STRUCT_OFFSET_MINT = STREAM_STRUCT_OFFSET_MINT;
|
|
7586
4233
|
exports.STREAM_STRUCT_OFFSET_RECIPIENT = STREAM_STRUCT_OFFSET_RECIPIENT;
|
|
7587
4234
|
exports.STREAM_STRUCT_OFFSET_SENDER = STREAM_STRUCT_OFFSET_SENDER;
|
|
7588
|
-
exports.
|
|
7589
|
-
exports.SolanaContractErrorCode = SolanaContractErrorCode;
|
|
4235
|
+
exports.SolanaStreamClient = SolanaStreamClient;
|
|
7590
4236
|
exports.StreamDirection = StreamDirection;
|
|
7591
4237
|
exports.StreamType = StreamType;
|
|
7592
|
-
exports.StreamflowAptos = aptos_exports;
|
|
7593
|
-
exports.StreamflowEVM = evm_exports;
|
|
7594
|
-
exports.StreamflowSolana = solana_exports;
|
|
7595
|
-
exports.StreamflowSui = sui_exports;
|
|
7596
4238
|
exports.TEST_ORACLE_DISCRIMINATOR = TEST_ORACLE_DISCRIMINATOR;
|
|
7597
4239
|
exports.TEST_ORACLE_SEED = TEST_ORACLE_SEED;
|
|
7598
4240
|
exports.TX_FINALITY_CONFIRMED = TX_FINALITY_CONFIRMED;
|
|
@@ -7601,15 +4243,29 @@ exports.WITHDRAW_AVAILABLE_AMOUNT = WITHDRAW_AVAILABLE_AMOUNT;
|
|
|
7601
4243
|
exports.buildStreamType = buildStreamType;
|
|
7602
4244
|
exports.calculateTotalAmountToDeposit = calculateTotalAmountToDeposit;
|
|
7603
4245
|
exports.calculateUnlockedAmount = calculateUnlockedAmount;
|
|
4246
|
+
exports.cancelStreamInstruction = cancelStreamInstruction;
|
|
4247
|
+
exports.createStreamInstruction = createStreamInstruction;
|
|
4248
|
+
exports.createUncheckedStreamInstruction = createUncheckedStreamInstruction;
|
|
7604
4249
|
exports.decodeEndTime = decodeEndTime;
|
|
7605
|
-
exports.
|
|
7606
|
-
exports.
|
|
4250
|
+
exports.decodeStream = decodeStream;
|
|
4251
|
+
exports.deriveContractPDA = deriveContractPDA;
|
|
4252
|
+
exports.deriveEscrowPDA = deriveEscrowPDA;
|
|
4253
|
+
exports.deriveTestOraclePDA = deriveTestOraclePDA;
|
|
4254
|
+
exports.extractSolanaErrorCode = extractSolanaErrorCode;
|
|
7607
4255
|
exports.handleContractError = handleContractError;
|
|
7608
4256
|
exports.isAligned = isAligned;
|
|
7609
4257
|
exports.isCliffCloseToDepositedAmount = isCliffCloseToDepositedAmount;
|
|
7610
4258
|
exports.isCreateAlignedStreamData = isCreateAlignedStreamData;
|
|
7611
4259
|
exports.isDynamicLock = isDynamicLock;
|
|
4260
|
+
exports.isPayment = isPayment;
|
|
7612
4261
|
exports.isTokenLock = isTokenLock;
|
|
7613
4262
|
exports.isVesting = isVesting;
|
|
4263
|
+
exports.sendAndConfirmStreamRawTransaction = sendAndConfirmStreamRawTransaction;
|
|
4264
|
+
exports.signAllTransactionWithRecipients = signAllTransactionWithRecipients;
|
|
4265
|
+
exports.timelockIDL = timelockIDL_default;
|
|
4266
|
+
exports.topupStreamInstruction = topupStreamInstruction;
|
|
4267
|
+
exports.transferStreamInstruction = transferStreamInstruction;
|
|
4268
|
+
exports.updateStreamInstruction = updateStreamInstruction;
|
|
4269
|
+
exports.withdrawStreamInstruction = withdrawStreamInstruction;
|
|
7614
4270
|
//# sourceMappingURL=index.cjs.map
|
|
7615
4271
|
//# sourceMappingURL=index.cjs.map
|